summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeCCompiler.cmake.in2
-rw-r--r--Modules/CMakeCCompilerId.c.in22
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in2
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in22
-rw-r--r--Modules/CMakeCheckCompilerFlagCommonPatterns.cmake41
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake21
-rw-r--r--Modules/CMakeFindBinUtils.cmake6
-rw-r--r--Modules/CMakePlatformId.h.in18
-rw-r--r--Modules/CheckCCompilerFlag.cmake16
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake19
-rw-r--r--Modules/CheckStructHasMember.cmake35
-rw-r--r--Modules/Compiler/AppleClang-ASM.cmake1
-rw-r--r--Modules/Compiler/AppleClang-C.cmake1
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake1
-rw-r--r--Modules/Compiler/Clang-CXX.cmake4
-rw-r--r--Modules/Compiler/Clang.cmake20
-rw-r--r--Modules/FindGTK2.cmake375
-rw-r--r--Modules/FindLua51.cmake2
-rw-r--r--Modules/FindSDL.cmake4
-rw-r--r--Modules/Platform/Darwin-AppleClang-C.cmake1
-rw-r--r--Modules/Platform/Darwin-AppleClang-CXX.cmake1
-rw-r--r--Modules/Platform/Haiku.cmake127
-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
26 files changed, 621 insertions, 164 deletions
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index c41adc956b..3e8d4ff140 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -3,6 +3,8 @@ set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@")
set(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
+set(CMAKE_C_SIMULATE_ID "@CMAKE_C_SIMULATE_ID@")
+set(CMAKE_C_SIMULATE_VERSION "@CMAKE_C_SIMULATE_VERSION@")
@SET_MSVC_C_ARCHITECTURE_ID@
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 66a5582650..6dde1c3b23 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -29,10 +29,21 @@
# endif
#elif defined(__clang__)
-# define COMPILER_ID "Clang"
+# if defined(__apple_build_version__)
+# define COMPILER_ID "AppleClang"
+# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
+# else
+# define COMPILER_ID "Clang"
+# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+# define SIMULATE_ID "MSVC"
+ /* _MSC_VER = VVRR */
+# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# define COMPILER_ID "Embarcadero"
@@ -206,6 +217,9 @@
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+#ifdef SIMULATE_ID
+char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
+#endif
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
@@ -223,6 +237,12 @@ int main(int argc, char* argv[])
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
+#ifdef SIMULATE_ID
+ require += info_simulate[argc];
+#endif
+#ifdef SIMULATE_VERSION_MAJOR
+ require += info_simulate_version[argc];
+#endif
(void)argv;
return require;
}
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 9287b81945..777f007ba7 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -3,6 +3,8 @@ set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@")
set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
+set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@")
+set(CMAKE_CXX_SIMULATE_VERSION "@CMAKE_CXX_SIMULATE_VERSION@")
@SET_MSVC_CXX_ARCHITECTURE_ID@
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 5e87715c03..3a60922424 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -34,10 +34,21 @@
# endif
#elif defined(__clang__)
-# define COMPILER_ID "Clang"
+# if defined(__apple_build_version__)
+# define COMPILER_ID "AppleClang"
+# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
+# else
+# define COMPILER_ID "Clang"
+# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+# define SIMULATE_ID "MSVC"
+ /* _MSC_VER = VVRR */
+# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# define COMPILER_ID "Embarcadero"
@@ -199,6 +210,9 @@
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+#ifdef SIMULATE_ID
+char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
+#endif
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
@@ -212,6 +226,12 @@ int main(int argc, char* argv[])
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
+#ifdef SIMULATE_ID
+ require += info_simulate[argc];
+#endif
+#ifdef SIMULATE_VERSION_MAJOR
+ require += info_simulate_version[argc];
+#endif
(void)argv;
return require;
}
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
new file mode 100644
index 0000000000..9d8ba9ed56
--- /dev/null
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -0,0 +1,41 @@
+
+#=============================================================================
+# Copyright 2006-2011 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2011 Matthias Kretz <kretz@kde.org>
+# Copyright 2013 Rolf Eike Beer <eike@sf-mail.de>
+#
+# 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.)
+
+# Do NOT include this module directly into any of your code. It is meant as
+# a library for Check*CompilerFlag.cmake modules. It's content may change in
+# any way between releases.
+
+macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
+ set(${_VAR}
+ FAIL_REGEX "unrecognized .*option" # GNU
+ FAIL_REGEX "unknown .*option" # Clang
+ FAIL_REGEX "ignoring unknown option" # MSVC
+ FAIL_REGEX "warning D9002" # MSVC, any lang
+ FAIL_REGEX "option.*not supported" # Intel
+ FAIL_REGEX "invalid argument .*option" # Intel
+ FAIL_REGEX "ignoring option .*argument required" # Intel
+ FAIL_REGEX "[Uu]nknown option" # HP
+ FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
+ FAIL_REGEX "command option .* is not recognized" # XL
+ FAIL_REGEX "command option .* contains an incorrect subargument" # XL
+ FAIL_REGEX "not supported in this configuration; ignored" # AIX
+ FAIL_REGEX "File with unknown suffix passed to linker" # PGI
+ FAIL_REGEX "WARNING: unknown flag:" # Open64
+ FAIL_REGEX "Incorrect command line option:" # Borland
+ FAIL_REGEX "Warning: illegal option" # SunStudio 12
+ )
+endmacro ()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index da955cbcc6..de4a88205b 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -80,6 +80,8 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
endfunction()
#-----------------------------------------------------------------------------
@@ -309,9 +311,12 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(COMPILER_ID)
set(COMPILER_VERSION)
set(PLATFORM_ID)
+ set(ARCHITECTURE_ID)
+ set(SIMULATE_ID)
+ set(SIMULATE_VERSION)
file(STRINGS ${file}
- CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 4 REGEX "INFO:")
- set(HAVE_COMPILER_TWICE 0)
+ CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:")
+ set(COMPILER_ID_TWICE)
foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
if("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*")
if(COMPILER_ID)
@@ -333,6 +338,14 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${COMPILER_VERSION}")
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
endif()
+ if("${info}" MATCHES ".*INFO:simulate\\[([^]\"]*)\\].*")
+ set(SIMULATE_ID "${CMAKE_MATCH_1}")
+ endif()
+ if("${info}" MATCHES ".*INFO:simulate_version\\[([^]\"]*)\\].*")
+ set(SIMULATE_VERSION "${CMAKE_MATCH_1}")
+ string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${SIMULATE_VERSION}")
+ string(REGEX REPLACE "\\.0+([0-9])" ".\\1" SIMULATE_VERSION "${SIMULATE_VERSION}")
+ endif()
endforeach()
# Detect the exact architecture from the PE header.
@@ -370,6 +383,8 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}")
set(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}")
set(CMAKE_${lang}_COMPILER_VERSION "${COMPILER_VERSION}")
+ set(CMAKE_${lang}_SIMULATE_ID "${SIMULATE_ID}")
+ set(CMAKE_${lang}_SIMULATE_VERSION "${SIMULATE_VERSION}")
endif()
# Check the compiler identification string.
@@ -418,6 +433,8 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE)
endfunction()
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index e70c013beb..b4e2ae5448 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -30,8 +30,10 @@
# License text for the above reference.)
# if it's the MS C/CXX compiler, search for link
-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
- OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
+if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC"
+ OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC"
+ OR "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC"
+ OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"
OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index 69171c2a3c..1e41fec6bd 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -151,6 +151,24 @@ char const info_version[] = {
']','\0'};
#endif
+/* Construct a string literal encoding the version number components. */
+#ifdef SIMULATE_VERSION_MAJOR
+char const info_simulate_version[] = {
+ 'I', 'N', 'F', 'O', ':',
+ 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
+ SIMULATE_VERSION_MAJOR,
+# ifdef SIMULATE_VERSION_MINOR
+ '.', SIMULATE_VERSION_MINOR,
+# ifdef SIMULATE_VERSION_PATCH
+ '.', SIMULATE_VERSION_PATCH,
+# ifdef SIMULATE_VERSION_TWEAK
+ '.', SIMULATE_VERSION_TWEAK,
+# endif
+# endif
+# endif
+ ']','\0'};
+#endif
+
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index bc15e9a0b7..dab57108ea 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -26,36 +26,30 @@
# License text for the above reference.)
include(CheckCSourceCompiles)
+include(CMakeCheckCompilerFlagCommonPatterns)
macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+
# Normalize locale during test compilation.
set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
foreach(v ${_CheckCCompilerFlag_LOCALE_VARS})
set(_CheckCCompilerFlag_SAVED_${v} "$ENV{${v}}")
set(ENV{${v}} C)
endforeach()
+ CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCCompilerFlag_COMMON_PATTERNS)
CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT}
# Some compilers do not fail with a bad flag
FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU
- FAIL_REGEX "unrecognized .*option" # GNU
- FAIL_REGEX "unknown .*option" # Clang
- FAIL_REGEX "ignoring unknown option" # MSVC
- FAIL_REGEX "warning D9002" # MSVC, any lang
- FAIL_REGEX "option.*not supported" # Intel
- FAIL_REGEX "invalid argument .*option" # Intel
- FAIL_REGEX "ignoring option .*argument required" # Intel
- FAIL_REGEX "[Uu]nknown option" # HP
- FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
- FAIL_REGEX "command option .* is not recognized" # XL
- FAIL_REGEX "WARNING: unknown flag:" # Open64
+ ${_CheckCCompilerFlag_COMMON_PATTERNS}
)
foreach(v ${_CheckCCompilerFlag_LOCALE_VARS})
set(ENV{${v}} ${_CheckCCompilerFlag_SAVED_${v}})
unset(_CheckCCompilerFlag_SAVED_${v})
endforeach()
unset(_CheckCCompilerFlag_LOCALE_VARS)
+ unset(_CheckCCompilerFlag_COMMON_PATTERNS)
set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
endmacro ()
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
index eee3a701e0..4435a1f4c9 100644
--- a/Modules/CheckCXXCompilerFlag.cmake
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -26,6 +26,7 @@
# License text for the above reference.)
include(CheckCXXSourceCompiles)
+include(CMakeCheckCompilerFlagCommonPatterns)
macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
@@ -37,28 +38,18 @@ macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
set(_CheckCXXCompilerFlag_SAVED_${v} "$ENV{${v}}")
set(ENV{${v}} C)
endforeach()
- CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}
+ CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCXXCompilerFlag_COMMON_PATTERNS)
+ CHECK_CXX_SOURCE_COMPILES("int main() { return 0; }" ${_RESULT}
# Some compilers do not fail with a bad flag
FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU
- FAIL_REGEX "unrecognized .*option" # GNU
- FAIL_REGEX "unknown .*option" # Clang
- FAIL_REGEX "ignoring unknown option" # MSVC
- FAIL_REGEX "warning D9002" # MSVC, any lang
- FAIL_REGEX "option.*not supported" # Intel
- FAIL_REGEX "invalid argument .*option" # Intel
- FAIL_REGEX "ignoring option .*argument required" # Intel
- FAIL_REGEX "[Uu]nknown option" # HP
- FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
- FAIL_REGEX "command option .* is not recognized" # XL
- FAIL_REGEX "not supported in this configuration; ignored" # AIX
- FAIL_REGEX "File with unknown suffix passed to linker" # PGI
- FAIL_REGEX "WARNING: unknown flag:" # Open64
+ ${_CheckCXXCompilerFlag_COMMON_PATTERNS}
)
foreach(v ${_CheckCXXCompilerFlag_LOCALE_VARS})
set(ENV{${v}} ${_CheckCXXCompilerFlag_SAVED_${v}})
unset(_CheckCXXCompilerFlag_SAVED_${v})
endforeach()
unset(_CheckCXXCompilerFlag_LOCALE_VARS)
+ unset(_CheckCXXCompilerFlag_COMMON_PATTERNS)
set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
endmacro ()
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index ea2891c8b1..d28cc2a1e1 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -1,10 +1,12 @@
# - Check if the given struct or class has the specified member variable
-# CHECK_STRUCT_HAS_MEMBER (STRUCT MEMBER HEADER VARIABLE)
+# CHECK_STRUCT_HAS_MEMBER (<struct> <member> <header> <variable>
+# [LANGUAGE <language>])
#
-# STRUCT - the name of the struct or class you are interested in
-# MEMBER - the member which existence you want to check
-# HEADER - the header(s) where the prototype should be declared
-# VARIABLE - variable to store the result
+# <struct> - the name of the struct or class you are interested in
+# <member> - the member which existence you want to check
+# <header> - the header(s) where the prototype should be declared
+# <variable> - variable to store the result
+# <language> - the compiler to use (C or CXX)
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
@@ -12,8 +14,9 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
#
-# Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC)
+# Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC LANGUAGE C)
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -29,6 +32,7 @@
# License text for the above reference.)
include(CheckCSourceCompiles)
+include(CheckCXXSourceCompiles)
macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
set(_INCLUDE_FILES)
@@ -36,16 +40,29 @@ macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
set(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
endforeach ()
+ if("x${ARGN}" STREQUAL "x")
+ set(_lang C)
+ elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$")
+ set(_lang "${CMAKE_MATCH_1}")
+ else()
+ message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n")
+ endif()
+
set(_CHECK_STRUCT_MEMBER_SOURCE_CODE "
${_INCLUDE_FILES}
int main()
{
${_STRUCT}* tmp;
tmp->${_MEMBER};
- return 0;
+ return 0;
}
")
- CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+ if("${_lang}" STREQUAL "C")
+ CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+ elseif("${_lang}" STREQUAL "CXX")
+ CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+ else()
+ message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n")
+ endif()
endmacro ()
-
diff --git a/Modules/Compiler/AppleClang-ASM.cmake b/Modules/Compiler/AppleClang-ASM.cmake
new file mode 100644
index 0000000000..f52bde05eb
--- /dev/null
+++ b/Modules/Compiler/AppleClang-ASM.cmake
@@ -0,0 +1 @@
+include(Compiler/Clang-ASM)
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
new file mode 100644
index 0000000000..44070b83fe
--- /dev/null
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -0,0 +1 @@
+include(Compiler/Clang-C)
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
new file mode 100644
index 0000000000..680f7208e4
--- /dev/null
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -0,0 +1 @@
+include(Compiler/Clang-CXX)
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 972d889aa6..0372e18b10 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -1,4 +1,6 @@
include(Compiler/Clang)
__compiler_clang(CXX)
-set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+ set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+endif()
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index ec4562a3db..7d7be5c4b7 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -18,11 +18,17 @@ if(__COMPILER_CLANG)
endif()
set(__COMPILER_CLANG 1)
-include(Compiler/GNU)
+if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC"
+ OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+ macro(__compiler_clang lang)
+ endmacro()
+else()
+ include(Compiler/GNU)
-macro(__compiler_clang lang)
- __compiler_gnu(${lang})
- set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
- set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
- set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
-endmacro()
+ macro(__compiler_clang lang)
+ __compiler_gnu(${lang})
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+ endmacro()
+endif()
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 77aac6dae6..9d8c41b30d 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -66,7 +66,10 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-# Version 1.5 (UNRELEASED) (CMake 2.8.12)
+# Version 1.6 (CMake 2.8.13)
+# * Create targets for each library
+# * Do not link libfreetype
+# Version 1.5 (CMake 2.8.12)
# * 14236: Detect gthread library
# Detect pangocairo on windows
# Detect pangocairo with gtk module instead of with gtkmm
@@ -130,6 +133,7 @@
#=============================================================
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr)
file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+")
@@ -214,7 +218,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
message(STATUS "Adding ${_gtk2_arch_dir} to search path for multiarch support")
endif()
endif()
- find_path(${_var}_INCLUDE_DIR ${_hdr}
+ find_path(GTK2_${_var}_INCLUDE_DIR ${_hdr}
PATHS
${_gtk2_arch_dir}
/usr/local/lib64
@@ -240,9 +244,10 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
PATH_SUFFIXES
${_suffixes}
)
+ mark_as_advanced(GTK2_${_var}_INCLUDE_DIR)
- if(${_var}_INCLUDE_DIR)
- set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${${_var}_INCLUDE_DIR} PARENT_SCOPE)
+ if(GTK2_${_var}_INCLUDE_DIR)
+ set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${GTK2_${_var}_INCLUDE_DIR} PARENT_SCOPE)
endif()
endfunction()
@@ -332,10 +337,10 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version)
if(GTK2_DEBUG)
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
- "While searching for ${_var}_LIBRARY, our proposed library list is ${_lib_list}")
+ "While searching for GTK2_${_var}_LIBRARY, our proposed library list is ${_lib_list}")
endif()
- find_library(${_var}_LIBRARY_RELEASE
+ find_library(GTK2_${_var}_LIBRARY_RELEASE
NAMES ${_lib_list}
PATHS
/opt/gnome/lib
@@ -349,10 +354,10 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version)
if(_expand_vc AND MSVC)
if(GTK2_DEBUG)
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
- "While searching for ${_var}_LIBRARY_DEBUG our proposed library list is ${_libd_list}")
+ "While searching for GTK2_${_var}_LIBRARY_DEBUG our proposed library list is ${_libd_list}")
endif()
- find_library(${_var}_LIBRARY_DEBUG
+ find_library(GTK2_${_var}_LIBRARY_DEBUG
NAMES ${_libd_list}
PATHS
$ENV{GTKMM_BASEPATH}/lib
@@ -361,24 +366,148 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version)
)
endif()
- select_library_configurations(${_var})
+ select_library_configurations(GTK2_${_var})
- set(${_var}_LIBRARY ${${_var}_LIBRARY} PARENT_SCOPE)
+ set(GTK2_${_var}_LIBRARY ${GTK2_${_var}_LIBRARY} PARENT_SCOPE)
+ set(GTK2_${_var}_FOUND ${GTK2_${_var}_FOUND} PARENT_SCOPE)
- set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${${_var}_LIBRARY})
- set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE)
+ if(GTK2_${_var}_FOUND)
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${GTK2_${_var}_LIBRARY})
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE)
+ endif()
if(GTK2_DEBUG)
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
- "${_var}_LIBRARY_RELEASE = \"${${_var}_LIBRARY_RELEASE}\"")
+ "GTK2_${_var}_LIBRARY_RELEASE = \"${GTK2_${_var}_LIBRARY_RELEASE}\"")
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "GTK2_${_var}_LIBRARY_DEBUG = \"${GTK2_${_var}_LIBRARY_DEBUG}\"")
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
- "${_var}_LIBRARY_DEBUG = \"${${_var}_LIBRARY_DEBUG}\"")
+ "GTK2_${_var}_LIBRARY = \"${GTK2_${_var}_LIBRARY}\"")
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
- "${_var}_LIBRARY = \"${${_var}_LIBRARY}\"")
+ "GTK2_${_var}_FOUND = \"${GTK2_${_var}_FOUND}\"")
+ endif()
+
+endfunction()
+
+
+function(_GTK2_ADD_TARGET_DEPENDS_INTERNAL _var _property)
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_ADD_TARGET_DEPENDS_INTERNAL( ${_var} ${_property} )")
+ endif()
+
+ string(TOLOWER "${_var}" _basename)
+
+ if (TARGET GTK2::${_basename})
+ foreach(_depend ${ARGN})
+ set(_valid_depends)
+ if (TARGET GTK2::${_depend})
+ list(APPEND _valid_depends GTK2::${_depend})
+ endif()
+ if (_valid_depends)
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY ${_property} "${_valid_depends}")
+ endif()
+ set(_valid_depends)
+ endforeach()
+ endif()
+endfunction()
+
+function(_GTK2_ADD_TARGET_DEPENDS _var)
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_ADD_TARGET_DEPENDS( ${_var} )")
+ endif()
+
+ string(TOLOWER "${_var}" _basename)
+
+ if(TARGET GTK2::${_basename})
+ get_target_property(_configs GTK2::${_basename} IMPORTED_CONFIGURATIONS)
+ _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} INTERFACE_LINK_LIBRARIES ${ARGN})
+ foreach(_config ${_configs})
+ _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN})
+ endforeach()
+ endif()
+endfunction()
+
+function(_GTK2_ADD_TARGET_INCLUDE_DIRS _var)
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_ADD_TARGET_INCLUDE_DIRS( ${_var} )")
+ endif()
+
+ string(TOLOWER "${_var}" _basename)
+
+ if(TARGET GTK2::${_basename})
+ foreach(_include ${ARGN})
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}")
+ endforeach()
+ endif()
+endfunction()
+
+#=============================================================
+# _GTK2_ADD_TARGET
+# Internal function to create targets for GTK2
+# _var = target to create
+#=============================================================
+function(_GTK2_ADD_TARGET _var)
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_ADD_TARGET( ${_var} )")
endif()
+ string(TOLOWER "${_var}" _basename)
+
+ cmake_parse_arguments(_${_var} "" "" "GTK2_DEPENDS;GTK2_OPTIONAL_DEPENDS;OPTIONAL_INCLUDES" ${ARGN})
+
+ if(GTK2_${_var}_FOUND AND NOT TARGET GTK2::${_basename})
+ # Do not create the target if dependencies are missing
+ foreach(_dep ${_${_var}_GTK2_DEPENDS})
+ if(NOT TARGET GTK2::${_dep})
+ return()
+ endif()
+ endforeach()
+
+ add_library(GTK2::${_basename} UNKNOWN IMPORTED)
+
+ if(GTK2_${_var}_LIBRARY_RELEASE)
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" )
+ endif()
+
+ if(GTK2_${_var}_LIBRARY_DEBUG)
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" )
+ endif()
+
+ if(GTK2_${_var}_INCLUDE_DIR)
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}")
+ endif()
+
+ if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "GTK2_${_var}_INCLUDE_DIR")
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}")
+ endif()
+
+ if(GTK2_DEFINITIONS)
+ set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}")
+ endif()
+
+ if(_${_var}_GTK2_DEPENDS)
+ _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS} ${_${_var}_GTK2_OPTIONAL_DEPENDS})
+ endif()
+
+ if(_${_var}_OPTIONAL_INCLUDES)
+ _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_${_var}_OPTIONAL_INCLUDES})
+ endif()
+
+ if(GTK2_USE_IMPORTED_TARGETS)
+ set(GTK2_${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE)
+ endif()
+
+ endif()
endfunction()
+
+
#=============================================================
#
@@ -405,7 +534,7 @@ if(GTK2_FIND_VERSION)
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"Searching for version ${GTK2_FIND_VERSION}")
endif()
- _GTK2_FIND_INCLUDE_DIR(GTK2_GTK gtk/gtk.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK gtk/gtk.h)
if(GTK2_GTK_INCLUDE_DIR)
_GTK2_GET_VERSION(GTK2_MAJOR_VERSION
GTK2_MINOR_VERSION
@@ -446,104 +575,162 @@ if(GTK2_FIND_VERSION)
endif()
#
+# On MSVC, according to https://wiki.gnome.org/gtkmm/MSWindows, the /vd2 flag needs to be
+# passed to the compiler in order to use gtkmm
+#
+if(MSVC)
+ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
+ if(_GTK2_component STREQUAL "gtkmm")
+ set(GTK2_DEFINITIONS "/vd2")
+ elseif(_GTK2_component STREQUAL "glademm")
+ set(GTK2_DEFINITIONS "/vd2")
+ endif()
+ endforeach()
+endif()
+
+#
# Find all components
#
-find_package(Freetype)
-list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
-list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES})
+find_package(Freetype QUIET)
+if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
+ list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+endif()
foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
if(_GTK2_component STREQUAL "gtk")
- _GTK2_FIND_INCLUDE_DIR(GTK2_GTK gtk/gtk.h)
-
- if(UNIX)
- _GTK2_FIND_LIBRARY (GTK2_GTK gtk-x11 false true)
- _GTK2_FIND_LIBRARY (GTK2_GDK gdk-x11 false true)
- else()
- _GTK2_FIND_LIBRARY (GTK2_GTK gtk-win32 false true)
- _GTK2_FIND_LIBRARY (GTK2_GDK gdk-win32 false true)
- endif()
+ _GTK2_FIND_INCLUDE_DIR(GLIB glib.h)
+ _GTK2_FIND_INCLUDE_DIR(GLIBCONFIG glibconfig.h)
+ _GTK2_FIND_LIBRARY (GLIB glib false true)
+ _GTK2_ADD_TARGET (GLIB)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GDK gdk/gdk.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG gdkconfig.h)
+ _GTK2_FIND_INCLUDE_DIR(GOBJECT glib-object.h)
+ _GTK2_FIND_LIBRARY (GOBJECT gobject false true)
+ _GTK2_ADD_TARGET (GOBJECT GTK2_DEPENDS glib)
- _GTK2_FIND_INCLUDE_DIR(GTK2_CAIRO cairo.h)
- _GTK2_FIND_LIBRARY (GTK2_CAIRO cairo false false)
+ _GTK2_FIND_INCLUDE_DIR(ATK atk/atk.h)
+ _GTK2_FIND_LIBRARY (ATK atk false true)
+ _GTK2_ADD_TARGET (ATK GTK2_DEPENDS gobject glib)
- _GTK2_FIND_INCLUDE_DIR(GTK2_FONTCONFIG fontconfig/fontconfig.h)
+ _GTK2_FIND_LIBRARY (GIO gio false true)
+ _GTK2_ADD_TARGET (GIO GTK2_DEPENDS gobject glib)
- _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO pango/pango.h)
- _GTK2_FIND_LIBRARY (GTK2_PANGO pango false true)
+ _GTK2_FIND_LIBRARY (GTHREAD gthread false true)
+ _GTK2_ADD_TARGET (GTHREAD GTK2_DEPENDS glib)
- _GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO pangocairo false true)
+ _GTK2_FIND_LIBRARY (GMODULE gmodule false true)
+ _GTK2_ADD_TARGET (GMODULE GTK2_DEPENDS glib)
- _GTK2_FIND_LIBRARY (GTK2_PANGOFT2 pangoft2 false true)
+ _GTK2_FIND_INCLUDE_DIR(GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h)
+ _GTK2_FIND_LIBRARY (GDK_PIXBUF gdk_pixbuf false true)
+ _GTK2_ADD_TARGET (GDK_PIXBUF GTK2_DEPENDS gobject glib)
- _GTK2_FIND_LIBRARY (GTK2_PANGOXFT pangoxft false true)
+ _GTK2_FIND_INCLUDE_DIR(CAIRO cairo.h)
+ _GTK2_FIND_LIBRARY (CAIRO cairo false false)
+ _GTK2_ADD_TARGET (CAIRO)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h)
- _GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF gdk_pixbuf false true)
+ _GTK2_FIND_INCLUDE_DIR(PANGO pango/pango.h)
+ _GTK2_FIND_LIBRARY (PANGO pango false true)
+ _GTK2_ADD_TARGET (PANGO GTK2_DEPENDS gobject glib)
- _GTK2_FIND_LIBRARY (GTK2_GTHREAD gthread false true)
+ _GTK2_FIND_LIBRARY (PANGOCAIRO pangocairo false true)
+ _GTK2_ADD_TARGET (PANGOCAIRO GTK2_DEPENDS pango cairo gobject glib)
- _GTK2_FIND_LIBRARY (GTK2_GMODULE gmodule false true)
+ _GTK2_FIND_LIBRARY (PANGOFT2 pangoft2 false true)
+ _GTK2_ADD_TARGET (PANGOFT2 GTK2_DEPENDS pango gobject glib
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
- _GTK2_FIND_LIBRARY (GTK2_GIO gio false true)
+ _GTK2_FIND_LIBRARY (PANGOXFT pangoxft false true)
+ _GTK2_ADD_TARGET (PANGOXFT GTK2_DEPENDS pangoft2 pango gobject glib
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
- _GTK2_FIND_INCLUDE_DIR(GTK2_ATK atk/atk.h)
- _GTK2_FIND_LIBRARY (GTK2_ATK atk false true)
+ _GTK2_FIND_INCLUDE_DIR(GDK gdk/gdk.h)
+ _GTK2_FIND_INCLUDE_DIR(GDKCONFIG gdkconfig.h)
+ if(UNIX)
+ _GTK2_FIND_LIBRARY (GDK gdk-x11 false true)
+ else()
+ _GTK2_FIND_LIBRARY (GDK gdk-win32 false true)
+ endif()
+ _GTK2_ADD_TARGET (GDK GTK2_DEPENDS pango gdk_pixbuf gobject glib
+ GTK2_OPTIONAL_DEPENDS pangocairo cairo)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT gobject/gobject.h)
- _GTK2_FIND_LIBRARY (GTK2_GOBJECT gobject false true)
+ _GTK2_FIND_INCLUDE_DIR(GTK gtk/gtk.h)
+ if(UNIX)
+ _GTK2_FIND_LIBRARY (GTK gtk-x11 false true)
+ else()
+ _GTK2_FIND_LIBRARY (GTK gtk-win32 false true)
+ endif()
+ _GTK2_ADD_TARGET (GTK GTK2_DEPENDS gdk atk pangoft2 pango gdk_pixbuf gthread gobject glib
+ GTK2_OPTIONAL_DEPENDS gio pangocairo cairo)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB glib.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG glibconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GLIB glib false true)
+ # Left for compatibility with previous versions. It doesn't seem to be required
+ _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h)
elseif(_GTK2_component STREQUAL "gtkmm")
- _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMM gtkmm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMMCONFIG gtkmmconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GTKMM gtkmm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMM gdkmm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMMCONFIG gdkmmconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GDKMM gdkmm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM pangomm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMMCONFIG pangommconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_PANGOMM pangomm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM cairomm/cairomm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMMCONFIG cairommconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_CAIROMM cairomm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMM giomm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMMCONFIG giommconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GIOMM giomm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_ATKMM atkmm.h)
- _GTK2_FIND_LIBRARY (GTK2_ATKMM atkmm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMM glibmm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMMCONFIG glibmmconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GLIBMM glibmm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++ sigc++/sigc++.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++CONFIG sigc++config.h)
- _GTK2_FIND_LIBRARY (GTK2_SIGC++ sigc true true)
+ _GTK2_FIND_INCLUDE_DIR(SIGC++ sigc++/sigc++.h)
+ _GTK2_FIND_INCLUDE_DIR(SIGC++CONFIG sigc++config.h)
+ _GTK2_FIND_LIBRARY (SIGC++ sigc true true)
+ _GTK2_ADD_TARGET (SIGC++)
+
+ _GTK2_FIND_INCLUDE_DIR(GLIBMM glibmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GLIBMMCONFIG glibmmconfig.h)
+ _GTK2_FIND_LIBRARY (GLIBMM glibmm true true)
+ _GTK2_ADD_TARGET (GLIBMM GTK2_DEPENDS gobject sigc++ glib)
+
+ _GTK2_FIND_INCLUDE_DIR(GIOMM giomm.h)
+ _GTK2_FIND_INCLUDE_DIR(GIOMMCONFIG giommconfig.h)
+ _GTK2_FIND_LIBRARY (GIOMM giomm true true)
+ _GTK2_ADD_TARGET (GIOMM GTK2_DEPENDS gio glibmm gobject sigc++ glib)
+
+ _GTK2_FIND_INCLUDE_DIR(ATKMM atkmm.h)
+ _GTK2_FIND_LIBRARY (ATKMM atkmm true true)
+ _GTK2_ADD_TARGET (ATKMM GTK2_DEPENDS atk glibmm gobject sigc++ glib)
+
+ _GTK2_FIND_INCLUDE_DIR(CAIROMM cairomm/cairomm.h)
+ _GTK2_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h)
+ _GTK2_FIND_LIBRARY (CAIROMM cairomm true true)
+ _GTK2_ADD_TARGET (CAIROMM GTK2_DEPENDS cairo sigc++
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+
+ _GTK2_FIND_INCLUDE_DIR(PANGOMM pangomm.h)
+ _GTK2_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h)
+ _GTK2_FIND_LIBRARY (PANGOMM pangomm true true)
+ _GTK2_ADD_TARGET (PANGOMM GTK2_DEPENDS glibmm sigc++ pango gobject glib
+ GTK2_OPTIONAL_DEPENDS cairomm pangocairo cairo
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+
+
+ _GTK2_FIND_INCLUDE_DIR(GDKMM gdkmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h)
+ _GTK2_FIND_LIBRARY (GDKMM gdkmm true true)
+ _GTK2_ADD_TARGET (GDKMM GTK2_DEPENDS pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gobject glib
+ GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+
+ _GTK2_FIND_INCLUDE_DIR(GTKMM gtkmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h)
+ _GTK2_FIND_LIBRARY (GTKMM gtkmm true true)
+ _GTK2_ADD_TARGET (GTKMM GTK2_DEPENDS atkmm gdkmm pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib
+ GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
elseif(_GTK2_component STREQUAL "glade")
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLADE glade/glade.h)
- _GTK2_FIND_LIBRARY (GTK2_GLADE glade false true)
+ _GTK2_FIND_INCLUDE_DIR(GLADE glade/glade.h)
+ _GTK2_FIND_LIBRARY (GLADE glade false true)
+ _GTK2_ADD_TARGET (GLADE GTK2_DEPENDS gtk gdk atk gio pangoft2 gdk_pixbuf pango gobject glib
+ GTK2_OPTIONAL_DEPENDS pangocairo cairo
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
elseif(_GTK2_component STREQUAL "glademm")
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMM libglademm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMMCONFIG libglademmconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GLADEMM glademm true true)
+ _GTK2_FIND_INCLUDE_DIR(GLADEMM libglademm.h)
+ _GTK2_FIND_INCLUDE_DIR(GLADEMMCONFIG libglademmconfig.h)
+ _GTK2_FIND_LIBRARY (GLADEMM glademm true true)
+ _GTK2_ADD_TARGET (GLADEMM GTK2_DEPENDS gtkmm glade atkmm gdkmm giomm pangomm glibmm sigc++ gtk gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib
+ GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
else()
message(FATAL_ERROR "Unknown GTK2 component ${_component}")
@@ -562,20 +749,6 @@ if(NOT GTK2_FIND_VERSION AND GTK2_GTK_INCLUDE_DIR)
endif()
#
-# On MSVC, according to https://wiki.gnome.org/gtkmm/MSWindows, the /vd2 flag needs to be
-# passed to the compiler in order to use gtkmm
-#
-if(MSVC)
- foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
- if(_GTK2_component STREQUAL "gtkmm")
- set(GTK2_DEFINITIONS "/vd2")
- elseif(_GTK2_component STREQUAL "glademm")
- set(GTK2_DEFINITIONS "/vd2")
- endif()
- endforeach()
-endif()
-
-#
# Try to enforce components
#
@@ -586,6 +759,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
string(TOUPPER ${_GTK2_component} _COMPONENT_UPPER)
+ set(GTK2_${_COMPONENT_UPPER}_FIND_QUIETLY ${GTK2_FIND_QUIETLY})
+
if(_GTK2_component STREQUAL "gtk")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found."
GTK2_GTK_LIBRARY
@@ -613,6 +788,8 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
GTK2_GLIBMMCONFIG_INCLUDE_DIR
GTK2_GLIBMM_LIBRARY
+ FREETYPE_INCLUDE_DIR_ft2build
+ FREETYPE_INCLUDE_DIR_freetype2
)
elseif(_GTK2_component STREQUAL "glade")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glade library was not found."
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
index a2bf0c0efa..770e93a1a7 100644
--- a/Modules/FindLua51.cmake
+++ b/Modules/FindLua51.cmake
@@ -54,7 +54,7 @@ find_library(LUA_LIBRARY
if(LUA_LIBRARY)
# include the math library for Unix
- if(UNIX AND NOT APPLE AND NOT BEOS)
+ if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index fec142ed5e..a4f12ba3be 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -70,7 +70,9 @@
find_path(SDL_INCLUDE_DIR SDL.h
HINTS
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL SDL12 SDL11
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
# SDL-1.1 is the name used by FreeBSD ports...
diff --git a/Modules/Platform/Darwin-AppleClang-C.cmake b/Modules/Platform/Darwin-AppleClang-C.cmake
new file mode 100644
index 0000000000..98971bbca3
--- /dev/null
+++ b/Modules/Platform/Darwin-AppleClang-C.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin-Clang-C)
diff --git a/Modules/Platform/Darwin-AppleClang-CXX.cmake b/Modules/Platform/Darwin-AppleClang-CXX.cmake
new file mode 100644
index 0000000000..4e9e7c12e7
--- /dev/null
+++ b/Modules/Platform/Darwin-AppleClang-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin-Clang-CXX)
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
index 8987783ff9..825f851640 100644
--- a/Modules/Platform/Haiku.cmake
+++ b/Modules/Platform/Haiku.cmake
@@ -1,22 +1,123 @@
-set(BEOS 1)
+# process only once
+if(HAIKU)
+ return()
+endif()
+
+set(HAIKU 1)
+set(UNIX 1)
-set(CMAKE_DL_LIBS root be)
-set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
-set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+set(CMAKE_DL_LIBS "")
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
-set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart")
+set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+
+# Determine, if the C or C++ compiler is configured for a secondary
+# architecture. If so, that will change the search paths we set below. We check
+# whether the compiler's library search paths contain a
+# "/boot/system/develop/lib/<subdir>/", which we assume to be the secondary
+# architecture specific subdirectory and extract the name of the architecture
+# accordingly.
+set(__HAIKU_COMPILER ${CMAKE_C_COMPILER})
+
+if(NOT __HAIKU_COMPILER)
+ set(__HAIKU_COMPILER ${CMAKE_CXX_COMPILER})
+endif()
+
+execute_process(
+ COMMAND ${__HAIKU_COMPILER} -print-search-dirs
+ OUTPUT_VARIABLE _HAIKU_SEARCH_DIRS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+string(REGEX MATCH ".*\nlibraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/(:[^\n]*)?\n.*" _dummy "\n${_HAIKU_SEARCH_DIRS}\n")
+set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}")
+
+if(NOT CMAKE_HAIKU_SECONDARY_ARCH)
+ set(CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR "")
+ unset(CMAKE_HAIKU_SECONDARY_ARCH)
+else()
+ set(CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR "/${CMAKE_HAIKU_SECONDARY_ARCH}")
+
+ # Override CMAKE_*LIBRARY_ARCHITECTURE. This will cause FIND_LIBRARY to search
+ # the libraries in the correct subdirectory first. It still isn't completely
+ # correct, since the parent directories shouldn't be searched at all. The
+ # primary architecture library might still be found, if there isn't one
+ # installed for the secondary architecture or it is installed in a less
+ # specific location.
+ set(CMAKE_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH})
+ set(CMAKE_C_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH})
+ set(CMAKE_CXX_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH})
+endif()
+
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ /boot/common/non-packaged
+ /boot/common
+ /boot/system
+ )
+
+LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
+ /boot/common/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ /boot/common/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ /boot/system/develop/headers/os
+ /boot/system/develop/headers/os/app
+ /boot/system/develop/headers/os/device
+ /boot/system/develop/headers/os/drivers
+ /boot/system/develop/headers/os/game
+ /boot/system/develop/headers/os/interface
+ /boot/system/develop/headers/os/kernel
+ /boot/system/develop/headers/os/locale
+ /boot/system/develop/headers/os/mail
+ /boot/system/develop/headers/os/media
+ /boot/system/develop/headers/os/midi
+ /boot/system/develop/headers/os/midi2
+ /boot/system/develop/headers/os/net
+ /boot/system/develop/headers/os/opengl
+ /boot/system/develop/headers/os/storage
+ /boot/system/develop/headers/os/support
+ /boot/system/develop/headers/os/translation
+ /boot/system/develop/headers/os/add-ons/graphics
+ /boot/system/develop/headers/os/add-ons/input_server
+ /boot/system/develop/headers/os/add-ons/screen_saver
+ /boot/system/develop/headers/os/add-ons/tracker
+ /boot/system/develop/headers/os/be_apps/Deskbar
+ /boot/system/develop/headers/os/be_apps/NetPositive
+ /boot/system/develop/headers/os/be_apps/Tracker
+ /boot/system/develop/headers/3rdparty
+ /boot/system/develop/headers/bsd
+ /boot/system/develop/headers/glibc
+ /boot/system/develop/headers/gnu
+ /boot/system/develop/headers/posix
+ /boot/system/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ )
+IF (CMAKE_HAIKU_SECONDARY_ARCH)
+ LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
+ /boot/system/develop/headers
+ )
+ENDIF (CMAKE_HAIKU_SECONDARY_ARCH)
+
+LIST(APPEND CMAKE_HAIKU_C_INCLUDE_DIRECTORIES
+ ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES}
+ )
+
+LIST(APPEND CMAKE_HAIKU_CXX_INCLUDE_DIRECTORIES
+ ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES})
+
+LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_HAIKU_C_INCLUDE_DIRECTORIES})
+
+LIST(APPEND CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES
+ /boot/common/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ /boot/common/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ /boot/system/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ )
+
+LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+ ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES}
+ )
-include(Platform/UnixPaths)
-list(APPEND CMAKE_SYSTEM_PREFIX_PATH /boot/common)
-list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/common/include)
-list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/common/lib)
-list(APPEND CMAKE_SYSTEM_PROGRAM_PATH /boot/common/bin)
-list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /boot/common/lib)
-list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/develop/headers/3rdparty)
-list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/develop/lib/x86)
+LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES})
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH
diff --git a/Modules/Platform/Windows-Clang-C.cmake b/Modules/Platform/Windows-Clang-C.cmake
new file mode 100644
index 0000000000..d00710579f
--- /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 0000000000..2c3688a368
--- /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 0000000000..4c936fe2e7
--- /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 7036ba0bd5..a2cfe33d28 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 ")