summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2020-12-23 10:39:09 (GMT)
committerRaul Tambre <raul@tambre.ee>2020-12-23 10:39:09 (GMT)
commitacfb54bb2f07072fab4adaa365fd7bdcdf83468a (patch)
tree1371f31afd53879f4cbee97f3d59ed76ed7c1e7a
parent8c9c338e5e297020df0b5cdf9443beef245513de (diff)
downloadCMake-acfb54bb2f07072fab4adaa365fd7bdcdf83468a.zip
CMake-acfb54bb2f07072fab4adaa365fd7bdcdf83468a.tar.gz
CMake-acfb54bb2f07072fab4adaa365fd7bdcdf83468a.tar.bz2
Clang: Support WIN32_EXECUTABLE
Fixes #21613.
-rw-r--r--Help/release/dev/clang-win32-subsystem.rst4
-rw-r--r--Modules/Platform/Windows-Clang.cmake3
2 files changed, 7 insertions, 0 deletions
diff --git a/Help/release/dev/clang-win32-subsystem.rst b/Help/release/dev/clang-win32-subsystem.rst
new file mode 100644
index 0000000..c970f53
--- /dev/null
+++ b/Help/release/dev/clang-win32-subsystem.rst
@@ -0,0 +1,4 @@
+clang-win32-subsystem
+---------------------
+
+* :prop_tgt:`WIN32_EXECUTABLE` now works on Windows with Clang.
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index 51e9e81..dc41572 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -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)