Skip to content

Check*: Add option to pass link directories into checks

Alex Overchenko requested to merge AJIOB/cmake:pass-link-directories into master

It's suitable for checking something on Windows platforms with MSVC compiler.

The cl.exe knows the libraries to link with from the #pragma comment(lib, "<libname>"), and this is periodically used inside the system libraries (such as Windows SDK, MFC, ATL and so on).

If you're using Ninja generator outside the vcvarsXXX.bat call, you need to pass the link directories via link_direcories() or target_link_directories() call.

With this PR, we can also pass directories to the try_compile() and try_run() function wrappers, such as check_c_compiler_flag(), check_cxx_symbol_exists() and so on.

This PR introduces policy CMP0175 for that improvement.

Edited by Alex Overchenko

Merge request reports

Loading