summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeASMInformation.cmake9
-rw-r--r--Modules/CMakeBackwardCompatibilityCXX.cmake2
-rw-r--r--Modules/CMakeCCompiler.cmake.in1
-rw-r--r--Modules/CMakeCInformation.cmake9
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in1
-rw-r--r--Modules/CMakeCXXInformation.cmake9
-rw-r--r--Modules/CMakeCommonLanguageInclude.cmake14
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake8
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake3
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake3
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake11
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake7
-rw-r--r--Modules/CMakeDetermineSystem.cmake1
-rw-r--r--Modules/CMakeFindEclipseCDT4.cmake2
-rw-r--r--Modules/CMakeFindFrameworks.cmake8
-rw-r--r--Modules/CMakeFortranCompiler.cmake.in4
-rw-r--r--Modules/CMakeFortranInformation.cmake9
-rw-r--r--Modules/CMakeIOSInstallCombined.cmake14
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake8
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake46
-rw-r--r--Modules/CMakePrintHelpers.cmake12
-rw-r--r--Modules/CMakeRCInformation.cmake4
-rw-r--r--Modules/CMakeSwiftInformation.cmake1
-rw-r--r--Modules/CMakeSystem.cmake.in2
-rw-r--r--Modules/CPack.cmake19
-rw-r--r--Modules/CPackComponent.cmake34
-rw-r--r--Modules/CPackDeb.cmake76
-rw-r--r--Modules/CPackIFW.cmake255
-rw-r--r--Modules/CPackProductBuild.cmake38
-rw-r--r--Modules/CPackRPM.cmake369
-rw-r--r--Modules/CPackWIX.cmake30
-rw-r--r--Modules/CTest.cmake12
-rw-r--r--Modules/CTestUseLaunchers.cmake2
-rw-r--r--Modules/CheckFortranSourceCompiles.cmake17
-rw-r--r--Modules/CheckIncludeFile.cmake2
-rw-r--r--Modules/CheckIncludeFileCXX.cmake2
-rw-r--r--Modules/CheckIncludeFiles.cmake8
-rw-r--r--Modules/CheckPrototypeDefinition.cmake4
-rw-r--r--Modules/CheckStructHasMember.cmake2
-rw-r--r--Modules/CheckSymbolExists.cmake8
-rw-r--r--Modules/CheckTypeSize.cmake10
-rw-r--r--Modules/Compiler/ARMCC.cmake10
-rw-r--r--Modules/Compiler/Absoft-Fortran.cmake10
-rw-r--r--Modules/Compiler/AppleClang-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/Bruce-C.cmake10
-rw-r--r--Modules/Compiler/G95-Fortran.cmake10
-rw-r--r--Modules/Compiler/GHS-C.cmake10
-rw-r--r--Modules/Compiler/GHS-CXX.cmake10
-rw-r--r--Modules/Compiler/GNU-Fortran.cmake7
-rw-r--r--Modules/Compiler/GNU.cmake12
-rw-r--r--Modules/Compiler/IAR.cmake5
-rw-r--r--Modules/Compiler/Intel-ASM.cmake11
-rw-r--r--Modules/Compiler/Intel-C.cmake11
-rw-r--r--Modules/Compiler/Intel-CXX.cmake11
-rw-r--r--Modules/Compiler/Intel-Fortran.cmake12
-rw-r--r--Modules/Compiler/Intel.cmake36
-rw-r--r--Modules/Compiler/MSVC-CXX-FeatureTests.cmake3
-rw-r--r--Modules/Compiler/NAG-Fortran.cmake1
-rw-r--r--Modules/Compiler/PGI-C.cmake4
-rw-r--r--Modules/Compiler/PGI-CXX.cmake4
-rw-r--r--Modules/Compiler/PGI-Fortran.cmake4
-rw-r--r--Modules/Compiler/PGI.cmake10
-rw-r--r--Modules/Compiler/PathScale-C.cmake4
-rw-r--r--Modules/Compiler/PathScale-CXX.cmake4
-rw-r--r--Modules/Compiler/PathScale.cmake10
-rw-r--r--Modules/Compiler/SunPro-ASM.cmake10
-rw-r--r--Modules/Compiler/SunPro-C.cmake10
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake10
-rw-r--r--Modules/Compiler/SunPro-Fortran.cmake13
-rw-r--r--Modules/Compiler/TinyCC-C.cmake10
-rw-r--r--Modules/Compiler/XL-ASM.cmake10
-rw-r--r--Modules/Compiler/XL-C.cmake6
-rw-r--r--Modules/Compiler/XL-CXX.cmake6
-rw-r--r--Modules/Compiler/XL-Fortran.cmake2
-rw-r--r--Modules/Compiler/XL.cmake8
-rw-r--r--Modules/Dart.cmake2
-rw-r--r--Modules/DeployQt4.cmake4
-rw-r--r--Modules/ExternalData.cmake95
-rw-r--r--Modules/ExternalProject-download.cmake.in86
-rw-r--r--Modules/ExternalProject.cmake116
-rw-r--r--Modules/FeatureSummary.cmake689
-rw-r--r--Modules/FindBISON.cmake135
-rw-r--r--Modules/FindBZip2.cmake38
-rw-r--r--Modules/FindBoost.cmake141
-rw-r--r--Modules/FindCUDA.cmake234
-rw-r--r--Modules/FindCUDA/make2cmake.cmake2
-rw-r--r--Modules/FindCUDA/run_nvcc.cmake19
-rw-r--r--Modules/FindCUDA/select_compute_arch.cmake195
-rw-r--r--Modules/FindCups.cmake2
-rw-r--r--Modules/FindEXPAT.cmake10
-rw-r--r--Modules/FindFreetype.cmake67
-rw-r--r--Modules/FindGIF.cmake46
-rw-r--r--Modules/FindGLEW.cmake43
-rw-r--r--Modules/FindGTest.cmake28
-rw-r--r--Modules/FindHDF5.cmake4
-rw-r--r--Modules/FindICU.cmake359
-rw-r--r--Modules/FindIce.cmake44
-rw-r--r--Modules/FindJNI.cmake7
-rw-r--r--Modules/FindJava.cmake3
-rw-r--r--Modules/FindLua.cmake117
-rw-r--r--Modules/FindMPI.cmake8
-rw-r--r--Modules/FindMatlab.cmake106
-rw-r--r--Modules/FindOpenCL.cmake29
-rw-r--r--Modules/FindOpenMP.cmake121
-rw-r--r--Modules/FindOpenSSL.cmake65
-rw-r--r--Modules/FindPHP4.cmake8
-rw-r--r--Modules/FindPNG.cmake14
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake18
-rw-r--r--Modules/FindPkgConfig.cmake10
-rw-r--r--Modules/FindPostgreSQL.cmake6
-rw-r--r--Modules/FindProtobuf.cmake8
-rw-r--r--Modules/FindPythonInterp.cmake2
-rw-r--r--Modules/FindPythonLibs.cmake2
-rw-r--r--Modules/FindQt4.cmake2
-rw-r--r--Modules/FindSDL_sound.cmake4
-rw-r--r--Modules/FindTIFF.cmake14
-rw-r--r--Modules/FindVulkan.cmake85
-rw-r--r--Modules/FindXalanC.cmake14
-rw-r--r--Modules/FindXercesC.cmake14
-rw-r--r--Modules/FindZLIB.cmake4
-rw-r--r--Modules/FindwxWidgets.cmake21
-rw-r--r--Modules/FindwxWindows.cmake2
-rw-r--r--Modules/FortranCInterface.cmake8
-rw-r--r--Modules/GNUInstallDirs.cmake81
-rw-r--r--Modules/GenerateExportHeader.cmake24
-rw-r--r--Modules/GetPrerequisites.cmake14
-rw-r--r--Modules/MatlabTestsRedirect.cmake43
-rw-r--r--Modules/NSIS.template.in7
-rw-r--r--Modules/Platform/AIX-Clang-C.cmake1
-rw-r--r--Modules/Platform/AIX-Clang-CXX.cmake1
-rw-r--r--Modules/Platform/AIX-GNU-CXX.cmake1
-rw-r--r--Modules/Platform/AIX-GNU.cmake7
-rw-r--r--Modules/Platform/AIX-XL.cmake6
-rw-r--r--Modules/Platform/ARTOS-GNU-C.cmake10
-rw-r--r--Modules/Platform/Android-Clang-C.cmake2
-rw-r--r--Modules/Platform/Android-Clang-CXX.cmake2
-rw-r--r--Modules/Platform/Android-Clang.cmake52
-rw-r--r--Modules/Platform/Android-Common.cmake158
-rw-r--r--Modules/Platform/Android-Determine-C.cmake2
-rw-r--r--Modules/Platform/Android-Determine-CXX.cmake2
-rw-r--r--Modules/Platform/Android-Determine.cmake301
-rw-r--r--Modules/Platform/Android-GNU-C.cmake2
-rw-r--r--Modules/Platform/Android-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Android-GNU.cmake43
-rw-r--r--Modules/Platform/Android-Initialize.cmake51
-rw-r--r--Modules/Platform/Android.cmake2
-rw-r--r--Modules/Platform/Android/Determine-Compiler-NDK.cmake256
-rw-r--r--Modules/Platform/Android/Determine-Compiler-Standalone.cmake69
-rw-r--r--Modules/Platform/Android/Determine-Compiler.cmake80
-rw-r--r--Modules/Platform/Android/abi-arm64-v8a-Clang.cmake8
-rw-r--r--Modules/Platform/Android/abi-arm64-v8a-GNU.cmake6
-rw-r--r--Modules/Platform/Android/abi-armeabi-Clang.cmake20
-rw-r--r--Modules/Platform/Android/abi-armeabi-GNU.cmake18
-rw-r--r--Modules/Platform/Android/abi-armeabi-v6-Clang.cmake19
-rw-r--r--Modules/Platform/Android/abi-armeabi-v6-GNU.cmake17
-rw-r--r--Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake29
-rw-r--r--Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake27
-rw-r--r--Modules/Platform/Android/abi-common-Clang.cmake6
-rw-r--r--Modules/Platform/Android/abi-common-GNU.cmake1
-rw-r--r--Modules/Platform/Android/abi-common.cmake4
-rw-r--r--Modules/Platform/Android/abi-mips-Clang.cmake8
-rw-r--r--Modules/Platform/Android/abi-mips-GNU.cmake6
-rw-r--r--Modules/Platform/Android/abi-mips64-Clang.cmake8
-rw-r--r--Modules/Platform/Android/abi-mips64-GNU.cmake6
-rw-r--r--Modules/Platform/Android/abi-x86-Clang.cmake8
-rw-r--r--Modules/Platform/Android/abi-x86-GNU.cmake2
-rw-r--r--Modules/Platform/Android/abi-x86_64-Clang.cmake8
-rw-r--r--Modules/Platform/Android/abi-x86_64-GNU.cmake2
-rw-r--r--Modules/Platform/Android/ndk-stl-c++.cmake13
-rw-r--r--Modules/Platform/Android/ndk-stl-c++_shared.cmake4
-rw-r--r--Modules/Platform/Android/ndk-stl-c++_static.cmake6
-rw-r--r--Modules/Platform/Android/ndk-stl-gabi++.cmake7
-rw-r--r--Modules/Platform/Android/ndk-stl-gabi++_shared.cmake4
-rw-r--r--Modules/Platform/Android/ndk-stl-gabi++_static.cmake4
-rw-r--r--Modules/Platform/Android/ndk-stl-gnustl.cmake9
-rw-r--r--Modules/Platform/Android/ndk-stl-gnustl_shared.cmake4
-rw-r--r--Modules/Platform/Android/ndk-stl-gnustl_static.cmake4
-rw-r--r--Modules/Platform/Android/ndk-stl-none.cmake2
-rw-r--r--Modules/Platform/Android/ndk-stl-stlport.cmake7
-rw-r--r--Modules/Platform/Android/ndk-stl-stlport_shared.cmake4
-rw-r--r--Modules/Platform/Android/ndk-stl-stlport_static.cmake4
-rw-r--r--Modules/Platform/Android/ndk-stl-system.cmake6
-rw-r--r--Modules/Platform/BlueGeneQ-base.cmake2
-rw-r--r--Modules/Platform/CYGWIN-Determine-CXX.cmake (renamed from Modules/Platform/Windows-CXX.cmake)0
-rw-r--r--Modules/Platform/CYGWIN-GNU.cmake2
-rw-r--r--Modules/Platform/Darwin-Determine-CXX.cmake (renamed from Modules/Platform/Darwin-CXX.cmake)0
-rw-r--r--Modules/Platform/Generic-ADSP-C.cmake8
-rw-r--r--Modules/Platform/Generic-ADSP-CXX.cmake8
-rw-r--r--Modules/Platform/Generic-SDCC-C.cmake2
-rw-r--r--Modules/Platform/HP-UX-GNU-CXX.cmake1
-rw-r--r--Modules/Platform/HP-UX-GNU.cmake1
-rw-r--r--Modules/Platform/HP-UX-HP-CXX.cmake8
-rw-r--r--Modules/Platform/HP-UX-HP.cmake2
-rw-r--r--Modules/Platform/Linux-Determine-CXX.cmake (renamed from Modules/Platform/Linux-CXX.cmake)0
-rw-r--r--Modules/Platform/Linux-Intel-Fortran.cmake2
-rw-r--r--Modules/Platform/Linux.cmake3
-rw-r--r--Modules/Platform/OpenBSD.cmake1
-rw-r--r--Modules/Platform/SCO_SV.cmake1
-rw-r--r--Modules/Platform/UnixPaths.cmake3
-rw-r--r--Modules/Platform/Windows-Determine-CXX.cmake (renamed from Modules/Platform/CYGWIN-CXX.cmake)0
-rw-r--r--Modules/Platform/Windows-Embarcadero.cmake24
-rw-r--r--Modules/Platform/Windows-Intel-Fortran.cmake10
-rw-r--r--Modules/Platform/Windows-MSVC.cmake82
-rw-r--r--Modules/Platform/Windows-OpenWatcom-C.cmake1
-rw-r--r--Modules/Platform/Windows-OpenWatcom-CXX.cmake1
-rw-r--r--Modules/Platform/Windows-OpenWatcom.cmake (renamed from Modules/Platform/Windows-wcl386.cmake)42
-rw-r--r--Modules/Platform/Windows-Watcom-C.cmake1
-rw-r--r--Modules/Platform/Windows-Watcom-CXX.cmake1
-rw-r--r--Modules/Qt4Macros.cmake4
-rw-r--r--Modules/UseJava.cmake169
-rw-r--r--Modules/UseSWIG.cmake12
-rw-r--r--Modules/Use_wxWindows.cmake2
-rw-r--r--Modules/UsewxWidgets.cmake2
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake56
-rw-r--r--Modules/exportheader.cmake.in2
-rw-r--r--Modules/javaTargets.cmake.in39
216 files changed, 4892 insertions, 1523 deletions
diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake
index 0e547c4..1bb16ac 100644
--- a/Modules/CMakeASMInformation.cmake
+++ b/Modules/CMakeASMInformation.cmake
@@ -76,10 +76,11 @@ endif()
# Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends:
set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}")
-# avoid just having a space as the initial value for the cache
-if(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ")
- set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT)
-endif()
+
+foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
+ string(STRIP "${CMAKE_ASM${ASM_DIALECT}_FLAGS${c}_INIT}" CMAKE_ASM${ASM_DIALECT}_FLAGS${c}_INIT)
+endforeach()
+
set (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING
"Flags used by the assembler during all build types.")
diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake
index f1db46e..f4044e5 100644
--- a/Modules/CMakeBackwardCompatibilityCXX.cmake
+++ b/Modules/CMakeBackwardCompatibilityCXX.cmake
@@ -50,7 +50,7 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
endif()
endif()
set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
+ string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_ANSI_CXXFLAGS}")
include(TestForANSIStreamHeaders)
include(CheckIncludeFileCXX)
include(TestForSTDNamespace)
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index f109a14..50b12f2 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -59,6 +59,7 @@ if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
endif()
+@CMAKE_C_COMPILER_CUSTOM_CODE@
@CMAKE_C_SYSROOT_FLAG_CODE@
@CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index fa87ca8..98eedc4 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -111,10 +111,11 @@ if(NOT CMAKE_MODULE_EXISTS)
endif()
set(CMAKE_C_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}")
-# avoid just having a space as the initial value for the cache
-if(CMAKE_C_FLAGS_INIT STREQUAL " ")
- set(CMAKE_C_FLAGS_INIT)
-endif()
+
+foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
+ string(STRIP "${CMAKE_C_FLAGS${c}_INIT}" CMAKE_C_FLAGS${c}_INIT)
+endforeach()
+
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_INIT}" CACHE STRING
"Flags used by the compiler during all build types.")
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 9e90aea..c295b74 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -60,6 +60,7 @@ if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
endif()
+@CMAKE_CXX_COMPILER_CUSTOM_CODE@
@CMAKE_CXX_SYSROOT_FLAG_CODE@
@CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index b35280f..07e4f39 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -206,10 +206,11 @@ endforeach()
# use _INIT variables so that this only happens the first time
# and you can set these flags in the cmake cache
set(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}")
-# avoid just having a space as the initial value for the cache
-if(CMAKE_CXX_FLAGS_INIT STREQUAL " ")
- set(CMAKE_CXX_FLAGS_INIT)
-endif()
+
+foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
+ string(STRIP "${CMAKE_CXX_FLAGS${c}_INIT}" CMAKE_CXX_FLAGS${c}_INIT)
+endforeach()
+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}" CACHE STRING
"Flags used by the compiler during all build types.")
diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake
index fa025a8..8bf7288 100644
--- a/Modules/CMakeCommonLanguageInclude.cmake
+++ b/Modules/CMakeCommonLanguageInclude.cmake
@@ -16,11 +16,15 @@
# cache values that can be initialized in the platform-compiler.cmake file
# it may be included by more than one language.
-if(NOT "x$ENV{LDFLAGS}" STREQUAL "x")
- set (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
- set (CMAKE_SHARED_LINKER_FLAGS_INIT "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
- set (CMAKE_MODULE_LINKER_FLAGS_INIT "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
-endif()
+string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
+string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
+string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
+
+foreach(t EXE SHARED MODULE STATIC)
+ foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
+ string(STRIP "${CMAKE_${t}_LINKER_FLAGS${c}_INIT}" CMAKE_${t}_LINKER_FLAGS${c}_INIT)
+ endforeach()
+endforeach()
if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
# default build type is none
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 1d341e5..17e5302 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -120,18 +120,18 @@ function(compiler_id_detection outvar lang)
if (CID_ID_STRING)
set(PREFIX ${CID_PREFIX})
string(CONFIGURE "${_compiler_id_simulate_${Id}}" SIMULATE_BLOCK @ONLY)
- set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"${SIMULATE_BLOCK}")
+ string(APPEND id_content "# define ${CID_PREFIX}COMPILER_ID \"${Id}\"${SIMULATE_BLOCK}")
endif()
if (CID_ID_DEFINE)
- set(id_content "${id_content}# undef ${CID_PREFIX}COMPILER_IS_${Id}\n")
- set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_IS_${Id} 1\n")
+ string(APPEND id_content "# undef ${CID_PREFIX}COMPILER_IS_${Id}\n")
+ string(APPEND id_content "# define ${CID_PREFIX}COMPILER_IS_${Id} 1\n")
endif()
if (CID_VERSION_STRINGS)
set(PREFIX ${CID_PREFIX})
set(MACRO_DEC DEC)
set(MACRO_HEX HEX)
string(CONFIGURE "${_compiler_id_version_compute_${Id}}" VERSION_BLOCK @ONLY)
- set(id_content "${id_content}${VERSION_BLOCK}\n")
+ string(APPEND id_content "${VERSION_BLOCK}\n")
endif()
set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${id_content}")
set(pp_if "#elif")
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index f8c6303..c566f39 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -34,6 +34,7 @@
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
# Load system-specific compiler preferences for this language.
+include(Platform/${CMAKE_SYSTEM_NAME}-Determine-C OPTIONAL)
include(Platform/${CMAKE_SYSTEM_NAME}-C OPTIONAL)
if(NOT CMAKE_C_COMPILER_NAMES)
set(CMAKE_C_COMPILER_NAMES cc)
@@ -104,7 +105,7 @@ if(NOT CMAKE_C_COMPILER_ID_RUN)
CMAKE_C_COMPILER_ID_PLATFORM_CONTENT)
# The IAR compiler produces weird output.
- # See https://cmake.org/Bug/view.php?id=10176#c19598
+ # See https://gitlab.kitware.com/cmake/cmake/issues/10176#note_153591
list(APPEND CMAKE_C_COMPILER_ID_VENDORS IAR)
set(CMAKE_C_COMPILER_ID_VENDOR_FLAGS_IAR )
set(CMAKE_C_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler")
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 3c9bbc2..fb4155b 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -33,6 +33,7 @@
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
# Load system-specific compiler preferences for this language.
+include(Platform/${CMAKE_SYSTEM_NAME}-Determine-CXX OPTIONAL)
include(Platform/${CMAKE_SYSTEM_NAME}-CXX OPTIONAL)
if(NOT CMAKE_CXX_COMPILER_NAMES)
set(CMAKE_CXX_COMPILER_NAMES CC)
@@ -96,7 +97,7 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN)
CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT)
# The IAR compiler produces weird output.
- # See https://cmake.org/Bug/view.php?id=10176#c19598
+ # See https://gitlab.kitware.com/cmake/cmake/issues/10176#note_153591
list(APPEND CMAKE_CXX_COMPILER_ID_VENDORS IAR)
set(CMAKE_CXX_COMPILER_ID_VENDOR_FLAGS_IAR )
set(CMAKE_CXX_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler")
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 465989d..64d9bed 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -365,14 +365,15 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
# Find the executable produced by the compiler, try all files in the
# binary dir.
+ string(REGEX REPLACE "([][])" "[\\1]" _glob_id_dir "${CMAKE_${lang}_COMPILER_ID_DIR}")
file(GLOB files
RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR}
# normal case
- ${CMAKE_${lang}_COMPILER_ID_DIR}/*
+ ${_glob_id_dir}/*
# com.apple.package-type.bundle.unit-test
- ${CMAKE_${lang}_COMPILER_ID_DIR}/*.xctest/*
+ ${_glob_id_dir}/*.xctest/*
)
list(REMOVE_ITEM files "${src}")
set(COMPILER_${lang}_PRODUCED_FILES "")
@@ -492,11 +493,11 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
if(NOT DEFINED COMPILER_VERSION AND HAVE_COMPILER_VERSION_MAJOR)
set(COMPILER_VERSION "${COMPILER_VERSION_MAJOR}")
if(HAVE_COMPILER_VERSION_MINOR)
- set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_MINOR}")
+ string(APPEND COMPILER_VERSION ".${COMPILER_VERSION_MINOR}")
if(HAVE_COMPILER_VERSION_PATCH)
- set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_PATCH}")
+ string(APPEND COMPILER_VERSION ".${COMPILER_VERSION_PATCH}")
if(HAVE_COMPILER_VERSION_TWEAK)
- set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_TWEAK}")
+ string(APPEND COMPILER_VERSION ".${COMPILER_VERSION_TWEAK}")
endif()
endif()
endif()
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 4f2a70c..596fc5f 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -20,6 +20,7 @@
# as a default compiler
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
+include(Platform/${CMAKE_SYSTEM_NAME}-Determine-Fortran OPTIONAL)
include(Platform/${CMAKE_SYSTEM_NAME}-Fortran OPTIONAL)
if(NOT CMAKE_Fortran_COMPILER_NAMES)
set(CMAKE_Fortran_COMPILER_NAMES f95)
@@ -140,10 +141,10 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
set(_version_info "")
foreach(m MAJOR MINOR PATCH TWEAK)
set(_COMP "_${m}")
- set(_version_info "${_version_info}
+ string(APPEND _version_info "
#if defined(COMPILER_VERSION${_COMP})")
foreach(d 1 2 3 4 5 6 7 8)
- set(_version_info "${_version_info}
+ string(APPEND _version_info "
# undef DEC
# undef HEX
# define DEC(n) DEC_${d}(n)
@@ -171,7 +172,7 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
# endif
")
endforeach()
- set(_version_info "${_version_info}
+ string(APPEND _version_info "
#endif")
endforeach()
set(CMAKE_Fortran_COMPILER_ID_VERSION_INFO "${_version_info}")
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index d9f7579..f7a32b7 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -131,6 +131,7 @@ else()
set(PRESET_CMAKE_SYSTEM_NAME FALSE)
endif()
+include(Platform/${CMAKE_SYSTEM_NAME}-Determine OPTIONAL)
macro(ADJUST_CMAKE_SYSTEM_VARIABLES _PREFIX)
if(NOT ${_PREFIX}_NAME)
diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake
index 5bf738a..e158a73 100644
--- a/Modules/CMakeFindEclipseCDT4.cmake
+++ b/Modules/CMakeFindEclipseCDT4.cmake
@@ -35,7 +35,7 @@ function(_FIND_ECLIPSE_VERSION)
if(NOT DEFINED CMAKE_ECLIPSE_VERSION)
if(CMAKE_ECLIPSE_EXECUTABLE)
- # use REALPATH to resolve symlinks (http://public.kitware.com/Bug/view.php?id=13036)
+ # use REALPATH to resolve symlinks (https://gitlab.kitware.com/cmake/cmake/issues/13036)
get_filename_component(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH)
get_filename_component(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH)
file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*")
diff --git a/Modules/CMakeFindFrameworks.cmake b/Modules/CMakeFindFrameworks.cmake
index 6a8bcd4..80eb003 100644
--- a/Modules/CMakeFindFrameworks.cmake
+++ b/Modules/CMakeFindFrameworks.cmake
@@ -3,6 +3,10 @@
# -------------------
#
# helper module to find OSX frameworks
+#
+# This module reads hints about search locations from variables::
+#
+# CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS - Extra directories
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
@@ -24,9 +28,11 @@ if(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED)
if(APPLE)
foreach(dir
~/Library/Frameworks/${fwk}.framework
+ /usr/local/Frameworks/${fwk}.framework
/Library/Frameworks/${fwk}.framework
/System/Library/Frameworks/${fwk}.framework
- /Network/Library/Frameworks/${fwk}.framework)
+ /Network/Library/Frameworks/${fwk}.framework
+ ${CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS})
if(EXISTS ${dir})
set(${fwk}_FRAMEWORKS ${${fwk}_FRAMEWORKS} ${dir})
endif()
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in
index 2a4bea4..69800d7 100644
--- a/Modules/CMakeFortranCompiler.cmake.in
+++ b/Modules/CMakeFortranCompiler.cmake.in
@@ -54,6 +54,10 @@ if(CMAKE_Fortran_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_Fortran_LIBRARY_ARCHITECTURE@")
endif()
+@CMAKE_Fortran_COMPILER_CUSTOM_CODE@
+@CMAKE_Fortran_SYSROOT_FLAG_CODE@
+@CMAKE_Fortran_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
+
set(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index 1fd0972..45dbfcc 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -173,10 +173,11 @@ endif()
set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
set(CMAKE_Fortran_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Fortran_FLAGS_INIT}")
-# avoid just having a space as the initial value for the cache
-if(CMAKE_Fortran_FLAGS_INIT STREQUAL " ")
- set(CMAKE_Fortran_FLAGS_INIT)
-endif()
+
+foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
+ string(STRIP "${CMAKE_Fortran_FLAGS${c}_INIT}" CMAKE_Fortran_FLAGS${c}_INIT)
+endforeach()
+
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_INIT}" CACHE STRING
"Flags for Fortran compiler.")
diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake
index 1256f56..234322c 100644
--- a/Modules/CMakeIOSInstallCombined.cmake
+++ b/Modules/CMakeIOSInstallCombined.cmake
@@ -237,20 +237,30 @@ function(ios_install_combined target destination)
endif()
set(cmd xcrun -f lipo)
+
+ # Do not merge OUTPUT_VARIABLE and ERROR_VARIABLE since latter may contain
+ # some diagnostic information even for the successful run.
execute_process(
COMMAND ${cmd}
RESULT_VARIABLE result
OUTPUT_VARIABLE output
- ERROR_VARIABLE output
+ ERROR_VARIABLE error_output
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
if(NOT result EQUAL 0)
message(
- FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}"
+ FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}\nOutput(error):\n${error_output}"
)
endif()
set(_lipo_path ${output})
+ list(LENGTH _lipo_path len)
+ if(NOT len EQUAL 1)
+ message(FATAL_ERROR "Unexpected xcrun output: ${_lipo_path}")
+ endif()
+ if(NOT EXISTS "${_lipo_path}")
+ message(FATAL_ERROR "File not found: ${_lipo_path}")
+ endif()
set(CURRENT_CONFIG "${CMAKE_INSTALL_CONFIG_NAME}")
set(CURRENT_TARGET "${target}")
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 5e5302f..828ea9e 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -280,7 +280,7 @@ get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE
if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+")
# Handle "/usr move" symlinks created by some Linux distros.
- set(PACKAGE_INIT "${PACKAGE_INIT}
+ string(APPEND PACKAGE_INIT "
# Use original install prefix when loaded through a \"/usr move\"
# cross-prefix symbolic link such as /lib -> /usr/lib.
get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH)
@@ -294,7 +294,7 @@ unset(_realCurr)
endif()
if(NOT CCF_NO_SET_AND_CHECK_MACRO)
- set(PACKAGE_INIT "${PACKAGE_INIT}
+ string(APPEND PACKAGE_INIT "
macro(set_and_check _var _file)
set(\${_var} \"\${_file}\")
if(NOT EXISTS \"\${_file}\")
@@ -306,7 +306,7 @@ endmacro()
if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO)
- set(PACKAGE_INIT "${PACKAGE_INIT}
+ string(APPEND PACKAGE_INIT "
macro(check_required_components _NAME)
foreach(comp \${\${_NAME}_FIND_COMPONENTS})
if(NOT \${_NAME}_\${comp}_FOUND)
@@ -319,7 +319,7 @@ endmacro()
")
endif()
- set(PACKAGE_INIT "${PACKAGE_INIT}
+ string(APPEND PACKAGE_INIT "
####################################################################################")
configure_file("${_inputFile}" "${_outputFile}" @ONLY)
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index ef9a2eb..f6d07e5 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -32,7 +32,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
# whole line and just the command (argv[0]).
set(linker_regex "^( *|.*[/\\])(${linker}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)")
set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=|/ldfe ")
- set(log "${log} link line regex: [${linker_regex}]\n")
+ string(APPEND log " link line regex: [${linker_regex}]\n")
string(REGEX REPLACE "\r?\n" ";" output_lines "${text}")
foreach(line IN LISTS output_lines)
set(cmd)
@@ -44,7 +44,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _dir_regex "${CMAKE_BINARY_DIR}")
string(REGEX REPLACE " -[FL]${_dir_regex}/([^ ]| [^-])+( |$)" " " xline "${line}")
if(NOT "x${xline}" STREQUAL "x${line}")
- set(log "${log} reduced line: [${line}]\n to: [${xline}]\n")
+ string(APPEND log " reduced line: [${line}]\n to: [${xline}]\n")
set(line "${xline}")
endif()
endif()
@@ -56,67 +56,67 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
list(GET args 0 cmd)
endif()
if("${cmd}" MATCHES "${linker_regex}")
- set(log "${log} link line: [${line}]\n")
+ string(APPEND log " link line: [${line}]\n")
string(REGEX REPLACE ";-([LYz]);" ";-\\1" args "${args}")
foreach(arg IN LISTS args)
if("${arg}" MATCHES "^-L(.:)?[/\\]")
# Unix search path.
string(REGEX REPLACE "^-L" "" dir "${arg}")
list(APPEND implicit_dirs_tmp ${dir})
- set(log "${log} arg [${arg}] ==> dir [${dir}]\n")
+ string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
elseif("${arg}" MATCHES "^-l([^:].*)$")
# Unix library.
set(lib "${CMAKE_MATCH_1}")
list(APPEND implicit_libs_tmp ${lib})
- set(log "${log} arg [${arg}] ==> lib [${lib}]\n")
+ string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$")
# Unix library full path.
list(APPEND implicit_libs_tmp ${arg})
- set(log "${log} arg [${arg}] ==> lib [${arg}]\n")
+ string(APPEND log " arg [${arg}] ==> lib [${arg}]\n")
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$"
AND obj_regex AND "${arg}" MATCHES "${obj_regex}")
# Object file full path.
list(APPEND implicit_libs_tmp ${arg})
- set(log "${log} arg [${arg}] ==> obj [${arg}]\n")
+ string(APPEND log " arg [${arg}] ==> obj [${arg}]\n")
elseif("${arg}" MATCHES "^-Y(P,)?[^0-9]")
# Sun search path ([^0-9] avoids conflict with Mac -Y<num>).
string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}")
string(REPLACE ":" ";" dirs "${dirs}")
list(APPEND implicit_dirs_tmp ${dirs})
- set(log "${log} arg [${arg}] ==> dirs [${dirs}]\n")
+ string(APPEND log " arg [${arg}] ==> dirs [${dirs}]\n")
elseif("${arg}" MATCHES "^-l:")
# HP named library.
list(APPEND implicit_libs_tmp ${arg})
- set(log "${log} arg [${arg}] ==> lib [${arg}]\n")
+ string(APPEND log " arg [${arg}] ==> lib [${arg}]\n")
elseif("${arg}" MATCHES "^-z(all|default|weak)extract")
# Link editor option.
list(APPEND implicit_libs_tmp ${arg})
- set(log "${log} arg [${arg}] ==> opt [${arg}]\n")
+ string(APPEND log " arg [${arg}] ==> opt [${arg}]\n")
else()
- set(log "${log} arg [${arg}] ==> ignore\n")
+ string(APPEND log " arg [${arg}] ==> ignore\n")
endif()
endforeach()
break()
elseif("${line}" MATCHES "LPATH(=| is:? *)(.*)$")
- set(log "${log} LPATH line: [${line}]\n")
+ string(APPEND log " LPATH line: [${line}]\n")
# HP search path.
string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}")
list(APPEND implicit_dirs_tmp ${paths})
- set(log "${log} dirs [${paths}]\n")
+ string(APPEND log " dirs [${paths}]\n")
else()
- set(log "${log} ignore line: [${line}]\n")
+ string(APPEND log " ignore line: [${line}]\n")
endif()
endforeach()
# Look for library search paths reported by linker.
if("${output_lines}" MATCHES ";Library search paths:((;\t[^;]+)+)")
string(REPLACE ";\t" ";" implicit_dirs_match "${CMAKE_MATCH_1}")
- set(log "${log} Library search paths: [${implicit_dirs_match}]\n")
+ string(APPEND log " Library search paths: [${implicit_dirs_match}]\n")
list(APPEND implicit_dirs_tmp ${implicit_dirs_match})
endif()
if("${output_lines}" MATCHES ";Framework search paths:((;\t[^;]+)+)")
string(REPLACE ";\t" ";" implicit_fwks_match "${CMAKE_MATCH_1}")
- set(log "${log} Framework search paths: [${implicit_fwks_match}]\n")
+ string(APPEND log " Framework search paths: [${implicit_fwks_match}]\n")
list(APPEND implicit_fwks_tmp ${implicit_fwks_match})
endif()
@@ -124,12 +124,12 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
# We remove items that are not language-specific.
set(implicit_libs "")
foreach(lib IN LISTS implicit_libs_tmp)
- if("x${lib}" MATCHES "^x(crt.*\\.o|gcc.*|System.*)$")
- set(log "${log} remove lib [${lib}]\n")
+ if("x${lib}" MATCHES "^x(crt.*\\.o|gcc.*|System.*|.*libclang_rt.*)$")
+ string(APPEND log " remove lib [${lib}]\n")
elseif(IS_ABSOLUTE "${lib}")
get_filename_component(abs "${lib}" ABSOLUTE)
if(NOT "x${lib}" STREQUAL "x${abs}")
- set(log "${log} collapse lib [${lib}] ==> [${abs}]\n")
+ string(APPEND log " collapse lib [${lib}] ==> [${abs}]\n")
endif()
list(APPEND implicit_libs "${abs}")
else()
@@ -151,15 +151,15 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
set(msg "")
list(APPEND implicit_${t} "${dir}")
endif()
- set(log "${log} collapse ${desc_${t}} dir [${d}] ==> [${dir}]${msg}\n")
+ string(APPEND log " collapse ${desc_${t}} dir [${d}] ==> [${dir}]${msg}\n")
endforeach()
list(REMOVE_DUPLICATES implicit_${t})
endforeach()
# Log results.
- set(log "${log} implicit libs: [${implicit_libs}]\n")
- set(log "${log} implicit dirs: [${implicit_dirs}]\n")
- set(log "${log} implicit fwks: [${implicit_fwks}]\n")
+ string(APPEND log " implicit libs: [${implicit_libs}]\n")
+ string(APPEND log " implicit dirs: [${implicit_dirs}]\n")
+ string(APPEND log " implicit fwks: [${implicit_fwks}]\n")
# Return results.
set(${lib_var} "${implicit_libs}" PARENT_SCOPE)
diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake
index 474fa41..61a0909 100644
--- a/Modules/CMakePrintHelpers.cmake
+++ b/Modules/CMakePrintHelpers.cmake
@@ -55,9 +55,9 @@ function(CMAKE_PRINT_VARIABLES)
set(msg "")
foreach(var ${ARGN})
if(msg)
- set(msg "${msg} ; ")
+ string(APPEND msg " ; ")
endif()
- set(msg "${msg}${var}=\"${${var}}\"")
+ string(APPEND msg "${var}=\"${${var}}\"")
endforeach()
message(STATUS "${msg}")
endfunction()
@@ -132,21 +132,21 @@ function(CMAKE_PRINT_PROPERTIES )
if(keyword STREQUAL "TARGET")
if(NOT TARGET ${item})
set(itemExists FALSE)
- set(msg "${msg}\n No such TARGET \"${item}\" !\n\n")
+ string(APPEND msg "\n No such TARGET \"${item}\" !\n\n")
endif()
endif()
if (itemExists)
- set(msg "${msg} Properties for ${keyword} ${item}:\n")
+ string(APPEND msg " Properties for ${keyword} ${item}:\n")
foreach(prop ${CPP_PROPERTIES})
get_property(propertySet ${keyword} ${item} PROPERTY "${prop}" SET)
if(propertySet)
get_property(property ${keyword} ${item} PROPERTY "${prop}")
- set(msg "${msg} ${item}.${prop} = \"${property}\"\n")
+ string(APPEND msg " ${item}.${prop} = \"${property}\"\n")
else()
- set(msg "${msg} ${item}.${prop} = <NOTFOUND>\n")
+ string(APPEND msg " ${item}.${prop} = <NOTFOUND>\n")
endif()
endforeach()
endif()
diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake
index 94abd4b..60276e2 100644
--- a/Modules/CMakeRCInformation.cmake
+++ b/Modules/CMakeRCInformation.cmake
@@ -28,9 +28,9 @@ set(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
+string(STRIP "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}" CMAKE_RC_FLAGS_INIT)
-
-set (CMAKE_RC_FLAGS "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}" CACHE STRING
+set (CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS_INIT}" CACHE STRING
"Flags for Windows Resource Compiler.")
# These are the only types of flags that should be passed to the rc
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index 61ad928..85d3143 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -13,6 +13,7 @@
# License text for the above reference.)
set(CMAKE_Swift_OUTPUT_EXTENSION .o)
+set(CMAKE_INCLUDE_FLAG_Swift "-I")
# Load compiler-specific information.
if(CMAKE_Swift_COMPILER_ID)
diff --git a/Modules/CMakeSystem.cmake.in b/Modules/CMakeSystem.cmake.in
index 70c98d5..ef8aaa0 100644
--- a/Modules/CMakeSystem.cmake.in
+++ b/Modules/CMakeSystem.cmake.in
@@ -9,7 +9,7 @@ set(CMAKE_SYSTEM "@CMAKE_SYSTEM@")
set(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
set(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@")
set(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@")
-
+@CMAKE_SYSTEM_CUSTOM_CODE@
set(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@")
set(CMAKE_SYSTEM_LOADED 1)
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 77f854d..99f22ec 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -116,6 +116,15 @@
# A branding image that will be displayed inside the installer (used by GUI
# installers).
#
+# .. variable:: CPACK_PACKAGE_CHECKSUM
+#
+# An algorithm that will be used to generate additional file with checksum
+# of the package. Output file name will be::
+#
+# ${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_CHECKSUM}
+#
+# Current supported alogorithms: MD5|SHA1|SHA224|SHA256|SHA384|SHA512.
+#
# .. variable:: CPACK_PROJECT_CONFIG_FILE
#
# CPack-time project CPack configuration file. This file included at cpack
@@ -332,7 +341,7 @@ function(cpack_encode_variables)
set(value "${${var}}")
endif()
- set(commands "${commands}\nSET(${var} \"${value}\")")
+ string(APPEND commands "\nSET(${var} \"${value}\")")
endif()
endforeach()
@@ -455,6 +464,7 @@ if(NOT CPACK_GENERATOR)
option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF)
option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF)
option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" OFF)
+ option(CPACK_BINARY_PRODUCTBUILD "Enable to build productbuild packages" OFF)
else()
option(CPACK_BINARY_TZ "Enable to build TZ packages" ON)
endif()
@@ -483,6 +493,7 @@ if(NOT CPACK_GENERATOR)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PRODUCTBUILD productbuild)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_STGZ STGZ)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2)
@@ -500,6 +511,7 @@ if(NOT CPACK_SOURCE_GENERATOR)
if(CYGWIN)
option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON)
else()
+ option(CPACK_SOURCE_RPM "Enable to build RPM source packages" OFF)
option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON)
option(CPACK_SOURCE_TGZ "Enable to build TGZ source packages" ON)
option(CPACK_SOURCE_TXZ "Enable to build TXZ source packages" ON)
@@ -513,6 +525,7 @@ if(NOT CPACK_SOURCE_GENERATOR)
cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_7Z 7Z)
cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_CYGWIN CygwinSource)
+ cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_RPM RPM)
cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TBZ2 TBZ2)
cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ)
cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TXZ TXZ)
@@ -531,6 +544,7 @@ mark_as_advanced(
CPACK_BINARY_NSIS
CPACK_BINARY_OSXX11
CPACK_BINARY_PACKAGEMAKER
+ CPACK_BINARY_PRODUCTBUILD
CPACK_BINARY_RPM
CPACK_BINARY_STGZ
CPACK_BINARY_TBZ2
@@ -541,6 +555,7 @@ mark_as_advanced(
CPACK_BINARY_ZIP
CPACK_SOURCE_7Z
CPACK_SOURCE_CYGWIN
+ CPACK_SOURCE_RPM
CPACK_SOURCE_TBZ2
CPACK_SOURCE_TGZ
CPACK_SOURCE_TXZ
@@ -648,6 +663,8 @@ set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
set(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}")
set(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}")
+set(CPACK_RPM_PACKAGE_SOURCES "ON")
+
cpack_encode_variables()
configure_file("${cpack_source_input_file}"
"${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY)
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake
index 038a717..6552a2d 100644
--- a/Modules/CPackComponent.cmake
+++ b/Modules/CPackComponent.cmake
@@ -75,9 +75,17 @@
#
# The dependencies (list of components) on which this component depends.
#
+# .. variable:: CPACK_COMPONENT_<compName>_HIDDEN
+#
+# True if this component is hidden from the user.
+#
# .. variable:: CPACK_COMPONENT_<compName>_REQUIRED
#
-# True is this component is required.
+# True if this component is required.
+#
+# .. variable:: CPACK_COMPONENT_<compName>_DISABLED
+#
+# True if this component is not selected to be installed by default.
#
# .. command:: cpack_add_component
#
@@ -360,6 +368,20 @@ macro(cpack_append_string_variable_set_command var strvar)
endif ()
endmacro()
+# Macro that appends a SET command for the given list variable name (var)
+# to the macro named strvar, but only if the variable named "var"
+# has been defined. It's like add variable, but wrap each item to quotes.
+# The string will eventually be appended to a CPack configuration file.
+macro(cpack_append_list_variable_set_command var strvar)
+ if (DEFINED ${var})
+ string(APPEND ${strvar} "set(${var}")
+ foreach(_val IN LISTS ${var})
+ string(APPEND ${strvar} "\n \"${_val}\"")
+ endforeach()
+ string(APPEND ${strvar} ")\n")
+ endif ()
+endmacro()
+
# Macro that appends a SET command for the given variable name (var)
# to the macro named strvar, but only if the variable named "var"
# has been set to true. The string will eventually be
@@ -395,11 +417,11 @@ macro(cpack_add_component compname)
# moduled was included.
if(NOT CPACK_COMPONENTS_ALL_SET_BY_USER)
get_cmake_property(_CPACK_ADDCOMP_COMPONENTS COMPONENTS)
- set(_CPACK_ADDCOMP_STR "${_CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL")
+ string(APPEND _CPACK_ADDCOMP_STR "\nSET(CPACK_COMPONENTS_ALL")
foreach(COMP ${_CPACK_ADDCOMP_COMPONENTS})
- set(_CPACK_ADDCOMP_STR "${_CPACK_ADDCOMP_STR} ${COMP}")
+ string(APPEND _CPACK_ADDCOMP_STR " ${COMP}")
endforeach()
- set(_CPACK_ADDCOMP_STR "${_CPACK_ADDCOMP_STR})\n")
+ string(APPEND _CPACK_ADDCOMP_STR ")\n")
endif()
endif()
@@ -487,8 +509,8 @@ macro(cpack_add_install_type insttype)
set(_CPACK_INSTTYPE_STR
"\n# Configuration for installation type \"${insttype}\"\n")
- set(_CPACK_INSTTYPE_STR
- "${_CPACK_INSTTYPE_STR}list(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n")
+ string(APPEND _CPACK_INSTTYPE_STR
+ "list(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n")
cpack_append_string_variable_set_command(
CPACK_INSTALL_TYPE_${_CPACK_INSTTYPE_UNAME}_DISPLAY_NAME
_CPACK_INSTTYPE_STR)
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index c9678d6..423bb00 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -156,16 +156,18 @@
# * Default : :code:`CPACK_PACKAGE_CONTACT`
#
# .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION
-# CPACK_COMPONENT_<COMPONENT>_DESCRIPTION
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_DESCRIPTION
#
# The Debian package description
#
# * Mandatory : YES
# * Default :
#
-# - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set or
-# - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
-#
+# - :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION` (component based installers only) if set,
+# - :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` if set to non default location,
+# - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` if set,
+# - :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` default value if set,
+# - or "no package description available"
#
# .. variable:: CPACK_DEBIAN_PACKAGE_SECTION
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION
@@ -177,6 +179,24 @@
#
# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
#
+# .. variable:: CPACK_DEBIAN_ARCHIVE_TYPE
+#
+# The archive format used for creating the Debian package.
+#
+# * Mandatory : YES
+# * Default : "paxr"
+#
+# Possible values are:
+#
+# - paxr
+# - gnutar
+#
+# .. note::
+#
+# Default pax archive format is the most portable format and generates
+# packages that do not treat sparse files specially.
+# GNU tar format on the other hand supports longer filenames.
+#
# .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
#
# The compression used for creating the Debian package.
@@ -811,24 +831,23 @@ function(cpack_deb_prepare_package_vars)
endif()
# Description: (mandatory)
- if(NOT CPACK_DEB_PACKAGE_COMPONENT)
- if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
- if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
- message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
- endif()
- set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+ if(CPACK_DEB_PACKAGE_COMPONENT)
+ if(CPACK_DEBIAN_${_local_component_name}_PACKAGE_DESCRIPTION)
+ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_DESCRIPTION}")
+ elseif(CPACK_COMPONENT_${_local_component_name}_DESCRIPTION)
+ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_COMPONENT_${_local_component_name}_DESCRIPTION}")
endif()
- else()
- set(component_description_var CPACK_COMPONENT_${_local_component_name}_DESCRIPTION)
-
- # component description overrides package description
- if(${component_description_var})
- set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${${component_description_var}})
- elseif(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
- if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
- message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION or ${component_description_var}")
- endif()
- set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+ endif()
+
+ if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
+ if(CPACK_PACKAGE_DESCRIPTION_FILE AND NOT "${CPACK_PACKAGE_DESCRIPTION_FILE}" STREQUAL "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
+ file(READ "${CPACK_PACKAGE_DESCRIPTION_FILE}" CPACK_DEBIAN_PACKAGE_DESCRIPTION)
+ elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
+ elseif(CPACK_PACKAGE_DESCRIPTION_FILE) # use default package description file content
+ file(READ "${CPACK_PACKAGE_DESCRIPTION_FILE}" CPACK_DEBIAN_PACKAGE_DESCRIPTION)
+ else()
+ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "no package description available")
endif()
endif()
@@ -842,12 +861,24 @@ function(cpack_deb_prepare_package_vars)
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
endif()
+ if(CPACK_DEBIAN_ARCHIVE_TYPE)
+ set(archive_types_ "paxr;gnutar")
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0057 NEW)
+ if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_)
+ message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported"
+ "type ${CPACK_DEBIAN_ARCHIVE_TYPE}")
+ endif()
+ cmake_policy(POP)
+ else()
+ set(CPACK_DEBIAN_ARCHIVE_TYPE "paxr")
+ endif()
+
# Compression: (recommended)
if(NOT CPACK_DEBIAN_COMPRESSION_TYPE)
set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
endif()
-
# Recommends:
# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
@@ -1000,6 +1031,7 @@ function(cpack_deb_prepare_package_vars)
set(GEN_CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_DEBIAN_PACKAGE_MAINTAINER}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_ARCHIVE_TYPE "${CPACK_DEBIAN_ARCHIVE_TYPE}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_COMPRESSION_TYPE "${CPACK_DEBIAN_COMPRESSION_TYPE}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_RECOMMENDS "${CPACK_DEBIAN_PACKAGE_RECOMMENDS}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_SUGGESTS "${CPACK_DEBIAN_PACKAGE_SUGGESTS}" PARENT_SCOPE)
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 083fc28..bb1285d 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -131,6 +131,14 @@
#
# Filename for a custom installer control script.
#
+# .. variable:: CPACK_IFW_PACKAGE_RESOURCES
+#
+# List of additional resources ('.qrc' files) to include in the installer
+# binary.
+#
+# You can use :command:`cpack_ifw_add_package_resources` command to resolve
+# relative paths.
+#
# .. variable:: CPACK_IFW_REPOSITORIES_ALL
#
# The list of remote repositories.
@@ -181,136 +189,174 @@
#
# The module defines the following commands:
#
-# --------------------------------------------------------------------------
-#
# .. command:: cpack_ifw_configure_component
#
-# Sets the arguments specific to the CPack IFW generator.
+# Sets the arguments specific to the CPack IFW generator.
#
-# ::
+# ::
#
-# cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL]
-# [NAME <name>]
-# [VERSION <version>]
-# [SCRIPT <script>]
-# [PRIORITY <priority>]
-# [DEPENDS <com_id> ...]
-# [LICENSES <display_name> <file_path> ...])
+# cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL]
+# [NAME <name>]
+# [VERSION <version>]
+# [SCRIPT <script>]
+# [PRIORITY <priority>]
+# [DEPENDS <com_id> ...]
+# [LICENSES <display_name> <file_path> ...]
+# [USER_INTERFACES <file_path> <file_path> ...])
#
-# This command should be called after :command:`cpack_add_component` command.
+# This command should be called after :command:`cpack_add_component` command.
#
-# ``COMMON`` if set, then the component will be packaged and installed as part
-# of a group to which it belongs.
+# ``COMMON``
+# if set, then the component will be packaged and installed as part
+# of a group to which it belongs.
#
-# ``ESSENTIAL`` if set, then the package manager stays disabled until that
-# component is updated.
+# ``ESSENTIAL``
+# if set, then the package manager stays disabled until that
+# component is updated.
#
-# ``NAME`` is used to create domain-like identification for this component.
-# By default used origin component name.
+# ``NAME``
+# is used to create domain-like identification for this component.
+# By default used origin component name.
#
-# ``VERSION`` is version of component.
-# By default used :variable:`CPACK_PACKAGE_VERSION`.
+# ``VERSION``
+# is version of component.
+# By default used :variable:`CPACK_PACKAGE_VERSION`.
#
-# ``SCRIPT`` is a relative or absolute path to operations script
-# for this component.
+# ``SCRIPT``
+# is a relative or absolute path to operations script
+# for this component.
#
-# ``PRIORITY`` is priority of the component in the tree.
+# ``PRIORITY``
+# is priority of the component in the tree.
#
-# ``DEPENDS`` list of dependency component identifiers in QtIFW_ style.
+# ``DEPENDS``
+# list of dependency component identifiers in QtIFW_ style.
#
-# ``LICENSES`` pair of <display_name> and <file_path> of license text for this
-# component. You can specify more then one license.
+# ``LICENSES``
+# pair of <display_name> and <file_path> of license text for this
+# component. You can specify more then one license.
+#
+# ``USER_INTERFACES``
+# a list of <file_path> representing pages to load
#
-# --------------------------------------------------------------------------
#
# .. command:: cpack_ifw_configure_component_group
#
-# Sets the arguments specific to the CPack IFW generator.
+# Sets the arguments specific to the CPack IFW generator.
#
-# ::
+# ::
#
-# cpack_ifw_configure_component_group(<groupname>
-# [NAME <name>]
-# [VERSION <version>]
-# [SCRIPT <script>]
-# [PRIORITY <priority>]
-# [LICENSES <display_name> <file_path> ...])
+# cpack_ifw_configure_component_group(<groupname>
+# [NAME <name>]
+# [VERSION <version>]
+# [SCRIPT <script>]
+# [PRIORITY <priority>]
+# [LICENSES <display_name> <file_path> ...]
+# [USER_INTERFACES <file_path> <file_path> ...])
#
-# This command should be called after :command:`cpack_add_component_group`
-# command.
+# This command should be called after :command:`cpack_add_component_group`
+# command.
#
-# ``NAME`` is used to create domain-like identification for this component
-# group.
-# By default used origin component group name.
+# ``NAME``
+# is used to create domain-like identification for this component group.
+# By default used origin component group name.
#
-# ``VERSION`` is version of component group.
-# By default used :variable:`CPACK_PACKAGE_VERSION`.
+# ``VERSION``
+# is version of component group.
+# By default used :variable:`CPACK_PACKAGE_VERSION`.
#
-# ``SCRIPT`` is a relative or absolute path to operations script
-# for this component group.
+# ``SCRIPT``
+# is a relative or absolute path to operations script
+# for this component group.
#
-# ``PRIORITY`` is priority of the component group in the tree.
+# ``PRIORITY``
+# is priority of the component group in the tree.
#
-# ``LICENSES`` pair of <display_name> and <file_path> of license text for this
-# component group. You can specify more then one license.
+# ``LICENSES``
+# pair of <display_name> and <file_path> of license text for this
+# component group. You can specify more then one license.
#
-# --------------------------------------------------------------------------
+# ``USER_INTERFACES``
+# a list of <file_path> representing pages to load
#
-# .. command:: cpack_ifw_add_repository
#
-# Add QtIFW_ specific remote repository to binary installer.
+# .. command:: cpack_ifw_add_repository
#
-# ::
+# Add QtIFW_ specific remote repository to binary installer.
#
-# cpack_ifw_add_repository(<reponame> [DISABLED]
-# URL <url>
-# [USERNAME <username>]
-# [PASSWORD <password>]
-# [DISPLAY_NAME <display_name>])
+# ::
#
-# This command will also add the <reponame> repository
-# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`.
+# cpack_ifw_add_repository(<reponame> [DISABLED]
+# URL <url>
+# [USERNAME <username>]
+# [PASSWORD <password>]
+# [DISPLAY_NAME <display_name>])
#
-# ``DISABLED`` if set, then the repository will be disabled by default.
+# This command will also add the <reponame> repository
+# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`.
#
-# ``URL`` is points to a list of available components.
+# ``DISABLED``
+# if set, then the repository will be disabled by default.
#
-# ``USERNAME`` is used as user on a protected repository.
+# ``URL``
+# is points to a list of available components.
#
-# ``PASSWORD`` is password to use on a protected repository.
+# ``USERNAME``
+# is used as user on a protected repository.
#
-# ``DISPLAY_NAME`` is string to display instead of the URL.
+# ``PASSWORD``
+# is password to use on a protected repository.
#
+# ``DISPLAY_NAME``
+# is string to display instead of the URL.
#
-# --------------------------------------------------------------------------
#
# .. command:: cpack_ifw_update_repository
#
-# Update QtIFW_ specific repository from remote repository.
+# Update QtIFW_ specific repository from remote repository.
+#
+# ::
+#
+# cpack_ifw_update_repository(<reponame>
+# [[ADD|REMOVE] URL <url>]|
+# [REPLACE OLD_URL <old_url> NEW_URL <new_url>]]
+# [USERNAME <username>]
+# [PASSWORD <password>]
+# [DISPLAY_NAME <display_name>])
+#
+# This command will also add the <reponame> repository
+# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`.
+#
+# ``URL``
+# is points to a list of available components.
+#
+# ``OLD_URL``
+# is points to a list that will replaced.
+#
+# ``NEW_URL``
+# is points to a list that will replace to.
#
-# ::
+# ``USERNAME``
+# is used as user on a protected repository.
#
-# cpack_ifw_update_repository(<reponame>
-# [[ADD|REMOVE] URL <url>]|
-# [REPLACE OLD_URL <old_url> NEW_URL <new_url>]]
-# [USERNAME <username>]
-# [PASSWORD <password>]
-# [DISPLAY_NAME <display_name>])
+# ``PASSWORD``
+# is password to use on a protected repository.
#
-# This command will also add the <reponame> repository
-# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`.
+# ``DISPLAY_NAME``
+# is string to display instead of the URL.
#
-# ``URL`` is points to a list of available components.
#
-# ``OLD_URL`` is points to a list that will replaced.
+# .. command:: cpack_ifw_add_package_resources
#
-# ``NEW_URL`` is points to a list that will replace to.
+# Add additional resources in the installer binary.
#
-# ``USERNAME`` is used as user on a protected repository.
+# ::
#
-# ``PASSWORD`` is password to use on a protected repository.
+# cpack_ifw_add_package_resources(<file_path> <file_path> ...)
+#
+# This command will also add the specified files
+# to a variable :variable:`CPACK_IFW_PACKAGE_RESOURCES`.
#
-# ``DISPLAY_NAME`` is string to display instead of the URL.
#
# Example usage
# ^^^^^^^^^^^^^
@@ -362,16 +408,16 @@
#
# Qt Installer Framework Manual:
#
-# Index page
+# * Index page:
# http://doc.qt.io/qtinstallerframework/index.html
#
-# Component Scripting
+# * Component Scripting:
# http://doc.qt.io/qtinstallerframework/scripting.html
#
-# Predefined Variables
+# * Predefined Variables:
# http://doc.qt.io/qtinstallerframework/scripting.html#predefined-variables
#
-# Promoting Updates
+# * Promoting Updates:
# http://doc.qt.io/qtinstallerframework/ifw-updates.html
#
# Download Qt Installer Framework for you platform from Qt site:
@@ -543,6 +589,22 @@ macro(_cpack_ifw_resolve_lisenses _variable)
endif()
endmacro()
+# Resolve full path to a list of provided files
+macro(_cpack_ifw_resolve_file_list _variable)
+ if(${_variable})
+ set(_ifw_list_fix)
+ foreach(_ifw_file_arg ${${_variable}})
+ get_filename_component(_ifw_file_arg "${_ifw_file_arg}" ABSOLUTE)
+ if(EXISTS ${_ifw_file_arg})
+ list(APPEND _ifw_list_fix "${_ifw_file_arg}")
+ else()
+ message(WARNING "CPack IFW: page file \"${_ifw_file_arg}\" does not exist. Skipping")
+ endif()
+ endforeach(_ifw_file_arg)
+ set(${_variable} "${_ifw_list_fix}")
+ endif()
+endmacro()
+
# Macro for configure component
macro(cpack_ifw_configure_component compname)
@@ -550,11 +612,12 @@ macro(cpack_ifw_configure_component compname)
set(_IFW_OPT COMMON ESSENTIAL)
set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
- set(_IFW_MULTI_ARGS DEPENDS LICENSES)
+ set(_IFW_MULTI_ARGS DEPENDS LICENSES USER_INTERFACES)
cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
_cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT)
_cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES)
+ _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_USER_INTERFACES)
set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n")
@@ -571,7 +634,7 @@ macro(cpack_ifw_configure_component compname)
endforeach()
foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
- cpack_append_variable_set_command(
+ cpack_append_list_variable_set_command(
CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
_CPACK_IFWCOMP_STR)
endforeach()
@@ -589,11 +652,12 @@ macro(cpack_ifw_configure_component_group grpname)
set(_IFW_OPT)
set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
- set(_IFW_MULTI_ARGS LICENSES)
+ set(_IFW_MULTI_ARGS LICENSES USER_INTERFACES)
cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
_cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT)
_cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES)
+ _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_USER_INTERFACES)
set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n")
@@ -604,7 +668,7 @@ macro(cpack_ifw_configure_component_group grpname)
endforeach()
foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
- cpack_append_variable_set_command(
+ cpack_append_list_variable_set_command(
CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
_CPACK_IFWGRP_STR)
endforeach()
@@ -645,7 +709,7 @@ macro(cpack_ifw_add_repository reponame)
endforeach()
list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})
- set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
+ string(APPEND _CPACK_IFWREPO_STR "list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
if(CPack_CMake_INCLUDED)
file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}")
@@ -687,7 +751,7 @@ macro(cpack_ifw_update_repository reponame)
OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REMOVE
OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REPLACE)
list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})
- set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
+ string(APPEND _CPACK_IFWREPO_STR "list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
else()
set(_CPACK_IFWREPO_STR)
endif()
@@ -698,6 +762,17 @@ macro(cpack_ifw_update_repository reponame)
endmacro()
+# Macro for adding resources
+macro(cpack_ifw_add_package_resources)
+ set(_CPACK_IFW_PACKAGE_RESOURCES ${ARGV})
+ _cpack_ifw_resolve_file_list(_CPACK_IFW_PACKAGE_RESOURCES)
+ list(APPEND CPACK_IFW_PACKAGE_RESOURCES ${_CPACK_IFW_PACKAGE_RESOURCES})
+ set(_CPACK_IFWQRC_STR "list(APPEND CPACK_IFW_PACKAGE_RESOURCES \"${_CPACK_IFW_PACKAGE_RESOURCES}\")\n")
+ if(CPack_CMake_INCLUDED)
+ file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWQRC_STR}")
+ endif()
+endmacro()
+
# Resolve package control script
_cpack_ifw_resolve_script(CPACK_IFW_PACKAGE_CONTROL_SCRIPT)
diff --git a/Modules/CPackProductBuild.cmake b/Modules/CPackProductBuild.cmake
new file mode 100644
index 0000000..6545a3a
--- /dev/null
+++ b/Modules/CPackProductBuild.cmake
@@ -0,0 +1,38 @@
+#.rst:
+# CPackProductBuild
+# -----------------
+#
+# productbuild CPack generator (Mac OS X).
+#
+# Variables specific to CPack productbuild generator
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# The following variable is specific to installers built on Mac
+# OS X using productbuild:
+#
+# .. variable:: CPACK_COMMAND_PRODUCTBUILD
+#
+# Path to the productbuild(1) command used to generate a product archive for
+# the OS X Installer or Mac App Store. This variable can be used to override
+# the automatically detected command (or specify its location if the
+# auto-detection fails to find it.)
+#
+# .. variable:: CPACK_COMMAND_PKGBUILD
+#
+# Path to the pkgbuild(1) command used to generate an OS X component package
+# on OS X. This variable can be used to override the automatically detected
+# command (or specify its location if the auto-detection fails to find it.)
+#
+
+#=============================================================================
+# Copyright 2006-2012 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.)
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 9cc496f..d78f7fa 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -60,6 +60,14 @@
# * Mandatory : YES
# * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
#
+# .. variable:: CPACK_RPM_DEBUGINFO_PACKAGE
+# CPACK_RPM_<component>_DEBUGINFO_PACKAGE
+#
+# Option to additionally generate debuginfo RPM package(s).
+#
+# * Mandatory : NO
+# * Default : OFF
+#
# .. variable:: CPACK_RPM_PACKAGE_NAME
# CPACK_RPM_<component>_PACKAGE_NAME
#
@@ -698,6 +706,77 @@
# symbolic link(s) is also on a relocatable path, relocating it during
# package installation may cause initial symbolic link to point to an
# invalid location.
+#
+# Packaging of sources (SRPM)
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# SRPM packaging is enabled by setting :variable:`CPACK_RPM_PACKAGE_SOURCES`
+# variable while usually using :variable:`CPACK_INSTALLED_DIRECTORIES` variable
+# to provide directory containing CMakeLists.txt and source files.
+#
+# For CMake projects SRPM package would be product by executing:
+#
+# ``cpack -G RPM --config ./CPackSourceConfig.cmake``
+#
+# .. note::
+#
+# Produced SRPM package is expected to be built with :manual:`cmake(1)` executable
+# and packaged with :manual:`cpack(1)` executable so CMakeLists.txt has to be
+# located in root source directory and must be able to generate binary rpm
+# packages by executing ``cpack -G`` command. The two executables as well as
+# rpmbuild must also be present when generating binary rpm packages from the
+# produced SRPM package.
+#
+# Once the SRPM package is generated it can be used to generate binary packages
+# by creating a directory structure for rpm generation and executing rpmbuild
+# tool:
+#
+# ``mkdir -p build_dir/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}``
+# ``rpmbuild --define "_topdir <path_to_build_dir>" --rebuild <SRPM_file_name>``
+#
+# Generated packages will be located in build_dir/RPMS directory or its sub
+# directories.
+#
+# .. note::
+#
+# SRPM package internally uses CPack/RPM generator to generate binary packages
+# so CMakeScripts.txt can decide during the SRPM to binary rpm generation step
+# what content the package(s) should have as well as how they should be packaged
+# (monolithic or components). CMake can decide this for e.g. by reading environment
+# variables set by the package manager before starting the process of generating
+# binary rpm packages. This way a single SRPM package can be used to produce
+# different binary rpm packages on different platforms depending on the platform's
+# packaging rules.
+#
+# Source RPM packaging has it's own set of variables:
+#
+# .. variable:: CPACK_RPM_PACKAGE_SOURCES
+#
+# Should the content be packaged as a source rpm (default is binary rpm).
+#
+# * Mandatory : NO
+# * Default : OFF
+#
+# .. note::
+#
+# For cmake projects :variable:`CPACK_RPM_PACKAGE_SOURCES` variable is set
+# to ``OFF`` in CPackConfig.cmake and ``ON`` in CPackSourceConfig.cmake
+# generated files.
+#
+# .. variable:: CPACK_RPM_SOURCE_PKG_BUILD_PARAMS
+#
+# Additional command-line parameters provided to :manual:`cmake(1)` executable.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# .. variable:: CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX
+#
+# Packaging install prefix that would be provided in :variable:`CPACK_PACKAGING_INSTALL_PREFIX`
+# variable for producing binary RPM packages.
+#
+# * Mandatory : YES
+# * Default : "/"
#=============================================================================
# Copyright 2007-2016 Kitware, Inc.
@@ -761,7 +840,7 @@ function(cpack_rpm_prepare_relocation_paths)
if(NOT CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION AND
NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT}_INSTALL_PREFIX_RELOCATION AND
NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_INSTALL_PREFIX_RELOCATION)
- set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n")
+ string(APPEND TMP_RPM_PREFIXES "Prefix: ${PATH_PREFIX}\n")
list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}")
if(CPACK_RPM_PACKAGE_DEBUG)
@@ -779,7 +858,7 @@ function(cpack_rpm_prepare_relocation_paths)
endif()
if(EXISTS "${WDIR}/${PREPARED_RELOCATION_PATH}")
- set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PREPARED_RELOCATION_PATH}\n")
+ string(APPEND TMP_RPM_PREFIXES "Prefix: ${PREPARED_RELOCATION_PATH}\n")
list(APPEND RPM_USED_PACKAGE_PREFIXES "${PREPARED_RELOCATION_PATH}")
endif()
endforeach()
@@ -839,7 +918,10 @@ function(cpack_rpm_prepare_content_list)
set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}")
string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS " ${_RPM_RELOCATION_PREFIX}")
- list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0007 NEW)
+ list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
+ cmake_policy(POP)
unset(_TMP_LIST)
# Now generate all of the parent dirs of the relocation path
foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
@@ -859,7 +941,9 @@ function(cpack_rpm_prepare_content_list)
if(NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST)
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include)
if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION)
- message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.")
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.")
+ endif()
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}")
endif()
endif()
@@ -952,7 +1036,7 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES)
if("${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}")
set(INDENT "")
else()
- set(SCRIPT_PART "${SCRIPT_PART} if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n")
+ string(APPEND SCRIPT_PART " if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n")
set(INDENT " ")
endif()
@@ -969,14 +1053,14 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES)
math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN})
string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_)
- set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
- set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n")
- set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n")
- set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}fi\n")
+ string(APPEND SCRIPT_PART " ${INDENT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
+ string(APPEND SCRIPT_PART " ${INDENT}ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n")
+ string(APPEND SCRIPT_PART " ${INDENT}CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n")
+ string(APPEND SCRIPT_PART " ${INDENT}fi\n")
endforeach()
if(NOT "${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}")
- set(SCRIPT_PART "${SCRIPT_PART} fi\n")
+ string(APPEND SCRIPT_PART " fi\n")
endif()
endif()
endforeach()
@@ -996,16 +1080,16 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES)
math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1)
string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_)
- set(SCRIPT_PART "${SCRIPT_PART} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
- set(SCRIPT_PART "${SCRIPT_PART} ln -s \"${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n")
- set(SCRIPT_PART "${SCRIPT_PART} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n")
- set(SCRIPT_PART "${SCRIPT_PART} fi\n")
+ string(APPEND SCRIPT_PART " if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
+ string(APPEND SCRIPT_PART " ln -s \"${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n")
+ string(APPEND SCRIPT_PART " CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n")
+ string(APPEND SCRIPT_PART " fi\n")
endforeach()
endif()
if(PARTS_CNT)
set(SCRIPT "${SCRIPT_PART}")
- set(SCRIPT "${SCRIPT}fi\n")
+ string(APPEND SCRIPT "fi\n")
endif()
endforeach()
@@ -1016,7 +1100,7 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES)
string(LENGTH "${POINT_PATH}" POINT_PATH_LEN)
if(_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX})
- set(SCRIPT "${SCRIPT}if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n")
+ string(APPEND SCRIPT "if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n")
foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX})
math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1)
@@ -1028,13 +1112,13 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES)
math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN})
string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_)
- set(SCRIPT "${SCRIPT} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
- set(SCRIPT "${SCRIPT} ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"${SYMLINK_}\"\n")
- set(SCRIPT "${SCRIPT} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n")
- set(SCRIPT "${SCRIPT} fi\n")
+ string(APPEND SCRIPT " if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
+ string(APPEND SCRIPT " ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"${SYMLINK_}\"\n")
+ string(APPEND SCRIPT " CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n")
+ string(APPEND SCRIPT " fi\n")
endforeach()
- set(SCRIPT "${SCRIPT}fi\n")
+ string(APPEND SCRIPT "fi\n")
endif()
endforeach()
@@ -1050,9 +1134,9 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES)
math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1)
string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_)
- set(SCRIPT "${SCRIPT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
- set(SCRIPT "${SCRIPT} ln -s \"${POINT_}\" \"${SYMLINK_}\"\n")
- set(SCRIPT "${SCRIPT}fi\n")
+ string(APPEND SCRIPT "if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
+ string(APPEND SCRIPT " ln -s \"${POINT_}\" \"${SYMLINK_}\"\n")
+ string(APPEND SCRIPT "fi\n")
endforeach()
endif()
@@ -1215,7 +1299,7 @@ function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXE
set(DIRECTIVE "%dir ")
endif()
- set(INSTALL_FILES "${INSTALL_FILES}${DIRECTIVE}\"${F}\"\n")
+ string(APPEND INSTALL_FILES "${DIRECTIVE}\"${F}\"\n")
endforeach()
if(REQUIRES_SYMLINK_RELOCATION_SCRIPT)
@@ -1234,6 +1318,30 @@ if(NOT UNIX)
message(FATAL_ERROR "CPackRPM.cmake may only be used under UNIX.")
endif()
+# We need to check if the binaries were compiled with debug symbols
+# because without them the package will be useless
+function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR)
+ # With objdump we should check the debug symbols
+ find_program(OBJDUMP_EXECUTABLE objdump)
+ if(NOT OBJDUMP_EXECUTABLE)
+ message(WARNING "CPackRPM: objdump binary could not be found!")
+ endif()
+
+ foreach(F IN LISTS INSTALL_FILES)
+ execute_process(COMMAND "${OBJDUMP_EXECUTABLE}" -h ${WORKING_DIR}/${F}
+ WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}"
+ RESULT_VARIABLE OBJDUMP_EXEC_RESULT
+ OUTPUT_VARIABLE OBJDUMP_OUT)
+ # Check that if the given file was executable or not
+ if(NOT OBJDUMP_EXEC_RESULT)
+ string(FIND "${OBJDUMP_OUT}" "debug" FIND_RESULT)
+ if(NOT FIND_RESULT GREATER -1)
+ message(WARNING "CPackRPM: File: ${F} does not contain debug symbols. They will possibly be missing from debuginfo package!")
+ endif()
+ endif()
+ endforeach()
+endfunction()
+
function(cpack_rpm_variable_fallback OUTPUT_VAR_NAME)
set(FALLBACK_VAR_NAMES ${ARGN})
@@ -1346,7 +1454,7 @@ function(cpack_rpm_generate_package)
endif()
if(CPACK_RPM_PACKAGE_COMPONENT)
- set(CPACK_RPM_PACKAGE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_COMPONENT}")
+ string(APPEND CPACK_RPM_PACKAGE_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_NAME"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME")
@@ -1405,7 +1513,7 @@ function(cpack_rpm_generate_package)
endif()
if(CPACK_RPM_PACKAGE_RELEASE_DIST)
- set(CPACK_RPM_PACKAGE_RELEASE "${CPACK_RPM_PACKAGE_RELEASE}%{?dist}")
+ string(APPEND CPACK_RPM_PACKAGE_RELEASE "%{?dist}")
endif()
# CPACK_RPM_PACKAGE_LICENSE
@@ -1481,18 +1589,27 @@ function(cpack_rpm_generate_package)
set(CPACK_RPM_COMPRESSION_TYPE_TMP "")
endif()
- if(CPACK_PACKAGE_RELOCATABLE OR CPACK_RPM_PACKAGE_RELOCATABLE)
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: Trying to build a relocatable package")
+ if(NOT CPACK_RPM_PACKAGE_SOURCES)
+ if(CPACK_PACKAGE_RELOCATABLE OR CPACK_RPM_PACKAGE_RELOCATABLE)
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: Trying to build a relocatable package")
+ endif()
+ if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON"))
+ message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.")
+ set(CPACK_RPM_PACKAGE_RELOCATABLE FALSE)
+ else()
+ set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) # kept for back compatibility (provided external RPM spec files)
+ cpack_rpm_prepare_relocation_paths()
+ set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE)
+ endif()
endif()
- if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON"))
- message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.")
- set(CPACK_RPM_PACKAGE_RELOCATABLE FALSE)
- else()
- set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) # kept for back compatibility (provided external RPM spec files)
- cpack_rpm_prepare_relocation_paths()
- set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE)
+ else()
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ message(FATAL_ERROR "CPACK_RPM_PACKAGE_SOURCES parameter can not be used"
+ " in combination with CPACK_RPM_PACKAGE_COMPONENT parameter!")
endif()
+
+ set(CPACK_RPM_PACKAGE_RELOCATABLE FALSE) # disable relocatable option if building source RPM
endif()
# Check if additional fields for RPM spec header are given
@@ -1524,13 +1641,13 @@ function(cpack_rpm_generate_package)
string(SUBSTRING ${_RPM_SPEC_HEADER} 1 -1 _PACKAGE_HEADER_TAIL)
string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL)
string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME)
- set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}")
+ string(APPEND _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_TAIL}")
# The following keywords require parentheses around the "pre" or "post" suffix in the final RPM spec file.
set(SCRIPTS_REQUIREMENTS_LIST REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN)
list(FIND SCRIPTS_REQUIREMENTS_LIST ${_RPM_SPEC_HEADER} IS_SCRIPTS_REQUIREMENT_FOUND)
if(NOT ${IS_SCRIPTS_REQUIREMENT_FOUND} EQUAL -1)
string(REPLACE "_" "(" _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}")
- set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME})")
+ string(APPEND _PACKAGE_HEADER_NAME ")")
endif()
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}")
@@ -1683,17 +1800,17 @@ function(cpack_rpm_generate_package)
set(CPACK_RPM_USER_INSTALL_FILES "")
foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL)
- string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F})
- string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F})
+ string(REGEX REPLACE "%[A-Za-z]+(\\([^()]*\\))? " "" F_PATH ${F})
+ string(REGEX MATCH "%[A-Za-z]+(\\([^()]*\\))?" F_PREFIX ${F})
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>")
endif()
if(F_PREFIX)
- set(F_PREFIX "${F_PREFIX} ")
+ string(APPEND F_PREFIX " ")
endif()
# Rebuild the user list file
- set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n")
+ string(APPEND CPACK_RPM_USER_INSTALL_FILES "${F_PREFIX}\"${F_PATH}\"\n")
# Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL
list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH})
@@ -1706,7 +1823,7 @@ function(cpack_rpm_generate_package)
# Rebuild CPACK_RPM_INSTALL_FILES
set(CPACK_RPM_INSTALL_FILES "")
foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST)
- set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n")
+ string(APPEND CPACK_RPM_INSTALL_FILES "\"${F}\"\n")
endforeach()
else()
set(CPACK_RPM_USER_INSTALL_FILES "")
@@ -1727,12 +1844,12 @@ function(cpack_rpm_generate_package)
# Rebuild INSTALL_FILES
set(CPACK_RPM_INSTALL_FILES "")
foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST)
- set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n")
+ string(APPEND CPACK_RPM_INSTALL_FILES "\"${F}\"\n")
endforeach()
# Build ABSOLUTE_INSTALL_FILES
set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "")
foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
- set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "${CPACK_RPM_ABSOLUTE_INSTALL_FILES}%config \"${F}\"\n")
+ string(APPEND CPACK_RPM_ABSOLUTE_INSTALL_FILES "%config \"${F}\"\n")
endforeach()
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}")
@@ -1802,6 +1919,15 @@ function(cpack_rpm_generate_package)
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_USER_BINARY_SPECFILE")
endif()
+ cpack_rpm_variable_fallback("CPACK_RPM_DEBUGINFO_PACKAGE"
+ "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_DEBUGINFO_PACKAGE"
+ "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEBUGINFO_PACKAGE"
+ "CPACK_RPM_DEBUGINFO_PACKAGE")
+ if(CPACK_RPM_DEBUGINFO_PACKAGE)
+ cpack_rpm_debugsymbol_check("${CPACK_ABSOLUTE_DESTINATION_FILES}" "${WDIR}")
+ set(TMP_RPM_DEBUGINFO "%debug_package")
+ endif()
+
cpack_rpm_variable_fallback("CPACK_RPM_FILE_NAME"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_FILE_NAME"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_FILE_NAME"
@@ -1822,16 +1948,55 @@ function(cpack_rpm_generate_package)
# else example:
#set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm")
- set(FILE_NAME_DEFINE "%define _rpmfilename ${CPACK_RPM_FILE_NAME}")
+ if(NOT CPACK_RPM_DEBUGINFO_PACKAGE)
+ set(FILE_NAME_DEFINE "%define _rpmfilename ${CPACK_RPM_FILE_NAME}")
+ endif()
endif()
- # We should generate a USER spec file template:
- # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
- # - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE
- if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
+ if(CPACK_RPM_PACKAGE_SOURCES) # source rpm
+ set(archive_name_ "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}")
+
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E tar "cfvz" "${CPACK_RPM_DIRECTORY}/SOURCES/${archive_name_}.tar.gz" "${CPACK_PACKAGE_FILE_NAME}"
+ WORKING_DIRECTORY ${CPACK_RPM_DIRECTORY}
+ )
+ set(TMP_RPM_SOURCE "Source: ${archive_name_}.tar.gz")
+
+ if(CPACK_RPM_BUILDREQUIRES)
+ set(TMP_RPM_BUILD_REQUIRES "BuildRequires: ${CPACK_RPM_BUILDREQUIRES}")
+ endif()
+
+ # Disable debuginfo packages - srpm generates invalid packages due to
+ # releasing controll to cpack to generate binary packages.
+ # Note however that this doesn't prevent cpack to generate debuginfo
+ # packages when run from srpm with --rebuild.
+ set(TMP_RPM_DISABLE_DEBUGINFO "%define debug_package %{nil}")
+
+ if(NOT CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX)
+ set(CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX "/")
+ endif()
+
+ set(TMP_RPM_BUILD
+ "
+%build
+mkdir cpack_rpm_build_dir
+cd cpack_rpm_build_dir
+cmake ${CPACK_RPM_SOURCE_PKG_BUILD_PARAMS} -DCPACK_PACKAGING_INSTALL_PREFIX=${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX} ../${CPACK_PACKAGE_FILE_NAME}
+make %{?_smp_mflags}" # %{?_smp_mflags} -> -j option
+ )
+ set(TMP_RPM_INSTALL
+ "
+cd cpack_rpm_build_dir
+cpack -G RPM
+mv *.rpm %_rpmdir"
+ )
+ set(TMP_RPM_PREP "%setup -c")
+
+ set(RPMBUILD_FLAGS "-bs")
+
file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
"# -*- rpm-spec -*-
-BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@
+BuildRoot: %_topdir/\@CPACK_PACKAGE_FILE_NAME\@
Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@
Name: \@CPACK_RPM_PACKAGE_NAME\@
Version: \@CPACK_RPM_PACKAGE_VERSION\@
@@ -1839,6 +2004,64 @@ Release: \@CPACK_RPM_PACKAGE_RELEASE\@
License: \@CPACK_RPM_PACKAGE_LICENSE\@
Group: \@CPACK_RPM_PACKAGE_GROUP\@
Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
+
+\@TMP_RPM_SOURCE\@
+\@TMP_RPM_BUILD_REQUIRES\@
+\@TMP_RPM_BUILDARCH\@
+\@TMP_RPM_PREFIXES\@
+
+\@TMP_RPM_DISABLE_DEBUGINFO\@
+
+%define _rpmdir %_topdir/RPMS
+%define _srcrpmdir %_topdir/SRPMS
+\@FILE_NAME_DEFINE\@
+%define _unpackaged_files_terminate_build 0
+\@TMP_RPM_SPEC_INSTALL_POST\@
+\@CPACK_RPM_SPEC_MORE_DEFINE\@
+\@CPACK_RPM_COMPRESSION_TYPE_TMP\@
+
+%description
+\@CPACK_RPM_PACKAGE_DESCRIPTION\@
+
+# This is a shortcutted spec file generated by CMake RPM generator
+# we skip _install step because CPack does that for us.
+# We do only save CPack installed tree in _prepr
+# and then restore it in build.
+%prep
+\@TMP_RPM_PREP\@
+
+\@TMP_RPM_BUILD\@
+
+#p build
+
+%install
+\@TMP_RPM_INSTALL\@
+
+%clean
+
+%changelog
+\@CPACK_RPM_SPEC_CHANGELOG\@
+"
+ )
+ else() # binary rpm
+
+ # We should generate a USER spec file template:
+ # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
+ # - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE
+ if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
+ set(RPMBUILD_FLAGS "-bb")
+
+ file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
+ "# -*- rpm-spec -*-
+BuildRoot: %_topdir/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@
+Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@
+Name: \@CPACK_RPM_PACKAGE_NAME\@
+Version: \@CPACK_RPM_PACKAGE_VERSION\@
+Release: \@CPACK_RPM_PACKAGE_RELEASE\@
+License: \@CPACK_RPM_PACKAGE_LICENSE\@
+Group: \@CPACK_RPM_PACKAGE_GROUP\@
+Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
+
\@TMP_RPM_URL\@
\@TMP_RPM_REQUIRES\@
\@TMP_RPM_REQUIRES_PRE\@
@@ -1854,10 +2077,12 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@TMP_RPM_BUILDARCH\@
\@TMP_RPM_PREFIXES\@
-%define _rpmdir \@CPACK_RPM_DIRECTORY\@
+\@TMP_RPM_DEBUGINFO\@
+
+%define _rpmdir %_topdir/RPMS
+%define _srcrpmdir %_topdir/SRPMS
\@FILE_NAME_DEFINE\@
%define _unpackaged_files_terminate_build 0
-%define _topdir \@CPACK_RPM_DIRECTORY\@
\@TMP_RPM_SPEC_INSTALL_POST\@
\@CPACK_RPM_SPEC_MORE_DEFINE\@
\@CPACK_RPM_COMPRESSION_TYPE_TMP\@
@@ -1870,16 +2095,14 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
# We do only save CPack installed tree in _prepr
# and then restore it in build.
%prep
-mv $RPM_BUILD_ROOT \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\"
-
-#p build
+mv $RPM_BUILD_ROOT %_topdir/tmpBBroot
%install
if [ -e $RPM_BUILD_ROOT ];
then
rm -rf $RPM_BUILD_ROOT
fi
-mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
+mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
%clean
@@ -1904,12 +2127,15 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
%changelog
\@CPACK_RPM_SPEC_CHANGELOG\@
-")
+"
+ )
+ endif()
+
# Stop here if we were asked to only generate a template USER spec file
# The generated file may then be used as a template by user who wants
# to customize their own spec file.
if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
- message(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in")
+ message(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file template is: ${CPACK_RPM_BINARY_SPECFILE}.in")
endif()
endif()
@@ -1930,9 +2156,9 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
if(RPMBUILD_EXECUTABLE)
# Now call rpmbuild using the SPECFILE
execute_process(
- COMMAND "${RPMBUILD_EXECUTABLE}" -bb
+ COMMAND "${RPMBUILD_EXECUTABLE}" ${RPMBUILD_FLAGS}
--define "_topdir ${CPACK_RPM_DIRECTORY}"
- --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
+ --buildroot "%_topdir/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" # TODO should I remove this variable? or change the path?
--target "${CPACK_RPM_PACKAGE_ARCHITECTURE}"
"${CPACK_RPM_BINARY_SPECFILE}"
WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
@@ -1959,13 +2185,30 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
# Tell file(GLOB_RECURSE) not to follow directory symlinks
# even if the project does not set this policy to NEW.
cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/*.rpm")
+ file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm"
+ "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm")
cmake_policy(POP)
if(NOT GENERATED_FILES)
message(FATAL_ERROR "RPM package was not generated! ${CPACK_RPM_DIRECTORY}")
endif()
+ if(CPACK_RPM_DEBUGINFO_PACKAGE AND NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
+ string(TOLOWER "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.*\\.rpm" EXPECTED_FILENAME)
+
+ foreach(F IN LISTS GENERATED_FILES)
+ if(F MATCHES ".*/${EXPECTED_FILENAME}")
+ get_filename_component(FILE_PATH "${F}" DIRECTORY)
+ file(RENAME "${F}" "${FILE_PATH}/${CPACK_RPM_FILE_NAME}")
+ list(APPEND new_files_list_ "${FILE_PATH}/${CPACK_RPM_FILE_NAME}")
+ else()
+ list(APPEND new_files_list_ "${F}")
+ endif()
+ endforeach()
+
+ set(GENERATED_FILES "${new_files_list_}")
+ endif()
+
set(GEN_CPACK_OUTPUT_FILES "${GENERATED_FILES}" PARENT_SCOPE)
if(CPACK_RPM_PACKAGE_DEBUG)
diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake
index 3c90561..d02df2d 100644
--- a/Modules/CPackWIX.cmake
+++ b/Modules/CPackWIX.cmake
@@ -147,7 +147,7 @@
# }
#
# Currently fragments can be injected into most
-# Component, File and Directory elements.
+# Component, File, Directory and Feature elements.
#
# The following additional special Ids can be used:
#
@@ -237,6 +237,34 @@
# * ARPURLUPDATEINFO - Update information URL
# * ARPHELPTELEPHONE - Help and support telephone number
# * ARPSIZE - Size (in kilobytes) of the application
+#
+# .. variable:: CPACK_WIX_ROOT_FEATURE_TITLE
+#
+# Sets the name of the root install feature in the WIX installer. Same as
+# CPACK_COMPONENT_<compName>_DISPLAY_NAME for components.
+#
+# .. variable:: CPACK_WIX_ROOT_FEATURE_DESCRIPTION
+#
+# Sets the description of the root install feature in the WIX installer. Same as
+# CPACK_COMPONENT_<compName>_DESCRIPTION for components.
+#
+# .. variable:: CPACK_WIX_SKIP_PROGRAM_FOLDER
+#
+# If this variable is set to true, the default install location
+# of the generated package will be CPACK_PACKAGE_INSTALL_DIRECTORY directly.
+# The install location will not be located relatively below
+# ProgramFiles or ProgramFiles64.
+#
+# .. note::
+# Installers created with this feature do not take differences
+# between the system on which the installer is created
+# and the system on which the installer might be used into account.
+#
+# It is therefor possible that the installer e.g. might try to install
+# onto a drive that is unavailable or unintended or a path that does not
+# follow the localization or convention of the system on which the
+# installation is performed.
+#
#=============================================================================
# Copyright 2014-2015 Kitware, Inc.
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
index a27eb4b..ce725c5 100644
--- a/Modules/CTest.cmake
+++ b/Modules/CTest.cmake
@@ -224,16 +224,16 @@ if(BUILD_TESTING)
set(BUILD_NAME_SYSTEM_NAME "Win32")
endif()
if(UNIX OR BORLAND)
- get_filename_component(DART_CXX_NAME
- "${CMAKE_CXX_COMPILER}" ${DART_NAME_COMPONENT})
+ get_filename_component(DART_COMPILER_NAME
+ "${DART_COMPILER}" ${DART_NAME_COMPONENT})
else()
- get_filename_component(DART_CXX_NAME
+ get_filename_component(DART_COMPILER_NAME
"${CMAKE_MAKE_PROGRAM}" ${DART_NAME_COMPONENT})
endif()
- if(DART_CXX_NAME MATCHES "devenv")
- GET_VS_VERSION_STRING("${CMAKE_GENERATOR}" DART_CXX_NAME)
+ if(DART_COMPILER_NAME MATCHES "devenv")
+ GET_VS_VERSION_STRING("${CMAKE_GENERATOR}" DART_COMPILER_NAME)
endif()
- set(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}")
+ set(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_COMPILER_NAME}")
endif()
# the build command
diff --git a/Modules/CTestUseLaunchers.cmake b/Modules/CTestUseLaunchers.cmake
index c79119f..1a57d00 100644
--- a/Modules/CTestUseLaunchers.cmake
+++ b/Modules/CTestUseLaunchers.cmake
@@ -59,7 +59,7 @@ if(CTEST_USE_LAUNCHERS)
"${__launch_common_options} --output <OUTPUT>")
if("${CMAKE_GENERATOR}" MATCHES "Ninja")
- set(__launch_compile_options "${__launch_compile_options} --filter-prefix <CMAKE_CL_SHOWINCLUDES_PREFIX>")
+ string(APPEND __launch_compile_options " --filter-prefix <CMAKE_CL_SHOWINCLUDES_PREFIX>")
endif()
set(CTEST_LAUNCH_COMPILE
diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake
index 0bdcffa..967b830 100644
--- a/Modules/CheckFortranSourceCompiles.cmake
+++ b/Modules/CheckFortranSourceCompiles.cmake
@@ -4,7 +4,8 @@
#
# Check if given Fortran source compiles and links into an executable::
#
-# CHECK_Fortran_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>])
+# CHECK_Fortran_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>]
+# [SRC_EXT <ext>])
#
# The arguments are:
#
@@ -13,8 +14,10 @@
# ``<var>``
# Variable to store whether the source code compiled.
# Will be created as an internal cache variable.
-# ``<fail-regex>``
+# ``FAIL_REGEX <fail-regex>``
# Fail if test output matches this regex.
+# ``SRC_EXT <ext>``
+# Use source extension ``.<ext>`` instead of the default ``.F``.
#
# The following variables may be set before calling this macro to modify
# the way the check is run::
@@ -43,9 +46,10 @@
macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
if(NOT DEFINED "${VAR}")
set(_FAIL_REGEX)
+ set(_SRC_EXT)
set(_key)
foreach(arg ${ARGN})
- if("${arg}" MATCHES "^(FAIL_REGEX)$")
+ if("${arg}" MATCHES "^(FAIL_REGEX|SRC_EXT)$")
set(_key "${arg}")
elseif(_key)
list(APPEND _${_key} "${arg}")
@@ -53,6 +57,9 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
message(FATAL_ERROR "Unknown argument:\n ${arg}\n")
endif()
endforeach()
+ if(NOT _SRC_EXT)
+ set(_SRC_EXT F)
+ endif()
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
@@ -67,7 +74,7 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
else()
set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES)
endif()
- file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F"
+ file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}"
"${SOURCE}\n")
if(NOT CMAKE_REQUIRED_QUIET)
@@ -75,7 +82,7 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
endif()
try_compile(${VAR}
${CMAKE_BINARY_DIR}
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
index ef1e39d..cfbc28f 100644
--- a/Modules/CheckIncludeFile.cmake
+++ b/Modules/CheckIncludeFile.cmake
@@ -60,7 +60,7 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
endif()
if(${ARGC} EQUAL 3)
set(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS})
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}")
+ string(APPEND CMAKE_C_FLAGS " ${ARGV2}")
endif()
try_compile(${VARIABLE}
diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake
index 9a6df3b..59df7cb 100644
--- a/Modules/CheckIncludeFileCXX.cmake
+++ b/Modules/CheckIncludeFileCXX.cmake
@@ -59,7 +59,7 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
endif()
if(${ARGC} EQUAL 3)
set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}")
+ string(APPEND CMAKE_CXX_FLAGS " ${ARGV2}")
endif()
try_compile(${VARIABLE}
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 843cd35..3657c95 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -55,11 +55,11 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
set(CHECK_INCLUDE_FILES_CONTENT "/* */\n")
set(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS})
foreach(FILE ${INCLUDE})
- set(CMAKE_CONFIGURABLE_FILE_CONTENT
- "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
+ string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT
+ "#include <${FILE}>\n")
endforeach()
- set(CMAKE_CONFIGURABLE_FILE_CONTENT
- "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(void){return 0;}\n")
+ string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT
+ "\n\nint main(void){return 0;}\n")
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY)
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
index e203d4c..b9345e7 100644
--- a/Modules/CheckPrototypeDefinition.cmake
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -75,8 +75,8 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB
endif()
foreach(_FILE ${_HEADER})
- set(CHECK_PROTOTYPE_DEFINITION_HEADER
- "${CHECK_PROTOTYPE_DEFINITION_HEADER}#include <${_FILE}>\n")
+ string(APPEND CHECK_PROTOTYPE_DEFINITION_HEADER
+ "#include <${_FILE}>\n")
endforeach()
set(CHECK_PROTOTYPE_DEFINITION_SYMBOL ${_FUNCTION})
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index 6c15205..e9e5a18 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -54,7 +54,7 @@ include(CheckCXXSourceCompiles)
macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
set(_INCLUDE_FILES)
foreach (it ${_HEADER})
- set(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
+ string(APPEND _INCLUDE_FILES "#include <${it}>\n")
endforeach ()
if("x${ARGN}" STREQUAL "x")
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index c4dff3f..a62d1e1 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -71,11 +71,11 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
set(CMAKE_SYMBOL_EXISTS_INCLUDES)
endif()
foreach(FILE ${FILES})
- set(CMAKE_CONFIGURABLE_FILE_CONTENT
- "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
+ string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT
+ "#include <${FILE}>\n")
endforeach()
- set(CMAKE_CONFIGURABLE_FILE_CONTENT
- "${CMAKE_CONFIGURABLE_FILE_CONTENT}\nint main(int argc, char** argv)\n{\n (void)argv;\n#ifndef ${SYMBOL}\n return ((int*)(&${SYMBOL}))[argc];\n#else\n (void)argc;\n return 0;\n#endif\n}\n")
+ string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT
+ "\nint main(int argc, char** argv)\n{\n (void)argv;\n#ifndef ${SYMBOL}\n return ((int*)(&${SYMBOL}))[argc];\n#else\n (void)argc;\n return 0;\n#endif\n}\n")
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${SOURCEFILE}" @ONLY)
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index 5938d6c..827905b 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -97,17 +97,17 @@ function(__check_type_size_impl type var map builtin language)
set(headers)
if(builtin)
if(HAVE_SYS_TYPES_H)
- set(headers "${headers}#include <sys/types.h>\n")
+ string(APPEND headers "#include <sys/types.h>\n")
endif()
if(HAVE_STDINT_H)
- set(headers "${headers}#include <stdint.h>\n")
+ string(APPEND headers "#include <stdint.h>\n")
endif()
if(HAVE_STDDEF_H)
- set(headers "${headers}#include <stddef.h>\n")
+ string(APPEND headers "#include <stddef.h>\n")
endif()
endif()
foreach(h ${CMAKE_EXTRA_INCLUDE_FILES})
- set(headers "${headers}#include \"${h}\"\n")
+ string(APPEND headers "#include \"${h}\"\n")
endforeach()
# Perform the check.
@@ -157,7 +157,7 @@ function(__check_type_size_impl type var map builtin language)
string(REGEX MATCH "${regex_key}" key "${info}")
string(REGEX REPLACE "${regex_key}" "\\1" key "${key}")
if(key)
- set(code "${code}\nset(${var}-${key} \"${size}\")")
+ string(APPEND code "\nset(${var}-${key} \"${size}\")")
list(APPEND keys ${key})
endif()
endif()
diff --git a/Modules/Compiler/ARMCC.cmake b/Modules/Compiler/ARMCC.cmake
index 3cf628c..2ec75c3 100644
--- a/Modules/Compiler/ARMCC.cmake
+++ b/Modules/Compiler/ARMCC.cmake
@@ -20,11 +20,11 @@ set(CMAKE_AR "${CMAKE_ARMCC_AR}" CACHE FILEPATH "The ARMCC archiver" FORCE)
mark_as_advanced(CMAKE_ARMCC_AR)
macro(__compiler_armcc lang)
- set(CMAKE_${lang}_FLAGS_INIT "")
- set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")
- set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Ospace -DNDEBUG")
- set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-Otime -DNDEBUG")
- set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Ospace -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -Otime -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
set(CMAKE_${lang}_OUTPUT_EXTENSION ".o")
set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1)
diff --git a/Modules/Compiler/Absoft-Fortran.cmake b/Modules/Compiler/Absoft-Fortran.cmake
index 2e1666f..da1fc80 100644
--- a/Modules/Compiler/Absoft-Fortran.cmake
+++ b/Modules/Compiler/Absoft-Fortran.cmake
@@ -1,8 +1,8 @@
-set(CMAKE_Fortran_FLAGS_INIT "")
-set(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "")
-set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3")
-set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+string(APPEND CMAKE_Fortran_FLAGS_INIT " ")
+string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " ")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
+string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
set(CMAKE_Fortran_MODDIR_FLAG "-YMOD_OUT_DIR=")
set(CMAKE_Fortran_MODPATH_FLAG "-p")
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
diff --git a/Modules/Compiler/AppleClang-DetermineCompiler.cmake b/Modules/Compiler/AppleClang-DetermineCompiler.cmake
index 397f95c..83817f7 100644
--- a/Modules/Compiler/AppleClang-DetermineCompiler.cmake
+++ b/Modules/Compiler/AppleClang-DetermineCompiler.cmake
@@ -3,5 +3,5 @@ set(_compiler_id_pp_test "defined(__clang__) && defined(__apple_build_version__)
include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake")
-set(_compiler_id_version_compute "${_compiler_id_version_compute}
+string(APPEND _compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__apple_build_version__)")
diff --git a/Modules/Compiler/Bruce-C.cmake b/Modules/Compiler/Bruce-C.cmake
index 23676ec..cfabe65 100644
--- a/Modules/Compiler/Bruce-C.cmake
+++ b/Modules/Compiler/Bruce-C.cmake
@@ -1,7 +1,7 @@
# Bruce C Compiler ignores "-g" flag and optimization cannot be
# enabled here (it is implemented only for 8086 target).
-set (CMAKE_C_FLAGS_INIT "-D__CLASSIC_C__")
-set (CMAKE_C_FLAGS_DEBUG_INIT "-g")
-set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG")
-set (CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG")
-set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_INIT " -D__CLASSIC_C__")
+string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -DNDEBUG")
diff --git a/Modules/Compiler/G95-Fortran.cmake b/Modules/Compiler/G95-Fortran.cmake
index fd84848..2c83fb8 100644
--- a/Modules/Compiler/G95-Fortran.cmake
+++ b/Modules/Compiler/G95-Fortran.cmake
@@ -1,8 +1,8 @@
-set(CMAKE_Fortran_FLAGS_INIT "")
-set(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os")
-set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3")
-set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+string(APPEND CMAKE_Fortran_FLAGS_INIT " ")
+string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -Os")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
+string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
set(CMAKE_Fortran_MODDIR_FLAG "-fmod=")
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
diff --git a/Modules/Compiler/GHS-C.cmake b/Modules/Compiler/GHS-C.cmake
index 3072715..c30bdec 100644
--- a/Modules/Compiler/GHS-C.cmake
+++ b/Modules/Compiler/GHS-C.cmake
@@ -3,11 +3,11 @@ include(Compiler/GHS)
set(CMAKE_C_VERBOSE_FLAG "-v")
set(CMAKE_C_OUTPUT_EXTENSION ".o")
-set(CMAKE_C_FLAGS_INIT "")
-set(CMAKE_C_FLAGS_DEBUG_INIT "-Odebug -g")
-set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Ospace")
-set(CMAKE_C_FLAGS_RELEASE_INIT "-O")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O -g")
+string(APPEND CMAKE_C_FLAGS_INIT " ")
+string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -Odebug -g")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -Ospace")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -O")
+string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -O -g")
set(CMAKE_C_GHS_KERNEL_FLAGS_DEBUG_INIT "-ldebug ${CMAKE_C_FLAGS_DEBUG_INIT}")
set(CMAKE_C_GHS_KERNEL_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT}")
diff --git a/Modules/Compiler/GHS-CXX.cmake b/Modules/Compiler/GHS-CXX.cmake
index a51591b..b3018a7 100644
--- a/Modules/Compiler/GHS-CXX.cmake
+++ b/Modules/Compiler/GHS-CXX.cmake
@@ -3,11 +3,11 @@ include(Compiler/GHS)
set(CMAKE_CXX_VERBOSE_FLAG "-v")
set(CMAKE_CXX_OUTPUT_EXTENSION ".o")
-set(CMAKE_CXX_FLAGS_INIT "")
-set(CMAKE_CXX_FLAGS_DEBUG_INIT "-Odebug -g")
-set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Ospace")
-set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O -g")
+string(APPEND CMAKE_CXX_FLAGS_INIT " ")
+string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " -Odebug -g")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -Ospace")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -O")
+string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -O -g")
set(CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG_INIT
"-ldebug ${CMAKE_CXX_FLAGS_DEBUG_INIT}")
diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake
index e9c8a59..94dc275 100644
--- a/Modules/Compiler/GNU-Fortran.cmake
+++ b/Modules/Compiler/GNU-Fortran.cmake
@@ -1,12 +1,15 @@
include(Compiler/GNU)
__compiler_gnu(Fortran)
+set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>")
+
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
# No -DNDEBUG for Fortran.
-set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os")
-set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3")
+string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -Os")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
# No -isystem for Fortran because it will not find .mod files.
unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran)
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index c2d393d..4d2fe5b 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -25,7 +25,7 @@ macro(__compiler_gnu lang)
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
endif()
- if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.2)
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
endif()
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
@@ -45,11 +45,11 @@ macro(__compiler_gnu lang)
endif()
# Initial configuration flags.
- set(CMAKE_${lang}_FLAGS_INIT "")
- set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")
- set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
- set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
- set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
if(NOT APPLE OR NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4) # work around #4462
diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake
index 8c6c3f6..8c45276 100644
--- a/Modules/Compiler/IAR.cmake
+++ b/Modules/Compiler/IAR.cmake
@@ -1,6 +1,6 @@
# This file is processed when the IAR compiler is used for a C or C++ file
# Documentation can be downloaded here: http://www.iar.com/website1/1.0.1.0/675/1/
-# The initial feature request is here: https://cmake.org/Bug/view.php?id=10176
+# The initial feature request is here: https://gitlab.kitware.com/cmake/cmake/issues/10176
# It also contains additional links and information.
if(_IAR_CMAKE_LOADED)
@@ -39,7 +39,8 @@ endif()
if(NOT IAR_TARGET_ARCHITECTURE)
message(FATAL_ERROR "The IAR compiler for this architecture is not yet supported "
- " by CMake. Please go to https://cmake.org/Bug and enter a feature request there.")
+ "by CMake. Please go to https://gitlab.kitware.com/cmake/cmake/issues "
+ "and enter a feature request there.")
endif()
set(CMAKE_LINKER "${CMAKE_IAR_LINKER}" CACHE FILEPATH "The IAR linker" FORCE)
diff --git a/Modules/Compiler/Intel-ASM.cmake b/Modules/Compiler/Intel-ASM.cmake
index 74ceb0a..c2bf465 100644
--- a/Modules/Compiler/Intel-ASM.cmake
+++ b/Modules/Compiler/Intel-ASM.cmake
@@ -1,10 +1,9 @@
-set(CMAKE_ASM_VERBOSE_FLAG "-v")
+include(Compiler/Intel)
+__compiler_intel(ASM)
-set(CMAKE_ASM_FLAGS_INIT "")
-set(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
-set(CMAKE_ASM_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
-set(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG")
if(UNIX)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S)
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index edca154..1d09bd5 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -1,10 +1,9 @@
-set(CMAKE_C_VERBOSE_FLAG "-v")
+include(Compiler/Intel)
+__compiler_intel(C)
-set(CMAKE_C_FLAGS_INIT "")
-set(CMAKE_C_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
-set(CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG")
set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <OBJECT> -MF <DEPFILE>")
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 369e041..3cc4503 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -1,10 +1,9 @@
-set(CMAKE_CXX_VERBOSE_FLAG "-v")
+include(Compiler/Intel)
+__compiler_intel(CXX)
-set(CMAKE_CXX_FLAGS_INIT "")
-set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG")
set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <OBJECT> -MF <DEPFILE>")
diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake
index 671d284..a132055 100644
--- a/Modules/Compiler/Intel-Fortran.cmake
+++ b/Modules/Compiler/Intel-Fortran.cmake
@@ -1,12 +1,12 @@
-set(CMAKE_Fortran_FLAGS_INIT "")
-set(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os")
-set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3")
-set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+include(Compiler/Intel)
+__compiler_intel(Fortran)
+
set(CMAKE_Fortran_MODDIR_FLAG "-module ")
-set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+
+set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake
new file mode 100644
index 0000000..8c3942c
--- /dev/null
+++ b/Modules/Compiler/Intel.cmake
@@ -0,0 +1,36 @@
+
+#=============================================================================
+# Copyright 2002-2016 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(__COMPILER_INTEL)
+ return()
+endif()
+set(__COMPILER_INTEL 1)
+
+if(CMAKE_HOST_WIN32)
+ # MSVC-like
+ macro(__compiler_intel lang)
+ endmacro()
+else()
+ # GNU-like
+ macro(__compiler_intel lang)
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v")
+
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
+ endmacro()
+endif()
diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
index 79d5962..5969586 100644
--- a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
@@ -9,6 +9,9 @@
set(_cmake_oldestSupported "_MSC_VER >= 1600")
+# VS version 15 (not 2015) introduces support for aggregate initializers.
+set(_cmake_feature_test_cxx_aggregate_default_initializers "_MSC_FULL_VER >= 190024406")
+
# VS 2015 Update 2 introduces support for variable templates.
# https://www.visualstudio.com/en-us/news/vs2015-update2-vs.aspx
set(_cmake_feature_test_cxx_variable_templates "_MSC_FULL_VER >= 190023918")
diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake
index 18f141e..39aae18 100644
--- a/Modules/Compiler/NAG-Fortran.cmake
+++ b/Modules/Compiler/NAG-Fortran.cmake
@@ -33,3 +33,4 @@ set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-PIC")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PIE "-PIC")
diff --git a/Modules/Compiler/PGI-C.cmake b/Modules/Compiler/PGI-C.cmake
index da88c01..85d6e7e 100644
--- a/Modules/Compiler/PGI-C.cmake
+++ b/Modules/Compiler/PGI-C.cmake
@@ -1,4 +1,4 @@
include(Compiler/PGI)
__compiler_pgi(C)
-set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
-set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake
index 97c9555..896e298 100644
--- a/Modules/Compiler/PGI-CXX.cmake
+++ b/Modules/Compiler/PGI-CXX.cmake
@@ -1,4 +1,4 @@
include(Compiler/PGI)
__compiler_pgi(CXX)
-set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELEASE_INIT "${CMAKE_CXX_FLAGS_RELEASE_INIT} -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
diff --git a/Modules/Compiler/PGI-Fortran.cmake b/Modules/Compiler/PGI-Fortran.cmake
index 2866254..3765079 100644
--- a/Modules/Compiler/PGI-Fortran.cmake
+++ b/Modules/Compiler/PGI-Fortran.cmake
@@ -4,7 +4,7 @@ __compiler_pgi(Fortran)
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-Mnofreeform")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-Mfreeform")
-set(CMAKE_Fortran_FLAGS_INIT "${CMAKE_Fortran_FLAGS_INIT} -Mpreprocess -Kieee")
-set(CMAKE_Fortran_FLAGS_DEBUG_INIT "${CMAKE_Fortran_FLAGS_DEBUG_INIT} -Mbounds")
+string(APPEND CMAKE_Fortran_FLAGS_INIT " -Mpreprocess -Kieee")
+string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -Mbounds")
set(CMAKE_Fortran_MODDIR_FLAG "-module ")
diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake
index 797945f..51069c2 100644
--- a/Modules/Compiler/PGI.cmake
+++ b/Modules/Compiler/PGI.cmake
@@ -23,11 +23,11 @@ macro(__compiler_pgi lang)
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
# Initial configuration flags.
- set(CMAKE_${lang}_FLAGS_INIT "")
- set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g -O0")
- set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O2 -s")
- set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-fast -O3 -Mipa=fast")
- set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -gopt")
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O2 -s")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -fast -O3 -Mipa=fast")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -gopt")
# Preprocessing and assembly rules.
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/PathScale-C.cmake b/Modules/Compiler/PathScale-C.cmake
index 9db54af..94c7d08 100644
--- a/Modules/Compiler/PathScale-C.cmake
+++ b/Modules/Compiler/PathScale-C.cmake
@@ -1,4 +1,4 @@
include(Compiler/PathScale)
__compiler_pathscale(C)
-set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
-set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
diff --git a/Modules/Compiler/PathScale-CXX.cmake b/Modules/Compiler/PathScale-CXX.cmake
index 4dd7660..276b81b 100644
--- a/Modules/Compiler/PathScale-CXX.cmake
+++ b/Modules/Compiler/PathScale-CXX.cmake
@@ -1,4 +1,4 @@
include(Compiler/PathScale)
__compiler_pathscale(CXX)
-set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELEASE_INIT "${CMAKE_CXX_FLAGS_RELEASE_INIT} -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
diff --git a/Modules/Compiler/PathScale.cmake b/Modules/Compiler/PathScale.cmake
index 107f779..09ee2ba 100644
--- a/Modules/Compiler/PathScale.cmake
+++ b/Modules/Compiler/PathScale.cmake
@@ -23,9 +23,9 @@ macro(__compiler_pathscale lang)
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
# Initial configuration flags.
- set(CMAKE_${lang}_FLAGS_INIT "")
- set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g -O0")
- set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os")
- set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3")
- set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-g -O2")
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -g -O2")
endmacro()
diff --git a/Modules/Compiler/SunPro-ASM.cmake b/Modules/Compiler/SunPro-ASM.cmake
index 2fa8b99..0d67400 100644
--- a/Modules/Compiler/SunPro-ASM.cmake
+++ b/Modules/Compiler/SunPro-ASM.cmake
@@ -8,11 +8,11 @@ set(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG "-R")
set(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG_SEP ":")
set(CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG "-h")
-set(CMAKE_ASM_FLAGS_INIT "")
-set(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")
-set(CMAKE_ASM_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
-set(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_INIT " ")
+string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG")
# Initialize ASM link type selection flags. These flags are used when
# building a shared library, shared module, or executable that links
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index c452983..503684a 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -7,11 +7,11 @@ set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h")
-set(CMAKE_C_FLAGS_INIT "")
-set(CMAKE_C_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")
-set(CMAKE_C_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_INIT " ")
+string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG")
# Initialize C link type selection flags. These flags are used when
# building a shared library, shared module, or executable that links
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index b4a5591..ce01cdd 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -7,11 +7,11 @@ set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R")
set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":")
set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h")
-set(CMAKE_CXX_FLAGS_INIT "")
-set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_INIT " ")
+string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG")
# Initialize C link type selection flags. These flags are used when
# building a shared library, shared module, or executable that links
diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake
index 610e191..6607926 100644
--- a/Modules/Compiler/SunPro-Fortran.cmake
+++ b/Modules/Compiler/SunPro-Fortran.cmake
@@ -10,13 +10,16 @@ set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":")
set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-h")
set(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG "-R")
-set(CMAKE_Fortran_FLAGS_INIT "")
-set(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")
-set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
-set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG")
+string(APPEND CMAKE_Fortran_FLAGS_INIT " ")
+string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG")
+string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG")
set(CMAKE_Fortran_MODDIR_FLAG "-moddir=")
set(CMAKE_Fortran_MODPATH_FLAG "-M")
+set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F <SOURCE> -o <PREPROCESSED_SOURCE>")
+
set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F <SOURCE> -o <PREPROCESSED_SOURCE>")
set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/TinyCC-C.cmake b/Modules/Compiler/TinyCC-C.cmake
index f7937ac..fbd2841 100644
--- a/Modules/Compiler/TinyCC-C.cmake
+++ b/Modules/Compiler/TinyCC-C.cmake
@@ -1,8 +1,8 @@
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
# no optimization in tcc:
-set (CMAKE_C_FLAGS_INIT "")
-set (CMAKE_C_FLAGS_DEBUG_INIT "-g")
-set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG")
-set (CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG")
-set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_INIT " ")
+string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -DNDEBUG")
diff --git a/Modules/Compiler/XL-ASM.cmake b/Modules/Compiler/XL-ASM.cmake
index 212179e..9177b39 100644
--- a/Modules/Compiler/XL-ASM.cmake
+++ b/Modules/Compiler/XL-ASM.cmake
@@ -2,11 +2,11 @@ set(CMAKE_ASM_VERBOSE_FLAG "-V")
# -qthreaded = Ensures that all optimizations will be thread-safe
# -qhalt=e = Halt on error messages (rather than just severe errors)
-set(CMAKE_ASM_FLAGS_INIT "-qthreaded -qhalt=e -qsourcetype=assembler")
+string(APPEND CMAKE_ASM_FLAGS_INIT " -qthreaded -qhalt=e -qsourcetype=assembler")
-set(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_ASM_FLAGS_RELEASE_INIT "-O -DNDEBUG")
-set(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-O -DNDEBUG")
-set(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -O -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -O -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -g -DNDEBUG")
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s )
diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake
index 97dd017..f976c99 100644
--- a/Modules/Compiler/XL-C.cmake
+++ b/Modules/Compiler/XL-C.cmake
@@ -1,8 +1,8 @@
include(Compiler/XL)
__compiler_xl(C)
-set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG")
-set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
# -qthreaded = Ensures that all optimizations will be thread-safe
# -qhalt=e = Halt on error messages (rather than just severe errors)
-set(CMAKE_C_FLAGS_INIT "-qthreaded -qhalt=e")
+string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded -qhalt=e")
diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake
index 41372c1..545d657 100644
--- a/Modules/Compiler/XL-CXX.cmake
+++ b/Modules/Compiler/XL-CXX.cmake
@@ -1,11 +1,11 @@
include(Compiler/XL)
__compiler_xl(CXX)
-set(CMAKE_CXX_FLAGS_RELEASE_INIT "${CMAKE_CXX_FLAGS_RELEASE_INIT} -DNDEBUG")
-set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
# -qthreaded = Ensures that all optimizations will be thread-safe
# -qhalt=e = Halt on error messages (rather than just severe errors)
-set(CMAKE_CXX_FLAGS_INIT "-qthreaded -qhalt=e")
+string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded -qhalt=e")
set(CMAKE_CXX_COMPILE_OBJECT
"<CMAKE_CXX_COMPILER> -+ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake
index ae9df4e..6bab6f6 100644
--- a/Modules/Compiler/XL-Fortran.cmake
+++ b/Modules/Compiler/XL-Fortran.cmake
@@ -10,7 +10,7 @@ set(CMAKE_Fortran_DEFINE_FLAG "-WF,-D")
# -qthreaded = Ensures that all optimizations will be thread-safe
# -qhalt=e = Halt on error messages (rather than just severe errors)
-set(CMAKE_Fortran_FLAGS_INIT "-qthreaded -qhalt=e")
+string(APPEND CMAKE_Fortran_FLAGS_INIT " -qthreaded -qhalt=e")
# xlf: 1501-214 (W) command option E reserved for future use - ignored
set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE)
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake
index bf4f554..1f2b145 100644
--- a/Modules/Compiler/XL.cmake
+++ b/Modules/Compiler/XL.cmake
@@ -29,10 +29,10 @@ macro(__compiler_xl lang)
set(CMAKE_${lang}_VERBOSE_FLAG "-V")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic")
- set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")
- set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O")
- set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O")
- set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-g")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -g")
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake
index db487d8..90298d6 100644
--- a/Modules/Dart.cmake
+++ b/Modules/Dart.cmake
@@ -119,7 +119,7 @@ if(BUILD_TESTING)
# add testing targets
set(DART_EXPERIMENTAL_NAME Experimental)
if(DART_EXPERIMENTAL_USE_PROJECT_NAME)
- set(DART_EXPERIMENTAL_NAME "${DART_EXPERIMENTAL_NAME}${PROJECT_NAME}")
+ string(APPEND DART_EXPERIMENTAL_NAME "${PROJECT_NAME}")
endif()
endif ()
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
index de475e4..f5ac959 100644
--- a/Modules/DeployQt4.cmake
+++ b/Modules/DeployQt4.cmake
@@ -247,7 +247,7 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va
set(plugins_path ".")
endif()
if(plugins_dir)
- set(plugins_path "${plugins_path}/${plugins_dir}")
+ string(APPEND plugins_path "/${plugins_dir}")
endif()
endif()
@@ -263,7 +263,7 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va
get_filename_component(plugin_group "${plugin_path}" NAME)
set(${plugin_group_var} "${plugin_group}")
endif()
- set(plugins_path "${plugins_path}/${plugin_group}")
+ string(APPEND plugins_path "/${plugin_group}")
if(${copy})
file(MAKE_DIRECTORY "${plugins_path}")
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index a3f460d..e7f8408 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -86,6 +86,10 @@ Module Functions
in one of the paths specified in the ``ExternalData_OBJECT_STORES``
variable.
+ Typically only one target is needed to manage all external data within
+ a project. Call this function once at the end of configuration after
+ all data references have been processed.
+
Module Variables
^^^^^^^^^^^^^^^^
@@ -394,8 +398,14 @@ function(ExternalData_add_target target)
set(files "")
- # Set "_ExternalData_FILE_${file}" for each output file to avoid duplicate
- # rules. Use local data first to prefer real files over content links.
+ # Set a "_ExternalData_FILE_${file}" variable for each output file to avoid
+ # duplicate entries within this target. Set a directory property of the same
+ # name to avoid repeating custom commands with the same output in this directory.
+ # Repeating custom commands with the same output across directories or across
+ # targets in the same directory may be a race, but this is likely okay because
+ # we use atomic replacement of output files.
+ #
+ # Use local data first to prefer real files over content links.
# Custom commands to copy or link local data.
get_property(data_local GLOBAL PROPERTY _ExternalData_${target}_LOCAL)
@@ -405,16 +415,20 @@ function(ExternalData_add_target target)
list(GET tuple 1 name)
if(NOT DEFINED "_ExternalData_FILE_${file}")
set("_ExternalData_FILE_${file}" 1)
- add_custom_command(
- COMMENT "Generating ${file}"
- OUTPUT "${file}"
- COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR}
- -Dfile=${file} -Dname=${name}
- -DExternalData_ACTION=local
- -DExternalData_CONFIG=${config}
- -P ${_ExternalData_SELF}
- MAIN_DEPENDENCY "${name}"
- )
+ get_property(added DIRECTORY PROPERTY "_ExternalData_FILE_${file}")
+ if(NOT added)
+ set_property(DIRECTORY PROPERTY "_ExternalData_FILE_${file}" 1)
+ add_custom_command(
+ COMMENT "Generating ${file}"
+ OUTPUT "${file}"
+ COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR}
+ -Dfile=${file} -Dname=${name}
+ -DExternalData_ACTION=local
+ -DExternalData_CONFIG=${config}
+ -P ${_ExternalData_SELF}
+ MAIN_DEPENDENCY "${name}"
+ )
+ endif()
list(APPEND files "${file}")
endif()
endforeach()
@@ -429,23 +443,27 @@ function(ExternalData_add_target target)
set(stamp "${ext}-stamp")
if(NOT DEFINED "_ExternalData_FILE_${file}")
set("_ExternalData_FILE_${file}" 1)
- add_custom_command(
- # Users care about the data file, so hide the hash/timestamp file.
- COMMENT "Generating ${file}"
- # The hash/timestamp file is the output from the build perspective.
- # List the real file as a second output in case it is a broken link.
- # The files must be listed in this order so CMake can hide from the
- # make tool that a symlink target may not be newer than the input.
- OUTPUT "${file}${stamp}" "${file}"
- # Run the data fetch/update script.
- COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR}
- -Dfile=${file} -Dname=${name} -Dext=${ext}
- -DExternalData_ACTION=fetch
- -DExternalData_CONFIG=${config}
- -P ${_ExternalData_SELF}
- # Update whenever the object hash changes.
- MAIN_DEPENDENCY "${name}${ext}"
- )
+ get_property(added DIRECTORY PROPERTY "_ExternalData_FILE_${file}")
+ if(NOT added)
+ set_property(DIRECTORY PROPERTY "_ExternalData_FILE_${file}" 1)
+ add_custom_command(
+ # Users care about the data file, so hide the hash/timestamp file.
+ COMMENT "Generating ${file}"
+ # The hash/timestamp file is the output from the build perspective.
+ # List the real file as a second output in case it is a broken link.
+ # The files must be listed in this order so CMake can hide from the
+ # make tool that a symlink target may not be newer than the input.
+ OUTPUT "${file}${stamp}" "${file}"
+ # Run the data fetch/update script.
+ COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR}
+ -Dfile=${file} -Dname=${name} -Dext=${ext}
+ -DExternalData_ACTION=fetch
+ -DExternalData_CONFIG=${config}
+ -P ${_ExternalData_SELF}
+ # Update whenever the object hash changes.
+ MAIN_DEPENDENCY "${name}${ext}"
+ )
+ endif()
list(APPEND files "${file}${stamp}")
endif()
endforeach()
@@ -473,10 +491,10 @@ function(ExternalData_expand_arguments target outArgsVar)
if("x${piece}" MATCHES "^x${data_regex}$")
# Replace this DATA{}-piece with a file path.
_ExternalData_arg("${target}" "${piece}" "${CMAKE_MATCH_1}" file)
- set(outArg "${outArg}${file}")
+ string(APPEND outArg "${file}")
else()
# No replacement needed for this piece.
- set(outArg "${outArg}${piece}")
+ string(APPEND outArg "${piece}")
endif()
endforeach()
else()
@@ -696,12 +714,12 @@ macro(_ExternalData_arg_associated)
get_filename_component(reldir "${reldata}" PATH)
endif()
if(reldir)
- set(reldir "${reldir}/")
+ string(APPEND reldir "/")
endif()
_ExternalData_exact_regex(reldir_regex "${reldir}")
if(recurse_option)
set(glob GLOB_RECURSE)
- set(reldir_regex "${reldir_regex}(.+/)?")
+ string(APPEND reldir_regex "(.+/)?")
else()
set(glob GLOB)
endif()
@@ -717,7 +735,7 @@ macro(_ExternalData_arg_associated)
set(all "")
set(sep "")
foreach(regex ${associated_regex})
- set(all "${all}${sep}${reldir_regex}${regex}")
+ string(APPEND all "${sep}${reldir_regex}${regex}")
set(sep "|")
endforeach()
_ExternalData_arg_find_files(${glob} "${reldir}" "${all}")
@@ -971,15 +989,16 @@ function(_ExternalData_download_object name hash algo var_obj)
set(url "${lhs}${algo}${rhs}")
endif()
endif()
- message(STATUS "Fetching \"${url}\"")
+ string(REGEX REPLACE "((https?|ftp)://)([^@]+@)?(.*)" "\\1\\4" secured_url "${url}")
+ message(STATUS "Fetching \"${secured_url}\"")
if(url MATCHES "^ExternalDataCustomScript://([A-Za-z_][A-Za-z0-9_]*)/(.*)$")
_ExternalData_custom_fetch("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}" "${tmp}" err errMsg)
else()
_ExternalData_download_file("${url}" "${tmp}" err errMsg)
endif()
- set(tried "${tried}\n ${url}")
+ string(APPEND tried "\n ${url}")
if(err)
- set(tried "${tried} (${errMsg})")
+ string(APPEND tried " (${errMsg})")
else()
# Verify downloaded object.
_ExternalData_compute_hash(dl_hash "${algo}" "${tmp}")
@@ -987,7 +1006,7 @@ function(_ExternalData_download_object name hash algo var_obj)
set(found 1)
break()
else()
- set(tried "${tried} (wrong hash ${algo}=${dl_hash})")
+ string(APPEND tried " (wrong hash ${algo}=${dl_hash})")
if("$ENV{ExternalData_DEBUG_DOWNLOAD}" MATCHES ".")
file(RENAME "${tmp}" "${store}/${algo}/${dl_hash}")
endif()
diff --git a/Modules/ExternalProject-download.cmake.in b/Modules/ExternalProject-download.cmake.in
index 5b73cd8..8e39a7e 100644
--- a/Modules/ExternalProject-download.cmake.in
+++ b/Modules/ExternalProject-download.cmake.in
@@ -114,48 +114,58 @@ endif()
set(retry_number 5)
+message(STATUS "Downloading...
+ dst='@LOCAL@'
+ timeout='@TIMEOUT_MSG@'"
+)
+
foreach(i RANGE ${retry_number})
sleep_before_download(${i})
- message(STATUS "downloading...
- src='@REMOTE@'
- dst='@LOCAL@'
- timeout='@TIMEOUT_MSG@'")
-
- @TLS_VERIFY_CODE@
- @TLS_CAINFO_CODE@
-
- file(
- DOWNLOAD
- "@REMOTE@" "@LOCAL@"
- @SHOW_PROGRESS@
- @TIMEOUT_ARGS@
- STATUS status
- LOG log
- )
-
- list(GET status 0 status_code)
- list(GET status 1 status_string)
-
- if(status_code EQUAL 0)
- check_file_hash(has_hash hash_is_good)
- if(has_hash AND NOT hash_is_good)
- message(STATUS "Hash mismatch, removing...")
- file(REMOVE "@LOCAL@")
+ foreach(url @REMOTE@)
+ message(STATUS "Using src='${url}'")
+
+ @TLS_VERIFY_CODE@
+ @TLS_CAINFO_CODE@
+
+ file(
+ DOWNLOAD
+ "${url}" "@LOCAL@"
+ @SHOW_PROGRESS@
+ @TIMEOUT_ARGS@
+ STATUS status
+ LOG log
+ @USERPWD_ARGS@
+ @HTTP_HEADERS_ARGS@
+ )
+
+ list(GET status 0 status_code)
+ list(GET status 1 status_string)
+
+ if(status_code EQUAL 0)
+ check_file_hash(has_hash hash_is_good)
+ if(has_hash AND NOT hash_is_good)
+ message(STATUS "Hash mismatch, removing...")
+ file(REMOVE "@LOCAL@")
+ else()
+ message(STATUS "Downloading... done")
+ return()
+ endif()
else()
- message(STATUS "Downloading... done")
- return()
+ string(APPEND logFailedURLs "error: downloading '${url}' failed
+ status_code: ${status_code}
+ status_string: ${status_string}
+ log:
+ --- LOG BEGIN ---
+ ${log}
+ --- LOG END ---
+ "
+ )
endif()
- else()
- message("error: downloading '@REMOTE@' failed
- status_code: ${status_code}
- status_string: ${status_string}
- log:
- --- LOG BEGIN ---
- ${log}
- --- LOG END ---"
- )
- endif()
+ endforeach()
endforeach()
-message(FATAL_ERROR "Downloading failed")
+message(FATAL_ERROR "Each download failed!
+ ${logFailedURLs}
+ "
+)
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 2ff18fc..79054a1 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -69,12 +69,18 @@ Create custom targets to build projects in external trees
URL of mercurial repo
``HG_TAG <tag>``
Mercurial branch name, commit id or tag
- ``URL /.../src.tgz``
- Full path or URL of source
+ ``URL /.../src.tgz [/.../src.tgz]...``
+ Full path or URL(s) of source. Multiple URLs are allowed as mirrors.
``URL_HASH ALGO=value``
Hash of file at URL
``URL_MD5 md5``
Equivalent to URL_HASH MD5=md5
+ ``HTTP_USERNAME <username>``
+ Username for download operation
+ ``HTTP_PASSWORD <username>``
+ Password for download operation
+ ``HTTP_HEADER <header>``
+ HTTP header for download operation. Suboption can be repeated several times.
``TLS_VERIFY <bool>``
Should certificate for https be checked
``TLS_CAINFO <file>``
@@ -98,6 +104,8 @@ Create custom targets to build projects in external trees
``SOURCE_DIR <dir>``
Source dir to be used for build
+ ``SOURCE_SUBDIR <dir>``
+ Path to source CMakeLists.txt relative to ``SOURCE_DIR``
``CONFIGURE_COMMAND <cmd>...``
Build tree configuration command
``CMAKE_COMMAND /.../cmake``
@@ -236,6 +244,11 @@ Create custom targets to build projects in external trees
interpreted with respect to the build directory corresponding to the
source directory in which ``ExternalProject_Add`` is invoked.
+ If ``SOURCE_SUBDIR`` is set and no ``CONFIGURE_COMMAND`` is specified, the
+ configure command will run CMake using the ``CMakeLists.txt`` located in the
+ relative path specified by ``SOURCE_SUBDIR``, relative to the ``SOURCE_DIR``.
+ If no ``SOURCE_SUBDIR`` is given, ``SOURCE_DIR`` is used.
+
If ``SOURCE_DIR`` is explicitly set to an existing directory the project
will be built from it. Otherwise a download step must be specified
using one of the ``DOWNLOAD_COMMAND``, ``CVS_*``, ``SVN_*``, or ``URL``
@@ -287,8 +300,8 @@ Create custom targets to build projects in external trees
The command line, comment, working directory, and byproducts of every
standard and custom step are processed to replace tokens ``<SOURCE_DIR>``,
- ``<BINARY_DIR>``, ``<INSTALL_DIR>``, and ``<TMP_DIR>`` with
- corresponding property values.
+ ``<SOURCE_SUBDIR>``, ``<BINARY_DIR>``, ``<INSTALL_DIR>``, and ``<TMP_DIR>``
+ with corresponding property values.
Any builtin step that specifies a ``<step>_COMMAND cmd...`` or custom
step that specifies a ``COMMAND cmd...`` may specify additional command
@@ -851,7 +864,7 @@ endif()
endfunction(_ep_write_gitupdate_script)
-function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo)
+function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd http_headers)
if(timeout)
set(TIMEOUT_ARGS TIMEOUT ${timeout})
set(TIMEOUT_MSG "${timeout} seconds")
@@ -899,6 +912,22 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")")
endif()
+ if(userpwd STREQUAL ":")
+ set(USERPWD_ARGS)
+ else()
+ set(USERPWD_ARGS USERPWD "${userpwd}")
+ endif()
+
+ set(HTTP_HEADERS_ARGS "")
+ if(NOT http_headers STREQUAL "")
+ foreach(header ${http_headers})
+ set(
+ HTTP_HEADERS_ARGS
+ "HTTPHEADER \"${header}\"\n ${HTTP_HEADERS_ARGS}"
+ )
+ endforeach()
+ endif()
+
# Used variables:
# * TLS_VERIFY_CODE
# * TLS_CAINFO_CODE
@@ -909,6 +938,8 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
# * SHOW_PROGRESS
# * TIMEOUT_ARGS
# * TIMEOUT_MSG
+ # * USERPWD_ARGS
+ # * HTTP_HEADERS_ARGS
configure_file(
"${_ExternalProject_SELF_DIR}/ExternalProject-download.cmake.in"
"${script_filename}"
@@ -993,6 +1024,7 @@ endif()
#
message(STATUS \"extracting... [analysis]\")
file(GLOB contents \"\${ut_dir}/*\")
+list(REMOVE_ITEM contents \"\${ut_dir}/.DS_Store\")
list(LENGTH contents n)
if(NOT n EQUAL 1 OR NOT IS_DIRECTORY \"\${contents}\")
set(contents \"\${ut_dir}\")
@@ -1064,6 +1096,13 @@ function(_ep_set_directories name)
endif()
set_property(TARGET ${name} PROPERTY _EP_${VAR}_DIR "${${var}_dir}")
endforeach()
+ get_property(source_subdir TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR)
+ if(NOT source_subdir)
+ set_property(TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR ".")
+ elseif(IS_ABSOLUTE "${source_subdir}")
+ message(FATAL_ERROR
+ "External project ${name} has non-relative SOURCE_SUBDIR!")
+ endif()
if(build_in_source)
get_property(source_dir TARGET ${name} PROPERTY _EP_SOURCE_DIR)
set_property(TARGET ${name} PROPERTY _EP_BINARY_DIR "${source_dir}")
@@ -1095,7 +1134,7 @@ macro(_ep_replace_location_tags target_name)
set(vars ${ARGN})
foreach(var ${vars})
if(${var})
- foreach(dir SOURCE_DIR BINARY_DIR INSTALL_DIR TMP_DIR DOWNLOADED_FILE)
+ foreach(dir SOURCE_DIR SOURCE_SUBDIR BINARY_DIR INSTALL_DIR TMP_DIR DOWNLOADED_FILE)
get_property(val TARGET ${target_name} PROPERTY _EP_${dir})
string(REPLACE "<${dir}>" "${val}" ${var} "${${var}}")
endforeach()
@@ -1117,8 +1156,8 @@ function(_ep_command_line_to_initial_cache var args force)
set(line "${CMAKE_MATCH_1}")
if(setArg)
# This is required to build up lists in variables, or complete an entry
- set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})")
- set(script_initial_cache "${script_initial_cache}\n${setArg}")
+ string(APPEND setArg "${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})")
+ string(APPEND script_initial_cache "\n${setArg}")
set(accumulator "")
set(setArg "")
endif()
@@ -1132,13 +1171,13 @@ function(_ep_command_line_to_initial_cache var args force)
endif()
else()
# Assume this is a list to append to the last var
- set(accumulator "${accumulator};${line}")
+ list(APPEND accumulator "${line}")
endif()
endforeach()
# Catch the final line of the args
if(setArg)
- set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})")
- set(script_initial_cache "${script_initial_cache}\n${setArg}")
+ string(APPEND setArg "${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})")
+ string(APPEND script_initial_cache "\n${setArg}")
endif()
set(${var} ${script_initial_cache} PARENT_SCOPE)
endfunction()
@@ -1332,16 +1371,16 @@ endif()
foreach(arg IN LISTS command)
if("x${arg}" STREQUAL "xCOMMAND")
if(NOT "x${cmd}" STREQUAL "x")
- set(code "${code}set(command \"${cmd}\")${code_execute_process}")
+ string(APPEND code "set(command \"${cmd}\")${code_execute_process}")
endif()
set(cmd "")
set(sep "")
else()
- set(cmd "${cmd}${sep}${arg}")
+ string(APPEND cmd "${sep}${arg}")
set(sep ";")
endif()
endforeach()
- set(code "${code}set(command \"${cmd}\")${code_execute_process}")
+ string(APPEND code "set(command \"${cmd}\")${code_execute_process}")
file(GENERATE OUTPUT "${stamp_dir}/${name}-${step}-$<CONFIG>-impl.cmake" CONTENT "${code}")
set(command ${CMAKE_COMMAND} "-Dmake=\${make}" "-Dconfig=\${config}" -P ${stamp_dir}/${name}-${step}-$<CONFIG>-impl.cmake)
endif()
@@ -1667,7 +1706,7 @@ function(_ep_add_download_command name)
get_property(fname TARGET ${name} PROPERTY _EP_DOWNLOAD_NAME)
# TODO: Perhaps file:// should be copied to download dir before extraction.
- string(REGEX REPLACE "^file://" "" url "${url}")
+ string(REGEX REPLACE "file://" "" url "${url}")
set(depends)
set(comment)
@@ -1861,6 +1900,19 @@ function(_ep_add_download_command name)
@ONLY
)
list(APPEND depends ${stamp_dir}/${name}-urlinfo.txt)
+
+ list(LENGTH url url_list_length)
+ if(NOT "${url_list_length}" STREQUAL "1")
+ foreach(entry ${url})
+ if(NOT "${entry}" MATCHES "^[a-z]+://")
+ message(FATAL_ERROR "At least one entry of URL is a path (invalid in a list)")
+ endif()
+ endforeach()
+ if("x${fname}" STREQUAL "x")
+ list(GET url 0 fname)
+ endif()
+ endif()
+
if(IS_DIRECTORY "${url}")
get_filename_component(abs_dir "${url}" ABSOLUTE)
set(comment "Performing download step (DIR copy) for '${name}'")
@@ -1871,16 +1923,19 @@ function(_ep_add_download_command name)
if("${url}" MATCHES "^[a-z]+://")
# TODO: Should download and extraction be different steps?
if("x${fname}" STREQUAL "x")
- string(REGEX MATCH "[^/\\?]*$" fname "${url}")
+ set(fname "${url}")
endif()
- if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
- string(REGEX MATCH "([^/\\?]+(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip))/.*$" match_result "${url}")
+ if("${fname}" MATCHES [[([^/\?#]+(\.|=)(7z|tar|tar\.bz2|tar\.gz|tar\.xz|tbz2|tgz|txz|zip))([/?#].*)?$]])
set(fname "${CMAKE_MATCH_1}")
- endif()
- if (no_extract)
- get_filename_component(fname "${url}" NAME)
- elseif(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
- message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}")
+ elseif(no_extract)
+ get_filename_component(fname "${fname}" NAME)
+ else()
+ # Fall back to a default file name. The actual file name does not
+ # matter because it is used only internally and our extraction tool
+ # inspects the file content directly. If it turns out the wrong URL
+ # was given that will be revealed during the build which is an easier
+ # place for users to diagnose than an error here anyway.
+ set(fname "archive.tar")
endif()
string(REPLACE ";" "-" fname "${fname}")
set(file ${download_dir}/${fname})
@@ -1888,8 +1943,11 @@ function(_ep_add_download_command name)
get_property(no_progress TARGET ${name} PROPERTY _EP_DOWNLOAD_NO_PROGRESS)
get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO)
+ get_property(http_username TARGET ${name} PROPERTY _EP_HTTP_USERNAME)
+ get_property(http_password TARGET ${name} PROPERTY _EP_HTTP_PASSWORD)
+ get_property(http_headers TARGET ${name} PROPERTY _EP_HTTP_HEADER)
set(download_script "${stamp_dir}/download-${name}.cmake")
- _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}")
+ _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}")
set(cmd ${CMAKE_COMMAND} -P "${download_script}"
COMMAND)
if (no_extract)
@@ -2131,7 +2189,7 @@ endfunction()
# TODO: Make sure external projects use the proper compiler
function(_ep_add_configure_command name)
- ExternalProject_Get_Property(${name} source_dir binary_dir tmp_dir)
+ ExternalProject_Get_Property(${name} source_dir source_subdir binary_dir tmp_dir)
# Depend on other external projects (file-level).
set(file_deps)
@@ -2209,12 +2267,16 @@ function(_ep_add_configure_command name)
endif()
endif()
- list(APPEND cmd "${source_dir}")
+ if(source_subdir STREQUAL ".")
+ list(APPEND cmd "${source_dir}")
+ else()
+ list(APPEND cmd "${source_dir}/${source_subdir}")
+ endif()
endif()
# If anything about the configure command changes, (command itself, cmake
# used, cmake args or cmake generator) then re-run the configure step.
- # Fixes issue http://public.kitware.com/Bug/view.php?id=10258
+ # Fixes issue https://gitlab.kitware.com/cmake/cmake/issues/10258
#
if(NOT EXISTS ${tmp_dir}/${name}-cfgcmd.txt.in)
file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='\@cmd\@'\n")
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index dc31086..548d12a 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -1,268 +1,27 @@
-#.rst:
-# FeatureSummary
-# --------------
-#
-# Macros for generating a summary of enabled/disabled features
-#
-#
-#
-# This module provides the macros feature_summary(),
-# set_package_properties() and add_feature_info(). For compatibility it
-# also still provides set_package_info(), set_feature_info(),
-# print_enabled_features() and print_disabled_features().
-#
-# These macros can be used to generate a summary of enabled and disabled
-# packages and/or feature for a build tree:
-#
-# ::
-#
-# -- The following OPTIONAL packages have been found:
-# LibXml2 (required version >= 2.4), XML processing lib, <http://xmlsoft.org>
-# * Enables HTML-import in MyWordProcessor
-# * Enables odt-export in MyWordProcessor
-# PNG , A PNG image library. , <http://www.libpng.org/pub/png/>
-# * Enables saving screenshots
-# -- The following OPTIONAL packages have not been found:
-# Lua51 , The Lua scripting language. , <http://www.lua.org>
-# * Enables macros in MyWordProcessor
-# Foo , Foo provides cool stuff.
-#
-#
-#
-#
-#
-# ::
-#
-# FEATURE_SUMMARY( [FILENAME <file>]
-# [APPEND]
-# [VAR <variable_name>]
-# [INCLUDE_QUIET_PACKAGES]
-# [FATAL_ON_MISSING_REQUIRED_PACKAGES]
-# [DESCRIPTION "Found packages:"]
-# WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND
-# | ENABLED_FEATURES | DISABLED_FEATURES)
-# )
-#
-#
-#
-# The FEATURE_SUMMARY() macro can be used to print information about
-# enabled or disabled packages or features of a project. By default,
-# only the names of the features/packages will be printed and their
-# required version when one was specified. Use SET_PACKAGE_PROPERTIES()
-# to add more useful information, like e.g. a download URL for the
-# respective package or their purpose in the project.
-#
-# The WHAT option is the only mandatory option. Here you specify what
-# information will be printed:
-#
-# ``ALL``
-# print everything
-# ``ENABLED_FEATURES``
-# the list of all features which are enabled
-# ``DISABLED_FEATURES``
-# the list of all features which are disabled
-# ``PACKAGES_FOUND``
-# the list of all packages which have been found
-# ``PACKAGES_NOT_FOUND``
-# the list of all packages which have not been found
-# ``OPTIONAL_PACKAGES_FOUND``
-# only those packages which have been found which have the type OPTIONAL
-# ``OPTIONAL_PACKAGES_NOT_FOUND``
-# only those packages which have not been found which have the type OPTIONAL
-# ``RECOMMENDED_PACKAGES_FOUND``
-# only those packages which have been found which have the type RECOMMENDED
-# ``RECOMMENDED_PACKAGES_NOT_FOUND``
-# only those packages which have not been found which have the type RECOMMENDED
-# ``REQUIRED_PACKAGES_FOUND``
-# only those packages which have been found which have the type REQUIRED
-# ``REQUIRED_PACKAGES_NOT_FOUND``
-# only those packages which have not been found which have the type REQUIRED
-# ``RUNTIME_PACKAGES_FOUND``
-# only those packages which have been found which have the type RUNTIME
-# ``RUNTIME_PACKAGES_NOT_FOUND``
-# only those packages which have not been found which have the type RUNTIME
-#
-# With the exception of the ``ALL`` value, these values can be combined
-# in order to customize the output. For example:
-#
-# ::
-#
-# feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
-#
-#
-#
-# If a FILENAME is given, the information is printed into this file. If
-# APPEND is used, it is appended to this file, otherwise the file is
-# overwritten if it already existed. If the VAR option is used, the
-# information is "printed" into the specified variable. If FILENAME is
-# not used, the information is printed to the terminal. Using the
-# DESCRIPTION option a description or headline can be set which will be
-# printed above the actual content. If INCLUDE_QUIET_PACKAGES is given,
-# packages which have been searched with find_package(... QUIET) will
-# also be listed. By default they are skipped. If
-# FATAL_ON_MISSING_REQUIRED_PACKAGES is given, CMake will abort if a
-# package which is marked as REQUIRED has not been found.
-#
-# Example 1, append everything to a file:
-#
-# ::
-#
-# feature_summary(WHAT ALL
-# FILENAME ${CMAKE_BINARY_DIR}/all.log APPEND)
-#
-#
-#
-# Example 2, print the enabled features into the variable
-# enabledFeaturesText, including QUIET packages:
-#
-# ::
-#
-# feature_summary(WHAT ENABLED_FEATURES
-# INCLUDE_QUIET_PACKAGES
-# DESCRIPTION "Enabled Features:"
-# VAR enabledFeaturesText)
-# message(STATUS "${enabledFeaturesText}")
-#
-#
-#
-#
-#
-# ::
-#
-# SET_PACKAGE_PROPERTIES(<name> PROPERTIES
-# [ URL <url> ]
-# [ DESCRIPTION <description> ]
-# [ TYPE (RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED) ]
-# [ PURPOSE <purpose> ]
-# )
-#
-#
-#
-# Use this macro to set up information about the named package, which
-# can then be displayed via FEATURE_SUMMARY(). This can be done either
-# directly in the Find-module or in the project which uses the module
-# after the find_package() call. The features for which information can
-# be set are added automatically by the find_package() command.
-#
-# URL: this should be the homepage of the package, or something similar.
-# Ideally this is set already directly in the Find-module.
-#
-# DESCRIPTION: A short description what that package is, at most one
-# sentence. Ideally this is set already directly in the Find-module.
-#
-# TYPE: What type of dependency has the using project on that package.
-# Default is OPTIONAL. In this case it is a package which can be used
-# by the project when available at buildtime, but it also work without.
-# RECOMMENDED is similar to OPTIONAL, i.e. the project will build if
-# the package is not present, but the functionality of the resulting
-# binaries will be severly limited. If a REQUIRED package is not
-# available at buildtime, the project may not even build. This can be
-# combined with the FATAL_ON_MISSING_REQUIRED_PACKAGES argument for
-# feature_summary(). Last, a RUNTIME package is a package which is
-# actually not used at all during the build, but which is required for
-# actually running the resulting binaries. So if such a package is
-# missing, the project can still be built, but it may not work later on.
-# If set_package_properties() is called multiple times for the same
-# package with different TYPEs, the TYPE is only changed to higher TYPEs
-# ( RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED ), lower TYPEs are
-# ignored. The TYPE property is project-specific, so it cannot be set
-# by the Find-module, but must be set in the project.
-#
-# PURPOSE: This describes which features this package enables in the
-# project, i.e. it tells the user what functionality he gets in the
-# resulting binaries. If set_package_properties() is called multiple
-# times for a package, all PURPOSE properties are appended to a list of
-# purposes of the package in the project. As the TYPE property, also
-# the PURPOSE property is project-specific, so it cannot be set by the
-# Find-module, but must be set in the project.
-#
-#
-#
-# Example for setting the info for a package:
-#
-# ::
-#
-# find_package(LibXml2)
-# set_package_properties(LibXml2 PROPERTIES
-# DESCRIPTION "A XML processing library."
-# URL "http://xmlsoft.org/")
-#
-#
-#
-# ::
-#
-# set_package_properties(LibXml2 PROPERTIES
-# TYPE RECOMMENDED
-# PURPOSE "Enables HTML-import in MyWordProcessor")
-# ...
-# set_package_properties(LibXml2 PROPERTIES
-# TYPE OPTIONAL
-# PURPOSE "Enables odt-export in MyWordProcessor")
-#
-#
-#
-# ::
-#
-# find_package(DBUS)
-# set_package_properties(DBUS PROPERTIES
-# TYPE RUNTIME
-# PURPOSE "Necessary to disable the screensaver during a presentation" )
-#
-#
-#
-# ::
-#
-# ADD_FEATURE_INFO(<name> <enabled> <description>)
-#
-# Use this macro to add information about a feature with the given
-# <name>. <enabled> contains whether this feature is enabled or not,
-# <description> is a text describing the feature. The information can
-# be displayed using feature_summary() for ENABLED_FEATURES and
-# DISABLED_FEATURES respectively.
-#
-# Example for setting the info for a feature:
-#
-# ::
-#
-# option(WITH_FOO "Help for foo" ON)
-# add_feature_info(Foo WITH_FOO "The Foo feature provides very cool stuff.")
-#
-#
-#
-#
-#
-# The following macros are provided for compatibility with previous
-# CMake versions:
-#
-# ::
-#
-# SET_PACKAGE_INFO(<name> <description> [<url> [<purpose>] ] )
-#
-# Use this macro to set up information about the named package, which
-# can then be displayed via FEATURE_SUMMARY(). This can be done either
-# directly in the Find-module or in the project which uses the module
-# after the find_package() call. The features for which information can
-# be set are added automatically by the find_package() command.
-#
-# ::
-#
-# PRINT_ENABLED_FEATURES()
-#
-# Does the same as FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION
-# "Enabled features:")
-#
-# ::
-#
-# PRINT_DISABLED_FEATURES()
-#
-# Does the same as FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION
-# "Disabled features:")
-#
-# ::
-#
-# SET_FEATURE_INFO(<name> <description> [<url>] )
-#
-# Does the same as SET_PACKAGE_INFO(<name> <description> <url> )
+#[=======================================================================[.rst:
+FeatureSummary
+--------------
+
+Functions for generating a summary of enabled/disabled features.
+
+These functions can be used to generate a summary of enabled and disabled
+packages and/or feature for a build tree such as::
+
+ -- The following OPTIONAL packages have been found:
+ LibXml2 (required version >= 2.4), XML processing lib, <http://xmlsoft.org>
+ * Enables HTML-import in MyWordProcessor
+ * Enables odt-export in MyWordProcessor
+ PNG , A PNG image library. , <http://www.libpng.org/pub/png/>
+ * Enables saving screenshots
+ -- The following OPTIONAL packages have not been found:
+ Lua51 , The Lua scripting language. , <http://www.lua.org>
+ * Enables macros in MyWordProcessor
+ Foo , Foo provides cool stuff.
+
+Functions
+^^^^^^^^^
+
+#]=======================================================================]
#=============================================================================
# Copyright 2007-2015 Kitware, Inc.
@@ -280,83 +39,6 @@
include("${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake")
-function(ADD_FEATURE_INFO _name _enabled _desc)
- if (${_enabled})
- set_property(GLOBAL APPEND PROPERTY ENABLED_FEATURES "${_name}")
- else ()
- set_property(GLOBAL APPEND PROPERTY DISABLED_FEATURES "${_name}")
- endif ()
-
- set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
-endfunction()
-
-
-
-function(SET_PACKAGE_PROPERTIES _name _props)
- if(NOT "${_props}" STREQUAL "PROPERTIES")
- message(FATAL_ERROR "PROPERTIES keyword is missing in SET_PACKAGE_PROPERTIES() call.")
- endif()
-
- set(options ) # none
- set(oneValueArgs DESCRIPTION URL TYPE PURPOSE )
- set(multiValueArgs ) # none
-
- CMAKE_PARSE_ARGUMENTS(_SPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
- if(_SPP_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to SET_PACKAGE_PROPERTIES(): \"${_SPP_UNPARSED_ARGUMENTS}\"")
- endif()
-
- if(_SPP_DESCRIPTION)
- get_property(_info GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION)
- if(_info AND NOT "${_info}" STREQUAL "${_SPP_DESCRIPTION}")
- message(STATUS "Warning: Property DESCRIPTION for package ${_name} already set to \"${_info}\", overriding it with \"${_SPP_DESCRIPTION}\"")
- endif()
-
- set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_SPP_DESCRIPTION}" )
- endif()
-
-
- if(_SPP_URL)
- get_property(_info GLOBAL PROPERTY _CMAKE_${_name}_URL)
- if(_info AND NOT "${_info}" STREQUAL "${_SPP_URL}")
- message(STATUS "Warning: Property URL already set to \"${_info}\", overriding it with \"${_SPP_URL}\"")
- endif()
-
- set_property(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_SPP_URL}" )
- endif()
-
-
- # handle the PURPOSE: use APPEND, since there can be multiple purposes for one package inside a project
- if(_SPP_PURPOSE)
- set_property(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_SPP_PURPOSE}" )
- endif()
-
- # handle the TYPE
- if(NOT _SPP_TYPE)
- set(_SPP_TYPE OPTIONAL)
- endif()
-
- # List the supported types, according to their priority
- set(validTypes "RUNTIME" "OPTIONAL" "RECOMMENDED" "REQUIRED" )
- list(FIND validTypes ${_SPP_TYPE} _typeIndexInList)
- if("${_typeIndexInList}" STREQUAL "-1" )
- message(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). "
- "Valid types are OPTIONAL, RECOMMENDED, REQUIRED and RUNTIME." )
- endif()
-
- get_property(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE)
- list(FIND validTypes "${_previousType}" _prevTypeIndexInList)
-
- # make sure a previously set TYPE is not overridden with a lower new TYPE:
- if("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}")
- set_property(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" )
- endif()
-
-endfunction()
-
-
-
function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
set(_type "ANY")
@@ -411,23 +93,23 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
if(includeThisOne)
- set(_currentFeatureText "${_currentFeatureText}\n * ${_currentFeature}")
+ string(APPEND _currentFeatureText "\n * ${_currentFeature}")
get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_REQUIRED_VERSION)
if(_info)
- set(_currentFeatureText "${_currentFeatureText} (required version ${_info})")
+ string(APPEND _currentFeatureText " (required version ${_info})")
endif()
get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION)
if(_info)
- set(_currentFeatureText "${_currentFeatureText} , ${_info}")
+ string(APPEND _currentFeatureText " , ${_info}")
endif()
get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL)
if(_info)
- set(_currentFeatureText "${_currentFeatureText} , <${_info}>")
+ string(APPEND _currentFeatureText " , <${_info}>")
endif()
get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE)
foreach(_purpose ${_info})
- set(_currentFeatureText "${_currentFeatureText}\n ${_purpose}")
+ string(APPEND _currentFeatureText "\n ${_purpose}")
endforeach()
endif()
@@ -439,6 +121,97 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
endfunction()
+#[=======================================================================[.rst:
+.. command:: feature_summary
+
+ ::
+
+ feature_summary( [FILENAME <file>]
+ [APPEND]
+ [VAR <variable_name>]
+ [INCLUDE_QUIET_PACKAGES]
+ [FATAL_ON_MISSING_REQUIRED_PACKAGES]
+ [DESCRIPTION "Found packages:"]
+ WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND
+ | ENABLED_FEATURES | DISABLED_FEATURES)
+ )
+
+ The ``feature_summary()`` macro can be used to print information about
+ enabled or disabled packages or features of a project. By default,
+ only the names of the features/packages will be printed and their
+ required version when one was specified. Use ``set_package_properties()``
+ to add more useful information, like e.g. a download URL for the
+ respective package or their purpose in the project.
+
+ The ``WHAT`` option is the only mandatory option. Here you specify what
+ information will be printed:
+
+ ``ALL``
+ print everything
+ ``ENABLED_FEATURES``
+ the list of all features which are enabled
+ ``DISABLED_FEATURES``
+ the list of all features which are disabled
+ ``PACKAGES_FOUND``
+ the list of all packages which have been found
+ ``PACKAGES_NOT_FOUND``
+ the list of all packages which have not been found
+ ``OPTIONAL_PACKAGES_FOUND``
+ only those packages which have been found which have the type OPTIONAL
+ ``OPTIONAL_PACKAGES_NOT_FOUND``
+ only those packages which have not been found which have the type OPTIONAL
+ ``RECOMMENDED_PACKAGES_FOUND``
+ only those packages which have been found which have the type RECOMMENDED
+ ``RECOMMENDED_PACKAGES_NOT_FOUND``
+ only those packages which have not been found which have the type RECOMMENDED
+ ``REQUIRED_PACKAGES_FOUND``
+ only those packages which have been found which have the type REQUIRED
+ ``REQUIRED_PACKAGES_NOT_FOUND``
+ only those packages which have not been found which have the type REQUIRED
+ ``RUNTIME_PACKAGES_FOUND``
+ only those packages which have been found which have the type RUNTIME
+ ``RUNTIME_PACKAGES_NOT_FOUND``
+ only those packages which have not been found which have the type RUNTIME
+
+ With the exception of the ``ALL`` value, these values can be combined
+ in order to customize the output. For example:
+
+ .. code-block:: cmake
+
+ feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
+
+ If a ``FILENAME`` is given, the information is printed into this file. If
+ ``APPEND`` is used, it is appended to this file, otherwise the file is
+ overwritten if it already existed. If the VAR option is used, the
+ information is "printed" into the specified variable. If ``FILENAME`` is
+ not used, the information is printed to the terminal. Using the
+ ``DESCRIPTION`` option a description or headline can be set which will be
+ printed above the actual content. If ``INCLUDE_QUIET_PACKAGES`` is given,
+ packages which have been searched with ``find_package(... QUIET)`` will
+ also be listed. By default they are skipped. If
+ ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` is given, CMake will abort if a
+ package which is marked as ``REQUIRED`` has not been found.
+
+ Example 1, append everything to a file:
+
+ .. code-block:: cmake
+
+ include(FeatureSummary)
+ feature_summary(WHAT ALL
+ FILENAME ${CMAKE_BINARY_DIR}/all.log APPEND)
+
+ Example 2, print the enabled features into the variable
+ enabledFeaturesText, including QUIET packages:
+
+ .. code-block:: cmake
+
+ include(FeatureSummary)
+ feature_summary(WHAT ENABLED_FEATURES
+ INCLUDE_QUIET_PACKAGES
+ DESCRIPTION "Enabled Features:"
+ VAR enabledFeaturesText)
+ message(STATUS "${enabledFeaturesText}")
+#]=======================================================================]
function(FEATURE_SUMMARY)
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
@@ -527,7 +300,7 @@ function(FEATURE_SUMMARY)
set(_tmp)
_FS_GET_FEATURE_SUMMARY( ${part} _tmp ${_FS_INCLUDE_QUIET_PACKAGES})
if(_tmp)
- set(_fullText "${_fullText}\n-- ${title_${part}}\n${_tmp}\n")
+ string(APPEND _fullText "\n-- ${title_${part}}\n${_tmp}\n")
if("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND")
set(requiredPackagesNotFound TRUE)
endif()
@@ -558,9 +331,198 @@ function(FEATURE_SUMMARY)
endfunction()
+#[=======================================================================[.rst:
+.. command:: set_package_properties
+
+ ::
+
+ set_package_properties(<name> PROPERTIES
+ [ URL <url> ]
+ [ DESCRIPTION <description> ]
+ [ TYPE (RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED) ]
+ [ PURPOSE <purpose> ]
+ )
+
+ Use this macro to set up information about the named package, which
+ can then be displayed via FEATURE_SUMMARY(). This can be done either
+ directly in the Find-module or in the project which uses the module
+ after the find_package() call. The features for which information can
+ be set are added automatically by the find_package() command.
+
+ ``URL <url>``
+ This should be the homepage of the package, or something similar.
+ Ideally this is set already directly in the Find-module.
+
+ ``DESCRIPTION <description>``
+ A short description what that package is, at most one sentence.
+ Ideally this is set already directly in the Find-module.
+
+ ``TYPE <type>``
+ What type of dependency has the using project on that package.
+ Default is ``OPTIONAL``. In this case it is a package which can be used
+ by the project when available at buildtime, but it also work without.
+ ``RECOMMENDED`` is similar to ``OPTIONAL``, i.e. the project will build if
+ the package is not present, but the functionality of the resulting
+ binaries will be severly limited. If a ``REQUIRED`` package is not
+ available at buildtime, the project may not even build. This can be
+ combined with the ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` argument for
+ ``feature_summary()``. Last, a ``RUNTIME`` package is a package which is
+ actually not used at all during the build, but which is required for
+ actually running the resulting binaries. So if such a package is
+ missing, the project can still be built, but it may not work later on.
+ If ``set_package_properties()`` is called multiple times for the same
+ package with different TYPEs, the ``TYPE`` is only changed to higher
+ TYPEs (``RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED``), lower TYPEs are
+ ignored. The ``TYPE`` property is project-specific, so it cannot be set
+ by the Find-module, but must be set in the project.
+
+
+ ``PURPOSE <purpose>``
+ This describes which features this package enables in the
+ project, i.e. it tells the user what functionality he gets in the
+ resulting binaries. If set_package_properties() is called multiple
+ times for a package, all PURPOSE properties are appended to a list of
+ purposes of the package in the project. As the TYPE property, also
+ the PURPOSE property is project-specific, so it cannot be set by the
+ Find-module, but must be set in the project.
+
+ Example for setting the info for a package:
+
+ .. code-block:: cmake
+
+ find_package(LibXml2)
+ set_package_properties(LibXml2 PROPERTIES
+ DESCRIPTION "A XML processing library."
+ URL "http://xmlsoft.org/")
+ # or
+ set_package_properties(LibXml2 PROPERTIES
+ TYPE RECOMMENDED
+ PURPOSE "Enables HTML-import in MyWordProcessor")
+ # or
+ set_package_properties(LibXml2 PROPERTIES
+ TYPE OPTIONAL
+ PURPOSE "Enables odt-export in MyWordProcessor")
+
+ find_package(DBUS)
+ set_package_properties(DBUS PROPERTIES
+ TYPE RUNTIME
+ PURPOSE "Necessary to disable the screensaver during a presentation")
+#]=======================================================================]
+function(SET_PACKAGE_PROPERTIES _name _props)
+ if(NOT "${_props}" STREQUAL "PROPERTIES")
+ message(FATAL_ERROR "PROPERTIES keyword is missing in SET_PACKAGE_PROPERTIES() call.")
+ endif()
+
+ set(options ) # none
+ set(oneValueArgs DESCRIPTION URL TYPE PURPOSE )
+ set(multiValueArgs ) # none
+
+ CMAKE_PARSE_ARGUMENTS(_SPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if(_SPP_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown keywords given to SET_PACKAGE_PROPERTIES(): \"${_SPP_UNPARSED_ARGUMENTS}\"")
+ endif()
+
+ if(_SPP_DESCRIPTION)
+ get_property(_info GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION)
+ if(_info AND NOT "${_info}" STREQUAL "${_SPP_DESCRIPTION}")
+ message(STATUS "Warning: Property DESCRIPTION for package ${_name} already set to \"${_info}\", overriding it with \"${_SPP_DESCRIPTION}\"")
+ endif()
+
+ set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_SPP_DESCRIPTION}" )
+ endif()
+
+
+ if(_SPP_URL)
+ get_property(_info GLOBAL PROPERTY _CMAKE_${_name}_URL)
+ if(_info AND NOT "${_info}" STREQUAL "${_SPP_URL}")
+ message(STATUS "Warning: Property URL already set to \"${_info}\", overriding it with \"${_SPP_URL}\"")
+ endif()
+
+ set_property(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_SPP_URL}" )
+ endif()
+
+
+ # handle the PURPOSE: use APPEND, since there can be multiple purposes for one package inside a project
+ if(_SPP_PURPOSE)
+ set_property(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_SPP_PURPOSE}" )
+ endif()
+
+ # handle the TYPE
+ if(NOT _SPP_TYPE)
+ set(_SPP_TYPE OPTIONAL)
+ endif()
+
+ # List the supported types, according to their priority
+ set(validTypes "RUNTIME" "OPTIONAL" "RECOMMENDED" "REQUIRED" )
+ list(FIND validTypes ${_SPP_TYPE} _typeIndexInList)
+ if("${_typeIndexInList}" STREQUAL "-1" )
+ message(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). "
+ "Valid types are OPTIONAL, RECOMMENDED, REQUIRED and RUNTIME." )
+ endif()
+
+ get_property(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE)
+ list(FIND validTypes "${_previousType}" _prevTypeIndexInList)
+
+ # make sure a previously set TYPE is not overridden with a lower new TYPE:
+ if("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}")
+ set_property(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" )
+ endif()
+
+endfunction()
+
+#[=======================================================================[.rst:
+.. command:: add_feature_info
+
+ ::
+
+ add_feature_info(<name> <enabled> <description>)
+
+ Use this macro to add information about a feature with the given ``<name>``.
+ ``<enabled>`` contains whether this feature is enabled or not.
+ ``<description>`` is a text describing the feature. The information can
+ be displayed using ``feature_summary()`` for ``ENABLED_FEATURES`` and
+ ``DISABLED_FEATURES`` respectively.
+
+ Example for setting the info for a feature:
+
+ .. code-block:: cmake
+
+ option(WITH_FOO "Help for foo" ON)
+ add_feature_info(Foo WITH_FOO "The Foo feature provides very cool stuff.")
+#]=======================================================================]
+function(ADD_FEATURE_INFO _name _enabled _desc)
+ if (${_enabled})
+ set_property(GLOBAL APPEND PROPERTY ENABLED_FEATURES "${_name}")
+ else ()
+ set_property(GLOBAL APPEND PROPERTY DISABLED_FEATURES "${_name}")
+ endif ()
+
+ set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
+endfunction()
+
# The stuff below is only kept for compatibility
+#[=======================================================================[.rst:
+Legacy Macros
+^^^^^^^^^^^^^
+
+The following macros are provided for compatibility with previous
+CMake versions:
+
+.. command:: set_package_info
+
+ ::
+
+ set_package_info(<name> <description> [ <url> [<purpose>] ])
+
+ Use this macro to set up information about the named package, which
+ can then be displayed via ``feature_summary()``. This can be done either
+ directly in the Find-module or in the project which uses the module
+ after the :command:`find_package` call. The features for which information
+ can be set are added automatically by the ``find_package()`` command.
+#]=======================================================================]
function(SET_PACKAGE_INFO _name _desc)
unset(_url)
unset(_purpose)
@@ -579,20 +541,51 @@ function(SET_PACKAGE_INFO _name _desc)
endif()
endfunction()
+#[=======================================================================[.rst:
+.. command:: set_feature_info
+ ::
+ set_feature_info(<name> <description> [<url>])
+
+ Does the same as::
+
+ set_package_info(<name> <description> <url>)
+#]=======================================================================]
function(SET_FEATURE_INFO)
SET_PACKAGE_INFO(${ARGN})
endfunction()
+#[=======================================================================[.rst:
+.. command:: print_enabled_features
+
+ ::
+
+ print_enabled_features()
+ Does the same as
+ .. code-block:: cmake
+
+ feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
+#]=======================================================================]
function(PRINT_ENABLED_FEATURES)
FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
endfunction()
+#[=======================================================================[.rst:
+.. command:: print_disabled_features
+
+ ::
+
+ print_disabled_features()
+
+ Does the same as
+ .. code-block:: cmake
+ feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
+#]=======================================================================]
function(PRINT_DISABLED_FEATURES)
FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
endfunction()
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index 69293f5..6b1c7bd 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -23,7 +23,8 @@
# BISON_TARGET(<Name> <YaccInput> <CodeOutput>
# [COMPILE_FLAGS <flags>]
# [DEFINES_FILE <file>]
-# [VERBOSE <file>]
+# [VERBOSE [<file>]]
+# [REPORT_FILE <file>]
# )
#
# which will create a custom rule to generate a parser. ``<YaccInput>`` is
@@ -39,9 +40,14 @@
# ``DEFINES_FILE <file>``
# Specify a non-default header ``<file>`` to be generated by ``bison``.
#
-# ``VERBOSE <file>``
-# Tell ``bison`` to write verbose descriptions of the grammar and
-# parser to the given ``<file>``.
+# ``VERBOSE [<file>]``
+# Tell ``bison`` to write a report file of the grammar and parser.
+# If ``<file>`` is given, it specifies path the report file is copied to.
+# ``[<file>]`` is left for backward compatibility of this module.
+# Use ``VERBOSE REPORT_FILE <file>``.
+#
+# ``REPORT_FILE <file>``
+# Specify a non-default report ``<file>``, if generated.
#
# The macro defines the following variables:
#
@@ -58,7 +64,7 @@
# The header file generated by bison
#
# ``BISON_<Name>_OUTPUTS``
-# The sources files generated by bison
+# All files generated by bison including the source, the header and the report
#
# ``BISON_<Name>_COMPILE_FLAGS``
# Options used in the ``bison`` command line
@@ -120,35 +126,65 @@ if(BISON_EXECUTABLE)
endif()
# internal macro
- macro(BISON_TARGET_option_verbose Name BisonOutput filename)
- list(APPEND BISON_TARGET_cmdopt "--verbose")
- get_filename_component(BISON_TARGET_output_path "${BisonOutput}" PATH)
- get_filename_component(BISON_TARGET_output_name "${BisonOutput}" NAME_WE)
- add_custom_command(OUTPUT ${filename}
- COMMAND ${CMAKE_COMMAND} -E copy
- "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
- "${filename}"
- VERBATIM
- DEPENDS
- "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
- COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}"
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
- set(BISON_${Name}_VERBOSE_FILE ${filename})
- list(APPEND BISON_TARGET_extraoutputs
- "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output")
- endmacro()
-
- # internal macro
+ # sets BISON_TARGET_cmdopt
macro(BISON_TARGET_option_extraopts Options)
+ set(BISON_TARGET_cmdopt "")
set(BISON_TARGET_extraopts "${Options}")
separate_arguments(BISON_TARGET_extraopts)
list(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts})
endmacro()
# internal macro
- macro(BISON_TARGET_option_defines Header)
- set(BISON_TARGET_output_header "${Header}")
- list(APPEND BISON_TARGET_cmdopt --defines=${BISON_TARGET_output_header})
+ # sets BISON_TARGET_output_header and BISON_TARGET_cmdopt
+ macro(BISON_TARGET_option_defines BisonOutput Header)
+ if("${Header}" STREQUAL "")
+ # default header path generated by bison (see option -d)
+ string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${BisonOutput}")
+ string(REPLACE "c" "h" _fileext ${_fileext})
+ string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
+ BISON_TARGET_output_header "${BisonOutput}")
+ list(APPEND BISON_TARGET_cmdopt "-d")
+ else()
+ set(BISON_TARGET_output_header "${Header}")
+ list(APPEND BISON_TARGET_cmdopt "--defines=${BISON_TARGET_output_header}")
+ endif()
+ endmacro()
+
+ # internal macro
+ # sets BISON_TARGET_verbose_file and BISON_TARGET_cmdopt
+ macro(BISON_TARGET_option_report_file BisonOutput ReportFile)
+ if("${ReportFile}" STREQUAL "")
+ get_filename_component(BISON_TARGET_output_path "${BisonOutput}" PATH)
+ get_filename_component(BISON_TARGET_output_name "${BisonOutput}" NAME_WE)
+ set(BISON_TARGET_verbose_file
+ "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output")
+ else()
+ set(BISON_TARGET_verbose_file "${ReportFile}")
+ list(APPEND BISON_TARGET_cmdopt "--report-file=${BISON_TARGET_verbose_file}")
+ endif()
+ endmacro()
+
+ # internal macro
+ # adds a custom command and sets
+ # BISON_TARGET_cmdopt, BISON_TARGET_verbose_file, BISON_TARGET_extraoutputs
+ macro(BISON_TARGET_option_verbose Name BisonOutput filename)
+ list(APPEND BISON_TARGET_cmdopt "--verbose")
+ list(APPEND BISON_TARGET_extraoutputs
+ "${BISON_TARGET_verbose_file}")
+ if (NOT "${filename}" STREQUAL "")
+ add_custom_command(OUTPUT ${filename}
+ COMMAND ${CMAKE_COMMAND} -E copy
+ "${BISON_TARGET_verbose_file}"
+ "${filename}"
+ VERBATIM
+ DEPENDS
+ "${BISON_TARGET_verbose_file}"
+ COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ set(BISON_${Name}_VERBOSE_FILE ${filename})
+ list(APPEND BISON_TARGET_extraoutputs
+ "${filename}")
+ endif()
endmacro()
#============================================================
@@ -156,18 +192,20 @@ if(BISON_EXECUTABLE)
#============================================================
#
macro(BISON_TARGET Name BisonInput BisonOutput)
- set(BISON_TARGET_output_header "")
- set(BISON_TARGET_cmdopt "")
set(BISON_TARGET_outputs "${BisonOutput}")
+ set(BISON_TARGET_extraoutputs "")
# Parsing parameters
- set(BISON_TARGET_PARAM_OPTIONS)
+ set(BISON_TARGET_PARAM_OPTIONS
+ )
set(BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS
- VERBOSE
COMPILE_FLAGS
DEFINES_FILE
+ REPORT_FILE
+ )
+ set(BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS
+ VERBOSE
)
- set(BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS)
cmake_parse_arguments(
BISON_TARGET_ARG
"${BISON_TARGET_PARAM_OPTIONS}"
@@ -178,29 +216,30 @@ if(BISON_EXECUTABLE)
if(NOT "${BISON_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
message(SEND_ERROR "Usage")
+ elseif("${BISON_TARGET_ARG_VERBOSE}" MATCHES ";")
+ # [VERBOSE [<file>] hack: <file> is non-multi value by usage
+ message(SEND_ERROR "Usage")
else()
+
+ BISON_TARGET_option_extraopts("${BISON_TARGET_ARG_COMPILE_FLAGS}")
+ BISON_TARGET_option_defines("${BisonOutput}" "${BISON_TARGET_ARG_DEFINES_FILE}")
+ BISON_TARGET_option_report_file("${BisonOutput}" "${BISON_TARGET_ARG_REPORT_FILE}")
if(NOT "${BISON_TARGET_ARG_VERBOSE}" STREQUAL "")
BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${BISON_TARGET_ARG_VERBOSE}")
- endif()
- if(NOT "${BISON_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "")
- BISON_TARGET_option_extraopts("${BISON_TARGET_ARG_COMPILE_FLAGS}")
- endif()
- if(NOT "${BISON_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
- BISON_TARGET_option_defines("${BISON_TARGET_ARG_DEFINES_FILE}")
+ else()
+ # [VERBOSE [<file>]] is used with no argument or is not used
+ set(BISON_TARGET_args "${ARGN}")
+ list(FIND BISON_TARGET_args "VERBOSE" BISON_TARGET_args_indexof_verbose)
+ if(${BISON_TARGET_args_indexof_verbose} GREATER -1)
+ # VERBOSE is used without <file>
+ BISON_TARGET_option_verbose(${Name} ${BisonOutput} "")
+ endif()
endif()
- if("${BISON_TARGET_output_header}" STREQUAL "")
- # Header's name generated by bison (see option -d)
- list(APPEND BISON_TARGET_cmdopt "-d")
- string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${BisonOutput}")
- string(REPLACE "c" "h" _fileext ${_fileext})
- string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
- BISON_TARGET_output_header "${BisonOutput}")
- endif()
list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}")
add_custom_command(OUTPUT ${BISON_TARGET_outputs}
- ${BISON_TARGET_extraoutputs}
+ ${BISON_TARGET_verbose_file}
COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput}
VERBATIM
DEPENDS ${BisonInput}
@@ -210,7 +249,7 @@ if(BISON_EXECUTABLE)
# define target variables
set(BISON_${Name}_DEFINED TRUE)
set(BISON_${Name}_INPUT ${BisonInput})
- set(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs})
+ set(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs} ${BISON_TARGET_extraoutputs})
set(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt})
set(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}")
set(BISON_${Name}_OUTPUT_HEADER "${BISON_TARGET_output_header}")
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 6af42dd..152d812 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -4,7 +4,16 @@
#
# Try to find BZip2
#
-# Once done this will define
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines :prop_tgt:`IMPORTED` target ``BZip2::BZip2``, if
+# BZip2 has been found.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the following variables:
#
# ::
#
@@ -37,7 +46,7 @@ find_path(BZIP2_INCLUDE_DIR bzlib.h ${_BZIP2_PATHS} PATH_SUFFIXES include)
if (NOT BZIP2_LIBRARIES)
find_library(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 ${_BZIP2_PATHS} PATH_SUFFIXES lib)
- find_library(BZIP2_LIBRARY_DEBUG NAMES bzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib)
+ find_library(BZIP2_LIBRARY_DEBUG NAMES bz2d bzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
SELECT_LIBRARY_CONFIGURATIONS(BZIP2)
@@ -64,6 +73,31 @@ if (BZIP2_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES})
CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX)
cmake_pop_check_state()
+
+ if(NOT TARGET BZip2::BZip2)
+ add_library(BZip2::BZip2 UNKNOWN IMPORTED)
+ set_target_properties(BZip2::BZip2 PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIRS}")
+
+ if(BZIP2_LIBRARY_RELEASE)
+ set_property(TARGET BZip2::BZip2 APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(BZip2::BZip2 PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${BZIP2_LIBRARY_RELEASE}")
+ endif()
+
+ if(BZIP2_LIBRARY_DEBUG)
+ set_property(TARGET BZip2::BZip2 APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(BZip2::BZip2 PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${BZIP2_LIBRARY_DEBUG}")
+ endif()
+
+ if(NOT BZIP2_LIBRARY_RELEASE AND NOT BZIP2_LIBRARY_DEBUG)
+ set_property(TARGET BZip2::BZip2 APPEND PROPERTY
+ IMPORTED_LOCATION "${BZIP2_LIBRARY}")
+ endif()
+ endif()
endif ()
mark_as_advanced(BZIP2_INCLUDE_DIR)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 67d71d0..1f03841 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -209,6 +209,7 @@
# Copyright 2007 Mike Jackson
# Copyright 2008 Andreas Pakulat <apaku@gmx.de>
# Copyright 2008-2012 Philip Lowman <philip@yhbt.com>
+# Copyright 2016 Alex Turbov <i.zaufi@gmail.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -442,24 +443,26 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
endif()
elseif (GHSMULTI)
set(_boost_COMPILER "-ghs")
- elseif (MSVC14)
- set(_boost_COMPILER "-vc140")
- elseif (MSVC12)
- set(_boost_COMPILER "-vc120")
- elseif (MSVC11)
- set(_boost_COMPILER "-vc110")
- elseif (MSVC10)
- set(_boost_COMPILER "-vc100")
- elseif (MSVC90)
- set(_boost_COMPILER "-vc90")
- elseif (MSVC80)
- set(_boost_COMPILER "-vc80")
- elseif (MSVC71)
- set(_boost_COMPILER "-vc71")
- elseif (MSVC70) # Good luck!
- set(_boost_COMPILER "-vc7") # yes, this is correct
- elseif (MSVC60) # Good luck!
- set(_boost_COMPILER "-vc6") # yes, this is correct
+ elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
+ set(_boost_COMPILER "-vc140")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
+ set(_boost_COMPILER "-vc120")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
+ set(_boost_COMPILER "-vc110")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
+ set(_boost_COMPILER "-vc100")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
+ set(_boost_COMPILER "-vc90")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
+ set(_boost_COMPILER "-vc80")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10)
+ set(_boost_COMPILER "-vc71")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck!
+ set(_boost_COMPILER "-vc7") # yes, this is correct
+ else() # MSVC60 Good luck!
+ set(_boost_COMPILER "-vc6") # yes, this is correct
+ endif()
elseif (BORLAND)
set(_boost_COMPILER "-bcb")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
@@ -805,6 +808,10 @@ function(_Boost_COMPONENT_HEADERS component _hdrs)
set(_Boost_UNIT_TEST_FRAMEWORK_HEADERS "boost/test/framework.hpp")
set(_Boost_WAVE_HEADERS "boost/wave.hpp")
set(_Boost_WSERIALIZATION_HEADERS "boost/archive/text_wiarchive.hpp")
+ if(WIN32)
+ set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp")
+ set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp")
+ endif()
string(TOUPPER ${component} uppercomponent)
set(${_hdrs} ${_Boost_${uppercomponent}_HEADERS} PARENT_SCOPE)
@@ -862,6 +869,37 @@ function(_Boost_MISSING_DEPENDENCIES componentvar extravar)
endfunction()
#
+# Update library search directory hint variable with paths used by prebuilt boost binaries.
+#
+# Prebuilt windows binaries (https://sourceforge.net/projects/boost/files/boost-binaries/)
+# have library directories named using MSVC compiler version and architecture.
+# This function would append corresponding directories if MSVC is a current compiler,
+# so having `BOOST_ROOT` would be enough to specify to find everything.
+#
+macro(_Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir)
+ if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_arch_suffix 64)
+ else()
+ set(_arch_suffix 32)
+ endif()
+ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
+ list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-14.0)
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
+ list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-12.0)
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
+ list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-11.0)
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
+ list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-10.0)
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
+ list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-9.0)
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
+ list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-8.0)
+ endif()
+ endif()
+endmacro()
+
+#
# End functions/macros
#
#-------------------------------------------------------------------------------
@@ -1143,8 +1181,8 @@ if(Boost_INCLUDE_DIR)
math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
+ string(APPEND Boost_ERROR_REASON
+ "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"version.hpp reveals boost "
@@ -1166,16 +1204,16 @@ if(Boost_INCLUDE_DIR)
endif()
if(NOT Boost_FOUND)
# State that we found a version of Boost that is too new or too old.
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
+ string(APPEND Boost_ERROR_REASON
+ "\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
if (Boost_FIND_VERSION_PATCH)
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
+ string(APPEND Boost_ERROR_REASON
+ ".${Boost_FIND_VERSION_PATCH}")
endif ()
if (NOT Boost_FIND_VERSION_EXACT)
- set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
+ string(APPEND Boost_ERROR_REASON " (or newer)")
endif ()
- set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
+ string(APPEND Boost_ERROR_REASON ".")
endif ()
else()
# Caller will accept any Boost version.
@@ -1183,8 +1221,8 @@ if(Boost_INCLUDE_DIR)
endif()
else()
set(Boost_FOUND 0)
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
+ string(APPEND Boost_ERROR_REASON
+ "Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
endif()
# ------------------------------------------------------------------------
@@ -1261,17 +1299,18 @@ endif()
# g using debug versions of the standard and runtime
# support libraries
if(WIN32 AND Boost_USE_DEBUG_RUNTIME)
- if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
+ if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
+ OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
- set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
+ string(APPEND _boost_DEBUG_ABI_TAG "g")
endif()
endif()
# y using special debug build of python
if(Boost_USE_DEBUG_PYTHON)
- set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
+ string(APPEND _boost_DEBUG_ABI_TAG "y")
endif()
# d using a debug version of your code
-set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
+string(APPEND _boost_DEBUG_ABI_TAG "d")
# p using the STLport standard library rather than the
# default one supplied with your compiler
if(Boost_USE_STLPORT)
@@ -1319,8 +1358,10 @@ foreach(c DEBUG RELEASE)
if(BOOST_ROOT)
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
+ _Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} BOOST_ROOT)
elseif(_ENV_BOOST_ROOT)
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
+ _Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} _ENV_BOOST_ROOT)
endif()
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c}
@@ -1599,26 +1640,26 @@ if(Boost_FOUND)
set(Boost_FOUND 0)
# We were unable to find some libraries, so generate a sensible
# error message that lists the libraries we were unable to find.
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}\nCould not find the following")
+ string(APPEND Boost_ERROR_REASON
+ "\nCould not find the following")
if(Boost_USE_STATIC_LIBS)
- set(Boost_ERROR_REASON "${Boost_ERROR_REASON} static")
+ string(APPEND Boost_ERROR_REASON " static")
endif()
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON} Boost libraries:\n")
+ string(APPEND Boost_ERROR_REASON
+ " Boost libraries:\n")
foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON} ${Boost_NAMESPACE}_${COMPONENT}\n")
+ string(APPEND Boost_ERROR_REASON
+ " ${Boost_NAMESPACE}_${COMPONENT}\n")
endforeach()
list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
+ string(APPEND Boost_ERROR_REASON
+ "No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
else ()
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
+ string(APPEND Boost_ERROR_REASON
+ "Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
endif ()
endif ()
@@ -1697,13 +1738,6 @@ if(Boost_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}")
endif()
- if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
- set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(Boost::${COMPONENT} PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
- IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
- endif()
if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
@@ -1711,6 +1745,13 @@ if(Boost_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
endif()
+ if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
+ set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(Boost::${COMPONENT} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
+ endif()
if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES)
unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES)
foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES})
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 48bb554..6b76c25 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -188,10 +188,8 @@
# files.
#
#
-#
# CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS( output_file_var cuda_target
# nvcc_flags object_files)
-#
# -- Generates the link object required by separable compilation from the given
# object files. This is called automatically for CUDA_ADD_EXECUTABLE and
# CUDA_ADD_LIBRARY, but can be called manually when using CUDA_WRAP_SRCS
@@ -201,6 +199,24 @@
# specified by CUDA_64_BIT_DEVICE_CODE. Note that this is a function
# instead of a macro.
#
+# CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable [target_CUDA_architectures])
+# -- Selects GPU arch flags for nvcc based on target_CUDA_architectures
+# target_CUDA_architectures : Auto | Common | All | LIST(ARCH_AND_PTX ...)
+# - "Auto" detects local machine GPU compute arch at runtime.
+# - "Common" and "All" cover common and entire subsets of architectures
+# ARCH_AND_PTX : NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX
+# NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal
+# NUM: Any number. Only those pairs are currently accepted by NVCC though:
+# 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2
+# Returns LIST of flags to be added to CUDA_NVCC_FLAGS in ${out_variable}
+# Additionally, sets ${out_variable}_readable to the resulting numeric list
+# Example:
+# CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell)
+# LIST(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})
+#
+# More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA
+# Note that this is a function instead of a macro.
+#
# CUDA_WRAP_SRCS ( cuda_target format generated_files file0 file1 ...
# [STATIC | SHARED | MODULE] [OPTIONS ...] )
# -- This is where all the magic happens. CUDA_ADD_EXECUTABLE,
@@ -283,10 +299,12 @@
# implementation (alternative to:
# CUDA_ADD_CUFFT_TO_TARGET macro)
# CUDA_CUBLAS_LIBRARIES -- Device or emulation library for the Cuda BLAS
-# implementation (alterative to:
+# implementation (alternative to:
# CUDA_ADD_CUBLAS_TO_TARGET macro).
# CUDA_cudart_static_LIBRARY -- Statically linkable cuda runtime library.
# Only available for CUDA version 5.5+
+# CUDA_cudadevrt_LIBRARY -- Device runtime library.
+# Required for separable compilation.
# CUDA_cupti_LIBRARY -- CUDA Profiling Tools Interface library.
# Only available for CUDA version 4.0+.
# CUDA_curand_LIBRARY -- CUDA Random Number Generation library.
@@ -548,6 +566,7 @@ macro(cuda_unset_include_and_libraries)
unset(CUDA_CUDARTEMU_LIBRARY CACHE)
endif()
unset(CUDA_cudart_static_LIBRARY CACHE)
+ unset(CUDA_cudadevrt_LIBRARY CACHE)
unset(CUDA_cublas_LIBRARY CACHE)
unset(CUDA_cublas_device_LIBRARY CACHE)
unset(CUDA_cublasemu_LIBRARY CACHE)
@@ -563,8 +582,8 @@ macro(cuda_unset_include_and_libraries)
unset(CUDA_npps_LIBRARY CACHE)
unset(CUDA_nvcuvenc_LIBRARY CACHE)
unset(CUDA_nvcuvid_LIBRARY CACHE)
-
unset(CUDA_USE_STATIC_CUDA_RUNTIME CACHE)
+ unset(CUDA_GPU_DETECT_OUTPUT CACHE)
endmacro()
# Check to see if the CUDA_TOOLKIT_ROOT_DIR and CUDA_SDK_ROOT_DIR have changed,
@@ -580,31 +599,33 @@ if(NOT "${CUDA_TOOLKIT_TARGET_DIR}" STREQUAL "${CUDA_TOOLKIT_TARGET_DIR_INTERNAL
cuda_unset_include_and_libraries()
endif()
-if(NOT "${CUDA_SDK_ROOT_DIR}" STREQUAL "${CUDA_SDK_ROOT_DIR_INTERNAL}")
- # No specific variables to catch. Use this kind of code before calling
- # find_package(CUDA) to clean up any variables that may depend on this path.
+#
+# End of unset()
+#
- # unset(MY_SPECIAL_CUDA_SDK_INCLUDE_DIR CACHE)
- # unset(MY_SPECIAL_CUDA_SDK_LIBRARY CACHE)
-endif()
+#
+# Start looking for things
+#
# Search for the cuda distribution.
-if(NOT CUDA_TOOLKIT_ROOT_DIR)
-
+if(NOT CUDA_TOOLKIT_ROOT_DIR AND NOT CMAKE_CROSSCOMPILING)
# Search in the CUDA_BIN_PATH first.
find_path(CUDA_TOOLKIT_ROOT_DIR
NAMES nvcc nvcc.exe
PATHS
+ ENV CUDA_TOOLKIT_ROOT
ENV CUDA_PATH
ENV CUDA_BIN_PATH
PATH_SUFFIXES bin bin64
DOC "Toolkit location."
NO_DEFAULT_PATH
)
+
# Now search default paths
find_path(CUDA_TOOLKIT_ROOT_DIR
NAMES nvcc nvcc.exe
- PATHS /usr/local/bin
+ PATHS /opt/cuda/bin
+ /usr/local/bin
/usr/local/cuda/bin
DOC "Toolkit location."
)
@@ -613,7 +634,9 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR)
string(REGEX REPLACE "[/\\\\]?bin[64]*[/\\\\]?$" "" CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR})
# We need to force this back into the cache.
set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH "Toolkit location." FORCE)
+ set(CUDA_TOOLKIT_TARGET_DIR ${CUDA_TOOLKIT_ROOT_DIR})
endif()
+
if (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
if(CUDA_FIND_REQUIRED)
message(FATAL_ERROR "Specify CUDA_TOOLKIT_ROOT_DIR")
@@ -623,8 +646,45 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR)
endif ()
endif ()
+if(CMAKE_CROSSCOMPILING)
+ SET (CUDA_TOOLKIT_ROOT $ENV{CUDA_TOOLKIT_ROOT})
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
+ # Support for NVPACK
+ set (CUDA_TOOLKIT_TARGET_NAME "armv7-linux-androideabi")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
+ # Support for arm cross compilation
+ set(CUDA_TOOLKIT_TARGET_NAME "armv7-linux-gnueabihf")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
+ # Support for aarch64 cross compilation
+ if (ANDROID_ARCH_NAME STREQUAL "arm64")
+ set(CUDA_TOOLKIT_TARGET_NAME "aarch64-linux-androideabi")
+ else()
+ set(CUDA_TOOLKIT_TARGET_NAME "aarch64-linux")
+ endif (ANDROID_ARCH_NAME STREQUAL "arm64")
+ endif()
+
+ if (EXISTS "${CUDA_TOOLKIT_ROOT}/targets/${CUDA_TOOLKIT_TARGET_NAME}")
+ set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT}/targets/${CUDA_TOOLKIT_TARGET_NAME}" CACHE PATH "CUDA Toolkit target location.")
+ SET (CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT})
+ mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR)
+ endif()
+
+ # add known CUDA targetr root path to the set of directories we search for programs, libraries and headers
+ set( CMAKE_FIND_ROOT_PATH "${CUDA_TOOLKIT_TARGET_DIR};${CMAKE_FIND_ROOT_PATH}")
+ macro( cuda_find_host_program )
+ find_host_program( ${ARGN} )
+ endmacro()
+else()
+ # for non-cross-compile, find_host_program == find_program and CUDA_TOOLKIT_TARGET_DIR == CUDA_TOOLKIT_ROOT_DIR
+ macro( cuda_find_host_program )
+ find_program( ${ARGN} )
+ endmacro()
+ SET (CUDA_TOOLKIT_TARGET_DIR ${CUDA_TOOLKIT_ROOT_DIR})
+endif()
+
+
# CUDA_NVCC_EXECUTABLE
-find_program(CUDA_NVCC_EXECUTABLE
+cuda_find_host_program(CUDA_NVCC_EXECUTABLE
NAMES nvcc
PATHS "${CUDA_TOOLKIT_ROOT_DIR}"
ENV CUDA_PATH
@@ -633,7 +693,7 @@ find_program(CUDA_NVCC_EXECUTABLE
NO_DEFAULT_PATH
)
# Search default search paths, after we search our own set of paths.
-find_program(CUDA_NVCC_EXECUTABLE nvcc)
+cuda_find_host_program(CUDA_NVCC_EXECUTABLE nvcc)
mark_as_advanced(CUDA_NVCC_EXECUTABLE)
if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION)
@@ -649,33 +709,14 @@ else()
string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR "${CUDA_VERSION}")
endif()
+
# Always set this convenience variable
set(CUDA_VERSION_STRING "${CUDA_VERSION}")
-# Support for arm cross compilation with CUDA 5.5
-if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf")
- set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf" CACHE PATH "Toolkit target location.")
-# Support for aarch64 cross compilation with CUDA 7.0
-elseif(CUDA_VERSION VERSION_GREATER "6.5" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux")
- set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux" CACHE PATH "Toolkit target location.")
-else()
- set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}" CACHE PATH "Toolkit target location.")
-endif()
-mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR)
-
-# Target CPU architecture
-if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
- set(_cuda_target_cpu_arch_initial "ARM")
-else()
- set(_cuda_target_cpu_arch_initial "")
-endif()
-set(CUDA_TARGET_CPU_ARCH ${_cuda_target_cpu_arch_initial} CACHE STRING "Specify the name of the class of CPU architecture for which the input files must be compiled.")
-mark_as_advanced(CUDA_TARGET_CPU_ARCH)
-
# CUDA_TOOLKIT_INCLUDE
find_path(CUDA_TOOLKIT_INCLUDE
device_functions.h # Header included in toolkit
- PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}"
+ PATHS ${CUDA_TOOLKIT_TARGET_DIR}
ENV CUDA_PATH
ENV CUDA_INC_PATH
PATH_SUFFIXES include
@@ -692,7 +733,7 @@ else()
endif()
# Set the user list of include dir to nothing to initialize it.
-set (CUDA_NVCC_INCLUDE_ARGS_USER "")
+set (CUDA_NVCC_INCLUDE_DIRS_USER "")
set (CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE})
macro(cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext )
@@ -705,19 +746,21 @@ macro(cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext )
# (lib/Win32) and the old path (lib).
find_library(${_var}
NAMES ${_names}
- PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}"
+ PATHS "${CUDA_TOOLKIT_TARGET_DIR}"
ENV CUDA_PATH
ENV CUDA_LIB_PATH
PATH_SUFFIXES ${_cuda_64bit_lib_dir} "${_path_ext}lib/Win32" "${_path_ext}lib" "${_path_ext}libWin32"
DOC ${_doc}
NO_DEFAULT_PATH
)
- # Search default search paths, after we search our own set of paths.
- find_library(${_var}
- NAMES ${_names}
- PATHS "/usr/lib/nvidia-current"
- DOC ${_doc}
- )
+ if (NOT CMAKE_CROSSCOMPILING)
+ # Search default search paths, after we search our own set of paths.
+ find_library(${_var}
+ NAMES ${_names}
+ PATHS "/usr/lib/nvidia-current"
+ DOC ${_doc}
+ )
+ endif()
endmacro()
macro(cuda_find_library_local_first _var _names _doc)
@@ -738,15 +781,25 @@ if(CUDA_VERSION VERSION_EQUAL "3.0")
CUDA_CUDARTEMU_LIBRARY
)
endif()
+
if(NOT CUDA_VERSION VERSION_LESS "5.5")
cuda_find_library_local_first(CUDA_cudart_static_LIBRARY cudart_static "static CUDA runtime library")
mark_as_advanced(CUDA_cudart_static_LIBRARY)
endif()
+
+
if(CUDA_cudart_static_LIBRARY)
- # Set whether to use the static cuda runtime.
+ # If static cudart available, use it by default, but provide a user-visible option to disable it.
option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" ON)
+ set(CUDA_CUDART_LIBRARY_VAR CUDA_cudart_static_LIBRARY)
else()
- option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" OFF)
+ # If not available, silently disable the option.
+ set(CUDA_USE_STATIC_CUDA_RUNTIME OFF CACHE INTERNAL "")
+ set(CUDA_CUDART_LIBRARY_VAR CUDA_CUDART_LIBRARY)
+endif()
+if(NOT CUDA_VERSION VERSION_LESS "5.0")
+ cuda_find_library_local_first(CUDA_cudadevrt_LIBRARY cudadevrt "\"cudadevrt\" library")
+ mark_as_advanced(CUDA_cudadevrt_LIBRARY)
endif()
if(CUDA_USE_STATIC_CUDA_RUNTIME)
@@ -772,8 +825,9 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME)
else()
unset(CMAKE_THREAD_PREFER_PTHREAD)
endif()
- if (NOT APPLE)
- # Here is librt that has things such as, clock_gettime, shm_open, and shm_unlink.
+
+ if(NOT APPLE)
+ #On Linux, you must link against librt when using the static cuda runtime.
find_library(CUDA_rt_LIBRARY rt)
if (NOT CUDA_rt_LIBRARY)
message(WARNING "Expecting to find librt for libcudart_static, but didn't find it.")
@@ -955,12 +1009,13 @@ set(CUDA_SDK_ROOT_DIR_INTERNAL "${CUDA_SDK_ROOT_DIR}" CACHE INTERNAL
"This is the value of the last time CUDA_SDK_ROOT_DIR was set successfully." FORCE)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
find_package_handle_standard_args(CUDA
REQUIRED_VARS
CUDA_TOOLKIT_ROOT_DIR
CUDA_NVCC_EXECUTABLE
CUDA_INCLUDE_DIRS
- CUDA_CUDART_LIBRARY
+ ${CUDA_CUDART_LIBRARY_VAR}
VERSION_VAR
CUDA_VERSION
)
@@ -977,7 +1032,7 @@ find_package_handle_standard_args(CUDA
# Add include directories to pass to the nvcc command.
macro(CUDA_INCLUDE_DIRECTORIES)
foreach(dir ${ARGN})
- list(APPEND CUDA_NVCC_INCLUDE_ARGS_USER -I${dir})
+ list(APPEND CUDA_NVCC_INCLUDE_DIRS_USER ${dir})
endforeach()
endmacro()
@@ -986,6 +1041,7 @@ endmacro()
cuda_find_helper_file(parse_cubin cmake)
cuda_find_helper_file(make2cmake cmake)
cuda_find_helper_file(run_nvcc cmake)
+include("${CMAKE_CURRENT_LIST_DIR}/FindCUDA/select_compute_arch.cmake")
##############################################################################
# Separate the OPTIONS out from the sources
@@ -1139,6 +1195,18 @@ endfunction()
macro(CUDA_WRAP_SRCS cuda_target format generated_files)
+ # Put optional arguments in list.
+ set(_argn_list "${ARGN}")
+ # If one of the given optional arguments is "PHONY", make a note of it, then
+ # remove it from the list.
+ list(FIND _argn_list "PHONY" _phony_idx)
+ if("${_phony_idx}" GREATER "-1")
+ set(_target_is_phony true)
+ list(REMOVE_AT _argn_list ${_phony_idx})
+ else()
+ set(_target_is_phony false)
+ endif()
+
# If CMake doesn't support separable compilation, complain
if(CUDA_SEPARABLE_COMPILATION AND CMAKE_VERSION VERSION_LESS "2.8.10.1")
message(SEND_ERROR "CUDA_SEPARABLE_COMPILATION isn't supported for CMake versions less than 2.8.10.1")
@@ -1200,18 +1268,27 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
endif()
# Initialize our list of includes with the user ones followed by the CUDA system ones.
- set(CUDA_NVCC_INCLUDE_ARGS ${CUDA_NVCC_INCLUDE_ARGS_USER} "-I${CUDA_INCLUDE_DIRS}")
- # Get the include directories for this directory and use them for our nvcc command.
- # Remove duplicate entries which may be present since include_directories
- # in CMake >= 2.8.8 does not remove them.
- get_directory_property(CUDA_NVCC_INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES)
- list(REMOVE_DUPLICATES CUDA_NVCC_INCLUDE_DIRECTORIES)
- if(CUDA_NVCC_INCLUDE_DIRECTORIES)
- foreach(dir ${CUDA_NVCC_INCLUDE_DIRECTORIES})
- list(APPEND CUDA_NVCC_INCLUDE_ARGS -I${dir})
- endforeach()
+ set(CUDA_NVCC_INCLUDE_DIRS ${CUDA_NVCC_INCLUDE_DIRS_USER} "${CUDA_INCLUDE_DIRS}")
+ if(_target_is_phony)
+ # If the passed in target name isn't a real target (i.e., this is from a call to one of the
+ # cuda_compile_* functions), need to query directory properties to get include directories
+ # and compile definitions.
+ get_directory_property(_dir_include_dirs INCLUDE_DIRECTORIES)
+ get_directory_property(_dir_compile_defs COMPILE_DEFINITIONS)
+
+ list(APPEND CUDA_NVCC_INCLUDE_DIRS "${_dir_include_dirs}")
+ set(CUDA_NVCC_COMPILE_DEFINITIONS "${_dir_compile_defs}")
+ else()
+ # Append the include directories for this target via generator expression, which is
+ # expanded by the FILE(GENERATE) call below. This generator expression captures all
+ # include dirs set by the user, whether via directory properties or target properties
+ list(APPEND CUDA_NVCC_INCLUDE_DIRS "$<TARGET_PROPERTY:${cuda_target},INCLUDE_DIRECTORIES>")
+
+ # Do the same thing with compile definitions
+ set(CUDA_NVCC_COMPILE_DEFINITIONS "$<TARGET_PROPERTY:${cuda_target},COMPILE_DEFINITIONS>")
endif()
+
# Reset these variables
set(CUDA_WRAP_OPTION_NVCC_FLAGS)
foreach(config ${CUDA_configuration_types})
@@ -1219,7 +1296,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper})
endforeach()
- CUDA_GET_SOURCES_AND_OPTIONS(_cuda_wrap_sources _cuda_wrap_cmake_options _cuda_wrap_options ${ARGN})
+ CUDA_GET_SOURCES_AND_OPTIONS(_cuda_wrap_sources _cuda_wrap_cmake_options _cuda_wrap_options ${_argn_list})
CUDA_PARSE_NVCC_OPTIONS(CUDA_WRAP_OPTION_NVCC_FLAGS ${_cuda_wrap_options})
# Figure out if we are building a shared library. BUILD_SHARED_LIBS is
@@ -1278,13 +1355,13 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")
endif()
- set(_cuda_host_flags "${_cuda_host_flags}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})")
+ string(APPEND _cuda_host_flags "\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})")
endif()
# Note that if we ever want CUDA_NVCC_FLAGS_<CONFIG> to be string (instead of a list
# like it is currently), we can remove the quotes around the
# ${CUDA_NVCC_FLAGS_${config_upper}} variable like the CMAKE_HOST_FLAGS_<CONFIG> variable.
- set(_cuda_nvcc_flags_config "${_cuda_nvcc_flags_config}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})")
+ string(APPEND _cuda_nvcc_flags_config "\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})")
endforeach()
# Process the C++11 flag. If the host sets the flag, we need to add it to nvcc and
@@ -1300,14 +1377,6 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
string(REGEX REPLACE "[-]+std=c\\+\\+11" "" _cuda_host_flags "${_cuda_host_flags}")
endif()
- # Get the list of definitions from the directory property
- get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS)
- if(CUDA_NVCC_DEFINITIONS)
- foreach(_definition ${CUDA_NVCC_DEFINITIONS})
- list(APPEND nvcc_flags "-D${_definition}")
- endforeach()
- endif()
-
if(_cuda_build_shared_libs)
list(APPEND nvcc_flags "-D${cuda_target}_EXPORTS")
endif()
@@ -1317,7 +1386,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# Iterate over the macro arguments and create custom
# commands for all the .cu files.
- foreach(file ${ARGN})
+ foreach(file ${_argn_list})
# Ignore any file marked as a HEADER_FILE_ONLY
get_source_file_property(_is_header ${file} HEADER_FILE_ONLY)
# Allow per source file overrides of the format. Also allows compiling non-.cu files.
@@ -1675,6 +1744,12 @@ macro(CUDA_ADD_LIBRARY cuda_target)
${CUDA_LIBRARIES}
)
+ if(CUDA_SEPARABLE_COMPILATION)
+ target_link_libraries(${cuda_target}
+ ${CUDA_cudadevrt_LIBRARY}
+ )
+ endif()
+
# We need to set the linker language based on what the expected generated file
# would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP.
set_target_properties(${cuda_target}
@@ -1735,12 +1810,23 @@ endmacro()
###############################################################################
###############################################################################
macro(cuda_compile_base cuda_target format generated_files)
+ # Update a counter in this directory, to keep phony target names unique.
+ set(_cuda_target "${cuda_target}")
+ get_property(_counter DIRECTORY PROPERTY _cuda_internal_phony_counter)
+ if(_counter)
+ math(EXPR _counter "${_counter} + 1")
+ else()
+ set(_counter 1)
+ endif()
+ set(_cuda_target "${_cuda_target}_${_counter}")
+ set_property(DIRECTORY PROPERTY _cuda_internal_phony_counter ${_counter})
# Separate the sources from the options
CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
+
# Create custom commands and targets for each file.
- CUDA_WRAP_SRCS( ${cuda_target} ${format} _generated_files ${_sources} ${_cmake_options}
- OPTIONS ${_options} )
+ CUDA_WRAP_SRCS( ${_cuda_target} ${format} _generated_files ${_sources}
+ ${_cmake_options} OPTIONS ${_options} PHONY)
set( ${generated_files} ${_generated_files})
diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake
index 802f93a..7b5389e 100644
--- a/Modules/FindCUDA/make2cmake.cmake
+++ b/Modules/FindCUDA/make2cmake.cmake
@@ -100,7 +100,7 @@ list(REMOVE_DUPLICATES dependency_list)
list(SORT dependency_list)
foreach(file ${dependency_list})
- set(cuda_nvcc_depend "${cuda_nvcc_depend} \"${file}\"\n")
+ string(APPEND cuda_nvcc_depend " \"${file}\"\n")
endforeach()
file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n")
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index 12b83e0..28cc1e9 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -73,10 +73,25 @@ set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@") # path
set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list
@CUDA_NVCC_FLAGS_CONFIG@
set(nvcc_flags @nvcc_flags@) # list
-set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@") # list (needs to be in quotes to handle spaces properly).
+set(CUDA_NVCC_INCLUDE_DIRS "@CUDA_NVCC_INCLUDE_DIRS@") # list (needs to be in quotes to handle spaces properly).
+set(CUDA_NVCC_COMPILE_DEFINITIONS "@CUDA_NVCC_COMPILE_DEFINITIONS@") # list (needs to be in quotes to handle spaces properly).
set(format_flag "@format_flag@") # string
set(cuda_language_flag @cuda_language_flag@) # list
+# Clean up list of include directories and add -I flags
+list(REMOVE_DUPLICATES CUDA_NVCC_INCLUDE_DIRS)
+set(CUDA_NVCC_INCLUDE_ARGS)
+foreach(dir ${CUDA_NVCC_INCLUDE_DIRS})
+ # Extra quotes are added around each flag to help nvcc parse out flags with spaces.
+ list(APPEND CUDA_NVCC_INCLUDE_ARGS "-I${dir}")
+endforeach()
+
+# Clean up list of compile definitions, add -D flags, and append to nvcc_flags
+list(REMOVE_DUPLICATES CUDA_NVCC_COMPILE_DEFINITIONS)
+foreach(def ${CUDA_NVCC_COMPILE_DEFINITIONS})
+ list(APPEND nvcc_flags "-D${def}")
+endforeach()
+
if(build_cubin AND NOT generated_cubin_file)
message(FATAL_ERROR "You must specify generated_cubin_file on the command line")
endif()
@@ -95,7 +110,7 @@ string(TOUPPER "${build_configuration}" build_configuration)
#message("CUDA_NVCC_HOST_COMPILER_FLAGS = ${CUDA_NVCC_HOST_COMPILER_FLAGS}")
foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}})
# Extra quotes are added around each flag to help nvcc parse out flags with spaces.
- set(nvcc_host_compiler_flags "${nvcc_host_compiler_flags},\"${flag}\"")
+ string(APPEND nvcc_host_compiler_flags ",\"${flag}\"")
endforeach()
if (nvcc_host_compiler_flags)
set(nvcc_host_compiler_flags "-Xcompiler" ${nvcc_host_compiler_flags})
diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake
new file mode 100644
index 0000000..5ce71a9
--- /dev/null
+++ b/Modules/FindCUDA/select_compute_arch.cmake
@@ -0,0 +1,195 @@
+# Synopsis:
+# CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable [target_CUDA_architectures])
+# -- Selects GPU arch flags for nvcc based on target_CUDA_architectures
+# target_CUDA_architectures : Auto | Common | All | LIST(ARCH_AND_PTX ...)
+# - "Auto" detects local machine GPU compute arch at runtime.
+# - "Common" and "All" cover common and entire subsets of architectures
+# ARCH_AND_PTX : NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX
+# NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal
+# NUM: Any number. Only those pairs are currently accepted by NVCC though:
+# 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2
+# Returns LIST of flags to be added to CUDA_NVCC_FLAGS in ${out_variable}
+# Additionally, sets ${out_variable}_readable to the resulting numeric list
+# Example:
+# CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell)
+# LIST(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})
+#
+# More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA
+#
+
+# This list will be used for CUDA_ARCH_NAME = All option
+set(CUDA_KNOWN_GPU_ARCHITECTURES "Fermi" "Kepler" "Maxwell")
+
+# This list will be used for CUDA_ARCH_NAME = Common option (enabled by default)
+set(CUDA_COMMON_GPU_ARCHITECTURES "3.0" "3.5" "5.0")
+
+if (CUDA_VERSION VERSION_GREATER "6.5")
+ list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Kepler+Tegra" "Kepler+Tesla" "Maxwell+Tegra")
+ list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "5.2")
+endif ()
+
+if (CUDA_VERSION VERSION_GREATER "7.5")
+ list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Pascal")
+ list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "6.0" "6.1" "6.1+PTX")
+else()
+ list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "5.2+PTX")
+endif ()
+
+
+
+################################################################################################
+# A function for automatic detection of GPUs installed (if autodetection is enabled)
+# Usage:
+# CUDA_DETECT_INSTALLED_GPUS(OUT_VARIABLE)
+#
+function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE)
+ if(NOT CUDA_GPU_DETECT_OUTPUT)
+ set(cufile ${PROJECT_BINARY_DIR}/detect_cuda_archs.cu)
+
+ file(WRITE ${cufile} ""
+ "#include <cstdio>\n"
+ "int main()\n"
+ "{\n"
+ " int count = 0;\n"
+ " if (cudaSuccess != cudaGetDeviceCount(&count)) return -1;\n"
+ " if (count == 0) return -1;\n"
+ " for (int device = 0; device < count; ++device)\n"
+ " {\n"
+ " cudaDeviceProp prop;\n"
+ " if (cudaSuccess == cudaGetDeviceProperties(&prop, device))\n"
+ " std::printf(\"%d.%d \", prop.major, prop.minor);\n"
+ " }\n"
+ " return 0;\n"
+ "}\n")
+
+ execute_process(COMMAND "${CUDA_NVCC_EXECUTABLE}" "--run" "${cufile}"
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/"
+ RESULT_VARIABLE nvcc_res OUTPUT_VARIABLE nvcc_out
+ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if(nvcc_res EQUAL 0)
+ string(REPLACE "2.1" "2.1(2.0)" nvcc_out "${nvcc_out}")
+ set(CUDA_GPU_DETECT_OUTPUT ${nvcc_out} CACHE INTERNAL "Returned GPU architetures from detect_gpus tool" FORCE)
+ endif()
+ endif()
+
+ if(NOT CUDA_GPU_DETECT_OUTPUT)
+ message(STATUS "Automatic GPU detection failed. Building for common architectures.")
+ set(${OUT_VARIABLE} ${CUDA_COMMON_GPU_ARCHITECTURES} PARENT_SCOPE)
+ else()
+ set(${OUT_VARIABLE} ${CUDA_GPU_DETECT_OUTPUT} PARENT_SCOPE)
+ endif()
+endfunction()
+
+
+################################################################################################
+# Function for selecting GPU arch flags for nvcc based on CUDA architectures from parameter list
+# Usage:
+# SELECT_NVCC_ARCH_FLAGS(out_variable [list of CUDA compute archs])
+function(CUDA_SELECT_NVCC_ARCH_FLAGS out_variable)
+ set(CUDA_ARCH_LIST "${ARGN}")
+
+ if("X${CUDA_ARCH_LIST}" STREQUAL "X" )
+ set(CUDA_ARCH_LIST "Auto")
+ endif()
+
+ set(cuda_arch_bin)
+ set(cuda_arch_ptx)
+
+ if("${CUDA_ARCH_LIST}" STREQUAL "All")
+ set(CUDA_ARCH_LIST ${CUDA_KNOWN_GPU_ARCHITECTURES})
+ elseif("${CUDA_ARCH_LIST}" STREQUAL "Common")
+ set(CUDA_ARCH_LIST ${CUDA_COMMON_GPU_ARCHITECTURES})
+ elseif("${CUDA_ARCH_LIST}" STREQUAL "Auto")
+ CUDA_DETECT_INSTALLED_GPUS(CUDA_ARCH_LIST)
+ message(STATUS "Autodetected CUDA architecture(s): ${CUDA_ARCH_LIST}")
+ endif()
+
+ # Now process the list and look for names
+ string(REGEX REPLACE "[ \t]+" ";" CUDA_ARCH_LIST "${CUDA_ARCH_LIST}")
+ list(REMOVE_DUPLICATES CUDA_ARCH_LIST)
+ foreach(arch_name ${CUDA_ARCH_LIST})
+ set(arch_bin)
+ set(add_ptx FALSE)
+ # Check to see if we are compiling PTX
+ if(arch_name MATCHES "(.*)\\+PTX$")
+ set(add_ptx TRUE)
+ set(arch_name ${CMAKE_MATCH_1})
+ endif()
+ if(arch_name MATCHES "^([0-9]\\.[0-9](\\([0-9]\\.[0-9]\\))?)$")
+ set(arch_bin ${CMAKE_MATCH_1})
+ set(arch_ptx ${arch_bin})
+ else()
+ # Look for it in our list of known architectures
+ if(${arch_name} STREQUAL "Fermi")
+ set(arch_bin 2.0 "2.1(2.0)")
+ elseif(${arch_name} STREQUAL "Kepler+Tegra")
+ set(arch_bin 3.2)
+ elseif(${arch_name} STREQUAL "Kepler+Tesla")
+ set(arch_bin 3.7)
+ elseif(${arch_name} STREQUAL "Kepler")
+ set(arch_bin 3.0 3.5)
+ set(arch_ptx 3.5)
+ elseif(${arch_name} STREQUAL "Maxwell+Tegra")
+ set(arch_bin 5.3)
+ elseif(${arch_name} STREQUAL "Maxwell")
+ set(arch_bin 5.0 5.2)
+ set(arch_ptx 5.2)
+ elseif(${arch_name} STREQUAL "Pascal")
+ set(arch_bin 6.0 6.1)
+ set(arch_ptx 6.1)
+ else()
+ message(SEND_ERROR "Unknown CUDA Architecture Name ${arch_name} in CUDA_SELECT_NVCC_ARCH_FLAGS")
+ endif()
+ endif()
+ if(NOT arch_bin)
+ message(SEND_ERROR "arch_bin wasn't set for some reason")
+ endif()
+ list(APPEND cuda_arch_bin ${arch_bin})
+ if(add_ptx)
+ if (NOT arch_ptx)
+ set(arch_ptx ${arch_bin})
+ endif()
+ list(APPEND cuda_arch_ptx ${arch_ptx})
+ endif()
+ endforeach()
+
+ # remove dots and convert to lists
+ string(REGEX REPLACE "\\." "" cuda_arch_bin "${cuda_arch_bin}")
+ string(REGEX REPLACE "\\." "" cuda_arch_ptx "${cuda_arch_ptx}")
+ string(REGEX MATCHALL "[0-9()]+" cuda_arch_bin "${cuda_arch_bin}")
+ string(REGEX MATCHALL "[0-9]+" cuda_arch_ptx "${cuda_arch_ptx}")
+
+ if(cuda_arch_bin)
+ list(REMOVE_DUPLICATES cuda_arch_bin)
+ endif()
+ if(cuda_arch_ptx)
+ list(REMOVE_DUPLICATES cuda_arch_ptx)
+ endif()
+
+ set(nvcc_flags "")
+ set(nvcc_archs_readable "")
+
+ # Tell NVCC to add binaries for the specified GPUs
+ foreach(arch ${cuda_arch_bin})
+ if(arch MATCHES "([0-9]+)\\(([0-9]+)\\)")
+ # User explicitly specified ARCH for the concrete CODE
+ list(APPEND nvcc_flags -gencode arch=compute_${CMAKE_MATCH_2},code=sm_${CMAKE_MATCH_1})
+ list(APPEND nvcc_archs_readable sm_${CMAKE_MATCH_1})
+ else()
+ # User didn't explicitly specify ARCH for the concrete CODE, we assume ARCH=CODE
+ list(APPEND nvcc_flags -gencode arch=compute_${arch},code=sm_${arch})
+ list(APPEND nvcc_archs_readable sm_${arch})
+ endif()
+ endforeach()
+
+ # Tell NVCC to add PTX intermediate code for the specified architectures
+ foreach(arch ${cuda_arch_ptx})
+ list(APPEND nvcc_flags -gencode arch=compute_${arch},code=compute_${arch})
+ list(APPEND nvcc_archs_readable compute_${arch})
+ endforeach()
+
+ string(REPLACE ";" " " nvcc_archs_readable "${nvcc_archs_readable}")
+ set(${out_variable} ${nvcc_flags} PARENT_SCOPE)
+ set(${out_variable}_readable ${nvcc_archs_readable} PARENT_SCOPE)
+endfunction()
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
index 51eb7c5..6f70455 100644
--- a/Modules/FindCups.cmake
+++ b/Modules/FindCups.cmake
@@ -55,7 +55,7 @@ if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
if(VLINE MATCHES "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}[\t ]+([0-9]+)$")
set(CUPS_VERSION_PART "${CMAKE_MATCH_1}")
if(CUPS_VERSION_STRING)
- set(CUPS_VERSION_STRING "${CUPS_VERSION_STRING}.${CUPS_VERSION_PART}")
+ string(APPEND CUPS_VERSION_STRING ".${CUPS_VERSION_PART}")
else()
set(CUPS_VERSION_STRING "${CUPS_VERSION_PART}")
endif()
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index 653094c..ea55a73 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -25,11 +25,15 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+find_package(PkgConfig QUIET)
+
+pkg_check_modules(PC_EXPAT QUIET expat)
+
# Look for the header file.
-find_path(EXPAT_INCLUDE_DIR NAMES expat.h)
+find_path(EXPAT_INCLUDE_DIR NAMES expat.h HINTS ${PC_EXPAT_INCLUDE_DIRS})
# Look for the library.
-find_library(EXPAT_LIBRARY NAMES expat libexpat)
+find_library(EXPAT_LIBRARY NAMES expat libexpat HINTS ${PC_EXPAT_LIBRARY_DIRS})
if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
file(STRINGS "${EXPAT_INCLUDE_DIR}/expat.h" expat_version_str
@@ -41,7 +45,7 @@ if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$")
set(EXPAT_VERSION_PART "${CMAKE_MATCH_1}")
if(EXPAT_VERSION_STRING)
- set(EXPAT_VERSION_STRING "${EXPAT_VERSION_STRING}.${EXPAT_VERSION_PART}")
+ string(APPEND EXPAT_VERSION_STRING ".${EXPAT_VERSION_PART}")
else()
set(EXPAT_VERSION_STRING "${EXPAT_VERSION_PART}")
endif()
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 7d46d15..35dc17d 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -51,9 +51,8 @@
# wants explicit full paths and this trickery doesn't work too well.
# I'm going to attempt to cut out the middleman and hope
# everything still works.
-find_path(
- FREETYPE_INCLUDE_DIR_ft2build
- ft2build.h
+
+set(FREETYPE_FIND_ARGS
HINTS
ENV FREETYPE_DIR
PATHS
@@ -64,6 +63,12 @@ find_path(
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
+)
+
+find_path(
+ FREETYPE_INCLUDE_DIR_ft2build
+ ft2build.h
+ ${FREETYPE_FIND_ARGS}
PATH_SUFFIXES
include/freetype2
include
@@ -75,40 +80,37 @@ find_path(
NAMES
freetype/config/ftheader.h
config/ftheader.h
- HINTS
- ENV FREETYPE_DIR
- PATHS
- /usr/X11R6
- /usr/local/X11R6
- /usr/local/X11
- /usr/freeware
- ENV GTKMM_BASEPATH
- [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
+ ${FREETYPE_FIND_ARGS}
PATH_SUFFIXES
include/freetype2
include
freetype2
)
-find_library(FREETYPE_LIBRARY
- NAMES
- freetype
- libfreetype
- freetype219
- HINTS
- ENV FREETYPE_DIR
- PATHS
- /usr/X11R6
- /usr/local/X11R6
- /usr/local/X11
- /usr/freeware
- ENV GTKMM_BASEPATH
- [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
- PATH_SUFFIXES
- lib
-)
+if(NOT FREETYPE_LIBRARY)
+ find_library(FREETYPE_LIBRARY_RELEASE
+ NAMES
+ freetype
+ libfreetype
+ freetype219
+ ${FREETYPE_FIND_ARGS}
+ PATH_SUFFIXES
+ lib
+ )
+ find_library(FREETYPE_LIBRARY_DEBUG
+ NAMES
+ freetyped
+ libfreetyped
+ freetype219d
+ ${FREETYPE_FIND_ARGS}
+ PATH_SUFFIXES
+ lib
+ )
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(FREETYPE)
+endif()
+
+unset(FREETYPE_FIND_ARGS)
# set the user variables
if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
@@ -133,7 +135,7 @@ if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$")
set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}")
if(FREETYPE_VERSION_STRING)
- set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
+ string(APPEND FREETYPE_VERSION_STRING ".${FREETYPE_VERSION_PART}")
else()
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
endif()
@@ -158,7 +160,6 @@ find_package_handle_standard_args(
)
mark_as_advanced(
- FREETYPE_LIBRARY
FREETYPE_INCLUDE_DIR_freetype2
FREETYPE_INCLUDE_DIR_ft2build
)
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index 7bbb8cf..6fbe9e9 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -2,12 +2,18 @@
# FindGIF
# -------
#
+# This finds the GIF library (giflib)
#
+# The module defines the following variables:
#
-# This module searches giflib and defines GIF_LIBRARIES - libraries to
-# link to in order to use GIF GIF_FOUND, if false, do not try to link
-# GIF_INCLUDE_DIR, where to find the headers GIF_VERSION, reports either
-# version 4 or 3 (for everything before version 4)
+# ``GIF_FOUND``
+# True if giflib was found
+# ``GIF_LIBRARIES``
+# Libraries to link to in order to use giflib
+# ``GIF_INCLUDE_DIR``
+# where to find the headers
+# ``GIF_VERSION``
+# 3, 4 or a full version string (eg 5.1.4) for versions >= 4.1.6
#
# The minimum required version of giflib can be specified using the
# standard syntax, e.g. find_package(GIF 4)
@@ -29,7 +35,7 @@
# License text for the above reference.)
# Created by Eric Wing.
-# Modifications by Alexander Neundorf
+# Modifications by Alexander Neundorf, Ben Campbell
find_path(GIF_INCLUDE_DIR gif_lib.h
HINTS
@@ -61,22 +67,40 @@ set(GIF_LIBRARIES ${GIF_LIBRARY})
# to be always " Version 2.0, " in versions 3.x of giflib.
# In version 4 the member UserData was added to GifFileType, so we check for this
# one.
-# http://giflib.sourcearchive.com/documentation/4.1.4/files.html
+# Versions after 4.1.6 define GIFLIB_MAJOR, GIFLIB_MINOR, and GIFLIB_RELEASE
+# see http://giflib.sourceforge.net/gif_lib.html#compatibility
if(GIF_INCLUDE_DIR)
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake)
CMAKE_PUSH_CHECK_STATE()
set(CMAKE_REQUIRED_QUIET ${GIF_FIND_QUIETLY})
- set(GIF_VERSION 3)
set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}")
- CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData )
- if(GIF_GifFileType_UserData)
- set(GIF_VERSION 4)
+
+ # Check for the specific version defines (>=4.1.6 only)
+ file(STRINGS ${GIF_INCLUDE_DIR}/gif_lib.h _GIF_DEFS REGEX "^[ \t]*#define[ \t]+GIFLIB_(MAJOR|MINOR|RELEASE)")
+ if(_GIF_DEFS)
+ # yay - got exact version info
+ string(REGEX REPLACE ".*GIFLIB_MAJOR ([0-9]+).*" "\\1" _GIF_MAJ "${_GIF_DEFS}")
+ string(REGEX REPLACE ".*GIFLIB_MINOR ([0-9]+).*" "\\1" _GIF_MIN "${_GIF_DEFS}")
+ string(REGEX REPLACE ".*GIFLIB_RELEASE ([0-9]+).*" "\\1" _GIF_REL "${_GIF_DEFS}")
+ set(GIF_VERSION "${_GIF_MAJ}.${_GIF_MIN}.${_GIF_REL}")
+ else()
+ # use UserData field to sniff version instead
+ CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData )
+ if(GIF_GifFileType_UserData)
+ set(GIF_VERSION 4)
+ else()
+ set(GIF_VERSION 3)
+ endif()
endif()
+
+ unset(_GIF_MAJ)
+ unset(_GIF_MIN)
+ unset(_GIF_REL)
+ unset(_GIF_DEFS)
CMAKE_POP_CHECK_STATE()
endif()
-
# handle the QUIETLY and REQUIRED arguments and set GIF_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index f42182f..7413289 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -35,20 +35,45 @@
# License text for the above reference.)
find_path(GLEW_INCLUDE_DIR GL/glew.h)
-find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64)
-set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
-set(GLEW_LIBRARIES ${GLEW_LIBRARY})
+if(NOT GLEW_LIBRARY)
+ find_library(GLEW_LIBRARY_RELEASE NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64)
+ find_library(GLEW_LIBRARY_DEBUG NAMES GLEWd glew32d glewd PATH_SUFFIXES lib64)
+
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(GLEW)
+endif ()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(GLEW
REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY)
-if(GLEW_FOUND AND NOT TARGET GLEW::GLEW)
- add_library(GLEW::GLEW UNKNOWN IMPORTED)
- set_target_properties(GLEW::GLEW PROPERTIES
- IMPORTED_LOCATION "${GLEW_LIBRARY}"
- INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
+if(GLEW_FOUND)
+ set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
+
+ if(NOT GLEW_LIBRARIES)
+ set(GLEW_LIBRARIES ${GLEW_LIBRARY})
+ endif()
+
+ if (NOT TARGET GLEW::GLEW)
+ add_library(GLEW::GLEW UNKNOWN IMPORTED)
+ set_target_properties(GLEW::GLEW PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
+
+ if(GLEW_LIBRARY_RELEASE)
+ set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(GLEW::GLEW PROPERTIES IMPORTED_LOCATION_RELEASE "${GLEW_LIBRARY_RELEASE}")
+ endif()
+
+ if(GLEW_LIBRARY_DEBUG)
+ set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(GLEW::GLEW PROPERTIES IMPORTED_LOCATION_DEBUG "${GLEW_LIBRARY_DEBUG}")
+ endif()
+
+ if(NOT GLEW_LIBRARY_RELEASE AND NOT GLEW_LIBRARY_DEBUG)
+ set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_LOCATION "${GLEW_LIBRARY}")
+ endif()
+ endif()
endif()
-mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)
+mark_as_advanced(GLEW_INCLUDE_DIR)
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index a7ffcfe..72032c7 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -226,13 +226,6 @@ if(GTEST_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GTEST_LIBRARY}")
endif()
- if(EXISTS "${GTEST_LIBRARY_DEBUG}")
- set_property(TARGET GTest::GTest APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(GTest::GTest PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
- IMPORTED_LOCATION_DEBUG "${GTEST_LIBRARY_DEBUG}")
- endif()
if(EXISTS "${GTEST_LIBRARY_RELEASE}")
set_property(TARGET GTest::GTest APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
@@ -240,6 +233,13 @@ if(GTEST_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${GTEST_LIBRARY_RELEASE}")
endif()
+ if(EXISTS "${GTEST_LIBRARY_DEBUG}")
+ set_property(TARGET GTest::GTest APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(GTest::GTest PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${GTEST_LIBRARY_DEBUG}")
+ endif()
endif()
if(NOT TARGET GTest::Main)
add_library(GTest::Main UNKNOWN IMPORTED)
@@ -250,13 +250,6 @@ if(GTEST_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GTEST_MAIN_LIBRARY}")
endif()
- if(EXISTS "${GTEST_MAIN_LIBRARY_DEBUG}")
- set_property(TARGET GTest::Main APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(GTest::Main PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
- IMPORTED_LOCATION_DEBUG "${GTEST_MAIN_LIBRARY_DEBUG}")
- endif()
if(EXISTS "${GTEST_MAIN_LIBRARY_RELEASE}")
set_property(TARGET GTest::Main APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
@@ -264,5 +257,12 @@ if(GTEST_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${GTEST_MAIN_LIBRARY_RELEASE}")
endif()
+ if(EXISTS "${GTEST_MAIN_LIBRARY_DEBUG}")
+ set_property(TARGET GTest::Main APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(GTest::Main PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${GTEST_MAIN_LIBRARY_DEBUG}")
+ endif()
endif()
endif()
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index ab046e3..2f4ed82 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -691,7 +691,7 @@ if( NOT HDF5_FOUND )
if(UNIX AND HDF5_USE_STATIC_LIBRARIES)
# According to bug 1643 on the CMake bug tracker, this is the
# preferred method for searching for a static library.
- # See https://cmake.org/Bug/view.php?id=1643. We search
+ # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search
# first for the full static library name, but fall back to a
# generic search on the name if the static search fails.
set( THIS_LIBRARY_SEARCH_DEBUG
@@ -728,7 +728,7 @@ if( NOT HDF5_FOUND )
if(UNIX AND HDF5_USE_STATIC_LIBRARIES)
# According to bug 1643 on the CMake bug tracker, this is the
# preferred method for searching for a static library.
- # See https://cmake.org/Bug/view.php?id=1643. We search
+ # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search
# first for the full static library name, but fall back to a
# generic search on the name if the static search fails.
set( THIS_LIBRARY_SEARCH_DEBUG
diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake
new file mode 100644
index 0000000..ade39b8
--- /dev/null
+++ b/Modules/FindICU.cmake
@@ -0,0 +1,359 @@
+#.rst:
+# FindICU
+# -------
+#
+# Find the International Components for Unicode (ICU) libraries and
+# programs.
+#
+# This module supports multiple components.
+# Components can include any of: ``data``, ``i18n``, ``io``, ``le``,
+# ``lx``, ``test``, ``tu`` and ``uc``.
+#
+# Note that on Windows ``data`` is named ``dt`` and ``i18n`` is named
+# ``in``; any of the names may be used, and the appropriate
+# platform-specific library name will be automatically selected.
+#
+# This module reports information about the ICU installation in
+# several variables. General variables::
+#
+# ICU_VERSION - ICU release version
+# ICU_FOUND - true if the main programs and libraries were found
+# ICU_LIBRARIES - component libraries to be linked
+# ICU_INCLUDE_DIRS - the directories containing the ICU headers
+#
+# Imported targets::
+#
+# ICU::<C>
+#
+# Where ``<C>`` is the name of an ICU component, for example
+# ``ICU::i18n``.
+#
+# ICU programs are reported in::
+#
+# ICU_GENCNVAL_EXECUTABLE - path to gencnval executable
+# ICU_ICUINFO_EXECUTABLE - path to icuinfo executable
+# ICU_GENBRK_EXECUTABLE - path to genbrk executable
+# ICU_ICU-CONFIG_EXECUTABLE - path to icu-config executable
+# ICU_GENRB_EXECUTABLE - path to genrb executable
+# ICU_GENDICT_EXECUTABLE - path to gendict executable
+# ICU_DERB_EXECUTABLE - path to derb executable
+# ICU_PKGDATA_EXECUTABLE - path to pkgdata executable
+# ICU_UCONV_EXECUTABLE - path to uconv executable
+# ICU_GENCFU_EXECUTABLE - path to gencfu executable
+# ICU_MAKECONV_EXECUTABLE - path to makeconv executable
+# ICU_GENNORM2_EXECUTABLE - path to gennorm2 executable
+# ICU_GENCCODE_EXECUTABLE - path to genccode executable
+# ICU_GENSPREP_EXECUTABLE - path to gensprep executable
+# ICU_ICUPKG_EXECUTABLE - path to icupkg executable
+# ICU_GENCMN_EXECUTABLE - path to gencmn executable
+#
+# ICU component libraries are reported in::
+#
+# ICU_<C>_FOUND - ON if component was found
+# ICU_<C>_LIBRARIES - libraries for component
+#
+# Note that ``<C>`` is the uppercased name of the component.
+#
+# This module reads hints about search results from::
+#
+# ICU_ROOT - the root of the ICU installation
+#
+# The environment variable ``ICU_ROOT`` may also be used; the
+# ICU_ROOT variable takes precedence.
+#
+# The following cache variables may also be set::
+#
+# ICU_<P>_EXECUTABLE - the path to executable <P>
+# ICU_INCLUDE_DIR - the directory containing the ICU headers
+# ICU_<C>_LIBRARY - the library for component <C>
+#
+# .. note::
+#
+# In most cases none of the above variables will require setting,
+# unless multiple ICU versions are available and a specific version
+# is required.
+#
+# Other variables one may set to control this module are::
+#
+# ICU_DEBUG - Set to ON to enable debug output from FindICU.
+
+# Written by Roger Leigh <rleigh@codelibre.net>
+
+#=============================================================================
+# Copyright 2014-2016 University of Dundee
+#
+# 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.)
+
+set(icu_programs
+ gencnval
+ icuinfo
+ genbrk
+ icu-config
+ genrb
+ gendict
+ derb
+ pkgdata
+ uconv
+ gencfu
+ makeconv
+ gennorm2
+ genccode
+ gensprep
+ icupkg
+ gencmn)
+
+# The ICU checks are contained in a function due to the large number
+# of temporary variables needed.
+function(_ICU_FIND)
+ # Set up search paths, taking compiler into account. Search ICU_ROOT,
+ # with ICU_ROOT in the environment as a fallback if unset.
+ if(ICU_ROOT)
+ list(APPEND icu_roots "${ICU_ROOT}")
+ else()
+ if(NOT "$ENV{ICU_ROOT}" STREQUAL "")
+ file(TO_CMAKE_PATH "$ENV{ICU_ROOT}" NATIVE_PATH)
+ list(APPEND icu_roots "${NATIVE_PATH}")
+ set(ICU_ROOT "${NATIVE_PATH}"
+ CACHE PATH "Location of the ICU installation" FORCE)
+ endif()
+ endif()
+
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ # 64-bit binary directory
+ set(_bin64 "bin64")
+ # 64-bit library directory
+ set(_lib64 "lib64")
+ endif()
+
+ # Generic 64-bit and 32-bit directories
+ list(APPEND icu_binary_suffixes "${_bin64}" "bin")
+ list(APPEND icu_library_suffixes "${_lib64}" "lib")
+
+ # Find all ICU programs
+ foreach(program ${icu_programs})
+ string(TOUPPER "${program}" program_upcase)
+ set(cache_var "ICU_${program_upcase}_EXECUTABLE")
+ set(program_var "ICU_${program_upcase}_EXECUTABLE")
+ find_program("${cache_var}" "${program}"
+ HINTS ${icu_roots}
+ PATH_SUFFIXES ${icu_binary_suffixes}
+ DOC "ICU ${program} executable")
+ mark_as_advanced(cache_var)
+ set("${program_var}" "${${cache_var}}" PARENT_SCOPE)
+ endforeach()
+
+ # Find include directory
+ find_path(ICU_INCLUDE_DIR
+ NAMES "unicode/utypes.h"
+ HINTS ${icu_roots}
+ PATH_SUFFIXES ${icu_include_suffixes}
+ DOC "ICU include directory")
+ set(ICU_INCLUDE_DIR "${ICU_INCLUDE_DIR}" PARENT_SCOPE)
+
+ # Get version
+ if(ICU_INCLUDE_DIR AND EXISTS "${ICU_INCLUDE_DIR}/unicode/uvernum.h")
+ file(STRINGS "${ICU_INCLUDE_DIR}/unicode/uvernum.h" icu_header_str
+ REGEX "^#define[\t ]+U_ICU_VERSION[\t ]+\".*\".*")
+
+ string(REGEX REPLACE "^#define[\t ]+U_ICU_VERSION[\t ]+\"([^ \\n]*)\".*"
+ "\\1" icu_version_string "${icu_header_str}")
+ set(ICU_VERSION "${icu_version_string}" PARENT_SCOPE)
+ unset(icu_header_str)
+ unset(icu_version_string)
+ endif()
+
+ # Find all ICU libraries
+ set(ICU_REQUIRED_LIBS_FOUND ON)
+ foreach(component ${ICU_FIND_COMPONENTS})
+ string(TOUPPER "${component}" component_upcase)
+ set(component_cache "ICU_${component_upcase}_LIBRARY")
+ set(component_cache_release "${component_cache}_RELEASE")
+ set(component_cache_debug "${component_cache}_DEBUG")
+ set(component_found "${component_upcase}_FOUND")
+ set(component_libnames "icu${component}")
+ set(component_debug_libnames "icu${component}d")
+
+ # Special case deliberate library naming mismatches between Unix
+ # and Windows builds
+ unset(component_libnames)
+ unset(component_debug_libnames)
+ list(APPEND component_libnames "icu${component}")
+ list(APPEND component_debug_libnames "icu${component}d")
+ if(component STREQUAL "data")
+ list(APPEND component_libnames "icudt")
+ # Note there is no debug variant at present
+ list(APPEND component_debug_libnames "icudtd")
+ endif()
+ if(component STREQUAL "dt")
+ list(APPEND component_libnames "icudata")
+ # Note there is no debug variant at present
+ list(APPEND component_debug_libnames "icudatad")
+ endif()
+ if(component STREQUAL "i18n")
+ list(APPEND component_libnames "icuin")
+ list(APPEND component_debug_libnames "icuind")
+ endif()
+ if(component STREQUAL "in")
+ list(APPEND component_libnames "icui18n")
+ list(APPEND component_debug_libnames "icui18nd")
+ endif()
+
+ find_library("${component_cache_release}" ${component_libnames}
+ HINTS ${icu_roots}
+ PATH_SUFFIXES ${icu_library_suffixes}
+ DOC "ICU ${component} library (release)")
+ find_library("${component_cache_debug}" ${component_debug_libnames}
+ HINTS ${icu_roots}
+ PATH_SUFFIXES ${icu_library_suffixes}
+ DOC "ICU ${component} library (debug)")
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(ICU_${component_upcase})
+ mark_as_advanced("${component_cache_release}" "${component_cache_debug}")
+ if(${component_cache})
+ set("${component_found}" ON)
+ list(APPEND ICU_LIBRARY "${${component_cache}}")
+ endif()
+ mark_as_advanced("${component_found}")
+ set("${component_cache}" "${${component_cache}}" PARENT_SCOPE)
+ set("${component_found}" "${${component_found}}" PARENT_SCOPE)
+ if(${component_found})
+ if (ICU_FIND_REQUIRED_${component})
+ list(APPEND ICU_LIBS_FOUND "${component} (required)")
+ else()
+ list(APPEND ICU_LIBS_FOUND "${component} (optional)")
+ endif()
+ else()
+ if (ICU_FIND_REQUIRED_${component})
+ set(ICU_REQUIRED_LIBS_FOUND OFF)
+ list(APPEND ICU_LIBS_NOTFOUND "${component} (required)")
+ else()
+ list(APPEND ICU_LIBS_NOTFOUND "${component} (optional)")
+ endif()
+ endif()
+ endforeach()
+ set(_ICU_REQUIRED_LIBS_FOUND "${ICU_REQUIRED_LIBS_FOUND}" PARENT_SCOPE)
+ set(ICU_LIBRARY "${ICU_LIBRARY}" PARENT_SCOPE)
+
+ if(NOT ICU_FIND_QUIETLY)
+ if(ICU_LIBS_FOUND)
+ message(STATUS "Found the following ICU libraries:")
+ foreach(found ${ICU_LIBS_FOUND})
+ message(STATUS " ${found}")
+ endforeach()
+ endif()
+ if(ICU_LIBS_NOTFOUND)
+ message(STATUS "The following ICU libraries were not found:")
+ foreach(notfound ${ICU_LIBS_NOTFOUND})
+ message(STATUS " ${notfound}")
+ endforeach()
+ endif()
+ endif()
+
+ if(ICU_DEBUG)
+ message(STATUS "--------FindICU.cmake search debug--------")
+ message(STATUS "ICU binary path search order: ${icu_roots}")
+ message(STATUS "ICU include path search order: ${icu_roots}")
+ message(STATUS "ICU library path search order: ${icu_roots}")
+ message(STATUS "----------------")
+ endif()
+endfunction()
+
+_ICU_FIND()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ICU
+ FOUND_VAR ICU_FOUND
+ REQUIRED_VARS ICU_INCLUDE_DIR
+ ICU_LIBRARY
+ _ICU_REQUIRED_LIBS_FOUND
+ VERSION_VAR ICU_VERSION
+ FAIL_MESSAGE "Failed to find all ICU components")
+
+unset(_ICU_REQUIRED_LIBS_FOUND)
+
+if(ICU_FOUND)
+ set(ICU_INCLUDE_DIRS "${ICU_INCLUDE_DIR}")
+ set(ICU_LIBRARIES "${ICU_LIBRARY}")
+ foreach(_ICU_component ${ICU_FIND_COMPONENTS})
+ string(TOUPPER "${_ICU_component}" _ICU_component_upcase)
+ set(_ICU_component_cache "ICU_${_ICU_component_upcase}_LIBRARY")
+ set(_ICU_component_cache_release "ICU_${_ICU_component_upcase}_LIBRARY_RELEASE")
+ set(_ICU_component_cache_debug "ICU_${_ICU_component_upcase}_LIBRARY_DEBUG")
+ set(_ICU_component_lib "ICU_${_ICU_component_upcase}_LIBRARIES")
+ set(_ICU_component_found "${_ICU_component_upcase}_FOUND")
+ set(_ICU_imported_target "ICU::${_ICU_component}")
+ if(${_ICU_component_found})
+ set("${_ICU_component_lib}" "${${_ICU_component_cache}}")
+ if(NOT TARGET ${_ICU_imported_target})
+ add_library(${_ICU_imported_target} UNKNOWN IMPORTED)
+ if(ICU_INCLUDE_DIR)
+ set_target_properties(${_ICU_imported_target} PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${ICU_INCLUDE_DIR}")
+ endif()
+ if(EXISTS "${${_ICU_component_cache}}")
+ set_target_properties(${_ICU_imported_target} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ IMPORTED_LOCATION "${${_ICU_component_cache}}")
+ endif()
+ if(EXISTS "${${_ICU_component_cache_release}}")
+ set_property(TARGET ${_ICU_imported_target} APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(${_ICU_imported_target} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
+ IMPORTED_LOCATION_RELEASE "${${_ICU_component_cache_release}}")
+ endif()
+ if(EXISTS "${${_ICU_component_cache_debug}}")
+ set_property(TARGET ${_ICU_imported_target} APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(${_ICU_imported_target} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${${_ICU_component_cache_debug}}")
+ endif()
+ endif()
+ endif()
+ unset(_ICU_component_upcase)
+ unset(_ICU_component_cache)
+ unset(_ICU_component_lib)
+ unset(_ICU_component_found)
+ unset(_ICU_imported_target)
+ endforeach()
+endif()
+
+if(ICU_DEBUG)
+ message(STATUS "--------FindICU.cmake results debug--------")
+ message(STATUS "ICU found: ${ICU_FOUND}")
+ message(STATUS "ICU_VERSION number: ${ICU_VERSION}")
+ message(STATUS "ICU_ROOT directory: ${ICU_ROOT}")
+ message(STATUS "ICU_INCLUDE_DIR directory: ${ICU_INCLUDE_DIR}")
+ message(STATUS "ICU_LIBRARIES: ${ICU_LIBRARIES}")
+
+ foreach(program IN LISTS icu_programs)
+ string(TOUPPER "${program}" program_upcase)
+ set(program_lib "ICU_${program_upcase}_EXECUTABLE")
+ message(STATUS "${program} program: ${${program_lib}}")
+ unset(program_upcase)
+ unset(program_lib)
+ endforeach()
+
+ foreach(component IN LISTS ICU_FIND_COMPONENTS)
+ string(TOUPPER "${component}" component_upcase)
+ set(component_lib "ICU_${component_upcase}_LIBRARIES")
+ set(component_found "${component_upcase}_FOUND")
+ message(STATUS "${component} library found: ${${component_found}}")
+ message(STATUS "${component} library: ${${component_lib}}")
+ unset(component_upcase)
+ unset(component_lib)
+ unset(component_found)
+ endforeach()
+ message(STATUS "----------------")
+endif()
+
+unset(icu_programs)
diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake
index 3fa6cab..2bd39e8 100644
--- a/Modules/FindIce.cmake
+++ b/Modules/FindIce.cmake
@@ -141,6 +141,8 @@ function(_Ice_FIND)
set(ice_versions
3
3.6
+ 3.6.2
+ 3.6.1
3.6.0
3.5
3.5.1
@@ -360,12 +362,20 @@ function(_Ice_FIND)
foreach(component ${Ice_FIND_COMPONENTS})
string(TOUPPER "${component}" component_upcase)
set(component_cache "Ice_${component_upcase}_LIBRARY")
+ set(component_cache_release "${component_cache}_RELEASE")
+ set(component_cache_debug "${component_cache}_DEBUG")
set(component_found "${component_upcase}_FOUND")
- find_library("${component_cache}" "${component}"
+ find_library("${component_cache_release}" "${component}"
HINTS ${ice_roots}
PATH_SUFFIXES ${ice_library_suffixes}
- DOC "Ice ${component} library")
- mark_as_advanced("${component_cache}")
+ DOC "Ice ${component} library (release)")
+ find_library("${component_cache_debug}" "${component}d"
+ HINTS ${ice_roots}
+ PATH_SUFFIXES ${ice_library_suffixes}
+ DOC "Ice ${component} library (debug)")
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(Ice_${component_upcase})
+ mark_as_advanced("${component_cache_release}" "${component_cache_debug}")
if(${component_cache})
set("${component_found}" ON)
list(APPEND Ice_LIBRARY "${${component_cache}}")
@@ -438,6 +448,8 @@ if(Ice_FOUND)
foreach(_Ice_component ${Ice_FIND_COMPONENTS})
string(TOUPPER "${_Ice_component}" _Ice_component_upcase)
set(_Ice_component_cache "Ice_${_Ice_component_upcase}_LIBRARY")
+ set(_Ice_component_cache_release "Ice_${_Ice_component_upcase}_LIBRARY_RELEASE")
+ set(_Ice_component_cache_debug "Ice_${_Ice_component_upcase}_LIBRARY_DEBUG")
set(_Ice_component_lib "Ice_${_Ice_component_upcase}_LIBRARIES")
set(_Ice_component_found "${_Ice_component_upcase}_FOUND")
set(_Ice_imported_target "Ice::${_Ice_component}")
@@ -445,9 +457,29 @@ if(Ice_FOUND)
set("${_Ice_component_lib}" "${${_Ice_component_cache}}")
if(NOT TARGET ${_Ice_imported_target})
add_library(${_Ice_imported_target} UNKNOWN IMPORTED)
- set_target_properties(${_Ice_imported_target} PROPERTIES
- IMPORTED_LOCATION "${${_Ice_component_cache}}"
- INTERFACE_INCLUDE_DIRECTORIES "${Ice_INCLUDE_DIR}")
+ if()
+ set_target_properties(${_Ice_imported_target} PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Ice_INCLUDE_DIR}")
+ endif()
+ if(EXISTS "${${_Ice_component_cache}}")
+ set_target_properties(${_Ice_imported_target} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ IMPORTED_LOCATION "${${_Ice_component_cache}}")
+ endif()
+ if(EXISTS "${${_Ice_component_cache_release}}")
+ set_property(TARGET ${_Ice_imported_target} APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(${_Ice_imported_target} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
+ IMPORTED_LOCATION_RELEASE "${${_Ice_component_cache_release}}")
+ endif()
+ if(EXISTS "${${_Ice_component_cache_debug}}")
+ set_property(TARGET ${_Ice_imported_target} APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(${_Ice_imported_target} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${${_Ice_component_cache_debug}}")
+ endif()
endif()
endif()
unset(_Ice_component_upcase)
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 3ceab39..658d6ca 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -312,8 +312,11 @@ else()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
- JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY
+ JAVA_JVM_LIBRARY
+ JAVA_INCLUDE_PATH
+ JAVA_INCLUDE_PATH2
+ JAVA_AWT_INCLUDE_PATH)
mark_as_advanced(
JAVA_AWT_LIBRARY
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index c643d9b..424ae30 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -8,6 +8,7 @@
# include files and libraries are. The caller may set variable JAVA_HOME
# to specify a Java installation prefix explicitly.
#
+# See also the :module:`FindJNI` module to find Java development tools.
#
# Specify one or more of the following components as you call this find module. See example below.
#
@@ -54,8 +55,6 @@
# ::
#
# Java_FOUND - TRUE if all components are found.
-# Java_INCLUDE_DIRS - Full paths to all include dirs.
-# Java_LIBRARIES - Full paths to all libraries.
# Java_<component>_FOUND - TRUE if <component> is found.
#
#
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
index 4e00a92..f105f3d 100644
--- a/Modules/FindLua.cmake
+++ b/Modules/FindLua.cmake
@@ -49,34 +49,37 @@
unset(_lua_include_subdirs)
unset(_lua_library_names)
+unset(_lua_append_versions)
# this is a function only to have all the variables inside go away automatically
-function(set_lua_version_vars)
+function(_lua_set_version_vars)
set(LUA_VERSIONS5 5.3 5.2 5.1 5.0)
if (Lua_FIND_VERSION_EXACT)
if (Lua_FIND_VERSION_COUNT GREATER 1)
- set(lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR})
+ set(_lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR})
endif ()
elseif (Lua_FIND_VERSION)
# once there is a different major version supported this should become a loop
if (NOT Lua_FIND_VERSION_MAJOR GREATER 5)
if (Lua_FIND_VERSION_COUNT EQUAL 1)
- set(lua_append_versions ${LUA_VERSIONS5})
+ set(_lua_append_versions ${LUA_VERSIONS5})
else ()
foreach (subver IN LISTS LUA_VERSIONS5)
if (NOT subver VERSION_LESS ${Lua_FIND_VERSION})
- list(APPEND lua_append_versions ${subver})
+ list(APPEND _lua_append_versions ${subver})
endif ()
endforeach ()
endif ()
endif ()
else ()
# once there is a different major version supported this should become a loop
- set(lua_append_versions ${LUA_VERSIONS5})
+ set(_lua_append_versions ${LUA_VERSIONS5})
endif ()
- foreach (ver IN LISTS lua_append_versions)
+ list(APPEND _lua_include_subdirs "include/lua" "include")
+
+ foreach (ver IN LISTS _lua_append_versions)
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}")
list(APPEND _lua_include_subdirs
include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
@@ -93,23 +96,72 @@ function(set_lua_version_vars)
set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE)
-endfunction(set_lua_version_vars)
+ set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE)
+endfunction(_lua_set_version_vars)
-set_lua_version_vars()
+function(_lua_check_header_version _hdr_file)
+ # At least 5.[012] have different ways to express the version
+ # so all of them need to be tested. Lua 5.2 defines LUA_VERSION
+ # and LUA_RELEASE as joined by the C preprocessor, so avoid those.
+ file(STRINGS "${_hdr_file}" lua_version_strings
+ REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*")
-find_path(LUA_INCLUDE_DIR lua.h
- HINTS
- ENV LUA_DIR
- PATH_SUFFIXES ${_lua_include_subdirs} include/lua include
- PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
-)
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};")
+ if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};")
+ set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
+ else ()
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+ if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+ endif ()
+ string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}")
+ string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}")
+ string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}")
+ endif ()
+ foreach (ver IN LISTS _lua_append_versions)
+ if (ver STREQUAL "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}")
+ set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE)
+ set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE)
+ set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE)
+ set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE)
+ return()
+ endif ()
+ endforeach ()
+endfunction(_lua_check_header_version)
+
+_lua_set_version_vars()
+
+if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
+ _lua_check_header_version("${LUA_INCLUDE_DIR}/lua.h")
+endif ()
+
+if (NOT LUA_VERSION_STRING)
+ foreach (subdir IN LISTS _lua_include_subdirs)
+ unset(LUA_INCLUDE_PREFIX CACHE)
+ find_path(LUA_INCLUDE_PREFIX ${subdir}/lua.h
+ HINTS
+ ENV LUA_DIR
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+ )
+ if (LUA_INCLUDE_PREFIX)
+ _lua_check_header_version("${LUA_INCLUDE_PREFIX}/${subdir}/lua.h")
+ if (LUA_VERSION_STRING)
+ set(LUA_INCLUDE_DIR "${LUA_INCLUDE_PREFIX}/${subdir}")
+ break()
+ endif ()
+ endif ()
+ endforeach ()
+endif ()
unset(_lua_include_subdirs)
+unset(_lua_append_versions)
find_library(LUA_LIBRARY
NAMES ${_lua_library_names} lua
@@ -137,31 +189,6 @@ if (LUA_LIBRARY)
endif ()
endif ()
-if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
- # At least 5.[012] have different ways to express the version
- # so all of them need to be tested. Lua 5.2 defines LUA_VERSION
- # and LUA_RELEASE as joined by the C preprocessor, so avoid those.
- file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_strings
- REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*")
-
- string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};")
- if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$")
- string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};")
- string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};")
- set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
- else ()
- string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
- if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$")
- string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
- endif ()
- string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}")
- string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}")
- string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}")
- endif ()
-
- unset(lua_version_strings)
-endif()
-
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index fbc6795..4f78623 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -327,7 +327,7 @@ function (interrogate_mpi_compiler lang try_libs)
foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
if (MPI_COMPILE_FLAGS_WORK)
- set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}")
+ string(APPEND MPI_COMPILE_FLAGS_WORK " ${FLAG}")
else()
set(MPI_COMPILE_FLAGS_WORK ${FLAG})
endif()
@@ -376,7 +376,7 @@ function (interrogate_mpi_compiler lang try_libs)
set(MPI_LINK_FLAGS_WORK)
foreach(FLAG ${MPI_ALL_LINK_FLAGS})
if (MPI_LINK_FLAGS_WORK)
- set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}")
+ string(APPEND MPI_LINK_FLAGS_WORK " ${FLAG}")
else()
set(MPI_LINK_FLAGS_WORK ${FLAG})
endif()
@@ -398,8 +398,8 @@ function (interrogate_mpi_compiler lang try_libs)
# in the showme list that can only be found in the implicit
# link directories of the compiler.
if (DEFINED CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES)
- set(MPI_LINK_PATH
- "${MPI_LINK_PATH};${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}")
+ string(APPEND MPI_LINK_PATH
+ ";${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}")
endif ()
# Determine full path names for all of the libraries that one needs
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 956dad2..c813f8f 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -15,8 +15,8 @@
#
# The module supports the following components:
#
-# * ``MX_LIBRARY`` and ``ENG_LIBRARY`` respectively the MX and ENG libraries of
-# Matlab
+# * ``MX_LIBRARY``, ``ENG_LIBRARY`` and ``MAT_LIBRARY``: respectively the MX,
+# ENG and MAT libraries of Matlab
# * ``MAIN_PROGRAM`` the Matlab binary program.
#
# .. note::
@@ -93,6 +93,9 @@
# ``Matlab_ENG_LIBRARY``
# Matlab engine library. Available only if the component ``ENG_LIBRARY``
# is requested.
+# ``Matlab_MAT_LIBRARY``
+# Matlab matrix library. Available only if the component ``MAT_LIBRARY``
+# is requested.
# ``Matlab_LIBRARIES``
# the whole set of libraries of Matlab
# ``Matlab_MEX_COMPILER``
@@ -632,7 +635,7 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve
set(devnull INPUT_FILE NUL)
endif()
- # timeout set to 30 seconds, in case it does not start
+ # timeout set to 120 seconds, in case it does not start
# note as said before OUTPUT_VARIABLE cannot be used in a platform
# independent manner however, not setting it would flush the output of Matlab
# in the current console (unix variant)
@@ -641,11 +644,18 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve
OUTPUT_VARIABLE _matlab_version_from_cmd_dummy
RESULT_VARIABLE _matlab_result_version_call
ERROR_VARIABLE _matlab_result_version_call_error
- TIMEOUT 30
+ TIMEOUT 120
WORKING_DIRECTORY "${_matlab_temporary_folder}"
${devnull}
)
+ if("${_matlab_result_version_call}" MATCHES "timeout")
+ if(MATLAB_FIND_DEBUG)
+ message(WARNING "[MATLAB] Unable to determine the version of Matlab."
+ " Matlab call timed out after 120 seconds.")
+ endif()
+ return()
+ endif()
if(${_matlab_result_version_call})
if(MATLAB_FIND_DEBUG)
@@ -695,7 +705,6 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve
endfunction()
-
#.rst:
# .. command:: matlab_add_unit_test
#
@@ -717,6 +726,7 @@ endfunction()
# matlab_add_unit_test(
# NAME <name>
# UNITTEST_FILE matlab_file_containing_unittest.m
+# [CUSTOM_MATLAB_COMMAND matlab_command_to_run_as_test]
# [UNITTEST_PRECOMMAND matlab_command_to_run]
# [TIMEOUT timeout]
# [ADDITIONAL_PATH path1 [path2 ...]]
@@ -732,6 +742,11 @@ endfunction()
# ``UNITTEST_FILE``
# the matlab unittest file. Its path will be automatically
# added to the Matlab path.
+# ``CUSTOM_MATLAB_COMMAND``
+# Matlab script command to run as the test.
+# IIf this is not set, then the following is run:
+# "runtests('matlab_file_name'), exit(max([ans(1,:).Failed]))
+# matlab_file_name comes from UNITTEST_FILE without the .m.
# ``UNITTEST_PRECOMMAND``
# Matlab script command to be ran before the file
# containing the test (eg. GPU device initialisation based on CMake
@@ -745,12 +760,18 @@ endfunction()
# ``MATLAB_ADDITIONAL_STARTUP_OPTIONS``
# a list of additional option in order
# to run Matlab from the command line.
+# -nosplash -nodesktop -nodisplay are always added.
# ``TEST_ARGS``
# Additional options provided to the add_test command. These
# options are added to the default options (eg. "CONFIGURATIONS Release")
# ``NO_UNITTEST_FRAMEWORK``
# when set, indicates that the test should not
# use the unittest framework of Matlab (available for versions >= R2013a).
+# ``WORKING_DIRECTORY``
+# This will be the working directory for the test. If specified it will
+# also be the output directory used for the log file of the test run.
+# If not specifed the temporary directory ${CMAKE_BINARY_DIR}/Matlab will
+# be used as the working directory and the log location.
#
function(matlab_add_unit_test)
@@ -759,11 +780,12 @@ function(matlab_add_unit_test)
endif()
set(options NO_UNITTEST_FRAMEWORK)
- set(oneValueArgs NAME UNITTEST_PRECOMMAND UNITTEST_FILE TIMEOUT)
+ set(oneValueArgs NAME UNITTEST_FILE TIMEOUT WORKING_DIRECTORY
+ UNITTEST_PRECOMMAND CUSTOM_TEST_COMMAND)
set(multiValueArgs ADDITIONAL_PATH MATLAB_ADDITIONAL_STARTUP_OPTIONS TEST_ARGS)
set(prefix _matlab_unittest_prefix)
- cmake_parse_arguments(${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+ cmake_parse_arguments(PARSE_ARGV 0 ${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" )
if(NOT ${prefix}_NAME)
message(FATAL_ERROR "[MATLAB] The Matlab test name cannot be empty")
@@ -771,15 +793,17 @@ function(matlab_add_unit_test)
add_test(NAME ${${prefix}_NAME}
COMMAND ${CMAKE_COMMAND}
- -Dtest_name=${${prefix}_NAME}
- -Dadditional_paths=${${prefix}_ADDITIONAL_PATH}
- -Dtest_timeout=${${prefix}_TIMEOUT}
- -Doutput_directory=${_matlab_temporary_folder}
- -DMatlab_PROGRAM=${Matlab_MAIN_PROGRAM}
- -Dno_unittest_framework=${${prefix}_NO_UNITTEST_FRAMEWORK}
- -DMatlab_ADDITIONNAL_STARTUP_OPTIONS=${${prefix}_MATLAB_ADDITIONAL_STARTUP_OPTIONS}
- -Dunittest_file_to_run=${${prefix}_UNITTEST_FILE}
- -Dcmd_to_run_before_test=${${prefix}_UNITTEST_PRECOMMAND}
+ "-Dtest_name=${${prefix}_NAME}"
+ "-Dadditional_paths=${${prefix}_ADDITIONAL_PATH}"
+ "-Dtest_timeout=${${prefix}_TIMEOUT}"
+ "-Doutput_directory=${_matlab_temporary_folder}"
+ "-Dworking_directory=${${prefix}_WORKING_DIRECTORY}"
+ "-DMatlab_PROGRAM=${Matlab_MAIN_PROGRAM}"
+ "-Dno_unittest_framework=${${prefix}_NO_UNITTEST_FRAMEWORK}"
+ "-DMatlab_ADDITIONNAL_STARTUP_OPTIONS=${${prefix}_MATLAB_ADDITIONAL_STARTUP_OPTIONS}"
+ "-Dunittest_file_to_run=${${prefix}_UNITTEST_FILE}"
+ "-Dcustom_Matlab_test_command=${${prefix}_CUSTOM_TEST_COMMAND}"
+ "-Dcmd_to_run_before_test=${${prefix}_UNITTEST_PRECOMMAND}"
-P ${_FindMatlab_SELF_DIR}/MatlabTestsRedirect.cmake
${${prefix}_TEST_ARGS}
${${prefix}_UNPARSED_ARGUMENTS}
@@ -1027,13 +1051,17 @@ function(_Matlab_get_version_from_root matlab_root matlab_known_version matlab_f
set(matlab_list_of_all_versions)
matlab_get_version_from_matlab_run("${Matlab_PROG_VERSION_STRING_AUTO_DETECT}" matlab_list_of_all_versions)
- list(GET matlab_list_of_all_versions 0 _matlab_version_tmp)
+ list(LENGTH matlab_list_of_all_versions list_of_all_versions_length)
+ if(${list_of_all_versions_length} GREATER 0)
+ list(GET matlab_list_of_all_versions 0 _matlab_version_tmp)
+ else()
+ set(_matlab_version_tmp "unknown")
+ endif()
# set the version into the cache
set(Matlab_VERSION_STRING_INTERNAL ${_matlab_version_tmp} CACHE INTERNAL "Matlab version (automatically determined)" FORCE)
# warning, just in case several versions found (should not happen)
- list(LENGTH matlab_list_of_all_versions list_of_all_versions_length)
if((${list_of_all_versions_length} GREATER 1) AND MATLAB_FIND_DEBUG)
message(WARNING "[MATLAB] Found several versions, taking the first one (versions found ${matlab_list_of_all_versions})")
endif()
@@ -1213,6 +1241,7 @@ if(DEFINED Matlab_ROOT_DIR_LAST_CACHED)
Matlab_MAIN_PROGRAM
Matlab_MX_LIBRARY
Matlab_ENG_LIBRARY
+ Matlab_MAT_LIBRARY
Matlab_MEX_EXTENSION
# internal
@@ -1287,7 +1316,11 @@ set(Matlab_EXTERN_LIBRARY_DIR
${Matlab_ROOT_DIR}/extern/lib/${_matlab_bin_prefix}${_matlab_current_suffix})
if(WIN32)
- set(_matlab_lib_dir_for_search ${Matlab_EXTERN_LIBRARY_DIR}/microsoft)
+ if(MINGW)
+ set(_matlab_lib_dir_for_search ${Matlab_EXTERN_LIBRARY_DIR}/mingw64)
+ else()
+ set(_matlab_lib_dir_for_search ${Matlab_EXTERN_LIBRARY_DIR}/microsoft)
+ endif()
set(_matlab_lib_prefix_for_search "lib")
else()
set(_matlab_lib_dir_for_search ${Matlab_BINARIES_DIR})
@@ -1342,7 +1375,6 @@ _Matlab_find_library(
NO_DEFAULT_PATH
)
-
list(APPEND _matlab_required_variables Matlab_MEX_LIBRARY)
# the MEX extension is required
@@ -1351,7 +1383,6 @@ list(APPEND _matlab_required_variables Matlab_MEX_EXTENSION)
# the matlab root is required
list(APPEND _matlab_required_variables Matlab_ROOT_DIR)
-
# component Mex Compiler
list(FIND Matlab_FIND_COMPONENTS MEX_COMPILER _matlab_find_mex_compiler)
if(_matlab_find_mex_compiler GREATER -1)
@@ -1362,7 +1393,6 @@ if(_matlab_find_mex_compiler GREATER -1)
DOC "Matlab MEX compiler"
NO_DEFAULT_PATH
)
-
if(Matlab_MEX_COMPILER)
set(Matlab_MEX_COMPILER_FOUND TRUE)
endif()
@@ -1372,7 +1402,6 @@ unset(_matlab_find_mex_compiler)
# component Matlab program
list(FIND Matlab_FIND_COMPONENTS MAIN_PROGRAM _matlab_find_matlab_program)
if(_matlab_find_matlab_program GREATER -1)
-
find_program(
Matlab_MAIN_PROGRAM
matlab
@@ -1380,11 +1409,9 @@ if(_matlab_find_matlab_program GREATER -1)
DOC "Matlab main program"
NO_DEFAULT_PATH
)
-
if(Matlab_MAIN_PROGRAM)
set(Matlab_MAIN_PROGRAM_FOUND TRUE)
endif()
-
endif()
unset(_matlab_find_matlab_program)
@@ -1398,14 +1425,12 @@ if(_matlab_find_mx GREATER -1)
PATHS ${_matlab_lib_dir_for_search}
NO_DEFAULT_PATH
)
-
if(Matlab_MX_LIBRARY)
set(Matlab_MX_LIBRARY_FOUND TRUE)
endif()
endif()
unset(_matlab_find_mx)
-
# Component ENG library
list(FIND Matlab_FIND_COMPONENTS ENG_LIBRARY _matlab_find_eng)
if(_matlab_find_eng GREATER -1)
@@ -1422,15 +1447,26 @@ if(_matlab_find_eng GREATER -1)
endif()
unset(_matlab_find_eng)
-
-
+# Component MAT library
+list(FIND Matlab_FIND_COMPONENTS MAT_LIBRARY _matlab_find_mat)
+if(_matlab_find_mat GREATER -1)
+ _Matlab_find_library(
+ ${_matlab_lib_prefix_for_search}
+ Matlab_MAT_LIBRARY
+ mat
+ PATHS ${_matlab_lib_dir_for_search}
+ NO_DEFAULT_PATH
+ )
+ if(Matlab_MAT_LIBRARY)
+ set(Matlab_MAT_LIBRARY_FOUND TRUE)
+ endif()
+endif()
+unset(_matlab_find_mat)
unset(_matlab_lib_dir_for_search)
-
-set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY})
-
+set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY} ${Matlab_MAT_LIBRARY})
find_package_handle_standard_args(
Matlab
@@ -1449,18 +1485,14 @@ unset(_matlab_lib_prefix_for_search)
if(Matlab_INCLUDE_DIRS AND Matlab_LIBRARIES)
mark_as_advanced(
- #Matlab_LIBRARIES
Matlab_MEX_LIBRARY
Matlab_MX_LIBRARY
Matlab_ENG_LIBRARY
+ Matlab_MAT_LIBRARY
Matlab_INCLUDE_DIRS
Matlab_FOUND
- #Matlab_ROOT_DIR
- #Matlab_VERSION_STRING
Matlab_MAIN_PROGRAM
- #Matlab_MEX_EXTENSION
Matlab_MEXEXTENSIONS_PROG
Matlab_MEX_EXTENSION
- #Matlab_BINARIES_DIR
)
endif()
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
index 4d3ed84..6acda55 100644
--- a/Modules/FindOpenCL.cmake
+++ b/Modules/FindOpenCL.cmake
@@ -4,7 +4,16 @@
#
# Try to find OpenCL
#
-# Once done this will define::
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines :prop_tgt:`IMPORTED` target ``OpenCL::OpenCL``, if
+# OpenCL has been found.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the following variables::
#
# OpenCL_FOUND - True if OpenCL was found
# OpenCL_INCLUDE_DIRS - include directories for OpenCL
@@ -20,7 +29,7 @@
#
#=============================================================================
-# Copyright 2014 Matthaeus G. Chajdas
+# Copyright 2014-2016 Matthaeus G. Chajdas
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -44,7 +53,7 @@ function(_FIND_OPENCL_VERSION)
if(APPLE)
CHECK_SYMBOL_EXISTS(
CL_VERSION_${VERSION}
- "${OpenCL_INCLUDE_DIR}/OpenCL/cl.h"
+ "${OpenCL_INCLUDE_DIR}/Headers/cl.h"
OPENCL_VERSION_${VERSION})
else()
CHECK_SYMBOL_EXISTS(
@@ -134,3 +143,17 @@ find_package_handle_standard_args(
mark_as_advanced(
OpenCL_INCLUDE_DIR
OpenCL_LIBRARY)
+
+if(OpenCL_FOUND AND NOT TARGET OpenCL::OpenCL)
+ if(OpenCL_LIBRARY MATCHES "/([^/]+)\\.framework$")
+ add_library(OpenCL::OpenCL INTERFACE IMPORTED)
+ set_target_properties(OpenCL::OpenCL PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${OpenCL_LIBRARY}")
+ else()
+ add_library(OpenCL::OpenCL UNKNOWN IMPORTED)
+ set_target_properties(OpenCL::OpenCL PROPERTIES
+ IMPORTED_LOCATION "${OpenCL_LIBRARY}")
+ endif()
+ set_target_properties(OpenCL::OpenCL PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OpenCL_INCLUDE_DIRS}")
+endif()
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index ee4bdd6..a788832 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -12,17 +12,27 @@
#
# The following variables are set:
#
-# ::
+# ``OpenMP_C_FLAGS``
+# Flags to add to the C compiler for OpenMP support.
+# ``OpenMP_CXX_FLAGS``
+# Flags to add to the CXX compiler for OpenMP support.
+# ``OpenMP_Fortran_FLAGS``
+# Flags to add to the Fortran compiler for OpenMP support.
+# ``OPENMP_FOUND``
+# True if openmp is detected.
#
-# OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support
-# OpenMP_CXX_FLAGS - flags to add to the CXX compiler for OpenMP support
-# OpenMP_Fortran_FLAGS - flags to add to the Fortran compiler for OpenMP support
-# OPENMP_FOUND - true if openmp is detected
+# The following internal variables are set, if detected:
#
+# ``OpenMP_C_SPEC_DATE``
+# Specification date of OpenMP version of C compiler.
+# ``OpenMP_CXX_SPEC_DATE``
+# Specification date of OpenMP version of CXX compiler.
+# ``OpenMP_Fortran_SPEC_DATE``
+# Specification date of OpenMP version of Fortran compiler.
#
-#
-# Supported compilers can be found at
-# http://openmp.org/wp/openmp-compilers/
+# The specification dates are formatted as integers of the form
+# ``CCYYMM`` where these represent the decimal digits of the century,
+# year, and month.
#=============================================================================
# Copyright 2009 Kitware, Inc.
@@ -122,6 +132,75 @@ set(OpenMP_Fortran_TEST_SOURCE
"
)
+set(OpenMP_C_CXX_CHECK_VERSION_SOURCE
+"
+#include <stdio.h>
+#include <omp.h>
+const char ompver_str[] = { 'I', 'N', 'F', 'O', ':', 'O', 'p', 'e', 'n', 'M',
+ 'P', '-', 'd', 'a', 't', 'e', '[',
+ ('0' + ((_OPENMP/100000)%10)),
+ ('0' + ((_OPENMP/10000)%10)),
+ ('0' + ((_OPENMP/1000)%10)),
+ ('0' + ((_OPENMP/100)%10)),
+ ('0' + ((_OPENMP/10)%10)),
+ ('0' + ((_OPENMP/1)%10)),
+ ']', '\\0' };
+int main(int argc, char *argv[])
+{
+ printf(\"%s\\n\", ompver_str);
+ return 0;
+}
+")
+
+set(OpenMP_Fortran_CHECK_VERSION_SOURCE
+"
+ program omp_ver
+ use omp_lib
+ integer, parameter :: zero = ichar('0')
+ integer, parameter :: ompv = openmp_version
+ character, dimension(24), parameter :: ompver_str =&
+ (/ 'I', 'N', 'F', 'O', ':', 'O', 'p', 'e', 'n', 'M', 'P', '-',&
+ 'd', 'a', 't', 'e', '[',&
+ char(zero + mod(ompv/100000, 10)),&
+ char(zero + mod(ompv/10000, 10)),&
+ char(zero + mod(ompv/1000, 10)),&
+ char(zero + mod(ompv/100, 10)),&
+ char(zero + mod(ompv/10, 10)),&
+ char(zero + mod(ompv/1, 10)), ']' /)
+ print *, ompver_str
+ end program omp_ver
+")
+
+function(_OPENMP_GET_SPEC_DATE LANG SPEC_DATE)
+ set(WORK_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenMP)
+ if("${LANG}" STREQUAL "C")
+ set(SRC_FILE ${WORK_DIR}/ompver.c)
+ file(WRITE ${SRC_FILE} "${OpenMP_C_CXX_CHECK_VERSION_SOURCE}")
+ elseif("${LANG}" STREQUAL "CXX")
+ set(SRC_FILE ${WORK_DIR}/ompver.cpp)
+ file(WRITE ${SRC_FILE} "${OpenMP_C_CXX_CHECK_VERSION_SOURCE}")
+ else() # ("${LANG}" STREQUAL "Fortran")
+ set(SRC_FILE ${WORK_DIR}/ompver.f90)
+ file(WRITE ${SRC_FILE} "${OpenMP_Fortran_CHECK_VERSION_SOURCE}")
+ endif()
+
+ set(BIN_FILE ${WORK_DIR}/ompver_${LANG}.bin)
+ try_compile(OpenMP_TRY_COMPILE_RESULT ${CMAKE_BINARY_DIR} ${SRC_FILE}
+ CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OpenMP_${LANG}_FLAGS}"
+ COPY_FILE ${BIN_FILE})
+
+ if(${OpenMP_TRY_COMPILE_RESULT})
+ file(STRINGS ${BIN_FILE} specstr LIMIT_COUNT 1 REGEX "INFO:OpenMP-date")
+ set(regex_spec_date ".*INFO:OpenMP-date\\[0*([^]]*)\\].*")
+ if("${specstr}" MATCHES "${regex_spec_date}")
+ set(${SPEC_DATE} "${CMAKE_MATCH_1}" PARENT_SCOPE)
+ endif()
+ endif()
+
+ unset(OpenMP_TRY_COMPILE_RESULT CACHE)
+endfunction()
+
+
# check c compiler
if(CMAKE_C_COMPILER_LOADED)
# if these are set then do not try to find them again,
@@ -153,6 +232,12 @@ if(CMAKE_C_COMPILER_LOADED)
list(APPEND _OPENMP_REQUIRED_VARS OpenMP_C_FLAGS)
unset(OpenMP_C_FLAG_CANDIDATES)
+
+ if (NOT OpenMP_C_SPEC_DATE)
+ _OPENMP_GET_SPEC_DATE("C" OpenMP_C_SPEC_DATE_INTERNAL)
+ set(OpenMP_C_SPEC_DATE "${OpenMP_C_SPEC_DATE_INTERNAL}" CACHE
+ INTERNAL "C compiler's OpenMP specification date")
+ endif()
endif()
# check cxx compiler
@@ -189,7 +274,12 @@ if(CMAKE_CXX_COMPILER_LOADED)
list(APPEND _OPENMP_REQUIRED_VARS OpenMP_CXX_FLAGS)
unset(OpenMP_CXX_FLAG_CANDIDATES)
- unset(OpenMP_CXX_TEST_SOURCE)
+
+ if (NOT OpenMP_CXX_SPEC_DATE)
+ _OPENMP_GET_SPEC_DATE("CXX" OpenMP_CXX_SPEC_DATE_INTERNAL)
+ set(OpenMP_CXX_SPEC_DATE "${OpenMP_CXX_SPEC_DATE_INTERNAL}" CACHE
+ INTERNAL "C++ compiler's OpenMP specification date")
+ endif()
endif()
# check Fortran compiler
@@ -223,7 +313,12 @@ if(CMAKE_Fortran_COMPILER_LOADED)
list(APPEND _OPENMP_REQUIRED_VARS OpenMP_Fortran_FLAGS)
unset(OpenMP_Fortran_FLAG_CANDIDATES)
- unset(OpenMP_Fortran_TEST_SOURCE)
+
+ if (NOT OpenMP_Fortran_SPEC_DATE)
+ _OPENMP_GET_SPEC_DATE("Fortran" OpenMP_Fortran_SPEC_DATE_INTERNAL)
+ set(OpenMP_Fortran_SPEC_DATE "${OpenMP_Fortran_SPEC_DATE_INTERNAL}" CACHE
+ INTERNAL "Fortran compiler's OpenMP specification date")
+ endif()
endif()
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
@@ -240,3 +335,9 @@ if(_OPENMP_REQUIRED_VARS)
else()
message(SEND_ERROR "FindOpenMP requires C or CXX language to be enabled")
endif()
+
+unset(OpenMP_C_TEST_SOURCE)
+unset(OpenMP_CXX_TEST_SOURCE)
+unset(OpenMP_Fortran_TEST_SOURCE)
+unset(OpenMP_C_CXX_CHECK_VERSION_SOURCE)
+unset(OpenMP_Fortran_CHECK_VERSION_SOURCE)
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 8dbaf11..034b0e6 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -133,22 +133,31 @@ if(WIN32 AND NOT CYGWIN)
set(_OPENSSL_MSVC_RT_MODE "MD")
endif ()
+ # Since OpenSSL 1.1, lib names are like libcrypto32MTd.lib and libssl32MTd.lib
+ if( "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" )
+ set(_OPENSSL_MSVC_ARCH_SUFFIX "64")
+ else()
+ set(_OPENSSL_MSVC_ARCH_SUFFIX "32")
+ endif()
+
if(OPENSSL_USE_STATIC_LIBS)
set(_OPENSSL_PATH_SUFFIXES
- "lib"
- "VC/static"
"lib/VC/static"
+ "VC/static"
+ "lib"
)
else()
set(_OPENSSL_PATH_SUFFIXES
- "lib"
- "VC"
"lib/VC"
+ "VC"
+ "lib"
)
endif ()
find_library(LIB_EAY_DEBUG
NAMES
+ libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
+ libcryptod
libeay32${_OPENSSL_MSVC_RT_MODE}d
libeay32d
NAMES_PER_DIR
@@ -159,6 +168,8 @@ if(WIN32 AND NOT CYGWIN)
find_library(LIB_EAY_RELEASE
NAMES
+ libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
+ libcrypto
libeay32${_OPENSSL_MSVC_RT_MODE}
libeay32
NAMES_PER_DIR
@@ -169,6 +180,8 @@ if(WIN32 AND NOT CYGWIN)
find_library(SSL_EAY_DEBUG
NAMES
+ libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
+ libssld
ssleay32${_OPENSSL_MSVC_RT_MODE}d
ssleay32d
NAMES_PER_DIR
@@ -179,6 +192,8 @@ if(WIN32 AND NOT CYGWIN)
find_library(SSL_EAY_RELEASE
NAMES
+ libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
+ libssl
ssleay32${_OPENSSL_MSVC_RT_MODE}
ssleay32
ssl
@@ -212,8 +227,8 @@ if(WIN32 AND NOT CYGWIN)
NAMES_PER_DIR
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
- "lib"
"lib/MinGW"
+ "lib"
)
find_library(SSL_EAY
@@ -222,8 +237,8 @@ if(WIN32 AND NOT CYGWIN)
NAMES_PER_DIR
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
- "lib"
"lib/MinGW"
+ "lib"
)
mark_as_advanced(SSL_EAY LIB_EAY)
@@ -236,6 +251,7 @@ if(WIN32 AND NOT CYGWIN)
# Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
find_library(LIB_EAY
NAMES
+ libcrypto
libeay32
NAMES_PER_DIR
${_OPENSSL_ROOT_HINTS_AND_PATHS}
@@ -247,6 +263,7 @@ if(WIN32 AND NOT CYGWIN)
find_library(SSL_EAY
NAMES
+ libssl
ssleay32
NAMES_PER_DIR
${_OPENSSL_ROOT_HINTS_AND_PATHS}
@@ -328,11 +345,11 @@ function(from_hex HEX DEC)
set(${DEC} ${_res} PARENT_SCOPE)
endfunction()
-if (OPENSSL_INCLUDE_DIR)
- if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
- file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
- REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
+if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
+ file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
+ REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
+ if(openssl_version_str)
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
# The status gives if this is a developer or prerelease and is ignored here.
# Major, minor, and fix directly translate into the version numbers shown in
@@ -399,13 +416,6 @@ if(OPENSSL_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARY}")
endif()
- if(EXISTS "${LIB_EAY_LIBRARY_DEBUG}")
- set_property(TARGET OpenSSL::Crypto APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(OpenSSL::Crypto PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
- IMPORTED_LOCATION_DEBUG "${LIB_EAY_LIBRARY_DEBUG}")
- endif()
if(EXISTS "${LIB_EAY_LIBRARY_RELEASE}")
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
@@ -413,6 +423,13 @@ if(OPENSSL_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${LIB_EAY_LIBRARY_RELEASE}")
endif()
+ if(EXISTS "${LIB_EAY_LIBRARY_DEBUG}")
+ set_property(TARGET OpenSSL::Crypto APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(OpenSSL::Crypto PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${LIB_EAY_LIBRARY_DEBUG}")
+ endif()
endif()
if(NOT TARGET OpenSSL::SSL AND
(EXISTS "${OPENSSL_SSL_LIBRARY}" OR
@@ -427,13 +444,6 @@ if(OPENSSL_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${OPENSSL_SSL_LIBRARY}")
endif()
- if(EXISTS "${SSL_EAY_LIBRARY_DEBUG}")
- set_property(TARGET OpenSSL::SSL APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(OpenSSL::SSL PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
- IMPORTED_LOCATION_DEBUG "${SSL_EAY_LIBRARY_DEBUG}")
- endif()
if(EXISTS "${SSL_EAY_LIBRARY_RELEASE}")
set_property(TARGET OpenSSL::SSL APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
@@ -441,6 +451,13 @@ if(OPENSSL_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${SSL_EAY_LIBRARY_RELEASE}")
endif()
+ if(EXISTS "${SSL_EAY_LIBRARY_DEBUG}")
+ set_property(TARGET OpenSSL::SSL APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(OpenSSL::SSL PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${SSL_EAY_LIBRARY_DEBUG}")
+ endif()
if(TARGET OpenSSL::Crypto)
set_target_properties(OpenSSL::SSL PROPERTIES
INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
diff --git a/Modules/FindPHP4.cmake b/Modules/FindPHP4.cmake
index 25fff8c..7eab161 100644
--- a/Modules/FindPHP4.cmake
+++ b/Modules/FindPHP4.cmake
@@ -58,8 +58,8 @@ mark_as_advanced(
if(APPLE)
# this is a hack for now
- set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
- "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -Wl,-flat_namespace")
+ string(APPEND CMAKE_SHARED_MODULE_CREATE_C_FLAGS
+ " -Wl,-flat_namespace")
foreach(symbol
__efree
__emalloc
@@ -82,8 +82,8 @@ if(APPLE)
_zend_wrong_param_count
_zval_used_for_init
)
- set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
- "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS},-U,${symbol}")
+ string(APPEND CMAKE_SHARED_MODULE_CREATE_C_FLAGS
+ ",-U,${symbol}")
endforeach()
endif()
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index 5050d91..d0dd870 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -126,13 +126,6 @@ if(ZLIB_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${PNG_LIBRARY}")
endif()
- if(EXISTS "${PNG_LIBRARY_DEBUG}")
- set_property(TARGET PNG::PNG APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(PNG::PNG PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
- IMPORTED_LOCATION_DEBUG "${PNG_LIBRARY_DEBUG}")
- endif()
if(EXISTS "${PNG_LIBRARY_RELEASE}")
set_property(TARGET PNG::PNG APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
@@ -140,6 +133,13 @@ if(ZLIB_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${PNG_LIBRARY_RELEASE}")
endif()
+ if(EXISTS "${PNG_LIBRARY_DEBUG}")
+ set_property(TARGET PNG::PNG APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(PNG::PNG PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${PNG_LIBRARY_DEBUG}")
+ endif()
endif()
endif ()
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index fe2dbea..96590cb 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -169,10 +169,10 @@ macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
foreach(currentConfigIndex RANGE ${configsCount})
list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
- set(configsText "${configsText} ${filename} (version ${version})\n")
+ string(APPEND configsText " ${filename} (version ${version})\n")
endforeach()
if (${_NAME}_NOT_FOUND_MESSAGE)
- set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n")
+ string(APPEND configsText " Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n")
endif()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
@@ -253,9 +253,9 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
if(NOT ${_CURRENT_VAR})
set(FPHSA_FOUND_${_NAME} FALSE)
- set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
+ string(APPEND MISSING_VARS " ${_CURRENT_VAR}")
else()
- set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
+ string(APPEND DETAILS "[${${_CURRENT_VAR}}]")
endif()
endforeach()
if(FPHSA_FOUND_${_NAME})
@@ -277,24 +277,24 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
if(NOT DEFINED FOUND_COMPONENTS_MSG)
set(FOUND_COMPONENTS_MSG "found components: ")
endif()
- set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}")
+ string(APPEND FOUND_COMPONENTS_MSG " ${comp}")
else()
if(NOT DEFINED MISSING_COMPONENTS_MSG)
set(MISSING_COMPONENTS_MSG "missing components: ")
endif()
- set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}")
+ string(APPEND MISSING_COMPONENTS_MSG " ${comp}")
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
- set(MISSING_VARS "${MISSING_VARS} ${comp}")
+ string(APPEND MISSING_VARS " ${comp}")
endif()
endif()
endforeach()
set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
- set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]")
+ string(APPEND DETAILS "[c${COMPONENT_MSG}]")
endif()
# version handling:
@@ -368,7 +368,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
endif ()
if(VERSION_OK)
- set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
+ string(APPEND DETAILS "[v${VERSION}(${${_NAME}_FIND_VERSION})]")
else()
set(${_NAME}_FOUND FALSE)
endif()
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index b79e9df..b6156dd 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -200,7 +200,7 @@ function(_pkg_create_imp_target _prefix _no_cmake_path _no_cmake_environment_pat
set(_find_opts "NO_CMAKE_PATH")
endif()
if(_no_cmake_environment_path)
- set(_find_opts "${_find_opts} NO_CMAKE_ENVIRONMENT_PATH")
+ string(APPEND _find_opts " NO_CMAKE_ENVIRONMENT_PATH")
endif()
foreach (flag IN LISTS ${_prefix}_LDFLAGS)
@@ -316,9 +316,13 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
endif()
else()
- # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property
+ # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties
+ get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS)
+ if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
+ list(APPEND _lib_dirs "lib32/pkgconfig")
+ endif()
get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
- if(uselib64)
+ if(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND _lib_dirs "lib64/pkgconfig")
endif()
endif()
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index d05d3da..84fa541 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -37,7 +37,7 @@
# In Windows the default installation of PostgreSQL uses that as part of the path.
# E.g C:\Program Files\PostgreSQL\8.4.
# Currently, the following version numbers are known to this module:
-# "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0"
+# "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0"
#
# To use this variable just do something like this:
# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4")
@@ -81,7 +81,7 @@ set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to wher
set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
- "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
+ "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
# Define additional search paths for root directories.
set( PostgreSQL_ROOT_DIRECTORIES
@@ -186,7 +186,7 @@ set(PostgreSQL_FOUND ${POSTGRESQL_FOUND})
if(PostgreSQL_FOUND)
set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} )
set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} )
- set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND})
+ set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY})
endif()
mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY )
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 2807bb9..8a2e4e7 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -148,6 +148,10 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
foreach(FIL ${ARGN})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE)
+ get_filename_component(FIL_DIR ${FIL} DIRECTORY)
+ if(FIL_DIR)
+ set(FIL_WE "${FIL_DIR}/${FIL_WE}")
+ endif()
list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc")
list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
@@ -205,6 +209,10 @@ function(PROTOBUF_GENERATE_PYTHON SRCS)
foreach(FIL ${ARGN})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE)
+ get_filename_component(FIL_DIR ${FIL} DIRECTORY)
+ if(FIL_DIR)
+ set(FIL_WE "${FIL_DIR}/${FIL_WE}")
+ endif()
list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py")
add_custom_command(
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index e194185..4d726f2 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -52,7 +52,7 @@ unset(_Python_NAMES)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
-set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+set(_PYTHON3_VERSIONS 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonInterp_FIND_VERSION)
if(PythonInterp_FIND_VERSION_COUNT GREATER 1)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index ab92f86..d9916a1 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -84,7 +84,7 @@ set(CMAKE_FIND_FRAMEWORK LAST)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
-set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+set(_PYTHON3_VERSIONS 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonLibs_FIND_VERSION)
if(PythonLibs_FIND_VERSION_COUNT GREATER 1)
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index d167a13..7c41b99 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -764,7 +764,7 @@ if (QT_QMAKE_EXECUTABLE AND
#############################################
cmake_push_check_state()
# Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
- set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}")
+ list(APPEND CMAKE_REQUIRED_INCLUDES "${QT_INCLUDE_DIR}")
set(CMAKE_REQUIRED_QUIET ${Qt4_FIND_QUIETLY})
# Check for Window system symbols (note: only one should end up being set)
CHECK_CXX_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11)
diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake
index 494d358..b378c34 100644
--- a/Modules/FindSDL_sound.cmake
+++ b/Modules/FindSDL_sound.cmake
@@ -123,7 +123,7 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
# To get multiple single variables to work, I must separate them with a "\;"
# I could go back and modify the FindSDL.cmake module, but that's kind of painful.
# The solution would be to try something like:
- # set(SDL_TRY_COMPILE_LIBRARY_LIST "${SDL_TRY_COMPILE_LIBRARY_LIST}\;${CMAKE_THREAD_LIBS_INIT}")
+ # string(APPEND SDL_TRY_COMPILE_LIBRARY_LIST "\;${CMAKE_THREAD_LIBS_INIT}")
# Instead, it was suggested on the mailing list to write a temporary CMakeLists.txt
# with a temporary test project and invoke that with TRY_COMPILE.
# See message thread "Figuring out dependencies for a library in order to build"
@@ -173,7 +173,7 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
# would fix the problem.
set(TMP_TRY_LIBS)
foreach(lib ${SDL_SOUND_LIBRARY} ${SDL_LIBRARY})
- set(TMP_TRY_LIBS "${TMP_TRY_LIBS} \"${lib}\"")
+ string(APPEND TMP_TRY_LIBS " \"${lib}\"")
endforeach()
# message("TMP_TRY_LIBS ${TMP_TRY_LIBS}")
diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
index e600498..6c760db 100644
--- a/Modules/FindTIFF.cmake
+++ b/Modules/FindTIFF.cmake
@@ -98,13 +98,6 @@ if(TIFF_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${TIFF_LIBRARY}")
endif()
- if(EXISTS "${TIFF_LIBRARY_DEBUG}")
- set_property(TARGET TIFF::TIFF APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(TIFF::TIFF PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
- IMPORTED_LOCATION_DEBUG "${TIFF_LIBRARY_DEBUG}")
- endif()
if(EXISTS "${TIFF_LIBRARY_RELEASE}")
set_property(TARGET TIFF::TIFF APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
@@ -112,6 +105,13 @@ if(TIFF_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${TIFF_LIBRARY_RELEASE}")
endif()
+ if(EXISTS "${TIFF_LIBRARY_DEBUG}")
+ set_property(TARGET TIFF::TIFF APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(TIFF::TIFF PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${TIFF_LIBRARY_DEBUG}")
+ endif()
endif()
endif()
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake
new file mode 100644
index 0000000..b335f5f
--- /dev/null
+++ b/Modules/FindVulkan.cmake
@@ -0,0 +1,85 @@
+#.rst:
+# FindVulkan
+# ----------
+#
+# Try to find Vulkan
+#
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if
+# Vulkan has been found.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the following variables::
+#
+# Vulkan_FOUND - True if Vulkan was found
+# Vulkan_INCLUDE_DIRS - include directories for Vulkan
+# Vulkan_LIBRARIES - link against this library to use Vulkan
+#
+# The module will also define two cache variables::
+#
+# Vulkan_INCLUDE_DIR - the Vulkan include directory
+# Vulkan_LIBRARY - the path to the Vulkan library
+#
+
+#=============================================================================
+# Copyright 2016 Matthaeus G. Chajdas
+#
+# 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.)
+
+if(WIN32)
+ find_path(Vulkan_INCLUDE_DIR
+ NAMES vulkan/vulkan.h
+ PATHS
+ "$ENV{VULKAN_SDK}/Include"
+ )
+
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ find_library(Vulkan_LIBRARY
+ NAMES vulkan-1
+ PATHS
+ "$ENV{VULKAN_SDK}/Bin")
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ find_library(Vulkan_LIBRARY
+ NAMES vulkan-1
+ PATHS
+ "$ENV{VULKAN_SDK}/Bin32")
+ endif()
+else()
+ find_path(Vulkan_INCLUDE_DIR
+ NAMES vulkan/vulkan.h
+ PATHS
+ "$ENV{VULKAN_SDK}/include")
+ find_library(Vulkan_LIBRARY
+ NAMES vulkan
+ PATHS
+ "$ENV{VULKAN_SDK}/lib")
+endif()
+
+set(Vulkan_LIBRARIES ${Vulkan_LIBRARY})
+set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Vulkan
+ DEFAULT_MSG
+ Vulkan_LIBRARY Vulkan_INCLUDE_DIR)
+
+mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY)
+
+if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan)
+ add_library(Vulkan::Vulkan UNKNOWN IMPORTED)
+ set_target_properties(Vulkan::Vulkan PROPERTIES
+ IMPORTED_LOCATION "${Vulkan_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
+endif()
diff --git a/Modules/FindXalanC.cmake b/Modules/FindXalanC.cmake
index 016b7aa..f5061d3 100644
--- a/Modules/FindXalanC.cmake
+++ b/Modules/FindXalanC.cmake
@@ -143,13 +143,6 @@ if(XalanC_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${XalanC_LIBRARY}")
endif()
- if(EXISTS "${XalanC_LIBRARY_DEBUG}")
- set_property(TARGET XalanC::XalanC APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(XalanC::XalanC PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
- IMPORTED_LOCATION_DEBUG "${XalanC_LIBRARY_DEBUG}")
- endif()
if(EXISTS "${XalanC_LIBRARY_RELEASE}")
set_property(TARGET XalanC::XalanC APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
@@ -157,6 +150,13 @@ if(XalanC_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${XalanC_LIBRARY_RELEASE}")
endif()
+ if(EXISTS "${XalanC_LIBRARY_DEBUG}")
+ set_property(TARGET XalanC::XalanC APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(XalanC::XalanC PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${XalanC_LIBRARY_DEBUG}")
+ endif()
set_target_properties(XalanC::XalanC PROPERTIES INTERFACE_LINK_LIBRARIES XercesC::XercesC)
endif()
endif()
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake
index a4b80e5..25e79d1 100644
--- a/Modules/FindXercesC.cmake
+++ b/Modules/FindXercesC.cmake
@@ -122,13 +122,6 @@ if(XercesC_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${XercesC_LIBRARY}")
endif()
- if(EXISTS "${XercesC_LIBRARY_DEBUG}")
- set_property(TARGET XercesC::XercesC APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(XercesC::XercesC PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
- IMPORTED_LOCATION_DEBUG "${XercesC_LIBRARY_DEBUG}")
- endif()
if(EXISTS "${XercesC_LIBRARY_RELEASE}")
set_property(TARGET XercesC::XercesC APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
@@ -136,5 +129,12 @@ if(XercesC_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${XercesC_LIBRARY_RELEASE}")
endif()
+ if(EXISTS "${XercesC_LIBRARY_DEBUG}")
+ set_property(TARGET XercesC::XercesC APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(XercesC::XercesC PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${XercesC_LIBRARY_DEBUG}")
+ endif()
endif()
endif()
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index a57f450..f4dc5ae 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -96,7 +96,7 @@ endif()
unset(ZLIB_NAMES)
unset(ZLIB_NAMES_DEBUG)
-mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
+mark_as_advanced(ZLIB_INCLUDE_DIR)
if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$")
@@ -110,7 +110,7 @@ if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
set(ZLIB_VERSION_TWEAK "")
if( "${ZLIB_H}" MATCHES "ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)")
set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}")
- set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}")
+ string(APPEND ZLIB_VERSION_STRING ".${ZLIB_VERSION_TWEAK}")
endif()
set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}")
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 8c07e6c..47a70f5 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -452,6 +452,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
D:/
ENV ProgramFiles
PATH_SUFFIXES
+ wxWidgets-3.1.0
wxWidgets-3.0.2
wxWidgets-3.0.1
wxWidgets-3.0.0
@@ -503,10 +504,22 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# settings.
if(MINGW)
set(WX_LIB_DIR_PREFIX gcc)
- elseif(CMAKE_CL_64)
- set(WX_LIB_DIR_PREFIX vc_x64)
- else()
+ elseif(MSVC)
set(WX_LIB_DIR_PREFIX vc)
+ if(MSVC14)
+ set(WX_LIB_DIR_PREFIX ${WX_LIB_DIR_PREFIX}140)
+ elseif(MSVC12)
+ set(WX_LIB_DIR_PREFIX ${WX_LIB_DIR_PREFIX}120)
+ elseif(MSVC11)
+ set(WX_LIB_DIR_PREFIX ${WX_LIB_DIR_PREFIX}110)
+ elseif(MSVC10)
+ set(WX_LIB_DIR_PREFIX ${WX_LIB_DIR_PREFIX}100)
+ elseif(MSVC90)
+ set(WX_LIB_DIR_PREFIX ${WX_LIB_DIR_PREFIX}90)
+ endif()
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(WX_LIB_DIR_PREFIX ${WX_LIB_DIR_PREFIX}_x64)
+ endif()
endif()
if(BUILD_SHARED_LIBS)
find_path(wxWidgets_LIB_DIR
@@ -854,7 +867,7 @@ else()
if(_retv EQUAL 0)
file(TO_CMAKE_PATH ${_native_path} _native_path)
DBG_MSG_V("Path ${_path} converted to ${_native_path}")
- set(_tmp_path "${_tmp_path} ${_native_path}")
+ string(APPEND _tmp_path " ${_native_path}")
endif()
endforeach()
DBG_MSG("Setting wxWidgets_INCLUDE_DIRS = ${_tmp_path}")
diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake
index 6e441c3..e405257 100644
--- a/Modules/FindwxWindows.cmake
+++ b/Modules/FindwxWindows.cmake
@@ -650,7 +650,7 @@ else()
# do we need additionial wx GL stuff like GLCanvas ?
if(WXWINDOWS_USE_GL)
- set(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" )
+ string(APPEND WX_CONFIG_ARGS_LIBS " --gl-libs" )
endif()
##message("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===")
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index c12dd4c..ae01541 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -270,7 +270,7 @@ function(FortranCInterface_HEADER file)
set(_desc_MODULE_ "/* Mangling for Fortran module symbols with underscores. */")
foreach(macro GLOBAL GLOBAL_ MODULE MODULE_)
if(FortranCInterface_${macro}_MACRO)
- set(HEADER_CONTENT "${HEADER_CONTENT}
+ string(APPEND HEADER_CONTENT "
${_desc_${macro}}
#define ${MACRO_NAMESPACE}${macro}${FortranCInterface_${macro}_MACRO}
")
@@ -279,7 +279,7 @@ ${_desc_${macro}}
# Generate symbol mangling definitions.
if(SYMBOLS)
- set(HEADER_CONTENT "${HEADER_CONTENT}
+ string(APPEND HEADER_CONTENT "
/*--------------------------------------------------------------------------*/
/* Mangle some symbols automatically. */
")
@@ -300,7 +300,7 @@ ${_desc_${macro}}
set(form "")
endif()
if(FortranCInterface_MODULE${form}_MACRO)
- set(HEADER_CONTENT "${HEADER_CONTENT}#define ${SYMBOL_NAMESPACE}${module}_${function} ${MACRO_NAMESPACE}MODULE${form}(${m_lower},${f_lower}, ${m_upper},${f_upper})\n")
+ string(APPEND HEADER_CONTENT "#define ${SYMBOL_NAMESPACE}${module}_${function} ${MACRO_NAMESPACE}MODULE${form}(${m_lower},${f_lower}, ${m_upper},${f_upper})\n")
else()
message(AUTHOR_WARNING "No FortranCInterface mangling known for ${f}")
endif()
@@ -314,7 +314,7 @@ ${_desc_${macro}}
string(TOUPPER "${f}" f_upper)
string(TOLOWER "${f}" f_lower)
if(FortranCInterface_GLOBAL${form}_MACRO)
- set(HEADER_CONTENT "${HEADER_CONTENT}#define ${SYMBOL_NAMESPACE}${f} ${MACRO_NAMESPACE}GLOBAL${form}(${f_lower}, ${f_upper})\n")
+ string(APPEND HEADER_CONTENT "#define ${SYMBOL_NAMESPACE}${f} ${MACRO_NAMESPACE}GLOBAL${form}(${f_lower}, ${f_upper})\n")
else()
message(AUTHOR_WARNING "No FortranCInterface mangling known for ${f}")
endif()
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index b42084e..0c80b8a 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -99,6 +99,23 @@
# `Filesystem Hierarchy Standard`_.
#
# .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
+#
+# Macros
+# ^^^^^^
+#
+# .. command:: GNUInstallDirs_get_absolute_install_dir
+#
+# ::
+#
+# GNUInstallDirs_get_absolute_install_dir(absvar var)
+#
+# Set the given variable ``absvar`` to the absolute path contained
+# within the variable ``var``. This is to allow the computation of an
+# absolute path, accounting for all the special cases documented
+# above. While this macro is used to compute the various
+# ``CMAKE_INSTALL_FULL_<dir>`` variables, it is exposed publicly to
+# allow users who create additional path variables to also compute
+# absolute paths where necessary, using the same logic.
#=============================================================================
# Copyright 2015 Alex Turbov <i.zaufi@gmail.com>
@@ -300,55 +317,59 @@ mark_as_advanced(
CMAKE_INSTALL_DOCDIR
)
-# Result directories
-#
-foreach(dir
- BINDIR
- SBINDIR
- LIBEXECDIR
- SYSCONFDIR
- SHAREDSTATEDIR
- LOCALSTATEDIR
- LIBDIR
- INCLUDEDIR
- OLDINCLUDEDIR
- DATAROOTDIR
- DATADIR
- INFODIR
- LOCALEDIR
- MANDIR
- DOCDIR
- )
- if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_${dir}}")
+macro(GNUInstallDirs_get_absolute_install_dir absvar var)
+ if(NOT IS_ABSOLUTE "${${var}}")
# Handle special cases:
# - CMAKE_INSTALL_PREFIX == /
# - CMAKE_INSTALL_PREFIX == /usr
# - CMAKE_INSTALL_PREFIX == /opt/...
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/")
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
- set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "/${${var}}")
else()
- if (NOT "${CMAKE_INSTALL_${dir}}" MATCHES "^usr/")
- set(CMAKE_INSTALL_${dir} "usr/${CMAKE_INSTALL_${dir}}")
+ if (NOT "${${var}}" MATCHES "^usr/")
+ set(${var} "usr/${${var}}")
endif()
- set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "/${${var}}")
endif()
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
- set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "/${${var}}")
else()
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*")
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
- set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}${CMAKE_INSTALL_PREFIX}")
+ set(${absvar} "/${${var}}${CMAKE_INSTALL_PREFIX}")
else()
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
else()
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
else()
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "${${var}}")
endif()
+endmacro()
+
+# Result directories
+#
+foreach(dir
+ BINDIR
+ SBINDIR
+ LIBEXECDIR
+ SYSCONFDIR
+ SHAREDSTATEDIR
+ LOCALSTATEDIR
+ LIBDIR
+ INCLUDEDIR
+ OLDINCLUDEDIR
+ DATAROOTDIR
+ DATADIR
+ INFODIR
+ LOCALEDIR
+ MANDIR
+ DOCDIR
+ )
+ GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir})
endforeach()
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index 6389d30..bacf137 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -20,6 +20,7 @@
# [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>]
# [DEFINE_NO_DEPRECATED]
# [PREFIX_NAME <prefix_name>]
+# [CUSTOM_CONTENT_FROM_VARIABLE <variable>]
# )
#
#
@@ -60,8 +61,10 @@
# The CMake fragment will generate a file in the
# ``${CMAKE_CURRENT_BINARY_DIR}`` called ``somelib_export.h`` containing the
# macros ``SOMELIB_EXPORT``, ``SOMELIB_NO_EXPORT``, ``SOMELIB_DEPRECATED``,
-# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``. The
-# resulting file should be installed with other headers in the library.
+# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``.
+# They will be followed by content taken from the variable specified by
+# the ``CUSTOM_CONTENT_FROM_VARIABLE`` option, if any.
+# The resulting file should be installed with other headers in the library.
#
# The ``BASE_NAME`` argument can be used to override the file name and the
# names used for the macros:
@@ -78,7 +81,7 @@
# ``OTHER_NAME_EXPORT``, ``OTHER_NAME_NO_EXPORT`` and ``OTHER_NAME_DEPRECATED``
# etc.
#
-# The ``BASE_NAME`` may be overridden by specifiying other options in the
+# The ``BASE_NAME`` may be overridden by specifying other options in the
# function. For example:
#
# .. code-block:: cmake
@@ -205,7 +208,7 @@ macro(_test_compiler_hidden_visibility)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2")
set(GCC_TOO_OLD TRUE)
- elseif(CMAKE_COMPILER_IS_GNUC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2")
+ elseif(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2")
set(GCC_TOO_OLD TRUE)
elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0")
set(_INTEL_TOO_OLD TRUE)
@@ -288,7 +291,7 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
set(options DEFINE_NO_DEPRECATED)
set(oneValueArgs PREFIX_NAME BASE_NAME EXPORT_MACRO_NAME EXPORT_FILE_NAME
DEPRECATED_MACRO_NAME NO_EXPORT_MACRO_NAME STATIC_DEFINE
- NO_DEPRECATED_MACRO_NAME)
+ NO_DEPRECATED_MACRO_NAME CUSTOM_CONTENT_FROM_VARIABLE)
set(multiValueArgs)
cmake_parse_arguments(_GEH "${options}" "${oneValueArgs}" "${multiValueArgs}"
@@ -361,6 +364,14 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
endif()
string(MAKE_C_IDENTIFIER ${EXPORT_IMPORT_CONDITION} EXPORT_IMPORT_CONDITION)
+ if(_GEH_CUSTOM_CONTENT_FROM_VARIABLE)
+ if(DEFINED "${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}")
+ set(CUSTOM_CONTENT "${${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}}")
+ else()
+ set(CUSTOM_CONTENT "")
+ endif()
+ endif()
+
configure_file("${_GENERATE_EXPORT_HEADER_MODULE_DIR}/exportheader.cmake.in"
"${EXPORT_FILE_NAME}" @ONLY)
endmacro()
@@ -404,6 +415,7 @@ function(add_compiler_export_flags)
if(ARGC GREATER 0)
set(${ARGV0} "${EXTRA_FLAGS}" PARENT_SCOPE)
else()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}" PARENT_SCOPE)
+ string(APPEND CMAKE_CXX_FLAGS " ${EXTRA_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE)
endif()
endfunction()
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index fb7bf93..127fda2 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -544,7 +544,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
string(TOLOWER "$ENV{windir}" windir)
file(TO_CMAKE_PATH "${windir}" windir)
- if(lower MATCHES "^(api-ms-win-|${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
+ if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*(msvc|api-ms-win-)[^/]+dll)")
set(is_system 1)
endif()
@@ -572,7 +572,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
string(TOLOWER "${env_windir}" windir)
string(TOLOWER "${env_sysdir}" sysroot)
- if(lower MATCHES "^(api-ms-win-|${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
+ if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*(msvc|api-ms-win-)[^/]+dll)")
set(is_system 1)
endif()
endif()
@@ -751,9 +751,13 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(gp_regex_fallback "")
set(gp_regex_cmp_count 1)
# objdump generates copious output so we create a grep filter to pre-filter results
- find_program(gp_grep_cmd grep)
+ if(WIN32)
+ find_program(gp_grep_cmd findstr)
+ else()
+ find_program(gp_grep_cmd grep)
+ endif()
if(gp_grep_cmd)
- set(gp_cmd_maybe_filter COMMAND ${gp_grep_cmd} "^[[:blank:]]*DLL Name: ")
+ set(gp_cmd_maybe_filter COMMAND ${gp_grep_cmd} "-a" "^[[:blank:]]*DLL Name: ")
endif()
else()
message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...")
@@ -796,7 +800,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
set(new_ld_env "${exepath}")
foreach(dir ${dirs})
- set(new_ld_env "${new_ld_env}:${dir}")
+ string(APPEND new_ld_env ":${dir}")
endforeach()
set(ENV{LD_LIBRARY_PATH} "${new_ld_env}:$ENV{LD_LIBRARY_PATH}")
endif()
diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake
index 77b7afe..76f9a53 100644
--- a/Modules/MatlabTestsRedirect.cmake
+++ b/Modules/MatlabTestsRedirect.cmake
@@ -23,11 +23,12 @@
# -DMatlab_PROGRAM=matlab_exe_location
# -DMatlab_ADDITIONNAL_STARTUP_OPTIONS=""
# -Dtest_name=name_of_the_test
+# -Dcustom_Matlab_test_command=""
# -Dcmd_to_run_before_test=""
# -Dunittest_file_to_run
# -P FindMatlab_TestsRedirect.cmake
-set(Matlab_UNIT_TESTS_CMD -nosplash -nojvm -nodesktop -nodisplay ${Matlab_ADDITIONNAL_STARTUP_OPTIONS})
+set(Matlab_UNIT_TESTS_CMD -nosplash -nodesktop -nodisplay ${Matlab_ADDITIONNAL_STARTUP_OPTIONS})
if(WIN32)
set(Matlab_UNIT_TESTS_CMD ${Matlab_UNIT_TESTS_CMD} -wait)
endif()
@@ -36,6 +37,13 @@ if(NOT test_timeout)
set(test_timeout 180)
endif()
+# If timeout is -1, then do not put a timeout on the execute_process
+if(test_timeout EQUAL -1)
+ set(test_timeout "")
+else()
+ set(test_timeout TIMEOUT ${test_timeout})
+endif()
+
if(NOT cmd_to_run_before_test)
set(cmd_to_run_before_test)
endif()
@@ -46,20 +54,34 @@ get_filename_component(unittest_file_to_run_name "${unittest_file_to_run}" NAME_
set(concat_string '${unittest_file_directory}')
foreach(s IN LISTS additional_paths)
if(NOT "${s}" STREQUAL "")
- set(concat_string "${concat_string}, '${s}'")
+ string(APPEND concat_string ", '${s}'")
endif()
endforeach()
-set(unittest_to_run "runtests('${unittest_file_to_run_name}'), exit(max([ans(1,:).Failed]))")
+if(custom_Matlab_test_command)
+ set(unittest_to_run "${custom_Matlab_test_command}")
+else()
+ set(unittest_to_run "runtests('${unittest_file_to_run_name}'), exit(max([ans(1,:).Failed]))")
+endif()
+
+
if(no_unittest_framework)
set(unittest_to_run "try, ${unittest_file_to_run_name}, catch err, disp('An exception has been thrown during the execution'), disp(err), disp(err.stack), exit(1), end, exit(0)")
endif()
set(Matlab_SCRIPT_TO_RUN
- "addpath(${concat_string}), path, ${cmd_to_run_before_test}, ${unittest_to_run}"
+ "addpath(${concat_string}); ${cmd_to_run_before_test}; ${unittest_to_run}"
)
+# if the working directory is not specified then default
+# to the output_directory because the log file will go there
+# if the working_directory is specified it will override the
+# output_directory
+if(NOT working_directory)
+ set(working_directory "${output_directory}")
+endif()
-set(Matlab_LOG_FILE "${output_directory}/${test_name}.log")
+string(REPLACE "/" "_" log_file_name "${test_name}.log")
+set(Matlab_LOG_FILE "${working_directory}/${log_file_name}")
set(devnull)
if(UNIX)
@@ -69,11 +91,14 @@ elseif(WIN32)
endif()
execute_process(
- COMMAND "${Matlab_PROGRAM}" ${Matlab_UNIT_TESTS_CMD} -logfile "${test_name}.log" -r "${Matlab_SCRIPT_TO_RUN}"
+ # Do not use a full path to log file. Depend on the fact that the log file
+ # is always going to go in the working_directory. This is because matlab
+ # on unix is a shell script that does not handle spaces in the logfile path.
+ COMMAND "${Matlab_PROGRAM}" ${Matlab_UNIT_TESTS_CMD} -logfile "${log_file_name}" -r "${Matlab_SCRIPT_TO_RUN}"
RESULT_VARIABLE res
- TIMEOUT ${test_timeout}
+ ${test_timeout}
OUTPUT_QUIET # we do not want the output twice
- WORKING_DIRECTORY "${output_directory}"
+ WORKING_DIRECTORY "${working_directory}"
${devnull}
)
@@ -87,5 +112,5 @@ message("Matlab test ${name_of_the_test} output:\n${matlab_log_content}") # if w
if(NOT (res EQUAL 0))
- message( FATAL_ERROR "[MATLAB] TEST FAILED" )
+ message( FATAL_ERROR "[MATLAB] TEST FAILED Matlab returned ${res}" )
endif()
diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in
index 92a3142..c66a89b 100644
--- a/Modules/NSIS.template.in
+++ b/Modules/NSIS.template.in
@@ -157,13 +157,6 @@ Var AR_RegFlags
!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING
-;--------------------------------
-; path functions
-
-!verbose 3
-!include "WinMessages.NSH"
-!verbose 4
-
;----------------------------------------
; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
;----------------------------------------
diff --git a/Modules/Platform/AIX-Clang-C.cmake b/Modules/Platform/AIX-Clang-C.cmake
new file mode 100644
index 0000000..0e8a1c0
--- /dev/null
+++ b/Modules/Platform/AIX-Clang-C.cmake
@@ -0,0 +1 @@
+include(Platform/AIX-GNU-C)
diff --git a/Modules/Platform/AIX-Clang-CXX.cmake b/Modules/Platform/AIX-Clang-CXX.cmake
new file mode 100644
index 0000000..6b9110e
--- /dev/null
+++ b/Modules/Platform/AIX-Clang-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/AIX-GNU-CXX)
diff --git a/Modules/Platform/AIX-GNU-CXX.cmake b/Modules/Platform/AIX-GNU-CXX.cmake
index ec8e83f..d047801 100644
--- a/Modules/Platform/AIX-GNU-CXX.cmake
+++ b/Modules/Platform/AIX-GNU-CXX.cmake
@@ -1,2 +1,3 @@
include(Platform/AIX-GNU)
__aix_compiler_gnu(CXX)
+unset(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN)
diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake
index d6f5331..ce6faff 100644
--- a/Modules/Platform/AIX-GNU.cmake
+++ b/Modules/Platform/AIX-GNU.cmake
@@ -21,9 +21,9 @@ set(__AIX_COMPILER_GNU 1)
#
# By default, runtime linking is enabled. All shared objects specified on the command line
# will be listed, even if there are no symbols referenced, in the output file.
-set (CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-brtl")
-set (CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,-brtl")
-set (CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-brtl")
+string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " -Wl,-brtl")
+string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " -Wl,-brtl")
+string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,-brtl")
macro(__aix_compiler_gnu lang)
@@ -34,4 +34,5 @@ macro(__aix_compiler_gnu lang)
set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1)
set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
+ unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY)
endmacro()
diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake
index 5470441..3be095e 100644
--- a/Modules/Platform/AIX-XL.cmake
+++ b/Modules/Platform/AIX-XL.cmake
@@ -21,9 +21,9 @@ set(__AIX_COMPILER_XL 1)
#
# By default, runtime linking is enabled. All shared objects specified on the command line
# will be listed, even if there are no symbols referenced, in the output file.
-set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-brtl")
-set(CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,-brtl")
-set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-brtl")
+string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " -Wl,-brtl")
+string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " -Wl,-brtl")
+string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,-brtl")
macro(__aix_compiler_xl lang)
diff --git a/Modules/Platform/ARTOS-GNU-C.cmake b/Modules/Platform/ARTOS-GNU-C.cmake
index 967d0e7..fe8d782 100644
--- a/Modules/Platform/ARTOS-GNU-C.cmake
+++ b/Modules/Platform/ARTOS-GNU-C.cmake
@@ -1,9 +1,9 @@
# Define ARTOS to select proper behaviour and tell preprocessor to accept C++ style comments.
-set(CMAKE_C_FLAGS_INIT "-DARTOS -Xp -+")
+string(APPEND CMAKE_C_FLAGS_INIT " -DARTOS -Xp -+")
# ac doesn't support -g properly and doesn't support the normal gcc optimization options. Just use the defaults set by ac.
-set(CMAKE_C_FLAGS_DEBUG_INIT "")
-set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG")
-set(CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG")
# Most projects expect the stdio functions to be available.
set(CMAKE_C_STANDARD_LIBRARIES_INIT "stdio.a")
diff --git a/Modules/Platform/Android-Clang-C.cmake b/Modules/Platform/Android-Clang-C.cmake
new file mode 100644
index 0000000..9e16911
--- /dev/null
+++ b/Modules/Platform/Android-Clang-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Android-Clang)
+__android_compiler_clang(C)
diff --git a/Modules/Platform/Android-Clang-CXX.cmake b/Modules/Platform/Android-Clang-CXX.cmake
new file mode 100644
index 0000000..7111836
--- /dev/null
+++ b/Modules/Platform/Android-Clang-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Android-Clang)
+__android_compiler_clang(CXX)
diff --git a/Modules/Platform/Android-Clang.cmake b/Modules/Platform/Android-Clang.cmake
new file mode 100644
index 0000000..7ed5046
--- /dev/null
+++ b/Modules/Platform/Android-Clang.cmake
@@ -0,0 +1,52 @@
+#=============================================================================
+# Copyright 2015-2016 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(__ANDROID_COMPILER_CLANG)
+ return()
+endif()
+set(__ANDROID_COMPILER_CLANG 1)
+
+# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
+# implemented in the CMake VS IDE generators. Avoid interfering with
+# that functionality for now. Later we may try to integrate this.
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ macro(__android_compiler_clang lang)
+ endmacro()
+ return()
+endif()
+
+# Commonly used Android toolchain files that pre-date CMake upstream support
+# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
+if(CMAKE_SYSTEM_VERSION EQUAL 1)
+ macro(__android_compiler_clang lang)
+ endmacro()
+ return()
+endif()
+
+include(Platform/Android-Common)
+
+# The NDK toolchain configuration files at:
+#
+# <ndk>/[build/core/]toolchains/*-clang*/setup.mk
+#
+# contain logic to set LLVM_TRIPLE for Clang-based toolchains for each target.
+# We need to produce the same target here to produce compatible binaries.
+include(Platform/Android/abi-${CMAKE_ANDROID_ARCH_ABI}-Clang)
+
+macro(__android_compiler_clang lang)
+ __android_compiler_common(${lang})
+ if(NOT CMAKE_${lang}_COMPILER_TARGET)
+ set(CMAKE_${lang}_COMPILER_TARGET "${_ANDROID_ABI_CLANG_TARGET}")
+ endif()
+endmacro()
diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake
new file mode 100644
index 0000000..6e86c10
--- /dev/null
+++ b/Modules/Platform/Android-Common.cmake
@@ -0,0 +1,158 @@
+#=============================================================================
+# Copyright 2015-2016 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(__ANDROID_COMPILER_COMMON)
+ return()
+endif()
+set(__ANDROID_COMPILER_COMMON 1)
+
+if(CMAKE_ANDROID_NDK)
+ # <ndk>/build/core/definitions.mk
+
+ set(_ANDROID_STL_TYPES
+ none
+ system
+ c++_static
+ c++_shared
+ gabi++_static
+ gabi++_shared
+ gnustl_static
+ gnustl_shared
+ stlport_static
+ stlport_shared
+ )
+
+ if(CMAKE_ANDROID_STL_TYPE)
+ list(FIND _ANDROID_STL_TYPES "${CMAKE_ANDROID_STL_TYPE}" _ANDROID_STL_TYPE_FOUND)
+ if(_ANDROID_STL_TYPE_FOUND EQUAL -1)
+ string(REPLACE ";" "\n " _msg ";${_ANDROID_STL_TYPES}")
+ message(FATAL_ERROR
+ "The CMAKE_ANDROID_STL_TYPE '${CMAKE_ANDROID_STL_TYPE}' is not one of the allowed values:${_msg}\n"
+ )
+ endif()
+ unset(_ANDROID_STL_TYPE_FOUND)
+ else()
+ set(CMAKE_ANDROID_STL_TYPE "gnustl_static")
+ endif()
+
+ unset(_ANDROID_STL_TYPES)
+
+ # Forward Android-specific platform variables to try_compile projects.
+ list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
+ CMAKE_ANDROID_STL_TYPE
+ )
+endif()
+
+if(CMAKE_ANDROID_STL_TYPE)
+ if(CMAKE_ANDROID_NDK)
+
+ macro(__android_stl_inc lang dir req)
+ if(EXISTS "${dir}")
+ list(APPEND CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES "${dir}")
+ elseif(${req})
+ message(FATAL_ERROR
+ "Android: STL '${CMAKE_ANDROID_STL_TYPE}' include directory not found:\n"
+ " ${dir}"
+ )
+ endif()
+ endmacro()
+
+ macro(__android_stl_lib lang lib req)
+ if(CMAKE_ANDROID_ARCH_ABI MATCHES "^armeabi" AND NOT CMAKE_ANDROID_ARM_MODE)
+ get_filename_component(_ANDROID_STL_LIBDIR "${lib}" DIRECTORY)
+ get_filename_component(_ANDROID_STL_LIBNAME "${lib}" NAME)
+ set(_ANDROID_STL_LIBTHUMB "${_ANDROID_STL_LIBDIR}/thumb/${_ANDROID_STL_LIBNAME}")
+ unset(_ANDROID_STL_LIBDIR)
+ unset(_ANDROID_STL_LIBNAME)
+ else()
+ set(_ANDROID_STL_LIBTHUMB "")
+ endif()
+
+ if(_ANDROID_STL_LIBTHUMB AND EXISTS "${_ANDROID_STL_LIBTHUMB}")
+ string(APPEND CMAKE_${lang}_STANDARD_LIBRARIES " \"${_ANDROID_STL_LIBTHUMB}\"")
+ elseif(EXISTS "${lib}")
+ string(APPEND CMAKE_${lang}_STANDARD_LIBRARIES " \"${lib}\"")
+ elseif(${req})
+ message(FATAL_ERROR
+ "Android: STL '${CMAKE_ANDROID_STL_TYPE}' library file not found:\n"
+ " ${lib}"
+ )
+ endif()
+
+ unset(_ANDROID_STL_LIBTHUMB)
+ endmacro()
+
+ include(Platform/Android/ndk-stl-${CMAKE_ANDROID_STL_TYPE})
+ else()
+ macro(__android_stl lang)
+ endmacro()
+ endif()
+else()
+ macro(__android_stl lang)
+ endmacro()
+endif()
+
+# The NDK toolchain configuration files at:
+#
+# <ndk>/[build/core/]toolchains/*/setup.mk
+#
+# contain logic to set TARGET_CFLAGS and TARGET_LDFLAGS (and debug/release
+# variants) to tell their build system what flags to pass for each ABI.
+# We need to produce the same flags here to produce compatible binaries.
+# We initialize these variables here and set them in the compiler-specific
+# modules that include this one. Then we use them in the macro below when
+# it is called.
+set(_ANDROID_ABI_INIT_CFLAGS "")
+set(_ANDROID_ABI_INIT_CFLAGS_DEBUG "")
+set(_ANDROID_ABI_INIT_CFLAGS_RELEASE "")
+set(_ANDROID_ABI_INIT_LDFLAGS "")
+
+macro(__android_compiler_common lang)
+ if(_ANDROID_ABI_INIT_CFLAGS)
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_ANDROID_ABI_INIT_CFLAGS}")
+ endif()
+ if(_ANDROID_ABI_INIT_CFLAGS_DEBUG)
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " ${_ANDROID_ABI_INIT_CFLAGS_DEBUG}")
+ endif()
+ if(_ANDROID_ABI_INIT_CFLAGS_RELEASE)
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " ${_ANDROID_ABI_INIT_CFLAGS_RELEASE}")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " ${_ANDROID_ABI_INIT_CFLAGS_RELEASE}")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " ${_ANDROID_ABI_INIT_CFLAGS_RELEASE}")
+ endif()
+ if(_ANDROID_ABI_INIT_LDFLAGS)
+ foreach(t EXE SHARED MODULE)
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " ${_ANDROID_ABI_INIT_LDFLAGS}")
+ endforeach()
+ endif()
+
+ if(DEFINED _ANDROID_STL_EXCEPTIONS)
+ if(_ANDROID_STL_EXCEPTIONS)
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " -fexceptions")
+ else()
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " -fno-exceptions")
+ endif()
+ endif()
+
+ if("x${lang}" STREQUAL "xCXX" AND DEFINED _ANDROID_STL_RTTI)
+ if(_ANDROID_STL_RTTI)
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " -frtti")
+ else()
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " -fno-rtti")
+ endif()
+ endif()
+
+ if("x${lang}" STREQUAL "xCXX")
+ __android_stl(CXX)
+ endif()
+endmacro()
diff --git a/Modules/Platform/Android-Determine-C.cmake b/Modules/Platform/Android-Determine-C.cmake
new file mode 100644
index 0000000..c7d1d15
--- /dev/null
+++ b/Modules/Platform/Android-Determine-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Android/Determine-Compiler)
+__android_determine_compiler(C)
diff --git a/Modules/Platform/Android-Determine-CXX.cmake b/Modules/Platform/Android-Determine-CXX.cmake
new file mode 100644
index 0000000..3a3de88
--- /dev/null
+++ b/Modules/Platform/Android-Determine-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Android/Determine-Compiler)
+__android_determine_compiler(CXX)
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake
new file mode 100644
index 0000000..0a89c58
--- /dev/null
+++ b/Modules/Platform/Android-Determine.cmake
@@ -0,0 +1,301 @@
+#=============================================================================
+# Copyright 2015-2016 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.)
+
+# When CMAKE_SYSTEM_NAME is "Android", CMakeDetermineSystem loads this module.
+# This module detects platform-wide information about the Android target
+# in order to store it in "CMakeSystem.cmake".
+
+# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
+# implemented in the CMake VS IDE generators. Avoid interfering with
+# that functionality for now. Later we may try to integrate this.
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ return()
+endif()
+
+# Commonly used Android toolchain files that pre-date CMake upstream support
+# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
+if(CMAKE_SYSTEM_VERSION EQUAL 1)
+ return()
+endif()
+
+# If the user provided CMAKE_SYSROOT for us, extract information from it.
+set(_ANDROID_SYSROOT_NDK "")
+set(_ANDROID_SYSROOT_API "")
+set(_ANDROID_SYSROOT_ARCH "")
+set(_ANDROID_SYSROOT_STANDALONE_TOOLCHAIN "")
+if(CMAKE_SYSROOT)
+ if(NOT IS_DIRECTORY "${CMAKE_SYSROOT}")
+ message(FATAL_ERROR
+ "Android: The specified CMAKE_SYSROOT:\n"
+ " ${CMAKE_SYSROOT}\n"
+ "is not an existing directory."
+ )
+ endif()
+ if(CMAKE_SYSROOT MATCHES "^([^\\\n]*)/platforms/android-([0-9]+)/arch-([a-z0-9_]+)$")
+ set(_ANDROID_SYSROOT_NDK "${CMAKE_MATCH_1}")
+ set(_ANDROID_SYSROOT_API "${CMAKE_MATCH_2}")
+ set(_ANDROID_SYSROOT_ARCH "${CMAKE_MATCH_3}")
+ elseif(CMAKE_SYSROOT MATCHES "^([^\\\n]*)/sysroot$")
+ set(_ANDROID_SYSROOT_STANDALONE_TOOLCHAIN "${CMAKE_MATCH_1}")
+ else()
+ message(FATAL_ERROR
+ "The value of CMAKE_SYSROOT:\n"
+ " ${CMAKE_SYSROOT}\n"
+ "does not match any of the forms:\n"
+ " <ndk>/platforms/android-<api>/arch-<arch>\n"
+ " <standalone-toolchain>/sysroot\n"
+ "where:\n"
+ " <ndk> = Android NDK directory (with forward slashes)\n"
+ " <api> = Android API version number (decimal digits)\n"
+ " <arch> = Android ARCH name (lower case)\n"
+ " <standalone-toolchain> = Path to standalone toolchain prefix\n"
+ )
+ endif()
+endif()
+
+# Find the Android NDK.
+if(CMAKE_ANDROID_NDK)
+ if(NOT IS_DIRECTORY "${CMAKE_ANDROID_NDK}")
+ message(FATAL_ERROR
+ "Android: The NDK root directory specified by CMAKE_ANDROID_NDK:\n"
+ " ${CMAKE_ANDROID_NDK}\n"
+ "does not exist."
+ )
+ endif()
+elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
+ if(NOT IS_DIRECTORY "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}")
+ message(FATAL_ERROR
+ "Android: The standalone toolchain directory specified by CMAKE_ANDROID_STANDALONE_TOOLCHAIN:\n"
+ " ${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}\n"
+ "does not exist."
+ )
+ endif()
+ if(NOT EXISTS "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/sysroot/usr/include/android/api-level.h")
+ message(FATAL_ERROR
+ "Android: The standalone toolchain directory specified by CMAKE_ANDROID_STANDALONE_TOOLCHAIN:\n"
+ " ${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}\n"
+ "does not contain a sysroot with a known layout. The file:\n"
+ " ${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/sysroot/usr/include/android/api-level.h\n"
+ "does not exist."
+ )
+ endif()
+else()
+ if(IS_DIRECTORY "${_ANDROID_SYSROOT_NDK}")
+ set(CMAKE_ANDROID_NDK "${_ANDROID_SYSROOT_NDK}")
+ elseif(IS_DIRECTORY "${_ANDROID_SYSROOT_STANDALONE_TOOLCHAIN}")
+ set(CMAKE_ANDROID_STANDALONE_TOOLCHAIN "${_ANDROID_SYSROOT_STANDALONE_TOOLCHAIN}")
+ elseif(IS_DIRECTORY "${ANDROID_NDK}")
+ file(TO_CMAKE_PATH "${ANDROID_NDK}" CMAKE_ANDROID_NDK)
+ elseif(IS_DIRECTORY "${ANDROID_STANDALONE_TOOLCHAIN}")
+ file(TO_CMAKE_PATH "${ANDROID_STANDALONE_TOOLCHAIN}" CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
+ elseif(IS_DIRECTORY "$ENV{ANDROID_NDK_ROOT}")
+ file(TO_CMAKE_PATH "$ENV{ANDROID_NDK_ROOT}" CMAKE_ANDROID_NDK)
+ elseif(IS_DIRECTORY "$ENV{ANDROID_NDK}")
+ file(TO_CMAKE_PATH "$ENV{ANDROID_NDK}" CMAKE_ANDROID_NDK)
+ elseif(IS_DIRECTORY "$ENV{ANDROID_STANDALONE_TOOLCHAIN}")
+ file(TO_CMAKE_PATH "$ENV{ANDROID_STANDALONE_TOOLCHAIN}" CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
+ endif()
+ # TODO: Search harder for the NDK or standalone toolchain.
+endif()
+
+set(_ANDROID_STANDALONE_TOOLCHAIN_API "")
+if(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
+ set(_ANDROID_API_LEVEL_H_REGEX "^[\t ]*#[\t ]*define[\t ]+__ANDROID_API__[\t ]+([0-9]+)")
+ file(STRINGS "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/sysroot/usr/include/android/api-level.h"
+ _ANDROID_API_LEVEL_H_CONTENT REGEX "${_ANDROID_API_LEVEL_H_REGEX}")
+ if(_ANDROID_API_LEVEL_H_CONTENT MATCHES "${_ANDROID_API_LEVEL_H_REGEX}")
+ set(_ANDROID_STANDALONE_TOOLCHAIN_API "${CMAKE_MATCH_1}")
+ endif()
+endif()
+
+if(NOT CMAKE_ANDROID_NDK AND NOT CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
+ message(FATAL_ERROR "Android: Neither the NDK or a standalone toolchain was found.")
+endif()
+
+# Select an API.
+if(CMAKE_SYSTEM_VERSION)
+ set(_ANDROID_API_VAR CMAKE_SYSTEM_VERSION)
+elseif(CMAKE_ANDROID_API)
+ set(CMAKE_SYSTEM_VERSION "${CMAKE_ANDROID_API}")
+ set(_ANDROID_API_VAR CMAKE_ANDROID_API)
+elseif(_ANDROID_SYSROOT_API)
+ set(CMAKE_SYSTEM_VERSION "${_ANDROID_SYSROOT_API}")
+ set(_ANDROID_API_VAR CMAKE_SYSROOT)
+elseif(_ANDROID_STANDALONE_TOOLCHAIN_API)
+ set(CMAKE_SYSTEM_VERSION "${_ANDROID_STANDALONE_TOOLCHAIN_API}")
+endif()
+if(CMAKE_SYSTEM_VERSION)
+ if(CMAKE_ANDROID_API AND NOT "x${CMAKE_ANDROID_API}" STREQUAL "x${CMAKE_SYSTEM_VERSION}")
+ message(FATAL_ERROR
+ "Android: The API specified by CMAKE_ANDROID_API='${CMAKE_ANDROID_API}' is not consistent with CMAKE_SYSTEM_VERSION='${CMAKE_SYSTEM_VERSION}'."
+ )
+ endif()
+ if(_ANDROID_SYSROOT_API)
+ foreach(v CMAKE_ANDROID_API CMAKE_SYSTEM_VERSION)
+ if(${v} AND NOT "x${_ANDROID_SYSROOT_API}" STREQUAL "x${${v}}")
+ message(FATAL_ERROR
+ "Android: The API specified by ${v}='${${v}}' is not consistent with CMAKE_SYSROOT:\n"
+ " ${CMAKE_SYSROOT}"
+ )
+ endif()
+ endforeach()
+ endif()
+ if(CMAKE_ANDROID_NDK AND NOT IS_DIRECTORY "${CMAKE_ANDROID_NDK}/platforms/android-${CMAKE_SYSTEM_VERSION}")
+ message(FATAL_ERROR
+ "Android: The API specified by ${_ANDROID_API_VAR}='${${_ANDROID_API_VAR}}' does not exist in the NDK. "
+ "The directory:\n"
+ " ${CMAKE_ANDROID_NDK}/platforms/android-${CMAKE_SYSTEM_VERSION}\n"
+ "does not exist."
+ )
+ endif()
+elseif(CMAKE_ANDROID_NDK)
+ file(GLOB _ANDROID_APIS_1 RELATIVE "${CMAKE_ANDROID_NDK}/platforms" "${CMAKE_ANDROID_NDK}/platforms/android-[0-9]")
+ file(GLOB _ANDROID_APIS_2 RELATIVE "${CMAKE_ANDROID_NDK}/platforms" "${CMAKE_ANDROID_NDK}/platforms/android-[0-9][0-9]")
+ list(SORT _ANDROID_APIS_1)
+ list(SORT _ANDROID_APIS_2)
+ set(_ANDROID_APIS ${_ANDROID_APIS_1} ${_ANDROID_APIS_2})
+ unset(_ANDROID_APIS_1)
+ unset(_ANDROID_APIS_2)
+ if(_ANDROID_APIS STREQUAL "")
+ message(FATAL_ERROR
+ "Android: No APIs found in the NDK. No\n"
+ " ${CMAKE_ANDROID_NDK}/platforms/android-*\n"
+ "directories exist."
+ )
+ endif()
+ string(REPLACE "android-" "" _ANDROID_APIS "${_ANDROID_APIS}")
+ list(REVERSE _ANDROID_APIS)
+ list(GET _ANDROID_APIS 0 CMAKE_SYSTEM_VERSION)
+ unset(_ANDROID_APIS)
+endif()
+if(NOT CMAKE_SYSTEM_VERSION MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "Android: The API specified by CMAKE_SYSTEM_VERSION='${CMAKE_SYSTEM_VERSION}' is not an integer.")
+endif()
+
+# https://developer.android.com/ndk/guides/abis.html
+
+set(_ANDROID_ABI_arm64-v8a_PROC "aarch64")
+set(_ANDROID_ABI_arm64-v8a_ARCH "arm64")
+set(_ANDROID_ABI_armeabi-v7a_PROC "armv7-a")
+set(_ANDROID_ABI_armeabi-v7a_ARCH "arm")
+set(_ANDROID_ABI_armeabi-v6_PROC "armv6")
+set(_ANDROID_ABI_armeabi-v6_ARCH "arm")
+set(_ANDROID_ABI_armeabi_PROC "armv5te")
+set(_ANDROID_ABI_armeabi_ARCH "arm")
+set(_ANDROID_ABI_mips_PROC "mips")
+set(_ANDROID_ABI_mips_ARCH "mips")
+set(_ANDROID_ABI_mips64_PROC "mips64")
+set(_ANDROID_ABI_mips64_ARCH "mips64")
+set(_ANDROID_ABI_x86_PROC "i686")
+set(_ANDROID_ABI_x86_ARCH "x86")
+set(_ANDROID_ABI_x86_64_PROC "x86_64")
+set(_ANDROID_ABI_x86_64_ARCH "x86_64")
+
+set(_ANDROID_PROC_aarch64_ARCH_ABI "arm64-v8a")
+set(_ANDROID_PROC_armv7-a_ARCH_ABI "armeabi-v7a")
+set(_ANDROID_PROC_armv6_ARCH_ABI "armeabi-v6")
+set(_ANDROID_PROC_armv5te_ARCH_ABI "armeabi")
+set(_ANDROID_PROC_i686_ARCH_ABI "x86")
+set(_ANDROID_PROC_mips_ARCH_ABI "mips")
+set(_ANDROID_PROC_mips64_ARCH_ABI "mips64")
+set(_ANDROID_PROC_x86_64_ARCH_ABI "x86_64")
+
+set(_ANDROID_ARCH_arm64_ABI "arm64-v8a")
+set(_ANDROID_ARCH_arm_ABI "armeabi")
+set(_ANDROID_ARCH_mips_ABI "mips")
+set(_ANDROID_ARCH_mips64_ABI "mips64")
+set(_ANDROID_ARCH_x86_ABI "x86")
+set(_ANDROID_ARCH_x86_64_ABI "x86_64")
+
+# Validate inputs.
+if(CMAKE_ANDROID_ARCH_ABI AND NOT DEFINED "_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC")
+ message(FATAL_ERROR "Android: Unknown ABI CMAKE_ANDROID_ARCH_ABI='${CMAKE_ANDROID_ARCH_ABI}'.")
+endif()
+if(CMAKE_SYSTEM_PROCESSOR AND NOT DEFINED "_ANDROID_PROC_${CMAKE_SYSTEM_PROCESSOR}_ARCH_ABI")
+ message(FATAL_ERROR "Android: Unknown processor CMAKE_SYSTEM_PROCESSOR='${CMAKE_SYSTEM_PROCESSOR}'.")
+endif()
+if(_ANDROID_SYSROOT_ARCH AND NOT DEFINED "_ANDROID_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI")
+ message(FATAL_ERROR
+ "Android: Unknown architecture '${_ANDROID_SYSROOT_ARCH}' specified in CMAKE_SYSROOT:\n"
+ " ${CMAKE_SYSROOT}"
+ )
+endif()
+
+# Select an ABI.
+if(NOT CMAKE_ANDROID_ARCH_ABI)
+ if(CMAKE_SYSTEM_PROCESSOR)
+ set(CMAKE_ANDROID_ARCH_ABI "${_ANDROID_PROC_${CMAKE_SYSTEM_PROCESSOR}_ARCH_ABI}")
+ elseif(_ANDROID_SYSROOT_ARCH)
+ set(CMAKE_ANDROID_ARCH_ABI "${_ANDROID_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI}")
+ else()
+ # https://developer.android.com/ndk/guides/application_mk.html
+ # Default is the oldest ARM ABI.
+ set(CMAKE_ANDROID_ARCH_ABI "armeabi")
+ endif()
+endif()
+set(CMAKE_ANDROID_ARCH "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_ARCH}")
+if(_ANDROID_SYSROOT_ARCH AND NOT "x${_ANDROID_SYSROOT_ARCH}" STREQUAL "x${CMAKE_ANDROID_ARCH}")
+ message(FATAL_ERROR
+ "Android: Architecture '${_ANDROID_SYSROOT_ARCH}' specified in CMAKE_SYSROOT:\n"
+ " ${CMAKE_SYSROOT}\n"
+ "does not match architecture '${CMAKE_ANDROID_ARCH}' for the ABI '${CMAKE_ANDROID_ARCH_ABI}'."
+ )
+endif()
+
+# Select a processor.
+if(NOT CMAKE_SYSTEM_PROCESSOR)
+ set(CMAKE_SYSTEM_PROCESSOR "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC}")
+endif()
+
+# If the user specified both an ABI and a processor then they might not match.
+if(NOT _ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC STREQUAL CMAKE_SYSTEM_PROCESSOR)
+ message(FATAL_ERROR "Android: The specified CMAKE_ANDROID_ARCH_ABI='${CMAKE_ANDROID_ARCH_ABI}' and CMAKE_SYSTEM_PROCESSOR='${CMAKE_SYSTEM_PROCESSOR}' is not a valid combination.")
+endif()
+
+# Save the Android-specific information in CMakeSystem.cmake.
+set(CMAKE_SYSTEM_CUSTOM_CODE "
+set(CMAKE_ANDROID_NDK \"${CMAKE_ANDROID_NDK}\")
+set(CMAKE_ANDROID_STANDALONE_TOOLCHAIN \"${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}\")
+set(CMAKE_ANDROID_ARCH \"${CMAKE_ANDROID_ARCH}\")
+set(CMAKE_ANDROID_ARCH_ABI \"${CMAKE_ANDROID_ARCH_ABI}\")
+")
+
+# Select an ARM variant.
+if(CMAKE_ANDROID_ARCH_ABI MATCHES "^armeabi")
+ if(CMAKE_ANDROID_ARM_MODE)
+ set(CMAKE_ANDROID_ARM_MODE 1)
+ else()
+ set(CMAKE_ANDROID_ARM_MODE 0)
+ endif()
+ string(APPEND CMAKE_SYSTEM_CUSTOM_CODE
+ "set(CMAKE_ANDROID_ARM_MODE \"${CMAKE_ANDROID_ARM_MODE}\")\n"
+ )
+elseif(DEFINED CMAKE_ANDROID_ARM_MODE)
+ message(FATAL_ERROR "Android: CMAKE_ANDROID_ARM_MODE is set but is valid only for 'armeabi' architectures.")
+endif()
+
+if(CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
+ if(CMAKE_ANDROID_ARM_NEON)
+ set(CMAKE_ANDROID_ARM_NEON 1)
+ else()
+ set(CMAKE_ANDROID_ARM_NEON 0)
+ endif()
+ string(APPEND CMAKE_SYSTEM_CUSTOM_CODE
+ "set(CMAKE_ANDROID_ARM_NEON \"${CMAKE_ANDROID_ARM_NEON}\")\n"
+ )
+elseif(DEFINED CMAKE_ANDROID_ARM_NEON)
+ message(FATAL_ERROR "Android: CMAKE_ANDROID_ARM_NEON is set but is valid only for 'armeabi-v7a' architecture.")
+endif()
+
+# Report the chosen architecture.
+message(STATUS "Android: Targeting API '${CMAKE_SYSTEM_VERSION}' with architecture '${CMAKE_ANDROID_ARCH}', ABI '${CMAKE_ANDROID_ARCH_ABI}', and processor '${CMAKE_SYSTEM_PROCESSOR}'")
diff --git a/Modules/Platform/Android-GNU-C.cmake b/Modules/Platform/Android-GNU-C.cmake
new file mode 100644
index 0000000..78a6a50
--- /dev/null
+++ b/Modules/Platform/Android-GNU-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Android-GNU)
+__android_compiler_gnu(C)
diff --git a/Modules/Platform/Android-GNU-CXX.cmake b/Modules/Platform/Android-GNU-CXX.cmake
new file mode 100644
index 0000000..41279d1
--- /dev/null
+++ b/Modules/Platform/Android-GNU-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Android-GNU)
+__android_compiler_gnu(CXX)
diff --git a/Modules/Platform/Android-GNU.cmake b/Modules/Platform/Android-GNU.cmake
new file mode 100644
index 0000000..58943d0
--- /dev/null
+++ b/Modules/Platform/Android-GNU.cmake
@@ -0,0 +1,43 @@
+#=============================================================================
+# Copyright 2015-2016 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(__ANDROID_COMPILER_GNU)
+ return()
+endif()
+set(__ANDROID_COMPILER_GNU 1)
+
+# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
+# implemented in the CMake VS IDE generators. Avoid interfering with
+# that functionality for now. Later we may try to integrate this.
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ macro(__android_compiler_gnu lang)
+ endmacro()
+ return()
+endif()
+
+# Commonly used Android toolchain files that pre-date CMake upstream support
+# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
+if(CMAKE_SYSTEM_VERSION EQUAL 1)
+ macro(__android_compiler_gnu lang)
+ endmacro()
+ return()
+endif()
+
+include(Platform/Android-Common)
+
+include(Platform/Android/abi-${CMAKE_ANDROID_ARCH_ABI}-GNU)
+
+macro(__android_compiler_gnu lang)
+ __android_compiler_common(${lang})
+endmacro()
diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake
new file mode 100644
index 0000000..353dd0d
--- /dev/null
+++ b/Modules/Platform/Android-Initialize.cmake
@@ -0,0 +1,51 @@
+#=============================================================================
+# Copyright 2015-2016 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.)
+
+# When CMAKE_SYSTEM_NAME is "Android", CMakeSystemSpecificInitialize loads this
+# module.
+
+# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
+# implemented in the CMake VS IDE generators. Avoid interfering with
+# that functionality for now. Later we may try to integrate this.
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ return()
+endif()
+
+# Commonly used Android toolchain files that pre-date CMake upstream support
+# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
+if(CMAKE_SYSTEM_VERSION EQUAL 1)
+ return()
+endif()
+
+if(NOT CMAKE_SYSROOT)
+ if(CMAKE_ANDROID_NDK)
+ set(CMAKE_SYSROOT "${CMAKE_ANDROID_NDK}/platforms/android-${CMAKE_SYSTEM_VERSION}/arch-${CMAKE_ANDROID_ARCH}")
+ elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
+ set(CMAKE_SYSROOT "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/sysroot")
+ endif()
+endif()
+
+if(CMAKE_SYSROOT)
+ if(NOT IS_DIRECTORY "${CMAKE_SYSROOT}")
+ message(FATAL_ERROR
+ "Android: The system root directory needed for the selected Android version and architecture does not exist:\n"
+ " ${CMAKE_SYSROOT}\n"
+ )
+ endif()
+else()
+ message(FATAL_ERROR
+ "Android: No CMAKE_SYSROOT was selected."
+ )
+endif()
+
+set(CMAKE_BUILD_TYPE_INIT Debug)
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
index 1bdad04..3d69733 100644
--- a/Modules/Platform/Android.cmake
+++ b/Modules/Platform/Android.cmake
@@ -1,5 +1,7 @@
include(Platform/Linux)
+set(ANDROID 1)
+
# Android has soname, but binary names must end in ".so" so we cannot append
# a version number. Also we cannot portably represent symlinks on the host.
set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1)
diff --git a/Modules/Platform/Android/Determine-Compiler-NDK.cmake b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
new file mode 100644
index 0000000..8bd0de9
--- /dev/null
+++ b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
@@ -0,0 +1,256 @@
+#=============================================================================
+# Copyright 2015-2016 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.)
+
+# In Android NDK releases there is build system toolchain selection logic in
+# these files:
+#
+# * <ndk>/build/core/init.mk
+# * <ndk>/build/core/setup-toolchain.mk
+# * <ndk>/[build/core/]toolchains/<toolchain>/{config.mk,setup.mk}
+#
+# We parse information out of the ``config.mk`` and ``setup.mk`` files below.
+#
+# There is also a "toolchains" directory with the prebuilt toolchains themselves:
+#
+# * <triple-or-arch>-<gcc-version>/prebuilt/<host>/bin/<triple>-gcc(.exe)?
+# The gcc compiler to be invoked.
+#
+# * llvm*/prebuilt/<host>/bin/clang
+# The clang compiler to be invoked with flags:
+# -target <triple>
+# -gcc-toolchain <ndk>/toolchains/<triple-or-arch>-<gcc-version>
+
+# Glob available toolchains in the NDK, restricted by any version request.
+if(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION STREQUAL "clang")
+ set(_ANDROID_TOOL_PATTERNS "*-clang" "*-clang[0-9].[0-9]")
+elseif(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION)
+ if(NOT CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION MATCHES "^(clang)?[0-9]\\.[0-9]$")
+ message(FATAL_ERROR
+ "Android: The CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION value '${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}' "
+ "is not one of the allowed forms:\n"
+ " <major>.<minor> = GCC of specified version\n"
+ " clang<major>.<minor> = Clang of specified version\n"
+ " clang = Clang of most recent available version\n"
+ )
+ endif()
+ set(_ANDROID_TOOL_PATTERNS "*-${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}")
+else()
+ set(_ANDROID_TOOL_PATTERNS "*-[0-9].[0-9]")
+endif()
+set(_ANDROID_CONFIG_MK_PATTERNS)
+foreach(base "build/core/toolchains" "toolchains")
+ foreach(pattern IN LISTS _ANDROID_TOOL_PATTERNS)
+ list(APPEND _ANDROID_CONFIG_MK_PATTERNS
+ "${CMAKE_ANDROID_NDK}/${base}/${pattern}/config.mk"
+ )
+ endforeach()
+endforeach()
+unset(_ANDROID_TOOL_PATTERNS)
+file(GLOB _ANDROID_CONFIG_MKS ${_ANDROID_CONFIG_MK_PATTERNS})
+unset(_ANDROID_CONFIG_MK_PATTERNS)
+
+# Find the newest toolchain version matching the ABI.
+set(_ANDROID_TOOL_NAME "")
+set(_ANDROID_TOOL_VERS 0)
+set(_ANDROID_TOOL_SETUP_MK "")
+foreach(config_mk IN LISTS _ANDROID_CONFIG_MKS)
+ # Check that the toolchain matches the ABI.
+ file(STRINGS "${config_mk}" _ANDROID_TOOL_ABIS REGEX "^TOOLCHAIN_ABIS :=.* ${CMAKE_ANDROID_ARCH_ABI}( |$)")
+ if(NOT _ANDROID_TOOL_ABIS)
+ continue()
+ endif()
+ unset(_ANDROID_TOOL_ABIS)
+
+ # Check the version.
+ if("${config_mk}" MATCHES [[/([^/]+-(clang)?([0-9]\.[0-9]|))/config.mk$]])
+ set(_ANDROID_CUR_NAME "${CMAKE_MATCH_1}")
+ set(_ANDROID_CUR_VERS "${CMAKE_MATCH_3}")
+ if(_ANDROID_TOOL_VERS STREQUAL "")
+ # already the latest possible
+ elseif(_ANDROID_CUR_VERS STREQUAL "" OR _ANDROID_CUR_VERS VERSION_GREATER _ANDROID_TOOL_VERS)
+ set(_ANDROID_TOOL_NAME "${_ANDROID_CUR_NAME}")
+ set(_ANDROID_TOOL_VERS "${_ANDROID_CUR_VERS}")
+ string(REPLACE "/config.mk" "/setup.mk" _ANDROID_TOOL_SETUP_MK "${config_mk}")
+ endif()
+ unset(_ANDROID_CUR_TOOL)
+ unset(_ANDROID_CUR_VERS)
+ endif()
+endforeach()
+
+# Verify that we have a suitable toolchain.
+if(NOT _ANDROID_TOOL_NAME)
+ if(_ANDROID_CONFIG_MKS)
+ string(REPLACE ";" "\n " _ANDROID_TOOLS_MSG "after considering:;${_ANDROID_CONFIG_MKS}")
+ else()
+ set(_ANDROID_TOOLS_MSG "")
+ endif()
+ if(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION)
+ string(CONCAT _ANDROID_TOOLS_MSG
+ "of the version specified by CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION:\n"
+ " ${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}\n"
+ "${_ANDROID_TOOLS_MSG}")
+ endif()
+ message(FATAL_ERROR
+ "Android: No toolchain for ABI '${CMAKE_ANDROID_ARCH_ABI}' found in the NDK:\n"
+ " ${CMAKE_ANDROID_NDK}\n"
+ "${_ANDROID_TOOLS_MSG}"
+ )
+endif()
+unset(_ANDROID_CONFIG_MKS)
+
+# For clang toolchains we still need to find a gcc toolchain.
+if(_ANDROID_TOOL_NAME MATCHES "-clang")
+ set(_ANDROID_TOOL_CLANG_NAME "${_ANDROID_TOOL_NAME}")
+ set(_ANDROID_TOOL_CLANG_VERS "${_ANDROID_TOOL_VERS}")
+ set(_ANDROID_TOOL_NAME "")
+ set(_ANDROID_TOOL_VERS "")
+else()
+ set(_ANDROID_TOOL_CLANG_NAME "")
+ set(_ANDROID_TOOL_CLANG_VERS "")
+endif()
+
+# Parse the toolchain setup.mk file to extract information we need.
+# Their content is not standardized across toolchains or NDK versions,
+# so we match known cases. Note that the parsing is stateful across
+# lines because we need to substitute for some Make variable references.
+if(CMAKE_ANDROID_NDK_TOOLCHAIN_DEBUG)
+ message(STATUS "loading: ${_ANDROID_TOOL_SETUP_MK}")
+endif()
+file(STRINGS "${_ANDROID_TOOL_SETUP_MK}" _ANDROID_TOOL_SETUP REGEX "^(LLVM|TOOLCHAIN)_[A-Z_]+ +:= +.*$")
+unset(_ANDROID_TOOL_SETUP_MK)
+set(_ANDROID_TOOL_PREFIX "")
+set(_ANDROID_TOOL_NAME_ONLY "")
+set(_ANDROID_TOOL_LLVM_NAME "")
+set(_ANDROID_TOOL_LLVM_VERS "")
+foreach(line IN LISTS _ANDROID_TOOL_SETUP)
+ if(CMAKE_ANDROID_NDK_TOOLCHAIN_DEBUG)
+ message(STATUS "setup.mk: ${line}")
+ endif()
+
+ if(line MATCHES [[^TOOLCHAIN_PREFIX +:= +.*/bin/([^$/ ]*) *$]])
+ # We just matched the toolchain prefix with no Make variable references.
+ set(_ANDROID_TOOL_PREFIX "${CMAKE_MATCH_1}")
+ elseif(_ANDROID_TOOL_CLANG_NAME)
+ # For clang toolchains we need to find more information.
+ if(line MATCHES [[^TOOLCHAIN_VERSION +:= +([0-9.]+) *$]])
+ # We just matched the gcc toolchain version number. Save it for later.
+ set(_ANDROID_TOOL_VERS "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^TOOLCHAIN_NAME +:= +(.*\$\(TOOLCHAIN_VERSION\)) *$]])
+ # We just matched the gcc toolchain name with a version number placeholder, so substitute it.
+ # The gcc toolchain version number will have already been extracted from a TOOLCHAIN_VERSION line.
+ string(REPLACE "$(TOOLCHAIN_VERSION)" "${_ANDROID_TOOL_VERS}" _ANDROID_TOOL_NAME "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^TOOLCHAIN_NAME +:= +([^$/ ]+) *$]])
+ # We just matched the gcc toolchain name without version number. Save it for later.
+ set(_ANDROID_TOOL_NAME_ONLY "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^TOOLCHAIN_PREFIX +:= +.*/bin/(\$\(TOOLCHAIN_NAME\)-) *$]])
+ # We just matched the toolchain prefix with a name placholder, so substitute it.
+ # The gcc toolchain name will have already been extracted without version number from a TOOLCHAIN_NAME line.
+ string(REPLACE "$(TOOLCHAIN_NAME)" "${_ANDROID_TOOL_NAME_ONLY}" _ANDROID_TOOL_PREFIX "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^LLVM_VERSION +:= +([0-9.]+)$]])
+ # We just matched the llvm prebuilt binary toolchain version number. Save it for later.
+ set(_ANDROID_TOOL_LLVM_VERS "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^LLVM_NAME +:= +(llvm-\$\(LLVM_VERSION\)) *$]])
+ # We just matched the llvm prebuilt binary toolchain directory name with a version number placeholder,
+ # so substitute it. The llvm prebuilt binary toolchain version number will have already been extracted
+ # from a LLVM_VERSION line.
+ string(REPLACE "$(LLVM_VERSION)" "${_ANDROID_TOOL_LLVM_VERS}" _ANDROID_TOOL_LLVM_NAME "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^LLVM_TOOLCHAIN_PREBUILT_ROOT +:= +\$\(call get-toolchain-root.*,([^$ ]+)\) *$]])
+ # We just matched the llvm prebuilt binary toolchain directory name.
+ set(_ANDROID_TOOL_LLVM_NAME "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^TOOLCHAIN_ROOT +:= +\$\(call get-toolchain-root.*,(\$\(TOOLCHAIN_NAME\)-[0-9.]+)\) *$]])
+ # We just matched a placeholder for the name followed by a version number.
+ # The gcc toolchain name will have already been extracted without version number from a TOOLCHAIN_NAME line.
+ # Substitute for the placeholder to get the full gcc toolchain name.
+ string(REPLACE "$(TOOLCHAIN_NAME)" "${_ANDROID_TOOL_NAME_ONLY}" _ANDROID_TOOL_NAME "${CMAKE_MATCH_1}")
+ elseif(line MATCHES [[^TOOLCHAIN_ROOT +:= +\$\(call get-toolchain-root.*,([^$ ]+)\) *$]])
+ # We just matched the full gcc toolchain name without placeholder.
+ set(_ANDROID_TOOL_NAME "${CMAKE_MATCH_1}")
+ endif()
+ endif()
+endforeach()
+unset(_ANDROID_TOOL_NAME_ONLY)
+unset(_ANDROID_TOOL_LLVM_VERS)
+unset(_ANDROID_TOOL_SETUP)
+
+# Fall back to parsing the version and prefix from the tool name.
+if(NOT _ANDROID_TOOL_VERS AND "${_ANDROID_TOOL_NAME}" MATCHES "-([0-9.]+)$")
+ set(_ANDROID_TOOL_VERS "${CMAKE_MATCH_1}")
+endif()
+if(NOT _ANDROID_TOOL_PREFIX AND "${_ANDROID_TOOL_NAME}" MATCHES "^(.*-)[0-9.]+$")
+ set(_ANDROID_TOOL_PREFIX "${CMAKE_MATCH_1}")
+endif()
+
+# Identify the host platform.
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ set(_ANDROID_HOST_DIR "darwin-x86_64")
+ else()
+ set(_ANDROID_HOST_DIR "darwin-x86")
+ endif()
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
+ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ set(_ANDROID_HOST_DIR "linux-x86_64")
+ else()
+ set(_ANDROID_HOST_DIR "linux-x86")
+ endif()
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
+ set(_ANDROID_HOST_DIR "windows-x86_64")
+ else()
+ set(_ANDROID_HOST_DIR "windows")
+ endif()
+else()
+ message(FATAL_ERROR "Android: Builds hosted on '${CMAKE_HOST_SYSTEM_NAME}' not supported.")
+endif()
+
+# Help CMakeFindBinUtils locate things.
+set(_CMAKE_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_PREFIX}")
+
+set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "${_ANDROID_TOOL_VERS}")
+set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "${CMAKE_ANDROID_NDK}/toolchains/${_ANDROID_TOOL_NAME}/prebuilt/${_ANDROID_HOST_DIR}/bin/${_ANDROID_TOOL_PREFIX}")
+set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "${_ANDROID_HOST_EXT}")
+
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "${_ANDROID_TOOL_C_TOOLCHAIN_VERSION}")
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}")
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}")
+
+if(_ANDROID_TOOL_CLANG_NAME)
+ message(STATUS "Android: Selected Clang toolchain '${_ANDROID_TOOL_CLANG_NAME}' with GCC toolchain '${_ANDROID_TOOL_NAME}'")
+ set(_ANDROID_TOOL_C_COMPILER "${CMAKE_ANDROID_NDK}/toolchains/${_ANDROID_TOOL_LLVM_NAME}/prebuilt/${_ANDROID_HOST_DIR}/bin/clang${_ANDROID_HOST_EXT}")
+ set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN ${CMAKE_ANDROID_NDK}/toolchains/${_ANDROID_TOOL_NAME}/prebuilt/${_ANDROID_HOST_DIR})
+ set(_ANDROID_TOOL_CXX_COMPILER "${CMAKE_ANDROID_NDK}/toolchains/${_ANDROID_TOOL_LLVM_NAME}/prebuilt/${_ANDROID_HOST_DIR}/bin/clang++${_ANDROID_HOST_EXT}")
+ set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN}")
+else()
+ message(STATUS "Android: Selected GCC toolchain '${_ANDROID_TOOL_NAME}'")
+ set(_ANDROID_TOOL_C_COMPILER "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}gcc${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}")
+ set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN "")
+ set(_ANDROID_TOOL_CXX_COMPILER "${_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX}g++${_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX}")
+ set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "")
+endif()
+
+if(CMAKE_ANDROID_NDK_TOOLCHAIN_DEBUG)
+ message(STATUS "_ANDROID_TOOL_NAME=${_ANDROID_TOOL_NAME}")
+ message(STATUS "_ANDROID_TOOL_VERS=${_ANDROID_TOOL_VERS}")
+ message(STATUS "_ANDROID_TOOL_PREFIX=${_ANDROID_TOOL_PREFIX}")
+ message(STATUS "_ANDROID_TOOL_CLANG_NAME=${_ANDROID_TOOL_CLANG_NAME}")
+ message(STATUS "_ANDROID_TOOL_CLANG_VERS=${_ANDROID_TOOL_CLANG_VERS}")
+ message(STATUS "_ANDROID_TOOL_LLVM_NAME=${_ANDROID_TOOL_LLVM_NAME}")
+endif()
+
+unset(_ANDROID_TOOL_NAME)
+unset(_ANDROID_TOOL_VERS)
+unset(_ANDROID_TOOL_PREFIX)
+unset(_ANDROID_TOOL_CLANG_NAME)
+unset(_ANDROID_TOOL_CLANG_VERS)
+unset(_ANDROID_TOOL_LLVM_NAME)
+unset(_ANDROID_HOST_DIR)
diff --git a/Modules/Platform/Android/Determine-Compiler-Standalone.cmake b/Modules/Platform/Android/Determine-Compiler-Standalone.cmake
new file mode 100644
index 0000000..64d4ccf
--- /dev/null
+++ b/Modules/Platform/Android/Determine-Compiler-Standalone.cmake
@@ -0,0 +1,69 @@
+#=============================================================================
+# Copyright 2015-2016 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.)
+
+set(_ANDROID_TOOL_C_COMPILER "")
+set(_ANDROID_TOOL_CXX_COMPILER "")
+set(_ANDROID_TOOL_PREFIX "")
+file(GLOB _gcc "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/*-gcc${_ANDROID_HOST_EXT}")
+foreach(gcc IN LISTS _gcc)
+ if("${gcc}" MATCHES "/bin/([^/]*)gcc${_ANDROID_HOST_EXT}$")
+ set(_ANDROID_TOOL_PREFIX "${CMAKE_MATCH_1}")
+ break()
+ endif()
+endforeach()
+
+if(NOT _ANDROID_TOOL_PREFIX)
+ message(FATAL_ERROR
+ "Android: No '*-gcc' compiler found in CMAKE_ANDROID_STANDALONE_TOOLCHAIN:\n"
+ " ${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}"
+ )
+endif()
+
+# Help CMakeFindBinUtils locate things.
+set(_CMAKE_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_PREFIX}")
+
+execute_process(
+ COMMAND "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/${_ANDROID_TOOL_PREFIX}gcc${_ANDROID_HOST_EXT}" -dumpversion
+ OUTPUT_VARIABLE _gcc_version
+ ERROR_VARIABLE _gcc_error
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+if(_gcc_version MATCHES "^([0-9]+\\.[0-9]+)")
+ set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "${CMAKE_MATCH_1}")
+else()
+ message(FATAL_ERROR
+ "Android: Failed to extract the standalone toolchain version. The command:\n"
+ " '${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/${_ANDROID_TOOL_PREFIX}gcc${_ANDROID_HOST_EXT}' '-dumpversion'\n"
+ "produced output:\n"
+ " ${_gcc_version}\n"
+ )
+endif()
+
+set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/${_ANDROID_TOOL_PREFIX}")
+set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "${_ANDROID_HOST_EXT}")
+
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "${_ANDROID_TOOL_C_TOOLCHAIN_VERSION}")
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}")
+set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}")
+
+if(EXISTS "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/clang${_ANDROID_HOST_EXT}")
+ set(_ANDROID_TOOL_C_COMPILER "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/clang${_ANDROID_HOST_EXT}")
+ set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}")
+ set(_ANDROID_TOOL_CXX_COMPILER "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/clang++${_ANDROID_HOST_EXT}")
+ set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}")
+else()
+ set(_ANDROID_TOOL_C_COMPILER "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}gcc${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}")
+ set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN "")
+ set(_ANDROID_TOOL_CXX_COMPILER "${_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX}g++${_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX}")
+ set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "")
+endif()
diff --git a/Modules/Platform/Android/Determine-Compiler.cmake b/Modules/Platform/Android/Determine-Compiler.cmake
new file mode 100644
index 0000000..65223dc
--- /dev/null
+++ b/Modules/Platform/Android/Determine-Compiler.cmake
@@ -0,0 +1,80 @@
+#=============================================================================
+# Copyright 2015-2016 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(__ANDROID_DETERMINE_COMPILER)
+ return()
+endif()
+set(__ANDROID_DETERMINE_COMPILER 1)
+
+# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
+# implemented in the CMake VS IDE generators. Avoid interfering with
+# that functionality for now. Later we may try to integrate this.
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ macro(__android_determine_compiler lang)
+ endmacro()
+ return()
+endif()
+
+# Commonly used Android toolchain files that pre-date CMake upstream support
+# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
+if(CMAKE_SYSTEM_VERSION EQUAL 1)
+ macro(__android_determine_compiler lang)
+ endmacro()
+ return()
+endif()
+
+# Identify the host platform.
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ set(_ANDROID_HOST_EXT "")
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
+ set(_ANDROID_HOST_EXT "")
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ set(_ANDROID_HOST_EXT ".exe")
+else()
+ message(FATAL_ERROR "Android: Builds hosted on '${CMAKE_HOST_SYSTEM_NAME}' not supported.")
+endif()
+
+if(CMAKE_ANDROID_NDK)
+ include(Platform/Android/Determine-Compiler-NDK)
+elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
+ include(Platform/Android/Determine-Compiler-Standalone)
+else()
+ set(_ANDROID_TOOL_C_COMPILER "")
+ set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "")
+ set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN "")
+ set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "")
+ set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "")
+ set(_ANDROID_TOOL_CXX_COMPILER "")
+ set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "")
+ set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "")
+ set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "")
+ set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "")
+endif()
+
+unset(_ANDROID_HOST_EXT)
+
+macro(__android_determine_compiler lang)
+ if(_ANDROID_TOOL_${lang}_COMPILER)
+ set(CMAKE_${lang}_COMPILER "${_ANDROID_TOOL_${lang}_COMPILER}")
+ set(CMAKE_${lang}_COMPILER_EXTERNAL_TOOLCHAIN "${_ANDROID_TOOL_${lang}_COMPILER_EXTERNAL_TOOLCHAIN}")
+
+ # Save the Android-specific information in CMake${lang}Compiler.cmake.
+ set(CMAKE_${lang}_COMPILER_CUSTOM_CODE "
+set(CMAKE_${lang}_ANDROID_TOOLCHAIN_VERSION \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_VERSION}\")
+set(CMAKE_${lang}_COMPILER_EXTERNAL_TOOLCHAIN \"${_ANDROID_TOOL_${lang}_COMPILER_EXTERNAL_TOOLCHAIN}\")
+set(CMAKE_${lang}_ANDROID_TOOLCHAIN_PREFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_PREFIX}\")
+set(CMAKE_${lang}_ANDROID_TOOLCHAIN_SUFFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_SUFFIX}\")
+")
+ endif()
+endmacro()
diff --git a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
new file mode 100644
index 0000000..3ff1fe5
--- /dev/null
+++ b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
@@ -0,0 +1,8 @@
+# <ndk>/build/core/toolchains/aarch64-linux-android-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "aarch64-none-linux-android")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake b/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake
new file mode 100644
index 0000000..538ec2f
--- /dev/null
+++ b/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake
@@ -0,0 +1,6 @@
+# <ndk>/build/core/toolchains/aarch64-linux-android-4.9/setup.mk
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/abi-armeabi-Clang.cmake b/Modules/Platform/Android/abi-armeabi-Clang.cmake
new file mode 100644
index 0000000..4fc3009
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-Clang.cmake
@@ -0,0 +1,20 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "armv5te-none-linux-androideabi")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv5te"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -msoft-float"
+ " -mtune=xscale"
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-armeabi-GNU.cmake b/Modules/Platform/Android/abi-armeabi-GNU.cmake
new file mode 100644
index 0000000..10cac00
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-GNU.cmake
@@ -0,0 +1,18 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-4.9/setup.mk
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv5te"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -msoft-float"
+ " -mtune=xscale"
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
new file mode 100644
index 0000000..15f1d4a
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
@@ -0,0 +1,19 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "armv6-none-linux-androideabi")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv6"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -mfloat-abi=softfp"
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake b/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake
new file mode 100644
index 0000000..7492de0
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake
@@ -0,0 +1,17 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-4.9/setup.mk
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv6"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -mfloat-abi=softfp"
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake
new file mode 100644
index 0000000..3a3efb3
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake
@@ -0,0 +1,29 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "armv7-none-linux-androideabi")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv7-a"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+if(CMAKE_ANDROID_ARM_NEON)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfpu=neon")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfpu=vfpv3-d16")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_LDFLAGS
+ " -Wl,--fix-cortex-a8"
+ )
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -mfloat-abi=softfp"
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake b/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake
new file mode 100644
index 0000000..d27e37e
--- /dev/null
+++ b/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake
@@ -0,0 +1,27 @@
+# <ndk>/build/core/toolchains/arm-linux-androideabi-4.9/setup.mk
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -march=armv7-a"
+ )
+
+if(CMAKE_ANDROID_ARM_MODE)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -marm")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mthumb")
+endif()
+
+if(CMAKE_ANDROID_ARM_NEON)
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfpu=neon")
+else()
+ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfpu=vfpv3-d16")
+endif()
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -mfloat-abi=softfp"
+ " -fpic"
+ )
+
+string(APPEND _ANDROID_ABI_INIT_LDFLAGS
+ " -Wl,--fix-cortex-a8"
+ )
+
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/abi-common-Clang.cmake b/Modules/Platform/Android/abi-common-Clang.cmake
new file mode 100644
index 0000000..6025170
--- /dev/null
+++ b/Modules/Platform/Android/abi-common-Clang.cmake
@@ -0,0 +1,6 @@
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ #" -Wno-invalid-command-line-argument"
+ #" -Wno-unused-command-line-argument"
+ )
+
+include(Platform/Android/abi-common)
diff --git a/Modules/Platform/Android/abi-common-GNU.cmake b/Modules/Platform/Android/abi-common-GNU.cmake
new file mode 100644
index 0000000..40d829f
--- /dev/null
+++ b/Modules/Platform/Android/abi-common-GNU.cmake
@@ -0,0 +1 @@
+include(Platform/Android/abi-common)
diff --git a/Modules/Platform/Android/abi-common.cmake b/Modules/Platform/Android/abi-common.cmake
new file mode 100644
index 0000000..12d8e5c
--- /dev/null
+++ b/Modules/Platform/Android/abi-common.cmake
@@ -0,0 +1,4 @@
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -funwind-tables"
+ " -no-canonical-prefixes"
+ )
diff --git a/Modules/Platform/Android/abi-mips-Clang.cmake b/Modules/Platform/Android/abi-mips-Clang.cmake
new file mode 100644
index 0000000..bf6b9fc
--- /dev/null
+++ b/Modules/Platform/Android/abi-mips-Clang.cmake
@@ -0,0 +1,8 @@
+# <ndk>/build/core/toolchains/mipsel-linux-android-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "mipsel-none-linux-android")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-mips-GNU.cmake b/Modules/Platform/Android/abi-mips-GNU.cmake
new file mode 100644
index 0000000..d380440
--- /dev/null
+++ b/Modules/Platform/Android/abi-mips-GNU.cmake
@@ -0,0 +1,6 @@
+# <ndk>/build/core/toolchains/mipsel-linux-android-4.9/setup.mk
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/abi-mips64-Clang.cmake b/Modules/Platform/Android/abi-mips64-Clang.cmake
new file mode 100644
index 0000000..1a94107
--- /dev/null
+++ b/Modules/Platform/Android/abi-mips64-Clang.cmake
@@ -0,0 +1,8 @@
+# <ndk>/build/core/toolchains/mips64el-linux-android-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "mips64el-none-linux-android")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-mips64-GNU.cmake b/Modules/Platform/Android/abi-mips64-GNU.cmake
new file mode 100644
index 0000000..4525d40
--- /dev/null
+++ b/Modules/Platform/Android/abi-mips64-GNU.cmake
@@ -0,0 +1,6 @@
+# <ndk>/build/core/toolchains/mips64el-linux-android-4.9/setup.mk
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -fpic"
+ )
+
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/abi-x86-Clang.cmake b/Modules/Platform/Android/abi-x86-Clang.cmake
new file mode 100644
index 0000000..f63ed36
--- /dev/null
+++ b/Modules/Platform/Android/abi-x86-Clang.cmake
@@ -0,0 +1,8 @@
+# <ndk>/build/core/toolchains/x86-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "i686-none-linux-android")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -fPIC"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-x86-GNU.cmake b/Modules/Platform/Android/abi-x86-GNU.cmake
new file mode 100644
index 0000000..76ea5ca
--- /dev/null
+++ b/Modules/Platform/Android/abi-x86-GNU.cmake
@@ -0,0 +1,2 @@
+# <ndk>/build/core/toolchains/x86-4.9/setup.mk
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/abi-x86_64-Clang.cmake b/Modules/Platform/Android/abi-x86_64-Clang.cmake
new file mode 100644
index 0000000..c15042b
--- /dev/null
+++ b/Modules/Platform/Android/abi-x86_64-Clang.cmake
@@ -0,0 +1,8 @@
+# <ndk>/build/core/toolchains/x86_64-clang/setup.mk
+set(_ANDROID_ABI_CLANG_TARGET "x86_64-none-linux-android")
+
+string(APPEND _ANDROID_ABI_INIT_CFLAGS
+ " -fPIC"
+ )
+
+include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-x86_64-GNU.cmake b/Modules/Platform/Android/abi-x86_64-GNU.cmake
new file mode 100644
index 0000000..441bdcd
--- /dev/null
+++ b/Modules/Platform/Android/abi-x86_64-GNU.cmake
@@ -0,0 +1,2 @@
+# <ndk>/build/core/toolchains/x86_64-4.9/setup.mk
+include(Platform/Android/abi-common-GNU)
diff --git a/Modules/Platform/Android/ndk-stl-c++.cmake b/Modules/Platform/Android/ndk-stl-c++.cmake
new file mode 100644
index 0000000..14748a1
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-c++.cmake
@@ -0,0 +1,13 @@
+# <ndk>/sources/cxx-stl/llvm-libc++/Android.mk
+set(_ANDROID_STL_RTTI 1)
+set(_ANDROID_STL_EXCEPTIONS 1)
+macro(__android_stl_cxx lang filename)
+ # Add the include directory.
+ __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx/include" 1)
+
+ # Add a secondary include directory if it exists.
+ __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/android/support/include" 0)
+
+ # Add the library file.
+ __android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${CMAKE_ANDROID_ARCH_ABI}/${filename}" 1)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-c++_shared.cmake b/Modules/Platform/Android/ndk-stl-c++_shared.cmake
new file mode 100644
index 0000000..f585adb
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-c++_shared.cmake
@@ -0,0 +1,4 @@
+include(Platform/Android/ndk-stl-c++)
+macro(__android_stl lang)
+ __android_stl_cxx(${lang} libc++_shared.so)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-c++_static.cmake b/Modules/Platform/Android/ndk-stl-c++_static.cmake
new file mode 100644
index 0000000..8e562f8
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-c++_static.cmake
@@ -0,0 +1,6 @@
+include(Platform/Android/ndk-stl-c++)
+macro(__android_stl lang)
+ __android_stl_cxx(${lang} libc++_static.a)
+ __android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${CMAKE_ANDROID_ARCH_ABI}/libc++abi.a" 0)
+ __android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${CMAKE_ANDROID_ARCH_ABI}/libandroid_support.a" 0)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-gabi++.cmake b/Modules/Platform/Android/ndk-stl-gabi++.cmake
new file mode 100644
index 0000000..850a47a
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-gabi++.cmake
@@ -0,0 +1,7 @@
+# <ndk>/sources/cxx-stl/gabi++/Android.mk
+set(_ANDROID_STL_RTTI 1)
+set(_ANDROID_STL_EXCEPTIONS 1)
+macro(__android_stl_gabixx lang filename)
+ __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/gabi++/include" 1)
+ __android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/gabi++/libs/${CMAKE_ANDROID_ARCH_ABI}/${filename}" 1)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-gabi++_shared.cmake b/Modules/Platform/Android/ndk-stl-gabi++_shared.cmake
new file mode 100644
index 0000000..314c1e0
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-gabi++_shared.cmake
@@ -0,0 +1,4 @@
+include(Platform/Android/ndk-stl-gabi++)
+macro(__android_stl lang)
+ __android_stl_gabixx(${lang} libgabi++_shared.so)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-gabi++_static.cmake b/Modules/Platform/Android/ndk-stl-gabi++_static.cmake
new file mode 100644
index 0000000..f4a1d3c
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-gabi++_static.cmake
@@ -0,0 +1,4 @@
+include(Platform/Android/ndk-stl-gabi++)
+macro(__android_stl lang)
+ __android_stl_gabixx(${lang} libgabi++_static.a)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-gnustl.cmake b/Modules/Platform/Android/ndk-stl-gnustl.cmake
new file mode 100644
index 0000000..b3226ee
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-gnustl.cmake
@@ -0,0 +1,9 @@
+# <ndk>/sources/cxx-stl/gnu-libstdc++/Android.mk
+set(_ANDROID_STL_RTTI 1)
+set(_ANDROID_STL_EXCEPTIONS 1)
+macro(__android_stl_gnustl lang filename)
+ __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${CMAKE_${lang}_ANDROID_TOOLCHAIN_VERSION}/include" 1)
+ __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${CMAKE_${lang}_ANDROID_TOOLCHAIN_VERSION}/libs/${CMAKE_ANDROID_ARCH_ABI}/include" 1)
+ __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${CMAKE_${lang}_ANDROID_TOOLCHAIN_VERSION}/include/backward" 1)
+ __android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${CMAKE_${lang}_ANDROID_TOOLCHAIN_VERSION}/libs/${CMAKE_ANDROID_ARCH_ABI}/${filename}" 1)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-gnustl_shared.cmake b/Modules/Platform/Android/ndk-stl-gnustl_shared.cmake
new file mode 100644
index 0000000..f20cc4d
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-gnustl_shared.cmake
@@ -0,0 +1,4 @@
+include(Platform/Android/ndk-stl-gnustl)
+macro(__android_stl lang)
+ __android_stl_gnustl(${lang} libgnustl_shared.so)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-gnustl_static.cmake b/Modules/Platform/Android/ndk-stl-gnustl_static.cmake
new file mode 100644
index 0000000..af4cc2a
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-gnustl_static.cmake
@@ -0,0 +1,4 @@
+include(Platform/Android/ndk-stl-gnustl)
+macro(__android_stl lang)
+ __android_stl_gnustl(${lang} libgnustl_static.a)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-none.cmake b/Modules/Platform/Android/ndk-stl-none.cmake
new file mode 100644
index 0000000..9049c91
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-none.cmake
@@ -0,0 +1,2 @@
+macro(__android_stl lang)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-stlport.cmake b/Modules/Platform/Android/ndk-stl-stlport.cmake
new file mode 100644
index 0000000..eab6b94
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-stlport.cmake
@@ -0,0 +1,7 @@
+# <ndk>/sources/cxx-stl/stlport/Android.mk
+set(_ANDROID_STL_RTTI 1)
+set(_ANDROID_STL_EXCEPTIONS 1)
+macro(__android_stl_stlport lang filename)
+ __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/stlport/stlport" 1)
+ __android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/stlport/libs/${CMAKE_ANDROID_ARCH_ABI}/${filename}" 1)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-stlport_shared.cmake b/Modules/Platform/Android/ndk-stl-stlport_shared.cmake
new file mode 100644
index 0000000..2b5846b
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-stlport_shared.cmake
@@ -0,0 +1,4 @@
+include(Platform/Android/ndk-stl-stlport)
+macro(__android_stl lang)
+ __android_stl_stlport(${lang} libstlport_shared.so)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-stlport_static.cmake b/Modules/Platform/Android/ndk-stl-stlport_static.cmake
new file mode 100644
index 0000000..bf60307
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-stlport_static.cmake
@@ -0,0 +1,4 @@
+include(Platform/Android/ndk-stl-stlport)
+macro(__android_stl lang)
+ __android_stl_stlport(${lang} libstlport_static.a)
+endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-system.cmake b/Modules/Platform/Android/ndk-stl-system.cmake
new file mode 100644
index 0000000..dd554fe
--- /dev/null
+++ b/Modules/Platform/Android/ndk-stl-system.cmake
@@ -0,0 +1,6 @@
+# <ndk>/android-ndk-r11c/sources/cxx-stl/system/Android.mk
+set(_ANDROID_STL_RTTI 0)
+set(_ANDROID_STL_EXCEPTIONS 0)
+macro(__android_stl lang)
+ __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/system/include" 1)
+endmacro()
diff --git a/Modules/Platform/BlueGeneQ-base.cmake b/Modules/Platform/BlueGeneQ-base.cmake
index 9372166..dc066b7 100644
--- a/Modules/Platform/BlueGeneQ-base.cmake
+++ b/Modules/Platform/BlueGeneQ-base.cmake
@@ -110,7 +110,7 @@ macro(__BlueGeneQ_common_setup compiler_id lang)
# to do the same thing as the MPI compilers, which add these flags.
set(BGQ_SYSTEM_INCLUDES "")
foreach(dir ${CMAKE_SYSTEM_INCLUDE_PATH})
- set(BGQ_SYSTEM_INCLUDES "${BGQ_SYSTEM_INCLUDES} -I${dir}")
+ string(APPEND BGQ_SYSTEM_INCLUDES " -I${dir}")
endforeach()
set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${BGQ_SYSTEM_INCLUDES} <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${BGQ_SYSTEM_INCLUDES} <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/Platform/Windows-CXX.cmake b/Modules/Platform/CYGWIN-Determine-CXX.cmake
index bf37f79..bf37f79 100644
--- a/Modules/Platform/Windows-CXX.cmake
+++ b/Modules/Platform/CYGWIN-Determine-CXX.cmake
diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake
index 1a46c10..5090c08 100644
--- a/Modules/Platform/CYGWIN-GNU.cmake
+++ b/Modules/Platform/CYGWIN-GNU.cmake
@@ -19,7 +19,7 @@ endif()
set(__CYGWIN_COMPILER_GNU 1)
# TODO: Is -Wl,--enable-auto-import now always default?
-set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--enable-auto-import")
+string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,--enable-auto-import")
set(CMAKE_CREATE_WIN32_EXE "-mwindows")
set(CMAKE_GNULD_IMAGE_VERSION
diff --git a/Modules/Platform/Darwin-CXX.cmake b/Modules/Platform/Darwin-Determine-CXX.cmake
index bf37f79..bf37f79 100644
--- a/Modules/Platform/Darwin-CXX.cmake
+++ b/Modules/Platform/Darwin-Determine-CXX.cmake
diff --git a/Modules/Platform/Generic-ADSP-C.cmake b/Modules/Platform/Generic-ADSP-C.cmake
index 4b9ed9d..de1cee2 100644
--- a/Modules/Platform/Generic-ADSP-C.cmake
+++ b/Modules/Platform/Generic-ADSP-C.cmake
@@ -4,10 +4,10 @@ include(Platform/Generic-ADSP-Common)
set(CMAKE_C_OUTPUT_EXTENSION ".doj")
-set(CMAKE_C_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_C_FLAGS_MINSIZEREL_INIT "")
-set(CMAKE_C_FLAGS_RELEASE_INIT "")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "")
+string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " ")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ")
+string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " ")
set(CMAKE_C_CREATE_STATIC_LIBRARY
"<CMAKE_C_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_C_LINK_FLAGS> <OBJECTS>")
diff --git a/Modules/Platform/Generic-ADSP-CXX.cmake b/Modules/Platform/Generic-ADSP-CXX.cmake
index 9673aef..0cde8f2 100644
--- a/Modules/Platform/Generic-ADSP-CXX.cmake
+++ b/Modules/Platform/Generic-ADSP-CXX.cmake
@@ -2,10 +2,10 @@ include(Platform/Generic-ADSP-Common)
set(CMAKE_CXX_OUTPUT_EXTENSION ".doj")
-set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "")
-set(CMAKE_CXX_FLAGS_RELEASE_INIT "")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "")
+string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " ")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ")
+string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " ")
set(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_CXX_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_CXX_LINK_FLAGS> <OBJECTS>")
diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake
index a1ca812..bbefe19 100644
--- a/Modules/Platform/Generic-SDCC-C.cmake
+++ b/Modules/Platform/Generic-SDCC-C.cmake
@@ -30,7 +30,7 @@ set(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE)
# CMAKE_C_FLAGS_INIT and CMAKE_EXE_LINKER_FLAGS_INIT should be set in a CMAKE_SYSTEM_PROCESSOR file
if(NOT DEFINED CMAKE_C_FLAGS_INIT)
- set(CMAKE_C_FLAGS_INIT "-mmcs51 --model-small")
+ string(APPEND CMAKE_C_FLAGS_INIT " -mmcs51 --model-small")
endif()
if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT)
diff --git a/Modules/Platform/HP-UX-GNU-CXX.cmake b/Modules/Platform/HP-UX-GNU-CXX.cmake
index 689bed0..ac72560 100644
--- a/Modules/Platform/HP-UX-GNU-CXX.cmake
+++ b/Modules/Platform/HP-UX-GNU-CXX.cmake
@@ -1,2 +1,3 @@
include(Platform/HP-UX-GNU)
__hpux_compiler_gnu(CXX)
+unset(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN)
diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake
index 6c71784..cbd8164 100644
--- a/Modules/Platform/HP-UX-GNU.cmake
+++ b/Modules/Platform/HP-UX-GNU.cmake
@@ -26,4 +26,5 @@ macro(__hpux_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h")
set(CMAKE_${lang}_LINK_FLAGS "-Wl,+s,+nodefaultrpath")
+ unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY)
endmacro()
diff --git a/Modules/Platform/HP-UX-HP-CXX.cmake b/Modules/Platform/HP-UX-HP-CXX.cmake
index 6d90191..d37d2b0 100644
--- a/Modules/Platform/HP-UX-HP-CXX.cmake
+++ b/Modules/Platform/HP-UX-HP-CXX.cmake
@@ -8,7 +8,7 @@ set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE
"rm -f `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.o"
)
-set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
-set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "+O3 -DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELEASE_INIT "+O2 -DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g")
+string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " +O3 -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " +O2 -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -g")
diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake
index 3935c31..398d6fb 100644
--- a/Modules/Platform/HP-UX-HP.cmake
+++ b/Modules/Platform/HP-UX-HP.cmake
@@ -27,7 +27,7 @@ macro(__hpux_compiler_hp lang)
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h")
- set(CMAKE_${lang}_FLAGS_INIT "")
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
set(CMAKE_${lang}_LINK_FLAGS "-Wl,+s,+nodefaultrpath")
endmacro()
diff --git a/Modules/Platform/Linux-CXX.cmake b/Modules/Platform/Linux-Determine-CXX.cmake
index b594dae..b594dae 100644
--- a/Modules/Platform/Linux-CXX.cmake
+++ b/Modules/Platform/Linux-Determine-CXX.cmake
diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake
index 0c9523c..d8e94d0 100644
--- a/Modules/Platform/Linux-Intel-Fortran.cmake
+++ b/Modules/Platform/Linux-Intel-Fortran.cmake
@@ -1,4 +1,4 @@
include(Platform/Linux-Intel)
__linux_compiler_intel(Fortran)
-set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -nofor_main")
+string(APPEND CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS " -nofor_main")
set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "")
diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
index e40a74f..1f8c1b4 100644
--- a/Modules/Platform/Linux.cmake
+++ b/Modules/Platform/Linux.cmake
@@ -50,8 +50,9 @@ set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_
include(Platform/UnixPaths)
-# Debian has lib64 paths only for compatibility so they should not be
+# Debian has lib32 and lib64 paths only for compatibility so they should not be
# searched.
if(NOT CMAKE_CROSSCOMPILING AND EXISTS "/etc/debian_version")
+ set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS FALSE)
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
endif()
diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake
index 7ac6c7e..6466a0a 100644
--- a/Modules/Platform/OpenBSD.cmake
+++ b/Modules/Platform/OpenBSD.cmake
@@ -18,6 +18,7 @@ endif()
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1)
# OpenBSD has no multilib
+set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS FALSE)
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
# OpenBSD policy requires that shared libraries be installed without
diff --git a/Modules/Platform/SCO_SV.cmake b/Modules/Platform/SCO_SV.cmake
index ddd9600..1cb4b38 100644
--- a/Modules/Platform/SCO_SV.cmake
+++ b/Modules/Platform/SCO_SV.cmake
@@ -1,2 +1,3 @@
set(CMAKE_DL_LIBS "")
+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h,")
include(Platform/UnixPaths)
diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
index 20ee1d1..d6c3d41 100644
--- a/Modules/Platform/UnixPaths.cmake
+++ b/Modules/Platform/UnixPaths.cmake
@@ -93,5 +93,6 @@ list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
/usr/include
)
-# Enable use of lib64 search path variants by default.
+# Enable use of lib32 and lib64 search path variants by default.
+set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE)
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
diff --git a/Modules/Platform/CYGWIN-CXX.cmake b/Modules/Platform/Windows-Determine-CXX.cmake
index bf37f79..bf37f79 100644
--- a/Modules/Platform/CYGWIN-CXX.cmake
+++ b/Modules/Platform/Windows-Determine-CXX.cmake
diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake
index 102e3a6..43ae2a3 100644
--- a/Modules/Platform/Windows-Embarcadero.cmake
+++ b/Modules/Platform/Windows-Embarcadero.cmake
@@ -64,15 +64,11 @@ set(CMAKE_CREATE_CONSOLE_EXE "${_tC}" )
set (CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.")
-set (CMAKE_EXE_LINKER_FLAGS_INIT "${_tM} -lS:1048576 -lSc:4098 -lH:1048576 -lHc:8192 ")
-set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v")
-set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v")
-set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
-set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
-set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
-set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT})
+foreach(t EXE SHARED MODULE)
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " ${_tM} -lS:1048576 -lSc:4098 -lH:1048576 -lHc:8192 ")
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_DEBUG_INIT " -v")
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_RELWITHDEBINFO_INIT " -v")
+endforeach()
# The Borland link tool does not support multiple concurrent
# invocations within a single working directory.
@@ -132,10 +128,10 @@ macro(__embarcadero_language lang)
)
# Initial configuration flags.
- set(CMAKE_${lang}_FLAGS_INIT "${_tM}")
- set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-Od -v")
- set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG")
- set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
- set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-Od")
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_tM}")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -Od -v")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O1 -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O2 -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -Od")
set(CMAKE_${lang}_STANDARD_LIBRARIES_INIT "import32.lib")
endmacro()
diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake
index 1b93db8..3981a09 100644
--- a/Modules/Platform/Windows-Intel-Fortran.cmake
+++ b/Modules/Platform/Windows-Intel-Fortran.cmake
@@ -4,8 +4,8 @@ set(_COMPILE_Fortran " /fpp")
set(CMAKE_Fortran_MODDIR_FLAG "-module:")
set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib")
__windows_compiler_intel(Fortran)
-set (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads")
-set (CMAKE_Fortran_FLAGS_DEBUG_INIT "/Od /debug:full /dbglibs")
-set (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O1 /DNDEBUG")
-set (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O2 /DNDEBUG")
-set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /debug:full /DNDEBUG")
+string(APPEND CMAKE_Fortran_FLAGS_INIT " /W1 /nologo /fpp /libs:dll /threads")
+string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " /Od /debug:full /dbglibs")
+string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " /O1 /DNDEBUG")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " /O2 /DNDEBUG")
+string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " /O2 /debug:full /DNDEBUG")
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 6c254ed..723c69e 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -166,10 +166,12 @@ if(WINCE)
endforeach()
set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib")
- set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib")
+ foreach(t EXE SHARED MODULE)
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib")
+ endforeach()
if (MSVC_VERSION LESS 1600)
- set(CMAKE_C_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT} corelibc.lib")
+ string(APPEND CMAKE_C_STANDARD_LIBRARIES_INIT " corelibc.lib")
endif ()
elseif(WINDOWS_PHONE OR WINDOWS_STORE)
set(_PLATFORM_DEFINES "/DWIN32")
@@ -235,9 +237,6 @@ elseif(MSVC_CXX_ARCHITECTURE_ID)
elseif(MSVC_Fortran_ARCHITECTURE_ID)
set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}")
endif()
-set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}")
-set(CMAKE_STATIC_LINKER_FLAGS_INIT "${CMAKE_STATIC_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}")
-unset(_MACHINE_ARCH_FLAG)
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
# on versions that support it
@@ -250,30 +249,22 @@ if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE)
endif()
endif()
-if (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
- set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
- set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
-else ()
- set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}")
- set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}")
-endif ()
-# for release and minsize release default to no incremental linking
-set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO")
-set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO")
-
-# copy the EXE_LINKER flags to SHARED and MODULE linker flags
-# shared linker flags
-set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
-# module linker flags
-set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
-set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
-set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
-set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
-set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
+foreach(t EXE SHARED MODULE)
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " ${_MACHINE_ARCH_FLAG}")
+ if (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_DEBUG_INIT " /debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_RELWITHDEBINFO_INIT " /debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
+ else ()
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_DEBUG_INIT " /debug ${MSVC_INCREMENTAL_YES_FLAG}")
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_RELWITHDEBINFO_INIT " /debug ${MSVC_INCREMENTAL_YES_FLAG}")
+ endif ()
+ # for release and minsize release default to no incremental linking
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_MINSIZEREL_INIT " /INCREMENTAL:NO")
+ string(APPEND CMAKE_${t}_LINKER_FLAGS_RELEASE_INIT " /INCREMENTAL:NO")
+endforeach()
+
+string(APPEND CMAKE_STATIC_LINKER_FLAGS_INIT " ${_MACHINE_ARCH_FLAG}")
+unset(_MACHINE_ARCH_FLAG)
macro(__windows_compiler_msvc lang)
if(NOT MSVC_VERSION LESS 1400)
@@ -298,20 +289,23 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_${lang}_LINK_EXECUTABLE
"${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
- if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*")
- # note: MSVC 14 2015 Update 1 sets -fno-ms-compatibility by default, but this does not allow one to compile many projects
- # that include MS's own headers. CMake itself is affected project too.
- set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS -Wall${_FLAGS_${lang}}")
- set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-D_DEBUG /MDd -gline-tables-only -fno-inline -O0 ${_RTC1}")
- set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD -O2 -DNDEBUG")
- set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD -gline-tables-only -O2 -fno-inline -DNDEBUG")
- set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD -DNDEBUG") # TODO: Add '-Os' once VS generator maps it properly for Clang
- else()
- set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}")
- set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
- set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /DNDEBUG")
- set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /DNDEBUG")
- set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /DNDEBUG")
+ if("x${lang}" STREQUAL "xC" OR
+ "x${lang}" STREQUAL "xCXX")
+ if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*")
+ # note: MSVC 14 2015 Update 1 sets -fno-ms-compatibility by default, but this does not allow one to compile many projects
+ # that include MS's own headers. CMake itself is affected project too.
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS -Wall${_FLAGS_${lang}}")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -D_DEBUG /MDd -gline-tables-only -fno-inline -O0 ${_RTC1}")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " /MD -O2 -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " /MD -gline-tables-only -O2 -fno-inline -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " /MD -DNDEBUG") # TODO: Add '-Os' once VS generator maps it properly for Clang
+ else()
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " /D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " /MD /O2 /Ob2 /DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " /MD /Zi /O2 /Ob1 /DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " /MD /O1 /Ob1 /DNDEBUG")
+ endif()
endif()
set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON)
set(CMAKE_NINJA_DEPTYPE_${lang} msvc)
@@ -320,7 +314,7 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_RC_COMPILER_INIT rc)
endif()
if(NOT CMAKE_RC_FLAGS_INIT)
- set(CMAKE_RC_FLAGS_INIT "${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}")
+ string(APPEND CMAKE_RC_FLAGS_INIT " ${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}")
endif()
enable_language(RC)
diff --git a/Modules/Platform/Windows-OpenWatcom-C.cmake b/Modules/Platform/Windows-OpenWatcom-C.cmake
new file mode 100644
index 0000000..ce9bc45
--- /dev/null
+++ b/Modules/Platform/Windows-OpenWatcom-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-OpenWatcom)
diff --git a/Modules/Platform/Windows-OpenWatcom-CXX.cmake b/Modules/Platform/Windows-OpenWatcom-CXX.cmake
new file mode 100644
index 0000000..ce9bc45
--- /dev/null
+++ b/Modules/Platform/Windows-OpenWatcom-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-OpenWatcom)
diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-OpenWatcom.cmake
index 3bc5444..7419fe4 100644
--- a/Modules/Platform/Windows-wcl386.cmake
+++ b/Modules/Platform/Windows-OpenWatcom.cmake
@@ -1,3 +1,23 @@
+
+#=============================================================================
+# Copyright 2002-2016 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_OPENWATCOM)
+ return()
+endif()
+set(__WINDOWS_OPENWATCOM 1)
+
set(CMAKE_LIBRARY_PATH_FLAG "libpath ")
set(CMAKE_LINK_LIBRARY_FLAG "library ")
set(CMAKE_LINK_LIBRARY_FILE_FLAG "library")
@@ -12,14 +32,14 @@ else()
set(CMAKE_LIB_QUIET "-q")
endif()
-set(CMAKE_EXE_LINKER_FLAGS_INIT)
+string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ")
set(CMAKE_CREATE_WIN32_EXE "system nt_win" )
set(CMAKE_CREATE_CONSOLE_EXE "system nt" )
-set(CMAKE_SHARED_LINKER_FLAGS_INIT "system nt_dll")
-set(CMAKE_MODULE_LINKER_FLAGS_INIT "system nt_dll")
+string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system nt_dll")
+string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system nt_dll")
foreach(type SHARED MODULE EXE)
- set(CMAKE_${type}_LINKER_FLAGS_DEBUG_INIT "debug all opt map")
- set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all opt map")
+ string(APPEND CMAKE_${type}_LINKER_FLAGS_DEBUG_INIT " debug all opt map")
+ string(APPEND CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO_INIT " debug all opt map")
endforeach()
set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list
@@ -32,13 +52,13 @@ set(CMAKE_BUILD_TYPE_INIT Debug)
# single/multi-threaded /-bm
# static/DLL run-time libraries /-br
# default is setup for multi-threaded + DLL run-time libraries
-set (CMAKE_C_FLAGS_INIT "-bt=nt -w3 -dWIN32 -br -bm")
-set (CMAKE_CXX_FLAGS_INIT "-bt=nt -xs -w3 -dWIN32 -br -bm")
+string(APPEND CMAKE_C_FLAGS_INIT " -bt=nt -w3 -dWIN32 -br -bm")
+string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=nt -xs -w3 -dWIN32 -br -bm")
foreach(lang C CXX)
- set (CMAKE_${lang}_FLAGS_DEBUG_INIT "-d2")
- set (CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-s -os -d0 -dNDEBUG")
- set (CMAKE_${lang}_FLAGS_RELEASE_INIT "-s -ot -d0 -dNDEBUG")
- set (CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-s -ot -d1 -dNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -d2")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -s -os -d0 -dNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -s -ot -d0 -dNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -s -ot -d1 -dNDEBUG")
endforeach()
foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE)
diff --git a/Modules/Platform/Windows-Watcom-C.cmake b/Modules/Platform/Windows-Watcom-C.cmake
new file mode 100644
index 0000000..44a008b
--- /dev/null
+++ b/Modules/Platform/Windows-Watcom-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-OpenWatcom-C)
diff --git a/Modules/Platform/Windows-Watcom-CXX.cmake b/Modules/Platform/Windows-Watcom-CXX.cmake
new file mode 100644
index 0000000..63d109b
--- /dev/null
+++ b/Modules/Platform/Windows-Watcom-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-OpenWatcom-CXX)
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index 3b0a6cc..4b066b74 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -441,14 +441,14 @@ macro(QT4_CREATE_TRANSLATION _qm_files)
set(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro)
set(_pro_srcs)
foreach(_pro_src ${_my_sources})
- set(_pro_srcs "${_pro_srcs} \\\n \"${_pro_src}\"")
+ string(APPEND _pro_srcs " \\\n \"${_pro_src}\"")
endforeach()
set(_pro_includes)
get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES)
list(REMOVE_DUPLICATES _inc_DIRS)
foreach(_pro_include ${_inc_DIRS})
get_filename_component(_abs_include "${_pro_include}" ABSOLUTE)
- set(_pro_includes "${_pro_includes} \\\n \"${_abs_include}\"")
+ string(APPEND _pro_includes " \\\n \"${_abs_include}\"")
endforeach()
file(WRITE ${_ts_pro} "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n")
endif()
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 7b3416e..f4b5e52 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -217,6 +217,19 @@
# This command installs the TARGET_NAME files to the given DESTINATION.
# It should be called in the same scope as add_jar() or it will fail.
#
+# Target Properties:
+#
+# ::
+#
+# The install_jar() function sets the INSTALL_DESTINATION target property
+# on jars so installed. This property holds the DESTINATION as described
+# above, and is used by install_jar_exports(). You can get this property
+# with the
+# get_property(TARGET <target_name> PROPERTY INSTALL_DESTINATION)
+# command.
+#
+#
+#
# ::
#
# install_jni_symlink(target_name destination)
@@ -228,6 +241,24 @@
#
# ::
#
+# install_jar_exports(TARGETS jar1 [jar2 ...]
+# FILE export_filename
+# DESTINATION destination [COMPONENT component])
+#
+# This command installs a target export file export_filename for the named jar
+# targets to the given DESTINATION. Its function is similar to that of
+# install(EXPORTS).
+#
+# ::
+#
+# export_jars(TARGETS jar1 [jar2 ...]
+# FILE export_filename)
+#
+# This command writes a target export file export_filename for the named jar
+# targets. Its function is similar to that of export().
+#
+# ::
+#
# create_javadoc(<VAR>
# PACKAGES pkg1 [pkg2 ...]
# [SOURCEPATH <sourcepath>]
@@ -396,7 +427,29 @@ function (__java_copy_file src dest comment)
COMMENT ${comment})
endfunction ()
+function(__java_lcat VAR)
+ foreach(_line ${ARGN})
+ set(${VAR} "${${VAR}}${_line}\n")
+ endforeach()
+
+ set(${VAR} "${${VAR}}" PARENT_SCOPE)
+endfunction()
+
+function(__java_export_jar VAR TARGET PATH)
+ get_target_property(_jarpath ${TARGET} JAR_FILE)
+ get_filename_component(_jarname ${_jarpath} NAME)
+ __java_lcat(${VAR}
+ "# Create imported target ${TARGET}"
+ "add_custom_target(${TARGET})"
+ "set_target_properties(${TARGET} PROPERTIES"
+ " JAR_FILE \"${PATH}/${_jarname}\")"
+ ""
+ )
+ set(${VAR} "${${VAR}}" PARENT_SCOPE)
+endfunction()
+
# define helper scripts
+set(_JAVA_EXPORT_TARGETS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/javaTargets.cmake.in)
set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake)
set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake)
@@ -435,6 +488,8 @@ function(add_jar _TARGET_NAME)
if (NOT DEFINED _add_jar_OUTPUT_DIR)
set(_add_jar_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
+ else()
+ get_filename_component(_add_jar_OUTPUT_DIR ${_add_jar_OUTPUT_DIR} ABSOLUTE)
endif()
if (_add_jar_ENTRY_POINT)
@@ -467,7 +522,7 @@ function(add_jar _TARGET_NAME)
endif()
foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH})
- set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
+ string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
endforeach()
set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${_add_jar_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
@@ -539,7 +594,7 @@ function(add_jar _TARGET_NAME)
if (TARGET ${_JAVA_INCLUDE_JAR})
get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE)
if (_JAVA_JAR_PATH)
- set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}")
+ string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}")
list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH})
list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR})
list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_INCLUDE_JAR})
@@ -547,18 +602,13 @@ function(add_jar _TARGET_NAME)
message(SEND_ERROR "add_jar: INCLUDE_JARS target ${_JAVA_INCLUDE_JAR} is not a jar")
endif ()
else ()
- set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_INCLUDE_JAR}")
+ string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_INCLUDE_JAR}")
list(APPEND CMAKE_JAVA_INCLUDE_PATH "${_JAVA_INCLUDE_JAR}")
list(APPEND _JAVA_DEPENDS "${_JAVA_INCLUDE_JAR}")
list(APPEND _JAVA_COMPILE_DEPENDS "${_JAVA_INCLUDE_JAR}")
endif ()
endforeach()
- # create an empty java_class_filelist
- if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist)
- file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "")
- endif()
-
if (_JAVA_COMPILE_FILES OR _JAVA_COMPILE_FILELISTS)
set (_JAVA_SOURCES_FILELISTS)
@@ -598,6 +648,11 @@ function(add_jar _TARGET_NAME)
DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
+ else ()
+ # create an empty java_class_filelist
+ if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist)
+ file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "")
+ endif()
endif ()
# create the jar file
@@ -716,6 +771,13 @@ function(INSTALL_JAR _TARGET_NAME)
PROPERTY
INSTALL_FILES
)
+ set_property(
+ TARGET
+ ${_TARGET_NAME}
+ PROPERTY
+ INSTALL_DESTINATION
+ ${_DESTINATION}
+ )
if (__FILES)
install(
@@ -1288,3 +1350,94 @@ function (create_javah)
set (${_create_javah_GENERATED_FILES} ${_output_files} PARENT_SCOPE)
endif()
endfunction()
+
+function(export_jars)
+ # Parse and validate arguments
+ cmake_parse_arguments(_export_jars
+ ""
+ "FILE"
+ "TARGETS"
+ ${ARGN}
+ )
+ if (NOT _export_jars_FILE)
+ message(SEND_ERROR "export_jars: FILE must be specified.")
+ endif()
+ if (NOT _export_jars_TARGETS)
+ message(SEND_ERROR "export_jars: TARGETS must be specified.")
+ endif()
+
+ # Set content of generated exports file
+ string(REPLACE ";" " " __targets__ "${_export_jars_TARGETS}")
+ set(__targetdefs__ "")
+ foreach(_target ${_export_jars_TARGETS})
+ get_target_property(_jarpath ${_target} JAR_FILE)
+ get_filename_component(_jarpath ${_jarpath} PATH)
+ __java_export_jar(__targetdefs__ ${_target} "${_jarpath}")
+ endforeach()
+
+ # Generate exports file
+ configure_file(
+ ${_JAVA_EXPORT_TARGETS_SCRIPT}
+ ${_export_jars_FILE}
+ @ONLY
+ )
+endfunction()
+
+function(install_jar_exports)
+ # Parse and validate arguments
+ cmake_parse_arguments(_install_jar_exports
+ ""
+ "FILE;DESTINATION;COMPONENT"
+ "TARGETS"
+ ${ARGN}
+ )
+ if (NOT _install_jar_exports_FILE)
+ message(SEND_ERROR "install_jar_exports: FILE must be specified.")
+ endif()
+ if (NOT _install_jar_exports_DESTINATION)
+ message(SEND_ERROR "install_jar_exports: DESTINATION must be specified.")
+ endif()
+ if (NOT _install_jar_exports_TARGETS)
+ message(SEND_ERROR "install_jar_exports: TARGETS must be specified.")
+ endif()
+
+ if (_install_jar_exports_COMPONENT)
+ set (_COMPONENT COMPONENT ${_install_jar_exports_COMPONENT})
+ endif()
+
+ # Determine relative path from installed export file to install prefix
+ if(IS_ABSOLUTE ${_install_jar_exports_DESTINATION})
+ file(RELATIVE_PATH _relpath
+ ${_install_jar_exports_DESTINATION}
+ ${CMAKE_INSTALL_PREFIX}
+ )
+ else()
+ file(RELATIVE_PATH _relpath
+ ${CMAKE_INSTALL_PREFIX}/${_install_jar_exports_DESTINATION}
+ ${CMAKE_INSTALL_PREFIX}
+ )
+ endif()
+
+ # Set up unique location for generated exports file
+ string(SHA256 _hash "${_install_jar_exports_DESTINATION}")
+ set(_tmpdir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/JavaExports/${_hash})
+
+ # Set content of generated exports file
+ string(REPLACE ";" " " __targets__ "${_install_jar_exports_TARGETS}")
+ set(__targetdefs__ "set(_prefix \${CMAKE_CURRENT_LIST_DIR}/${_relpath})\n\n")
+ foreach(_target ${_install_jar_exports_TARGETS})
+ get_target_property(_dir ${_target} INSTALL_DESTINATION)
+ __java_export_jar(__targetdefs__ ${_target} "\${_prefix}/${_dir}")
+ endforeach()
+ __java_lcat(__targetdefs__ "\nunset(_prefix)")
+
+ # Generate and install exports file
+ configure_file(
+ ${_JAVA_EXPORT_TARGETS_SCRIPT}
+ ${_tmpdir}/${_install_jar_exports_FILE}
+ @ONLY
+ )
+ install(FILES ${_tmpdir}/${_install_jar_exports_FILE}
+ DESTINATION ${_install_jar_exports_DESTINATION}
+ ${_COMPONENT})
+endfunction()
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index d757f65..2631ca1 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -163,15 +163,15 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
"${swig_outdir}/${swig_source_file_name_we}")
# add the language into the name of the file (i.e. TCL_wrap)
# this allows for the same .i file to be wrapped into different languages
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}${SWIG_MODULE_${name}_LANGUAGE}_wrap")
+ string(APPEND swig_generated_file_fullname
+ "${SWIG_MODULE_${name}_LANGUAGE}_wrap")
if(swig_source_file_cplusplus)
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}.${SWIG_CXX_EXTENSION}")
+ string(APPEND swig_generated_file_fullname
+ ".${SWIG_CXX_EXTENSION}")
else()
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}.c")
+ string(APPEND swig_generated_file_fullname
+ ".c")
endif()
#message("Full path to source file: ${swig_source_file_fullname}")
diff --git a/Modules/Use_wxWindows.cmake b/Modules/Use_wxWindows.cmake
index d3025ac..597b4ec 100644
--- a/Modules/Use_wxWindows.cmake
+++ b/Modules/Use_wxWindows.cmake
@@ -68,7 +68,7 @@ if(WXWINDOWS_FOUND)
link_libraries(${WXWINDOWS_LIBRARIES})
endif()
if (CMAKE_WXWINDOWS_CXX_FLAGS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_WXWINDOWS_CXX_FLAGS}")
+ string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_WXWINDOWS_CXX_FLAGS}")
endif()
if(WXWINDOWS_DEFINITIONS)
add_definitions(${WXWINDOWS_DEFINITIONS})
diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake
index b3633a6..4d16482 100644
--- a/Modules/UsewxWidgets.cmake
+++ b/Modules/UsewxWidgets.cmake
@@ -90,7 +90,7 @@ if (wxWidgets_FOUND)
if (wxWidgets_CXX_FLAGS)
# Flags are expected to be a string here, not a list.
string(REPLACE ";" " " wxWidgets_CXX_FLAGS_str "${wxWidgets_CXX_FLAGS}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS_str}")
+ string(APPEND CMAKE_CXX_FLAGS " ${wxWidgets_CXX_FLAGS_str}")
MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS_str}")
unset(wxWidgets_CXX_FLAGS_str)
endif()
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 2669a84..4b829e5 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -282,9 +282,9 @@ function(write_compiler_detection_header
set(_min_version 3.1.0) # Version which introduced this function
if (_WCD_VERSION VERSION_LESS _min_version)
set(err "VERSION compatibility for write_compiler_detection_header is set to ${_WCD_VERSION}, which is too low.")
- set(err "${err} It must be set to at least ${_min_version}. ")
- set(err "${err} Either set the VERSION parameter to the write_compiler_detection_header function, or update")
- set(err "${err} your minimum required CMake version with the cmake_minimum_required command.")
+ string(APPEND err " It must be set to at least ${_min_version}. ")
+ string(APPEND err " Either set the VERSION parameter to the write_compiler_detection_header function, or update")
+ string(APPEND err " your minimum required CMake version with the cmake_minimum_required command.")
message(FATAL_ERROR "${err}")
endif()
@@ -349,11 +349,11 @@ function(write_compiler_detection_header
")
if (_WCD_PROLOG)
- set(file_content "${file_content}\n${_WCD_PROLOG}\n")
+ string(APPEND file_content "\n${_WCD_PROLOG}\n")
endif()
if (_need_hex_conversion)
- set(file_content "${file_content}
+ string(APPEND file_content "
#define ${prefix_arg}_DEC(X) (X)
#define ${prefix_arg}_HEX(X) ( \\
((X)>>28 & 0xF) * 10000000 + \\
@@ -406,24 +406,24 @@ function(write_compiler_detection_header
endforeach()
if(_lang STREQUAL CXX)
- set(file_content "${file_content}\n#ifdef __cplusplus\n")
+ string(APPEND file_content "\n#ifdef __cplusplus\n")
else()
- set(file_content "${file_content}\n#ifndef __cplusplus\n")
+ string(APPEND file_content "\n#ifndef __cplusplus\n")
endif()
compiler_id_detection(ID_CONTENT ${_lang} PREFIX ${prefix_arg}_
ID_DEFINE
)
- set(file_content "${file_content}${ID_CONTENT}\n")
+ string(APPEND file_content "${ID_CONTENT}\n")
set(pp_if "if")
foreach(compiler ${target_compilers})
- set(file_content "${file_content}\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n")
+ string(APPEND file_content "\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n")
if(_WCD_OUTPUT_FILES_VAR)
set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h")
- set(file_content "${file_content}\n# include \"${compile_file_name}\"\n")
+ string(APPEND file_content "\n# include \"${compile_file_name}\"\n")
endif()
if(_WCD_OUTPUT_FILES_VAR)
@@ -466,7 +466,7 @@ function(write_compiler_detection_header
endforeach()
endforeach()
if(pp_if STREQUAL "elif")
- set(file_content "${file_content}
+ string(APPEND file_content "
# else
# error Unsupported compiler
# endif\n")
@@ -477,7 +477,7 @@ function(write_compiler_detection_header
set(def_name ${prefix_arg}_${feature_PP})
if (feature STREQUAL c_restrict)
set(def_value "${prefix_arg}_RESTRICT")
- set(file_content "${file_content}
+ string(APPEND file_content "
# if ${def_name}
# define ${def_value} restrict
# else
@@ -487,7 +487,7 @@ function(write_compiler_detection_header
endif()
if (feature STREQUAL cxx_constexpr)
set(def_value "${prefix_arg}_CONSTEXPR")
- set(file_content "${file_content}
+ string(APPEND file_content "
# if ${def_name}
# define ${def_value} constexpr
# else
@@ -497,7 +497,7 @@ function(write_compiler_detection_header
endif()
if (feature STREQUAL cxx_final)
set(def_value "${prefix_arg}_FINAL")
- set(file_content "${file_content}
+ string(APPEND file_content "
# if ${def_name}
# define ${def_value} final
# else
@@ -507,7 +507,7 @@ function(write_compiler_detection_header
endif()
if (feature STREQUAL cxx_override)
set(def_value "${prefix_arg}_OVERRIDE")
- set(file_content "${file_content}
+ string(APPEND file_content "
# if ${def_name}
# define ${def_value} override
# else
@@ -521,11 +521,11 @@ function(write_compiler_detection_header
set(static_assert_struct "template<bool> struct ${prefix_arg}StaticAssert;\ntemplate<> struct ${prefix_arg}StaticAssert<true>{};\n")
set(def_standard "# define ${def_value} static_assert(X, #X)\n# define ${def_value_msg} static_assert(X, MSG)")
set(def_alternative "${static_assert_struct}# define ${def_value} sizeof(${prefix_arg}StaticAssert<X>)\n# define ${def_value_msg} sizeof(${prefix_arg}StaticAssert<X>)")
- set(file_content "${file_content}# if ${def_name}\n${def_standard}\n# else\n${def_alternative}\n# endif\n\n")
+ string(APPEND file_content "# if ${def_name}\n${def_standard}\n# else\n${def_alternative}\n# endif\n\n")
endif()
if (feature STREQUAL cxx_alignas)
set(def_value "${prefix_arg}_ALIGNAS(X)")
- set(file_content "${file_content}
+ string(APPEND file_content "
# if ${def_name}
# define ${def_value} alignas(X)
# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang
@@ -539,7 +539,7 @@ function(write_compiler_detection_header
endif()
if (feature STREQUAL cxx_alignof)
set(def_value "${prefix_arg}_ALIGNOF(X)")
- set(file_content "${file_content}
+ string(APPEND file_content "
# if ${def_name}
# define ${def_value} alignof(X)
# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang
@@ -551,7 +551,7 @@ function(write_compiler_detection_header
endif()
if (feature STREQUAL cxx_deleted_functions)
set(def_value "${prefix_arg}_DELETED_FUNCTION")
- set(file_content "${file_content}
+ string(APPEND file_content "
# if ${def_name}
# define ${def_value} = delete
# else
@@ -561,7 +561,7 @@ function(write_compiler_detection_header
endif()
if (feature STREQUAL cxx_extern_templates)
set(def_value "${prefix_arg}_EXTERN_TEMPLATE")
- set(file_content "${file_content}
+ string(APPEND file_content "
# if ${def_name}
# define ${def_value} extern
# else
@@ -571,7 +571,7 @@ function(write_compiler_detection_header
endif()
if (feature STREQUAL cxx_noexcept)
set(def_value "${prefix_arg}_NOEXCEPT")
- set(file_content "${file_content}
+ string(APPEND file_content "
# if ${def_name}
# define ${def_value} noexcept
# define ${def_value}_EXPR(X) noexcept(X)
@@ -583,7 +583,7 @@ function(write_compiler_detection_header
endif()
if (feature STREQUAL cxx_nullptr)
set(def_value "${prefix_arg}_NULLPTR")
- set(file_content "${file_content}
+ string(APPEND file_content "
# if ${def_name}
# define ${def_value} nullptr
# else
@@ -593,7 +593,7 @@ function(write_compiler_detection_header
endif()
if (feature STREQUAL cxx_thread_local)
set(def_value "${prefix_arg}_THREAD_LOCAL")
- set(file_content "${file_content}
+ string(APPEND file_content "
# if ${def_name}
# define ${def_value} thread_local
# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang
@@ -608,7 +608,7 @@ function(write_compiler_detection_header
if (feature STREQUAL cxx_attribute_deprecated)
set(def_name ${prefix_arg}_${feature_PP})
set(def_value "${prefix_arg}_DEPRECATED")
- set(file_content "${file_content}
+ string(APPEND file_content "
# ifndef ${def_value}
# if ${def_name}
# define ${def_value} [[deprecated]]
@@ -628,7 +628,7 @@ function(write_compiler_detection_header
endif()
endforeach()
- set(file_content "${file_content}#endif\n")
+ string(APPEND file_content "#endif\n")
endforeach()
@@ -637,7 +637,7 @@ function(write_compiler_detection_header
foreach(_lang ${_langs})
if(compiler_file_content_${compiler}_${_lang})
set(CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_}")
- set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${compiler_file_content_${compiler}_${_lang}}")
+ string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_${compiler}_${_lang}}")
set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h")
set(full_path "${main_file_dir}/${compile_file_name}")
@@ -653,9 +653,9 @@ function(write_compiler_detection_header
endif()
if (_WCD_EPILOG)
- set(file_content "${file_content}\n${_WCD_EPILOG}\n")
+ string(APPEND file_content "\n${_WCD_EPILOG}\n")
endif()
- set(file_content "${file_content}\n#endif")
+ string(APPEND file_content "\n#endif")
set(CMAKE_CONFIGURABLE_FILE_CONTENT ${file_content})
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in
index 7cfbcbd..9dd75bf 100644
--- a/Modules/exportheader.cmake.in
+++ b/Modules/exportheader.cmake.in
@@ -38,5 +38,5 @@
# define @NO_DEPRECATED_MACRO_NAME@
# endif
#endif
-
+@CUSTOM_CONTENT@
#endif
diff --git a/Modules/javaTargets.cmake.in b/Modules/javaTargets.cmake.in
new file mode 100644
index 0000000..c5f9c78
--- /dev/null
+++ b/Modules/javaTargets.cmake.in
@@ -0,0 +1,39 @@
+cmake_minimum_required(VERSION 2.8)
+cmake_policy(PUSH)
+cmake_policy(VERSION 2.8)
+
+#----------------------------------------------------------------
+# Generated CMake Java target import file.
+#----------------------------------------------------------------
+
+# Protect against multiple inclusion, which would fail when already imported targets are added once more.
+set(_targetsDefined)
+set(_targetsNotDefined)
+set(_expectedTargets)
+foreach(_expectedTarget @__targets__@)
+ list(APPEND _expectedTargets ${_expectedTarget})
+ if(TARGET ${_expectedTarget})
+ list(APPEND _targetsDefined ${_expectedTarget})
+ else()
+ list(APPEND _targetsNotDefined ${_expectedTarget})
+ endif()
+endforeach()
+if("%${_targetsDefined}" STREQUAL "%${_expectedTargets}")
+ unset(_targetsDefined)
+ unset(_targetsNotDefined)
+ unset(_expectedTargets)
+ cmake_policy(POP)
+ return()
+endif()
+if(NOT "${_targetsDefined}" STREQUAL "")
+ message(FATAL_ERROR
+ "Some (but not all) targets in this export set were already defined.\n"
+ "Targets Defined: ${_targetsDefined}\n"
+ "Targets not yet defined: ${_targetsNotDefined}\n")
+endif()
+unset(_targetsDefined)
+unset(_targetsNotDefined)
+unset(_expectedTargets)
+
+@__targetdefs__@
+cmake_policy(POP)