summaryrefslogtreecommitdiffstats
path: root/Modules/Platform
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-04 14:13:08 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-04 17:39:22 (GMT)
commit3d8356d486ae736d1ba151aedfeb928222e7a084 (patch)
treeca7a5aefdaac1f61bb04c96a11095642d5f7dbc3 /Modules/Platform
parent51ab85c398319c074200ca51f37baa0e4c47ed7c (diff)
downloadCMake-3d8356d486ae736d1ba151aedfeb928222e7a084.zip
CMake-3d8356d486ae736d1ba151aedfeb928222e7a084.tar.gz
CMake-3d8356d486ae736d1ba151aedfeb928222e7a084.tar.bz2
Clang: Support Windows variants for GNU and MSVC (#13035, #14458)
Teach the compiler identification preprocessor tests to report when Clang simulates MSVC, and what version. If not MSVC, assume GNU. Teach compiler information modules Clang-(C|CXX) to recognize when Clang simulates MSVC and skip loading the GNU information. Teach the Windows-MSVC platform information to recognize when it is loaded as the simulated compiler and use that version information instead of the real compiler's (different) version scheme. Add platform modules Windows-Clang-(C|CXX) and support module Windows-Clang to load either Windows-MSVC or Windows-GNU and wrap the corresponding information macros.
Diffstat (limited to 'Modules/Platform')
-rw-r--r--Modules/Platform/Windows-Clang-C.cmake2
-rw-r--r--Modules/Platform/Windows-Clang-CXX.cmake2
-rw-r--r--Modules/Platform/Windows-Clang.cmake32
-rw-r--r--Modules/Platform/Windows-MSVC.cmake8
4 files changed, 42 insertions, 2 deletions
diff --git a/Modules/Platform/Windows-Clang-C.cmake b/Modules/Platform/Windows-Clang-C.cmake
new file mode 100644
index 0000000..d007105
--- /dev/null
+++ b/Modules/Platform/Windows-Clang-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-Clang)
+__windows_compiler_clang(C)
diff --git a/Modules/Platform/Windows-Clang-CXX.cmake b/Modules/Platform/Windows-Clang-CXX.cmake
new file mode 100644
index 0000000..2c3688a
--- /dev/null
+++ b/Modules/Platform/Windows-Clang-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-Clang)
+__windows_compiler_clang(CXX)
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
new file mode 100644
index 0000000..4c936fe
--- /dev/null
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -0,0 +1,32 @@
+
+#=============================================================================
+# Copyright 2001-2013 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__WINDOWS_CLANG)
+ return()
+endif()
+set(__WINDOWS_CLANG 1)
+
+if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC"
+ OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+ 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()
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 7036ba0..a2cfe33 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -65,7 +65,11 @@ else()
endif()
if(NOT MSVC_VERSION)
- if(CMAKE_C_COMPILER_VERSION)
+ if(CMAKE_C_SIMULATE_VERSION)
+ set(_compiler_version ${CMAKE_C_SIMULATE_VERSION})
+ elseif(CMAKE_CXX_SIMULATE_VERSION)
+ set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION})
+ elseif(CMAKE_C_COMPILER_VERSION)
set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
else()
set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
@@ -220,7 +224,7 @@ set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INI
set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
macro(__windows_compiler_msvc lang)
- if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" VERSION_LESS 14)
+ if(NOT MSVC_VERSION LESS 1400)
# for 2005 make sure the manifest is put in the dll with mt
set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll ")
set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ")