Make sure that windows libraries contain the suffixes expected by clang.
This is expecially important when compiling the windows builtins with
clang, as cmake will use .a as the suffix by default.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I question if this is correct. When targeting Windows CMAKE_STATIC_LIBRARY_SUFFIX should be ".lib" by default, unless you're targeting MinGW or Cygwin, in which case it is ".a".
Is this not what you're experiencing?
The problem comes when we use clang and not MSVC, and the gcc driver in clang is used, which adds the .a suffix instead of the .lib suffix by default.
(cmake:Modules/Platform/Windows-Clang.cmake)
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") include(Platform/Windows-MSVC) macro(__windows_compiler_clang lang) __windows_compiler_msvc(${lang}) endmacro() else() include(Platform/Windows-GNU) macro(__windows_compiler_clang lang) __windows_compiler_gnu(${lang}) endmacro() endif()
I'll update the patch to check for CMAKE_SYSTEM_NAME=Windows instead of WIN32 to avoid breaking MinGW and Cygwin.
I sent a message to the cmake developer list to ask about using the correct suffixes by default when using the GNU driver in clang to target MSVCRT. For now, I'll go ahead and merge this patch, and hope that we can remove it if cmake adds proper support in the future.