summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:13:15 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:13:15 +0900
commita9a515dd6b7b96484920a3f0f1202393b91dfd2e (patch)
tree62e21c47bbffdc30a405d1ef04f452ee46a384b6 /Modules
parent0375131677cc32a24352f205d05c730690c55af6 (diff)
downloadcmake-a9a515dd6b7b96484920a3f0f1202393b91dfd2e.tar.gz
cmake-a9a515dd6b7b96484920a3f0f1202393b91dfd2e.tar.bz2
cmake-a9a515dd6b7b96484920a3f0f1202393b91dfd2e.zip
Imported Upstream version 3.11.0upstream/3.11.0
Diffstat (limited to 'Modules')
-rw-r--r--Modules/AndroidTestUtilities/PushToAndroidDevice.cmake2
-rw-r--r--Modules/AutogenInfo.cmake.in37
-rw-r--r--Modules/BasicConfigVersion-SameMinorVersion.cmake.in50
-rw-r--r--Modules/CMakeASMInformation.cmake33
-rw-r--r--Modules/CMakeCCompilerId.c.in3
-rw-r--r--Modules/CMakeCInformation.cmake32
-rw-r--r--Modules/CMakeCSharpInformation.cmake58
-rw-r--r--Modules/CMakeCUDAInformation.cmake26
-rw-r--r--Modules/CMakeCXXInformation.cmake29
-rw-r--r--Modules/CMakeCommonLanguageInclude.cmake114
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake6
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake3
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineSwiftCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineSystem.cmake2
-rw-r--r--Modules/CMakeExpandImportedTargets.cmake4
-rw-r--r--Modules/CMakeFindBinUtils.cmake13
-rw-r--r--Modules/CMakeFindCodeBlocks.cmake3
-rw-r--r--Modules/CMakeFindKDevelop3.cmake13
-rw-r--r--Modules/CMakeFindPackageMode.cmake2
-rw-r--r--Modules/CMakeFindSublimeText2.cmake23
-rw-r--r--Modules/CMakeFortranCompilerId.F.in41
-rw-r--r--Modules/CMakeFortranInformation.cmake35
-rw-r--r--Modules/CMakeGenericSystem.cmake2
-rw-r--r--Modules/CMakeInitializeConfigs.cmake39
-rw-r--r--Modules/CMakeJavaInformation.cmake2
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake12
-rw-r--r--Modules/CMakeRCInformation.cmake25
-rw-r--r--Modules/CMakeSystemSpecificInformation.cmake1
-rw-r--r--Modules/CPack.cmake19
-rw-r--r--Modules/CPackComponent.cmake2
-rw-r--r--Modules/CPackDeb.cmake34
-rw-r--r--Modules/CPackIFW.cmake12
-rw-r--r--Modules/CPackRPM.cmake154
-rw-r--r--Modules/CPackWIX.cmake4
-rw-r--r--Modules/CTest.cmake2
-rw-r--r--Modules/CTestTargets.cmake5
-rw-r--r--Modules/CheckCCompilerFlag.cmake1
-rw-r--r--Modules/CheckCSourceCompiles.cmake1
-rw-r--r--Modules/CheckCSourceRuns.cmake2
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake1
-rw-r--r--Modules/CheckCXXSourceCompiles.cmake2
-rw-r--r--Modules/CheckCXXSourceRuns.cmake2
-rw-r--r--Modules/CheckCXXSymbolExists.cmake1
-rw-r--r--Modules/CheckFortranCompilerFlag.cmake1
-rw-r--r--Modules/CheckFortranFunctionExists.cmake2
-rw-r--r--Modules/CheckFortranSourceCompiles.cmake1
-rw-r--r--Modules/CheckFunctionExists.cmake2
-rw-r--r--Modules/CheckIPOSupported.cmake2
-rw-r--r--Modules/CheckIncludeFile.cmake5
-rw-r--r--Modules/CheckIncludeFileCXX.cmake5
-rw-r--r--Modules/CheckIncludeFiles.cmake45
-rw-r--r--Modules/CheckLanguage.cmake8
-rw-r--r--Modules/CheckLibraryExists.cmake2
-rw-r--r--Modules/CheckPrototypeDefinition.cmake4
-rw-r--r--Modules/CheckStructHasMember.cmake1
-rw-r--r--Modules/CheckSymbolExists.cmake2
-rw-r--r--Modules/CheckTypeSize.cmake6
-rw-r--r--Modules/CheckVariableExists.cmake2
-rw-r--r--Modules/Compiler/Clang.cmake3
-rw-r--r--Modules/Compiler/Cray-C.cmake3
-rw-r--r--Modules/Compiler/Cray-CXX.cmake3
-rw-r--r--Modules/Compiler/Cray-Fortran.cmake7
-rw-r--r--Modules/Compiler/Cray.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv.cmake3
-rw-r--r--Modules/Compiler/IAR-FindBinUtils.cmake2
-rw-r--r--Modules/Compiler/IAR.cmake2
-rw-r--r--Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake16
-rw-r--r--Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake16
-rw-r--r--Modules/Compiler/Intel-C.cmake3
-rw-r--r--Modules/Compiler/Intel-CXX-FeatureTests.cmake6
-rw-r--r--Modules/Compiler/Intel-CXX.cmake11
-rw-r--r--Modules/Compiler/MSVC-ASM.cmake1
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake6
-rw-r--r--Modules/Compiler/SunPro-CXX-FeatureTests.cmake6
-rw-r--r--Modules/Compiler/TI-C.cmake2
-rw-r--r--Modules/Compiler/TI-CXX.cmake2
-rw-r--r--Modules/Compiler/XL-C-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/XL-CXX-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/XL.cmake2
-rw-r--r--Modules/DeployQt4.cmake14
-rw-r--r--Modules/Documentation.cmake2
-rw-r--r--Modules/ExternalProject-download.cmake.in2
-rw-r--r--Modules/ExternalProject.cmake99
-rw-r--r--Modules/FeatureSummary.cmake2
-rw-r--r--Modules/FetchContent.cmake916
-rw-r--r--Modules/FetchContent/CMakeLists.cmake.in21
-rw-r--r--Modules/FindAVIFile.cmake10
-rw-r--r--Modules/FindBLAS.cmake85
-rw-r--r--Modules/FindBZip2.cmake2
-rw-r--r--Modules/FindBoost.cmake250
-rw-r--r--Modules/FindCUDA.cmake91
-rw-r--r--Modules/FindCUDA/make2cmake.cmake2
-rw-r--r--Modules/FindCUDA/run_nvcc.cmake6
-rw-r--r--Modules/FindCxxTest.cmake2
-rw-r--r--Modules/FindDCMTK.cmake2
-rw-r--r--Modules/FindDevIL.cmake2
-rw-r--r--Modules/FindDoxygen.cmake64
-rw-r--r--Modules/FindFLEX.cmake2
-rw-r--r--Modules/FindFLTK.cmake378
-rw-r--r--Modules/FindFLTK2.cmake29
-rw-r--r--Modules/FindFreetype.cmake7
-rw-r--r--Modules/FindGDAL.cmake18
-rw-r--r--Modules/FindGIF.cmake6
-rw-r--r--Modules/FindGTK.cmake7
-rw-r--r--Modules/FindGTK2.cmake2
-rw-r--r--Modules/FindHDF5.cmake2
-rw-r--r--Modules/FindICU.cmake21
-rw-r--r--Modules/FindIconv.cmake133
-rw-r--r--Modules/FindImageMagick.cmake13
-rw-r--r--Modules/FindJNI.cmake13
-rw-r--r--Modules/FindJava.cmake34
-rw-r--r--Modules/FindKDE3.cmake3
-rw-r--r--Modules/FindLAPACK.cmake15
-rw-r--r--Modules/FindLibLZMA.cmake2
-rw-r--r--Modules/FindLua50.cmake4
-rw-r--r--Modules/FindMPEG.cmake20
-rw-r--r--Modules/FindMPEG2.cmake20
-rw-r--r--Modules/FindMPI.cmake435
-rw-r--r--Modules/FindMatlab.cmake6
-rw-r--r--Modules/FindOpenCL.cmake8
-rw-r--r--Modules/FindOpenGL.cmake54
-rw-r--r--Modules/FindOpenMP.cmake6
-rw-r--r--Modules/FindOpenSSL.cmake2
-rw-r--r--Modules/FindOpenThreads.cmake18
-rw-r--r--Modules/FindPNG.cmake4
-rw-r--r--Modules/FindPerlLibs.cmake212
-rw-r--r--Modules/FindPike.cmake9
-rw-r--r--Modules/FindPkgConfig.cmake261
-rw-r--r--Modules/FindPostgreSQL.cmake2
-rw-r--r--Modules/FindPythonInterp.cmake3
-rw-r--r--Modules/FindPythonLibs.cmake7
-rw-r--r--Modules/FindQt.cmake12
-rw-r--r--Modules/FindQt3.cmake35
-rw-r--r--Modules/FindQt4.cmake11
-rw-r--r--Modules/FindRuby.cmake24
-rw-r--r--Modules/FindSelfPackers.cmake8
-rw-r--r--Modules/FindSquish.cmake3
-rw-r--r--Modules/FindTCL.cmake53
-rw-r--r--Modules/FindTclStub.cmake2
-rw-r--r--Modules/FindUnixCommands.cmake24
-rw-r--r--Modules/Findosg_functions.cmake18
-rw-r--r--Modules/FindwxWidgets.cmake9
-rw-r--r--Modules/FindwxWindows.cmake7
-rw-r--r--Modules/GNUInstallDirs.cmake2
-rw-r--r--Modules/GenerateExportHeader.cmake9
-rw-r--r--Modules/GetPrerequisites.cmake2
-rw-r--r--Modules/ITKCompatibility.cmake2
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake18
-rw-r--r--Modules/Platform/AIX-GNU.cmake4
-rw-r--r--Modules/Platform/Darwin-Clang.cmake15
-rw-r--r--Modules/Platform/Windows-Flang-Fortran.cmake3
-rw-r--r--Modules/Platform/Windows-MSVC.cmake6
-rw-r--r--Modules/Qt4Macros.cmake2
-rw-r--r--Modules/SelectLibraryConfigurations.cmake7
-rw-r--r--Modules/SquishTestScript.cmake2
-rw-r--r--Modules/UseEcos.cmake2
-rw-r--r--Modules/UseJava.cmake82
-rw-r--r--Modules/UseSWIG.cmake153
-rw-r--r--Modules/WriteBasicConfigVersionFile.cmake2
-rw-r--r--Modules/exportheader.cmake.in2
163 files changed, 3206 insertions, 1694 deletions
diff --git a/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake b/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake
index 04529b10a..fccff6725 100644
--- a/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake
+++ b/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake
@@ -31,7 +31,7 @@ function(android_push_test_files_to_device)
set(out_var ${out_var} PARENT_SCOPE)
if(res_var)
string(REGEX REPLACE ";" " " com "${ARGN}")
- message(FATAL_ERROR "Error occured during adb command: adb ${com}\nError: ${err_var}.")
+ message(FATAL_ERROR "Error occurred during adb command: adb ${com}\nError: ${err_var}.")
endif()
endfunction()
diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in
deleted file mode 100644
index 7f4b398b6..000000000
--- a/Modules/AutogenInfo.cmake.in
+++ /dev/null
@@ -1,37 +0,0 @@
-# Meta
-set(AM_MULTI_CONFIG @_multi_config@)
-# Directories and files
-set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/")
-set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
-set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
-set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
-set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
-set(AM_BUILD_DIR @_build_dir@)
-set(AM_SOURCES @_sources@)
-set(AM_HEADERS @_headers@)
-# Qt environment
-set(AM_QT_VERSION_MAJOR @_qt_version_major@)
-set(AM_QT_VERSION_MINOR @_qt_version_minor@)
-set(AM_QT_MOC_EXECUTABLE @_qt_moc_executable@)
-set(AM_QT_UIC_EXECUTABLE @_qt_uic_executable@)
-set(AM_QT_RCC_EXECUTABLE @_qt_rcc_executable@)
-# MOC settings
-set(AM_MOC_SKIP @_moc_skip@)
-set(AM_MOC_DEFINITIONS @_moc_compile_defs@)
-set(AM_MOC_INCLUDES @_moc_include_dirs@)
-set(AM_MOC_OPTIONS @_moc_options@)
-set(AM_MOC_RELAXED_MODE @_moc_relaxed_mode@)
-set(AM_MOC_MACRO_NAMES @_moc_macro_names@)
-set(AM_MOC_DEPEND_FILTERS @_moc_depend_filters@)
-set(AM_MOC_PREDEFS_CMD @_moc_predefs_cmd@)
-# UIC settings
-set(AM_UIC_SKIP @_uic_skip@)
-set(AM_UIC_TARGET_OPTIONS @_uic_target_options@)
-set(AM_UIC_OPTIONS_FILES @_qt_uic_options_files@)
-set(AM_UIC_OPTIONS_OPTIONS @_qt_uic_options_options@)
-set(AM_UIC_SEARCH_PATHS @_uic_search_paths@)
-# RCC settings
-set(AM_RCC_SOURCES @_rcc_files@)
-set(AM_RCC_BUILDS @_rcc_builds@)
-set(AM_RCC_OPTIONS @_rcc_options@)
-set(AM_RCC_INPUTS @_rcc_inputs@)
diff --git a/Modules/BasicConfigVersion-SameMinorVersion.cmake.in b/Modules/BasicConfigVersion-SameMinorVersion.cmake.in
new file mode 100644
index 000000000..59ca25376
--- /dev/null
+++ b/Modules/BasicConfigVersion-SameMinorVersion.cmake.in
@@ -0,0 +1,50 @@
+# This is a basic version file for the Config-mode of find_package().
+# It is used by write_basic_package_version_file() as input file for configure_file()
+# to create a version-file which can be installed along a config.cmake file.
+#
+# The created file sets PACKAGE_VERSION_EXACT if the current version string and
+# the requested version string are exactly the same and it sets
+# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
+# but only if the requested major and minor versions are the same as the current
+# one.
+# The variable CVF_VERSION must be set before calling configure_file().
+
+
+set(PACKAGE_VERSION "@CVF_VERSION@")
+
+if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+
+ if("@CVF_VERSION@" MATCHES "^([0-9]+)\\.([0-9]+)")
+ set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
+ set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
+ else()
+ set(CVF_VERSION_MAJOR "@CVF_VERSION@")
+ set(CVF_VERSION_MINOR "")
+ endif()
+
+ if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND
+ (PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR))
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ else()
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+ endif()
+
+ if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+endif()
+
+
+# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+ return()
+endif()
+
+# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+ math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
+ set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
+ set(PACKAGE_VERSION_UNSUITABLE TRUE)
+endif()
diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake
index f7cf900fd..125c4e372 100644
--- a/Modules/CMakeASMInformation.cmake
+++ b/Modules/CMakeASMInformation.cmake
@@ -67,38 +67,7 @@ endif()
# Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends:
set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}")
-foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
- string(STRIP "${CMAKE_ASM${ASM_DIALECT}_FLAGS${c}_INIT}" CMAKE_ASM${ASM_DIALECT}_FLAGS${c}_INIT)
-endforeach()
-
-set (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING
- "Flags used by the assembler during all build types.")
-
-if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
- get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
- # default build type is none
- if(NOT _GENERATOR_IS_MULTI_CONFIG AND NOT CMAKE_NO_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
- "Choose the type of build, options are: None, Debug Release RelWithDebInfo MinSizeRel.")
- endif()
- unset(_GENERATOR_IS_MULTI_CONFIG)
- set (CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG "${CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG_INIT}" CACHE STRING
- "Flags used by the assembler during debug builds.")
- set (CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL "${CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Flags used by the assembler during release minsize builds.")
- set (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE_INIT}" CACHE STRING
- "Flags used by the assembler during release builds.")
- set (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Flags used by the assembler during Release with Debug Info builds.")
-endif()
-
-mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_FLAGS
- CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG
- CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL
- CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE
- CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO
- )
-
+cmake_initialize_per_config_variable(CMAKE_ASM${ASM_DIALECT}_FLAGS "Flags used by the ASM${ASM_DIALECT} compiler")
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 10f7318a6..2f6bdb4a7 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -34,7 +34,8 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
@CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
#if !defined(__STDC__)
-# if defined(_MSC_VER) && !defined(__clang__)
+# if (defined(_MSC_VER) && !defined(__clang__)) \
+ || (defined(__ibmxl__) || defined(__IBMC__))
# define C_DIALECT "90"
# else
# define C_DIALECT
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index 71aadb474..1e46cacaa 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -102,30 +102,7 @@ endif()
set(CMAKE_C_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}")
-foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
- string(STRIP "${CMAKE_C_FLAGS${c}_INIT}" CMAKE_C_FLAGS${c}_INIT)
-endforeach()
-
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_INIT}" CACHE STRING
- "Flags used by the compiler during all build types.")
-
-if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
- get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
- # default build type is none
- if(NOT _GENERATOR_IS_MULTI_CONFIG AND NOT CMAKE_NO_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
- "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
- endif()
- unset(_GENERATOR_IS_MULTI_CONFIG)
- set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT}" CACHE STRING
- "Flags used by the compiler during debug builds.")
- set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Flags used by the compiler during release builds for minimum size.")
- set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT}" CACHE STRING
- "Flags used by the compiler during release builds.")
- set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Flags used by the compiler during release builds with debug info.")
-endif()
+cmake_initialize_per_config_variable(CMAKE_C_FLAGS "Flags used by the C compiler")
if(CMAKE_C_STANDARD_LIBRARIES_INIT)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INIT}"
@@ -208,13 +185,6 @@ if(NOT CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG)
set(CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
endif()
-mark_as_advanced(
-CMAKE_C_FLAGS
-CMAKE_C_FLAGS_DEBUG
-CMAKE_C_FLAGS_MINSIZEREL
-CMAKE_C_FLAGS_RELEASE
-CMAKE_C_FLAGS_RELWITHDEBINFO
-)
set(CMAKE_C_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeCSharpInformation.cmake b/Modules/CMakeCSharpInformation.cmake
index 25f869c9b..48e1a1e5f 100644
--- a/Modules/CMakeCSharpInformation.cmake
+++ b/Modules/CMakeCSharpInformation.cmake
@@ -44,23 +44,8 @@ endif()
# use _INIT variables so that this only happens the first time
# and you can set these flags in the cmake cache
set(CMAKE_CSharp_FLAGS_INIT "$ENV{CSFLAGS} ${CMAKE_CSharp_FLAGS_INIT}")
-# avoid just having a space as the initial value for the cache
-if(CMAKE_CSharp_FLAGS_INIT STREQUAL " ")
- set(CMAKE_CSharp_FLAGS_INIT)
-endif()
-set (CMAKE_CSharp_FLAGS "${CMAKE_CSharp_FLAGS_INIT}" CACHE STRING
- "Flags used by the C# compiler during all build types.")
-if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
- set (CMAKE_CSharp_FLAGS_DEBUG "${CMAKE_CSharp_FLAGS_DEBUG_INIT}" CACHE STRING
- "Flags used by the C# compiler during debug builds.")
- set (CMAKE_CSharp_FLAGS_MINSIZEREL "${CMAKE_CSharp_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Flags used by the C# compiler during release builds for minimum size.")
- set (CMAKE_CSharp_FLAGS_RELEASE "${CMAKE_CSharp_FLAGS_RELEASE_INIT}" CACHE STRING
- "Flags used by the C# compiler during release builds.")
- set (CMAKE_CSharp_FLAGS_RELWITHDEBINFO "${CMAKE_CSharp_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Flags used by the C# compiler during release builds with debug info.")
-endif()
+cmake_initialize_per_config_variable(CMAKE_CSharp_FLAGS "Flags used by the C# compiler")
if(CMAKE_CSharp_STANDARD_LIBRARIES_INIT)
set(CMAKE_CSharp_STANDARD_LIBRARIES "${CMAKE_CSharp_STANDARD_LIBRARIES_INIT}"
@@ -71,49 +56,12 @@ endif()
# set missing flags (if they are not defined). This is needed in the
# unlikely case that you have only C# and no C/C++ targets in your
# project.
-if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS)
- set(CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "" FORCE)
-endif()
-if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_DEBUG)
- set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "" CACHE STRING "" FORCE)
-endif()
-if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_RELEASE)
- set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "" CACHE STRING "" FORCE)
-endif()
-if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL)
- set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
-endif()
-if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO)
- set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
-endif()
-
-if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS)
- set(CMAKE_EXE_LINKER_FLAGS "" CACHE STRING "" FORCE)
-endif()
-if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_DEBUG)
- set(CMAKE_EXE_LINKER_FLAGS_DEBUG "" CACHE STRING "" FORCE)
-endif()
-if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_RELEASE)
- set(CMAKE_EXE_LINKER_FLAGS_RELEASE "" CACHE STRING "" FORCE)
-endif()
-if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_MINSIZEREL)
- set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
-endif()
-if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO)
- set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
-endif()
+cmake_initialize_per_config_variable(CMAKE_EXE_LINKER_FLAGS "Flags used by the linker")
+cmake_initialize_per_config_variable(CMAKE_SHARED_LINKER_FLAGS "Flags used by the linker during the creation of shared libraries")
set(CMAKE_CSharp_CREATE_SHARED_LIBRARY "CSharp_NO_CREATE_SHARED_LIBRARY")
set(CMAKE_CSharp_CREATE_SHARED_MODULE "CSharp_NO_CREATE_SHARED_MODULE")
set(CMAKE_CSharp_LINK_EXECUTABLE "CSharp_NO_LINK_EXECUTABLE")
-mark_as_advanced(
- CMAKE_CSharp_FLAGS
- CMAKE_CSharp_FLAGS_RELEASE
- CMAKE_CSharp_FLAGS_RELWITHDEBINFO
- CMAKE_CSharp_FLAGS_MINSIZEREL
- CMAKE_CSharp_FLAGS_DEBUG
- )
-
set(CMAKE_CSharp_USE_RESPONSE_FILE_FOR_OBJECTS 1)
set(CMAKE_CSharp_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index f4609cd8b..167e17785 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -74,24 +74,7 @@ endif()
# and you can set these flags in the cmake cache
set(CMAKE_CUDA_FLAGS_INIT "$ENV{CUDAFLAGS} ${CMAKE_CUDA_FLAGS_INIT}")
-foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
- string(STRIP "${CMAKE_CUDA_FLAGS${c}_INIT}" CMAKE_CUDA_FLAGS${c}_INIT)
-endforeach()
-
-set (CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS_INIT}" CACHE STRING
- "Flags used by the compiler during all build types.")
-
-if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
- set (CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG_INIT}" CACHE STRING
- "Flags used by the compiler during debug builds.")
- set (CMAKE_CUDA_FLAGS_MINSIZEREL "${CMAKE_CUDA_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Flags used by the compiler during release builds for minimum size.")
- set (CMAKE_CUDA_FLAGS_RELEASE "${CMAKE_CUDA_FLAGS_RELEASE_INIT}" CACHE STRING
- "Flags used by the compiler during release builds.")
- set (CMAKE_CUDA_FLAGS_RELWITHDEBINFO "${CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Flags used by the compiler during release builds with debug info.")
-
-endif()
+cmake_initialize_per_config_variable(CMAKE_CUDA_FLAGS "Flags used by the CUDA compiler")
if(CMAKE_CUDA_STANDARD_LIBRARIES_INIT)
set(CMAKE_CUDA_STANDARD_LIBRARIES "${CMAKE_CUDA_STANDARD_LIBRARIES_INIT}"
@@ -207,11 +190,4 @@ endif()
unset(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS)
-mark_as_advanced(
-CMAKE_CUDA_FLAGS
-CMAKE_CUDA_FLAGS_RELEASE
-CMAKE_CUDA_FLAGS_RELWITHDEBINFO
-CMAKE_CUDA_FLAGS_MINSIZEREL
-CMAKE_CUDA_FLAGS_DEBUG)
-
set(CMAKE_CUDA_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index ec731fae7..9ac9560e0 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -158,10 +158,6 @@ if(NOT CMAKE_INCLUDE_FLAG_CXX)
set(CMAKE_INCLUDE_FLAG_CXX ${CMAKE_INCLUDE_FLAG_C})
endif()
-if(NOT CMAKE_INCLUDE_FLAG_SEP_CXX)
- set(CMAKE_INCLUDE_FLAG_SEP_CXX ${CMAKE_INCLUDE_FLAG_SEP_C})
-endif()
-
# for most systems a module is the same as a shared library
# so unless the variable CMAKE_MODULE_EXISTS is set just
# copy the values from the LIBRARY variables
@@ -197,24 +193,7 @@ endforeach()
# and you can set these flags in the cmake cache
set(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}")
-foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
- string(STRIP "${CMAKE_CXX_FLAGS${c}_INIT}" CMAKE_CXX_FLAGS${c}_INIT)
-endforeach()
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}" CACHE STRING
- "Flags used by the compiler during all build types.")
-
-if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
- set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT}" CACHE STRING
- "Flags used by the compiler during debug builds.")
- set (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Flags used by the compiler during release builds for minimum size.")
- set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT}" CACHE STRING
- "Flags used by the compiler during release builds.")
- set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Flags used by the compiler during release builds with debug info.")
-
-endif()
+cmake_initialize_per_config_variable(CMAKE_CXX_FLAGS "Flags used by the CXX compiler")
if(CMAKE_CXX_STANDARD_LIBRARIES_INIT)
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES_INIT}"
@@ -287,11 +266,7 @@ endif()
mark_as_advanced(
CMAKE_VERBOSE_MAKEFILE
-CMAKE_CXX_FLAGS
-CMAKE_CXX_FLAGS_RELEASE
-CMAKE_CXX_FLAGS_RELWITHDEBINFO
-CMAKE_CXX_FLAGS_MINSIZEREL
-CMAKE_CXX_FLAGS_DEBUG)
+)
set(CMAKE_CXX_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake
index 43b5da022..b043e1815 100644
--- a/Modules/CMakeCommonLanguageInclude.cmake
+++ b/Modules/CMakeCommonLanguageInclude.cmake
@@ -10,120 +10,14 @@ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
-foreach(t EXE SHARED MODULE STATIC)
- foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
- string(STRIP "${CMAKE_${t}_LINKER_FLAGS${c}_INIT}" CMAKE_${t}_LINKER_FLAGS${c}_INIT)
- endforeach()
-endforeach()
-
-if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
- get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
- # default build type is none
- if(NOT _GENERATOR_IS_MULTI_CONFIG AND NOT CMAKE_NO_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
- "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
- endif()
- unset(_GENERATOR_IS_MULTI_CONFIG)
-
- set (CMAKE_EXE_LINKER_FLAGS_DEBUG ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
- "Flags used by the linker during debug builds.")
-
- set (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT} CACHE STRING
- "Flags used by the linker during release minsize builds.")
-
- set (CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
- "Flags used by the linker during release builds.")
-
- set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
- ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
- "Flags used by the linker during Release with Debug Info builds.")
-
- set (CMAKE_SHARED_LINKER_FLAGS_DEBUG ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
- "Flags used by the linker during debug builds.")
-
- set (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL ${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT}
- CACHE STRING
- "Flags used by the linker during release minsize builds.")
-
- set (CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
- "Flags used by the linker during release builds.")
-
- set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
- ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
- "Flags used by the linker during Release with Debug Info builds.")
-
- set (CMAKE_MODULE_LINKER_FLAGS_DEBUG ${CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
- "Flags used by the linker during debug builds.")
-
- set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL ${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT}
- CACHE STRING
- "Flags used by the linker during release minsize builds.")
-
- set (CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
- "Flags used by the linker during release builds.")
-
- set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
- ${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
- "Flags used by the linker during Release with Debug Info builds.")
-
- set (CMAKE_STATIC_LINKER_FLAGS_DEBUG ${CMAKE_STATIC_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
- "Flags used by the linker during debug builds.")
-
- set (CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL ${CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL_INIT}
- CACHE STRING
- "Flags used by the linker during release minsize builds.")
-
- set (CMAKE_STATIC_LINKER_FLAGS_RELEASE ${CMAKE_STATIC_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
- "Flags used by the linker during release builds.")
-
- set (CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
- ${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}"
- 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}"
- CACHE STRING "Flags used by the linker during the creation of modules.")
-
-# static linker flags
-set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS_INIT}"
- CACHE STRING "Flags used by the linker during the creation of static libraries.")
+cmake_initialize_per_config_variable(CMAKE_EXE_LINKER_FLAGS "Flags used by the linker")
+cmake_initialize_per_config_variable(CMAKE_SHARED_LINKER_FLAGS "Flags used by the linker during the creation of shared libraries")
+cmake_initialize_per_config_variable(CMAKE_MODULE_LINKER_FLAGS "Flags used by the linker during the creation of modules")
+cmake_initialize_per_config_variable(CMAKE_STATIC_LINKER_FLAGS "Flags used by the linker during the creation of static libraries")
# Alias the build tool variable for backward compatibility.
set(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM})
mark_as_advanced(
CMAKE_VERBOSE_MAKEFILE
-
-CMAKE_EXE_LINKER_FLAGS
-CMAKE_EXE_LINKER_FLAGS_DEBUG
-CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
-CMAKE_EXE_LINKER_FLAGS_RELEASE
-CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
-
-CMAKE_SHARED_LINKER_FLAGS
-CMAKE_SHARED_LINKER_FLAGS_DEBUG
-CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
-CMAKE_SHARED_LINKER_FLAGS_RELEASE
-CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
-
-CMAKE_MODULE_LINKER_FLAGS
-CMAKE_MODULE_LINKER_FLAGS_DEBUG
-CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
-CMAKE_MODULE_LINKER_FLAGS_RELEASE
-CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
-
-CMAKE_STATIC_LINKER_FLAGS
-CMAKE_STATIC_LINKER_FLAGS_DEBUG
-CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
-CMAKE_STATIC_LINKER_FLAGS_RELEASE
-CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
)
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index f7cf54a8d..24048ed7e 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -100,6 +100,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_YASM "--version")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_YASM "(yasm)")
+ list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ADSP)
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ADSP "-version")
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ADSP "Analog Devices")
+
include(CMakeDetermineCompilerId)
set(userflags)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}")
@@ -163,8 +167,8 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
-include(CMakeFindBinUtils)
set(_CMAKE_PROCESSING_LANGUAGE "ASM")
+include(CMakeFindBinUtils)
include(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 4e56ce1cf..7e6ca1edf 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -166,8 +166,8 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
-include(CMakeFindBinUtils)
set(_CMAKE_PROCESSING_LANGUAGE "C")
+include(CMakeFindBinUtils)
include(Compiler/${CMAKE_C_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index c9cd7e29b..f5a3ebdba 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -73,7 +73,10 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
CMAKE_DETERMINE_COMPILER_ID(CUDA CUDAFLAGS CMakeCUDACompilerId.cu)
endif()
+set(_CMAKE_PROCESSING_LANGUAGE "CUDA")
include(CMakeFindBinUtils)
+unset(_CMAKE_PROCESSING_LANGUAGE)
+
if(MSVC_CUDA_ARCHITECTURE_ID)
set(SET_MSVC_CUDA_ARCHITECTURE_ID
"set(MSVC_CUDA_ARCHITECTURE_ID ${MSVC_CUDA_ARCHITECTURE_ID})")
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 454184429..c0fb3b6bd 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -164,8 +164,8 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
-include(CMakeFindBinUtils)
set(_CMAKE_PROCESSING_LANGUAGE "CXX")
+include(CMakeFindBinUtils)
include(Compiler/${CMAKE_CXX_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 2549c22b8..cf502f66e 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -258,8 +258,8 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
-include(CMakeFindBinUtils)
set(_CMAKE_PROCESSING_LANGUAGE "Fortran")
+include(CMakeFindBinUtils)
include(Compiler/${CMAKE_Fortran_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake
index 2604906e5..dd02d5447 100644
--- a/Modules/CMakeDetermineSwiftCompiler.cmake
+++ b/Modules/CMakeDetermineSwiftCompiler.cmake
@@ -34,7 +34,9 @@ if (NOT _CMAKE_TOOLCHAIN_LOCATION)
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Swift_COMPILER}" PATH)
endif ()
+set(_CMAKE_PROCESSING_LANGUAGE "Swift")
include(CMakeFindBinUtils)
+unset(_CMAKE_PROCESSING_LANGUAGE)
# configure variables set in this file for fast reload later on
configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index 20dcf1bb5..600d5580e 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -2,7 +2,7 @@
# file Copyright.txt or https://cmake.org/licensing for details.
-# This module is used by the Makefile generator to determin the following variables:
+# This module is used by the Makefile generator to determine the following variables:
# CMAKE_SYSTEM_NAME - on unix this is uname -s, for windows it is Windows
# CMAKE_SYSTEM_VERSION - on unix this is uname -r, for windows it is empty
# CMAKE_SYSTEM - ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_VERSION}, for windows: ${CMAKE_SYSTEM}
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index ad065f050..21a3065fe 100644
--- a/Modules/CMakeExpandImportedTargets.cmake
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -50,6 +50,10 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
endif()
if(NOT CEIT_CONFIGURATION)
+ # Would be better to test GENERATOR_IS_MULTI_CONFIG global property,
+ # but the documented behavior specifically says we check
+ # CMAKE_CONFIGURATION_TYPES and fall back to CMAKE_BUILD_TYPE if no
+ # config types are defined.
if(CMAKE_CONFIGURATION_TYPES)
list(GET CMAKE_CONFIGURATION_TYPES 0 CEIT_CONFIGURATION)
else()
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index e4103d0b7..ece054766 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -20,16 +20,9 @@
# on UNIX, cygwin and mingw
# if it's the MS C/CXX compiler, search for link
-if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
- OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
- OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC"
- OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC"
- OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
- OR "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC"
- OR (CMAKE_HOST_WIN32 AND (
- "x${CMAKE_C_COMPILER_ID}" STREQUAL "xPGI"
- OR "x${CMAKE_Fortran_COMPILER_ID}" STREQUAL "xPGI"
- ))
+if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xMSVC"
+ OR (CMAKE_HOST_WIN32 AND "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xPGI")
OR (CMAKE_GENERATOR MATCHES "Visual Studio"
AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
diff --git a/Modules/CMakeFindCodeBlocks.cmake b/Modules/CMakeFindCodeBlocks.cmake
index b76e5c57f..13bceb1a8 100644
--- a/Modules/CMakeFindCodeBlocks.cmake
+++ b/Modules/CMakeFindCodeBlocks.cmake
@@ -28,3 +28,6 @@ endif()
# This variable is used by the CodeBlocks generator and appended to the make invocation commands.
set(CMAKE_CODEBLOCKS_MAKE_ARGUMENTS "${_CMAKE_CODEBLOCKS_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when CodeBlocks invokes make. Enter e.g. -j<some_number> to get parallel builds")
+
+# This variable is used by the CodeBlocks generator and allows the user to overwrite the autodetected CodeBlocks compiler id
+set(CMAKE_CODEBLOCKS_COMPILER_ID "" CACHE STRING "Id string of the compiler for the CodeBlocks IDE. Automatically detected when left empty")
diff --git a/Modules/CMakeFindKDevelop3.cmake b/Modules/CMakeFindKDevelop3.cmake
deleted file mode 100644
index 488acf758..000000000
--- a/Modules/CMakeFindKDevelop3.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-
-# This file is included in CMakeSystemSpecificInformation.cmake if
-# the KDevelop3 extra generator has been selected.
-
-find_program(CMAKE_KDEVELOP3_EXECUTABLE NAMES kdevelop DOC "The KDevelop3 executable")
-
-if(CMAKE_KDEVELOP3_EXECUTABLE)
- set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_KDEVELOP3_EXECUTABLE} <PROJECT_FILE>" )
-endif()
-
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
index 1261137c1..7c41d49e2 100644
--- a/Modules/CMakeFindPackageMode.cmake
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -17,7 +17,7 @@
# i.e. GNU/Intel/Clang/MSVC, etc.
# ``LANGUAGE``
# language for which the result will be used,
-# i.e. C/CXX/Fortan/ASM
+# i.e. C/CXX/Fortran/ASM
# ``MODE``
# ``EXIST``
# only check for existence of the given package
diff --git a/Modules/CMakeFindSublimeText2.cmake b/Modules/CMakeFindSublimeText2.cmake
new file mode 100644
index 000000000..022d0109e
--- /dev/null
+++ b/Modules/CMakeFindSublimeText2.cmake
@@ -0,0 +1,23 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This file is included in CMakeSystemSpecificInformation.cmake if
+# the Sublime Text 2 extra generator has been selected.
+
+find_program(CMAKE_SUBLIMETEXT_EXECUTABLE
+ NAMES subl3 subl sublime_text
+ PATHS
+ "/Applications/Sublime Text.app/Contents/SharedSupport/bin"
+ "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin"
+ "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin"
+ "$ENV{HOME}/Applications/Sublime Text.app/Contents/SharedSupport/bin"
+ "$ENV{HOME}/Applications/Sublime Text 3.app/Contents/SharedSupport/bin"
+ "$ENV{HOME}/Applications/Sublime Text 2.app/Contents/SharedSupport/bin"
+ "/opt/sublime_text"
+ "/opt/sublime_text_3"
+ DOC "The Sublime Text executable")
+
+if(CMAKE_SUBLIMETEXT_EXECUTABLE)
+ set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_SUBLIMETEXT_EXECUTABLE} --project <PROJECT_FILE>" )
+endif()
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index 49789f197..da3d9533d 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -2,6 +2,26 @@
#if 0
! Identify the compiler
#endif
+#if defined(_MSC_VER)
+ PRINT *, 'INFO:simulate[MSVC]'
+# if _MSC_VER >= 1900
+ PRINT *, 'INFO:simulate_version[019.00]'
+# elif _MSC_VER >= 1800
+ PRINT *, 'INFO:simulate_version[018.00]'
+# elif _MSC_VER >= 1700
+ PRINT *, 'INFO:simulate_version[017.00]'
+# elif _MSC_VER >= 1600
+ PRINT *, 'INFO:simulate_version[016.00]'
+# elif _MSC_VER >= 1500
+ PRINT *, 'INFO:simulate_version[015.00]'
+# elif _MSC_VER >= 1400
+ PRINT *, 'INFO:simulate_version[014.00]'
+# elif _MSC_VER >= 1310
+ PRINT *, 'INFO:simulate_version[013.01]'
+# else
+ PRINT *, 'INFO:simulate_version[013.00]'
+# endif
+#endif
#if defined(__INTEL_COMPILER) || defined(__ICC)
PRINT *, 'INFO:compiler[Intel]'
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
@@ -14,27 +34,6 @@
# if defined(__INTEL_COMPILER_BUILD_DATE)
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif
-
-# if defined(_MSC_VER)
- PRINT *, 'INFO:simulate[MSVC]'
-# if _MSC_VER >= 1900
- PRINT *, 'INFO:simulate_version[019.00]'
-# elif _MSC_VER >= 1800
- PRINT *, 'INFO:simulate_version[018.00]'
-# elif _MSC_VER >= 1700
- PRINT *, 'INFO:simulate_version[017.00]'
-# elif _MSC_VER >= 1600
- PRINT *, 'INFO:simulate_version[016.00]'
-# elif _MSC_VER >= 1500
- PRINT *, 'INFO:simulate_version[015.00]'
-# elif _MSC_VER >= 1400
- PRINT *, 'INFO:simulate_version[014.00]'
-# elif _MSC_VER >= 1310
- PRINT *, 'INFO:simulate_version[013.01]'
-# else
- PRINT *, 'INFO:simulate_version[013.00]'
-# endif
-# endif
#elif defined(__SUNPRO_F95)
PRINT *, 'INFO:compiler[SunPro]'
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F95>>8)
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index 8005da6e4..5f028e4f3 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -67,11 +67,6 @@ if(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran "${_override}")
endif()
-
-# Fortran needs cmake to do a requires step during its build process to
-# catch any modules
-set(CMAKE_NEEDS_REQUIRES_STEP_Fortran_FLAG 1)
-
if(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIC)
set(CMAKE_Fortran_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC})
endif()
@@ -156,20 +151,11 @@ if(NOT CMAKE_INCLUDE_FLAG_Fortran)
set(CMAKE_INCLUDE_FLAG_Fortran ${CMAKE_INCLUDE_FLAG_C})
endif()
-if(NOT CMAKE_INCLUDE_FLAG_SEP_Fortran)
- set(CMAKE_INCLUDE_FLAG_SEP_Fortran ${CMAKE_INCLUDE_FLAG_SEP_C})
-endif()
-
set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
set(CMAKE_Fortran_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Fortran_FLAGS_INIT}")
-foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
- string(STRIP "${CMAKE_Fortran_FLAGS${c}_INIT}" CMAKE_Fortran_FLAGS${c}_INIT)
-endforeach()
-
-set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_INIT}" CACHE STRING
- "Flags for Fortran compiler.")
+cmake_initialize_per_config_variable(CMAKE_Fortran_FLAGS "Flags used by the Fortran compiler")
include(CMakeCommonLanguageInclude)
@@ -221,24 +207,5 @@ if(CMAKE_Fortran_STANDARD_LIBRARIES_INIT)
mark_as_advanced(CMAKE_Fortran_STANDARD_LIBRARIES)
endif()
-if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
- set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG_INIT}" CACHE STRING
- "Flags used by the compiler during debug builds.")
- set (CMAKE_Fortran_FLAGS_MINSIZEREL "${CMAKE_Fortran_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Flags used by the compiler during release builds for minimum size.")
- set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE_INIT}" CACHE STRING
- "Flags used by the compiler during release builds.")
- set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Flags used by the compiler during release builds with debug info.")
-
-endif()
-
-mark_as_advanced(
-CMAKE_Fortran_FLAGS
-CMAKE_Fortran_FLAGS_DEBUG
-CMAKE_Fortran_FLAGS_MINSIZEREL
-CMAKE_Fortran_FLAGS_RELEASE
-CMAKE_Fortran_FLAGS_RELWITHDEBINFO)
-
# set this variable so we can avoid loading this more than once.
set(CMAKE_Fortran_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index 324a27939..02cb46450 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -1,6 +1,7 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
+include(CMakeInitializeConfigs)
set(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
@@ -8,7 +9,6 @@ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
set(CMAKE_INCLUDE_FLAG_C "-I") # -I
-set(CMAKE_INCLUDE_FLAG_C_SEP "") # , or empty
set(CMAKE_LIBRARY_PATH_FLAG "-L")
set(CMAKE_LIBRARY_PATH_TERMINATOR "") # for the Digital Mars D compiler the link paths have to be terminated with a "/"
set(CMAKE_LINK_LIBRARY_FLAG "-l")
diff --git a/Modules/CMakeInitializeConfigs.cmake b/Modules/CMakeInitializeConfigs.cmake
new file mode 100644
index 000000000..9dfe04086
--- /dev/null
+++ b/Modules/CMakeInitializeConfigs.cmake
@@ -0,0 +1,39 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include_guard(GLOBAL)
+
+# Initializes `<_PREFIX>_<CONFIG>` variables from the corresponding
+# `<_PREFIX>_<CONFIG>_INIT`, for the configurations currently used.
+function(cmake_initialize_per_config_variable _PREFIX _DOCSTRING)
+ string(STRIP "${${_PREFIX}_INIT}" _INIT)
+ set("${_PREFIX}" "${_INIT}"
+ CACHE STRING "${_DOCSTRING} during all build types.")
+ mark_as_advanced("${_PREFIX}")
+
+ if (NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+ set(_CONFIGS Debug Release MinSizeRel RelWithDebInfo)
+
+ get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if (_GENERATOR_IS_MULTI_CONFIG)
+ list(APPEND _CONFIGS ${CMAKE_CONFIGURATION_TYPES})
+ else()
+ if (NOT CMAKE_NO_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE_INIT}" CACHE STRING
+ "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...")
+ endif()
+ list(APPEND _CONFIGS ${CMAKE_BUILD_TYPE})
+ endif()
+
+ list(REMOVE_DUPLICATES _CONFIGS)
+ foreach(_BUILD_TYPE IN LISTS _CONFIGS)
+ if (NOT "${_BUILD_TYPE}" STREQUAL "")
+ string(TOUPPER "${_BUILD_TYPE}" _BUILD_TYPE)
+ string(STRIP "${${_PREFIX}_${_BUILD_TYPE}_INIT}" _INIT)
+ set("${_PREFIX}_${_BUILD_TYPE}" "${_INIT}"
+ CACHE STRING "${_DOCSTRING} during ${_BUILD_TYPE} builds.")
+ mark_as_advanced("${_PREFIX}_${_BUILD_TYPE}")
+ endif()
+ endforeach()
+ endif()
+endfunction()
diff --git a/Modules/CMakeJavaInformation.cmake b/Modules/CMakeJavaInformation.cmake
index 844bbbbbf..11568a810 100644
--- a/Modules/CMakeJavaInformation.cmake
+++ b/Modules/CMakeJavaInformation.cmake
@@ -30,7 +30,7 @@ if(NOT CMAKE_Java_CREATE_STATIC_LIBRARY)
set(CMAKE_Java_CREATE_STATIC_LIBRARY
"<CMAKE_Java_ARCHIVE> -cf <TARGET> -C <OBJECT_DIR> ${class_files_mask}")
- # "${class_files_mask}" should really be "<OBJECTS>" but compling a *.java
+ # "${class_files_mask}" should really be "<OBJECTS>" but compiling a *.java
# file can create more than one *.class file...
endif()
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 90c2a5719..e37f34f6f 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -122,7 +122,7 @@
#
# write_basic_package_version_file(<filename>
# [VERSION <major.minor.patch>]
-# COMPATIBILITY <AnyNewerVersion|SameMajorVersion|ExactVersion> )
+# COMPATIBILITY <AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion> )
#
#
# Writes a file for use as ``<package>ConfigVersion.cmake`` file to
@@ -144,6 +144,9 @@
# 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 ``SameMinorVersion`` is used, the behaviour is the same as
+# ``SameMajorVersion``, but both major and minor version must be the same as
+# requested, e.g version 0.2 will not be compatible if 0.1 is requested.
# 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
@@ -154,10 +157,9 @@
# 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
+# resulting version file. Depending on the ``COMPATIBILITY``, the corresponding
+# ``BasicConfigVersion-<COMPATIBILITY>.cmake.in`` file is used.
+# Please note that these files are internal to CMake and you should not call
# :command:`configure_file()` on them yourself, but they can be used as starting
# point to create more sophisticted custom ``ConfigVersion.cmake`` files.
#
diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake
index a34028867..1227fdf26 100644
--- a/Modules/CMakeRCInformation.cmake
+++ b/Modules/CMakeRCInformation.cmake
@@ -19,23 +19,7 @@ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
set(CMAKE_RC_FLAGS_INIT "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}")
-foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
- string(STRIP "${CMAKE_RC_FLAGS${c}_INIT}" CMAKE_RC_FLAGS${c}_INIT)
-endforeach()
-
-set (CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS_INIT}" CACHE STRING
- "Flags for Windows Resource Compiler.")
-
-if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
- set (CMAKE_RC_FLAGS_DEBUG "${CMAKE_RC_FLAGS_DEBUG_INIT}" CACHE STRING
- "Flags for Windows Resource Compiler during debug builds.")
- set (CMAKE_RC_FLAGS_MINSIZEREL "${CMAKE_RC_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Flags for Windows Resource Compiler during release builds for minimum size.")
- set (CMAKE_RC_FLAGS_RELEASE "${CMAKE_RC_FLAGS_RELEASE_INIT}" CACHE STRING
- "Flags for Windows Resource Compiler during release builds.")
- set (CMAKE_RC_FLAGS_RELWITHDEBINFO "${CMAKE_RC_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Flags for Windows Resource Compiler during release builds with debug info.")
-endif()
+cmake_initialize_per_config_variable(CMAKE_RC_FLAGS "Flags for Windows Resource Compiler")
# These are the only types of flags that should be passed to the rc
# command, if COMPILE_FLAGS is used on a target this will be used
@@ -51,12 +35,5 @@ if(NOT CMAKE_RC_COMPILE_OBJECT)
"<CMAKE_RC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /fo<OBJECT> <SOURCE>")
endif()
-mark_as_advanced(
-CMAKE_RC_FLAGS
-CMAKE_RC_FLAGS_DEBUG
-CMAKE_RC_FLAGS_MINSIZEREL
-CMAKE_RC_FLAGS_RELEASE
-CMAKE_RC_FLAGS_RELWITHDEBINFO
-)
# set this variable so we can avoid loading this more than once.
set(CMAKE_RC_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake
index 03f348d72..66f172277 100644
--- a/Modules/CMakeSystemSpecificInformation.cmake
+++ b/Modules/CMakeSystemSpecificInformation.cmake
@@ -37,7 +37,6 @@ if(NOT _INCLUDED_SYSTEM_INFO_FILE)
endif()
endif()
-
# optionally include a file which can do extra-generator specific things, e.g.
# CMakeFindEclipseCDT4.cmake asks gcc for the system include dirs for the Eclipse CDT4 generator
if(CMAKE_EXTRA_GENERATOR)
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 391594381..9216fc917 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -68,7 +68,7 @@
#
# .. variable:: CPACK_PACKAGE_VENDOR
#
-# The name of the package vendor. (e.g., "Kitware").
+# The name of the package vendor. (e.g., "Kitware"). Default is "Humanity".
#
# .. variable:: CPACK_PACKAGE_DIRECTORY
#
@@ -80,15 +80,15 @@
#
# .. variable:: CPACK_PACKAGE_VERSION_MAJOR
#
-# Package major Version
+# Package major Version. Default value is 0.
#
# .. variable:: CPACK_PACKAGE_VERSION_MINOR
#
-# Package minor Version
+# Package minor Version. Default value is 1.
#
# .. variable:: CPACK_PACKAGE_VERSION_PATCH
#
-# Package patch Version
+# Package patch Version. Default value is 1.
#
# .. variable:: CPACK_PACKAGE_DESCRIPTION_FILE
#
@@ -262,7 +262,8 @@
#
# .. variable:: CPACK_SYSTEM_NAME
#
-# System name, defaults to the value of ${CMAKE_SYSTEM_NAME}.
+# System name, defaults to the value of ${CMAKE_SYSTEM_NAME}, except on
+# Windows where it will be "win32" or "win64".
#
# .. variable:: CPACK_PACKAGE_VERSION
#
@@ -338,7 +339,7 @@ function(cpack_encode_variables)
set(value "${${var}}")
endif()
- string(APPEND commands "\nSET(${var} \"${value}\")")
+ string(APPEND commands "\nset(${var} \"${value}\")")
endif()
endforeach()
@@ -384,6 +385,12 @@ _cpack_set_default(CPACK_RESOURCE_FILE_WELCOME
_cpack_set_default(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
+# Set default directory creation permissions mode
+if(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS)
+ _cpack_set_default(CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
+ "${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS}")
+endif()
+
if(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL)
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
endif()
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake
index 2374fbda8..6c122e566 100644
--- a/Modules/CPackComponent.cmake
+++ b/Modules/CPackComponent.cmake
@@ -66,7 +66,7 @@
# the component differently depending on the value of this variable:
#
# * ONE_PER_GROUP (default): creates one package file per component group
-# * ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) component
+# * ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) components
# * IGNORE : creates one package per component, i.e. IGNORE component group
#
# One can specify different grouping for different CPack generator by
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 187982701..35447c9ff 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -470,7 +470,7 @@
# Usage::
#
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
-# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
+# "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
#
# .. note::
#
@@ -610,12 +610,7 @@ function(cpack_deb_prepare_package_vars)
if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OR CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS)
# Generating binary list - Get type of all install files
- cmake_policy(PUSH)
- # Tell file(GLOB_RECURSE) not to follow directory symlinks
- # even if the project does not set this policy to NEW.
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*")
- cmake_policy(POP)
+ file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*")
find_program(FILE_EXECUTABLE file)
if(NOT FILE_EXECUTABLE)
@@ -931,13 +926,10 @@ function(cpack_deb_prepare_package_vars)
if(CPACK_DEBIAN_ARCHIVE_TYPE)
set(archive_types_ "paxr;gnutar")
- cmake_policy(PUSH)
- cmake_policy(SET CMP0057 NEW)
- if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_)
- message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported"
- "type ${CPACK_DEBIAN_ARCHIVE_TYPE}")
- endif()
- cmake_policy(POP)
+ if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_)
+ message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported"
+ "type ${CPACK_DEBIAN_ARCHIVE_TYPE}")
+ endif()
else()
set(CPACK_DEBIAN_ARCHIVE_TYPE "paxr")
endif()
@@ -962,7 +954,7 @@ function(cpack_deb_prepare_package_vars)
# - prerm
# Usage:
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
- # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
+ # "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
# Are we packaging components ?
if(CPACK_DEB_PACKAGE_COMPONENT)
@@ -987,7 +979,7 @@ function(cpack_deb_prepare_package_vars)
if(READELF_EXECUTABLE)
foreach(_FILE IN LISTS CPACK_DEB_SHARED_OBJECT_FILES)
extract_so_info("${_FILE}" libname soversion)
- if(libname AND soversion)
+ if(libname AND DEFINED soversion)
list(APPEND CPACK_DEBIAN_PACKAGE_SHLIBS_LIST
"${libname} ${soversion} ${CPACK_DEBIAN_PACKAGE_NAME} (${CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY} ${CPACK_DEBIAN_PACKAGE_VERSION})")
else()
@@ -1039,13 +1031,9 @@ function(cpack_deb_prepare_package_vars)
set(CPACK_OUTPUT_FILE_NAME
"${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
else()
- cmake_policy(PUSH)
- cmake_policy(SET CMP0010 NEW)
- if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)")
- cmake_policy(POP)
- message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!")
- endif()
- cmake_policy(POP)
+ if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)")
+ message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!")
+ endif()
set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}")
endif()
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 8d8b07072..9d733dcd4 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -191,6 +191,12 @@
#
# By default used QtIFW_ defaults (``maintenancetool``).
#
+# .. variable:: CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR
+#
+# Set to ``OFF`` if the target directory should not be deleted when uninstalling.
+#
+# Is ``ON`` by default
+#
# .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE
#
# Filename for the configuration of the generated maintenance tool.
@@ -817,7 +823,7 @@ if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND NOT CPACK_IFW_FRAMEWORK_VERSION_FORCED
endif()
endif()
endforeach()
- # Finaly try to get version from executable path
+ # Finally try to get version from executable path
if(NOT CPACK_IFW_FRAMEWORK_VERSION)
string(REGEX MATCH "[0-9]+(\\.[0-9]+)*"
CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_INSTALLERBASE_EXECUTABLE}")
@@ -837,7 +843,7 @@ if(CPACK_IFW_VERBOSE)
endif()
endif()
if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND NOT CPACK_IFW_FRAMEWORK_VERSION)
- message(WARNING "Could not detect QtIFW tools version. Set used version to variable \"CPACK_IFW_FRAMEWORK_VERSION_FORCED\" manualy.")
+ message(WARNING "Could not detect QtIFW tools version. Set used version to variable \"CPACK_IFW_FRAMEWORK_VERSION_FORCED\" manually.")
endif()
#=============================================================================
@@ -864,7 +870,7 @@ macro(_cpack_ifw_resolve_script _variable)
endif()
endmacro()
-# Resolve full path to lisense file
+# Resolve full path to license file
macro(_cpack_ifw_resolve_lisenses _variable)
if(${_variable})
set(_ifw_license_file FALSE)
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 9f77ec3c7..bb5181f38 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -545,7 +545,7 @@
# /usr/share/doc
#
# May be used to exclude path (directories or files) from the auto-generated
-# list of paths discovered by CPack RPM. The defaut value contains a
+# list of paths discovered by CPack RPM. The default value contains a
# reasonable set of values if the variable is not defined by the user. If the
# variable is defined by the user then CPackRPM will NOT any of the default
# path. If you want to add some path to the default list then you can use
@@ -691,6 +691,22 @@
# are the same as for :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`.
# Note that <compName> must be in upper-case.
#
+# .. variable:: CPACK_RPM_INSTALL_WITH_EXEC
+#
+# force execute permissions on programs and shared libraries
+#
+# * Mandatory : NO
+# * Default : - (system default)
+#
+# Force set owner, group and world execute permissions on programs and shared
+# libraries. This can be used for creating valid rpm packages on systems such
+# as Debian where shared libraries do not have execute permissions set.
+#
+# .. note::
+#
+# Programs and shared libraries without execute permissions are ignored during
+# separation of debug symbols from the binary for debuginfo packages.
+#
# Packaging of Symbolic Links
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
@@ -751,7 +767,8 @@
# .. note::
#
# Packages generated from packages without binary files, with binary files but
-# without execute permissions or without debug symbols will be empty.
+# without execute permissions or without debug symbols will cause packaging
+# termination.
#
# .. variable:: CPACK_BUILD_SOURCE_DIRS
#
@@ -782,7 +799,7 @@
#
# .. note::
#
-# Each source path prefix is additionaly suffixed by ``src_<index>`` where
+# Each source path prefix is additionally suffixed by ``src_<index>`` where
# index is index of the path used from :variable:`CPACK_BUILD_SOURCE_DIRS`
# variable. This produces ``<CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX>/src_<index>``
# replacement path.
@@ -939,6 +956,34 @@
# Author: Eric Noulard with the help of Alexander Neundorf.
+function(get_file_permissions FILE RETURN_VAR)
+ execute_process(COMMAND ls -l ${FILE}
+ OUTPUT_VARIABLE permissions_
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ string(REPLACE " " ";" permissions_ "${permissions_}")
+ list(GET permissions_ 0 permissions_)
+
+ unset(text_notation_)
+ set(any_chars_ ".")
+ foreach(PERMISSION_TYPE "OWNER" "GROUP" "WORLD")
+ if(permissions_ MATCHES "${any_chars_}r.*")
+ list(APPEND text_notation_ "${PERMISSION_TYPE}_READ")
+ endif()
+ string(APPEND any_chars_ ".")
+ if(permissions_ MATCHES "${any_chars_}w.*")
+ list(APPEND text_notation_ "${PERMISSION_TYPE}_WRITE")
+ endif()
+ string(APPEND any_chars_ ".")
+ if(permissions_ MATCHES "${any_chars_}x.*")
+ list(APPEND text_notation_ "${PERMISSION_TYPE}_EXECUTE")
+ endif()
+ endforeach()
+
+ set(${RETURN_VAR} "${text_notation_}" PARENT_SCOPE)
+endfunction()
+
function(get_unix_permissions_octal_notation PERMISSIONS_VAR RETURN_VAR)
set(PERMISSIONS ${${PERMISSIONS_VAR}})
list(LENGTH PERMISSIONS PERM_LEN_PRE)
@@ -1020,12 +1065,7 @@ function(cpack_rpm_prepare_relocation_paths)
endforeach()
# warn about all the paths that are not relocatable
- cmake_policy(PUSH)
- # Tell file(GLOB_RECURSE) not to follow directory symlinks
- # even if the project does not set this policy to NEW.
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*")
- cmake_policy(POP)
+ file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*")
foreach(TMP_PATH ${FILE_PATHS_})
string(LENGTH "${WDIR}" WDIR_LEN)
string(SUBSTRING "${TMP_PATH}" ${WDIR_LEN} -1 TMP_PATH)
@@ -1052,10 +1092,7 @@ endfunction()
function(cpack_rpm_prepare_content_list)
# get files list
- cmake_policy(PUSH)
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*")
- cmake_policy(POP)
+ file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*")
set(CPACK_RPM_INSTALL_FILES "/${CPACK_RPM_INSTALL_FILES}")
string(REPLACE ";" ";/" CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}")
@@ -1074,10 +1111,7 @@ function(cpack_rpm_prepare_content_list)
set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}")
string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS " ${_RPM_RELOCATION_PREFIX}")
- cmake_policy(PUSH)
- cmake_policy(SET CMP0007 NEW)
- list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
- cmake_policy(POP)
+ list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
unset(_TMP_LIST)
# Now generate all of the parent dirs of the relocation path
foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
@@ -1515,7 +1549,7 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR)
RESULT_VARIABLE OBJDUMP_EXEC_RESULT
OUTPUT_VARIABLE OBJDUMP_OUT
ERROR_QUIET)
- # Check that if the given file was executable or not
+ # Check if the given file is an executable or not
if(NOT OBJDUMP_EXEC_RESULT)
string(FIND "${OBJDUMP_OUT}" "debug" FIND_RESULT)
if(FIND_RESULT GREATER -1)
@@ -1560,6 +1594,30 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR)
else()
message(WARNING "CPackRPM: File: ${F} does not contain debug symbols. They will possibly be missing from debuginfo package!")
endif()
+
+ get_file_permissions("${WORKING_DIR}/${F}" permissions_)
+ if(NOT "USER_EXECUTE" IN_LIST permissions_ AND
+ NOT "GROUP_EXECUTE" IN_LIST permissions_ AND
+ NOT "WORLD_EXECUTE" IN_LIST permissions_)
+ if(CPACK_RPM_INSTALL_WITH_EXEC)
+ execute_process(COMMAND chmod a+x ${WORKING_DIR}/${F}
+ RESULT_VARIABLE res_
+ ERROR_VARIABLE err_
+ OUTPUT_QUIET)
+
+ if(res_)
+ message(FATAL_ERROR "CPackRPM: could not apply execute permissions "
+ "requested by CPACK_RPM_INSTALL_WITH_EXEC variable on "
+ "'${WORKING_DIR}/${F}'! Reason: '${err_}'")
+ endif()
+ else()
+ message(AUTHOR_WARNING "CPackRPM: File: ${WORKING_DIR}/${F} does not "
+ "have execute permissions. Debuginfo symbols will not be extracted"
+ "! Missing debuginfo may cause packaging failure. Consider setting "
+ "execute permissions or setting 'CPACK_RPM_INSTALL_WITH_EXEC' "
+ "variable.")
+ endif()
+ endif()
endif()
endforeach()
@@ -1926,19 +1984,15 @@ function(cpack_rpm_generate_package)
endif()
if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
- cmake_policy(PUSH)
- cmake_policy(SET CMP0057 NEW)
- # Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now
- # Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun)
- # Auto* is a special case because the tags can not be queried by querytags rpmbuild flag
- set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV)
- if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_)
- cmake_policy(POP)
- message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not "
- "supported in provided rpmbuild. Tag will not be used.")
- continue()
- endif()
- cmake_policy(POP)
+ # Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now
+ # Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun)
+ # Auto* is a special case because the tags can not be queried by querytags rpmbuild flag
+ set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV)
+ if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_)
+ message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not "
+ "supported in provided rpmbuild. Tag will not be used.")
+ continue()
+ endif()
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}")
@@ -1985,13 +2039,13 @@ function(cpack_rpm_generate_package)
# CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE)
# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE)
# May be used to embed a post (un)installation script in the spec file.
- # The refered script file(s) will be read and directly
+ # The referred script file(s) will be read and directly
# put after the %post or %postun section
# ----------------------------------------------------------------
# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE)
# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE)
# May be used to embed a pre (un)installation script in the spec file.
- # The refered script file(s) will be read and directly
+ # The referred script file(s) will be read and directly
# put after the %pre or %preun section
foreach(RPM_SCRIPT_FILE_TYPE_ "INSTALL" "UNINSTALL")
foreach(RPM_SCRIPT_FILE_TIME_ "PRE" "POST")
@@ -2022,7 +2076,7 @@ function(cpack_rpm_generate_package)
# CPACK_RPM_CHANGELOG_FILE
# May be used to embed a changelog in the spec file.
- # The refered file will be read and directly put after the %changelog section
+ # The referred file will be read and directly put after the %changelog section
if(CPACK_RPM_CHANGELOG_FILE)
if(EXISTS ${CPACK_RPM_CHANGELOG_FILE})
file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG)
@@ -2152,7 +2206,7 @@ function(cpack_rpm_generate_package)
string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST)
# Transform endline separated - string into CMake List
string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}")
- # Remove unecessary quotes
+ # Remove unnecessary quotes
string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}")
# Remove ABSOLUTE install file from INSTALL FILE LIST
list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL})
@@ -2230,12 +2284,9 @@ function(cpack_rpm_generate_package)
continue()
endif()
- cmake_policy(PUSH)
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE
- "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}"
- "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*")
- cmake_policy(POP)
+ file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}"
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*")
foreach(f_ IN LISTS files_for_move_)
get_filename_component(dir_path_ "${f_}" DIRECTORY)
@@ -2367,13 +2418,9 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
"CPACK_RPM_FILE_NAME")
if(NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
if(CPACK_RPM_FILE_NAME)
- cmake_policy(PUSH)
- cmake_policy(SET CMP0010 NEW)
- if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm")
- cmake_policy(POP)
- message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!")
- endif()
- cmake_policy(POP)
+ if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm")
+ message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!")
+ endif()
else()
# old file name format for back compatibility
string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}"
@@ -2413,7 +2460,7 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
endif()
# Disable debuginfo packages - srpm generates invalid packages due to
- # releasing controll to cpack to generate binary packages.
+ # releasing control to cpack to generate binary packages.
# Note however that this doesn't prevent cpack to generate debuginfo
# packages when run from srpm with --rebuild.
set(TMP_RPM_DISABLE_DEBUGINFO "%define debug_package %{nil}")
@@ -2691,13 +2738,8 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
endif()
# find generated rpm files and take their names
- cmake_policy(PUSH)
- # Tell file(GLOB_RECURSE) not to follow directory symlinks
- # even if the project does not set this policy to NEW.
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm"
- "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm")
- cmake_policy(POP)
+ file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm"
+ "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm")
if(NOT GENERATED_FILES)
message(FATAL_ERROR "RPM package was not generated! ${CPACK_RPM_DIRECTORY}")
diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake
index 1dc37d415..27737e59d 100644
--- a/Modules/CPackWIX.cmake
+++ b/Modules/CPackWIX.cmake
@@ -263,7 +263,7 @@
# between the system on which the installer is created
# and the system on which the installer might be used into account.
#
-# It is therefor possible that the installer e.g. might try to install
+# It is therefore possible that the installer e.g. might try to install
# onto a drive that is unavailable or unintended or a path that does not
# follow the localization or convention of the system on which the
# installation is performed.
@@ -289,7 +289,7 @@
#
if(NOT CPACK_WIX_ROOT)
- file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT)
+ string(REPLACE "\\" "/" CPACK_WIX_ROOT "$ENV{WIX}")
endif()
find_program(CPACK_WIX_CANDLE_EXECUTABLE candle
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
index 9370596a8..a08282e75 100644
--- a/Modules/CTest.cmake
+++ b/Modules/CTest.cmake
@@ -65,7 +65,7 @@ endfunction()
include(CTestUseLaunchers)
if(BUILD_TESTING)
- # Setup some auxilary macros
+ # Setup some auxiliary macros
macro(SET_IF_NOT_SET var val)
if(NOT DEFINED "${var}")
set("${var}" "${val}")
diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake
index ff9aada54..838fbbfeb 100644
--- a/Modules/CTestTargets.cmake
+++ b/Modules/CTestTargets.cmake
@@ -3,7 +3,7 @@
if(NOT RUN_FROM_CTEST_OR_DART)
- message(FATAL_ERROR "Do not incldue CTestTargets.cmake directly")
+ message(FATAL_ERROR "Do not include CTestTargets.cmake directly")
endif()
if(NOT PROJECT_BINARY_DIR)
@@ -38,7 +38,8 @@ endif()
#
set(__conf_types "")
-if(CMAKE_CONFIGURATION_TYPES)
+get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(_isMultiConfig)
# We need to pass the configuration type on the test command line.
set(__conf_types -C "${CMAKE_CFG_INTDIR}")
endif()
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index 5a7298b81..9d2c74dbd 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -32,6 +32,7 @@ effect or even a specific one is beyond the scope of this module.
in such variables may cause a false negative for this check.
#]=======================================================================]
+include_guard(GLOBAL)
include(CheckCSourceCompiles)
include(CMakeCheckCompilerFlagCommonPatterns)
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index 56e68d5b1..114213ac6 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -60,6 +60,7 @@ Check if given C source compiles and links into an executable.
#]=======================================================================]
+include_guard(GLOBAL)
macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
if(NOT DEFINED "${VAR}")
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
index 8da9f1ea9..fa513466e 100644
--- a/Modules/CheckCSourceRuns.cmake
+++ b/Modules/CheckCSourceRuns.cmake
@@ -60,6 +60,8 @@ subsequently be run.
#]=======================================================================]
+include_guard(GLOBAL)
+
macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
if(NOT DEFINED "${VAR}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
index f731b7048..dd6083531 100644
--- a/Modules/CheckCXXCompilerFlag.cmake
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -32,6 +32,7 @@ effect or even a specific one is beyond the scope of this module.
in such variables may cause a false negative for this check.
#]=======================================================================]
+include_guard(GLOBAL)
include(CheckCXXSourceCompiles)
include(CMakeCheckCompilerFlagCommonPatterns)
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
index 4634a7bd9..ed8661b11 100644
--- a/Modules/CheckCXXSourceCompiles.cmake
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -60,6 +60,8 @@ Check if given C++ source compiles and links into an executable.
#]=======================================================================]
+include_guard(GLOBAL)
+
macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
if(NOT DEFINED "${VAR}")
set(_FAIL_REGEX)
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
index 558708c8f..83bf2f23d 100644
--- a/Modules/CheckCXXSourceRuns.cmake
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -60,6 +60,8 @@ subsequently be run.
#]=======================================================================]
+include_guard(GLOBAL)
+
macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
if(NOT DEFINED "${VAR}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake
index 855215407..117a45808 100644
--- a/Modules/CheckCXXSymbolExists.cmake
+++ b/Modules/CheckCXXSymbolExists.cmake
@@ -32,6 +32,7 @@
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
+include_guard(GLOBAL)
include(CheckSymbolExists)
macro(CHECK_CXX_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake
index 8a1a8b9cd..2cb25321e 100644
--- a/Modules/CheckFortranCompilerFlag.cmake
+++ b/Modules/CheckFortranCompilerFlag.cmake
@@ -32,6 +32,7 @@ effect or even a specific one is beyond the scope of this module.
in such variables may cause a false negative for this check.
#]=======================================================================]
+include_guard(GLOBAL)
include(CheckFortranSourceCompiles)
include(CMakeCheckCompilerFlagCommonPatterns)
diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake
index 5fc740ab8..f3ced93d7 100644
--- a/Modules/CheckFortranFunctionExists.cmake
+++ b/Modules/CheckFortranFunctionExists.cmake
@@ -24,6 +24,8 @@
#
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+include_guard(GLOBAL)
+
macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
if(NOT DEFINED ${VARIABLE})
message(STATUS "Looking for Fortran ${FUNCTION}")
diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake
index 4df17e352..d2b0ccaf4 100644
--- a/Modules/CheckFortranSourceCompiles.cmake
+++ b/Modules/CheckFortranSourceCompiles.cmake
@@ -66,6 +66,7 @@ Check if given Fortran source compiles and links into an executable.
#]=======================================================================]
+include_guard(GLOBAL)
macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
if(NOT DEFINED "${VAR}")
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index ef080621d..d00aa8ade 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -38,6 +38,8 @@
# * ``check_function_exists()`` only verifies linking, it does not verify
# that the function is declared in system headers.
+include_guard(GLOBAL)
+
macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake
index e04ab1c54..d8297d91c 100644
--- a/Modules/CheckIPOSupported.cmake
+++ b/Modules/CheckIPOSupported.cmake
@@ -26,7 +26,7 @@ property.
Set ``<output>`` variable with details about any error.
``LANGUAGES <lang>...``
Specify languages whose compilers to check.
- Languages ``C`` and ``CXX`` are supported.
+ Languages ``C``, ``CXX``, and ``Fortran`` are supported.
It makes no sense to use this module when :policy:`CMP0069` is set to ``OLD`` so
module will return error in this case. See policy :policy:`CMP0069` for details.
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
index c566e1448..501fc9a1e 100644
--- a/Modules/CheckIncludeFile.cmake
+++ b/Modules/CheckIncludeFile.cmake
@@ -27,6 +27,8 @@
# 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
#
@@ -34,6 +36,8 @@
# at once. See the :module:`CheckIncludeFileCXX` module to check for headers
# using the ``CXX`` language.
+include_guard(GLOBAL)
+
macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
if(NOT DEFINED "${VARIABLE}")
if(CMAKE_REQUIRED_INCLUDES)
@@ -57,6 +61,7 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
"${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}"
diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake
index 19b1ef6f8..cdb25fb16 100644
--- a/Modules/CheckIncludeFileCXX.cmake
+++ b/Modules/CheckIncludeFileCXX.cmake
@@ -27,12 +27,16 @@
# 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
#
# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles`
# to check for one or more ``C`` headers.
+include_guard(GLOBAL)
+
macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
if(CMAKE_REQUIRED_INCLUDES)
@@ -56,6 +60,7 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
"${CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS}"
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index bef11a5e9..14db68cd0 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -6,19 +6,24 @@
# -----------------
#
# Provides a macro to check if a list of one or more header files can
-# be included together in ``C``.
+# be included together.
#
# .. command:: CHECK_INCLUDE_FILES
#
# ::
#
-# CHECK_INCLUDE_FILES("<includes>" <variable>)
+# CHECK_INCLUDE_FILES("<includes>" <variable> [LANGUAGE <language>])
#
# Check if the given ``<includes>`` list may be included together
-# in a ``C`` source file and store the result in an internal cache
+# in a source file and store the result in an internal cache
# entry named ``<variable>``. Specify the ``<includes>`` argument
# as a :ref:`;-list <CMake Language Lists>` of header file names.
#
+# If LANGUAGE is set, the specified compiler will be used to perform the
+# check. Acceptable values are ``C`` and ``CXX``. If not set, the C compiler
+# will be used if enabled. If the C compiler is not enabled, the C++
+# compiler will be used if enabled.
+#
# The following variables may be set before calling this macro to modify
# the way the check is run:
#
@@ -28,15 +33,44 @@
# 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
#
# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX`
# to check for a single header file in ``C`` or ``CXX`` languages.
+include_guard(GLOBAL)
+
macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
if(NOT DEFINED "${VARIABLE}")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
+
+ if("x${ARGN}" STREQUAL "x")
+ if(CMAKE_C_COMPILER_LOADED)
+ set(_lang C)
+ elseif(CMAKE_CXX_COMPILER_LOADED)
+ set(_lang CXX)
+ else()
+ message(FATAL_ERROR "CHECK_INCLUDE_FILES needs either C or CXX language enabled.\n")
+ endif()
+ elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$")
+ set(_lang "${CMAKE_MATCH_1}")
+ elseif("x${ARGN}" MATCHES "^xLANGUAGE$")
+ message(FATAL_ERROR "No languages listed for LANGUAGE option.\nSupported languages: C, CXX.\n")
+ else()
+ message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n")
+ endif()
+
+ if(_lang STREQUAL "C")
+ set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckIncludeFiles/${VARIABLE}.c)
+ elseif(_lang STREQUAL "CXX")
+ set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckIncludeFiles/${VARIABLE}.cpp)
+ else()
+ message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n")
+ endif()
+
if(CMAKE_REQUIRED_INCLUDES)
set(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
else()
@@ -51,7 +85,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT
"\n\nint main(void){return 0;}\n")
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
- "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY)
+ "${src}" @ONLY)
set(_INCLUDE ${INCLUDE}) # remove empty elements
if("${_INCLUDE}" MATCHES "^([^;]+);.+;([^;]+)$")
@@ -68,8 +102,9 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
endif()
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c
+ ${src}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILES_FLAGS}
"${CHECK_INCLUDE_FILES_INCLUDE_DIRS}"
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index 1ea91d2d0..ce92bfe6d 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -31,6 +31,8 @@
# message(STATUS "No Fortran support")
# endif()
+include_guard(GLOBAL)
+
macro(check_language lang)
if(NOT DEFINED CMAKE_${lang}_COMPILER)
set(_desc "Looking for a ${lang} compiler")
@@ -43,11 +45,17 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
\"set(CMAKE_${lang}_COMPILER \\\"\${CMAKE_${lang}_COMPILER}\\\")\\n\"
)
")
+ if(CMAKE_GENERATOR_INSTANCE)
+ set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}")
+ else()
+ set(_D_CMAKE_GENERATOR_INSTANCE "")
+ endif()
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}
COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR}
-A "${CMAKE_GENERATOR_PLATFORM}"
-T "${CMAKE_GENERATOR_TOOLSET}"
+ ${_D_CMAKE_GENERATOR_INSTANCE}
OUTPUT_VARIABLE output
ERROR_VARIABLE output
RESULT_VARIABLE result
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index 528a45085..487cc592a 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -29,6 +29,8 @@
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
+include_guard(GLOBAL)
+
macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
if(NOT DEFINED "${VARIABLE}")
set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
index 785959496..dde077513 100644
--- a/Modules/CheckPrototypeDefinition.cmake
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -5,7 +5,7 @@
# CheckPrototypeDefinition
# ------------------------
#
-# Check if the protoype we expect is correct.
+# Check if the prototype we expect is correct.
#
# check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE)
#
@@ -41,9 +41,9 @@
#
-
get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
+include_guard(GLOBAL)
function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index 085b46492..8689a5cb9 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -38,6 +38,7 @@
# Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h
# HAVE_TIMEVAL_TV_SEC LANGUAGE C)
+include_guard(GLOBAL)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index 6d52d56c9..d9c9ae463 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -43,6 +43,8 @@ the way the check is run:
execute quietly without messages
#]=======================================================================]
+include_guard(GLOBAL)
+
macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
if(CMAKE_C_COMPILER_LOADED)
__CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index fcf1df740..2b5deec81 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -71,11 +71,13 @@
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
+get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+include_guard(GLOBAL)
+
cmake_policy(PUSH)
cmake_policy(SET CMP0054 NEW)
-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)
diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake
index fd5c36c6a..ab456d14d 100644
--- a/Modules/CheckVariableExists.cmake
+++ b/Modules/CheckVariableExists.cmake
@@ -32,6 +32,8 @@
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
+include_guard(GLOBAL)
+
macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
if(NOT DEFINED "${VARIABLE}")
set(MACRO_CHECK_VARIABLE_DEFINITIONS
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 9f5e92181..7ce1adb9d 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -11,7 +11,8 @@ set(__COMPILER_CLANG 1)
include(Compiler/CMakeCommonCompilerMacros)
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
- OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
macro(__compiler_clang lang)
endmacro()
else()
diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake
index 87ce20f71..d34154c1f 100644
--- a/Modules/Compiler/Cray-C.cmake
+++ b/Modules/Compiler/Cray-C.cmake
@@ -2,8 +2,7 @@
# file Copyright.txt or https://cmake.org/licensing for details.
include(Compiler/Cray)
-
-set(CMAKE_C_VERBOSE_FLAG "-v")
+__compiler_cray(C)
string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake
index 8506c0942..a1899e6dd 100644
--- a/Modules/Compiler/Cray-CXX.cmake
+++ b/Modules/Compiler/Cray-CXX.cmake
@@ -2,8 +2,7 @@
# file Copyright.txt or https://cmake.org/licensing for details.
include(Compiler/Cray)
-
-set(CMAKE_CXX_VERBOSE_FLAG "-v")
+__compiler_cray(C)
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
diff --git a/Modules/Compiler/Cray-Fortran.cmake b/Modules/Compiler/Cray-Fortran.cmake
index 5d81bb02c..dbf28e3a4 100644
--- a/Modules/Compiler/Cray-Fortran.cmake
+++ b/Modules/Compiler/Cray-Fortran.cmake
@@ -1,4 +1,9 @@
-set(CMAKE_Fortran_VERBOSE_FLAG "-v")
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include(Compiler/Cray)
+__compiler_cray(Fortran)
+
set(CMAKE_Fortran_MODOUT_FLAG -em)
set(CMAKE_Fortran_MODDIR_FLAG -J)
set(CMAKE_Fortran_MODDIR_DEFAULT .)
diff --git a/Modules/Compiler/Cray.cmake b/Modules/Compiler/Cray.cmake
index 8fe8eebda..c214afc69 100644
--- a/Modules/Compiler/Cray.cmake
+++ b/Modules/Compiler/Cray.cmake
@@ -8,3 +8,10 @@ endif()
set(__COMPILER_CRAY 1)
include(Compiler/CMakeCommonCompilerMacros)
+
+macro(__compiler_cray lang)
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC -h PIC)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE -h PIC)
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-h PIC")
+endmacro()
diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake
index 9f8befda3..05e3fc763 100644
--- a/Modules/Compiler/CrayPrgEnv.cmake
+++ b/Modules/Compiler/CrayPrgEnv.cmake
@@ -62,12 +62,11 @@ macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd)
# Flags for the Cray wrappers
set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static")
- set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic")
# If the link type is not explicitly specified in the environment then
- # the Cray wrappers assume that the code will be built staticly so
+ # the Cray wrappers assume that the code will be built statically so
# we check the following condition(s) are NOT met
# Compiler flags are explicitly dynamic
# Env var is dynamic and compiler flags are not explicitly static
diff --git a/Modules/Compiler/IAR-FindBinUtils.cmake b/Modules/Compiler/IAR-FindBinUtils.cmake
index d662f5615..5fecb2662 100644
--- a/Modules/Compiler/IAR-FindBinUtils.cmake
+++ b/Modules/Compiler/IAR-FindBinUtils.cmake
@@ -17,7 +17,7 @@ if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "A
find_program(CMAKE_IAR_ARCHIVE iarchive.exe HINTS ${__iar_hints}
DOC "The IAR archiver")
- # find auxillary tools
+ # find auxiliary tools
find_program(CMAKE_IAR_ELFTOOL ielftool.exe HINTS ${__iar_hints}
DOC "The IAR ELF Tool")
find_program(CMAKE_IAR_ELFDUMP ielfdumparm.exe HINTS ${__iar_hints}
diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake
index 52ebaf20a..43243b9d6 100644
--- a/Modules/Compiler/IAR.cmake
+++ b/Modules/Compiler/IAR.cmake
@@ -29,7 +29,7 @@
# "Silent" Operation
#
# this really is different to most programs I know.
-# nothing meaningfull from the operation is lost, just some redundant
+# nothing meaningful from the operation is lost, just some redundant
# code and data size printouts (that can be inspected with common tools).
# This module is shared by multiple languages; use include blocker.
diff --git a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
index 899e284ad..e5b97412e 100644
--- a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
+++ b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
@@ -1,6 +1,14 @@
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)")
+# if defined(__ibmxl__)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__)
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__)
+# else
+ /* __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)
+# endif
+")
diff --git a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
index 73aa2b4f9..63c3e32d6 100644
--- a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
+++ b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
@@ -1,6 +1,14 @@
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)")
+# if defined(__ibmxl__)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__)
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__)
+# else
+ /* __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)
+# endif
+")
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index 4e4af2956..3e0439faf 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -25,7 +25,8 @@ else()
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+ # todo: there is no gnu11 value supported; figure out what to do
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=c11")
endif()
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0)
diff --git a/Modules/Compiler/Intel-CXX-FeatureTests.cmake b/Modules/Compiler/Intel-CXX-FeatureTests.cmake
index 929a7c632..bbefe15de 100644
--- a/Modules/Compiler/Intel-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/Intel-CXX-FeatureTests.cmake
@@ -31,11 +31,6 @@ set(_cmake_feature_test_cxx_aggregate_default_initializers "${Intel16_CXX14}")
set(_cmake_feature_test_cxx_contextual_conversions "${Intel16_CXX14}")
set(_cmake_feature_test_cxx_generic_lambdas "__cpp_generic_lambdas >= 201304")
set(_cmake_feature_test_cxx_digit_separators "${Intel16_CXX14}")
-# This test is supposed to work in Intel 14 but the compiler has a bug
-# in versions 14 and 15::
-# https://software.intel.com/en-us/forums/intel-c-compiler/topic/600514
-# It also appears to fail with an internal compiler error on Intel 16 and 17.
-#set(_cmake_feature_test_cxx_generalized_initializers "${Intel16_CXX14}")
unset(Intel16_CXX14)
set(Intel15 "__INTEL_COMPILER >= 1500")
@@ -75,6 +70,7 @@ set(_cmake_feature_test_cxx_override "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_final "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_noexcept "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_defaulted_move_initializers "${Intel14_CXX11}")
+set(_cmake_feature_test_cxx_generalized_initializers "${Intel14_CXX11}")
unset(Intel14_CXX11)
set(Intel13_CXX11 "__INTEL_COMPILER >= 1300 && ${DETECT_CXX11}")
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 0eb9e1fd7..d9c574938 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -9,6 +9,11 @@ set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <OBJECT> -MF <DEPFILE>")
if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0)
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-Qstd=c++17")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-Qstd=c++17")
+ endif()
+
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-Qstd=c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-Qstd=c++14")
@@ -29,6 +34,12 @@ if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
else()
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0)
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
+ # todo: there is no gnu++17 value supported; figure out what to do
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=c++17")
+ endif()
+
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
# todo: there is no gnu++14 value supported; figure out what to do
diff --git a/Modules/Compiler/MSVC-ASM.cmake b/Modules/Compiler/MSVC-ASM.cmake
new file mode 100644
index 000000000..45978c5e2
--- /dev/null
+++ b/Modules/Compiler/MSVC-ASM.cmake
@@ -0,0 +1 @@
+# This file is loaded when Visual Studio is used for the ASM language.
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 1c9165458..05db548f5 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -33,3 +33,9 @@ else()
endif()
endif()
+
+# FIXME: investigate use of --options-file.
+# Tell Makefile generator that nvcc does not support @<rspfile> syntax.
+set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES 0)
+set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
+set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS 0)
diff --git a/Modules/Compiler/SunPro-CXX-FeatureTests.cmake b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake
index 60280cadc..279d87538 100644
--- a/Modules/Compiler/SunPro-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake
@@ -1,10 +1,14 @@
# Based on GNU 4.8.2
-# http://docs.oracle.com/cd/E37069_01/html/E37071/gncix.html
+# https://docs.oracle.com/cd/E37069_01/html/E37071/gncix.html
+# https://docs.oracle.com/cd/E77782_01/html/E77784/gkeza.html
# Reference: http://gcc.gnu.org/projects/cxx0x.html
set(_cmake_oldestSupported "__SUNPRO_CC >= 0x5130")
+set(SolarisStudio126_CXX11 "(__SUNPRO_CC >= 0x5150) && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_decltype_auto "${SolarisStudio126_CXX11}")
+
set(SolarisStudio125_CXX11 "(__SUNPRO_CC >= 0x5140) && __cplusplus >= 201103L")
set(_cmake_feature_test_cxx_binary_literals "${SolarisStudio125_CXX11}")
set(_cmake_feature_test_cxx_reference_qualified_functions "${SolarisStudio125_CXX11}")
diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake
index ebc79f424..e149237d4 100644
--- a/Modules/Compiler/TI-C.cmake
+++ b/Modules/Compiler/TI-C.cmake
@@ -2,6 +2,8 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
set(CMAKE_LINK_LIBRARY_FLAG "--library=")
set(CMAKE_INCLUDE_FLAG_C "--include_path=")
+set(CMAKE_DEPFILE_FLAGS_C "--preproc_with_compile --preproc_dependency=<DEPFILE>")
+
set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> --compile_only --skip_assembler --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> --preproc_only --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake
index 4104c3b18..4c6af06cd 100644
--- a/Modules/Compiler/TI-CXX.cmake
+++ b/Modules/Compiler/TI-CXX.cmake
@@ -2,6 +2,8 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
set(CMAKE_LINK_LIBRARY_FLAG "--library=")
set(CMAKE_INCLUDE_FLAG_CXX "--include_path=")
+set(CMAKE_DEPFILE_FLAGS_CXX "--preproc_with_compile --preproc_dependency=<DEPFILE>")
+
set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> --compile_only --skip_assembler --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> --preproc_only --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/XL-C-DetermineCompiler.cmake b/Modules/Compiler/XL-C-DetermineCompiler.cmake
index 3f4e05c55..484811efe 100644
--- a/Modules/Compiler/XL-C-DetermineCompiler.cmake
+++ b/Modules/Compiler/XL-C-DetermineCompiler.cmake
@@ -1,4 +1,4 @@
-set(_compiler_id_pp_test "defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800")
+set(_compiler_id_pp_test "defined(__ibmxl__) || (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
index dffa4bc21..2bf1ec69c 100644
--- a/Modules/Compiler/XL-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake
@@ -1,4 +1,4 @@
-set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800")
+set(_compiler_id_pp_test "defined(__ibmxl__) || (defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800)")
include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake
index 478378570..e527a049e 100644
--- a/Modules/Compiler/XL.cmake
+++ b/Modules/Compiler/XL.cmake
@@ -20,6 +20,8 @@ macro(__compiler_xl lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-V")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic")
+ set(CMAKE_${lang}_RESPONSE_FILE_FLAG "-qoptfile=")
+ set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-qoptfile=")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O")
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
index 8ada451a6..e758f3a9c 100644
--- a/Modules/DeployQt4.cmake
+++ b/Modules/DeployQt4.cmake
@@ -259,7 +259,8 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va
file(MAKE_DIRECTORY "${plugins_path}")
file(COPY "${plugin}" DESTINATION "${plugins_path}")
else()
- if(configurations AND (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE))
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(configurations AND (_isMultiConfig OR CMAKE_BUILD_TYPE))
set(configurations CONFIGURATIONS ${configurations})
else()
unset(configurations)
@@ -295,9 +296,16 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var)
set(plugin_debug "${plugin_release}")
endif()
- if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}_release" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel")
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(_isMultiConfig OR CMAKE_BUILD_TYPE)
+ set(_RELEASE_CONFIGS ${CMAKE_CONFIGURATION_TYPES} "${CMAKE_BUILD_TYPE}")
+ if (_RELEASE_CONFIGS)
+ list(FILTER _RELEASE_CONFIGS EXCLUDE REGEX "[Dd][Ee][Bb][Uu][Gg]")
+ endif()
+ string(REPLACE ";" "|" _RELEASE_CONFIGS "${_RELEASE_CONFIGS}")
+ install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}_release" "${plugins_dir}" "${component}" "${_RELEASE_CONFIGS}")
install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}_debug" "${plugins_dir}" "${component}" "Debug")
+ unset(_RELEASE_CONFIGS)
if(CMAKE_BUILD_TYPE MATCHES "^Debug$")
set(${installed_plugin_path_var} ${${installed_plugin_path_var}_debug})
diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake
index fc398e6c5..6e212490e 100644
--- a/Modules/Documentation.cmake
+++ b/Modules/Documentation.cmake
@@ -40,7 +40,7 @@ if (BUILD_DOCUMENTATION)
)
#
- # The documentation process is controled by a batch file.
+ # The documentation process is controlled by a batch file.
# We will probably need bash to create the custom target
#
diff --git a/Modules/ExternalProject-download.cmake.in b/Modules/ExternalProject-download.cmake.in
index 7f92596c5..99fb91781 100644
--- a/Modules/ExternalProject-download.cmake.in
+++ b/Modules/ExternalProject-download.cmake.in
@@ -116,6 +116,8 @@ foreach(i RANGE ${retry_number})
@TLS_VERIFY_CODE@
@TLS_CAINFO_CODE@
+ @NETRC_CODE@
+ @NETRC_FILE_CODE@
file(
DOWNLOAD
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 419c9d67b..db19691de 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -193,6 +193,28 @@ External Project Definition
``CMAKE_TLS_CAINFO`` variable will be used instead (see
:command:`file(DOWNLOAD)`)
+ ``NETRC <level>``
+ Specify whether the .netrc file is to be used for operation. If this
+ option is not specified, the value of the ``CMAKE_NETRC`` variable
+ will be used instead (see :command:`file(DOWNLOAD)`)
+ Valid levels are:
+
+ ``IGNORED``
+ The .netrc file is ignored.
+ This is the default.
+ ``OPTIONAL``
+ The .netrc file is optional, and information in the URL is preferred.
+ The file will be scanned to find which ever information is not specified
+ in the URL.
+ ``REQUIRED``
+ The .netrc file is required, and information in the URL is ignored.
+
+ ``NETRC_FILE <file>``
+ Specify an alternative .netrc file to the one in your home directory
+ if the ``NETRC`` level is ``OPTIONAL`` or ``REQUIRED``. If this option
+ is not specified, the value of the ``CMAKE_NETRC_FILE`` variable will
+ be used instead (see :command:`file(DOWNLOAD)`)
+
*Git*
NOTE: A git version of 1.6.5 or later is required if this download method
is used.
@@ -359,6 +381,11 @@ External Project Definition
:variable:`CMAKE_GENERATOR_TOOLSET`). It is an error to provide this
option without the ``CMAKE_GENERATOR`` option.
+ ``CMAKE_GENERATOR_INSTANCE <instance>``
+ Pass a generator-specific instance selection to the CMake command (see
+ :variable:`CMAKE_GENERATOR_INSTANCE`). It is an error to provide this
+ option without the ``CMAKE_GENERATOR`` option.
+
``CMAKE_ARGS <arg>...``
The specified arguments are passed to the ``cmake`` command line. They
can be any argument the ``cmake`` command understands, not just cache
@@ -687,8 +714,9 @@ control needed to implement such step-level capabilities.
The command line, comment, working directory and byproducts of every
standard and custom step are processed to replace the tokens
``<SOURCE_DIR>``, ``<SOURCE_SUBDIR>``, ``<BINARY_DIR>``, ``<INSTALL_DIR>``
- and ``<TMP_DIR>`` with their corresponding property values defined in the
- original call to :command:`ExternalProject_Add`.
+ ``<TMP_DIR>``, ``<DOWNLOAD_DIR>`` and ``<DOWNLOADED_FILE>`` with their
+ corresponding property values defined in the original call to
+ :command:`ExternalProject_Add`.
.. command:: ExternalProject_Add_StepTargets
@@ -1048,7 +1076,7 @@ foreach(config IN LISTS git_config)
list(APPEND git_clone_options --config \${config})
endforeach()
-# try the clone 3 times incase there is an odd git clone issue
+# try the clone 3 times in case there is an odd git clone issue
set(error_code 1)
set(number_of_tries 0)
while(error_code AND number_of_tries LESS 3)
@@ -1346,7 +1374,7 @@ endif()
endfunction(_ep_write_gitupdate_script)
-function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd http_headers)
+function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd http_headers netrc netrc_file)
if(timeout)
set(TIMEOUT_ARGS TIMEOUT ${timeout})
set(TIMEOUT_MSG "${timeout} seconds")
@@ -1371,6 +1399,8 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
set(TLS_VERIFY_CODE "")
set(TLS_CAINFO_CODE "")
+ set(NETRC_CODE "")
+ set(NETRC_FILE_CODE "")
# check for curl globals in the project
if(DEFINED CMAKE_TLS_VERIFY)
@@ -1379,6 +1409,12 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
if(DEFINED CMAKE_TLS_CAINFO)
set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")")
endif()
+ if(DEFINED CMAKE_NETRC)
+ set(NETRC_CODE "set(CMAKE_NETRC \"${CMAKE_NETRC}\")")
+ endif()
+ if(DEFINED CMAKE_NETRC_FILE)
+ set(NETRC_FILE_CODE "set(CMAKE_NETRC_FILE \"${CMAKE_NETRC_FILE}\")")
+ endif()
# now check for curl locals so that the local values
# will override the globals
@@ -1393,6 +1429,16 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
if(tls_cainfo_len GREATER 0)
set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")")
endif()
+ # check for netrc argument
+ string(LENGTH "${netrc}" netrc_len)
+ if(netrc_len GREATER 0)
+ set(NETRC_CODE "set(CMAKE_NETRC \"${netrc}\")")
+ endif()
+ # check for netrc_file argument
+ string(LENGTH "${netrc_file}" netrc_file_len)
+ if(netrc_file_len GREATER 0)
+ set(NETRC_FILE_CODE "set(CMAKE_NETRC_FILE \"${netrc_file}\")")
+ endif()
if(userpwd STREQUAL ":")
set(USERPWD_ARGS)
@@ -1620,7 +1666,7 @@ macro(_ep_replace_location_tags target_name)
set(vars ${ARGN})
foreach(var ${vars})
if(${var})
- foreach(dir SOURCE_DIR SOURCE_SUBDIR BINARY_DIR INSTALL_DIR TMP_DIR DOWNLOADED_FILE)
+ foreach(dir SOURCE_DIR SOURCE_SUBDIR BINARY_DIR INSTALL_DIR TMP_DIR DOWNLOAD_DIR DOWNLOADED_FILE)
get_property(val TARGET ${target_name} PROPERTY _EP_${dir})
string(REPLACE "<${dir}>" "${val}" ${var} "${${var}}")
endforeach()
@@ -1661,7 +1707,7 @@ function(_ep_command_line_to_initial_cache var args force)
endif()
endforeach()
# Catch the final line of the args
- if(setArg)
+ if(NOT "${setArg}" STREQUAL "")
string(APPEND setArg "${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})")
string(APPEND script_initial_cache "\n${setArg}")
endif()
@@ -1744,7 +1790,8 @@ function(_ep_get_build_command name step cmd_var)
set(cmd "${CMAKE_COMMAND}")
endif()
set(args --build ".")
- if(CMAKE_CONFIGURATION_TYPES)
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(_isMultiConfig)
if (CMAKE_CFG_INTDIR AND
NOT CMAKE_CFG_INTDIR STREQUAL "." AND
NOT CMAKE_CFG_INTDIR MATCHES "\\$")
@@ -1769,7 +1816,7 @@ function(_ep_get_build_command name step cmd_var)
if("x${step}x" STREQUAL "xTESTx")
string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}")
set(args "")
- if(CMAKE_CONFIGURATION_TYPES)
+ if(_isMultiConfig)
list(APPEND args -C ${config})
endif()
endif()
@@ -1909,7 +1956,8 @@ endfunction()
#
function(_ep_get_configuration_subdir_suffix suffix_var)
set(suffix "")
- if(CMAKE_CONFIGURATION_TYPES)
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(_isMultiConfig)
set(suffix "/${CMAKE_CFG_INTDIR}")
endif()
set(${suffix_var} "${suffix}" PARENT_SCOPE)
@@ -2039,7 +2087,8 @@ function(ExternalProject_Add_Step name step)
set_property(SOURCE ${stamp_file} PROPERTY SYMBOLIC 1)
set(touch)
# Remove any existing stamp in case the option changed in an existing tree.
- if(CMAKE_CONFIGURATION_TYPES)
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(_isMultiConfig)
foreach(cfg ${CMAKE_CONFIGURATION_TYPES})
string(REPLACE "/${CMAKE_CFG_INTDIR}" "/${cfg}" stamp_file_config "${stamp_file}")
file(REMOVE ${stamp_file_config})
@@ -2436,11 +2485,13 @@ function(_ep_add_download_command name)
get_property(no_progress TARGET ${name} PROPERTY _EP_DOWNLOAD_NO_PROGRESS)
get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO)
+ get_property(netrc TARGET ${name} PROPERTY _EP_NETRC)
+ get_property(netrc_file TARGET ${name} PROPERTY _EP_NETRC_FILE)
get_property(http_username TARGET ${name} PROPERTY _EP_HTTP_USERNAME)
get_property(http_password TARGET ${name} PROPERTY _EP_HTTP_PASSWORD)
get_property(http_headers TARGET ${name} PROPERTY _EP_HTTP_HEADER)
set(download_script "${stamp_dir}/download-${name}.cmake")
- _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}")
+ _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}" "${netrc}" "${netrc_file}")
set(cmd ${CMAKE_COMMAND} -P "${download_script}"
COMMAND)
if (no_extract)
@@ -2699,12 +2750,22 @@ function(_ep_extract_configure_command var name)
get_property(cmake_cache_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_ARGS)
get_property(cmake_cache_default_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_DEFAULT_ARGS)
- if(cmake_cache_args OR cmake_cache_default_args)
+ set(has_cmake_cache_args 0)
+ if(NOT "${cmake_cache_args}" STREQUAL "")
+ set(has_cmake_cache_args 1)
+ endif()
+
+ set(has_cmake_cache_default_args 0)
+ if(NOT "${cmake_cache_default_args}" STREQUAL "")
+ set(has_cmake_cache_default_args 1)
+ endif()
+
+ if(has_cmake_cache_args OR has_cmake_cache_default_args)
set(_ep_cache_args_script "<TMP_DIR>/${name}-cache-$<CONFIG>.cmake")
- if(cmake_cache_args)
+ if(has_cmake_cache_args)
_ep_command_line_to_initial_cache(script_initial_cache_force "${cmake_cache_args}" 1)
endif()
- if(cmake_cache_default_args)
+ if(has_cmake_cache_default_args)
_ep_command_line_to_initial_cache(script_initial_cache_default "${cmake_cache_default_args}" 0)
endif()
_ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${script_initial_cache_force}${script_initial_cache_default}")
@@ -2712,6 +2773,7 @@ function(_ep_extract_configure_command var name)
endif()
get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
+ get_target_property(cmake_generator_instance ${name} _EP_CMAKE_GENERATOR_INSTANCE)
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)
@@ -2722,6 +2784,9 @@ function(_ep_extract_configure_command var name)
if(cmake_generator_toolset)
list(APPEND cmd "-T${cmake_generator_toolset}")
endif()
+ if(cmake_generator_instance)
+ list(APPEND cmd "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${cmake_generator_instance}")
+ endif()
else()
if(CMAKE_EXTRA_GENERATOR)
list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
@@ -2740,6 +2805,12 @@ function(_ep_extract_configure_command var name)
if(CMAKE_GENERATOR_TOOLSET)
list(APPEND cmd "-T${CMAKE_GENERATOR_TOOLSET}")
endif()
+ if(cmake_generator_instance)
+ message(FATAL_ERROR "Option CMAKE_GENERATOR_INSTANCE not allowed without CMAKE_GENERATOR.")
+ endif()
+ if(CMAKE_GENERATOR_INSTANCE)
+ list(APPEND cmd "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}")
+ endif()
endif()
list(APPEND cmd "<SOURCE_DIR><SOURCE_SUBDIR>")
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index 1b93304bb..fbce235f5 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -493,7 +493,7 @@ endfunction()
by the project when available at buildtime, but it also work without.
``RECOMMENDED`` is similar to ``OPTIONAL``, i.e. the project will build if
the package is not present, but the functionality of the resulting
- binaries will be severly limited. If a ``REQUIRED`` package is not
+ binaries will be severely limited. If a ``REQUIRED`` package is not
available at buildtime, the project may not even build. This can be
combined with the ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` argument for
``feature_summary()``. Last, a ``RUNTIME`` package is a package which is
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
new file mode 100644
index 000000000..98cdf6cb9
--- /dev/null
+++ b/Modules/FetchContent.cmake
@@ -0,0 +1,916 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FetchContent
+------------------
+
+.. only:: html
+
+ .. contents::
+
+Overview
+^^^^^^^^
+
+This module enables populating content at configure time via any method
+supported by the :module:`ExternalProject` module. Whereas
+:command:`ExternalProject_Add` downloads at build time, the
+``FetchContent`` module makes content available immediately, allowing the
+configure step to use the content in commands like :command:`add_subdirectory`,
+:command:`include` or :command:`file` operations.
+
+Content population details would normally be defined separately from the
+command that performs the actual population. Projects should also
+check whether the content has already been populated somewhere else in the
+project hierarchy. Typical usage would look something like this:
+
+.. code-block:: cmake
+
+ FetchContent_Declare(
+ googletest
+ GIT_REPOSITORY https://github.com/google/googletest.git
+ GIT_TAG release-1.8.0
+ )
+
+ FetchContent_GetProperties(googletest)
+ if(NOT googletest_POPULATED)
+ FetchContent_Populate(googletest)
+ add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
+ endif()
+
+When using the above pattern with a hierarchical project arrangement,
+projects at higher levels in the hierarchy are able to define or override
+the population details of content specified anywhere lower in the project
+hierarchy. The ability to detect whether content has already been
+populated ensures that even if multiple child projects want certain content
+to be available, the first one to populate it wins. The other child project
+can simply make use of the already available content instead of repeating
+the population for itself. See the
+:ref:`Examples <fetch-content-examples>` section which demonstrates
+this scenario.
+
+The ``FetchContent`` module also supports defining and populating
+content in a single call, with no check for whether the content has been
+populated elsewhere in the project already. This is a more low level
+operation and would not normally be the way the module is used, but it is
+sometimes useful as part of implementing some higher level feature or to
+populate some content in CMake's script mode.
+
+
+Declaring Content Details
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. command:: FetchContent_Declare
+
+ .. code-block:: cmake
+
+ FetchContent_Declare(<name> <contentOptions>...)
+
+ The ``FetchContent_Declare()`` function records the options that describe
+ how to populate the specified content, but if such details have already
+ been recorded earlier in this project (regardless of where in the project
+ hierarchy), this and all later calls for the same content ``<name>`` are
+ ignored. This "first to record, wins" approach is what allows hierarchical
+ projects to have parent projects override content details of child projects.
+
+ The content ``<name>`` can be any string without spaces, but good practice
+ would be to use only letters, numbers and underscores. The name will be
+ treated case-insensitively and it should be obvious for the content it
+ represents, often being the name of the child project or the value given
+ to its top level :command:`project` command (if it is a CMake project).
+ For well-known public projects, the name should generally be the official
+ name of the project. Choosing an unusual name makes it unlikely that other
+ projects needing that same content will use the same name, leading to
+ the content being populated multiple times.
+
+ The ``<contentOptions>`` can be any of the download or update/patch options
+ that the :command:`ExternalProject_Add` command understands. The configure,
+ build, install and test steps are explicitly disabled and therefore options
+ related to them will be ignored. In most cases, ``<contentOptions>`` will
+ just be a couple of options defining the download method and method-specific
+ details like a commit tag or archive hash. For example:
+
+ .. code-block:: cmake
+
+ FetchContent_Declare(
+ googletest
+ GIT_REPOSITORY https://github.com/google/googletest.git
+ GIT_TAG release-1.8.0
+ )
+
+ FetchContent_Declare(
+ myCompanyIcons
+ URL https://intranet.mycompany.com/assets/iconset_1.12.tar.gz
+ URL_HASH 5588a7b18261c20068beabfb4f530b87
+ )
+
+ FetchContent_Declare(
+ myCompanyCertificates
+ SVN_REPOSITORY svn+ssh://svn.mycompany.com/srv/svn/trunk/certs
+ SVN_REVISION -r12345
+ )
+
+Populating The Content
+^^^^^^^^^^^^^^^^^^^^^^
+
+.. command:: FetchContent_Populate
+
+ .. code-block:: cmake
+
+ FetchContent_Populate( <name> )
+
+ In most cases, the only argument given to ``FetchContent_Populate()`` is the
+ ``<name>``. When used this way, the command assumes the content details have
+ been recorded by an earlier call to :command:`FetchContent_Declare`. The
+ details are stored in a global property, so they are unaffected by things
+ like variable or directory scope. Therefore, it doesn't matter where in the
+ project the details were previously declared, as long as they have been
+ declared before the call to ``FetchContent_Populate()``. Those saved details
+ are then used to construct a call to :command:`ExternalProject_Add` in a
+ private sub-build to perform the content population immediately. The
+ implementation of ``ExternalProject_Add()`` ensures that if the content has
+ already been populated in a previous CMake run, that content will be reused
+ rather than repopulating them again. For the common case where population
+ involves downloading content, the cost of the download is only paid once.
+
+ An internal global property records when a particular content population
+ request has been processed. If ``FetchContent_Populate()`` is called more
+ than once for the same content name within a configure run, the second call
+ will halt with an error. Projects can and should check whether content
+ population has already been processed with the
+ :command:`FetchContent_GetProperties` command before calling
+ ``FetchContent_Populate()``.
+
+ ``FetchContent_Populate()`` will set three variables in the scope of the
+ caller; ``<lcName>_POPULATED``, ``<lcName>_SOURCE_DIR`` and
+ ``<lcName>_BINARY_DIR``, where ``<lcName>`` is the lowercased ``<name>``.
+ ``<lcName>_POPULATED`` will always be set to ``True`` by the call.
+ ``<lcName>_SOURCE_DIR`` is the location where the
+ content can be found upon return (it will have already been populated), while
+ ``<lcName>_BINARY_DIR`` is a directory intended for use as a corresponding
+ build directory. The main use case for the two directory variables is to
+ call :command:`add_subdirectory` immediately after population, i.e.:
+
+ .. code-block:: cmake
+
+ FetchContent_Populate(FooBar ...)
+ add_subdirectory(${foobar_SOURCE_DIR} ${foobar_BINARY_DIR})
+
+ The values of the three variables can also be retrieved from anywhere in the
+ project hierarchy using the :command:`FetchContent_GetProperties` command.
+
+ A number of cache variables influence the behavior of all content population
+ performed using details saved from a :command:`FetchContent_Declare` call:
+
+ ``FETCHCONTENT_BASE_DIR``
+ In most cases, the saved details do not specify any options relating to the
+ directories to use for the internal sub-build, final source and build areas.
+ It is generally best to leave these decisions up to the ``FetchContent``
+ module to handle on the project's behalf. The ``FETCHCONTENT_BASE_DIR``
+ cache variable controls the point under which all content population
+ directories are collected, but in most cases developers would not need to
+ change this. The default location is ``${CMAKE_BINARY_DIR}/_deps``, but if
+ developers change this value, they should aim to keep the path short and
+ just below the top level of the build tree to avoid running into path
+ length problems on Windows.
+
+ ``FETCHCONTENT_QUIET``
+ The logging output during population can be quite verbose, making the
+ configure stage quite noisy. This cache option (``ON`` by default) hides
+ all population output unless an error is encountered. If experiencing
+ problems with hung downloads, temporarily switching this option off may
+ help diagnose which content population is causing the issue.
+
+ ``FETCHCONTENT_FULLY_DISCONNECTED``
+ When this option is enabled, no attempt is made to download or update
+ any content. It is assumed that all content has already been populated in
+ a previous run or the source directories have been pointed at existing
+ contents the developer has provided manually (using options described
+ further below). When the developer knows that no changes have been made to
+ any content details, turning this option ``ON`` can significantly speed up
+ the configure stage. It is ``OFF`` by default.
+
+ ``FETCHCONTENT_UPDATES_DISCONNECTED``
+ This is a less severe download/update control compared to
+ ``FETCHCONTENT_FULLY_DISCONNECTED``. Instead of bypassing all download and
+ update logic, the ``FETCHCONTENT_UPDATES_DISCONNECTED`` only disables the
+ update stage. Therefore, if content has not been downloaded previously,
+ it will still be downloaded when this option is enabled. This can speed up
+ the configure stage, but not as much as
+ ``FETCHCONTENT_FULLY_DISCONNECTED``. It is ``OFF`` by default.
+
+ In addition to the above cache variables, the following cache variables are
+ also defined for each content name (``<ucName>`` is the uppercased value of
+ ``<name>``):
+
+ ``FETCHCONTENT_SOURCE_DIR_<ucName>``
+ If this is set, no download or update steps are performed for the specified
+ content and the ``<lcName>_SOURCE_DIR`` variable returned to the caller is
+ pointed at this location. This gives developers a way to have a separate
+ checkout of the content that they can modify freely without interference
+ from the build. The build simply uses that existing source, but it still
+ defines ``<lcName>_BINARY_DIR`` to point inside its own build area.
+ Developers are strongly encouraged to use this mechanism rather than
+ editing the sources populated in the default location, as changes to
+ sources in the default location can be lost when content population details
+ are changed by the project.
+
+ ``FETCHCONTENT_UPDATES_DISCONNECTED_<ucName>``
+ This is the per-content equivalent of
+ ``FETCHCONTENT_UPDATES_DISCONNECTED``. If the global option or this option
+ is ``ON``, then updates will be disabled for the named content.
+ Disabling updates for individual content can be useful for content whose
+ details rarely change, while still leaving other frequently changing
+ content with updates enabled.
+
+
+ The ``FetchContent_Populate()`` command also supports a syntax allowing the
+ content details to be specified directly rather than using any saved
+ details. This is more low-level and use of this form is generally to be
+ avoided in favour of using saved content details as outlined above.
+ Nevertheless, in certain situations it can be useful to invoke the content
+ population as an isolated operation (typically as part of implementing some
+ other higher level feature or when using CMake in script mode):
+
+ .. code-block:: cmake
+
+ FetchContent_Populate( <name>
+ [QUIET]
+ [SUBBUILD_DIR <subBuildDir>]
+ [SOURCE_DIR <srcDir>]
+ [BINARY_DIR <binDir>]
+ ...
+ )
+
+ This form has a number of key differences to that where only ``<name>`` is
+ provided:
+
+ - All required population details are assumed to have been provided directly
+ in the call to ``FetchContent_Populate()``. Any saved details for
+ ``<name>`` are ignored.
+ - No check is made for whether content for ``<name>`` has already been
+ populated.
+ - No global property is set to record that the population has occurred.
+ - No global properties record the source or binary directories used for the
+ populated content.
+ - The ``FETCHCONTENT_FULLY_DISCONNECTED`` and
+ ``FETCHCONTENT_UPDATES_DISCONNECTED`` cache variables are ignored.
+
+ The ``<lcName>_SOURCE_DIR`` and ``<lcName>_BINARY_DIR`` variables are still
+ returned to the caller, but since these locations are not stored as global
+ properties when this form is used, they are only available to the calling
+ scope and below rather than the entire project hierarchy. No
+ ``<lcName>_POPULATED`` variable is set in the caller's scope with this form.
+
+ The supported options for ``FetchContent_Populate()`` are the same as those
+ for :command:`FetchContent_Declare()`. Those few options shown just
+ above are either specific to ``FetchContent_Populate()`` or their behavior is
+ slightly modified from how :command:`ExternalProject_Add` treats them.
+
+ ``QUIET``
+ The ``QUIET`` option can be given to hide the output associated with
+ populating the specified content. If the population fails, the output will
+ be shown regardless of whether this option was given or not so that the
+ cause of the failure can be diagnosed. The global ``FETCHCONTENT_QUIET``
+ cache variable has no effect on ``FetchContent_Populate()`` calls where the
+ content details are provided directly.
+
+ ``SUBBUILD_DIR``
+ The ``SUBBUILD_DIR`` argument can be provided to change the location of the
+ sub-build created to perform the population. The default value is
+ ``${CMAKE_CURRENT_BINARY_DIR}/<lcName>-subbuild`` and it would be unusual
+ to need to override this default. If a relative path is specified, it will
+ be interpreted as relative to :variable:`CMAKE_CURRENT_BINARY_DIR`.
+
+ ``SOURCE_DIR``, ``BINARY_DIR``
+ The ``SOURCE_DIR`` and ``BINARY_DIR`` arguments are supported by
+ :command:`ExternalProject_Add`, but different default values are used by
+ ``FetchContent_Populate()``. ``SOURCE_DIR`` defaults to
+ ``${CMAKE_CURRENT_BINARY_DIR}/<lcName>-src`` and ``BINARY_DIR`` defaults to
+ ``${CMAKE_CURRENT_BINARY_DIR}/<lcName>-build``. If a relative path is
+ specified, it will be interpreted as relative to
+ :variable:`CMAKE_CURRENT_BINARY_DIR`.
+
+ In addition to the above explicit options, any other unrecognized options are
+ passed through unmodified to :command:`ExternalProject_Add` to perform the
+ download, patch and update steps. The following options are explicitly
+ prohibited (they are disabled by the ``FetchContent_Populate()`` command):
+
+ - ``CONFIGURE_COMMAND``
+ - ``BUILD_COMMAND``
+ - ``INSTALL_COMMAND``
+ - ``TEST_COMMAND``
+
+ If using ``FetchContent_Populate()`` within CMake's script mode, be aware
+ that the implementation sets up a sub-build which therefore requires a CMake
+ generator and build tool to be available. If these cannot be found by
+ default, then the :variable:`CMAKE_GENERATOR` and/or
+ :variable:`CMAKE_MAKE_PROGRAM` variables will need to be set appropriately
+ on the command line invoking the script.
+
+
+Retrieve Population Properties
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. command:: FetchContent_GetProperties
+
+ When using saved content details, a call to :command:`FetchContent_Populate`
+ records information in global properties which can be queried at any time.
+ This information includes the source and binary directories associated with
+ the content and also whether or not the content population has been processed
+ during the current configure run.
+
+ .. code-block:: cmake
+
+ FetchContent_GetProperties( <name>
+ [SOURCE_DIR <srcDirVar>]
+ [BINARY_DIR <binDirVar>]
+ [POPULATED <doneVar>]
+ )
+
+ The ``SOURCE_DIR``, ``BINARY_DIR`` and ``POPULATED`` options can be used to
+ specify which properties should be retrieved. Each option accepts a value
+ which is the name of the variable in which to store that property. Most of
+ the time though, only ``<name>`` is given, in which case the call will then
+ set the same variables as a call to
+ :command:`FetchContent_Populate(name) <FetchContent_Populate>`. This allows
+ the following canonical pattern to be used, which ensures that the relevant
+ variables will always be defined regardless of whether or not the population
+ has been performed elsewhere in the project already:
+
+ .. code-block:: cmake
+
+ FetchContent_GetProperties(foobar)
+ if(NOT foobar_POPULATED)
+ FetchContent_Populate(foobar)
+
+ # Set any custom variables, etc. here, then
+ # populate the content as part of this build
+
+ add_subdirectory(${foobar_SOURCE_DIR} ${foobar_BINARY_DIR})
+ endif()
+
+ The above pattern allows other parts of the overall project hierarchy to
+ re-use the same content and ensure that it is only populated once.
+
+
+.. _`fetch-content-examples`:
+
+Examples
+^^^^^^^^
+
+Consider a project hierarchy where ``projA`` is the top level project and it
+depends on projects ``projB`` and ``projC``. Both ``projB`` and ``projC``
+can be built standalone and they also both depend on another project
+``projD``. For simplicity, this example will assume that all four projects
+are available on a company git server. The ``CMakeLists.txt`` of each project
+might have sections like the following:
+
+*projA*:
+
+.. code-block:: cmake
+
+ include(FetchContent)
+ FetchContent_Declare(
+ projB
+ GIT_REPOSITORY git@mycompany.com/git/projB.git
+ GIT_TAG 4a89dc7e24ff212a7b5167bef7ab079d
+ )
+ FetchContent_Declare(
+ projC
+ GIT_REPOSITORY git@mycompany.com/git/projC.git
+ GIT_TAG 4ad4016bd1d8d5412d135cf8ceea1bb9
+ )
+ FetchContent_Declare(
+ projD
+ GIT_REPOSITORY git@mycompany.com/git/projD.git
+ GIT_TAG origin/integrationBranch
+ )
+
+ FetchContent_GetProperties(projB)
+ if(NOT projb_POPULATED)
+ FetchContent_Populate(projB)
+ add_subdirectory(${projb_SOURCE_DIR} ${projb_BINARY_DIR})
+ endif()
+
+ FetchContent_GetProperties(projC)
+ if(NOT projc_POPULATED)
+ FetchContent_Populate(projC)
+ add_subdirectory(${projc_SOURCE_DIR} ${projc_BINARY_DIR})
+ endif()
+
+*projB*:
+
+.. code-block:: cmake
+
+ include(FetchContent)
+ FetchContent_Declare(
+ projD
+ GIT_REPOSITORY git@mycompany.com/git/projD.git
+ GIT_TAG 20b415f9034bbd2a2e8216e9a5c9e632
+ )
+
+ FetchContent_GetProperties(projD)
+ if(NOT projd_POPULATED)
+ FetchContent_Populate(projD)
+ add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR})
+ endif()
+
+
+*projC*:
+
+.. code-block:: cmake
+
+ include(FetchContent)
+ FetchContent_Declare(
+ projD
+ GIT_REPOSITORY git@mycompany.com/git/projD.git
+ GIT_TAG 7d9a17ad2c962aa13e2fbb8043fb6b8a
+ )
+
+ FetchContent_GetProperties(projD)
+ if(NOT projd_POPULATED)
+ FetchContent_Populate(projD)
+ add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR})
+ endif()
+
+A few key points should be noted in the above:
+
+- ``projB`` and ``projC`` define different content details for ``projD``,
+ but ``projA`` also defines a set of content details for ``projD`` and
+ because ``projA`` will define them first, the details from ``projB`` and
+ ``projC`` will not be used. The override details defined by ``projA``
+ are not required to match either of those from ``projB`` or ``projC``, but
+ it is up to the higher level project to ensure that the details it does
+ define still make sense for the child projects.
+- While ``projA`` defined content details for ``projD``, it did not need
+ to explicitly call ``FetchContent_Populate(projD)`` itself. Instead, it
+ leaves that to a child project to do (in this case it will be ``projB``
+ since it is added to the build ahead of ``projC``). If ``projA`` needed to
+ customize how the ``projD`` content was brought into the build as well
+ (e.g. define some CMake variables before calling
+ :command:`add_subdirectory` after populating), it would do the call to
+ ``FetchContent_Populate()``, etc. just as it did for the ``projB`` and
+ ``projC`` content. For higher level projects, it is usually enough to
+ just define the override content details and leave the actual population
+ to the child projects. This saves repeating the same thing at each level
+ of the project hierarchy unnecessarily.
+- Even though ``projA`` is the top level project in this example, it still
+ checks whether ``projB`` and ``projC`` have already been populated before
+ going ahead to do those populations. This makes ``projA`` able to be more
+ easily incorporated as a child of some other higher level project in the
+ future if required. Always protect a call to
+ :command:`FetchContent_Populate` with a check to
+ :command:`FetchContent_GetProperties`, even in what may be considered a top
+ level project at the time.
+
+
+The following example demonstrates how one might download and unpack a
+firmware tarball using CMake's :manual:`script mode <cmake(1)>`. The call to
+:command:`FetchContent_Populate` specifies all the content details and the
+unpacked firmware will be placed in a ``firmware`` directory below the
+current working directory.
+
+*getFirmware.cmake*:
+
+.. code-block:: cmake
+
+ # NOTE: Intended to be run in script mode with cmake -P
+ include(FetchContent)
+ FetchContent_Populate(
+ firmware
+ URL https://mycompany.com/assets/firmware-1.23-arm.tar.gz
+ URL_HASH MD5=68247684da89b608d466253762b0ff11
+ SOURCE_DIR firmware
+ )
+
+#]=======================================================================]
+
+
+set(__FetchContent_privateDir "${CMAKE_CURRENT_LIST_DIR}/FetchContent")
+
+#=======================================================================
+# Recording and retrieving content details for later population
+#=======================================================================
+
+# Internal use, projects must not call this directly. It is
+# intended for use by FetchContent_Declare() only.
+#
+# Sets a content-specific global property (not meant for use
+# outside of functions defined here in this file) which can later
+# be retrieved using __FetchContent_getSavedDetails() with just the
+# same content name. If there is already a value stored in the
+# property, it is left unchanged and this call has no effect.
+# This allows parent projects to define the content details,
+# overriding anything a child project may try to set (properties
+# are not cached between runs, so the first thing to set it in a
+# build will be in control).
+function(__FetchContent_declareDetails contentName)
+
+ string(TOLOWER ${contentName} contentNameLower)
+ set(propertyName "_FetchContent_${contentNameLower}_savedDetails")
+ get_property(alreadyDefined GLOBAL PROPERTY ${propertyName} DEFINED)
+ if(NOT alreadyDefined)
+ define_property(GLOBAL PROPERTY ${propertyName}
+ BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()"
+ FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}"
+ )
+ set_property(GLOBAL PROPERTY ${propertyName} ${ARGN})
+ endif()
+
+endfunction()
+
+
+# Internal use, projects must not call this directly. It is
+# intended for use by the FetchContent_Declare() function.
+#
+# Retrieves details saved for the specified content in an
+# earlier call to __FetchContent_declareDetails().
+function(__FetchContent_getSavedDetails contentName outVar)
+
+ string(TOLOWER ${contentName} contentNameLower)
+ set(propertyName "_FetchContent_${contentNameLower}_savedDetails")
+ get_property(alreadyDefined GLOBAL PROPERTY ${propertyName} DEFINED)
+ if(NOT alreadyDefined)
+ message(FATAL_ERROR "No content details recorded for ${contentName}")
+ endif()
+ get_property(propertyValue GLOBAL PROPERTY ${propertyName})
+ set(${outVar} "${propertyValue}" PARENT_SCOPE)
+
+endfunction()
+
+
+# Saves population details of the content, sets defaults for the
+# SOURCE_DIR and BUILD_DIR.
+function(FetchContent_Declare contentName)
+
+ set(options "")
+ set(oneValueArgs SVN_REPOSITORY)
+ set(multiValueArgs "")
+
+ cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ unset(srcDirSuffix)
+ unset(svnRepoArgs)
+ if(ARG_SVN_REPOSITORY)
+ # Add a hash of the svn repository URL to the source dir. This works
+ # around the problem where if the URL changes, the download would
+ # fail because it tries to checkout/update rather than switch the
+ # old URL to the new one. We limit the hash to the first 7 characters
+ # so that the source path doesn't get overly long (which can be a
+ # problem on windows due to path length limits).
+ string(SHA1 urlSHA ${ARG_SVN_REPOSITORY})
+ string(SUBSTRING ${urlSHA} 0 7 urlSHA)
+ set(srcDirSuffix "-${urlSHA}")
+ set(svnRepoArgs SVN_REPOSITORY ${ARG_SVN_REPOSITORY})
+ endif()
+
+ string(TOLOWER ${contentName} contentNameLower)
+ __FetchContent_declareDetails(
+ ${contentNameLower}
+ SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-src${srcDirSuffix}"
+ BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build"
+ ${svnRepoArgs}
+ # List these last so they can override things we set above
+ ${ARG_UNPARSED_ARGUMENTS}
+ )
+
+endfunction()
+
+
+#=======================================================================
+# Set/get whether the specified content has been populated yet.
+# The setter also records the source and binary dirs used.
+#=======================================================================
+
+# Internal use, projects must not call this directly. It is
+# intended for use by the FetchContent_Populate() function to
+# record when FetchContent_Populate() is called for a particular
+# content name.
+function(__FetchContent_setPopulated contentName sourceDir binaryDir)
+
+ string(TOLOWER ${contentName} contentNameLower)
+ set(prefix "_FetchContent_${contentNameLower}")
+
+ set(propertyName "${prefix}_sourceDir")
+ define_property(GLOBAL PROPERTY ${propertyName}
+ BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()"
+ FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}"
+ )
+ set_property(GLOBAL PROPERTY ${propertyName} ${sourceDir})
+
+ set(propertyName "${prefix}_binaryDir")
+ define_property(GLOBAL PROPERTY ${propertyName}
+ BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()"
+ FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}"
+ )
+ set_property(GLOBAL PROPERTY ${propertyName} ${binaryDir})
+
+ set(propertyName "${prefix}_populated")
+ define_property(GLOBAL PROPERTY ${propertyName}
+ BRIEF_DOCS "Internal implementation detail of FetchContent_Populate()"
+ FULL_DOCS "Details used by FetchContent_Populate() for ${contentName}"
+ )
+ set_property(GLOBAL PROPERTY ${propertyName} True)
+
+endfunction()
+
+
+# Set variables in the calling scope for any of the retrievable
+# properties. If no specific properties are requested, variables
+# will be set for all retrievable properties.
+#
+# This function is intended to also be used by projects as the canonical
+# way to detect whether they should call FetchContent_Populate()
+# and pull the populated source into the build with add_subdirectory(),
+# if they are using the populated content in that way.
+function(FetchContent_GetProperties contentName)
+
+ string(TOLOWER ${contentName} contentNameLower)
+
+ set(options "")
+ set(oneValueArgs SOURCE_DIR BINARY_DIR POPULATED)
+ set(multiValueArgs "")
+
+ cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if(NOT ARG_SOURCE_DIR AND
+ NOT ARG_BINARY_DIR AND
+ NOT ARG_POPULATED)
+ # No specific properties requested, provide them all
+ set(ARG_SOURCE_DIR ${contentNameLower}_SOURCE_DIR)
+ set(ARG_BINARY_DIR ${contentNameLower}_BINARY_DIR)
+ set(ARG_POPULATED ${contentNameLower}_POPULATED)
+ endif()
+
+ set(prefix "_FetchContent_${contentNameLower}")
+
+ if(ARG_SOURCE_DIR)
+ set(propertyName "${prefix}_sourceDir")
+ get_property(value GLOBAL PROPERTY ${propertyName})
+ if(value)
+ set(${ARG_SOURCE_DIR} ${value} PARENT_SCOPE)
+ endif()
+ endif()
+
+ if(ARG_BINARY_DIR)
+ set(propertyName "${prefix}_binaryDir")
+ get_property(value GLOBAL PROPERTY ${propertyName})
+ if(value)
+ set(${ARG_BINARY_DIR} ${value} PARENT_SCOPE)
+ endif()
+ endif()
+
+ if(ARG_POPULATED)
+ set(propertyName "${prefix}_populated")
+ get_property(value GLOBAL PROPERTY ${propertyName} DEFINED)
+ set(${ARG_POPULATED} ${value} PARENT_SCOPE)
+ endif()
+
+endfunction()
+
+
+#=======================================================================
+# Performing the population
+#=======================================================================
+
+# The value of contentName will always have been lowercased by the caller.
+# All other arguments are assumed to be options that are understood by
+# ExternalProject_Add(), except for QUIET and SUBBUILD_DIR.
+function(__FetchContent_directPopulate contentName)
+
+ set(options
+ QUIET
+ )
+ set(oneValueArgs
+ SUBBUILD_DIR
+ SOURCE_DIR
+ BINARY_DIR
+ # Prevent the following from being passed through
+ CONFIGURE_COMMAND
+ BUILD_COMMAND
+ INSTALL_COMMAND
+ TEST_COMMAND
+ )
+ set(multiValueArgs "")
+
+ cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if(NOT ARG_SUBBUILD_DIR)
+ message(FATAL_ERROR "Internal error: SUBBUILD_DIR not set")
+ elseif(NOT IS_ABSOLUTE "${ARG_SUBBUILD_DIR}")
+ set(ARG_SUBBUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_SUBBUILD_DIR}")
+ endif()
+
+ if(NOT ARG_SOURCE_DIR)
+ message(FATAL_ERROR "Internal error: SOURCE_DIR not set")
+ elseif(NOT IS_ABSOLUTE "${ARG_SOURCE_DIR}")
+ set(ARG_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_SOURCE_DIR}")
+ endif()
+
+ if(NOT ARG_BINARY_DIR)
+ message(FATAL_ERROR "Internal error: BINARY_DIR not set")
+ elseif(NOT IS_ABSOLUTE "${ARG_BINARY_DIR}")
+ set(ARG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_BINARY_DIR}")
+ endif()
+
+ # Ensure the caller can know where to find the source and build directories
+ # with some convenient variables. Doing this here ensures the caller sees
+ # the correct result in the case where the default values are overridden by
+ # the content details set by the project.
+ set(${contentName}_SOURCE_DIR "${ARG_SOURCE_DIR}" PARENT_SCOPE)
+ set(${contentName}_BINARY_DIR "${ARG_BINARY_DIR}" PARENT_SCOPE)
+
+ # The unparsed arguments may contain spaces, so build up ARG_EXTRA
+ # in such a way that it correctly substitutes into the generated
+ # CMakeLists.txt file with each argument quoted.
+ unset(ARG_EXTRA)
+ foreach(arg IN LISTS ARG_UNPARSED_ARGUMENTS)
+ set(ARG_EXTRA "${ARG_EXTRA} \"${arg}\"")
+ endforeach()
+
+ # Hide output if requested, but save it to a variable in case there's an
+ # error so we can show the output upon failure. When not quiet, don't
+ # capture the output to a variable because the user may want to see the
+ # output as it happens (e.g. progress during long downloads). Combine both
+ # stdout and stderr in the one capture variable so the output stays in order.
+ if (ARG_QUIET)
+ set(outputOptions
+ OUTPUT_VARIABLE capturedOutput
+ ERROR_VARIABLE capturedOutput
+ )
+ else()
+ set(capturedOutput)
+ set(outputOptions)
+ message(STATUS "Populating ${contentName}")
+ endif()
+
+ if(CMAKE_GENERATOR)
+ set(generatorOpts "-G${CMAKE_GENERATOR}")
+ if(CMAKE_GENERATOR_PLATFORM)
+ list(APPEND generatorOpts "-A${CMAKE_GENERATOR_PLATFORM}")
+ endif()
+ if(CMAKE_GENERATOR_TOOLSET)
+ list(APPEND generatorOpts "-T${CMAKE_GENERATOR_TOOLSET}")
+ endif()
+
+ if(CMAKE_MAKE_PROGRAM)
+ list(APPEND generatorOpts "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}")
+ endif()
+
+ else()
+ # Likely we've been invoked via CMake's script mode where no
+ # generator is set (and hence CMAKE_MAKE_PROGRAM could not be
+ # trusted even if provided). We will have to rely on being
+ # able to find the default generator and build tool.
+ unset(generatorOpts)
+ endif()
+
+ # Create and build a separate CMake project to carry out the population.
+ # If we've already previously done these steps, they will not cause
+ # anything to be updated, so extra rebuilds of the project won't occur.
+ # Make sure to pass through CMAKE_MAKE_PROGRAM in case the main project
+ # has this set to something not findable on the PATH.
+ configure_file("${__FetchContent_privateDir}/CMakeLists.cmake.in"
+ "${ARG_SUBBUILD_DIR}/CMakeLists.txt")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} ${generatorOpts} .
+ RESULT_VARIABLE result
+ ${outputOptions}
+ WORKING_DIRECTORY "${ARG_SUBBUILD_DIR}"
+ )
+ if(result)
+ if(capturedOutput)
+ message("${capturedOutput}")
+ endif()
+ message(FATAL_ERROR "CMake step for ${contentName} failed: ${result}")
+ endif()
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} --build .
+ RESULT_VARIABLE result
+ ${outputOptions}
+ WORKING_DIRECTORY "${ARG_SUBBUILD_DIR}"
+ )
+ if(result)
+ if(capturedOutput)
+ message("${capturedOutput}")
+ endif()
+ message(FATAL_ERROR "Build step for ${contentName} failed: ${result}")
+ endif()
+
+endfunction()
+
+
+option(FETCHCONTENT_FULLY_DISCONNECTED "Disables all attempts to download or update content and assumes source dirs already exist")
+option(FETCHCONTENT_UPDATES_DISCONNECTED "Enables UPDATE_DISCONNECTED behavior for all content population")
+option(FETCHCONTENT_QUIET "Enables QUIET option for all content population" ON)
+set(FETCHCONTENT_BASE_DIR "${CMAKE_BINARY_DIR}/_deps" CACHE PATH "Directory under which to collect all populated content")
+
+# Populate the specified content using details stored from
+# an earlier call to FetchContent_Declare().
+function(FetchContent_Populate contentName)
+
+ if(NOT contentName)
+ message(FATAL_ERROR "Empty contentName not allowed for FetchContent_Populate()")
+ endif()
+
+ string(TOLOWER ${contentName} contentNameLower)
+
+ if(ARGN)
+ # This is the direct population form with details fully specified
+ # as part of the call, so we already have everything we need
+ __FetchContent_directPopulate(
+ ${contentNameLower}
+ SUBBUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${contentNameLower}-subbuild"
+ SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${contentNameLower}-src"
+ BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${contentNameLower}-build"
+ ${ARGN} # Could override any of the above ..._DIR variables
+ )
+
+ # Pass source and binary dir variables back to the caller
+ set(${contentNameLower}_SOURCE_DIR "${${contentNameLower}_SOURCE_DIR}" PARENT_SCOPE)
+ set(${contentNameLower}_BINARY_DIR "${${contentNameLower}_BINARY_DIR}" PARENT_SCOPE)
+
+ # Don't set global properties, or record that we did this population, since
+ # this was a direct call outside of the normal declared details form.
+ # We only want to save values in the global properties for content that
+ # honours the hierarchical details mechanism so that projects are not
+ # robbed of the ability to override details set in nested projects.
+ return()
+ endif()
+
+ # No details provided, so assume they were saved from an earlier call
+ # to FetchContent_Declare(). Do a check that we haven't already
+ # populated this content before in case the caller forgot to check.
+ FetchContent_GetProperties(${contentName})
+ if(${contentNameLower}_POPULATED)
+ message(FATAL_ERROR "Content ${contentName} already populated in ${${contentNameLower}_SOURCE_DIR}")
+ endif()
+
+ string(TOUPPER ${contentName} contentNameUpper)
+ set(FETCHCONTENT_SOURCE_DIR_${contentNameUpper}
+ "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}"
+ CACHE PATH "When not empty, overrides where to find pre-populated content for ${contentName}")
+
+ if(FETCHCONTENT_SOURCE_DIR_${contentNameUpper})
+ # The source directory has been explicitly provided in the cache,
+ # so no population is required
+ set(${contentNameLower}_SOURCE_DIR "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}")
+ set(${contentNameLower}_BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build")
+
+ elseif(FETCHCONTENT_FULLY_DISCONNECTED)
+ # Bypass population and assume source is already there from a previous run
+ set(${contentNameLower}_SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-src")
+ set(${contentNameLower}_BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build")
+
+ else()
+ # Support both a global "disconnect all updates" and a per-content
+ # update test (either one being set disables updates for this content).
+ option(FETCHCONTENT_UPDATES_DISCONNECTED_${contentNameUpper}
+ "Enables UPDATE_DISCONNECTED behavior just for population of ${contentName}")
+ if(FETCHCONTENT_UPDATES_DISCONNECTED OR
+ FETCHCONTENT_UPDATES_DISCONNECTED_${contentNameUpper})
+ set(disconnectUpdates True)
+ else()
+ set(disconnectUpdates False)
+ endif()
+
+ if(FETCHCONTENT_QUIET)
+ set(quietFlag QUIET)
+ else()
+ unset(quietFlag)
+ endif()
+
+ __FetchContent_getSavedDetails(${contentName} contentDetails)
+ if("${contentDetails}" STREQUAL "")
+ message(FATAL_ERROR "No details have been set for content: ${contentName}")
+ endif()
+
+ __FetchContent_directPopulate(
+ ${contentNameLower}
+ ${quietFlag}
+ UPDATE_DISCONNECTED ${disconnectUpdates}
+ SUBBUILD_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-subbuild"
+ SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-src"
+ BINARY_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-build"
+ # Put the saved details last so they can override any of the
+ # the options we set above (this can include SOURCE_DIR or
+ # BUILD_DIR)
+ ${contentDetails}
+ )
+ endif()
+
+ __FetchContent_setPopulated(
+ ${contentName}
+ ${${contentNameLower}_SOURCE_DIR}
+ ${${contentNameLower}_BINARY_DIR}
+ )
+
+ # Pass variables back to the caller. The variables passed back here
+ # must match what FetchContent_GetProperties() sets when it is called
+ # with just the content name.
+ set(${contentNameLower}_SOURCE_DIR "${${contentNameLower}_SOURCE_DIR}" PARENT_SCOPE)
+ set(${contentNameLower}_BINARY_DIR "${${contentNameLower}_BINARY_DIR}" PARENT_SCOPE)
+ set(${contentNameLower}_POPULATED True PARENT_SCOPE)
+
+endfunction()
diff --git a/Modules/FetchContent/CMakeLists.cmake.in b/Modules/FetchContent/CMakeLists.cmake.in
new file mode 100644
index 000000000..9a7a7715a
--- /dev/null
+++ b/Modules/FetchContent/CMakeLists.cmake.in
@@ -0,0 +1,21 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+cmake_minimum_required(VERSION ${CMAKE_VERSION})
+
+# We name the project and the target for the ExternalProject_Add() call
+# to something that will highlight to the user what we are working on if
+# something goes wrong and an error message is produced.
+
+project(${contentName}-populate NONE)
+
+include(ExternalProject)
+ExternalProject_Add(${contentName}-populate
+ ${ARG_EXTRA}
+ SOURCE_DIR "${ARG_SOURCE_DIR}"
+ BINARY_DIR "${ARG_BINARY_DIR}"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+)
diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake
index 88a2a25b0..2df29cacb 100644
--- a/Modules/FindAVIFile.cmake
+++ b/Modules/FindAVIFile.cmake
@@ -21,14 +21,8 @@
if (UNIX)
- find_path(AVIFILE_INCLUDE_DIR avifile.h
- /usr/local/avifile/include
- /usr/local/include/avifile
- )
-
- find_library(AVIFILE_AVIPLAY_LIBRARY aviplay
- /usr/local/avifile/lib
- )
+ find_path(AVIFILE_INCLUDE_DIR avifile.h PATH_SUFFIXES avifile/include include/avifile include/avifile-0.7)
+ find_library(AVIFILE_AVIPLAY_LIBRARY aviplay aviplay-0.7 PATH_SUFFIXES avifile/lib)
endif ()
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 2684617fe..8e8c6f4f2 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -27,15 +27,23 @@
# to link against to use BLAS95 interface
# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
# is found
+#
+# The following variables can be used to control this module:
+#
+# ::
+#
# BLA_STATIC if set on this determines what kind of linkage we do (static)
# BLA_VENDOR if set checks only the specified vendor, if not set checks
# all the possibilities
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
+# BLA_PREFER_PKGCONFIG if set pkg-config will be used to search for a BLAS
+# library first and if one is found that is preferred
#
# List of vendors (BLA_VENDOR) valid in this module:
#
# * Goto
# * OpenBLAS
+# * FLAME
# * ATLAS PhiPACK
# * CXML
# * DXML
@@ -62,6 +70,7 @@
include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
@@ -77,6 +86,18 @@ if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_C
endif()
endif()
+if(BLA_PREFER_PKGCONFIG)
+ find_package(PkgConfig)
+ pkg_check_modules(PKGC_BLAS IMPORTED_TARGET blas)
+ if(PKGC_BLAS_FOUND)
+ set(BLAS_LIBRARIES PkgConfig::PKGC_BLAS)
+ find_package_handle_standard_args(BLAS
+ REQUIRED_VARS BLAS_LIBRARIES
+ VERSION_VAR PKGC_BLAS_VERSION)
+ return()
+ endif()
+endif()
+
macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
# This macro checks for the existence of the combination of fortran libraries
# given by _list. If the combination is found, this macro checks (using the
@@ -190,6 +211,20 @@ if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
endif()
endif ()
+if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ # FLAME's blis library (https://github.com/flame/blis)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "blis"
+ ""
+ )
+ endif()
+endif ()
+
if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES)
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
@@ -645,8 +680,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
foreach (IT ${BLAS_SEARCH_LIBS})
string(REPLACE " " ";" SEARCH_LIBS ${IT})
- if (${_LIBRARIES})
- else ()
+ if (NOT ${_LIBRARIES})
check_fortran_libraries(
${_LIBRARIES}
BLAS
@@ -661,51 +695,14 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
endif ()
endif ()
-
if(BLA_F95)
- if(BLAS95_LIBRARIES)
- set(BLAS95_FOUND TRUE)
- else()
- set(BLAS95_FOUND FALSE)
- endif()
-
- if(NOT BLAS_FIND_QUIETLY)
- if(BLAS95_FOUND)
- message(STATUS "A library with BLAS95 API found.")
- else()
- if(BLAS_FIND_REQUIRED)
- message(FATAL_ERROR
- "A required library with BLAS95 API not found. Please specify library location.")
- else()
- message(STATUS
- "A library with BLAS95 API not found. Please specify library location.")
- endif()
- endif()
+ find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS95_LIBRARIES)
+ set(BLAS95_FOUND ${BLAS_FOUND})
+ if(BLAS_FOUND)
+ set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
endif()
- set(BLAS_FOUND TRUE)
- set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
else()
- if(BLAS_LIBRARIES)
- set(BLAS_FOUND TRUE)
- else()
- set(BLAS_FOUND FALSE)
- endif()
-
- if(NOT BLAS_FIND_QUIETLY)
- if(BLAS_FOUND)
- message(STATUS "A library with BLAS API found.")
- else()
- if(BLAS_FIND_REQUIRED)
- message(FATAL_ERROR
- "A required library with BLAS API not found. Please specify library location."
- )
- else()
- message(STATUS
- "A library with BLAS API not found. Please specify library location."
- )
- endif()
- endif()
- endif()
+ find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS_LIBRARIES)
endif()
cmake_pop_check_state()
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index d2307f131..0375b099a 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -38,6 +38,8 @@ if (NOT BZIP2_LIBRARIES)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
SELECT_LIBRARY_CONFIGURATIONS(BZIP2)
+else ()
+ file(TO_CMAKE_PATH "${BZIP2_LIBRARIES}" BZIP2_LIBRARIES)
endif ()
if (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h")
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 88d14abd2..8d44aee0b 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -10,9 +10,12 @@
# Use this module by invoking find_package with the form::
#
# find_package(Boost
-# [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0
+# [version] [EXACT] # Minimum or EXACT version e.g. 1.67.0
# [REQUIRED] # Fail with error if Boost is not found
# [COMPONENTS <libs>...] # Boost libraries by their canonical name
+# # e.g. "date_time" for "libboost_date_time"
+# [OPTIONAL_COMPONENTS <libs>...]
+# # Optional Boost libraries by their canonical name)
# ) # e.g. "date_time" for "libboost_date_time"
#
# This module finds headers and requested component libraries OR a CMake
@@ -37,6 +40,15 @@
# information about Boost's automatic linking
# displayed during compilation
#
+# Note that Boost Python components require a Python version suffix
+# (Boost 1.67 and later), e.g. ``python36`` or ``python27`` for the
+# versions built against Python 3.6 and 2.7, respectively. This also
+# applies to additional components using Python including
+# ``mpi_python`` and ``numpy``. Earlier Boost releases may use
+# distribution-specific suffixes such as ``2``, ``3`` or ``2.7``.
+# These may also be used as suffixes, but note that they are not
+# portable.
+#
# This module reads hints about search locations from variables::
#
# BOOST_ROOT - Preferred installation prefix
@@ -153,7 +165,7 @@
# Boost_REALPATH - Set to ON to resolve symlinks for discovered
# libraries to assist with packaging. For example,
# the "system" component library may be resolved to
-# "/usr/lib/libboost_system.so.1.42.0" instead of
+# "/usr/lib/libboost_system.so.1.67.0" instead of
# "/usr/lib/libboost_system.so". This does not
# affect linking and should not be enabled unless
# the user needs this information.
@@ -187,6 +199,13 @@
# target_link_libraries(foo Boost::date_time Boost::filesystem
# Boost::iostreams)
#
+# Example to find Boost Python 3.6 libraries and use imported targets::
+#
+# find_package(Boost 1.67 REQUIRED COMPONENTS
+# python36 numpy36)
+# add_executable(foo foo.cc)
+# target_link_libraries(foo Boost::python36 Boost::numpy36)
+#
# Example to find Boost headers and some *static* (release only) libraries::
#
# set(Boost_USE_STATIC_LIBS ON) # only find static libs
@@ -194,7 +213,7 @@
# set(Boost_USE_RELEASE_LIBS ON) # only find release libs
# set(Boost_USE_MULTITHREADED ON)
# set(Boost_USE_STATIC_RUNTIME OFF)
-# find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...)
+# find_package(Boost 1.66.0 COMPONENTS date_time filesystem system ...)
# if(Boost_FOUND)
# include_directories(${Boost_INCLUDE_DIRS})
# add_executable(foo foo.cc)
@@ -275,13 +294,14 @@ endif()
macro(_Boost_ADJUST_LIB_VARS basename)
if(Boost_INCLUDE_DIR )
if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
- # if the generator supports configuration types then set
- # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
- if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
+ # single-config generators, set optimized and debug libraries
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(_isMultiConfig OR CMAKE_BUILD_TYPE)
set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
else()
- # if there are no configuration types and CMAKE_BUILD_TYPE has no value
- # then just use the release libraries
+ # For single-config generators where CMAKE_BUILD_TYPE has no value,
+ # just use the release libraries
set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
endif()
# FIXME: This probably should be set for both cases
@@ -391,13 +411,8 @@ endmacro()
# version with a regex.
#
function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
-
- exec_program(${CMAKE_CXX_COMPILER}
- ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
- OUTPUT_VARIABLE _boost_COMPILER_VERSION
- )
- string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
- _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\1\\2"
+ _boost_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
endfunction()
@@ -434,9 +449,7 @@ endfunction()
# Guesses Boost's compiler prefix used in built library names
# Returns the guess by setting the variable pointed to by _ret
function(_Boost_GUESS_COMPILER_PREFIX _ret)
- if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel"
- OR CMAKE_CXX_COMPILER MATCHES "icl"
- OR CMAKE_CXX_COMPILER MATCHES "icpc")
+ if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel")
if(WIN32)
set (_boost_COMPILER "-iw")
else()
@@ -562,6 +575,13 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
# required only if the BoostScanDeps.cmake script logic is changed.
# The addition of a new release should only require it to be run
# against the new release.
+
+ # Handle Python version suffixes
+ if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$")
+ set(component "${CMAKE_MATCH_1}")
+ set(component_python_version "${CMAKE_MATCH_2}")
+ endif()
+
set(_Boost_IMPORTED_TARGETS TRUE)
if(Boost_VERSION VERSION_LESS 103300)
message(WARNING "Imported targets and dependency information not available for Boost version ${Boost_VERSION} (all versions older than 1.33)")
@@ -779,8 +799,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
- else()
- if(NOT Boost_VERSION VERSION_LESS 106500)
+ elseif(NOT Boost_VERSION VERSION_LESS 106500 AND Boost_VERSION VERSION_LESS 106700)
set(_Boost_CHRONO_DEPENDENCIES system)
set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
set(_Boost_COROUTINE_DEPENDENCIES context system)
@@ -794,12 +813,30 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_NUMPY_DEPENDENCIES python)
set(_Boost_RANDOM_DEPENDENCIES system)
set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
+ set(_Boost_TIMER_DEPENDENCIES chrono system)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ else()
+ if(NOT Boost_VERSION VERSION_LESS 106700)
+ set(_Boost_CHRONO_DEPENDENCIES system)
+ set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
+ set(_Boost_COROUTINE_DEPENDENCIES context system)
+ set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
+ set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
+ set(_Boost_RANDOM_DEPENDENCIES system)
+ set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
+ set(_Boost_TIMER_DEPENDENCIES chrono system)
set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
endif()
- if(NOT Boost_VERSION VERSION_LESS 106600)
+ if(NOT Boost_VERSION VERSION_LESS 106800)
message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
- set(_Boost_IMPORTED_TARGETS FALSE)
endif()
endif()
@@ -824,6 +861,12 @@ endfunction()
# _hdrs
#
function(_Boost_COMPONENT_HEADERS component _hdrs)
+ # Handle Python version suffixes
+ if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$")
+ set(component "${CMAKE_MATCH_1}")
+ set(component_python_version "${CMAKE_MATCH_2}")
+ endif()
+
# Note: new boost components will require adding here. The header
# must be present in all versions of Boost providing a library.
set(_Boost_ATOMIC_HEADERS "boost/atomic.hpp")
@@ -831,8 +874,8 @@ function(_Boost_COMPONENT_HEADERS component _hdrs)
set(_Boost_CONTAINER_HEADERS "boost/container/container_fwd.hpp")
set(_Boost_CONTEXT_HEADERS "boost/context/all.hpp")
set(_Boost_COROUTINE_HEADERS "boost/coroutine/all.hpp")
- set(_Boost_EXCEPTION_HEADERS "boost/exception/exception.hpp")
set(_Boost_DATE_TIME_HEADERS "boost/date_time/date.hpp")
+ set(_Boost_EXCEPTION_HEADERS "boost/exception/exception.hpp")
set(_Boost_FIBER_HEADERS "boost/fiber/all.hpp")
set(_Boost_FILESYSTEM_HEADERS "boost/filesystem/path.hpp")
set(_Boost_GRAPH_HEADERS "boost/graph/adjacency_list.hpp")
@@ -931,8 +974,8 @@ endfunction()
# `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`.
#
function(_Boost_COMPILER_FEATURES component _ret)
- # Boost >= 1.62 and < 1.65
- if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106500)
+ # Boost >= 1.62 and < 1.67
+ if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106700)
set(_Boost_FIBER_COMPILER_FEATURES
cxx_alias_templates
cxx_auto_type
@@ -1038,7 +1081,7 @@ else()
# _Boost_COMPONENT_HEADERS. See the instructions at the top of
# _Boost_COMPONENT_DEPENDENCIES.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.65.1" "1.65.0" "1.65"
+ "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65"
"1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60"
"1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55"
"1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51"
@@ -1385,8 +1428,11 @@ if(Boost_DEBUG)
endif()
#======================
-# Systematically build up the Boost ABI tag
-# http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
+# Systematically build up the Boost ABI tag for the 'tagged' and 'versioned' layouts
+# http://boost.org/doc/libs/1_66_0/more/getting_started/windows.html#library-naming
+# http://boost.org/doc/libs/1_66_0/boost/config/auto_link.hpp
+# http://boost.org/doc/libs/1_66_0/tools/build/src/tools/common.jam
+# http://boost.org/doc/libs/1_66_0/boostcpp.jam
set( _boost_RELEASE_ABI_TAG "-")
set( _boost_DEBUG_ABI_TAG "-")
# Key Use this library when:
@@ -1400,8 +1446,8 @@ endif()
# support libraries
if(WIN32 AND Boost_USE_DEBUG_RUNTIME)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
- OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
- OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
+ OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang"
+ OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel")
string(APPEND _boost_DEBUG_ABI_TAG "g")
endif()
endif()
@@ -1418,11 +1464,40 @@ if(Boost_USE_STLPORT)
string(APPEND _boost_DEBUG_ABI_TAG "p")
endif()
# n using the STLport deprecated "native iostreams" feature
+# removed from the documentation in 1.43.0 but still present in
+# boost/config/auto_link.hpp
if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
string(APPEND _boost_RELEASE_ABI_TAG "n")
string(APPEND _boost_DEBUG_ABI_TAG "n")
endif()
+# -x86 Architecture and address model tag
+# First character is the architecture, then word-size, either 32 or 64
+# Only used in 'versioned' layout, added in Boost 1.66.0
+set(_boost_ARCHITECTURE_TAG "")
+# {CMAKE_CXX_COMPILER_ARCHITECTURE_ID} is not currently set for all compilers
+if(NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" AND NOT Boost_VERSION VERSION_LESS 106600)
+ string(APPEND _boost_ARCHITECTURE_TAG "-")
+ # This needs to be kept in-sync with the section of CMakePlatformId.h.in
+ # inside 'defined(_WIN32) && defined(_MSC_VER)'
+ if(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "IA64")
+ string(APPEND _boost_ARCHITECTURE_TAG "i")
+ elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "X86"
+ OR ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "x64")
+ string(APPEND _boost_ARCHITECTURE_TAG "x")
+ elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} MATCHES "^ARM")
+ string(APPEND _boost_ARCHITECTURE_TAG "a")
+ elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "MIPS")
+ string(APPEND _boost_ARCHITECTURE_TAG "m")
+ endif()
+
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ string(APPEND _boost_ARCHITECTURE_TAG "64")
+ else()
+ string(APPEND _boost_ARCHITECTURE_TAG "32")
+ endif()
+endif()
+
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
@@ -1470,6 +1545,7 @@ foreach(c DEBUG RELEASE)
${Boost_INCLUDE_DIR}/stage/lib
)
_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}/..")
+ _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}")
if( Boost_NO_SYSTEM_PATHS )
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
else()
@@ -1584,7 +1660,44 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
endforeach()
endif()
+ # Handle Python version suffixes
+ unset(COMPONENT_PYTHON_VERSION_MAJOR)
+ unset(COMPONENT_PYTHON_VERSION_MINOR)
+ if(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\$")
+ set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}")
+ set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}")
+ elseif(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\\.?([0-9])\$")
+ set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}")
+ set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}")
+ set(COMPONENT_PYTHON_VERSION_MINOR "${CMAKE_MATCH_3}")
+ endif()
+
+ unset(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME)
+ if (COMPONENT_PYTHON_VERSION_MINOR)
+ # Boost >= 1.67
+ list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
+ # Debian/Ubuntu (Some versions omit the 2 and/or 3 from the suffix)
+ list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
+ list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
+ # Gentoo
+ list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
+ # RPMs
+ list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
+ endif()
+ if (COMPONENT_PYTHON_VERSION_MAJOR AND NOT COMPONENT_PYTHON_VERSION_MINOR)
+ # Boost < 1.67
+ list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}")
+ endif()
+
# Consolidate and report component-specific hints.
+ if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME)
+ list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME)
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Component-specific library search names for ${COMPONENT_NAME}: "
+ "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME}")
+ endif()
+ endif()
if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
if(Boost_DEBUG)
@@ -1614,28 +1727,30 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
# Find RELEASE libraries
#
unset(_boost_RELEASE_NAMES)
- foreach(compiler IN LISTS _boost_COMPILER)
- list(APPEND _boost_RELEASE_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} )
- endforeach()
- list(APPEND _boost_RELEASE_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
- if(_boost_STATIC_RUNTIME_WORKAROUND)
- set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
+ foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT)
foreach(compiler IN LISTS _boost_COMPILER)
list(APPEND _boost_RELEASE_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} )
endforeach()
list(APPEND _boost_RELEASE_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
- endif()
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} )
+ if(_boost_STATIC_RUNTIME_WORKAROUND)
+ set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
+ foreach(compiler IN LISTS _boost_COMPILER)
+ list(APPEND _boost_RELEASE_NAMES
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
+ endforeach()
+ list(APPEND _boost_RELEASE_NAMES
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
+ endif()
+ endforeach()
if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
- _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
+ _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
endif()
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
@@ -1664,27 +1779,29 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
# Find DEBUG libraries
#
unset(_boost_DEBUG_NAMES)
- foreach(compiler IN LISTS _boost_COMPILER)
- list(APPEND _boost_DEBUG_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} )
- endforeach()
- list(APPEND _boost_DEBUG_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
- if(_boost_STATIC_RUNTIME_WORKAROUND)
- set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
+ foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT)
foreach(compiler IN LISTS _boost_COMPILER)
list(APPEND _boost_DEBUG_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} )
endforeach()
list(APPEND _boost_DEBUG_NAMES
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
- endif()
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} )
+ if(_boost_STATIC_RUNTIME_WORKAROUND)
+ set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
+ foreach(compiler IN LISTS _boost_COMPILER)
+ list(APPEND _boost_DEBUG_NAMES
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
+ endforeach()
+ list(APPEND _boost_DEBUG_NAMES
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
+ endif()
+ endforeach()
if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
_Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
endif()
@@ -1751,10 +1868,9 @@ if(Boost_FOUND)
set(_boost_CHECKED_COMPONENT FALSE)
set(_Boost_MISSING_COMPONENTS "")
foreach(COMPONENT ${Boost_FIND_COMPONENTS})
- string(TOUPPER ${COMPONENT} COMPONENT)
+ string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
set(_boost_CHECKED_COMPONENT TRUE)
- if(NOT Boost_${COMPONENT}_FOUND)
- string(TOLOWER ${COMPONENT} COMPONENT)
+ if(NOT Boost_${UPPERCOMPONENT}_FOUND AND Boost_FIND_REQUIRED_${COMPONENT})
list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
endif()
endforeach()
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 1c8ac2646..0a31ac2b9 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -18,35 +18,36 @@
#
# Tools for building CUDA C files: libraries and build dependencies.
#
-# This script locates the NVIDIA CUDA C tools. It should work on linux,
-# windows, and mac and should be reasonably up to date with CUDA C
+# This script locates the NVIDIA CUDA C tools. It should work on Linux,
+# Windows, and macOS and should be reasonably up to date with CUDA C
# releases.
#
-# This script makes use of the standard find_package arguments of
-# <VERSION>, REQUIRED and QUIET. CUDA_FOUND will report if an
+# This script makes use of the standard :command:`find_package` arguments of
+# ``<VERSION>``, ``REQUIRED`` and ``QUIET``. ``CUDA_FOUND`` will report if an
# acceptable version of CUDA was found.
#
-# The script will prompt the user to specify CUDA_TOOLKIT_ROOT_DIR if
+# The script will prompt the user to specify ``CUDA_TOOLKIT_ROOT_DIR`` if
# the prefix cannot be determined by the location of nvcc in the system
-# path and REQUIRED is specified to find_package(). To use a different
-# installed version of the toolkit set the environment variable
-# CUDA_BIN_PATH before running cmake (e.g.
-# CUDA_BIN_PATH=/usr/local/cuda1.0 instead of the default
-# /usr/local/cuda) or set CUDA_TOOLKIT_ROOT_DIR after configuring. If
-# you change the value of CUDA_TOOLKIT_ROOT_DIR, various components that
+# path and ``REQUIRED`` is specified to :command:`find_package`. To use
+# a different installed version of the toolkit set the environment variable
+# ``CUDA_BIN_PATH`` before running cmake (e.g.
+# ``CUDA_BIN_PATH=/usr/local/cuda1.0`` instead of the default
+# ``/usr/local/cuda``) or set ``CUDA_TOOLKIT_ROOT_DIR`` after configuring. If
+# you change the value of ``CUDA_TOOLKIT_ROOT_DIR``, various components that
# depend on the path will be relocated.
#
-# It might be necessary to set CUDA_TOOLKIT_ROOT_DIR manually on certain
-# platforms, or to use a cuda runtime not installed in the default
-# location. In newer versions of the toolkit the cuda library is
-# included with the graphics driver- be sure that the driver version
-# matches what is needed by the cuda runtime version.
+# It might be necessary to set ``CUDA_TOOLKIT_ROOT_DIR`` manually on certain
+# platforms, or to use a CUDA runtime not installed in the default
+# location. In newer versions of the toolkit the CUDA library is
+# included with the graphics driver -- be sure that the driver version
+# matches what is needed by the CUDA runtime version.
#
# 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,
-# CUDA_COMPILE_FATBIN, CUDA_COMPILE_CUBIN 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.
@@ -97,11 +98,12 @@
# CUDA_HOST_COMPILATION_CPP (Default ON)
# -- Set to OFF for C compilation of host code.
#
-# CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS)
+# CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER)
# -- Set the host compiler to be used by nvcc. Ignored if -ccbin or
# --compiler-bindir is already present in the CUDA_NVCC_FLAGS or
-# CUDA_NVCC_FLAGS_<CONFIG> variables. For Visual Studio targets
-# $(VCInstallDir)/bin is a special value that expands out to the path when
+# CUDA_NVCC_FLAGS_<CONFIG> variables. For Visual Studio targets,
+# the host compiler is constructed with one or more visual studio macros
+# such as $(VCInstallDir), that expands out to the path when
# the command is run from within VS.
#
# CUDA_NVCC_FLAGS
@@ -523,10 +525,16 @@ set(CUDA_GENERATED_OUTPUT_DIR "" CACHE PATH "Directory to put all the output fil
option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON)
# Extra user settable flags
-set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
+cmake_initialize_per_config_variable(CUDA_NVCC_FLAGS "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")
+ set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)")
+ if(MSVC_VERSION LESS 1910)
+ set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)bin")
+ endif()
+
+ set(CUDA_HOST_COMPILER "${_CUDA_MSVC_HOST_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC")
+
else()
if(APPLE
AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang"
@@ -577,19 +585,17 @@ mark_as_advanced(
CUDA_SEPARABLE_COMPILATION
)
-# Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we
-# need to add another entry for the CMAKE_BUILD_TYPE. We also need to add the
-# standerd set of 4 build types (Debug, MinSizeRel, Release, and RelWithDebInfo)
-# for completeness. We need run this loop in order to accomodate the addition
-# of extra configuration types. Duplicate entries will be removed by
-# REMOVE_DUPLICATES.
+# Single config generators like Makefiles or Ninja don't usually have
+# CMAKE_CONFIGURATION_TYPES defined (but note that it can be defined if set by
+# projects or developers). Even CMAKE_BUILD_TYPE might not be defined for
+# single config generators (and should not be defined for multi-config
+# generators). To ensure we get a complete superset of all possible
+# configurations, we combine CMAKE_CONFIGURATION_TYPES, CMAKE_BUILD_TYPE and
+# all of the standard configurations, then weed out duplicates with
+# list(REMOVE_DUPLICATES). Looping over the unique set then ensures we have
+# each configuration-specific set of nvcc flags defined and marked as advanced.
set(CUDA_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo)
list(REMOVE_DUPLICATES CUDA_configuration_types)
-foreach(config ${CUDA_configuration_types})
- string(TOUPPER ${config} config_upper)
- set(CUDA_NVCC_FLAGS_${config_upper} "" CACHE STRING "Semi-colon delimit multiple arguments.")
- mark_as_advanced(CUDA_NVCC_FLAGS_${config_upper})
-endforeach()
###############################################################################
###############################################################################
@@ -665,8 +671,7 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR AND NOT CMAKE_CROSSCOMPILING)
find_path(CUDA_TOOLKIT_ROOT_DIR
NAMES nvcc nvcc.exe
PATHS /opt/cuda/bin
- /usr/local/bin
- /usr/local/cuda/bin
+ PATH_SUFFIXES cuda/bin
DOC "Toolkit location."
)
@@ -977,7 +982,7 @@ if(NOT CUDA_VERSION VERSION_LESS "9.0")
find_cuda_helper_libs(npps)
set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")
elseif(CUDA_VERSION VERSION_GREATER "5.0")
- # In CUDA 5.5 NPP was splitted onto 3 separate libraries.
+ # In CUDA 5.5 NPP was split into 3 separate libraries.
find_cuda_helper_libs(nppc)
find_cuda_helper_libs(nppi)
find_cuda_helper_libs(npps)
@@ -1315,11 +1320,11 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
endif()
# This needs to be passed in at this stage, because VS needs to fill out the
- # value of VCInstallDir from within VS. Note that CCBIN is only used if
+ # various macros from within VS. Note that CCBIN is only used if
# -ccbin or --compiler-bindir isn't used and CUDA_HOST_COMPILER matches
- # $(VCInstallDir)/bin.
+ # _CUDA_MSVC_HOST_COMPILER
if(CMAKE_GENERATOR MATCHES "Visual Studio")
- set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" )
+ set(ccbin_flags -D "\"CCBIN:PATH=${_CUDA_MSVC_HOST_COMPILER}\"" )
else()
set(ccbin_flags)
endif()
@@ -1438,7 +1443,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
if( "${_cuda_host_flags}" MATCHES "-std=c\\+\\+11")
# Add the c++11 flag to nvcc if it isn't already present. Note that we only look at
# the main flag instead of the configuration specific flags.
- if( NOT "${CUDA_NVCC_FLAGS}" MATCHES "-std;c\\+\\+11" )
+ if( NOT "${CUDA_NVCC_FLAGS}" MATCHES "-std=c\\+\\+11" )
list(APPEND nvcc_flags --std c++11)
endif()
string(REGEX REPLACE "[-]+std=c\\+\\+11" "" _cuda_host_flags "${_cuda_host_flags}")
@@ -1755,7 +1760,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
add_custom_command(
OUTPUT ${output_file}
DEPENDS ${object_files}
- COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} -o ${output_file}
+ COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} ${CUDA_cublas_device_LIBRARY} -o ${output_file}
${flags}
COMMENT "Building NVCC intermediate link file ${output_file_relative_path}"
COMMAND_EXPAND_LISTS
@@ -1768,7 +1773,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
PRE_LINK
COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${output_file_dir}"
- COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}"
+ COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} ${CUDA_cublas_device_LIBRARY} -o "${output_file}"
COMMAND_EXPAND_LISTS
${_verbatim}
)
diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake
index 7b5389ec5..580f24a40 100644
--- a/Modules/FindCUDA/make2cmake.cmake
+++ b/Modules/FindCUDA/make2cmake.cmake
@@ -40,7 +40,7 @@
# verbose:BOOL=<> OFF: Be as quiet as possible (default)
# ON : Extra output
#
-# input_file:FILEPATH=<> Path to dependecy file in makefile format
+# input_file:FILEPATH=<> Path to dependency file in makefile format
#
# output_file:FILEPATH=<> Path to file with dependencies in CMake readable variable
#
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index f78119d34..6fc2439ad 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -125,7 +125,7 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
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 AND CUDA_HOST_COMPILER )
- if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN)
+ if (CUDA_HOST_COMPILER STREQUAL "@_CUDA_MSVC_HOST_COMPILER@" AND DEFINED CCBIN)
set(CCBIN -ccbin "${CCBIN}")
else()
set(CCBIN -ccbin "${CUDA_HOST_COMPILER}")
@@ -181,13 +181,13 @@ cuda_execute_process(
set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
set(CUDA_VERSION @CUDA_VERSION@)
if(CUDA_VERSION VERSION_LESS "3.0")
- # Note that this will remove all occurances of -G.
+ # Note that this will remove all occurrences of -G.
list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G")
endif()
# nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This
# can cause incorrect dependencies when #including files based on this macro which is
-# defined in the generating passes of nvcc invokation. We will go ahead and manually
+# defined in the generating passes of nvcc invocation. We will go ahead and manually
# define this for now until a future version fixes this bug.
set(CUDACC_DEFINE -D__CUDACC__)
diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake
index 9ba1ff3e9..2aa5f6ff7 100644
--- a/Modules/FindCxxTest.cmake
+++ b/Modules/FindCxxTest.cmake
@@ -145,7 +145,7 @@
#
# Version 1.3 (8/19/10) (CMake 2.8.3)
# Included patch by Simone Rossetto to check if either Python or Perl
-# are present in the system. Whichever intepreter that is detected
+# are present in the system. Whichever interpreter that is detected
# is now used to run the test generator program. If both interpreters
# are detected, the CXXTEST_USE_PYTHON variable is obeyed.
#
diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake
index 0d86e8e0a..f348d3aab 100644
--- a/Modules/FindDCMTK.cmake
+++ b/Modules/FindDCMTK.cmake
@@ -217,7 +217,7 @@ if(EXISTS ${DCMTK_DIR}/CMakeCache.txt)
if(NOT EXISTS ${EXTDCMTK_SOURCE_DIR})
message(FATAL_ERROR
"DCMTK build directory references
-nonexistant DCMTK source directory ${EXTDCMTK_SOURCE_DIR}")
+nonexistent DCMTK source directory ${EXTDCMTK_SOURCE_DIR}")
endif()
endif()
diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake
index f6c8e3f24..e904a30fc 100644
--- a/Modules/FindDevIL.cmake
+++ b/Modules/FindDevIL.cmake
@@ -70,5 +70,5 @@ find_library(ILU_LIBRARIES
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DevIL DEFAULT_MSG
IL_LIBRARIES ILU_LIBRARIES
IL_INCLUDE_DIR)
-# provide legacy variable for compatiblity
+# provide legacy variable for compatibility
set(IL_FOUND ${DevIL_FOUND})
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index d0dd0f164..599d7991d 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -244,7 +244,7 @@ required form if set.
TAGFILES
TCL_SUBST
-The following single value Doxygen options would be quoted automatically
+The following single value Doxygen options will be quoted automatically
if they contain at least one space:
::
@@ -292,6 +292,36 @@ if they contain at least one space:
WARN_LOGFILE
XML_OUTPUT
+There are situations where it may be undesirable for a particular config option
+to be automatically quoted by ``doxygen_add_docs()``, such as ``ALIASES`` which
+may need to include its own embedded quoting. The ``DOXYGEN_VERBATIM_VARS``
+variable can be used to specify a list of Doxygen variables (including the
+leading ``DOXYGEN_`` prefix) which should not be quoted. The project is then
+responsible for ensuring that those variables' values make sense when placed
+directly in the Doxygen input file. In the case of list variables, list items
+are still separated by spaces, it is only the automatic quoting that is
+skipped. For example, the following allows ``doxygen_add_docs()`` to apply
+quoting to ``DOXYGEN_PROJECT_BRIEF``, but not each item in the
+``DOXYGEN_ALIASES`` list (:ref:`bracket syntax <Bracket Argument>` can also
+be used to make working with embedded quotes easier):
+
+.. code-block:: cmake
+
+ set(DOXYGEN_PROJECT_BRIEF "String with spaces")
+ set(DOXYGEN_ALIASES
+ [[somealias="@some_command param"]]
+ "anotherAlias=@foobar"
+ )
+ set(DOXYGEN_VERBATIM_VARS DOXYGEN_ALIASES)
+
+The resultant ``Doxyfile`` will contain the following lines:
+
+.. code-block:: text
+
+ PROJECT_BRIEF = "String with spaces"
+ ALIASES = somealias="@some_command param" anotherAlias=@foobar
+
+
Deprecated Result Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -331,7 +361,7 @@ Deprecated Hint Variables
.. variable:: DOXYGEN_SKIP_DOT
- This variable has no any effect for component form of ``find_package``.
+ This variable has no effect for the component form of ``find_package``.
In backward compatibility mode (i.e. without components list) it prevents
the finder module from searching for Graphviz's ``dot`` utility.
@@ -381,6 +411,8 @@ macro(_Doxygen_find_doxygen)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin"
/Applications/Doxygen.app/Contents/Resources
/Applications/Doxygen.app/Contents/MacOS
+ /Applications/Utilities/Doxygen.app/Contents/Resources
+ /Applications/Utilities/Doxygen.app/Contents/MacOS
DOC "Doxygen documentation generation tool (http://www.doxygen.org)"
)
mark_as_advanced(DOXYGEN_EXECUTABLE)
@@ -462,8 +494,11 @@ macro(_Doxygen_find_dot)
"C:/Program Files/ATT/Graphviz/bin"
[HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin
/Applications/Graphviz.app/Contents/MacOS
+ /Applications/Utilities/Graphviz.app/Contents/MacOS
/Applications/Doxygen.app/Contents/Resources
/Applications/Doxygen.app/Contents/MacOS
+ /Applications/Utilities/Doxygen.app/Contents/Resources
+ /Applications/Utilities/Doxygen.app/Contents/MacOS
DOC "Dot tool for use with Doxygen"
)
mark_as_advanced(DOXYGEN_DOT_EXECUTABLE)
@@ -716,12 +751,15 @@ endif()
function(doxygen_quote_value VARIABLE)
# Quote a value of the given variable if:
- # - variable parameter was really given
- # - a variable it points is defined
- # - a value doesn't quoted already
- # - and it has spaces
+ # - VARIABLE parameter was really given
+ # - the variable it names is defined and is not present in the list
+ # specified by DOXYGEN_VERBATIM_VARS (if set)
+ # - the value of the named variable isn't already quoted
+ # - the value has spaces
if(VARIABLE AND DEFINED ${VARIABLE} AND
- NOT ${VARIABLE} MATCHES "^\".* .*\"$" AND ${VARIABLE} MATCHES " ")
+ NOT ${VARIABLE} MATCHES "^\".* .*\"$" AND ${VARIABLE} MATCHES " " AND
+ NOT (DEFINED DOXYGEN_VERBATIM_VARS AND
+ "${VARIABLE}" IN_LIST DOXYGEN_VERBATIM_VARS))
set(${VARIABLE} "\"${${VARIABLE}}\"" PARENT_SCOPE)
endif()
endfunction()
@@ -730,8 +768,18 @@ function(doxygen_list_to_quoted_strings LIST_VARIABLE)
if(LIST_VARIABLE AND DEFINED ${LIST_VARIABLE})
unset(_inputs)
unset(_sep)
+ unset(_verbatim)
+ # Have to test if list items should be treated as verbatim here
+ # because we lose the variable name when we pass just one list item
+ # to doxygen_quote_value() below
+ if(DEFINED DOXYGEN_VERBATIM_VARS AND
+ "${LIST_VARIABLE}" IN_LIST DOXYGEN_VERBATIM_VARS)
+ set(_verbatim True)
+ endif()
foreach(_in IN LISTS ${LIST_VARIABLE})
- doxygen_quote_value(_in)
+ if(NOT _verbatim)
+ doxygen_quote_value(_in)
+ endif()
string(APPEND _inputs "${_sep}${_in}")
set(_sep " ")
endforeach()
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index fef7fb474..3945b7884 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -52,7 +52,7 @@
#
#
#
-# Flex scanners oftenly use tokens defined by Bison: the code generated
+# Flex scanners often use tokens defined by Bison: the code generated
# by Flex depends of the header generated by Bison. This module also
# defines a macro:
#
diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake
index e6bd3c98b..82c63efd4 100644
--- a/Modules/FindFLTK.cmake
+++ b/Modules/FindFLTK.cmake
@@ -5,57 +5,78 @@
# FindFLTK
# --------
#
-# Find the native FLTK includes and library
+# Find the FLTK library
#
+# Input Variables
+# ^^^^^^^^^^^^^^^
#
+# By default this module will search for all of the FLTK components and
+# add them to the FLTK_LIBRARIES variable. You can limit the components
+# which get placed in FLTK_LIBRARIES by defining one or more of the
+# following three options:
#
-# By default FindFLTK.cmake will search for all of the FLTK components
-# and add them to the FLTK_LIBRARIES variable.
+# ``FLTK_SKIP_OPENGL``
+# Set to true to disable searching for the FLTK GL library
#
-# ::
+# ``FLTK_SKIP_FORMS``
+# Set to true to disable searching for the FLTK Forms library
#
-# You can limit the components which get placed in FLTK_LIBRARIES by
-# defining one or more of the following three options:
+# ``FLTK_SKIP_IMAGES``
+# Set to true to disable searching for the FLTK Images library
#
+# FLTK is composed also by a binary tool. You can set the following option:
#
+# ``FLTK_SKIP_FLUID``
+# Set to true to not look for the FLUID binary
#
-# ::
+# Result Variables
+# ^^^^^^^^^^^^^^^^
#
-# FLTK_SKIP_OPENGL, set to true to disable searching for opengl and
-# the FLTK GL library
-# FLTK_SKIP_FORMS, set to true to disable searching for fltk_forms
-# FLTK_SKIP_IMAGES, set to true to disable searching for fltk_images
+# The following variables will be defined:
#
+# ``FLTK_FOUND``
+# True if all components not skipped were found
#
+# ``FLTK_INCLUDE_DIR``
+# Path to the include directory for FLTK header files
#
-# ::
+# ``FLTK_LIBRARIES``
+# List of the FLTK libraries found
#
-# FLTK_SKIP_FLUID, set to true if the fluid binary need not be present
-# at build time
+# ``FLTK_FLUID_EXECUTABLE``
+# Path to the FLUID binary tool
#
+# ``FLTK_WRAP_UI``
+# True if FLUID is found, used to enable the FLTK_WRAP_UI command
#
+# Cache Variables
+# ^^^^^^^^^^^^^^^
#
-# The following variables will be defined:
+# The following cache variables are also available to set or use:
#
-# ::
+# ``FLTK_BASE_LIBRARY_RELEASE``
+# The FLTK base library (optimized)
#
-# FLTK_FOUND, True if all components not skipped were found
-# FLTK_INCLUDE_DIR, where to find include files
-# FLTK_LIBRARIES, list of fltk libraries you should link against
-# FLTK_FLUID_EXECUTABLE, where to find the Fluid tool
-# FLTK_WRAP_UI, This enables the FLTK_WRAP_UI command
+# ``FLTK_BASE_LIBRARY_DEBUG``
+# The FLTK base library (debug)
#
+# ``FLTK_GL_LIBRARY_RELEASE``
+# The FLTK GL library (optimized)
#
+# ``FLTK_GL_LIBRARY_DEBUG``
+# The FLTK GL library (debug)
#
-# The following cache variables are assigned but should not be used.
-# See the FLTK_LIBRARIES variable instead.
+# ``FLTK_FORMS_LIBRARY_RELEASE``
+# The FLTK Forms library (optimized)
#
-# ::
+# ``FLTK_FORMS_LIBRARY_DEBUG``
+# The FLTK Forms library (debug)
#
-# FLTK_BASE_LIBRARY = the full path to fltk.lib
-# FLTK_GL_LIBRARY = the full path to fltk_gl.lib
-# FLTK_FORMS_LIBRARY = the full path to fltk_forms.lib
-# FLTK_IMAGES_LIBRARY = the full path to fltk_images.lib
+# ``FLTK_IMAGES_LIBRARY_RELEASE``
+# The FLTK Images protobuf library (optimized)
+#
+# ``FLTK_IMAGES_LIBRARY_DEBUG``
+# The FLTK Images library (debug)
if(NOT FLTK_SKIP_OPENGL)
find_package(OpenGL)
@@ -114,177 +135,183 @@ if(NOT FLTK_DIR)
# Look in places relative to the system executable search path.
${FLTK_DIR_SEARCH}
- PATHS
- # Look in standard UNIX install locations.
- /usr/local/lib/fltk
- /usr/lib/fltk
- /usr/local/fltk
- /usr/X11R6/include
+ PATH_SUFFIXES
+ fltk
+ fltk/include
+ lib/fltk
+ lib/fltk/include
# Help the user find it if we cannot.
DOC "The ${FLTK_DIR_STRING}"
)
endif()
- # Check if FLTK was built using CMake
- if(EXISTS ${FLTK_DIR}/FLTKConfig.cmake)
- set(FLTK_BUILT_WITH_CMAKE 1)
- endif()
+# Check if FLTK was built using CMake
+if(EXISTS ${FLTK_DIR}/FLTKConfig.cmake)
+ set(FLTK_BUILT_WITH_CMAKE 1)
+endif()
- if(FLTK_BUILT_WITH_CMAKE)
- set(FLTK_FOUND 1)
- include(${FLTK_DIR}/FLTKConfig.cmake)
-
- # Fluid
- if(FLUID_COMMAND)
- set(FLTK_FLUID_EXECUTABLE ${FLUID_COMMAND} CACHE FILEPATH "Fluid executable")
- else()
- find_program(FLTK_FLUID_EXECUTABLE fluid PATHS
- ${FLTK_EXECUTABLE_DIRS}
- ${FLTK_EXECUTABLE_DIRS}/RelWithDebInfo
- ${FLTK_EXECUTABLE_DIRS}/Debug
- ${FLTK_EXECUTABLE_DIRS}/Release
- NO_SYSTEM_PATH)
- endif()
- # mark_as_advanced(FLTK_FLUID_EXECUTABLE)
-
- set(FLTK_INCLUDE_DIR ${FLTK_DIR})
- link_directories(${FLTK_LIBRARY_DIRS})
-
- set(FLTK_BASE_LIBRARY fltk)
- set(FLTK_GL_LIBRARY fltk_gl)
- set(FLTK_FORMS_LIBRARY fltk_forms)
- set(FLTK_IMAGES_LIBRARY fltk_images)
-
- # Add the extra libraries
- load_cache(${FLTK_DIR}
- READ_WITH_PREFIX
- FL FLTK_USE_SYSTEM_JPEG
- FL FLTK_USE_SYSTEM_PNG
- FL FLTK_USE_SYSTEM_ZLIB
- )
-
- set(FLTK_IMAGES_LIBS "")
- if(FLFLTK_USE_SYSTEM_JPEG)
- set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_jpeg)
- endif()
- if(FLFLTK_USE_SYSTEM_PNG)
- set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_png)
- endif()
- if(FLFLTK_USE_SYSTEM_ZLIB)
- set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_zlib)
- endif()
- set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL
- "Extra libraries for fltk_images library.")
+if(FLTK_BUILT_WITH_CMAKE)
+ set(FLTK_FOUND 1)
+ include(${FLTK_DIR}/FLTKConfig.cmake)
+ # Fluid
+ if(FLUID_COMMAND)
+ set(FLTK_FLUID_EXECUTABLE ${FLUID_COMMAND} CACHE FILEPATH "Fluid executable")
else()
+ find_program(FLTK_FLUID_EXECUTABLE fluid PATHS
+ ${FLTK_EXECUTABLE_DIRS}
+ ${FLTK_EXECUTABLE_DIRS}/RelWithDebInfo
+ ${FLTK_EXECUTABLE_DIRS}/Debug
+ ${FLTK_EXECUTABLE_DIRS}/Release
+ NO_SYSTEM_PATH)
+ endif()
+ # mark_as_advanced(FLTK_FLUID_EXECUTABLE)
+
+ set(FLTK_INCLUDE_DIR ${FLTK_DIR})
+ link_directories(${FLTK_LIBRARY_DIRS})
+
+ set(FLTK_BASE_LIBRARY fltk)
+ set(FLTK_GL_LIBRARY fltk_gl)
+ set(FLTK_FORMS_LIBRARY fltk_forms)
+ set(FLTK_IMAGES_LIBRARY fltk_images)
+
+ # Add the extra libraries
+ load_cache(${FLTK_DIR}
+ READ_WITH_PREFIX
+ FL FLTK_USE_SYSTEM_JPEG
+ FL FLTK_USE_SYSTEM_PNG
+ FL FLTK_USE_SYSTEM_ZLIB
+ )
- # if FLTK was not built using CMake
- # Find fluid executable.
- find_program(FLTK_FLUID_EXECUTABLE fluid ${FLTK_INCLUDE_DIR}/fluid)
-
- # Use location of fluid to help find everything else.
- set(FLTK_INCLUDE_SEARCH_PATH "")
- set(FLTK_LIBRARY_SEARCH_PATH "")
- if(FLTK_FLUID_EXECUTABLE)
- get_filename_component(FLTK_BIN_DIR "${FLTK_FLUID_EXECUTABLE}" PATH)
- set(FLTK_INCLUDE_SEARCH_PATH ${FLTK_INCLUDE_SEARCH_PATH}
- ${FLTK_BIN_DIR}/../include ${FLTK_BIN_DIR}/..)
- set(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH}
- ${FLTK_BIN_DIR}/../lib)
- set(FLTK_WRAP_UI 1)
- endif()
+ set(FLTK_IMAGES_LIBS "")
+ if(FLFLTK_USE_SYSTEM_JPEG)
+ set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_jpeg)
+ endif()
+ if(FLFLTK_USE_SYSTEM_PNG)
+ set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_png)
+ endif()
+ if(FLFLTK_USE_SYSTEM_ZLIB)
+ set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_zlib)
+ endif()
+ set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL
+ "Extra libraries for fltk_images library.")
- #
- # Try to find FLTK include dir using fltk-config
- #
- if(UNIX)
- # Use fltk-config to generate a list of possible include directories
- find_program(FLTK_CONFIG_SCRIPT fltk-config PATHS ${FLTK_BIN_DIR})
- if(FLTK_CONFIG_SCRIPT)
- if(NOT FLTK_INCLUDE_DIR)
- exec_program(${FLTK_CONFIG_SCRIPT} ARGS --cxxflags OUTPUT_VARIABLE FLTK_CXXFLAGS)
- if(FLTK_CXXFLAGS)
- string(REGEX MATCHALL "-I[^ ]*" _fltk_temp_dirs ${FLTK_CXXFLAGS})
- string(REPLACE "-I" "" _fltk_temp_dirs "${_fltk_temp_dirs}")
- foreach(_dir ${_fltk_temp_dirs})
- string(STRIP ${_dir} _output)
- list(APPEND _FLTK_POSSIBLE_INCLUDE_DIRS ${_output})
- endforeach()
- endif()
- endif()
- endif()
- endif()
+else()
+
+ # if FLTK was not built using CMake
+ # Find fluid executable.
+ find_program(FLTK_FLUID_EXECUTABLE fluid ${FLTK_INCLUDE_DIR}/fluid)
+ # Use location of fluid to help find everything else.
+ set(FLTK_INCLUDE_SEARCH_PATH "")
+ set(FLTK_LIBRARY_SEARCH_PATH "")
+ if(FLTK_FLUID_EXECUTABLE)
+ get_filename_component(FLTK_BIN_DIR "${FLTK_FLUID_EXECUTABLE}" PATH)
set(FLTK_INCLUDE_SEARCH_PATH ${FLTK_INCLUDE_SEARCH_PATH}
- /usr/local/fltk
- /usr/X11R6/include
- ${_FLTK_POSSIBLE_INCLUDE_DIRS}
- )
-
- find_path(FLTK_INCLUDE_DIR
- NAMES FL/Fl.h FL/Fl.H # fltk 1.1.9 has Fl.H (#8376)
- PATHS ${FLTK_INCLUDE_SEARCH_PATH})
-
- #
- # Try to find FLTK library
- if(UNIX)
- if(FLTK_CONFIG_SCRIPT)
- exec_program(${FLTK_CONFIG_SCRIPT} ARGS --libs OUTPUT_VARIABLE _FLTK_POSSIBLE_LIBS)
- if(_FLTK_POSSIBLE_LIBS)
- get_filename_component(_FLTK_POSSIBLE_LIBRARY_DIR ${_FLTK_POSSIBLE_LIBS} PATH)
+ ${FLTK_BIN_DIR}/../include ${FLTK_BIN_DIR}/..)
+ set(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH}
+ ${FLTK_BIN_DIR}/../lib)
+ set(FLTK_WRAP_UI 1)
+ endif()
+
+ #
+ # Try to find FLTK include dir using fltk-config
+ #
+ if(UNIX)
+ # Use fltk-config to generate a list of possible include directories
+ find_program(FLTK_CONFIG_SCRIPT fltk-config PATHS ${FLTK_BIN_DIR})
+ if(FLTK_CONFIG_SCRIPT)
+ if(NOT FLTK_INCLUDE_DIR)
+ exec_program(${FLTK_CONFIG_SCRIPT} ARGS --cxxflags OUTPUT_VARIABLE FLTK_CXXFLAGS)
+ if(FLTK_CXXFLAGS)
+ string(REGEX MATCHALL "-I[^ ]*" _fltk_temp_dirs ${FLTK_CXXFLAGS})
+ string(REPLACE "-I" "" _fltk_temp_dirs "${_fltk_temp_dirs}")
+ foreach(_dir ${_fltk_temp_dirs})
+ string(STRIP ${_dir} _output)
+ list(APPEND _FLTK_POSSIBLE_INCLUDE_DIRS ${_output})
+ endforeach()
endif()
endif()
endif()
+ endif()
- set(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH}
- /usr/local/fltk/lib
- /usr/X11R6/lib
- ${FLTK_INCLUDE_DIR}/lib
- ${_FLTK_POSSIBLE_LIBRARY_DIR}
- )
-
- find_library(FLTK_BASE_LIBRARY NAMES fltk fltkd
- PATHS ${FLTK_LIBRARY_SEARCH_PATH})
- find_library(FLTK_GL_LIBRARY NAMES fltkgl fltkgld fltk_gl
- PATHS ${FLTK_LIBRARY_SEARCH_PATH})
- find_library(FLTK_FORMS_LIBRARY NAMES fltkforms fltkformsd fltk_forms
- PATHS ${FLTK_LIBRARY_SEARCH_PATH})
- find_library(FLTK_IMAGES_LIBRARY NAMES fltkimages fltkimagesd fltk_images
- PATHS ${FLTK_LIBRARY_SEARCH_PATH})
-
- # Find the extra libraries needed for the fltk_images library.
- if(UNIX)
- if(FLTK_CONFIG_SCRIPT)
- exec_program(${FLTK_CONFIG_SCRIPT} ARGS --use-images --ldflags
- 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_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
- "Extra libraries for fltk_images library.")
- endif()
+ list(APPEND FLTK_INCLUDE_SEARCH_PATH ${_FLTK_POSSIBLE_INCLUDE_DIRS})
+
+ find_path(FLTK_INCLUDE_DIR
+ NAMES FL/Fl.h FL/Fl.H # fltk 1.1.9 has Fl.H (#8376)
+ PATH_SUFFIXES fltk fltk/include
+ PATHS ${FLTK_INCLUDE_SEARCH_PATH})
+
+ #
+ # Try to find FLTK library
+ if(UNIX)
+ if(FLTK_CONFIG_SCRIPT)
+ exec_program(${FLTK_CONFIG_SCRIPT} ARGS --libs OUTPUT_VARIABLE _FLTK_POSSIBLE_LIBS)
+ if(_FLTK_POSSIBLE_LIBS)
+ get_filename_component(_FLTK_POSSIBLE_LIBRARY_DIR ${_FLTK_POSSIBLE_LIBS} PATH)
endif()
endif()
-
endif()
- # Append all of the required libraries together (by default, everything)
- set(FLTK_LIBRARIES)
- if(NOT FLTK_SKIP_IMAGES)
- list(APPEND FLTK_LIBRARIES ${FLTK_IMAGES_LIBRARY})
+ list(APPEND FLTK_LIBRARY_SEARCH_PATH ${FLTK_INCLUDE_DIR}/lib ${_FLTK_POSSIBLE_LIBRARY_DIR})
+
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+
+ # Allow libraries to be set manually
+ if(NOT FLTK_BASE_LIBRARY)
+ find_library(FLTK_BASE_LIBRARY_RELEASE NAMES fltk PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib)
+ find_library(FLTK_BASE_LIBRARY_DEBUG NAMES fltkd PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib)
+ select_library_configurations(FLTK_BASE)
+ endif()
+ if(NOT FLTK_GL_LIBRARY)
+ find_library(FLTK_GL_LIBRARY_RELEASE NAMES fltkgl fltk_gl PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib)
+ find_library(FLTK_GL_LIBRARY_DEBUG NAMES fltkgld fltk_gld PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib)
+ select_library_configurations(FLTK_GL)
endif()
- if(NOT FLTK_SKIP_FORMS)
- list(APPEND FLTK_LIBRARIES ${FLTK_FORMS_LIBRARY})
+ if(NOT FLTK_FORMS_LIBRARY)
+ find_library(FLTK_FORMS_LIBRARY_RELEASE NAMES fltkforms fltk_forms PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib)
+ find_library(FLTK_FORMS_LIBRARY_DEBUG NAMES fltkformsd fltk_formsd PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib)
+ select_library_configurations(FLTK_FORMS)
endif()
- if(NOT FLTK_SKIP_OPENGL)
- list(APPEND FLTK_LIBRARIES ${FLTK_GL_LIBRARY} ${OPENGL_gl_LIBRARY})
- list(APPEND FLTK_INCLUDE_DIR ${OPENGL_INCLUDE_DIR})
- list(REMOVE_DUPLICATES FLTK_INCLUDE_DIR)
+ if(NOT FLTK_IMAGES_LIBRARY)
+ find_library(FLTK_IMAGES_LIBRARY_RELEASE NAMES fltkimages fltk_images PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib)
+ find_library(FLTK_IMAGES_LIBRARY_DEBUG NAMES fltkimagesd fltk_imagesd PATHS ${FLTK_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk fltk/lib)
+ select_library_configurations(FLTK_IMAGES)
endif()
- list(APPEND FLTK_LIBRARIES ${FLTK_BASE_LIBRARY})
+
+ # Find the extra libraries needed for the fltk_images library.
+ if(UNIX)
+ if(FLTK_CONFIG_SCRIPT)
+ exec_program(${FLTK_CONFIG_SCRIPT} ARGS --use-images --ldflags
+ 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_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
+ "Extra libraries for fltk_images library.")
+ endif()
+ endif()
+ endif()
+
+endif()
+
+# Append all of the required libraries together (by default, everything)
+set(FLTK_LIBRARIES)
+if(NOT FLTK_SKIP_IMAGES)
+ list(APPEND FLTK_LIBRARIES ${FLTK_IMAGES_LIBRARY})
+endif()
+if(NOT FLTK_SKIP_FORMS)
+ list(APPEND FLTK_LIBRARIES ${FLTK_FORMS_LIBRARY})
+endif()
+if(NOT FLTK_SKIP_OPENGL)
+ list(APPEND FLTK_LIBRARIES ${FLTK_GL_LIBRARY} ${OPENGL_gl_LIBRARY})
+ list(APPEND FLTK_INCLUDE_DIR ${OPENGL_INCLUDE_DIR})
+ list(REMOVE_DUPLICATES FLTK_INCLUDE_DIR)
+endif()
+list(APPEND FLTK_LIBRARIES ${FLTK_BASE_LIBRARY})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
if(FLTK_SKIP_FLUID)
@@ -306,4 +333,3 @@ if(FLTK_FOUND)
set (FLTK_FLUID_EXE ${FLTK_FLUID_EXECUTABLE})
set (FLTK_LIBRARY ${FLTK_LIBRARIES})
endif()
-
diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake
index a43e5ff27..365a82a55 100644
--- a/Modules/FindFLTK2.cmake
+++ b/Modules/FindFLTK2.cmake
@@ -80,11 +80,11 @@ if(NOT FLTK2_DIR)
# Look in places relative to the system executable search path.
${FLTK2_DIR_SEARCH}
- # Look in standard UNIX install locations.
- /usr/local/lib/fltk2
- /usr/lib/fltk2
- /usr/local/fltk2
- /usr/X11R6/include
+ PATH_SUFFIXES
+ fltk2
+ fltk2/include
+ lib/fltk2
+ lib/fltk2/include
# Help the user find it if we cannot.
DOC "The ${FLTK2_DIR_STRING}"
@@ -175,25 +175,16 @@ if(FLTK2_DIR)
set(FLTK2_WRAP_UI 1)
endif()
- set(FLTK2_INCLUDE_SEARCH_PATH ${FLTK2_INCLUDE_SEARCH_PATH}
- /usr/local/fltk2
- /usr/X11R6/include
- )
-
- find_path(FLTK2_INCLUDE_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH})
+ find_path(FLTK2_INCLUDE_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/include)
- set(FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_LIBRARY_SEARCH_PATH}
- /usr/local/fltk2/lib
- /usr/X11R6/lib
- ${FLTK2_INCLUDE_DIR}/lib
- )
+ list(APPEND FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_INCLUDE_DIR}/lib)
find_library(FLTK2_BASE_LIBRARY NAMES fltk2
- PATHS ${FLTK2_LIBRARY_SEARCH_PATH})
+ PATHS ${FLTK2_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/lib)
find_library(FLTK2_GL_LIBRARY NAMES fltk2_gl
- PATHS ${FLTK2_LIBRARY_SEARCH_PATH})
+ PATHS ${FLTK2_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/lib)
find_library(FLTK2_IMAGES_LIBRARY NAMES fltk2_images
- PATHS ${FLTK2_LIBRARY_SEARCH_PATH})
+ PATHS ${FLTK2_LIBRARY_SEARCH_PATH} PATH_SUFFIXES fltk2 fltk2/lib)
# Find the extra libraries needed for the fltk_images library.
if(UNIX)
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 0e6d33645..61643be45 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -63,10 +63,6 @@ set(FREETYPE_FIND_ARGS
HINTS
ENV FREETYPE_DIR
PATHS
- /usr/X11R6
- /usr/local/X11R6
- /usr/local/X11
- /usr/freeware
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
@@ -115,6 +111,9 @@ if(NOT FREETYPE_LIBRARY)
)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(FREETYPE)
+else()
+ # on Windows, ensure paths are in canonical format (forward slahes):
+ file(TO_CMAKE_PATH "${FREETYPE_LIBRARY}" FREETYPE_LIBRARY)
endif()
unset(FREETYPE_FIND_ARGS)
diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake
index 0cce9cb9f..2b940b01f 100644
--- a/Modules/FindGDAL.cmake
+++ b/Modules/FindGDAL.cmake
@@ -50,13 +50,6 @@ find_path(GDAL_INCLUDE_DIR gdal.h
include/gdal
include/GDAL
include
- PATHS
- ~/Library/Frameworks/gdal.framework/Headers
- /Library/Frameworks/gdal.framework/Headers
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
)
if(UNIX)
@@ -69,11 +62,6 @@ if(UNIX)
ENV GDAL_DIR
ENV GDAL_ROOT
PATH_SUFFIXES bin
- PATHS
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
)
if(GDAL_CONFIG)
@@ -94,12 +82,6 @@ find_library(GDAL_LIBRARY
ENV GDAL_ROOT
${_gdal_libpath}
PATH_SUFFIXES lib
- PATHS
- /sw
- /opt/local
- /opt/csw
- /opt
- /usr/freeware
)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index 0843d5fda..efc397318 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -31,9 +31,6 @@ find_path(GIF_INCLUDE_DIR gif_lib.h
HINTS
ENV GIF_DIR
PATH_SUFFIXES include
- PATHS
- ~/Library/Frameworks
- /usr/freeware
)
# the gif library can have many names :-/
@@ -44,9 +41,6 @@ find_library(GIF_LIBRARY
HINTS
ENV GIF_DIR
PATH_SUFFIXES lib
- PATHS
- ~/Library/Frameworks
- /usr/freeware
)
# see readme.txt
diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake
index 8a89cda6b..89fb54baf 100644
--- a/Modules/FindGTK.cmake
+++ b/Modules/FindGTK.cmake
@@ -31,20 +31,17 @@ if(UNIX)
# - Atanas Georgiev <atanas@cs.columbia.edu>
find_path( GTK_glibconfig_INCLUDE_PATH NAMES glibconfig.h
+ PATH_SUFFIXES glib/include lib/glib/include include/glib12
PATHS
/usr/openwin/share/include
- /usr/local/include/glib12
- /usr/lib/glib/include
- /usr/local/lib/glib/include
/opt/gnome/include
/opt/gnome/lib/glib/include
)
find_path( GTK_glib_INCLUDE_PATH NAMES glib.h
- PATH_SUFFIXES gtk-1.2 glib-1.2 glib12
+ PATH_SUFFIXES gtk-1.2 glib-1.2 glib12 glib/include lib/glib/include
PATHS
/usr/openwin/share/include
- /usr/lib/glib/include
/opt/gnome/include
)
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index b87b9f3ab..8d0da51dc 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -298,8 +298,6 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
/usr/libx32
/usr/lib64
/usr/lib
- /usr/X11R6/include
- /usr/X11R6/lib
/opt/gnome/include
/opt/gnome/lib
/opt/openwin/include
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 3279bf26b..41b10025b 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -479,7 +479,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_NO_FIND_PACKAGE_CONFIG_FILE)
#if we detect that occurrence clear the suffix
if(_suffix AND NOT TARGET ${HDF5_${_lang}_TARGET}${_suffix})
if(NOT TARGET ${HDF5_${_lang}_TARGET})
- #cant find this component with or without the suffix
+ #can't find this component with or without the suffix
#so bail out, and let the following locate HDF5
set(HDF5_FOUND FALSE)
break()
diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake
index d9705d9db..aa531d522 100644
--- a/Modules/FindICU.cmake
+++ b/Modules/FindICU.cmake
@@ -156,7 +156,7 @@ function(_ICU_FIND)
# Find all ICU programs
- list(APPEND icu_binary_suffixes "${_bin64}" "bin")
+ list(APPEND icu_binary_suffixes "${_bin64}" "bin" "sbin")
foreach(program ${icu_programs})
string(TOUPPER "${program}" program_upcase)
set(cache_var "ICU_${program_upcase}_EXECUTABLE")
@@ -172,6 +172,11 @@ function(_ICU_FIND)
# Find all ICU libraries
list(APPEND icu_library_suffixes "${_lib64}" "lib")
set(ICU_REQUIRED_LIBS_FOUND ON)
+ set(static_prefix )
+ # static icu libraries compiled with MSVC have the prefix 's'
+ if(MSVC)
+ set(static_prefix "s")
+ endif()
foreach(component ${ICU_FIND_COMPONENTS})
string(TOUPPER "${component}" component_upcase)
set(component_cache "ICU_${component_upcase}_LIBRARY")
@@ -206,6 +211,20 @@ function(_ICU_FIND)
list(APPEND component_debug_libnames "icui18nd")
endif()
+ if(static_prefix)
+ unset(static_component_libnames)
+ unset(static_component_debug_libnames)
+ foreach(component_libname ${component_libnames})
+ list(APPEND static_component_libnames
+ ${static_prefix}${component_libname})
+ endforeach()
+ foreach(component_libname ${component_debug_libnames})
+ list(APPEND static_component_debug_libnames
+ ${static_prefix}${component_libname})
+ endforeach()
+ list(APPEND component_libnames ${static_component_libnames})
+ list(APPEND component_debug_libnames ${static_component_debug_libnames})
+ endif()
find_library("${component_cache_release}" ${component_libnames}
HINTS ${icu_roots}
PATH_SUFFIXES ${icu_library_suffixes}
diff --git a/Modules/FindIconv.cmake b/Modules/FindIconv.cmake
new file mode 100644
index 000000000..bf20f6f7e
--- /dev/null
+++ b/Modules/FindIconv.cmake
@@ -0,0 +1,133 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindIconv
+---------
+
+This module finds the ``iconv()`` POSIX.1 functions on the system.
+These functions might be provided in the regular C library or externally
+in the form of an additional library.
+
+The following variables are provided to indicate iconv support:
+
+.. variable:: Iconv_FOUND
+
+ Variable indicating if the iconv support was found.
+
+.. variable:: Iconv_INCLUDE_DIRS
+
+ The directories containing the iconv headers.
+
+.. variable:: Iconv_LIBRARIES
+
+ The iconv libraries to be linked.
+
+.. variable:: Iconv_IS_BUILT_IN
+
+ A variable indicating whether iconv support is stemming from the
+ C library or not. Even if the C library provides `iconv()`, the presence of
+ an external `libiconv` implementation might lead to this being false.
+
+Additionally, the following :prop_tgt:`IMPORTED` target is being provided:
+
+.. variable:: Iconv::Iconv
+
+ Imported target for using iconv.
+
+The following cache variables may also be set:
+
+.. variable:: Iconv_INCLUDE_DIR
+
+ The directory containing the iconv headers.
+
+.. variable:: Iconv_LIBRARY
+
+ The iconv library (if not implicitly given in the C library).
+
+.. note::
+ On POSIX platforms, iconv might be part of the C library and the cache
+ variables ``Iconv_INCLUDE_DIR`` and ``Iconv_LIBRARY`` might be empty.
+
+#]=======================================================================]
+
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+if(CMAKE_C_COMPILER_LOADED)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckCSourceCompiles.cmake)
+elseif(CMAKE_CXX_COMPILER_LOADED)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSourceCompiles.cmake)
+else()
+ # If neither C nor CXX are loaded, implicit iconv makes no sense.
+ set(Iconv_IS_BUILT_IN FALSE)
+endif()
+
+# iconv can only be provided in libc on a POSIX system.
+# If any cache variable is already set, we'll skip this test.
+if(NOT DEFINED Iconv_IS_BUILT_IN)
+ if(UNIX AND NOT DEFINED Iconv_INCLUDE_DIR AND NOT DEFINED Iconv_LIBRARY)
+ cmake_push_check_state(RESET)
+ # We always suppress the message here: Otherwise on supported systems
+ # not having iconv in their C library (e.g. those using libiconv)
+ # would always display a confusing "Looking for iconv - not found" message
+ set(CMAKE_FIND_QUIETLY TRUE)
+ # The following code will not work, but it's sufficient to see if it compiles.
+ # Note: libiconv will define the iconv functions as macros, so CheckSymbolExists
+ # will not yield correct results.
+ set(Iconv_IMPLICIT_TEST_CODE
+ "
+ #include <stddef.h>
+ #include <iconv.h>
+ int main() {
+ char *a, *b;
+ size_t i, j;
+ iconv_t ic;
+ ic = iconv_open(\"to\", \"from\");
+ iconv(ic, &a, &i, &b, &j);
+ iconv_close(ic);
+ }
+ "
+ )
+ if(CMAKE_C_COMPILER_LOADED)
+ check_c_source_compiles("${Iconv_IMPLICIT_TEST_CODE}" Iconv_IS_BUILT_IN)
+ else()
+ check_cxx_source_compiles("${Iconv_IMPLICIT_TEST_CODE}" Iconv_IS_BUILT_IN)
+ endif()
+ cmake_pop_check_state()
+ else()
+ set(Iconv_IS_BUILT_IN FALSE)
+ endif()
+endif()
+
+if(NOT Iconv_IS_BUILT_IN)
+ find_path(Iconv_INCLUDE_DIR
+ NAMES "iconv.h"
+ DOC "iconv include directory")
+ set(Iconv_LIBRARY_NAMES "iconv" "libiconv")
+else()
+ set(Iconv_INCLUDE_DIR "" CACHE FILEPATH "iconv include directory")
+ set(Iconv_LIBRARY_NAMES "c")
+endif()
+
+find_library(Iconv_LIBRARY
+ NAMES ${Iconv_LIBRARY_NAMES}
+ DOC "iconv library (potentially the C library)")
+
+mark_as_advanced(Iconv_INCLUDE_DIR)
+mark_as_advanced(Iconv_LIBRARY)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+if(NOT Iconv_IS_BUILT_IN)
+ find_package_handle_standard_args(Iconv REQUIRED_VARS Iconv_LIBRARY Iconv_INCLUDE_DIR)
+else()
+ find_package_handle_standard_args(Iconv REQUIRED_VARS Iconv_LIBRARY)
+endif()
+
+if(Iconv_FOUND)
+ set(Iconv_INCLUDE_DIRS "${Iconv_INCLUDE_DIR}")
+ set(Iconv_LIBRARIES "${Iconv_LIBRARY}")
+ if(NOT TARGET Iconv::Iconv)
+ add_library(Iconv::Iconv INTERFACE IMPORTED)
+ endif()
+ set_property(TARGET Iconv::Iconv PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${Iconv_INCLUDE_DIRS}")
+ set_property(TARGET Iconv::Iconv PROPERTY INTERFACE_LINK_LIBRARIES "${Iconv_LIBRARIES}")
+endif()
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 7d5534bc2..881bff13e 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -196,24 +196,33 @@ foreach(component ${ImageMagick_FIND_COMPONENTS}
if(component STREQUAL "Magick++")
FIND_IMAGEMAGICK_API(Magick++ Magick++.h
Magick++ CORE_RL_Magick++_
+ Magick++-6 Magick++-7
Magick++-Q8 Magick++-Q16 Magick++-Q16HDRI Magick++-Q8HDRI
+ Magick++-6.Q64 Magick++-6.Q32 Magick++-6.Q64HDRI Magick++-6.Q32HDRI
Magick++-6.Q16 Magick++-6.Q8 Magick++-6.Q16HDRI Magick++-6.Q8HDRI
+ Magick++-7.Q64 Magick++-7.Q32 Magick++-7.Q64HDRI Magick++-7.Q32HDRI
Magick++-7.Q16 Magick++-7.Q8 Magick++-7.Q16HDRI Magick++-7.Q8HDRI
)
list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY)
elseif(component STREQUAL "MagickWand")
FIND_IMAGEMAGICK_API(MagickWand "wand/MagickWand.h;MagickWand/MagickWand.h"
- Wand MagickWand CORE_RL_wand_
+ Wand MagickWand CORE_RL_wand_ CORE_RL_MagickWand_
+ MagickWand-6 MagickWand-7
MagickWand-Q16 MagickWand-Q8 MagickWand-Q16HDRI MagickWand-Q8HDRI
+ MagickWand-6.Q64 MagickWand-6.Q32 MagickWand-6.Q64HDRI MagickWand-6.Q32HDRI
MagickWand-6.Q16 MagickWand-6.Q8 MagickWand-6.Q16HDRI MagickWand-6.Q8HDRI
+ MagickWand-7.Q64 MagickWand-7.Q32 MagickWand-7.Q64HDRI MagickWand-7.Q32HDRI
MagickWand-7.Q16 MagickWand-7.Q8 MagickWand-7.Q16HDRI MagickWand-7.Q8HDRI
)
list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY)
elseif(component STREQUAL "MagickCore")
FIND_IMAGEMAGICK_API(MagickCore "magick/MagickCore.h;MagickCore/MagickCore.h"
- Magick MagickCore CORE_RL_magick_
+ Magick MagickCore CORE_RL_magick_ CORE_RL_MagickCore_
+ MagickCore-6 MagickCore-7
MagickCore-Q16 MagickCore-Q8 MagickCore-Q16HDRI MagickCore-Q8HDRI
+ MagickCore-6.Q64 MagickCore-6.Q32 MagickCore-6.Q64HDRI MagickCore-6.Q32HDRI
MagickCore-6.Q16 MagickCore-6.Q8 MagickCore-6.Q16HDRI MagickCore-6.Q8HDRI
+ MagickCore-7.Q64 MagickCore-7.Q32 MagickCore-7.Q64HDRI MagickCore-7.Q32HDRI
MagickCore-7.Q16 MagickCore-7.Q8 MagickCore-7.Q16HDRI MagickCore-7.Q8HDRI
)
list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY)
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index cebba10f0..e31c19e10 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -25,7 +25,7 @@
# JAVA_INCLUDE_PATH2 = the include path to jni_md.h
# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h
-# Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var}
+# Expand {libarch} occurrences to java_libarch subdirectory(-ies) and set ${_var}
macro(java_append_library_directories _var)
# Determine java arch-specific library subdir
# Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk
@@ -46,8 +46,11 @@ macro(java_append_library_directories _var)
set(_java_libarch "arm" "aarch32")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
# mips* machines are bi-endian mostly so processor does not tell
- # endianess of the underlying system.
- set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el")
+ # endianness of the underlying system.
+ set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}"
+ "mips" "mipsel" "mipseb" "mipsr6" "mipsr6el"
+ "mips64" "mips64el" "mips64r6" "mips64r6el"
+ "mipsn32" "mipsn32el" "mipsn32r6" "mipsn32r6el")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
set(_java_libarch "ppc64" "ppc64le")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
@@ -126,8 +129,6 @@ list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib"
)
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
- /usr/lib
- /usr/local/lib
/usr/lib/jvm/java/lib
/usr/lib/java/jre/lib/{libarch}
/usr/lib/jvm/jre/lib/{libarch}
@@ -185,8 +186,6 @@ list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES
)
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_INCLUDE_DIRECTORIES
- /usr/include
- /usr/local/include
/usr/lib/java/include
/usr/local/lib/java/include
/usr/lib/jvm/java/include
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index b913e170f..e3f5af6c6 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -237,10 +237,18 @@ if(Java_FIND_COMPONENTS)
endif()
elseif(component STREQUAL "Development")
list(APPEND _JAVA_REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAVAC_EXECUTABLE
- Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE)
- if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE
- AND Java_JAVAH_EXECUTABLE AND Java_JAVADOC_EXECUTABLE)
- set(Java_Development_FOUND TRUE)
+ Java_JAVADOC_EXECUTABLE)
+ if(Java_VERSION VERSION_LESS "1.10")
+ list(APPEND _JAVA_REQUIRED_VARS Java_JAVAH_EXECUTABLE)
+ if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE
+ AND Java_JAVAH_EXECUTABLE AND Java_JAVADOC_EXECUTABLE)
+ set(Java_Development_FOUND TRUE)
+ endif()
+ else()
+ if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE
+ AND Java_JAVADOC_EXECUTABLE)
+ set(Java_Development_FOUND TRUE)
+ endif()
endif()
elseif(component STREQUAL "IdlJ")
list(APPEND _JAVA_REQUIRED_VARS Java_IDLJ_EXECUTABLE)
@@ -268,11 +276,19 @@ if(Java_FIND_COMPONENTS)
endif()
else()
# Check for Development
- find_package_handle_standard_args(Java
- REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
- Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE
- VERSION_VAR Java_VERSION_STRING
- )
+ if(Java_VERSION VERSION_LESS "1.10")
+ find_package_handle_standard_args(Java
+ REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
+ Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE
+ VERSION_VAR Java_VERSION_STRING
+ )
+ else()
+ find_package_handle_standard_args(Java
+ REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
+ Java_JAVADOC_EXECUTABLE
+ VERSION_VAR Java_VERSION_STRING
+ )
+ endif()
endif()
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake
index 03216a5c1..daf681863 100644
--- a/Modules/FindKDE3.cmake
+++ b/Modules/FindKDE3.cmake
@@ -200,8 +200,7 @@ find_path(KDE3_INCLUDE_DIR kpassdlg.h
PATHS
/opt/kde3/include
/opt/kde/include
- /usr/include/kde
- /usr/local/include/kde
+ PATH_SUFFIXES include/kde
)
#now the KDE library directory
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index a451e6ccd..a3c87f81e 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -37,6 +37,7 @@
#
# * Intel(mkl)
# * OpenBLAS
+# * FLAME
# * ACML
# * Apple
# * NAS
@@ -201,6 +202,20 @@ if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
endif()
endif ()
+if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All")
+ if(NOT LAPACK_LIBRARIES)
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "flame"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif()
+endif ()
+
#acml lapack
if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
if (BLAS_LIBRARIES MATCHES ".+acml.+")
diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake
index 8009bcfab..d203eafa1 100644
--- a/Modules/FindLibLZMA.cmake
+++ b/Modules/FindLibLZMA.cmake
@@ -23,7 +23,7 @@
# LIBLZMA_VERSION_STRING - version number as a string (ex: "5.0.3")
find_path(LIBLZMA_INCLUDE_DIR lzma.h )
-find_library(LIBLZMA_LIBRARY lzma)
+find_library(LIBLZMA_LIBRARY NAMES lzma liblzma)
if(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h")
file(STRINGS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h" LIBLZMA_HEADER_CONTENTS REGEX "#define LZMA_VERSION_[A-Z]+ [0-9]+")
diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake
index 838ca6a88..315f301b7 100644
--- a/Modules/FindLua50.cmake
+++ b/Modules/FindLua50.cmake
@@ -80,10 +80,10 @@ else()
# include the math library for Unix
if(UNIX AND NOT APPLE)
find_library(MATH_LIBRARY_FOR_LUA m)
- set( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua};${MATH_LIBRARY_FOR_LUA}" CACHE STRING "This is the concatentation of lua and lualib libraries")
+ set( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua};${MATH_LIBRARY_FOR_LUA}" CACHE STRING "This is the concatenation of lua and lualib libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
- set( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua}" CACHE STRING "This is the concatentation of lua and lualib libraries")
+ set( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua}" CACHE STRING "This is the concatenation of lua and lualib libraries")
endif()
endif()
endif()
diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake
index cd1b0214e..850a57e4d 100644
--- a/Modules/FindMPEG.cmake
+++ b/Modules/FindMPEG.cmake
@@ -22,23 +22,21 @@
# MPEG_mpeg2_LIBRARY, where to find the MPEG library.
# MPEG_vo_LIBRARY, where to find the vo library.
-find_path(MPEG_INCLUDE_DIR mpeg2dec/include/video_out.h
- /usr/local/livid
-)
+find_path(MPEG_INCLUDE_DIR
+ NAMES mpeg2.h mpeg2dec/mpeg2.h mpeg2dec/include/video_out.h)
-find_library(MPEG_mpeg2_LIBRARY mpeg2
- /usr/local/livid/mpeg2dec/libmpeg2/.libs
-)
+find_library(MPEG_mpeg2_LIBRARY mpeg2)
-find_library( MPEG_vo_LIBRARY vo
- /usr/local/livid/mpeg2dec/libvo/.libs
-)
+find_library(MPEG_vo_LIBRARY vo)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_mpeg2_LIBRARY MPEG_INCLUDE_DIR)
if(MPEG_FOUND)
- set( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} ${MPEG_vo_LIBRARY} )
+ set( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} )
+ if(MPEG_vo_LIBRARY)
+ list(APPEND MPEG2_LIBRARIES ${MPEG_vo_LIBRARY})
+ endif()
endif()
mark_as_advanced(MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY)
diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake
index 2c75d7b2e..f9ccd6ae1 100644
--- a/Modules/FindMPEG2.cmake
+++ b/Modules/FindMPEG2.cmake
@@ -23,28 +23,24 @@
# MPEG2_vo_LIBRARY, where to find the vo library.
find_path(MPEG2_INCLUDE_DIR
- NAMES mpeg2.h mpeg2dec/mpeg2.h
- PATHS /usr/local/livid
-)
+ NAMES mpeg2.h mpeg2dec/mpeg2.h)
-find_library(MPEG2_mpeg2_LIBRARY mpeg2
- /usr/local/livid/mpeg2dec/libmpeg2/.libs
-)
+find_library(MPEG2_mpeg2_LIBRARY mpeg2)
-find_library( MPEG2_vo_LIBRARY vo
- /usr/local/livid/mpeg2dec/libvo/.libs
-)
+find_library(MPEG2_vo_LIBRARY vo)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR)
if(MPEG2_FOUND)
- set( MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY}
- ${MPEG2_vo_LIBRARY})
+ set(MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY})
+ if(MPEG2_vo_LIBRARY)
+ list(APPEND MPEG2_LIBRARIES ${MPEG2_vo_LIBRARY})
+ endif()
#some native mpeg2 installations will depend
#on libSDL, if found, add it in.
- include(${CMAKE_CURRENT_LIST_DIR}/FindSDL.cmake)
+ find_package(SDL)
if(SDL_FOUND)
set( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY})
endif()
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 22493f69b..4bfbf037b 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -346,7 +346,7 @@ function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE)
# library that has invalid or missing version information there would be warning
# messages emitted by ld.so in the compiler output. In either case, we'll treat
# the output as invalid.
- if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available")
+ if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available|command not found")
set(WRAPPER_RETURN 255)
endif()
# Ensure that no error output might be passed upwards.
@@ -357,7 +357,22 @@ function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE)
set(${RESULT_VARIABLE} "${WRAPPER_RETURN}" PARENT_SCOPE)
endfunction()
-function (_MPI_interrogate_compiler lang)
+macro(_MPI_env_set_ifnot VAR VALUE)
+ if(NOT DEFINED ENV{${VAR}})
+ set(_MPI_${VAR}_WAS_SET FALSE)
+ set(ENV{${VAR}} ${${VALUE}})
+ else()
+ set(_MPI_${VAR}_WAS_SET TRUE)
+ endif()
+endmacro()
+
+macro(_MPI_env_unset_ifnot VAR)
+ if(NOT _MPI_${VAR}_WAS_SET)
+ unset(ENV{${VAR}})
+ endif()
+endmacro()
+
+function (_MPI_interrogate_compiler LANG)
unset(MPI_COMPILE_CMDLINE)
unset(MPI_LINK_CMDLINE)
@@ -368,6 +383,41 @@ function (_MPI_interrogate_compiler lang)
unset(MPI_LIB_NAMES_WORK)
unset(MPI_LIB_FULLPATHS_WORK)
+ # Define the MPICH and Intel MPI compiler variables to the compilers set in CMake.
+ # It's possible to have a per-compiler configuration in these MPI implementations and
+ # a particular MPICH derivate might check compiler interoperability.
+ # Intel MPI in particular does this with I_MPI_CHECK_COMPILER.
+ file(TO_NATIVE_PATH "${CMAKE_${LANG}_COMPILER}" _MPI_UNDERLAYING_COMPILER)
+ # On Windows, the Intel MPI batch scripts can only work with filnames - Full paths will break them.
+ # Due to the lack of other MPICH-based wrappers for Visual C++, we may treat this as default.
+ if(MSVC)
+ get_filename_component(_MPI_UNDERLAYING_COMPILER "${_MPI_UNDERLAYING_COMPILER}" NAME)
+ endif()
+ if("${LANG}" STREQUAL "C")
+ _MPI_env_set_ifnot(I_MPI_CC _MPI_UNDERLAYING_COMPILER)
+ _MPI_env_set_ifnot(MPICH_CC _MPI_UNDERLAYING_COMPILER)
+ elseif("${LANG}" STREQUAL "CXX")
+ _MPI_env_set_ifnot(I_MPI_CXX _MPI_UNDERLAYING_COMPILER)
+ _MPI_env_set_ifnot(MPICH_CXX _MPI_UNDERLAYING_COMPILER)
+ elseif("${LANG}" STREQUAL "Fortran")
+ _MPI_env_set_ifnot(I_MPI_FC _MPI_UNDERLAYING_COMPILER)
+ _MPI_env_set_ifnot(MPICH_FC _MPI_UNDERLAYING_COMPILER)
+ _MPI_env_set_ifnot(I_MPI_F77 _MPI_UNDERLAYING_COMPILER)
+ _MPI_env_set_ifnot(MPICH_F77 _MPI_UNDERLAYING_COMPILER)
+ _MPI_env_set_ifnot(I_MPI_F90 _MPI_UNDERLAYING_COMPILER)
+ _MPI_env_set_ifnot(MPICH_F90 _MPI_UNDERLAYING_COMPILER)
+ endif()
+
+ # Set these two variables for Intel MPI:
+ # - I_MPI_DEBUG_INFO_STRIP: It adds 'objcopy' lines to the compiler output. We support stripping them
+ # (see below), but if we can avoid them in the first place, we should.
+ # - I_MPI_FORT_BIND: By default Intel MPI makes the C/C++ compiler wrappers link Fortran bindings.
+ # This is so that mixed-language code doesn't require additional libraries when linking with mpicc.
+ # For our purposes, this makes little sense, since correct MPI usage from CMake already circumvenes this.
+ set(_MPI_ENV_VALUE "disable")
+ _MPI_env_set_ifnot(I_MPI_DEBUG_INFO_STRIP _MPI_ENV_VALUE)
+ _MPI_env_set_ifnot(I_MPI_FORT_BIND _MPI_ENV_VALUE)
+
# Check whether the -showme:compile option works. This indicates that we have either Open MPI
# or a newer version of LAM/MPI, and implies that -showme:link will also work.
# Open MPI also supports -show, but separates linker and compiler information
@@ -408,6 +458,52 @@ function (_MPI_interrogate_compiler lang)
_MPI_check_compiler(${LANG} "-showme" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
endif()
+ if (MPI_COMPILER_RETURN EQUAL 0 AND DEFINED MPI_COMPILE_CMDLINE)
+ # Intel MPI can be run with -compchk or I_MPI_CHECK_COMPILER set to 1.
+ # In this case, -show will be prepended with a line to the compiler checker. This is a script that performs
+ # compatibility checks and returns a non-zero exit code together with an error if something fails.
+ # It has to be called as "compchk.sh <arch> <compiler>". Here, <arch> is one out of 32 (i686), 64 (ia64) or 32e (x86_64).
+ # The compiler is identified by filename, and can be either the MPI compiler or the underlying compiler.
+ # NOTE: It is vital to run this script while the environment variables are set up, otherwise it can check the wrong compiler.
+ if("${MPI_COMPILE_CMDLINE}" MATCHES "^([^\" ]+/compchk.sh|\"[^\"]+/compchk.sh\") +([^ ]+)")
+ # Now CMAKE_MATCH_1 contains the path to the compchk.sh file and CMAKE_MATCH_2 the architecture flag.
+ unset(COMPILER_CHECKER_OUTPUT)
+ execute_process(
+ COMMAND ${CMAKE_MATCH_1} ${CMAKE_MATCH_2} ${MPI_${LANG}_COMPILER}
+ OUTPUT_VARIABLE COMPILER_CHECKER_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE COMPILER_CHECKER_OUTPUT ERROR_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE MPI_COMPILER_RETURN)
+ # If it returned a non-zero value, the check below will fail and cause the interrogation to be aborted.
+ if(NOT MPI_COMPILER_RETURN EQUAL 0)
+ if(NOT MPI_FIND_QUIETLY)
+ message(STATUS "Intel MPI compiler check failed: ${COMPILER_CHECKER_OUTPUT}")
+ endif()
+ else()
+ # Since the check passed, we can remove the compchk.sh script.
+ string(REGEX REPLACE "^([^\" ]+|\"[^\"]+\")/compchk.sh.*\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
+ endif()
+ endif()
+ endif()
+
+ # Revert changes to the environment made previously
+ if("${LANG}" STREQUAL "C")
+ _MPI_env_unset_ifnot(I_MPI_CC)
+ _MPI_env_unset_ifnot(MPICH_CC)
+ elseif("${LANG}" STREQUAL "CXX")
+ _MPI_env_unset_ifnot(I_MPI_CXX)
+ _MPI_env_unset_ifnot(MPICH_CXX)
+ elseif("${LANG}" STREQUAL "Fortran")
+ _MPI_env_unset_ifnot(I_MPI_FC)
+ _MPI_env_unset_ifnot(MPICH_FC)
+ _MPI_env_unset_ifnot(I_MPI_F77)
+ _MPI_env_unset_ifnot(MPICH_F77)
+ _MPI_env_unset_ifnot(I_MPI_F90)
+ _MPI_env_unset_ifnot(MPICH_F90)
+ endif()
+
+ _MPI_env_unset_ifnot(I_MPI_DEBUG_INFO_STRIP)
+ _MPI_env_unset_ifnot(I_MPI_FORT_BIND)
+
if (NOT (MPI_COMPILER_RETURN EQUAL 0) OR NOT (DEFINED MPI_COMPILE_CMDLINE))
# Cannot interrogate this compiler, so exit.
set(MPI_${LANG}_WRAPPER_FOUND FALSE PARENT_SCOPE)
@@ -421,49 +517,92 @@ function (_MPI_interrogate_compiler lang)
set(MPI_LINK_CMDLINE "${MPI_COMPILE_CMDLINE}")
endif()
- # At this point, we obtained some output from a compiler wrapper that works.
- # We'll now try to parse it into variables with meaning to us.
- if("${LANG}" STREQUAL "Fortran")
- # Some MPICH-1 and MVAPICH-1 versions return a three command answer for Fortran, consisting
- # out of a symlink command for mpif.h, the actual compiler command and a deletion of the
- # created symlink. We need to detect that case, remember the include path and drop the
- # symlink/deletion operation to obtain the link/compile lines we'd usually expect.
- if("${MPI_COMPILE_CMDLINE}" MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h")
- get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY)
- string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
- string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
- string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
- string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
+ # Visual Studio parsers permit each flag prefixed by either / or -.
+ # We'll normalize this to the - syntax we use for CMake purposes anyways.
+ if(MSVC)
+ foreach(_MPI_VARIABLE IN ITEMS COMPILE LINK)
+ # The Intel MPI wrappers on Windows prefix their output with some copyright boilerplate.
+ # To prevent possible problems, we discard this text before proceeding with any further matching.
+ string(REGEX REPLACE "^[^ ]+ for the Intel\\(R\\) MPI Library [^\n]+ for Windows\\*\nCopyright\\(C\\) [^\n]+, Intel Corporation\\. All rights reserved\\.\n\n" ""
+ MPI_${_MPI_VARIABLE}_CMDLINE "${MPI_${_MPI_VARIABLE}_CMDLINE}")
+ string(REGEX REPLACE "(^| )/" "\\1-" MPI_${_MPI_VARIABLE}_CMDLINE "${MPI_${_MPI_VARIABLE}_CMDLINE}")
+ string(REPLACE "-libpath:" "-LIBPATH:" MPI_${_MPI_VARIABLE}_CMDLINE "${MPI_${_MPI_VARIABLE}_CMDLINE}")
+ endforeach()
+ endif()
+
+ # For MSVC and cl-compatible compilers, the keyword /link indicates a point after which
+ # everything following is passed to the linker. In this case, we drop all prior information
+ # from the link line and treat any unknown extra flags as linker flags.
+ set(_MPI_FILTERED_LINK_INFORMATION FALSE)
+ if(MSVC)
+ if(MPI_LINK_CMDLINE MATCHES " -(link|LINK) ")
+ string(REGEX REPLACE ".+-(link|LINK) +" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
+ set(_MPI_FILTERED_LINK_INFORMATION TRUE)
endif()
+ string(REGEX REPLACE " +-(link|LINK) .+" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
endif()
- # The Intel MPI wrapper on Linux will emit some objcopy commands after its compile command
- # if -static_mpi was passed to the wrapper. To avoid spurious matches, we need to drop these lines.
if(UNIX)
+ # At this point, we obtained some output from a compiler wrapper that works.
+ # We'll now try to parse it into variables with meaning to us.
+ if("${LANG}" STREQUAL "Fortran")
+ # If MPICH (and derivates) didn't recognize the Fortran compiler include flag during configuration,
+ # they'll return a set of three commands, consisting out of a symlink command for mpif.h,
+ # the actual compiler command and deletion of the created symlink.
+ # Especially with M(VA)PICH-1, this appears to happen erroneously, and therefore we should translate
+ # this output into an additional include directory and then drop it from the output.
+ if("${MPI_COMPILE_CMDLINE}" MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h")
+ get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY)
+ string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
+ string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
+ string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
+ string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
+ endif()
+ endif()
+
+ # If Intel MPI was configured for static linkage with -static_mpi, the wrapper will by default strip
+ # debug information from resulting binaries (see I_MPI_DEBUG_INFO_STRIP).
+ # Since we cannot process this information into CMake logic, we need to discard the resulting objcopy
+ # commands from the output.
string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
endif()
- # Extract compile options from the compile command line.
- string(REGEX MATCHALL "(^| )-f([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_OPTIONS "${MPI_COMPILE_CMDLINE}")
-
- foreach(_MPI_COMPILE_OPTION IN LISTS MPI_ALL_COMPILE_OPTIONS)
- string(REGEX REPLACE "^ " "" _MPI_COMPILE_OPTION "${_MPI_COMPILE_OPTION}")
- # Ignore -fstack-protector directives: These occur on MPICH and MVAPICH when the libraries
- # themselves were built with this flag. However, this flag is unrelated to using MPI, and
- # we won't match the accompanying --param-ssp-size and -Wp,-D_FORTIFY_SOURCE flags and therefore
- # produce inconsistent results with the regularly flags.
- # Similarly, aliasing flags do not belong into our flag array.
- if(NOT "${_MPI_COMPILE_OPTION}" MATCHES "^-f(stack-protector|(no-|)strict-aliasing|PI[CE]|pi[ce])")
- list(APPEND MPI_COMPILE_OPTIONS_WORK "${_MPI_COMPILE_OPTION}")
- endif()
- endforeach()
+ # For Visual C++, extracting compiler options in a generic fashion isn't easy. However, no MPI implementation
+ # on Windows seems to require any specific ones, either.
+ if(NOT MSVC)
+ # Extract compile options from the compile command line.
+ string(REGEX MATCHALL "(^| )-f([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_OPTIONS "${MPI_COMPILE_CMDLINE}")
+
+ foreach(_MPI_COMPILE_OPTION IN LISTS MPI_ALL_COMPILE_OPTIONS)
+ string(REGEX REPLACE "^ " "" _MPI_COMPILE_OPTION "${_MPI_COMPILE_OPTION}")
+
+ # Ignore -fstack-protector directives: These occur on MPICH and MVAPICH when the libraries
+ # themselves were built with this flag. However, this flag is unrelated to using MPI, and
+ # we won't match the accompanying --param-ssp-size and -Wp,-D_FORTIFY_SOURCE flags and therefore
+ # produce inconsistent results with the regularly flags.
+ # Similarly, aliasing flags do not belong into our flag array.
+ if(NOT "${_MPI_COMPILE_OPTION}" MATCHES "^-f((no-|)(stack-protector|strict-aliasing)|PI[CE]|pi[ce])")
+ list(APPEND MPI_COMPILE_OPTIONS_WORK "${_MPI_COMPILE_OPTION}")
+ endif()
+ endforeach()
+ endif()
- # Same deal, with the definitions. We also treat arguments passed to the preprocessor directly.
- string(REGEX MATCHALL "(^| )(-Wp,|-Xpreprocessor |)[-/]D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_DEFINITIONS "${MPI_COMPILE_CMDLINE}")
+ # For GNU-style compilers, it's possible to prefix includes and definitions with certain flags to pass them
+ # only to the preprocessor. For CMake purposes, we need to treat, but ignore such scopings.
+ # Note that we do not support spaces between the arguments, i.e. -Wp,-I -Wp,/opt/mympi will not be parsed
+ # correctly. This form does not seem to occur in any common MPI implementation, however.
+ if(NOT MSVC)
+ set(_MPI_PREPROCESSOR_FLAG_REGEX "(-Wp,|-Xpreprocessor )?")
+ else()
+ set(_MPI_PREPROCESSOR_FLAG_REGEX "")
+ endif()
+
+ # Same deal as above, for the definitions.
+ string(REGEX MATCHALL "(^| )${_MPI_PREPROCESSOR_FLAG_REGEX}-D *([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_DEFINITIONS "${MPI_COMPILE_CMDLINE}")
foreach(_MPI_COMPILE_DEFINITION IN LISTS MPI_ALL_COMPILE_DEFINITIONS)
- string(REGEX REPLACE "^ ?(-Wp,|-Xpreprocessor )?[-/]D" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}")
+ string(REGEX REPLACE "^ ?${_MPI_PREPROCESSOR_FLAG_REGEX}-D *" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}")
string(REPLACE "\"" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}")
if(NOT "${_MPI_COMPILE_DEFINITION}" MATCHES "^_FORTIFY_SOURCE.*")
list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${_MPI_COMPILE_DEFINITION}")
@@ -471,9 +610,12 @@ function (_MPI_interrogate_compiler lang)
endforeach()
# Extract include paths from compile command line
- string(REGEX MATCHALL "(^| )[-/]I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
+ string(REGEX MATCHALL "(^| )${_MPI_PREPROCESSOR_FLAG_REGEX}${CMAKE_INCLUDE_FLAG_${LANG}} *([^\" ]+|\"[^\"]+\")"
+ MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
# If extracting failed to work, we'll try using -showme:incdirs.
+ # Unlike before, we do this without the environment variables set up, but since only MPICH derivates are affected by any of them, and
+ # -showme:... is only supported by Open MPI and LAM/MPI, this isn't a concern.
if (NOT MPI_ALL_INCLUDE_PATHS)
_MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN)
if(MPI_INCDIRS_COMPILER_RETURN)
@@ -482,16 +624,66 @@ function (_MPI_interrogate_compiler lang)
endif()
foreach(_MPI_INCLUDE_PATH IN LISTS MPI_ALL_INCLUDE_PATHS)
- string(REGEX REPLACE "^ ?[-/]I" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}")
+ string(REGEX REPLACE "^ ?${_MPI_PREPROCESSOR_FLAG_REGEX}${CMAKE_INCLUDE_FLAG_${LANG}} *" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}")
string(REPLACE "\"" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}")
get_filename_component(_MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}" REALPATH)
list(APPEND MPI_INCLUDE_DIRS_WORK "${_MPI_INCLUDE_PATH}")
endforeach()
- # Extract linker paths from the link command line
- string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker |)(-L|[/-]LIBPATH:|[/-]libpath:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
+ # The next step are linker flags and library directories. Here, we first take the flags given in raw -L or -LIBPATH: syntax.
+ string(REGEX MATCHALL "(^| )${CMAKE_LIBRARY_PATH_FLAG} *([^\" ]+|\"[^\"]+\")" MPI_DIRECT_LINK_PATHS "${MPI_LINK_CMDLINE}")
+ foreach(_MPI_LPATH IN LISTS MPI_DIRECT_LINK_PATHS)
+ string(REGEX REPLACE "(^| )${CMAKE_LIBRARY_PATH_FLAG} *" "" _MPI_LPATH "${_MPI_LPATH}")
+ list(APPEND MPI_ALL_LINK_PATHS "${_MPI_LPATH}")
+ endforeach()
+
+ # If the link commandline hasn't been filtered (e.g. when using MSVC and /link), we need to extract the relevant parts first.
+ if(NOT _MPI_FILTERED_LINK_INFORMATION)
+ string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker +)([^\" ]+|\"[^\"]+\")" MPI_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+
+ # In this case, we could also find some indirectly given linker paths, e.g. prefixed by -Xlinker or -Wl,
+ # Since syntaxes like -Wl,-L -Wl,/my/path/to/lib are also valid, we parse these paths by first removing -Wl, and -Xlinker
+ # from the list of filtered flags and then parse the remainder of the output.
+ string(REGEX REPLACE "(-Wl,|-Xlinker +)" "" MPI_LINK_FLAGS_RAW "${MPI_LINK_FLAGS}")
+
+ # Now we can parse the leftover output. Note that spaces can now be handled since the above example would reduce to
+ # -L /my/path/to/lib and can be extracted correctly.
+ string(REGEX MATCHALL "^(${CMAKE_LIBRARY_PATH_FLAG},? *|--library-path=)([^\" ]+|\"[^\"]+\")"
+ MPI_INDIRECT_LINK_PATHS "${MPI_LINK_FLAGS_RAW}")
+
+ foreach(_MPI_LPATH IN LISTS MPI_INDIRECT_LINK_PATHS)
+ string(REGEX REPLACE "^(${CMAKE_LIBRARY_PATH_FLAG},? *|--library-path=)" "" _MPI_LPATH "${_MPI_LPATH}")
+ list(APPEND MPI_ALL_LINK_PATHS "${_MPI_LPATH}")
+ endforeach()
+
+ # We need to remove the flags we extracted from the linker flag list now.
+ string(REGEX REPLACE "(^| )(-Wl,|-Xlinker +)(${CMAKE_LIBRARY_PATH_FLAG},? *(-Wl,|-Xlinker +)?|--library-path=)([^\" ]+|\"[^\"]+\")" ""
+ MPI_LINK_CMDLINE_FILTERED "${MPI_LINK_CMDLINE}")
+
+ # Some MPI implementations pass on options they themselves were built with. Since -z,noexecstack is a common
+ # hardening, we should strip it. In general, the -z options should be undesirable.
+ string(REGEX REPLACE "(^| )-Wl,-z(,[^ ]+| +-Wl,[^ ]+)" "" MPI_LINK_CMDLINE_FILTERED "${MPI_LINK_CMDLINE_FILTERED}")
+ string(REGEX REPLACE "(^| )-Xlinker +-z +-Xlinker +[^ ]+" "" MPI_LINK_CMDLINE_FILTERED "${MPI_LINK_CMDLINE_FILTERED}")
+
+ # We only consider options of the form -Wl or -Xlinker:
+ string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker +)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE_FILTERED}")
+
+ # As a next step, we assemble the linker flags extracted in a preliminary flags string
+ foreach(_MPI_LINK_FLAG IN LISTS MPI_ALL_LINK_FLAGS)
+ string(STRIP "${_MPI_LINK_FLAG}" _MPI_LINK_FLAG)
+ if (MPI_LINK_FLAGS_WORK)
+ string(APPEND MPI_LINK_FLAGS_WORK " ${_MPI_LINK_FLAG}")
+ else()
+ set(MPI_LINK_FLAGS_WORK "${_MPI_LINK_FLAG}")
+ endif()
+ endforeach()
+ else()
+ # In the filtered case, we obtain the link time flags by just stripping the library paths.
+ string(REGEX REPLACE "(^| )${CMAKE_LIBRARY_PATH_FLAG} *([^\" ]+|\"[^\"]+\")" "" MPI_LINK_CMDLINE_FILTERED "${MPI_LINK_CMDLINE}")
+ endif()
- # If extracting failed to work, we'll try using -showme:libdirs.
+ # If we failed to extract any linker paths, we'll try using the -showme:libdirs option with the MPI compiler.
+ # This will return a list of folders, not a set of flags!
if (NOT MPI_ALL_LINK_PATHS)
_MPI_check_compiler(${LANG} "-showme:libdirs" MPI_LIBDIRS_CMDLINE MPI_LIBDIRS_COMPILER_RETURN)
if(MPI_LIBDIRS_COMPILER_RETURN)
@@ -499,34 +691,43 @@ function (_MPI_interrogate_compiler lang)
endif()
endif()
+ # We need to remove potential quotes and convert the paths to CMake syntax while resolving them, too.
foreach(_MPI_LPATH IN LISTS MPI_ALL_LINK_PATHS)
- string(REGEX REPLACE "^ ?(-Wl,|-Xlinker )?(-L|[/-]LIBPATH:|[/-]libpath:)" "" _MPI_LPATH "${_MPI_LPATH}")
string(REPLACE "\"" "" _MPI_LPATH "${_MPI_LPATH}")
get_filename_component(_MPI_LPATH "${_MPI_LPATH}" REALPATH)
list(APPEND MPI_LINK_DIRECTORIES_WORK "${_MPI_LPATH}")
endforeach()
- # Extract linker flags from the link command line
- string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+ # Extract the set of libraries to link against from the link command line
+ # This only makes sense if CMAKE_LINK_LIBRARY_FLAG is defined, i.e. a -lxxxx syntax is supported by the compiler.
+ if(CMAKE_LINK_LIBRARY_FLAG)
+ string(REGEX MATCHALL "(^| )${CMAKE_LINK_LIBRARY_FLAG}([^\" ]+|\"[^\"]+\")"
+ MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
- foreach(_MPI_LINK_FLAG IN LISTS MPI_ALL_LINK_FLAGS)
- string(STRIP "${_MPI_LINK_FLAG}" _MPI_LINK_FLAG)
- # MPI might be marked to build with non-executable stacks but this should not propagate.
- if (NOT "${_MPI_LINK_FLAG}" MATCHES "(-Wl,|-Xlinker )-z,noexecstack")
- if (MPI_LINK_FLAGS_WORK)
- string(APPEND MPI_LINK_FLAGS_WORK " ${_MPI_LINK_FLAG}")
- else()
- set(MPI_LINK_FLAGS_WORK "${_MPI_LINK_FLAG}")
- endif()
- endif()
- endforeach()
+ foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES)
+ string(REGEX REPLACE "^ ?${CMAKE_LINK_LIBRARY_FLAG}" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
+ string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
+ list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}")
+ endforeach()
+ endif()
- # Extract the set of libraries to link against from the link command
- # line
- string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+ # Treat linker objects given by full path, for example static libraries, import libraries
+ # or shared libraries if there aren't any import libraries in use on the system.
+ # Note that we do not consider CMAKE_<TYPE>_LIBRARY_PREFIX intentionally here: The linker will for a given file
+ # decide how to link it based on file type, not based on a prefix like 'lib'.
+ set(_MPI_LIB_NAME_REGEX "[^\" ]+${CMAKE_STATIC_LIBRARY_SUFFIX}|\"[^\"]+${CMAKE_STATIC_LIBRARY_SUFFIX}\"")
+ if(DEFINED CMAKE_IMPORT_LIBRARY_SUFFIX)
+ if(NOT ("${CMAKE_IMPORT_LIBRARY_SUFFIX}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}"))
+ string(APPEND _MPI_LIB_NAME_REGEX "[^\" ]+${CMAKE_IMPORT_LIBRARY_SUFFIX}|\"[^\"]+${CMAKE_IMPORT_LIBRARY_SUFFIX}\"")
+ endif()
+ else()
+ string(APPEND _MPI_LIB_NAME_REGEX "[^\" ]+${CMAKE_SHARED_LIBRARY_SUFFIX}|\"[^\"]+${CMAKE_SHARED_LIBRARY_SUFFIX}\"")
+ endif()
+ string(REPLACE "." "\\." _MPI_LIB_NAME_REGEX "${_MPI_LIB_NAME_REGEX}")
+ string(REGEX MATCHALL "(^| )(${_MPI_LIB_NAME_REGEX})" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES)
- string(REGEX REPLACE "^ ?-l" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
+ string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY)
if(NOT "${_MPI_LIB_PATH}" STREQUAL "")
@@ -536,34 +737,8 @@ function (_MPI_interrogate_compiler lang)
endif()
endforeach()
- if(WIN32)
- # A compiler wrapper on Windows will just have the name of the
- # library to link on its link line, potentially with a full path
- string(REGEX MATCHALL "(^| )([^\" ]+\\.lib|\"[^\"]+\\.lib\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
- foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES)
- string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
- string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
- get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY)
- if(NOT "${_MPI_LIB_PATH}" STREQUAL "")
- list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}")
- else()
- list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}")
- endif()
- endforeach()
- else()
- # On UNIX platforms, archive libraries can be given with full path.
- string(REGEX MATCHALL "(^| )([^\" ]+\\.a|\"[^\"]+\\.a\")" MPI_LIBFULLPATHS "${MPI_LINK_CMDLINE}")
- foreach(_MPI_LIB_NAME IN LISTS MPI_LIBFULLPATHS)
- string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
- string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
- get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY)
- if(NOT "${_MPI_LIB_PATH}" STREQUAL "")
- list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}")
- else()
- list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}")
- endif()
- endforeach()
- endif()
+ # Save the explicitly given link directories
+ set(MPI_LINK_DIRECTORIES_LEFTOVER "${MPI_LINK_DIRECTORIES_WORK}")
# An MPI compiler wrapper could have its MPI libraries in the implictly
# linked directories of the compiler itself.
@@ -583,22 +758,36 @@ function (_MPI_interrogate_compiler lang)
DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
)
mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
+ # Remove the directory from the remainder list.
+ if(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
+ get_filename_component(_MPI_TAKEN_DIRECTORY "${MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY}" DIRECTORY)
+ list(REMOVE_ITEM MPI_LINK_DIRECTORIES_LEFTOVER "${_MPI_TAKEN_DIRECTORY}")
+ endif()
+ endforeach()
+
+ # Add the link directories given explicitly that we haven't used back as linker directories.
+ foreach(_MPI_LINK_DIRECTORY IN LISTS MPI_LINK_DIRECTORIES_LEFTOVER)
+ file(TO_NATIVE_PATH "${_MPI_LINK_DIRECTORY}" _MPI_LINK_DIRECTORY_ACTUAL)
+ string(FIND "${_MPI_LINK_DIRECTORY_ACTUAL}" " " _MPI_LINK_DIRECTORY_CONTAINS_SPACE)
+ if(NOT _MPI_LINK_DIRECTORY_CONTAINS_SPACE EQUAL -1)
+ set(_MPI_LINK_DIRECTORY_ACTUAL "\"${_MPI_LINK_DIRECTORY_ACTUAL}\"")
+ endif()
+ if(MPI_LINK_FLAGS_WORK)
+ string(APPEND MPI_LINK_FLAGS_WORK " ${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}")
+ else()
+ set(MPI_LINK_FLAGS_WORK "${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}")
+ endif()
endforeach()
# Deal with the libraries given with full path next
unset(MPI_DIRECT_LIB_NAMES_WORK)
foreach(_MPI_LIB_FULLPATH IN LISTS MPI_LIB_FULLPATHS_WORK)
get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME_WE)
- get_filename_component(_MPI_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME)
- get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_FULLPATH}" DIRECTORY)
list(APPEND MPI_DIRECT_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}")
- find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY
- NAMES "${_MPI_LIB_NAME}"
- HINTS ${_MPI_LIB_PATH}
- DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
- )
+ set(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY "${_MPI_LIB_FULLPATH}" CACHE FILEPATH "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI")
mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
endforeach()
+ # Directly linked objects should be linked first in case some generic linker flags are needed for them.
if(MPI_DIRECT_LIB_NAMES_WORK)
set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}")
endif()
@@ -744,13 +933,22 @@ function(_MPI_guess_settings LANG)
endif()
mark_as_advanced(MPI_${LANG}_LIB_NAMES)
set(MPI_GUESS_FOUND TRUE)
+
+ if(_MPIEXEC_NOT_GIVEN)
+ unset(MPIEXEC_EXECUTABLE CACHE)
+ endif()
+
+ find_program(MPIEXEC_EXECUTABLE
+ NAMES mpiexec
+ HINTS $ENV{MSMPI_BIN} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]/Bin"
+ DOC "Executable for running MPI programs.")
endif()
endif()
# At this point there's not many MPIs that we could still consider.
# OpenMPI 1.6.x and below supported Windows, but these ship compiler wrappers that still work.
# The only other relevant MPI implementation without a wrapper is MPICH2, which had Windows support in 1.4.1p1 and older.
- if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MPICH2")
+ if(NOT MPI_GUESS_FOUND AND (NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MPICH2"))
set(MPI_MPICH_PREFIX_PATHS
"$ENV{ProgramW6432}/MPICH2/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/../lib"
@@ -809,6 +1007,17 @@ function(_MPI_guess_settings LANG)
unset(MPI_MPICH_ROOT_DIR)
endif()
set(MPI_GUESS_FOUND TRUE)
+
+ if(_MPIEXEC_NOT_GIVEN)
+ unset(MPIEXEC_EXECUTABLE CACHE)
+ endif()
+
+ find_program(MPIEXEC_EXECUTABLE
+ NAMES ${_MPIEXEC_NAMES}
+ HINTS "$ENV{ProgramW6432}/MPICH2/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]/bin"
+ DOC "Executable for running MPI programs.")
endif()
unset(MPI_MPICH_PREFIX_PATHS)
endif()
@@ -1034,9 +1243,6 @@ if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
# SUSE Linux Enterprise Server stores its MPI implementations under /usr/lib64/mpi/gcc/<name>
# We enumerate the subfolders and append each as a prefix
MPI_search_mpi_prefix_folder("/usr/lib64/mpi/gcc")
-elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
- # MSMPI stores its runtime in a special folder, this adds the possible locations to the hints.
- list(APPEND MPI_HINT_DIRS $ENV{MSMPI_BIN} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]")
elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD")
# FreeBSD ships mpich under the normal system paths - but available openmpi implementations
# will be found in /usr/local/mpi/<name>
@@ -1046,6 +1252,15 @@ endif()
# Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for.
# The MPI standard does not mandate the existence of either, but instead only makes requirements if a distribution
# ships an mpiexec program (mpirun executables are not regulated by the standard).
+
+# We defer searching for mpiexec binaries belonging to guesses until later. By doing so, mismatches between mpiexec
+# and the MPI we found should be reduced.
+if(NOT MPIEXEC_EXECUTABLE)
+ set(_MPIEXEC_NOT_GIVEN TRUE)
+else()
+ set(_MPIEXEC_NOT_GIVEN FALSE)
+endif()
+
find_program(MPIEXEC_EXECUTABLE
NAMES ${_MPIEXEC_NAMES}
PATH_SUFFIXES bin sbin
@@ -1095,7 +1310,7 @@ if(NOT MPI_IGNORE_LEGACY_VARIABLES)
if(MPI_${LANG}_COMPILE_FLAGS)
separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}")
foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS)
- if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)")
+ if("${_MPI_FLAG}" MATCHES "^ *-D([^ ]+)")
list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}")
else()
list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}")
@@ -1233,17 +1448,21 @@ foreach(LANG IN ITEMS C CXX Fortran)
endif()
endif()
- if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER)
- # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the
- # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI.
- if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND)
- set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" )
- set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" )
- set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories")
- set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" )
- set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" )
- else()
- _MPI_guess_settings(${LANG})
+ if(NOT MPI_PINNED_COMPILER AND NOT MPI_${LANG}_WRAPPER_FOUND)
+ # If MPI_PINNED_COMPILER wasn't given, and the MPI compiler we potentially found didn't work, we withdraw it.
+ set(MPI_${LANG}_COMPILER "MPI_${LANG}_COMPILER-NOTFOUND" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE)
+ if(NOT MPI_SKIP_GUESSING)
+ # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the
+ # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI.
+ if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND)
+ set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" )
+ set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" )
+ set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories")
+ set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" )
+ set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" )
+ else()
+ _MPI_guess_settings(${LANG})
+ endif()
endif()
endif()
endif()
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 7d4ed6ad2..8402b2316 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -356,7 +356,7 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio
endif()
- if(${win64} AND ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "64")
+ if(${win64} AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "64")
set(APPEND_REG "/reg:64")
else()
set(APPEND_REG "/reg:32")
@@ -765,7 +765,7 @@ endfunction()
# ``WORKING_DIRECTORY``
# This will be the working directory for the test. If specified it will
# also be the output directory used for the log file of the test run.
-# If not specifed the temporary directory ``${CMAKE_BINARY_DIR}/Matlab`` will
+# If not specified the temporary directory ``${CMAKE_BINARY_DIR}/Matlab`` will
# be used as the working directory and the log location.
#
function(matlab_add_unit_test)
@@ -1198,7 +1198,7 @@ if(_numbers_of_matlab_roots EQUAL 0)
# At this point, we have no other choice than trying to find it from PATH.
- # If set by the user, this wont change
+ # If set by the user, this won't change
find_program(
_matlab_main_tmp
NAMES matlab)
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
index 0db2dd280..297a5fba7 100644
--- a/Modules/FindOpenCL.cmake
+++ b/Modules/FindOpenCL.cmake
@@ -76,6 +76,7 @@ find_path(OpenCL_INCLUDE_DIR
ENV NVSDKCOMPUTE_ROOT
ENV CUDA_PATH
ENV ATISTREAMSDKROOT
+ ENV OCL_ROOT
PATH_SUFFIXES
include
OpenCL/common/inc
@@ -94,6 +95,7 @@ if(WIN32)
ENV CUDA_PATH
ENV NVSDKCOMPUTE_ROOT
ENV ATISTREAMSDKROOT
+ ENV OCL_ROOT
PATH_SUFFIXES
"AMD APP/lib/x86"
lib/x86
@@ -109,6 +111,7 @@ if(WIN32)
ENV CUDA_PATH
ENV NVSDKCOMPUTE_ROOT
ENV ATISTREAMSDKROOT
+ ENV OCL_ROOT
PATH_SUFFIXES
"AMD APP/lib/x86_64"
lib/x86_64
@@ -120,9 +123,12 @@ else()
NAMES OpenCL
PATHS
ENV AMDAPPSDKROOT
+ ENV CUDA_PATH
PATH_SUFFIXES
lib/x86_64
- lib/x64)
+ lib/x64
+ lib
+ lib64)
endif()
set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 906349273..4d0786cd2 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -22,7 +22,6 @@
# Defined to the platform-specific OpenGL libraries if the system has OpenGL.
# ``OpenGL::OpenGL``
# Defined to libOpenGL if the system is GLVND-based.
-# ``OpenGL::GL``
# ``OpenGL::GLU``
# Defined if the system has GLU.
# ``OpenGL::GLX``
@@ -99,11 +98,13 @@
# If the GLVND OpenGL and GLX libraries are available, prefer them.
# This forces ``OPENGL_gl_LIBRARY`` to be empty.
# This is the default if components were requested (since components
-# correspond to GLVND libraries).
+# correspond to GLVND libraries) or if policy :policy:`CMP0072` is
+# set to ``NEW``.
#
# ``LEGACY``
# Prefer to use the legacy libGL library, if available.
-# This is the default if no components were requested.
+# This is the default if no components were requested and
+# policy :policy:`CMP0072` is not set to ``NEW``.
#
# For EGL targets the client must rely on GLVND support on the user's system.
# Linking should use the ``OpenGL::OpenGL OpenGL::EGL`` targets. Using GLES*
@@ -182,7 +183,7 @@ else()
find_path(OPENGL_INCLUDE_DIR GL/gl.h
/usr/share/doc/NVIDIA_GLX-1.0/include
/usr/openwin/share/include
- /opt/graphics/OpenGL/include /usr/X11R6/include
+ /opt/graphics/OpenGL/include
${_OPENGL_INCLUDE_PATH}
)
find_path(OPENGL_GLX_INCLUDE_DIR GL/glx.h ${_OPENGL_INCLUDE_PATH})
@@ -190,21 +191,19 @@ else()
find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
/usr/share/doc/NVIDIA_GLX-1.0/include
/usr/openwin/share/include
- /opt/graphics/OpenGL/include /usr/X11R6/include
+ /opt/graphics/OpenGL/include
)
# Search for the GLVND libraries. We do this regardless of COMPONENTS; we'll
# take into account the COMPONENTS logic later.
find_library(OPENGL_opengl_LIBRARY
NAMES OpenGL
- PATHS /usr/X11R6/lib
- ${_OPENGL_LIB_PATH}
+ PATHS ${_OPENGL_LIB_PATH}
)
find_library(OPENGL_glx_LIBRARY
NAMES GLX
- PATHS /usr/X11R6/lib
- ${_OPENGL_LIB_PATH}
+ PATHS ${_OPENGL_LIB_PATH}
)
find_library(OPENGL_egl_LIBRARY
@@ -217,9 +216,10 @@ else()
PATHS ${OPENGL_gl_LIBRARY}
/opt/graphics/OpenGL/lib
/usr/openwin/lib
- /usr/shlib /usr/X11R6/lib
+ /usr/shlib
)
+ set(_OpenGL_GL_POLICY_WARN 0)
if(NOT DEFINED OpenGL_GL_PREFERENCE)
set(OpenGL_GL_PREFERENCE "")
endif()
@@ -237,8 +237,17 @@ else()
set(OpenGL_GL_PREFERENCE "GLVND")
else()
# No preference was explicitly specified and no GLVND components were
- # requested. Prefer libGL for legacy GL.
- set(OpenGL_GL_PREFERENCE "LEGACY")
+ # requested. Use a policy to choose the default.
+ cmake_policy(GET CMP0072 _OpenGL_GL_POLICY)
+ if("x${_OpenGL_GL_POLICY}x" STREQUAL "xNEWx")
+ set(OpenGL_GL_PREFERENCE "GLVND")
+ else()
+ set(OpenGL_GL_PREFERENCE "LEGACY")
+ if("x${_OpenGL_GL_POLICY}x" STREQUAL "xx")
+ set(_OpenGL_GL_POLICY_WARN 1)
+ endif()
+ endif()
+ unset(_OpenGL_GL_POLICY)
endif()
if("x${OpenGL_GL_PREFERENCE}x" STREQUAL "xGLVNDx" AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY)
@@ -252,11 +261,28 @@ else()
NAMES GL MesaGL
PATHS /opt/graphics/OpenGL/lib
/usr/openwin/lib
- /usr/shlib /usr/X11R6/lib
+ /usr/shlib
${_OPENGL_LIB_PATH}
)
endif()
+ if(_OpenGL_GL_POLICY_WARN AND OPENGL_gl_LIBRARY AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY)
+ message(AUTHOR_WARNING
+ "Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when available. "
+ "Run \"cmake --help-policy CMP0072\" for policy details. "
+ "Use the cmake_policy command to set the policy and suppress this warning."
+ "\n"
+ "FindOpenGL found both a legacy GL library:\n"
+ " OPENGL_gl_LIBRARY: ${OPENGL_gl_LIBRARY}\n"
+ "and GLVND libraries for OpenGL and GLX:\n"
+ " OPENGL_opengl_LIBRARY: ${OPENGL_opengl_LIBRARY}\n"
+ " OPENGL_glx_LIBRARY: ${OPENGL_glx_LIBRARY}\n"
+ "OpenGL_GL_PREFERENCE has not been set to \"GLVND\" or \"LEGACY\", so for "
+ "compatibility with CMake 3.10 and below the legacy GL library will be used."
+ )
+ endif()
+ unset(_OpenGL_GL_POLICY_WARN)
+
# FPHSA cannot handle "this OR that is required", so we conditionally set what
# it must look for. First clear any previous config we might have done:
set(_OpenGL_REQUIRED_VARS)
@@ -323,7 +349,7 @@ else()
PATHS ${OPENGL_gl_LIBRARY}
/opt/graphics/OpenGL/lib
/usr/openwin/lib
- /usr/shlib /usr/X11R6/lib
+ /usr/shlib
)
endif ()
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 489476b19..ced092e5f 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -75,6 +75,7 @@
# the OpenMP specification implemented by the ``<lang>`` compiler.
cmake_policy(PUSH)
+cmake_policy(SET CMP0012 NEW) # if() recognizes numbers and booleans
cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
cmake_policy(SET CMP0057 NEW) # if IN_LIST
@@ -230,6 +231,7 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
DOC "Path to the ${_OPENMP_IMPLICIT_LIB_PLAIN} library for OpenMP"
HINTS ${OpenMP_${LANG}_IMPLICIT_LINK_DIRS}
CMAKE_FIND_ROOT_PATH_BOTH
+ NO_DEFAULT_PATH
)
endif()
mark_as_advanced(OpenMP_${_OPENMP_IMPLICIT_LIB_PLAIN}_LIBRARY)
@@ -244,6 +246,8 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
find_library(OpenMP_libiomp5md_LIBRARY
NAMES "libiomp5md"
HINTS ${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}
+ CMAKE_FIND_ROOT_PATH_BOTH
+ NO_DEFAULT_PATH
)
mark_as_advanced(OpenMP_libiomp5md_LIBRARY)
else()
@@ -466,7 +470,7 @@ foreach(LANG IN LISTS OpenMP_FINDLIST)
if(OpenMP_${LANG}_FLAGS)
separate_arguments(_OpenMP_${LANG}_OPTIONS NATIVE_COMMAND "${OpenMP_${LANG}_FLAGS}")
set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY
- INTERFACE_COMPILE_OPTIONS "${_OpenMP_${LANG}_OPTIONS}")
+ INTERFACE_COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:${LANG}>:${_OpenMP_${LANG}_OPTIONS}>")
unset(_OpenMP_${LANG}_OPTIONS)
endif()
if(OpenMP_${LANG}_LIBRARIES)
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 0187e0d66..c358ff1a8 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -110,7 +110,7 @@ if(WIN32 AND NOT CYGWIN)
# * MTd for static-debug
# Implementation details:
- # We are using the libraries located in the VC subdir instead of the parent directory eventhough :
+ # We are using the libraries located in the VC subdir instead of the parent directory even though :
# libeay32MD.lib is identical to ../libeay32.lib, and
# ssleay32MD.lib is identical to ../ssleay32.lib
# enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static
diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake
index 54804b87d..a197e4d2b 100644
--- a/Modules/FindOpenThreads.cmake
+++ b/Modules/FindOpenThreads.cmake
@@ -58,12 +58,6 @@ find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
ENV OSG_ROOT
${OPENTHREADS_DIR}
${OSG_DIR}
- PATHS
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
- /usr/freeware
PATH_SUFFIXES include
)
@@ -80,12 +74,6 @@ find_library(OPENTHREADS_LIBRARY
ENV OSG_ROOT
${OPENTHREADS_DIR}
${OSG_DIR}
- PATHS
- /sw
- /opt/local
- /opt/csw
- /opt
- /usr/freeware
PATH_SUFFIXES lib
)
@@ -102,12 +90,6 @@ find_library(OPENTHREADS_LIBRARY_DEBUG
ENV OSG_ROOT
${OPENTHREADS_DIR}
${OSG_DIR}
- PATHS
- /sw
- /opt/local
- /opt/csw
- /opt
- /usr/freeware
PATH_SUFFIXES lib
)
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index dceb6bcc5..936f01fed 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -51,9 +51,7 @@ endif()
find_package(ZLIB ${_FIND_ZLIB_ARG})
if(ZLIB_FOUND)
- find_path(PNG_PNG_INCLUDE_DIR png.h
- /usr/local/include/libpng # OpenBSD
- )
+ find_path(PNG_PNG_INCLUDE_DIR png.h PATH_SUFFIXES include/libpng)
list(APPEND PNG_NAMES png libpng)
unset(PNG_NAMES_DEBUG)
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake
index e01e75e2d..0b902e74d 100644
--- a/Modules/FindPerlLibs.cmake
+++ b/Modules/FindPerlLibs.cmake
@@ -32,193 +32,94 @@
#
# ::
#
-# PERL_SITESEARCH = path to the sitesearch install dir
-# PERL_SITELIB = path to the sitelib install directory
-# PERL_VENDORARCH = path to the vendor arch install directory
-# PERL_VENDORLIB = path to the vendor lib install directory
-# PERL_ARCHLIB = path to the arch lib install directory
-# PERL_PRIVLIB = path to the priv lib install directory
+# PERL_SITESEARCH = path to the sitesearch install dir (-V:installsitesearch)
+# PERL_SITEARCH = path to the sitelib install directory (-V:installsitearch)
+# PERL_SITELIB = path to the sitelib install directory (-V:installsitelib)
+# PERL_VENDORARCH = path to the vendor arch install directory (-V:installvendorarch)
+# PERL_VENDORLIB = path to the vendor lib install directory (-V:installvendorlib)
+# PERL_ARCHLIB = path to the core arch lib install directory (-V:archlib)
+# PERL_PRIVLIB = path to the core priv lib install directory (-V:privlib)
+# PERL_UPDATE_ARCHLIB = path to the update arch lib install directory (-V:installarchlib)
+# PERL_UPDATE_PRIVLIB = path to the update priv lib install directory (-V:installprivlib)
# PERL_EXTRA_C_FLAGS = Compilation flags used to build perl
# find the perl executable
include(${CMAKE_CURRENT_LIST_DIR}/FindPerl.cmake)
if (PERL_EXECUTABLE)
- ### PERL_PREFIX
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V:prefix
- OUTPUT_VARIABLE
- PERL_PREFIX_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_PREFIX_RESULT_VARIABLE
- )
- if (NOT PERL_PREFIX_RESULT_VARIABLE)
- string(REGEX REPLACE "prefix='([^']+)'.*" "\\1" PERL_PREFIX ${PERL_PREFIX_OUTPUT_VARIABLE})
- endif ()
+ function (perl_get_info _pgi_info tag)
+ cmake_parse_arguments(_PGI "IS_PATH" "" "" ${ARGN})
- ### PERL_ARCHNAME
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V:archname
- OUTPUT_VARIABLE
- PERL_ARCHNAME_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_ARCHNAME_RESULT_VARIABLE
- )
- if (NOT PERL_ARCHNAME_RESULT_VARIABLE)
- string(REGEX REPLACE "archname='([^']+)'.*" "\\1" PERL_ARCHNAME ${PERL_ARCHNAME_OUTPUT_VARIABLE})
- endif ()
+ set (${_pgi_info} NOTFOUND PARENT_SCOPE)
+
+ execute_process(COMMAND "${PERL_EXECUTABLE}" -V:${tag}
+ OUTPUT_VARIABLE result
+ RESULT_VARIABLE status)
+
+ if (NOT status)
+ string(REGEX REPLACE "${tag}='([^']*)'.*" "\\1" result "${result}")
+ if (_PGI_IS_PATH)
+ file(TO_CMAKE_PATH "${result}" result)
+ endif()
+ set (${_pgi_info} "${result}" PARENT_SCOPE)
+ endif ()
+ endfunction()
+ ### PERL_PREFIX
+ perl_get_info(PERL_PREFIX prefix IS_PATH)
+ ### PERL_ARCHNAME
+ perl_get_info(PERL_ARCHNAME archname)
### PERL_EXTRA_C_FLAGS
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V:cppflags
- OUTPUT_VARIABLE
- PERL_CPPFLAGS_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_CPPFLAGS_RESULT_VARIABLE
- )
- if (NOT PERL_CPPFLAGS_RESULT_VARIABLE)
- string(REGEX REPLACE "cppflags='([^']+)'.*" "\\1" PERL_EXTRA_C_FLAGS ${PERL_CPPFLAGS_OUTPUT_VARIABLE})
- endif ()
+ perl_get_info(PERL_EXTRA_C_FLAGS cppflags)
### PERL_SITESEARCH
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V:installsitesearch
- OUTPUT_VARIABLE
- PERL_SITESEARCH_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_SITESEARCH_RESULT_VARIABLE
- )
- if (NOT PERL_SITESEARCH_RESULT_VARIABLE)
- string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITESEARCH ${PERL_SITESEARCH_OUTPUT_VARIABLE})
- file(TO_CMAKE_PATH "${PERL_SITESEARCH}" PERL_SITESEARCH)
- endif ()
+ perl_get_info(PERL_SITESEARCH installsitesearch IS_PATH)
+
+ ### PERL_SITEARCH
+ perl_get_info(PERL_SITEARCH installsitearch IS_PATH)
### PERL_SITELIB
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V:installsitelib
- OUTPUT_VARIABLE
- PERL_SITELIB_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_SITELIB_RESULT_VARIABLE
- )
- if (NOT PERL_SITELIB_RESULT_VARIABLE)
- string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITELIB ${PERL_SITELIB_OUTPUT_VARIABLE})
- file(TO_CMAKE_PATH "${PERL_SITELIB}" PERL_SITELIB)
- endif ()
+ perl_get_info(PERL_SITELIB installsitelib IS_PATH)
### PERL_VENDORARCH
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V:installvendorarch
- OUTPUT_VARIABLE
- PERL_VENDORARCH_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_VENDORARCH_RESULT_VARIABLE
- )
- if (NOT PERL_VENDORARCH_RESULT_VARIABLE)
- string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORARCH ${PERL_VENDORARCH_OUTPUT_VARIABLE})
- file(TO_CMAKE_PATH "${PERL_VENDORARCH}" PERL_VENDORARCH)
- endif ()
+ perl_get_info(PERL_VENDORARCH installvendorarch IS_PATH)
### PERL_VENDORLIB
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V:installvendorlib
- OUTPUT_VARIABLE
- PERL_VENDORLIB_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_VENDORLIB_RESULT_VARIABLE
- )
- if (NOT PERL_VENDORLIB_RESULT_VARIABLE)
- string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORLIB ${PERL_VENDORLIB_OUTPUT_VARIABLE})
- file(TO_CMAKE_PATH "${PERL_VENDORLIB}" PERL_VENDORLIB)
- endif ()
-
- macro(perl_adjust_darwin_lib_variable varname)
- string( TOUPPER PERL_${varname} FINDPERL_VARNAME )
- string( TOLOWER install${varname} PERL_VARNAME )
-
- if (NOT PERL_MINUSV_OUTPUT_VARIABLE)
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V
- OUTPUT_VARIABLE
- PERL_MINUSV_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_MINUSV_RESULT_VARIABLE
- )
- endif()
-
- if (NOT PERL_MINUSV_RESULT_VARIABLE)
- string(REGEX MATCH "(${PERL_VARNAME}.*points? to the Updates directory)"
- PERL_NEEDS_ADJUSTMENT ${PERL_MINUSV_OUTPUT_VARIABLE})
-
- if (PERL_NEEDS_ADJUSTMENT)
- string(REGEX REPLACE "(.*)/Updates/" "/System/\\1/" ${FINDPERL_VARNAME} ${${FINDPERL_VARNAME}})
- endif ()
-
- endif ()
- endmacro()
+ perl_get_info(PERL_VENDORLIB installvendorlib IS_PATH)
### PERL_ARCHLIB
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V:installarchlib
- OUTPUT_VARIABLE
- PERL_ARCHLIB_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_ARCHLIB_RESULT_VARIABLE
- )
- if (NOT PERL_ARCHLIB_RESULT_VARIABLE)
- string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_ARCHLIB ${PERL_ARCHLIB_OUTPUT_VARIABLE})
- perl_adjust_darwin_lib_variable( ARCHLIB )
- file(TO_CMAKE_PATH "${PERL_ARCHLIB}" PERL_ARCHLIB)
- endif ()
+ perl_get_info(PERL_ARCHLIB archlib IS_PATH)
### PERL_PRIVLIB
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V:installprivlib
- OUTPUT_VARIABLE
- PERL_PRIVLIB_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_PRIVLIB_RESULT_VARIABLE
- )
- if (NOT PERL_PRIVLIB_RESULT_VARIABLE)
- string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_PRIVLIB ${PERL_PRIVLIB_OUTPUT_VARIABLE})
- perl_adjust_darwin_lib_variable( PRIVLIB )
- file(TO_CMAKE_PATH "${PERL_PRIVLIB}" PERL_PRIVLIB)
- endif ()
+ perl_get_info(PERL_PRIVLIB privlib IS_PATH)
+
+ ### PERL_UPDATE_ARCHLIB
+ perl_get_info(PERL_UPDATE_ARCHLIB installarchlib IS_PATH)
+
+ ### PERL_UPDATE_PRIVLIB
+ perl_get_info(PERL_UPDATE_PRIVLIB installprivlib IS_PATH)
### PERL_POSSIBLE_LIBRARY_NAMES
- execute_process(
- COMMAND
- ${PERL_EXECUTABLE} -V:libperl
- OUTPUT_VARIABLE
- PERL_LIBRARY_OUTPUT_VARIABLE
- RESULT_VARIABLE
- PERL_LIBRARY_RESULT_VARIABLE
- )
- if (NOT PERL_LIBRARY_RESULT_VARIABLE)
- string(REGEX REPLACE "libperl='([^']+)'.*" "\\1" PERL_POSSIBLE_LIBRARY_NAMES ${PERL_LIBRARY_OUTPUT_VARIABLE})
- else ()
+ perl_get_info(PERL_POSSIBLE_LIBRARY_NAMES libperl)
+ if (NOT PERL_POSSIBLE_LIBRARY_NAMES)
set(PERL_POSSIBLE_LIBRARY_NAMES perl${PERL_VERSION_STRING} perl)
- endif ()
+ endif()
+ if (CMAKE_SYSTEM_NAME MATCHES "MSYS|CYGWIN")
+ # on MSYS and CYGWIN environments, current perl -V:libperl gives shared library name
+ # rather than the import library. So, extends possible library names
+ list (APPEND PERL_POSSIBLE_LIBRARY_NAMES perl)
+ endif()
### PERL_INCLUDE_PATH
find_path(PERL_INCLUDE_PATH
NAMES
perl.h
PATHS
- ${PERL_ARCHLIB}/CORE
+ "${PERL_UPDATE_ARCHLIB}/CORE"
+ "${PERL_ARCHLIB}/CORE"
/usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl5/${PERL_VERSION_STRING}/CORE
@@ -230,7 +131,8 @@ if (PERL_EXECUTABLE)
NAMES
${PERL_POSSIBLE_LIBRARY_NAMES}
PATHS
- ${PERL_ARCHLIB}/CORE
+ "${PERL_UPDATE_ARCHLIB}/CORE"
+ "${PERL_ARCHLIB}/CORE"
/usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl5/${PERL_VERSION_STRING}/CORE
diff --git a/Modules/FindPike.cmake b/Modules/FindPike.cmake
index dff55a480..ec71c949a 100644
--- a/Modules/FindPike.cmake
+++ b/Modules/FindPike.cmake
@@ -16,15 +16,12 @@
# PIKE_INCLUDE_PATH = path to where program.h is found
# PIKE_EXECUTABLE = full path to the pike binary
-file(GLOB PIKE_POSSIBLE_INCLUDE_PATHS
- /usr/include/pike/*
- /usr/local/include/pike/*)
-
find_path(PIKE_INCLUDE_PATH program.h
- ${PIKE_POSSIBLE_INCLUDE_PATHS})
+ ${PIKE_POSSIBLE_INCLUDE_PATHS}
+ PATH_SUFFIXES include/pike8.0/pike include/pike7.8/pike include/pike7.4/pike)
find_program(PIKE_EXECUTABLE
- NAMES pike7.4
+ NAMES pike8.0 pike 7.8 pike7.4
)
mark_as_advanced(
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 76afa8a5d..952ca9265 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -1,19 +1,22 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPkgConfig
-# -------------
-#
-# A `pkg-config` module for CMake.
-#
-# Finds the ``pkg-config`` executable and add the
-# :command:`pkg_check_modules` and :command:`pkg_search_module`
-# commands.
-#
-# In order to find the ``pkg-config`` executable, it uses the
-# :variable:`PKG_CONFIG_EXECUTABLE` variable or the ``PKG_CONFIG``
-# environment variable first.
+#[========================================[.rst:
+FindPkgConfig
+-------------
+
+A ``pkg-config`` module for CMake.
+
+Finds the ``pkg-config`` executable and adds the :command:`pkg_get_variable`,
+:command:`pkg_check_modules` and :command:`pkg_search_module` commands. The
+following variables will also be set::
+
+ 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)
+
+#]========================================]
### Common stuff ####
set(PKG_CONFIG_VERSION 1)
@@ -82,12 +85,13 @@ endmacro()
#[========================================[.rst:
.. command:: pkg_get_variable
- Retrieves the value of a variable from a package::
+ Retrieves the value of a pkg-config variable ``varName`` and stores it in the
+ result variable ``resultVar`` in the calling scope. ::
- pkg_get_variable(<RESULT> <MODULE> <VARIABLE>)
+ pkg_get_variable(<resultVar> <moduleName> <varName>)
- If multiple values are returned variable will contain a
- :ref:`;-list <CMake Language Lists>`.
+ If ``pkg-config`` returns multiple values for the specified variable,
+ ``resultVar`` will contain a :ref:`;-list <CMake Language Lists>`.
For example:
@@ -187,10 +191,10 @@ function(_pkg_create_imp_target _prefix _no_cmake_path _no_cmake_environment_pat
# set the options that are used as long as the .pc file does not provide a library
# path to look into
if(_no_cmake_path)
- set(_find_opts "NO_CMAKE_PATH")
+ list(APPEND _find_opts "NO_CMAKE_PATH")
endif()
if(_no_cmake_environment_path)
- string(APPEND _find_opts " NO_CMAKE_ENVIRONMENT_PATH")
+ list(APPEND _find_opts "NO_CMAKE_ENVIRONMENT_PATH")
endif()
unset(_search_paths)
@@ -454,7 +458,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
if (_imp_target)
- _pkg_create_imp_target("${_prefix}" _no_cmake_path _no_cmake_environment_path)
+ _pkg_create_imp_target("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path})
endif()
endif()
@@ -472,117 +476,106 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
endif()
endmacro()
-###
-### User visible macros start here
-###
#[========================================[.rst:
.. command:: pkg_check_modules
- Checks for all the given modules. ::
+ Checks for all the given modules, setting a variety of result variables in
+ the calling scope. ::
- pkg_check_modules(<PREFIX> [REQUIRED] [QUIET]
- [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
+ pkg_check_modules(<prefix>
+ [REQUIRED] [QUIET]
+ [NO_CMAKE_PATH]
+ [NO_CMAKE_ENVIRONMENT_PATH]
[IMPORTED_TARGET]
- <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.
- The ``IMPORTED_TARGET`` argument will create an imported target named
- PkgConfig::<PREFIX>> that can be passed directly as an argument to
- :command:`target_link_libraries`.
-
- 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
+ <moduleSpec> [<moduleSpec>...])
+
+ When the ``REQUIRED`` argument is given, the command will fail with an error
+ if module(s) could not be found.
+
+ When the ``QUIET`` argument is given, 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 to a
+ boolean ``True`` value, then the :variable:`CMAKE_PREFIX_PATH`,
+ :variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH` cache
+ and environment variables will be added to the ``pkg-config`` search path.
+ The ``NO_CMAKE_PATH`` and ``NO_CMAKE_ENVIRONMENT_PATH`` arguments
+ disable this behavior for the cache variables and environment variables
+ respectively.
+
+ The ``IMPORTED_TARGET`` argument will create an imported target named
+ ``PkgConfig::<prefix>`` that can be passed directly as an argument to
+ :command:`target_link_libraries`.
+
+ Each ``<moduleSpec>`` must be in one of the following formats::
+
+ {moduleName} ... matches any version
+ {moduleName}>={version} ... at least version <version> is required
+ {moduleName}={version} ... exactly version <version> is required
+ {moduleName}<={version} ... modules must not be newer than <version>
+
+ The following variables may be set upon return. Two sets of values exist,
+ one for the common case (``<XXX> = <prefix>``) and another for the
+ information ``pkg-config`` provides when it is called with the ``--static``
+ option (``<XXX> = <prefix>_STATIC``)::
+
+ <XXX>_FOUND ... set to 1 if module(s) exist
+ <XXX>_LIBRARIES ... only the libraries (without the '-l')
+ <XXX>_LIBRARY_DIRS ... the paths of the libraries (without the '-L')
+ <XXX>_LDFLAGS ... all required linker flags
+ <XXX>_LDFLAGS_OTHER ... all other linker flags
+ <XXX>_INCLUDE_DIRS ... the '-I' preprocessor flags (without the '-I')
+ <XXX>_CFLAGS ... all required cflags
+ <XXX>_CFLAGS_OTHER ... the other compiler flags
+
+ All but ``<XXX>_FOUND`` may be a :ref:`;-list <CMake Language Lists>` if the
+ associated variable returned from ``pkg-config`` has multiple values.
+
+ There are some special variables whose prefix depends on the number of
+ ``<moduleSpec>`` given. When there is only one ``<moduleSpec>``,
+ ``<YYY>`` will simply be ``<prefix>``, but if two or more ``<moduleSpec>``
+ items are given, ``<YYY>`` will be ``<prefix>_<moduleName>``::
+
+ <YYY>_VERSION ... version of the module
+ <YYY>_PREFIX ... prefix directory of the module
+ <YYY>_INCLUDEDIR ... include directory of the module
+ <YYY>_LIBDIR ... lib directory of the module
+
+ Examples
- ::
-
- <XPREFIX> = <PREFIX> for common case
- <XPREFIX> = <PREFIX>_STATIC for static linking
-
- Every variable containing multiple values will be a
- :ref:`;-list <CMake Language Lists>`.
-
- 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
- .. code-block:: cmake
+ pkg_check_modules (GLIB2 glib-2.0)
- pkg_check_modules (GLIB2 glib-2.0)
+ Looks for any version of glib2. If found, the output variable
+ ``GLIB2_VERSION`` will hold the actual version found.
- .. code-block:: cmake
+ .. code-block:: cmake
- pkg_check_modules (GLIB2 glib-2.0>=2.10)
+ 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``
+ Looks for at least version 2.10 of glib2. If found, the output variable
+ ``GLIB2_VERSION`` will hold the actual version found.
- .. code-block:: cmake
+ .. code-block:: cmake
- pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
+ 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``
+ Looks for both glib2-2.0 (at least version 2.10) and any version of
+ gtk2+-2.0. Only if both are found will ``FOO`` be considered found.
+ The ``FOO_glib-2.0_VERSION`` and ``FOO_gtk+-2.0_VERSION`` variables will be
+ set to their respective found module versions.
- .. code-block:: cmake
+ .. code-block:: cmake
pkg_check_modules (XRENDER REQUIRED xrender)
- Defines for example::
+ Requires any version of ``xrender``. Example output variables set by a
+ successful call::
- XRENDER_LIBRARIES=Xrender;X11``
- XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
+ XRENDER_LIBRARIES=Xrender;X11
+ XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
#]========================================]
macro(pkg_check_modules _prefix _module0)
_pkgconfig_parse_options(_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
@@ -597,7 +590,7 @@ macro(pkg_check_modules _prefix _module0)
_pkgconfig_set(__pkg_config_arguments_${_prefix} "${_module0};${ARGN}")
endif()
elseif (${_prefix}_FOUND AND ${_imp_target})
- _pkg_create_imp_target("${_prefix}" _no_cmake_path _no_cmake_environment_path)
+ _pkg_create_imp_target("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path})
endif()
endmacro()
@@ -605,19 +598,22 @@ 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. ::
+ The behavior of this command is the same as :command:`pkg_check_modules`,
+ except that rather than checking for all the specified modules, it searches
+ for just the first successful match. ::
- pkg_search_module(<PREFIX> [REQUIRED] [QUIET]
- [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
+ pkg_search_module(<prefix>
+ [REQUIRED] [QUIET]
+ [NO_CMAKE_PATH]
+ [NO_CMAKE_ENVIRONMENT_PATH]
[IMPORTED_TARGET]
- <MODULE> [<MODULE>]*)
+ <moduleSpec> [<moduleSpec>...])
- Examples
+ Examples
- .. code-block:: cmake
+ .. code-block:: cmake
- pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
+ pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
#]========================================]
macro(pkg_search_module _prefix _module0)
_pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
@@ -648,27 +644,32 @@ macro(pkg_search_module _prefix _module0)
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
elseif (${_prefix}_FOUND AND ${_imp_target})
- _pkg_create_imp_target("${_prefix}" _no_cmake_path _no_cmake_environment_path)
+ _pkg_create_imp_target("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path})
endif()
endmacro()
#[========================================[.rst:
-.. variable:: PKG_CONFIG_EXECUTABLE
+Variables Affecting Behavior
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Path to the pkg-config executable.
+.. variable:: PKG_CONFIG_EXECUTABLE
+ This can be set to the path of the pkg-config executable. If not provided,
+ it will be set by the module as a result of calling :command:`find_program`
+ internally. The ``PKG_CONFIG`` environment variable can be used as a hint.
.. 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.
+ Specifies whether :command:`pkg_check_modules` and
+ :command:`pkg_search_module` should add the paths in the
+ :variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_FRAMEWORK_PATH` and
+ :variable:`CMAKE_APPBUNDLE_PATH` cache and environment variables to the
+ ``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.
+ 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.
#]========================================]
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index f745876ec..3f6fa6c0f 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -23,7 +23,7 @@
# ----------------------------------------------------------------------------
# Note:
# PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the
-# version mumber of the implementation of PostgreSQL.
+# version number of the implementation of PostgreSQL.
# In Windows the default installation of PostgreSQL uses that as part of the path.
# E.g C:\Program Files\PostgreSQL\8.4.
# Currently, the following version numbers are known to this module:
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 64b98a879..3ef8e9f19 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -100,6 +100,9 @@ if(NOT PYTHON_EXECUTABLE)
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-32\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-64\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-32\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-64\\InstallPath]
)
endforeach()
endif()
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 63ec9a84e..341d5d9e3 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -122,6 +122,7 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
if(WIN32)
find_library(PYTHON_DEBUG_LIBRARY
NAMES python${_CURRENT_VERSION_NO_DOTS}_d python
+ NAMES_PER_DIR
HINTS ${_Python_LIBRARY_PATH_HINT}
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
@@ -145,20 +146,18 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
python${_CURRENT_VERSION}m
python${_CURRENT_VERSION}u
python${_CURRENT_VERSION}
+ NAMES_PER_DIR
HINTS
${_Python_LIBRARY_PATH_HINT}
PATHS
${PYTHON_FRAMEWORK_LIBRARIES}
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
- # Avoid finding the .dll in the PATH. We want the .lib.
- NO_SYSTEM_ENVIRONMENT_PATH
)
# Look for the static library in the Python config directory
find_library(PYTHON_LIBRARY
NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION}
- # Avoid finding the .dll in the PATH. We want the .lib.
- NO_SYSTEM_ENVIRONMENT_PATH
+ NAMES_PER_DIR
# This is where the static library is usually located
PATH_SUFFIXES python${_CURRENT_VERSION}/config
)
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake
index 4d8aea92e..68dfa7d28 100644
--- a/Modules/FindQt.cmake
+++ b/Modules/FindQt.cmake
@@ -105,13 +105,11 @@ find_file( QT4_QGLOBAL_H_FILE qglobal.h
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/include/Qt"
${qt_headers}/Qt
$ENV{QTDIR}/include/Qt
- /usr/local/qt/include/Qt
- /usr/local/include/Qt
/usr/lib/qt/include/Qt
- /usr/include/Qt
/usr/share/qt4/include/Qt
/usr/local/include/X11/qt4/Qt
- C:/Progra~1/qt/include/Qt )
+ C:/Progra~1/qt/include/Qt
+ PATH_SUFFIXES qt/include/Qt include/Qt)
if(QT4_QGLOBAL_H_FILE)
set(QT4_INSTALLED TRUE)
@@ -125,14 +123,10 @@ find_file( QT3_QGLOBAL_H_FILE qglobal.h
C:/Qt/3.3.3Educational/include
$ENV{QTDIR}/include
/usr/include/qt3/Qt
- /usr/local/qt/include
- /usr/local/include
- /usr/lib/qt/include
- /usr/include
/usr/share/qt3/include
/usr/local/include/X11/qt3
C:/Progra~1/qt/include
- /usr/include/qt3 )
+ PATH_SUFFIXES qt/include include/qt3)
if(QT3_QGLOBAL_H_FILE)
set(QT3_INSTALLED TRUE)
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index fa9f3a15c..a034210d8 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -61,14 +61,10 @@ find_path(QT_INCLUDE_DIR qt.h
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
$ENV{QTDIR}/include
${GLOB_PATHS}
- /usr/local/qt/include
- /usr/lib/qt/include
- /usr/lib/qt3/include
- /usr/include/qt
/usr/share/qt3/include
C:/Progra~1/qt/include
- /usr/include/qt3
/usr/local/include/X11/qt3
+ PATH_SUFFIXES lib/qt/include lib/qt3/include include/qt include/qt3 qt/include qt3/include
)
# if qglobal.h is not in the qt_include_dir then set
@@ -101,13 +97,10 @@ if (QT_MT_REQUIRED)
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]"
ENV QTDIR
${GLOB_PATHS_LIB}
- /usr/local/qt
- /usr/lib/qt
- /usr/lib/qt3
/usr/share/qt3
C:/Progra~1/qt
PATH_SUFFIXES
- lib
+ lib/qt lib/qt3 qt qt3 qt/lib qt3/lib
)
else ()
@@ -122,13 +115,10 @@ else ()
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]"
ENV QTDIR
${GLOB_PATHS_LIB}
- /usr/local/qt
- /usr/lib/qt
- /usr/lib/qt3
/usr/share/qt3
C:/Progra~1/qt/lib
PATH_SUFFIXES
- lib
+ lib/qt lib/qt3 qt qt3 qt/lib qt3/lib
)
endif ()
@@ -141,12 +131,10 @@ find_library(QT_QASSISTANTCLIENT_LIBRARY
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]"
ENV QTDIR
${GLOB_PATHS_LIB}
- /usr/local/qt
- /usr/lib/qt3
/usr/share/qt3
C:/Progra~1/qt
PATH_SUFFIXES
- lib
+ lib/qt lib/qt3 qt qt3 qt/lib qt3/lib
)
# Qt 3 should prefer QTDIR over the PATH
@@ -159,15 +147,10 @@ find_program(QT_MOC_EXECUTABLE
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
${GLOB_PATHS_BIN}
- /usr/local/lib/qt3
- /usr/local/qt
- /usr/lib/qt
- /usr/lib/qt3
/usr/share/qt3
C:/Progra~1/qt
- /usr/X11R6
PATH_SUFFIXES
- bin
+ lib/qt lib/qt3 qt qt3 qt/lib qt3/lib
)
if(QT_MOC_EXECUTABLE)
@@ -184,14 +167,10 @@ find_program(QT_UIC_EXECUTABLE
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
${GLOB_PATHS_BIN}
- /usr/local/qt
- /usr/lib/qt
- /usr/lib/qt3
/usr/share/qt3
C:/Progra~1/qt
- /usr/X11R6
PATH_SUFFIXES
- bin
+ lib/qt lib/qt3 qt qt3 qt/lib qt3/lib
)
if(QT_UIC_EXECUTABLE)
@@ -208,8 +187,6 @@ if (WIN32)
PATHS
"$ENV{ProgramFiles}/qt"
"C:/Program Files/qt"
- PATH_SUFFIXES
- lib
DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise."
)
endif ()
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index c67d0beaa..5a7eadb96 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -398,13 +398,14 @@ macro (_QT4_ADJUST_LIB_VARS _camelCaseBasename)
# if the release- as well as the debug-version of the library have been found:
if (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
- # if the generator supports configuration types then set
- # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
- if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
+ # single-config generators, set optimized and debug libraries
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(_isMultiConfig OR CMAKE_BUILD_TYPE)
set(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
else()
- # if there are no configuration types and CMAKE_BUILD_TYPE has no value
- # then just use the release libraries
+ # For single-config generators where CMAKE_BUILD_TYPE has no value,
+ # just use the release libraries
set(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} )
endif()
set(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index a9f8d3545..bd9f8357d 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -59,6 +59,9 @@ else()
endif()
if(NOT Ruby_FIND_VERSION_EXACT)
+ list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.4 ruby24)
+ list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.3 ruby23)
+ list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.2 ruby22)
list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.1 ruby21)
list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.0 ruby20)
list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby1.9 ruby19)
@@ -156,20 +159,35 @@ if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
set(RUBY_VERSION_MINOR 8)
set(RUBY_VERSION_PATCH 0)
# check whether we found 1.9.x
- if(${RUBY_EXECUTABLE} MATCHES "ruby1.?9")
+ if(${RUBY_EXECUTABLE} MATCHES "ruby1\\.?9")
set(RUBY_VERSION_MAJOR 1)
set(RUBY_VERSION_MINOR 9)
endif()
# check whether we found 2.0.x
- if(${RUBY_EXECUTABLE} MATCHES "ruby2.?0")
+ if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?0")
set(RUBY_VERSION_MAJOR 2)
set(RUBY_VERSION_MINOR 0)
endif()
# check whether we found 2.1.x
- if(${RUBY_EXECUTABLE} MATCHES "ruby2.?1")
+ if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?1")
set(RUBY_VERSION_MAJOR 2)
set(RUBY_VERSION_MINOR 1)
endif()
+ # check whether we found 2.2.x
+ if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?2")
+ set(RUBY_VERSION_MAJOR 2)
+ set(RUBY_VERSION_MINOR 2)
+ endif()
+ # check whether we found 2.3.x
+ if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?3")
+ set(RUBY_VERSION_MAJOR 2)
+ set(RUBY_VERSION_MINOR 3)
+ endif()
+ # check whether we found 2.4.x
+ if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?4")
+ set(RUBY_VERSION_MAJOR 2)
+ set(RUBY_VERSION_MINOR 4)
+ endif()
endif()
if(RUBY_VERSION_MAJOR)
diff --git a/Modules/FindSelfPackers.cmake b/Modules/FindSelfPackers.cmake
index 01d064139..ac2c7cf88 100644
--- a/Modules/FindSelfPackers.cmake
+++ b/Modules/FindSelfPackers.cmake
@@ -20,19 +20,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
find_program(SELF_PACKER_FOR_EXECUTABLE
upx
${CYGWIN_INSTALL_PATH}/bin
- /bin
- /usr/bin
- /usr/local/bin
- /sbin
)
find_program(SELF_PACKER_FOR_SHARED_LIB
upx
${CYGWIN_INSTALL_PATH}/bin
- /bin
- /usr/bin
- /usr/local/bin
- /sbin
)
mark_as_advanced(
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index 09bdf1ff9..d1ce2002a 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -144,9 +144,6 @@ if(NOT SQUISH_INSTALL_DIR)
# Look in places relative to the system executable search path.
${SQUISH_INSTALL_DIR_SEARCH}
- # Look in standard UNIX install locations.
- #/usr/local/squish
-
DOC "The ${SQUISH_INSTALL_DIR_STRING}"
)
endif()
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index b6e24a36d..19eb9329f 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -26,7 +26,7 @@
#
#
# In an effort to remove some clutter and clear up some issues for
-# people who are not necessarily Tcl/Tk gurus/developpers, some
+# people who are not necessarily Tcl/Tk gurus/developers, some
# variables were moved or removed. Changes compared to CMake 2.4 are:
#
# ::
@@ -82,11 +82,16 @@ set(TCLTK_POSSIBLE_LIB_PATHS
"${TK_LIBRARY_PATH}"
"${TCL_TCLSH_PATH_PARENT}/lib"
"${TK_WISH_PATH_PARENT}/lib"
- /usr/local/lib/tcl/tcl8.5
- /usr/local/lib/tcl/tk8.5
- /usr/local/lib/tcl/tcl8.4
- /usr/local/lib/tcl/tk8.4
- )
+)
+
+set(TCLTK_POSSIBLE_LIB_PATH_SUFFIXES
+ lib/tcl/tcl8.6
+ lib/tcl/tk8.6
+ lib/tcl/tcl8.5
+ lib/tcl/tk8.5
+ lib/tcl/tcl8.4
+ lib/tcl/tk8.4
+)
if(WIN32)
get_filename_component(
@@ -111,26 +116,28 @@ find_library(TCL_LIBRARY
NAMES
tcl
tcl${TCL_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION}
- tcl86 tcl8.6
+ tcl86 tcl8.6 tcl86t tcl8.6t
tcl85 tcl8.5
tcl84 tcl8.4
tcl83 tcl8.3
tcl82 tcl8.2
tcl80 tcl8.0
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
+ PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
)
find_library(TK_LIBRARY
NAMES
tk
tk${TK_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION}
- tk86 tk8.6
+ tk86 tk8.6 tk86t tk8.6t
tk85 tk8.5
tk84 tk8.4
tk83 tk8.3
tk82 tk8.2
tk80 tk8.0
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
+ PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
)
CMAKE_FIND_FRAMEWORKS(Tcl)
@@ -164,20 +171,20 @@ set(TCLTK_POSSIBLE_INCLUDE_PATHS
${TK_FRAMEWORK_INCLUDES}
"${TCL_TCLSH_PATH_PARENT}/include"
"${TK_WISH_PATH_PARENT}/include"
- /usr/include/tcl${TK_LIBRARY_VERSION}
- /usr/include/tcl${TCL_LIBRARY_VERSION}
- /usr/include/tcl8.6
- /usr/include/tcl8.5
- /usr/include/tcl8.4
- /usr/include/tcl8.3
- /usr/include/tcl8.2
- /usr/include/tcl8.0
- /usr/local/include/tcl8.6
- /usr/local/include/tk8.6
- /usr/local/include/tcl8.5
- /usr/local/include/tk8.5
- /usr/local/include/tcl8.4
- /usr/local/include/tk8.4
+ )
+
+set(TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES
+ include/tcl${TK_LIBRARY_VERSION}
+ include/tcl${TCL_LIBRARY_VERSION}
+ include/tcl8.6
+ include/tk8.6
+ include/tcl8.5
+ include/tk8.5
+ include/tcl8.4
+ include/tk8.4
+ include/tcl8.3
+ include/tcl8.2
+ include/tcl8.0
)
if(WIN32)
@@ -198,11 +205,13 @@ endif()
find_path(TCL_INCLUDE_PATH
NAMES tcl.h
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
+ PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
)
find_path(TK_INCLUDE_PATH
NAMES tk.h
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
+ PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindTclStub.cmake b/Modules/FindTclStub.cmake
index 9711bd6f8..51fc02933 100644
--- a/Modules/FindTclStub.cmake
+++ b/Modules/FindTclStub.cmake
@@ -32,7 +32,7 @@
#
#
# In an effort to remove some clutter and clear up some issues for
-# people who are not necessarily Tcl/Tk gurus/developpers, some
+# people who are not necessarily Tcl/Tk gurus/developers, some
# variables were moved or removed. Changes compared to CMake 2.4 are:
#
# ::
diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake
index d2b6a4d7f..45047a949 100644
--- a/Modules/FindUnixCommands.cmake
+++ b/Modules/FindUnixCommands.cmake
@@ -15,10 +15,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
find_program(BASH
bash
${CYGWIN_INSTALL_PATH}/bin
- /bin
- /usr/bin
- /usr/local/bin
- /sbin
)
mark_as_advanced(
BASH
@@ -27,10 +23,6 @@ mark_as_advanced(
find_program(CP
cp
${CYGWIN_INSTALL_PATH}/bin
- /bin
- /usr/bin
- /usr/local/bin
- /sbin
)
mark_as_advanced(
CP
@@ -39,10 +31,6 @@ mark_as_advanced(
find_program(GZIP
gzip
${CYGWIN_INSTALL_PATH}/bin
- /bin
- /usr/bin
- /usr/local/bin
- /sbin
)
mark_as_advanced(
GZIP
@@ -51,10 +39,6 @@ mark_as_advanced(
find_program(MV
mv
${CYGWIN_INSTALL_PATH}/bin
- /bin
- /usr/bin
- /usr/local/bin
- /sbin
)
mark_as_advanced(
MV
@@ -63,10 +47,6 @@ mark_as_advanced(
find_program(RM
rm
${CYGWIN_INSTALL_PATH}/bin
- /bin
- /usr/bin
- /usr/local/bin
- /sbin
)
mark_as_advanced(
RM
@@ -78,10 +58,6 @@ find_program(TAR
gtar
PATH
${CYGWIN_INSTALL_PATH}/bin
- /bin
- /usr/bin
- /usr/local/bin
- /sbin
)
mark_as_advanced(
TAR
diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake
index c81c4485e..60de726e1 100644
--- a/Modules/Findosg_functions.cmake
+++ b/Modules/Findosg_functions.cmake
@@ -29,12 +29,6 @@ function(OSG_FIND_PATH module header)
${${module_uc}_DIR}
${OSG_DIR}
PATH_SUFFIXES include
- PATHS
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
- /usr/freeware
)
endfunction()
@@ -55,12 +49,6 @@ function(OSG_FIND_LIBRARY module library)
${${module_uc}_DIR}
${OSG_DIR}
PATH_SUFFIXES lib
- PATHS
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
- /usr/freeware
)
find_library(${module_uc}_LIBRARY_DEBUG
@@ -73,12 +61,6 @@ function(OSG_FIND_LIBRARY module library)
${${module_uc}_DIR}
${OSG_DIR}
PATH_SUFFIXES lib
- PATHS
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
- /usr/freeware
)
if(NOT ${module_uc}_LIBRARY_DEBUG)
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index be8499953..e21ec388a 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -751,7 +751,7 @@ else()
#-----------------------------------------------------------------
# Support cross-compiling, only search in the target platform.
find_program(wxWidgets_CONFIG_EXECUTABLE
- NAMES wx-config wx-config-3.1 wx-config-3.0 wx-config-2.9 wx-config-2.8
+ NAMES $ENV{WX_CONFIG} wx-config wx-config-3.1 wx-config-3.0 wx-config-2.9 wx-config-2.8
DOC "Location of wxWidgets library configuration provider binary (wx-config)."
ONLY_CMAKE_FIND_ROOT_PATH
)
@@ -915,7 +915,7 @@ if (_wx_lib_missing)
endif()
unset(_wx_lib_missing)
-# Check if a specfic version was requested by find_package().
+# Check if a specific version was requested by find_package().
if(wxWidgets_FOUND)
find_file(_filename wx/version.h PATHS ${wxWidgets_INCLUDE_DIRS} NO_DEFAULT_PATH)
dbg_msg("_filename: ${_filename}")
@@ -964,8 +964,9 @@ find_package_handle_standard_args(wxWidgets
#=====================================================================
# Resource file compiler.
-find_program(wxWidgets_wxrc_EXECUTABLE wxrc
- ${wxWidgets_ROOT_DIR}/utils/wxrc/vc_msw
+find_program(wxWidgets_wxrc_EXECUTABLE
+ NAMES $ENV{WXRC_CMD} wxrc
+ PATHS ${wxWidgets_ROOT_DIR}/utils/wxrc/vc_msw
DOC "Location of wxWidgets resource file compiler binary (wxrc)"
)
diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake
index 76eb6be47..115cdc6fe 100644
--- a/Modules/FindwxWindows.cmake
+++ b/Modules/FindwxWindows.cmake
@@ -390,7 +390,7 @@ if(WIN32_STYLE_FIND)
if (NOT WXWINDOWS_USE_SHARED_LIBS)
set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
- ## these ones dont seem required, in particular ctl3d32 is not neccesary (Jan Woetzel 07/2003)
+ ## these ones don't seem required, in particular ctl3d32 is not necessary (Jan Woetzel 07/2003)
# ctl3d32
debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB} optimized ${WXWINDOWS_STATIC_LIBRARY_ZLIB}
debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX} optimized ${WXWINDOWS_STATIC_LIBRARY_REGEX}
@@ -546,7 +546,7 @@ if(WIN32_STYLE_FIND)
endif()
- ## not neccessary in wxWindows 2.4.1 and 2.6.2
+ ## not necessary in wxWindows 2.4.1 and 2.6.2
## but it may fix a previous bug, see
## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap
option(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF)
@@ -617,7 +617,8 @@ else()
# wx-config should be in your path anyhow, usually no need to set WXWIN or
# search in ../wx or ../../wx
- find_program(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE wx-config
+ find_program(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
+ NAMES $ENV{WX_CONFIG} wx-config
HINTS
ENV WXWIN
$ENV{WXWIN}/bin
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index 91361d298..9dd464c8d 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -205,7 +205,7 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set
# - we are on Linux system but NOT cross-compiling
# - we are NOT on debian
# - we are on a 64 bits system
- # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
+ # reason is: amd64 ABI: https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI
# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
# and CMAKE_INSTALL_PREFIX is "/usr"
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index 4573c2e77..17a3357c0 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -19,6 +19,7 @@
# [EXPORT_FILE_NAME <export_file_name>]
# [DEPRECATED_MACRO_NAME <deprecated_macro_name>]
# [NO_EXPORT_MACRO_NAME <no_export_macro_name>]
+# [INCLUDE_GUARD_NAME <include_guard_name>]
# [STATIC_DEFINE <static_define>]
# [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>]
# [DEFINE_NO_DEPRECATED]
@@ -277,7 +278,7 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
set(options DEFINE_NO_DEPRECATED)
set(oneValueArgs PREFIX_NAME BASE_NAME EXPORT_MACRO_NAME EXPORT_FILE_NAME
DEPRECATED_MACRO_NAME NO_EXPORT_MACRO_NAME STATIC_DEFINE
- NO_DEPRECATED_MACRO_NAME CUSTOM_CONTENT_FROM_VARIABLE)
+ NO_DEPRECATED_MACRO_NAME CUSTOM_CONTENT_FROM_VARIABLE INCLUDE_GUARD_NAME)
set(multiValueArgs)
cmake_parse_arguments(_GEH "${options}" "${oneValueArgs}" "${multiValueArgs}"
@@ -341,7 +342,11 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
endif()
string(MAKE_C_IDENTIFIER ${NO_DEPRECATED_MACRO_NAME} NO_DEPRECATED_MACRO_NAME)
- set(INCLUDE_GUARD_NAME "${EXPORT_MACRO_NAME}_H")
+ if(_GEH_INCLUDE_GUARD_NAME)
+ set(INCLUDE_GUARD_NAME ${_GEH_INCLUDE_GUARD_NAME})
+ else()
+ set(INCLUDE_GUARD_NAME "${EXPORT_MACRO_NAME}_H")
+ endif()
get_target_property(EXPORT_IMPORT_CONDITION ${TARGET_LIBRARY} DEFINE_SYMBOL)
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index b81dd76aa..d3977910b 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -687,8 +687,6 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
"$ENV{VS71COMNTOOLS}/../../VC7/bin"
"C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN"
"C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN"
- "/usr/local/bin"
- "/usr/bin"
)
# <setup-gp_tool-vars>
diff --git a/Modules/ITKCompatibility.cmake b/Modules/ITKCompatibility.cmake
index fef065381..7d211b61e 100644
--- a/Modules/ITKCompatibility.cmake
+++ b/Modules/ITKCompatibility.cmake
@@ -2,6 +2,6 @@
# file Copyright.txt or https://cmake.org/licensing for details.
-# work around an old bug in ITK prior to verison 3.0
+# work around an old bug in ITK prior to version 3.0
set(TIFF_RIGHT_VERSION 1)
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index f62bd09b4..797f9e4b7 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -597,14 +597,20 @@ if(_IRSL_HAVE_Intel)
endif()
if(WIN32)
set(__install_dirs "${_Intel_redistdir}/1033")
+ if(EXISTS "${_Intel_redistdir}/1041")
+ list(APPEND __install_dirs "${_Intel_redistdir}/1041")
+ endif()
if(_Intel_compiler_ver VERSION_LESS 18)
- list(APPEND __install_dirs "${_Intel_redistdir}/irml" "${_Intel_redistdir}/irml_c" "${_Intel_redistdir}/1041")
+ list(APPEND __install_dirs "${_Intel_redistdir}/irml" "${_Intel_redistdir}/irml_c")
endif()
- foreach(__Intel_lib IN ITEMS cilkrts20.dll libchkp.dll libgfxoffload.dll libioffload_host.dll libirngmd.dll
+ foreach(__Intel_lib IN ITEMS cilkrts20.dll libchkp.dll libioffload_host.dll libirngmd.dll
libmmd.dll libmmdd.dll libmpx.dll liboffload.dll svml_dispmd.dll)
list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
endforeach()
+ if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel)
+ list(APPEND __install_libs "${_Intel_redistdir}/libgfxoffload.dll")
+ endif()
if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
foreach(__Intel_lib IN ITEMS ifdlg100.dll libicaf.dll libifcoremd.dll libifcoremdd.dll libifcorert.dll libifcorertd.dll libifportmd.dll)
@@ -637,10 +643,10 @@ if(_IRSL_HAVE_Intel)
endforeach()
endif()
if(_Intel_compiler_ver VERSION_GREATER_EQUAL 15)
- foreach(__Intel_lib IN ITEMS libgfxoffload.so libistrconv.so)
-
- list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
- endforeach()
+ list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.so")
+ if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel)
+ list(APPEND __install_libs "${_Intel_redistdir}/libgfxoffload.so")
+ endif()
endif()
if(_Intel_compiler_ver VERSION_GREATER_EQUAL 16)
foreach(__Intel_lib IN ITEMS libioffload_host.so libioffload_host.so.5 libioffload_target.so libioffload_target.so.5 libmpx.so offload_main)
diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake
index 7f08c4a35..0abbb6175 100644
--- a/Modules/Platform/AIX-GNU.cmake
+++ b/Modules/Platform/AIX-GNU.cmake
@@ -24,5 +24,7 @@ macro(__aix_compiler_gnu lang)
set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1)
set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
- unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY)
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 7 OR CMAKE_SYSTEM_VERSION VERSION_LESS 7.1)
+ unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY)
+ endif()
endmacro()
diff --git a/Modules/Platform/Darwin-Clang.cmake b/Modules/Platform/Darwin-Clang.cmake
index a6661a849..f8a07ec2d 100644
--- a/Modules/Platform/Darwin-Clang.cmake
+++ b/Modules/Platform/Darwin-Clang.cmake
@@ -17,4 +17,19 @@ macro(__darwin_compiler_clang lang)
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.2)
set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
endif()
+ if(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneOS")
+ set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-miphoneos-version-min=")
+ elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneSimulator")
+ set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mios-simulator-version-min=")
+ elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTVOS")
+ set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-version-min=")
+ elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTVSimulator")
+ set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-simulator-version-min=")
+ elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchOS")
+ set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mwatchos-version-min=")
+ elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchSimulator")
+ set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mwatchos-simulator-version-min=")
+ else()
+ set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=")
+ endif()
endmacro()
diff --git a/Modules/Platform/Windows-Flang-Fortran.cmake b/Modules/Platform/Windows-Flang-Fortran.cmake
new file mode 100644
index 000000000..a4b1cf14e
--- /dev/null
+++ b/Modules/Platform/Windows-Flang-Fortran.cmake
@@ -0,0 +1,3 @@
+include(Platform/Windows-MSVC)
+__windows_compiler_msvc(Fortran)
+set(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> ${_COMPILE_Fortran} <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 4719563cc..0737c1269 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -48,7 +48,11 @@ else()
endif()
if(NOT MSVC_VERSION)
- if(CMAKE_C_SIMULATE_VERSION)
+ if("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC")
+ set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
+ set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
+ elseif(CMAKE_C_SIMULATE_VERSION)
set(_compiler_version ${CMAKE_C_SIMULATE_VERSION})
elseif(CMAKE_CXX_SIMULATE_VERSION)
set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION})
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index 047891866..aee40288f 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -151,7 +151,7 @@ macro (QT4_GENERATE_MOC infile outfile )
set(moc_target ${ARGV3})
endif()
QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}")
- set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file
+ set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # don't run automoc on this file
endmacro ()
diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake
index dce6f9926..fe3bb00a6 100644
--- a/Modules/SelectLibraryConfigurations.cmake
+++ b/Modules/SelectLibraryConfigurations.cmake
@@ -38,11 +38,12 @@ macro( select_library_configurations basename )
set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.")
endif()
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND
- ( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) )
- # if the generator supports configuration types or CMAKE_BUILD_TYPE
- # is set, then set optimized and debug options.
+ ( _isMultiConfig OR CMAKE_BUILD_TYPE ) )
+ # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
+ # single-config generators, set optimized and debug libraries
set( ${basename}_LIBRARY "" )
foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake
index cfdfaec1b..c0e1bea59 100644
--- a/Modules/SquishTestScript.cmake
+++ b/Modules/SquishTestScript.cmake
@@ -34,7 +34,7 @@ message(STATUS "squish_settingsgroup='${squish_settingsgroup}'")
message(STATUS "squish_pre_command='${squish_pre_command}'")
message(STATUS "squish_post_command='${squish_post_command}'")
-# parse enviornment variables
+# parse environment variables
foreach(i ${squish_env_vars})
message(STATUS "parsing env var key/value pair ${i}")
string(REGEX MATCH "([^=]*)=(.*)" squish_env_name ${i})
diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake
index 942bc38bb..700bfe6cc 100644
--- a/Modules/UseEcos.cmake
+++ b/Modules/UseEcos.cmake
@@ -181,7 +181,7 @@ macro(ECOS_ADD_EXECUTABLE _exe_NAME )
#the executable depends on ecos target.ld
ECOS_ADD_TARGET_LIB(${ARGN})
-# when using nmake makefiles, the custom buildtype supresses the default cl.exe flags
+# when using nmake makefiles, the custom buildtype suppresses the default cl.exe flags
# and the rules for creating objects are adjusted for gcc
set(CMAKE_BUILD_TYPE CUSTOM_ECOS_BUILD)
set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 11828757b..939bd7be7 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -20,6 +20,7 @@
# [VERSION version]
# [OUTPUT_NAME name]
# [OUTPUT_DIR dir]
+# [GENERATE_NATIVE_HEADERS target [DESTINATION dir]]
# )
#
# This command creates a <target_name>.jar. It compiles the given
@@ -35,6 +36,14 @@
# The default OUTPUT_DIR can also be changed by setting the variable
# CMAKE_JAVA_TARGET_OUTPUT_DIR.
#
+# Optionaly, using option GENERATE_NATIVE_HEADERS, native header files can be generated
+# for methods declared as native. These files provide the connective glue that allow your
+# Java and C code to interact. An INTERFACE target will be created for an easy usage
+# of generated files. Sub-option DESTINATION can be used to specify output directory for
+# generated header files.
+#
+# GENERATE_NATIVE_HEADERS option requires, at least, version 1.8 of the JDK.
+#
# Additional instructions:
#
# ::
@@ -168,6 +177,22 @@
#
#
#
+# ::
+#
+# For an optimum usage of option GENERATE_NATIVE_HEADERS, it is recommended to
+# include module JNI before any call to add_jar. The produced target for native
+# headers can then be used to compile C/C++ sources with command
+# target_link_libraries.
+#
+#
+# ::
+#
+# find_package(JNI)
+# add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native)
+# add_library(bar bar.cpp)
+# target_link_libraries(bar PRIVATE foo-native)
+#
+#
# Target Properties:
#
# ::
@@ -286,7 +311,7 @@
#
# Example:
# create_javadoc(my_example_doc
-# PACKAGES com.exmaple.foo com.example.bar
+# PACKAGES com.example.foo com.example.bar
# SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}"
# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
# WINDOWTITLE "My example"
@@ -359,6 +384,10 @@
# Create C header files from java classes. These files provide the connective glue
# that allow your Java and C code to interact.
#
+# This command will no longer be supported starting with version 1.10 of the JDK due
+# to the `suppression of javah tool <http://openjdk.java.net/jeps/313>`_.
+# Command ``add_jar(GENERATE_NATIVE_HEADERS)`` must be used instead.
+#
# There are two main signatures for create_javah. The first signature
# returns generated files through variable specified by GENERATED_FILES option:
#
@@ -448,7 +477,7 @@ function(add_jar _TARGET_NAME)
cmake_parse_arguments(_add_jar
""
"VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST"
- "SOURCES;INCLUDE_JARS"
+ "SOURCES;INCLUDE_JARS;GENERATE_NATIVE_HEADERS"
${ARGN}
)
@@ -481,6 +510,8 @@ function(add_jar _TARGET_NAME)
else()
get_filename_component(_add_jar_OUTPUT_DIR ${_add_jar_OUTPUT_DIR} ABSOLUTE)
endif()
+ # ensure output directory exists
+ file (MAKE_DIRECTORY "${_add_jar_OUTPUT_DIR}")
if (_add_jar_ENTRY_POINT)
set(_ENTRY_POINT_OPTION e)
@@ -492,6 +523,31 @@ function(add_jar _TARGET_NAME)
get_filename_component (_MANIFEST_VALUE "${_add_jar_MANIFEST}" ABSOLUTE)
endif ()
+ unset (_GENERATE_NATIVE_HEADERS)
+ if (_add_jar_GENERATE_NATIVE_HEADERS)
+ # Raise an error if JDK version is less than 1.8 because javac -h is not supported
+ # by earlier versions.
+ if ("${Java_VERSION}" VERSION_LESS 1.8)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS is not supported with this version of Java.")
+ endif()
+ cmake_parse_arguments (_add_jar_GENERATE_NATIVE_HEADERS "" "DESTINATION" "" ${_add_jar_GENERATE_NATIVE_HEADERS})
+ if (NOT _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: missing required argument.")
+ endif()
+ list (LENGTH _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS length)
+ if (length GREATER 1)
+ list (REMOVE_AT _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS 0)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: ${_add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS}: unexpected argument(s).")
+ endif()
+ if (NOT _add_jar_GENERATE_NATIVE_HEADERS_DESTINATION)
+ set (_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir/native_headers")
+ endif()
+
+ set (_GENERATE_NATIVE_HEADERS_TARGET ${_add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS})
+ set (_GENERATE_NATIVE_HEADERS_OUTPUT_DIR "${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION}")
+ set (_GENERATE_NATIVE_HEADERS -h "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
+ endif()
+
if (LIBRARY_OUTPUT_PATH)
set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
else ()
@@ -515,7 +571,7 @@ function(add_jar _TARGET_NAME)
string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
endforeach()
- set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${_add_jar_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
+ set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar")
if (_add_jar_OUTPUT_NAME AND _add_jar_VERSION)
@@ -546,7 +602,7 @@ function(add_jar _TARGET_NAME)
list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL})
elseif (_JAVA_EXT MATCHES ".java")
- file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL})
+ file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR} ${_JAVA_FULL})
file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
@@ -623,6 +679,7 @@ function(add_jar _TARGET_NAME)
${CMAKE_JAVA_COMPILE_FLAGS}
-classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}"
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+ ${_GENERATE_NATIVE_HEADERS}
${_JAVA_SOURCES_FILELISTS}
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILELISTS} ${_JAVA_COMPILE_DEPENDS}
@@ -733,6 +790,17 @@ function(add_jar _TARGET_NAME)
${CMAKE_JAVA_CLASS_OUTPUT_PATH}
)
+ if (_GENERATE_NATIVE_HEADERS)
+ # create an INTERFACE library encapsulating include directory for generated headers
+ add_library (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE)
+ target_include_directories (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE
+ "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}"
+ ${JNI_INCLUDE_DIRS})
+ # this INTERFACE library depends on jar generation
+ add_dependencies (${_GENERATE_NATIVE_HEADERS_TARGET} ${_TARGET_NAME})
+
+ set_property (DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
+ endif()
endfunction()
function(INSTALL_JAR _TARGET_NAME)
@@ -1244,6 +1312,12 @@ function(create_javadoc _target)
endfunction()
function (create_javah)
+ if ("${Java_VERSION}" VERSION_GREATER_EQUAL 1.10)
+ message (FATAL_ERROR "create_javah: not supported with this Java version. Use add_jar(GENERATE_NATIVE_HEADERS) instead.")
+ elseif ("${Java_VERSION}" VERSION_GREATER_EQUAL 1.8)
+ message (DEPRECATION "create_javah: this command will no longer be supported starting with version 1.10 of JDK. Update your project by using command add_jar(GENERATE_NATIVE_HEADERS) instead.")
+ endif()
+
cmake_parse_arguments(_create_javah
""
"TARGET;GENERATED_FILES;OUTPUT_NAME;OUTPUT_DIR"
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index c8b1cd7c4..959893fe5 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -1,58 +1,70 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# UseSWIG
-# -------
-#
-# Defines the following macros for use with SWIG:
-#
-# ::
-#
-# SWIG_ADD_LIBRARY(<name>
-# [TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>]
-# LANGUAGE <language>
-# SOURCES <file>...
-# )
-# - Define swig module with given name and specified language
-# SWIG_LINK_LIBRARIES(name [ libraries ])
-# - Link libraries to swig module
-#
-# Source files properties on module files can be set before the invocation
-# of the SWIG_ADD_LIBRARY macro to specify special behavior of SWIG.
-#
-# The source file property CPLUSPLUS calls SWIG in c++ mode, e.g.::
-#
-# set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON)
-# swig_add_library(mymod LANGUAGE python SOURCES 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.
-#
-# CMAKE_SWIG_OUTDIR allows one to specify where to write
-# the language specific files (swig -outdir option).
-#
-# SWIG_OUTFILE_DIR allows one to specify where to write the output file
-# (swig -o option). If not specified, CMAKE_SWIG_OUTDIR is used.
-#
-# 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")
+#[=======================================================================[.rst:
+UseSWIG
+-------
+
+Defines the following macros for use with SWIG:
+
+.. command:: swig_add_library
+
+ Define swig module with given name and specified language::
+
+ swig_add_library(<name>
+ [TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>]
+ LANGUAGE <language>
+ SOURCES <file>...
+ )
+
+ The variable ``SWIG_MODULE_<name>_REAL_NAME`` will be set to the name
+ of the swig module target library.
+
+.. command:: swig_link_libraries
+
+ Link libraries to swig module::
+
+ swig_link_libraries(<name> [ libraries ])
+
+Source file properties on module files can be set before the invocation
+of the ``swig_add_library`` macro to specify special behavior of SWIG:
+
+``CPLUSPLUS``
+ Call SWIG in c++ mode. For example:
+
+ .. code-block:: cmake
+
+ set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON)
+ swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
+
+``SWIG_FLAGS``
+ Add custom flags to the SWIG executable.
+
+
+``SWIG_MODULE_NAME``
+ Specify the actual import name of the module in the target language.
+ This is required if it cannot be scanned automatically from source
+ or different from the module file basename. For example:
+
+ .. code-block:: cmake
+
+ set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname)
+
+Some variables can be set to specify special behavior of SWIG:
+
+``CMAKE_SWIG_FLAGS``
+ Add flags to all swig calls.
+
+``CMAKE_SWIG_OUTDIR``
+ Specify where to write the language specific files (swig ``-outdir`` option).
+
+``SWIG_OUTFILE_DIR``
+ Specify an output directory name where the generated source file will be
+ placed. If not specified, ``CMAKE_SWIG_OUTDIR`` is used.
+
+``SWIG_MODULE_<name>_EXTRA_DEPS``
+ Specify extra dependencies for the generated module for ``<name>``.
+#]=======================================================================]
set(SWIG_CXX_EXTENSION "cxx")
set(SWIG_EXTRA_LIBRARIES "")
@@ -201,10 +213,32 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
if(SWIG_MODULE_${name}_EXTRA_FLAGS)
set(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS})
endif()
+ # IMPLICIT_DEPENDS below can not handle situations where a dependent file is
+ # removed. We need an extra step with timestamp and custom target, see #16830
+ # As this is needed only for Makefile generator do it conditionally
+ if(CMAKE_GENERATOR MATCHES "Make")
+ get_filename_component(swig_generated_timestamp
+ "${swig_generated_file_fullname}" NAME_WE)
+ set(swig_gen_target gen_${name}_${swig_generated_timestamp})
+ set(swig_generated_timestamp
+ "${swig_outdir}/${swig_generated_timestamp}.stamp")
+ set(swig_custom_output ${swig_generated_timestamp})
+ set(swig_custom_products
+ BYPRODUCTS "${swig_generated_file_fullname}" ${swig_extra_generated_files})
+ set(swig_timestamp_command
+ COMMAND ${CMAKE_COMMAND} -E touch ${swig_generated_timestamp})
+ else()
+ set(swig_custom_output
+ "${swig_generated_file_fullname}" ${swig_extra_generated_files})
+ set(swig_custom_products)
+ set(swig_timestamp_command)
+ endif()
add_custom_command(
- OUTPUT "${swig_generated_file_fullname}" ${swig_extra_generated_files}
+ OUTPUT ${swig_custom_output}
+ ${swig_custom_products}
# Let's create the ${swig_outdir} at execution time, in case dir contains $(OutDir)
COMMAND ${CMAKE_COMMAND} -E make_directory ${swig_outdir}
+ ${swig_timestamp_command}
COMMAND "${SWIG_EXECUTABLE}"
ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
${swig_source_file_flags}
@@ -219,6 +253,13 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS}
IMPLICIT_DEPENDS CXX "${swig_source_file_fullname}"
COMMENT "Swig source")
+ if(CMAKE_GENERATOR MATCHES "Make")
+ add_custom_target(${swig_gen_target} DEPENDS ${swig_generated_timestamp})
+ endif()
+ unset(swig_generated_timestamp)
+ unset(swig_custom_output)
+ unset(swig_custom_products)
+ unset(swig_timestamp_command)
set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files}
PROPERTIES GENERATED 1)
set(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files})
@@ -270,9 +311,11 @@ macro(SWIG_ADD_LIBRARY name)
endforeach()
set(swig_generated_sources)
+ set(swig_generated_targets)
foreach(it ${swig_dot_i_sources})
SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source ${it})
set(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}")
+ list(APPEND swig_generated_targets "${swig_gen_target}")
endforeach()
get_directory_property(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
set_directory_properties(PROPERTIES
@@ -281,6 +324,10 @@ macro(SWIG_ADD_LIBRARY name)
${_SAM_TYPE}
${swig_generated_sources}
${swig_other_sources})
+ if(CMAKE_GENERATOR MATCHES "Make")
+ # see IMPLICIT_DEPENDS above
+ add_dependencies(${SWIG_MODULE_${name}_REAL_NAME} ${swig_generated_targets})
+ endif()
if("${_SAM_TYPE}" STREQUAL "MODULE")
set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES NO_SONAME ON)
endif()
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 7c9467ab3..2f7c80ab8 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -11,7 +11,7 @@
#
# WRITE_BASIC_CONFIG_VERSION_FILE( filename
# [VERSION major.minor.patch]
-# COMPATIBILITY (AnyNewerVersion|SameMajorVersion)
+# COMPATIBILITY (AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion)
# )
#
#
diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in
index 9dd75bf56..c518b3d7a 100644
--- a/Modules/exportheader.cmake.in
+++ b/Modules/exportheader.cmake.in
@@ -39,4 +39,4 @@
# endif
#endif
@CUSTOM_CONTENT@
-#endif
+#endif /* @INCLUDE_GUARD_NAME@ */