1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 22:37:30 +08:00

Clang: Support WIN32_EXECUTABLE

Fixes #21613.
This commit is contained in:
Raul Tambre
2020-12-23 12:39:09 +02:00
parent 8c9c338e5e
commit acfb54bb2f
2 changed files with 7 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
clang-win32-subsystem
---------------------
* :prop_tgt:`WIN32_EXECUTABLE` now works on Windows with Clang.

View File

@@ -71,6 +71,9 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_${lang}_LINK_EXECUTABLE
"<CMAKE_${lang}_COMPILER> -fuse-ld=lld-link -nostartfiles -nostdlib <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
set(CMAKE_CREATE_WIN32_EXE "-Xlinker /subsystem:windows")
set(CMAKE_CREATE_CONSOLE_EXE "-Xlinker /subsystem:console")
if(NOT "${lang}" STREQUAL "ASM")
set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -Xclang -flto-visibility-public-std -D_MT -Xclang --dependent-lib=libcmt)
set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -D_DLL -D_MT -Xclang --dependent-lib=msvcrt)