Xcode generator: `try_compile` takes compile flags from `add_compile_options`, but not link flags from `add_link_options`, even after "CMP0056 NEW"
For finding Boost's thread
(and its dependent) library, a try_compile
test is performed, [1]
The compile flags set via add_compile_options
are passed to the test correctly.
but the linker flags set via add_link_options
are not. So there's a mismatch, and
the test fails.
This can be seen by adding -fsanitize=address
to both compiler and linker options, and
then using find_package(Boost COMPONENTS thread)
.
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Could NOT find Threads (missing: Threads_FOUND)
clang 11, Xcode 10.3, Cmake 3.16
[1] https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindThreads.cmake#L114
Edited by TY