summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2020-01-26 20:00:01 (GMT)
committerBrad King <brad.king@kitware.com>2020-01-31 19:37:34 (GMT)
commit6348ffb9e55c5e84b9bc65d4d97a2f6b6f016edc (patch)
treee48bb3fcb447c5144133620403b99afff252dad3
parent371e9e48a4186f41354938b0b805a351857c78a0 (diff)
downloadCMake-6348ffb9e55c5e84b9bc65d4d97a2f6b6f016edc.zip
CMake-6348ffb9e55c5e84b9bc65d4d97a2f6b6f016edc.tar.gz
CMake-6348ffb9e55c5e84b9bc65d4d97a2f6b6f016edc.tar.bz2
ASM: Hook up Windows-specific GNU/Clang compiler information modules
This allows building .s/.S assembly code, and makes sure that the `-fPIC` option isn't passed to the compiler (as it errors out on Clang and causes a loud warning on GCC).
-rw-r--r--Modules/Platform/Windows-Clang-ASM.cmake2
-rw-r--r--Modules/Platform/Windows-Clang.cmake36
-rw-r--r--Modules/Platform/Windows-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/WindowsPhone-Clang-ASM.cmake1
-rw-r--r--Modules/Platform/WindowsPhone-GNU-ASM.cmake1
-rw-r--r--Modules/Platform/WindowsStore-Clang-ASM.cmake1
-rw-r--r--Modules/Platform/WindowsStore-GNU-ASM.cmake1
7 files changed, 28 insertions, 16 deletions
diff --git a/Modules/Platform/Windows-Clang-ASM.cmake b/Modules/Platform/Windows-Clang-ASM.cmake
new file mode 100644
index 0000000..345d77d
--- /dev/null
+++ b/Modules/Platform/Windows-Clang-ASM.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-Clang)
+__windows_compiler_clang(ASM)
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index c17cf6d..5eddd04 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -21,7 +21,9 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
set(CMAKE_SHARED_MODULE_SUFFIX ".dll")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
- set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <OBJECT> -MF <DEPFILE>")
+ if(NOT "${lang}" STREQUAL "ASM")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <OBJECT> -MF <DEPFILE>")
+ endif()
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib")
@@ -61,23 +63,25 @@ 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_${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)
- set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -D_DEBUG -Xclang -flto-visibility-public-std -D_MT -Xclang --dependent-lib=libcmtd)
- set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd)
+ 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)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -D_DEBUG -Xclang -flto-visibility-public-std -D_MT -Xclang --dependent-lib=libcmtd)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd)
- if(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT)
- set(__ADDED_FLAGS "")
- set(__ADDED_FLAGS_DEBUG "")
- else()
- set(__ADDED_FLAGS_DEBUG "-D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd")
- set(__ADDED_FLAGS "-D_DLL -D_MT -Xclang --dependent-lib=msvcrt")
- endif()
+ if(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT)
+ set(__ADDED_FLAGS "")
+ set(__ADDED_FLAGS_DEBUG "")
+ else()
+ set(__ADDED_FLAGS_DEBUG "-D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd")
+ set(__ADDED_FLAGS "-D_DLL -D_MT -Xclang --dependent-lib=msvcrt")
+ endif()
- string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -Xclang -gcodeview -O0 ${__ADDED_FLAGS_DEBUG}")
- string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG ${__ADDED_FLAGS}")
- string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG ${__ADDED_FLAGS}")
- string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG -Xclang -gcodeview ${__ADDED_FLAGS}")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -Xclang -gcodeview -O0 ${__ADDED_FLAGS_DEBUG}")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG ${__ADDED_FLAGS}")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG ${__ADDED_FLAGS}")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG -Xclang -gcodeview ${__ADDED_FLAGS}")
+ endif()
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
set(CMAKE_PCH_EXTENSION .pch)
diff --git a/Modules/Platform/Windows-GNU-ASM.cmake b/Modules/Platform/Windows-GNU-ASM.cmake
new file mode 100644
index 0000000..8600892
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-ASM.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-GNU)
+__windows_compiler_gnu(ASM)
diff --git a/Modules/Platform/WindowsPhone-Clang-ASM.cmake b/Modules/Platform/WindowsPhone-Clang-ASM.cmake
new file mode 100644
index 0000000..94f4ca7
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-Clang-ASM.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-Clang-ASM)
diff --git a/Modules/Platform/WindowsPhone-GNU-ASM.cmake b/Modules/Platform/WindowsPhone-GNU-ASM.cmake
new file mode 100644
index 0000000..140eea7
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-GNU-ASM.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-GNU-ASM)
diff --git a/Modules/Platform/WindowsStore-Clang-ASM.cmake b/Modules/Platform/WindowsStore-Clang-ASM.cmake
new file mode 100644
index 0000000..94f4ca7
--- /dev/null
+++ b/Modules/Platform/WindowsStore-Clang-ASM.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-Clang-ASM)
diff --git a/Modules/Platform/WindowsStore-GNU-ASM.cmake b/Modules/Platform/WindowsStore-GNU-ASM.cmake
new file mode 100644
index 0000000..140eea7
--- /dev/null
+++ b/Modules/Platform/WindowsStore-GNU-ASM.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-GNU-ASM)