Document more clearly that check_linker_flag will only check linker flags used for statically linking
I wanted to check that the dynamic linker that the compiler will use supports flags like --thinlto-jobs=8
, and other such flags that aren't uniformly supported by all linkers on a linux system.
This function looks like it does what I want: https://cmake.org/cmake/help/latest/module/CheckLinkerFlag.html
Much to my surprise, check_linker_flag
is directly invoking the static library archiver (e.g. llvm-ar), based on the output from --debug-trycompile
The documentation for check_linker_flag
should be enhanced to more clearly indicate what the function does. Simply saying "It invokes check_source_compiles()" isn't enough to let a developer using CMake quickly understand what the function will actually do.