summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/AutogenInfo.cmake.in1
-rw-r--r--Modules/BasicConfigVersion-ExactVersion.cmake.in4
-rw-r--r--Modules/BundleUtilities.cmake12
-rw-r--r--Modules/CMakeASMInformation.cmake18
-rw-r--r--Modules/CMakeASM_MASMInformation.cmake2
-rw-r--r--Modules/CMakeBackwardCompatibilityCXX.cmake6
-rw-r--r--Modules/CMakeCCompiler.cmake.in7
-rw-r--r--Modules/CMakeCCompilerId.c.in216
-rw-r--r--Modules/CMakeCInformation.cmake4
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in7
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in210
-rw-r--r--Modules/CMakeCXXInformation.cmake4
-rw-r--r--Modules/CMakeCheckCompilerFlagCommonPatterns.cmake2
-rw-r--r--Modules/CMakeCommonLanguageInclude.cmake18
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake157
-rw-r--r--Modules/CMakeConfigurableFile.in1
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineASM_MASMCompiler.cmake3
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake4
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake4
-rw-r--r--Modules/CMakeDetermineCompileFeatures.cmake94
-rw-r--r--Modules/CMakeDetermineCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake22
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake70
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake8
-rw-r--r--Modules/CMakeDetermineJavaCompiler.cmake6
-rw-r--r--Modules/CMakeDetermineRCCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineSystem.cmake6
-rw-r--r--Modules/CMakeDetermineVSServicePack.cmake7
-rw-r--r--Modules/CMakeExportBuildSettings.cmake2
-rw-r--r--Modules/CMakeFindBinUtils.cmake4
-rw-r--r--Modules/CMakeFortranInformation.cmake4
-rw-r--r--Modules/CMakeImportBuildSettings.cmake3
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake293
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake10
-rw-r--r--Modules/CMakePlatformId.h.in28
-rw-r--r--Modules/CMakePushCheckState.cmake3
-rw-r--r--Modules/CMakeRCCompiler.cmake.in2
-rw-r--r--Modules/CMakeSystemSpecificInitialize.cmake20
-rw-r--r--Modules/CMakeTestCCompiler.cmake3
-rw-r--r--Modules/CMakeTestCXXCompiler.cmake3
-rw-r--r--Modules/CPack.cmake64
-rw-r--r--Modules/CPackComponent.cmake3
-rw-r--r--Modules/CPackDeb.cmake17
-rw-r--r--Modules/CPackIFW.cmake447
-rw-r--r--Modules/CPackRPM.cmake4
-rw-r--r--Modules/CPackWIX.cmake17
-rw-r--r--Modules/CheckCCompilerFlag.cmake1
-rw-r--r--Modules/CheckCSourceCompiles.cmake16
-rw-r--r--Modules/CheckCSourceRuns.cmake16
-rw-r--r--Modules/CheckCXXSourceCompiles.cmake16
-rw-r--r--Modules/CheckCXXSourceRuns.cmake16
-rw-r--r--Modules/CheckCXXSymbolExists.cmake1
-rw-r--r--Modules/CheckFortranFunctionExists.cmake1
-rw-r--r--Modules/CheckFortranSourceCompiles.cmake111
-rw-r--r--Modules/CheckFunctionExists.cmake16
-rw-r--r--Modules/CheckIncludeFile.cmake16
-rw-r--r--Modules/CheckIncludeFileCXX.cmake16
-rw-r--r--Modules/CheckIncludeFiles.cmake18
-rw-r--r--Modules/CheckLanguage.cmake2
-rw-r--r--Modules/CheckLibraryExists.cmake16
-rw-r--r--Modules/CheckPrototypeDefinition.cmake12
-rw-r--r--Modules/CheckStructHasMember.cmake1
-rw-r--r--Modules/CheckSymbolExists.cmake16
-rw-r--r--Modules/CheckTypeSize.cmake33
-rw-r--r--Modules/CheckVariableExists.cmake17
-rw-r--r--Modules/Compiler/ADSP-DetermineCompiler.cmake10
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake7
-rw-r--r--Modules/Compiler/AppleClang-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/Borland-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/Clang-C-FeatureTests.cmake11
-rw-r--r--Modules/Compiler/Clang-C.cmake36
-rw-r--r--Modules/Compiler/Clang-CXX-FeatureTests.cmake86
-rw-r--r--Modules/Compiler/Clang-CXX.cmake46
-rw-r--r--Modules/Compiler/Clang-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/Clang-DetermineCompilerInternal.cmake15
-rw-r--r--Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/Compaq-C-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/Cray-DetermineCompiler.cmake6
-rw-r--r--Modules/Compiler/Embarcadero-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/Fujitsu-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/GNU-C-FeatureTests.cmake12
-rw-r--r--Modules/Compiler/GNU-C.cmake32
-rw-r--r--Modules/Compiler/GNU-CXX-FeatureTests.cmake98
-rw-r--r--Modules/Compiler/GNU-CXX.cmake41
-rw-r--r--Modules/Compiler/GNU-DetermineCompiler.cmake9
-rw-r--r--Modules/Compiler/HP-C-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/HP-CXX-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/HP-CXX.cmake9
-rw-r--r--Modules/Compiler/IAR-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake6
-rw-r--r--Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake6
-rw-r--r--Modules/Compiler/Intel-DetermineCompiler.cmake26
-rw-r--r--Modules/Compiler/MIPSpro-DetermineCompiler.cmake15
-rw-r--r--Modules/Compiler/MSVC-DetermineCompiler.cmake19
-rw-r--r--Modules/Compiler/OpenWatcom-DetermineCompiler.cmake10
-rw-r--r--Modules/Compiler/PGI-DetermineCompiler.cmake9
-rw-r--r--Modules/Compiler/PathScale-DetermineCompiler.cmake9
-rw-r--r--Modules/Compiler/SCO-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/SDCC-C-DetermineCompiler.cmake10
-rw-r--r--Modules/Compiler/SunPro-C-DetermineCompiler.cmake15
-rw-r--r--Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake15
-rw-r--r--Modules/Compiler/TI-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/TinyCC-C-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/VisualAge-C-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/Watcom-DetermineCompiler.cmake10
-rw-r--r--Modules/Compiler/XL-C-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/XL-CXX-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/zOS-C-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/zOS-CXX-DetermineCompiler.cmake4
-rw-r--r--Modules/CompilerId/VS-10.vcxproj.in3
-rw-r--r--Modules/CompilerId/Xcode-3.pbxproj.in2
-rw-r--r--Modules/DartConfiguration.tcl.in4
-rw-r--r--Modules/ExternalData.cmake56
-rw-r--r--Modules/ExternalProject.cmake204
-rw-r--r--Modules/FeatureSummary.cmake62
-rw-r--r--Modules/FindBISON.cmake15
-rw-r--r--Modules/FindBLAS.cmake14
-rw-r--r--Modules/FindBZip2.cmake4
-rw-r--r--Modules/FindBacktrace.cmake1
-rw-r--r--Modules/FindBoost.cmake19
-rw-r--r--Modules/FindCUDA.cmake112
-rw-r--r--Modules/FindCUDA/make2cmake.cmake5
-rw-r--r--Modules/FindCUDA/parse_cubin.cmake15
-rw-r--r--Modules/FindCUDA/run_nvcc.cmake4
-rw-r--r--Modules/FindCups.cmake9
-rw-r--r--Modules/FindCurses.cmake182
-rw-r--r--Modules/FindDoxygen.cmake24
-rw-r--r--Modules/FindEXPAT.cmake5
-rw-r--r--Modules/FindFLTK.cmake4
-rw-r--r--Modules/FindFLTK2.cmake4
-rw-r--r--Modules/FindFreetype.cmake74
-rw-r--r--Modules/FindGDAL.cmake4
-rw-r--r--Modules/FindGIF.cmake1
-rw-r--r--Modules/FindGLEW.cmake16
-rw-r--r--Modules/FindGLUT.cmake77
-rw-r--r--Modules/FindGTK2.cmake51
-rw-r--r--Modules/FindGTest.cmake28
-rw-r--r--Modules/FindGettext.cmake4
-rw-r--r--Modules/FindHDF5.cmake6
-rw-r--r--Modules/FindHg.cmake37
-rw-r--r--Modules/FindIce.cmake393
-rw-r--r--Modules/FindIcotool.cmake2
-rw-r--r--Modules/FindImageMagick.cmake42
-rw-r--r--Modules/FindJNI.cmake2
-rw-r--r--Modules/FindJPEG.cmake2
-rw-r--r--Modules/FindJava.cmake15
-rw-r--r--Modules/FindKDE3.cmake2
-rw-r--r--Modules/FindLAPACK.cmake11
-rw-r--r--Modules/FindLibLZMA.cmake3
-rw-r--r--Modules/FindMPI.cmake22
-rw-r--r--Modules/FindOpenCL.cmake136
-rw-r--r--Modules/FindOpenGL.cmake76
-rw-r--r--Modules/FindOpenMP.cmake64
-rw-r--r--Modules/FindOpenSceneGraph.cmake7
-rw-r--r--Modules/FindPNG.cmake6
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake2
-rw-r--r--Modules/FindPackageMessage.cmake2
-rw-r--r--Modules/FindPerl.cmake4
-rw-r--r--Modules/FindPkgConfig.cmake428
-rw-r--r--Modules/FindPostgreSQL.cmake22
-rw-r--r--Modules/FindProtobuf.cmake2
-rw-r--r--Modules/FindPythonInterp.cmake31
-rw-r--r--Modules/FindPythonLibs.cmake16
-rw-r--r--Modules/FindQt.cmake6
-rw-r--r--Modules/FindQt3.cmake8
-rw-r--r--Modules/FindQt4.cmake47
-rw-r--r--Modules/FindSDL_image.cmake4
-rw-r--r--Modules/FindSDL_mixer.cmake4
-rw-r--r--Modules/FindSDL_net.cmake4
-rw-r--r--Modules/FindSDL_sound.cmake6
-rw-r--r--Modules/FindSDL_ttf.cmake4
-rw-r--r--Modules/FindSWIG.cmake3
-rw-r--r--Modules/FindSquish.cmake2
-rw-r--r--Modules/FindThreads.cmake46
-rw-r--r--Modules/FindVTK.cmake112
-rw-r--r--Modules/FindX11.cmake78
-rw-r--r--Modules/FindXMLRPC.cmake19
-rw-r--r--Modules/FindXerces.cmake85
-rw-r--r--Modules/FindZLIB.cmake33
-rw-r--r--Modules/FindwxWidgets.cmake11
-rw-r--r--Modules/FortranCInterface.cmake2
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt2
-rw-r--r--Modules/FortranCInterface/Detect.cmake7
-rw-r--r--Modules/FortranCInterface/Verify/CMakeLists.txt2
-rw-r--r--Modules/GNUInstallDirs.cmake28
-rw-r--r--Modules/GenerateExportHeader.cmake2
-rw-r--r--Modules/GetPrerequisites.cmake8
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake75
-rw-r--r--Modules/IntelVSImplicitPath/CMakeLists.txt2
-rw-r--r--Modules/Internal/FeatureTesting.cmake60
-rw-r--r--Modules/Platform/Android.cmake9
-rw-r--r--Modules/Platform/Darwin-Clang.cmake3
-rw-r--r--Modules/Platform/Darwin-GNU.cmake4
-rw-r--r--Modules/Platform/Darwin-Initialize.cmake151
-rw-r--r--Modules/Platform/Darwin.cmake141
-rw-r--r--Modules/Platform/Haiku.cmake27
-rw-r--r--Modules/Platform/OSF1.cmake4
-rw-r--r--Modules/Platform/OpenBSD.cmake18
-rw-r--r--Modules/Platform/SunOS.cmake2
-rw-r--r--Modules/Platform/Windows-GNU.cmake13
-rw-r--r--Modules/Platform/Windows-MSVC.cmake38
-rw-r--r--Modules/Platform/Windows-df.cmake1
-rw-r--r--Modules/Platform/Windows-wcl386.cmake88
-rw-r--r--Modules/Platform/Windows.cmake8
-rw-r--r--Modules/Platform/WindowsCE-MSVC.cmake1
-rw-r--r--Modules/Platform/WindowsPaths.cmake5
-rw-r--r--Modules/Platform/WindowsPhone-MSVC-C.cmake1
-rw-r--r--Modules/Platform/WindowsPhone-MSVC-CXX.cmake1
-rw-r--r--Modules/Platform/WindowsPhone.cmake1
-rw-r--r--Modules/Platform/WindowsStore-MSVC-C.cmake1
-rw-r--r--Modules/Platform/WindowsStore-MSVC-CXX.cmake1
-rw-r--r--Modules/Platform/WindowsStore.cmake1
-rw-r--r--Modules/ProcessorCount.cmake16
-rw-r--r--Modules/Qt4Macros.cmake10
-rw-r--r--Modules/TestBigEndian.cmake2
-rw-r--r--Modules/TestForANSIForScope.cmake2
-rw-r--r--Modules/TestForSSTREAM.cmake2
-rw-r--r--Modules/TestForSTDNamespace.cmake2
-rw-r--r--Modules/UseJava.cmake8
-rw-r--r--Modules/UseQt4.cmake4
-rw-r--r--Modules/UseSWIG.cmake80
-rw-r--r--Modules/UseVTKConfig40.cmake2
-rw-r--r--Modules/UsewxWidgets.cmake7
-rw-r--r--Modules/WIX.template.in2
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake535
228 files changed, 5263 insertions, 1765 deletions
diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in
index b6f9791..602b065 100644
--- a/Modules/AutogenInfo.cmake.in
+++ b/Modules/AutogenInfo.cmake.in
@@ -16,6 +16,7 @@ set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
set(AM_QT_VERSION_MAJOR "@_target_qt_version@")
set(AM_TARGET_NAME @_moc_target_name@)
+set(AM_ORIGIN_TARGET_NAME @_origin_target_name@)
set(AM_RELAXED_MODE "@_moc_relaxed_mode@")
set(AM_UIC_TARGET_OPTIONS @_uic_target_options@)
set(AM_UIC_OPTIONS_FILES @_qt_uic_options_files@)
diff --git a/Modules/BasicConfigVersion-ExactVersion.cmake.in b/Modules/BasicConfigVersion-ExactVersion.cmake.in
index 63f3f03..9fd0136 100644
--- a/Modules/BasicConfigVersion-ExactVersion.cmake.in
+++ b/Modules/BasicConfigVersion-ExactVersion.cmake.in
@@ -11,13 +11,13 @@
set(PACKAGE_VERSION "@CVF_VERSION@")
-if("@CVF_VERSION@" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\..*") # strip the tweak version
+if("@CVF_VERSION@" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
set(CVF_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_NO_TWEAK "@CVF_VERSION@")
endif()
-if("${PACKAGE_FIND_VERSION}" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\..*") # strip the tweak version
+if("${PACKAGE_FIND_VERSION}" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
else()
set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}")
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 60d01b5..0046c97 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -235,9 +235,9 @@ function(get_bundle_main_executable bundle result_var)
#
set(eol_char "E")
file(READ "${bundle}/Contents/Info.plist" info_plist)
- string(REGEX REPLACE ";" "\\\\;" info_plist "${info_plist}")
- string(REGEX REPLACE "\n" "${eol_char};" info_plist "${info_plist}")
- string(REGEX REPLACE "\r" "${eol_char};" info_plist "${info_plist}")
+ string(REPLACE ";" "\\;" info_plist "${info_plist}")
+ string(REPLACE "\n" "${eol_char};" info_plist "${info_plist}")
+ string(REPLACE "\r" "${eol_char};" info_plist "${info_plist}")
# Scan the lines for "<key>CFBundleExecutable</key>" - the line after that
# is the name of the main executable.
@@ -248,7 +248,7 @@ function(get_bundle_main_executable bundle result_var)
break()
endif()
- if(line MATCHES "^.*<key>CFBundleExecutable</key>.*$")
+ if(line MATCHES "<key>CFBundleExecutable</key>")
set(line_is_main_executable 1)
endif()
endforeach()
@@ -288,7 +288,7 @@ endfunction()
function(get_dotapp_dir exe dotapp_dir_var)
set(s "${exe}")
- if(s MATCHES "^.*/.*\\.app/.*$")
+ if(s MATCHES "/.*\\.app/")
# If there is a ".app" parent directory,
# ascend until we hit it:
# (typical of a Mac bundle executable)
@@ -395,7 +395,7 @@ function(get_item_key item key_var)
if(WIN32)
string(TOLOWER "${item_name}" item_name)
endif()
- string(REGEX REPLACE "\\." "_" ${key_var} "${item_name}")
+ string(REPLACE "." "_" ${key_var} "${item_name}")
set(${key_var} ${${key_var}} PARENT_SCOPE)
endfunction()
diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake
index dce1624..62ef972 100644
--- a/Modules/CMakeASMInformation.cmake
+++ b/Modules/CMakeASMInformation.cmake
@@ -50,6 +50,24 @@ if(NOT _INCLUDED_FILE)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
endif()
+# This should be included before the _INIT variables are
+# used to initialize the cache. Since the rule variables
+# have if blocks on them, users can still define them here.
+# But, it should still be after the platform file so changes can
+# be made to those values.
+
+if(CMAKE_USER_MAKE_RULES_OVERRIDE)
+ # Save the full path of the file so try_compile can use it.
+ include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
+ set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
+endif()
+
+if(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM)
+ # Save the full path of the file so try_compile can use it.
+ include(${CMAKE_USER_MAKE_RULES_OVERRIDE_ASM} RESULT_VARIABLE _override)
+ set(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM "${_override}")
+endif()
+
# Set default assembler file extensions:
if(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS)
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm)
diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake
index eb105ab..972883c 100644
--- a/Modules/CMakeASM_MASMInformation.cmake
+++ b/Modules/CMakeASM_MASMInformation.cmake
@@ -18,7 +18,7 @@ set(ASM_DIALECT "_MASM")
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
-set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> /c /Fo <OBJECT> <SOURCE>")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <FLAGS> /c /Fo <OBJECT> <SOURCE>")
include(CMakeASMInformation)
set(ASM_DIALECT)
diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake
index 343fdb2..f1db46e 100644
--- a/Modules/CMakeBackwardCompatibilityCXX.cmake
+++ b/Modules/CMakeBackwardCompatibilityCXX.cmake
@@ -31,15 +31,15 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
if(NOT CMAKE_COMPILER_IS_GNUCXX)
include(TestCXXAcceptsFlag)
set(CMAKE_TRY_ANSI_CXX_FLAGS "")
- if(CMAKE_SYSTEM MATCHES "IRIX.*")
+ if(CMAKE_SYSTEM_NAME MATCHES "IRIX")
set(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std")
endif()
- if(CMAKE_SYSTEM MATCHES "OSF.*")
+ if(CMAKE_SYSTEM_NAME MATCHES "OSF")
set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname")
endif()
# if CMAKE_TRY_ANSI_CXX_FLAGS has something in it, see
# if the compiler accepts it
- if( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+")
+ if(NOT CMAKE_TRY_ANSI_CXX_FLAGS STREQUAL "")
CHECK_CXX_ACCEPTS_FLAG(${CMAKE_TRY_ANSI_CXX_FLAGS} CMAKE_CXX_ACCEPTS_FLAGS)
# if the compiler liked the flag then set CMAKE_ANSI_CXXFLAGS
# to the flag
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index 804cce2..86cd894 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -2,6 +2,11 @@ set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@")
+set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@")
+set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@")
+set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@")
+set(CMAKE_C11_COMPILE_FEATURES "@CMAKE_C11_COMPILE_FEATURES@")
+
set(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
set(CMAKE_C_SIMULATE_ID "@CMAKE_C_SIMULATE_ID@")
set(CMAKE_C_SIMULATE_VERSION "@CMAKE_C_SIMULATE_VERSION@")
@@ -26,7 +31,7 @@ if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_C_COMPILER_ID_RUN 1)
-set(CMAKE_C_SOURCE_FILE_EXTENSIONS c)
+set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_C_LINKER_PREFERENCE 10)
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 561ccf2..0221cbd 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -2,225 +2,11 @@
# error "A C++ compiler has been selected for C."
#endif
-/* Version number components: V=Version, R=Revision, P=Patch
- Version date components: YYYY=Year, MM=Month, DD=Day */
-
#if defined(__18CXX)
# define ID_VOID_MAIN
#endif
-#if defined(__INTEL_COMPILER) || defined(__ICC)
-# define COMPILER_ID "Intel"
- /* __INTEL_COMPILER = VRP */
-# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
-# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
-# if defined(__INTEL_COMPILER_UPDATE)
-# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
-# else
-# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
-# endif
-# if defined(__INTEL_COMPILER_BUILD_DATE)
- /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
-# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
-# endif
-# if defined(_MSC_VER)
-# define SIMULATE_ID "MSVC"
- /* _MSC_VER = VVRR */
-# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
-# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
-# endif
-
-#elif defined(__PATHCC__)
-# define COMPILER_ID "PathScale"
-# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
-# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
-# if defined(__PATHCC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
-# endif
-
-#elif defined(__clang__)
-# if defined(__apple_build_version__)
-# define COMPILER_ID "AppleClang"
-# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
-# else
-# define COMPILER_ID "Clang"
-# endif
-# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
-# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
-# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
-# if defined(_MSC_VER)
-# define SIMULATE_ID "MSVC"
- /* _MSC_VER = VVRR */
-# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
-# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
-# endif
-
-#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
-# define COMPILER_ID "Embarcadero"
-# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
-# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
-# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF)
-
-#elif defined(__BORLANDC__)
-# define COMPILER_ID "Borland"
- /* __BORLANDC__ = 0xVRR */
-# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
-# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
-
-#elif defined(__WATCOMC__)
-# define COMPILER_ID "Watcom"
- /* __WATCOMC__ = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
-
-#elif defined(__SUNPRO_C)
-# define COMPILER_ID "SunPro"
-# if __SUNPRO_C >= 0x5100
- /* __SUNPRO_C = 0xVRRP */
-# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
-# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
-# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
-# else
- /* __SUNPRO_C = 0xVRP */
-# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
-# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
-# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
-# endif
-
-#elif defined(__HP_cc)
-# define COMPILER_ID "HP"
- /* __HP_cc = VVRRPP */
-# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
-# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
-# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
-
-#elif defined(__DECC)
-# define COMPILER_ID "Compaq"
- /* __DECC_VER = VVRRTPPPP */
-# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
-# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
-# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
-
-#elif defined(__IBMC__)
-# if defined(__COMPILER_VER__)
-# define COMPILER_ID "zOS"
-# else
-# if __IBMC__ >= 800
-# define COMPILER_ID "XL"
-# else
-# define COMPILER_ID "VisualAge"
-# endif
- /* __IBMC__ = VRP */
-# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
-# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
-# endif
-
-#elif defined(__PGI)
-# define COMPILER_ID "PGI"
-# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
-# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
-# if defined(__PGIC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
-# endif
-
-#elif defined(_CRAYC)
-# define COMPILER_ID "Cray"
-# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
-# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
-
-#elif defined(__TI_COMPILER_VERSION__)
-# define COMPILER_ID "TI"
- /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
-# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
-# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
-# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
-
-#elif defined(__TINYC__)
-# define COMPILER_ID "TinyCC"
-
-#elif defined(__SCO_VERSION__)
-# define COMPILER_ID "SCO"
-
-#elif defined(__GNUC__)
-# define COMPILER_ID "GNU"
-# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
-# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
-# if defined(__GNUC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
-# endif
-
-#elif defined(_MSC_VER)
-# define COMPILER_ID "MSVC"
- /* _MSC_VER = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
-# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
-# if defined(_MSC_FULL_VER)
-# if _MSC_VER >= 1400
- /* _MSC_FULL_VER = VVRRPPPPP */
-# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
-# else
- /* _MSC_FULL_VER = VVRRPPPP */
-# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
-# endif
-# endif
-# if defined(_MSC_BUILD)
-# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
-# endif
-
-/* Analog VisualDSP++ >= 4.5.6 */
-#elif defined(__VISUALDSPVERSION__)
-# define COMPILER_ID "ADSP"
- /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
-# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
-# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
-# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
-
-/* Analog VisualDSP++ < 4.5.6 */
-#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
-# define COMPILER_ID "ADSP"
-
-/* IAR Systems compiler for embedded systems.
- http://www.iar.com */
-#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
-# define COMPILER_ID "IAR"
-
-/* sdcc, the small devices C compiler for embedded systems,
- http://sdcc.sourceforge.net */
-#elif defined(SDCC)
-# define COMPILER_ID "SDCC"
- /* SDCC = VRP */
-# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
-# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
-
-#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
-# define COMPILER_ID "MIPSpro"
-# if defined(_SGI_COMPILER_VERSION)
- /* _SGI_COMPILER_VERSION = VRP */
-# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
-# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
-# else
- /* _COMPILER_VERSION = VRP */
-# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
-# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
-# endif
-
-/* This compiler is either not known or is too old to define an
- identification macro. Try to identify the platform and guess that
- it is the native compiler. */
-#elif defined(__sgi)
-# define COMPILER_ID "MIPSpro"
-
-#elif defined(__hpux) || defined(__hpua)
-# define COMPILER_ID "HP"
-
-#else /* unknown compiler */
-# define COMPILER_ID ""
-
-#endif
+@CMAKE_C_COMPILER_ID_CONTENT@
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index e0cce45..332b26e 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -175,10 +175,10 @@ endif()
# Create a static archive incrementally for large object file counts.
# If CMAKE_C_CREATE_STATIC_LIBRARY is set it will override these.
if(NOT DEFINED CMAKE_C_ARCHIVE_CREATE)
- set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_C_ARCHIVE_APPEND)
- set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_C_ARCHIVE_FINISH)
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 35aa6c4..af79a31 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -2,6 +2,11 @@ set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@")
+set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@")
+set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@")
+set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@")
+set(CMAKE_CXX14_COMPILE_FEATURES "@CMAKE_CXX14_COMPILE_FEATURES@")
+
set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@")
set(CMAKE_CXX_SIMULATE_VERSION "@CMAKE_CXX_SIMULATE_VERSION@")
@@ -27,7 +32,7 @@ if(CMAKE_COMPILER_IS_MINGW)
endif()
set(CMAKE_CXX_COMPILER_ID_RUN 1)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
-set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
+set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP)
set(CMAKE_CXX_LINKER_PREFERENCE 30)
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 6c602d4..9ece26d 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -5,215 +5,7 @@
# error "A C compiler has been selected for C++."
#endif
-/* Version number components: V=Version, R=Revision, P=Patch
- Version date components: YYYY=Year, MM=Month, DD=Day */
-
-#if defined(__COMO__)
-# define COMPILER_ID "Comeau"
- /* __COMO_VERSION__ = VRR */
-# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
-
-#elif defined(__INTEL_COMPILER) || defined(__ICC)
-# define COMPILER_ID "Intel"
- /* __INTEL_COMPILER = VRP */
-# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
-# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
-# if defined(__INTEL_COMPILER_UPDATE)
-# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
-# else
-# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
-# endif
-# if defined(__INTEL_COMPILER_BUILD_DATE)
- /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
-# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
-# endif
-# if defined(_MSC_VER)
-# define SIMULATE_ID "MSVC"
- /* _MSC_VER = VVRR */
-# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
-# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
-# endif
-
-#elif defined(__PATHCC__)
-# define COMPILER_ID "PathScale"
-# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
-# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
-# if defined(__PATHCC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
-# endif
-
-#elif defined(__clang__)
-# if defined(__apple_build_version__)
-# define COMPILER_ID "AppleClang"
-# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
-# else
-# define COMPILER_ID "Clang"
-# endif
-# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
-# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
-# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
-# if defined(_MSC_VER)
-# define SIMULATE_ID "MSVC"
- /* _MSC_VER = VVRR */
-# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
-# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
-# endif
-
-#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
-# define COMPILER_ID "Embarcadero"
-# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
-# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
-# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF)
-
-#elif defined(__BORLANDC__)
-# define COMPILER_ID "Borland"
- /* __BORLANDC__ = 0xVRR */
-# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
-# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
-
-#elif defined(__WATCOMC__)
-# define COMPILER_ID "Watcom"
- /* __WATCOMC__ = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
-
-#elif defined(__SUNPRO_CC)
-# define COMPILER_ID "SunPro"
-# if __SUNPRO_CC >= 0x5100
- /* __SUNPRO_CC = 0xVRRP */
-# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
-# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
-# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
-# else
- /* __SUNPRO_CC = 0xVRP */
-# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
-# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
-# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
-# endif
-
-#elif defined(__HP_aCC)
-# define COMPILER_ID "HP"
- /* __HP_aCC = VVRRPP */
-# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
-# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
-# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
-
-#elif defined(__DECCXX)
-# define COMPILER_ID "Compaq"
- /* __DECCXX_VER = VVRRTPPPP */
-# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
-# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
-# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
-
-#elif defined(__IBMCPP__)
-# if defined(__COMPILER_VER__)
-# define COMPILER_ID "zOS"
-# else
-# if __IBMCPP__ >= 800
-# define COMPILER_ID "XL"
-# else
-# define COMPILER_ID "VisualAge"
-# endif
- /* __IBMCPP__ = VRP */
-# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
-# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
-# endif
-
-#elif defined(__PGI)
-# define COMPILER_ID "PGI"
-# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
-# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
-# if defined(__PGIC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
-# endif
-
-#elif defined(_CRAYC)
-# define COMPILER_ID "Cray"
-# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
-# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
-
-#elif defined(__TI_COMPILER_VERSION__)
-# define COMPILER_ID "TI"
- /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
-# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
-# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
-# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
-
-#elif defined(__SCO_VERSION__)
-# define COMPILER_ID "SCO"
-
-#elif defined(__GNUC__)
-# define COMPILER_ID "GNU"
-# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
-# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
-# if defined(__GNUC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
-# endif
-
-#elif defined(_MSC_VER)
-# define COMPILER_ID "MSVC"
- /* _MSC_VER = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
-# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
-# if defined(_MSC_FULL_VER)
-# if _MSC_VER >= 1400
- /* _MSC_FULL_VER = VVRRPPPPP */
-# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
-# else
- /* _MSC_FULL_VER = VVRRPPPP */
-# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
-# endif
-# endif
-# if defined(_MSC_BUILD)
-# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
-# endif
-
-/* Analog VisualDSP++ >= 4.5.6 */
-#elif defined(__VISUALDSPVERSION__)
-# define COMPILER_ID "ADSP"
- /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
-# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
-# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
-# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
-
-/* Analog VisualDSP++ < 4.5.6 */
-#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
-# define COMPILER_ID "ADSP"
-
-/* IAR Systems compiler for embedded systems.
- http://www.iar.com */
-#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
-# define COMPILER_ID "IAR"
-
-#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
-# define COMPILER_ID "MIPSpro"
-# if defined(_SGI_COMPILER_VERSION)
- /* _SGI_COMPILER_VERSION = VRP */
-# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
-# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
-# else
- /* _COMPILER_VERSION = VRP */
-# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
-# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
-# endif
-
-/* This compiler is either not known or is too old to define an
- identification macro. Try to identify the platform and guess that
- it is the native compiler. */
-#elif defined(__sgi)
-# define COMPILER_ID "MIPSpro"
-
-#elif defined(__hpux) || defined(__hpua)
-# define COMPILER_ID "HP"
-
-#else /* unknown compiler */
-# define COMPILER_ID ""
-
-#endif
+@CMAKE_CXX_COMPILER_ID_CONTENT@
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 3010a48..72b2857 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -266,10 +266,10 @@ endif()
# Create a static archive incrementally for large object file counts.
# If CMAKE_CXX_CREATE_STATIC_LIBRARY is set it will override these.
if(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE)
- set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND)
- set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH)
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
index abbcda4..19b2bbc 100644
--- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -28,6 +28,7 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
FAIL_REGEX "option.*not supported" # Intel
FAIL_REGEX "invalid argument .*option" # Intel
FAIL_REGEX "ignoring option .*argument required" # Intel
+ FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel
FAIL_REGEX "[Uu]nknown option" # HP
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
FAIL_REGEX "command option .* is not recognized" # XL
@@ -37,5 +38,6 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
FAIL_REGEX "WARNING: unknown flag:" # Open64
FAIL_REGEX "Incorrect command line option:" # Borland
FAIL_REGEX "Warning: illegal option" # SunStudio 12
+ FAIL_REGEX "[Ww]arning: Invalid suboption" # Fujitsu
)
endmacro ()
diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake
index 38a6d35..fa025a8 100644
--- a/Modules/CMakeCommonLanguageInclude.cmake
+++ b/Modules/CMakeCommonLanguageInclude.cmake
@@ -16,9 +16,11 @@
# cache values that can be initialized in the platform-compiler.cmake file
# it may be included by more than one language.
-set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
- CACHE STRING "Flags used by the linker.")
-
+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()
if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
# default build type is none
@@ -82,12 +84,17 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
"Flags used by the linker during Release with Debug Info builds.")
endif()
+
+# executable linker flags
+set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT}"
+ CACHE STRING "Flags used by the linker.")
+
# shared linker flags
-set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
+set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT}"
CACHE STRING "Flags used by the linker during the creation of dll's.")
# module linker flags
-set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
+set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT}"
CACHE STRING "Flags used by the linker during the creation of modules.")
# static linker flags
@@ -124,4 +131,3 @@ CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
CMAKE_STATIC_LINKER_FLAGS_RELEASE
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
)
-
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
new file mode 100644
index 0000000..19bcbcc
--- /dev/null
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -0,0 +1,157 @@
+
+#=============================================================================
+# Copyright 2014 Stephen Kelly <steveire@gmail.com>
+#
+# 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.)
+
+function(_readFile file)
+ include(${file})
+ get_filename_component(name ${file} NAME_WE)
+ string(REGEX REPLACE "-.*" "" CompilerId ${name})
+ set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
+ set(_compiler_id_simulate_${CompilerId} ${_compiler_id_simulate} PARENT_SCOPE)
+ set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE)
+endfunction()
+
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
+
+function(compiler_id_detection outvar lang)
+
+ if (NOT lang STREQUAL Fortran)
+ file(GLOB lang_files
+ "${CMAKE_ROOT}/Modules/Compiler/*-DetermineCompiler.cmake")
+ set(nonlang CXX)
+ if (lang STREQUAL CXX)
+ set(nonlang C)
+ endif()
+
+ file(GLOB nonlang_files
+ "${CMAKE_ROOT}/Modules/Compiler/*-${nonlang}-DetermineCompiler.cmake")
+ list(REMOVE_ITEM lang_files ${nonlang_files})
+ endif()
+
+ set(files ${lang_files})
+ if (files)
+ foreach(file ${files})
+ _readFile(${file})
+ endforeach()
+
+ set(options ID_STRING VERSION_STRINGS ID_DEFINE PLATFORM_DEFAULT_COMPILER)
+ set(oneValueArgs PREFIX)
+ cmake_parse_arguments(CID "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ if (CID_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unrecognized arguments: \"${CID_UNPARSED_ARGUMENTS}\"")
+ endif()
+
+ # Order is relevant here. For example, compilers which pretend to be
+ # GCC must appear before the actual GCC.
+ if (lang STREQUAL CXX)
+ list(APPEND ordered_compilers
+ Comeau
+ )
+ endif()
+ list(APPEND ordered_compilers
+ Intel
+ PathScale
+ Embarcadero
+ Borland
+ Watcom
+ OpenWatcom
+ SunPro
+ HP
+ Compaq
+ zOS
+ XL
+ VisualAge
+ PGI
+ Cray
+ TI
+ Fujitsu
+ )
+ if (lang STREQUAL C)
+ list(APPEND ordered_compilers
+ TinyCC
+ )
+ endif()
+ list(APPEND ordered_compilers
+ SCO
+ AppleClang
+ Clang
+ GNU
+ MSVC
+ ADSP
+ IAR
+ )
+ if (lang STREQUAL C)
+ list(APPEND ordered_compilers
+ SDCC
+ )
+ endif()
+ list(APPEND ordered_compilers
+ MIPSpro)
+
+ if(CID_ID_DEFINE)
+ foreach(Id ${ordered_compilers})
+ set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n")
+ endforeach()
+ endif()
+
+ set(pp_if "#if")
+ if (CID_VERSION_STRINGS)
+ set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n/* Version number components: V=Version, R=Revision, P=Patch
+ Version date components: YYYY=Year, MM=Month, DD=Day */\n")
+ endif()
+
+ foreach(Id ${ordered_compilers})
+ if (NOT _compiler_id_pp_test_${Id})
+ message(FATAL_ERROR "No preprocessor test for \"${Id}\"")
+ endif()
+ set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n")
+ 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}")
+ 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")
+ 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")
+ endif()
+ set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${id_content}")
+ set(pp_if "#elif")
+ endforeach()
+
+ if (CID_PLATFORM_DEFAULT_COMPILER)
+ set(platform_compiler_detection "
+/* These compilers are either not known or too old to define an
+ identification macro. Try to identify the platform and guess that
+ it is the native compiler. */
+#elif defined(__sgi)
+# define ${CID_PREFIX}COMPILER_ID \"MIPSpro\"
+
+#elif defined(__hpux) || defined(__hpua)
+# define ${CID_PREFIX}COMPILER_ID \"HP\"
+
+#else /* unknown compiler */
+# define ${CID_PREFIX}COMPILER_ID \"\"")
+ endif()
+
+ set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${platform_compiler_detection}\n#endif")
+ endif()
+
+ set(${outvar} ${CMAKE_${lang}_COMPILER_ID_CONTENT} PARENT_SCOPE)
+endfunction()
diff --git a/Modules/CMakeConfigurableFile.in b/Modules/CMakeConfigurableFile.in
index 4cf74a1..df2c382 100644
--- a/Modules/CMakeConfigurableFile.in
+++ b/Modules/CMakeConfigurableFile.in
@@ -1,2 +1 @@
@CMAKE_CONFIGURABLE_FILE_CONTENT@
-
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index 1d9617f..25af3e3 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -18,7 +18,7 @@ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
# prefer the environment variable ASM
- if($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
+ if(NOT $ENV{ASM${ASM_DIALECT}} STREQUAL "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}")
endif()
diff --git a/Modules/CMakeDetermineASM_MASMCompiler.cmake b/Modules/CMakeDetermineASM_MASMCompiler.cmake
index 665a65c..142ef95 100644
--- a/Modules/CMakeDetermineASM_MASMCompiler.cmake
+++ b/Modules/CMakeDetermineASM_MASMCompiler.cmake
@@ -17,7 +17,8 @@
set(ASM_DIALECT "_MASM")
# if we are using the 64bit cl compiler, assume we also want the 64bit assembler
-if(CMAKE_CL_64)
+if(";${CMAKE_VS_PLATFORM_NAME};${MSVC_C_ARCHITECTURE_ID};${MSVC_CXX_ARCHITECTURE_ID};"
+ MATCHES ";(Win64|Itanium|x64|IA64);")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64)
else()
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml)
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 2b8ecdc..6b425c6 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -48,7 +48,7 @@ else()
set(CMAKE_C_COMPILER_INIT NOTFOUND)
# prefer the environment variable CC
- if($ENV{CC} MATCHES ".+")
+ if(NOT $ENV{CC} STREQUAL "")
get_filename_component(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT)
if(CMAKE_C_FLAGS_ENV_INIT)
set(CMAKE_C_COMPILER_ARG1 "${CMAKE_C_FLAGS_ENV_INIT}" CACHE STRING "First argument to C compiler")
@@ -140,7 +140,7 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-)
endif()
elseif(COMPILER_BASENAME MATCHES "qcc(\\.exe)?$")
- if(CMAKE_C_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?.*$")
+ if(CMAKE_C_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?")
set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
endif()
endif ()
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 9af1de1..893c454 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -47,7 +47,7 @@ else()
set(CMAKE_CXX_COMPILER_INIT NOTFOUND)
# prefer the environment variable CXX
- if($ENV{CXX} MATCHES ".+")
+ if(NOT $ENV{CXX} STREQUAL "")
get_filename_component(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT)
if(CMAKE_CXX_FLAGS_ENV_INIT)
set(CMAKE_CXX_COMPILER_ARG1 "${CMAKE_CXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler")
@@ -137,7 +137,7 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-)
endif()
elseif(COMPILER_BASENAME MATCHES "QCC(\\.exe)?$")
- if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?.*$")
+ if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?")
set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
endif()
endif ()
diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake
new file mode 100644
index 0000000..2bb7a74
--- /dev/null
+++ b/Modules/CMakeDetermineCompileFeatures.cmake
@@ -0,0 +1,94 @@
+
+#=============================================================================
+# Copyright 2013 Stephen Kelly <steveire@gmail.com>
+#
+# 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.)
+
+function(cmake_determine_compile_features lang)
+
+ if(lang STREQUAL C AND COMMAND cmake_record_c_compile_features)
+ message(STATUS "Detecting ${lang} compile features")
+
+ set(CMAKE_C90_COMPILE_FEATURES)
+ set(CMAKE_C99_COMPILE_FEATURES)
+ set(CMAKE_C11_COMPILE_FEATURES)
+
+ include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
+
+ cmake_record_c_compile_features()
+
+ if(NOT _result EQUAL 0)
+ message(STATUS "Detecting ${lang} compile features - failed")
+ return()
+ endif()
+
+ if (CMAKE_C99_COMPILE_FEATURES AND CMAKE_C11_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_C11_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES})
+ endif()
+ if (CMAKE_C90_COMPILE_FEATURES AND CMAKE_C99_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_C99_COMPILE_FEATURES ${CMAKE_C90_COMPILE_FEATURES})
+ endif()
+
+ if(NOT CMAKE_C_COMPILE_FEATURES)
+ set(CMAKE_C_COMPILE_FEATURES
+ ${CMAKE_C90_COMPILE_FEATURES}
+ ${CMAKE_C99_COMPILE_FEATURES}
+ ${CMAKE_C11_COMPILE_FEATURES}
+ )
+ endif()
+
+ set(CMAKE_C_COMPILE_FEATURES ${CMAKE_C_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_C90_COMPILE_FEATURES ${CMAKE_C90_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_C99_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_C11_COMPILE_FEATURES ${CMAKE_C11_COMPILE_FEATURES} PARENT_SCOPE)
+
+ message(STATUS "Detecting ${lang} compile features - done")
+
+ elseif(lang STREQUAL CXX AND COMMAND cmake_record_cxx_compile_features)
+ message(STATUS "Detecting ${lang} compile features")
+
+ set(CMAKE_CXX98_COMPILE_FEATURES)
+ set(CMAKE_CXX11_COMPILE_FEATURES)
+ set(CMAKE_CXX14_COMPILE_FEATURES)
+
+ include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
+
+ cmake_record_cxx_compile_features()
+
+ if(NOT _result EQUAL 0)
+ message(STATUS "Detecting ${lang} compile features - failed")
+ return()
+ endif()
+
+ if (CMAKE_CXX11_COMPILE_FEATURES AND CMAKE_CXX14_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES})
+ endif()
+ if (CMAKE_CXX98_COMPILE_FEATURES AND CMAKE_CXX11_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES})
+ endif()
+
+ if(NOT CMAKE_CXX_COMPILE_FEATURES)
+ set(CMAKE_CXX_COMPILE_FEATURES
+ ${CMAKE_CXX98_COMPILE_FEATURES}
+ ${CMAKE_CXX11_COMPILE_FEATURES}
+ ${CMAKE_CXX14_COMPILE_FEATURES}
+ )
+ endif()
+
+ set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CXX98_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES} PARENT_SCOPE)
+
+ message(STATUS "Detecting ${lang} compile features - done")
+ endif()
+
+endfunction()
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake
index cd0f8b8..0ab3af6 100644
--- a/Modules/CMakeDetermineCompiler.cmake
+++ b/Modules/CMakeDetermineCompiler.cmake
@@ -65,7 +65,7 @@ macro(_cmake_find_compiler lang)
endif()
find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler")
if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER)
- set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_INIT}" CACHE FILEPATH "${lang} compiler" FORCE)
+ set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}")
endif()
unset(_${lang}_COMPILER_HINTS)
unset(_languages)
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 5d35ce3..4bc42dd 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -28,13 +28,15 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
endif()
+ if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC")
+ # Avoid adding our own platform standard libraries for compilers
+ # from which we might detect implicit link libraries.
+ list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=")
+ endif()
try_compile(CMAKE_${lang}_ABI_COMPILED
${CMAKE_BINARY_DIR} ${src}
- CMAKE_FLAGS "${CMAKE_FLAGS}"
- "-DCMAKE_${lang}_STANDARD_LIBRARIES="
- # We need ignore these warnings because some platforms need
- # CMAKE_${lang}_STANDARD_LIBRARIES to link properly and we
- # don't care when we are just determining the ABI.
+ CMAKE_FLAGS ${CMAKE_FLAGS}
+ # Ignore unused flags when we are just determining the ABI.
"--no-warn-unused-cli"
OUTPUT_VARIABLE OUTPUT
COPY_FILE "${BIN}"
@@ -50,13 +52,13 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
message(STATUS "Detecting ${lang} compiler ABI info - done")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n")
- file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[")
+ file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
foreach(info ${ABI_STRINGS})
- if("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
- string(REGEX REPLACE ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*" "\\1" ABI_SIZEOF_DPTR "${info}")
+ if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]")
+ set(ABI_SIZEOF_DPTR "${CMAKE_MATCH_1}")
endif()
- if("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
- string(REGEX REPLACE ".*INFO:abi\\[([^]]*)\\].*" "\\1" ABI_NAME "${info}")
+ if("${info}" MATCHES "INFO:abi\\[([^]]*)\\]")
+ set(ABI_NAME "${CMAKE_MATCH_1}")
endif()
endforeach()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 067892d..e00f22a 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -27,7 +27,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
else()
set(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}})
endif()
- string(REGEX REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}")
+ string(REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}")
# Compute the directory in which to run the test.
set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang})
@@ -97,11 +97,20 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
endfunction()
+include(CMakeCompilerIdDetection)
+
#-----------------------------------------------------------------------------
# Function to write the compiler id source file.
function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
find_file(src_in ${src}.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
file(READ ${src_in} ID_CONTENT_IN)
+
+ compiler_id_detection(CMAKE_${lang}_COMPILER_ID_CONTENT ${lang}
+ ID_STRING
+ VERSION_STRINGS
+ PLATFORM_DEFAULT_COMPILER
+ )
+
unset(src_in CACHE)
string(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY)
file(WRITE ${CMAKE_${lang}_COMPILER_ID_DIR}/${src} "${ID_CONTENT_OUT}")
@@ -159,6 +168,23 @@ Id flags: ${testflags}
else()
set(id_toolset "")
endif()
+ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
+ set(id_system "<ApplicationType>Windows Phone</ApplicationType>")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set(id_system "<ApplicationType>Windows Store</ApplicationType>")
+ else()
+ set(id_system "")
+ endif()
+ if(id_system AND CMAKE_SYSTEM_VERSION)
+ set(id_system_version "<ApplicationTypeRevision>${CMAKE_SYSTEM_VERSION}</ApplicationTypeRevision>")
+ else()
+ set(id_system_version "")
+ endif()
+ if(id_platform STREQUAL ARM)
+ set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>")
+ else()
+ set(id_WindowsSDKDesktopARMSupport "")
+ endif()
if(CMAKE_VS_WINCE_VERSION)
set(id_entrypoint "mainACRTStartup")
if("${vs_version}" VERSION_LESS 9)
@@ -215,6 +241,17 @@ Id flags: ${testflags}
else()
set(id_toolset "")
endif()
+ if(CMAKE_OSX_DEPLOYMENT_TARGET)
+ set(id_deployment_target
+ "MACOSX_DEPLOYMENT_TARGET = \"${CMAKE_OSX_DEPLOYMENT_TARGET}\";")
+ else()
+ set(id_deployment_target "")
+ endif()
+ if(CMAKE_OSX_SYSROOT)
+ set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";")
+ else()
+ set(id_sdkroot "")
+ endif()
if(NOT ${XCODE_VERSION} VERSION_LESS 3)
set(v 3)
set(ext xcodeproj)
@@ -353,38 +390,33 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(SIMULATE_ID)
set(SIMULATE_VERSION)
file(STRINGS ${file}
- CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:")
+ CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
set(COMPILER_ID_TWICE)
foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
- if("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*")
+ if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]")
if(COMPILER_ID)
set(COMPILER_ID_TWICE 1)
endif()
- string(REGEX REPLACE ".*INFO:compiler\\[([^]]*)\\].*" "\\1"
- COMPILER_ID "${info}")
+ set(COMPILER_ID "${CMAKE_MATCH_1}")
endif()
- if("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*")
- string(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1"
- PLATFORM_ID "${info}")
+ if("${info}" MATCHES "INFO:platform\\[([^]\"]*)\\]")
+ set(PLATFORM_ID "${CMAKE_MATCH_1}")
endif()
- if("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*")
- string(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1"
- ARCHITECTURE_ID "${info}")
+ if("${info}" MATCHES "INFO:arch\\[([^]\"]*)\\]")
+ set(ARCHITECTURE_ID "${CMAKE_MATCH_1}")
endif()
- if("${info}" MATCHES ".*INFO:compiler_version\\[([^]\"]*)\\].*")
- string(REGEX REPLACE ".*INFO:compiler_version\\[([^]]*)\\].*" "\\1" COMPILER_VERSION "${info}")
- string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${COMPILER_VERSION}")
+ if("${info}" MATCHES "INFO:compiler_version\\[([^]\"]*)\\]")
+ string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}")
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
endif()
- if("${info}" MATCHES ".*INFO:simulate\\[([^]\"]*)\\].*")
+ if("${info}" MATCHES "INFO:simulate\\[([^]\"]*)\\]")
set(SIMULATE_ID "${CMAKE_MATCH_1}")
endif()
- if("${info}" MATCHES ".*INFO:simulate_version\\[([^]\"]*)\\].*")
- set(SIMULATE_VERSION "${CMAKE_MATCH_1}")
- string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${SIMULATE_VERSION}")
+ if("${info}" MATCHES "INFO:simulate_version\\[([^]\"]*)\\]")
+ string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${CMAKE_MATCH_1}")
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" SIMULATE_VERSION "${SIMULATE_VERSION}")
endif()
- if("${info}" MATCHES ".*INFO:qnxnto")
+ if("${info}" MATCHES "INFO:qnxnto")
set(COMPILER_QNXNTO 1)
endif()
endforeach()
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index d38bf25..96df6a2 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -32,7 +32,7 @@ elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
else()
if(NOT CMAKE_Fortran_COMPILER)
# prefer the environment variable CC
- if($ENV{FC} MATCHES ".+")
+ if(NOT $ENV{FC} STREQUAL "")
get_filename_component(CMAKE_Fortran_COMPILER_INIT $ENV{FC} PROGRAM PROGRAM_ARGS CMAKE_Fortran_FLAGS_ENV_INIT)
if(CMAKE_Fortran_FLAGS_ENV_INIT)
set(CMAKE_Fortran_COMPILER_ARG1 "${CMAKE_Fortran_FLAGS_ENV_INIT}" CACHE STRING "First argument to Fortran compiler")
@@ -130,7 +130,7 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
ARGS ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\""
OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
if(NOT CMAKE_COMPILER_RETURN)
- if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
+ if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_GNU")
set(CMAKE_Fortran_COMPILER_ID "GNU")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the Fortran compiler is GNU succeeded with "
@@ -141,10 +141,10 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
"the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
endif()
if(NOT CMAKE_Fortran_PLATFORM_ID)
- if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" )
+ if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_MINGW")
set(CMAKE_Fortran_PLATFORM_ID "MinGW")
endif()
- if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
+ if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_CYGWIN")
set(CMAKE_Fortran_PLATFORM_ID "Cygwin")
endif()
endif()
diff --git a/Modules/CMakeDetermineJavaCompiler.cmake b/Modules/CMakeDetermineJavaCompiler.cmake
index 7ae7856..f657801 100644
--- a/Modules/CMakeDetermineJavaCompiler.cmake
+++ b/Modules/CMakeDetermineJavaCompiler.cmake
@@ -18,7 +18,7 @@
if(NOT CMAKE_Java_COMPILER)
# prefer the environment variable CC
- if($ENV{JAVA_COMPILER} MATCHES ".+")
+ if(NOT $ENV{JAVA_COMPILER} STREQUAL "")
get_filename_component(CMAKE_Java_COMPILER_INIT $ENV{JAVA_COMPILER} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
if(CMAKE_Java_FLAGS_ENV_INIT)
set(CMAKE_Java_COMPILER_ARG1 "${CMAKE_Java_FLAGS_ENV_INIT}" CACHE STRING "First argument to Java compiler")
@@ -28,14 +28,14 @@ if(NOT CMAKE_Java_COMPILER)
endif()
endif()
- if($ENV{JAVA_RUNTIME} MATCHES ".+")
+ if(NOT $ENV{JAVA_RUNTIME} STREQUAL "")
get_filename_component(CMAKE_Java_RUNTIME_INIT $ENV{JAVA_RUNTIME} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
if(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT})
message(SEND_ERROR "Could not find compiler set in environment variable JAVA_RUNTIME:\n$ENV{JAVA_RUNTIME}.")
endif()
endif()
- if($ENV{JAVA_ARCHIVE} MATCHES ".+")
+ if(NOT $ENV{JAVA_ARCHIVE} STREQUAL "")
get_filename_component(CMAKE_Java_ARCHIVE_INIT $ENV{JAVA_ARCHIVE} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
if(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT})
message(SEND_ERROR "Could not find compiler set in environment variable JAVA_ARCHIVE:\n$ENV{JAVA_ARCHIVE}.")
diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake
index f23846e..e5414eb 100644
--- a/Modules/CMakeDetermineRCCompiler.cmake
+++ b/Modules/CMakeDetermineRCCompiler.cmake
@@ -20,7 +20,7 @@
# as a default compiler
if(NOT CMAKE_RC_COMPILER)
# prefer the environment variable RC
- if($ENV{RC} MATCHES ".+")
+ if(NOT $ENV{RC} STREQUAL "")
get_filename_component(CMAKE_RC_COMPILER_INIT $ENV{RC} PROGRAM PROGRAM_ARGS CMAKE_RC_FLAGS_ENV_INIT)
if(CMAKE_RC_FLAGS_ENV_INIT)
set(CMAKE_RC_COMPILER_ARG1 "${CMAKE_RC_FLAGS_ENV_INIT}" CACHE STRING "First argument to RC compiler")
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index f1bad99..fe292ea 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -47,7 +47,7 @@ if(CMAKE_HOST_UNIX)
if(CMAKE_UNAME)
exec_program(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME)
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
- if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin")
+ if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin|^GNU$")
exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND
@@ -72,8 +72,8 @@ if(CMAKE_HOST_UNIX)
endif()
set(CMAKE_UNAME ${CMAKE_UNAME} CACHE INTERNAL "uname command")
# processor may have double quote in the name, and that needs to be removed
- string(REGEX REPLACE "\"" "" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
- string(REGEX REPLACE "/" "_" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
+ string(REPLACE "\"" "" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
+ string(REPLACE "/" "_" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
endif()
else()
if(CMAKE_HOST_WIN32)
diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake
index 2854387..6886084 100644
--- a/Modules/CMakeDetermineVSServicePack.cmake
+++ b/Modules/CMakeDetermineVSServicePack.cmake
@@ -43,6 +43,13 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.8)
+ message(DEPRECATION
+ "This module is deprecated and should not be used. "
+ "Use the CMAKE_<LANG>_COMPILER_VERSION variable instead."
+ )
+endif()
+
# [INTERNAL]
# Please do not call this function directly
function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version)
diff --git a/Modules/CMakeExportBuildSettings.cmake b/Modules/CMakeExportBuildSettings.cmake
index 90a7a89..a8dd8c2 100644
--- a/Modules/CMakeExportBuildSettings.cmake
+++ b/Modules/CMakeExportBuildSettings.cmake
@@ -27,7 +27,7 @@ endif()
# loaded by another project using CMAKE_IMPORT_BUILD_SETTINGS. Now it
# creates a file that refuses to load (with comment explaining why).
macro(CMAKE_EXPORT_BUILD_SETTINGS SETTINGS_FILE)
- if(${SETTINGS_FILE} MATCHES ".+")
+ if(NOT ${SETTINGS_FILE} STREQUAL "")
configure_file(${CMAKE_ROOT}/Modules/CMakeBuildSettings.cmake.in
${SETTINGS_FILE} @ONLY)
else()
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 829b6ff..dda28bd 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -66,9 +66,7 @@ else()
endif()
-
-# on Apple there really should be install_name_tool
-if(APPLE)
+if(CMAKE_PLATFORM_HAS_INSTALLNAME)
find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
if(NOT CMAKE_INSTALL_NAME_TOOL)
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index 080dc68..d638207 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -194,10 +194,10 @@ endif()
# Create a static archive incrementally for large object file counts.
# If CMAKE_Fortran_CREATE_STATIC_LIBRARY is set it will override these.
if(NOT DEFINED CMAKE_Fortran_ARCHIVE_CREATE)
- set(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND)
- set(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH)
set(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
diff --git a/Modules/CMakeImportBuildSettings.cmake b/Modules/CMakeImportBuildSettings.cmake
index 60b887a..edecc1f 100644
--- a/Modules/CMakeImportBuildSettings.cmake
+++ b/Modules/CMakeImportBuildSettings.cmake
@@ -17,8 +17,7 @@
# This macro used to load build settings from another project that
# stored settings using the CMAKE_EXPORT_BUILD_SETTINGS macro.
macro(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
- if(${SETTINGS_FILE} MATCHES ".+")
- else()
+ if("${SETTINGS_FILE}" STREQUAL "")
message(SEND_ERROR "CMAKE_IMPORT_BUILD_SETTINGS called with no argument.")
endif()
endmacro()
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 473bbe5..c6dc141 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -2,29 +2,36 @@
# CMakePackageConfigHelpers
# -------------------------
#
-# CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE()
+# Helpers functions for creating config files that can be included by other
+# projects to find and use a package.
#
+# Adds the :command:`configure_package_config_file()` and
+# :command:`write_basic_package_version_file()` commands.
#
+# Generating a Package Configuration File
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
-# ::
+# .. command:: configure_package_config_file
#
-# CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path>
+# Create a config file for a project::
+#
+# configure_package_config_file(<input> <output> INSTALL_DESTINATION <path>
# [PATH_VARS <var1> <var2> ... <varN>]
# [NO_SET_AND_CHECK_MACRO]
-# [NO_CHECK_REQUIRED_COMPONENTS_MACRO])
-#
+# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]
+# [INSTALL_PREFIX <path>])
#
#
-# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain
-# configure_file() command when creating the <Name>Config.cmake or
-# <Name>-config.cmake file for installing a project or library. It
-# helps making the resulting package relocatable by avoiding hardcoded
-# paths in the installed Config.cmake file.
+# ``configure_package_config_file()`` should be used instead of the plain
+# :command:`configure_file()` command when creating the ``<Name>Config.cmake``
+# or ``<Name>-config.cmake`` file for installing a project or library. It helps
+# making the resulting package relocatable by avoiding hardcoded paths in the
+# installed ``Config.cmake`` file.
#
-# In a FooConfig.cmake file there may be code like this to make the
-# install destinations know to the using project:
+# In a ``FooConfig.cmake`` file there may be code like this to make the install
+# destinations know to the using project:
#
-# ::
+# .. code-block:: cmake
#
# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" )
# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" )
@@ -32,121 +39,133 @@
# ...logic to determine installedPrefix from the own location...
# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" )
#
-# All 4 options shown above are not sufficient, since the first 3
-# hardcode the absolute directory locations, and the 4th case works only
-# if the logic to determine the installedPrefix is correct, and if
-# CONFIG_INSTALL_DIR contains a relative path, which in general cannot
-# be guaranteed. This has the effect that the resulting FooConfig.cmake
-# file would work poorly under Windows and OSX, where users are used to
-# choose the install location of a binary package at install time,
-# independent from how CMAKE_INSTALL_PREFIX was set at build/cmake time.
-#
-# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it
-# makes the resulting FooConfig.cmake file relocatable. Usage:
-#
-# ::
-#
-# 1. write a FooConfig.cmake.in file as you are used to
-# 2. insert a line containing only the string "@PACKAGE_INIT@"
-# 3. instead of set(FOO_DIR "@SOME_INSTALL_DIR@"), use set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")
-# (this must be after the @PACKAGE_INIT@ line)
-# 4. instead of using the normal configure_file(), use CONFIGURE_PACKAGE_CONFIG_FILE()
-#
-#
-#
-# The <input> and <output> arguments are the input and output file, the
-# same way as in configure_file().
-#
-# The <path> given to INSTALL_DESTINATION must be the destination where
-# the FooConfig.cmake file will be installed to. This can either be a
-# relative or absolute path, both work.
-#
-# The variables <var1> to <varN> given as PATH_VARS are the variables
-# which contain install destinations. For each of them the macro will
-# create a helper variable PACKAGE_<var...>. These helper variables
-# must be used in the FooConfig.cmake.in file for setting the installed
-# location. They are calculated by CONFIGURE_PACKAGE_CONFIG_FILE() so
-# that they are always relative to the installed location of the
-# package. This works both for relative and also for absolute
-# locations. For absolute locations it works only if the absolute
-# location is a subdirectory of CMAKE_INSTALL_PREFIX.
-#
-# By default configure_package_config_file() also generates two helper
-# macros, set_and_check() and check_required_components() into the
-# FooConfig.cmake file.
-#
-# set_and_check() should be used instead of the normal set() command for
-# setting directories and file locations. Additionally to setting the
-# variable it also checks that the referenced file or directory actually
-# exists and fails with a FATAL_ERROR otherwise. This makes sure that
-# the created FooConfig.cmake file does not contain wrong references.
-# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated
-# into the FooConfig.cmake file.
-#
-# check_required_components(<package_name>) should be called at the end
-# of the FooConfig.cmake file if the package supports components. This
-# macro checks whether all requested, non-optional components have been
-# found, and if this is not the case, sets the Foo_FOUND variable to
-# FALSE, so that the package is considered to be not found. It does
-# that by testing the Foo_<Component>_FOUND variables for all requested
-# required components. When using the NO_CHECK_REQUIRED_COMPONENTS
-# option, this macro is not generated into the FooConfig.cmake file.
+# All 4 options shown above are not sufficient, since the first 3 hardcode the
+# absolute directory locations, and the 4th case works only if the logic to
+# determine the ``installedPrefix`` is correct, and if ``CONFIG_INSTALL_DIR``
+# contains a relative path, which in general cannot be guaranteed. This has the
+# effect that the resulting ``FooConfig.cmake`` file would work poorly under
+# Windows and OSX, where users are used to choose the install location of a
+# binary package at install time, independent from how
+# :variable:`CMAKE_INSTALL_PREFIX` was set at build/cmake time.
+#
+# Using ``configure_package_config_file`` helps. If used correctly, it makes
+# the resulting ``FooConfig.cmake`` file relocatable. Usage:
+#
+# 1. write a ``FooConfig.cmake.in`` file as you are used to
+# 2. insert a line containing only the string ``@PACKAGE_INIT@``
+# 3. instead of ``set(FOO_DIR "@SOME_INSTALL_DIR@")``, use
+# ``set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")`` (this must be after the
+# ``@PACKAGE_INIT@`` line)
+# 4. instead of using the normal :command:`configure_file()`, use
+# ``configure_package_config_file()``
+#
+#
+#
+# The ``<input>`` and ``<output>`` arguments are the input and output file, the
+# same way as in :command:`configure_file()`.
+#
+# The ``<path>`` given to ``INSTALL_DESTINATION`` must be the destination where
+# the ``FooConfig.cmake`` file will be installed to. This path can either be
+# absolute, or relative to the ``INSTALL_PREFIX`` path.
+#
+# The variables ``<var1>`` to ``<varN>`` given as ``PATH_VARS`` are the
+# variables which contain install destinations. For each of them the macro will
+# create a helper variable ``PACKAGE_<var...>``. These helper variables must be
+# used in the ``FooConfig.cmake.in`` file for setting the installed location.
+# They are calculated by ``configure_package_config_file`` so that they are
+# always relative to the installed location of the package. This works both for
+# relative and also for absolute locations. For absolute locations it works
+# only if the absolute location is a subdirectory of ``INSTALL_PREFIX``.
+#
+# If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to
+# calculate all the relative paths. The ``<path>`` argument must be an absolute
+# path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX`
+# variable will be used instead. The default value is good when generating a
+# FooConfig.cmake file to use your package from the install tree. When
+# generating a FooConfig.cmake file to use your package from the build tree this
+# option should be used.
+#
+# By default ``configure_package_config_file`` also generates two helper macros,
+# ``set_and_check()`` and ``check_required_components()`` into the
+# ``FooConfig.cmake`` file.
+#
+# ``set_and_check()`` should be used instead of the normal ``set()`` command for
+# setting directories and file locations. Additionally to setting the variable
+# it also checks that the referenced file or directory actually exists and fails
+# with a ``FATAL_ERROR`` otherwise. This makes sure that the created
+# ``FooConfig.cmake`` file does not contain wrong references.
+# When using the ``NO_SET_AND_CHECK_MACRO``, this macro is not generated
+# into the ``FooConfig.cmake`` file.
+#
+# ``check_required_components(<package_name>)`` should be called at the end of
+# the ``FooConfig.cmake`` file if the package supports components. This macro
+# checks whether all requested, non-optional components have been found, and if
+# this is not the case, sets the ``Foo_FOUND`` variable to ``FALSE``, so that
+# the package is considered to be not found. It does that by testing the
+# ``Foo_<Component>_FOUND`` variables for all requested required components.
+# When using the ``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is
+# not generated into the ``FooConfig.cmake`` file.
#
# For an example see below the documentation for
-# WRITE_BASIC_PACKAGE_VERSION_FILE().
-#
-#
-#
-# ::
-#
-# WRITE_BASIC_PACKAGE_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) )
-#
-#
-#
-# Writes a file for use as <package>ConfigVersion.cmake file to
-# <filename>. See the documentation of find_package() for details on
-# this.
-#
-# ::
-#
-# filename is the output filename, it should be in the build tree.
-# major.minor.patch is the version number of the project to be installed
-#
-# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable
-# is used. If this hasn't been set, it errors out.
-#
-# The COMPATIBILITY mode AnyNewerVersion means that the installed
-# package version will be considered compatible if it is newer or
-# exactly the same as the requested version. This mode should be used
-# for packages which are fully backward compatible, also across major
-# versions. If SameMajorVersion is used instead, then the behaviour
-# differs from AnyNewerVersion in that the major version number must be
-# the same as requested, e.g. version 2.0 will not be considered
-# compatible if 1.0 is requested. This mode should be used for packages
-# which guarantee backward compatibility within the same major version.
-# If ExactVersion is used, then the package is only considered
-# compatible if the requested version matches exactly its own version
-# number (not considering the tweak version). For example, version
-# 1.2.3 of a package is only considered compatible to requested version
-# 1.2.3. This mode is for packages without compatibility guarantees.
-# If your project has more elaborated version matching rules, you will
-# need to write your own custom ConfigVersion.cmake file instead of
-# using this macro.
-#
-# Internally, this macro executes configure_file() to create the
-# resulting version file. Depending on the COMPATIBLITY, either the
-# file BasicConfigVersion-SameMajorVersion.cmake.in or
-# BasicConfigVersion-AnyNewerVersion.cmake.in is used. Please note that
+# :command:`write_basic_package_version_file()`.
+#
+# Generating a Package Version File
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# .. command:: write_basic_package_version_file
+#
+# Create a version file for a project::
+#
+# write_basic_package_version_file(<filename>
+# [VERSION <major.minor.patch>]
+# COMPATIBILITY <AnyNewerVersion|SameMajorVersion|ExactVersion> )
+#
+#
+# Writes a file for use as ``<package>ConfigVersion.cmake`` file to
+# ``<filename>``. See the documentation of :command:`find_package()` for
+# details on this.
+#
+# ``<filename>`` is the output filename, it should be in the build tree.
+# ``<major.minor.patch>`` is the version number of the project to be installed.
+#
+# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable is used.
+# If this hasn't been set, it errors out.
+#
+# The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed
+# package version will be considered compatible if it is newer or exactly the
+# same as the requested version. This mode should be used for packages which
+# are fully backward compatible, also across major versions.
+# If ``SameMajorVersion`` is used instead, then the behaviour differs from
+# ``AnyNewerVersion`` in that the major version number must be the same as
+# requested, e.g. version 2.0 will not be considered compatible if 1.0 is
+# requested. This mode should be used for packages which guarantee backward
+# compatibility within the same major version.
+# If ``ExactVersion`` is used, then the package is only considered compatible if
+# the requested version matches exactly its own version number (not considering
+# the tweak version). For example, version 1.2.3 of a package is only
+# considered compatible to requested version 1.2.3. This mode is for packages
+# without compatibility guarantees.
+# If your project has more elaborated version matching rules, you will need to
+# write your own custom ``ConfigVersion.cmake`` file instead of using this
+# macro.
+#
+# Internally, this macro executes :command:`configure_file()` to create the
+# resulting version file. Depending on the ``COMPATIBLITY``, either the file
+# ``BasicConfigVersion-SameMajorVersion.cmake.in`` or
+# ``BasicConfigVersion-AnyNewerVersion.cmake.in`` is used. Please note that
# these two files are internal to CMake and you should not call
-# configure_file() on them yourself, but they can be used as starting
-# point to create more sophisticted custom ConfigVersion.cmake files.
+# :command:`configure_file()` on them yourself, but they can be used as starting
+# point to create more sophisticted custom ``ConfigVersion.cmake`` files.
#
+# Example Generating Package Files
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
+# Example using both :command:`configure_package_config_file` and
+# ``write_basic_package_version_file()``:
#
-# Example using both configure_package_config_file() and
-# write_basic_package_version_file(): CMakeLists.txt:
+# ``CMakeLists.txt``:
#
-# ::
+# .. code-block:: cmake
#
# set(INCLUDE_INSTALL_DIR include/ ... CACHE )
# set(LIB_INSTALL_DIR lib/ ... CACHE )
@@ -162,11 +181,9 @@
# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
# DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake )
#
+# ``FooConfig.cmake.in``:
#
-#
-# With a FooConfig.cmake.in:
-#
-# ::
+# .. code-block:: cmake
#
# set(FOO_VERSION x.y.z)
# ...
@@ -175,10 +192,6 @@
# set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
# set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@")
#
-#
-#
-# ::
-#
# check_required_components(Foo)
@@ -203,11 +216,9 @@ macro(WRITE_BASIC_PACKAGE_VERSION_FILE)
write_basic_config_version_file(${ARGN})
endmacro()
-set(cfpch_dir ${CMAKE_CURRENT_LIST_DIR})
-
function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
- set(oneValueArgs INSTALL_DESTINATION )
+ set(oneValueArgs INSTALL_DESTINATION INSTALL_PREFIX)
set(multiValueArgs PATH_VARS )
cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@@ -220,20 +231,30 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()")
endif()
+ if(DEFINED CCF_INSTALL_PREFIX)
+ if(IS_ABSOLUTE "${CCF_INSTALL_PREFIX}")
+ set(installPrefix "${CCF_INSTALL_PREFIX}")
+ else()
+ message(FATAL_ERROR "INSTALL_PREFIX must be an absolute path")
+ endif()
+ else()
+ set(installPrefix "${CMAKE_INSTALL_PREFIX}")
+ endif()
+
if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}")
set(absInstallDir "${CCF_INSTALL_DESTINATION}")
else()
- set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
+ set(absInstallDir "${installPrefix}/${CCF_INSTALL_DESTINATION}")
endif()
- file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" )
+ file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${installPrefix}" )
foreach(var ${CCF_PATH_VARS})
if(NOT DEFINED ${var})
message(FATAL_ERROR "Variable ${var} does not exist")
else()
if(IS_ABSOLUTE "${${var}}")
- string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}"
+ string(REPLACE "${installPrefix}" "\${PACKAGE_PREFIX_DIR}"
PACKAGE_${var} "${${var}}")
else()
set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
@@ -259,7 +280,7 @@ get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE
get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH)
get_filename_component(_realOrig \"${absInstallDir}\" REALPATH)
if(_realCurr STREQUAL _realOrig)
- set(PACKAGE_PREFIX_DIR \"${CMAKE_INSTALL_PREFIX}\")
+ set(PACKAGE_PREFIX_DIR \"${installPrefix}\")
endif()
unset(_realOrig)
unset(_realCurr)
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index 4724a8c..bfcf455 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -64,10 +64,9 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
string(REGEX REPLACE "^-L" "" dir "${arg}")
list(APPEND implicit_dirs_tmp ${dir})
set(log "${log} arg [${arg}] ==> dir [${dir}]\n")
- elseif("${arg}" MATCHES "^-l[^:]")
+ elseif("${arg}" MATCHES "^-l([^:].*)$")
# Unix library.
- string(REGEX REPLACE "^-l" "" lib "${arg}")
- list(APPEND implicit_libs_tmp ${lib})
+ list(APPEND implicit_libs_tmp ${CMAKE_MATCH_1})
set(log "${log} arg [${arg}] ==> lib [${lib}]\n")
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$")
# Unix library full path.
@@ -97,11 +96,10 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
endif()
endforeach()
break()
- elseif("${line}" MATCHES "LPATH(=| is:? )")
+ elseif("${line}" MATCHES "LPATH(=| is:? *)(.*)$")
set(log "${log} LPATH line: [${line}]\n")
# HP search path.
- string(REGEX REPLACE ".*LPATH(=| is:? *)" "" paths "${line}")
- string(REPLACE ":" ";" paths "${paths}")
+ string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}")
list(APPEND implicit_dirs_tmp ${paths})
set(log "${log} dirs [${paths}]\n")
else()
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index 1e41fec..bc26c07 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -74,6 +74,23 @@
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
+#elif defined(__WATCOMC__)
+# if defined(__LINUX__)
+# define PLATFORM_ID "Linux"
+
+# elif defined(__DOS__)
+# define PLATFORM_ID "DOS"
+
+# elif defined(__OS2__)
+# define PLATFORM_ID "OS2"
+
+# elif defined(__WINDOWS__)
+# define PLATFORM_ID "Windows3x"
+
+# else /* unknown platform */
+# define PLATFORM_ID ""
+# endif
+
#else /* unknown platform */
# define PLATFORM_ID ""
@@ -107,6 +124,17 @@
# define ARCHITECTURE_ID ""
# endif
+#elif defined(__WATCOMC__)
+# if defined(_M_I86)
+# define ARCHITECTURE_ID "I86"
+
+# elif defined(_M_IX86)
+# define ARCHITECTURE_ID "X86"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
+
#else
# define ARCHITECTURE_ID ""
#endif
diff --git a/Modules/CMakePushCheckState.cmake b/Modules/CMakePushCheckState.cmake
index 39f0023..bf4ec0e 100644
--- a/Modules/CMakePushCheckState.cmake
+++ b/Modules/CMakePushCheckState.cmake
@@ -53,6 +53,7 @@ macro(CMAKE_RESET_CHECK_STATE)
set(CMAKE_REQUIRED_DEFINITIONS)
set(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_FLAGS)
+ set(CMAKE_REQUIRED_QUIET)
endmacro()
@@ -68,6 +69,7 @@ macro(CMAKE_PUSH_CHECK_STATE)
set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS})
+ set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET})
if (ARGC GREATER 0 AND ARGV0 STREQUAL "RESET")
cmake_reset_check_state()
@@ -84,6 +86,7 @@ macro(CMAKE_POP_CHECK_STATE)
set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ set(CMAKE_REQUIRED_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1")
endif()
diff --git a/Modules/CMakeRCCompiler.cmake.in b/Modules/CMakeRCCompiler.cmake.in
index 0fc3142..8257cd6 100644
--- a/Modules/CMakeRCCompiler.cmake.in
+++ b/Modules/CMakeRCCompiler.cmake.in
@@ -1,6 +1,6 @@
set(CMAKE_RC_COMPILER "@CMAKE_RC_COMPILER@")
set(CMAKE_RC_COMPILER_ARG1 "@CMAKE_RC_COMPILER_ARG1@")
set(CMAKE_RC_COMPILER_LOADED 1)
-set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc)
+set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc;RC)
set(CMAKE_RC_OUTPUT_EXTENSION @CMAKE_RC_OUTPUT_EXTENSION@)
set(CMAKE_RC_COMPILER_ENV_VAR "RC")
diff --git a/Modules/CMakeSystemSpecificInitialize.cmake b/Modules/CMakeSystemSpecificInitialize.cmake
new file mode 100644
index 0000000..5327ac1
--- /dev/null
+++ b/Modules/CMakeSystemSpecificInitialize.cmake
@@ -0,0 +1,20 @@
+
+#=============================================================================
+# Copyright 2002-2014 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 file is included by cmGlobalGenerator::EnableLanguage.
+# It is included before the compiler has been determined.
+
+include(Platform/${CMAKE_SYSTEM_NAME}-Initialize OPTIONAL)
+
+set(CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED 1)
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
index d133042..29a58bd 100644
--- a/Modules/CMakeTestCCompiler.cmake
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -73,6 +73,9 @@ else()
# Try to identify the ABI and configure it into CMakeCCompiler.cmake
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
CMAKE_DETERMINE_COMPILER_ABI(C ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c)
+ # Try to identify the compiler features
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake)
+ CMAKE_DETERMINE_COMPILE_FEATURES(C)
# Re-configure to save learned information.
configure_file(
diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake
index a06c92a..81561b2 100644
--- a/Modules/CMakeTestCXXCompiler.cmake
+++ b/Modules/CMakeTestCXXCompiler.cmake
@@ -66,6 +66,9 @@ else()
# Try to identify the ABI and configure it into CMakeCXXCompiler.cmake
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
CMAKE_DETERMINE_COMPILER_ABI(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp)
+ # Try to identify the compiler features
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake)
+ CMAKE_DETERMINE_COMPILE_FEATURES(CXX)
# Re-configure to save learned information.
configure_file(
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 89547af..35259c4 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -418,35 +418,41 @@ if(NOT CPACK_GENERATOR)
if(APPLE)
option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF)
option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF)
- option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" OFF)
option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF)
+ option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" OFF)
else()
option(CPACK_BINARY_TZ "Enable to build TZ packages" ON)
endif()
- option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON)
- option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON)
- option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF)
option(CPACK_BINARY_DEB "Enable to build Debian packages" OFF)
- option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF)
option(CPACK_BINARY_NSIS "Enable to build NSIS packages" OFF)
+ option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF)
+ option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON)
+ option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF)
+ option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON)
+ option(CPACK_BINARY_TXZ "Enable to build TXZ packages" OFF)
endif()
else()
+ option(CPACK_BINARY_7Z "Enable to build 7-Zip packages" OFF)
option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF)
option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF)
endif()
+ option(CPACK_BINARY_IFW "Enable to build IFW packages" OFF)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_7Z 7Z)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle)
- cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop)
- cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker)
- cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_CYGWIN CygwinBinary)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DEB DEB)
- cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_IFW IFW)
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_RPM RPM)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_STGZ STGZ)
- cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TXZ TXZ)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_WIX WIX)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP)
@@ -461,27 +467,51 @@ if(NOT CPACK_SOURCE_GENERATOR)
else()
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)
option(CPACK_SOURCE_TZ "Enable to build TZ source packages" ON)
option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF)
endif()
else()
+ option(CPACK_SOURCE_7Z "Enable to build 7-Zip source packages" ON)
option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON)
endif()
+ 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_TGZ TGZ)
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)
cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TZ TZ)
cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP)
endif()
# mark the above options as advanced
-mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11
- CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2
- CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ
- CPACK_BINARY_NSIS CPACK_BINARY_WIX CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
- CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
- CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
+mark_as_advanced(
+ CPACK_BINARY_7Z
+ CPACK_BINARY_BUNDLE
+ CPACK_BINARY_CYGWIN
+ CPACK_BINARY_DEB
+ CPACK_BINARY_DRAGNDROP
+ CPACK_BINARY_IFW
+ CPACK_BINARY_NSIS
+ CPACK_BINARY_OSXX11
+ CPACK_BINARY_PACKAGEMAKER
+ CPACK_BINARY_RPM
+ CPACK_BINARY_STGZ
+ CPACK_BINARY_TBZ2
+ CPACK_BINARY_TGZ
+ CPACK_BINARY_TXZ
+ CPACK_BINARY_TZ
+ CPACK_BINARY_WIX
+ CPACK_BINARY_ZIP
+ CPACK_SOURCE_7Z
+ CPACK_SOURCE_CYGWIN
+ CPACK_SOURCE_TBZ2
+ CPACK_SOURCE_TGZ
+ CPACK_SOURCE_TXZ
+ CPACK_SOURCE_TZ
+ CPACK_SOURCE_ZIP
+ )
# Set some other variables
cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake
index 1433d9e..5524a3f 100644
--- a/Modules/CPackComponent.cmake
+++ b/Modules/CPackComponent.cmake
@@ -458,6 +458,9 @@ macro(cpack_add_component_group grpname)
cpack_append_string_variable_set_command(
CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION
CPACK_ADDGRP_STR)
+ cpack_append_string_variable_set_command(
+ CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_PARENT_GROUP
+ CPACK_ADDGRP_STR)
cpack_append_option_set_command(
CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED
CPACK_ADDGRP_STR)
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index c79ef06..8a4fa49 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -67,7 +67,12 @@
# * Mandatory : YES
# * Default : 'devel'
#
-# The debian package section
+# .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
+#
+# * Mandatory : YES
+# * Default : 'gzip'
+#
+# Possible values are: lzma, xz, bzip2 and gzip.
#
# .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
#
@@ -235,7 +240,7 @@ if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
# Check version of the dpkg-shlibdeps tool using CPackRPM method
if(SHLIBDEPS_EXECUTABLE)
- execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} --version
+ execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --version
OUTPUT_VARIABLE _TMP_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -254,7 +259,7 @@ if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
OUTPUT_VARIABLE CPACK_DEB_INSTALL_FILES)
# Convert to CMake list
- string(REGEX REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES})
+ string(REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES})
# Only dynamically linked ELF files are included
# Extract only file name infront of ":"
@@ -390,6 +395,12 @@ if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
endif()
+# Compression: (recommended)
+if(NOT CPACK_DEBIAN_COMPRESSION_TYPE)
+ set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
+endif()
+
+
# Recommends:
# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
new file mode 100644
index 0000000..8463b5d
--- /dev/null
+++ b/Modules/CPackIFW.cmake
@@ -0,0 +1,447 @@
+#.rst:
+# CPackIFW
+# --------
+#
+# .. _QtIFW: http://qt-project.org/doc/qtinstallerframework/index.html
+#
+# This module looks for the location of the command line utilities supplied with
+# the Qt Installer Framework (QtIFW_).
+#
+# The module also defines several commands to control the behavior of the
+# CPack ``IFW`` generator.
+#
+#
+# Overview
+# ^^^^^^^^
+#
+# CPack ``IFW`` generator helps you create online and offline
+# binary cross-platform installers with a graphical user interface.
+#
+# CPack IFW generator prepare project installation and generate configuration
+# and meta information for QtIFW_ tools.
+#
+# The QtIFW_ provides a set of tools and utilities to create
+# installers for the supported desktop Qt platforms: Linux, Microsoft Windows,
+# and Mac OS X.
+#
+# To use CPack ``IFW`` generator you must also install QtIFW_.
+#
+# Variables
+# ^^^^^^^^^
+#
+# You can use the following variables to change behavior of CPack ``IFW`` generator.
+#
+# Package
+# """""""
+#
+# .. variable:: CPACK_IFW_PACKAGE_TITLE
+#
+# Name of the installer as displayed on the title bar.
+# By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
+#
+# .. variable:: CPACK_IFW_PACKAGE_PUBLISHER
+#
+# Publisher of the software (as shown in the Windows Control Panel).
+# By default used :variable:`CPACK_PACKAGE_VENDOR`
+#
+# .. variable:: CPACK_IFW_PRODUCT_URL
+#
+# URL to a page that contains product information on your web site.
+#
+# .. variable:: CPACK_IFW_PACKAGE_ICON
+#
+# Filename for a custom installer icon. The actual file is '.icns' (Mac OS X),
+# '.ico' (Windows). No functionality on Unix.
+#
+# .. variable:: CPACK_IFW_PACKAGE_WINDOW_ICON
+#
+# Filename for a custom window icon in PNG format for the Installer application.
+#
+# .. variable:: CPACK_IFW_PACKAGE_LOGO
+#
+# Filename for a logo used as QWizard::LogoPixmap.
+#
+# .. variable:: CPACK_IFW_TARGET_DIRECTORY
+#
+# Default target directory for installation.
+# By default used "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`"
+#
+# You can use predefined variables.
+#
+# .. variable:: CPACK_IFW_ADMIN_TARGET_DIRECTORY
+#
+# Default target directory for installation with administrator rights.
+#
+# You can use predefined variables.
+#
+# .. variable:: CPACK_IFW_PACKAGE_GROUP
+#
+# The group, which will be used to configure the root package
+#
+# .. variable:: CPACK_IFW_PACKAGE_NAME
+#
+# The root package name, which will be used if configuration group is not
+# specified
+#
+# Components
+# """"""""""
+#
+# .. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES
+#
+# Resolve duplicate names when installing components with groups.
+#
+# .. variable:: CPACK_IFW_PACKAGES_DIRECTORIES
+#
+# Additional prepared packages dirs that will be used to resolve
+# dependent components.
+#
+# Advanced
+# """"""""
+#
+# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
+#
+# The path to "binarycreator" command line client.
+#
+# This variable is cached and can be configured user if need.
+#
+# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND
+#
+# True if the "binarycreator" command line client was found.
+#
+# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE
+#
+# The path to "repogen" command line client.
+#
+# This variable is cached and can be configured user if need.
+#
+# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE_FOUND
+#
+# True if the "repogen" command line client was found.
+#
+# Commands
+# ^^^^^^^^^
+#
+# The module defines the following commands:
+#
+# --------------------------------------------------------------------------
+#
+# .. command:: cpack_ifw_configure_component
+#
+# Sets the arguments specific to the CPack IFW generator.
+#
+# ::
+#
+# cpack_ifw_configure_component(<compname> [COMMON]
+# [NAME <name>]
+# [VERSION <version>]
+# [SCRIPT <script>]
+# [PRIORITY <priority>]
+# [DEPENDS <com_id> ...]
+# [LICENSES <display_name> <file_path> ...])
+#
+# This command should be called after cpack_add_component command.
+#
+# ``COMMON`` if set, then the component will be packaged and installed as part
+# of a group to which he belongs.
+#
+# ``VERSION`` is version of component.
+# By default used :variable:`CPACK_PACKAGE_VERSION`.
+#
+# ``SCRIPT`` is relative or absolute path to operations script
+# for this component.
+#
+# ``NAME`` is used to create domain-like identification for this component.
+# By default used origin component name.
+#
+# ``PRIORITY`` is priority of the component in the tree.
+#
+# ``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.
+#
+# --------------------------------------------------------------------------
+#
+# .. command:: cpack_ifw_configure_component_group
+#
+# Sets the arguments specific to the CPack IFW generator.
+#
+# ::
+#
+# cpack_ifw_configure_component_group(<grpname>
+# [VERSION <version>]
+# [NAME <name>]
+# [SCRIPT <script>]
+# [PRIORITY <priority>]
+# [LICENSES <display_name> <file_path> ...])
+#
+# This command should be called after cpack_add_component_group command.
+#
+# ``VERSION`` is version of component group.
+# By default used :variable:`CPACK_PACKAGE_VERSION`.
+#
+# ``NAME`` is used to create domain-like identification for this component group.
+# By default used origin component group name.
+#
+# ``SCRIPT`` is relative or absolute path to operations script
+# for this component group.
+#
+# ``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.
+#
+# Example usage
+# ^^^^^^^^^^^^^
+#
+# .. code-block:: cmake
+#
+# set(CPACK_PACKAGE_NAME "MyPackage")
+# set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyPackage Installation Example")
+# set(CPACK_PACKAGE_VERSION "1.0.0")
+#
+# include(CPack)
+# include(CPackIFW)
+#
+# cpack_add_component(myapp
+# DISPLAY_NAME "MyApp"
+# DESCRIPTION "My Application")
+# cpack_ifw_configure_component(myapp
+# VERSION "1.2.3"
+# SCRIPT "operations.qs")
+#
+#
+# Online installer
+# ^^^^^^^^^^^^^^^^
+#
+# By defaul CPack IFW generator make offline installer. This means that all
+# components will be packaged into a binary file.
+#
+# To make a component downloaded, you must set the ``DOWNLOADED`` option in
+# :command:`cpack_add_component`.
+#
+# Then you would use the command :command:`cpack_configure_downloads`.
+# If you set ``ALL`` option all components will be downloaded.
+#
+# CPack IFW generator create "repository" dir in current binary dir. You
+# would copy content of this dir to specified ``site``.
+#
+# See Also
+# ^^^^^^^^
+#
+# Qt Installer Framework Manual:
+#
+# Index page
+# http://qt-project.org/doc/qtinstallerframework/index.html
+#
+# Component Scripting
+# http://qt-project.org/doc/qtinstallerframework/scripting.html
+#
+# Predefined Variables
+# http://qt-project.org/doc/qtinstallerframework/scripting.html#predefined-variables
+#
+# Download Qt Installer Framework for you platform from Qt Project site:
+# http://download.qt-project.org/official_releases/qt-installer-framework/
+#
+
+#=============================================================================
+# Copyright 2014 Kitware, Inc.
+# Copyright 2014 Konstantin Podsvirov <konstantin@podsvirov.pro>
+#
+# 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.)
+
+#=============================================================================
+# Search Qt Installer Framework tools
+#=============================================================================
+
+# Default path
+
+if(WIN32)
+ set(_CPACK_IFW_PATHS
+ "$ENV{HOMEDRIVE}/Qt"
+ "C:/Qt"
+ )
+else()
+ set(_CPACK_IFW_PATHS
+ "$ENV{HOME}/Qt"
+ "/opt/Qt"
+ )
+endif()
+
+set(_CPACK_IFW_SUFFIXES
+ "QtIFW-1.7.0/bin"
+ "QtIFW-1.6.0/bin"
+ "QtIFW-1.5.0/bin"
+ "QtIFW-1.4.0/bin"
+ "QtIFW-1.3.0/bin"
+)
+
+# Look for 'binarycreator'
+
+if(NOT CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND)
+
+find_program(CPACK_IFW_BINARYCREATOR_EXECUTABLE
+ NAMES binarycreator
+ PATHS ${_CPACK_IFW_PATHS}
+ PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
+ DOC "QtIFW binarycreator command line client"
+ )
+mark_as_advanced(CPACK_IFW_BINARYCREATOR_EXECUTABLE)
+
+if(EXISTS ${CPACK_IFW_BINARYCREATOR_EXECUTABLE})
+ set(CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND 1)
+endif()
+
+endif() # NOT CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND
+
+# Look for 'repogen'
+
+if(NOT CPACK_IFW_REPOGEN_EXECUTABLE_FOUND)
+
+find_program(CPACK_IFW_REPOGEN_EXECUTABLE
+ NAMES repogen
+ PATHS ${_CPACK_IFW_PATHS}
+ PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
+ DOC "QtIFW repogen command line client"
+ )
+mark_as_advanced(CPACK_IFW_REPOGEN_EXECUTABLE)
+
+if(EXISTS ${CPACK_IFW_REPOGEN_EXECUTABLE})
+ set(CPACK_IFW_REPOGEN_EXECUTABLE_FOUND 1)
+endif()
+
+endif() # NOT CPACK_IFW_REPOGEN_EXECUTABLE_FOUND
+
+#
+## Next code is included only once
+#
+
+if(NOT CPackIFW_CMake_INCLUDED)
+set(CPackIFW_CMake_INCLUDED 1)
+
+#=============================================================================
+# Macro definition
+#=============================================================================
+
+# Macro definition based on CPackComponent
+
+if(NOT CPackComponent_CMake_INCLUDED)
+ include(CPackComponent)
+endif()
+
+if(NOT __CMAKE_PARSE_ARGUMENTS_INCLUDED)
+ include(CMakeParseArguments)
+endif()
+
+# Resolve full filename for script file
+macro(_cpack_ifw_resolve_script _variable)
+ set(_ifw_script_macro ${_variable})
+ set(_ifw_script_file ${${_ifw_script_macro}})
+ if(DEFINED ${_ifw_script_macro})
+ get_filename_component(${_ifw_script_macro} ${_ifw_script_file} ABSOLUTE)
+ set(_ifw_script_file ${${_ifw_script_macro}})
+ if(NOT EXISTS ${_ifw_script_file})
+ message(WARNING "CPack IFW: script file \"${_ifw_script_file}\" is not exists")
+ set(${_ifw_script_macro})
+ endif()
+ endif()
+endmacro()
+
+# Resolve full path to lisense file
+macro(_cpack_ifw_resolve_lisenses _variable)
+ if(${_variable})
+ set(_ifw_license_file FALSE)
+ set(_ifw_licenses_fix)
+ foreach(_ifw_licenses_arg ${${_variable}})
+ if(_ifw_license_file)
+ get_filename_component(_ifw_licenses_arg "${_ifw_licenses_arg}" ABSOLUTE)
+ set(_ifw_license_file FALSE)
+ else()
+ set(_ifw_license_file TRUE)
+ endif()
+ list(APPEND _ifw_licenses_fix "${_ifw_licenses_arg}")
+ endforeach(_ifw_licenses_arg)
+ set(${_variable} "${_ifw_licenses_fix}")
+ endif()
+endmacro()
+
+# Macro for configure component
+macro(cpack_ifw_configure_component compname)
+
+ string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME)
+
+ set(_IFW_OPT COMMON)
+ set(_IFW_ARGS VERSION SCRIPT NAME PRIORITY)
+ set(_IFW_MULTI_ARGS DEPENDS LICENSES)
+ 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)
+
+ set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n")
+
+ foreach(_IFW_ARG_NAME ${_IFW_OPT})
+ cpack_append_option_set_command(
+ CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWCOMP_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_ARGS})
+ cpack_append_string_variable_set_command(
+ CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWCOMP_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
+ cpack_append_variable_set_command(
+ CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWCOMP_STR)
+ endforeach()
+
+ if(CPack_CMake_INCLUDED)
+ file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWCOMP_STR}")
+ endif()
+
+endmacro()
+
+# Macro for configure group
+macro(cpack_ifw_configure_component_group grpname)
+
+ string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME)
+
+ set(_IFW_OPT)
+ set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
+ set(_IFW_MULTI_ARGS LICENSES)
+ 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)
+
+ set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n")
+
+ foreach(_IFW_ARG_NAME ${_IFW_ARGS})
+ cpack_append_string_variable_set_command(
+ CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWGRP_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
+ cpack_append_variable_set_command(
+ CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWGRP_STR)
+ endforeach()
+
+ if(CPack_CMake_INCLUDED)
+ file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWGRP_STR}")
+ endif()
+endmacro()
+
+endif() # NOT CPackIFW_CMake_INCLUDED
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index a13a46f..2864b21 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -384,7 +384,7 @@ if(CPACK_RPM_PACKAGE_DEBUG)
OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX REPLACE "\n" ", "
+ string(REPLACE "\n" ", "
LSB_RELEASE_OUTPUT
${_TMP_LSB_RELEASE_OUTPUT})
else ()
@@ -397,7 +397,7 @@ endif()
# to shut down warning about space in buildtree
# some recent RPM version should support space in different places.
# not checked [yet].
-if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*")
+if(CPACK_TOPLEVEL_DIRECTORY MATCHES " ")
message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.")
endif()
diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake
index 39183c6..0a47e19 100644
--- a/Modules/CPackWIX.cmake
+++ b/Modules/CPackWIX.cmake
@@ -216,9 +216,24 @@
# allow other CMake projects to find your package with
# the :command:`find_package` command.
#
+# .. variable:: CPACK_WIX_PROPERTY_<PROPERTY>
+#
+# This variable can be used to provide a value for
+# the Windows Installer property ``<PROPERTY>``
+#
+# The follwing list contains some example properties that can be used to
+# customize information under
+# "Programs and Features" (also known as "Add or Remove Programs")
+#
+# * ARPCOMMENTS - Comments
+# * ARPHELPLINK - Help and support information URL
+# * ARPURLINFOABOUT - General information URL
+# * URLUPDATEINFO - Update information URL
+# * ARPHELPTELEPHONE - Help and support telephone number
+# * ARPSIZE - Size (in kilobytes) of the application
#=============================================================================
-# Copyright 2013 Kitware, Inc.
+# Copyright 2014 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index efdac20..53f3454 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -10,6 +10,7 @@
#
# <flag> - the compiler flag
# <var> - variable to store the result
+# Will be created as an internal cache variable.
#
# This internally calls the check_c_source_compiles macro and sets
# CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index c2f6915..6e80fb5 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -10,6 +10,7 @@
#
# <code> - source code to try to compile, must define 'main'
# <var> - variable to store whether the source code compiled
+# Will be created as an internal cache variable.
# <fail-regex> - fail if test output matches this regex
#
# The following variables may be set before calling this macro to modify
@@ -21,6 +22,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
@@ -38,7 +40,7 @@
macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
- if("${VAR}" MATCHES "^${VAR}$")
+ if(NOT DEFINED "${VAR}")
set(_FAIL_REGEX)
set(_key)
foreach(arg ${ARGN})
@@ -67,7 +69,9 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
"${SOURCE}\n")
- message(STATUS "Performing Test ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR}")
+ endif()
try_compile(${VAR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
@@ -85,13 +89,17 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
if(${VAR})
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
- message(STATUS "Performing Test ${VAR} - Success")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Success")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
else()
- message(STATUS "Performing Test ${VAR} - Failed")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Failed")
+ endif()
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
index 2e68454..0ce423c 100644
--- a/Modules/CheckCSourceRuns.cmake
+++ b/Modules/CheckCSourceRuns.cmake
@@ -11,6 +11,7 @@
# <code> - source code to try to compile
# <var> - variable to store the result
# (1 for success, empty for failure)
+# Will be created as an internal cache variable.
#
# The following variables may be set before calling this macro to modify
# the way the check is run:
@@ -21,6 +22,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -38,7 +40,7 @@
macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
- if("${VAR}" MATCHES "^${VAR}$")
+ if(NOT DEFINED "${VAR}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
@@ -56,7 +58,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
"${SOURCE}\n")
- message(STATUS "Performing Test ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR}")
+ endif()
try_run(${VAR}_EXITCODE ${VAR}_COMPILED
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
@@ -73,7 +77,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
# if the return value was 0 then it worked
if("${${VAR}_EXITCODE}" EQUAL 0)
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
- message(STATUS "Performing Test ${VAR} - Success")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Success")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n"
@@ -86,7 +92,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
endif()
- message(STATUS "Performing Test ${VAR} - Failed")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Failed")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
index c7ef5ec..6d52ec6 100644
--- a/Modules/CheckCXXSourceCompiles.cmake
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -10,6 +10,7 @@
#
# <code> - source code to try to compile, must define 'main'
# <var> - variable to store whether the source code compiled
+# Will be created as an internal cache variable.
# <fail-regex> - fail if test output matches this regex
#
# The following variables may be set before calling this macro to modify
@@ -21,6 +22,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
@@ -38,7 +40,7 @@
macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
- if("${VAR}" MATCHES "^${VAR}$")
+ if(NOT DEFINED "${VAR}")
set(_FAIL_REGEX)
set(_key)
foreach(arg ${ARGN})
@@ -68,7 +70,9 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
"${SOURCE}\n")
- message(STATUS "Performing Test ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR}")
+ endif()
try_compile(${VAR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
@@ -86,13 +90,17 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
if(${VAR})
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
- message(STATUS "Performing Test ${VAR} - Success")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Success")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
else()
- message(STATUS "Performing Test ${VAR} - Failed")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Failed")
+ endif()
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
index 4e3ff6c..3c06d75 100644
--- a/Modules/CheckCXXSourceRuns.cmake
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -11,6 +11,7 @@
# <code> - source code to try to compile
# <var> - variable to store the result
# (1 for success, empty for failure)
+# Will be created as an internal cache variable.
#
# The following variables may be set before calling this macro to modify
# the way the check is run:
@@ -21,6 +22,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -38,7 +40,7 @@
macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
- if("${VAR}" MATCHES "^${VAR}$")
+ if(NOT DEFINED "${VAR}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
@@ -56,7 +58,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
"${SOURCE}\n")
- message(STATUS "Performing Test ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR}")
+ endif()
try_run(${VAR}_EXITCODE ${VAR}_COMPILED
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
@@ -74,7 +78,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
# if the return value was 0 then it worked
if("${${VAR}_EXITCODE}" EQUAL 0)
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
- message(STATUS "Performing Test ${VAR} - Success")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Success")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n"
@@ -87,7 +93,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
endif()
- message(STATUS "Performing Test ${VAR} - Failed")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Failed")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake
index aa62fbf..084fbb4 100644
--- a/Modules/CheckCXXSymbolExists.cmake
+++ b/Modules/CheckCXXSymbolExists.cmake
@@ -27,6 +27,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2003-2011 Kitware, Inc.
diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake
index 0b12289..bd52f61 100644
--- a/Modules/CheckFortranFunctionExists.cmake
+++ b/Modules/CheckFortranFunctionExists.cmake
@@ -10,6 +10,7 @@
#
# FUNCTION - the name of the Fortran function
# VARIABLE - variable to store the result
+# Will be created as an internal cache variable.
#
#
#
diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake
new file mode 100644
index 0000000..f90d05b
--- /dev/null
+++ b/Modules/CheckFortranSourceCompiles.cmake
@@ -0,0 +1,111 @@
+#.rst:
+# CheckFortranSourceCompiles
+# --------------------------
+#
+# Check if given Fortran source compiles and links into an executable::
+#
+# CHECK_Fortran_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>])
+#
+# The arguments are:
+#
+# ``<code>``
+# Source code to try to compile. It must define a PROGRAM entry point.
+# ``<var>``
+# Variable to store whether the source code compiled.
+# Will be created as an internal cache variable.
+# ``<fail-regex>``
+# Fail if test output matches this regex.
+#
+# The following variables may be set before calling this macro to modify
+# the way the check is run::
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
+
+#=============================================================================
+# Copyright 2005-2009 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.)
+
+
+
+macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
+ if(NOT DEFINED "${VAR}")
+ set(_FAIL_REGEX)
+ set(_key)
+ foreach(arg ${ARGN})
+ if("${arg}" MATCHES "^(FAIL_REGEX)$")
+ set(_key "${arg}")
+ elseif(_key)
+ list(APPEND _${_key} "${arg}")
+ else()
+ message(FATAL_ERROR "Unknown argument:\n ${arg}\n")
+ endif()
+ endforeach()
+ set(MACRO_CHECK_FUNCTION_DEFINITIONS
+ "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ if(CMAKE_REQUIRED_LIBRARIES)
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+ else()
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES)
+ endif()
+ if(CMAKE_REQUIRED_INCLUDES)
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ else()
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES)
+ endif()
+ file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F"
+ "${SOURCE}\n")
+
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR}")
+ endif()
+ try_compile(${VAR}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}"
+ OUTPUT_VARIABLE OUTPUT)
+
+ foreach(_regex ${_FAIL_REGEX})
+ if("${OUTPUT}" MATCHES "${_regex}")
+ set(${VAR} 0)
+ endif()
+ endforeach()
+
+ if(${VAR})
+ set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Success")
+ endif()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing Fortran SOURCE FILE Test ${VAR} succeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Source file was:\n${SOURCE}\n")
+ else()
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Failed")
+ endif()
+ set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n"
+ "${OUTPUT}\n"
+ "Source file was:\n${SOURCE}\n")
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index e232bd7..d277c32 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -10,6 +10,7 @@
# store the result in a <variable>. This does not verify that any
# system header file declares the function, only that it can be found at
# link time (consider using CheckSymbolExists).
+# <variable> will be created as an internal cache variable.
#
# The following variables may be set before calling this macro to modify
# the way the check is run:
@@ -20,6 +21,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2002-2011 Kitware, Inc.
@@ -37,10 +39,12 @@
macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
- message(STATUS "Looking for ${FUNCTION}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION}")
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -63,12 +67,16 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}")
- message(STATUS "Looking for ${FUNCTION} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION} - found")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the function ${FUNCTION} exists passed with the following output:\n"
"${OUTPUT}\n\n")
else()
- message(STATUS "Looking for ${FUNCTION} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the function ${FUNCTION} exists failed with the following output:\n"
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
index 9dc1648..402b37c 100644
--- a/Modules/CheckIncludeFile.cmake
+++ b/Modules/CheckIncludeFile.cmake
@@ -10,6 +10,7 @@
#
# INCLUDE - name of include file
# VARIABLE - variable to return result
+# Will be created as an internal cache variable.
#
#
#
@@ -24,6 +25,7 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -39,7 +41,7 @@
# License text for the above reference.)
macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}")
if(CMAKE_REQUIRED_INCLUDES)
set(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
else()
@@ -49,7 +51,9 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
set(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c)
- message(STATUS "Looking for ${INCLUDE}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${INCLUDE}")
+ endif()
if(${ARGC} EQUAL 3)
set(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}")
@@ -69,14 +73,18 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
endif()
if(${VARIABLE})
- message(STATUS "Looking for ${INCLUDE} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${INCLUDE} - found")
+ endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the include file ${INCLUDE} "
"exists passed with the following output:\n"
"${OUTPUT}\n\n")
else()
- message(STATUS "Looking for ${INCLUDE} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${INCLUDE} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the include file ${INCLUDE} "
diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake
index fa36a3f..eae1730 100644
--- a/Modules/CheckIncludeFileCXX.cmake
+++ b/Modules/CheckIncludeFileCXX.cmake
@@ -14,6 +14,7 @@
#
# INCLUDE - name of include file
# VARIABLE - variable to return result
+# Will be created as an internal cache variable.
#
#
#
@@ -28,6 +29,7 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -43,7 +45,7 @@
# License text for the above reference.)
macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
if(CMAKE_REQUIRED_INCLUDES)
set(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
else()
@@ -53,7 +55,9 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
set(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
- message(STATUS "Looking for C++ include ${INCLUDE}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for C++ include ${INCLUDE}")
+ endif()
if(${ARGC} EQUAL 3)
set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}")
@@ -73,14 +77,18 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
endif()
if(${VARIABLE})
- message(STATUS "Looking for C++ include ${INCLUDE} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for C++ include ${INCLUDE} - found")
+ endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the include file ${INCLUDE} "
"exists passed with the following output:\n"
"${OUTPUT}\n\n")
else()
- message(STATUS "Looking for C++ include ${INCLUDE} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for C++ include ${INCLUDE} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the include file ${INCLUDE} "
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 182067f..2494862 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -12,6 +12,7 @@
#
# INCLUDE - list of files to include
# VARIABLE - variable to return result
+# Will be created as an internal cache variable.
#
#
#
@@ -23,6 +24,7 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2003-2012 Kitware, Inc.
@@ -38,7 +40,7 @@
# License text for the above reference.)
macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
if(CMAKE_REQUIRED_INCLUDES)
set(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
@@ -52,7 +54,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
"${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
endforeach()
set(CMAKE_CONFIGURABLE_FILE_CONTENT
- "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(){return 0;}\n")
+ "${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)
@@ -66,7 +68,9 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
set(_description "include file ${_INCLUDE}")
endif()
- message(STATUS "Looking for ${_description}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${_description}")
+ endif()
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c
@@ -76,14 +80,18 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
"${CHECK_INCLUDE_FILES_INCLUDE_DIRS}"
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
- message(STATUS "Looking for ${_description} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${_description} - found")
+ endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if files ${INCLUDE} "
"exist passed with the following output:\n"
"${OUTPUT}\n\n")
else()
- message(STATUS "Looking for ${_description} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${_description} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if files ${INCLUDE} "
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index 3bd126a..99c809b 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -47,7 +47,7 @@ macro(check_language lang)
message(STATUS ${_desc})
file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang})
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/CMakeLists.txt"
- "cmake_minimum_required(VERSION 2.8)
+ "cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(Check${lang} ${lang})
file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
\"set(CMAKE_${lang}_COMPILER \\\"\${CMAKE_${lang}_COMPILER}\\\")\\n\"
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index f5c563c..95c595a 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -12,6 +12,7 @@
# FUNCTION - the name of the function
# LOCATION - location where the library should be found
# VARIABLE - variable to store the result
+# Will be created as an internal cache variable.
#
#
#
@@ -23,6 +24,7 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -40,10 +42,12 @@
macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}")
set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
- message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
+ endif()
set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY})
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_LIBRARY_EXISTS_LIBRARIES
@@ -60,14 +64,18 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
- message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found")
+ endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the function ${FUNCTION} exists in the ${LIBRARY} "
"passed with the following output:\n"
"${OUTPUT}\n\n")
else()
- message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the function ${FUNCTION} exists in the ${LIBRARY} "
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
index 25ea7f4..e203d4c 100644
--- a/Modules/CheckPrototypeDefinition.cmake
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -13,6 +13,7 @@
# RETURN - The return value of the function.
# HEADER - The header files required.
# VARIABLE - The variable to store the result.
+# Will be created as an internal cache variable.
#
# Example:
#
@@ -33,6 +34,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
@@ -55,7 +57,7 @@ get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
- if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$")
+ if (NOT DEFINED ${_VARIABLE})
set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n")
set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS})
@@ -97,12 +99,16 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB
if (${_VARIABLE})
set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
- message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n"
"${OUTPUT}\n\n")
else ()
- message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
+ endif()
set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n"
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index a864e82..880a688 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -28,6 +28,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#
#
#
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index e1ca412..79c5ba7 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -9,6 +9,7 @@
# Check that the <symbol> is available after including given header
# <files> and store the result in a <variable>. Specify the list of
# files in one argument as a semicolon-separated list.
+# <variable> will be created as an internal cache variable.
#
# If the header files define the symbol as a macro it is considered
# available and assumed to work. If the header files declare the symbol
@@ -28,6 +29,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2003-2011 Kitware, Inc.
@@ -49,7 +51,7 @@ macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
endmacro()
macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS})
if(CMAKE_REQUIRED_LIBRARIES)
@@ -74,7 +76,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${SOURCEFILE}" @ONLY)
- message(STATUS "Looking for ${SYMBOL}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${SYMBOL}")
+ endif()
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
"${SOURCEFILE}"
@@ -85,7 +89,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
"${CMAKE_SYMBOL_EXISTS_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
- message(STATUS "Looking for ${SYMBOL} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${SYMBOL} - found")
+ endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the ${SYMBOL} "
@@ -93,7 +99,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
"${OUTPUT}\nFile ${SOURCEFILE}:\n"
"${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
else()
- message(STATUS "Looking for ${SYMBOL} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${SYMBOL} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the ${SYMBOL} "
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index ec28d8b..73ad86e 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -19,6 +19,9 @@
# "0" = type has arch-dependent size (see below)
# "" = type does not exist
#
+# Both ``HAVE_${VARIABLE}`` and ``${VARIABLE}`` will be created as internal
+# cache variables.
+#
# Furthermore, the variable "${VARIABLE}_CODE" holds C preprocessor code
# to define the macro "${VARIABLE}" to the size of the type, or leave
# the macro undefined if the type does not exist.
@@ -59,6 +62,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
# CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include
#=============================================================================
@@ -75,16 +79,19 @@
# License text for the above reference.)
include(CheckIncludeFile)
+include(CheckIncludeFileCXX)
cmake_policy(PUSH)
-cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
+cmake_policy(VERSION 3.0)
get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
#-----------------------------------------------------------------------------
# Helper function. DO NOT CALL DIRECTLY.
function(__check_type_size_impl type var map builtin language)
- message(STATUS "Check size of ${type}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Check size of ${type}")
+ endif()
# Include header files.
set(headers)
@@ -138,7 +145,7 @@ function(__check_type_size_impl type var map builtin language)
foreach(info ${strings})
if("${info}" MATCHES "${regex_size}")
# Get the type size.
- string(REGEX REPLACE "${regex_size}" "\\1" size "${info}")
+ set(size "${CMAKE_MATCH_1}")
if(first)
set(${var} ${size})
elseif(NOT "${size}" STREQUAL "${${var}}")
@@ -168,13 +175,17 @@ function(__check_type_size_impl type var map builtin language)
message(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !")
endif()
- message(STATUS "Check size of ${type} - done")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Check size of ${type} - done")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining size of ${type} passed with the following output:\n${output}\n\n")
set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})")
else()
# The check failed to compile.
- message(STATUS "Check size of ${type} - failed")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Check size of ${type} - failed")
+ endif()
file(READ ${src} content)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n")
@@ -218,9 +229,15 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE)
set(_builtin 0)
else()
set(_builtin 1)
- check_include_file(sys/types.h HAVE_SYS_TYPES_H)
- check_include_file(stdint.h HAVE_STDINT_H)
- check_include_file(stddef.h HAVE_STDDEF_H)
+ if("${_language}" STREQUAL "C")
+ check_include_file(sys/types.h HAVE_SYS_TYPES_H)
+ check_include_file(stdint.h HAVE_STDINT_H)
+ check_include_file(stddef.h HAVE_STDDEF_H)
+ elseif("${_language}" STREQUAL "CXX")
+ check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H)
+ check_include_file_cxx(stdint.h HAVE_STDINT_H)
+ check_include_file_cxx(stddef.h HAVE_STDDEF_H)
+ endif()
endif()
unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
unset(_CHECK_TYPE_SIZE_LANGUAGE)
diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake
index 4861ff0..f3e05e4 100644
--- a/Modules/CheckVariableExists.cmake
+++ b/Modules/CheckVariableExists.cmake
@@ -14,7 +14,7 @@
#
# VAR - the name of the variable
# VARIABLE - variable to store the result
-#
+# Will be created as an internal cache variable.
#
#
# This macro is only for C variables.
@@ -27,6 +27,7 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -44,10 +45,12 @@
macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}")
set(MACRO_CHECK_VARIABLE_DEFINITIONS
"-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}")
- message(STATUS "Looking for ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${VAR}")
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -63,13 +66,17 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
set(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}")
- message(STATUS "Looking for ${VAR} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${VAR} - found")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the variable ${VAR} exists passed with the following output:\n"
"${OUTPUT}\n\n")
else()
set(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}")
- message(STATUS "Looking for ${VAR} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${VAR} - not found")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the variable ${VAR} exists failed with the following output:\n"
"${OUTPUT}\n\n")
diff --git a/Modules/Compiler/ADSP-DetermineCompiler.cmake b/Modules/Compiler/ADSP-DetermineCompiler.cmake
new file mode 100644
index 0000000..0340f69
--- /dev/null
+++ b/Modules/Compiler/ADSP-DetermineCompiler.cmake
@@ -0,0 +1,10 @@
+
+set(_compiler_id_pp_test "defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)")
+
+set(_compiler_id_version_compute "
+#if defined(__VISUALDSPVERSION__)
+ /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__VISUALDSPVERSION__>>24)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__VISUALDSPVERSION__>>16 & 0xFF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__VISUALDSPVERSION__>>8 & 0xFF)
+#endif")
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index 680f720..0372e18 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -1 +1,6 @@
-include(Compiler/Clang-CXX)
+include(Compiler/Clang)
+__compiler_clang(CXX)
+
+if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+ set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+endif()
diff --git a/Modules/Compiler/AppleClang-DetermineCompiler.cmake b/Modules/Compiler/AppleClang-DetermineCompiler.cmake
new file mode 100644
index 0000000..397f95c
--- /dev/null
+++ b/Modules/Compiler/AppleClang-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+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}
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__apple_build_version__)")
diff --git a/Modules/Compiler/Borland-DetermineCompiler.cmake b/Modules/Compiler/Borland-DetermineCompiler.cmake
new file mode 100644
index 0000000..ef3083b
--- /dev/null
+++ b/Modules/Compiler/Borland-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__BORLANDC__)")
+
+set(_compiler_id_version_compute "
+ /* __BORLANDC__ = 0xVRR */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__BORLANDC__>>8)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__BORLANDC__ & 0xFF)")
diff --git a/Modules/Compiler/Clang-C-FeatureTests.cmake b/Modules/Compiler/Clang-C-FeatureTests.cmake
new file mode 100644
index 0000000..4a72e87
--- /dev/null
+++ b/Modules/Compiler/Clang-C-FeatureTests.cmake
@@ -0,0 +1,11 @@
+
+set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 304")
+
+set(Clang_C11 "${_cmake_oldestSupported} && __STDC_VERSION__ >= 201112L")
+set(_cmake_feature_test_c_static_assert "${Clang_C11}")
+set(Clang_C99 "${_cmake_oldestSupported} && __STDC_VERSION__ >= 199901L")
+set(_cmake_feature_test_c_restrict "${Clang_C99}")
+set(_cmake_feature_test_c_variadic_macros "${Clang_C99}")
+
+set(Clang_C90 "${_cmake_oldestSupported} && !defined(__STDC_VERSION__)")
+set(_cmake_feature_test_c_function_prototypes "${Clang_C90}")
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index 98fcd0b..05d3c0b 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -1,2 +1,38 @@
include(Compiler/Clang)
__compiler_clang(C)
+
+cmake_policy(GET CMP0025 appleClangPolicy)
+if(WIN32 OR (APPLE AND NOT appleClangPolicy STREQUAL NEW))
+ return()
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
+
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+endif()
+
+set(CMAKE_C_STANDARD_DEFAULT 90)
+
+macro(cmake_record_c_compile_features)
+ macro(_get_clang_features std_version list)
+ record_compiler_features(C "-std=${std_version}" ${list})
+ endmacro()
+
+ if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+ _get_clang_features(c11 CMAKE_C11_COMPILE_FEATURES)
+ if (_result EQUAL 0)
+ _get_clang_features(c99 CMAKE_C99_COMPILE_FEATURES)
+ endif()
+ if (_result EQUAL 0)
+ _get_clang_features(c90 CMAKE_C90_COMPILE_FEATURES)
+ endif()
+ else()
+ set(_result 0)
+ endif()
+endmacro()
diff --git a/Modules/Compiler/Clang-CXX-FeatureTests.cmake b/Modules/Compiler/Clang-CXX-FeatureTests.cmake
new file mode 100644
index 0000000..4c532fb
--- /dev/null
+++ b/Modules/Compiler/Clang-CXX-FeatureTests.cmake
@@ -0,0 +1,86 @@
+
+# Reference: http://clang.llvm.org/cxx_status.html
+# http://clang.llvm.org/docs/LanguageExtensions.html
+
+set(testable_features
+ cxx_alias_templates
+ cxx_alignas
+ cxx_attributes
+ cxx_auto_type
+ cxx_binary_literals
+ cxx_constexpr
+ cxx_contextual_conversions
+ cxx_decltype
+ cxx_decltype_incomplete_return_types
+ cxx_default_function_template_args
+ cxx_defaulted_functions
+ cxx_delegating_constructors
+ cxx_deleted_functions
+ cxx_explicit_conversions
+ cxx_generalized_initializers
+ cxx_inheriting_constructors
+ cxx_lambdas
+ cxx_local_type_template_args
+ cxx_noexcept
+ cxx_nonstatic_member_init
+ cxx_nullptr
+ cxx_range_for
+ cxx_raw_string_literals
+ cxx_reference_qualified_functions
+ cxx_relaxed_constexpr
+ cxx_return_type_deduction
+ cxx_rvalue_references
+ cxx_static_assert
+ cxx_strong_enums
+ cxx_thread_local
+ cxx_unicode_literals
+ cxx_unrestricted_unions
+ cxx_user_literals
+ cxx_variable_templates
+ cxx_variadic_templates
+)
+
+set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 304")
+
+foreach(feature ${testable_features})
+ set(_cmake_feature_test_${feature} "${_cmake_oldestSupported} && __has_feature(${feature})")
+endforeach()
+
+unset(testable_features)
+
+set(_cmake_feature_test_cxx_aggregate_default_initializers "${_cmake_oldestSupported} && __has_feature(cxx_aggregate_nsdmi)")
+
+set(_cmake_feature_test_cxx_trailing_return_types "${_cmake_oldestSupported} && __has_feature(cxx_trailing_return)")
+set(_cmake_feature_test_cxx_alignof "${_cmake_oldestSupported} && __has_feature(cxx_alignas)")
+set(_cmake_feature_test_cxx_final "${_cmake_oldestSupported} && __has_feature(cxx_override_control)")
+set(_cmake_feature_test_cxx_override "${_cmake_oldestSupported} && __has_feature(cxx_override_control)")
+set(_cmake_feature_test_cxx_uniform_initialization "${_cmake_oldestSupported} && __has_feature(cxx_generalized_initializers)")
+set(_cmake_feature_test_cxx_defaulted_move_initializers "${_cmake_oldestSupported} && __has_feature(cxx_defaulted_functions)")
+set(_cmake_feature_test_cxx_lambda_init_captures "${_cmake_oldestSupported} && __has_feature(cxx_init_captures)")
+
+set(Clang34_CXX14 "((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L")
+# http://llvm.org/bugs/show_bug.cgi?id=19242
+set(_cmake_feature_test_cxx_attribute_deprecated "${Clang34_CXX14}")
+# http://llvm.org/bugs/show_bug.cgi?id=19698
+set(_cmake_feature_test_cxx_decltype_auto "${Clang34_CXX14}")
+set(_cmake_feature_test_cxx_digit_separators "${Clang34_CXX14}")
+# http://llvm.org/bugs/show_bug.cgi?id=19674
+set(_cmake_feature_test_cxx_generic_lambdas "${Clang34_CXX14}")
+
+# TODO: Should be supported by Clang 3.1
+set(Clang31_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_enum_forward_declarations "${Clang31_CXX11}")
+set(_cmake_feature_test_cxx_sizeof_member "${Clang31_CXX11}")
+# TODO: Should be supported by Clang 2.9
+set(Clang29_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_extended_friend_declarations "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_extern_templates "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_func_identifier "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_inline_namespaces "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_long_long_type "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_right_angle_brackets "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_variadic_macros "${Clang29_CXX11}")
+
+# TODO: Should be supported forever?
+set(Clang_CXX98 "${_cmake_oldestSupported} && __cplusplus >= 199711L")
+set(_cmake_feature_test_cxx_template_template_parameters "${Clang_CXX98}")
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 0372e18..5dd7b4a 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -4,3 +4,49 @@ __compiler_clang(CXX)
if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
+
+cmake_policy(GET CMP0025 appleClangPolicy)
+if(WIN32 OR (APPLE AND NOT appleClangPolicy STREQUAL NEW))
+ return()
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.1)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.1)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
+endif()
+
+set(CMAKE_CXX_STANDARD_DEFAULT 98)
+
+macro(cmake_record_cxx_compile_features)
+ macro(_get_clang_features std_version list)
+ record_compiler_features(CXX "-std=${std_version}" ${list})
+ endmacro()
+
+ if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+ _get_clang_features(c++1y CMAKE_CXX14_COMPILE_FEATURES)
+ if (_result EQUAL 0)
+ _get_clang_features(c++11 CMAKE_CXX11_COMPILE_FEATURES)
+ endif()
+ if (_result EQUAL 0)
+ _get_clang_features(c++98 CMAKE_CXX98_COMPILE_FEATURES)
+ endif()
+ else()
+ set(_result 0)
+ endif()
+endmacro()
diff --git a/Modules/Compiler/Clang-DetermineCompiler.cmake b/Modules/Compiler/Clang-DetermineCompiler.cmake
new file mode 100644
index 0000000..89df1b6
--- /dev/null
+++ b/Modules/Compiler/Clang-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__clang__)")
+
+include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake")
diff --git a/Modules/Compiler/Clang-DetermineCompilerInternal.cmake b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake
new file mode 100644
index 0000000..08c1230
--- /dev/null
+++ b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake
@@ -0,0 +1,15 @@
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__clang_major__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__clang_minor__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__clang_patchlevel__)
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+# endif")
+
+set(_compiler_id_simulate "
+# if defined(_MSC_VER)
+# define @PREFIX@SIMULATE_ID \"MSVC\"
+# endif")
diff --git a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..2265e5e
--- /dev/null
+++ b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__COMO__)")
+
+set(_compiler_id_version_compute "
+ /* __COMO_VERSION__ = VRR */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__COMO_VERSION__ / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__COMO_VERSION__ % 100)")
diff --git a/Modules/Compiler/Compaq-C-DetermineCompiler.cmake b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake
new file mode 100644
index 0000000..02e99dc
--- /dev/null
+++ b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__DECC)")
+
+set(_compiler_id_version_compute "
+ /* __DECC_VER = VVRRTPPPP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECC_VER/10000000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECC_VER/100000 % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECC_VER % 10000)")
diff --git a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..c7d0565
--- /dev/null
+++ b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__DECCXX)")
+
+set(_compiler_id_version_compute "
+ /* __DECCXX_VER = VVRRTPPPP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECCXX_VER/10000000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECCXX_VER/100000 % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECCXX_VER % 10000)")
diff --git a/Modules/Compiler/Cray-DetermineCompiler.cmake b/Modules/Compiler/Cray-DetermineCompiler.cmake
new file mode 100644
index 0000000..881b82c
--- /dev/null
+++ b/Modules/Compiler/Cray-DetermineCompiler.cmake
@@ -0,0 +1,6 @@
+
+set(_compiler_id_pp_test "defined(_CRAYC)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_RELEASE_MINOR)")
diff --git a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake
new file mode 100644
index 0000000..2feedac
--- /dev/null
+++ b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__CODEGEARC_VERSION__>>24 & 0x00FF)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__CODEGEARC_VERSION__>>16 & 0x00FF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__CODEGEARC_VERSION__ & 0xFFFF)")
diff --git a/Modules/Compiler/Fujitsu-DetermineCompiler.cmake b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake
new file mode 100644
index 0000000..73ee38c
--- /dev/null
+++ b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake
@@ -0,0 +1,2 @@
+
+set(_compiler_id_pp_test "defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)")
diff --git a/Modules/Compiler/GNU-C-FeatureTests.cmake b/Modules/Compiler/GNU-C-FeatureTests.cmake
new file mode 100644
index 0000000..dc1695c
--- /dev/null
+++ b/Modules/Compiler/GNU-C-FeatureTests.cmake
@@ -0,0 +1,12 @@
+
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407")
+
+set(GNU46_C11 "${_cmake_oldestSupported} && __STDC_VERSION__ >= 201112L")
+set(_cmake_feature_test_c_static_assert "${GNU46_C11}")
+# Since 4.4 at least:
+set(GNU44_C99 "${_cmake_oldestSupported} && __STDC_VERSION__ >= 199901L")
+set(_cmake_feature_test_c_restrict "${GNU44_C99}")
+set(_cmake_feature_test_c_variadic_macros "${GNU44_C99}")
+
+set(GNU_C90 "${_cmake_oldestSupported} && !defined(__STDC_VERSION__)")
+set(_cmake_feature_test_c_function_prototypes "${GNU_C90}")
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 9a5137a..35954be 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -1,2 +1,34 @@
include(Compiler/GNU)
__compiler_gnu(C)
+
+if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
+
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+endif()
+
+# This may change in a future GNU version.
+set(CMAKE_C_STANDARD_DEFAULT 90)
+
+macro(cmake_record_c_compile_features)
+ macro(_get_gcc_features std_version list)
+ record_compiler_features(C "-std=${std_version}" ${list})
+ endmacro()
+
+ if (UNIX AND NOT APPLE AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+ _get_gcc_features(c90 CMAKE_C90_COMPILE_FEATURES)
+ if (_result EQUAL 0)
+ _get_gcc_features(c99 CMAKE_C99_COMPILE_FEATURES)
+ endif()
+ if (_result EQUAL 0)
+ _get_gcc_features(c11 CMAKE_C11_COMPILE_FEATURES)
+ endif()
+ else()
+ set(_result 0)
+ endif()
+endmacro()
diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
new file mode 100644
index 0000000..9c98e44
--- /dev/null
+++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
@@ -0,0 +1,98 @@
+
+# Reference: http://gcc.gnu.org/projects/cxx0x.html
+
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407")
+
+set(GNU49_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L")
+set(_cmake_feature_test_cxx_contextual_conversions "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_attribute_deprecated "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_decltype_auto "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_digit_separators "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_generic_lambdas "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_lambda_init_captures "${GNU49_CXX14}")
+# GNU 4.3 supports binary literals as an extension, but may warn about
+# use of extensions prior to GNU 4.9
+# http://stackoverflow.com/questions/16334024/difference-between-gcc-binary-literals-and-c14-ones
+set(_cmake_feature_test_cxx_binary_literals "${GNU49_CXX14}")
+# The feature below is documented as available in GNU 4.8 (by implementing an
+# earlier draft of the standard paper), but that version of the compiler
+# does not set __cplusplus to a value greater than 201103L until GNU 4.9:
+# http://gcc.gnu.org/onlinedocs/gcc-4.8.2/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros
+# http://gcc.gnu.org/onlinedocs/gcc-4.9.0/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros
+# So, CMake only reports availability for it with GNU 4.9 or later.
+set(_cmake_feature_test_cxx_return_type_deduction "${GNU49_CXX14}")
+
+# Introduced in GCC 4.8.1
+set(GNU481_CXX11 "((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${GNU481_CXX11}")
+set(_cmake_feature_test_cxx_reference_qualified_functions "${GNU481_CXX11}")
+set(GNU48_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_alignas "${GNU48_CXX11}")
+# The alignof feature works with GNU 4.7 and -std=c++11, but it is documented
+# as available with GNU 4.8, so treat that as true.
+set(_cmake_feature_test_cxx_alignof "${GNU48_CXX11}")
+set(_cmake_feature_test_cxx_attributes "${GNU48_CXX11}")
+set(_cmake_feature_test_cxx_inheriting_constructors "${GNU48_CXX11}")
+set(_cmake_feature_test_cxx_thread_local "${GNU48_CXX11}")
+set(GNU47_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_alias_templates "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_extended_friend_declarations "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_final "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_noexcept "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_nonstatic_member_init "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_override "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}")
+# NOTE: C++11 was ratified in September 2011. GNU 4.7 is the first minor
+# release following that (March 2012), and the first minor release to
+# support -std=c++11. Prior to that, support for C++11 features is technically
+# experiemental and possibly incomplete (see for example the note below about
+# cxx_variadic_template_template_parameters)
+# TODO: Should be supported by GNU 4.6
+set(GNU46_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_defaulted_move_initializers "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_enum_forward_declarations "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_nullptr "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_range_for "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_unrestricted_unions "${GNU46_CXX11}")
+# TODO: Should be supported by GNU 4.5
+set(GNU45_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}")
+set(_cmake_feature_test_cxx_lambdas "${GNU45_CXX11}")
+set(_cmake_feature_test_cxx_local_type_template_args "${GNU45_CXX11}")
+set(_cmake_feature_test_cxx_raw_string_literals "${GNU45_CXX11}")
+# TODO: Should be supported by GNU 4.4
+set(GNU44_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_defaulted_functions "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_deleted_functions "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_generalized_initializers "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_inline_namespaces "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_sizeof_member "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_strong_enums "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_trailing_return_types "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_unicode_literals "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_uniform_initialization "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_variadic_templates "${GNU44_CXX11}")
+# TODO: If features are ever recorded for GNU 4.3, there should possibly
+# be a new feature added like cxx_variadic_template_template_parameters,
+# which is implemented by GNU 4.4, but not 4.3. cxx_variadic_templates is
+# actually implemented by GNU 4.3, but variadic template template parameters
+# 'completes' it, so that is the version we record as having the variadic
+# templates capability in CMake. See
+# http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf
+# TODO: Should be supported by GNU 4.3
+set(GNU43_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_decltype "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_default_function_template_args "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_long_long_type "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_right_angle_brackets "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_rvalue_references "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_static_assert "${GNU43_CXX11}")
+# TODO: Should be supported since GNU 3.4?
+set(_cmake_feature_test_cxx_extern_templates "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+# TODO: Should be supported forever?
+set(_cmake_feature_test_cxx_func_identifier "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_variadic_macros "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_template_template_parameters "${_cmake_oldestSupported} && __cplusplus >= 199711L")
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index 33d6093..14dc76a 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -10,3 +10,44 @@ else()
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.3)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+endif()
+
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.3)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
+endif()
+
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
+endif()
+
+set(CMAKE_CXX_STANDARD_DEFAULT 98)
+
+macro(cmake_record_cxx_compile_features)
+ macro(_get_gcc_features std_version list)
+ record_compiler_features(CXX "-std=${std_version}" ${list})
+ endmacro()
+
+ set(_result 0)
+ if (UNIX AND NOT APPLE AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
+ _get_gcc_features(c++1y CMAKE_CXX14_COMPILE_FEATURES)
+ endif()
+ if (UNIX AND NOT APPLE AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+ if (_result EQUAL 0)
+ _get_gcc_features(c++11 CMAKE_CXX11_COMPILE_FEATURES)
+ endif()
+ if (_result EQUAL 0)
+ _get_gcc_features(c++98 CMAKE_CXX98_COMPILE_FEATURES)
+ endif()
+ else()
+ set(_result 0)
+ endif()
+endmacro()
diff --git a/Modules/Compiler/GNU-DetermineCompiler.cmake b/Modules/Compiler/GNU-DetermineCompiler.cmake
new file mode 100644
index 0000000..261f148
--- /dev/null
+++ b/Modules/Compiler/GNU-DetermineCompiler.cmake
@@ -0,0 +1,9 @@
+
+set(_compiler_id_pp_test "defined(__GNUC__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GNUC__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__)
+# if defined(__GNUC_PATCHLEVEL__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__)
+# endif")
diff --git a/Modules/Compiler/HP-C-DetermineCompiler.cmake b/Modules/Compiler/HP-C-DetermineCompiler.cmake
new file mode 100644
index 0000000..4269799
--- /dev/null
+++ b/Modules/Compiler/HP-C-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__HP_cc)")
+
+set(_compiler_id_version_compute "
+ /* __HP_cc = VVRRPP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__HP_cc/10000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__HP_cc/100 % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__HP_cc % 100)")
diff --git a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..3d4d7e4
--- /dev/null
+++ b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__HP_aCC)")
+
+set(_compiler_id_version_compute "
+ /* __HP_aCC = VVRRPP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__HP_aCC/10000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__HP_aCC/100 % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__HP_aCC % 100)")
diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake
index 44470ca..6411dac 100644
--- a/Modules/Compiler/HP-CXX.cmake
+++ b/Modules/Compiler/HP-CXX.cmake
@@ -2,3 +2,12 @@ set(CMAKE_CXX_VERBOSE_FLAG "-v")
set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+
+# HP aCC since version 3.80 supports the flag +hpxstd98 to get ANSI C++98
+# template support. It is known that version 6.25 doesn't need that flag.
+# Current assumption: the flag is needed for every version from 3.80 to 4
+# to get it working.
+if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4 AND
+ NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.80)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "+hpxstd98")
+endif()
diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake
new file mode 100644
index 0000000..c39810a
--- /dev/null
+++ b/Modules/Compiler/IAR-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+# IAR Systems compiler for embedded systems.
+# http://www.iar.com
+set(_compiler_id_pp_test "defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)")
diff --git a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
new file mode 100644
index 0000000..899e284
--- /dev/null
+++ b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
@@ -0,0 +1,6 @@
+
+set(_compiler_id_version_compute "
+ /* __IBMC__ = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMC__/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMC__/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMC__ % 10)")
diff --git a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
new file mode 100644
index 0000000..73aa2b4
--- /dev/null
+++ b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
@@ -0,0 +1,6 @@
+
+set(_compiler_id_version_compute "
+ /* __IBMCPP__ = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMCPP__/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMCPP__/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMCPP__ % 10)")
diff --git a/Modules/Compiler/Intel-DetermineCompiler.cmake b/Modules/Compiler/Intel-DetermineCompiler.cmake
new file mode 100644
index 0000000..d7e4532
--- /dev/null
+++ b/Modules/Compiler/Intel-DetermineCompiler.cmake
@@ -0,0 +1,26 @@
+
+set(_compiler_id_pp_test "defined(__INTEL_COMPILER) || defined(__ICC)")
+
+set(_compiler_id_version_compute "
+ /* __INTEL_COMPILER = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEL_COMPILER/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEL_COMPILER/10 % 10)
+# if defined(__INTEL_COMPILER_UPDATE)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER_UPDATE)
+# else
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER % 10)
+# endif
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+ /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__INTEL_COMPILER_BUILD_DATE)
+# endif
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+# endif")
+
+set(_compiler_id_simulate "
+# if defined(_MSC_VER)
+# define @PREFIX@SIMULATE_ID \"MSVC\"
+# endif")
diff --git a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake
new file mode 100644
index 0000000..9e48553
--- /dev/null
+++ b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake
@@ -0,0 +1,15 @@
+
+set(_compiler_id_pp_test "defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)")
+
+set(_compiler_id_version_compute "
+# if defined(_SGI_COMPILER_VERSION)
+ /* _SGI_COMPILER_VERSION = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_SGI_COMPILER_VERSION/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_SGI_COMPILER_VERSION/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_SGI_COMPILER_VERSION % 10)
+# else
+ /* _COMPILER_VERSION = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_COMPILER_VERSION/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_COMPILER_VERSION/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_COMPILER_VERSION % 10)
+# endif")
diff --git a/Modules/Compiler/MSVC-DetermineCompiler.cmake b/Modules/Compiler/MSVC-DetermineCompiler.cmake
new file mode 100644
index 0000000..313de89
--- /dev/null
+++ b/Modules/Compiler/MSVC-DetermineCompiler.cmake
@@ -0,0 +1,19 @@
+
+set(_compiler_id_pp_test "defined(_MSC_VER)")
+
+set(_compiler_id_version_compute "
+ /* _MSC_VER = VVRR */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+# if defined(_MSC_FULL_VER)
+# if _MSC_VER >= 1400
+ /* _MSC_FULL_VER = VVRRPPPPP */
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_MSC_FULL_VER % 100000)
+# else
+ /* _MSC_FULL_VER = VVRRPPPP */
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_MSC_FULL_VER % 10000)
+# endif
+# endif
+# if defined(_MSC_BUILD)
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(_MSC_BUILD)
+# endif")
diff --git a/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake
new file mode 100644
index 0000000..2ed116c
--- /dev/null
+++ b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake
@@ -0,0 +1,10 @@
+
+set(_compiler_id_pp_test "defined(__WATCOMC__)")
+
+set(_compiler_id_version_compute "
+ /* __WATCOMC__ = VVRP + 1100 */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__WATCOMC__ - 1100) / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__WATCOMC__ % 10)
+# endif")
diff --git a/Modules/Compiler/PGI-DetermineCompiler.cmake b/Modules/Compiler/PGI-DetermineCompiler.cmake
new file mode 100644
index 0000000..8d3dc9c
--- /dev/null
+++ b/Modules/Compiler/PGI-DetermineCompiler.cmake
@@ -0,0 +1,9 @@
+
+set(_compiler_id_pp_test "defined(__PGI)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__PGIC__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__PGIC_MINOR__)
+# if defined(__PGIC_PATCHLEVEL__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__PGIC_PATCHLEVEL__)
+# endif")
diff --git a/Modules/Compiler/PathScale-DetermineCompiler.cmake b/Modules/Compiler/PathScale-DetermineCompiler.cmake
new file mode 100644
index 0000000..4eb81de
--- /dev/null
+++ b/Modules/Compiler/PathScale-DetermineCompiler.cmake
@@ -0,0 +1,9 @@
+
+set(_compiler_id_pp_test "defined(__PATHCC__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__PATHCC__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__PATHCC_MINOR__)
+# if defined(__PATHCC_PATCHLEVEL__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__PATHCC_PATCHLEVEL__)
+# endif")
diff --git a/Modules/Compiler/SCO-DetermineCompiler.cmake b/Modules/Compiler/SCO-DetermineCompiler.cmake
new file mode 100644
index 0000000..a44b22b
--- /dev/null
+++ b/Modules/Compiler/SCO-DetermineCompiler.cmake
@@ -0,0 +1,2 @@
+
+set(_compiler_id_pp_test "defined(__SCO_VERSION__)")
diff --git a/Modules/Compiler/SDCC-C-DetermineCompiler.cmake b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake
new file mode 100644
index 0000000..1d7dd78
--- /dev/null
+++ b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake
@@ -0,0 +1,10 @@
+
+# sdcc, the small devices C compiler for embedded systems,
+# http://sdcc.sourceforge.net */
+set(_compiler_id_pp_test "defined(SDCC)")
+
+set(_compiler_id_version_compute "
+ /* SDCC = VRP */
+# define COMPILER_VERSION_MAJOR @MACRO_DEC@(SDCC/100)
+# define COMPILER_VERSION_MINOR @MACRO_DEC@(SDCC/10 % 10)
+# define COMPILER_VERSION_PATCH @MACRO_DEC@(SDCC % 10)")
diff --git a/Modules/Compiler/SunPro-C-DetermineCompiler.cmake b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake
new file mode 100644
index 0000000..e9d7457
--- /dev/null
+++ b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake
@@ -0,0 +1,15 @@
+
+set(_compiler_id_pp_test "defined(__SUNPRO_C)")
+
+set(_compiler_id_version_compute "
+# if __SUNPRO_C >= 0x5100
+ /* __SUNPRO_C = 0xVRRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_C>>12)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_C>>4 & 0xFF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_C & 0xF)
+# else
+ /* __SUNPRO_CC = 0xVRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_C>>8)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_C>>4 & 0xF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_C & 0xF)
+# endif")
diff --git a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..5c23a95
--- /dev/null
+++ b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
@@ -0,0 +1,15 @@
+
+set(_compiler_id_pp_test "defined(__SUNPRO_CC)")
+
+set(_compiler_id_version_compute "
+# if __SUNPRO_CC >= 0x5100
+ /* __SUNPRO_CC = 0xVRRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_CC>>12)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_CC>>4 & 0xFF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_CC & 0xF)
+# else
+ /* __SUNPRO_CC = 0xVRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_CC>>8)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_CC>>4 & 0xF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_CC & 0xF)
+# endif")
diff --git a/Modules/Compiler/TI-DetermineCompiler.cmake b/Modules/Compiler/TI-DetermineCompiler.cmake
new file mode 100644
index 0000000..19aa9e3
--- /dev/null
+++ b/Modules/Compiler/TI-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__TI_COMPILER_VERSION__)")
+
+set(_compiler_id_version_compute "
+ /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__TI_COMPILER_VERSION__/1000000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__TI_COMPILER_VERSION__/1000 % 1000)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__TI_COMPILER_VERSION__ % 1000)")
diff --git a/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake b/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake
new file mode 100644
index 0000000..8d6de7e
--- /dev/null
+++ b/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake
@@ -0,0 +1,2 @@
+
+set(_compiler_id_pp_test "defined(__TINYC__)")
diff --git a/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake b/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake
new file mode 100644
index 0000000..97c2263
--- /dev/null
+++ b/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake b/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..cd53499
--- /dev/null
+++ b/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/Watcom-DetermineCompiler.cmake b/Modules/Compiler/Watcom-DetermineCompiler.cmake
new file mode 100644
index 0000000..153e350
--- /dev/null
+++ b/Modules/Compiler/Watcom-DetermineCompiler.cmake
@@ -0,0 +1,10 @@
+
+set(_compiler_id_pp_test "defined(__WATCOMC__) && __WATCOMC__ < 1200")
+
+set(_compiler_id_version_compute "
+ /* __WATCOMC__ = VVRR */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__WATCOMC__ / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__WATCOMC__ % 10)
+# endif")
diff --git a/Modules/Compiler/XL-C-DetermineCompiler.cmake b/Modules/Compiler/XL-C-DetermineCompiler.cmake
new file mode 100644
index 0000000..3f4e05c
--- /dev/null
+++ b/Modules/Compiler/XL-C-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/XL-CXX-DetermineCompiler.cmake b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..dffa4bc
--- /dev/null
+++ b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/zOS-C-DetermineCompiler.cmake b/Modules/Compiler/zOS-C-DetermineCompiler.cmake
new file mode 100644
index 0000000..daa3781
--- /dev/null
+++ b/Modules/Compiler/zOS-C-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMC__) && defined(__COMPILER_VER__)")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake b/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..a08ff57
--- /dev/null
+++ b/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMCPP__) && defined(__COMPILER_VER__)")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
index 1a7a539..a17d03d 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -10,6 +10,9 @@
<ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
<RootNamespace>CompilerId@id_lang@</RootNamespace>
<Keyword>Win32Proj</Keyword>
+ @id_system@
+ @id_system_version@
+ @id_WindowsSDKDesktopARMSupport@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in
index 6f861eb..eabfc6b 100644
--- a/Modules/CompilerId/Xcode-3.pbxproj.in
+++ b/Modules/CompilerId/Xcode-3.pbxproj.in
@@ -84,6 +84,8 @@
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
SYMROOT = .;
@id_toolset@
+ @id_deployment_target@
+ @id_sdkroot@
};
name = Debug;
};
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index 68fadf6..86049d0 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -37,6 +37,9 @@ ConfigureCommand: "@CMAKE_COMMAND@" "@PROJECT_SOURCE_DIR@"
MakeCommand: @MAKECOMMAND@
DefaultCTestConfigurationType: @DEFAULT_CTEST_CONFIGURATION_TYPE@
+# version control
+UpdateVersionOnly: @CTEST_UPDATE_VERSION_ONLY@
+
# CVS options
# Default is "-d -P -A"
CVSCommand: @CVSCOMMAND@
@@ -71,6 +74,7 @@ Compiler: @CMAKE_CXX_COMPILER@
PurifyCommand: @PURIFYCOMMAND@
ValgrindCommand: @VALGRIND_COMMAND@
ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@
+MemoryCheckType: @MEMORYCHECK_TYPE@
MemoryCheckCommand: @MEMORYCHECK_COMMAND@
MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@
MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index 1e2698c..79bb064 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -76,7 +76,7 @@
# SHA512 .sha512 US Secure Hash Algorithms, RFC 4634
#
# Note that the hashes are used only for unique data identification and
-# download verification. This is not security software.
+# download verification.
#
# Example usage:
#
@@ -292,8 +292,7 @@ function(ExternalData_expand_arguments target outArgsVar)
foreach(piece IN LISTS pieces)
if("x${piece}" MATCHES "^x${data_regex}$")
# Replace this DATA{}-piece with a file path.
- string(REGEX REPLACE "${data_regex}" "\\1" data "${piece}")
- _ExternalData_arg("${target}" "${piece}" "${data}" file)
+ _ExternalData_arg("${target}" "${piece}" "${CMAKE_MATCH_1}" file)
set(outArg "${outArg}${file}")
else()
# No replacement needed for this piece.
@@ -422,16 +421,16 @@ function(_ExternalData_arg target arg options var_file)
set(external "") # Entries external to the source tree.
set(internal "") # Entries internal to the source tree.
set(have_original ${data_is_directory})
+ set(have_original_as_dir 0)
# Process options.
set(series_option "")
set(associated_files "")
set(associated_regex "")
foreach(opt ${options})
- if("x${opt}" MATCHES "^xREGEX:[^:/]+$")
- # Regular expression to match associated files.
- string(REGEX REPLACE "^REGEX:" "" regex "${opt}")
- list(APPEND associated_regex "${regex}")
+ # Regular expression to match associated files.
+ if("x${opt}" MATCHES "^xREGEX:([^:/]+)$")
+ list(APPEND associated_regex "${CMAKE_MATCH_1}")
elseif(opt STREQUAL ":")
# Activate series matching.
set(series_option "${opt}")
@@ -472,11 +471,18 @@ function(_ExternalData_arg target arg options var_file)
endif()
if(NOT have_original)
- message(FATAL_ERROR "Data file referenced by argument\n"
+ if(have_original_as_dir)
+ set(msg_kind FATAL_ERROR)
+ set(msg "that is directory instead of a file!")
+ else()
+ set(msg_kind AUTHOR_WARNING)
+ set(msg "that does not exist as a file (with or without an extension)!")
+ endif()
+ message(${msg_kind} "Data file referenced by argument\n"
" ${arg}\n"
"corresponds to source tree path\n"
" ${reldata}\n"
- "that does not exist as a file (with or without an extension)!")
+ "${msg}")
endif()
if(external)
@@ -593,27 +599,33 @@ function(_ExternalData_arg_find_files pattern regex)
set(alg "")
endif()
if("x${relname}" MATCHES "^x${regex}$" # matches
- AND NOT IS_DIRECTORY "${top_src}/${entry}" # not a directory
AND NOT "x${relname}" MATCHES "(^x|/)\\.ExternalData_" # not staged obj
)
- set(name "${top_src}/${relname}")
- set(file "${top_bin}/${relname}")
- if(alg)
- list(APPEND external "${file}|${name}|${alg}")
- elseif(ExternalData_LINK_CONTENT)
- _ExternalData_link_content("${name}" alg)
- list(APPEND external "${file}|${name}|${alg}")
- elseif(NOT top_same)
- list(APPEND internal "${file}|${name}")
- endif()
- if("${relname}" STREQUAL "${reldata}")
- set(have_original 1)
+ if(IS_DIRECTORY "${top_src}/${entry}")
+ if("${relname}" STREQUAL "${reldata}")
+ set(have_original_as_dir 1)
+ endif()
+ else()
+ set(name "${top_src}/${relname}")
+ set(file "${top_bin}/${relname}")
+ if(alg)
+ list(APPEND external "${file}|${name}|${alg}")
+ elseif(ExternalData_LINK_CONTENT)
+ _ExternalData_link_content("${name}" alg)
+ list(APPEND external "${file}|${name}|${alg}")
+ elseif(NOT top_same)
+ list(APPEND internal "${file}|${name}")
+ endif()
+ if("${relname}" STREQUAL "${reldata}")
+ set(have_original 1)
+ endif()
endif()
endif()
endforeach()
set(external "${external}" PARENT_SCOPE)
set(internal "${internal}" PARENT_SCOPE)
set(have_original "${have_original}" PARENT_SCOPE)
+ set(have_original_as_dir "${have_original_as_dir}" PARENT_SCOPE)
endfunction()
#-----------------------------------------------------------------------------
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index a1c7629..d6a6b72 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -16,15 +16,17 @@
# [LIST_SEPARATOR sep] # Sep to be replaced by ; in cmd lines
# [TMP_DIR dir] # Directory to store temporary files
# [STAMP_DIR dir] # Directory to store step timestamps
+# [EXCLUDE_FROM_ALL 1] # The "all" target does not depend on this
# #--Download step--------------
# [DOWNLOAD_NAME fname] # File name to store (if not end of URL)
# [DOWNLOAD_DIR dir] # Directory to store downloaded files
# [DOWNLOAD_COMMAND cmd...] # Command to download source tree
+# [DOWNLOAD_NO_PROGRESS 1] # Disable download progress reports
# [CVS_REPOSITORY cvsroot] # CVSROOT of CVS repository
# [CVS_MODULE mod] # Module to checkout from CVS repo
# [CVS_TAG tag] # Tag to checkout from CVS repo
# [SVN_REPOSITORY url] # URL of Subversion repo
-# [SVN_REVISION rev] # Revision to checkout from Subversion repo
+# [SVN_REVISION -r<rev>] # Revision to checkout from Subversion repo
# [SVN_USERNAME john ] # Username for Subversion checkout and update
# [SVN_PASSWORD doe ] # Password for Subversion checkout and update
# [SVN_TRUST_CERT 1 ] # Trust the Subversion server site certificate
@@ -47,6 +49,7 @@
# [CONFIGURE_COMMAND cmd...] # Build tree configuration command
# [CMAKE_COMMAND /.../cmake] # Specify alternative cmake executable
# [CMAKE_GENERATOR gen] # Specify generator for native build
+# [CMAKE_GENERATOR_PLATFORM p] # Generator-specific platform name
# [CMAKE_GENERATOR_TOOLSET t] # Generator-specific toolset name
# [CMAKE_ARGS args...] # Arguments to CMake command line
# [CMAKE_CACHE_ARGS args...] # Initial cache arguments, of the form -Dvar:string=on
@@ -54,6 +57,7 @@
# [BINARY_DIR dir] # Specify build dir location
# [BUILD_COMMAND cmd...] # Command to drive the native build
# [BUILD_IN_SOURCE 1] # Use source dir for build dir
+# [BUILD_ALWAYS 1] # No stamp file, build step always runs
# #--Install step---------------
# [INSTALL_DIR dir] # Installation prefix
# [INSTALL_COMMAND cmd...] # Command to drive install after build
@@ -117,6 +121,7 @@
# [DEPENDERS steps...] # Steps that depend on this step
# [DEPENDS files...] # Files on which this step depends
# [ALWAYS 1] # No stamp file, step always runs
+# [EXCLUDE_FROM_MAIN 1] # Main target does not depend on this step
# [WORKING_DIRECTORY dir] # Working directory for command
# [LOG 1] # Wrap step in script to log output
# )
@@ -197,11 +202,11 @@ file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines
LIMIT_COUNT ${_ep_documentation_line_count}
REGEX "^# ( \\[[A-Z0-9_]+ [^]]*\\] +#.*$|[A-Za-z0-9_]+\\()")
foreach(line IN LISTS lines)
- if("${line}" MATCHES "^# [A-Za-z0-9_]+\\(")
+ if("${line}" MATCHES "^# ([A-Za-z0-9_]+)\\(")
if(_ep_func)
set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$")
endif()
- string(REGEX REPLACE "^# ([A-Za-z0-9_]+)\\(.*" "\\1" _ep_func "${line}")
+ set(_ep_func "${CMAKE_MATCH_1}")
#message("function [${_ep_func}]")
set(_ep_keywords_${_ep_func} "^(")
set(_ep_keyword_sep)
@@ -235,7 +240,7 @@ function(_ep_parse_arguments f name ns args)
set(is_value 1)
if(arg MATCHES "^[A-Z][A-Z0-9_][A-Z0-9_]+$" AND
- NOT ((arg STREQUAL "${key}") AND (key STREQUAL "COMMAND")) AND
+ NOT (("x${arg}x" STREQUAL "x${key}x") AND ("x${key}x" STREQUAL "xCOMMANDx")) AND
NOT arg MATCHES "^(TRUE|FALSE)$")
if(_ep_keywords_${f} AND arg MATCHES "${_ep_keywords_${f}}")
set(is_value 0)
@@ -452,6 +457,7 @@ execute_process(
WORKING_DIRECTORY \"${work_dir}\"
RESULT_VARIABLE error_code
OUTPUT_VARIABLE head_sha
+ OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(error_code)
message(FATAL_ERROR \"Failed to get the hash for HEAD\")
@@ -470,6 +476,17 @@ else()
set(is_remote_ref 0)
endif()
+# Tag is in the form <remote>/<tag> (i.e. origin/master) we must strip
+# the remote from the tag.
+if(\"\${show_ref_output}\" MATCHES \"refs/remotes/${git_tag}\")
+ string(REGEX MATCH \"^([^/]+)/(.+)$\" _unused \"${git_tag}\")
+ set(git_remote \"\${CMAKE_MATCH_1}\")
+ set(git_tag \"\${CMAKE_MATCH_2}\")
+else()
+ set(git_remote \"origin\")
+ set(git_tag \"${git_tag}\")
+endif()
+
# This will fail if the tag does not exist (it probably has not been fetched
# yet).
execute_process(
@@ -477,6 +494,7 @@ execute_process(
WORKING_DIRECTORY \"${work_dir}\"
RESULT_VARIABLE error_code
OUTPUT_VARIABLE tag_sha
+ OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Is the hash checkout out that we want?
@@ -490,13 +508,94 @@ if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\"
message(FATAL_ERROR \"Failed to fetch repository '${git_repository}'\")
endif()
- execute_process(
- COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag}
- WORKING_DIRECTORY \"${work_dir}\"
- RESULT_VARIABLE error_code
- )
- if(error_code)
- message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
+ if(is_remote_ref)
+ # Check if stash is needed
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" status --porcelain
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ OUTPUT_VARIABLE repo_status
+ )
+ if(error_code)
+ message(FATAL_ERROR \"Failed to get the status\")
+ endif()
+ string(LENGTH \"\${repo_status}\" need_stash)
+
+ # If not in clean state, stash changes in order to be able to be able to
+ # perform git pull --rebase
+ if(need_stash)
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" stash save --all --quiet
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ message(FATAL_ERROR \"Failed to stash changes\")
+ endif()
+ endif()
+
+ # Pull changes from the remote branch
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" rebase \${git_remote}/\${git_tag}
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ # Rebase failed: Restore previous state.
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" rebase --abort
+ WORKING_DIRECTORY \"${work_dir}\"
+ )
+ if(need_stash)
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet
+ WORKING_DIRECTORY \"${work_dir}\"
+ )
+ endif()
+ message(FATAL_ERROR \"\\nFailed to rebase in: '${work_dir}/${src_name}'.\\nYou will have to resolve the conflicts manually\")
+ endif()
+
+ if(need_stash)
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ # Stash pop --index failed: Try again dropping the index
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" reset --hard --quiet
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" stash pop --quiet
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ # Stash pop failed: Restore previous state.
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" reset --hard --quiet \${head_sha}
+ WORKING_DIRECTORY \"${work_dir}\"
+ )
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet
+ WORKING_DIRECTORY \"${work_dir}\"
+ )
+ message(FATAL_ERROR \"\\nFailed to unstash changes in: '${work_dir}/${src_name}'.\\nYou will have to resolve the conflicts manually\")
+ endif()
+ endif()
+ endif()
+ else()
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag}
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
+ endif()
endif()
execute_process(
@@ -514,7 +613,7 @@ endif()
endfunction(_ep_write_gitupdate_script)
-function(_ep_write_downloadfile_script script_filename remote local timeout hash tls_verify tls_cainfo)
+function(_ep_write_downloadfile_script script_filename remote local timeout no_progress hash tls_verify tls_cainfo)
if(timeout)
set(timeout_args TIMEOUT ${timeout})
set(timeout_msg "${timeout} seconds")
@@ -523,11 +622,12 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash
set(timeout_msg "none")
endif()
- if("${hash}" MATCHES "${_ep_hash_regex}")
- set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2})
+ if(no_progress)
+ set(show_progress "")
else()
- set(hash_args "# no EXPECTED_HASH")
+ set(show_progress "SHOW_PROGRESS")
endif()
+
# check for curl globals in the project
if(DEFINED CMAKE_TLS_VERIFY)
set(tls_verify "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})")
@@ -562,8 +662,7 @@ ${tls_cainfo}
file(DOWNLOAD
\"${remote}\"
\"${local}\"
- SHOW_PROGRESS
- ${hash_args}
+ ${show_progress}
${timeout_args}
STATUS status
LOG log)
@@ -634,7 +733,7 @@ endfunction()
function(_ep_write_extractfile_script script_filename name filename directory)
set(args "")
- if(filename MATCHES "(\\.|=)(bz2|tar\\.gz|tgz|zip)$")
+ if(filename MATCHES "(\\.|=)(7z|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
set(args xfz)
endif()
@@ -643,7 +742,7 @@ function(_ep_write_extractfile_script script_filename name filename directory)
endif()
if(args STREQUAL "")
- message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .bz2, .tar, .tar.gz, .tgz and .zip")
+ message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .7z, .tar, .tar.bz2, .tar.gz, .tar.xz, .tbz2, .tgz, .txz and .zip")
return()
endif()
@@ -804,7 +903,8 @@ function(_ep_write_initial_cache target_name script_filename args)
set(regex "^([^:]+):([^=]+)=(.*)$")
set(setArg "")
foreach(line ${args})
- if("${line}" MATCHES "^-D")
+ if("${line}" MATCHES "^-D(.*)")
+ 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\" FORCE)")
@@ -812,9 +912,7 @@ function(_ep_write_initial_cache target_name script_filename args)
set(accumulator "")
set(setArg "")
endif()
- string(REGEX REPLACE "^-D" "" line ${line})
if("${line}" MATCHES "${regex}")
- string(REGEX MATCH "${regex}" match "${line}")
set(name "${CMAKE_MATCH_1}")
set(type "${CMAKE_MATCH_2}")
set(value "${CMAKE_MATCH_3}")
@@ -1074,6 +1172,8 @@ function(ExternalProject_Add_StepTargets name)
_ep_get_step_stampfile(${name} ${step} stamp_file)
add_custom_target(${name}-${step}
DEPENDS ${stamp_file})
+ set_property(TARGET ${name}-${step} PROPERTY LABELS ${name})
+ set_property(TARGET ${name}-${step} PROPERTY FOLDER "ExternalProjectTargets/${name}")
# Depend on other external projects (target-level).
get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
@@ -1091,14 +1191,17 @@ function(ExternalProject_Add_Step name step)
set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete")
_ep_get_step_stampfile(${name} ${step} stamp_file)
- add_custom_command(APPEND
- OUTPUT ${complete_stamp_file}
- DEPENDS ${stamp_file}
- )
-
_ep_parse_arguments(ExternalProject_Add_Step
${name} _EP_${step}_ "${ARGN}")
+ get_property(exclude_from_main TARGET ${name} PROPERTY _EP_${step}_EXCLUDE_FROM_MAIN)
+ if(NOT exclude_from_main)
+ add_custom_command(APPEND
+ OUTPUT ${complete_stamp_file}
+ DEPENDS ${stamp_file}
+ )
+ endif()
+
# Steps depending on this step.
get_property(dependers TARGET ${name} PROPERTY _EP_${step}_DEPENDERS)
foreach(depender IN LISTS dependers)
@@ -1246,7 +1349,7 @@ function(_ep_add_download_command name)
if(cmd_set)
set(work_dir ${download_dir})
elseif(cvs_repository)
- find_package(CVS)
+ find_package(CVS QUIET)
if(NOT CVS_EXECUTABLE)
message(FATAL_ERROR "error: could not find cvs for checkout of ${name}")
endif()
@@ -1273,7 +1376,7 @@ function(_ep_add_download_command name)
set(cmd ${CVS_EXECUTABLE} -d ${cvs_repository} -q co ${cvs_tag} -d ${src_name} ${cvs_module})
list(APPEND depends ${stamp_dir}/${name}-cvsinfo.txt)
elseif(svn_repository)
- find_package(Subversion)
+ find_package(Subversion QUIET)
if(NOT Subversion_SVN_EXECUTABLE)
message(FATAL_ERROR "error: could not find svn for checkout of ${name}")
endif()
@@ -1309,7 +1412,7 @@ function(_ep_add_download_command name)
--non-interactive ${svn_trust_cert_args} ${svn_user_pw_args} ${src_name})
list(APPEND depends ${stamp_dir}/${name}-svninfo.txt)
elseif(git_repository)
- find_package(Git)
+ find_package(Git QUIET)
if(NOT GIT_EXECUTABLE)
message(FATAL_ERROR "error: could not find git for clone of ${name}")
endif()
@@ -1357,7 +1460,7 @@ function(_ep_add_download_command name)
set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitclone.cmake)
list(APPEND depends ${stamp_dir}/${name}-gitinfo.txt)
elseif(hg_repository)
- find_package(Hg)
+ find_package(Hg QUIET)
if(NOT HG_EXECUTABLE)
message(FATAL_ERROR "error: could not find hg for clone of ${name}")
endif()
@@ -1433,20 +1536,21 @@ function(_ep_add_download_command name)
if("x${fname}" STREQUAL "x")
string(REGEX MATCH "[^/\\?]*$" fname "${url}")
endif()
- if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$")
- string(REGEX MATCH "([^/\\?]+(\\.|=)(bz2|tar|tgz|tar\\.gz|zip))/.*$" match_result "${url}")
+ 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}")
set(fname "${CMAKE_MATCH_1}")
endif()
- if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$")
+ if(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}")
endif()
string(REPLACE ";" "-" fname "${fname}")
set(file ${download_dir}/${fname})
get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT)
+ 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)
set(download_script "${stamp_dir}/download-${name}.cmake")
- _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}")
+ _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}")
set(cmd ${CMAKE_COMMAND} -P "${download_script}"
COMMAND)
set(retries 3)
@@ -1649,9 +1753,13 @@ function(_ep_add_configure_command name)
endif()
get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
+ get_target_property(cmake_generator_platform ${name} _EP_CMAKE_GENERATOR_PLATFORM)
get_target_property(cmake_generator_toolset ${name} _EP_CMAKE_GENERATOR_TOOLSET)
if(cmake_generator)
list(APPEND cmd "-G${cmake_generator}")
+ if(cmake_generator_platform)
+ list(APPEND cmd "-A${cmake_generator_platform}")
+ endif()
if(cmake_generator_toolset)
list(APPEND cmd "-T${cmake_generator_toolset}")
endif()
@@ -1661,6 +1769,12 @@ function(_ep_add_configure_command name)
else()
list(APPEND cmd "-G${CMAKE_GENERATOR}")
endif()
+ if(cmake_generator_platform)
+ message(FATAL_ERROR "Option CMAKE_GENERATOR_PLATFORM not allowed without CMAKE_GENERATOR.")
+ endif()
+ if(CMAKE_GENERATOR_PLATFORM)
+ list(APPEND cmd "-A${CMAKE_GENERATOR_PLATFORM}")
+ endif()
if(cmake_generator_toolset)
message(FATAL_ERROR "Option CMAKE_GENERATOR_TOOLSET not allowed without CMAKE_GENERATOR.")
endif()
@@ -1717,10 +1831,18 @@ function(_ep_add_build_command name)
set(log "")
endif()
+ get_property(build_always TARGET ${name} PROPERTY _EP_BUILD_ALWAYS)
+ if(build_always)
+ set(always 1)
+ else()
+ set(always 0)
+ endif()
+
ExternalProject_Add_Step(${name} build
COMMAND ${cmd}
WORKING_DIRECTORY ${binary_dir}
DEPENDEES configure
+ ALWAYS ${always}
${log}
)
endfunction()
@@ -1799,13 +1921,25 @@ function(ExternalProject_Add name)
set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete")
+ # The "ALL" option to add_custom_target just tells it to not set the
+ # EXCLUDE_FROM_ALL target property. Later, if the EXCLUDE_FROM_ALL
+ # argument was passed, we explicitly set it for the target.
add_custom_target(${name} ALL DEPENDS ${complete_stamp_file})
set_property(TARGET ${name} PROPERTY _EP_IS_EXTERNAL_PROJECT 1)
+ set_property(TARGET ${name} PROPERTY LABELS ${name})
+ set_property(TARGET ${name} PROPERTY FOLDER "ExternalProjectTargets/${name}")
+
_ep_parse_arguments(ExternalProject_Add ${name} _EP_ "${ARGN}")
_ep_set_directories(${name})
_ep_get_step_stampfile(${name} "done" done_stamp_file)
_ep_get_step_stampfile(${name} "install" install_stamp_file)
+ # Set the EXCLUDE_FROM_ALL target property if required.
+ get_property(exclude_from_all TARGET ${name} PROPERTY _EP_EXCLUDE_FROM_ALL)
+ if(exclude_from_all)
+ set_property(TARGET ${name} PROPERTY EXCLUDE_FROM_ALL TRUE)
+ endif()
+
# The 'complete' step depends on all other steps and creates a
# 'done' mark. A dependent external project's 'configure' step
# depends on the 'done' mark so that it rebuilds when this project
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index c0e63d5..12ea384 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -71,6 +71,13 @@
# 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
@@ -417,8 +424,8 @@ endfunction()
function(FEATURE_SUMMARY)
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
- set(oneValueArgs FILENAME VAR DESCRIPTION WHAT)
- set(multiValueArgs ) # none
+ set(oneValueArgs FILENAME VAR DESCRIPTION)
+ set(multiValueArgs WHAT)
CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
@@ -451,23 +458,42 @@ function(FEATURE_SUMMARY)
set(requiredPackagesNotFound TRUE)
endif()
- elseif("${_FS_WHAT}" STREQUAL "ALL")
-
- set(allWhatParts "ENABLED_FEATURES"
- "RUNTIME_PACKAGES_FOUND"
- "OPTIONAL_PACKAGES_FOUND"
- "RECOMMENDED_PACKAGES_FOUND"
- "REQUIRED_PACKAGES_FOUND"
+ else()
+ if("${_FS_WHAT}" STREQUAL "ALL")
+
+ set(allWhatParts "ENABLED_FEATURES"
+ "RUNTIME_PACKAGES_FOUND"
+ "OPTIONAL_PACKAGES_FOUND"
+ "RECOMMENDED_PACKAGES_FOUND"
+ "REQUIRED_PACKAGES_FOUND"
+
+ "DISABLED_FEATURES"
+ "RUNTIME_PACKAGES_NOT_FOUND"
+ "OPTIONAL_PACKAGES_NOT_FOUND"
+ "RECOMMENDED_PACKAGES_NOT_FOUND"
+ "REQUIRED_PACKAGES_NOT_FOUND"
+ )
- "DISABLED_FEATURES"
- "RUNTIME_PACKAGES_NOT_FOUND"
- "OPTIONAL_PACKAGES_NOT_FOUND"
- "RECOMMENDED_PACKAGES_NOT_FOUND"
- "REQUIRED_PACKAGES_NOT_FOUND"
- )
+ else()
+ set(allWhatParts)
+ foreach(part ${_FS_WHAT})
+ list(FIND validWhatParts "${part}" indexInList)
+ if(NOT "${indexInList}" STREQUAL "-1")
+ list(APPEND allWhatParts "${part}")
+ else()
+ if("${part}" STREQUAL "ALL")
+ message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() contains ALL, which cannot be combined with other values.")
+ else()
+ message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() contains ${part}, which is not a valid value.")
+ endif()
+ endif()
+ endforeach()
+ endif()
set(title_ENABLED_FEATURES "The following features have been enabled:")
set(title_DISABLED_FEATURES "The following features have been disabled:")
+ set(title_PACKAGES_FOUND "The following packages have been found:")
+ set(title_PACKAGES_NOT_FOUND "The following packages have not been found:")
set(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:")
set(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:")
set(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:")
@@ -488,8 +514,6 @@ function(FEATURE_SUMMARY)
endif()
endif()
endforeach()
- else()
- message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() is set to ${_FS_WHAT}, which is not a valid value.")
endif()
if(_FS_FILENAME)
@@ -522,10 +546,10 @@ function(SET_PACKAGE_INFO _name _desc)
set(_url "${ARGV2}")
set(_purpose "${ARGV3}")
set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
- if(_url MATCHES ".+")
+ if(NOT _url STREQUAL "")
set_property(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_url}" )
endif()
- if(_purpose MATCHES ".+")
+ if(NOT _purpose STREQUAL "")
set_property(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_purpose}" )
endif()
endfunction()
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index 9ca428e..ec3ee78 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -92,16 +92,13 @@ if(BISON_EXECUTABLE)
message(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
else()
# Bison++
- if("${BISON_version_output}" MATCHES "^bison\\+\\+")
- string(REGEX REPLACE "^bison\\+\\+ Version ([^,]+).*" "\\1"
- BISON_VERSION "${BISON_version_output}")
+ if("${BISON_version_output}" MATCHES "^bison\\+\\+ Version ([^,]+)")
+ set(BISON_VERSION "${CMAKE_MATCH_1}")
# GNU Bison
- elseif("${BISON_version_output}" MATCHES "^bison[^+]")
- string(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
- BISON_VERSION "${BISON_version_output}")
- elseif("${BISON_version_output}" MATCHES "^GNU Bison ")
- string(REGEX REPLACE "^GNU Bison (version )?([^\n]+).*" "\\2"
- BISON_VERSION "${BISON_version_output}")
+ elseif("${BISON_version_output}" MATCHES "^bison \\(GNU Bison\\) ([^\n]+)\n")
+ set(BISON_VERSION "${CMAKE_MATCH_1}")
+ elseif("${BISON_version_output}" MATCHES "^GNU Bison (version )?([^\n]+)")
+ set(BISON_VERSION "${CMAKE_MATCH_2}")
endif()
endif()
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 3b658ef..6a583d9 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -52,6 +52,9 @@
include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+cmake_push_check_state()
+set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
@@ -147,7 +150,7 @@ endmacro()
set(BLAS_LINKER_FLAGS)
set(BLAS_LIBRARIES)
set(BLAS95_LIBRARIES)
-if ($ENV{BLA_VENDOR} MATCHES ".+")
+if (NOT $ENV{BLA_VENDOR} STREQUAL "")
set(BLA_VENDOR $ENV{BLA_VENDOR})
else ()
if(NOT BLA_VENDOR)
@@ -285,7 +288,7 @@ if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
endif ()
#BLAS in acml library?
-if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
+if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR
((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
@@ -462,7 +465,7 @@ if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
endif ()
#BLAS in intel mkl 10 library? (em64t 64bit)
-if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
if (NOT WIN32)
set(LM "-lm")
endif ()
@@ -529,7 +532,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
"mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
# mkl >= 10.3
- if (CMAKE_C_COMPILER MATCHES ".+gcc.*")
+ if (CMAKE_C_COMPILER MATCHES ".+gcc")
list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
else ()
@@ -597,7 +600,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
"mkl_intel_lp64 mkl_intel_thread mkl_core guide")
# mkl >= 10.3
- if (CMAKE_C_COMPILER MATCHES ".+gcc.*")
+ if (CMAKE_C_COMPILER MATCHES ".+gcc")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
else ()
@@ -687,4 +690,5 @@ else()
endif()
endif()
+cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 3883877..b479332 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -57,7 +57,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2
if (BZIP2_FOUND)
include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+ cmake_push_check_state()
+ set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY})
CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
+ cmake_pop_check_state()
endif ()
mark_as_advanced(BZIP2_INCLUDE_DIR)
diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake
index 83789cc..5620661 100644
--- a/Modules/FindBacktrace.cmake
+++ b/Modules/FindBacktrace.cmake
@@ -62,6 +62,7 @@ if (NOT DEFINED Backtrace_LIBRARY)
# First, check if we already have backtrace(), e.g., in libc
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS})
+ set(CMAKE_REQUIRED_QUIET ${Backtrace_FIND_QUIETLY})
check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND)
cmake_pop_check_state()
endif()
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index a57e12c..0eec4ad 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -383,6 +383,8 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
else()
set (_boost_COMPILER "-il")
endif()
+ elseif (MSVC14)
+ set(_boost_COMPILER "-vc140")
elseif (MSVC12)
set(_boost_COMPILER "-vc120")
elseif (MSVC11)
@@ -631,12 +633,12 @@ if(NOT Boost_INCLUDE_DIR)
set(_boost_BOOSTIFIED_VERSION)
# Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
- if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
- string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
- _boost_BOOSTIFIED_VERSION ${_boost_VER})
- elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
- string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
- _boost_BOOSTIFIED_VERSION ${_boost_VER})
+ if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
+ set(_boost_BOOSTIFIED_VERSION
+ "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}")
+ elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)")
+ set(_boost_BOOSTIFIED_VERSION
+ "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
endif()
list(APPEND _boost_PATH_SUFFIXES
@@ -684,7 +686,7 @@ if(Boost_INCLUDE_DIR)
set(_Boost_VERSION_REGEX "([0-9]+)")
set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"")
foreach(v VERSION LIB_VERSION)
- if("${_boost_VERSION_HPP_CONTENTS}" MATCHES ".*#define BOOST_${v} ${_Boost_${v}_REGEX}.*")
+ if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}")
set(Boost_${v} "${CMAKE_MATCH_1}")
endif()
endforeach()
@@ -954,7 +956,8 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
# Compute component-specific hints.
set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
- if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python")
+ if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR
+ ${COMPONENT} STREQUAL "graph_parallel")
foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
if(IS_ABSOLUTE "${lib}")
get_filename_component(libdir "${lib}" PATH)
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index d50e960..9348aa5 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -31,8 +31,8 @@
# The following variables affect the behavior of the macros in the
# script (in alphebetical order). Note that any of these flags can be
# changed multiple times in the same directory before calling
-# CUDA_ADD_EXECUTABLE, CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX
-# or CUDA_WRAP_SRCS::
+# CUDA_ADD_EXECUTABLE, CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX,
+# CUDA_COMPILE_FATBIN, CUDA_COMPILE_CUBIN or CUDA_WRAP_SRCS::
#
# CUDA_64_BIT_DEVICE_CODE (Default matches host bit size)
# -- Set to ON to compile for 64 bit device code, OFF for 32 bit device code.
@@ -152,6 +152,12 @@
# CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] )
# -- Returns a list of PTX files generated from the input source files.
#
+# CUDA_COMPILE_FATBIN( generated_files file0 file1 ... [OPTIONS ...] )
+# -- Returns a list of FATBIN files generated from the input source files.
+#
+# CUDA_COMPILE_CUBIN( generated_files file0 file1 ... [OPTIONS ...] )
+# -- Returns a list of CUBIN files generated from the input source files.
+#
# CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME( output_file_var
# cuda_target
# object_files )
@@ -324,11 +330,6 @@
# FindCUDA.cmake
-# We need to have at least this version to support the VERSION_LESS argument to 'if' (2.6.2) and unset (2.6.3)
-cmake_policy(PUSH)
-cmake_minimum_required(VERSION 2.6.3)
-cmake_policy(POP)
-
# This macro helps us find the location of helper files we will need the full path to
macro(CUDA_FIND_HELPER_FILE _name _extension)
set(_full_name "${_name}.${_extension}")
@@ -451,7 +452,17 @@ set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
if(CMAKE_GENERATOR MATCHES "Visual Studio")
set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC")
else()
- set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC")
+ # Using cc which is symlink to clang may let NVCC think it is GCC and issue
+ # unhandled -dumpspecs option to clang. Also in case neither
+ # CMAKE_C_COMPILER is defined (project does not use C language) nor
+ # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let
+ # nvcc use its own default C compiler.
+ if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER)
+ get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH)
+ else()
+ set(c_compiler_realpath "")
+ endif()
+ set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC")
endif()
# Propagate the host flags to the host compiler via -Xcompiler
@@ -987,7 +998,7 @@ function(CUDA_COMPUTE_BUILD_PATH path build_path)
endif()
endif()
- # This recipie is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the
+ # This recipe is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the
# CMake source.
# Remove leading /
@@ -1016,7 +1027,7 @@ endfunction()
# a .cpp or .ptx file.
# INPUT:
# cuda_target - Target name
-# format - PTX or OBJ
+# format - PTX, CUBIN, FATBIN or OBJ
# FILE1 .. FILEN - The remaining arguments are the sources to be wrapped.
# OPTIONS - Extra options to NVCC
# OUTPUT:
@@ -1194,7 +1205,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
foreach(file ${ARGN})
# Ignore any file marked as a HEADER_FILE_ONLY
get_source_file_property(_is_header ${file} HEADER_FILE_ONLY)
- if(${file} MATCHES ".*\\.cu$" AND NOT _is_header)
+ if(${file} MATCHES "\\.cu$" AND NOT _is_header)
# Allow per source file overrides of the format.
get_source_file_property(_cuda_source_format ${file} CUDA_SOURCE_PROPERTY_FORMAT)
@@ -1202,16 +1213,22 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(_cuda_source_format ${format})
endif()
- if( ${_cuda_source_format} MATCHES "PTX" )
- set( compile_to_ptx ON )
- elseif( ${_cuda_source_format} MATCHES "OBJ")
- set( compile_to_ptx OFF )
+ if( ${_cuda_source_format} MATCHES "OBJ")
+ set( cuda_compile_to_external_module OFF )
else()
- message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS for file '${file}': '${_cuda_source_format}'. Use OBJ or PTX.")
+ set( cuda_compile_to_external_module ON )
+ if( ${_cuda_source_format} MATCHES "PTX" )
+ set( cuda_compile_to_external_module_type "ptx" )
+ elseif( ${_cuda_source_format} MATCHES "CUBIN")
+ set( cuda_compile_to_external_module_type "cubin" )
+ elseif( ${_cuda_source_format} MATCHES "FATBIN")
+ set( cuda_compile_to_external_module_type "fatbin" )
+ else()
+ message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS for file '${file}': '${_cuda_source_format}'. Use OBJ, PTX, CUBIN or FATBIN.")
+ endif()
endif()
-
- if(compile_to_ptx)
+ if(cuda_compile_to_external_module)
# Don't use any of the host compilation flags for PTX targets.
set(CUDA_HOST_FLAGS)
set(CUDA_NVCC_FLAGS_CONFIG)
@@ -1226,7 +1243,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
if(CUDA_GENERATED_OUTPUT_DIR)
set(cuda_compile_output_dir "${CUDA_GENERATED_OUTPUT_DIR}")
else()
- if ( compile_to_ptx )
+ if ( cuda_compile_to_external_module )
set(cuda_compile_output_dir "${CMAKE_CURRENT_BINARY_DIR}")
else()
set(cuda_compile_output_dir "${cuda_compile_intermediate_directory}")
@@ -1236,10 +1253,10 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# Add a custom target to generate a c or ptx file. ######################
get_filename_component( basename ${file} NAME )
- if( compile_to_ptx )
+ if( cuda_compile_to_external_module )
set(generated_file_path "${cuda_compile_output_dir}")
- set(generated_file_basename "${cuda_target}_generated_${basename}.ptx")
- set(format_flag "-ptx")
+ set(generated_file_basename "${cuda_target}_generated_${basename}.${cuda_compile_to_external_module_type}")
+ set(format_flag "-${cuda_compile_to_external_module_type}")
file(MAKE_DIRECTORY "${cuda_compile_output_dir}")
else()
set(generated_file_path "${cuda_compile_output_dir}/${CMAKE_CFG_INTDIR}")
@@ -1262,7 +1279,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(custom_target_script "${cuda_compile_intermediate_directory}/${generated_file_basename}.cmake")
# Setup properties for obj files:
- if( NOT compile_to_ptx )
+ if( NOT cuda_compile_to_external_module )
set_source_files_properties("${generated_file}"
PROPERTIES
EXTERNAL_OBJECT true # This is an object file not to be compiled, but only be linked.
@@ -1277,7 +1294,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
endif()
- if( NOT compile_to_ptx AND CUDA_SEPARABLE_COMPILATION)
+ if( NOT cuda_compile_to_external_module AND CUDA_SEPARABLE_COMPILATION)
list(APPEND ${cuda_target}_SEPARABLE_COMPILATION_OBJECTS "${generated_file}")
endif()
@@ -1294,7 +1311,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# Build the NVCC made dependency file ###################################
set(build_cubin OFF)
if ( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN )
- if ( NOT compile_to_ptx )
+ if ( NOT cuda_compile_to_external_module )
set ( build_cubin ON )
endif()
endif()
@@ -1321,8 +1338,8 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# Create up the comment string
file(RELATIVE_PATH generated_file_relative_path "${CMAKE_BINARY_DIR}" "${generated_file}")
- if(compile_to_ptx)
- set(cuda_build_comment_string "Building NVCC ptx file ${generated_file_relative_path}")
+ if(cuda_compile_to_external_module)
+ set(cuda_build_comment_string "Building NVCC ${cuda_compile_to_external_module_type} file ${generated_file_relative_path}")
else()
set(cuda_build_comment_string "Building NVCC (${cuda_build_type}) object ${generated_file_relative_path}")
endif()
@@ -1415,7 +1432,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
# If -ccbin, --compiler-bindir has been specified, don't do anything. Otherwise add it here.
list( FIND nvcc_flags "-ccbin" ccbin_found0 )
list( FIND nvcc_flags "--compiler-bindir" ccbin_found1 )
- if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 )
+ if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
endif()
# Create a list of flags specified by CUDA_NVCC_FLAGS_${CONFIG}
@@ -1561,21 +1578,29 @@ endmacro()
###############################################################################
###############################################################################
-# CUDA COMPILE
+# (Internal) helper for manually added cuda source files with specific targets
###############################################################################
###############################################################################
-macro(CUDA_COMPILE generated_files)
+macro(cuda_compile_base cuda_target format generated_files)
# 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_compile OBJ _generated_files ${_sources} ${_cmake_options}
+ CUDA_WRAP_SRCS( ${cuda_target} ${format} _generated_files ${_sources} ${_cmake_options}
OPTIONS ${_options} )
set( ${generated_files} ${_generated_files})
endmacro()
+###############################################################################
+###############################################################################
+# CUDA COMPILE
+###############################################################################
+###############################################################################
+macro(CUDA_COMPILE generated_files)
+ cuda_compile_base(cuda_compile OBJ ${generated_files} ${ARGN})
+endmacro()
###############################################################################
###############################################################################
@@ -1583,17 +1608,28 @@ endmacro()
###############################################################################
###############################################################################
macro(CUDA_COMPILE_PTX generated_files)
+ cuda_compile_base(cuda_compile_ptx PTX ${generated_files} ${ARGN})
+endmacro()
- # 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_compile_ptx PTX _generated_files ${_sources} ${_cmake_options}
- OPTIONS ${_options} )
-
- set( ${generated_files} ${_generated_files})
+###############################################################################
+###############################################################################
+# CUDA COMPILE FATBIN
+###############################################################################
+###############################################################################
+macro(CUDA_COMPILE_FATBIN generated_files)
+ cuda_compile_base(cuda_compile_fatbin FATBIN ${generated_files} ${ARGN})
+endmacro()
+###############################################################################
+###############################################################################
+# CUDA COMPILE CUBIN
+###############################################################################
+###############################################################################
+macro(CUDA_COMPILE_CUBIN generated_files)
+ cuda_compile_base(cuda_compile_cubin CUBIN ${generated_files} ${ARGN})
endmacro()
+
###############################################################################
###############################################################################
# CUDA ADD CUFFT TO TARGET
diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake
index 1b53d17..c433fa8 100644
--- a/Modules/FindCUDA/make2cmake.cmake
+++ b/Modules/FindCUDA/make2cmake.cmake
@@ -37,12 +37,11 @@
file(READ ${input_file} depend_text)
-if (${depend_text} MATCHES ".+")
+if (NOT "${depend_text}" STREQUAL "")
# message("FOUND DEPENDS")
- # Remember, four backslashes is escaped to one backslash in the string.
- string(REGEX REPLACE "\\\\ " " " depend_text ${depend_text})
+ string(REPLACE "\\ " " " depend_text ${depend_text})
# This works for the nvcc -M generated dependency files.
string(REGEX REPLACE "^.* : " "" depend_text ${depend_text})
diff --git a/Modules/FindCUDA/parse_cubin.cmake b/Modules/FindCUDA/parse_cubin.cmake
index 94be7e2..626c8a2 100644
--- a/Modules/FindCUDA/parse_cubin.cmake
+++ b/Modules/FindCUDA/parse_cubin.cmake
@@ -37,11 +37,10 @@
file(READ ${input_file} file_text)
-if (${file_text} MATCHES ".+")
+if (NOT "${file_text}" STREQUAL "")
- # Remember, four backslashes is escaped to one backslash in the string.
- string(REGEX REPLACE ";" "\\\\;" file_text ${file_text})
- string(REGEX REPLACE "\ncode" ";code" file_text ${file_text})
+ string(REPLACE ";" "\\;" file_text ${file_text})
+ string(REPLACE "\ncode" ";code" file_text ${file_text})
list(LENGTH file_text len)
@@ -57,7 +56,7 @@ if (${file_text} MATCHES ".+")
# Extract kernel names.
if (${entry} MATCHES "[^g]name = ([^ ]+)")
- string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
+ set(entry "${CMAKE_MATCH_1}")
# Check to see if the kernel name starts with "_"
set(skip FALSE)
@@ -76,19 +75,19 @@ if (${file_text} MATCHES ".+")
# Registers
if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
- string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ set(entry "${CMAKE_MATCH_3}")
message("Registers: ${entry}")
endif()
# Local memory
if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
- string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ set(entry "${CMAKE_MATCH_3}")
message("Local: ${entry}")
endif()
# Shared memory
if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
- string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ set(entry "${CMAKE_MATCH_3}")
message("Shared: ${entry}")
endif()
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index f0aac84..58e0d31 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -62,7 +62,7 @@ set(cmake_dependency_file "@cmake_dependency_file@") # path
set(CUDA_make2cmake "@CUDA_make2cmake@") # path
set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path
set(build_cubin @build_cubin@) # bool
-set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # bool
+set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # path
# We won't actually use these variables for now, but we need to set this, in
# order to force this file to be run again if it changes.
set(generated_file_path "@generated_file_path@") # path
@@ -106,7 +106,7 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
-if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 )
+if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN)
set(CCBIN -ccbin "${CCBIN}")
else()
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
index 4b55d6a..51eb7c5 100644
--- a/Modules/FindCups.cmake
+++ b/Modules/FindCups.cmake
@@ -36,9 +36,13 @@ find_library(CUPS_LIBRARIES NAMES cups )
if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+ cmake_push_check_state()
+ set(CMAKE_REQUIRED_QUIET ${Cups_FIND_QUIETLY})
# ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
+ cmake_pop_check_state()
endif ()
if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
@@ -48,9 +52,8 @@ if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
unset(CUPS_VERSION_STRING)
foreach(VPART MAJOR MINOR PATCH)
foreach(VLINE ${cups_version_str})
- if(VLINE MATCHES "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}")
- string(REGEX REPLACE "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}[\t ]+([0-9]+)$" "\\1"
- CUPS_VERSION_PART "${VLINE}")
+ 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}")
else()
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index a453a67..0184c39 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -2,28 +2,43 @@
# FindCurses
# ----------
#
-# Find the curses include file and library
+# Find the curses or ncurses include file and library.
#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
#
+# This module defines the following variables:
#
-# ::
+# ``CURSES_FOUND``
+# True if Curses is found.
+# ``CURSES_INCLUDE_DIRS``
+# The include directories needed to use Curses.
+# ``CURSES_LIBRARIES``
+# The libraries needed to use Curses.
+# ``CURSES_HAVE_CURSES_H``
+# True if curses.h is available.
+# ``CURSES_HAVE_NCURSES_H``
+# True if ncurses.h is available.
+# ``CURSES_HAVE_NCURSES_NCURSES_H``
+# True if ``ncurses/ncurses.h`` is available.
+# ``CURSES_HAVE_NCURSES_CURSES_H``
+# True if ``ncurses/curses.h`` is available.
#
-# CURSES_FOUND - system has Curses
-# CURSES_INCLUDE_DIR - the Curses include directory
-# CURSES_LIBRARIES - The libraries needed to use Curses
-# CURSES_HAVE_CURSES_H - true if curses.h is available
-# CURSES_HAVE_NCURSES_H - true if ncurses.h is available
-# CURSES_HAVE_NCURSES_NCURSES_H - true if ncurses/ncurses.h is available
-# CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available
-# CURSES_LIBRARY - set for backwards compatibility with 2.4 CMake
+# Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the
+# ``find_package(Curses)`` call if NCurses functionality is required.
#
+# Backward Compatibility
+# ^^^^^^^^^^^^^^^^^^^^^^
#
+# The following variable are provided for backward compatibility:
#
-# Set CURSES_NEED_NCURSES to TRUE before the find_package() command if
-# NCurses functionality is required.
+# ``CURSES_INCLUDE_DIR``
+# Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead.
+# ``CURSES_LIBRARY``
+# Path to Curses library. Use ``CURSES_LIBRARIES`` instead.
#=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
+# Copyright 2001-2014 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -67,6 +82,9 @@ endif()
# default search paths.
if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+ cmake_push_check_state()
+ set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY})
CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
@@ -77,62 +95,31 @@ if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
set(CURSES_USE_NCURSES TRUE)
endif()
endif()
+ cmake_pop_check_state()
endif()
-
-if(NOT CURSES_USE_NCURSES)
- find_file(CURSES_HAVE_CURSES_H curses.h )
- find_path(CURSES_CURSES_H_PATH curses.h )
- get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
- get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
-
- # for compatibility with older FindCurses.cmake this has to be in the cache
- # FORCE must not be used since this would break builds which preload a cache wqith these variables set
- set(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}"
- CACHE FILEPATH "The curses include path")
- set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}"
- CACHE FILEPATH "The curses library")
-else()
-# we need to find ncurses
+if(CURSES_USE_NCURSES)
get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
- find_file(CURSES_HAVE_NCURSES_H ncurses.h)
- find_file(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h)
- find_file(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h)
- find_file(CURSES_HAVE_CURSES_H curses.h
- HINTS "${_cursesParentDir}/include")
-
- find_path(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h
- ncurses/curses.h)
- find_path(CURSES_NCURSES_INCLUDE_PATH curses.h
- HINTS "${_cursesParentDir}/include")
-
- # for compatibility with older FindCurses.cmake this has to be in the cache
- # FORCE must not be used since this would break builds which preload
- # however if the value of the variable has NOTFOUND in it, then
- # it is OK to force, and we need to force in order to have it work.
- # a cache wqith these variables set
- # only put ncurses include and library into
- # variables if they are found
- if(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H)
- get_filename_component(CURSES_NCURSES_INCLUDE_PATH
- "${CURSES_HAVE_NCURSES_NCURSES_H}" PATH)
+ # Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility.
+ if(CURSES_NCURSES_INCLUDE_PATH)
+ find_path(CURSES_INCLUDE_PATH
+ NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h
+ PATHS ${CURSES_NCURSES_INCLUDE_PATH}
+ NO_DEFAULT_PATH
+ )
endif()
- if(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY)
- set( FORCE_IT )
- if(CURSES_INCLUDE_PATH MATCHES NOTFOUND)
- set(FORCE_IT FORCE)
- endif()
- set(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}"
- CACHE FILEPATH "The curses include path" ${FORCE_IT})
- set( FORCE_IT)
- if(CURSES_LIBRARY MATCHES NOTFOUND)
- set(FORCE_IT FORCE)
- endif()
- set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}"
- CACHE FILEPATH "The curses library" ${FORCE_IT})
+
+ find_path(CURSES_INCLUDE_PATH
+ NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h
+ HINTS "${_cursesParentDir}/include"
+ )
+
+ # Previous versions of FindCurses provided these values.
+ if(NOT DEFINED CURSES_LIBRARY)
+ set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}")
endif()
CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
@@ -143,6 +130,52 @@ else()
CHECK_LIBRARY_EXISTS("${CURSES_EXTRA_LIBRARY}"
cbreak "" CURSES_TINFO_HAS_CBREAK)
endif()
+else()
+ get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
+ get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
+
+ find_path(CURSES_INCLUDE_PATH
+ NAMES curses.h
+ HINTS "${_cursesParentDir}/include"
+ )
+
+ # Previous versions of FindCurses provided these values.
+ if(NOT DEFINED CURSES_CURSES_H_PATH)
+ set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}")
+ endif()
+ if(NOT DEFINED CURSES_LIBRARY)
+ set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}")
+ endif()
+endif()
+
+# Report whether each possible header name exists in the include directory.
+if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H)
+ if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
+ set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
+ else()
+ set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND")
+ endif()
+endif()
+if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H)
+ if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
+ set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
+ else()
+ set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND")
+ endif()
+endif()
+if(NOT DEFINED CURSES_HAVE_NCURSES_H)
+ if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h")
+ set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h")
+ else()
+ set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND")
+ endif()
+endif()
+if(NOT DEFINED CURSES_HAVE_CURSES_H)
+ if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h")
+ set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h")
+ else()
+ set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND")
+ endif()
endif()
if (NOT CURSES_TINFO_HAS_CBREAK)
@@ -153,11 +186,10 @@ endif()
find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}")
find_library(CURSES_FORM_LIBRARY form )
-# for compatibility with older FindCurses.cmake this has to be in the cache
-# FORCE must not be used since this would break builds which preload a cache
-# qith these variables set
-set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}"
- CACHE FILEPATH "The curses form library")
+# Previous versions of FindCurses provided these values.
+if(NOT DEFINED FORM_LIBRARY)
+ set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}")
+endif()
# Need to provide the *_LIBRARIES
set(CURSES_LIBRARIES ${CURSES_LIBRARY})
@@ -170,8 +202,9 @@ if(CURSES_FORM_LIBRARY)
set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY})
endif()
-# Proper name is *_INCLUDE_DIR
-set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
+# Provide the *_INCLUDE_DIRS result.
+set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH})
+set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility
# handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if
# all listed variables are TRUE
@@ -181,18 +214,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG
mark_as_advanced(
CURSES_INCLUDE_PATH
- CURSES_LIBRARY
- CURSES_CURSES_INCLUDE_PATH
CURSES_CURSES_LIBRARY
- CURSES_NCURSES_INCLUDE_PATH
CURSES_NCURSES_LIBRARY
CURSES_EXTRA_LIBRARY
- FORM_LIBRARY
- CURSES_LIBRARIES
- CURSES_INCLUDE_DIR
- CURSES_CURSES_HAS_WSYNCUP
- CURSES_NCURSES_HAS_WSYNCUP
- CURSES_NCURSES_HAS_CBREAK
- CURSES_TINFO_HAS_CBREAK
)
-
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index a456d9c..d34941a 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -30,7 +30,16 @@
#
# DOXYGEN_DOT_EXECUTABLE = The path to the dot program used by doxygen.
# DOXYGEN_DOT_FOUND = Was Dot found or not?
-# DOXYGEN_DOT_PATH = The path to dot not including the executable
+#
+# For compatibility with older versions of CMake, the now-deprecated
+# variable ``DOXYGEN_DOT_PATH`` is set to the path to the directory
+# containing ``dot`` as reported in ``DOXYGEN_DOT_EXECUTABLE``.
+# The path may have forward slashes even on Windows and is not
+# suitable for direct substitution into a ``Doxyfile.in`` template.
+# If you need this value, use :command:`get_filename_component`
+# to compute it from ``DOXYGEN_DOT_EXECUTABLE`` directly, and
+# perhaps the :command:`file(TO_NATIVE_PATH)` command to prepare
+# the path for a Doxygen configuration file.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -101,12 +110,18 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Doxygen REQUIRED_VARS DOXYGEN_EXECUTABLE VERSI
# Find Dot...
#
+set(_x86 "(x86)")
+file(GLOB _Doxygen_GRAPHVIZ_BIN_DIRS
+ "$ENV{ProgramFiles}/Graphviz*/bin"
+ "$ENV{ProgramFiles${_x86}}/Graphviz*/bin"
+ )
+unset(_x86)
+
if(NOT DOXYGEN_SKIP_DOT)
find_program(DOXYGEN_DOT_EXECUTABLE
NAMES dot
PATHS
- "$ENV{ProgramFiles}/Graphviz 2.21/bin"
- "C:/Program Files/Graphviz 2.21/bin"
+ ${_Doxygen_GRAPHVIZ_BIN_DIRS}
"$ENV{ProgramFiles}/ATT/Graphviz/bin"
"C:/Program Files/ATT/Graphviz/bin"
[HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin
@@ -119,7 +134,7 @@ if(NOT DOXYGEN_SKIP_DOT)
if(DOXYGEN_DOT_EXECUTABLE)
set(DOXYGEN_DOT_FOUND TRUE)
# The Doxyfile wants the path to Dot, not the entire path and executable
- get_filename_component(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH CACHE)
+ get_filename_component(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH)
endif()
endif()
@@ -153,5 +168,4 @@ set (DOT ${DOXYGEN_DOT_EXECUTABLE} )
mark_as_advanced(
DOXYGEN_EXECUTABLE
DOXYGEN_DOT_EXECUTABLE
- DOXYGEN_DOT_PATH
)
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index 6183af8..653094c 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -38,9 +38,8 @@ if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
unset(EXPAT_VERSION_STRING)
foreach(VPART MAJOR MINOR MICRO)
foreach(VLINE ${expat_version_str})
- if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION")
- string(REGEX REPLACE "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$" "\\1"
- EXPAT_VERSION_PART "${VLINE}")
+ 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}")
else()
diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake
index b87bc7f..76f702e 100644
--- a/Modules/FindFLTK.cmake
+++ b/Modules/FindFLTK.cmake
@@ -285,9 +285,7 @@ endif()
OUTPUT_VARIABLE FLTK_IMAGES_LDFLAGS)
set(FLTK_LIBS_EXTRACT_REGEX ".*-lfltk_images (.*) -lfltk.*")
if("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}")
- string(REGEX REPLACE "${FLTK_LIBS_EXTRACT_REGEX}" "\\1"
- FLTK_IMAGES_LIBS "${FLTK_IMAGES_LDFLAGS}")
- string(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}")
+ string(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${CMAKE_MATCH_1}")
# The EXEC_PROGRAM will not be inherited into subdirectories from
# the file that originally included this module. Save the answer.
set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL
diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake
index 4deffda..930acca 100644
--- a/Modules/FindFLTK2.cmake
+++ b/Modules/FindFLTK2.cmake
@@ -226,9 +226,7 @@ if(FLTK2_DIR)
OUTPUT_VARIABLE FLTK2_IMAGES_LDFLAGS)
set(FLTK2_LIBS_EXTRACT_REGEX ".*-lfltk2_images (.*) -lfltk2.*")
if("${FLTK2_IMAGES_LDFLAGS}" MATCHES "${FLTK2_LIBS_EXTRACT_REGEX}")
- string(REGEX REPLACE "${FLTK2_LIBS_EXTRACT_REGEX}" "\\1"
- FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LDFLAGS}")
- string(REGEX REPLACE " +" ";" FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}")
+ string(REGEX REPLACE " +" ";" FLTK2_IMAGES_LIBS "${CMAKE_MATCH_1}")
# The EXEC_PROGRAM will not be inherited into subdirectories from
# the file that originally included this module. Save the answer.
set(FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}" CACHE INTERNAL
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 6f03c86..7d46d15 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -51,7 +51,9 @@
# 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
+find_path(
+ FREETYPE_INCLUDE_DIR_ft2build
+ ft2build.h
HINTS
ENV FREETYPE_DIR
PATHS
@@ -62,10 +64,14 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
- PATH_SUFFIXES include/freetype2 include
+ PATH_SUFFIXES
+ include/freetype2
+ include
+ freetype2
)
-find_path(FREETYPE_INCLUDE_DIR_freetype2
+find_path(
+ FREETYPE_INCLUDE_DIR_freetype2
NAMES
freetype/config/ftheader.h
config/ftheader.h
@@ -79,14 +85,19 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
- PATH_SUFFIXES include/freetype2 include
+ PATH_SUFFIXES
+ include/freetype2
+ include
+ freetype2
)
find_library(FREETYPE_LIBRARY
- NAMES freetype libfreetype freetype219
+ NAMES
+ freetype
+ libfreetype
+ freetype219
HINTS
ENV FREETYPE_DIR
- PATH_SUFFIXES lib
PATHS
/usr/X11R6
/usr/local/X11R6
@@ -95,6 +106,8 @@ find_library(FREETYPE_LIBRARY
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
+ PATH_SUFFIXES
+ lib
)
# set the user variables
@@ -111,32 +124,41 @@ elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
endif()
if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
- file(STRINGS "${FREETYPE_H}" freetype_version_str
- REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
+ file(STRINGS "${FREETYPE_H}" freetype_version_str
+ REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
- unset(FREETYPE_VERSION_STRING)
- foreach(VPART MAJOR MINOR PATCH)
- foreach(VLINE ${freetype_version_str})
- if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}")
- string(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1"
- FREETYPE_VERSION_PART "${VLINE}")
- if(FREETYPE_VERSION_STRING)
- set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
- else()
- set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
- endif()
- unset(FREETYPE_VERSION_PART)
- endif()
- endforeach()
+ unset(FREETYPE_VERSION_STRING)
+ foreach(VPART MAJOR MINOR PATCH)
+ foreach(VLINE ${freetype_version_str})
+ 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}")
+ else()
+ set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
+ endif()
+ unset(FREETYPE_VERSION_PART)
+ endif()
endforeach()
+ endforeach()
endif()
# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype
- REQUIRED_VARS FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS
- VERSION_VAR FREETYPE_VERSION_STRING)
-mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build)
+find_package_handle_standard_args(
+ Freetype
+ REQUIRED_VARS
+ FREETYPE_LIBRARY
+ FREETYPE_INCLUDE_DIRS
+ VERSION_VAR
+ FREETYPE_VERSION_STRING
+)
+
+mark_as_advanced(
+ FREETYPE_LIBRARY
+ FREETYPE_INCLUDE_DIR_freetype2
+ FREETYPE_INCLUDE_DIR_ft2build
+)
diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake
index 4e04c31..bf374f9 100644
--- a/Modules/FindGDAL.cmake
+++ b/Modules/FindGDAL.cmake
@@ -90,9 +90,9 @@ if(UNIX)
exec_program(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS)
if(GDAL_CONFIG_LIBS)
string(REGEX MATCHALL "-l[^ ]+" _gdal_dashl ${GDAL_CONFIG_LIBS})
- string(REGEX REPLACE "-l" "" _gdal_lib "${_gdal_dashl}")
+ string(REPLACE "-l" "" _gdal_lib "${_gdal_dashl}")
string(REGEX MATCHALL "-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_LIBS})
- string(REGEX REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}")
+ string(REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}")
endif()
endif()
endif()
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index 117ded7..7bbb8cf 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -66,6 +66,7 @@ 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 )
diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index 497a80c..f42182f 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -4,6 +4,15 @@
#
# Find the OpenGL Extension Wrangler Library (GLEW)
#
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``,
+# if GLEW has been found.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
# This module defines the following variables:
#
# ::
@@ -35,4 +44,11 @@ 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}")
+endif()
+
mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index be7c0cd..c9f7597 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -2,7 +2,20 @@
# FindGLUT
# --------
#
-# try to find glut library and include files
+# try to find glut library and include files.
+#
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the :prop_tgt:`IMPORTED` targets:
+#
+# ``GLUT::GLUT``
+# Defined if the system has GLUT.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module sets the following variables:
#
# ::
#
@@ -42,13 +55,21 @@ if (WIN32)
else ()
if (APPLE)
- # These values for Apple could probably do with improvement.
- find_path( GLUT_INCLUDE_DIR glut.h
- /System/Library/Frameworks/GLUT.framework/Versions/A/Headers
- ${OPENGL_LIBRARY_DIR}
- )
- set(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX")
- set(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
+ find_path(GLUT_INCLUDE_DIR glut.h ${OPENGL_LIBRARY_DIR})
+ find_library(GLUT_glut_LIBRARY GLUT DOC "GLUT library for OSX")
+ find_library(GLUT_cocoa_LIBRARY Cocoa DOC "Cocoa framework for OSX")
+
+ if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa)
+ add_library(GLUT::Cocoa UNKNOWN IMPORTED)
+ # Cocoa should always be a Framework, but we check to make sure.
+ if(GLUT_cocoa_LIBRARY MATCHES "/([^/]+)\\.framework$")
+ set_target_properties(GLUT::Cocoa PROPERTIES
+ IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}/${CMAKE_MATCH_1}")
+ else()
+ set_target_properties(GLUT::Cocoa PROPERTIES
+ IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}")
+ endif()
+ endif()
else ()
if (BEOS)
@@ -66,6 +87,18 @@ else ()
/usr/openwin/lib
)
+ if(GLUT_Xi_LIBRARY AND NOT TARGET GLUT::Xi)
+ add_library(GLUT::Xi UNKNOWN IMPORTED)
+ set_target_properties(GLUT::Xi PROPERTIES
+ IMPORTED_LOCATION "${GLUT_Xi_LIBRARY}")
+ endif()
+
+ if(GLUT_Xmu_LIBRARY AND NOT TARGET GLUT::Xmu)
+ add_library(GLUT::Xmu UNKNOWN IMPORTED)
+ set_target_properties(GLUT::Xmu PROPERTIES
+ IMPORTED_LOCATION "${GLUT_Xmu_LIBRARY}")
+ endif()
+
endif ()
find_path( GLUT_INCLUDE_DIR GL/glut.h
@@ -102,6 +135,34 @@ if (GLUT_FOUND)
${GLUT_cocoa_LIBRARY}
)
+ if(NOT TARGET GLUT::GLUT)
+ add_library(GLUT::GLUT UNKNOWN IMPORTED)
+ set_target_properties(GLUT::GLUT PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${GLUT_INCLUDE_DIR}")
+ if(GLUT_glut_LIBRARY MATCHES "/([^/]+)\\.framework$")
+ set_target_properties(GLUT::GLUT PROPERTIES
+ IMPORTED_LOCATION "${GLUT_glut_LIBRARY}/${CMAKE_MATCH_1}")
+ else()
+ set_target_properties(GLUT::GLUT PROPERTIES
+ IMPORTED_LOCATION "${GLUT_glut_LIBRARY}")
+ endif()
+
+ if(TARGET GLUT::Xmu)
+ set_property(TARGET GLUT::GLUT APPEND
+ PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xmu)
+ endif()
+
+ if(TARGET GLUT::Xi)
+ set_property(TARGET GLUT::GLUT APPEND
+ PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xi)
+ endif()
+
+ if(TARGET GLUT::Cocoa)
+ set_property(TARGET GLUT::GLUT APPEND
+ PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Cocoa)
+ endif()
+ endif()
+
#The following deprecated settings are for backwards compatibility with CMake1.4
set (GLUT_LIBRARY ${GLUT_LIBRARIES})
set (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index a91da33..72bb8eb 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -267,6 +267,8 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
/usr/local/lib
/usr/lib64
/usr/lib
+ /usr/X11R6/include
+ /usr/X11R6/lib
/opt/gnome/include
/opt/gnome/lib
/opt/openwin/include
@@ -525,7 +527,7 @@ function(_GTK2_ADD_TARGET _var)
set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}")
endif()
- if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "GTK2_${_var}_INCLUDE_DIR")
+ if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK2_${_var}_INCLUDE_DIR}")
set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}")
endif()
@@ -538,7 +540,11 @@ function(_GTK2_ADD_TARGET _var)
endif()
if(_${_var}_OPTIONAL_INCLUDES)
- _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_${_var}_OPTIONAL_INCLUDES})
+ foreach(_D ${_${_var}_OPTIONAL_INCLUDES})
+ if(_D)
+ _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D})
+ endif()
+ endforeach()
endif()
if(GTK2_USE_IMPORTED_TARGETS)
@@ -570,7 +576,6 @@ endif()
# If specified, enforce version number
#
if(GTK2_FIND_VERSION)
- cmake_minimum_required(VERSION 2.6.2)
set(GTK2_FAILED_VERSION_CHECK true)
if(GTK2_DEBUG)
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
@@ -641,6 +646,10 @@ endif()
foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
if(_GTK2_component STREQUAL "gtk")
+ # Left for compatibility with previous versions.
+ _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h)
+ _GTK2_FIND_INCLUDE_DIR(X11 X11/Xlib.h)
+
_GTK2_FIND_INCLUDE_DIR(GLIB glib.h)
_GTK2_FIND_INCLUDE_DIR(GLIBCONFIG glibconfig.h)
_GTK2_FIND_LIBRARY (GLIB glib false true)
@@ -680,11 +689,15 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
_GTK2_FIND_LIBRARY (PANGOFT2 pangoft2 false true)
_GTK2_ADD_TARGET (PANGOFT2 GTK2_DEPENDS pango gobject glib
- OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
_GTK2_FIND_LIBRARY (PANGOXFT pangoxft false true)
_GTK2_ADD_TARGET (PANGOXFT GTK2_DEPENDS pangoft2 pango gobject glib
- OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
_GTK2_FIND_INCLUDE_DIR(GDK gdk/gdk.h)
_GTK2_FIND_INCLUDE_DIR(GDKCONFIG gdkconfig.h)
@@ -715,9 +728,6 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
_GTK2_ADD_TARGET (GTK GTK2_DEPENDS gdk atk pangoft2 pango gdk_pixbuf gthread gobject glib
GTK2_OPTIONAL_DEPENDS gio pangocairo cairo)
- # Left for compatibility with previous versions. It doesn't seem to be required
- _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h)
-
elseif(_GTK2_component STREQUAL "gtkmm")
_GTK2_FIND_INCLUDE_DIR(SIGC++ sigc++/sigc++.h)
@@ -743,29 +753,36 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
_GTK2_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h)
_GTK2_FIND_LIBRARY (CAIROMM cairomm true true)
_GTK2_ADD_TARGET (CAIROMM GTK2_DEPENDS cairo sigc++
- OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
_GTK2_FIND_INCLUDE_DIR(PANGOMM pangomm.h)
_GTK2_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h)
_GTK2_FIND_LIBRARY (PANGOMM pangomm true true)
_GTK2_ADD_TARGET (PANGOMM GTK2_DEPENDS glibmm sigc++ pango gobject glib
GTK2_OPTIONAL_DEPENDS cairomm pangocairo cairo
- OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
-
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
_GTK2_FIND_INCLUDE_DIR(GDKMM gdkmm.h)
_GTK2_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h)
_GTK2_FIND_LIBRARY (GDKMM gdkmm true true)
_GTK2_ADD_TARGET (GDKMM GTK2_DEPENDS pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gobject glib
GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo
- OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
_GTK2_FIND_INCLUDE_DIR(GTKMM gtkmm.h)
_GTK2_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h)
_GTK2_FIND_LIBRARY (GTKMM gtkmm true true)
_GTK2_ADD_TARGET (GTKMM GTK2_DEPENDS atkmm gdkmm pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib
GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo
- OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
elseif(_GTK2_component STREQUAL "glade")
@@ -773,7 +790,9 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
_GTK2_FIND_LIBRARY (GLADE glade false true)
_GTK2_ADD_TARGET (GLADE GTK2_DEPENDS gtk gdk atk gio pangoft2 gdk_pixbuf pango gobject glib
GTK2_OPTIONAL_DEPENDS pangocairo cairo
- OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
elseif(_GTK2_component STREQUAL "glademm")
@@ -782,7 +801,9 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
_GTK2_FIND_LIBRARY (GLADEMM glademm true true)
_GTK2_ADD_TARGET (GLADEMM GTK2_DEPENDS gtkmm glade atkmm gdkmm giomm pangomm glibmm sigc++ gtk gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib
GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo
- OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
else()
message(FATAL_ERROR "Unknown GTK2 component ${_component}")
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index c00a750..e6b5b0a 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -79,7 +79,7 @@
# extra_args = Pass a list of extra arguments to be passed to
# executable enclosed in quotes (or "" for none)
# ARGN = A list of source files to search for tests & test
-# fixtures.
+# fixtures. Or AUTO to find them from executable target.
#
#
#
@@ -88,7 +88,7 @@
# Example:
# set(FooTestArgs --foo 1 --bar 2)
# add_executable(FooTest FooUnitTest.cc)
-# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" FooUnitTest.cc)
+# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" AUTO)
#=============================================================================
# Copyright 2009 Kitware, Inc.
@@ -111,12 +111,30 @@ function(GTEST_ADD_TESTS executable extra_args)
if(NOT ARGN)
message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
endif()
+ if(ARGN STREQUAL "AUTO")
+ # obtain sources used for building that executable
+ get_property(ARGN TARGET ${executable} PROPERTY SOURCES)
+ endif()
+ set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*")
+ set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)")
foreach(source ${ARGN})
file(READ "${source}" contents)
- string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
+ string(REGEX MATCHALL "${gtest_test_type_regex}\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
foreach(hit ${found_tests})
- string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit})
- add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args})
+ string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit})
+
+ # Parameterized tests have a different signature for the filter
+ if(${test_type} STREQUAL "TEST_P")
+ string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit})
+ elseif(${test_type} STREQUAL "TEST_F" OR ${test_type} STREQUAL "TEST")
+ string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit})
+ elseif(${test_type} STREQUAL "TYPED_TEST")
+ string(REGEX REPLACE ${gtest_case_name_regex} "\\1/*.\\2" test_name ${hit})
+ else()
+ message(WARNING "Could not parse GTest ${hit} for adding to CTest.")
+ continue()
+ endif()
+ add_test(NAME ${test_name} COMMAND ${executable} --gtest_filter=${test_name} ${extra_args})
endforeach()
endforeach()
endfunction()
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake
index 0188d2d..16478cb 100644
--- a/Modules/FindGettext.cmake
+++ b/Modules/FindGettext.cmake
@@ -71,8 +71,8 @@ if(GETTEXT_MSGMERGE_EXECUTABLE)
OUTPUT_VARIABLE gettext_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (gettext_version MATCHES "^msgmerge \\(.*\\) [0-9]")
- string(REGEX REPLACE "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" GETTEXT_VERSION_STRING "${gettext_version}")
+ if (gettext_version MATCHES "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
+ set(GETTEXT_VERSION_STRING "${CMAKE_MATCH_1}")
endif()
unset(gettext_version)
endif()
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 2903bf8..0d58e13 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -162,7 +162,7 @@ macro( _HDF5_parse_compile_line
)
foreach( IPATH ${include_path_flags} )
string( REGEX REPLACE "^-I" "" IPATH ${IPATH} )
- string( REGEX REPLACE "//" "/" IPATH ${IPATH} )
+ string( REPLACE "//" "/" IPATH ${IPATH} )
list( APPEND ${include_paths} ${IPATH} )
endforeach()
@@ -179,7 +179,7 @@ macro( _HDF5_parse_compile_line
foreach( LPATH ${library_path_flags} )
string( REGEX REPLACE "^-L" "" LPATH ${LPATH} )
- string( REGEX REPLACE "//" "/" LPATH ${LPATH} )
+ string( REPLACE "//" "/" LPATH ${LPATH} )
list( APPEND ${library_paths} ${LPATH} )
endforeach()
@@ -253,7 +253,7 @@ if( NOT HDF5_FOUND )
list( APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS} )
# find the HDF5 include directories
- if(${LANGUAGE} MATCHES "Fortran.*")
+ if(${LANGUAGE} MATCHES "Fortran")
set(HDF5_INCLUDE_FILENAME hdf5.mod)
else()
set(HDF5_INCLUDE_FILENAME hdf5.h)
diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake
index a1fb33f..c418afd 100644
--- a/Modules/FindHg.cmake
+++ b/Modules/FindHg.cmake
@@ -2,7 +2,7 @@
# FindHg
# ------
#
-#
+# Extract information from a mercurial working copy.
#
# The module defines the following variables:
#
@@ -12,6 +12,20 @@
# HG_FOUND - true if the command line client was found
# HG_VERSION_STRING - the version of mercurial found
#
+# If the command line client executable is found the following macro is defined:
+#
+# ::
+#
+# HG_WC_INFO(<dir> <var-prefix>)
+#
+# Hg_WC_INFO extracts information of a mercurial working copy
+# at a given location. This macro defines the following variables:
+#
+# ::
+#
+# <var-prefix>_WC_CHANGESET - current changeset
+# <var-prefix>_WC_REVISION - current revision
+#
# Example usage:
#
# ::
@@ -19,11 +33,15 @@
# find_package(Hg)
# if(HG_FOUND)
# message("hg found: ${HG_EXECUTABLE}")
+# HG_WC_INFO(${PROJECT_SOURCE_DIR} Project)
+# message("Current revision is ${Project_WC_REVISION}")
+# message("Current changeset is ${Project_WC_CHANGESET}")
# endif()
#=============================================================================
# Copyright 2010-2012 Kitware, Inc.
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
+# Copyright 2014 Matthaeus G. Chajdas
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -37,6 +55,8 @@
find_program(HG_EXECUTABLE
NAMES hg
+ PATHS
+ [HKEY_LOCAL_MACHINE\\Software\\TortoiseHG]
PATH_SUFFIXES Mercurial
DOC "hg command line client"
)
@@ -51,6 +71,21 @@ if(HG_EXECUTABLE)
set(HG_VERSION_STRING "${CMAKE_MATCH_1}")
endif()
unset(hg_version)
+
+ macro(HG_WC_INFO dir prefix)
+ execute_process(COMMAND ${HG_EXECUTABLE} id -i -n
+ WORKING_DIRECTORY ${dir}
+ RESULT_VARIABLE hg_id_result
+ ERROR_VARIABLE hg_id_error
+ OUTPUT_VARIABLE ${prefix}_WC_DATA
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT ${hg_id_result} EQUAL 0)
+ message(SEND_ERROR "Command \"${HG_EXECUTBALE} id -n\" in directory ${dir} failed with output:\n${hg_id_error}")
+ endif()
+
+ string(REGEX REPLACE "([0-9a-f]+)\\+? [0-9]+\\+?" "\\1" ${prefix}_WC_CHANGESET ${${prefix}_WC_DATA})
+ string(REGEX REPLACE "[0-9a-f]+\\+? ([0-9]+)\\+?" "\\1" ${prefix}_WC_REVISION ${${prefix}_WC_DATA})
+ endmacro(HG_WC_INFO)
endif()
# Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if
diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake
new file mode 100644
index 0000000..60a4107
--- /dev/null
+++ b/Modules/FindIce.cmake
@@ -0,0 +1,393 @@
+#.rst:
+# FindIce
+# -------
+#
+# Find the ZeroC Internet Communication Engine (ICE) programs,
+# libraries and datafiles.
+#
+# This module supports multiple components.
+# Components can include any of: ``Freeze``, ``Glacier2``, ``Ice``,
+# ``IceBox``, ``IceDB``, ``IceGrid``, ``IcePatch``, ``IceSSL``,
+# ``IceStorm``, ``IceUtil``, ``IceXML``, or ``Slice``.
+#
+# This module reports information about the Ice installation in
+# several variables. General variables::
+#
+# Ice_VERSION - Ice release version
+# Ice_FOUND - true if the main programs and libraries were found
+# Ice_LIBRARIES - component libraries to be linked
+# Ice_INCLUDE_DIRS - the directories containing the Ice headers
+# Ice_SLICE_DIRS - the directories containing the Ice slice interface
+# definitions
+#
+# Ice programs are reported in::
+#
+# Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable
+# Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable
+# Ice_SLICE2FREEZEJ_EXECUTABLE - path to slice2freezej executable
+# Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable
+# Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable
+# Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable
+# Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable
+# Ice_SLICE2PY_EXECUTABLE - path to slice2py executable
+# Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable
+#
+# Ice component libraries are reported in::
+#
+# Ice_<C>_FOUND - ON if component was found
+# Ice_<C>_LIBRARIES - libraries for component
+#
+# Note that ``<C>`` is the uppercased name of the component.
+#
+# This module reads hints about search results from::
+#
+# Ice_HOME - the root of the Ice installation
+#
+# The environment variable :envvar:`ICE_HOME` may also be used; the
+# Ice_HOME variable takes precedence.
+#
+# The following cache variables may also be set::
+#
+# Ice_<P>_EXECUTABLE - the path to executable <P>
+# Ice_INCLUDE_DIR - the directory containing the Ice headers
+# Ice_SLICE_DIR - the directory containing the Ice slice interface
+# definitions
+# Ice_<C>_LIBRARY - the library for component <C>
+#
+# .. note::
+#
+# In most cases none of the above variables will require setting,
+# unless multiple Ice versions are available and a specific version
+# is required. On Windows, the most recent version of Ice will be
+# found through the registry. On Unix, the programs, headers and
+# libraries will usually be in standard locations, but Ice_SLICE_DIRS
+# might not be automatically detected (commonly known locations are
+# searched). All the other variables are defaulted using Ice_HOME,
+# if set. It's possible to set Ice_HOME and selectively specify
+# alternative locations for the other components; this might be
+# required for e.g. newer versions of Visual Studio if the
+# heuristics are not sufficient to identify the correct programs and
+# libraries for the specific Visual Studio version.
+#
+# Other variables one may set to control this module are::
+#
+# Ice_DEBUG - Set to ON to enable debug output from FindIce.
+
+# Written by Roger Leigh <rleigh@codelibre.net>
+
+#=============================================================================
+# Copyright 2014 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.)
+
+# The Ice checks are contained in a function due to the large number
+# of temporary variables needed.
+function(_Ice_FIND)
+ # Released versions of Ice, including generic short forms
+ set(ice_versions
+ 3
+ 3.5
+ 3.5.1
+ 3.5.0
+ 3.4
+ 3.4.2
+ 3.4.1
+ 3.4.0
+ 3.3
+ 3.3.1
+ 3.3.0)
+
+ # Set up search paths, taking compiler into account. Search Ice_HOME,
+ # with ICE_HOME in the environment as a fallback if unset.
+ if(Ice_HOME)
+ list(APPEND ice_roots "${Ice_HOME}")
+ else()
+ if(NOT "$ENV{ICE_HOME}" STREQUAL "")
+ file(TO_CMAKE_PATH "$ENV{ICE_HOME}" NATIVE_PATH)
+ list(APPEND ice_roots "${NATIVE_PATH}")
+ set(Ice_HOME "${NATIVE_PATH}"
+ CACHE PATH "Location of the Ice installation" FORCE)
+ endif()
+ endif()
+
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ # 64-bit path suffix
+ set(_x64 "/x64")
+ # 64-bit library directory
+ set(_lib64 "lib64")
+ endif()
+
+ if(MSVC_VERSION)
+ # VS 8.0
+ if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500)
+ set(vcver "vc80")
+ set(vcyear "2005")
+ # VS 9.0
+ elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600)
+ set(vcver "vc90")
+ set(vcyear "2008")
+ # VS 10.0
+ elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700)
+ set(vcver "vc100")
+ # VS 11.0
+ elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800)
+ set(vcver "vc110")
+ # VS 12.0
+ elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900)
+ set(vcver "vc120")
+ # VS 14.0
+ elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 2000)
+ set(vcver "vc140")
+ endif()
+ endif()
+
+ # For compatibility with ZeroC Windows builds.
+ if(vcver)
+ # Earlier Ice (3.3) builds don't use vcnnn subdirectories, but are harmless to check.
+ list(APPEND ice_binary_suffixes "bin/${vcver}${_x64}" "bin/${vcver}")
+ list(APPEND ice_library_suffixes "lib/${vcver}${_x64}" "lib/${vcver}")
+ endif()
+ # Generic 64-bit and 32-bit directories
+ list(APPEND ice_binary_suffixes "bin${_x64}" "bin")
+ list(APPEND ice_library_suffixes "${_lib64}" "lib${_x64}" "lib")
+ list(APPEND ice_include_suffixes "include")
+ list(APPEND ice_slice_suffixes "slice")
+
+ # On Windows, look in the registry for install locations. Different
+ # versions of Ice install support different compiler versions.
+ if(vcver)
+ foreach(ice_version ${ice_versions})
+ # Ice 3.3 releases use a Visual Studio year suffix and value is
+ # enclosed in double quotes, though only the leading quote is
+ # returned by get_filename_component.
+ unset(ice_location)
+ if(vcyear)
+ get_filename_component(ice_location
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version} for Visual Studio ${vcyear};InstallDir]"
+ PATH)
+ if(ice_location AND NOT ("${ice_location}" STREQUAL "/registry" OR "${ice_location}" STREQUAL "/"))
+ string(REGEX REPLACE "^\"(.*)\"?$" "\\1" ice_location "${ice_location}")
+ get_filename_component(ice_location "${ice_location}" ABSOLUTE)
+ else()
+ unset(ice_location)
+ endif()
+ endif()
+ # Ice 3.4+ releases don't use a suffix
+ if(NOT ice_location OR "${ice_location}" STREQUAL "/registry")
+ get_filename_component(ice_location
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version};InstallDir]"
+ ABSOLUTE)
+ endif()
+
+ if(ice_location AND NOT "${ice_location}" STREQUAL "/registry")
+ list(APPEND ice_roots "${ice_location}")
+ endif()
+ endforeach()
+ else()
+ foreach(ice_version ${ice_versions})
+ # Prefer 64-bit variants if present (and using a 64-bit compiler)
+ list(APPEND ice_roots "/opt/Ice-${ice_version}")
+ endforeach()
+ endif()
+
+ set(ice_programs
+ slice2cpp
+ slice2cs
+ slice2freezej
+ slice2freeze
+ slice2html
+ slice2java
+ slice2php
+ slice2py
+ slice2rb)
+
+ # Find all Ice programs
+ foreach(program ${ice_programs})
+ string(TOUPPER "${program}" program_upcase)
+ set(cache_var "Ice_${program_upcase}_EXECUTABLE")
+ set(program_var "Ice_${program_upcase}_EXECUTABLE")
+ find_program("${cache_var}" "${program}"
+ HINTS ${ice_roots}
+ PATH_SUFFIXES ${ice_binary_suffixes}
+ DOC "Ice ${program} executable")
+ mark_as_advanced(cache_var)
+ set("${program_var}" "${${cache_var}}" PARENT_SCOPE)
+ endforeach()
+
+ # Get version.
+ if(Ice_SLICE2CPP_EXECUTABLE)
+ # Execute in C locale for safety
+ set(_Ice_SAVED_LC_ALL "$ENV{LC_ALL}")
+ set(ENV{LC_ALL} C)
+
+ execute_process(COMMAND ${Ice_SLICE2CPP_EXECUTABLE} --version
+ ERROR_VARIABLE Ice_VERSION_SLICE2CPP_FULL
+ ERROR_STRIP_TRAILING_WHITESPACE)
+
+ # restore the previous LC_ALL
+ set(ENV{LC_ALL} ${_Ice_SAVED_LC_ALL})
+
+ # Make short version
+ string(REGEX REPLACE "^(.*)\\.[^.]*$" "\\1" Ice_VERSION_SLICE2CPP_SHORT "${Ice_VERSION_SLICE2CPP_FULL}")
+ set(Ice_VERSION "${Ice_VERSION_SLICE2CPP_FULL}" PARENT_SCOPE)
+ endif()
+
+ if(NOT Ice_FIND_QUIETLY)
+ message(STATUS "Ice version: ${Ice_VERSION_SLICE2CPP_FULL}")
+ endif()
+
+ # Find include directory
+ find_path(Ice_INCLUDE_DIR
+ NAMES "Ice/Ice.h"
+ HINTS ${ice_roots}
+ PATH_SUFFIXES ${ice_include_suffixes}
+ DOC "Ice include directory")
+ set(Ice_INCLUDE_DIR "${Ice_INCLUDE_DIR}" PARENT_SCOPE)
+
+ # In common use on Linux, MacOS X (homebrew) and FreeBSD; prefer
+ # version-specific dir
+ list(APPEND ice_slice_paths
+ /usr/local/share /usr/share)
+ list(APPEND ice_slice_suffixes
+ "Ice-${Ice_VERSION_SLICE2CPP_FULL}/slice"
+ "Ice-${Ice_VERSION_SLICE2CPP_SHORT}/slice"
+ Ice)
+
+ # Find slice directory
+ find_path(Ice_SLICE_DIR
+ NAMES "Ice/Connection.ice"
+ HINTS ${ice_roots}
+ ${ice_slice_paths}
+ PATH_SUFFIXES ${ice_slice_suffixes}
+ NO_DEFAULT_PATH
+ DOC "Ice slice directory")
+ set(Ice_SLICE_DIR "${Ice_SLICE_DIR}" PARENT_SCOPE)
+
+ # Find all Ice libraries
+ set(Ice_REQUIRED_LIBS_FOUND ON)
+ foreach(component ${Ice_FIND_COMPONENTS})
+ string(TOUPPER "${component}" component_upcase)
+ set(component_cache "Ice_${component_upcase}_LIBRARY")
+ set(component_found "${component_upcase}_FOUND")
+ find_library("${component_cache}" "${component}"
+ HINTS ${ice_roots}
+ PATH_SUFFIXES ${ice_library_suffixes}
+ DOC "Ice ${component} library")
+ mark_as_advanced("${component_cache}")
+ if("${component_cache}")
+ set("${component_found}" ON)
+ list(APPEND Ice_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 ("Ice_FIND_REQUIRED_${component}")
+ list(APPEND Ice_LIBS_FOUND "${component} (required)")
+ else()
+ list(APPEND Ice_LIBS_FOUND "${component} (optional)")
+ endif()
+ else()
+ if ("Ice_FIND_REQUIRED_${component}")
+ set(Ice_REQUIRED_LIBS_FOUND OFF)
+ list(APPEND Ice_LIBS_NOTFOUND "${component} (required)")
+ else()
+ list(APPEND Ice_LIBS_NOTFOUND "${component} (optional)")
+ endif()
+ endif()
+ endforeach()
+ set(_Ice_REQUIRED_LIBS_FOUND "${Ice_REQUIRED_LIBS_FOUND}" PARENT_SCOPE)
+ set(Ice_LIBRARY "${Ice_LIBRARY}" PARENT_SCOPE)
+
+ if(NOT Ice_FIND_QUIETLY)
+ if(Ice_LIBS_FOUND)
+ message(STATUS "Found the following Ice libraries:")
+ foreach(found ${Ice_LIBS_FOUND})
+ message(STATUS " ${found}")
+ endforeach()
+ endif()
+ if(Ice_LIBS_NOTFOUND)
+ message(STATUS "The following Ice libraries were not found:")
+ foreach(notfound ${Ice_LIBS_NOTFOUND})
+ message(STATUS " ${notfound}")
+ endforeach()
+ endif()
+ endif()
+
+ if(Ice_DEBUG)
+ message(STATUS "--------FindIce.cmake search debug--------")
+ message(STATUS "ICE binary path search order: ${ice_roots}")
+ message(STATUS "ICE include path search order: ${ice_roots}")
+ message(STATUS "ICE slice path search order: ${ice_roots} ${ice_slice_paths}")
+ message(STATUS "ICE library path search order: ${ice_roots}")
+ message(STATUS "----------------")
+ endif()
+endfunction()
+
+_Ice_FIND()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ice
+ FOUND_VAR Ice_FOUND
+ REQUIRED_VARS Ice_SLICE2CPP_EXECUTABLE
+ Ice_INCLUDE_DIR
+ Ice_SLICE_DIR
+ Ice_LIBRARY
+ _Ice_REQUIRED_LIBS_FOUND
+ VERSION_VAR Ice_VERSION
+ FAIL_MESSAGE "Failed to find all Ice components")
+
+unset(_Ice_REQUIRED_LIBS_FOUND)
+
+if(Ice_FOUND)
+ set(Ice_INCLUDE_DIRS "${Ice_INCLUDE_DIR}")
+ set(Ice_SLICE_DIRS "${Ice_SLICE_DIR}")
+ set(Ice_LIBRARIES "${Ice_LIBRARY}")
+ 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_lib "Ice_${_Ice_component_upcase}_LIBRARIES")
+ set(_Ice_component_found "${_Ice_component_upcase}_FOUND")
+ if("${_Ice_component_found}")
+ set("${_Ice_component_lib}" "${${_Ice_component_cache}}")
+ endif()
+ unset(_Ice_component_upcase)
+ unset(_Ice_component_cache)
+ unset(_Ice_component_lib)
+ unset(_Ice_component_found)
+ endforeach()
+endif()
+
+if(Ice_DEBUG)
+ message(STATUS "--------FindIce.cmake results debug--------")
+ message(STATUS "Ice_VERSION number: ${Ice_VERSION}")
+ message(STATUS "Ice_HOME directory: ${Ice_HOME}")
+ message(STATUS "Ice_INCLUDE_DIR directory: ${Ice_INCLUDE_DIR}")
+ message(STATUS "Ice_SLICE_DIR directory: ${Ice_SLICE_DIR}")
+ message(STATUS "Ice_LIBRARIES: ${Ice_LIBRARIES}")
+ message(STATUS "slice2cpp executable: ${Ice_SLICE2CPP_EXECUTABLE}")
+ message(STATUS "slice2cs executable: ${Ice_SLICE2CS_EXECUTABLE}")
+ message(STATUS "slice2freezej executable: ${Ice_SLICE2FREEZEJ_EXECUTABLE}")
+ message(STATUS "slice2freeze executable: ${Ice_SLICE2FREEZE_EXECUTABLE}")
+ message(STATUS "slice2html executable: ${Ice_SLICE2HTML_EXECUTABLE}")
+ message(STATUS "slice2java executable: ${Ice_SLICE2JAVA_EXECUTABLE}")
+ message(STATUS "slice2php executable: ${Ice_SLICE2PHP_EXECUTABLE}")
+ message(STATUS "slice2py executable: ${Ice_SLICE2PY_EXECUTABLE}")
+ message(STATUS "slice2rb executable: ${Ice_SLICE2RB_EXECUTABLE}")
+ foreach(component ${Ice_FIND_COMPONENTS})
+ string(TOUPPER "${component}" component_upcase)
+ set(component_lib "Ice_${component_upcase}_LIBRARIES")
+ set(component_found "${component_upcase}_FOUND")
+ message(STATUS "${component} library found: ${${component_found}}")
+ message(STATUS "${component} library: ${${component_lib}}")
+ endforeach()
+ message(STATUS "----------------")
+endif()
diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake
index e29fe2e..a7c5a64 100644
--- a/Modules/FindIcotool.cmake
+++ b/Modules/FindIcotool.cmake
@@ -37,7 +37,7 @@ if(ICOTOOL_EXECUTABLE)
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
- if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*")
+ if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
set( ICOTOOL_VERSION_STRING
"${CMAKE_MATCH_1}"
)
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 1e7bda5..65458b7 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -95,34 +95,68 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+find_package(PkgConfig QUIET)
+
#---------------------------------------------------------------------
# Helper functions
#---------------------------------------------------------------------
function(FIND_IMAGEMAGICK_API component header)
set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE)
+ pkg_check_modules(PC_${component} QUIET ${component})
+
find_path(ImageMagick_${component}_INCLUDE_DIR
NAMES ${header}
+ HINTS
+ ${PC_${component}_INCLUDEDIR}
+ ${PC_${component}_INCLUDE_DIRS}
+ PATHS
+ ${ImageMagick_INCLUDE_DIRS}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include"
+ PATH_SUFFIXES
+ ImageMagick ImageMagick-6
+ DOC "Path to the ImageMagick arch-independent include dir."
+ )
+ find_path(ImageMagick_${component}_ARCH_INCLUDE_DIR
+ NAMES magick/magick-baseconfig.h
+ HINTS
+ ${PC_${component}_INCLUDEDIR}
+ ${PC_${component}_INCLUDE_DIRS}
PATHS
${ImageMagick_INCLUDE_DIRS}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include"
PATH_SUFFIXES
ImageMagick ImageMagick-6
- DOC "Path to the ImageMagick include dir."
+ DOC "Path to the ImageMagick arch-specific include dir."
)
find_library(ImageMagick_${component}_LIBRARY
NAMES ${ARGN}
+ HINTS
+ ${PC_${component}_LIBDIR}
+ ${PC_${component}_LIB_DIRS}
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib"
DOC "Path to the ImageMagick Magick++ library."
)
+ # old version have only indep dir
if(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY)
set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE)
- list(APPEND ImageMagick_INCLUDE_DIRS
+ # Construct per-component include directories.
+ set(ImageMagick_${component}_INCLUDE_DIRS
${ImageMagick_${component}_INCLUDE_DIR}
)
+ if(ImageMagick_${component}_ARCH_INCLUDE_DIR)
+ list(APPEND ImageMagick_${component}_INCLUDE_DIRS
+ ${ImageMagick_${component}_ARCH_INCLUDE_DIR})
+ endif()
+ list(REMOVE_DUPLICATES ImageMagick_${component}_INCLUDE_DIRS)
+ set(ImageMagick_${component}_INCLUDE_DIRS
+ ${ImageMagick_${component}_INCLUDE_DIRS} PARENT_SCOPE)
+
+ # Add the per-component include directories to the full include dirs.
+ list(APPEND ImageMagick_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIRS})
list(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS)
set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE)
@@ -221,8 +255,8 @@ if(ImageMagick_mogrify_EXECUTABLE)
OUTPUT_VARIABLE imagemagick_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(imagemagick_version MATCHES "^Version: ImageMagick [0-9]")
- string(REGEX REPLACE "^Version: ImageMagick ([-0-9\\.]+).*" "\\1" ImageMagick_VERSION_STRING "${imagemagick_version}")
+ if(imagemagick_version MATCHES "^Version: ImageMagick ([-0-9\\.]+)")
+ set(ImageMagick_VERSION_STRING "${CMAKE_MATCH_1}")
endif()
unset(imagemagick_version)
endif()
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 6a496af..3dcb0d0 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -55,7 +55,7 @@ macro(java_append_library_directories _var)
# endianess of the underlying system.
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
- set(_java_libarch "ppc64le")
+ set(_java_libarch "ppc64" "ppc64le")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
set(_java_libarch "ppc64" "ppc")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index 90e4485..86bb6e5 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -33,7 +33,7 @@
find_path(JPEG_INCLUDE_DIR jpeglib.h)
-set(JPEG_NAMES ${JPEG_NAMES} jpeg)
+set(JPEG_NAMES ${JPEG_NAMES} jpeg libjpeg)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index a488c46..0bd7eb0 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -128,18 +128,15 @@ if(Java_JAVA_EXECUTABLE)
# 3. GCJ 1.5
# 4. Kaffe 1.4.2
# 5. OpenJDK 1.7.x on OpenBSD
- if(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*")
+ if(var MATCHES "java version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\"")
# This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
- string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*"
- "\\1" Java_VERSION_STRING "${var}" )
- elseif(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*")
+ set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
+ elseif(var MATCHES "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+)\"")
# Kaffe style
- string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*"
- "\\1" Java_VERSION_STRING "${var}" )
- elseif(var MATCHES "openjdk version \"[0-9]+\\.[0-9]+\\.[0-9_]+\".*")
+ set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
+ elseif(var MATCHES "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+)\"")
# OpenJDK ver 1.7.x on OpenBSD
- string( REGEX REPLACE "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+).*"
- "\\1" Java_VERSION_STRING "${var}" )
+ set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
else()
if(NOT Java_FIND_QUIETLY)
message(WARNING "regex not supported: ${var}. Please report")
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake
index 159e29c..ea898a6 100644
--- a/Modules/FindKDE3.cmake
+++ b/Modules/FindKDE3.cmake
@@ -192,7 +192,7 @@ if(KDECONFIG_EXECUTABLE)
if ("${kde_version}" MATCHES "KDE: 3\\.")
execute_process(COMMAND ${KDECONFIG_EXECUTABLE} --prefix
OUTPUT_VARIABLE kdedir )
- string(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}")
+ string(REPLACE "\n" "" KDE3PREFIX "${kdedir}")
endif ()
endif()
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 69da4cd..b11edc3 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -54,6 +54,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
else ()
include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
endif ()
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+
+cmake_push_check_state()
+set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY})
set(LAPACK_FOUND FALSE)
set(LAPACK95_FOUND FALSE)
@@ -155,7 +159,7 @@ endif()
if(BLAS_FOUND)
set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
- if ($ENV{BLA_VENDOR} MATCHES ".+")
+ if (NOT $ENV{BLA_VENDOR} STREQUAL "")
set(BLA_VENDOR $ENV{BLA_VENDOR})
else ()
if(NOT BLA_VENDOR)
@@ -179,7 +183,7 @@ endif ()
#acml lapack
- if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
+ if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
if (BLAS_LIBRARIES MATCHES ".+acml.+")
set (LAPACK_LIBRARIES ${BLAS_LIBRARIES})
endif ()
@@ -229,7 +233,7 @@ if (BLA_VENDOR STREQUAL "Generic" OR
endif ()
endif ()
#intel lapack
-if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
if (NOT WIN32)
set(LM "-lm")
endif ()
@@ -347,4 +351,5 @@ else()
endif()
endif()
+cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake
index be01594..742b851 100644
--- a/Modules/FindLibLZMA.cmake
+++ b/Modules/FindLibLZMA.cmake
@@ -55,9 +55,12 @@ endif()
# Avoid using old codebase
if (LIBLZMA_LIBRARY)
include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+ set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+ set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY})
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER)
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER)
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET)
+ set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
endif ()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index c8d46ba..3be5e3c 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -330,7 +330,7 @@ function (interrogate_mpi_compiler lang try_libs)
string(REGEX MATCHALL "(^| )-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH})
- string(REGEX REPLACE "//" "/" IPATH ${IPATH})
+ string(REPLACE "//" "/" IPATH ${IPATH})
list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
endforeach()
@@ -354,7 +354,7 @@ function (interrogate_mpi_compiler lang try_libs)
set(MPI_LINK_PATH)
foreach(LPATH ${MPI_ALL_LINK_PATHS})
string(REGEX REPLACE "^(| |-Wl,)-L" "" LPATH ${LPATH})
- string(REGEX REPLACE "//" "/" LPATH ${LPATH})
+ string(REPLACE "//" "/" LPATH ${LPATH})
list(APPEND MPI_LINK_PATH ${LPATH})
endforeach()
@@ -378,19 +378,14 @@ function (interrogate_mpi_compiler lang try_libs)
# Extract the set of libraries to link against from the link command
# line
string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+
# add the compiler implicit directories because some compilers
# such as the intel compiler have libraries that show up
# in the showme list that can only be found in the implicit
- # link directories of the compiler. Do this for C++ and C
- # compilers if the implicit link directories are defined.
- if (DEFINED CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES)
- set(MPI_LINK_PATH
- "${MPI_LINK_PATH};${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}")
- endif ()
-
- if (DEFINED CMAKE_C_IMPLICIT_LINK_DIRECTORIES)
+ # link directories of the compiler.
+ if (DEFINED CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES)
set(MPI_LINK_PATH
- "${MPI_LINK_PATH};${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+ "${MPI_LINK_PATH};${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}")
endif ()
# Determine full path names for all of the libraries that one needs
@@ -527,6 +522,7 @@ endfunction()
# Most mpi distros have some form of mpiexec which gives us something we can reliably look for.
find_program(MPIEXEC
NAMES ${_MPI_EXEC_NAMES}
+ HINTS ${MPI_HOME} $ENV{MPI_HOME}
PATHS ${_MPI_PREFIX_PATH}
PATH_SUFFIXES bin
DOC "Executable for running MPI programs.")
@@ -589,7 +585,9 @@ foreach (lang C CXX Fortran)
find_program(MPI_${lang}_COMPILER
NAMES ${_MPI_${lang}_COMPILER_NAMES}
- PATHS "${MPI_HOME}/bin" "$ENV{MPI_HOME}/bin" ${_MPI_PREFIX_PATH})
+ HINTS ${_MPI_BASE_DIR}/bin
+ PATHS ${_MPI_PREFIX_PATH}
+ )
interrogate_mpi_compiler(${lang} ${try_libs})
mark_as_advanced(MPI_${lang}_COMPILER)
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
new file mode 100644
index 0000000..4d3ed84
--- /dev/null
+++ b/Modules/FindOpenCL.cmake
@@ -0,0 +1,136 @@
+#.rst:
+# FindOpenCL
+# ----------
+#
+# Try to find OpenCL
+#
+# Once done this will define::
+#
+# OpenCL_FOUND - True if OpenCL was found
+# OpenCL_INCLUDE_DIRS - include directories for OpenCL
+# OpenCL_LIBRARIES - link against this library to use OpenCL
+# OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
+# OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation
+# OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation
+#
+# The module will also define two cache variables::
+#
+# OpenCL_INCLUDE_DIR - the OpenCL include directory
+# OpenCL_LIBRARY - the path to the OpenCL library
+#
+
+#=============================================================================
+# Copyright 2014 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.)
+
+function(_FIND_OPENCL_VERSION)
+ include(CheckSymbolExists)
+ include(CMakePushCheckState)
+ set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY})
+
+ CMAKE_PUSH_CHECK_STATE()
+ foreach(VERSION "2_0" "1_2" "1_1" "1_0")
+ set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}")
+
+ if(APPLE)
+ CHECK_SYMBOL_EXISTS(
+ CL_VERSION_${VERSION}
+ "${OpenCL_INCLUDE_DIR}/OpenCL/cl.h"
+ OPENCL_VERSION_${VERSION})
+ else()
+ CHECK_SYMBOL_EXISTS(
+ CL_VERSION_${VERSION}
+ "${OpenCL_INCLUDE_DIR}/CL/cl.h"
+ OPENCL_VERSION_${VERSION})
+ endif()
+
+ if(OPENCL_VERSION_${VERSION})
+ string(REPLACE "_" "." VERSION "${VERSION}")
+ set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE)
+ string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}")
+ list(GET version_components 0 major_version)
+ list(GET version_components 1 minor_version)
+ set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE)
+ set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE)
+ break()
+ endif()
+ endforeach()
+ CMAKE_POP_CHECK_STATE()
+endfunction()
+
+find_path(OpenCL_INCLUDE_DIR
+ NAMES
+ CL/cl.h OpenCL/cl.h
+ PATHS
+ ENV "PROGRAMFILES(X86)"
+ ENV AMDAPPSDKROOT
+ ENV INTELOCLSDKROOT
+ ENV NVSDKCOMPUTE_ROOT
+ ENV CUDA_PATH
+ ENV ATISTREAMSDKROOT
+ PATH_SUFFIXES
+ include
+ OpenCL/common/inc
+ "AMD APP/include")
+
+_FIND_OPENCL_VERSION()
+
+if(WIN32)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ find_library(OpenCL_LIBRARY
+ NAMES OpenCL
+ PATHS
+ ENV "PROGRAMFILES(X86)"
+ ENV AMDAPPSDKROOT
+ ENV INTELOCLSDKROOT
+ ENV CUDA_PATH
+ ENV NVSDKCOMPUTE_ROOT
+ ENV ATISTREAMSDKROOT
+ PATH_SUFFIXES
+ "AMD APP/lib/x86"
+ lib/x86
+ lib/Win32
+ OpenCL/common/lib/Win32)
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ find_library(OpenCL_LIBRARY
+ NAMES OpenCL
+ PATHS
+ ENV "PROGRAMFILES(X86)"
+ ENV AMDAPPSDKROOT
+ ENV INTELOCLSDKROOT
+ ENV CUDA_PATH
+ ENV NVSDKCOMPUTE_ROOT
+ ENV ATISTREAMSDKROOT
+ PATH_SUFFIXES
+ "AMD APP/lib/x86_64"
+ lib/x86_64
+ lib/x64
+ OpenCL/common/lib/x64)
+ endif()
+else()
+ find_library(OpenCL_LIBRARY
+ NAMES OpenCL)
+endif()
+
+set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
+set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR})
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(
+ OpenCL
+ FOUND_VAR OpenCL_FOUND
+ REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR
+ VERSION_VAR OpenCL_VERSION_STRING)
+
+mark_as_advanced(
+ OpenCL_INCLUDE_DIR
+ OpenCL_LIBRARY)
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 21c2198..2b3bd14 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -2,32 +2,48 @@
# FindOpenGL
# ----------
#
-# Try to find OpenGL
+# FindModule for OpenGL and GLU.
#
-# Once done this will define
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
#
-# ::
+# This module defines the :prop_tgt:`IMPORTED` targets:
#
-# OPENGL_FOUND - system has OpenGL
-# OPENGL_XMESA_FOUND - system has XMESA
-# OPENGL_GLU_FOUND - system has GLU
-# OPENGL_INCLUDE_DIR - the GL include directory
-# OPENGL_LIBRARIES - Link these to use OpenGL and GLU
+# ``OpenGL::GL``
+# Defined if the system has OpenGL.
+# ``OpenGL::GLU``
+# Defined if the system has GLU.
#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
#
+# This module sets the following variables:
#
-# If you want to use just GL you can use these values
+# ``OPENGL_FOUND``
+# True, if the system has OpenGL.
+# ``OPENGL_XMESA_FOUND``
+# True, if the system has XMESA.
+# ``OPENGL_GLU_FOUND``
+# True, if the system has GLU.
+# ``OPENGL_INCLUDE_DIR``
+# Path to the OpenGL include directory.
+# ``OPENGL_LIBRARIES``
+# Paths to the OpenGL and GLU libraries.
#
-# ::
+# If you want to use just GL you can use these values:
#
-# OPENGL_gl_LIBRARY - Path to OpenGL Library
-# OPENGL_glu_LIBRARY - Path to GLU Library
+# ``OPENGL_gl_LIBRARY``
+# Path to the OpenGL library.
+# ``OPENGL_glu_LIBRARY``
+# Path to the GLU library.
#
+# OSX Specific
+# ^^^^^^^^^^^^
#
-#
-# On OSX default to using the framework version of opengl People will
+# On OSX default to using the framework version of OpenGL. People will
# have to change the cache values of OPENGL_glu_LIBRARY and
-# OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX
+# OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX.
+
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -175,6 +191,36 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS})
unset(_OpenGL_REQUIRED_VARS)
+# OpenGL:: targets
+if(OPENGL_FOUND)
+ if(NOT TARGET OpenGL::GL)
+ add_library(OpenGL::GL UNKNOWN IMPORTED)
+ set_target_properties(OpenGL::GL PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}")
+ if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$")
+ set_target_properties(OpenGL::GL PROPERTIES
+ IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}")
+ else()
+ set_target_properties(OpenGL::GL PROPERTIES
+ IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}")
+ endif()
+ endif()
+
+ if(OPENGL_GLU_FOUND AND NOT TARGET OpenGL::GLU)
+ add_library(OpenGL::GLU UNKNOWN IMPORTED)
+ set_target_properties(OpenGL::GLU PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
+ INTERFACE_LINK_LIBRARIES OpenGL::GL)
+ if(OPENGL_glu_LIBRARY MATCHES "/([^/]+)\\.framework$")
+ set_target_properties(OpenGL::GLU PROPERTIES
+ IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}")
+ else()
+ set_target_properties(OpenGL::GLU PROPERTIES
+ IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}")
+ endif()
+ endif()
+endif()
+
mark_as_advanced(
OPENGL_INCLUDE_DIR
OPENGL_xmesa_INCLUDE_DIR
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index fead4a6..801b4f8 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -16,6 +16,7 @@
#
# 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
#
#
@@ -27,6 +28,7 @@
# Copyright 2009 Kitware, Inc.
# Copyright 2008-2009 André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no>
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
+# Copyright 2014 Nicolas Bock <nicolasbock@gmail.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -39,6 +41,8 @@
# License text for the above reference.)
set(_OPENMP_REQUIRED_VARS)
+set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+set(CMAKE_REQUIRED_QUIET ${OpenMP_FIND_QUIETLY})
function(_OPENMP_FLAG_CANDIDATES LANG)
set(OpenMP_FLAG_CANDIDATES
@@ -66,8 +70,11 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
set(OMP_FLAG_HP "+Oopenmp")
if(WIN32)
set(OMP_FLAG_Intel "-Qopenmp")
- else()
+ elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "Intel" AND
+ "${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528")
set(OMP_FLAG_Intel "-openmp")
+ else()
+ set(OMP_FLAG_Intel "-qopenmp")
endif()
set(OMP_FLAG_MIPSpro "-mp")
set(OMP_FLAG_MSVC "/openmp")
@@ -101,6 +108,17 @@ int main() {
}
")
+# same in Fortran
+set(OpenMP_Fortran_TEST_SOURCE
+ "
+program test
+use omp_lib
+integer :: n
+n = omp_get_num_threads()
+end program test
+ "
+ )
+
# check c compiler
if(CMAKE_C_COMPILER_LOADED)
# if these are set then do not try to find them again,
@@ -116,7 +134,9 @@ if(CMAKE_C_COMPILER_LOADED)
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
unset(OpenMP_FLAG_DETECTED CACHE)
- message(STATUS "Try OpenMP C flag = [${FLAG}]")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Try OpenMP C flag = [${FLAG}]")
+ endif()
check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
if(OpenMP_FLAG_DETECTED)
@@ -150,7 +170,9 @@ if(CMAKE_CXX_COMPILER_LOADED)
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
unset(OpenMP_FLAG_DETECTED CACHE)
- message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
+ endif()
check_cxx_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
if(OpenMP_FLAG_DETECTED)
@@ -167,6 +189,42 @@ if(CMAKE_CXX_COMPILER_LOADED)
unset(OpenMP_CXX_TEST_SOURCE)
endif()
+# check Fortran compiler
+if(CMAKE_Fortran_COMPILER_LOADED)
+ # if these are set then do not try to find them again,
+ # by avoiding any try_compiles for the flags
+ if(OpenMP_Fortran_FLAGS)
+ unset(OpenMP_Fortran_FLAG_CANDIDATES)
+ else()
+ _OPENMP_FLAG_CANDIDATES("Fortran")
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranSourceCompiles.cmake)
+ endif()
+
+ foreach(FLAG IN LISTS OpenMP_Fortran_FLAG_CANDIDATES)
+ set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+ set(CMAKE_REQUIRED_FLAGS "${FLAG}")
+ unset(OpenMP_FLAG_DETECTED CACHE)
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Try OpenMP Fortran flag = [${FLAG}]")
+ endif()
+ check_fortran_source_compiles("${OpenMP_Fortran_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
+ set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+ if(OpenMP_FLAG_DETECTED)
+ set(OpenMP_Fortran_FLAGS_INTERNAL "${FLAG}")
+ break()
+ endif()
+ endforeach()
+
+ set(OpenMP_Fortran_FLAGS "${OpenMP_Fortran_FLAGS_INTERNAL}"
+ CACHE STRING "Fortran compiler flags for OpenMP parallization")
+
+ list(APPEND _OPENMP_REQUIRED_VARS OpenMP_Fortran_FLAGS)
+ unset(OpenMP_Fortran_FLAG_CANDIDATES)
+ unset(OpenMP_Fortran_TEST_SOURCE)
+endif()
+
+set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
+
if(_OPENMP_REQUIRED_VARS)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 7bbd753..68adff7 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -203,8 +203,11 @@ foreach(_osg_module ${_osg_modules_to_process})
find_package(${_osg_module} ${_osg_quiet})
string(TOUPPER ${_osg_module} _osg_module_UC)
- list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR})
- list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES})
+ # append to list if module was found OR is required
+ if( ${_osg_module_UC}_FOUND OR OpenSceneGraph_FIND_REQUIRED )
+ list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR})
+ list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES})
+ endif()
if(OpenSceneGraph_MARK_AS_ADVANCED)
OSG_MARK_AS_ADVANCED(${_osg_module})
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index 873c3de..fa04bf0 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -56,10 +56,8 @@ if(ZLIB_FOUND)
list(APPEND PNG_NAMES png libpng)
unset(PNG_NAMES_DEBUG)
set(_PNG_VERSION_SUFFIXES 17 16 15 14 12)
- if (PNG_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\..*)?$")
- string(REGEX REPLACE
- "^([0-9]+)\\.([0-9]+).*" "\\1\\2"
- _PNG_VERSION_SUFFIX_MIN "${PNG_FIND_VERSION}")
+ if (PNG_FIND_VERSION MATCHES "^([0-9]+)\\.([0-9]+)(\\..*)?$")
+ set(_PNG_VERSION_SUFFIX_MIN "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
if (PNG_FIND_VERSION_EXACT)
set(_PNG_VERSION_SUFFIXES ${_PNG_VERSION_SUFFIX_MIN})
else ()
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index d030418..e8d1dfb 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -201,7 +201,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# now that we collected all arguments, process them
- if("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
+ if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG")
set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
endif()
diff --git a/Modules/FindPackageMessage.cmake b/Modules/FindPackageMessage.cmake
index b6a58e4..a0349d3 100644
--- a/Modules/FindPackageMessage.cmake
+++ b/Modules/FindPackageMessage.cmake
@@ -42,7 +42,7 @@
function(FIND_PACKAGE_MESSAGE pkg msg details)
# Avoid printing a message repeatedly for the same find result.
if(NOT ${pkg}_FIND_QUIETLY)
- string(REGEX REPLACE "[\n]" "" details "${details}")
+ string(REPLACE "\n" "" details "${details}")
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
# The message has not yet been printed.
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake
index 3fd5d8e..70284b6 100644
--- a/Modules/FindPerl.cmake
+++ b/Modules/FindPerl.cmake
@@ -70,9 +70,9 @@ if(PERL_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]")
- string(REGEX REPLACE ".*This is perl.*[ \\(]v([0-9\\._]+)[ \\)].*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE})
+ set(PERL_VERSION_STRING "${CMAKE_MATCH_1}")
elseif(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +")
- string(REGEX REPLACE ".*This is perl, version ([0-9\\._]+) +.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE})
+ set(PERL_VERSION_STRING "${CMAKE_MATCH_1}")
endif()
endif()
endif()
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index e6fdefe..d728324 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -2,140 +2,20 @@
# FindPkgConfig
# -------------
#
-# a pkg-config module for CMake
+# A `pkg-config` module for CMake.
#
+# Finds the ``pkg-config`` executable and add the
+# :command:`pkg_check_modules` and :command:`pkg_search_module`
+# commands.
#
-#
-# Usage:
-#
-# ::
-#
-# pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
-# checks for all the given modules
-#
-#
-#
-# ::
-#
-# pkg_search_module(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
-# checks for given modules and uses the first working one
-#
-#
-#
-# When the 'REQUIRED' argument was set, macros will fail with an error
-# when module(s) could not be found
-#
-# When the 'QUIET' argument is set, no status messages will be printed.
-#
-# It sets the following variables:
-#
-# ::
-#
-# PKG_CONFIG_FOUND ... if pkg-config executable was found
-# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
-# PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
-# (since CMake 2.8.8)
-#
-#
-#
-# For the following variables two sets of values exist; first one is the
-# common one and has the given PREFIX. The second set contains flags
-# which are given out when pkgconfig was called with the '--static'
-# option.
-#
-# ::
-#
-# <XPREFIX>_FOUND ... set to 1 if module(s) exist
-# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
-# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
-# <XPREFIX>_LDFLAGS ... all required linker flags
-# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
-# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
-# <XPREFIX>_CFLAGS ... all required cflags
-# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
-#
-#
-#
-# ::
-#
-# <XPREFIX> = <PREFIX> for common case
-# <XPREFIX> = <PREFIX>_STATIC for static linking
-#
-#
-#
-# There are some special variables whose prefix depends on the count of
-# given modules. When there is only one module, <PREFIX> stays
-# unchanged. When there are multiple modules, the prefix will be
-# changed to <PREFIX>_<MODNAME>:
-#
-# ::
-#
-# <XPREFIX>_VERSION ... version of the module
-# <XPREFIX>_PREFIX ... prefix-directory of the module
-# <XPREFIX>_INCLUDEDIR ... include-dir of the module
-# <XPREFIX>_LIBDIR ... lib-dir of the module
-#
-#
-#
-# ::
-#
-# <XPREFIX> = <PREFIX> when |MODULES| == 1, else
-# <XPREFIX> = <PREFIX>_<MODNAME>
-#
-#
-#
-# A <MODULE> parameter can have the following formats:
-#
-# ::
-#
-# {MODNAME} ... matches any version
-# {MODNAME}>={VERSION} ... at least version <VERSION> is required
-# {MODNAME}={VERSION} ... exactly version <VERSION> is required
-# {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
-#
-#
-#
-# Examples
-#
-# ::
-#
-# pkg_check_modules (GLIB2 glib-2.0)
-#
-#
-#
-# ::
-#
-# pkg_check_modules (GLIB2 glib-2.0>=2.10)
-# requires at least version 2.10 of glib2 and defines e.g.
-# GLIB2_VERSION=2.10.3
-#
-#
-#
-# ::
-#
-# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
-# requires both glib2 and gtk2, and defines e.g.
-# FOO_glib-2.0_VERSION=2.10.3
-# FOO_gtk+-2.0_VERSION=2.8.20
-#
-#
-#
-# ::
-#
-# pkg_check_modules (XRENDER REQUIRED xrender)
-# defines e.g.:
-# XRENDER_LIBRARIES=Xrender;X11
-# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
-#
-#
-#
-# ::
-#
-# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
+# In order to find the ``pkg-config`` executable, it uses the
+# :variable:`PKG_CONFIG_EXECUTABLE` variable or the ``PKG_CONFIG``
+# environment variable first.
#=============================================================================
-# Copyright 2006-2009 Kitware, Inc.
-# Copyright 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+# Copyright 2006-2014 Kitware, Inc.
+# Copyright 2014 Christoph Grüninger <foss@grueninger.de>
+# Copyright 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -150,6 +30,10 @@
### Common stuff ####
set(PKG_CONFIG_VERSION 1)
+# find pkg-config, use PKG_CONFIG if set
+if((NOT PKG_CONFIG_EXECUTABLE) AND (NOT "$ENV{PKG_CONFIG}" STREQUAL ""))
+ set(PKG_CONFIG_EXECUTABLE "$ENV{PKG_CONFIG}" CACHE FILEPATH "pkg-config executable")
+endif()
find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
mark_as_advanced(PKG_CONFIG_EXECUTABLE)
@@ -215,9 +99,20 @@ macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
endmacro()
# Splits given arguments into options and a package list
-macro(_pkgconfig_parse_options _result _is_req _is_silent)
+macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cmake_environment_path)
set(${_is_req} 0)
set(${_is_silent} 0)
+ set(${_no_cmake_path} 0)
+ set(${_no_cmake_environment_path} 0)
+ if(DEFINED PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
+ if(NOT PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
+ set(${_no_cmake_path} 1)
+ set(${_no_cmake_environment_path} 1)
+ endif()
+ elseif(${CMAKE_MINIMUM_REQUIRED_VERSION} VERSION_LESS 3.1)
+ set(${_no_cmake_path} 1)
+ set(${_no_cmake_environment_path} 1)
+ endif()
foreach(_pkg ${ARGN})
if (_pkg STREQUAL "REQUIRED")
@@ -226,15 +121,48 @@ macro(_pkgconfig_parse_options _result _is_req _is_silent)
if (_pkg STREQUAL "QUIET")
set(${_is_silent} 1)
endif ()
+ if (_pkg STREQUAL "NO_CMAKE_PATH")
+ set(${_no_cmake_path} 1)
+ endif()
+ if (_pkg STREQUAL "NO_CMAKE_ENVIRONMENT_PATH")
+ set(${_no_cmake_environment_path} 1)
+ endif()
endforeach()
set(${_result} ${ARGN})
list(REMOVE_ITEM ${_result} "REQUIRED")
list(REMOVE_ITEM ${_result} "QUIET")
+ list(REMOVE_ITEM ${_result} "NO_CMAKE_PATH")
+ list(REMOVE_ITEM ${_result} "NO_CMAKE_ENVIRONMENT_PATH")
endmacro()
+# Add the content of a variable or an environment variable to a list of
+# paths
+# Usage:
+# - _pkgconfig_add_extra_path(_extra_paths VAR)
+# - _pkgconfig_add_extra_path(_extra_paths ENV VAR)
+function(_pkgconfig_add_extra_path _extra_paths_var _var)
+ set(_is_env 0)
+ if(_var STREQUAL "ENV")
+ set(_var ${ARGV2})
+ set(_is_env 1)
+ endif()
+ if(NOT _is_env)
+ if(NOT "${${_var}}" STREQUAL "")
+ list(APPEND ${_extra_paths_var} ${CMAKE_PREFIX_PATH})
+ endif()
+ else()
+ if(NOT "$ENV{${_var}}" STREQUAL "")
+ file(TO_CMAKE_PATH "$ENV{${_var}}" _path)
+ list(APPEND ${_extra_paths_var} ${_path})
+ unset(_path)
+ endif()
+ endif()
+ set(${_extra_paths_var} ${${_extra_paths_var}} PARENT_SCOPE)
+endfunction()
+
###
-macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
+macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _prefix)
_pkgconfig_unset(${_prefix}_FOUND)
_pkgconfig_unset(${_prefix}_VERSION)
_pkgconfig_unset(${_prefix}_PREFIX)
@@ -273,15 +201,86 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
set(_pkg_check_modules_packages)
set(_pkg_check_modules_failed)
+ set(_extra_paths)
+
+ if(NOT _no_cmake_path)
+ _pkgconfig_add_extra_path(_extra_paths CMAKE_PREFIX_PATH)
+ _pkgconfig_add_extra_path(_extra_paths CMAKE_FRAMEWORK_PATH)
+ _pkgconfig_add_extra_path(_extra_paths CMAKE_APPBUNDLE_PATH)
+ endif()
+
+ if(NOT _no_cmake_environment_path)
+ _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_PREFIX_PATH)
+ _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_FRAMEWORK_PATH)
+ _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_APPBUNDLE_PATH)
+ endif()
+
+ if(NOT "${_extra_paths}" STREQUAL "")
+ # Save the PKG_CONFIG_PATH environment variable, and add paths
+ # from the CMAKE_PREFIX_PATH variables
+ set(_pkgconfig_path_old $ENV{PKG_CONFIG_PATH})
+ set(_pkgconfig_path ${_pkgconfig_path_old})
+ if(NOT "${_pkgconfig_path}" STREQUAL "")
+ file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+ endif()
+
+ # Create a list of the possible pkgconfig subfolder (depending on
+ # the system
+ set(_lib_dirs)
+ if(NOT DEFINED CMAKE_SYSTEM_NAME
+ OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
+ AND NOT CMAKE_CROSSCOMPILING))
+ if(EXISTS "/etc/debian_version") # is this a debian system ?
+ if(CMAKE_LIBRARY_ARCHITECTURE)
+ list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
+ endif()
+ else()
+ # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property
+ get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+ if(uselib64)
+ list(APPEND _lib_dirs "lib64/pkgconfig")
+ endif()
+ endif()
+ endif()
+ list(APPEND _lib_dirs "lib/pkgconfig")
+
+ # Check if directories exist and eventually append them to the
+ # pkgconfig path list
+ foreach(_prefix_dir ${_extra_paths})
+ foreach(_lib_dir ${_lib_dirs})
+ if(EXISTS "${_prefix_dir}/${_lib_dir}")
+ list(APPEND _pkgconfig_path "${_prefix_dir}/${_lib_dir}")
+ list(REMOVE_DUPLICATES _pkgconfig_path)
+ endif()
+ endforeach()
+ endforeach()
+
+ # Prepare and set the environment variable
+ if(NOT "${_pkgconfig_path}" STREQUAL "")
+ # remove empty values from the list
+ list(REMOVE_ITEM _pkgconfig_path "")
+ file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+ if(UNIX)
+ string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}")
+ string(REPLACE "\\ " " " _pkgconfig_path "${_pkgconfig_path}")
+ endif()
+ set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path})
+ endif()
+
+ # Unset variables
+ unset(_lib_dirs)
+ unset(_pkgconfig_path)
+ endif()
+
# iterate through module list and check whether they exist and match the required version
foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
set(_pkg_check_modules_exist_query)
# check whether version is given
- if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
- string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
- string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}")
- string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}")
+ if (_pkg_check_modules_pkg MATCHES "(.*[^><])(>=|=|<=)(.*)")
+ set(_pkg_check_modules_pkg_name "${CMAKE_MATCH_1}")
+ set(_pkg_check_modules_pkg_op "${CMAKE_MATCH_2}")
+ set(_pkg_check_modules_pkg_ver "${CMAKE_MATCH_3}")
else()
set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
set(_pkg_check_modules_pkg_op)
@@ -338,7 +337,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
if(_pkg_check_modules_failed)
# fail when requested
if (${_is_required})
- message(SEND_ERROR "A required package was not found")
+ message(FATAL_ERROR "A required package was not found")
endif ()
else()
# when we are here, we checked whether requested modules
@@ -376,6 +375,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
endif()
+
+ if(NOT "${_extra_paths}" STREQUAL "")
+ # Restore the environment variable
+ set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path})
+ endif()
+
+ unset(_extra_paths)
+ unset(_pkgconfig_path_old)
else()
if (${_is_required})
message(SEND_ERROR "pkg-config tool not found")
@@ -387,23 +394,138 @@ endmacro()
### User visible macros start here
###
-###
+#[========================================[.rst:
+.. command:: pkg_check_modules
+
+ Checks for all the given modules. ::
+
+ pkg_check_modules(<PREFIX> [REQUIRED] [QUIET]
+ [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
+ <MODULE> [<MODULE>]*)
+
+
+ When the ``REQUIRED`` argument was set, macros will fail with an error
+ when module(s) could not be found.
+
+ When the ``QUIET`` argument is set, no status messages will be printed.
+
+ By default, if :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or
+ later, or if :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` is set, the
+ :variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_FRAMEWORK_PATH`, and
+ :variable:`CMAKE_APPBUNDLE_PATH` cache and environment variables will
+ be added to ``pkg-config`` search path.
+ The ``NO_CMAKE_PATH`` and ``NO_CMAKE_ENVIRONMENT_PATH`` arguments
+ disable this behavior for the cache variables and the environment
+ variables, respectively.
+
+ It sets the following variables: ::
+
+ PKG_CONFIG_FOUND ... if pkg-config executable was found
+ PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
+ PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
+ (since CMake 2.8.8)
+
+ For the following variables two sets of values exist; first one is the
+ common one and has the given PREFIX. The second set contains flags
+ which are given out when ``pkg-config`` was called with the ``--static``
+ option. ::
+
+ <XPREFIX>_FOUND ... set to 1 if module(s) exist
+ <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
+ <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
+ <XPREFIX>_LDFLAGS ... all required linker flags
+ <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
+ <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
+ <XPREFIX>_CFLAGS ... all required cflags
+ <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
+
+ ::
+
+ <XPREFIX> = <PREFIX> for common case
+ <XPREFIX> = <PREFIX>_STATIC for static linking
+
+ There are some special variables whose prefix depends on the count of
+ given modules. When there is only one module, <PREFIX> stays
+ unchanged. When there are multiple modules, the prefix will be
+ changed to <PREFIX>_<MODNAME>: ::
+
+ <XPREFIX>_VERSION ... version of the module
+ <XPREFIX>_PREFIX ... prefix-directory of the module
+ <XPREFIX>_INCLUDEDIR ... include-dir of the module
+ <XPREFIX>_LIBDIR ... lib-dir of the module
+
+ ::
+
+ <XPREFIX> = <PREFIX> when |MODULES| == 1, else
+ <XPREFIX> = <PREFIX>_<MODNAME>
+
+ A <MODULE> parameter can have the following formats: ::
+
+ {MODNAME} ... matches any version
+ {MODNAME}>={VERSION} ... at least version <VERSION> is required
+ {MODNAME}={VERSION} ... exactly version <VERSION> is required
+ {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
+
+ Examples
+
+ .. code-block:: cmake
+
+ pkg_check_modules (GLIB2 glib-2.0)
+
+ .. code-block:: cmake
+
+ pkg_check_modules (GLIB2 glib-2.0>=2.10)
+
+ Requires at least version 2.10 of glib2 and defines e.g.
+ ``GLIB2_VERSION=2.10.3``
+
+ .. code-block:: cmake
+
+ pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
+
+ Requires both glib2 and gtk2, and defines e.g.
+ ``FOO_glib-2.0_VERSION=2.10.3`` and ``FOO_gtk+-2.0_VERSION=2.8.20``
+
+ .. code-block:: cmake
+
+ pkg_check_modules (XRENDER REQUIRED xrender)
+
+ Defines e.g.:
+ ``XRENDER_LIBRARIES=Xrender;X11`` and
+ ``XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp``
+#]========================================]
macro(pkg_check_modules _prefix _module0)
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
- _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
- _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" "${_prefix}" ${_pkg_modules})
+ _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
+ _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
endif()
endmacro()
-###
+
+#[========================================[.rst:
+.. command:: pkg_search_module
+
+ Same as :command:`pkg_check_modules`, but instead it checks for given
+ modules and uses the first working one. ::
+
+ pkg_search_module(<PREFIX> [REQUIRED] [QUIET]
+ [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
+ <MODULE> [<MODULE>]*)
+
+ Examples
+
+ .. code-block:: cmake
+
+ pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
+#]========================================]
macro(pkg_search_module _prefix _module0)
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
set(_pkg_modules_found 0)
- _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
+ _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
if (NOT ${_pkg_is_silent})
message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
@@ -412,7 +534,7 @@ macro(pkg_search_module _prefix _module0)
# iterate through all modules and stop at the first working one.
foreach(_pkg_alt ${_pkg_modules_alt})
if(NOT _pkg_modules_found)
- _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}")
+ _pkg_check_modules_internal(0 1 ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" "${_pkg_alt}")
endif()
if (${_prefix}_FOUND)
@@ -430,6 +552,26 @@ macro(pkg_search_module _prefix _module0)
endif()
endmacro()
+
+#[========================================[.rst:
+.. variable:: PKG_CONFIG_EXECUTABLE
+
+ Path to the pkg-config executable.
+
+
+.. variable:: PKG_CONFIG_USE_CMAKE_PREFIX_PATH
+
+ Whether :command:`pkg_check_modules` and :command:`pkg_search_module`
+ should add the paths in :variable:`CMAKE_PREFIX_PATH`,
+ :variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH`
+ cache and environment variables to ``pkg-config`` search path.
+
+ If this variable is not set, this behavior is enabled by default if
+ :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or later, disabled
+ otherwise.
+#]========================================]
+
+
### Local Variables:
### mode: cmake
### End:
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index f13dea8..97666c8 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -145,12 +145,22 @@ find_library( PostgreSQL_LIBRARY
)
get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH)
-if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h")
- file(STRINGS "${PostgreSQL_INCLUDE_DIR}/pg_config.h" pgsql_version_str
- REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
-
- string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
- PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+if (PostgreSQL_INCLUDE_DIR)
+ # Some platforms include multiple pg_config.hs for multi-lib configurations
+ # This is a temporary workaround. A better solution would be to compile
+ # a dummy c file and extract the value of the symbol.
+ file(GLOB _PG_CONFIG_HEADERS "${PostgreSQL_INCLUDE_DIR}/pg_config*.h")
+ foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS})
+ if(EXISTS "${_PG_CONFIG_HEADER}")
+ file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str
+ REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
+ if(pgsql_version_str)
+ string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*"
+ "\\1" PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+ break()
+ endif()
+ endif()
+ endforeach()
unset(pgsql_version_str)
endif()
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 9b120a6..72ca6ed 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -183,7 +183,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
"${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
- DEPENDS ${ABS_FIL}
+ DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE}
COMMENT "Running C++ protocol buffer compiler on ${FIL}"
VERBATIM )
endforeach()
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index e23a58b..5e5c7b9 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -27,6 +27,10 @@
# of version numbers that should be taken into account when searching
# for Python. You need to set this variable before calling
# find_package(PythonInterp).
+#
+# If also calling find_package(PythonLibs), call find_package(PythonInterp)
+# first to get the currently active Python version by default with a consistent
+# version of PYTHON_LIBRARIES.
#=============================================================================
# Copyright 2005-2010 Kitware, Inc.
@@ -71,18 +75,23 @@ if(PythonInterp_FIND_VERSION)
else()
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
endif()
-
-list(APPEND _Python_NAMES python)
-
-# Search for the current active python version first
find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
# Set up the versions we know about, in the order we will search. Always add
# the user supplied additional versions to the front.
-set(_Python_VERSIONS
- ${Python_ADDITIONAL_VERSIONS}
- ${_PYTHON_FIND_OTHER_VERSIONS}
- )
+set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
+# If FindPythonInterp has already found the major and minor version,
+# insert that version next to get consistent versions of the interpreter and
+# library.
+if(DEFINED PYTHONLIBS_VERSION_STRING)
+ string(REPLACE "." ";" _PYTHONLIBS_VERSION "${PYTHONLIBS_VERSION_STRING}")
+ list(GET _PYTHONLIBS_VERSION 0 _PYTHONLIBS_VERSION_MAJOR)
+ list(GET _PYTHONLIBS_VERSION 1 _PYTHONLIBS_VERSION_MINOR)
+ list(APPEND _Python_VERSIONS ${_PYTHONLIBS_VERSION_MAJOR}.${_PYTHONLIBS_VERSION_MINOR})
+endif()
+# Search for the current active python version first
+list(APPEND _Python_VERSIONS ";")
+list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
unset(_PYTHON_FIND_OTHER_VERSIONS)
unset(_PYTHON1_VERSIONS)
@@ -91,7 +100,7 @@ unset(_PYTHON3_VERSIONS)
# Search for newest python version if python executable isn't found
if(NOT PYTHON_EXECUTABLE)
- foreach(_CURRENT_VERSION ${_Python_VERSIONS})
+ foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS)
set(_Python_NAMES python${_CURRENT_VERSION})
if(WIN32)
list(APPEND _Python_NAMES python)
@@ -129,8 +138,8 @@ if(PYTHON_EXECUTABLE)
string(REGEX REPLACE " .*" "" PYTHON_VERSION_STRING "${_VERSION}")
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}")
- if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*")
- string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}")
+ if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.([0-9]+)")
+ set(PYTHON_VERSION_PATCH "${CMAKE_MATCH_1}")
else()
set(PYTHON_VERSION_PATCH "0")
endif()
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 1dbc967..cc875ad 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -31,6 +31,10 @@
#
# PYTHON_LIBRARY - path to the python library
# PYTHON_INCLUDE_DIR - path to where Python.h is found
+#
+# If also calling find_package(PythonInterp), call find_package(PythonInterp)
+# first to get the currently active Python version by default with a consistent
+# version of PYTHON_LIBRARIES.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -80,10 +84,14 @@ endif()
# Set up the versions we know about, in the order we will search. Always add
# the user supplied additional versions to the front.
-set(_Python_VERSIONS
- ${Python_ADDITIONAL_VERSIONS}
- ${_PYTHON_FIND_OTHER_VERSIONS}
- )
+# If FindPythonInterp has already found the major and minor version,
+# insert that version between the user supplied versions and the stock
+# version list.
+set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
+if(DEFINED PYTHON_VERSION_MAJOR AND DEFINED PYTHON_VERSION_MINOR)
+ list(APPEND _Python_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
+endif()
+list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
unset(_PYTHON_FIND_OTHER_VERSIONS)
unset(_PYTHON1_VERSIONS)
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake
index e893c7a..1bc0940 100644
--- a/Modules/FindQt.cmake
+++ b/Modules/FindQt.cmake
@@ -87,7 +87,7 @@ find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin
if(QT_QMAKE_EXECUTABLE_FINDQT)
exec_program(${QT_QMAKE_EXECUTABLE_FINDQT} ARGS "-query QT_VERSION"
OUTPUT_VARIABLE QTVERSION)
- if(QTVERSION MATCHES "4.*")
+ if(QTVERSION MATCHES "4")
set(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "Qt4 qmake program.")
set(QT4_INSTALLED TRUE)
endif()
@@ -154,12 +154,12 @@ else()
endif()
endif()
-if(DESIRED_QT_VERSION MATCHES 3)
+if(DESIRED_QT_VERSION EQUAL 3)
set(Qt3_FIND_REQUIRED ${Qt_FIND_REQUIRED})
set(Qt3_FIND_QUIETLY ${Qt_FIND_QUIETLY})
include(${CMAKE_CURRENT_LIST_DIR}/FindQt3.cmake)
endif()
-if(DESIRED_QT_VERSION MATCHES 4)
+if(DESIRED_QT_VERSION EQUAL 4)
set(Qt4_FIND_REQUIRED ${Qt_FIND_REQUIRED})
set(Qt4_FIND_QUIETLY ${Qt_FIND_QUIETLY})
include(${CMAKE_CURRENT_LIST_DIR}/FindQt4.cmake)
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index 6cd12c6..86997ba 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -161,7 +161,7 @@ find_library(QT_QASSISTANTCLIENT_LIBRARY
# Qt 3 should prefer QTDIR over the PATH
find_program(QT_MOC_EXECUTABLE
- NAMES moc-qt3 moc moc3 moc3-mt
+ NAMES moc-qt3 moc3 moc3-mt moc
HINTS
ENV QTDIR
PATHS
@@ -186,7 +186,7 @@ endif()
# Qt 3 should prefer QTDIR over the PATH
find_program(QT_UIC_EXECUTABLE
- NAMES uic-qt3 uic uic3 uic3-mt
+ NAMES uic-qt3 uic3 uic3-mt uic
HINTS
ENV QTDIR
PATHS
@@ -295,12 +295,12 @@ if(QT_UIC_EXECUTABLE)
endif()
set(_QT_UIC_VERSION_3 FALSE)
-if("${QTVERSION_UIC}" MATCHES ".* 3..*")
+if("${QTVERSION_UIC}" MATCHES " 3.")
set(_QT_UIC_VERSION_3 TRUE)
endif()
set(_QT_MOC_VERSION_3 FALSE)
-if("${QTVERSION_MOC}" MATCHES ".* 3..*")
+if("${QTVERSION_MOC}" MATCHES " 3.")
set(_QT_MOC_VERSION_3 TRUE)
endif()
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 99e574e..06a8917 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -1,9 +1,9 @@
#.rst:
# FindQt4
-# *******
+# -------
#
# Finding and Using Qt4
-# =====================
+# ^^^^^^^^^^^^^^^^^^^^^
#
# This module can be used to find Qt4. The most important issue is that
# the Qt4 qmake is available via the system path. This qmake is then
@@ -30,7 +30,7 @@
# property to ``TRUE`` on the executable.
#
# Qt Build Tools
-# ==============
+# ^^^^^^^^^^^^^^
#
# Qt relies on some bundled tools for code generation, such as ``moc`` for
# meta-object code generation,``uic`` for widget layout and population,
@@ -39,7 +39,7 @@
# are met. See :manual:`cmake-qt(7)` for more.
#
# Qt Macros
-# =========
+# ^^^^^^^^^
#
# In some cases it can be necessary or useful to invoke the Qt build tools in a
# more-manual way. Several macros are available to add targets for such uses.
@@ -194,7 +194,7 @@
#
#
# IMPORTED Targets
-# ================
+# ^^^^^^^^^^^^^^^^
#
# A particular Qt library may be used by using the corresponding
# :prop_tgt:`IMPORTED` target with the :command:`target_link_libraries`
@@ -271,7 +271,7 @@
# The phonon target
#
# Result Variables
-# ================
+# ^^^^^^^^^^^^^^^^
#
# Below is a detailed list of variables that FindQt4.cmake sets.
#
@@ -335,6 +335,7 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSymbolExists.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/MacroAddFileDependencies.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
set(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
@@ -517,7 +518,8 @@ set(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
set(_QT4_QMAKE_NAMES qmake qmake4 qmake-qt4 qmake-mac)
_qt4_find_qmake("${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION)
-if (QT_QMAKE_EXECUTABLE AND QTVERSION)
+if (QT_QMAKE_EXECUTABLE AND
+ QTVERSION VERSION_GREATER 3 AND QTVERSION VERSION_LESS 5)
if (Qt5Core_FOUND)
# Qt5CoreConfig sets QT_MOC_EXECUTABLE as a non-cache variable to the Qt 5
@@ -613,9 +615,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE)
set(QT_QTCORE_FOUND 1)
else()
- message(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" "
- "but QtCore could not be found there. "
- "Qt is NOT installed correctly for the target build environment.")
+ if(NOT Qt4_FIND_QUIETLY)
+ message(WARNING
+ "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as "
+ "\"${QT_LIBRARY_DIR_TMP}\" "
+ "but QtCore could not be found there. "
+ "Qt is NOT installed correctly for the target build environment.")
+ endif()
set(Qt4_FOUND FALSE)
if(Qt4_FIND_REQUIRED)
message( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.")
@@ -747,11 +753,10 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
# Find out what window system we're using
#
#############################################
- # Save required variable
- set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
- set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
+ cmake_push_check_state()
# Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
set(CMAKE_REQUIRED_INCLUDES "${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)
CHECK_CXX_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN)
@@ -771,9 +776,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
endif ()
endif ()
- # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
- set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
- set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
+ cmake_pop_check_state()
#
#############################################
@@ -1135,17 +1138,17 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
endif()
endmacro()
- _find_qt4_program(QT_MOC_EXECUTABLE Qt4::moc moc-qt4 moc moc4)
- _find_qt4_program(QT_UIC_EXECUTABLE Qt4::uic uic-qt4 uic uic4)
+ _find_qt4_program(QT_MOC_EXECUTABLE Qt4::moc moc-qt4 moc4 moc)
+ _find_qt4_program(QT_UIC_EXECUTABLE Qt4::uic uic-qt4 uic4 uic)
_find_qt4_program(QT_UIC3_EXECUTABLE Qt4::uic3 uic3)
_find_qt4_program(QT_RCC_EXECUTABLE Qt4::rcc rcc)
_find_qt4_program(QT_DBUSCPP2XML_EXECUTABLE Qt4::qdbuscpp2xml qdbuscpp2xml)
_find_qt4_program(QT_DBUSXML2CPP_EXECUTABLE Qt4::qdbusxml2cpp qdbusxml2cpp)
- _find_qt4_program(QT_LUPDATE_EXECUTABLE Qt4::lupdate lupdate-qt4 lupdate lupdate4)
- _find_qt4_program(QT_LRELEASE_EXECUTABLE Qt4::lrelease lrelease-qt4 lrelease lrelease4)
+ _find_qt4_program(QT_LUPDATE_EXECUTABLE Qt4::lupdate lupdate-qt4 lupdate4 lupdate)
+ _find_qt4_program(QT_LRELEASE_EXECUTABLE Qt4::lrelease lrelease-qt4 lrelease4 lrelease)
_find_qt4_program(QT_QCOLLECTIONGENERATOR_EXECUTABLE Qt4::qcollectiongenerator qcollectiongenerator-qt4 qcollectiongenerator)
- _find_qt4_program(QT_DESIGNER_EXECUTABLE Qt4::designer designer-qt4 designer designer4)
- _find_qt4_program(QT_LINGUIST_EXECUTABLE Qt4::linguist linguist-qt4 linguist linguist4)
+ _find_qt4_program(QT_DESIGNER_EXECUTABLE Qt4::designer designer-qt4 designer4 designer)
+ _find_qt4_program(QT_LINGUIST_EXECUTABLE Qt4::linguist linguist-qt4 linguist4 linguist)
if (NOT TARGET Qt4::qmake)
add_executable(Qt4::qmake IMPORTED)
diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake
index e5173e3..fc2c043 100644
--- a/Modules/FindSDL_image.cmake
+++ b/Modules/FindSDL_image.cmake
@@ -54,7 +54,9 @@ find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h
HINTS
ENV SDLIMAGEDIR
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake
index 8f2f066..176fee6 100644
--- a/Modules/FindSDL_mixer.cmake
+++ b/Modules/FindSDL_mixer.cmake
@@ -54,7 +54,9 @@ find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h
HINTS
ENV SDLMIXERDIR
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake
index e5c2cdb..ef23573 100644
--- a/Modules/FindSDL_net.cmake
+++ b/Modules/FindSDL_net.cmake
@@ -54,7 +54,9 @@ find_path(SDL_NET_INCLUDE_DIR SDL_net.h
HINTS
ENV SDLNETDIR
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake
index 3a6ab7b..5fa40a5 100644
--- a/Modules/FindSDL_sound.cmake
+++ b/Modules/FindSDL_sound.cmake
@@ -98,7 +98,9 @@ find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h
HINTS
ENV SDLSOUNDDIR
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
find_library(SDL_SOUND_LIBRARY
@@ -181,7 +183,7 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
# in the SDL_LIBRARY string after the "-framework".
# But if I quote the stuff in INCLUDE_DIRECTORIES, it doesn't work.
file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/CMakeLists.txt
- "cmake_minimum_required(VERSION 2.8)
+ "cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(DetermineSoundLibs)
include_directories(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
add_executable(DetermineSoundLibs DetermineSoundLibs.c)
diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake
index 3f58ac1..4b527fa 100644
--- a/Modules/FindSDL_ttf.cmake
+++ b/Modules/FindSDL_ttf.cmake
@@ -54,7 +54,9 @@ find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h
HINTS
ENV SDLTTFDIR
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake
index 8bd4048..818d1f2 100644
--- a/Modules/FindSWIG.cmake
+++ b/Modules/FindSWIG.cmake
@@ -25,6 +25,7 @@
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
# Copyright 2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
+# Copyright 2014 Sylvain Joubert <joubert.sy@gmail.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -36,7 +37,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-find_program(SWIG_EXECUTABLE NAMES swig2.0 swig)
+find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig)
if(SWIG_EXECUTABLE)
execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index 5cff122..4076521 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -184,7 +184,7 @@ if(SQUISH_CLIENT_EXECUTABLE)
execute_process(COMMAND "${SQUISH_CLIENT_EXECUTABLE}" --version
OUTPUT_VARIABLE _squishVersionOutput
ERROR_QUIET )
- if("${_squishVersionOutput}" MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+).*$")
+ if("${_squishVersionOutput}" MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
set(SQUISH_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(SQUISH_VERSION_MINOR "${CMAKE_MATCH_2}")
set(SQUISH_VERSION_PATCH "${CMAKE_MATCH_3}")
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index ec671bf..6050dcd 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -37,9 +37,11 @@ include (CheckIncludeFiles)
include (CheckLibraryExists)
include (CheckSymbolExists)
set(Threads_FOUND FALSE)
+set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+set(CMAKE_REQUIRED_QUIET ${Threads_FIND_QUIETLY})
# Do we have sproc?
-if(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
+if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H)
endif()
@@ -63,32 +65,31 @@ else()
set(CMAKE_THREAD_LIBS_INIT "")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE)
- endif()
+ else()
- if(NOT CMAKE_HAVE_THREADS_LIBRARY)
# Do we have -lpthreads
CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE)
if(CMAKE_HAVE_PTHREADS_CREATE)
set(CMAKE_THREAD_LIBS_INIT "-lpthreads")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE)
- endif()
-
- # Ok, how about -lpthread
- CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
- if(CMAKE_HAVE_PTHREAD_CREATE)
- set(CMAKE_THREAD_LIBS_INIT "-lpthread")
- set(CMAKE_HAVE_THREADS_LIBRARY 1)
- set(Threads_FOUND TRUE)
- endif()
+ else()
- if(CMAKE_SYSTEM MATCHES "SunOS.*")
- # On sun also check for -lthread
- CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
- if(CMAKE_HAVE_THR_CREATE)
- set(CMAKE_THREAD_LIBS_INIT "-lthread")
+ # Ok, how about -lpthread
+ CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
+ if(CMAKE_HAVE_PTHREAD_CREATE)
+ set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE)
+
+ elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ # On sun also check for -lthread
+ CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
+ if(CMAKE_HAVE_THR_CREATE)
+ set(CMAKE_THREAD_LIBS_INIT "-lthread")
+ set(CMAKE_HAVE_THREADS_LIBRARY 1)
+ set(Threads_FOUND TRUE)
+ endif()
endif()
endif()
endif()
@@ -96,7 +97,7 @@ else()
if(NOT CMAKE_HAVE_THREADS_LIBRARY)
# If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
- if("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
+ if("x${THREADS_HAVE_PTHREAD_ARG}" STREQUAL "x")
message(STATUS "Check if compiler accepts -pthread")
try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
${CMAKE_BINARY_DIR}
@@ -137,13 +138,13 @@ if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE)
set(Threads_FOUND TRUE)
endif()
-if(CMAKE_SYSTEM MATCHES "Windows")
+if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_USE_WIN32_THREADS_INIT 1)
set(Threads_FOUND TRUE)
endif()
if(CMAKE_USE_PTHREADS_INIT)
- if(CMAKE_SYSTEM MATCHES "HP-UX-*")
+ if(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
# Use libcma if it exists and can be used. It provides more
# symbols than the plain pthread library. CMA threads
# have actually been deprecated:
@@ -161,12 +162,12 @@ if(CMAKE_USE_PTHREADS_INIT)
set(CMAKE_USE_PTHREADS_INIT 1)
endif()
- if(CMAKE_SYSTEM MATCHES "OSF1-V*")
+ if(CMAKE_SYSTEM MATCHES "OSF1-V")
set(CMAKE_USE_PTHREADS_INIT 0)
set(CMAKE_THREAD_LIBS_INIT )
endif()
- if(CMAKE_SYSTEM MATCHES "CYGWIN_NT*")
+ if(CMAKE_SYSTEM MATCHES "CYGWIN_NT")
set(CMAKE_USE_PTHREADS_INIT 1)
set(Threads_FOUND TRUE)
set(CMAKE_THREAD_LIBS_INIT )
@@ -174,5 +175,6 @@ if(CMAKE_USE_PTHREADS_INIT)
endif()
endif()
+set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND)
diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake
index bcc7f87..60f48dd 100644
--- a/Modules/FindVTK.cmake
+++ b/Modules/FindVTK.cmake
@@ -10,18 +10,6 @@
# ::
#
# VTK_FOUND - Set to true when VTK is found.
-# VTK_USE_FILE - CMake file to use VTK.
-# VTK_MAJOR_VERSION - The VTK major version number.
-# VTK_MINOR_VERSION - The VTK minor version number
-# (odd non-release).
-# VTK_BUILD_VERSION - The VTK patch level
-# (meaningless for odd minor).
-# VTK_INCLUDE_DIRS - Include directories for VTK
-# VTK_LIBRARY_DIRS - Link directories for VTK libraries
-# VTK_KITS - List of VTK kits, in CAPS
-# (COMMON,IO,) etc.
-# VTK_LANGUAGES - List of wrapped languages, in CAPS
-# (TCL, PYHTON,) etc.
#
# The following cache entries must be set by the user to locate VTK:
#
@@ -43,7 +31,7 @@
# instead.
#=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
+# Copyright 2001-2014 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -55,102 +43,24 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-# Assume not found.
-set(VTK_FOUND 0)
-
-# VTK 4.0 did not provide VTKConfig.cmake.
-if("${VTK_FIND_VERSION}" VERSION_LESS 4.1)
- set(_VTK_40_ALLOW 1)
- if(VTK_FIND_VERSION)
- set(_VTK_40_ONLY 1)
- endif()
-endif()
-
-# Construct consistent error messages for use below.
-set(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.")
-if(_VTK_40_ALLOW)
- set(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.")
-endif()
-set(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}")
-
-# Check whether VTK 4.0 has already been found.
-if(_VTK_40_ALLOW AND VTK_DIR)
- if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
- set(VTK_FOUND 1)
- include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings.
- endif()
-endif()
-
# Use the Config mode of the find_package() command to find VTKConfig.
# If this succeeds (possibly because VTK_DIR is already set), the
# command will have already loaded VTKConfig.cmake and set VTK_FOUND.
-if(NOT _VTK_40_ONLY AND NOT VTK_FOUND)
- find_package(VTK QUIET NO_MODULE)
-endif()
-
-# Special search for VTK 4.0.
-if(_VTK_40_ALLOW AND NOT VTK_DIR)
- # Old scripts may set these directories in the CMakeCache.txt file.
- # They can tell us where to find VTKConfig.cmake.
- set(VTK_DIR_SEARCH_LEGACY "")
- if(VTK_BINARY_PATH AND USE_BUILT_VTK)
- set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH})
- endif()
- if(VTK_INSTALL_PATH AND USE_INSTALLED_VTK)
- set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY}
- ${VTK_INSTALL_PATH}/lib/vtk)
+if(NOT VTK_FOUND)
+ set(_VTK_REQUIRED "")
+ if(VTK_FIND_REQUIRED)
+ set(_VTK_REQUIRED REQUIRED)
endif()
-
- # Look for UseVTK.cmake in build trees or under <prefix>/include/vtk.
- find_path(VTK_DIR
- NAMES UseVTK.cmake
- PATH_SUFFIXES vtk-4.0 vtk
- HINTS ENV VTK_DIR
-
- PATHS
-
- # Support legacy cache files.
- ${VTK_DIR_SEARCH_LEGACY}
-
- # Read from the CMakeSetup registry entries. It is likely that
- # VTK will have been recently built.
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
-
- # Help the user find it if we cannot.
- DOC "The ${VTK_DIR_DESCRIPTION}"
- )
-
- if(VTK_DIR)
- if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
- set(VTK_FOUND 1)
- include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings.
- else()
- # We found the wrong version. Pretend we did not find it.
- set(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE)
- endif()
+ set(_VTK_QUIET "")
+ if(VTK_FIND_QUIETLY)
+ set(_VTK_QUIET QUIET)
endif()
+ find_package(VTK ${_VTK_REQUIRED} ${_VTK_QUIET} NO_MODULE)
+ unset(_VTK_REQUIRED)
+ unset(_VTK_QUIET)
endif()
-#-----------------------------------------------------------------------------
if(VTK_FOUND)
# Set USE_VTK_FILE for backward-compatibility.
set(USE_VTK_FILE ${VTK_USE_FILE})
-else()
- # VTK not found, explain to the user how to specify its location.
- if(VTK_FIND_REQUIRED)
- message(FATAL_ERROR ${VTK_DIR_MESSAGE})
- else()
- if(NOT VTK_FIND_QUIETLY)
- message(STATUS ${VTK_DIR_MESSAGE})
- endif()
- endif()
endif()
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index 67cecc2..90c1499 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -4,7 +4,7 @@
#
# Find X11 installation
#
-# Try to find X11 on UNIX systems. The following values are defined
+# Try to find X11 on UNIX systems. The following values are defined
#
# ::
#
@@ -12,47 +12,44 @@
# X11_INCLUDE_DIR - include directories to use X11
# X11_LIBRARIES - link against these to use X11
#
-#
-#
-# and also the following more fine grained variables: Include paths:
-# X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND
+# and also the following more fine grained variables:
#
# ::
#
-# X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND
-# X11_X11_INCLUDE_PATH, X11_X11_LIB
-# X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND
-# X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND
-# X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND
-# X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND
-# X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND
-# X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND
-# X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND
-# X11_Xext_LIB, X11_Xext_FOUND
-# X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND
-# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND
-# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND
-# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND
-# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND
-# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND
-# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND
-# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND
-# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND
-# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND
-# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND
-# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND
-# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND
-# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND
-# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND
-# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND
-# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND
-# X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND
-# X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND
-# X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND
-# X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND
-# X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND
-# X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND
-
+# X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND
+# X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND
+# X11_X11_INCLUDE_PATH, X11_X11_LIB
+# X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND
+# X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND
+# X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND
+# X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND
+# X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND
+# X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND
+# X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND
+# X11_Xext_LIB, X11_Xext_FOUND
+# X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND
+# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND
+# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND
+# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND
+# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND
+# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND
+# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND
+# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND
+# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND
+# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND
+# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND
+# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND
+# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND
+# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND
+# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND
+# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND
+# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND
+# X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND
+# X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND
+# X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND
+# X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND
+# X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND
+# X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -73,6 +70,8 @@ if (UNIX)
# found in tcl on the mac
set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK})
set(CMAKE_FIND_FRAMEWORK NEVER)
+ set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+ set(CMAKE_REQUIRED_QUIET ${X11_FIND_QUIETLY})
set(X11_INC_SEARCH_PATH
/usr/pkg/xorg/include
/usr/X11R6/include
@@ -507,6 +506,7 @@ if (UNIX)
X11_XSync_INCLUDE_PATH
)
set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE})
+ set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
endif ()
# X11_FIND_REQUIRED_<component> could be checked too
diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake
index e855050..1491754 100644
--- a/Modules/FindXMLRPC.cmake
+++ b/Modules/FindXMLRPC.cmake
@@ -77,10 +77,9 @@ if(XMLRPC_FOUND)
# Look for -I options.
set(XMLRPC_INCLUDE_DIRS)
foreach(flag ${XMLRPC_C_CONFIG_CFLAGS})
- if("${flag}" MATCHES "^-I")
- string(REGEX REPLACE "^-I" "" DIR "${flag}")
- file(TO_CMAKE_PATH "${DIR}" DIR)
- set(XMLRPC_INCLUDE_DIRS ${XMLRPC_INCLUDE_DIRS} "${DIR}")
+ if("${flag}" MATCHES "^-I(.+)")
+ file(TO_CMAKE_PATH "${CMAKE_MATCH_1}" DIR)
+ list(APPEND XMLRPC_INCLUDE_DIRS "${DIR}")
endif()
endforeach()
else()
@@ -115,13 +114,11 @@ if(XMLRPC_FOUND)
set(XMLRPC_LIBRARY_DIRS)
set(XMLRPC_LIBRARY_NAMES)
foreach(flag ${XMLRPC_C_CONFIG_LIBS})
- if("${flag}" MATCHES "^-L")
- string(REGEX REPLACE "^-L" "" DIR "${flag}")
- file(TO_CMAKE_PATH "${DIR}" DIR)
- set(XMLRPC_LIBRARY_DIRS ${XMLRPC_LIBRARY_DIRS} "${DIR}")
- elseif("${flag}" MATCHES "^-l")
- string(REGEX REPLACE "^-l" "" NAME "${flag}")
- set(XMLRPC_LIBRARY_NAMES ${XMLRPC_LIBRARY_NAMES} "${NAME}")
+ if("${flag}" MATCHES "^-L(.+)")
+ file(TO_CMAKE_PATH "${CMAKE_MATCH_1}" DIR)
+ list(APPEND XMLRPC_LIBRARY_DIRS "${DIR}")
+ elseif("${flag}" MATCHES "^-l(.+)")
+ list(APPEND XMLRPC_LIBRARY_NAMES "${CMAKE_MATCH_1}")
endif()
endforeach()
diff --git a/Modules/FindXerces.cmake b/Modules/FindXerces.cmake
new file mode 100644
index 0000000..325bb6d
--- /dev/null
+++ b/Modules/FindXerces.cmake
@@ -0,0 +1,85 @@
+#.rst:
+# FindXerces
+# ----------
+#
+# Find the Apache Xerces-C++ validating XML parser headers and libraries.
+#
+# This module reports information about the Xerces installation in
+# several variables. General variables::
+#
+# Xerces_FOUND - true if the Xerces headers and libraries were found
+# Xerces_VERSION - Xerces release version
+# Xerces_INCLUDE_DIRS - the directory containing the Xerces headers
+# Xerces_LIBRARIES - Xerces libraries to be linked
+#
+# The following cache variables may also be set::
+#
+# Xerces_INCLUDE_DIR - the directory containing the Xerces headers
+# Xerces_LIBRARY - the Xerces library
+
+# Written by Roger Leigh <rleigh@codelibre.net>
+
+#=============================================================================
+# Copyright 2014 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.)
+
+function(_Xerces_GET_VERSION version_hdr)
+ file(STRINGS ${version_hdr} _contents REGEX "^[ \t]*#define XERCES_VERSION_.*")
+ if(_contents)
+ string(REGEX REPLACE ".*#define XERCES_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" Xerces_MAJOR "${_contents}")
+ string(REGEX REPLACE ".*#define XERCES_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" Xerces_MINOR "${_contents}")
+ string(REGEX REPLACE ".*#define XERCES_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" Xerces_PATCH "${_contents}")
+
+ if(NOT Xerces_MAJOR MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MAJOR!")
+ endif()
+ if(NOT Xerces_MINOR MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MINOR!")
+ endif()
+ if(NOT Xerces_PATCH MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_REVISION!")
+ endif()
+
+ set(Xerces_VERSION "${Xerces_MAJOR}.${Xerces_MINOR}.${Xerces_PATCH}" PARENT_SCOPE)
+ else()
+ message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information")
+ endif()
+endfunction()
+
+# Find include directory
+find_path(Xerces_INCLUDE_DIR
+ NAMES "xercesc/util/PlatformUtils.hpp"
+ DOC "Xerces-C++ include directory")
+mark_as_advanced(Xerces_INCLUDE_DIR)
+
+# Find all Xerces libraries
+find_library(Xerces_LIBRARY "xerces-c"
+ DOC "Xerces-C++ libraries")
+mark_as_advanced(Xerces_LIBRARY)
+
+if(Xerces_INCLUDE_DIR)
+ _Xerces_GET_VERSION("${Xerces_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp")
+endif()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xerces
+ FOUND_VAR Xerces_FOUND
+ REQUIRED_VARS Xerces_LIBRARY
+ Xerces_INCLUDE_DIR
+ Xerces_VERSION
+ VERSION_VAR Xerces_VERSION
+ FAIL_MESSAGE "Failed to find Xerces")
+
+if(Xerces_FOUND)
+ set(Xerces_INCLUDE_DIRS "${Xerces_INCLUDE_DIR}")
+ set(Xerces_LIBRARIES "${Xerces_LIBRARY}")
+endif()
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 75b0076..d4a27d5 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -2,9 +2,18 @@
# FindZLIB
# --------
#
-# Find zlib
+# Find the native ZLIB includes and library.
#
-# Find the native ZLIB includes and library. Once done this will define
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if
+# ZLIB has been found.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the following variables:
#
# ::
#
@@ -12,8 +21,6 @@
# ZLIB_LIBRARIES - List of libraries when using zlib.
# ZLIB_FOUND - True if zlib found.
#
-#
-#
# ::
#
# ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
@@ -22,7 +29,8 @@
# ZLIB_VERSION_PATCH - The patch version of zlib
# ZLIB_VERSION_TWEAK - The tweak version of zlib
#
-#
+# Backward Compatibility
+# ^^^^^^^^^^^^^^^^^^^^^^
#
# The following variable are provided for backward compatibility
#
@@ -32,9 +40,10 @@
# ZLIB_MINOR_VERSION - The minor version of zlib
# ZLIB_PATCH_VERSION - The patch version of zlib
#
+# Hints
+# ^^^^^
#
-#
-# An includer may set ZLIB_ROOT to a zlib installation root to tell this
+# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this
# module where to look.
#=============================================================================
@@ -85,7 +94,7 @@ if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
# only append a TWEAK version if it exists:
set(ZLIB_VERSION_TWEAK "")
- if( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$")
+ 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}")
endif()
@@ -104,5 +113,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D
if(ZLIB_FOUND)
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
-endif()
+ if(NOT TARGET ZLIB::ZLIB)
+ add_library(ZLIB::ZLIB UNKNOWN IMPORTED)
+ set_target_properties(ZLIB::ZLIB PROPERTIES
+ IMPORTED_LOCATION "${ZLIB_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}")
+ endif()
+endif()
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 3c664e7..7ef06a8 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -229,13 +229,12 @@ else()
endif()
#=====================================================================
+# Determine whether unix or win32 paths should be used
#=====================================================================
-if(WIN32 AND NOT CYGWIN AND NOT MSYS)
+if(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_CROSSCOMPILING)
set(wxWidgets_FIND_STYLE "win32")
else()
- if(UNIX OR MSYS)
- set(wxWidgets_FIND_STYLE "unix")
- endif()
+ set(wxWidgets_FIND_STYLE "unix")
endif()
#=====================================================================
@@ -560,7 +559,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
if(WX_LIB_DIR)
# If building shared libs, define WXUSINGDLL to use dllimport.
- if(WX_LIB_DIR MATCHES ".*[dD][lL][lL].*")
+ if(WX_LIB_DIR MATCHES "[dD][lL][lL]")
set(wxWidgets_DEFINITIONS WXUSINGDLL)
DBG_MSG_V("detected SHARED/DLL tree WX_LIB_DIR=${WX_LIB_DIR}")
endif()
@@ -668,7 +667,7 @@ else()
if(_wx_result EQUAL 0)
foreach(_opt_name debug static unicode universal)
string(TOUPPER ${_opt_name} _upper_opt_name)
- if(_wx_selected_config MATCHES ".*${_opt_name}.*")
+ if(_wx_selected_config MATCHES "${_opt_name}")
set(wxWidgets_DEFAULT_${_upper_opt_name} ON)
else()
set(wxWidgets_DEFAULT_${_upper_opt_name} OFF)
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index dccb26f..27f8a82 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -328,7 +328,7 @@ function(FortranCInterface_VERIFY)
# Error if compilers are incompatible.
if(NOT FortranCInterface_VERIFIED_${lang} AND NOT quiet)
file(READ "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" _output)
- string(REGEX REPLACE "\n" "\n " _output "${_output}")
+ string(REPLACE "\n" "\n " _output "${_output}")
message(FATAL_ERROR
"The Fortran compiler:\n ${CMAKE_Fortran_COMPILER}\n"
"and the ${lang} compiler:\n ${CMAKE_${lang}_COMPILER}\n"
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index d35a72c..b6232ed 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -9,7 +9,7 @@
# See the License for more information.
#=============================================================================
-cmake_minimum_required(VERSION 2.6.3)
+cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(FortranCInterface C Fortran)
include(${FortranCInterface_BINARY_DIR}/Input.cmake OPTIONAL)
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index afeb9c5..bee7dae 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -67,11 +67,10 @@ endif()
set(FortranCInterface_SYMBOLS)
if(FortranCInterface_EXE)
file(STRINGS "${FortranCInterface_EXE}" _info_strings
- LIMIT_COUNT 8 REGEX "INFO:[^[]*\\[")
+ LIMIT_COUNT 8 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
foreach(info ${_info_strings})
- if("${info}" MATCHES ".*INFO:symbol\\[([^]]*)\\].*")
- string(REGEX REPLACE ".*INFO:symbol\\[([^]]*)\\].*" "\\1" symbol "${info}")
- list(APPEND FortranCInterface_SYMBOLS ${symbol})
+ if("${info}" MATCHES "INFO:symbol\\[([^]]*)\\]")
+ list(APPEND FortranCInterface_SYMBOLS ${CMAKE_MATCH_1})
endif()
endforeach()
elseif(NOT _result)
diff --git a/Modules/FortranCInterface/Verify/CMakeLists.txt b/Modules/FortranCInterface/Verify/CMakeLists.txt
index e969f24..cde3c53 100644
--- a/Modules/FortranCInterface/Verify/CMakeLists.txt
+++ b/Modules/FortranCInterface/Verify/CMakeLists.txt
@@ -9,7 +9,7 @@
# See the License for more information.
#=============================================================================
-cmake_minimum_required(VERSION 2.7)
+cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(VerifyFortranC C Fortran)
option(VERIFY_CXX "Whether to verify C++ and Fortran" OFF)
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index d868cb3..eac553d 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -192,9 +192,26 @@ if(NOT CMAKE_INSTALL_DATADIR)
set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
endif()
-if(NOT CMAKE_INSTALL_INFODIR)
- set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
- set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
+if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+ if(NOT CMAKE_INSTALL_INFODIR)
+ set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (info)")
+ set(CMAKE_INSTALL_INFODIR "info")
+ endif()
+
+ if(NOT CMAKE_INSTALL_MANDDIR)
+ set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (man)")
+ set(CMAKE_INSTALL_MANDIR "man")
+ endif()
+else()
+ if(NOT CMAKE_INSTALL_INFODIR)
+ set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
+ set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
+ endif()
+
+ if(NOT CMAKE_INSTALL_MANDDIR)
+ set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
+ set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
+ endif()
endif()
if(NOT CMAKE_INSTALL_LOCALEDIR)
@@ -202,11 +219,6 @@ if(NOT CMAKE_INSTALL_LOCALEDIR)
set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
endif()
-if(NOT CMAKE_INSTALL_MANDIR)
- set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
- set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
-endif()
-
if(NOT CMAKE_INSTALL_DOCDIR)
set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index f83f992..f00b577 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -213,7 +213,6 @@ macro(_test_compiler_hidden_visibility)
# Exclude XL here because it misinterprets -fvisibility=hidden even though
# the check_cxx_compiler_flag passes
- # http://www.cdash.org/CDash/testDetails.php?test=109109951&build=1419259
if(NOT GCC_TOO_OLD
AND NOT _INTEL_TOO_OLD
AND NOT WIN32
@@ -364,6 +363,7 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY)
get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
if(NOT ${type} STREQUAL "STATIC_LIBRARY"
AND NOT ${type} STREQUAL "SHARED_LIBRARY"
+ AND NOT ${type} STREQUAL "OBJECT_LIBRARY"
AND NOT ${type} STREQUAL "MODULE_LIBRARY")
message(WARNING "This macro can only be used with libraries")
return()
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index ac649e9..05c2edb 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -509,10 +509,10 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
if(WIN32)
string(TOLOWER "$ENV{SystemRoot}" sysroot)
- string(REGEX REPLACE "\\\\" "/" sysroot "${sysroot}")
+ file(TO_CMAKE_PATH "${sysroot}" sysroot)
string(TOLOWER "$ENV{windir}" windir)
- string(REGEX REPLACE "\\\\" "/" windir "${windir}")
+ file(TO_CMAKE_PATH "${windir}" windir)
if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
set(is_system 1)
@@ -772,8 +772,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# Convert to a list of lines:
#
- string(REGEX REPLACE ";" "\\\\;" candidates "${gp_cmd_ov}")
- string(REGEX REPLACE "\n" "${eol_char};" candidates "${candidates}")
+ string(REPLACE ";" "\\;" candidates "${gp_cmd_ov}")
+ string(REPLACE "\n" "${eol_char};" candidates "${candidates}")
# check for install id and remove it from list, since otool -L can include a
# reference to itself
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 86033e6..5afb517 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -19,6 +19,8 @@
# libraries are installed when both debug and release are available. If
# CMAKE_INSTALL_MFC_LIBRARIES is set then the MFC run time libraries are
# installed as well as the CRT run time libraries. If
+# CMAKE_INSTALL_OPENMP_LIBRARIES is set then the OpenMP run time libraries
+# are installed as well. If
# CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION is set then the libraries are
# installed to that directory rather than the default. If
# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS is NOT set, then this
@@ -94,6 +96,8 @@ if(MSVC)
"${MSVC80_CRT_DIR}/msvcp80.dll"
"${MSVC80_CRT_DIR}/msvcr80.dll"
)
+ else()
+ set(__install__libs)
endif()
if(CMAKE_INSTALL_DEBUG_LIBRARIES)
@@ -132,6 +136,8 @@ if(MSVC)
"${MSVC90_CRT_DIR}/msvcp90.dll"
"${MSVC90_CRT_DIR}/msvcr90.dll"
)
+ else()
+ set(__install__libs)
endif()
if(CMAKE_INSTALL_DEBUG_LIBRARIES)
@@ -157,7 +163,8 @@ if(MSVC)
"${msvc_install_dir}/../../VC/redist"
"${base_dir}/VC/redist"
"$ENV{ProgramFiles}/Microsoft Visual Studio ${v}.0/VC/redist"
- "$ENV{ProgramFiles(x86)}/Microsoft Visual Studio ${v}.0/VC/redist"
+ set(programfilesx86 "ProgramFiles(x86)")
+ "$ENV{${programfilesx86}}/Microsoft Visual Studio ${v}.0/VC/redist"
)
mark_as_advanced(MSVC${v}_REDIST_DIR)
set(MSVC${v}_CRT_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT")
@@ -167,6 +174,8 @@ if(MSVC)
"${MSVC${v}_CRT_DIR}/msvcp${v}0.dll"
"${MSVC${v}_CRT_DIR}/msvcr${v}0.dll"
)
+ else()
+ set(__install__libs)
endif()
if(CMAKE_INSTALL_DEBUG_LIBRARIES)
@@ -191,6 +200,10 @@ if(MSVC)
MSVCRT_FILES_FOR_VERSION(12)
endif()
+ if(MSVC14)
+ MSVCRT_FILES_FOR_VERSION(14)
+ endif()
+
if(CMAKE_INSTALL_MFC_LIBRARIES)
if(MSVC70)
set(__install__libs ${__install__libs}
@@ -360,6 +373,44 @@ if(MSVC)
if(MSVC12)
MFC_FILES_FOR_VERSION(12)
endif()
+
+ if(MSVC14)
+ MFC_FILES_FOR_VERSION(14)
+ endif()
+ endif()
+
+ # MSVC 8 was the first version with OpenMP
+ # Furthermore, there is no debug version of this
+ if(CMAKE_INSTALL_OPENMP_LIBRARIES)
+ macro(OPENMP_FILES_FOR_VERSION version_a version_b)
+ set(va "${version_a}")
+ set(vb "${version_b}")
+ set(MSVC${va}_OPENMP_DIR "${MSVC${va}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${vb}.OPENMP")
+
+ if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+ set(__install__libs ${__install__libs}
+ "${MSVC${va}_OPENMP_DIR}/vcomp${vb}.dll")
+ endif()
+ endmacro()
+
+ if(MSVC80)
+ OPENMP_FILES_FOR_VERSION(80 80)
+ endif()
+ if(MSVC90)
+ OPENMP_FILES_FOR_VERSION(90 90)
+ endif()
+ if(MSVC10)
+ OPENMP_FILES_FOR_VERSION(10 100)
+ endif()
+ if(MSVC11)
+ OPENMP_FILES_FOR_VERSION(11 110)
+ endif()
+ if(MSVC12)
+ OPENMP_FILES_FOR_VERSION(12 120)
+ endif()
+ if(MSVC14)
+ OPENMP_FILES_FOR_VERSION(14 140)
+ endif()
endif()
foreach(lib
@@ -383,18 +434,18 @@ endif()
if(WATCOM)
get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH )
- if(WATCOM17)
- set( __install__libs ${CompilerPath}/clbr17.dll
- ${CompilerPath}/mt7r17.dll ${CompilerPath}/plbr17.dll )
- endif()
- if(WATCOM18)
- set( __install__libs ${CompilerPath}/clbr18.dll
- ${CompilerPath}/mt7r18.dll ${CompilerPath}/plbr18.dll )
- endif()
- if(WATCOM19)
- set( __install__libs ${CompilerPath}/clbr19.dll
- ${CompilerPath}/mt7r19.dll ${CompilerPath}/plbr19.dll )
+ if(CMAKE_C_COMPILER_VERSION)
+ set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ else()
+ set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
endif()
+ string(REGEX MATCHALL "[0-9]+" _watcom_version_list "${_compiler_version}")
+ list(GET _watcom_version_list 0 _watcom_major)
+ list(GET _watcom_version_list 1 _watcom_minor)
+ set( __install__libs
+ ${CompilerPath}/clbr${_watcom_major}${_watcom_minor}.dll
+ ${CompilerPath}/mt7r${_watcom_major}${_watcom_minor}.dll
+ ${CompilerPath}/plbr${_watcom_major}${_watcom_minor}.dll )
foreach(lib
${__install__libs}
)
diff --git a/Modules/IntelVSImplicitPath/CMakeLists.txt b/Modules/IntelVSImplicitPath/CMakeLists.txt
index 96dc4e6..d115704 100644
--- a/Modules/IntelVSImplicitPath/CMakeLists.txt
+++ b/Modules/IntelVSImplicitPath/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(IntelFortranImplicit Fortran)
add_custom_command(
OUTPUT output.cmake
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
new file mode 100644
index 0000000..abd9a26
--- /dev/null
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -0,0 +1,60 @@
+
+macro(record_compiler_features lang compile_flags feature_list)
+ include("${CMAKE_ROOT}/Modules/Compiler/${CMAKE_${lang}_COMPILER_ID}-${lang}-FeatureTests.cmake" OPTIONAL)
+
+ string(TOLOWER ${lang} lang_lc)
+ file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin")
+ file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" "
+ const char features[] = {\"\"\n")
+
+ get_property(known_features GLOBAL PROPERTY CMAKE_${lang}_KNOWN_FEATURES)
+
+ foreach(feature ${known_features})
+ if (_cmake_feature_test_${feature})
+ if (${_cmake_feature_test_${feature}} STREQUAL 1)
+ set(_feature_condition "\"1\" ")
+ else()
+ set(_feature_condition "#if ${_cmake_feature_test_${feature}}\n\"1\"\n#else\n\"0\"\n#endif\n")
+ endif()
+ file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" "\"${lang}_FEATURE:\"\n${_feature_condition}\"${feature}\\n\"\n")
+ endif()
+ endforeach()
+ file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
+ "\n};\n\nint main(int argc, char** argv) { (void)argv; return features[argc]; }\n")
+
+ try_compile(CMAKE_${lang}_FEATURE_TEST
+ ${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
+ COMPILE_DEFINITIONS "${compile_flags}"
+ OUTPUT_VARIABLE _output
+ COPY_FILE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin"
+ COPY_FILE_ERROR _copy_error
+ )
+ if(CMAKE_${lang}_FEATURE_TEST AND NOT _copy_error)
+ set(_result 0)
+ else()
+ set(_result 255)
+ endif()
+ unset(CMAKE_${lang}_FEATURE_TEST CACHE)
+
+ if (_result EQUAL 0)
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "\n\nDetecting ${lang} [${compile_flags}] compiler features compiled with the following output:\n${_output}\n\n")
+ if(EXISTS "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin")
+ file(STRINGS "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin"
+ features REGEX "${lang}_FEATURE:.*")
+ foreach(info ${features})
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ " Feature record: ${info}\n")
+ string(REPLACE "${lang}_FEATURE:" "" info ${info})
+ string(SUBSTRING ${info} 0 1 has_feature)
+ if(has_feature)
+ string(REGEX REPLACE "^1" "" feature ${info})
+ list(APPEND ${feature_list} ${feature})
+ endif()
+ endforeach()
+ endif()
+ else()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Detecting ${lang} [${compile_flags}] compiler features failed to compile with the following output:\n${_output}\n${_copy_error}\n\n")
+ endif()
+endmacro()
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
new file mode 100644
index 0000000..e6d4fcf
--- /dev/null
+++ b/Modules/Platform/Android.cmake
@@ -0,0 +1,9 @@
+include(Platform/Linux)
+
+# 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)
+
+# Android reportedly ignores RPATH, and we cannot predict the install
+# location anyway.
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
diff --git a/Modules/Platform/Darwin-Clang.cmake b/Modules/Platform/Darwin-Clang.cmake
index 528873c..4cded47 100644
--- a/Modules/Platform/Darwin-Clang.cmake
+++ b/Modules/Platform/Darwin-Clang.cmake
@@ -24,4 +24,7 @@ macro(__darwin_compiler_clang lang)
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=")
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.1)
+ set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
+ endif()
endmacro()
diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake
index 5fee7e3..87d1d23 100644
--- a/Modules/Platform/Darwin-GNU.cmake
+++ b/Modules/Platform/Darwin-GNU.cmake
@@ -23,6 +23,10 @@ macro(__darwin_compiler_gnu lang)
# GNU does not have -shared on OS X
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
+
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.3)
+ set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
+ endif()
endmacro()
macro(cmake_gnu_set_sysroot_flag lang)
diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake
new file mode 100644
index 0000000..62fb985
--- /dev/null
+++ b/Modules/Platform/Darwin-Initialize.cmake
@@ -0,0 +1,151 @@
+# Ask xcode-select where to find /Developer or fall back to ancient location.
+execute_process(COMMAND xcode-select -print-path
+ OUTPUT_VARIABLE _stdout
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _stderr
+ RESULT_VARIABLE _failed)
+if(NOT _failed AND IS_DIRECTORY ${_stdout})
+ set(OSX_DEVELOPER_ROOT ${_stdout})
+elseif(IS_DIRECTORY "/Developer")
+ set(OSX_DEVELOPER_ROOT "/Developer")
+else()
+ set(OSX_DEVELOPER_ROOT "")
+endif()
+
+execute_process(COMMAND sw_vers -productVersion
+ OUTPUT_VARIABLE CURRENT_OSX_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+# Save CMAKE_OSX_ARCHITECTURES from the environment.
+set(CMAKE_OSX_ARCHITECTURES "$ENV{CMAKE_OSX_ARCHITECTURES}" CACHE STRING
+ "Build architectures for OSX")
+
+#----------------------------------------------------------------------------
+# _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ...
+#
+string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1"
+ _CURRENT_OSX_VERSION "${CURRENT_OSX_VERSION}")
+
+#----------------------------------------------------------------------------
+# CMAKE_OSX_DEPLOYMENT_TARGET
+
+# Set cache variable - end user may change this during ccmake or cmake-gui configure.
+if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3)
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING
+ "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.")
+endif()
+
+#----------------------------------------------------------------------------
+# CMAKE_OSX_SYSROOT
+
+if(CMAKE_OSX_SYSROOT)
+ # Use the existing value without further computation to choose a default.
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "${CMAKE_OSX_SYSROOT}")
+elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND
+ (NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}"))
+ # Use the value of SDKROOT from the environment.
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}")
+elseif("${CMAKE_GENERATOR}" MATCHES Xcode
+ OR CMAKE_OSX_DEPLOYMENT_TARGET
+ OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]"
+ OR NOT EXISTS "/usr/include/sys/types.h")
+ # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory.
+ set(_CMAKE_OSX_SDKS_DIR "")
+ if(OSX_DEVELOPER_ROOT)
+ foreach(d Platforms/MacOSX.platform/Developer/SDKs SDKs)
+ file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${d}/*)
+ if(_CMAKE_OSX_SDKS)
+ set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${d})
+ break()
+ endif()
+ endforeach()
+ endif()
+
+ if(_CMAKE_OSX_SDKS_DIR)
+ # Select SDK for current OSX version accounting for the known
+ # specially named SDKs.
+ set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u")
+ set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.3 ".9")
+
+ # find the latest SDK
+ set(_CMAKE_OSX_LATEST_SDK_VERSION "0.0")
+ file(GLOB _CMAKE_OSX_SDKS RELATIVE "${_CMAKE_OSX_SDKS_DIR}" "${_CMAKE_OSX_SDKS_DIR}/MacOSX*.sdk")
+ foreach(_SDK ${_CMAKE_OSX_SDKS})
+ if(_SDK MATCHES "MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk" AND CMAKE_MATCH_1 VERSION_GREATER ${_CMAKE_OSX_LATEST_SDK_VERSION})
+ set(_CMAKE_OSX_LATEST_SDK_VERSION "${CMAKE_MATCH_1}")
+ endif()
+ endforeach()
+
+ # pick an SDK that works
+ set(_CMAKE_OSX_SYSROOT_DEFAULT)
+ foreach(ver ${CMAKE_OSX_DEPLOYMENT_TARGET}
+ ${_CURRENT_OSX_VERSION}
+ ${_CMAKE_OSX_LATEST_SDK_VERSION})
+ set(_CMAKE_OSX_DEPLOYMENT_TARGET ${ver})
+ set(_CMAKE_OSX_SDKS_VER ${_CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CMAKE_OSX_DEPLOYMENT_TARGET}})
+ set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
+ if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_CHECK}")
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SYSROOT_CHECK}")
+ break()
+ endif()
+ endforeach()
+
+ if(CMAKE_OSX_DEPLOYMENT_TARGET AND
+ NOT CMAKE_OSX_DEPLOYMENT_TARGET VERSION_EQUAL ${_CMAKE_OSX_DEPLOYMENT_TARGET})
+ set(_CMAKE_OSX_SDKS_VER ${CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${CMAKE_OSX_DEPLOYMENT_TARGET}})
+ set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
+ message(WARNING
+ "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
+ "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n"
+ "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"."
+ )
+ endif()
+ else()
+ # Assume developer files are in root (such as Xcode 4.5 command-line tools).
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "")
+ endif()
+endif()
+
+# Set cache variable - end user may change this during ccmake or cmake-gui configure.
+# Choose the type based on the current value.
+set(_CMAKE_OSX_SYSROOT_TYPE STRING)
+foreach(v CMAKE_OSX_SYSROOT _CMAKE_OSX_SYSROOT_DEFAULT)
+ if("x${${v}}" MATCHES "/")
+ set(_CMAKE_OSX_SYSROOT_TYPE PATH)
+ break()
+ endif()
+endforeach()
+set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_DEFAULT}" CACHE ${_CMAKE_OSX_SYSROOT_TYPE}
+ "The product will be built against the headers and libraries located inside the indicated SDK.")
+
+# Transform the cached value to something we can use.
+set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}")
+set(_CMAKE_OSX_SYSROOT_PATH "")
+if(CMAKE_OSX_SYSROOT)
+ if("x${CMAKE_OSX_SYSROOT}" MATCHES "/")
+ # This is a path to the SDK. Make sure it exists.
+ if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}")
+ message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n"
+ "because the directory does not exist.")
+ set(CMAKE_OSX_SYSROOT "")
+ set(_CMAKE_OSX_SYSROOT_ORIG "")
+ endif()
+ set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}")
+ else()
+ # Transform the sdk name into a path.
+ execute_process(
+ COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path
+ OUTPUT_VARIABLE _stdout
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _stderr
+ RESULT_VARIABLE _failed
+ )
+ if(NOT _failed AND IS_DIRECTORY "${_stdout}")
+ set(_CMAKE_OSX_SYSROOT_PATH "${_stdout}")
+ # For non-Xcode generators use the path.
+ if(NOT "${CMAKE_GENERATOR}" MATCHES "Xcode")
+ set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}")
+ endif()
+ endif()
+ endif()
+endif()
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index fc3f87e..e5c5f36 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -64,149 +64,14 @@ if(NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
mark_as_advanced(CMAKE_INSTALL_NAME_TOOL)
endif()
-# Ask xcode-select where to find /Developer or fall back to ancient location.
-execute_process(COMMAND xcode-select -print-path
- OUTPUT_VARIABLE _stdout
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE _stderr
- RESULT_VARIABLE _failed)
-if(NOT _failed AND IS_DIRECTORY ${_stdout})
- set(OSX_DEVELOPER_ROOT ${_stdout})
-elseif(IS_DIRECTORY "/Developer")
- set(OSX_DEVELOPER_ROOT "/Developer")
-else()
- set(OSX_DEVELOPER_ROOT "")
-endif()
-
-execute_process(COMMAND sw_vers -productVersion
- OUTPUT_VARIABLE CURRENT_OSX_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-# Save CMAKE_OSX_ARCHITECTURES from the environment.
-set(CMAKE_OSX_ARCHITECTURES "$ENV{CMAKE_OSX_ARCHITECTURES}" CACHE STRING
- "Build architectures for OSX")
-
-#----------------------------------------------------------------------------
-# _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ...
-#
-string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1"
- _CURRENT_OSX_VERSION "${CURRENT_OSX_VERSION}")
-
-#----------------------------------------------------------------------------
-# CMAKE_OSX_DEPLOYMENT_TARGET
-
-# Set cache variable - end user may change this during ccmake or cmake-gui configure.
-if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3)
- set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING
- "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.")
-endif()
-
-#----------------------------------------------------------------------------
-# CMAKE_OSX_SYSROOT
-
-if(CMAKE_OSX_SYSROOT)
- # Use the existing value without further computation to choose a default.
- set(_CMAKE_OSX_SYSROOT_DEFAULT "${CMAKE_OSX_SYSROOT}")
-elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND
- (NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}"))
- # Use the value of SDKROOT from the environment.
- set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}")
-elseif("${CMAKE_GENERATOR}" MATCHES Xcode
- OR CMAKE_OSX_DEPLOYMENT_TARGET
- OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]"
- OR NOT EXISTS "/usr/include/sys/types.h")
- # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory.
- set(_CMAKE_OSX_SDKS_DIR "")
- if(OSX_DEVELOPER_ROOT)
- foreach(d Platforms/MacOSX.platform/Developer/SDKs SDKs)
- file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${d}/*)
- if(_CMAKE_OSX_SDKS)
- set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${d})
- break()
- endif()
- endforeach()
- endif()
-
- if(_CMAKE_OSX_SDKS_DIR)
- # Select SDK for current OSX version accounting for the known
- # specially named SDKs.
- set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u")
- set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.3 ".9")
- if(CMAKE_OSX_DEPLOYMENT_TARGET)
- set(_CMAKE_OSX_SDKS_VER ${CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${CMAKE_OSX_DEPLOYMENT_TARGET}})
- set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
- if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_CHECK}")
- set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SYSROOT_CHECK}")
- else()
- set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}})
- set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
- message(WARNING
- "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
- "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n"
- "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"\n"
- "matching the host OS X version."
- )
- endif()
- else()
- set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}})
- set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
- endif()
- else()
- # Assume developer files are in root (such as Xcode 4.5 command-line tools).
- set(_CMAKE_OSX_SYSROOT_DEFAULT "")
- endif()
-endif()
-
-# Set cache variable - end user may change this during ccmake or cmake-gui configure.
-# Choose the type based on the current value.
-set(_CMAKE_OSX_SYSROOT_TYPE STRING)
-foreach(v CMAKE_OSX_SYSROOT _CMAKE_OSX_SYSROOT_DEFAULT)
- if("x${${v}}" MATCHES "/")
- set(_CMAKE_OSX_SYSROOT_TYPE PATH)
- break()
- endif()
-endforeach()
-set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_DEFAULT}" CACHE ${_CMAKE_OSX_SYSROOT_TYPE}
- "The product will be built against the headers and libraries located inside the indicated SDK.")
-
-# Transform the cached value to something we can use.
-set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}")
-set(_CMAKE_OSX_SYSROOT_PATH "")
-if(CMAKE_OSX_SYSROOT)
- if("x${CMAKE_OSX_SYSROOT}" MATCHES "/")
- # This is a path to the SDK. Make sure it exists.
- if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}")
- message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n"
- "because the directory does not exist.")
- set(CMAKE_OSX_SYSROOT "")
- set(_CMAKE_OSX_SYSROOT_ORIG "")
- endif()
- set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}")
- else()
- # Transform the sdk name into a path.
- execute_process(
- COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path
- OUTPUT_VARIABLE _stdout
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE _stderr
- RESULT_VARIABLE _failed
- )
- if(NOT _failed AND IS_DIRECTORY "${_stdout}")
- set(_CMAKE_OSX_SYSROOT_PATH "${_stdout}")
- # For non-Xcode generators use the path.
- if(NOT "${CMAKE_GENERATOR}" MATCHES "Xcode")
- set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}")
- endif()
- endif()
- endif()
-endif()
-
# Make sure the combination of SDK and Deployment Target are allowed
if(CMAKE_OSX_DEPLOYMENT_TARGET)
- if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "^.*/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk")
+ if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk")
set(_sdk_ver "${CMAKE_MATCH_1}")
elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$")
set(_sdk_ver "${CMAKE_MATCH_1}")
+ elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/")
+ set(_sdk_ver "${_CURRENT_OSX_VERSION}")
else()
message(FATAL_ERROR
"CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
index 825f851..dfc2664 100644
--- a/Modules/Platform/Haiku.cmake
+++ b/Modules/Platform/Haiku.cmake
@@ -21,18 +21,26 @@ set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
# "/boot/system/develop/lib/<subdir>/", which we assume to be the secondary
# architecture specific subdirectory and extract the name of the architecture
# accordingly.
-set(__HAIKU_COMPILER ${CMAKE_C_COMPILER})
-if(NOT __HAIKU_COMPILER)
+# First of all, find a C or C++ compiler we can run. The "arg1" is necessary
+# here for compilers such as "distcc gcc-x86" or "ccache gcc-x86"
+# TODO See CMakeDetermineCompilerId.cmake for some more things we may want to do.
+if(CMAKE_C_COMPILER)
+ set(__HAIKU_COMPILER ${CMAKE_C_COMPILER})
+ string (STRIP "${CMAKE_C_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS)
+else()
set(__HAIKU_COMPILER ${CMAKE_CXX_COMPILER})
+ string (STRIP "${CMAKE_CXX_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS)
endif()
+
execute_process(
- COMMAND ${__HAIKU_COMPILER} -print-search-dirs
+ COMMAND ${__HAIKU_COMPILER} ${__HAIKU_COMPILER_FLAGS} -print-search-dirs
OUTPUT_VARIABLE _HAIKU_SEARCH_DIRS
+ RESULT_VARIABLE _HAIKU_SEARCH_DIRS_FOUND
OUTPUT_STRIP_TRAILING_WHITESPACE)
-string(REGEX MATCH ".*\nlibraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/(:[^\n]*)?\n.*" _dummy "\n${_HAIKU_SEARCH_DIRS}\n")
+string(REGEX MATCH "libraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/?(:?\n+)" _dummy "${_HAIKU_SEARCH_DIRS}\n")
set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}")
if(NOT CMAKE_HAIKU_SECONDARY_ARCH)
@@ -53,14 +61,12 @@ else()
endif()
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
- /boot/common/non-packaged
- /boot/common
+ /boot/system/non-packaged
/boot/system
)
LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
- /boot/common/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
- /boot/common/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ /boot/system/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
/boot/system/develop/headers/os
/boot/system/develop/headers/os/app
/boot/system/develop/headers/os/device
@@ -108,8 +114,7 @@ LIST(APPEND CMAKE_HAIKU_CXX_INCLUDE_DIRECTORIES
LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_HAIKU_C_INCLUDE_DIRECTORIES})
LIST(APPEND CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES
- /boot/common/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
- /boot/common/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ /boot/system/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
/boot/system/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
)
@@ -120,6 +125,6 @@ LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES})
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- set(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH
+ set(CMAKE_INSTALL_PREFIX "/boot/system" CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
endif()
diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake
index 9c3255e..f2ad612 100644
--- a/Modules/Platform/OSF1.cmake
+++ b/Modules/Platform/OSF1.cmake
@@ -2,7 +2,7 @@ set(CMAKE_DL_LIBS "")
if(CMAKE_SYSTEM MATCHES "OSF1-1.[012]")
endif()
-if(CMAKE_SYSTEM MATCHES "OSF1-1.*")
+if(CMAKE_SYSTEM MATCHES "OSF1-1")
# OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fpic")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fpie")
@@ -12,7 +12,7 @@ endif()
-if(CMAKE_SYSTEM MATCHES "OSF1-V.*")
+if(CMAKE_SYSTEM MATCHES "OSF1-V")
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-rpath,")
diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake
index 53cabed..7ac6c7e 100644
--- a/Modules/Platform/OpenBSD.cmake
+++ b/Modules/Platform/OpenBSD.cmake
@@ -10,13 +10,29 @@ if(NOT CMAKE_PLATFORM_RUNTIME_PATH)
ERROR_QUIET)
string(REGEX REPLACE ".*search\\ directories:\\ ([^\n]*).*" "\\1"
LDCONFIG_HINTS "${LDCONFIG_HINTS}")
- string(REGEX REPLACE ":" ";"
+ string(REPLACE ":" ";"
CMAKE_PLATFORM_RUNTIME_PATH
"${LDCONFIG_HINTS}")
endif()
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1)
+# OpenBSD has no multilib
+set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
+
# OpenBSD policy requires that shared libraries be installed without
# executable permission.
set(CMAKE_INSTALL_SO_NO_EXE 1)
+
+if($ENV{LOCALBASE})
+ set(OPENBSD_LOCALBASE $ENV{LOCALBASE})
+else()
+ set(OPENBSD_LOCALBASE /usr/local)
+endif()
+if($ENV{X11BASE})
+ set(OPENBSD_X11BASE $ENV{X11BASE})
+else()
+ set(OPENBSD_X11BASE /usr/X11R6)
+endif()
+
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${OPENBSD_LOCALBASE})
diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake
index da20f97..aaa79c4 100644
--- a/Modules/Platform/SunOS.cmake
+++ b/Modules/Platform/SunOS.cmake
@@ -1,4 +1,4 @@
-if(CMAKE_SYSTEM MATCHES "SunOS-4.*")
+if(CMAKE_SYSTEM MATCHES "SunOS-4")
set(CMAKE_C_COMPILE_OPTIONS_PIC "-PIC")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-PIE")
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC")
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 872755c..ffc5657 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -67,8 +67,8 @@ macro(__windows_compiler_gnu lang)
if(MSYS OR MINGW)
# Create archiving rules to support large object file lists for static libraries.
- set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
- set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
# Initialize C link type selection flags. These flags are used when
@@ -87,6 +87,7 @@ macro(__windows_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE})
+ set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES ${__WINDOWS_GNU_LD_RESPONSE})
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
# We prefer "@" for response files but it is not supported by gcc 3.
@@ -103,16 +104,18 @@ macro(__windows_compiler_gnu lang)
endif()
# The GNU 3.x compilers do not support response files (only linkers).
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 0)
- elseif(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS)
+ # Link libraries are generated only for the front-end.
+ set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
+ else()
# Use "@" to pass the response file to the front-end.
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
endif()
# Binary link rules.
set(CMAKE_${lang}_CREATE_SHARED_MODULE
- "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
+ "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
- "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
+ "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
set(CMAKE_${lang}_LINK_EXECUTABLE
"<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index cfef536..a72f946 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -36,13 +36,10 @@ else()
set(CMAKE_CL_NOLOGO "/nologo")
endif()
-set(WIN32 1)
-
-if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
+if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE")
set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup")
set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup")
set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce")
- set(WINCE 1)
else()
set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
@@ -87,6 +84,7 @@ if(NOT MSVC_VERSION)
set(MSVC10)
set(MSVC11)
set(MSVC12)
+ set(MSVC14)
set(MSVC60)
set(MSVC70)
set(MSVC71)
@@ -94,7 +92,9 @@ if(NOT MSVC_VERSION)
set(MSVC90)
set(CMAKE_COMPILER_2005)
set(CMAKE_COMPILER_SUPPORTS_PDBTYPE)
- if(NOT "${_compiler_version}" VERSION_LESS 18)
+ if(NOT "${_compiler_version}" VERSION_LESS 19)
+ set(MSVC14 1)
+ elseif(NOT "${_compiler_version}" VERSION_LESS 18)
set(MSVC12 1)
elseif(NOT "${_compiler_version}" VERSION_LESS 17)
set(MSVC11 1)
@@ -162,10 +162,23 @@ if(WINCE)
if (MSVC_VERSION LESS 1600)
set(CMAKE_C_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT} corelibc.lib")
endif ()
+elseif(WINDOWS_PHONE OR WINDOWS_STORE)
+ set(_PLATFORM_DEFINES "/DWIN32")
+ set(_FLAGS_C " /DUNICODE /D_UNICODE")
+ set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc")
+ if(WINDOWS_PHONE)
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib")
+ elseif(MSVC_C_ARCHITECTURE_ID STREQUAL ARM OR MSVC_CXX_ARCHITECTURE_ID STREQUAL ARM)
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib")
+ else()
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
+ endif()
else()
set(_PLATFORM_DEFINES "/DWIN32")
- if(MSVC_VERSION GREATER 1310)
+ if(MSVC_C_ARCHITECTURE_ID STREQUAL ARM OR MSVC_CXX_ARCHITECTURE_ID STREQUAL ARM)
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib")
+ elseif(MSVC_VERSION GREATER 1310)
set(_RTC1 "/RTC1")
set(_FLAGS_CXX " /GR /EHsc")
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
@@ -199,10 +212,12 @@ unset(_MACHINE_ARCH_FLAG)
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
# on versions that support it
set( MSVC_INCREMENTAL_YES_FLAG "")
-if(NOT MSVC_INCREMENTAL_DEFAULT)
- set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
-else()
- set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" )
+if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE)
+ if(NOT MSVC_INCREMENTAL_DEFAULT)
+ set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
+ else()
+ set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" )
+ endif()
endif()
if (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
@@ -243,7 +258,7 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
set(CMAKE_${lang}_COMPILE_OBJECT
- "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<OBJECT_DIR>/${_FS_${lang}} -c <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<TARGET_COMPILE_PDB>${_FS_${lang}} -c <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
"<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
@@ -258,4 +273,5 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
+ set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON)
endmacro()
diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake
index 8dfb610..211cc9d 100644
--- a/Modules/Platform/Windows-df.cmake
+++ b/Modules/Platform/Windows-df.cmake
@@ -26,7 +26,6 @@ set(CMAKE_Fortran_COMPILE_OBJECT
set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
-set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link")
set(CMAKE_Fortran_LINK_EXECUTABLE
"<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /exe:<TARGET> <OBJECTS> /link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake
index 8a03b29..ac410de 100644
--- a/Modules/Platform/Windows-wcl386.cmake
+++ b/Modules/Platform/Windows-wcl386.cmake
@@ -12,13 +12,15 @@ else()
set(CMAKE_LIB_QUIET "-q")
endif()
+set(CMAKE_EXE_LINKER_FLAGS_INIT)
set(CMAKE_CREATE_WIN32_EXE "system nt_win" )
set(CMAKE_CREATE_CONSOLE_EXE "system nt" )
-
-set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "debug all" )
-set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "debug all" )
-set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" )
-set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" )
+set(CMAKE_SHARED_LINKER_FLAGS_INIT "system nt_dll")
+set(CMAKE_MODULE_LINKER_FLAGS_INIT "system nt_dll")
+foreach(type SHARED MODULE EXE)
+ set(CMAKE_${type}_LINKER_FLAGS_DEBUG_INIT "debug all opt map, symfile")
+ set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all opt map, symfile")
+endforeach()
set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated string.
@@ -26,50 +28,54 @@ set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated st
set(CMAKE_RC_COMPILER "rc" )
set(CMAKE_BUILD_TYPE_INIT Debug)
-set (CMAKE_CXX_FLAGS_INIT "-w=3 -xs")
-set (CMAKE_CXX_FLAGS_DEBUG_INIT "-br -bm -d2")
-set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG")
-set (CMAKE_CXX_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG")
-set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG")
-set (CMAKE_C_FLAGS_INIT "-w=3 ")
-set (CMAKE_C_FLAGS_DEBUG_INIT "-br -bm -d2 -od")
-set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG")
-set (CMAKE_C_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG")
-set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG")
-set (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib")
-set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
+
+# 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")
+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")
+endforeach()
+
+foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE)
+ set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1)
+ set(CMAKE_CXX_${type}_USE_WATCOM_QUOTE 1)
+endforeach()
set(CMAKE_C_CREATE_IMPORT_LIBRARY
- "wlib -c -q -n -b <TARGET_IMPLIB> +'<TARGET_UNQUOTED>'")
+ "wlib -c -q -n -b <TARGET_IMPLIB> +<TARGET_QUOTED>")
set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY})
set(CMAKE_C_LINK_EXECUTABLE
- "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+ "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE})
# compile a C++ file into an object file
set(CMAKE_CXX_COMPILE_OBJECT
- "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
# compile a C file into an object file
set(CMAKE_C_COMPILE_OBJECT
- "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}")
# preprocess a C source file
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE
- "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>${CMAKE_END_TEMP_FILE}")
# preprocess a C++ source file
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE
- "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
-set(CMAKE_CXX_CREATE_SHARED_MODULE
- "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
- ${CMAKE_CXX_CREATE_SHARED_MODULE}
- ${CMAKE_CXX_CREATE_IMPORT_LIBRARY})
+ "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> option implib=<TARGET_IMPLIB> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+string(REPLACE " option implib=<TARGET_IMPLIB>" ""
+ CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
# create a C shared library
set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
@@ -78,7 +84,7 @@ set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE})
# create a C++ static library
-set(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b '<TARGET_UNQUOTED>' <LINK_FLAGS> <OBJECTS> ")
+set(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b <TARGET_QUOTED> <LINK_FLAGS> <OBJECTS> ")
# create a C static library
set(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY})
@@ -87,23 +93,27 @@ if(NOT _CMAKE_WATCOM_VERSION)
set(_CMAKE_WATCOM_VERSION 1)
if(CMAKE_C_COMPILER_VERSION)
set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ set(_compiler_id ${CMAKE_C_COMPILER_ID})
else()
set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
+ set(_compiler_id ${CMAKE_CXX_COMPILER_ID})
endif()
set(WATCOM16)
set(WATCOM17)
set(WATCOM18)
set(WATCOM19)
- if("${_compiler_version}" LESS 12.70)
- set(WATCOM16 1)
- endif()
- if("${_compiler_version}" EQUAL 12.70)
- set(WATCOM17 1)
- endif()
- if("${_compiler_version}" EQUAL 12.80)
- set(WATCOM18 1)
- endif()
- if("${_compiler_version}" EQUAL 12.90)
- set(WATCOM19 1)
+ if("${_compiler_id}" STREQUAL "OpenWatcom")
+ if("${_compiler_version}" VERSION_LESS 1.7)
+ set(WATCOM16 1)
+ endif()
+ if("${_compiler_version}" VERSION_EQUAL 1.7)
+ set(WATCOM17 1)
+ endif()
+ if("${_compiler_version}" VERSION_EQUAL 1.8)
+ set(WATCOM18 1)
+ endif()
+ if("${_compiler_version}" VERSION_EQUAL 1.9)
+ set(WATCOM19 1)
+ endif()
endif()
endif()
diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake
index b158a9d..9a937a7 100644
--- a/Modules/Platform/Windows.cmake
+++ b/Modules/Platform/Windows.cmake
@@ -1,5 +1,13 @@
set(WIN32 1)
+if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE")
+ set(WINCE 1)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
+ set(WINDOWS_PHONE 1)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set(WINDOWS_STORE 1)
+endif()
+
set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib
diff --git a/Modules/Platform/WindowsCE-MSVC.cmake b/Modules/Platform/WindowsCE-MSVC.cmake
deleted file mode 100644
index d28b4ab..0000000
--- a/Modules/Platform/WindowsCE-MSVC.cmake
+++ /dev/null
@@ -1 +0,0 @@
-include(Platform/Windows-MSVC)
diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake
index 3240c23..658de3b 100644
--- a/Modules/Platform/WindowsPaths.cmake
+++ b/Modules/Platform/WindowsPaths.cmake
@@ -56,9 +56,10 @@ else()
if(DEFINED "ENV{ProgramFiles}")
list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}")
endif()
- if(DEFINED "ENV{ProgramFiles(x86)}")
+ set(programfilesx86 "ProgramFiles(x86)")
+ if(DEFINED "ENV{${programfilesx86}}")
# 64-bit binary. 32-bit program files are in ProgramFiles(x86).
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles(x86)}")
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{${programfilesx86}}")
elseif(DEFINED "ENV{SystemDrive}")
# Guess the 32-bit program files location.
if(EXISTS "$ENV{SystemDrive}/Program Files (x86)")
diff --git a/Modules/Platform/WindowsPhone-MSVC-C.cmake b/Modules/Platform/WindowsPhone-MSVC-C.cmake
new file mode 100644
index 0000000..ce8060b
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-MSVC-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-C)
diff --git a/Modules/Platform/WindowsPhone-MSVC-CXX.cmake b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake
new file mode 100644
index 0000000..281eadc
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-CXX)
diff --git a/Modules/Platform/WindowsPhone.cmake b/Modules/Platform/WindowsPhone.cmake
new file mode 100644
index 0000000..65b2eae
--- /dev/null
+++ b/Modules/Platform/WindowsPhone.cmake
@@ -0,0 +1 @@
+include(Platform/Windows)
diff --git a/Modules/Platform/WindowsStore-MSVC-C.cmake b/Modules/Platform/WindowsStore-MSVC-C.cmake
new file mode 100644
index 0000000..ce8060b
--- /dev/null
+++ b/Modules/Platform/WindowsStore-MSVC-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-C)
diff --git a/Modules/Platform/WindowsStore-MSVC-CXX.cmake b/Modules/Platform/WindowsStore-MSVC-CXX.cmake
new file mode 100644
index 0000000..281eadc
--- /dev/null
+++ b/Modules/Platform/WindowsStore-MSVC-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-CXX)
diff --git a/Modules/Platform/WindowsStore.cmake b/Modules/Platform/WindowsStore.cmake
new file mode 100644
index 0000000..65b2eae
--- /dev/null
+++ b/Modules/Platform/WindowsStore.cmake
@@ -0,0 +1 @@
+include(Platform/Windows)
diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index 0fe0b32..8f21adf 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -103,7 +103,23 @@ function(ProcessorCount var)
OUTPUT_VARIABLE machinfo_output)
string(REGEX MATCHALL "Number of CPUs = ([0-9]+)" procs "${machinfo_output}")
set(count "${CMAKE_MATCH_1}")
+ if(NOT count)
+ string(REGEX MATCHALL "([0-9]+) logical processors" procs "${machinfo_output}")
+ set(count "${CMAKE_MATCH_1}")
+ endif()
#message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'")
+ else()
+ find_program(ProcessorCount_cmd_mpsched mpsched)
+ mark_as_advanced(ProcessorCount_cmd_mpsched)
+ if(ProcessorCount_cmd_mpsched)
+ execute_process(COMMAND ${ProcessorCount_cmd_mpsched} -s
+ OUTPUT_QUIET
+ ERROR_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE mpsched_output)
+ string(REGEX MATCHALL "Processor Count *: *([0-9]+)" procs "${mpsched_output}")
+ set(count "${CMAKE_MATCH_1}")
+ #message("ProcessorCount: trying mpsched -s '${ProcessorCount_cmd_mpsched}'")
+ endif()
endif()
endif()
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index 5ada030..8c4daac 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -65,8 +65,8 @@ macro (QT4_MAKE_OUTPUT_FILE infile prefix ext outfile )
else()
file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
endif()
- if(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path
- string(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}")
+ if(WIN32 AND rel MATCHES "^([a-zA-Z]):(.*)$") # absolute path
+ set(rel "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
endif()
set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
string(REPLACE ".." "__" _outfile ${_outfile})
@@ -135,13 +135,15 @@ function (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target
set(targetincludes)
set(targetdefines)
else()
- file(WRITE ${_moc_parameters_file} "${_moc_parameters}\n")
+ set(CMAKE_CONFIGURABLE_FILE_CONTENT "${_moc_parameters}")
+ configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
+ "${_moc_parameters_file}" @ONLY)
endif()
set(_moc_extra_parameters_file @${_moc_parameters_file})
add_custom_command(OUTPUT ${outfile}
COMMAND Qt4::moc ${_moc_extra_parameters_file}
- DEPENDS ${infile}
+ DEPENDS ${infile} ${_moc_parameters_file}
${_moc_working_dir}
VERBATIM)
endfunction ()
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake
index 6f32b08..fcb41ab 100644
--- a/Modules/TestBigEndian.cmake
+++ b/Modules/TestBigEndian.cmake
@@ -25,7 +25,7 @@
# License text for the above reference.)
macro(TEST_BIG_ENDIAN VARIABLE)
- if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+ if(NOT DEFINED HAVE_${VARIABLE})
message(STATUS "Check if the system is big endian")
message(STATUS "Searching 16 bit integer")
diff --git a/Modules/TestForANSIForScope.cmake b/Modules/TestForANSIForScope.cmake
index de4b1f1..78fff9f 100644
--- a/Modules/TestForANSIForScope.cmake
+++ b/Modules/TestForANSIForScope.cmake
@@ -24,7 +24,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-if("CMAKE_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$")
+if(NOT DEFINED CMAKE_ANSI_FOR_SCOPE)
message(STATUS "Check for ANSI scope")
try_compile(CMAKE_ANSI_FOR_SCOPE ${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx
diff --git a/Modules/TestForSSTREAM.cmake b/Modules/TestForSSTREAM.cmake
index 8977583..fe18ea2 100644
--- a/Modules/TestForSSTREAM.cmake
+++ b/Modules/TestForSSTREAM.cmake
@@ -23,7 +23,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-if("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$")
+if(NOT DEFINED CMAKE_HAS_ANSI_STRING_STREAM)
message(STATUS "Check for sstream")
try_compile(CMAKE_HAS_ANSI_STRING_STREAM ${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/TestForSSTREAM.cxx
diff --git a/Modules/TestForSTDNamespace.cmake b/Modules/TestForSTDNamespace.cmake
index e43b75d..0d90774 100644
--- a/Modules/TestForSTDNamespace.cmake
+++ b/Modules/TestForSTDNamespace.cmake
@@ -23,7 +23,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-if("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$")
+if(NOT DEFINED CMAKE_STD_NAMESPACE)
message(STATUS "Check for STD namespace")
try_compile(CMAKE_STD_NAMESPACE ${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 654b4d0..127012f 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -426,6 +426,7 @@ function(add_jar _TARGET_NAME)
set(_JAVA_DEPENDS)
set(_JAVA_COMPILE_DEPENDS)
set(_JAVA_RESOURCE_FILES)
+ set(_JAVA_RESOURCE_FILES_RELATIVE)
foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES})
get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT)
get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE)
@@ -462,7 +463,8 @@ function(add_jar _TARGET_NAME)
__java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE}
${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE}
"Copying ${_JAVA_SOURCE_FILE} to the build directory")
- list(APPEND _JAVA_RESOURCE_FILES ${_JAVA_SOURCE_FILE})
+ list(APPEND _JAVA_RESOURCE_FILES ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE})
+ list(APPEND _JAVA_RESOURCE_FILES_RELATIVE ${_JAVA_SOURCE_FILE})
endif ()
endforeach()
@@ -529,7 +531,7 @@ function(add_jar _TARGET_NAME)
OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE}
-cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE}
- ${_JAVA_RESOURCE_FILES} @java_class_filelist
+ ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist
COMMAND ${CMAKE_COMMAND}
-D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR}
-D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}
@@ -549,7 +551,7 @@ function(add_jar _TARGET_NAME)
OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE}
-cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE}
- ${_JAVA_RESOURCE_FILES} @java_class_filelist
+ ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist
COMMAND ${CMAKE_COMMAND}
-D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR}
-D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}
diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake
index 7478310..cba22af 100644
--- a/Modules/UseQt4.cmake
+++ b/Modules/UseQt4.cmake
@@ -98,7 +98,9 @@ foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
include_directories(SYSTEM ${QT_${module}_INCLUDE_DIR})
endif(QT_INCLUDE_DIRS_NO_SYSTEM)
endif()
- set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
+ if(QT_USE_${module} OR QT_IS_STATIC)
+ set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
+ endif()
set(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS})
if(QT_IS_STATIC)
set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES})
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index f8eeef6..31ab48d 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -2,9 +2,7 @@
# UseSWIG
# -------
#
-# SWIG module for CMake
-#
-# Defines the following macros:
+# Defines the following macros for use with SWIG:
#
# ::
#
@@ -13,20 +11,38 @@
# SWIG_LINK_LIBRARIES(name [ libraries ])
# - Link libraries to swig module
#
-# All other macros are for internal use only. To get the actual name of
-# the swig module, use: ${SWIG_MODULE_${name}_REAL_NAME}. Set Source
-# files properties such as CPLUSPLUS and SWIG_FLAGS to specify special
-# behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add
-# special flags to all swig calls. Another special variable is
-# CMAKE_SWIG_OUTDIR, it allows one to specify where to write all the
-# swig generated module (swig -outdir option) The name-specific variable
-# SWIG_MODULE_<name>_EXTRA_DEPS may be used to specify extra
-# dependencies for the generated modules. If the source file generated
-# by swig need some special flag you can use::
+# Source files properties on module files can be set before the invocation
+# of the SWIG_ADD_MODULE macro to specify special behavior of SWIG.
#
-# set_source_files_properties( ${swig_generated_file_fullname}
-# PROPERTIES COMPILE_FLAGS "-bla")
-
+# The source file property CPLUSPLUS calls SWIG in c++ mode, e.g.::
+#
+# set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON)
+# swig_add_module(mymod python mymod.i)
+#
+# The source file property SWIG_FLAGS adds custom flags to the SWIG executable.
+#
+# The source-file property SWIG_MODULE_NAME have to be provided to specify the actual
+# import name of the module in the target language if it cannot be scanned automatically
+# from source or different from the module file basename.::
+#
+# set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname)
+#
+# To get the name of the swig module target library, use: ${SWIG_MODULE_${name}_REAL_NAME}.
+#
+# Also some variables can be set to specify special behavior of SWIG.
+#
+# CMAKE_SWIG_FLAGS can be used to add special flags to all swig calls.
+#
+# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify
+# where to write all the swig generated module (swig -outdir option)
+#
+# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used to specify extra
+# dependencies for the generated modules.
+#
+# If the source file generated by swig need some special flag you can use::
+#
+# set_source_files_properties( ${swig_generated_file_fullname}
+# PROPERTIES COMPILE_FLAGS "-bla")
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
@@ -86,7 +102,30 @@ macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
get_source_file_property(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename
${infile} SWIG_MODULE_NAME)
if(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND")
- get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE)
+
+ # try to get module name from "%module foo" syntax
+ if ( EXISTS ${infile} )
+ file ( STRINGS ${infile} _MODULE_NAME REGEX "[ ]*%module[ ]*[a-zA-Z0-9_]+.*" )
+ endif ()
+ if ( _MODULE_NAME )
+ string ( REGEX REPLACE "[ ]*%module[ ]*([a-zA-Z0-9_]+).*" "\\1" _MODULE_NAME "${_MODULE_NAME}" )
+ set(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${_MODULE_NAME}")
+
+ else ()
+ # try to get module name from "%module (options=...) foo" syntax
+ if ( EXISTS ${infile} )
+ file ( STRINGS ${infile} _MODULE_NAME REGEX "[ ]*%module[ ]*\\(.*\\)[ ]*[a-zA-Z0-9_]+.*" )
+ endif ()
+ if ( _MODULE_NAME )
+ string ( REGEX REPLACE "[ ]*%module[ ]*\\(.*\\)[ ]*([a-zA-Z0-9_]+).*" "\\1" _MODULE_NAME "${_MODULE_NAME}" )
+ set(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${_MODULE_NAME}")
+
+ else ()
+ # fallback to file basename
+ get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename ${infile} NAME_WE)
+ endif ()
+ endif ()
+
endif()
foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION})
set(${outfiles} ${${outfiles}}
@@ -181,7 +220,7 @@ macro(SWIG_ADD_MODULE name language)
set(swig_dot_i_sources)
set(swig_other_sources)
foreach(it ${ARGN})
- if(${it} MATCHES ".*\\.i$")
+ if(${it} MATCHES "\\.i$")
set(swig_dot_i_sources ${swig_dot_i_sources} "${it}")
else()
set(swig_other_sources ${swig_other_sources} "${it}")
@@ -200,10 +239,13 @@ macro(SWIG_ADD_MODULE name language)
MODULE
${swig_generated_sources}
${swig_other_sources})
+ set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES NO_SONAME ON)
string(TOLOWER "${language}" swig_lowercase_language)
if ("${swig_lowercase_language}" STREQUAL "octave")
set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".oct")
+ elseif ("${swig_lowercase_language}" STREQUAL "go")
+ set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
elseif ("${swig_lowercase_language}" STREQUAL "java")
if (APPLE)
# In java you want:
@@ -214,6 +256,8 @@ macro(SWIG_ADD_MODULE name language)
# Linux : libLIBRARY.so
set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib")
endif ()
+ elseif ("${swig_lowercase_language}" STREQUAL "lua")
+ set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
elseif ("${swig_lowercase_language}" STREQUAL "python")
# this is only needed for the python case where a _modulename.so is generated
set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
diff --git a/Modules/UseVTKConfig40.cmake b/Modules/UseVTKConfig40.cmake
index 554b8c4..c5022e4 100644
--- a/Modules/UseVTKConfig40.cmake
+++ b/Modules/UseVTKConfig40.cmake
@@ -312,7 +312,7 @@ else()
if(CMAKE_ANSI_CFLAGS)
set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
endif()
- if(CMAKE_SYSTEM MATCHES "OSF1-V.*")
+ if(CMAKE_SYSTEM MATCHES "OSF1-V")
set(VTK_REQUIRED_CXX_FLAGS
"${VTK_REQUIRED_CXX_FLAGS} -timplicit_local -no_implicit_include")
endif()
diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake
index f2f260d..b3633a6 100644
--- a/Modules/UsewxWidgets.cmake
+++ b/Modules/UsewxWidgets.cmake
@@ -88,8 +88,11 @@ if (wxWidgets_FOUND)
endif()
if (wxWidgets_CXX_FLAGS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
- MSG("wxWidgets_CXX_FLAGS=${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}")
+ MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS_str}")
+ unset(wxWidgets_CXX_FLAGS_str)
endif()
# DEPRECATED JW
diff --git a/Modules/WIX.template.in b/Modules/WIX.template.in
index 59a75c7..bbb7c88 100644
--- a/Modules/WIX.template.in
+++ b/Modules/WIX.template.in
@@ -40,5 +40,7 @@
<FeatureRef Id="ProductFeature"/>
<UIRef Id="$(var.CPACK_WIX_UI_REF)" />
+
+ <?include "properties.wxi"?>
</Product>
</Wix>
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
new file mode 100644
index 0000000..86137e2
--- /dev/null
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -0,0 +1,535 @@
+#.rst:
+# WriteCompilerDetectionHeader
+# ----------------------------
+#
+# This module provides the function write_compiler_detection_header().
+#
+# The ``WRITE_COMPILER_DETECTION_HEADER`` function can be used to generate
+# a file suitable for preprocessor inclusion which contains macros to be
+# used in source code::
+#
+# write_compiler_detection_header(
+# FILE <file>
+# PREFIX <prefix>
+# COMPILERS <compiler> [...]
+# FEATURES <feature> [...]
+# [VERSION <version>]
+# [PROLOG <prolog>]
+# [EPILOG <epilog>]
+# )
+#
+# The ``write_compiler_detection_header`` function generates the
+# file ``<file>`` with macros which all have the prefix ``<prefix>``.
+#
+# ``VERSION`` may be used to specify the API version to be generated.
+# Future versions of CMake may introduce alternative APIs. A given
+# API is selected by any ``<version>`` value greater than or equal
+# to the version of CMake that introduced the given API and less
+# than the version of CMake that introduced its succeeding API.
+# The value of the :variable:`CMAKE_MINIMUM_REQUIRED_VERSION`
+# variable is used if no explicit version is specified.
+# (As of CMake version |release| there is only one API version.)
+#
+# ``PROLOG`` may be specified as text content to write at the start of the
+# header. ``EPILOG`` may be specified as text content to write at the end
+# of the header
+#
+# At least one ``<compiler>`` and one ``<feature>`` must be listed. Compilers
+# which are known to CMake, but not specified are detected and a preprocessor
+# ``#error`` is generated for them. A preprocessor macro matching
+# ``<PREFIX>_COMPILER_IS_<compiler>`` is generated for each compiler
+# known to CMake to contain the value ``0`` or ``1``.
+#
+# Possible compiler identifiers are documented with the
+# :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
+# Available features in this version of CMake are listed in the
+# :prop_gbl:`CMAKE_C_KNOWN_FEATURES` and
+# :prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` global properties.
+#
+# See the :manual:`cmake-compile-features(7)` manual for information on
+# compile features.
+#
+# Feature Test Macros
+# ===================
+#
+# For each compiler, a preprocessor macro is generated matching
+# ``<PREFIX>_COMPILER_IS_<compiler>`` which has the content either ``0``
+# or ``1``, depending on the compiler in use. Preprocessor macros for
+# compiler version components are generated matching
+# ``<PREFIX>_COMPILER_VERSION_MAJOR`` ``<PREFIX>_COMPILER_VERSION_MINOR``
+# and ``<PREFIX>_COMPILER_VERSION_PATCH`` containing decimal values
+# for the corresponding compiler version components, if defined.
+#
+# A preprocessor test is generated based on the compiler version
+# denoting whether each feature is enabled. A preprocessor macro
+# matching ``<PREFIX>_COMPILER_<FEATURE>``, where ``<FEATURE>`` is the
+# upper-case ``<feature>`` name, is generated to contain the value
+# ``0`` or ``1`` depending on whether the compiler in use supports the
+# feature:
+#
+# .. code-block:: cmake
+#
+# write_compiler_detection_header(
+# FILE climbingstats_compiler_detection.h
+# PREFIX ClimbingStats
+# COMPILERS GNU Clang MSVC
+# FEATURES cxx_variadic_templates
+# )
+#
+# .. code-block:: c++
+#
+# #if ClimbingStats_COMPILER_CXX_VARIADIC_TEMPLATES
+# template<typename... T>
+# void someInterface(T t...) { /* ... */ }
+# #else
+# // Compatibility versions
+# template<typename T1>
+# void someInterface(T1 t1) { /* ... */ }
+# template<typename T1, typename T2>
+# void someInterface(T1 t1, T2 t2) { /* ... */ }
+# template<typename T1, typename T2, typename T3>
+# void someInterface(T1 t1, T2 t2, T3 t3) { /* ... */ }
+# #endif
+#
+# Symbol Macros
+# =============
+#
+# Some additional symbol-defines are created for particular features for
+# use as symbols which may be conditionally defined empty:
+#
+# .. code-block:: c++
+#
+# class MyClass ClimbingStats_FINAL
+# {
+# ClimbingStats_CONSTEXPR int someInterface() { return 42; }
+# };
+#
+# The ``ClimbingStats_FINAL`` macro will expand to ``final`` if the
+# compiler (and its flags) support the ``cxx_final`` feature, and the
+# ``ClimbingStats_CONSTEXPR`` macro will expand to ``constexpr``
+# if ``cxx_constexpr`` is supported.
+#
+# The following features generate corresponding symbol defines:
+#
+# ========================== =================================== =================
+# Feature Define Symbol
+# ========================== =================================== =================
+# ``c_restrict`` ``<PREFIX>_RESTRICT`` ``restrict``
+# ``cxx_constexpr`` ``<PREFIX>_CONSTEXPR`` ``constexpr``
+# ``cxx_deleted_functions`` ``<PREFIX>_DELETED_FUNCTION`` ``= delete``
+# ``cxx_extern_templates`` ``<PREFIX>_EXTERN_TEMPLATE`` ``extern``
+# ``cxx_final`` ``<PREFIX>_FINAL`` ``final``
+# ``cxx_noexcept`` ``<PREFIX>_NOEXCEPT`` ``noexcept``
+# ``cxx_noexcept`` ``<PREFIX>_NOEXCEPT_EXPR(X)`` ``noexcept(X)``
+# ``cxx_override`` ``<PREFIX>_OVERRIDE`` ``override``
+# ========================== =================================== =================
+#
+# Compatibility Implementation Macros
+# ===================================
+#
+# Some features are suitable for wrapping in a macro with a backward
+# compatibility implementation if the compiler does not support the feature.
+#
+# When the ``cxx_static_assert`` feature is not provided by the compiler,
+# a compatibility implementation is available via the
+# ``<PREFIX>_STATIC_ASSERT(COND)`` and
+# ``<PREFIX>_STATIC_ASSERT_MSG(COND, MSG)`` function-like macros. The macros
+# expand to ``static_assert`` where that compiler feature is available, and
+# to a compatibility implementation otherwise. In the first form, the
+# condition is stringified in the message field of ``static_assert``. In
+# the second form, the message ``MSG`` is passed to the message field of
+# ``static_assert``, or ignored if using the backward compatibility
+# implementation.
+#
+# The ``cxx_attribute_deprecated`` feature provides a macro definition
+# ``<PREFIX>_DEPRECATED``, which expands to either the standard
+# ``[[deprecated]]`` attribute or a compiler-specific decorator such
+# as ``__attribute__((__deprecated__))`` used by GNU compilers.
+#
+# The ``cxx_alignas`` feature provides a macro definition
+# ``<PREFIX>_ALIGNAS`` which expands to either the standard ``alignas``
+# decorator or a compiler-specific decorator such as
+# ``__attribute__ ((__aligned__))`` used by GNU compilers.
+#
+# The ``cxx_alignof`` feature provides a macro definition
+# ``<PREFIX>_ALIGNOF`` which expands to either the standard ``alignof``
+# decorator or a compiler-specific decorator such as ``__alignof__``
+# used by GNU compilers.
+#
+# ============================= ================================ =====================
+# Feature Define Symbol
+# ============================= ================================ =====================
+# ``cxx_alignas`` ``<PREFIX>_ALIGNAS`` ``alignas``
+# ``cxx_alignof`` ``<PREFIX>_ALIGNOF`` ``alignof``
+# ``cxx_nullptr`` ``<PREFIX>_NULLPTR`` ``nullptr``
+# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT`` ``static_assert``
+# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT_MSG`` ``static_assert``
+# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED`` ``[[deprecated]]``
+# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED_MSG`` ``[[deprecated]]``
+# ============================= ================================ =====================
+#
+# A use-case which arises with such deprecation macros is the deprecation
+# of an entire library. In that case, all public API in the library may
+# be decorated with the ``<PREFIX>_DEPRECATED`` macro. This results in
+# very noisy build output when building the library itself, so the macro
+# may be may be defined to empty in that case when building the deprecated
+# library:
+#
+# .. code-block:: cmake
+#
+# add_library(compat_support ${srcs})
+# target_compile_definitions(compat_support
+# PRIVATE
+# CompatSupport_DEPRECATED=
+# )
+
+#=============================================================================
+# Copyright 2014 Stephen Kelly <steveire@gmail.com>
+#
+# 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.)
+
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerIdDetection.cmake)
+
+function(_load_compiler_variables CompilerId lang)
+ include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-${lang}-FeatureTests.cmake" OPTIONAL)
+ set(_cmake_oldestSupported_${CompilerId} ${_cmake_oldestSupported} PARENT_SCOPE)
+ foreach(feature ${ARGN})
+ set(_cmake_feature_test_${CompilerId}_${feature} ${_cmake_feature_test_${feature}} PARENT_SCOPE)
+ endforeach()
+ include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-DetermineCompiler.cmake" OPTIONAL)
+ set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
+endfunction()
+
+function(write_compiler_detection_header
+ file_keyword file_arg
+ prefix_keyword prefix_arg
+ )
+ if (NOT file_keyword STREQUAL FILE)
+ message(FATAL_ERROR "write_compiler_detection_header: FILE parameter missing.")
+ endif()
+ if (NOT prefix_keyword STREQUAL PREFIX)
+ message(FATAL_ERROR "write_compiler_detection_header: PREFIX parameter missing.")
+ endif()
+ set(options)
+ set(oneValueArgs VERSION EPILOG PROLOG)
+ set(multiValueArgs COMPILERS FEATURES)
+ cmake_parse_arguments(_WCD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if (NOT _WCD_COMPILERS)
+ message(FATAL_ERROR "Invalid arguments. write_compiler_detection_header requires at least one compiler.")
+ endif()
+ if (NOT _WCD_FEATURES)
+ message(FATAL_ERROR "Invalid arguments. write_compiler_detection_header requires at least one feature.")
+ endif()
+
+ if(_WCD_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unparsed arguments: ${_WCD_UNPARSED_ARGUMENTS}")
+ endif()
+
+ if (prefix_arg STREQUAL "")
+ message(FATAL_ERROR "A prefix must be specified")
+ endif()
+ string(MAKE_C_IDENTIFIER ${prefix_arg} cleaned_prefix)
+ if (NOT prefix_arg STREQUAL cleaned_prefix)
+ message(FATAL_ERROR "The prefix must be a valid C identifier.")
+ endif()
+
+ if(NOT _WCD_VERSION)
+ set(_WCD_VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
+ endif()
+ 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.")
+ message(FATAL_ERROR "${err}")
+ endif()
+
+ set(compilers
+ GNU
+ Clang
+ )
+
+ set(_hex_compilers ADSP Borland Embarcadero SunPro)
+
+ foreach(_comp ${_WCD_COMPILERS})
+ list(FIND compilers ${_comp} idx)
+ if (idx EQUAL -1)
+ message(FATAL_ERROR "Unsupported compiler ${_comp}.")
+ endif()
+ if (NOT _need_hex_conversion)
+ list(FIND _hex_compilers ${_comp} idx)
+ if (NOT idx EQUAL -1)
+ set(_need_hex_conversion TRUE)
+ endif()
+ endif()
+ endforeach()
+
+ set(file_content "
+// This is a generated file. Do not edit!
+
+#ifndef ${prefix_arg}_COMPILER_DETECTION_H
+#define ${prefix_arg}_COMPILER_DETECTION_H
+")
+
+ if (_WCD_PROLOG)
+ set(file_content "${file_content}\n${_WCD_PROLOG}\n")
+ endif()
+
+ if (_need_hex_conversion)
+ set(file_content "${file_content}
+#define ${prefix_arg}_DEC(X) (X)
+#define ${prefix_arg}_HEX(X) ( \\
+ ((X)>>28 & 0xF) * 10000000 + \\
+ ((X)>>24 & 0xF) * 1000000 + \\
+ ((X)>>20 & 0xF) * 100000 + \\
+ ((X)>>16 & 0xF) * 10000 + \\
+ ((X)>>12 & 0xF) * 1000 + \\
+ ((X)>>8 & 0xF) * 100 + \\
+ ((X)>>4 & 0xF) * 10 + \\
+ ((X) & 0xF) \\
+ )\n")
+ endif()
+
+ foreach(feature ${_WCD_FEATURES})
+ if (feature MATCHES "^cxx_")
+ list(APPEND _langs CXX)
+ list(APPEND CXX_features ${feature})
+ elseif (feature MATCHES "^c_")
+ list(APPEND _langs C)
+ list(APPEND C_features ${feature})
+ else()
+ message(FATAL_ERROR "Unsupported feature ${feature}.")
+ endif()
+ endforeach()
+ list(REMOVE_DUPLICATES _langs)
+
+ foreach(_lang ${_langs})
+
+ get_property(known_features GLOBAL PROPERTY CMAKE_${_lang}_KNOWN_FEATURES)
+ foreach(feature ${${_lang}_features})
+ list(FIND known_features ${feature} idx)
+ if (idx EQUAL -1)
+ message(FATAL_ERROR "Unsupported feature ${feature}.")
+ endif()
+ endforeach()
+
+ if(_lang STREQUAL CXX)
+ set(file_content "${file_content}\n#ifdef __cplusplus\n")
+ else()
+ set(file_content "${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")
+
+ set(pp_if "if")
+ foreach(compiler ${_WCD_COMPILERS})
+ _load_compiler_variables(${compiler} ${_lang} ${${_lang}_features})
+ set(file_content "${file_content}\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n")
+ set(file_content "${file_content}
+# if !(${_cmake_oldestSupported_${compiler}})
+# error Unsupported compiler version
+# endif\n")
+
+ set(PREFIX ${prefix_arg}_)
+ if (_need_hex_conversion)
+ set(MACRO_DEC ${prefix_arg}_DEC)
+ set(MACRO_HEX ${prefix_arg}_HEX)
+ else()
+ set(MACRO_DEC)
+ set(MACRO_HEX)
+ endif()
+ string(CONFIGURE "${_compiler_id_version_compute_${compiler}}" VERSION_BLOCK @ONLY)
+ set(file_content "${file_content}${VERSION_BLOCK}\n")
+ set(PREFIX)
+ set(MACRO_DEC)
+ set(MACRO_HEX)
+
+ set(pp_if "elif")
+ foreach(feature ${${_lang}_features})
+ string(TOUPPER ${feature} feature_upper)
+ set(feature_PP "COMPILER_${feature_upper}")
+ set(_define_item "\n# define ${prefix_arg}_${feature_PP} 0\n")
+ if (_cmake_feature_test_${compiler}_${feature} STREQUAL "1")
+ set(_define_item "\n# define ${prefix_arg}_${feature_PP} 1\n")
+ elseif (_cmake_feature_test_${compiler}_${feature})
+ set(_define_item "\n# define ${prefix_arg}_${feature_PP} 0\n")
+ set(_define_item "\n# if ${_cmake_feature_test_${compiler}_${feature}}\n# define ${prefix_arg}_${feature_PP} 1\n# else${_define_item}# endif\n")
+ endif()
+ set(file_content "${file_content}${_define_item}")
+ endforeach()
+ endforeach()
+ if(pp_if STREQUAL "elif")
+ set(file_content "${file_content}
+# else
+# error Unsupported compiler
+# endif\n")
+ endif()
+ foreach(feature ${${_lang}_features})
+ string(TOUPPER ${feature} feature_upper)
+ set(feature_PP "COMPILER_${feature_upper}")
+ set(def_name ${prefix_arg}_${feature_PP})
+ if (feature STREQUAL c_restrict)
+ set(def_value "${prefix_arg}_RESTRICT")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} restrict
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_constexpr)
+ set(def_value "${prefix_arg}_CONSTEXPR")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} constexpr
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_final)
+ set(def_value "${prefix_arg}_FINAL")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} final
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_override)
+ set(def_value "${prefix_arg}_OVERRIDE")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} override
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_static_assert)
+ set(def_value "${prefix_arg}_STATIC_ASSERT(X)")
+ set(def_value_msg "${prefix_arg}_STATIC_ASSERT_MSG(X, MSG)")
+ 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")
+ endif()
+ if (feature STREQUAL cxx_alignas)
+ set(def_value "${prefix_arg}_ALIGNAS(X)")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} alignas(X)
+# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang
+# define ${def_value} __attribute__ ((__aligned__(X)))
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_alignof)
+ set(def_value "${prefix_arg}_ALIGNOF(X)")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} alignof(X)
+# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang
+# define ${def_value} __alignof__(X)
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_deleted_functions)
+ set(def_value "${prefix_arg}_DELETED_FUNCTION")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} = delete
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_extern_templates)
+ set(def_value "${prefix_arg}_EXTERN_TEMPLATE")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} extern
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_noexcept)
+ set(def_value "${prefix_arg}_NOEXCEPT")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} noexcept
+# define ${def_value}_EXPR(X) noexcept(X)
+# else
+# define ${def_value}
+# define ${def_value}_EXPR(X)
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_nullptr)
+ set(def_value "${prefix_arg}_NULLPTR")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} nullptr
+# else
+# define ${def_value} static_cast<void*>(0)
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_attribute_deprecated)
+ set(def_name ${prefix_arg}_${feature_PP})
+ set(def_value "${prefix_arg}_DEPRECATED")
+ set(file_content "${file_content}
+# ifndef ${def_value}
+# if ${def_name}
+# define ${def_value} [[deprecated]]
+# define ${def_value}_MSG(MSG) [[deprecated(MSG)]]
+# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang
+# define ${def_value} __attribute__((__deprecated__))
+# define ${def_value}_MSG(MSG) __attribute__((__deprecated__(MSG)))
+# elif ${prefix_arg}_COMPILER_IS_MSVC
+# define ${def_value} __declspec(deprecated)
+# define ${def_value}_MSG(MSG) __declspec(deprecated(MSG))
+# else
+# define ${def_value}
+# define ${def_value}_MSG(MSG)
+# endif
+# endif
+\n")
+ endif()
+ endforeach()
+
+ set(file_content "${file_content}#endif\n")
+
+ endforeach()
+
+ if (_WCD_EPILOG)
+ set(file_content "${file_content}\n${_WCD_EPILOG}\n")
+ endif()
+ set(file_content "${file_content}\n#endif")
+
+ set(CMAKE_CONFIGURABLE_FILE_CONTENT ${file_content})
+ configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
+ "${file_arg}"
+ @ONLY
+ )
+endfunction()