CMAKE_{C,CXX}_COMPILER_TARGET not honoured for clang on Windows
Setting CMAKE_{lang}_COMPILER_TARGET
should append --target=${CMAKE_{lang}_COMPILER_TARGET}
to the compile line when using either clang (LLVM GNU frontend) or clang-cl (LLVM MSVC frontend) on Windows.
I saw that a recent change -- !5058 (merged) -- addresses this in an unreleased CMake version, but I don't think it's quite complete. That MR:
- only sets
CMAKE_${lang}_COMPILE_OPTIONS_TARGET
to"--target="
when using the MSVC frontend (clang-cl). It would be useful to set this for the GNU frontend (clang) also. - has a small typo in CMakeDetermineCXXCompiler.cmake that sets
CMAKE_CXX_COPMILER_ID_TEST_FLAGS
instead ofCMAKE_CXX_COMPILER_ID_TEST_FLAGS
, which prevents the--target
flag being added during C++ compiler detection.