summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/AddFileDependencies.cmake27
-rw-r--r--Modules/BundleUtilities.cmake28
-rw-r--r--Modules/CMakeCCompiler.cmake.in1
-rw-r--r--Modules/CMakeCCompilerABI.c2
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in2
-rw-r--r--Modules/CMakeCUDACompilerABI.cu2
-rw-r--r--Modules/CMakeCUDACompilerId.cu.in4
-rw-r--r--Modules/CMakeCUDAInformation.cmake15
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in4
-rw-r--r--Modules/CMakeCXXCompilerABI.cpp2
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in4
-rw-r--r--Modules/CMakeCompilerABI.h12
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake2
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake4
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake10
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake34
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake8
-rw-r--r--Modules/CMakeDetermineCompileFeatures.cmake14
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake48
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake80
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake8
-rw-r--r--Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake4
-rw-r--r--Modules/CMakeFindBinUtils.cmake96
-rw-r--r--Modules/CMakeFortranCompilerId.F.in33
-rw-r--r--Modules/CMakeGraphVizOptions.cmake5
-rw-r--r--Modules/CMakeOBJCCompiler.cmake.in1
-rw-r--r--Modules/CMakeOBJCCompilerABI.m2
-rw-r--r--Modules/CMakeOBJCXXCompiler.cmake.in2
-rw-r--r--Modules/CMakeOBJCXXCompilerABI.mm2
-rw-r--r--Modules/CMakeOBJCXXCompilerId.mm.in4
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake50
-rw-r--r--Modules/CMakeParseLibraryArchitecture.cmake56
-rw-r--r--Modules/CMakePlatformId.h.in6
-rw-r--r--Modules/CMakeTestGNU.c3
-rw-r--r--Modules/CPack.cmake35
-rw-r--r--Modules/CPackIFW.cmake84
-rw-r--r--Modules/CTest.cmake34
-rw-r--r--Modules/CTestCoverageCollectGCOV.cmake13
-rw-r--r--Modules/CTestUseLaunchers.cmake9
-rw-r--r--Modules/CheckCSourceCompiles.cmake4
-rw-r--r--Modules/CheckCSourceRuns.cmake4
-rw-r--r--Modules/CheckCXXSourceCompiles.cmake4
-rw-r--r--Modules/CheckCXXSourceRuns.cmake4
-rw-r--r--Modules/CheckCXXSymbolExists.cmake6
-rw-r--r--Modules/CheckFortranFunctionExists.cmake5
-rw-r--r--Modules/CheckFortranSourceCompiles.cmake2
-rw-r--r--Modules/CheckFunctionExists.cmake6
-rw-r--r--Modules/CheckIPOSupported.cmake3
-rw-r--r--Modules/CheckIncludeFile.cmake6
-rw-r--r--Modules/CheckIncludeFileCXX.cmake6
-rw-r--r--Modules/CheckIncludeFiles.cmake6
-rw-r--r--Modules/CheckLanguage.cmake6
-rw-r--r--Modules/CheckLibraryExists.cmake19
-rw-r--r--Modules/CheckPrototypeDefinition.cmake22
-rw-r--r--Modules/CheckStructHasMember.cmake23
-rw-r--r--Modules/CheckSymbolExists.cmake6
-rw-r--r--Modules/CheckTypeSize.cmake26
-rw-r--r--Modules/CheckVariableExists.cmake19
-rw-r--r--Modules/Compiler/ARMCC.cmake2
-rw-r--r--Modules/Compiler/AppleClang-C.cmake13
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake10
-rw-r--r--Modules/Compiler/AppleClang-OBJC.cmake9
-rw-r--r--Modules/Compiler/AppleClang-OBJCXX.cmake10
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake34
-rw-r--r--Modules/Compiler/Clang-C.cmake15
-rw-r--r--Modules/Compiler/Clang-CUDA.cmake8
-rw-r--r--Modules/Compiler/Clang-CXX.cmake14
-rw-r--r--Modules/Compiler/Clang-FindBinUtils.cmake8
-rw-r--r--Modules/Compiler/Clang-OBJC.cmake9
-rw-r--r--Modules/Compiler/Clang-OBJCXX.cmake8
-rw-r--r--Modules/Compiler/Clang.cmake16
-rw-r--r--Modules/Compiler/Cray-Fortran.cmake4
-rw-r--r--Modules/Compiler/GNU-ASM.cmake2
-rw-r--r--Modules/Compiler/GNU-C.cmake11
-rw-r--r--Modules/Compiler/GNU-CXX.cmake11
-rw-r--r--Modules/Compiler/GNU-OBJC.cmake9
-rw-r--r--Modules/Compiler/GNU-OBJCXX.cmake9
-rw-r--r--Modules/Compiler/GNU.cmake2
-rw-r--r--Modules/Compiler/IAR-ASM.cmake5
-rw-r--r--Modules/Compiler/IAR-C.cmake4
-rw-r--r--Modules/Compiler/IAR-CXX.cmake4
-rw-r--r--Modules/Compiler/IAR-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/IAR-FindBinUtils.cmake3
-rw-r--r--Modules/Compiler/IAR.cmake4
-rw-r--r--Modules/Compiler/Intel-C.cmake11
-rw-r--r--Modules/Compiler/Intel-CXX.cmake10
-rw-r--r--Modules/Compiler/Intel-ISPC.cmake8
-rw-r--r--Modules/Compiler/IntelLLVM-ASM.cmake12
-rw-r--r--Modules/Compiler/IntelLLVM-C.cmake58
-rw-r--r--Modules/Compiler/IntelLLVM-CXX.cmake69
-rw-r--r--Modules/Compiler/IntelLLVM-DetermineCompiler.cmake41
-rw-r--r--Modules/Compiler/IntelLLVM-Fortran.cmake27
-rw-r--r--Modules/Compiler/IntelLLVM.cmake92
-rw-r--r--Modules/Compiler/MSVC-C.cmake1
-rw-r--r--Modules/Compiler/NAG-Fortran.cmake1
-rw-r--r--Modules/Compiler/NVHPC-C.cmake3
-rw-r--r--Modules/Compiler/NVHPC-CXX.cmake3
-rw-r--r--Modules/Compiler/NVHPC-DetermineCompiler.cmake9
-rw-r--r--Modules/Compiler/NVHPC-Fortran.cmake3
-rw-r--r--Modules/Compiler/NVHPC.cmake15
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake9
-rw-r--r--Modules/Compiler/PGI-CXX.cmake3
-rw-r--r--Modules/Compiler/QCC.cmake2
-rw-r--r--Modules/Compiler/SunPro-C.cmake2
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake2
-rw-r--r--Modules/Compiler/TI.cmake2
-rw-r--r--Modules/Compiler/XL.cmake2
-rw-r--r--Modules/Compiler/XLClang-C.cmake2
-rw-r--r--Modules/Compiler/XLClang-CXX.cmake2
-rw-r--r--Modules/DartConfiguration.tcl.in4
-rw-r--r--Modules/Documentation.cmake3
-rw-r--r--Modules/ExternalData.cmake68
-rw-r--r--Modules/ExternalProject-gitupdate.cmake.in405
-rw-r--r--Modules/ExternalProject.cmake459
-rw-r--r--Modules/FeatureSummary.cmake26
-rw-r--r--Modules/FetchContent.cmake23
-rw-r--r--Modules/FetchContent/CMakeLists.cmake.in2
-rw-r--r--Modules/FindALSA.cmake2
-rw-r--r--Modules/FindArmadillo.cmake3
-rw-r--r--Modules/FindBISON.cmake16
-rw-r--r--Modules/FindBLAS.cmake75
-rw-r--r--Modules/FindBZip2.cmake5
-rw-r--r--Modules/FindBoost.cmake440
-rw-r--r--Modules/FindCUDA.cmake829
-rw-r--r--Modules/FindCUDA/select_compute_arch.cmake89
-rw-r--r--Modules/FindCUDAToolkit.cmake26
-rw-r--r--Modules/FindCURL.cmake14
-rw-r--r--Modules/FindCups.cmake2
-rw-r--r--Modules/FindCurses.cmake8
-rw-r--r--Modules/FindDoxygen.cmake79
-rw-r--r--Modules/FindEXPAT.cmake2
-rw-r--r--Modules/FindFLEX.cmake19
-rw-r--r--Modules/FindFLTK.cmake4
-rw-r--r--Modules/FindFreetype.cmake7
-rw-r--r--Modules/FindGDAL.cmake64
-rw-r--r--Modules/FindGLEW.cmake5
-rw-r--r--Modules/FindGLUT.cmake5
-rw-r--r--Modules/FindGTK2.cmake25
-rw-r--r--Modules/FindGTest.cmake102
-rw-r--r--Modules/FindGettext.cmake2
-rw-r--r--Modules/FindGit.cmake58
-rw-r--r--Modules/FindGnuTLS.cmake2
-rw-r--r--Modules/FindHDF5.cmake86
-rw-r--r--Modules/FindHg.cmake3
-rw-r--r--Modules/FindICU.cmake38
-rw-r--r--Modules/FindIce.cmake12
-rw-r--r--Modules/FindImageMagick.cmake3
-rw-r--r--Modules/FindIntl.cmake50
-rw-r--r--Modules/FindJPEG.cmake10
-rw-r--r--Modules/FindJava.cmake7
-rw-r--r--Modules/FindLAPACK.cmake108
-rw-r--r--Modules/FindLATEX.cmake4
-rw-r--r--Modules/FindLibArchive.cmake4
-rw-r--r--Modules/FindLibLZMA.cmake2
-rw-r--r--Modules/FindLibXml2.cmake8
-rw-r--r--Modules/FindLibXslt.cmake5
-rw-r--r--Modules/FindLua.cmake5
-rw-r--r--Modules/FindMPI.cmake27
-rw-r--r--Modules/FindMatlab.cmake134
-rw-r--r--Modules/FindOpenACC.cmake22
-rw-r--r--Modules/FindOpenCL.cmake5
-rw-r--r--Modules/FindOpenGL.cmake46
-rw-r--r--Modules/FindOpenMP.cmake12
-rw-r--r--Modules/FindOpenSSL.cmake49
-rw-r--r--Modules/FindPNG.cmake5
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake18
-rw-r--r--Modules/FindPkgConfig.cmake76
-rw-r--r--Modules/FindPostgreSQL.cmake36
-rw-r--r--Modules/FindProtobuf.cmake26
-rw-r--r--Modules/FindPython.cmake112
-rw-r--r--Modules/FindPython/Support.cmake25
-rw-r--r--Modules/FindPython2.cmake99
-rw-r--r--Modules/FindPython3.cmake113
-rw-r--r--Modules/FindQt.cmake6
-rw-r--r--Modules/FindQt3.cmake7
-rw-r--r--Modules/FindRuby.cmake12
-rw-r--r--Modules/FindSDL.cmake8
-rw-r--r--Modules/FindSWIG.cmake19
-rw-r--r--Modules/FindSquish.cmake3
-rw-r--r--Modules/FindSubversion.cmake9
-rw-r--r--Modules/FindTIFF.cmake7
-rw-r--r--Modules/FindThreads.cmake4
-rw-r--r--Modules/FindVulkan.cmake7
-rw-r--r--Modules/FindX11.cmake20
-rw-r--r--Modules/FindXercesC.cmake5
-rw-r--r--Modules/FindZLIB.cmake5
-rw-r--r--Modules/FindwxWidgets.cmake9
-rw-r--r--Modules/FortranCInterface.cmake8
-rw-r--r--Modules/FortranCInterface/Detect.cmake10
-rw-r--r--Modules/GNUInstallDirs.cmake40
-rw-r--r--Modules/GenerateExportHeader.cmake28
-rw-r--r--Modules/GetPrerequisites.cmake11
-rw-r--r--Modules/GoogleTest.cmake10
-rw-r--r--Modules/GoogleTestAddTests.cmake2
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake46
-rw-r--r--Modules/Internal/CPack/CPack.NuGet.nuspec.in5
-rw-r--r--Modules/Internal/CPack/CPackDeb.cmake21
-rw-r--r--Modules/Internal/CPack/CPackNuGet.cmake80
-rw-r--r--Modules/Internal/CPack/NSIS.template.in3
-rw-r--r--Modules/MacroAddFileDependencies.cmake29
-rw-r--r--Modules/Platform/Android-Clang.cmake48
-rw-r--r--Modules/Platform/Android-Common.cmake12
-rw-r--r--Modules/Platform/Android-Determine.cmake181
-rw-r--r--Modules/Platform/Android-Initialize.cmake14
-rw-r--r--Modules/Platform/Android.cmake68
-rw-r--r--Modules/Platform/Android/Determine-Compiler.cmake12
-rw-r--r--Modules/Platform/Android/abi-arm64-v8a-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-armeabi-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-armeabi-v6-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-mips-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-mips64-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-x86-Clang.cmake3
-rw-r--r--Modules/Platform/Android/abi-x86_64-Clang.cmake3
-rw-r--r--Modules/Platform/Apple-IntelLLVM-C.cmake2
-rw-r--r--Modules/Platform/Apple-IntelLLVM-CXX.cmake2
-rw-r--r--Modules/Platform/Apple-IntelLLVM-Fortran.cmake8
-rw-r--r--Modules/Platform/Apple-IntelLLVM.cmake17
-rw-r--r--Modules/Platform/Linux-IntelLLVM-C.cmake3
-rw-r--r--Modules/Platform/Linux-IntelLLVM-CXX.cmake3
-rw-r--r--Modules/Platform/Linux-IntelLLVM-Fortran.cmake4
-rw-r--r--Modules/Platform/Linux-IntelLLVM.cmake55
-rw-r--r--Modules/Platform/Linux-NVHPC-C.cmake2
-rw-r--r--Modules/Platform/Linux-NVHPC-CXX.cmake2
-rw-r--r--Modules/Platform/Linux-NVHPC-Fortran.cmake2
-rw-r--r--Modules/Platform/Linux-NVHPC.cmake15
-rw-r--r--Modules/Platform/Linux.cmake1
-rw-r--r--Modules/Platform/Windows-Clang-C.cmake16
-rw-r--r--Modules/Platform/Windows-Clang-CXX.cmake16
-rw-r--r--Modules/Platform/Windows-Clang.cmake11
-rw-r--r--Modules/Platform/Windows-Embarcadero.cmake8
-rw-r--r--Modules/Platform/Windows-Intel-C.cmake27
-rw-r--r--Modules/Platform/Windows-Intel-CXX.cmake27
-rw-r--r--Modules/Platform/Windows-Intel.cmake14
-rw-r--r--Modules/Platform/Windows-IntelLLVM-ASM.cmake2
-rw-r--r--Modules/Platform/Windows-IntelLLVM-C.cmake2
-rw-r--r--Modules/Platform/Windows-IntelLLVM-CXX.cmake3
-rw-r--r--Modules/Platform/Windows-IntelLLVM-Fortran.cmake44
-rw-r--r--Modules/Platform/Windows-IntelLLVM.cmake17
-rw-r--r--Modules/Platform/Windows-MSVC-C.cmake7
-rw-r--r--Modules/Platform/Windows-MSVC-CXX.cmake7
-rw-r--r--Modules/Platform/Windows-MSVC.cmake44
-rw-r--r--Modules/ProcessorCount.cmake3
-rw-r--r--Modules/TestBigEndian.cmake36
-rw-r--r--Modules/UseJava.cmake103
-rw-r--r--Modules/UseJava/ClassFilelist.cmake (renamed from Modules/UseJavaClassFilelist.cmake)15
-rw-r--r--Modules/UseJava/Symlinks.cmake (renamed from Modules/UseJavaSymlinks.cmake)11
-rw-r--r--Modules/UseJava/javaTargets.cmake.in (renamed from Modules/javaTargets.cmake.in)2
-rw-r--r--Modules/UseSWIG.cmake147
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake43
250 files changed, 5290 insertions, 1769 deletions
diff --git a/Modules/AddFileDependencies.cmake b/Modules/AddFileDependencies.cmake
index 598a52fa9a..13b2600f9b 100644
--- a/Modules/AddFileDependencies.cmake
+++ b/Modules/AddFileDependencies.cmake
@@ -5,24 +5,29 @@
AddFileDependencies
-------------------
+.. deprecated:: 3.20
+
Add dependencies to a source file.
.. code-block:: cmake
- ADD_FILE_DEPENDENCIES(<source> <files>)
+ add_file_dependencies(<source> <files>...)
Adds the given ``<files>`` to the dependencies of file ``<source>``.
-#]=======================================================================]
-macro(ADD_FILE_DEPENDENCIES _file)
+Do not use this command in new code. It is just a wrapper around:
+
+.. code-block:: cmake
+
+ set_property(SOURCE <source> APPEND PROPERTY OBJECT_DEPENDS <files>...)
+
+Instead use the :command:`set_property` command to append to the
+:prop_sf:`OBJECT_DEPENDS` source file property directly.
+
+#]=======================================================================]
- get_source_file_property(_deps ${_file} OBJECT_DEPENDS)
- if (_deps)
- set(_deps ${_deps} ${ARGN})
- else ()
- set(_deps ${ARGN})
- endif ()
+function(add_file_dependencies _file)
- set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}")
+ set_property(SOURCE "${_file}" APPEND PROPERTY OBJECT_DEPENDS "${ARGN}")
-endmacro()
+endfunction()
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index f521d22200..0beff04fdd 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -59,9 +59,10 @@ fix each one up according to its own list of prerequisites.
Then clear all the keys and call ``verify_app`` on the final bundle to
ensure that it is truly standalone.
-As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
-which are then ignored
-(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``).
+.. versionadded:: 3.6
+ As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
+ which are then ignored
+ (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``).
.. code-block:: cmake
@@ -78,9 +79,10 @@ Verifies that an application ``<app>`` appears valid based on running
analysis tools on it. Calls :command:`message(FATAL_ERROR)` if the application
is not verified.
-As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
-which are then ignored
-(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
+.. versionadded:: 3.6
+ As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
+ which are then ignored
+ (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
.. code-block:: cmake
@@ -155,9 +157,10 @@ them. Set values associated with each key such that we can loop over
all of them and copy prerequisite libs into the bundle and then do
appropriate ``install_name_tool`` fixups.
-As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
-which are then ignored
-(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
+.. versionadded:: 3.6
+ As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
+ which are then ignored
+ (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
.. code-block:: cmake
@@ -215,9 +218,10 @@ Verifies that the sum of all prerequisites of all files inside the
bundle are contained within the bundle or are ``system`` libraries,
presumed to exist everywhere.
-As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
-which are then ignored
-(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
+.. versionadded:: 3.6
+ As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed,
+ which are then ignored
+ (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``)
.. code-block:: cmake
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index eea3f5d41c..7f73891faf 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -48,6 +48,7 @@ set(CMAKE_C_LINKER_PREFERENCE 10)
# Save compiler ABI information.
set(CMAKE_C_SIZEOF_DATA_PTR "@CMAKE_C_SIZEOF_DATA_PTR@")
set(CMAKE_C_COMPILER_ABI "@CMAKE_C_COMPILER_ABI@")
+set(CMAKE_C_BYTE_ORDER "@CMAKE_C_BYTE_ORDER@")
set(CMAKE_C_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@")
if(CMAKE_C_SIZEOF_DATA_PTR)
diff --git a/Modules/CMakeCCompilerABI.c b/Modules/CMakeCCompilerABI.c
index 08cf39bd8f..f0ee21acf2 100644
--- a/Modules/CMakeCCompilerABI.c
+++ b/Modules/CMakeCCompilerABI.c
@@ -17,6 +17,8 @@ int main(int argc, char* argv[])
{
int require = 0;
require += info_sizeof_dptr[argc];
+ require += info_byte_order_big_endian[argc];
+ require += info_byte_order_little_endian[argc];
#if defined(ABI_ID)
require += info_abi[argc];
#endif
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
index 871e18e7bf..56ae7324b2 100644
--- a/Modules/CMakeCUDACompiler.cmake.in
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -12,6 +12,7 @@ set(CMAKE_CUDA11_COMPILE_FEATURES "@CMAKE_CUDA11_COMPILE_FEATURES@")
set(CMAKE_CUDA14_COMPILE_FEATURES "@CMAKE_CUDA14_COMPILE_FEATURES@")
set(CMAKE_CUDA17_COMPILE_FEATURES "@CMAKE_CUDA17_COMPILE_FEATURES@")
set(CMAKE_CUDA20_COMPILE_FEATURES "@CMAKE_CUDA20_COMPILE_FEATURES@")
+set(CMAKE_CUDA23_COMPILE_FEATURES "@CMAKE_CUDA23_COMPILE_FEATURES@")
set(CMAKE_CUDA_PLATFORM_ID "@CMAKE_CUDA_PLATFORM_ID@")
set(CMAKE_CUDA_SIMULATE_ID "@CMAKE_CUDA_SIMULATE_ID@")
@@ -31,6 +32,7 @@ set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1)
set(CMAKE_CUDA_SIZEOF_DATA_PTR "@CMAKE_CUDA_SIZEOF_DATA_PTR@")
set(CMAKE_CUDA_COMPILER_ABI "@CMAKE_CUDA_COMPILER_ABI@")
+set(CMAKE_CUDA_BYTE_ORDER "@CMAKE_CUDA_BYTE_ORDER@")
set(CMAKE_CUDA_LIBRARY_ARCHITECTURE "@CMAKE_CUDA_LIBRARY_ARCHITECTURE@")
if(CMAKE_CUDA_SIZEOF_DATA_PTR)
diff --git a/Modules/CMakeCUDACompilerABI.cu b/Modules/CMakeCUDACompilerABI.cu
index 702a7c53a2..449a079445 100644
--- a/Modules/CMakeCUDACompilerABI.cu
+++ b/Modules/CMakeCUDACompilerABI.cu
@@ -8,6 +8,8 @@ int main(int argc, char* argv[])
{
int require = 0;
require += info_sizeof_dptr[argc];
+ require += info_byte_order_big_endian[argc];
+ require += info_byte_order_little_endian[argc];
#if defined(ABI_ID)
require += info_abi[argc];
#endif
diff --git a/Modules/CMakeCUDACompilerId.cu.in b/Modules/CMakeCUDACompilerId.cu.in
index 2055de2181..91039e5ae9 100644
--- a/Modules/CMakeCUDACompilerId.cu.in
+++ b/Modules/CMakeCUDACompilerId.cu.in
@@ -17,7 +17,9 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
@CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
-#if __cplusplus > 201703L
+#if __cplusplus > 202002L
+ "23"
+#elif __cplusplus > 201703L
"20"
#elif __cplusplus >= 201703L
"17"
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index 58e6e29941..cb03ef405b 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -154,21 +154,6 @@ if(NOT CMAKE_CUDA_COMPILE_WHOLE_COMPILATION)
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c <SOURCE> -o <OBJECT>")
endif()
-if(CMAKE_GENERATOR STREQUAL "Ninja" AND NOT CMAKE_DEPFILE_FLAGS_CUDA)
- set(CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o $DEP_FILE")
- #The Ninja generator uses the make file dependency files to determine what
- #files need to be recompiled. Unfortunately, nvcc < 10.2 doesn't support building
- #a source file and generating the dependencies of said file in a single
- #invocation. Instead we have to state that you need to chain two commands.
- #
- #The makefile generators uses the custom CMake dependency scanner, and thus
- #it is exempt from this logic.
- list(APPEND CMAKE_CUDA_COMPILE_PTX_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
- list(APPEND CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
- list(APPEND CMAKE_CUDA_COMPILE_WHOLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
-endif()
-
# compile a cu file into an executable
if(NOT CMAKE_CUDA_LINK_EXECUTABLE)
set(CMAKE_CUDA_LINK_EXECUTABLE
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 09bdc23ee9..45acfe732b 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -11,6 +11,7 @@ set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@")
set(CMAKE_CXX14_COMPILE_FEATURES "@CMAKE_CXX14_COMPILE_FEATURES@")
set(CMAKE_CXX17_COMPILE_FEATURES "@CMAKE_CXX17_COMPILE_FEATURES@")
set(CMAKE_CXX20_COMPILE_FEATURES "@CMAKE_CXX20_COMPILE_FEATURES@")
+set(CMAKE_CXX23_COMPILE_FEATURES "@CMAKE_CXX23_COMPILE_FEATURES@")
set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@")
@@ -43,7 +44,7 @@ if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_CXX_COMPILER_ID_RUN 1)
-set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
+set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
foreach (lang C OBJC OBJCXX)
@@ -60,6 +61,7 @@ set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
# Save compiler ABI information.
set(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@")
set(CMAKE_CXX_COMPILER_ABI "@CMAKE_CXX_COMPILER_ABI@")
+set(CMAKE_CXX_BYTE_ORDER "@CMAKE_CXX_BYTE_ORDER@")
set(CMAKE_CXX_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
if(CMAKE_CXX_SIZEOF_DATA_PTR)
diff --git a/Modules/CMakeCXXCompilerABI.cpp b/Modules/CMakeCXXCompilerABI.cpp
index 236053452b..036b96ea36 100644
--- a/Modules/CMakeCXXCompilerABI.cpp
+++ b/Modules/CMakeCXXCompilerABI.cpp
@@ -8,6 +8,8 @@ int main(int argc, char* argv[])
{
int require = 0;
require += info_sizeof_dptr[argc];
+ require += info_byte_order_big_endian[argc];
+ require += info_byte_order_little_endian[argc];
#if defined(ABI_ID)
require += info_abi[argc];
#endif
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index d55d8b1905..a67caba2c3 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -44,7 +44,9 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#endif
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
-#if CXX_STD > 201703L
+#if CXX_STD > 202002L
+ "23"
+#elif CXX_STD > 201703L
"20"
#elif CXX_STD >= 201703L
"17"
diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h
index 45532afdb3..c5ce4dd9ab 100644
--- a/Modules/CMakeCompilerABI.h
+++ b/Modules/CMakeCompilerABI.h
@@ -9,6 +9,18 @@ const char info_sizeof_dptr[] = {
/* clang-format on */
};
+/* Byte order. Only one of these will have bytes in the right order. */
+static unsigned short const info_byte_order_big_endian[] = {
+ /* INFO:byte_order string for BIG_ENDIAN */
+ 0x494E, 0x464F, 0x3A62, 0x7974, 0x655F, 0x6F72, 0x6465, 0x725B,
+ 0x4249, 0x475F, 0x454E, 0x4449, 0x414E, 0x5D00, 0x0000
+};
+static unsigned short const info_byte_order_little_endian[] = {
+ /* INFO:byte_order string for LITTLE_ENDIAN */
+ 0x4E49, 0x4F46, 0x623A, 0x7479, 0x5F65, 0x726F, 0x6564, 0x5B72,
+ 0x494C, 0x5454, 0x454C, 0x455F, 0x444E, 0x4149, 0x5D4E, 0x0000
+};
+
/* Application Binary Interface. */
/* Check for (some) ARM ABIs.
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index a0f0dfacb6..214d58a8ef 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -49,6 +49,7 @@ function(compiler_id_detection outvar lang)
endif()
list(APPEND ordered_compilers
Intel
+ IntelLLVM
PathScale
Embarcadero
Borland
@@ -61,6 +62,7 @@ function(compiler_id_detection outvar lang)
XLClang
XL
VisualAge
+ NVHPC
PGI
Cray
TI
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index a3e5a1229d..e8b9db797f 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -78,6 +78,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Intel "--version")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Intel "(ICC)")
+ list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS IntelLLVM )
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_IntelLLVM "--version")
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_IntelLLVM "(Intel[^\n]+oneAPI)")
+
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS SunPro )
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_SunPro "-V")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_SunPro "Sun C")
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index ae3abe9b20..cd07ba983b 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -59,7 +59,7 @@ else()
# finally list compilers to try
if(NOT CMAKE_C_COMPILER_INIT)
- set(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc clang)
+ set(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc icx clang)
endif()
_cmake_find_compiler(C)
@@ -134,7 +134,8 @@ else()
# variable but are not aware of CMAKE_C_COMPILER_FRONTEND_VARIANT.
# They pre-date our support for the GNU-like variant targeting the
# MSVC ABI so we do not consider that here.
- if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ if(CMAKE_C_COMPILER_ID STREQUAL "Clang"
+ OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xIntelLLVM")
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "MSVC")
else()
@@ -161,9 +162,10 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX)
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC")
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
- if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
+ if (COMPILER_BASENAME MATCHES "^(.+-)?(clang|g?cc)(-cl)?(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
- set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_5})
+ set(_CMAKE_TOOLCHAIN_SUFFIX ${CMAKE_MATCH_4})
+ set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_6})
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(CMAKE_C_COMPILER_TARGET)
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-)
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 972adefd18..1ba537a3eb 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -47,6 +47,10 @@ if(NOT $ENV{CUDAHOSTCXX} STREQUAL "")
endif()
endif()
+if(NOT "$ENV{CUDAARCHS}" STREQUAL "")
+ set(CMAKE_CUDA_ARCHITECTURES "$ENV{CUDAARCHS}" CACHE STRING "CUDA architectures")
+endif()
+
# Build a small source file to identify the compiler.
if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
set(CMAKE_CUDA_COMPILER_ID_RUN 1)
@@ -65,6 +69,10 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
set(CMAKE_CUDA_COMPILER_ID_VENDOR_REGEX_Clang "(clang version)")
CMAKE_DETERMINE_COMPILER_ID_VENDOR(CUDA "--version")
+ if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang" AND WIN32)
+ message(FATAL_ERROR "Clang with CUDA is not yet supported on Windows. See CMake issue #20776.")
+ endif()
+
# Find the CUDA toolkit. We store the CMAKE_CUDA_COMPILER_TOOLKIT_ROOT and CMAKE_CUDA_COMPILER_LIBRARY_ROOT
# in CMakeCUDACompiler.cmake, so FindCUDAToolkit can avoid searching on future runs and the toolkit stays the same.
# This is very similar to FindCUDAToolkit, but somewhat simplified since we can issue fatal errors
@@ -163,15 +171,27 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
unset(search_paths)
if(NOT _CUDA_NVCC_EXECUTABLE)
- message(FATAL_ERROR "Could not find nvcc, please set CUDAToolkit_ROOT.")
+ message(FATAL_ERROR "Failed to find nvcc.\nCompiler ${CMAKE_CUDA_COMPILER_ID} requires the CUDA toolkit. Please set the CUDAToolkit_ROOT variable.")
endif()
endif()
endif()
- get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${_CUDA_NVCC_EXECUTABLE}" DIRECTORY)
- set(CMAKE_CUDA_DEVICE_LINKER "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/nvlink${CMAKE_EXECUTABLE_SUFFIX}")
- set(CMAKE_CUDA_FATBINARY "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/fatbinary${CMAKE_EXECUTABLE_SUFFIX}")
- get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}" DIRECTORY)
+ # Given that NVCC can be provided by multiple different sources (NVIDIA HPC SDK, CUDA Toolkit, distro)
+ # each of which has a different layout, we need to extract the CUDA toolkit root from the compiler
+ # itself, allowing us to support numerous different scattered toolkit layouts
+ execute_process(COMMAND ${_CUDA_NVCC_EXECUTABLE} "-v" "__cmake_determine_cuda"
+ OUTPUT_VARIABLE _CUDA_NVCC_OUT ERROR_VARIABLE _CUDA_NVCC_OUT)
+ if(_CUDA_NVCC_OUT MATCHES "TOP=([^\r\n]*)")
+ get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_MATCH_1}" ABSOLUTE)
+ else()
+ get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${_CUDA_NVCC_EXECUTABLE}" DIRECTORY)
+ get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}" DIRECTORY)
+ endif()
+ unset(_CUDA_NVCC_OUT)
+
+ set(CMAKE_CUDA_DEVICE_LINKER "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/bin/nvlink${CMAKE_EXECUTABLE_SUFFIX}")
+ set(CMAKE_CUDA_FATBINARY "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/bin/fatbinary${CMAKE_EXECUTABLE_SUFFIX}")
+
# In a non-scattered installation the following are equivalent to CMAKE_CUDA_COMPILER_TOOLKIT_ROOT.
# We first check for a non-scattered installation to prefer it over a scattered installation.
@@ -209,10 +229,6 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON)
endif()
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
- if(WIN32)
- message(FATAL_ERROR "Clang with CUDA is not yet supported on Windows. See CMake issue #20776.")
- endif()
-
set(clang_test_flags "--cuda-path=\"${CMAKE_CUDA_COMPILER_LIBRARY_ROOT}\"")
if(CMAKE_CROSSCOMPILING)
# Need to pass the host target and include directories if we're crosscompiling.
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 905eb259a8..fd07a5c47e 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -58,7 +58,7 @@ else()
# finally list compilers to try
if(NOT CMAKE_CXX_COMPILER_INIT)
- set(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC clang++)
+ set(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC icpx icx clang++)
endif()
_cmake_find_compiler(CXX)
@@ -131,7 +131,8 @@ else()
# variable but are not aware of CMAKE_CXX_COMPILER_FRONTEND_VARIANT.
# They pre-date our support for the GNU-like variant targeting the
# MSVC ABI so we do not consider that here.
- if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
+ OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntelLLVM")
if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "MSVC")
else()
@@ -160,8 +161,9 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC")
get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
- if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
+ if (COMPILER_BASENAME MATCHES "^(.+-)?(clang\\+\\+|g\\+\\+|clang-cl)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ set(_CMAKE_TOOLCHAIN_SUFFIX ${CMAKE_MATCH_3})
set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_5})
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if(CMAKE_CXX_COMPILER_TARGET)
diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake
index b50e5f1723..c03a85fdbf 100644
--- a/Modules/CMakeDetermineCompileFeatures.cmake
+++ b/Modules/CMakeDetermineCompileFeatures.cmake
@@ -50,6 +50,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CXX14_COMPILE_FEATURES)
set(CMAKE_CXX17_COMPILE_FEATURES)
set(CMAKE_CXX20_COMPILE_FEATURES)
+ set(CMAKE_CXX23_COMPILE_FEATURES)
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
@@ -60,6 +61,9 @@ function(cmake_determine_compile_features lang)
return()
endif()
+ if (CMAKE_CXX20_COMPILE_FEATURES AND CMAKE_CXX23_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CXX23_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES})
+ endif()
if (CMAKE_CXX17_COMPILE_FEATURES AND CMAKE_CXX20_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES})
endif()
@@ -80,6 +84,7 @@ function(cmake_determine_compile_features lang)
${CMAKE_CXX14_COMPILE_FEATURES}
${CMAKE_CXX17_COMPILE_FEATURES}
${CMAKE_CXX20_COMPILE_FEATURES}
+ ${CMAKE_CXX23_COMPILE_FEATURES}
)
endif()
@@ -89,6 +94,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CXX23_COMPILE_FEATURES ${CMAKE_CXX23_COMPILE_FEATURES} PARENT_SCOPE)
message(CHECK_PASS "done")
@@ -100,6 +106,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CUDA14_COMPILE_FEATURES)
set(CMAKE_CUDA17_COMPILE_FEATURES)
set(CMAKE_CUDA20_COMPILE_FEATURES)
+ set(CMAKE_CUDA23_COMPILE_FEATURES)
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
@@ -110,7 +117,10 @@ function(cmake_determine_compile_features lang)
return()
endif()
- if (CMAKE_CUDA17_COMPILE_FEATURES AND CMAKE_CUDA20_COMPILE_FEATURES)
+ if (CMAKE_CUDA20_COMPILE_FEATURES AND CMAKE_CUDA23_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CUDA23_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES})
+ endif()
+ if (CMAKE_CUDA17_COMPILE_FEATURES AND CMAKE_CUDA20_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES})
endif()
if (CMAKE_CUDA14_COMPILE_FEATURES AND CMAKE_CUDA17_COMPILE_FEATURES)
@@ -130,6 +140,7 @@ function(cmake_determine_compile_features lang)
${CMAKE_CUDA14_COMPILE_FEATURES}
${CMAKE_CUDA17_COMPILE_FEATURES}
${CMAKE_CUDA20_COMPILE_FEATURES}
+ ${CMAKE_CUDA23_COMPILE_FEATURES}
)
endif()
@@ -139,6 +150,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CUDA14_COMPILE_FEATURES ${CMAKE_CUDA14_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CUDA17_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CUDA23_COMPILE_FEATURES ${CMAKE_CUDA23_COMPILE_FEATURES} PARENT_SCOPE)
message(CHECK_PASS "done")
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 7e5b3751ba..cf028f1812 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -8,6 +8,7 @@
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitIncludeInfo.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
+include(${CMAKE_ROOT}/Modules/CMakeParseLibraryArchitecture.cmake)
include(CMakeTestCompilerCommon)
function(CMAKE_DETERMINE_COMPILER_ABI lang src)
@@ -75,12 +76,25 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
message(CHECK_PASS "done")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n")
- file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 32 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ set(ABI_SIZEOF_DPTR "NOTFOUND")
+ set(ABI_BYTE_ORDER "NOTFOUND")
+ set(ABI_NAME "NOTFOUND")
foreach(info ${ABI_STRINGS})
- if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]")
+ if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]" AND NOT ABI_SIZEOF_DPTR)
set(ABI_SIZEOF_DPTR "${CMAKE_MATCH_1}")
endif()
- if("${info}" MATCHES "INFO:abi\\[([^]]*)\\]")
+ if("${info}" MATCHES "INFO:byte_order\\[(BIG_ENDIAN|LITTLE_ENDIAN)\\]")
+ set(byte_order "${CMAKE_MATCH_1}")
+ if(ABI_BYTE_ORDER STREQUAL "NOTFOUND")
+ # Tentatively use the value because this is the first occurrence.
+ set(ABI_BYTE_ORDER "${byte_order}")
+ elseif(NOT ABI_BYTE_ORDER STREQUAL "${byte_order}")
+ # Drop value because multiple occurrences do not match.
+ set(ABI_BYTE_ORDER "")
+ endif()
+ endif()
+ if("${info}" MATCHES "INFO:abi\\[([^]]*)\\]" AND NOT ABI_NAME)
set(ABI_NAME "${CMAKE_MATCH_1}")
endif()
endforeach()
@@ -91,6 +105,10 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE)
endif()
+ if(ABI_BYTE_ORDER)
+ set(CMAKE_${lang}_BYTE_ORDER "${ABI_BYTE_ORDER}" PARENT_SCOPE)
+ endif()
+
if(ABI_NAME)
set(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE)
endif()
@@ -158,27 +176,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE)
- # Detect library architecture directory name.
- if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
- foreach(dir ${implicit_dirs})
- if("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
- get_filename_component(arch "${dir}" NAME)
- set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${arch}" PARENT_SCOPE)
- break()
- endif()
- endforeach()
- elseif(CMAKE_CXX_COMPILER_ID STREQUAL QCC)
- foreach(dir ${implicit_dirs})
- if (dir MATCHES "/lib$")
- get_filename_component(assumedArchDir "${dir}" DIRECTORY)
- get_filename_component(archParentDir "${assumedArchDir}" DIRECTORY)
- if (archParentDir STREQUAL CMAKE_SYSROOT)
- get_filename_component(archDirName "${assumedArchDir}" NAME)
- set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${archDirName}" PARENT_SCOPE)
- break()
- endif()
- endif()
- endforeach()
+ cmake_parse_library_architecture("${implicit_dirs}" architecture_flag)
+ if(architecture_flag)
+ set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${architecture_flag}" PARENT_SCOPE)
endif()
else()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 937a1206b6..1595cfd73c 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -1,6 +1,17 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
+macro(__determine_compiler_id_test testflags_in userflags)
+ separate_arguments(testflags UNIX_COMMAND "${testflags_in}")
+ CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${testflags}" "${userflags}" "${src}")
+ CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}")
+
+ if(NOT CMAKE_${lang}_COMPILER_ID)
+ foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
+ CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
+ endforeach()
+ endif()
+endmacro()
# Function to compile a source file to identify the compiler. This is
# used internally by CMake and should not be included by user code.
@@ -24,29 +35,36 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
# Compute the directory in which to run the test.
set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang})
- # Try building with no extra flags and then try each set
- # of helper flags. Stop when the compiler is identified.
- foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
- foreach(testflags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}
- ""
- ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
- separate_arguments(testflags UNIX_COMMAND "${testflags}")
- CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${testflags}" "${userflags}" "${src}")
- CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}")
+ # If we REQUIRE_SUCCESS, i.e. TEST_FLAGS_FIRST has the correct flags, we still need to
+ # try two combinations: with COMPILER_ID_FLAGS (from user) and without (see issue #21869).
+ if(CMAKE_${lang}_COMPILER_ID_REQUIRE_SUCCESS)
+ # If there COMPILER_ID_FLAGS is empty we can error for the first invocation.
+ if("${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" STREQUAL "")
+ set(__compiler_id_require_success TRUE)
+ endif()
+
+ foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
+ __determine_compiler_id_test("${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}" "${userflags}")
if(CMAKE_${lang}_COMPILER_ID)
break()
endif()
- foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
- CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
+ set(__compiler_id_require_success TRUE)
+ endforeach()
+ else()
+ # Try building with no extra flags and then try each set
+ # of helper flags. Stop when the compiler is identified.
+ foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
+ foreach(testflags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST} "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
+ __determine_compiler_id_test("${testflags}" "${userflags}")
+ if(CMAKE_${lang}_COMPILER_ID)
+ break()
+ endif()
endforeach()
if(CMAKE_${lang}_COMPILER_ID)
break()
endif()
endforeach()
- if(CMAKE_${lang}_COMPILER_ID)
- break()
- endif()
- endforeach()
+ endif()
# Check if compiler id detection gave us the compiler tool.
if(CMAKE_${lang}_COMPILER_ID_TOOL)
@@ -152,7 +170,10 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format")
endif()
- if(CMAKE_GENERATOR MATCHES "^Ninja" AND MSVC_${lang}_ARCHITECTURE_ID)
+ if((CMAKE_GENERATOR MATCHES "^Ninja"
+ OR ((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"))
+ AND MSVC_${lang}_ARCHITECTURE_ID)
foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX(${lang} "${userflags}")
endforeach()
@@ -161,7 +182,8 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
set(_variant "")
- if("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xClang")
+ if("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xClang"
+ OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xIntelLLVM")
if("x${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "xMSVC")
if(CMAKE_GENERATOR MATCHES "Visual Studio")
set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "MSVC")
@@ -276,6 +298,16 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_cl "$(CLToolExe)")
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*")
set(id_cl clang.exe)
+ # Executable names have choosen according documentation
+ # URL: (https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-dpcpp-compiler/top.html#top_GUID-A9B4C91D-97AC-450D-9742-9D895BC8AEE1)
+ elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel")
+ if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "DPC\\+\\+ Compiler")
+ set(id_cl dpcpp.exe)
+ elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler 2021")
+ set(id_cl icx.exe)
+ elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler")
+ set(id_cl icl.exe)
+ endif()
else()
set(id_cl cl.exe)
endif()
@@ -310,9 +342,6 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_toolset "<NdkToolchainVersion>${CMAKE_VS_PLATFORM_TOOLSET}</NdkToolchainVersion>")
else()
set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
- if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel")
- set(id_cl icl.exe)
- endif()
if(CMAKE_VS_PLATFORM_TOOLSET_VERSION)
set(id_sep "\\")
if(CMAKE_VS_PLATFORM_TOOLSET_VERSION VERSION_GREATER_EQUAL "14.20")
@@ -642,7 +671,7 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
# Some languages may know the correct/desired set of flags and want to fail right away if they don't work.
# This is currently only used by CUDA.
- if(CMAKE_${lang}_COMPILER_ID_REQUIRE_SUCCESS)
+ if(__compiler_id_require_success)
message(FATAL_ERROR "${MSG}")
endif()
@@ -901,12 +930,17 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
# # COFF (.exe) files start with "MZ"
# if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....")
-# set(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE STRING "Executable file format")
+# set(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE INTERNAL "Executable file format")
# endif()
#
# Mach-O files start with MH_MAGIC or MH_CIGAM
if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface|cefaedfe|feedfacf|cffaedfe")
- set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format")
+ set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE INTERNAL "Executable file format")
+ endif()
+
+ # XCOFF files start with 0x01 followed by 0xDF (32-bit) or 0xF7 (64-bit).
+ if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "^01(df|f7)")
+ set(CMAKE_EXECUTABLE_FORMAT "XCOFF" CACHE INTERNAL "Executable file format")
endif()
endif()
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 8a574086e1..d7d032c01b 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -59,6 +59,8 @@ else()
# af77: Apogee F77 compiler for Intergraph hardware running CLIX
# epcf90: "Edinburgh Portable Compiler" F90
# fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha
+ # ifx: Intel Fortran LLVM-based compiler
+ # ifort: Intel Classic Fortran compiler
# ifc: Intel Fortran 95 compiler for Linux/x86
# efc: Intel Fortran 95 compiler for IA64
# nagfor: NAG Fortran compiler
@@ -68,14 +70,14 @@ else()
# so if you paid for a compiler it is picked by default.
if(CMAKE_HOST_WIN32)
set(CMAKE_Fortran_COMPILER_LIST
- ifort pgf95 pgfortran lf95 fort
+ ifort ifx pgf95 pgfortran lf95 fort
flang gfortran gfortran-4 g95 f90 pgf90
pgf77 g77 f77 nag
)
else()
set(CMAKE_Fortran_COMPILER_LIST
ftn
- ifort ifc efc pgf95 pgfortran lf95 xlf95 fort
+ ifort ifc ifx efc pgf95 pgfortran lf95 xlf95 fort
flang gfortran gfortran-4 g95 f90 pgf90
frt pgf77 xlf g77 f77 nag
)
@@ -83,7 +85,7 @@ else()
# Vendor-specific compiler names.
set(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77)
- set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc)
+ set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc ifx)
set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77)
set(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77)
set(_Fortran_COMPILER_NAMES_Flang flang)
diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
index 11f4a29b4d..f90301be91 100644
--- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
+++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
@@ -88,7 +88,7 @@ set(ENV{LANG} C)
# Now check for C, works for gcc and Intel compiler at least
if (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS)
- if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES Intel OR CMAKE_C_COMPILER_ID MATCHES Clang)
+ if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES "Intel" OR CMAKE_C_COMPILER_ID MATCHES Clang)
_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs _defines)
set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories")
set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "C compiler system defined macros")
@@ -99,7 +99,7 @@ endif ()
# And now the same for C++
if (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS)
- if ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Intel OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Clang)
+ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Clang)
_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c++ _dirs _defines)
set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories")
set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "CXX compiler system defined macros")
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index d81fd1158c..ff178f647d 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -70,17 +70,18 @@ if(("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC" AND
OR (CMAKE_GENERATOR MATCHES "Visual Studio"
AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
+ set(_CMAKE_LINKER_NAMES "link")
+ set(_CMAKE_AR_NAMES "lib")
+ set(_CMAKE_MT_NAMES "mt")
if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xClang")
- find_program(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm llvm-nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- set(_CMAKE_ADDITIONAL_LINKER_NAMES "lld-link")
- set(_CMAKE_ADDITIONAL_AR_NAMES "llvm-lib")
+ set(_CMAKE_NM_NAMES "llvm-nm" "nm")
+ list(APPEND _CMAKE_AR_NAMES "lib" "llvm-lib")
+ list(APPEND _CMAKE_MT_NAMES "mt" "llvm-mt")
+ list(APPEND _CMAKE_LINKER_NAMES "lld-link")
+ list(APPEND _CMAKE_TOOL_VARS NM)
endif()
- find_program(CMAKE_LINKER NAMES ${_CMAKE_ADDITIONAL_LINKER_NAMES} link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- find_program(CMAKE_AR NAMES ${_CMAKE_ADDITIONAL_AR_NAMES} lib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- find_program(CMAKE_MT NAMES mt HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
-
- list(APPEND _CMAKE_TOOL_VARS LINKER MT)
+ list(APPEND _CMAKE_TOOL_VARS LINKER MT AR)
# in all other cases search for ar, ranlib, etc.
else()
@@ -92,55 +93,54 @@ else()
endif()
if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL Clang)
- set(_CMAKE_ADDITIONAL_AR_NAMES "llvm-ar")
- set(_CMAKE_ADDITIONAL_RANLIB_NAMES "llvm-ranlib")
- set(_CMAKE_ADDITIONAL_STRIP_NAMES "llvm-strip")
if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC")
- set(_CMAKE_ADDITIONAL_LINKER_NAMES "lld-link")
+ set(_CMAKE_LINKER_NAMES "lld-link")
else()
- set(_CMAKE_ADDITIONAL_LINKER_NAMES "ld.lld")
+ set(_CMAKE_LINKER_NAMES "ld.lld")
endif()
- set(_CMAKE_ADDITIONAL_NM_NAMES "llvm-nm")
- set(_CMAKE_ADDITIONAL_OBJDUMP_NAMES "llvm-objdump")
- set(_CMAKE_ADDITIONAL_OBJCOPY_NAMES "llvm-objcopy")
- set(_CMAKE_ADDITIONAL_READELF_NAMES "llvm-readelf")
- set(_CMAKE_ADDITIONAL_DLLTOOL_NAMES "llvm-dlltool")
- set(_CMAKE_ADDITIONAL_ADDR2LINE_NAMES "llvm-addr2line")
+ list(APPEND _CMAKE_AR_NAMES "llvm-ar")
+ list(APPEND _CMAKE_NM_NAMES "llvm-nm")
+ list(APPEND _CMAKE_OBJDUMP_NAMES "llvm-objdump")
+ list(APPEND _CMAKE_OBJCOPY_NAMES "llvm-objcopy")
+ list(APPEND _CMAKE_READELF_NAMES "llvm-readelf")
+ list(APPEND _CMAKE_DLLTOOL_NAMES "llvm-dlltool")
+ list(APPEND _CMAKE_ADDR2LINE_NAMES "llvm-addr2line")
endif()
- if(NOT CMAKE_CROSSCOMPILING AND NOT "${_CMAKE_TOOLCHAIN_PREFIX}" STREQUAL "")
- list(APPEND _CMAKE_ADDITIONAL_AR_NAMES "ar")
- list(APPEND _CMAKE_ADDITIONAL_RANLIB_NAMES "ranlib")
- list(APPEND _CMAKE_ADDITIONAL_STRIP_NAMES "strip")
- list(APPEND _CMAKE_ADDITIONAL_LINKER_NAMES "ld")
- list(APPEND _CMAKE_ADDITIONAL_NM_NAMES "nm")
- list(APPEND _CMAKE_ADDITIONAL_OBJDUMP_NAMES "objdump")
- list(APPEND _CMAKE_ADDITIONAL_OBJCOPY_NAMES "objcopy")
- list(APPEND _CMAKE_ADDITIONAL_READELF_NAMES "readelf")
- list(APPEND _CMAKE_ADDITIONAL_DLLTOOL_NAMES "dlltool")
- list(APPEND _CMAKE_ADDITIONAL_ADDR2LINE_NAMES "addr2line")
- endif()
+ list(APPEND _CMAKE_AR_NAMES "ar")
+ list(APPEND _CMAKE_RANLIB_NAMES "ranlib")
+ list(APPEND _CMAKE_STRIP_NAMES "strip")
+ list(APPEND _CMAKE_LINKER_NAMES "ld")
+ list(APPEND _CMAKE_NM_NAMES "nm")
+ list(APPEND _CMAKE_OBJDUMP_NAMES "objdump")
+ list(APPEND _CMAKE_OBJCOPY_NAMES "objcopy")
+ list(APPEND _CMAKE_READELF_NAMES "readelf")
+ list(APPEND _CMAKE_DLLTOOL_NAMES "dlltool")
+ list(APPEND _CMAKE_ADDR2LINE_NAMES "addr2line")
+
+ list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE)
+endif()
- find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar${_CMAKE_TOOLCHAIN_SUFFIX} ${_CMAKE_ADDITIONAL_AR_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+foreach(TOOL IN LISTS _CMAKE_TOOL_VARS)
+ foreach(NAME IN LISTS _CMAKE_${TOOL}_NAMES)
+ if(NOT _CMAKE_TOOLCHAIN_PREFIX STREQUAL "")
+ if(NOT _CMAKE_TOOLCHAIN_SUFFIX STREQUAL "")
+ list(PREPEND _CMAKE_${TOOL}_NAMES ${NAME}${_CMAKE_TOOLCHAIN_SUFFIX})
+ endif()
+ list(PREPEND _CMAKE_${TOOL}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${NAME})
+ endif()
+ if(NOT _CMAKE_TOOLCHAIN_SUFFIX STREQUAL "")
+ list(PREPEND _CMAKE_${TOOL}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${NAME}${_CMAKE_TOOLCHAIN_SUFFIX})
+ endif()
+ endforeach()
+ find_program(CMAKE_${TOOL} NAMES ${_CMAKE_${TOOL}_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+endforeach()
- find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib ${_CMAKE_ADDITIONAL_RANLIB_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- if(NOT CMAKE_RANLIB)
+if(NOT CMAKE_RANLIB)
set(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
- endif()
-
-
- find_program(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip${_CMAKE_TOOLCHAIN_SUFFIX} ${_CMAKE_ADDITIONAL_STRIP_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- find_program(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld ${_CMAKE_ADDITIONAL_LINKER_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- find_program(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm ${_CMAKE_ADDITIONAL_NM_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- find_program(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump ${_CMAKE_ADDITIONAL_OBJDUMP_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- find_program(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy ${_CMAKE_ADDITIONAL_OBJCOPY_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- find_program(CMAKE_READELF NAMES ${_CMAKE_TOOLCHAIN_PREFIX}readelf ${_CMAKE_ADDITIONAL_READELF_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- find_program(CMAKE_DLLTOOL NAMES ${_CMAKE_TOOLCHAIN_PREFIX}dlltool ${_CMAKE_ADDITIONAL_DLLTOOL_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- find_program(CMAKE_ADDR2LINE NAMES ${_CMAKE_TOOLCHAIN_PREFIX}addr2line ${_CMAKE_ADDITIONAL_ADDR2LINE_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
-
- list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE)
endif()
+
if(CMAKE_PLATFORM_HAS_INSTALLNAME)
find_program(CMAKE_INSTALL_NAME_TOOL NAMES ${_CMAKE_TOOLCHAIN_PREFIX}install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
@@ -157,7 +157,7 @@ foreach(var IN LISTS _CMAKE_TOOL_VARS)
if(_CMAKE_TOOL_CACHED)
mark_as_advanced(CMAKE_${var})
endif()
- unset(_CMAKE_ADDITIONAL_${var}_NAMES)
+ unset(_CMAKE_${var}_NAMES)
endforeach()
unset(_CMAKE_TOOL_VARS)
unset(_CMAKE_TOOL_CACHED)
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index 6b51e38038..0a3db4cf6b 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -22,7 +22,21 @@
PRINT *, 'INFO:simulate_version[013.00]'
# endif
#endif
-#if defined(__INTEL_COMPILER) || defined(__ICC)
+#if defined(__INTEL_LLVM_COMPILER)
+ PRINT *, 'INFO:compiler[IntelLLVM]'
+! __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
+! later. Look for 6 digit vs. 8 digit version number to decide encoding.
+! VVVV is no smaller than the current year when a versio is released.
+# if __INTEL_LLVM_COMPILER < 1000000
+# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
+# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10)
+# else
+# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
+# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
+# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100)
+# endif
+#elif defined(__INTEL_COMPILER) || defined(__ICC)
PRINT *, 'INFO:compiler[Intel]'
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
@@ -82,6 +96,23 @@
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
# endif
+#elif defined(__NVCOMPILER) || defined(__NVCOMPILER_LLVM__)
+ PRINT *, 'INFO:compiler[NVHPC]'
+# if defined(__NVCOMPILER_MAJOR__)
+# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
+# else
+# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
+# endif
+# if defined(__NVCOMPILER_MINOR__)
+# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
+# else
+# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
+# endif
+# if defined(__NVCOMPILER_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
+# elif defined(__PGIC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
+# endif
#elif defined(__PGI)
PRINT *, 'INFO:compiler[PGI]'
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake
index be4a3be365..708672258a 100644
--- a/Modules/CMakeGraphVizOptions.cmake
+++ b/Modules/CMakeGraphVizOptions.cmake
@@ -29,8 +29,9 @@ Graphviz package:
dot -Tpng -o foo.png foo.dot
-The different dependency types ``PUBLIC``, ``INTERFACE`` and ``PRIVATE``
-are represented as solid, dashed and dotted edges.
+.. versionadded:: 3.10
+ The different dependency types ``PUBLIC``, ``INTERFACE`` and ``PRIVATE``
+ are represented as solid, dashed and dotted edges.
Variables specific to the Graphviz support
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in
index 155551789f..608adce0fd 100644
--- a/Modules/CMakeOBJCCompiler.cmake.in
+++ b/Modules/CMakeOBJCCompiler.cmake.in
@@ -45,6 +45,7 @@ endforeach()
# Save compiler ABI information.
set(CMAKE_OBJC_SIZEOF_DATA_PTR "@CMAKE_OBJC_SIZEOF_DATA_PTR@")
set(CMAKE_OBJC_COMPILER_ABI "@CMAKE_OBJC_COMPILER_ABI@")
+set(CMAKE_OBJC_BYTE_ORDER "@CMAKE_OBJC_BYTE_ORDER@")
set(CMAKE_OBJC_LIBRARY_ARCHITECTURE "@CMAKE_OBJC_LIBRARY_ARCHITECTURE@")
if(CMAKE_OBJC_SIZEOF_DATA_PTR)
diff --git a/Modules/CMakeOBJCCompilerABI.m b/Modules/CMakeOBJCCompilerABI.m
index 8fa85117cd..0726cd3eb4 100644
--- a/Modules/CMakeOBJCCompilerABI.m
+++ b/Modules/CMakeOBJCCompilerABI.m
@@ -12,6 +12,8 @@ int main(int argc, char *argv[])
{
int require = 0;
require += info_sizeof_dptr[argc];
+ require += info_byte_order_big_endian[argc];
+ require += info_byte_order_little_endian[argc];
#if defined(ABI_ID)
require += info_abi[argc];
#endif
diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in
index b6452c4643..a24582b8b5 100644
--- a/Modules/CMakeOBJCXXCompiler.cmake.in
+++ b/Modules/CMakeOBJCXXCompiler.cmake.in
@@ -11,6 +11,7 @@ set(CMAKE_OBJCXX11_COMPILE_FEATURES "@CMAKE_OBJCXX11_COMPILE_FEATURES@")
set(CMAKE_OBJCXX14_COMPILE_FEATURES "@CMAKE_OBJCXX14_COMPILE_FEATURES@")
set(CMAKE_OBJCXX17_COMPILE_FEATURES "@CMAKE_OBJCXX17_COMPILE_FEATURES@")
set(CMAKE_OBJCXX20_COMPILE_FEATURES "@CMAKE_OBJCXX20_COMPILE_FEATURES@")
+set(CMAKE_OBJCXX23_COMPILE_FEATURES "@CMAKE_OBJCXX23_COMPILE_FEATURES@")
set(CMAKE_OBJCXX_PLATFORM_ID "@CMAKE_OBJCXX_PLATFORM_ID@")
set(CMAKE_OBJCXX_SIMULATE_ID "@CMAKE_OBJCXX_SIMULATE_ID@")
@@ -55,6 +56,7 @@ set(CMAKE_OBJCXX_LINKER_PREFERENCE_PROPAGATES 1)
# Save compiler ABI information.
set(CMAKE_OBJCXX_SIZEOF_DATA_PTR "@CMAKE_OBJCXX_SIZEOF_DATA_PTR@")
set(CMAKE_OBJCXX_COMPILER_ABI "@CMAKE_OBJCXX_COMPILER_ABI@")
+set(CMAKE_OBJCXX_BYTE_ORDER "@CMAKE_OBJCXX_BYTE_ORDER@")
set(CMAKE_OBJCXX_LIBRARY_ARCHITECTURE "@CMAKE_OBJCXX_LIBRARY_ARCHITECTURE@")
if(CMAKE_OBJCXX_SIZEOF_DATA_PTR)
diff --git a/Modules/CMakeOBJCXXCompilerABI.mm b/Modules/CMakeOBJCXXCompilerABI.mm
index 288a58c8d0..7b9fefccf5 100644
--- a/Modules/CMakeOBJCXXCompilerABI.mm
+++ b/Modules/CMakeOBJCXXCompilerABI.mm
@@ -12,6 +12,8 @@ int main(int argc, char *argv[])
{
int require = 0;
require += info_sizeof_dptr[argc];
+ require += info_byte_order_big_endian[argc];
+ require += info_byte_order_little_endian[argc];
#if defined(ABI_ID)
require += info_abi[argc];
#endif
diff --git a/Modules/CMakeOBJCXXCompilerId.mm.in b/Modules/CMakeOBJCXXCompilerId.mm.in
index fe04de1c63..e2ac35d05b 100644
--- a/Modules/CMakeOBJCXXCompilerId.mm.in
+++ b/Modules/CMakeOBJCXXCompilerId.mm.in
@@ -30,7 +30,9 @@ char const* qnxnto = "INFO" ":" "qnxnto[]";
#endif
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
-#if CXX_STD > 201703L
+#if CXX_STD > 202002L
+ "23"
+#elfif CXX_STD > 201703L
"20"
#elif CXX_STD >= 201703L
"17"
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 36f2f7f1ed..ad719ef5af 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -81,13 +81,14 @@ always relative to the installed location of the package. This works both for
relative and also for absolute locations. For absolute locations it works
only if the absolute location is a subdirectory of ``INSTALL_PREFIX``.
-If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to
-calculate all the relative paths. The ``<path>`` argument must be an absolute
-path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX`
-variable will be used instead. The default value is good when generating a
-FooConfig.cmake file to use your package from the install tree. When
-generating a FooConfig.cmake file to use your package from the build tree this
-option should be used.
+.. versionadded:: 3.1
+ If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to
+ calculate all the relative paths. The ``<path>`` argument must be an absolute
+ path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX`
+ variable will be used instead. The default value is good when generating a
+ FooConfig.cmake file to use your package from the install tree. When
+ generating a FooConfig.cmake file to use your package from the build tree this
+ option should be used.
By default ``configure_package_config_file`` also generates two helper macros,
``set_and_check()`` and ``check_required_components()`` into the
@@ -159,23 +160,28 @@ If your project has more elaborated version matching rules, you will need to
write your own custom ``ConfigVersion.cmake`` file instead of using this
macro.
-.. note:: ``COMPATIBILITY_MODE`` ``AnyNewerVersion``, ``SameMajorVersion`` and
- ``SameMinorVersion`` handle the version range if any is specified (see
- :command:`find_package` command for the details). ``ExactVersion`` is
- incompatible with version ranges and will display an author warning if one is
- specified.
-
-If ``ARCH_INDEPENDENT`` is given, the installed package version will be
-considered compatible even if it was built for a different architecture than
-the requested architecture. Otherwise, an architecture check will be performed,
-and the package will be considered compatible only if the architecture matches
-exactly. For example, if the package is built for a 32-bit architecture, the
-package is only considered compatible if it is used on a 32-bit architecture,
-unless ``ARCH_INDEPENDENT`` is given, in which case the package is considered
-compatible on any architecture.
+.. versionadded:: 3.11
+ The ``SameMinorVersion`` compatibility mode.
+
+.. versionadded:: 3.14
+ If ``ARCH_INDEPENDENT`` is given, the installed package version will be
+ considered compatible even if it was built for a different architecture than
+ the requested architecture. Otherwise, an architecture check will be performed,
+ and the package will be considered compatible only if the architecture matches
+ exactly. For example, if the package is built for a 32-bit architecture, the
+ package is only considered compatible if it is used on a 32-bit architecture,
+ unless ``ARCH_INDEPENDENT`` is given, in which case the package is considered
+ compatible on any architecture.
.. note:: ``ARCH_INDEPENDENT`` is intended for header-only libraries or similar
- packages with no binaries.
+ packages with no binaries.
+
+.. versionadded:: 3.19
+ ``COMPATIBILITY_MODE`` ``AnyNewerVersion``, ``SameMajorVersion`` and
+ ``SameMinorVersion`` handle the version range if any is specified
+ (see :command:`find_package` command for the details).
+ ``ExactVersion`` mode is incompatible with version ranges and will display an
+ author warning if one is specified.
Internally, this macro executes :command:`configure_file()` to create the
resulting version file. Depending on the ``COMPATIBILITY``, the corresponding
diff --git a/Modules/CMakeParseLibraryArchitecture.cmake b/Modules/CMakeParseLibraryArchitecture.cmake
new file mode 100644
index 0000000000..aa6fd741d7
--- /dev/null
+++ b/Modules/CMakeParseLibraryArchitecture.cmake
@@ -0,0 +1,56 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+cmake_policy(PUSH)
+cmake_policy(SET CMP0053 NEW)
+cmake_policy(SET CMP0054 NEW)
+
+# Function parse implicit linker options.
+# This is used internally by CMake and should not be included by user
+# code.
+
+function(cmake_parse_library_architecture implicit_dirs output_var)
+ unset(library_arch)
+ # Detect library architecture directory name.
+ if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
+ foreach(dir ${implicit_dirs})
+ if("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
+ get_filename_component(arch "${dir}" NAME)
+ set(library_arch "${arch}")
+ break()
+ endif()
+ endforeach()
+ endif()
+
+ if(CMAKE_LIBRARY_ARCHITECTURE_REGEX_VERSIONED AND NOT library_arch)
+ foreach(dir ${implicit_dirs})
+ if("${dir}" MATCHES "/${CMAKE_LIBRARY_ARCHITECTURE_REGEX_VERSIONED}$")
+ get_filename_component(arch "${dir}" DIRECTORY)
+ get_filename_component(arch "${arch}" NAME)
+ set(library_arch "${arch}")
+ break()
+ endif()
+ endforeach()
+ endif()
+
+ if(CMAKE_CXX_COMPILER_ID STREQUAL QCC)
+ foreach(dir ${implicit_dirs})
+ if (dir MATCHES "/lib$")
+ get_filename_component(assumedArchDir "${dir}" DIRECTORY)
+ get_filename_component(archParentDir "${assumedArchDir}" DIRECTORY)
+ if (archParentDir STREQUAL CMAKE_SYSROOT)
+ get_filename_component(archDirName "${assumedArchDir}" NAME)
+ set(library_arch "${archDirName}")
+ break()
+ endif()
+ endif()
+ endforeach()
+ endif()
+
+ # Return results.
+ if(library_arch)
+ set(${output_var} "${library_arch}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+cmake_policy(POP)
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index 0b81c88ebe..1dc12c0606 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -116,6 +116,9 @@
# if defined(_M_IA64)
# define ARCHITECTURE_ID "IA64"
+# elif defined(_M_ARM64EC)
+# define ARCHITECTURE_ID "ARM64EC"
+
# elif defined(_M_X64) || defined(_M_AMD64)
# define ARCHITECTURE_ID "x64"
@@ -183,6 +186,9 @@
# elif defined(__ICC8051__)
# define ARCHITECTURE_ID "8051"
+# elif defined(__ICCSTM8__)
+# define ARCHITECTURE_ID "STM8"
+
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
diff --git a/Modules/CMakeTestGNU.c b/Modules/CMakeTestGNU.c
index 933e5a212b..7dcafde66e 100644
--- a/Modules/CMakeTestGNU.c
+++ b/Modules/CMakeTestGNU.c
@@ -1,4 +1,5 @@
-#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+#if defined(__GNUC__) && \
+ !(defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER))
void THIS_IS_GNU();
#endif
#ifdef __MINGW32__
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 7529a1f431..ef5a7d5b1a 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -194,6 +194,8 @@ installers. The most commonly-used variables are:
.. variable:: CPACK_PACKAGE_CHECKSUM
+ .. versionadded:: 3.7
+
An algorithm that will be used to generate an additional file with the
checksum of the package. The output file name will be::
@@ -271,6 +273,8 @@ installers. The most commonly-used variables are:
.. variable:: CPACK_VERBATIM_VARIABLES
+ .. versionadded:: 3.4
+
If set to ``TRUE``, values of variables prefixed with ``CPACK_`` will be
escaped before being written to the configuration files, so that the cpack
program receives them exactly as they were specified. If not, characters
@@ -278,6 +282,28 @@ installers. The most commonly-used variables are:
received by the cpack program. Defaults to ``FALSE`` for backwards
compatibility.
+.. variable:: CPACK_THREADS
+
+ .. versionadded:: 3.20
+
+ Number of threads to use when performing parallelized operations, such
+ as compressing the installer package.
+
+ Some compression methods used by CPack generators such as Debian or Archive
+ may take advantage of multiple CPU cores to speed up compression.
+ ``CPACK_THREADS`` can be set to positive integer to specify how many threads
+ will be used for compression. If it is set to 0, CPack will set it so that
+ all available CPU cores are used.
+ By default ``CPACK_THREADS`` is set to ``1``.
+
+ Currently only ``xz`` compression *may* take advantage of multiple cores. Other
+ compression methods ignore this value and use only one thread.
+
+ .. note::
+
+ Official CMake binaries available on ``cmake.org`` ship with a ``liblzma``
+ that does not support parallel compression.
+
Variables for Source Package Generators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -356,6 +382,8 @@ The following variables are for advanced uses of CPack:
.. variable:: CPACK_INSTALL_SCRIPTS
+ .. versionadded:: 3.16
+
Extra CMake scripts executed by CPack during its local staging
installation. They are executed before installing the files to be packaged.
The scripts are not called by a standalone install (e.g.: ``make install``).
@@ -372,6 +400,8 @@ The following variables are for advanced uses of CPack:
.. variable:: CPACK_PRE_BUILD_SCRIPTS
+ .. versionadded:: 3.19
+
List of CMake scripts to execute after CPack has installed the files to
be packaged into a staging directory and before producing the package(s)
from those files. See also :variable:`CPACK_INSTALL_SCRIPTS` and
@@ -379,6 +409,8 @@ The following variables are for advanced uses of CPack:
.. variable:: CPACK_POST_BUILD_SCRIPTS
+ .. versionadded:: 3.19
+
List of CMake scripts to execute after CPack has produced the resultant
packages and before copying them back to the build directory.
See also :variable:`CPACK_INSTALL_SCRIPTS`,
@@ -386,6 +418,8 @@ The following variables are for advanced uses of CPack:
.. variable:: CPACK_PACKAGE_FILES
+ .. versionadded:: 3.19
+
List of package files created in the staging directory, with each file
provided as a full absolute path. This variable is populated by CPack
just before invoking the post-build scripts listed in
@@ -734,6 +768,7 @@ _cpack_set_default(CPACK_INSTALL_CMAKE_PROJECTS
"${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
_cpack_set_default(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
_cpack_set_default(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
+_cpack_set_default(CPACK_THREADS 1)
# if the user has set CPACK_NSIS_DISPLAY_NAME remember it
if(DEFINED CPACK_NSIS_DISPLAY_NAME)
set(CPACK_NSIS_DISPLAY_NAME_SET TRUE)
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 6ce0bfcc8a..d57cf18bac 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -51,20 +51,28 @@ The module defines the following commands:
of a group to which it belongs.
``ESSENTIAL``
+ .. versionadded:: 3.6
+
if set, then the package manager stays disabled until that
component is updated.
``VIRTUAL``
+ .. versionadded:: 3.8
+
if set, then the component will be hidden from the installer.
It is a equivalent of the ``HIDDEN`` option from the
:command:`cpack_add_component` command.
``FORCED_INSTALLATION``
+ .. versionadded:: 3.8
+
if set, then the component must always be installed.
It is a equivalent of the ``REQUIRED`` option from the
:command:`cpack_add_component` command.
``REQUIRES_ADMIN_RIGHTS``
+ .. versionadded:: 3.8
+
set it if the component needs to be installed with elevated permissions.
``NAME``
@@ -72,14 +80,20 @@ The module defines the following commands:
By default used origin component name.
``DISPLAY_NAME``
+ .. versionadded:: 3.8
+
set to rewrite original name configured by
:command:`cpack_add_component` command.
``DESCRIPTION``
+ .. versionadded:: 3.8
+
set to rewrite original description configured by
:command:`cpack_add_component` command.
``UPDATE_TEXT``
+ .. versionadded:: 3.8
+
will be added to the component description if this is an update to
the component.
@@ -88,22 +102,32 @@ The module defines the following commands:
By default used :variable:`CPACK_PACKAGE_VERSION`.
``RELEASE_DATE``
+ .. versionadded:: 3.8
+
keep empty to auto generate.
``SCRIPT``
is a relative or absolute path to operations script
for this component.
- ``PRIORITY`` | ``SORTING_PRIORITY``
+ ``SORTING_PRIORITY``
+ .. versionadded:: 3.8
+
is priority of the component in the tree.
- The ``PRIORITY`` option is deprecated and will be removed in a future
- version of CMake. Please use ``SORTING_PRIORITY`` option instead.
- ``DEPENDS`` | ``DEPENDENCIES``
+ ``PRIORITY``
+ .. deprecated:: 3.8
+ Old name for ``SORTING_PRIORITY``.
+
+ ``DEPENDS``, ``DEPENDENCIES``
+ .. versionadded:: 3.8
+
list of dependency component or component group identifiers in
QtIFW style.
``AUTO_DEPEND_ON``
+ .. versionadded:: 3.8
+
list of identifiers of component or component group in QtIFW style
that this component has an automatic dependency on.
@@ -112,21 +136,31 @@ The module defines the following commands:
component. You can specify more then one license.
``DEFAULT``
+ .. versionadded:: 3.8
+
Possible values are: TRUE, FALSE, and SCRIPT.
Set to FALSE to disable the component in the installer or to SCRIPT
to resolved during runtime (don't forget add the file of the script
as a value of the ``SCRIPT`` option).
``USER_INTERFACES``
+ .. versionadded:: 3.7
+
is a list of <file_path> ('.ui' files) representing pages to load.
``TRANSLATIONS``
+ .. versionadded:: 3.8
+
is a list of <file_path> ('.qm' files) representing translations to load.
``REPLACES``
+ .. versionadded:: 3.10
+
list of identifiers of component or component group to replace.
``CHECKABLE``
+ .. versionadded:: 3.10
+
Possible values are: TRUE, FALSE.
Set to FALSE if you want to hide the checkbox for an item.
This is useful when only a few subcomponents should be selected
@@ -162,13 +196,19 @@ The module defines the following commands:
command.
``VIRTUAL``
+ .. versionadded:: 3.8
+
if set, then the group will be hidden from the installer.
Note that setting this on a root component does not work.
``FORCED_INSTALLATION``
+ .. versionadded:: 3.8
+
if set, then the group must always be installed.
``REQUIRES_ADMIN_RIGHTS``
+ .. versionadded:: 3.8
+
set it if the component group needs to be installed with elevated
permissions.
@@ -177,14 +217,20 @@ The module defines the following commands:
By default used origin component group name.
``DISPLAY_NAME``
+ .. versionadded:: 3.8
+
set to rewrite original name configured by
:command:`cpack_add_component_group` command.
``DESCRIPTION``
+ .. versionadded:: 3.8
+
set to rewrite original description configured by
:command:`cpack_add_component_group` command.
``UPDATE_TEXT``
+ .. versionadded:: 3.8
+
will be added to the component group description if this is an update to
the component group.
@@ -193,22 +239,30 @@ The module defines the following commands:
By default used :variable:`CPACK_PACKAGE_VERSION`.
``RELEASE_DATE``
+ .. versionadded:: 3.8
+
keep empty to auto generate.
``SCRIPT``
is a relative or absolute path to operations script
for this component group.
- ``PRIORITY`` | ``SORTING_PRIORITY``
+ ``SORTING_PRIORITY``
is priority of the component group in the tree.
- The ``PRIORITY`` option is deprecated and will be removed in a future
- version of CMake. Please use ``SORTING_PRIORITY`` option instead.
- ``DEPENDS`` | ``DEPENDENCIES``
+ ``PRIORITY``
+ .. deprecated:: 3.8
+ Old name for ``SORTING_PRIORITY``.
+
+ ``DEPENDS``, ``DEPENDENCIES``
+ .. versionadded:: 3.8
+
list of dependency component or component group identifiers in
QtIFW style.
``AUTO_DEPEND_ON``
+ .. versionadded:: 3.8
+
list of identifiers of component or component group in QtIFW style
that this component group has an automatic dependency on.
@@ -217,6 +271,8 @@ The module defines the following commands:
component group. You can specify more then one license.
``DEFAULT``
+ .. versionadded:: 3.8
+
Possible values are: TRUE, FALSE, and SCRIPT.
Set to TRUE to preselect the group in the installer
(this takes effect only on groups that have no visible child components)
@@ -224,15 +280,23 @@ The module defines the following commands:
the script as a value of the ``SCRIPT`` option).
``USER_INTERFACES``
+ .. versionadded:: 3.7
+
is a list of <file_path> ('.ui' files) representing pages to load.
``TRANSLATIONS``
+ .. versionadded:: 3.8
+
is a list of <file_path> ('.qm' files) representing translations to load.
``REPLACES``
+ .. versionadded:: 3.10
+
list of identifiers of component or component group to replace.
``CHECKABLE``
+ .. versionadded:: 3.10
+
Possible values are: TRUE, FALSE.
Set to FALSE if you want to hide the checkbox for an item.
This is useful when only a few subcomponents should be selected
@@ -272,6 +336,8 @@ The module defines the following commands:
.. command:: cpack_ifw_update_repository
+ .. versionadded:: 3.6
+
Update QtIFW specific repository from remote repository.
::
@@ -307,6 +373,8 @@ The module defines the following commands:
.. command:: cpack_ifw_add_package_resources
+ .. versionadded:: 3.7
+
Add additional resources in the installer binary.
::
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
index 8265bd26eb..8f8ebb4b76 100644
--- a/Modules/CTest.cmake
+++ b/Modules/CTest.cmake
@@ -121,15 +121,6 @@ if(BUILD_TESTING)
string(APPEND SUBMIT_URL "${DROP_SITE}${DROP_LOCATION}")
endif()
- find_program(CVSCOMMAND cvs )
- set(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING
- "Options passed to the cvs update command.")
- find_program(SVNCOMMAND svn)
- find_program(BZRCOMMAND bzr)
- find_program(HGCOMMAND hg)
- find_program(GITCOMMAND git)
- find_program(P4COMMAND p4)
-
if(NOT UPDATE_TYPE)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS")
set(UPDATE_TYPE cvs)
@@ -146,21 +137,29 @@ if(BUILD_TESTING)
string(TOLOWER "${UPDATE_TYPE}" _update_type)
if("${_update_type}" STREQUAL "cvs")
+ find_program(CVSCOMMAND cvs )
+ set(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING
+ "Options passed to the cvs update command.")
set(UPDATE_COMMAND "${CVSCOMMAND}")
set(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "svn")
+ find_program(SVNCOMMAND svn)
set(UPDATE_COMMAND "${SVNCOMMAND}")
set(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "bzr")
+ find_program(BZRCOMMAND bzr)
set(UPDATE_COMMAND "${BZRCOMMAND}")
set(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "hg")
+ find_program(HGCOMMAND hg)
set(UPDATE_COMMAND "${HGCOMMAND}")
set(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "git")
+ find_program(GITCOMMAND git)
set(UPDATE_COMMAND "${GITCOMMAND}")
set(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "p4")
+ find_program(P4COMMAND p4)
set(UPDATE_COMMAND "${P4COMMAND}")
set(UPDATE_OPTIONS "${P4_UPDATE_OPTIONS}")
endif()
@@ -179,12 +178,6 @@ if(BUILD_TESTING)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
DOC "Path to the memory checking command, used for memory error detection."
)
- find_program(SLURM_SBATCH_COMMAND sbatch DOC
- "Path to the SLURM sbatch executable"
- )
- find_program(SLURM_SRUN_COMMAND srun DOC
- "Path to the SLURM srun executable"
- )
set(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH
"File that contains suppressions for the memory checker")
find_program(COVERAGE_COMMAND gcov DOC
@@ -194,7 +187,14 @@ if(BUILD_TESTING)
"Extra command line flags to pass to the coverage tool")
# set the site name
- site_name(SITE)
+ if(COMMAND cmake_host_system_information)
+ cmake_host_system_information(RESULT _ctest_hostname QUERY HOSTNAME)
+ set(SITE "${_ctest_hostname}" CACHE STRING "Name of the computer/site where compile is being run")
+ unset(_ctest_hostname)
+ else()
+ # This code path is needed for CMake itself during bootstrap.
+ site_name(SITE)
+ endif()
# set the build name
if(NOT BUILDNAME)
set(DART_COMPILER "${CMAKE_CXX_COMPILER}")
@@ -256,8 +256,6 @@ if(BUILD_TESTING)
MAKECOMMAND
MEMORYCHECK_COMMAND
MEMORYCHECK_SUPPRESSIONS_FILE
- SLURM_SBATCH_COMMAND
- SLURM_SRUN_COMMAND
SITE
SVNCOMMAND
)
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index a01a2fea22..a6fa3a4c6c 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -39,7 +39,10 @@ After generating this tar file, it can be sent to CDash for display with the
upload to CDash. Relative paths will be interpreted with respect
to the top-level build directory.
- ``TARBALL_COMPRESSION <option>`` Specify a compression algorithm for the
+ ``TARBALL_COMPRESSION <option>``
+ .. versionadded:: 3.18
+
+ Specify a compression algorithm for the
``TARBALL`` data file. Using this option reduces the size of the data file
before it is submitted to CDash. ``<option>`` must be one of ``GZIP``,
``BZIP2``, ``XZ``, ``ZSTD``, ``FROM_EXT``, or an expression that CMake
@@ -68,15 +71,23 @@ After generating this tar file, it can be sent to CDash for display with the
If not specified, the default option is just ``-b -x``.
``GLOB``
+ .. versionadded:: 3.6
+
Recursively search for .gcda files in build_dir rather than
determining search locations by reading TargetDirectories.txt.
``DELETE``
+ .. versionadded:: 3.6
+
Delete coverage files after they've been packaged into the .tar.
``QUIET``
Suppress non-error messages that otherwise would have been
printed out by this function.
+
+ .. versionadded:: 3.3
+ Added support for the :variable:`CTEST_CUSTOM_COVERAGE_EXCLUDE` variable.
+
#]=======================================================================]
function(ctest_coverage_collect_gcov)
diff --git a/Modules/CTestUseLaunchers.cmake b/Modules/CTestUseLaunchers.cmake
index 3dff926052..23a206b2a5 100644
--- a/Modules/CTestUseLaunchers.cmake
+++ b/Modules/CTestUseLaunchers.cmake
@@ -24,9 +24,12 @@ long as your CMakeLists uses include(CTest) or
include(CTestUseLaunchers), it will use the value of the ENV variable
to initialize a CTEST_USE_LAUNCHERS cache variable. This cache
variable initialization only occurs if CTEST_USE_LAUNCHERS is not
-already defined. If CTEST_USE_LAUNCHERS is on in a ctest -S script
-the ctest_configure command will add -DCTEST_USE_LAUNCHERS:BOOL=TRUE
-to the cmake command used to configure the project.
+already defined.
+
+.. versionadded:: 3.8
+ If CTEST_USE_LAUNCHERS is on in a ctest -S script
+ the ctest_configure command will add -DCTEST_USE_LAUNCHERS:BOOL=TRUE
+ to the cmake command used to configure the project.
#]=======================================================================]
if(NOT DEFINED CTEST_USE_LAUNCHERS AND DEFINED ENV{CTEST_USE_LAUNCHERS_DEFAULT})
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index 698a007ebc..b24da49bc0 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -44,6 +44,8 @@ Check if given C source compiles and links into an executable.
directory property will be ignored.
``CMAKE_REQUIRED_LINK_OPTIONS``
+ .. versionadded:: 3.14
+
A :ref:`;-list <CMake Language Lists>` of options to add to the link
command (see :command:`try_compile` for further details).
@@ -54,6 +56,8 @@ Check if given C source compiles and links into an executable.
further details).
``CMAKE_REQUIRED_QUIET``
+ .. versionadded:: 3.1
+
If this variable evaluates to a boolean true value, all status messages
associated with the check will be suppressed.
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
index a99e47e833..a6081ff46e 100644
--- a/Modules/CheckCSourceRuns.cmake
+++ b/Modules/CheckCSourceRuns.cmake
@@ -43,6 +43,8 @@ subsequently be run.
directory property will be ignored.
``CMAKE_REQUIRED_LINK_OPTIONS``
+ .. versionadded:: 3.14
+
A :ref:`;-list <CMake Language Lists>` of options to add to the link
command (see :command:`try_run` for further details).
@@ -53,6 +55,8 @@ subsequently be run.
further details).
``CMAKE_REQUIRED_QUIET``
+ .. versionadded:: 3.1
+
If this variable evaluates to a boolean true value, all status messages
associated with the check will be suppressed.
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
index dc209b2688..502bfa76e6 100644
--- a/Modules/CheckCXXSourceCompiles.cmake
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -44,6 +44,8 @@ Check if given C++ source compiles and links into an executable.
directory property will be ignored.
``CMAKE_REQUIRED_LINK_OPTIONS``
+ .. versionadded:: 3.14
+
A :ref:`;-list <CMake Language Lists>` of options to add to the link
command (see :command:`try_compile` for further details).
@@ -54,6 +56,8 @@ Check if given C++ source compiles and links into an executable.
further details).
``CMAKE_REQUIRED_QUIET``
+ .. versionadded:: 3.1
+
If this variable evaluates to a boolean true value, all status messages
associated with the check will be suppressed.
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
index c8ff3d7bf5..af03453d98 100644
--- a/Modules/CheckCXXSourceRuns.cmake
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -43,6 +43,8 @@ subsequently be run.
directory property will be ignored.
``CMAKE_REQUIRED_LINK_OPTIONS``
+ .. versionadded:: 3.14
+
A :ref:`;-list <CMake Language Lists>` of options to add to the link
command (see :command:`try_run` for further details).
@@ -53,6 +55,8 @@ subsequently be run.
further details).
``CMAKE_REQUIRED_QUIET``
+ .. versionadded:: 3.1
+
If this variable evaluates to a boolean true value, all status messages
associated with the check will be suppressed.
diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake
index 5c9079dbf3..b4da4fac88 100644
--- a/Modules/CheckCXXSymbolExists.cmake
+++ b/Modules/CheckCXXSymbolExists.cmake
@@ -49,12 +49,14 @@ the way the check is run:
a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
the compiler.
``CMAKE_REQUIRED_LINK_OPTIONS``
- a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
+ .. versionadded:: 3.14
+ a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
``CMAKE_REQUIRED_LIBRARIES``
a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
command. See policy :policy:`CMP0075`.
``CMAKE_REQUIRED_QUIET``
- execute quietly without messages.
+ .. versionadded:: 3.1
+ execute quietly without messages.
For example:
diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake
index d06203fc23..ad72e2f09e 100644
--- a/Modules/CheckFortranFunctionExists.cmake
+++ b/Modules/CheckFortranFunctionExists.cmake
@@ -24,8 +24,9 @@ The following variables may be set before calling this macro to modify
the way the check is run:
``CMAKE_REQUIRED_LINK_OPTIONS``
- A :ref:`;-list <CMake Language Lists>` of options to add to the link
- command (see :command:`try_compile` for further details).
+ .. versionadded:: 3.14
+ A :ref:`;-list <CMake Language Lists>` of options to add to the link
+ command (see :command:`try_compile` for further details).
``CMAKE_REQUIRED_LIBRARIES``
A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake
index 5ede284572..e1343293b7 100644
--- a/Modules/CheckFortranSourceCompiles.cmake
+++ b/Modules/CheckFortranSourceCompiles.cmake
@@ -65,6 +65,8 @@ Check if given Fortran source compiles and links into an executable.
directory property will be ignored.
``CMAKE_REQUIRED_LINK_OPTIONS``
+ .. versionadded:: 3.14
+
A :ref:`;-list <CMake Language Lists>` of options to add to the link
command (see :command:`try_compile` for further details).
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index 136da89d9b..9efa132b43 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -28,12 +28,14 @@ way the check is run:
a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
the compiler.
``CMAKE_REQUIRED_LINK_OPTIONS``
- a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
+ .. versionadded:: 3.14
+ a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
``CMAKE_REQUIRED_LIBRARIES``
a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
command. See policy :policy:`CMP0075`.
``CMAKE_REQUIRED_QUIET``
- execute quietly without messages.
+ .. versionadded:: 3.1
+ execute quietly without messages.
.. note::
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake
index 1dd951d83c..0bc3c92338 100644
--- a/Modules/CheckIPOSupported.cmake
+++ b/Modules/CheckIPOSupported.cmake
@@ -33,6 +33,9 @@ property.
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.
+.. versionadded:: 3.13
+ Add support for Visual Studio generators.
+
Examples
^^^^^^^^
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
index 3a104736c6..71ddde7f21 100644
--- a/Modules/CheckIncludeFile.cmake
+++ b/Modules/CheckIncludeFile.cmake
@@ -29,12 +29,14 @@ the way the check is run:
a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
the compiler.
``CMAKE_REQUIRED_LINK_OPTIONS``
- a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
+ .. versionadded:: 3.14
+ a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
``CMAKE_REQUIRED_LIBRARIES``
a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
command. See policy :policy:`CMP0075`.
``CMAKE_REQUIRED_QUIET``
- execute quietly without messages.
+ .. versionadded:: 3.1
+ execute quietly without messages.
See the :module:`CheckIncludeFiles` module to check for multiple headers
at once. See the :module:`CheckIncludeFileCXX` module to check for headers
diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake
index 496550fa86..953224e763 100644
--- a/Modules/CheckIncludeFileCXX.cmake
+++ b/Modules/CheckIncludeFileCXX.cmake
@@ -29,12 +29,14 @@ the way the check is run:
a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
the compiler.
``CMAKE_REQUIRED_LINK_OPTIONS``
- a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
+ .. versionadded:: 3.14
+ a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
``CMAKE_REQUIRED_LIBRARIES``
a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
command. See policy :policy:`CMP0075`.
``CMAKE_REQUIRED_QUIET``
- execute quietly without messages.
+ .. versionadded:: 3.1
+ execute quietly without messages.
See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles`
to check for one or more ``C`` headers.
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 8e10cd6abb..1800ca888e 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -35,12 +35,14 @@ the way the check is run:
a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
the compiler.
``CMAKE_REQUIRED_LINK_OPTIONS``
- a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
+ .. versionadded:: 3.14
+ a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
``CMAKE_REQUIRED_LIBRARIES``
a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
command. See policy :policy:`CMP0075`.
``CMAKE_REQUIRED_QUIET``
- execute quietly without messages.
+ .. versionadded:: 3.1
+ execute quietly without messages.
See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX`
to check for a single header file in ``C`` or ``CXX`` languages.
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index 44387d4b44..928881cab1 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -68,6 +68,11 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
else()
set(_D_CMAKE_MAKE_PROGRAM "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}")
endif()
+ if(CMAKE_TOOLCHAIN_FILE)
+ set(_D_CMAKE_TOOLCHAIN_FILE "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}")
+ else()
+ set(_D_CMAKE_TOOLCHAIN_FILE "")
+ endif()
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}
COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR}
@@ -75,6 +80,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
-T "${CMAKE_GENERATOR_TOOLSET}"
${_D_CMAKE_GENERATOR_INSTANCE}
${_D_CMAKE_MAKE_PROGRAM}
+ ${_D_CMAKE_TOOLCHAIN_FILE}
OUTPUT_VARIABLE _cl_output
ERROR_VARIABLE _cl_output
RESULT_VARIABLE _cl_result
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index 6470dfd049..804e0cbba3 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -26,13 +26,18 @@ Check if the function exists.
The following variables may be set before calling this macro to modify
the way the check is run:
-::
-
- CMAKE_REQUIRED_FLAGS = string of compile command line flags
- CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
- CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command
- CMAKE_REQUIRED_LIBRARIES = list of libraries to link
- CMAKE_REQUIRED_QUIET = execute quietly without messages
+``CMAKE_REQUIRED_FLAGS``
+ string of compile command line flags.
+``CMAKE_REQUIRED_DEFINITIONS``
+ list of macros to define (-DFOO=bar).
+``CMAKE_REQUIRED_LINK_OPTIONS``
+ .. versionadded:: 3.14
+ list of options to pass to link command.
+``CMAKE_REQUIRED_LIBRARIES``
+ list of libraries to link.
+``CMAKE_REQUIRED_QUIET``
+ .. versionadded:: 3.1
+ execute quietly without messages.
#]=======================================================================]
include_guard(GLOBAL)
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
index 8b06403d7e..d29c5e89f3 100644
--- a/Modules/CheckPrototypeDefinition.cmake
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -35,14 +35,20 @@ Check if the prototype we expect is correct.
The following variables may be set before calling this function to modify
the way the check is run:
-::
-
- CMAKE_REQUIRED_FLAGS = string of compile command line flags
- CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
- CMAKE_REQUIRED_INCLUDES = list of include directories
- CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command
- CMAKE_REQUIRED_LIBRARIES = list of libraries to link
- CMAKE_REQUIRED_QUIET = execute quietly without messages
+``CMAKE_REQUIRED_FLAGS``
+ string of compile command line flags.
+``CMAKE_REQUIRED_DEFINITIONS``
+ list of macros to define (-DFOO=bar).
+``CMAKE_REQUIRED_INCLUDES``
+ list of include directories.
+``CMAKE_REQUIRED_LINK_OPTIONS``
+ .. versionadded:: 3.14
+ list of options to pass to link command.
+``CMAKE_REQUIRED_LIBRARIES``
+ list of libraries to link.
+``CMAKE_REQUIRED_QUIET``
+ .. versionadded:: 3.1
+ execute quietly without messages.
#]=======================================================================]
#
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index 842a8fdb72..8217c84c2a 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -23,18 +23,23 @@ Check if the given struct or class has the specified member variable
<language> - the compiler to use (C or CXX)
-
The following variables may be set before calling this macro to modify
the way the check is run:
-::
-
- CMAKE_REQUIRED_FLAGS = string of compile command line flags
- CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
- CMAKE_REQUIRED_INCLUDES = list of include directories
- CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command
- CMAKE_REQUIRED_LIBRARIES = list of libraries to link
- CMAKE_REQUIRED_QUIET = execute quietly without messages
+``CMAKE_REQUIRED_FLAGS``
+ string of compile command line flags.
+``CMAKE_REQUIRED_DEFINITIONS``
+ list of macros to define (-DFOO=bar).
+``CMAKE_REQUIRED_INCLUDES``
+ list of include directories.
+``CMAKE_REQUIRED_LINK_OPTIONS``
+ .. versionadded:: 3.14
+ list of options to pass to link command.
+``CMAKE_REQUIRED_LIBRARIES``
+ list of libraries to link.
+``CMAKE_REQUIRED_QUIET``
+ .. versionadded:: 3.1
+ execute quietly without messages.
Example:
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index 4f202c41d5..f8ca584026 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -39,12 +39,14 @@ the way the check is run:
a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
the compiler.
``CMAKE_REQUIRED_LINK_OPTIONS``
- a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
+ .. versionadded:: 3.14
+ a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
``CMAKE_REQUIRED_LIBRARIES``
a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
command. See policy :policy:`CMP0075`.
``CMAKE_REQUIRED_QUIET``
- execute quietly without messages.
+ .. versionadded:: 3.1
+ execute quietly without messages.
For example:
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index 17beadcb10..69f68f9d4a 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -57,19 +57,25 @@ member you can do something like this:
check_type_size("((struct something*)0)->member" SIZEOF_MEMBER)
-
The following variables may be set before calling this macro to modify
the way the check is run:
-::
-
- CMAKE_REQUIRED_FLAGS = string of compile command line flags
- CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
- CMAKE_REQUIRED_INCLUDES = list of include directories
- CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command
- CMAKE_REQUIRED_LIBRARIES = list of libraries to link
- CMAKE_REQUIRED_QUIET = execute quietly without messages
- CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include
+``CMAKE_REQUIRED_FLAGS``
+ string of compile command line flags.
+``CMAKE_REQUIRED_DEFINITIONS``
+ list of macros to define (-DFOO=bar).
+``CMAKE_REQUIRED_INCLUDES``
+ list of include directories.
+``CMAKE_REQUIRED_LINK_OPTIONS``
+ .. versionadded:: 3.14
+ list of options to pass to link command.
+``CMAKE_REQUIRED_LIBRARIES``
+ list of libraries to link.
+``CMAKE_REQUIRED_QUIET``
+ .. versionadded:: 3.1
+ execute quietly without messages.
+``CMAKE_EXTRA_INCLUDE_FILES``
+ list of extra headers to include.
#]=======================================================================]
include(CheckIncludeFile)
diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake
index 8a93535249..7420124f48 100644
--- a/Modules/CheckVariableExists.cmake
+++ b/Modules/CheckVariableExists.cmake
@@ -26,13 +26,18 @@ Check if the variable exists.
The following variables may be set before calling this macro to modify
the way the check is run:
-::
-
- CMAKE_REQUIRED_FLAGS = string of compile command line flags
- CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
- CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command
- CMAKE_REQUIRED_LIBRARIES = list of libraries to link
- CMAKE_REQUIRED_QUIET = execute quietly without messages
+``CMAKE_REQUIRED_FLAGS``
+ string of compile command line flags.
+``CMAKE_REQUIRED_DEFINITIONS``
+ list of macros to define (-DFOO=bar).
+``CMAKE_REQUIRED_LINK_OPTIONS``
+ .. versionadded:: 3.14
+ list of options to pass to link command.
+``CMAKE_REQUIRED_LIBRARIES``
+ list of libraries to link.
+``CMAKE_REQUIRED_QUIET``
+ .. versionadded:: 3.1
+ execute quietly without messages.
#]=======================================================================]
include_guard(GLOBAL)
diff --git a/Modules/Compiler/ARMCC.cmake b/Modules/Compiler/ARMCC.cmake
index f949568218..f4f1854a17 100644
--- a/Modules/Compiler/ARMCC.cmake
+++ b/Modules/Compiler/ARMCC.cmake
@@ -33,7 +33,7 @@ macro(__compiler_armcc lang)
set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> --list <TARGET_BASE>.map")
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
- set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEPFILE> --depend_single_line --no_depend_system_headers")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEP_FILE> --depend_single_line --no_depend_system_headers")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ")
endmacro()
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index 2794f52bbb..bd9819350a 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -1,6 +1,19 @@
include(Compiler/Clang)
__compiler_clang(C)
+
+if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_C_DEPFILE_FORMAT gcc)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+ endif()
+endif()
+
+set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
+
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index 15edc21e99..28be1dfd59 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -1,7 +1,17 @@
include(Compiler/Clang)
__compiler_clang(CXX)
+set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
+
if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles"
+ AND CMAKE_DEPFILE_FLAGS_CXX)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_CXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+ endif()
+
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
diff --git a/Modules/Compiler/AppleClang-OBJC.cmake b/Modules/Compiler/AppleClang-OBJC.cmake
index d1f37062e9..d4eab4f63a 100644
--- a/Modules/Compiler/AppleClang-OBJC.cmake
+++ b/Modules/Compiler/AppleClang-OBJC.cmake
@@ -1,5 +1,14 @@
include(Compiler/Clang-OBJC)
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles"
+ AND CMAKE_DEPFILE_FLAGS_OBJC)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_OBJC_DEPFILE_FORMAT gcc)
+ set(CMAKE_OBJC_DEPENDS_USE_COMPILER TRUE)
+endif()
+
+
if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_OBJC90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_OBJC90_EXTENSION_COMPILE_OPTION "-std=gnu90")
diff --git a/Modules/Compiler/AppleClang-OBJCXX.cmake b/Modules/Compiler/AppleClang-OBJCXX.cmake
index 409bd4a2e8..172a3438cd 100644
--- a/Modules/Compiler/AppleClang-OBJCXX.cmake
+++ b/Modules/Compiler/AppleClang-OBJCXX.cmake
@@ -1,5 +1,15 @@
include(Compiler/Clang-OBJCXX)
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles"
+ AND CMAKE_DEPFILE_FLAGS_OBJCXX)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_OBJCXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_OBJCXX_DEPENDS_USE_COMPILER TRUE)
+endif()
+
+
set(CMAKE_OBJCXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 4.0)
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
index 409b65a5f5..cd897c527e 100644
--- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake
+++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
@@ -93,21 +93,14 @@ endmacro()
# Define to allow compile features to be automatically determined
macro(cmake_record_cxx_compile_features)
set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_CXX23_STANDARD_COMPILE_OPTION)
+ _has_compiler_features_cxx(23)
+ endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION)
- if(CMAKE_CXX20_STANDARD__HAS_FULL_SUPPORT)
- _has_compiler_features_cxx(20)
- else()
- _record_compiler_features_cxx(20)
- endif()
- unset(CMAKE_CXX20_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cxx(20)
endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION)
- if(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT)
- _has_compiler_features_cxx(17)
- else()
- _record_compiler_features_cxx(17)
- endif()
- unset(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cxx(17)
endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION)
if(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT)
@@ -137,21 +130,14 @@ endmacro()
macro(cmake_record_cuda_compile_features)
set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_CUDA23_STANDARD_COMPILE_OPTION)
+ _has_compiler_features_cuda(23)
+ endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CUDA20_STANDARD_COMPILE_OPTION)
- if(CMAKE_CUDA20_STANDARD__HAS_FULL_SUPPORT)
- _has_compiler_features_cuda(20)
- else()
- _record_compiler_features_cuda(20)
- endif()
- unset(CMAKE_CUDA20_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cuda(20)
endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CUDA17_STANDARD_COMPILE_OPTION)
- if(CMAKE_CUDA17_STANDARD__HAS_FULL_SUPPORT)
- _has_compiler_features_cuda(17)
- else()
- _record_compiler_features_cuda(17)
- endif()
- unset(CMAKE_CUDA17_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cuda(17)
endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CUDA14_STANDARD_COMPILE_OPTION)
if(CMAKE_CUDA14_STANDARD__HAS_FULL_SUPPORT)
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index 7c4a263f6a..5609abf47e 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -7,7 +7,22 @@ if(APPLE AND NOT appleClangPolicy STREQUAL NEW)
endif()
if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
+ set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TC)
set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+ endif()
+elseif("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
+ set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_C_DEPFILE_FORMAT gcc)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+ endif()
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
diff --git a/Modules/Compiler/Clang-CUDA.cmake b/Modules/Compiler/Clang-CUDA.cmake
index fd8c2b7c94..cafc7ddd1e 100644
--- a/Modules/Compiler/Clang-CUDA.cmake
+++ b/Modules/Compiler/Clang-CUDA.cmake
@@ -2,7 +2,13 @@ include(Compiler/Clang)
__compiler_clang(CUDA)
# Set explicitly, because __compiler_clang() doesn't set this if we're simulating MSVC.
-set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <OBJECT> -MF <DEPFILE>")
+set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")
+ # dependencies are computed by the compiler itself
+ set(CMAKE_CUDA_DEPFILE_FORMAT gcc)
+ set(CMAKE_CUDA_DEPENDS_USE_COMPILER TRUE)
+endif()
# C++03 isn't supported for CXX, but is for CUDA, so we need to set these manually.
# Do this before __compiler_clang_cxx_standards() since that adds the feature.
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 789e991594..98828e0119 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -3,6 +3,15 @@ __compiler_clang(CXX)
__compiler_clang_cxx_standards(CXX)
if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_CXX)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_CXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+ endif()
+
+ set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
@@ -13,4 +22,9 @@ endif()
if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles"
+ AND CMAKE_DEPFILE_FLAGS_CXX)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+ endif()
endif()
diff --git a/Modules/Compiler/Clang-FindBinUtils.cmake b/Modules/Compiler/Clang-FindBinUtils.cmake
index b8526600e7..e6c469a10e 100644
--- a/Modules/Compiler/Clang-FindBinUtils.cmake
+++ b/Modules/Compiler/Clang-FindBinUtils.cmake
@@ -2,6 +2,12 @@ if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL
message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set")
endif()
+# Ubuntu:
+# * /usr/bin/llvm-ar-9
+# * /usr/bin/llvm-ranlib-9
+string(REGEX MATCH "^([0-9]+)" __version_x
+ "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}")
+
# Debian:
# * /usr/bin/llvm-ar-4.0
# * /usr/bin/llvm-ranlib-4.0
@@ -19,6 +25,7 @@ set(__clang_hints ${__clang_hint_1} ${__clang_hint_2})
# http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ar.1.html
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES
"${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar-${__version_x_y}"
+ "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar-${__version_x}"
"${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar"
HINTS ${__clang_hints}
DOC "LLVM archiver"
@@ -28,6 +35,7 @@ mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR)
# http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ranlib.1.html
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES
"${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib-${__version_x_y}"
+ "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib-${__version_x}"
"${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib"
HINTS ${__clang_hints}
DOC "Generate index for LLVM archive"
diff --git a/Modules/Compiler/Clang-OBJC.cmake b/Modules/Compiler/Clang-OBJC.cmake
index c61c497fc2..19179e36e5 100644
--- a/Modules/Compiler/Clang-OBJC.cmake
+++ b/Modules/Compiler/Clang-OBJC.cmake
@@ -1,6 +1,15 @@
include(Compiler/Clang)
__compiler_clang(OBJC)
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_OBJC)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_OBJC_DEPFILE_FORMAT gcc)
+ set(CMAKE_OBJC_DEPENDS_USE_COMPILER TRUE)
+endif()
+
+
if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_OBJC90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_OBJC90_EXTENSION_COMPILE_OPTION "-std=gnu90")
diff --git a/Modules/Compiler/Clang-OBJCXX.cmake b/Modules/Compiler/Clang-OBJCXX.cmake
index 453b5fd7ba..9bdff663fa 100644
--- a/Modules/Compiler/Clang-OBJCXX.cmake
+++ b/Modules/Compiler/Clang-OBJCXX.cmake
@@ -1,3 +1,11 @@
include(Compiler/Clang)
__compiler_clang(OBJCXX)
__compiler_clang_cxx_standards(OBJCXX)
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_OBJCXX)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_OBJCXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_OBJCXX_DEPENDS_USE_COMPILER TRUE)
+endif()
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index c43265d585..9f93d4188b 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -77,7 +77,7 @@ else()
set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto")
endif()
- if(ANDROID)
+ if(ANDROID AND NOT CMAKE_ANDROID_NDK_VERSION VERSION_GREATER_EQUAL "22")
# https://github.com/android-ndk/ndk/issues/242
set(CMAKE_${lang}_LINK_OPTIONS_IPO "-fuse-ld=gold")
endif()
@@ -154,10 +154,6 @@ macro(__compiler_clang_cxx_standards lang)
set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
- if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 6.0)
- set(CMAKE_${lang}17_STANDARD__HAS_FULL_SUPPORT ON)
- endif()
-
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0)
set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20")
set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
@@ -168,6 +164,11 @@ macro(__compiler_clang_cxx_standards lang)
unset(_clang_version_std17)
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0)
+ set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++2b")
+ set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++2b")
+ endif()
+
if("x${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "xMSVC")
# The MSVC standard library requires C++14, and MSVC itself has no
# notion of operating in a mode not aware of at least that standard.
@@ -179,8 +180,6 @@ macro(__compiler_clang_cxx_standards lang)
# This clang++ is missing some features because of MSVC compatibility.
unset(CMAKE_${lang}11_STANDARD__HAS_FULL_SUPPORT)
unset(CMAKE_${lang}14_STANDARD__HAS_FULL_SUPPORT)
- unset(CMAKE_${lang}17_STANDARD__HAS_FULL_SUPPORT)
- unset(CMAKE_${lang}20_STANDARD__HAS_FULL_SUPPORT)
endif()
__compiler_check_default_language_standard(${lang} 2.1 98)
@@ -220,6 +219,8 @@ macro(__compiler_clang_cxx_standards lang)
set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "")
set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "")
set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "")
# There is no meaningful default for this
set(CMAKE_${lang}_STANDARD_DEFAULT "")
@@ -235,6 +236,7 @@ macro(__compiler_clang_cxx_standards lang)
cxx_std_14
cxx_std_17
cxx_std_20
+ cxx_std_23
)
_record_compiler_features(${lang} "" CMAKE_${lang}_COMPILE_FEATURES)
endmacro()
diff --git a/Modules/Compiler/Cray-Fortran.cmake b/Modules/Compiler/Cray-Fortran.cmake
index 696ae76074..0d5e1c7679 100644
--- a/Modules/Compiler/Cray-Fortran.cmake
+++ b/Modules/Compiler/Cray-Fortran.cmake
@@ -19,3 +19,7 @@ else()
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-eZ")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-dZ")
endif()
+
+if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 11.0)
+ set(CMAKE_Fortran_PREPROCESS_SOURCE "<CMAKE_Fortran_COMPILER> -o <PREPROCESSED_SOURCE> <DEFINES> <INCLUDES> <FLAGS> -eP <SOURCE>")
+endif()
diff --git a/Modules/Compiler/GNU-ASM.cmake b/Modules/Compiler/GNU-ASM.cmake
index 94af401da5..a935416714 100644
--- a/Modules/Compiler/GNU-ASM.cmake
+++ b/Modules/Compiler/GNU-ASM.cmake
@@ -6,7 +6,7 @@ set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm)
__compiler_gnu(ASM)
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH STREQUAL "GNU assembler")
- set(CMAKE_DEPFILE_FLAGS_ASM${ASM_DIALECT} "--MD <DEPFILE>")
+ set(CMAKE_DEPFILE_FLAGS_ASM${ASM_DIALECT} "--MD <DEP_FILE>")
set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
"<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_ASM_DEFINE_FLAG "--defsym ")
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index ca286b3975..86b4d83e54 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -1,6 +1,17 @@
include(Compiler/GNU)
__compiler_gnu(C)
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_C_DEPFILE_FORMAT gcc)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+endif()
+
+set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
+
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index fcaaeab433..758d3c783f 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -1,6 +1,17 @@
include(Compiler/GNU)
__compiler_gnu(CXX)
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_CXX)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_CXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+endif()
+
+set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
+
if (WIN32)
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fno-keep-inline-dllexport")
diff --git a/Modules/Compiler/GNU-OBJC.cmake b/Modules/Compiler/GNU-OBJC.cmake
index fb9b0b2a56..7eeed833b8 100644
--- a/Modules/Compiler/GNU-OBJC.cmake
+++ b/Modules/Compiler/GNU-OBJC.cmake
@@ -1,2 +1,11 @@
include(Compiler/GNU)
__compiler_gnu(OBJC)
+
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_OBJC)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_OBJC_DEPFILE_FORMAT gcc)
+ set(CMAKE_OBJC_DEPENDS_USE_COMPILER TRUE)
+endif()
diff --git a/Modules/Compiler/GNU-OBJCXX.cmake b/Modules/Compiler/GNU-OBJCXX.cmake
index 06f0244dac..1047b5d33f 100644
--- a/Modules/Compiler/GNU-OBJCXX.cmake
+++ b/Modules/Compiler/GNU-OBJCXX.cmake
@@ -1,6 +1,15 @@
include(Compiler/GNU)
__compiler_gnu(OBJCXX)
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_OBJCXX)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_OBJCXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_OBJCXX_DEPENDS_USE_COMPILER TRUE)
+endif()
+
+
if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 4.2)
set(CMAKE_OBJCXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 81ab3a2f70..928e7263fc 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -48,7 +48,7 @@ macro(__compiler_gnu lang)
# distcc does not transform -o to -MT when invoking the preprocessor
# internally, as it ought to. Work around this bug by setting -MT here
# even though it isn't strictly necessary.
- set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <OBJECT> -MF <DEPFILE>")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
endif()
# Initial configuration flags.
diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake
index 936d4ae30b..e3ca16edca 100644
--- a/Modules/Compiler/IAR-ASM.cmake
+++ b/Modules/Compiler/IAR-ASM.cmake
@@ -47,6 +47,11 @@ elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051")
__compiler_iar_xlink(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s51;asm;msa)
+elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8")
+ set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
+ __compiler_iar_ilink(ASM)
+ set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa)
+
else()
message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.")
endif()
diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake
index e27fdfcb80..054ee74c17 100644
--- a/Modules/Compiler/IAR-C.cmake
+++ b/Modules/Compiler/IAR-C.cmake
@@ -70,6 +70,10 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051")
__compiler_check_default_language_standard(C 6.10 90 8.10 99)
set(CMAKE_C_OUTPUT_EXTENSION ".r51")
+elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8")
+ __compiler_iar_ilink(C)
+ __compiler_check_default_language_standard(C 3.11 90 3.11 99)
+
else()
message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.")
endif()
diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake
index eca89c5411..d93b27289f 100644
--- a/Modules/Compiler/IAR-CXX.cmake
+++ b/Modules/Compiler/IAR-CXX.cmake
@@ -78,6 +78,10 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051")
__compiler_check_default_language_standard(CXX 6.10 98)
set(CMAKE_C_OUTPUT_EXTENSION ".r51")
+elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8")
+ __compiler_iar_ilink(CXX)
+ __compiler_check_default_language_standard(CXX 3.11 98)
+
else()
message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected. This should be automatic." )
endif()
diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake
index 0a026b2e86..443b09c322 100644
--- a/Modules/Compiler/IAR-DetermineCompiler.cmake
+++ b/Modules/Compiler/IAR-DetermineCompiler.cmake
@@ -31,7 +31,7 @@ set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(((__VER__) / 1000) % 1000)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@((__VER__) % 1000)
# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__)
-# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__))
+# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 100)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__VER__) - (((__VER__) / 100)*100))
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__SUBVERSION__)
diff --git a/Modules/Compiler/IAR-FindBinUtils.cmake b/Modules/Compiler/IAR-FindBinUtils.cmake
index 6ef3759bab..6c67d34793 100644
--- a/Modules/Compiler/IAR-FindBinUtils.cmake
+++ b/Modules/Compiler/IAR-FindBinUtils.cmake
@@ -14,7 +14,8 @@ if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "A
"${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX" OR
"${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850" OR
"${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78" OR
- "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISCV")
+ "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISCV" OR
+ "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8")
string(TOLOWER "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" _archid_lower)
diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake
index f3938a9a21..b8c0770091 100644
--- a/Modules/Compiler/IAR.cmake
+++ b/Modules/Compiler/IAR.cmake
@@ -49,7 +49,7 @@ macro(__compiler_iar_ilink lang)
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy")
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-f ")
- set(CMAKE_DEPFILE_FLAGS_${lang} "--dependencies=ns <DEPFILE>")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "--dependencies=ns <DEP_FILE>")
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -r")
@@ -85,7 +85,7 @@ macro(__compiler_iar_xlink lang)
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy")
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-f ")
- set(CMAKE_DEPFILE_FLAGS_${lang} "--dependencies=ns <DEPFILE>")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "--dependencies=ns <DEP_FILE>")
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -r")
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index ec3bfd88fa..ead9069f35 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -5,10 +5,17 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG")
-set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <OBJECT> -MF <DEPFILE>")
+set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")
+ # dependencies are computed by the compiler itself
+ set(CMAKE_C_DEPFILE_FORMAT gcc)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+endif()
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TC)
set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 16.0.0)
@@ -28,6 +35,8 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
else()
+ set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
+
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")
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index b71b946e92..37f339a77d 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -5,7 +5,13 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG")
-set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <OBJECT> -MF <DEPFILE>")
+set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")
+ # dependencies are computed by the compiler itself
+ set(CMAKE_CXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+endif()
if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
@@ -42,6 +48,8 @@ if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
else()
+ set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
+
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
diff --git a/Modules/Compiler/Intel-ISPC.cmake b/Modules/Compiler/Intel-ISPC.cmake
index aa9ecea19f..be64cf79fb 100644
--- a/Modules/Compiler/Intel-ISPC.cmake
+++ b/Modules/Compiler/Intel-ISPC.cmake
@@ -3,7 +3,13 @@ include(Compiler/CMakeCommonCompilerMacros)
# Not aware of any verbose flag for ISPC
#set(CMAKE_ISPC_VERBOSE_FLAG )
-set(CMAKE_DEPFILE_FLAGS_ISPC "-M -MT <OBJECT> -MF <DEPFILE>")
+set(CMAKE_DEPFILE_FLAGS_ISPC "-M -MT <DEP_TARGET> -MF <DEP_FILE>")
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")
+ # dependencies are computed by the compiler itself
+ set(CMAKE_ISPC_DEPFILE_FORMAT gcc)
+ set(CMAKE_ISPC_DEPENDS_USE_COMPILER TRUE)
+endif()
string(APPEND CMAKE_ISPC_FLAGS_INIT " ")
string(APPEND CMAKE_ISPC_FLAGS_DEBUG_INIT "-O0 -g")
diff --git a/Modules/Compiler/IntelLLVM-ASM.cmake b/Modules/Compiler/IntelLLVM-ASM.cmake
new file mode 100644
index 0000000000..c258a0a24c
--- /dev/null
+++ b/Modules/Compiler/IntelLLVM-ASM.cmake
@@ -0,0 +1,12 @@
+include(Compiler/IntelLLVM)
+__compiler_intel_llvm(ASM)
+
+string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG")
+
+if(UNIX)
+ set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S)
+else()
+ set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm)
+endif()
diff --git a/Modules/Compiler/IntelLLVM-C.cmake b/Modules/Compiler/IntelLLVM-C.cmake
new file mode 100644
index 0000000000..fce2971cac
--- /dev/null
+++ b/Modules/Compiler/IntelLLVM-C.cmake
@@ -0,0 +1,58 @@
+include(Compiler/IntelLLVM)
+__compiler_intel_llvm(C)
+
+if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
+ set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TC)
+ set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+ endif()
+else()
+ set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_C_DEPFILE_FORMAT gcc)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+ endif()
+
+ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+ string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
+ string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG")
+endif()
+
+set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+
+if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
+
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+else()
+ # clang-cl doesn't have any of these
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
+
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
+
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
+endif()
+
+if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+ # FIXME: The compiler actually defaults to C17, but
+ # CMake does not yet model or detect that standard.
+ __compiler_check_default_language_standard(C 2020 11)
+else()
+ set(CMAKE_C_STANDARD_DEFAULT "")
+endif()
diff --git a/Modules/Compiler/IntelLLVM-CXX.cmake b/Modules/Compiler/IntelLLVM-CXX.cmake
new file mode 100644
index 0000000000..4c0c26e2e9
--- /dev/null
+++ b/Modules/Compiler/IntelLLVM-CXX.cmake
@@ -0,0 +1,69 @@
+include(Compiler/IntelLLVM)
+__compiler_intel_llvm(CXX)
+
+if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
+ set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TP)
+ set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_CXX)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+ endif()
+else()
+ set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_CXX)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_CXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+ endif()
+
+ set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+
+ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
+ string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG")
+endif()
+
+set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+
+if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+
+ set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
+ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
+else()
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
+
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++11")
+
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-Qstd=c++14")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-Qstd=c++14")
+
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-Qstd=c++17")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-Qstd=c++17")
+
+ set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-Qstd=c++20")
+ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-Qstd=c++20")
+endif()
+
+if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ __compiler_check_default_language_standard(CXX 2020 14)
+else()
+ set(CMAKE_CXX_STANDARD_DEFAULT "")
+endif()
diff --git a/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake b/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake
new file mode 100644
index 0000000000..124dafe69b
--- /dev/null
+++ b/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake
@@ -0,0 +1,41 @@
+
+set(_compiler_id_pp_test "(defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)")
+
+set(_compiler_id_version_compute "
+/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
+ * later. Look for 6 digit vs. 8 digit version number to decide encoding.
+ * VVVV is no smaller than the current year when a versio is released.
+ */
+#if __INTEL_LLVM_COMPILER < 1000000L
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEL_LLVM_COMPILER/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEL_LLVM_COMPILER/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_LLVM_COMPILER % 10)
+#else
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEL_LLVM_COMPILER/10000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEL_LLVM_COMPILER/100 % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_LLVM_COMPILER % 100)
+#endif
+#if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+#endif
+#if defined(__GNUC__)
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(__GNUC__)
+#elif defined(__GNUG__)
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(__GNUG__)
+#endif
+#if defined(__GNUC_MINOR__)
+# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__)
+#endif
+#if defined(__GNUC_PATCHLEVEL__)
+# define @PREFIX@SIMULATE_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__)
+#endif")
+
+set(_compiler_id_simulate "
+#if defined(_MSC_VER)
+# define @PREFIX@SIMULATE_ID \"MSVC\"
+#endif
+#if defined(__GNUC__)
+# define @PREFIX@SIMULATE_ID \"GNU\"
+#endif")
diff --git a/Modules/Compiler/IntelLLVM-Fortran.cmake b/Modules/Compiler/IntelLLVM-Fortran.cmake
new file mode 100644
index 0000000000..710803f018
--- /dev/null
+++ b/Modules/Compiler/IntelLLVM-Fortran.cmake
@@ -0,0 +1,27 @@
+include(Compiler/IntelLLVM)
+__compiler_intel_llvm(Fortran)
+
+set(CMAKE_Fortran_SUBMODULE_SEP "@")
+set(CMAKE_Fortran_SUBMODULE_EXT ".smod")
+
+set(CMAKE_Fortran_MODDIR_FLAG "-module ")
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
+
+set(CMAKE_Fortran_COMPILE_WITH_DEFINES 1)
+
+set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+
+if(CMAKE_HOST_WIN32)
+ # MSVC-like
+ set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -P <SOURCE> -Fi<PREPROCESSED_SOURCE>")
+else()
+ # GNU-like
+ set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -P <SOURCE> -o <PREPROCESSED_SOURCE>")
+endif()
+
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-fpp")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nofpp")
diff --git a/Modules/Compiler/IntelLLVM.cmake b/Modules/Compiler/IntelLLVM.cmake
new file mode 100644
index 0000000000..14b7ad83c7
--- /dev/null
+++ b/Modules/Compiler/IntelLLVM.cmake
@@ -0,0 +1,92 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__COMPILER_LLVM_INTEL)
+ return()
+endif()
+set(__COMPILER_LLVM_INTEL 1)
+
+include(Compiler/CMakeCommonCompilerMacros)
+
+set(__pch_header_C "c-header")
+set(__pch_header_CXX "c++-header")
+set(__pch_header_OBJC "objective-c-header")
+set(__pch_header_OBJCXX "objective-c++-header")
+
+if(CMAKE_HOST_WIN32)
+ # MSVC-like
+ macro(__compiler_intel_llvm lang)
+ if(NOT "x${lang}" STREQUAL "xFortran")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch)
+ endif()
+ endmacro()
+else()
+ # GNU-like
+ macro(__compiler_intel_llvm lang)
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v")
+
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
+
+ set(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER YES)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(CMAKE_${lang}_LINK_OPTIONS_PIE ${CMAKE_${lang}_COMPILE_OPTIONS_PIE} "-pie")
+ set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "-no-pie")
+
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+
+ # distcc does not transform -o to -MT when invoking the preprocessor
+ # internally, as it ought to. Work around this bug by setting -MT here
+ # even though it isn't strictly necessary.
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
+
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "--target=")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "--sysroot=")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "--gcc-toolchain=")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP)
+
+ set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
+ set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto=thin")
+ set(CMAKE_${lang}_ARCHIVE_CREATE_IPO "\"${CMAKE_${lang}_COMPILER_AR}\" cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_APPEND_IPO "\"${CMAKE_${lang}_COMPILER_AR}\" r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_FINISH_IPO "\"${CMAKE_${lang}_COMPILER_RANLIB}\" <TARGET>")
+
+ set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+
+ set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}")
+ if(CMAKE_${lang}_COMPILER_ARG1)
+ separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}")
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS})
+ unset(_COMPILER_ARGS)
+ endif()
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
+ if(CMAKE_${lang}_COMPILER_TARGET)
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "--target=${CMAKE_${lang}_COMPILER_TARGET}")
+ endif()
+
+ if(NOT "x${lang}" STREQUAL "xFortran")
+ # Precompile Headers
+ set(CMAKE_PCH_EXTENSION .pch)
+ set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER> -x ${__pch_header_${lang}})
+ endif()
+ endmacro()
+endif()
diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake
index 31ae7fdecb..9a5104bd90 100644
--- a/Modules/Compiler/MSVC-C.cmake
+++ b/Modules/Compiler/MSVC-C.cmake
@@ -27,6 +27,7 @@ else()
set(CMAKE_C_STANDARD_DEFAULT "")
endif()
+set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TC)
set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")
# There are no C compiler modes so we hard-code the known compiler supported
diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake
index ffce97ef7b..a65fd2c5a9 100644
--- a/Modules/Compiler/NAG-Fortran.cmake
+++ b/Modules/Compiler/NAG-Fortran.cmake
@@ -31,6 +31,7 @@ endif()
set(CMAKE_Fortran_SUBMODULE_SEP ".")
set(CMAKE_Fortran_SUBMODULE_EXT ".sub")
set(CMAKE_Fortran_MODDIR_FLAG "-mdir ")
+set(CMAKE_Fortran_MODDIR_INCLUDE_FLAG "-I") # -mdir does not affect search path
set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
diff --git a/Modules/Compiler/NVHPC-C.cmake b/Modules/Compiler/NVHPC-C.cmake
new file mode 100644
index 0000000000..d16c72b76e
--- /dev/null
+++ b/Modules/Compiler/NVHPC-C.cmake
@@ -0,0 +1,3 @@
+include(Compiler/PGI-C)
+include(Compiler/NVHPC)
+__compiler_nvhpc(C)
diff --git a/Modules/Compiler/NVHPC-CXX.cmake b/Modules/Compiler/NVHPC-CXX.cmake
new file mode 100644
index 0000000000..18ace8bfe6
--- /dev/null
+++ b/Modules/Compiler/NVHPC-CXX.cmake
@@ -0,0 +1,3 @@
+include(Compiler/PGI-CXX)
+include(Compiler/NVHPC)
+__compiler_nvhpc(CXX)
diff --git a/Modules/Compiler/NVHPC-DetermineCompiler.cmake b/Modules/Compiler/NVHPC-DetermineCompiler.cmake
new file mode 100644
index 0000000000..45b69e18eb
--- /dev/null
+++ b/Modules/Compiler/NVHPC-DetermineCompiler.cmake
@@ -0,0 +1,9 @@
+
+set(_compiler_id_pp_test "defined(__NVCOMPILER)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__NVCOMPILER_MAJOR__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__NVCOMPILER_MINOR__)
+# if defined(__NVCOMPILER_PATCHLEVEL__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__NVCOMPILER_PATCHLEVEL__)
+# endif")
diff --git a/Modules/Compiler/NVHPC-Fortran.cmake b/Modules/Compiler/NVHPC-Fortran.cmake
new file mode 100644
index 0000000000..59755b3a71
--- /dev/null
+++ b/Modules/Compiler/NVHPC-Fortran.cmake
@@ -0,0 +1,3 @@
+include(Compiler/PGI-Fortran)
+include(Compiler/NVHPC)
+__compiler_nvhpc(Fortran)
diff --git a/Modules/Compiler/NVHPC.cmake b/Modules/Compiler/NVHPC.cmake
new file mode 100644
index 0000000000..70486705c1
--- /dev/null
+++ b/Modules/Compiler/NVHPC.cmake
@@ -0,0 +1,15 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__COMPILER_NVHPC)
+ return()
+endif()
+set(__COMPILER_NVHPC 1)
+
+include(Compiler/PGI)
+
+macro(__compiler_nvhpc lang)
+ # Logic specific to NVHPC.
+endmacro()
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 95a51f66b5..eb806758ff 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -28,7 +28,14 @@ if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
# The -MD flag was only added to nvcc in 10.2 so
# before that we had to invoke the compiler twice
# to get header dependency information
- set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <OBJECT> -MF <DEPFILE>")
+ set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
+else()
+ set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o <DEP_FILE>")
+endif()
+set(CMAKE_CUDA_DEPFILE_FORMAT gcc)
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")
+ set(CMAKE_CUDA_DEPENDS_USE_COMPILER TRUE)
endif()
if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake
index 2d7a303c9b..1279c19872 100644
--- a/Modules/Compiler/PGI-CXX.cmake
+++ b/Modules/Compiler/PGI-CXX.cmake
@@ -8,6 +8,8 @@ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10)
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --gnu_extensions)
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.10)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION --c++03)
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --c++03 --gnu_extensions)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION --c++11)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION --c++11 --gnu_extensions)
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
@@ -18,7 +20,6 @@ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION --c++17)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION --c++17 --gnu_extensions)
- set(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT ON)
endif()
endif()
endif()
diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake
index 10e138918c..7fbfd107e5 100644
--- a/Modules/Compiler/QCC.cmake
+++ b/Modules/Compiler/QCC.cmake
@@ -14,7 +14,7 @@ macro(__compiler_qcc lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "-Wc,-isysroot,")
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,")
- set(CMAKE_DEPFILE_FLAGS_${lang} "-Wp,-MD,<DEPFILE> -Wp,-MT,<OBJECT> -Wp,-MF,<DEPFILE>")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-Wp,-MD,<DEP_FILE> -Wp,-MT,<DEP_TARGET> -Wp,-MF,<DEP_FILE>")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index 7e962b8ee2..c98656f58c 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -22,7 +22,7 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG")
-set(CMAKE_DEPFILE_FLAGS_C "-xMD -xMF <DEPFILE>")
+set(CMAKE_DEPFILE_FLAGS_C "-xMD -xMF <DEP_FILE>")
# Initialize C link type selection flags. These flags are used when
# building a shared library, shared module, or executable that links
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index c946c64362..aa8a9c549a 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -22,7 +22,7 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG")
-set(CMAKE_DEPFILE_FLAGS_CXX "-xMD -xMF <DEPFILE>")
+set(CMAKE_DEPFILE_FLAGS_CXX "-xMD -xMF <DEP_FILE>")
# Initialize C link type selection flags. These flags are used when
# building a shared library, shared module, or executable that links
diff --git a/Modules/Compiler/TI.cmake b/Modules/Compiler/TI.cmake
index f631688235..c8c1635134 100644
--- a/Modules/Compiler/TI.cmake
+++ b/Modules/Compiler/TI.cmake
@@ -18,7 +18,7 @@ macro(__compiler_ti lang)
set(CMAKE_${lang}_RESPONSE_FILE_FLAG "--cmd_file=")
set(CMAKE_INCLUDE_FLAG_${lang} "--include_path=")
- set(CMAKE_DEPFILE_FLAGS_${lang} "--preproc_with_compile --preproc_dependency=<DEPFILE>")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "--preproc_with_compile --preproc_dependency=<DEP_FILE>")
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> --preproc_only ${__COMPILER_TI_SOURCE_FLAG_${lang}}=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> --compile_only --skip_assembler ${__COMPILER_TI_SOURCE_FLAG_${lang}}=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake
index fc71ab4895..8b9d4a9dba 100644
--- a/Modules/Compiler/XL.cmake
+++ b/Modules/Compiler/XL.cmake
@@ -30,5 +30,5 @@ macro(__compiler_xl lang)
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
- set(CMAKE_DEPFILE_FLAGS_${lang} "-MF <DEPFILE> -qmakedep=gcc")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-MF <DEP_FILE> -qmakedep=gcc")
endmacro()
diff --git a/Modules/Compiler/XLClang-C.cmake b/Modules/Compiler/XLClang-C.cmake
index 54c18a668a..1668a4d0f9 100644
--- a/Modules/Compiler/XLClang-C.cmake
+++ b/Modules/Compiler/XLClang-C.cmake
@@ -1,6 +1,8 @@
include(Compiler/XLClang)
__compiler_xlclang(C)
+set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
+
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake
index 9ea3d7cace..02638c7917 100644
--- a/Modules/Compiler/XLClang-CXX.cmake
+++ b/Modules/Compiler/XLClang-CXX.cmake
@@ -1,6 +1,8 @@
include(Compiler/XLClang)
__compiler_xlclang(CXX)
+set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index 90a56e287a..e5b1e5d782 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -83,10 +83,6 @@ MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@
CoverageCommand: @COVERAGE_COMMAND@
CoverageExtraFlags: @COVERAGE_EXTRA_FLAGS@
-# Cluster commands
-SlurmBatchCommand: @SLURM_SBATCH_COMMAND@
-SlurmRunCommand: @SLURM_SRUN_COMMAND@
-
# Testing options
# TimeOut is the amount of time in seconds to wait for processes
# to complete during testing. After TimeOut seconds, the
diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake
index c297231e5b..2430f85a0c 100644
--- a/Modules/Documentation.cmake
+++ b/Modules/Documentation.cmake
@@ -5,6 +5,9 @@
Documentation
-------------
+.. deprecated:: 3.18
+ This module does nothing, unless policy :policy:`CMP0106` is set to ``OLD``.
+
This module provides support for the VTK documentation framework. It
relies on several tools (Doxygen, Perl, etc).
#]=======================================================================]
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index 6fe8685cae..d6fbae9aaf 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -78,7 +78,8 @@ Module Functions
manage local instances of data files stored externally::
ExternalData_Add_Target(
- <target> # Name of data management target
+ <target> # Name of data management target
+ [SHOW_PROGRESS <ON|OFF>] # Show progress during the download
)
It creates custom commands in the target as necessary to make data
@@ -89,6 +90,12 @@ Module Functions
in one of the paths specified in the ``ExternalData_OBJECT_STORES``
variable.
+ .. versionadded:: 3.20
+ The ``SHOW_PROGRESS`` argument may be passed to suppress progress information
+ during the download of objects. If not provided, it defaults to ``OFF`` for
+ :generator:`Ninja` and :generator:`Ninja Multi-Config` generators and ``ON``
+ otherwise.
+
Typically only one target is needed to manage all external data within
a project. Call this function once at the end of configuration after
all data references have been processed.
@@ -108,6 +115,8 @@ calling any of the functions provided by this module.
.. variable:: ExternalData_CUSTOM_SCRIPT_<key>
+ .. versionadded:: 3.2
+
Specify a full path to a ``.cmake`` custom fetch script identified by
``<key>`` in entries of the ``ExternalData_URL_TEMPLATES`` list.
See `Custom Fetch Scripts`_.
@@ -126,6 +135,8 @@ calling any of the functions provided by this module.
.. variable:: ExternalData_NO_SYMLINKS
+ .. versionadded:: 3.3
+
The real data files named by expanded ``DATA{}`` references may be made
available under ``ExternalData_BINARY_ROOT`` using symbolic links on
some platforms. The ``ExternalData_NO_SYMLINKS`` variable may be set
@@ -171,6 +182,8 @@ calling any of the functions provided by this module.
.. variable:: ExternalData_URL_ALGO_<algo>_<key>
+ .. versionadded:: 3.3
+
Specify a custom URL component to be substituted for URL template
placeholders of the form ``%(algo:<key>)``, where ``<key>`` is a
valid C identifier, when fetching an object referenced via hash
@@ -201,10 +214,11 @@ For example, the argument ``DATA{img.png}`` may be satisfied by either a
real ``img.png`` file in the current source directory or a ``img.png.md5``
file containing its MD5 sum.
-Multiple content links of the same name with different hash algorithms
-are supported (e.g. ``img.png.sha256`` and ``img.png.sha1``) so long as
-they all correspond to the same real file. This allows objects to be
-fetched from sources indexed by different hash algorithms.
+.. versionadded:: 3.8
+ Multiple content links of the same name with different hash algorithms
+ are supported (e.g. ``img.png.sha256`` and ``img.png.sha1``) so long as
+ they all correspond to the same real file. This allows objects to be
+ fetched from sources indexed by different hash algorithms.
Referencing File Series
"""""""""""""""""""""""
@@ -263,8 +277,11 @@ associated file options. For example, the argument
``DATA{MyDataDir/,REGEX:.*}`` will pass the full path to a ``MyDataDir``
directory on the command line and ensure that the directory contains
files corresponding to every file or content link in the ``MyDataDir``
-source directory. In order to match associated files in subdirectories,
-specify a ``RECURSE:`` option, e.g. ``DATA{MyDataDir/,RECURSE:,REGEX:.*}``.
+source directory.
+
+.. versionadded:: 3.3
+ In order to match associated files in subdirectories,
+ specify a ``RECURSE:`` option, e.g. ``DATA{MyDataDir/,RECURSE:,REGEX:.*}``.
Hash Algorithms
^^^^^^^^^^^^^^^
@@ -284,6 +301,9 @@ The following hash algorithms are supported::
SHA3_384 .sha3-384 Keccak SHA-3
SHA3_512 .sha3-512 Keccak SHA-3
+.. versionadded:: 3.8
+ Added the ``SHA3_*`` hash algorithms.
+
Note that the hashes are used only for unique data identification and
download verification.
@@ -292,6 +312,8 @@ download verification.
Custom Fetch Scripts
^^^^^^^^^^^^^^^^^^^^
+.. versionadded:: 3.2
+
When a data file must be fetched from one of the URL templates
specified in the ``ExternalData_URL_TEMPLATES`` variable, it is
normally downloaded using the :command:`file(DOWNLOAD)` command.
@@ -344,6 +366,30 @@ function(ExternalData_add_target target)
endif()
set(_ExternalData_CONFIG_CODE "")
+ cmake_parse_arguments(PARSE_ARGV 1 _ExternalData_add_target
+ ""
+ "SHOW_PROGRESS"
+ "")
+ if (_ExternalData_add_target_UNPARSED_ARGUMENTS)
+ message(AUTHOR_WARNING
+ "Ignoring unrecognized arguments passed to ExternalData_add_target: "
+ "`${_ExternalData_add_target_UNPARSED_ARGUMENTS}`")
+ endif ()
+
+ # Turn `SHOW_PROGRESS` into a boolean
+ if (NOT DEFINED _ExternalData_add_target_SHOW_PROGRESS)
+ # The default setting
+ if (CMAKE_GENERATOR MATCHES "Ninja")
+ set(_ExternalData_add_target_SHOW_PROGRESS OFF)
+ else ()
+ set(_ExternalData_add_target_SHOW_PROGRESS ON)
+ endif ()
+ elseif (_ExternalData_add_target_SHOW_PROGRESS)
+ set(_ExternalData_add_target_SHOW_PROGRESS ON)
+ else ()
+ set(_ExternalData_add_target_SHOW_PROGRESS OFF)
+ endif ()
+
# Store custom script configuration.
foreach(url_template IN LISTS ExternalData_URL_TEMPLATES)
if("${url_template}" MATCHES "^ExternalDataCustomScript://([^/]*)/(.*)$")
@@ -423,6 +469,7 @@ function(ExternalData_add_target target)
COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR}
-Dfile=${file} -Dname=${name}
-DExternalData_ACTION=local
+ -DExternalData_SHOW_PROGRESS=${_ExternalData_add_target_SHOW_PROGRESS}
-DExternalData_CONFIG=${config}
-P ${_ExternalData_SELF}
MAIN_DEPENDENCY "${name}"
@@ -459,6 +506,7 @@ function(ExternalData_add_target target)
COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR}
-Dfile=${file} -Dname=${name} -Dexts=${exts}
-DExternalData_ACTION=fetch
+ -DExternalData_SHOW_PROGRESS=${_ExternalData_add_target_SHOW_PROGRESS}
-DExternalData_CONFIG=${config}
-P ${_ExternalData_SELF}
# Update whenever the object hash changes.
@@ -925,7 +973,11 @@ function(_ExternalData_download_file url file err_var msg_var)
else()
set(absolute_timeout "")
endif()
- file(DOWNLOAD "${url}" "${file}" STATUS status LOG log ${inactivity_timeout} ${absolute_timeout} SHOW_PROGRESS)
+ set(show_progress_args)
+ if (ExternalData_SHOW_PROGRESS)
+ list(APPEND show_progress_args SHOW_PROGRESS)
+ endif ()
+ file(DOWNLOAD "${url}" "${file}" STATUS status LOG log ${inactivity_timeout} ${absolute_timeout} ${show_progress_args})
list(GET status 0 err)
list(GET status 1 msg)
if(err)
diff --git a/Modules/ExternalProject-gitupdate.cmake.in b/Modules/ExternalProject-gitupdate.cmake.in
index eff39c130f..7033918056 100644
--- a/Modules/ExternalProject-gitupdate.cmake.in
+++ b/Modules/ExternalProject-gitupdate.cmake.in
@@ -3,214 +3,275 @@
cmake_minimum_required(VERSION 3.5)
-execute_process(
- COMMAND "@git_EXECUTABLE@" rev-list --max-count=1 HEAD
- WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- OUTPUT_VARIABLE head_sha
- OUTPUT_STRIP_TRAILING_WHITESPACE
+function(get_hash_for_ref ref out_var err_var)
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" rev-parse "${ref}"
+ WORKING_DIRECTORY "@work_dir@"
+ RESULT_VARIABLE error_code
+ OUTPUT_VARIABLE ref_hash
+ ERROR_VARIABLE error_msg
+ OUTPUT_STRIP_TRAILING_WHITESPACE
)
-if(error_code)
- message(FATAL_ERROR "Failed to get the hash for HEAD")
+ if(error_code)
+ set(${out_var} "" PARENT_SCOPE)
+ else()
+ set(${out_var} "${ref_hash}" PARENT_SCOPE)
+ endif()
+ set(${err_var} "${error_msg}" PARENT_SCOPE)
+endfunction()
+
+get_hash_for_ref(HEAD head_sha error_msg)
+if(head_sha STREQUAL "")
+ message(FATAL_ERROR "Failed to get the hash for HEAD:\n${error_msg}")
endif()
+
execute_process(
COMMAND "@git_EXECUTABLE@" show-ref "@git_tag@"
WORKING_DIRECTORY "@work_dir@"
OUTPUT_VARIABLE show_ref_output
- )
-# If a remote ref is asked for, which can possibly move around,
-# we must always do a fetch and checkout.
-if("${show_ref_output}" MATCHES "remotes")
- set(is_remote_ref 1)
-else()
- set(is_remote_ref 0)
-endif()
+)
+if(show_ref_output MATCHES "^[a-z0-9]+[ \\t]+refs/remotes/")
+ # Given a full remote/branch-name and we know about it already. Since
+ # branches can move around, we always have to fetch.
+ set(fetch_required YES)
+ set(checkout_name "@git_tag@")
+
+elseif(show_ref_output MATCHES "^[a-z0-9]+[ \\t]+refs/tags/")
+ # Given a tag name that we already know about. We don't know if the tag we
+ # have matches the remote though (tags can move), so we should fetch.
+ set(fetch_required YES)
+ set(checkout_name "@git_tag@")
+
+ # Special case to preserve backward compatibility: if we are already at the
+ # same commit as the tag we hold locally, don't do a fetch and assume the tag
+ # hasn't moved on the remote.
+ # FIXME: We should provide an option to always fetch for this case
+ get_hash_for_ref("@git_tag@" tag_sha error_msg)
+ if(tag_sha STREQUAL head_sha)
+ message(VERBOSE "Already at requested tag: ${tag_sha}")
+ return()
+ endif()
+
+elseif(show_ref_output MATCHES "^[a-z0-9]+[ \\t]+refs/heads/")
+ # Given a branch name without any remote and we already have a branch by that
+ # name. We might already have that branch checked out or it might be a
+ # different branch. It isn't safe to use a bare branch name without the
+ # remote, so do a fetch and replace the ref with one that includes the remote.
+ set(fetch_required YES)
+ set(checkout_name "@git_remote_name@/@git_tag@")
-# Tag is in the form <remote>/<tag> (i.e. origin/master) we must strip
-# the remote from the tag.
-if("${show_ref_output}" MATCHES "refs/remotes/@git_tag@")
- string(REGEX MATCH "^([^/]+)/(.+)$" _unused "@git_tag@")
- set(git_remote "${CMAKE_MATCH_1}")
- set(git_tag "${CMAKE_MATCH_2}")
else()
- set(git_remote "@git_remote_name@")
- set(git_tag "@git_tag@")
+ get_hash_for_ref("@git_tag@" tag_sha error_msg)
+ if(tag_sha STREQUAL head_sha)
+ # Have the right commit checked out already
+ message(VERBOSE "Already at requested ref: ${tag_sha}")
+ return()
+
+ elseif(tag_sha STREQUAL "")
+ # We don't know about this ref yet, so we have no choice but to fetch.
+ # We deliberately swallow any error message at the default log level
+ # because it can be confusing for users to see a failed git command.
+ # That failure is being handled here, so it isn't an error.
+ set(fetch_required YES)
+ set(checkout_name "@git_tag@")
+ if(NOT error_msg STREQUAL "")
+ message(VERBOSE "${error_msg}")
+ endif()
+
+ else()
+ # We have the commit, so we know we were asked to find a commit hash
+ # (otherwise it would have been handled further above), but we don't
+ # have that commit checked out yet
+ set(fetch_required NO)
+ set(checkout_name "@git_tag@")
+ if(NOT error_msg STREQUAL "")
+ message(WARNING "${error_msg}")
+ endif()
+
+ endif()
endif()
-# This will fail if the tag does not exist (it probably has not been fetched
-# yet).
-execute_process(
- COMMAND "@git_EXECUTABLE@" rev-list --max-count=1 "${git_tag}"
- WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- OUTPUT_VARIABLE tag_sha
- OUTPUT_STRIP_TRAILING_WHITESPACE
+if(fetch_required)
+ message(VERBOSE "Fetching latest from the remote @git_remote_name@")
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" fetch --tags --force "@git_remote_name@"
+ WORKING_DIRECTORY "@work_dir@"
+ COMMAND_ERROR_IS_FATAL ANY
)
+endif()
-# Is the hash checkout out that we want?
-if(error_code OR is_remote_ref OR NOT ("${tag_sha}" STREQUAL "${head_sha}"))
+set(git_update_strategy "@git_update_strategy@")
+if(git_update_strategy STREQUAL "")
+ # Backward compatibility requires REBASE as the default behavior
+ set(git_update_strategy REBASE)
+endif()
+
+if(git_update_strategy MATCHES "^REBASE(_CHECKOUT)?$")
+ # Asked to potentially try to rebase first, maybe with fallback to checkout.
+ # We can't if we aren't already on a branch and we shouldn't if that local
+ # branch isn't tracking the one we want to checkout.
execute_process(
- COMMAND "@git_EXECUTABLE@" fetch
+ COMMAND "@git_EXECUTABLE@" symbolic-ref -q HEAD
WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- )
- if(error_code)
- message(FATAL_ERROR "Failed to fetch repository '@git_repository@'")
- endif()
+ OUTPUT_VARIABLE current_branch
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ # Don't test for an error. If this isn't a branch, we get a non-zero error
+ # code but empty output.
+ )
- if(is_remote_ref)
- # Check if stash is needed
+ if(current_branch STREQUAL "")
+ # Not on a branch, checkout is the only sensible option since any rebase
+ # would always fail (and backward compatibility requires us to checkout in
+ # this situation)
+ set(git_update_strategy CHECKOUT)
+
+ else()
execute_process(
- COMMAND "@git_EXECUTABLE@" status --porcelain
+ COMMAND "@git_EXECUTABLE@" for-each-ref "--format='%(upstream:short)'" "${current_branch}"
WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- OUTPUT_VARIABLE repo_status
- )
- if(error_code)
- message(FATAL_ERROR "Failed to get the status")
+ OUTPUT_VARIABLE upstream_branch
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ COMMAND_ERROR_IS_FATAL ANY # There is no error if no upstream is set
+ )
+ if(NOT upstream_branch STREQUAL checkout_name)
+ # Not safe to rebase when asked to checkout a different branch to the one
+ # we are tracking. If we did rebase, we could end up with arbitrary
+ # commits added to the ref we were asked to checkout if the current local
+ # branch happens to be able to rebase onto the target branch. There would
+ # be no error message and the user wouldn't know this was occurring.
+ set(git_update_strategy CHECKOUT)
endif()
- string(LENGTH "${repo_status}" need_stash)
- # If not in clean state, stash changes in order to be able to perform a
- # rebase or checkout without losing those changes permanently
- if(need_stash)
- execute_process(
- COMMAND "@git_EXECUTABLE@" stash save @git_stash_save_options@
- WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- )
- if(error_code)
- message(FATAL_ERROR "Failed to stash changes")
- endif()
- endif()
+ endif()
+elseif(NOT git_update_strategy STREQUAL "CHECKOUT")
+ message(FATAL_ERROR "Unsupported git update strategy: ${git_update_strategy}")
+endif()
- if("@git_update_strategy@" STREQUAL "CHECKOUT")
- execute_process(
- COMMAND "@git_EXECUTABLE@" checkout "${git_remote}/${git_tag}"
- WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- )
- if(error_code)
- message(FATAL_ERROR "Failed to checkout tag: '${git_remote}/${git_tag}'")
- endif()
- else()
- # Pull changes from the remote branch
- execute_process(
- COMMAND "@git_EXECUTABLE@" rebase "${git_remote}/${git_tag}"
- WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- OUTPUT_VARIABLE rebase_output
- ERROR_VARIABLE rebase_output
- )
- if(error_code)
- # Rebase failed, undo the rebase attempt before continuing
- execute_process(
- COMMAND "@git_EXECUTABLE@" rebase --abort
- WORKING_DIRECTORY "@work_dir@"
- )
-
- if(NOT "@git_update_strategy@" STREQUAL "REBASE_CHECKOUT")
- # Not allowed to do a checkout as a fallback, so cannot proceed
- if(need_stash)
- execute_process(
- COMMAND "@git_EXECUTABLE@" stash pop --index --quiet
- WORKING_DIRECTORY "@work_dir@"
- )
- endif()
- message(FATAL_ERROR "\nFailed to rebase in: '@work_dir@'."
- "\nOutput from the attempted rebase follows:"
- "\n${rebase_output}"
- "\n\nYou will have to resolve the conflicts manually")
- endif()
-
- # Fall back to checkout. We create an annotated tag so that the user
- # can manually inspect the situation and revert if required.
- # We can't log the failed rebase output because MSVC sees it and
- # intervenes, causing the build to fail even though it completes.
- # Write it to a file instead.
- string(TIMESTAMP tag_timestamp "%Y%m%dT%H%M%S" UTC)
- set(tag_name _cmake_ExternalProject_moved_from_here_${tag_timestamp}Z)
- set(error_log_file ${CMAKE_CURRENT_LIST_DIR}/rebase_error_${tag_timestamp}Z.log)
- file(WRITE ${error_log_file} "${rebase_output}")
- message(WARNING "Rebase failed, output has been saved to ${error_log_file}"
- "\nFalling back to checkout, previous commit tagged as ${tag_name}")
- execute_process(
- COMMAND "@git_EXECUTABLE@" tag -a
- -m "ExternalProject attempting to move from here to ${git_remote}/${git_tag}"
- ${tag_name}
- WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- )
- if(error_code)
- message(FATAL_ERROR "Failed to add marker tag")
- endif()
- execute_process(
- COMMAND "@git_EXECUTABLE@" checkout "${git_remote}/${git_tag}"
- WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- )
- if(error_code)
- message(FATAL_ERROR "Failed to checkout : '${git_remote}/${git_tag}'")
- endif()
+# Check if stash is needed
+execute_process(
+ COMMAND "@git_EXECUTABLE@" status --porcelain
+ WORKING_DIRECTORY "@work_dir@"
+ RESULT_VARIABLE error_code
+ OUTPUT_VARIABLE repo_status
+)
+if(error_code)
+ message(FATAL_ERROR "Failed to get the status")
+endif()
+string(LENGTH "${repo_status}" need_stash)
- endif()
- endif()
+# If not in clean state, stash changes in order to be able to perform a
+# rebase or checkout without losing those changes permanently
+if(need_stash)
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" stash save @git_stash_save_options@
+ WORKING_DIRECTORY "@work_dir@"
+ COMMAND_ERROR_IS_FATAL ANY
+ )
+endif()
- if(need_stash)
- execute_process(
- COMMAND "@git_EXECUTABLE@" stash pop --index --quiet
- WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- )
- if(error_code)
- # Stash pop --index failed: Try again dropping the index
- execute_process(
- COMMAND "@git_EXECUTABLE@" reset --hard --quiet
- WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- )
+if(git_update_strategy STREQUAL "CHECKOUT")
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" checkout "${checkout_name}"
+ WORKING_DIRECTORY "@work_dir@"
+ COMMAND_ERROR_IS_FATAL ANY
+ )
+else()
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" rebase "${checkout_name}"
+ WORKING_DIRECTORY "@work_dir@"
+ RESULT_VARIABLE error_code
+ OUTPUT_VARIABLE rebase_output
+ ERROR_VARIABLE rebase_output
+ )
+ if(error_code)
+ # Rebase failed, undo the rebase attempt before continuing
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" rebase --abort
+ WORKING_DIRECTORY "@work_dir@"
+ )
+
+ if(NOT git_update_strategy STREQUAL "REBASE_CHECKOUT")
+ # Not allowed to do a checkout as a fallback, so cannot proceed
+ if(need_stash)
execute_process(
- COMMAND "@git_EXECUTABLE@" stash pop --quiet
+ COMMAND "@git_EXECUTABLE@" stash pop --index --quiet
WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- )
- if(error_code)
- # Stash pop failed: Restore previous state.
- execute_process(
- COMMAND "@git_EXECUTABLE@" reset --hard --quiet ${head_sha}
- WORKING_DIRECTORY "@work_dir@"
- )
- execute_process(
- COMMAND "@git_EXECUTABLE@" stash pop --index --quiet
- WORKING_DIRECTORY "@work_dir@"
)
- message(FATAL_ERROR "\nFailed to unstash changes in: '@work_dir@'."
- "\nYou will have to resolve the conflicts manually")
- endif()
endif()
+ message(FATAL_ERROR "\nFailed to rebase in: '@work_dir@'."
+ "\nOutput from the attempted rebase follows:"
+ "\n${rebase_output}"
+ "\n\nYou will have to resolve the conflicts manually")
endif()
- else()
+
+ # Fall back to checkout. We create an annotated tag so that the user
+ # can manually inspect the situation and revert if required.
+ # We can't log the failed rebase output because MSVC sees it and
+ # intervenes, causing the build to fail even though it completes.
+ # Write it to a file instead.
+ string(TIMESTAMP tag_timestamp "%Y%m%dT%H%M%S" UTC)
+ set(tag_name _cmake_ExternalProject_moved_from_here_${tag_timestamp}Z)
+ set(error_log_file ${CMAKE_CURRENT_LIST_DIR}/rebase_error_${tag_timestamp}Z.log)
+ file(WRITE ${error_log_file} "${rebase_output}")
+ message(WARNING "Rebase failed, output has been saved to ${error_log_file}"
+ "\nFalling back to checkout, previous commit tagged as ${tag_name}")
execute_process(
- COMMAND "@git_EXECUTABLE@" checkout "${git_tag}"
+ COMMAND "@git_EXECUTABLE@" tag -a
+ -m "ExternalProject attempting to move from here to ${checkout_name}"
+ ${tag_name}
WORKING_DIRECTORY "@work_dir@"
- RESULT_VARIABLE error_code
- )
- if(error_code)
- message(FATAL_ERROR "Failed to checkout tag: '${git_tag}'")
- endif()
+ COMMAND_ERROR_IS_FATAL ANY
+ )
+
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" checkout "${checkout_name}"
+ WORKING_DIRECTORY "@work_dir@"
+ COMMAND_ERROR_IS_FATAL ANY
+ )
endif()
+endif()
- set(init_submodules "@init_submodules@")
- if(init_submodules)
+if(need_stash)
+ # Put back the stashed changes
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" stash pop --index --quiet
+ WORKING_DIRECTORY "@work_dir@"
+ RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ # Stash pop --index failed: Try again dropping the index
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" reset --hard --quiet
+ WORKING_DIRECTORY "@work_dir@"
+ )
execute_process(
- COMMAND "@git_EXECUTABLE@" submodule update @git_submodules_recurse@ --init @git_submodules@
+ COMMAND "@git_EXECUTABLE@" stash pop --quiet
WORKING_DIRECTORY "@work_dir@"
RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ # Stash pop failed: Restore previous state.
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" reset --hard --quiet ${head_sha}
+ WORKING_DIRECTORY "@work_dir@"
)
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" stash pop --index --quiet
+ WORKING_DIRECTORY "@work_dir@"
+ )
+ message(FATAL_ERROR "\nFailed to unstash changes in: '@work_dir@'."
+ "\nYou will have to resolve the conflicts manually")
+ endif()
endif()
- if(error_code)
- message(FATAL_ERROR "Failed to update submodules in: '@work_dir@'")
- endif()
+endif()
+
+set(init_submodules "@init_submodules@")
+if(init_submodules)
+ execute_process(
+ COMMAND "@git_EXECUTABLE@" submodule update @git_submodules_recurse@ --init @git_submodules@
+ WORKING_DIRECTORY "@work_dir@"
+ COMMAND_ERROR_IS_FATAL ANY
+ )
endif()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 8bbaf5a38a..56525080cc 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1,6 +1,8 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
+include_guard(GLOBAL)
+
#[=======================================================================[.rst:
ExternalProject
---------------
@@ -56,6 +58,8 @@ External Project Definition
(see *Logging Options* below).
``LOG_DIR <dir>``
+ .. versionadded:: 3.14
+
Directory in which to store the logs of each step.
``DOWNLOAD_DIR <dir>``
@@ -144,6 +148,9 @@ External Project Definition
is determined by inspecting the actual content rather than using logic
based on the file extension.
+ .. versionchanged:: 3.7
+ Multiple URLs are allowed.
+
``URL_HASH <algo>=<hashValue>``
Hash of the archive file to be downloaded. The argument should be of
the form ``<algo>=<hashValue>`` where ``algo`` can be any of the hashing
@@ -164,6 +171,8 @@ External Project Definition
of code internal to the ``ExternalProject`` module.
``DOWNLOAD_NO_EXTRACT <bool>``
+ .. versionadded:: 3.6
+
Allows the extraction part of the download step to be disabled by
passing a boolean true value for this option. If this option is not
given, the downloaded contents will be unpacked automatically if
@@ -180,15 +189,23 @@ External Project Definition
Maximum time allowed for file download operations.
``INACTIVITY_TIMEOUT <seconds>``
+ .. versionadded:: 3.19
+
Terminate the operation after a period of inactivity.
``HTTP_USERNAME <username>``
+ .. versionadded:: 3.7
+
Username for the download operation if authentication is required.
``HTTP_PASSWORD <password>``
+ .. versionadded:: 3.7
+
Password for the download operation if authentication is required.
``HTTP_HEADER <header1> [<header2>...]``
+ .. versionadded:: 3.7
+
Provides an arbitrary list of HTTP headers for the download operation.
This can be useful for accessing content in systems like AWS, etc.
@@ -201,6 +218,9 @@ External Project Definition
cannot be provided, this option can be an alternative verification
measure.
+ .. versionchanged:: 3.6
+ This option also applies to ``git clone`` invocations.
+
``TLS_CAINFO <file>``
Specify a custom certificate authority file to use if ``TLS_VERIFY``
is enabled. If this option is not specified, the value of the
@@ -208,6 +228,8 @@ External Project Definition
:command:`file(DOWNLOAD)`)
``NETRC <level>``
+ .. versionadded:: 3.11
+
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)`)
@@ -225,11 +247,16 @@ External Project Definition
is ignored.
``NETRC_FILE <file>``
+ .. versionadded:: 3.11
+
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)`)
+ .. versionadded:: 3.1
+ Added support for `tbz2`, `.tar.xz`, `.txz`, and `.7z` extensions.
+
*Git*
NOTE: A git version of 1.6.5 or later is required if this download method
is used.
@@ -267,22 +294,30 @@ External Project Definition
``GIT_SUBMODULES <module>...``
Specific git submodules that should also be updated. If this option is
- not provided, all git submodules will be updated. When :policy:`CMP0097`
- is set to ``NEW`` if this value is set to an empty string then no submodules
- are initialized or updated.
+ not provided, all git submodules will be updated.
+
+ .. versionchanged:: 3.16
+ When :policy:`CMP0097` is set to ``NEW``, if this value is set
+ to an empty string then no submodules are initialized or updated.
``GIT_SUBMODULES_RECURSE <bool>``
+ .. versionadded:: 3.17
+
Specify whether git submodules (if any) should update recursively by
passing the ``--recursive`` flag to ``git submodule update``.
If not specified, the default is on.
``GIT_SHALLOW <bool>``
+ .. versionadded:: 3.6
+
When this option is enabled, the ``git clone`` operation will be given
the ``--depth 1`` option. This performs a shallow clone, which avoids
downloading the whole history and instead retrieves just the commit
denoted by the ``GIT_TAG`` option.
``GIT_PROGRESS <bool>``
+ .. versionadded:: 3.8
+
When enabled, this option instructs the ``git clone`` operation to
report its progress by passing it the ``--progress`` option. Without
this option, the clone step for large projects may appear to make the
@@ -292,12 +327,16 @@ External Project Definition
overly noisy if lots of external projects are used.
``GIT_CONFIG <option1> [<option2>...]``
+ .. versionadded:: 3.8
+
Specify a list of config options to pass to ``git clone``. Each option
listed will be transformed into its own ``--config <option>`` on the
``git clone`` command line, with each option required to be in the
form ``key=value``.
``GIT_REMOTE_UPDATE_STRATEGY <strategy>``
+ .. versionadded:: 3.18
+
When ``GIT_TAG`` refers to a remote branch, this option can be used to
specify how the update step behaves. The ``<strategy>`` must be one of
the following:
@@ -379,6 +418,8 @@ External Project Definition
:manual:`generator expressions <cmake-generator-expressions(7)>`.
``UPDATE_DISCONNECTED <bool>``
+ .. versionadded:: 3.2
+
When enabled, this option causes the update step to be skipped. It does
not, however, prevent the download step. The update step can still be
added as a step target (see :command:`ExternalProject_Add_StepTargets`)
@@ -436,6 +477,8 @@ External Project Definition
``CONFIGURE_COMMAND`` option.
``CMAKE_GENERATOR_PLATFORM <platform>``
+ .. versionadded:: 3.1
+
Pass a generator-specific platform name to the CMake command (see
:variable:`CMAKE_GENERATOR_PLATFORM`). It is an error to provide this
option without the ``CMAKE_GENERATOR`` option.
@@ -446,6 +489,8 @@ External Project Definition
option without the ``CMAKE_GENERATOR`` option.
``CMAKE_GENERATOR_INSTANCE <instance>``
+ .. versionadded:: 3.11
+
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.
@@ -454,8 +499,10 @@ External Project Definition
The specified arguments are passed to the ``cmake`` command line. They
can be any argument the ``cmake`` command understands, not just cache
values defined by ``-D...`` arguments (see also
- :manual:`CMake Options <cmake(1)>`). In addition, arguments may use
- :manual:`generator expressions <cmake-generator-expressions(7)>`.
+ :manual:`CMake Options <cmake(1)>`).
+
+ .. versionadded:: 3.3
+ Arguments may use :manual:`generator expressions <cmake-generator-expressions(7)>`.
``CMAKE_CACHE_ARGS <arg>...``
This is an alternate way of specifying cache variables where command line
@@ -463,10 +510,14 @@ External Project Definition
the form ``-Dvar:STRING=value``, which are then transformed into
CMake :command:`set` commands with the ``FORCE`` option used. These
``set()`` commands are written to a pre-load script which is then applied
- using the :manual:`cmake -C <cmake(1)>` command line option. Arguments
- may use :manual:`generator expressions <cmake-generator-expressions(7)>`.
+ using the :manual:`cmake -C <cmake(1)>` command line option.
+
+ .. versionadded:: 3.3
+ Arguments may use :manual:`generator expressions <cmake-generator-expressions(7)>`.
``CMAKE_CACHE_DEFAULT_ARGS <arg>...``
+ .. versionadded:: 3.2
+
This is the same as the ``CMAKE_CACHE_ARGS`` option except the ``set()``
commands do not include the ``FORCE`` keyword. This means the values act
as initial defaults only and will not override any variables already set
@@ -474,20 +525,37 @@ External Project Definition
different behavior depending on whether the build starts from a fresh
build directory or re-uses previous build contents.
- If the CMake generator is the ``Green Hills MULTI`` and not overridden then
- the original project's settings for the GHS toolset and target system
- customization cache variables are propagated into the external project.
+ .. versionadded:: 3.15
+ If the CMake generator is the ``Green Hills MULTI`` and not overridden then
+ the original project's settings for the GHS toolset and target system
+ customization cache variables are propagated into the external project.
``SOURCE_SUBDIR <dir>``
+ .. versionadded:: 3.7
+
When no ``CONFIGURE_COMMAND`` option is specified, the configure step
assumes the external project has a ``CMakeLists.txt`` file at the top of
its source tree (i.e. in ``SOURCE_DIR``). The ``SOURCE_SUBDIR`` option
can be used to point to an alternative directory within the source tree
to use as the top of the CMake source tree instead. This must be a
relative path and it will be interpreted as being relative to
- ``SOURCE_DIR``. When ``BUILD_IN_SOURCE 1`` is specified, the
- ``BUILD_COMMAND`` is used to point to an alternative directory within the
- source tree.
+ ``SOURCE_DIR``.
+
+ .. versionadded:: 3.14
+ When ``BUILD_IN_SOURCE`` option is enabled, the ``BUILD_COMMAND``
+ is used to point to an alternative directory within the source tree.
+
+ ``CONFIGURE_HANDLED_BY_BUILD <bool>``
+ .. versionadded:: 3.20
+
+ Enabling this option relaxes the dependencies of the configure step on
+ other external projects to order-only. This means the configure step will
+ be executed after its external project dependencies are built but it will
+ not be marked dirty when one of its external project dependencies is
+ rebuilt. This option can be enabled when the build step is smart enough
+ to figure out if the configure step needs to be rerun. CMake and Meson are
+ examples of build systems whose build step is smart enough to know if the
+ configure step needs to be rerun.
**Build Step Options:**
If the configure step assumed the external project uses CMake as its build
@@ -524,6 +592,8 @@ External Project Definition
developers might modify the sources in ``SOURCE_DIR``).
``BUILD_BYPRODUCTS <file>...``
+ .. versionadded:: 3.2
+
Specifies files that will be generated by the build command but which
might or might not have their modification time updated by subsequent
builds. These ultimately get passed through as ``BYPRODUCTS`` to the
@@ -578,6 +648,8 @@ External Project Definition
``TEST_AFTER_INSTALL`` are enabled, the latter is silently ignored.
``TEST_EXCLUDE_FROM_MAIN <bool>``
+ .. versionadded:: 3.2
+
If enabled, the main build's default ALL target will not depend on the
test step. This can be a useful way of ensuring the test step is defined
but only gets invoked when manually requested.
@@ -597,6 +669,8 @@ External Project Definition
When enabled, the output of the update step is logged to files.
``LOG_PATCH <bool>``
+ .. versionadded:: 3.14
+
When enabled, the output of the patch step is logged to files.
``LOG_CONFIGURE <bool>``
@@ -612,10 +686,14 @@ External Project Definition
When enabled, the output of the test step is logged to files.
``LOG_MERGED_STDOUTERR <bool>``
+ .. versionadded:: 3.14
+
When enabled, stdout and stderr will be merged for any step whose
output is being logged to files.
``LOG_OUTPUT_ON_FAILURE <bool>``
+ .. versionadded:: 3.14
+
This option only has an effect if at least one of the other ``LOG_<step>``
options is enabled. If an error occurs for a step which has logging to
file enabled, that step's output will be printed to the console if
@@ -624,6 +702,8 @@ External Project Definition
console.
**Terminal Access Options:**
+ .. versionadded:: 3.4
+
Steps can be given direct access to the terminal in some cases. Giving a
step access to the terminal may allow it to receive terminal input if
required, such as for authentication details not provided by other options.
@@ -673,8 +753,9 @@ External Project Definition
discussion of the effects of this option.
``INDEPENDENT_STEP_TARGETS <step-target>...``
- Deprecated. This is allowed only if policy :policy:`CMP0114` is not set
- to ``NEW``.
+ .. deprecated:: 3.19
+ This is allowed only if policy :policy:`CMP0114` is not set to ``NEW``.
+
Generates custom targets for the specified steps and prevent these targets
from having the usual dependencies applied to them. If this option is not
specified, the default value is taken from the
@@ -780,6 +861,8 @@ control needed to implement such step-level capabilities.
Files on which this custom step depends.
``INDEPENDENT <bool>``
+ .. versionadded:: 3.19
+
Specifies whether this step is independent of the external dependencies
specified by the :command:`ExternalProject_Add`'s ``DEPENDS`` option.
The default is ``FALSE``. Steps marked as independent may depend only
@@ -795,6 +878,8 @@ control needed to implement such step-level capabilities.
on the external targets, but may depend on targets for other steps.
``BYPRODUCTS <file>...``
+ .. versionadded:: 3.2
+
Files that will be generated by this custom step but which might or might
not have their modification time updated by subsequent builds. This list of
files will ultimately be passed through as the ``BYPRODUCTS`` option to the
@@ -831,6 +916,12 @@ control needed to implement such step-level capabilities.
corresponding property values defined in the original call to
:command:`ExternalProject_Add`.
+ .. versionadded:: 3.3
+ Token replacement is extended to byproducts.
+
+ .. versionadded:: 3.11
+ The ``<DOWNLOAD_DIR>`` substitution token.
+
.. command:: ExternalProject_Add_StepTargets
The ``ExternalProject_Add_StepTargets()`` function generates targets for the
@@ -868,15 +959,16 @@ control needed to implement such step-level capabilities.
can save having to repeatedly specify the same set of step targets when
multiple external projects are being defined.
- If :policy:`CMP0114` is set to ``NEW``, step targets are fully responsible
- for holding the custom commands implementing their steps. The primary target
- created by ``ExternalProject_Add`` depends on the step targets, and the
- step targets depend on each other. The target-level dependencies match
- the file-level dependencies used by the custom commands for each step.
- The targets for steps created with :command:`ExternalProject_Add_Step`'s
- ``INDEPENDENT`` option do not depend on the external targets specified
- by :command:`ExternalProject_Add`'s ``DEPENDS`` option. The predefined
- steps ``mkdir``, ``download``, ``update``, and ``patch`` are independent.
+ .. versionadded:: 3.19
+ If :policy:`CMP0114` is set to ``NEW``, step targets are fully responsible
+ for holding the custom commands implementing their steps. The primary target
+ created by ``ExternalProject_Add`` depends on the step targets, and the
+ step targets depend on each other. The target-level dependencies match
+ the file-level dependencies used by the custom commands for each step.
+ The targets for steps created with :command:`ExternalProject_Add_Step`'s
+ ``INDEPENDENT`` option do not depend on the external targets specified
+ by :command:`ExternalProject_Add`'s ``DEPENDS`` option. The predefined
+ steps ``mkdir``, ``download``, ``update``, and ``patch`` are independent.
If :policy:`CMP0114` is not ``NEW``, the following deprecated behavior
is available:
@@ -901,6 +993,8 @@ control needed to implement such step-level capabilities.
.. command:: ExternalProject_Add_StepDependencies
+ .. versionadded:: 3.2
+
The ``ExternalProject_Add_StepDependencies()`` function can be used to add
dependencies to a step. The dependencies added must be targets CMake already
knows about (these can be ordinary executable or library targets, custom
@@ -1019,60 +1113,37 @@ cmake_policy(PUSH)
cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
-# Pre-compute a regex to match documented keywords for each command.
-math(EXPR _ep_documentation_line_count "${CMAKE_CURRENT_LIST_LINE} - 4")
-file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines
- LIMIT_COUNT ${_ep_documentation_line_count}
- REGEX "^\\.\\. command:: [A-Za-z0-9_]+|^ +``[A-Z0-9_]+ [^`]*``$")
-foreach(line IN LISTS lines)
- if("${line}" MATCHES "^\\.\\. command:: ([A-Za-z0-9_]+)")
- if(_ep_func)
- string(APPEND _ep_keywords_${_ep_func} ")$")
- endif()
- set(_ep_func "${CMAKE_MATCH_1}")
- #message("function [${_ep_func}]")
- set(_ep_keywords_${_ep_func} "^(")
- set(_ep_keyword_sep)
- elseif("${line}" MATCHES "^ +``([A-Z0-9_]+) [^`]*``$")
- set(_ep_key "${CMAKE_MATCH_1}")
- # COMMAND should never be included as a keyword,
- # for ExternalProject_Add(), as it is treated as a
- # special case by argument parsing as an extension
- # of a previous ..._COMMAND
- if("x${_ep_key}x" STREQUAL "xCOMMANDx" AND
- "x${_ep_func}x" STREQUAL "xExternalProject_Addx")
- continue()
- endif()
- #message(" keyword [${_ep_key}]")
- string(APPEND _ep_keywords_${_ep_func}
- "${_ep_keyword_sep}${_ep_key}")
- set(_ep_keyword_sep "|")
- endif()
-endforeach()
-if(_ep_func)
- string(APPEND _ep_keywords_${_ep_func} ")$")
-endif()
-
-# Save regex matching supported hash algorithm names.
-set(_ep_hash_algos "MD5|SHA1|SHA224|SHA256|SHA384|SHA512|SHA3_224|SHA3_256|SHA3_384|SHA3_512")
-set(_ep_hash_regex "^(${_ep_hash_algos})=([0-9A-Fa-f]+)$")
+macro(_ep_get_hash_algos out_var)
+ set(${out_var}
+ MD5
+ SHA1
+ SHA224
+ SHA256
+ SHA384
+ SHA512
+ SHA3_224
+ SHA3_256
+ SHA3_384
+ SHA3_512
+ )
+endmacro()
-set(_ExternalProject_SELF "${CMAKE_CURRENT_LIST_FILE}")
-get_filename_component(_ExternalProject_SELF_DIR "${_ExternalProject_SELF}" PATH)
+macro(_ep_get_hash_regex out_var)
+ _ep_get_hash_algos(${out_var})
+ list(JOIN ${out_var} "|" ${out_var})
+ set(${out_var} "^(${${out_var}})=([0-9A-Fa-f]+)$")
+endmacro()
-function(_ep_parse_arguments f name ns args)
+function(_ep_parse_arguments f keywords name ns args)
# Transfer the arguments to this function into target properties for the
# new custom target we just added so that we can set up all the build steps
# correctly based on target properties.
#
- # We loop through ARGN and consider the namespace starting with an
+ # Because some keywords can be repeated, we can't use cmake_parse_arguments().
+ # Instead, we loop through ARGN and consider the namespace starting with an
# upper-case letter followed by at least two more upper-case letters,
# numbers or underscores to be keywords.
- if(NOT DEFINED _ExternalProject_SELF)
- message(FATAL_ERROR "error: ExternalProject module must be explicitly included before using ${f} function")
- endif()
-
set(key)
foreach(arg IN LISTS args)
@@ -1081,7 +1152,7 @@ function(_ep_parse_arguments f name ns args)
if(arg MATCHES "^[A-Z][A-Z0-9_][A-Z0-9_]+$" AND
NOT (("x${arg}x" STREQUAL "x${key}x") AND ("x${key}x" STREQUAL "xCOMMANDx")) AND
NOT arg MATCHES "^(TRUE|FALSE)$")
- if(_ep_keywords_${f} AND arg MATCHES "${_ep_keywords_${f}}")
+ if(arg IN_LIST keywords)
set(is_value 0)
endif()
endif()
@@ -1106,9 +1177,6 @@ function(_ep_parse_arguments f name ns args)
endif()
else()
set(key "${arg}")
- if(key MATCHES GIT)
- get_property(have_key TARGET ${name} PROPERTY ${ns}${key} SET)
- endif()
endif()
endforeach()
endfunction()
@@ -1330,14 +1398,17 @@ function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_r
if("${git_tag}" STREQUAL "")
message(FATAL_ERROR "Tag for git checkout should not be empty.")
endif()
- if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.6)
- set(git_stash_save_options --all --quiet)
- else()
- set(git_stash_save_options --quiet)
+ set(git_stash_save_options --quiet)
+ if(GIT_VERSION_STRING VERSION_GREATER_EQUAL 1.7.7)
+ # This avoids stashing files covered by .gitignore
+ list(APPEND git_stash_save_options --include-untracked)
+ elseif(GIT_VERSION_STRING VERSION_GREATER_EQUAL 1.7.6)
+ # Untracked files, but also ignored files, so potentially slower
+ list(APPEND git_stash_save_options --all)
endif()
configure_file(
- "${_ExternalProject_SELF_DIR}/ExternalProject-gitupdate.cmake.in"
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject-gitupdate.cmake.in"
"${script_filename}"
@ONLY
)
@@ -1366,6 +1437,7 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout inac
set(SHOW_PROGRESS "SHOW_PROGRESS")
endif()
+ _ep_get_hash_regex(_ep_hash_regex)
if("${hash}" MATCHES "${_ep_hash_regex}")
set(ALGO "${CMAKE_MATCH_1}")
string(TOLOWER "${CMAKE_MATCH_2}" EXPECT_VALUE)
@@ -1446,13 +1518,14 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout inac
# * USERPWD_ARGS
# * HTTP_HEADERS_ARGS
configure_file(
- "${_ExternalProject_SELF_DIR}/ExternalProject-download.cmake.in"
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject-download.cmake.in"
"${script_filename}"
@ONLY
)
endfunction()
function(_ep_write_verifyfile_script script_filename LOCAL hash)
+ _ep_get_hash_regex(_ep_hash_regex)
if("${hash}" MATCHES "${_ep_hash_regex}")
set(ALGO "${CMAKE_MATCH_1}")
string(TOLOWER "${CMAKE_MATCH_2}" EXPECT_VALUE)
@@ -1466,7 +1539,7 @@ function(_ep_write_verifyfile_script script_filename LOCAL hash)
# * EXPECT_VALUE
# * LOCAL
configure_file(
- "${_ExternalProject_SELF_DIR}/ExternalProject-verify.cmake.in"
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ExternalProject-verify.cmake.in"
"${script_filename}"
@ONLY
)
@@ -1984,8 +2057,10 @@ if(result)
message(FATAL_ERROR \"\${msg}\")
endif()
else()
- set(msg \"${name} ${step} command succeeded. See also ${logbase}-*.log\")
- message(STATUS \"\${msg}\")
+ if(NOT \"${CMAKE_GENERATOR}\" MATCHES \"Ninja\")
+ set(msg \"${name} ${step} command succeeded. See also ${logbase}-*.log\")
+ message(STATUS \"\${msg}\")
+ endif()
endif()
")
file(GENERATE OUTPUT "${script}" CONTENT "${code}")
@@ -2153,7 +2228,21 @@ function(ExternalProject_Add_Step name step)
_ep_get_complete_stampfile(${name} complete_stamp_file)
_ep_get_step_stampfile(${name} ${step} stamp_file)
- _ep_parse_arguments(ExternalProject_Add_Step
+ set(keywords
+ COMMAND
+ COMMENT
+ DEPENDEES
+ DEPENDERS
+ DEPENDS
+ INDEPENDENT
+ BYPRODUCTS
+ ALWAYS
+ EXCLUDE_FROM_MAIN
+ WORKING_DIRECTORY
+ LOG
+ USES_TERMINAL
+ )
+ _ep_parse_arguments(ExternalProject_Add_Step "${keywords}"
${name} _EP_${step}_ "${ARGN}")
get_property(independent TARGET ${name} PROPERTY _EP_${step}_INDEPENDENT)
@@ -2536,10 +2625,13 @@ function(_ep_add_download_command name)
--non-interactive ${svn_trust_cert_args} ${svn_user_pw_args} ${src_name})
list(APPEND depends ${stamp_dir}/${name}-svninfo.txt)
elseif(git_repository)
- unset(CMAKE_MODULE_PATH) # Use CMake builtin find module
- find_package(Git QUIET)
- if(NOT GIT_EXECUTABLE)
- message(FATAL_ERROR "error: could not find git for clone of ${name}")
+ # FetchContent gives us these directly, so don't try to recompute them
+ if(NOT GIT_EXECUTABLE OR NOT GIT_VERSION_STRING)
+ unset(CMAKE_MODULE_PATH) # Use CMake builtin find module
+ find_package(Git QUIET)
+ if(NOT GIT_EXECUTABLE)
+ message(FATAL_ERROR "error: could not find git for clone of ${name}")
+ endif()
endif()
_ep_get_git_submodules_recurse(git_submodules_recurse)
@@ -2571,6 +2663,10 @@ function(_ep_add_download_command name)
get_property(git_progress TARGET ${name} PROPERTY _EP_GIT_PROGRESS)
get_property(git_config TARGET ${name} PROPERTY _EP_GIT_CONFIG)
+ # Make checkouts quiet when checking out a git hash (this avoids the
+ # very noisy detached head message)
+ list(PREPEND git_config advice.detachedHead=false)
+
# For the download step, and the git clone operation, only the repository
# should be recorded in a configured RepositoryInfo file. If the repo
# changes, the clone script should be run again. But if only the tag
@@ -2643,7 +2739,10 @@ function(_ep_add_download_command name)
elseif(url)
get_filename_component(work_dir "${source_dir}" PATH)
get_property(hash TARGET ${name} PROPERTY _EP_URL_HASH)
+ _ep_get_hash_regex(_ep_hash_regex)
if(hash AND NOT "${hash}" MATCHES "${_ep_hash_regex}")
+ _ep_get_hash_algos(_ep_hash_algos)
+ list(JOIN _ep_hash_algos "|" _ep_hash_algos)
message(FATAL_ERROR "URL_HASH is set to\n ${hash}\n"
"but must be ALGO=value where ALGO is\n ${_ep_hash_algos}\n"
"and value is a hex string.")
@@ -2857,10 +2956,13 @@ function(_ep_add_update_command name)
--non-interactive ${svn_trust_cert_args} ${svn_user_pw_args})
set(always 1)
elseif(git_repository)
- unset(CMAKE_MODULE_PATH) # Use CMake builtin find module
- find_package(Git QUIET)
- if(NOT GIT_EXECUTABLE)
- message(FATAL_ERROR "error: could not find git for fetch of ${name}")
+ # FetchContent gives us these directly, so don't try to recompute them
+ if(NOT GIT_EXECUTABLE OR NOT GIT_VERSION_STRING)
+ unset(CMAKE_MODULE_PATH) # Use CMake builtin find module
+ find_package(Git QUIET)
+ if(NOT GIT_EXECUTABLE)
+ message(FATAL_ERROR "error: could not find git for fetch of ${name}")
+ endif()
endif()
set(work_dir ${source_dir})
set(comment "Performing update step for '${name}'")
@@ -3001,6 +3103,23 @@ function(_ep_add_patch_command name)
)
endfunction()
+function(_ep_get_file_deps var name)
+ set(file_deps)
+
+ get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
+ foreach(dep IN LISTS deps)
+ get_property(dep_type TARGET ${dep} PROPERTY TYPE)
+ if(dep_type STREQUAL "UTILITY")
+ get_property(is_ep TARGET ${dep} PROPERTY _EP_IS_EXTERNAL_PROJECT)
+ if(is_ep)
+ _ep_get_step_stampfile(${dep} "done" done_stamp_file)
+ list(APPEND file_deps ${done_stamp_file})
+ endif()
+ endif()
+ endforeach()
+
+ set("${var}" "${file_deps}" PARENT_SCOPE)
+endfunction()
function(_ep_extract_configure_command var name)
get_property(cmd_set TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND SET)
@@ -3109,19 +3228,13 @@ endfunction()
function(_ep_add_configure_command name)
ExternalProject_Get_Property(${name} binary_dir tmp_dir)
- # Depend on other external projects (file-level).
set(file_deps)
- get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
- foreach(dep IN LISTS deps)
- get_property(dep_type TARGET ${dep} PROPERTY TYPE)
- if(dep_type STREQUAL "UTILITY")
- get_property(is_ep TARGET ${dep} PROPERTY _EP_IS_EXTERNAL_PROJECT)
- if(is_ep)
- _ep_get_step_stampfile(${dep} "done" done_stamp_file)
- list(APPEND file_deps ${done_stamp_file})
- endif()
- endif()
- endforeach()
+ get_property(configure_handled_by_build TARGET ${name}
+ PROPERTY _EP_CONFIGURE_HANDLED_BY_BUILD)
+ if(NOT configure_handled_by_build)
+ # Depend on other external projects (file-level)
+ _ep_get_file_deps(file_deps ${name})
+ endif()
_ep_extract_configure_command(cmd ${name})
@@ -3172,6 +3285,14 @@ endfunction()
function(_ep_add_build_command name)
ExternalProject_Get_Property(${name} binary_dir)
+ set(file_deps)
+ get_property(configure_handled_by_build TARGET ${name}
+ PROPERTY _EP_CONFIGURE_HANDLED_BY_BUILD)
+ if(configure_handled_by_build)
+ # Depend on other external projects (file-level)
+ _ep_get_file_deps(file_deps ${name})
+ endif()
+
get_property(cmd_set TARGET ${name} PROPERTY _EP_BUILD_COMMAND SET)
if(cmd_set)
get_property(cmd TARGET ${name} PROPERTY _EP_BUILD_COMMAND)
@@ -3214,6 +3335,7 @@ function(_ep_add_build_command name)
BYPRODUCTS \${build_byproducts}
WORKING_DIRECTORY \${binary_dir}
DEPENDEES configure
+ DEPENDS \${file_deps}
ALWAYS \${always}
${log}
${uses_terminal}
@@ -3378,7 +3500,136 @@ function(ExternalProject_Add name)
set_property(TARGET ${name} PROPERTY _EP_CMP0114 "${cmp0114}")
- _ep_parse_arguments(ExternalProject_Add ${name} _EP_ "${ARGN}")
+ set(keywords
+ #
+ # Directory options
+ #
+ PREFIX
+ TMP_DIR
+ STAMP_DIR
+ LOG_DIR
+ DOWNLOAD_DIR
+ SOURCE_DIR
+ BINARY_DIR
+ INSTALL_DIR
+ #
+ # Download step options
+ #
+ DOWNLOAD_COMMAND
+ #
+ URL
+ URL_HASH
+ URL_MD5
+ DOWNLOAD_NAME
+ DOWNLOAD_NO_EXTRACT
+ DOWNLOAD_NO_PROGRESS
+ TIMEOUT
+ INACTIVITY_TIMEOUT
+ HTTP_USERNAME
+ HTTP_PASSWORD
+ HTTP_HEADER
+ TLS_VERIFY # Also used for git clone operations
+ TLS_CAINFO
+ NETRC
+ NETRC_FILE
+ #
+ GIT_REPOSITORY
+ GIT_TAG
+ GIT_REMOTE_NAME
+ GIT_SUBMODULES
+ GIT_SUBMODULES_RECURSE
+ GIT_SHALLOW
+ GIT_PROGRESS
+ GIT_CONFIG
+ GIT_REMOTE_UPDATE_STRATEGY
+ #
+ SVN_REPOSITORY
+ SVN_REVISION
+ SVN_USERNAME
+ SVN_PASSWORD
+ SVN_TRUST_CERT
+ #
+ HG_REPOSITORY
+ HG_TAG
+ #
+ CVS_REPOSITORY
+ CVS_MODULE
+ CVS_TAG
+ #
+ # Update step options
+ #
+ UPDATE_COMMAND
+ UPDATE_DISCONNECTED
+ #
+ # Patch step options
+ #
+ PATCH_COMMAND
+ #
+ # Configure step options
+ #
+ CONFIGURE_COMMAND
+ CMAKE_COMMAND
+ CMAKE_GENERATOR
+ CMAKE_GENERATOR_PLATFORM
+ CMAKE_GENERATOR_TOOLSET
+ CMAKE_GENERATOR_INSTANCE
+ CMAKE_ARGS
+ CMAKE_CACHE_ARGS
+ CMAKE_CACHE_DEFAULT_ARGS
+ SOURCE_SUBDIR
+ CONFIGURE_HANDLED_BY_BUILD
+ #
+ # Build step options
+ #
+ BUILD_COMMAND
+ BUILD_IN_SOURCE
+ BUILD_ALWAYS
+ BUILD_BYPRODUCTS
+ #
+ # Install step options
+ #
+ INSTALL_COMMAND
+ #
+ # Test step options
+ #
+ TEST_COMMAND
+ TEST_BEFORE_INSTALL
+ TEST_AFTER_INSTALL
+ TEST_EXCLUDE_FROM_MAIN
+ #
+ # Logging options
+ #
+ LOG_DOWNLOAD
+ LOG_UPDATE
+ LOG_PATCH
+ LOG_CONFIGURE
+ LOG_BUILD
+ LOG_INSTALL
+ LOG_TEST
+ LOG_MERGED_STDOUTERR
+ LOG_OUTPUT_ON_FAILURE
+ #
+ # Terminal access options
+ #
+ USES_TERMINAL_DOWNLOAD
+ USES_TERMINAL_UPDATE
+ USES_TERMINAL_CONFIGURE
+ USES_TERMINAL_BUILD
+ USES_TERMINAL_INSTALL
+ USES_TERMINAL_TEST
+ #
+ # Target options
+ #
+ DEPENDS
+ EXCLUDE_FROM_ALL
+ STEP_TARGETS
+ INDEPENDENT_STEP_TARGETS
+ #
+ # Miscellaneous options
+ #
+ LIST_SEPARATOR
+ )
+ _ep_parse_arguments(ExternalProject_Add "${keywords}" ${name} _EP_ "${ARGN}")
_ep_set_directories(${name})
_ep_get_step_stampfile(${name} "done" done_stamp_file)
_ep_get_step_stampfile(${name} "install" install_stamp_file)
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index 4a3e83af31..77c66d14af 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -66,6 +66,8 @@ The default value for this global property is ``OPTIONAL``.
.. variable:: FeatureSummary_<TYPE>_DESCRIPTION
+.. versionadded:: 3.9
+
The global property :variable:`FeatureSummary_<TYPE>_DESCRIPTION` can be defined
for each type to replace the type name with the specified string whenever the
package type is used in an output string.
@@ -242,12 +244,13 @@ endfunction()
``<TYPE>_PACKAGES_NOT_FOUND``
only those packages which have not been found which have the type <TYPE>
- With the exception of the ``ALL`` value, these values can be combined
- in order to customize the output. For example:
+ .. versionchanged:: 3.1
+ With the exception of the ``ALL`` value, these values can be combined
+ in order to customize the output. For example:
- .. code-block:: cmake
+ .. code-block:: cmake
- feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
+ feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
If a ``FILENAME`` is given, the information is printed into this file. If
``APPEND`` is used, it is appended to this file, otherwise the file is
@@ -268,14 +271,18 @@ endfunction()
The default value for the :variable:`FeatureSummary_REQUIRED_PKG_TYPES` global
property is ``REQUIRED``.
+ .. versionadded:: 3.9
+ The ``DEFAULT_DESCRIPTION`` option.
+
The :variable:`FeatureSummary_DEFAULT_PKG_TYPE` global property can be
modified to change the default package type assigned when not explicitly
assigned by the user.
- If the ``QUIET_ON_EMPTY`` option is used, if only one type of package was
- requested, and no packages belonging to that category were found, then no
- output (including the ``DESCRIPTION``) is printed or added to the ``VAR``
- variable.
+ .. versionadded:: 3.8
+ If the ``QUIET_ON_EMPTY`` option is used, if only one type of package was
+ requested, and no packages belonging to that category were found, then no
+ output (including the ``DESCRIPTION``) is printed or added to the ``VAR``
+ variable.
Example 1, append everything to a file:
@@ -617,6 +624,9 @@ endfunction()
be displayed using ``feature_summary()`` for ``ENABLED_FEATURES`` and
``DISABLED_FEATURES`` respectively.
+ .. versionchanged:: 3.8
+ ``<enabled>`` can be a list of conditions.
+
Example for setting the info for a feature:
.. code-block:: cmake
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index c81b3711a5..8adef47778 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -77,6 +77,9 @@ 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.
+.. versionchanged:: 3.14
+ ``FetchContent`` commands can access the terminal. This is necessary
+ for password prompts and real-time progress displays to work.
Commands
^^^^^^^^
@@ -371,6 +374,8 @@ is simpler and provides additional features over the pattern above.
:variable:`CMAKE_MAKE_PROGRAM` variables will need to be set appropriately
on the command line invoking the script.
+ .. versionadded:: 3.18
+ Added support for ``DOWNLOAD_NO_EXTRACT`` and ``SOURCE_SUBDIR`` options.
.. command:: FetchContent_GetProperties
@@ -416,6 +421,8 @@ is simpler and provides additional features over the pattern above.
FetchContent_MakeAvailable( <name1> [<name2>...] )
+ .. versionadded:: 3.14
+
This command implements the common pattern typically needed for most
dependencies. It iterates over each of the named dependencies in turn
and for each one it loosely follows the
@@ -957,6 +964,22 @@ ExternalProject_Add_Step(${contentName}-populate copyfile
"-DCMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY=${CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY}")
endif()
+ # Avoid using if(... IN_LIST ...) so we don't have to alter policy settings
+ set(__FETCHCONTENT_CACHED_INFO "")
+ list(FIND ARG_UNPARSED_ARGUMENTS GIT_REPOSITORY indexResult)
+ if(indexResult GREATER_EQUAL 0)
+ find_package(Git QUIET)
+ set(__FETCHCONTENT_CACHED_INFO
+"# Pass through things we've already detected in the main project to avoid
+# paying the cost of redetecting them again in ExternalProject_Add()
+set(GIT_EXECUTABLE [==[${GIT_EXECUTABLE}]==])
+set(GIT_VERSION_STRING [==[${GIT_VERSION_STRING}]==])
+set_property(GLOBAL PROPERTY _CMAKE_FindGit_GIT_EXECUTABLE_VERSION
+ [==[${GIT_EXECUTABLE};${GIT_VERSION_STRING}]==]
+)
+")
+ 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.
diff --git a/Modules/FetchContent/CMakeLists.cmake.in b/Modules/FetchContent/CMakeLists.cmake.in
index 45e4df03ef..5ebb12f1ad 100644
--- a/Modules/FetchContent/CMakeLists.cmake.in
+++ b/Modules/FetchContent/CMakeLists.cmake.in
@@ -9,6 +9,8 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(${contentName}-populate NONE)
+@__FETCHCONTENT_CACHED_INFO@
+
include(ExternalProject)
ExternalProject_Add(${contentName}-populate
${ARG_EXTRA}
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake
index 88e2681eb5..627866a4d0 100644
--- a/Modules/FindALSA.cmake
+++ b/Modules/FindALSA.cmake
@@ -12,6 +12,8 @@ Find the alsa libraries (``asound``)
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.12
+
This module defines :prop_tgt:`IMPORTED` target ``ALSA::ALSA``, if
ALSA has been found.
diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake
index c8a31a0386..f959356b27 100644
--- a/Modules/FindArmadillo.cmake
+++ b/Modules/FindArmadillo.cmake
@@ -8,6 +8,9 @@ FindArmadillo
Find the Armadillo C++ library.
Armadillo is a library for linear algebra & scientific computing.
+.. versionadded:: 3.18
+ Support for linking wrapped libraries directly (``ARMA_DONT_USE_WRAPPER``).
+
Using Armadillo:
::
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index 1e1a5a3b41..3515bf0ddd 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -35,21 +35,31 @@ the path to a yacc file. ``<CodeOutput>`` is the name of the source file
generated by bison. A header file is also be generated, and contains
the token list.
+.. versionchanged:: 3.14
+ When :policy:`CMP0088` is set to ``NEW``, ``bison`` runs in the
+ :variable:`CMAKE_CURRENT_BINARY_DIR` directory.
+
The options are:
``COMPILE_FLAGS <flags>``
Specify flags to be added to the ``bison`` command line.
``DEFINES_FILE <file>``
+ .. versionadded:: 3.4
+
Specify a non-default header ``<file>`` to be generated by ``bison``.
``VERBOSE [<file>]``
Tell ``bison`` to write a report file of the grammar and parser.
- If ``<file>`` is given, it specifies path the report file is copied to.
- ``[<file>]`` is left for backward compatibility of this module.
- Use ``VERBOSE REPORT_FILE <file>``.
+
+ .. deprecated:: 3.7
+ If ``<file>`` is given, it specifies path the report file is copied to.
+ ``[<file>]`` is left for backward compatibility of this module.
+ Use ``VERBOSE REPORT_FILE <file>``.
``REPORT_FILE <file>``
+ .. versionadded:: 3.7
+
Specify a non-default report ``<file>``, if generated.
The macro defines the following variables:
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index e4353dfaf2..4cf812b7fa 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -53,18 +53,46 @@ The following variables may be set to influence this module's behavior:
* ``Arm_mp``
* ``Arm_ilp64``
* ``Arm_ilp64_mp``
+ * ``EML``
+ * ``EML_mt``
* ``Generic``
+ .. versionadded:: 3.6
+ ``OpenBLAS`` support.
+
+ .. versionadded:: 3.11
+ ``FLAME`` support.
+
+ .. versionadded:: 3.13
+ Added ILP64 MKL variants (``Intel10_64ilp``, ``Intel10_64ilp_seq``).
+
+ .. versionadded:: 3.17
+ Added single dynamic library MKL variant (``Intel10_64_dyn``).
+
+ .. versionadded:: 3.18
+ Arm Performance Libraries support (``Arm``, ``Arm_mp``, ``Arm_ilp64``,
+ ``Arm_ilp64_mp``).
+
+ .. versionadded:: 3.19
+ ``FlexiBLAS`` support.
+
+ .. versionadded:: 3.20
+ Elbrus Math Library support (``EML``, ``EML_mt``).
+
``BLA_F95``
if ``ON`` tries to find the BLAS95 interfaces
``BLA_PREFER_PKGCONFIG``
+ .. versionadded:: 3.11
+
if set ``pkg-config`` will be used to search for a BLAS library first
and if one is found that is preferred
Imported targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.18
+
This module defines the following :prop_tgt:`IMPORTED` target:
``BLAS::BLAS``
@@ -104,10 +132,13 @@ This module defines the following variables:
Hints
^^^^^
-Set the ``MKLROOT`` environment variable to a directory that contains an MKL
-installation, or add the directory to the dynamic library loader environment
-variable for your platform (``LIB``, ``DYLD_LIBRARY_PATH`` or
-``LD_LIBRARY_PATH``).
+``MKLROOT``
+ .. versionadded:: 3.15
+
+ Set this environment variable to a directory that contains an MKL
+ installation, or add the directory to the dynamic library loader environment
+ variable for your platform (``LIB``, ``DYLD_LIBRARY_PATH`` or
+ ``LD_LIBRARY_PATH``).
#]=======================================================================]
@@ -586,16 +617,22 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
else()
find_package(Threads REQUIRED)
endif()
+ set(_threadlibs "${CMAKE_THREAD_LIBS_INIT}")
+ if(BLA_STATIC)
+ find_package(OpenMP COMPONENTS C)
+ list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}")
+ endif()
check_blas_libraries(
BLAS_LIBRARIES
BLAS
sgemm
""
"openblas"
- "${CMAKE_THREAD_LIBS_INIT}"
+ "${_threadlibs}"
""
""
)
+ unset(_threadlibs)
endif()
endif()
@@ -805,6 +842,9 @@ if(BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
set(_ACML_COMPILER32 "ifort32")
set(_ACML_COMPILER64 "ifort64")
+ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
+ # 32-bit not supported
+ set(_ACML_COMPILER64 "ifx")
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro")
set(_ACML_COMPILER32 "sun32")
set(_ACML_COMPILER64 "sun64")
@@ -951,6 +991,31 @@ if(BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
+# Elbrus Math Library?
+if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")
+
+ set(BLAS_EML_LIB "eml")
+
+ # Check for OpenMP support, VIA BLA_VENDOR of eml_mt
+ if(BLA_VENDOR MATCHES "_mt")
+ set(BLAS_EML_LIB "${BLAS_EML_LIB}_mt")
+ endif()
+
+ if(NOT BLAS_LIBRARIES)
+ check_blas_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "${BLAS_EML_LIB}"
+ ""
+ ""
+ ""
+ )
+ endif()
+
+endif()
+
# Generic BLAS library?
if(BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES)
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 5704d1d83c..355c4bb96b 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -10,6 +10,8 @@ Try to find BZip2
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.12
+
This module defines :prop_tgt:`IMPORTED` target ``BZip2::BZip2``, if
BZip2 has been found.
@@ -21,7 +23,8 @@ This module defines the following variables:
``BZIP2_FOUND``
system has BZip2
``BZIP2_INCLUDE_DIRS``
- the BZip2 include directories
+ .. versionadded:: 3.12
+ the BZip2 include directories
``BZIP2_LIBRARIES``
Link these to use BZip2
``BZIP2_NEED_PREFIX``
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 54d9593ca7..f8887ad2be 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -7,7 +7,9 @@ FindBoost
Find Boost include dirs and libraries
-Use this module by invoking find_package with the form::
+Use this module by invoking :command:`find_package` with the form:
+
+.. code-block:: cmake
find_package(Boost
[version] [EXACT] # Minimum or EXACT version e.g. 1.67.0
@@ -20,97 +22,134 @@ Use this module by invoking find_package with the form::
This module finds headers and requested component libraries OR a CMake
package configuration file provided by a "Boost CMake" build. For the
-latter case skip to the "Boost CMake" section below. For the former
-case results are reported in variables::
-
- Boost_FOUND - True if headers and requested libraries were found
- Boost_INCLUDE_DIRS - Boost include directories
- Boost_LIBRARY_DIRS - Link directories for Boost libraries
- Boost_LIBRARIES - Boost component libraries to be linked
- Boost_<C>_FOUND - True if component <C> was found (<C> is upper-case)
- Boost_<C>_LIBRARY - Libraries to link for component <C> (may include
- target_link_libraries debug/optimized keywords)
- Boost_VERSION_MACRO - BOOST_VERSION value from boost/version.hpp
- Boost_VERSION_STRING - Boost version number in x.y.z format
- Boost_VERSION - if CMP0093 NEW => same as Boost_VERSION_STRING
- if CMP0093 OLD or unset => same as Boost_VERSION_MACRO
- Boost_LIB_VERSION - Version string appended to library filenames
- Boost_VERSION_MAJOR - Boost major version number (X in X.y.z)
- alias: Boost_MAJOR_VERSION
- Boost_VERSION_MINOR - Boost minor version number (Y in x.Y.z)
- alias: Boost_MINOR_VERSION
- Boost_VERSION_PATCH - Boost subminor version number (Z in x.y.Z)
- alias: Boost_SUBMINOR_VERSION
- Boost_VERSION_COUNT - Amount of version components (3)
- Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows)
- - Pass to add_definitions() to have diagnostic
- 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
- (or BOOSTROOT)
- BOOST_INCLUDEDIR - Preferred include directory e.g. <prefix>/include
- BOOST_LIBRARYDIR - Preferred library directory e.g. <prefix>/lib
- Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not
- specified by these hint variables. Default is OFF.
- Boost_ADDITIONAL_VERSIONS
- - List of Boost versions not known to this module
- (Boost install locations may contain the version)
-
-and saves search results persistently in CMake cache entries::
-
- Boost_INCLUDE_DIR - Directory containing Boost headers
- Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries
- Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries
- Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant
- Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant
-
-The following :prop_tgt:`IMPORTED` targets are also defined::
-
- Boost::headers - Target for header-only dependencies
- (Boost include directory)
- alias: Boost::boost
- Boost::<C> - Target for specific component dependency
- (shared or static library); <C> is lower-
- case
- Boost::diagnostic_definitions - interface target to enable diagnostic
- information about Boost's automatic linking
- during compilation (adds BOOST_LIB_DIAGNOSTIC)
- Boost::disable_autolinking - interface target to disable automatic
- linking with MSVC (adds BOOST_ALL_NO_LIB)
- Boost::dynamic_linking - interface target to enable dynamic linking
- linking with MSVC (adds BOOST_ALL_DYN_LINK)
+latter case skip to the :ref:`Boost CMake` section below.
-Implicit dependencies such as ``Boost::filesystem`` requiring
-``Boost::system`` will be automatically detected and satisfied, even
-if system is not specified when using :command:`find_package` and if
-``Boost::system`` is not added to :command:`target_link_libraries`. If using
-``Boost::thread``, then ``Threads::Threads`` will also be added automatically.
+.. versionadded:: 3.7
+ ``bzip2`` and ``zlib`` components (Windows only).
-It is important to note that the imported targets behave differently
-than variables created by this module: multiple calls to
-:command:`find_package(Boost)` in the same directory or sub-directories with
-different options (e.g. static or shared) will not override the
-values of the targets created by the first call.
+.. versionadded:: 3.11
+ The ``OPTIONAL_COMPONENTS`` option.
+
+.. versionadded:: 3.13
+ ``stacktrace_*`` components.
+
+.. versionadded:: 3.19
+ ``bzip2`` and ``zlib`` components on all platforms.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``Boost_FOUND``
+ True if headers and requested libraries were found.
+
+``Boost_INCLUDE_DIRS``
+ Boost include directories.
+
+``Boost_LIBRARY_DIRS``
+ Link directories for Boost libraries.
+
+``Boost_LIBRARIES``
+ Boost component libraries to be linked.
+
+``Boost_<COMPONENT>_FOUND``
+ True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
+
+``Boost_<COMPONENT>_LIBRARY``
+ Libraries to link for component ``<COMPONENT>`` (may include
+ :command:`target_link_libraries` debug/optimized keywords).
+
+``Boost_VERSION_MACRO``
+ ``BOOST_VERSION`` value from ``boost/version.hpp``.
+
+``Boost_VERSION_STRING``
+ Boost version number in ``X.Y.Z`` format.
+
+``Boost_VERSION``
+ Boost version number in ``X.Y.Z`` format (same as ``Boost_VERSION_STRING``).
+
+ .. versionchanged:: 3.15
+ In previous CMake versions, this variable used the raw version string
+ from the Boost header (same as ``Boost_VERSION_MACRO``).
+ See policy :policy:`CMP0093`.
+
+``Boost_LIB_VERSION``
+ Version string appended to library filenames.
+
+``Boost_VERSION_MAJOR``, ``Boost_MAJOR_VERSION``
+ Boost major version number (``X`` in ``X.Y.Z``).
+
+``Boost_VERSION_MINOR``, ``Boost_MINOR_VERSION``
+ Boost minor version number (``Y`` in ``X.Y.Z``).
+
+``Boost_VERSION_PATCH``, ``Boost_SUBMINOR_VERSION``
+ Boost subminor version number (``Z`` in ``X.Y.Z``).
+
+``Boost_VERSION_COUNT``
+ Amount of version components (3).
+
+``Boost_LIB_DIAGNOSTIC_DEFINITIONS`` (Windows-specific)
+ Pass to :command:`add_definitions` to have diagnostic
+ information about Boost's automatic linking
+ displayed during compilation
+
+.. versionadded:: 3.15
+ The ``Boost_VERSION_<PART>`` variables.
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+Search results are saved persistently in CMake cache entries:
+
+``Boost_INCLUDE_DIR``
+ Directory containing Boost headers.
+
+``Boost_LIBRARY_DIR_RELEASE``
+ Directory containing release Boost libraries.
+
+``Boost_LIBRARY_DIR_DEBUG``
+ Directory containing debug Boost libraries.
+
+``Boost_<COMPONENT>_LIBRARY_DEBUG``
+ Component ``<COMPONENT>`` library debug variant.
+
+``Boost_<COMPONENT>_LIBRARY_RELEASE``
+ Component ``<COMPONENT>`` library release variant.
+
+.. versionadded:: 3.3
+ Per-configuration variables ``Boost_LIBRARY_DIR_RELEASE`` and
+ ``Boost_LIBRARY_DIR_DEBUG``.
+
+Hints
+^^^^^
+
+This module reads hints about search locations from variables:
+
+``BOOST_ROOT``, ``BOOSTROOT``
+ Preferred installation prefix.
+
+``BOOST_INCLUDEDIR``
+ Preferred include directory e.g. ``<prefix>/include``.
+
+``BOOST_LIBRARYDIR``
+ Preferred library directory e.g. ``<prefix>/lib``.
+
+``Boost_NO_SYSTEM_PATHS``
+ Set to ``ON`` to disable searching in locations not
+ specified by these hint variables. Default is ``OFF``.
+
+``Boost_ADDITIONAL_VERSIONS``
+ List of Boost versions not known to this module.
+ (Boost install locations may contain the version).
Users may set these hints or results as ``CACHE`` entries. Projects
should not read these entries directly but instead use the above
result variables. Note that some hint names start in upper-case
-"BOOST". One may specify these as environment variables if they are
+``BOOST``. One may specify these as environment variables if they are
not specified as CMake variables or cache entries.
-This module first searches for the ``Boost`` header files using the above
+This module first searches for the Boost header files using the above
hint variables (excluding ``BOOST_LIBRARYDIR``) and saves the result in
``Boost_INCLUDE_DIR``. Then it searches for requested component libraries
using the above hints (excluding ``BOOST_INCLUDEDIR`` and
@@ -118,83 +157,170 @@ using the above hints (excluding ``BOOST_INCLUDEDIR`` and
and the library name configuration settings below. It saves the
library directories in ``Boost_LIBRARY_DIR_DEBUG`` and
``Boost_LIBRARY_DIR_RELEASE`` and individual library
-locations in ``Boost_<C>_LIBRARY_DEBUG`` and ``Boost_<C>_LIBRARY_RELEASE``.
+locations in ``Boost_<COMPONENT>_LIBRARY_DEBUG`` and ``Boost_<COMPONENT>_LIBRARY_RELEASE``.
When one changes settings used by previous searches in the same build
tree (excluding environment variables) this module discards previous
search results affected by the changes and searches again.
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.5
+
+This module defines the following :prop_tgt:`IMPORTED` targets:
+
+``Boost::boost``
+ Target for header-only dependencies. (Boost include directory).
+
+``Boost::headers``
+ .. versionadded:: 3.15
+ Alias for ``Boost::boost``.
+
+``Boost::<component>``
+ Target for specific component dependency (shared or static library);
+ ``<component>`` name is lower-case.
+
+``Boost::diagnostic_definitions``
+ Interface target to enable diagnostic information about Boost's automatic
+ linking during compilation (adds ``-DBOOST_LIB_DIAGNOSTIC``).
+
+``Boost::disable_autolinking``
+ Interface target to disable automatic linking with MSVC
+ (adds ``-DBOOST_ALL_NO_LIB``).
+
+``Boost::dynamic_linking``
+ Interface target to enable dynamic linking linking with MSVC
+ (adds ``-DBOOST_ALL_DYN_LINK``).
+
+Implicit dependencies such as ``Boost::filesystem`` requiring
+``Boost::system`` will be automatically detected and satisfied, even
+if system is not specified when using :command:`find_package` and if
+``Boost::system`` is not added to :command:`target_link_libraries`. If using
+``Boost::thread``, then ``Threads::Threads`` will also be added automatically.
+
+It is important to note that the imported targets behave differently
+than variables created by this module: multiple calls to
+:command:`find_package(Boost)` in the same directory or sub-directories with
+different options (e.g. static or shared) will not override the
+values of the targets created by the first call.
+
+Other Variables
+^^^^^^^^^^^^^^^
+
Boost libraries come in many variants encoded in their file name.
Users or projects may tell this module which variant to find by
-setting variables::
-
- Boost_USE_DEBUG_LIBS - Set to ON or OFF to specify whether to search
- and use the debug libraries. Default is ON.
- Boost_USE_RELEASE_LIBS - Set to ON or OFF to specify whether to search
- and use the release libraries. Default is ON.
- Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded
- libraries ('mt' tag). Default is ON.
- Boost_USE_STATIC_LIBS - Set to ON to force the use of the static
- libraries. Default is OFF.
- Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use
- libraries linked statically to the C++ runtime
- ('s' tag). Default is platform dependent.
- Boost_USE_DEBUG_RUNTIME - Set to ON or OFF to specify whether to use
- libraries linked to the MS debug C++ runtime
- ('g' tag). Default is ON.
- Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a
- debug Python build ('y' tag). Default is OFF.
- Boost_USE_STLPORT - Set to ON to use libraries compiled with
- STLPort ('p' tag). Default is OFF.
- Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
- - Set to ON to use libraries compiled with
- STLPort deprecated "native iostreams"
- ('n' tag). Default is OFF.
- Boost_COMPILER - Set to the compiler-specific library suffix
- (e.g. "-gcc43"). Default is auto-computed
- for the C++ compiler in use. A list may be
- used if multiple compatible suffixes should
- be tested for, in decreasing order of
- preference.
- Boost_LIB_PREFIX - Set to the platform-specific library name
- prefix (e.g. "lib") used by Boost static libs.
- This is needed only on platforms where CMake
- does not know the prefix by default.
- Boost_ARCHITECTURE - Set to the architecture-specific library suffix
- (e.g. "-x64"). Default is auto-computed for the
- C++ compiler in use.
- Boost_THREADAPI - Suffix for "thread" component library name,
- such as "pthread" or "win32". Names with
- and without this suffix will both be tried.
- Boost_NAMESPACE - Alternate namespace used to build boost with
- e.g. if set to "myboost", will search for
- myboost_thread instead of boost_thread.
-
-Other variables one may set to control this module are::
-
- Boost_DEBUG - Set to ON to enable debug output from FindBoost.
- Please enable this before filing any bug report.
- 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.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.
- Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and
- Boost_LIBRARY_DIR_DEBUG.
+setting variables:
+
+``Boost_USE_DEBUG_LIBS``
+ .. versionadded:: 3.10
+
+ Set to ``ON`` or ``OFF`` to specify whether to search and use the debug
+ libraries. Default is ``ON``.
+
+``Boost_USE_RELEASE_LIBS``
+ .. versionadded:: 3.10
+
+ Set to ``ON`` or ``OFF`` to specify whether to search and use the release
+ libraries. Default is ``ON``.
+
+``Boost_USE_MULTITHREADED``
+ Set to OFF to use the non-multithreaded libraries ("mt" tag). Default is
+ ``ON``.
+
+``Boost_USE_STATIC_LIBS``
+ Set to ON to force the use of the static libraries. Default is ``OFF``.
+
+``Boost_USE_STATIC_RUNTIME``
+ Set to ``ON`` or ``OFF`` to specify whether to use libraries linked
+ statically to the C++ runtime ("s" tag). Default is platform dependent.
+
+``Boost_USE_DEBUG_RUNTIME``
+ Set to ``ON`` or ``OFF`` to specify whether to use libraries linked to the
+ MS debug C++ runtime ("g" tag). Default is ``ON``.
+
+``Boost_USE_DEBUG_PYTHON``
+ Set to ``ON`` to use libraries compiled with a debug Python build ("y"
+ tag). Default is ``OFF``.
+
+``Boost_USE_STLPORT``
+ Set to ``ON`` to use libraries compiled with STLPort ("p" tag). Default is
+ ``OFF``.
+
+``Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS``
+ Set to ON to use libraries compiled with STLPort deprecated "native
+ iostreams" ("n" tag). Default is ``OFF``.
+
+``Boost_COMPILER``
+ Set to the compiler-specific library suffix (e.g. ``-gcc43``). Default is
+ auto-computed for the C++ compiler in use.
+
+ .. versionchanged:: 3.9
+ A list may be used if multiple compatible suffixes should be tested for,
+ in decreasing order of preference.
+
+``Boost_LIB_PREFIX``
+ .. versionadded:: 3.18
+
+ Set to the platform-specific library name prefix (e.g. ``lib``) used by
+ Boost static libs. This is needed only on platforms where CMake does not
+ know the prefix by default.
+
+``Boost_ARCHITECTURE``
+ .. versionadded:: 3.13
+
+ Set to the architecture-specific library suffix (e.g. ``-x64``).
+ Default is auto-computed for the C++ compiler in use.
+
+``Boost_THREADAPI``
+ Suffix for ``thread`` component library name, such as ``pthread`` or
+ ``win32``. Names with and without this suffix will both be tried.
+
+``Boost_NAMESPACE``
+ Alternate namespace used to build boost with e.g. if set to ``myboost``,
+ will search for ``myboost_thread`` instead of ``boost_thread``.
+
+Other variables one may set to control this module are:
+
+``Boost_DEBUG``
+ Set to ``ON`` to enable debug output from ``FindBoost``.
+ Please enable this before filing any bug report.
+
+``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.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.
+
+``Boost_LIBRARY_DIR``
+ Default value for ``Boost_LIBRARY_DIR_RELEASE`` and
+ ``Boost_LIBRARY_DIR_DEBUG``.
+
+``Boost_NO_WARN_NEW_VERSIONS``
+ .. versionadded:: 3.20
+
+ Set to ``ON`` to suppress the warning about unknown dependencies for new
+ Boost versions.
On Visual Studio and Borland compilers Boost headers request automatic
linking to corresponding libraries. This requires matching libraries
to be linked explicitly or available in the link library search path.
In this case setting ``Boost_USE_STATIC_LIBS`` to ``OFF`` may not achieve
dynamic linking. Boost automatic linking typically requests static
-libraries with a few exceptions (such as ``Boost.Python``). Use::
+libraries with a few exceptions (such as ``Boost.Python``). Use:
+
+.. code-block:: cmake
add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
to ask Boost to report information about automatic linking requests.
-Example to find Boost headers only::
+Examples
+^^^^^^^^
+
+Find Boost headers only:
+
+.. code-block:: cmake
find_package(Boost 1.36.0)
if(Boost_FOUND)
@@ -202,7 +328,9 @@ Example to find Boost headers only::
add_executable(foo foo.cc)
endif()
-Example to find Boost libraries and use imported targets::
+Find Boost libraries and use imported targets:
+
+.. code-block:: cmake
find_package(Boost 1.56 REQUIRED COMPONENTS
date_time filesystem iostreams)
@@ -210,17 +338,21 @@ Example to find Boost libraries and use imported targets::
target_link_libraries(foo Boost::date_time Boost::filesystem
Boost::iostreams)
-Example to find Boost Python 3.6 libraries and use imported targets::
+Find Boost Python 3.6 libraries and use imported targets:
+
+.. code-block:: cmake
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::
+Find Boost headers and some *static* (release only) libraries:
+
+.. code-block:: cmake
set(Boost_USE_STATIC_LIBS ON) # only find static libs
- set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs and
+ set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(Boost_USE_RELEASE_LIBS ON) # only find release libs
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
@@ -231,6 +363,8 @@ Example to find Boost headers and some *static* (release only) libraries::
target_link_libraries(foo ${Boost_LIBRARIES})
endif()
+.. _`Boost CMake`:
+
Boost CMake
^^^^^^^^^^^
@@ -238,7 +372,7 @@ If Boost was built using the boost-cmake project or from Boost 1.70.0 on
it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called
``BoostConfig.cmake`` or ``boost-config.cmake`` and stores the result in
-``CACHE`` entry "Boost_DIR". If found, the package configuration file is loaded
+``CACHE`` entry ``Boost_DIR``. If found, the package configuration file is loaded
and this module returns with no further action. See documentation of
the Boost CMake package configuration for details on what it provides.
@@ -725,7 +859,8 @@ 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("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel")
+ if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel"
+ OR "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "xIntelLLVM")
if(WIN32)
set (_boost_COMPILER "-iw")
else()
@@ -1215,7 +1350,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
- if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.76.0)
+ if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.76.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
endif()
endif()
@@ -1778,7 +1913,8 @@ endif()
if(WIN32 AND Boost_USE_DEBUG_RUNTIME)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang"
- OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel")
+ OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel"
+ OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntelLLVM")
string(APPEND _boost_DEBUG_ABI_TAG "g")
endif()
endif()
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index f04f571274..620e32af58 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -4,12 +4,6 @@ FindCUDA
.. deprecated:: 3.10
- Superseded by first-class support for the CUDA language in CMake.
- Superseded by the :module:`FindCUDAToolkit` for CUDA toolkit libraries.
-
-Replacement
-^^^^^^^^^^^
-
It is no longer necessary to use this module or call ``find_package(CUDA)``
for compiling CUDA code. Instead, list ``CUDA`` among the languages named
in the top-level call to the :command:`project` command, or call the
@@ -17,9 +11,10 @@ in the top-level call to the :command:`project` command, or call the
Then one can add CUDA (``.cu``) sources to programs directly
in calls to :command:`add_library` and :command:`add_executable`.
-To find and use the CUDA toolkit libraries the :module:`FindCUDAToolkit`
-module has superseded this module. It works whether or not the ``CUDA``
-language is enabled.
+.. versionadded:: 3.17
+ To find and use the CUDA toolkit libraries the :module:`FindCUDAToolkit`
+ module has superseded this module. It works whether or not the ``CUDA``
+ language is enabled.
Documentation of Deprecated Usage
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -30,6 +25,9 @@ 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.
+.. versionadded:: 3.19
+ QNX support.
+
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.
@@ -50,342 +48,476 @@ 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.
+Input Variables
+"""""""""""""""
+
The following variables affect the behavior of the macros in the
script (in alphabetical 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_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.
- Note that making this different from the host code when generating object
- or C files from CUDA code just won't work, because size_t gets defined by
- nvcc in the generated source. If you compile to PTX and then load the
- file yourself, you can mix bit sizes between device and host.
-
- CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE (Default ON)
- -- Set to ON if you want the custom build rule to be attached to the source
- file in Visual Studio. Turn OFF if you add the same cuda file to multiple
- targets.
-
- This allows the user to build the target from the CUDA file; however, bad
- things can happen if the CUDA source file is added to multiple targets.
- When performing parallel builds it is possible for the custom build
- command to be run more than once and in parallel causing cryptic build
- errors. VS runs the rules for every source file in the target, and a
- source can have only one rule no matter how many projects it is added to.
- When the rule is run from multiple targets race conditions can occur on
- the generated file. Eventually everything will get built, but if the user
- is unaware of this behavior, there may be confusion. It would be nice if
- this script could detect the reuse of source files across multiple targets
- and turn the option off for the user, but no good solution could be found.
-
- CUDA_BUILD_CUBIN (Default OFF)
- -- Set to ON to enable and extra compilation pass with the -cubin option in
- Device mode. The output is parsed and register, shared memory usage is
- printed during build.
-
- CUDA_BUILD_EMULATION (Default OFF for device mode)
- -- Set to ON for Emulation mode. -D_DEVICEEMU is defined for CUDA C files
- when CUDA_BUILD_EMULATION is TRUE.
-
- CUDA_LINK_LIBRARIES_KEYWORD (Default "")
- -- The <PRIVATE|PUBLIC|INTERFACE> keyword to use for internal
- target_link_libraries calls. The default is to use no keyword which
- uses the old "plain" form of target_link_libraries. Note that is matters
- because whatever is used inside the FindCUDA module must also be used
- outside - the two forms of target_link_libraries cannot be mixed.
-
- CUDA_GENERATED_OUTPUT_DIR (Default CMAKE_CURRENT_BINARY_DIR)
- -- Set to the path you wish to have the generated files placed. If it is
- blank output files will be placed in CMAKE_CURRENT_BINARY_DIR.
- Intermediate files will always be placed in
- CMAKE_CURRENT_BINARY_DIR/CMakeFiles.
-
- CUDA_HOST_COMPILATION_CPP (Default ON)
- -- Set to OFF for C compilation of host code.
-
- 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,
- 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.
- If the CUDAHOSTCXX environment variable is set it will
- be used as the default.
+``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: host bit size)
+ Set to ``ON`` to compile for 64 bit device code, OFF for 32 bit device code.
+ Note that making this different from the host code when generating object
+ or C files from CUDA code just won't work, because size_t gets defined by
+ nvcc in the generated source. If you compile to PTX and then load the
+ file yourself, you can mix bit sizes between device and host.
+
+``CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE`` (Default: ``ON``)
+ Set to ``ON`` if you want the custom build rule to be attached to the source
+ file in Visual Studio. Turn OFF if you add the same cuda file to multiple
+ targets.
+
+ This allows the user to build the target from the CUDA file; however, bad
+ things can happen if the CUDA source file is added to multiple targets.
+ When performing parallel builds it is possible for the custom build
+ command to be run more than once and in parallel causing cryptic build
+ errors. VS runs the rules for every source file in the target, and a
+ source can have only one rule no matter how many projects it is added to.
+ When the rule is run from multiple targets race conditions can occur on
+ the generated file. Eventually everything will get built, but if the user
+ is unaware of this behavior, there may be confusion. It would be nice if
+ this script could detect the reuse of source files across multiple targets
+ and turn the option off for the user, but no good solution could be found.
+
+``CUDA_BUILD_CUBIN`` (Default: ``OFF``)
+ Set to ``ON`` to enable and extra compilation pass with the ``-cubin`` option in
+ Device mode. The output is parsed and register, shared memory usage is
+ printed during build.
+
+``CUDA_BUILD_EMULATION`` (Default: ``OFF`` for device mode)
+ Set to ``ON`` for Emulation mode. ``-D_DEVICEEMU`` is defined for CUDA C files
+ when ``CUDA_BUILD_EMULATION`` is ``TRUE``.
+
+``CUDA_LINK_LIBRARIES_KEYWORD`` (Default: ``""``)
+ .. versionadded:: 3.9
+
+ The ``<PRIVATE|PUBLIC|INTERFACE>`` keyword to use for internal
+ :command:`target_link_libraries` calls. The default is to use no keyword which
+ uses the old "plain" form of :command:`target_link_libraries`. Note that is matters
+ because whatever is used inside the ``FindCUDA`` module must also be used
+ outside - the two forms of :command:`target_link_libraries` cannot be mixed.
+
+``CUDA_GENERATED_OUTPUT_DIR`` (Default: :variable:`CMAKE_CURRENT_BINARY_DIR`)
+ Set to the path you wish to have the generated files placed. If it is
+ blank output files will be placed in :variable:`CMAKE_CURRENT_BINARY_DIR`.
+ Intermediate files will always be placed in
+ ``CMAKE_CURRENT_BINARY_DIR/CMakeFiles``.
+
+``CUDA_HOST_COMPILATION_CPP`` (Default: ``ON``)
+ Set to ``OFF`` for C compilation of host code.
+
+``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,
+ 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.
+
+ .. versionadded:: 3.13
+ If the :envvar:`CUDAHOSTCXX` environment variable is set it will
+ be used as the default.
+
+``CUDA_NVCC_FLAGS``, ``CUDA_NVCC_FLAGS_<CONFIG>``
+ Additional NVCC command line arguments. NOTE: multiple arguments must be
+ semi-colon delimited (e.g. ``--compiler-options;-Wall``)
+
+ .. versionadded:: 3.6
+ Contents of these variables may use
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+``CUDA_PROPAGATE_HOST_FLAGS`` (Default: ``ON``)
+ Set to ``ON`` to propagate :variable:`CMAKE_{C,CXX}_FLAGS <CMAKE_<LANG>_FLAGS>` and their configuration
+ dependent counterparts (e.g. ``CMAKE_C_FLAGS_DEBUG``) automatically to the
+ host compiler through nvcc's ``-Xcompiler`` flag. This helps make the
+ generated host code match the rest of the system better. Sometimes
+ certain flags give nvcc problems, and this will help you turn the flag
+ propagation off. This does not affect the flags supplied directly to nvcc
+ via ``CUDA_NVCC_FLAGS`` or through the ``OPTION`` flags specified through
+ ``cuda_add_library()``, ``cuda_add_executable()``, or ``cuda_wrap_srcs()``. Flags used for
+ shared library compilation are not affected by this flag.
- CUDA_NVCC_FLAGS
- CUDA_NVCC_FLAGS_<CONFIG>
- -- Additional NVCC command line arguments. NOTE: multiple arguments must be
- semi-colon delimited (e.g. --compiler-options;-Wall)
-
- CUDA_PROPAGATE_HOST_FLAGS (Default ON)
- -- Set to ON to propagate CMAKE_{C,CXX}_FLAGS and their configuration
- dependent counterparts (e.g. CMAKE_C_FLAGS_DEBUG) automatically to the
- host compiler through nvcc's -Xcompiler flag. This helps make the
- generated host code match the rest of the system better. Sometimes
- certain flags give nvcc problems, and this will help you turn the flag
- propagation off. This does not affect the flags supplied directly to nvcc
- via CUDA_NVCC_FLAGS or through the OPTION flags specified through
- CUDA_ADD_LIBRARY, CUDA_ADD_EXECUTABLE, or CUDA_WRAP_SRCS. Flags used for
- shared library compilation are not affected by this flag.
-
- CUDA_SEPARABLE_COMPILATION (Default OFF)
- -- If set this will enable separable compilation for all CUDA runtime object
- files. If used outside of CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY
- (e.g. calling CUDA_WRAP_SRCS directly),
- CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME and
- CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS should be called.
-
- CUDA_SOURCE_PROPERTY_FORMAT
- -- If this source file property is set, it can override the format specified
- to CUDA_WRAP_SRCS (OBJ, PTX, CUBIN, or FATBIN). If an input source file
- is not a .cu file, setting this file will cause it to be treated as a .cu
- file. See documentation for set_source_files_properties on how to set
- this property.
-
- CUDA_USE_STATIC_CUDA_RUNTIME (Default ON)
- -- When enabled the static version of the CUDA runtime library will be used
- in CUDA_LIBRARIES. If the version of CUDA configured doesn't support
- this option, then it will be silently disabled.
-
- CUDA_VERBOSE_BUILD (Default OFF)
- -- Set to ON to see all the commands used when building the CUDA file. When
- using a Makefile generator the value defaults to VERBOSE (run make
- VERBOSE=1 to see output), although setting CUDA_VERBOSE_BUILD to ON will
- always print the output.
-
-The script creates the following macros (in alphabetical order)::
-
- CUDA_ADD_CUFFT_TO_TARGET( cuda_target )
- -- Adds the cufft library to the target (can be any target). Handles whether
- you are in emulation mode or not.
-
- CUDA_ADD_CUBLAS_TO_TARGET( cuda_target )
- -- Adds the cublas library to the target (can be any target). Handles
- whether you are in emulation mode or not.
-
- CUDA_ADD_EXECUTABLE( cuda_target file0 file1 ...
- [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
- -- Creates an executable "cuda_target" which is made up of the files
- specified. All of the non CUDA C files are compiled using the standard
- build rules specified by CMAKE and the cuda files are compiled to object
- files using nvcc and the host compiler. In addition CUDA_INCLUDE_DIRS is
- added automatically to include_directories(). Some standard CMake target
- calls can be used on the target after calling this macro
- (e.g. set_target_properties and target_link_libraries), but setting
- properties that adjust compilation flags will not affect code compiled by
- nvcc. Such flags should be modified before calling CUDA_ADD_EXECUTABLE,
- CUDA_ADD_LIBRARY or CUDA_WRAP_SRCS.
-
- CUDA_ADD_LIBRARY( cuda_target file0 file1 ...
- [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
- -- Same as CUDA_ADD_EXECUTABLE except that a library is created.
-
- CUDA_BUILD_CLEAN_TARGET()
- -- Creates a convenience target that deletes all the dependency files
- generated. You should make clean after running this target to ensure the
- dependency files get regenerated.
-
- CUDA_COMPILE( generated_files file0 file1 ... [STATIC | SHARED | MODULE]
- [OPTIONS ...] )
- -- Returns a list of generated files from the input source files to be used
- with ADD_LIBRARY or ADD_EXECUTABLE.
-
- CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] )
- -- Returns a list of PTX files generated from the input source files.
-
- CUDA_COMPILE_FATBIN( generated_files file0 file1 ... [OPTIONS ...] )
- -- Returns a list of FATBIN files generated from the input source files.
-
- CUDA_COMPILE_CUBIN( generated_files file0 file1 ... [OPTIONS ...] )
- -- Returns a list of CUBIN files generated from the input source files.
-
- CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME( output_file_var
- cuda_target
- object_files )
- -- Compute the name of the intermediate link file used for separable
- compilation. This file name is typically passed into
- CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS. output_file_var is produced
- based on cuda_target the list of objects files that need separable
- compilation as specified by object_files. If the object_files list is
- empty, then output_file_var will be empty. This function is called
- automatically for CUDA_ADD_LIBRARY and CUDA_ADD_EXECUTABLE. Note that
- this is a function and not a macro.
-
- CUDA_INCLUDE_DIRECTORIES( path0 path1 ... )
- -- Sets the directories that should be passed to nvcc
- (e.g. nvcc -Ipath0 -Ipath1 ... ). These paths usually contain other .cu
- files.
-
-
- CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS( output_file_var cuda_target
- nvcc_flags object_files)
- -- Generates the link object required by separable compilation from the given
- object files. This is called automatically for CUDA_ADD_EXECUTABLE and
- CUDA_ADD_LIBRARY, but can be called manually when using CUDA_WRAP_SRCS
- directly. When called from CUDA_ADD_LIBRARY or CUDA_ADD_EXECUTABLE the
- nvcc_flags passed in are the same as the flags passed in via the OPTIONS
- argument. The only nvcc flag added automatically is the bitness flag as
- specified by CUDA_64_BIT_DEVICE_CODE. Note that this is a function
- instead of a macro.
-
- CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable [target_CUDA_architectures])
- -- Selects GPU arch flags for nvcc based on target_CUDA_architectures
- target_CUDA_architectures : Auto | Common | All | LIST(ARCH_AND_PTX ...)
- - "Auto" detects local machine GPU compute arch at runtime.
- - "Common" and "All" cover common and entire subsets of architectures
- ARCH_AND_PTX : NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX
- NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal
- NUM: Any number. Only those pairs are currently accepted by NVCC though:
- 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2
- Returns LIST of flags to be added to CUDA_NVCC_FLAGS in ${out_variable}
- Additionally, sets ${out_variable}_readable to the resulting numeric list
- Example:
- CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell)
- LIST(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})
-
- More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA
- Note that this is a function instead of a macro.
-
- CUDA_WRAP_SRCS ( cuda_target format generated_files file0 file1 ...
- [STATIC | SHARED | MODULE] [OPTIONS ...] )
- -- This is where all the magic happens. CUDA_ADD_EXECUTABLE,
- CUDA_ADD_LIBRARY, CUDA_COMPILE, and CUDA_COMPILE_PTX all call this
- function under the hood.
-
- Given the list of files (file0 file1 ... fileN) this macro generates
- custom commands that generate either PTX or linkable objects (use "PTX" or
- "OBJ" for the format argument to switch). Files that don't end with .cu
- or have the HEADER_FILE_ONLY property are ignored.
-
- The arguments passed in after OPTIONS are extra command line options to
- give to nvcc. You can also specify per configuration options by
- specifying the name of the configuration followed by the options. General
- options must precede configuration specific options. Not all
- configurations need to be specified, only the ones provided will be used.
-
- OPTIONS -DFLAG=2 "-DFLAG_OTHER=space in flag"
- DEBUG -g
- RELEASE --use_fast_math
- RELWITHDEBINFO --use_fast_math;-g
- MINSIZEREL --use_fast_math
-
- For certain configurations (namely VS generating object files with
- CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE set to ON), no generated file will
- be produced for the given cuda file. This is because when you add the
- cuda file to Visual Studio it knows that this file produces an object file
- and will link in the resulting object file automatically.
-
- This script will also generate a separate cmake script that is used at
- build time to invoke nvcc. This is for several reasons.
-
- 1. nvcc can return negative numbers as return values which confuses
- Visual Studio into thinking that the command succeeded. The script now
- checks the error codes and produces errors when there was a problem.
-
- 2. nvcc has been known to not delete incomplete results when it
- encounters problems. This confuses build systems into thinking the
- target was generated when in fact an unusable file exists. The script
- now deletes the output files if there was an error.
-
- 3. By putting all the options that affect the build into a file and then
- make the build rule dependent on the file, the output files will be
- regenerated when the options change.
-
- This script also looks at optional arguments STATIC, SHARED, or MODULE to
- determine when to target the object compilation for a shared library.
- BUILD_SHARED_LIBS is ignored in CUDA_WRAP_SRCS, but it is respected in
- CUDA_ADD_LIBRARY. On some systems special flags are added for building
- objects intended for shared libraries. A preprocessor macro,
- <target_name>_EXPORTS is defined when a shared library compilation is
- detected.
-
- Flags passed into add_definitions with -D or /D are passed along to nvcc.
-
-
-
-The script defines the following variables::
-
- CUDA_VERSION_MAJOR -- The major version of cuda as reported by nvcc.
- CUDA_VERSION_MINOR -- The minor version.
- CUDA_VERSION
- CUDA_VERSION_STRING -- CUDA_VERSION_MAJOR.CUDA_VERSION_MINOR
- CUDA_HAS_FP16 -- Whether a short float (float16,fp16) is supported.
-
- CUDA_TOOLKIT_ROOT_DIR -- Path to the CUDA Toolkit (defined if not set).
- CUDA_SDK_ROOT_DIR -- Path to the CUDA SDK. Use this to find files in the
- SDK. This script will not directly support finding
- specific libraries or headers, as that isn't
- supported by NVIDIA. If you want to change
- libraries when the path changes see the
- FindCUDA.cmake script for an example of how to clear
- these variables. There are also examples of how to
- use the CUDA_SDK_ROOT_DIR to locate headers or
- libraries, if you so choose (at your own risk).
- CUDA_INCLUDE_DIRS -- Include directory for cuda headers. Added automatically
- for CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY.
- CUDA_LIBRARIES -- Cuda RT library.
- CUDA_CUFFT_LIBRARIES -- Device or emulation library for the Cuda FFT
- implementation (alternative to:
- CUDA_ADD_CUFFT_TO_TARGET macro)
- CUDA_CUBLAS_LIBRARIES -- Device or emulation library for the Cuda BLAS
- implementation (alternative to:
- CUDA_ADD_CUBLAS_TO_TARGET macro).
- CUDA_cudart_static_LIBRARY -- Statically linkable cuda runtime library.
- Only available for CUDA version 5.5+
- CUDA_cudadevrt_LIBRARY -- Device runtime library.
- Required for separable compilation.
- CUDA_cupti_LIBRARY -- CUDA Profiling Tools Interface library.
- Only available for CUDA version 4.0+.
- CUDA_curand_LIBRARY -- CUDA Random Number Generation library.
- Only available for CUDA version 3.2+.
- CUDA_cusolver_LIBRARY -- CUDA Direct Solver library.
- Only available for CUDA version 7.0+.
- CUDA_cusparse_LIBRARY -- CUDA Sparse Matrix library.
- Only available for CUDA version 3.2+.
- CUDA_npp_LIBRARY -- NVIDIA Performance Primitives lib.
- Only available for CUDA version 4.0+.
- CUDA_nppc_LIBRARY -- NVIDIA Performance Primitives lib (core).
- Only available for CUDA version 5.5+.
- CUDA_nppi_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
- Only available for CUDA version 5.5 - 8.0.
- CUDA_nppial_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
- Only available for CUDA version 9.0.
- CUDA_nppicc_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
- Only available for CUDA version 9.0.
- CUDA_nppicom_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
- Only available for CUDA version 9.0 - 10.2.
- Replaced by nvjpeg.
- CUDA_nppidei_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
- Only available for CUDA version 9.0.
- CUDA_nppif_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
- Only available for CUDA version 9.0.
- CUDA_nppig_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
- Only available for CUDA version 9.0.
- CUDA_nppim_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
- Only available for CUDA version 9.0.
- CUDA_nppist_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
- Only available for CUDA version 9.0.
- CUDA_nppisu_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
- Only available for CUDA version 9.0.
- CUDA_nppitc_LIBRARY -- NVIDIA Performance Primitives lib (image processing).
- Only available for CUDA version 9.0.
- CUDA_npps_LIBRARY -- NVIDIA Performance Primitives lib (signal processing).
- Only available for CUDA version 5.5+.
- CUDA_nvcuvenc_LIBRARY -- CUDA Video Encoder library.
- Only available for CUDA version 3.2+.
- Windows only.
- CUDA_nvcuvid_LIBRARY -- CUDA Video Decoder library.
- Only available for CUDA version 3.2+.
- Windows only.
- CUDA_nvToolsExt_LIBRARY
- -- NVIDA CUDA Tools Extension library.
- Available for CUDA version 5+.
- CUDA_OpenCL_LIBRARY -- NVIDA CUDA OpenCL library.
- Available for CUDA version 5+.
+``CUDA_SEPARABLE_COMPILATION`` (Default: ``OFF``)
+ If set this will enable separable compilation for all CUDA runtime object
+ files. If used outside of ``cuda_add_executable()`` and ``cuda_add_library()``
+ (e.g. calling ``cuda_wrap_srcs()`` directly),
+ ``cuda_compute_separable_compilation_object_file_name()`` and
+ ``cuda_link_separable_compilation_objects()`` should be called.
+
+``CUDA_SOURCE_PROPERTY_FORMAT``
+ .. versionadded:: 3.3
+
+ If this source file property is set, it can override the format specified
+ to ``cuda_wrap_srcs()`` (``OBJ``, ``PTX``, ``CUBIN``, or ``FATBIN``). If an input source file
+ is not a ``.cu`` file, setting this file will cause it to be treated as a ``.cu``
+ file. See documentation for set_source_files_properties on how to set
+ this property.
+
+``CUDA_USE_STATIC_CUDA_RUNTIME`` (Default: ``ON``)
+ .. versionadded:: 3.3
+
+ When enabled the static version of the CUDA runtime library will be used
+ in ``CUDA_LIBRARIES``. If the version of CUDA configured doesn't support
+ this option, then it will be silently disabled.
+
+``CUDA_VERBOSE_BUILD`` (Default: ``OFF``)
+ Set to ``ON`` to see all the commands used when building the CUDA file. When
+ using a Makefile generator the value defaults to ``VERBOSE`` (run
+ ``make VERBOSE=1`` to see output), although setting ``CUDA_VERBOSE_BUILD`` to ``ON`` will
+ always print the output.
+
+Commands
+""""""""
+
+The script creates the following functions and macros (in alphabetical order):
+
+.. code-block:: cmake
+
+ cuda_add_cufft_to_target(<cuda_target>)
+
+Adds the cufft library to the target (can be any target). Handles whether
+you are in emulation mode or not.
+
+.. code-block:: cmake
+
+ cuda_add_cublas_to_target(<cuda_target>)
+
+Adds the cublas library to the target (can be any target). Handles
+whether you are in emulation mode or not.
+
+.. code-block:: cmake
+
+ cuda_add_executable(<cuda_target> <file>...
+ [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] [OPTIONS ...])
+
+Creates an executable ``<cuda_target>`` which is made up of the files
+specified. All of the non CUDA C files are compiled using the standard
+build rules specified by CMake and the CUDA files are compiled to object
+files using nvcc and the host compiler. In addition ``CUDA_INCLUDE_DIRS`` is
+added automatically to :command:`include_directories`. Some standard CMake target
+calls can be used on the target after calling this macro
+(e.g. :command:`set_target_properties` and :command:`target_link_libraries`), but setting
+properties that adjust compilation flags will not affect code compiled by
+nvcc. Such flags should be modified before calling ``cuda_add_executable()``,
+``cuda_add_library()`` or ``cuda_wrap_srcs()``.
+
+.. code-block:: cmake
+
+ cuda_add_library(<cuda_target> <file>...
+ [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...])
+
+Same as ``cuda_add_executable()`` except that a library is created.
+
+.. code-block:: cmake
+
+ cuda_build_clean_target()
+
+Creates a convenience target that deletes all the dependency files
+generated. You should make clean after running this target to ensure the
+dependency files get regenerated.
+
+.. code-block:: cmake
+
+ cuda_compile(<generated_files> <file>... [STATIC | SHARED | MODULE]
+ [OPTIONS ...])
+
+Returns a list of generated files from the input source files to be used
+with :command:`add_library` or :command:`add_executable`.
+
+.. code-block:: cmake
+
+ cuda_compile_ptx(<generated_files> <file>... [OPTIONS ...])
+
+Returns a list of ``PTX`` files generated from the input source files.
+
+.. code-block:: cmake
+
+ cuda_compile_fatbin(<generated_files> <file>... [OPTIONS ...])
+
+.. versionadded:: 3.1
+
+Returns a list of ``FATBIN`` files generated from the input source files.
+
+.. code-block:: cmake
+
+ cuda_compile_cubin(<generated_files> <file>... [OPTIONS ...])
+
+.. versionadded:: 3.1
+
+Returns a list of ``CUBIN`` files generated from the input source files.
+
+.. code-block:: cmake
+
+ cuda_compute_separable_compilation_object_file_name(<output_file_var>
+ <cuda_target>
+ <object_files>)
+
+Compute the name of the intermediate link file used for separable
+compilation. This file name is typically passed into
+``CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS``. output_file_var is produced
+based on cuda_target the list of objects files that need separable
+compilation as specified by ``<object_files>``. If the ``<object_files>`` list is
+empty, then ``<output_file_var>`` will be empty. This function is called
+automatically for ``cuda_add_library()`` and ``cuda_add_executable()``. Note that
+this is a function and not a macro.
+
+.. code-block:: cmake
+
+ cuda_include_directories(path0 path1 ...)
+
+Sets the directories that should be passed to nvcc
+(e.g. ``nvcc -Ipath0 -Ipath1 ...``). These paths usually contain other ``.cu``
+files.
+
+.. code-block:: cmake
+
+ cuda_link_separable_compilation_objects(<output_file_var> <cuda_target>
+ <nvcc_flags> <object_files>)
+
+Generates the link object required by separable compilation from the given
+object files. This is called automatically for ``cuda_add_executable()`` and
+``cuda_add_library()``, but can be called manually when using ``cuda_wrap_srcs()``
+directly. When called from ``cuda_add_library()`` or ``cuda_add_executable()`` the
+``<nvcc_flags>`` passed in are the same as the flags passed in via the ``OPTIONS``
+argument. The only nvcc flag added automatically is the bitness flag as
+specified by ``CUDA_64_BIT_DEVICE_CODE``. Note that this is a function
+instead of a macro.
+
+.. code-block:: cmake
+
+ cuda_select_nvcc_arch_flags(<out_variable> [<target_CUDA_architecture> ...])
+
+Selects GPU arch flags for nvcc based on ``target_CUDA_architecture``.
+
+Values for ``target_CUDA_architecture``:
+
+* ``Auto``: detects local machine GPU compute arch at runtime.
+* ``Common`` and ``All``: cover common and entire subsets of architectures.
+* ``<name>``: one of ``Fermi``, ``Kepler``, ``Maxwell``, ``Kepler+Tegra``, ``Kepler+Tesla``, ``Maxwell+Tegra``, ``Pascal``.
+* ``<ver>``, ``<ver>(<ver>)``, ``<ver>+PTX``, where ``<ver>`` is one of
+ ``2.0``, ``2.1``, ``3.0``, ``3.2``, ``3.5``, ``3.7``, ``5.0``, ``5.2``, ``5.3``, ``6.0``, ``6.2``.
+
+Returns list of flags to be added to ``CUDA_NVCC_FLAGS`` in ``<out_variable>``.
+Additionally, sets ``<out_variable>_readable`` to the resulting numeric list.
+
+Example::
+
+ cuda_select_nvcc_arch_flags(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell)
+ list(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})
+
+More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA.
+Note that this is a function instead of a macro.
+
+.. code-block:: cmake
+
+ cuda_wrap_srcs(<cuda_target> <format> <generated_files> <file>...
+ [STATIC | SHARED | MODULE] [OPTIONS ...])
+
+This is where all the magic happens. ``cuda_add_executable()``,
+``cuda_add_library()``, ``cuda_compile()``, and ``cuda_compile_ptx()`` all call this
+function under the hood.
+
+Given the list of files ``<file>...`` this macro generates
+custom commands that generate either PTX or linkable objects (use ``PTX`` or
+``OBJ`` for the ``<format>`` argument to switch). Files that don't end with ``.cu``
+or have the ``HEADER_FILE_ONLY`` property are ignored.
+
+The arguments passed in after ``OPTIONS`` are extra command line options to
+give to nvcc. You can also specify per configuration options by
+specifying the name of the configuration followed by the options. General
+options must precede configuration specific options. Not all
+configurations need to be specified, only the ones provided will be used.
+For example:
+
+.. code-block:: cmake
+
+ cuda_add_executable(...
+ OPTIONS -DFLAG=2 "-DFLAG_OTHER=space in flag"
+ DEBUG -g
+ RELEASE --use_fast_math
+ RELWITHDEBINFO --use_fast_math;-g
+ MINSIZEREL --use_fast_math)
+
+For certain configurations (namely VS generating object files with
+``CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE`` set to ``ON``), no generated file will
+be produced for the given cuda file. This is because when you add the
+cuda file to Visual Studio it knows that this file produces an object file
+and will link in the resulting object file automatically.
+
+This script will also generate a separate cmake script that is used at
+build time to invoke nvcc. This is for several reasons:
+
+* nvcc can return negative numbers as return values which confuses
+ Visual Studio into thinking that the command succeeded. The script now
+ checks the error codes and produces errors when there was a problem.
+
+* nvcc has been known to not delete incomplete results when it
+ encounters problems. This confuses build systems into thinking the
+ target was generated when in fact an unusable file exists. The script
+ now deletes the output files if there was an error.
+
+* By putting all the options that affect the build into a file and then
+ make the build rule dependent on the file, the output files will be
+ regenerated when the options change.
+
+This script also looks at optional arguments ``STATIC``, ``SHARED``, or ``MODULE`` to
+determine when to target the object compilation for a shared library.
+:variable:`BUILD_SHARED_LIBS` is ignored in ``cuda_wrap_srcs()``, but it is respected in
+``cuda_add_library()``. On some systems special flags are added for building
+objects intended for shared libraries. A preprocessor macro,
+``<target_name>_EXPORTS`` is defined when a shared library compilation is
+detected.
+
+Flags passed into add_definitions with ``-D`` or ``/D`` are passed along to nvcc.
+
+Result Variables
+""""""""""""""""
+
+The script defines the following variables:
+
+``CUDA_VERSION_MAJOR``
+ The major version of cuda as reported by nvcc.
+
+``CUDA_VERSION_MINOR``
+ The minor version.
+
+``CUDA_VERSION``, ``CUDA_VERSION_STRING``
+ Full version in the ``X.Y`` format.
+
+``CUDA_HAS_FP16``
+ .. versionadded:: 3.6
+ Whether a short float (``float16``, ``fp16``) is supported.
+
+``CUDA_TOOLKIT_ROOT_DIR``
+ Path to the CUDA Toolkit (defined if not set).
+
+``CUDA_SDK_ROOT_DIR``
+ Path to the CUDA SDK. Use this to find files in the SDK. This script will
+ not directly support finding specific libraries or headers, as that isn't
+ supported by NVIDIA. If you want to change libraries when the path changes
+ see the ``FindCUDA.cmake`` script for an example of how to clear these
+ variables. There are also examples of how to use the ``CUDA_SDK_ROOT_DIR``
+ to locate headers or libraries, if you so choose (at your own risk).
+
+``CUDA_INCLUDE_DIRS``
+ Include directory for cuda headers. Added automatically
+ for ``cuda_add_executable()`` and ``cuda_add_library()``.
+
+``CUDA_LIBRARIES``
+ Cuda RT library.
+
+``CUDA_CUFFT_LIBRARIES``
+ Device or emulation library for the Cuda FFT implementation (alternative to
+ ``cuda_add_cufft_to_target()`` macro)
+
+``CUDA_CUBLAS_LIBRARIES``
+ Device or emulation library for the Cuda BLAS implementation (alternative to
+ ``cuda_add_cublas_to_target()`` macro).
+
+``CUDA_cudart_static_LIBRARY``
+ Statically linkable cuda runtime library.
+ Only available for CUDA version 5.5+.
+
+``CUDA_cudadevrt_LIBRARY``
+ .. versionadded:: 3.7
+ Device runtime library. Required for separable compilation.
+
+``CUDA_cupti_LIBRARY``
+ CUDA Profiling Tools Interface library.
+ Only available for CUDA version 4.0+.
+
+``CUDA_curand_LIBRARY``
+ CUDA Random Number Generation library.
+ Only available for CUDA version 3.2+.
+
+``CUDA_cusolver_LIBRARY``
+ .. versionadded:: 3.2
+ CUDA Direct Solver library.
+ Only available for CUDA version 7.0+.
+
+``CUDA_cusparse_LIBRARY``
+ CUDA Sparse Matrix library.
+ Only available for CUDA version 3.2+.
+
+``CUDA_npp_LIBRARY``
+ NVIDIA Performance Primitives lib.
+ Only available for CUDA version 4.0+.
+
+``CUDA_nppc_LIBRARY``
+ NVIDIA Performance Primitives lib (core).
+ Only available for CUDA version 5.5+.
+
+``CUDA_nppi_LIBRARY``
+ NVIDIA Performance Primitives lib (image processing).
+ Only available for CUDA version 5.5 - 8.0.
+
+``CUDA_nppial_LIBRARY``
+ NVIDIA Performance Primitives lib (image processing).
+ Only available for CUDA version 9.0.
+
+``CUDA_nppicc_LIBRARY``
+ NVIDIA Performance Primitives lib (image processing).
+ Only available for CUDA version 9.0.
+
+``CUDA_nppicom_LIBRARY``
+ NVIDIA Performance Primitives lib (image processing).
+ Only available for CUDA version 9.0 - 10.2.
+ Replaced by nvjpeg.
+
+``CUDA_nppidei_LIBRARY``
+ NVIDIA Performance Primitives lib (image processing).
+ Only available for CUDA version 9.0.
+
+``CUDA_nppif_LIBRARY``
+ NVIDIA Performance Primitives lib (image processing).
+ Only available for CUDA version 9.0.
+
+``CUDA_nppig_LIBRARY``
+ NVIDIA Performance Primitives lib (image processing).
+ Only available for CUDA version 9.0.
+
+``CUDA_nppim_LIBRARY``
+ NVIDIA Performance Primitives lib (image processing).
+ Only available for CUDA version 9.0.
+
+``CUDA_nppist_LIBRARY``
+ NVIDIA Performance Primitives lib (image processing).
+ Only available for CUDA version 9.0.
+
+``CUDA_nppisu_LIBRARY``
+ NVIDIA Performance Primitives lib (image processing).
+ Only available for CUDA version 9.0.
+
+``CUDA_nppitc_LIBRARY``
+ NVIDIA Performance Primitives lib (image processing).
+ Only available for CUDA version 9.0.
+
+``CUDA_npps_LIBRARY``
+ NVIDIA Performance Primitives lib (signal processing).
+ Only available for CUDA version 5.5+.
+
+``CUDA_nvcuvenc_LIBRARY``
+ CUDA Video Encoder library.
+ Only available for CUDA version 3.2+.
+ Windows only.
+
+``CUDA_nvcuvid_LIBRARY``
+ CUDA Video Decoder library.
+ Only available for CUDA version 3.2+.
+ Windows only.
+
+``CUDA_nvToolsExt_LIBRARY``
+ .. versionadded:: 3.16
+ NVIDA CUDA Tools Extension library.
+ Available for CUDA version 5+.
+
+``CUDA_OpenCL_LIBRARY``
+ .. versionadded:: 3.16
+ NVIDA CUDA OpenCL library.
+ Available for CUDA version 5+.
#]=======================================================================]
@@ -702,8 +834,19 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR AND NOT CMAKE_CROSSCOMPILING)
)
if (CUDA_TOOLKIT_ROOT_DIR_NVCC)
- get_filename_component(CUDA_TOOLKIT_ROOT_DIR_NVCC_PAR "${CUDA_TOOLKIT_ROOT_DIR_NVCC}" DIRECTORY)
- get_filename_component(CUDA_TOOLKIT_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR_NVCC_PAR}" DIRECTORY CACHE)
+ # Given that NVCC can be provided by multiple different sources (NVIDIA HPC SDK, CUDA Toolkit, distro)
+ # each of which has a different layout, we need to extract the CUDA toolkit root from the compiler
+ # itself, allowing us to support numerous different scattered toolkit layouts
+ execute_process(COMMAND ${CUDA_TOOLKIT_ROOT_DIR_NVCC} "-v" "__cmake_determine_cuda"
+ OUTPUT_VARIABLE _CUDA_NVCC_OUT ERROR_VARIABLE _CUDA_NVCC_OUT)
+ if(_CUDA_NVCC_OUT MATCHES "TOP=([^\r\n]*)")
+ get_filename_component(CUDA_TOOLKIT_ROOT_DIR "${CMAKE_MATCH_1}" ABSOLUTE CACHE)
+ else()
+ get_filename_component(CUDA_TOOLKIT_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR_NVCC}" DIRECTORY)
+ get_filename_component(CUDA_TOOLKIT_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR}" DIRECTORY CACHE)
+ endif()
+ unset(_CUDA_NVCC_OUT)
+
string(REGEX REPLACE "[/\\\\]?bin[64]*[/\\\\]?$" "" CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR})
# We need to force this back into the cache.
set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH "Toolkit location." FORCE)
diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake
index 93512882df..a35b3f8ff8 100644
--- a/Modules/FindCUDA/select_compute_arch.cmake
+++ b/Modules/FindCUDA/select_compute_arch.cmake
@@ -25,44 +25,26 @@ if(CMAKE_CUDA_COMPILER_LOADED) # CUDA as a language
endif()
# See: https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-feature-list
+# Additions, deprecations, and removals can be found in the release notes:
+# https://developer.nvidia.com/cuda-toolkit-archive
-# This list will be used for CUDA_ARCH_NAME = All option
-set(CUDA_KNOWN_GPU_ARCHITECTURES "Fermi" "Kepler" "Maxwell")
+# The initial status here is for CUDA 7.0
+set(CUDA_KNOWN_GPU_ARCHITECTURES "Fermi" "Kepler" "Maxwell" "Kepler+Tegra" "Kepler+Tesla" "Maxwell+Tegra")
+set(CUDA_COMMON_GPU_ARCHITECTURES "2.0" "2.1" "3.0" "3.5" "5.0" "5.3")
+set(CUDA_LIMIT_GPU_ARCHITECTURE "6.0")
+set(CUDA_ALL_GPU_ARCHITECTURES "2.0" "2.1" "3.0" "3.2" "3.5" "3.7" "5.0" "5.2" "5.3")
+set(_CUDA_MAX_COMMON_ARCHITECTURE "5.2+PTX")
-# This list will be used for CUDA_ARCH_NAME = Common option (enabled by default)
-set(CUDA_COMMON_GPU_ARCHITECTURES "3.5" "5.0")
-# 3.0 is removed in CUDA 11, see:
-# https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#deprecated-features
-if(CUDA_VERSION VERSION_LESS "11.0")
- list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "3.0")
-endif()
-
-if(CUDA_VERSION VERSION_LESS "7.0")
- set(CUDA_LIMIT_GPU_ARCHITECTURE "5.2")
-endif()
-
-# This list is used to filter CUDA archs when autodetecting
-set(CUDA_ALL_GPU_ARCHITECTURES "3.0" "3.2" "3.5" "5.0")
-
-if(CUDA_VERSION VERSION_GREATER_EQUAL "7.0")
- list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Kepler+Tegra" "Kepler+Tesla" "Maxwell+Tegra")
- list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "5.2")
-
- if(CUDA_VERSION VERSION_LESS "8.0")
- list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "5.2+PTX")
- set(CUDA_LIMIT_GPU_ARCHITECTURE "6.0")
- endif()
-endif()
if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0")
list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Pascal")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "6.0" "6.1")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "6.0" "6.1" "6.2")
- if(CUDA_VERSION VERSION_LESS "9.0")
- list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "6.2+PTX")
- set(CUDA_LIMIT_GPU_ARCHITECTURE "7.0")
- endif()
+ set(_CUDA_MAX_COMMON_ARCHITECTURE "6.2+PTX")
+ set(CUDA_LIMIT_GPU_ARCHITECTURE "7.0")
+
+ list(REMOVE_ITEM CUDA_COMMON_GPU_ARCHITECTURES "2.0" "2.1")
endif ()
if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0")
@@ -70,10 +52,11 @@ if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "7.0")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "7.0" "7.2")
- if(CUDA_VERSION VERSION_LESS "10.0")
- list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "7.2+PTX")
- set(CUDA_LIMIT_GPU_ARCHITECTURE "8.0")
- endif()
+ set(_CUDA_MAX_COMMON_ARCHITECTURE "7.2+PTX")
+ set(CUDA_LIMIT_GPU_ARCHITECTURE "8.0")
+
+ list(REMOVE_ITEM CUDA_KNOWN_GPU_ARCHITECTURES "Fermi")
+ list(REMOVE_ITEM CUDA_ALL_GPU_ARCHITECTURES "2.0" "2.1")
endif()
if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0")
@@ -81,32 +64,46 @@ if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "7.5")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "7.5")
- if(CUDA_VERSION VERSION_LESS "11.0")
- list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "7.5+PTX")
- set(CUDA_LIMIT_GPU_ARCHITECTURE "8.0")
- endif()
+ set(_CUDA_MAX_COMMON_ARCHITECTURE "7.5+PTX")
+ set(CUDA_LIMIT_GPU_ARCHITECTURE "8.0")
+
+ list(REMOVE_ITEM CUDA_COMMON_GPU_ARCHITECTURES "3.0")
endif()
+# https://docs.nvidia.com/cuda/archive/11.0/cuda-toolkit-release-notes/index.html#cuda-general-new-features
+# https://docs.nvidia.com/cuda/archive/11.0/cuda-toolkit-release-notes/index.html#deprecated-features
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Ampere")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "8.0")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "8.0")
- if(CUDA_VERSION VERSION_LESS "11.1")
- list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "8.0+PTX")
- set(CUDA_LIMIT_GPU_ARCHITECTURE "8.6")
- endif()
+ set(_CUDA_MAX_COMMON_ARCHITECTURE "8.0+PTX")
+ set(CUDA_LIMIT_GPU_ARCHITECTURE "8.6")
+
+ list(REMOVE_ITEM CUDA_COMMON_GPU_ARCHITECTURES "3.5" "5.0")
+ list(REMOVE_ITEM CUDA_ALL_GPU_ARCHITECTURES "3.0" "3.2")
endif()
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
- list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "8.6" "8.6+PTX")
+ list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "8.6")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "8.6")
- if(CUDA_VERSION VERSION_LESS "12.0")
- set(CUDA_LIMIT_GPU_ARCHITECTURE "9.0")
- endif()
+ set(_CUDA_MAX_COMMON_ARCHITECTURE "8.6+PTX")
+ set(CUDA_LIMIT_GPU_ARCHITECTURE "9.0")
endif()
+list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "${_CUDA_MAX_COMMON_ARCHITECTURE}")
+
+# Check with: cmake -DCUDA_VERSION=7.0 -P select_compute_arch.cmake
+if(DEFINED CMAKE_SCRIPT_MODE_FILE)
+ include(CMakePrintHelpers)
+ cmake_print_variables(CUDA_KNOWN_GPU_ARCHITECTURES)
+ cmake_print_variables(CUDA_COMMON_GPU_ARCHITECTURES)
+ cmake_print_variables(CUDA_LIMIT_GPU_ARCHITECTURE)
+ cmake_print_variables(CUDA_ALL_GPU_ARCHITECTURES)
+endif()
+
+
################################################################################################
# A function for automatic detection of GPUs installed (if autodetection is enabled)
# Usage:
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index d4cd338d35..de2b068830 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -11,6 +11,9 @@ This script locates the NVIDIA CUDA toolkit and the associated libraries, but
does not require the ``CUDA`` language be enabled for a given project. This
module does not search for the NVIDIA CUDA Samples.
+.. versionadded:: 3.19
+ QNX support.
+
Search Behavior
^^^^^^^^^^^^^^^
@@ -426,6 +429,8 @@ Result variables
Runtime library ``cudart``.
``CUDAToolkit_LIBRARY_ROOT``
+ .. versionadded:: 3.18
+
The path to the CUDA Toolkit directory containing the nvvm directory and
version.txt.
@@ -513,12 +518,24 @@ else()
)
endif()
- if(CUDAToolkit_NVCC_EXECUTABLE)
- get_filename_component(CUDAToolkit_BIN_DIR "${CUDAToolkit_NVCC_EXECUTABLE}" DIRECTORY)
+ if(EXISTS "${CUDAToolkit_NVCC_EXECUTABLE}")
+ # If NVCC exists then invoke it to find the toolkit location.
+ # This allows us to support wrapper scripts (e.g. ccache or colornvcc), CUDA Toolkit,
+ # NVIDIA HPC SDK, and distro's splayed layouts
+ execute_process(COMMAND ${CUDAToolkit_NVCC_EXECUTABLE} "-v" "__cmake_determine_cuda"
+ OUTPUT_VARIABLE _CUDA_NVCC_OUT ERROR_VARIABLE _CUDA_NVCC_OUT)
+ if(_CUDA_NVCC_OUT MATCHES "TOP=([^\r\n]*)")
+ get_filename_component(CUDAToolkit_BIN_DIR "${CMAKE_MATCH_1}/bin" ABSOLUTE)
+ else()
+ get_filename_component(CUDAToolkit_BIN_DIR "${CUDAToolkit_NVCC_EXECUTABLE}" DIRECTORY)
+ endif()
+ unset(_CUDA_NVCC_OUT)
- set(CUDAToolkit_BIN_DIR "${CUDAToolkit_BIN_DIR}" CACHE PATH "" FORCE)
mark_as_advanced(CUDAToolkit_BIN_DIR)
- elseif(CUDAToolkit_SENTINEL_FILE)
+ set(CUDAToolkit_BIN_DIR "${CUDAToolkit_BIN_DIR}" CACHE PATH "" FORCE)
+ endif()
+
+ if(CUDAToolkit_SENTINEL_FILE)
get_filename_component(CUDAToolkit_BIN_DIR ${CUDAToolkit_SENTINEL_FILE} DIRECTORY ABSOLUTE)
set(CUDAToolkit_BIN_DIR "${CUDAToolkit_BIN_DIR}/bin")
@@ -721,6 +738,7 @@ elseif(NOT CUDAToolkit_FIND_QUIETLY)
endif()
if(CUDAToolkit_NVCC_EXECUTABLE AND
+ CMAKE_CUDA_COMPILER_VERSION AND
CUDAToolkit_NVCC_EXECUTABLE STREQUAL CMAKE_CUDA_COMPILER)
# Need to set these based off the already computed CMAKE_CUDA_COMPILER_VERSION value
# This if statement will always match, but is used to provide variables for MATCH 1,2,3...
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index 74b36c6f7c..e37d22591c 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -7,8 +7,11 @@ FindCURL
Find the native CURL headers and libraries.
-This module accept optional COMPONENTS to check supported features and
-protocols::
+.. versionadded:: 3.14
+ This module accept optional COMPONENTS to check supported features and
+ protocols:
+
+::
PROTOCOLS: ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3
POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP
@@ -18,6 +21,8 @@ protocols::
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.12
+
This module defines :prop_tgt:`IMPORTED` target ``CURL::libcurl``, if
curl has been found.
@@ -38,9 +43,14 @@ This module defines the following variables:
``CURL_VERSION_STRING``
The version of ``curl`` found.
+.. versionadded:: 3.13
+ Debug and Release variants are found separately.
+
CURL CMake
^^^^^^^^^^
+.. versionadded:: 3.17
+
If CURL was built using the CMake buildsystem then it provides its own
``CURLConfig.cmake`` file for use with the :command:`find_package` command's
config mode. This module looks for this file and, if found,
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
index 4e8232d072..cf0d3416a7 100644
--- a/Modules/FindCups.cmake
+++ b/Modules/FindCups.cmake
@@ -13,6 +13,8 @@ features this function (i.e. at least ``1.1.19``)
Imported targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.15
+
This module defines :prop_tgt:`IMPORTED` target ``Cups::Cups``, if Cups has
been found.
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index cde3a4d2d7..5e25deb68e 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -19,6 +19,8 @@ This module defines the following variables:
``CURSES_LIBRARIES``
The libraries needed to use Curses.
``CURSES_CFLAGS``
+ .. versionadded:: 3.16
+
Parameters which ought be given to C/C++ compilers when using Curses.
``CURSES_HAVE_CURSES_H``
True if curses.h is available.
@@ -31,8 +33,10 @@ This module defines the following variables:
Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the
``find_package(Curses)`` call if NCurses functionality is required.
-Set ``CURSES_NEED_WIDE`` to ``TRUE`` before the
-``find_package(Curses)`` call if unicode functionality is required.
+
+.. versionadded:: 3.10
+ Set ``CURSES_NEED_WIDE`` to ``TRUE`` before the
+ ``find_package(Curses)`` call if unicode functionality is required.
Backward Compatibility
^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index 81fbbb7585..bbf941efb1 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -6,8 +6,7 @@ FindDoxygen
-----------
Doxygen is a documentation generation tool (see http://www.doxygen.org).
-This module looks for Doxygen and some optional tools it supports. These
-tools are enabled as components in the :command:`find_package` command:
+This module looks for Doxygen and some optional tools it supports:
``dot``
`Graphviz <http://graphviz.org>`_ ``dot`` utility used to render various
@@ -19,7 +18,9 @@ tools are enabled as components in the :command:`find_package` command:
`Dia <https://wiki.gnome.org/Apps/Dia>`_ the diagram editor used by Doxygen's
``\diafile`` command.
-Examples:
+.. versionadded:: 3.9
+ These tools are available as components in the :command:`find_package` command.
+ For example:
.. code-block:: cmake
@@ -38,12 +39,13 @@ The following variables are defined by this module:
The version reported by ``doxygen --version``.
-The module defines ``IMPORTED`` targets for Doxygen and each component found.
-These can be used as part of custom commands, etc. and should be preferred over
-old-style (and now deprecated) variables like ``DOXYGEN_EXECUTABLE``. The
-following import targets are defined if their corresponding executable could be
-found (the component import targets will only be defined if that component was
-requested):
+.. versionadded:: 3.9
+ The module defines ``IMPORTED`` targets for Doxygen and each component found.
+ These can be used as part of custom commands, etc. and should be preferred over
+ old-style (and now deprecated) variables like ``DOXYGEN_EXECUTABLE``. The
+ following import targets are defined if their corresponding executable could be
+ found (the component import targets will only be defined if that component was
+ requested):
::
@@ -58,6 +60,8 @@ Functions
.. command:: doxygen_add_docs
+ .. versionadded:: 3.9
+
This function is intended as a convenience for adding a target for generating
documentation with Doxygen. It aims to provide sensible defaults so that
projects can generally just provide the input files and directories and that
@@ -93,19 +97,21 @@ Functions
the :command:`add_custom_target` command used to create the custom target
internally.
- If ``ALL`` is set, the target will be added to the default build target.
-
- If ``USE_STAMP_FILE`` is set, the custom command defined by this function will
- create a stamp file with the name ``<targetName>.stamp`` in the current
- binary directory whenever doxygen is re-run. With this option present, all
- items in ``<filesOrDirs>`` must be files (i.e. no directories, symlinks or
- wildcards) and each of the files must exist at the time
- ``doxygen_add_docs()`` is called. An error will be raised if any of the
- items listed is missing or is not a file when ``USE_STAMP_FILE`` is given.
- A dependency will be created on each of the files so that doxygen will only
- be re-run if one of the files is updated. Without the ``USE_STAMP_FILE``
- option, doxygen will always be re-run if the ``<targetName>`` target is built
- regardless of whether anything listed in ``<filesOrDirs>`` has changed.
+ .. versionadded:: 3.12
+ If ``ALL`` is set, the target will be added to the default build target.
+
+ .. versionadded:: 3.16
+ If ``USE_STAMP_FILE`` is set, the custom command defined by this function will
+ create a stamp file with the name ``<targetName>.stamp`` in the current
+ binary directory whenever doxygen is re-run. With this option present, all
+ items in ``<filesOrDirs>`` must be files (i.e. no directories, symlinks or
+ wildcards) and each of the files must exist at the time
+ ``doxygen_add_docs()`` is called. An error will be raised if any of the
+ items listed is missing or is not a file when ``USE_STAMP_FILE`` is given.
+ A dependency will be created on each of the files so that doxygen will only
+ be re-run if one of the files is updated. Without the ``USE_STAMP_FILE``
+ option, doxygen will always be re-run if the ``<targetName>`` target is built
+ regardless of whether anything listed in ``<filesOrDirs>`` has changed.
The contents of the generated ``Doxyfile`` can be customized by setting CMake
variables before calling ``doxygen_add_docs()``. Any variable with a name of
@@ -308,18 +314,19 @@ 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):
+.. versionadded:: 3.11
+ 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
@@ -341,6 +348,8 @@ The resultant ``Doxyfile`` will contain the following lines:
Deprecated Result Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^
+.. deprecated:: 3.9
+
For compatibility with previous versions of CMake, the following variables
are also defined but they are deprecated and should no longer be used:
@@ -375,6 +384,8 @@ are also defined but they are deprecated and should no longer be used:
Deprecated Hint Variables
^^^^^^^^^^^^^^^^^^^^^^^^^
+.. deprecated:: 3.9
+
.. variable:: DOXYGEN_SKIP_DOT
This variable has no effect for the component form of ``find_package``.
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index b0bb02a566..f9cb432078 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -11,6 +11,8 @@ Expat is a stream-oriented XML parser library written in C.
Imported Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.10
+
This module defines the following :prop_tgt:`IMPORTED` targets:
``EXPAT::EXPAT``
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index 13847367d0..e67e931125 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -37,11 +37,20 @@ If flex is found on the system, the module provides the macro:
)
which creates a custom command to generate the ``FlexOutput`` file from
-the ``FlexInput`` file. If ``COMPILE_FLAGS`` option is specified, the next
-parameter is added to the flex command line. If flex is configured to
-output a header file, the ``DEFINES_FILE`` option may be used to specify its
-name. Name is an alias used to get details of this custom command.
-Indeed the macro defines the following variables:
+the ``FlexInput`` file. Name is an alias used to get details of this custom
+command. If ``COMPILE_FLAGS`` option is specified, the next
+parameter is added to the flex command line.
+
+.. versionadded:: 3.5
+ If flex is configured to
+ output a header file, the ``DEFINES_FILE`` option may be used to specify its
+ name.
+
+.. versionchanged:: 3.17
+ When :policy:`CMP0098` is set to ``NEW``, ``flex`` runs in the
+ :variable:`CMAKE_CURRENT_BINARY_DIR` directory.
+
+The macro defines the following variables:
::
diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake
index e273642b5f..e1e239a662 100644
--- a/Modules/FindFLTK.cmake
+++ b/Modules/FindFLTK.cmake
@@ -77,6 +77,10 @@ The following cache variables are also available to set or use:
``FLTK_IMAGES_LIBRARY_DEBUG``
The FLTK Images library (debug)
+
+.. versionadded:: 3.11
+ Debug and Release variants are found separately and use per-configuration
+ variables.
#]=======================================================================]
if(NOT FLTK_SKIP_OPENGL)
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 3e6a177dcc..82885cb2f1 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -10,6 +10,8 @@ Find the FreeType font renderer includes and library.
Imported Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.10
+
This module defines the following :prop_tgt:`IMPORTED` target:
``Freetype::Freetype``
@@ -33,7 +35,10 @@ This module will set the following variables in your project:
``FREETYPE_LIBRARIES``
the library to link against
``FREETYPE_VERSION_STRING``
- the version of freetype found (since CMake 2.8.8)
+ the version of freetype found
+
+.. versionadded:: 3.7
+ Debug and Release variants are found separately.
Hints
^^^^^
diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake
index fde84d4889..5237e15135 100644
--- a/Modules/FindGDAL.cmake
+++ b/Modules/FindGDAL.cmake
@@ -10,6 +10,8 @@ Find Geospatial Data Abstraction Library (GDAL).
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.14
+
This module defines :prop_tgt:`IMPORTED` target ``GDAL::GDAL``
if GDAL has been found.
@@ -25,7 +27,8 @@ This module will set the following variables in your project:
``GDAL_LIBRARIES``
Libraries to link to GDAL.
``GDAL_VERSION``
- The version of GDAL found.
+ .. versionadded:: 3.14
+ The version of GDAL found.
Cache variables
^^^^^^^^^^^^^^^
@@ -42,6 +45,15 @@ Hints
Set ``GDAL_DIR`` or ``GDAL_ROOT`` in the environment to specify the
GDAL installation prefix.
+
+The following variables may be set to modify the search strategy:
+
+``FindGDAL_SKIP_GDAL_CONFIG``
+ If set, ``gdal-config`` will not be used. This can be useful if there are
+ GDAL libraries built with autotools (which provide the tool) and CMake (which
+ do not) in the same environment.
+``GDAL_ADDITIONAL_LIBRARY_VERSIONS``
+ Extra versions of library names to search for.
#]=======================================================================]
# $GDALDIR is an environment variable that would
@@ -65,12 +77,14 @@ find_path(GDAL_INCLUDE_DIR gdal.h
ENV GDAL_DIR
ENV GDAL_ROOT
PATH_SUFFIXES
- include/gdal
- include/GDAL
- include
+ include/gdal
+ include/GDAL
+ include
+ DOC "Path to the GDAL include directory"
)
+mark_as_advanced(GDAL_INCLUDE_DIR)
-if(UNIX)
+if(UNIX AND NOT FindGDAL_SKIP_GDAL_CONFIG)
# Use gdal-config to obtain the library version (this should hopefully
# allow us to -lgdal1.x.y where x.y are correct version)
# For some reason, libgdal development packages do not contain
@@ -80,10 +94,12 @@ if(UNIX)
ENV GDAL_DIR
ENV GDAL_ROOT
PATH_SUFFIXES bin
+ DOC "Path to the gdal-config tool"
)
+ mark_as_advanced(GDAL_CONFIG)
if(GDAL_CONFIG)
- exec_program(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS)
+ execute_process(COMMAND ${GDAL_CONFIG} --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS)
if(GDAL_CONFIG_LIBS)
# treat the output as a command line and split it up
@@ -131,14 +147,30 @@ if(UNIX)
endif()
endif()
+# GDAL name its library when built with CMake as `gdal${major}${minor}`.
+set(_gdal_versions
+ ${GDAL_ADDITIONAL_LIBRARY_VERSIONS} 3.0 2.4 2.3 2.2 2.1 2.0 1.11 1.10 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2)
+
+set(_gdal_libnames)
+foreach (_gdal_version IN LISTS _gdal_versions)
+ string(REPLACE "." "" _gdal_version "${_gdal_version}")
+ list(APPEND _gdal_libnames "gdal${_gdal_version}" "GDAL${_gdal_version}")
+endforeach ()
+unset(_gdal_version)
+unset(_gdal_versions)
+
find_library(GDAL_LIBRARY
- NAMES ${_gdal_lib} gdal gdal_i gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
+ NAMES ${_gdal_lib} ${_gdal_libnames} gdal gdal_i gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
HINTS
ENV GDAL_DIR
ENV GDAL_ROOT
${_gdal_libpath}
PATH_SUFFIXES lib
+ DOC "Path to the GDAL library"
)
+mark_as_advanced(GDAL_LIBRARY)
+unset(_gdal_libnames)
+unset(_gdal_lib)
if (EXISTS "${GDAL_INCLUDE_DIR}/gdal_version.h")
file(STRINGS "${GDAL_INCLUDE_DIR}/gdal_version.h" _gdal_version
@@ -154,12 +186,14 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL
VERSION_VAR GDAL_VERSION
REQUIRED_VARS GDAL_LIBRARY GDAL_INCLUDE_DIR)
-if (GDAL_FOUND AND NOT TARGET GDAL::GDAL)
- add_library(GDAL::GDAL UNKNOWN IMPORTED)
- set_target_properties(GDAL::GDAL PROPERTIES
- IMPORTED_LOCATION "${GDAL_LIBRARY}"
- INTERFACE_INCLUDE_DIRECTORIES "${GDAL_INCLUDE_DIR}")
-endif ()
+if (GDAL_FOUND)
+ set(GDAL_LIBRARIES ${GDAL_LIBRARY})
+ set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
-set(GDAL_LIBRARIES ${GDAL_LIBRARY})
-set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
+ if (NOT TARGET GDAL::GDAL)
+ add_library(GDAL::GDAL UNKNOWN IMPORTED)
+ set_target_properties(GDAL::GDAL PROPERTIES
+ IMPORTED_LOCATION "${GDAL_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${GDAL_INCLUDE_DIR}")
+ endif ()
+endif ()
diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index 187b6a8d2f..b9ebe08bd6 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -21,6 +21,8 @@ The following variables may be set to influence this module's behavior:
Imported Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.1
+
This module defines the following :ref:`Imported Targets <Imported Targets>`:
@@ -55,6 +57,9 @@ This module defines the following variables:
``GLEW_VERSION_MICRO``
GLEW micro version
+.. versionadded:: 3.7
+ Debug and Release variants are found separately.
+
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index 15561d6b08..2770c604de 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -10,6 +10,8 @@ Find OpenGL Utility Toolkit (GLUT) library and include files.
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.1
+
This module defines the :prop_tgt:`IMPORTED` targets:
``GLUT::GLUT``
@@ -33,6 +35,9 @@ Also defined, but not for general use are:
GLUT_glut_LIBRARY = the full path to the glut library.
GLUT_Xmu_LIBRARY = the full path to the Xmu library.
GLUT_Xi_LIBRARY = the full path to the Xi Library.
+
+.. versionadded:: 3.13
+ Debug and Release variants are found separately.
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 62f1614f8c..00bfc29c83 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -16,6 +16,23 @@ module. See example below.
* ``glade``
* ``glademm``
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` targets (subject to
+component selection):
+
+``GTK2::atk``, ``GTK2::atkmm``, ``GTK2::cairo``, ``GTK2::cairomm``,
+``GTK2::gdk_pixbuf``, ``GTK2::gdk``, ``GTK2::gdkmm``, ``GTK2::gio``,
+``GTK2::giomm``, ``GTK2::glade``, ``GTK2::glademm``, ``GTK2::glib``,
+``GTK2::glibmm``, ``GTK2::gmodule``, ``GTK2::gobject``, ``GTK2::gthread``,
+``GTK2::gtk``, ``GTK2::gtkmm``, ``GTK2::harfbuzz``, ``GTK2::pango``,
+``GTK2::pangocairo``, ``GTK2::pangoft2``, ``GTK2::pangomm``,
+``GTK2::pangoxft``, ``GTK2::sigc``.
+
+.. versionadded:: 3.16.7
+ Added the ``GTK2::harfbuzz`` target.
+
Result Variables
^^^^^^^^^^^^^^^^
@@ -28,7 +45,8 @@ The following variables will be defined for your use
``GTK2_LIBRARIES``
All libraries
``GTK2_TARGETS``
- All imported targets
+ .. versionadded:: 3.5
+ All imported targets
``GTK2_DEFINITIONS``
Additional compiler flags
``GTK2_VERSION``
@@ -40,6 +58,10 @@ The following variables will be defined for your use
``GTK2_PATCH_VERSION``
The patch version of GTK2
+.. versionadded:: 3.5
+ When ``GTK2_USE_IMPORTED_TARGETS`` is set to ``TRUE``, ``GTK2_LIBRARIES``
+ will list imported targets instead of library paths.
+
Input Variables
^^^^^^^^^^^^^^^
@@ -783,6 +805,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
_GTK2_ADD_TARGET (GIOMM GTK2_DEPENDS gio glibmm gobject sigc++ glib)
_GTK2_FIND_INCLUDE_DIR(ATKMM atkmm.h)
+ _GTK2_FIND_INCLUDE_DIR(ATKMMCONFIG atkmmconfig.h)
_GTK2_FIND_LIBRARY (ATKMM atkmm true true)
_GTK2_ADD_TARGET (ATKMM GTK2_DEPENDS atk glibmm gobject sigc++ glib)
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index 53cab1a760..8e22f79198 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -7,10 +7,24 @@ FindGTest
Locate the Google C++ Testing Framework.
+.. versionadded:: 3.20
+ Upstream ``GTestConfig.cmake`` is used if possible.
+
Imported targets
^^^^^^^^^^^^^^^^
-This module defines the following :prop_tgt:`IMPORTED` targets:
+.. versionadded:: 3.20
+ This module defines the following :prop_tgt:`IMPORTED` targets:
+
+``GTest::gtest``
+ The Google Test ``gtest`` library, if found; adds Thread::Thread
+ automatically
+``GTest::gtest_main``
+ The Google Test ``gtest_main`` library, if found
+
+.. deprecated:: 3.20
+ For backwards compatibility, this module defines additionally the
+ following deprecated :prop_tgt:`IMPORTED` targets (available since 3.5):
``GTest::GTest``
The Google Test ``gtest`` library, if found; adds Thread::Thread
@@ -24,7 +38,7 @@ Result variables
This module will set the following variables in your project:
-``GTEST_FOUND``
+``GTest_FOUND``
Found the Google Testing framework
``GTEST_INCLUDE_DIRS``
the directory containing the Google Test headers
@@ -62,7 +76,7 @@ Example usage
find_package(GTest REQUIRED)
add_executable(foo foo.cc)
- target_link_libraries(foo GTest::GTest GTest::Main)
+ target_link_libraries(foo GTest::gtest GTest::gtest_main)
add_test(AllTestsInFoo foo)
@@ -72,6 +86,10 @@ Deeper integration with CTest
See :module:`GoogleTest` for information on the :command:`gtest_add_tests`
and :command:`gtest_discover_tests` commands.
+
+.. versionchanged:: 3.9
+ Previous CMake versions defined :command:`gtest_add_tests` macro in this
+ module.
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/GoogleTest.cmake)
@@ -146,8 +164,41 @@ function(__gtest_import_library _target _var _config)
endif()
endfunction()
+function(__gtest_define_backwards_compatible_library_targets)
+ set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} PARENT_SCOPE)
+
+ # Add targets mapping the same library names as defined in
+ # older versions of CMake's FindGTest
+ if(NOT TARGET GTest::GTest)
+ add_library(GTest::GTest INTERFACE IMPORTED)
+ target_link_libraries(GTest::GTest INTERFACE GTest::gtest)
+ endif()
+ if(NOT TARGET GTest::Main)
+ add_library(GTest::Main INTERFACE IMPORTED)
+ target_link_libraries(GTest::Main INTERFACE GTest::gtest_main)
+ endif()
+endfunction()
+
#
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+# first specifically look for the CMake version of GTest
+find_package(GTest QUIET NO_MODULE)
+
+# if we found the GTest cmake package then we are done, and
+# can print what we found and return.
+if(GTest_FOUND)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest HANDLE_COMPONENTS CONFIG_MODE)
+
+ set(GTEST_LIBRARIES GTest::gtest)
+ set(GTEST_MAIN_LIBRARIES GTest::gtest_main)
+
+ __gtest_define_backwards_compatible_library_targets()
+
+ return()
+endif()
+
if(NOT DEFINED GTEST_MSVC_SEARCH)
set(GTEST_MSVC_SEARCH MD)
endif()
@@ -201,54 +252,43 @@ else()
__gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
-if(GTEST_FOUND)
+if(GTest_FOUND)
set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
__gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY)
__gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY)
- set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
find_package(Threads QUIET)
- if(NOT TARGET GTest::GTest)
+ if(NOT TARGET GTest::gtest)
__gtest_determine_library_type(GTEST_LIBRARY)
- add_library(GTest::GTest ${GTEST_LIBRARY_TYPE} IMPORTED)
+ add_library(GTest::gtest ${GTEST_LIBRARY_TYPE} IMPORTED)
if(TARGET Threads::Threads)
- set_target_properties(GTest::GTest PROPERTIES
+ set_target_properties(GTest::gtest PROPERTIES
INTERFACE_LINK_LIBRARIES Threads::Threads)
endif()
if(GTEST_LIBRARY_TYPE STREQUAL "SHARED")
- set_target_properties(GTest::GTest PROPERTIES
+ set_target_properties(GTest::gtest PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
endif()
if(GTEST_INCLUDE_DIRS)
- set_target_properties(GTest::GTest PROPERTIES
+ set_target_properties(GTest::gtest PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")
endif()
- __gtest_import_library(GTest::GTest GTEST_LIBRARY "")
- __gtest_import_library(GTest::GTest GTEST_LIBRARY "RELEASE")
- __gtest_import_library(GTest::GTest GTEST_LIBRARY "DEBUG")
+ __gtest_import_library(GTest::gtest GTEST_LIBRARY "")
+ __gtest_import_library(GTest::gtest GTEST_LIBRARY "RELEASE")
+ __gtest_import_library(GTest::gtest GTEST_LIBRARY "DEBUG")
endif()
- if(NOT TARGET GTest::Main)
+ if(NOT TARGET GTest::gtest_main)
__gtest_determine_library_type(GTEST_MAIN_LIBRARY)
- add_library(GTest::Main ${GTEST_MAIN_LIBRARY_TYPE} IMPORTED)
- set_target_properties(GTest::Main PROPERTIES
- INTERFACE_LINK_LIBRARIES "GTest::GTest")
- __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "")
- __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "RELEASE")
- __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "DEBUG")
+ add_library(GTest::gtest_main ${GTEST_MAIN_LIBRARY_TYPE} IMPORTED)
+ set_target_properties(GTest::gtest_main PROPERTIES
+ INTERFACE_LINK_LIBRARIES "GTest::gtest")
+ __gtest_import_library(GTest::gtest_main GTEST_MAIN_LIBRARY "")
+ __gtest_import_library(GTest::gtest_main GTEST_MAIN_LIBRARY "RELEASE")
+ __gtest_import_library(GTest::gtest_main GTEST_MAIN_LIBRARY "DEBUG")
endif()
- # Add targets mapping the same library names as defined in
- # GTest's CMake package config.
- if(NOT TARGET GTest::gtest)
- add_library(GTest::gtest INTERFACE IMPORTED)
- target_link_libraries(GTest::gtest INTERFACE GTest::GTest)
- endif()
- if(NOT TARGET GTest::gtest_main)
- add_library(GTest::gtest_main INTERFACE IMPORTED)
- target_link_libraries(GTest::gtest_main INTERFACE GTest::Main)
- endif()
+ __gtest_define_backwards_compatible_library_targets()
endif()
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake
index 213ad13de0..252f2aea27 100644
--- a/Modules/FindGettext.cmake
+++ b/Modules/FindGettext.cmake
@@ -54,7 +54,7 @@ PO_FILES <po1> <po2> ... )
If ALL is specified, the po files are processed when building the all traget.
It creates a custom target "pofiles".
-.. note::
+.. versionadded:: 3.2
If you wish to use the Gettext library (libintl), use :module:`FindIntl`.
#]=======================================================================]
diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
index 3491cdcc2f..99850b4f17 100644
--- a/Modules/FindGit.cmake
+++ b/Modules/FindGit.cmake
@@ -5,12 +5,6 @@
FindGit
-------
-The module defines the following ``IMPORTED`` targets (when
-:prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
-
-``Git::Git``
- Executable of the Git command-line client.
-
The module defines the following variables:
``GIT_EXECUTABLE``
@@ -20,6 +14,13 @@ The module defines the following variables:
``GIT_VERSION_STRING``
The version of Git found.
+.. versionadded:: 3.14
+ The module defines the following ``IMPORTED`` targets (when
+ :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
+
+``Git::Git``
+ Executable of the Git command-line client.
+
Example usage:
.. code-block:: cmake
@@ -76,20 +77,51 @@ unset(git_names)
unset(_git_sourcetree_path)
if(GIT_EXECUTABLE)
- execute_process(COMMAND ${GIT_EXECUTABLE} --version
- OUTPUT_VARIABLE git_version
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (git_version MATCHES "^git version [0-9]")
- string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
+ # Avoid querying the version if we've already done that this run. For
+ # projects that use things like ExternalProject or FetchContent heavily,
+ # this saving can be measurable on some platforms.
+ #
+ # This is an internal property, projects must not try to use it.
+ # We don't want this stored in the cache because it might still change
+ # between CMake runs, but it shouldn't change during a run for a given
+ # git executable location.
+ set(__doGitVersionCheck TRUE)
+ get_property(__gitVersionProp GLOBAL
+ PROPERTY _CMAKE_FindGit_GIT_EXECUTABLE_VERSION
+ )
+ if(__gitVersionProp)
+ list(GET __gitVersionProp 0 __gitExe)
+ list(GET __gitVersionProp 1 __gitVersion)
+ if(__gitExe STREQUAL GIT_EXECUTABLE AND NOT __gitVersion STREQUAL "")
+ set(GIT_VERSION_STRING "${__gitVersion}")
+ set(__doGitVersionCheck FALSE)
+ endif()
+ unset(__gitExe)
+ unset(__gitVersion)
+ endif()
+ unset(__gitVersionProp)
+
+ if(__doGitVersionCheck)
+ execute_process(COMMAND ${GIT_EXECUTABLE} --version
+ OUTPUT_VARIABLE git_version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (git_version MATCHES "^git version [0-9]")
+ string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
+ set_property(GLOBAL PROPERTY _CMAKE_FindGit_GIT_EXECUTABLE_VERSION
+ "${GIT_EXECUTABLE};${GIT_VERSION_STRING}"
+ )
+ endif()
+ unset(git_version)
endif()
- unset(git_version)
+ unset(__doGitVersionCheck)
get_property(_findgit_role GLOBAL PROPERTY CMAKE_ROLE)
if(_findgit_role STREQUAL "PROJECT" AND NOT TARGET Git::Git)
add_executable(Git::Git IMPORTED)
set_property(TARGET Git::Git PROPERTY IMPORTED_LOCATION "${GIT_EXECUTABLE}")
endif()
+ unset(_findgit_role)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake
index 819f000121..782a72b2fe 100644
--- a/Modules/FindGnuTLS.cmake
+++ b/Modules/FindGnuTLS.cmake
@@ -10,6 +10,8 @@ Find the GNU Transport Layer Security library (gnutls)
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.16
+
This module defines :prop_tgt:`IMPORTED` target ``GnuTLS::GnuTLS``, if
gnutls has been found.
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 38388d998e..16bf2794c2 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -32,6 +32,9 @@ static link to a dynamic link for ``HDF5`` and all of it's dependencies.
To use this feature, make sure that the ``HDF5_USE_STATIC_LIBRARIES``
variable is set before the call to find_package.
+.. versionadded:: 3.10
+ Support for ``HDF5_USE_STATIC_LIBRARIES`` on Windows.
+
Both the serial and parallel ``HDF5`` wrappers are considered and the first
directory to contain either one will be used. In the event that both appear
in the same directory the serial version is preferentially selected. This
@@ -51,7 +54,8 @@ This module will set the following variables in your project:
``HDF5_FOUND``
HDF5 was found on the system
``HDF5_VERSION``
- HDF5 library version
+ .. versionadded:: 3.3
+ HDF5 library version
``HDF5_INCLUDE_DIRS``
Location of the HDF5 header files
``HDF5_DEFINITIONS``
@@ -112,15 +116,22 @@ also be defined. With all components enabled, the following variables will be d
With all components enabled, the following targets will be defined:
-::
-
- ``hdf5::hdf5``
- ``hdf5::hdf5_hl_cpp``
- ``hdf5::hdf5_fortran``
- ``hdf5::hdf5_hl``
- ``hdf5::hdf5_hl_cpp``
- ``hdf5::hdf5_hl_fortran``
- ``hdf5::h5diff``
+``HDF5::HDF5``
+ All detected ``HDF5_LIBRARIES``.
+``hdf5::hdf5``
+ C library.
+``hdf5::hdf5_cpp``
+ C++ library.
+``hdf5::hdf5_fortran``
+ Fortran library.
+``hdf5::hdf5_hl``
+ High-level C library.
+``hdf5::hdf5_hl_cpp``
+ High-level C++ library.
+``hdf5::hdf5_hl_fortran``
+ High-level Fortran library.
+``hdf5::h5diff``
+ ``h5diff`` executable.
Hints
^^^^^
@@ -128,12 +139,18 @@ Hints
The following variables can be set to guide the search for HDF5 libraries and includes:
``HDF5_PREFER_PARALLEL``
+ .. versionadded:: 3.4
+
set ``true`` to prefer parallel HDF5 (by default, serial is preferred)
``HDF5_FIND_DEBUG``
+ .. versionadded:: 3.9
+
Set ``true`` to get extra debugging output.
``HDF5_NO_FIND_PACKAGE_CONFIG_FILE``
+ .. versionadded:: 3.8
+
Set ``true`` to skip trying to find ``hdf5-config.cmake``.
#]=======================================================================]
@@ -196,22 +213,6 @@ else()
set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc)
endif()
-# We may have picked up some duplicates in various lists during the above
-# process for the language bindings (both the C and C++ bindings depend on
-# libz for example). Remove the duplicates. It appears that the default
-# CMake behavior is to remove duplicates from the end of a list. However,
-# for link lines, this is incorrect since unresolved symbols are searched
-# for down the link line. Therefore, we reverse the list, remove the
-# duplicates, and then reverse it again to get the duplicates removed from
-# the beginning.
-macro(_HDF5_remove_duplicates_from_beginning _list_name)
- if(${_list_name})
- list(REVERSE ${_list_name})
- list(REMOVE_DUPLICATES ${_list_name})
- list(REVERSE ${_list_name})
- endif()
-endmacro()
-
# Test first if the current compilers automatically wrap HDF5
function(_HDF5_test_regular_compiler_C success version is_parallel)
set(scratch_directory
@@ -716,10 +717,8 @@ if(NOT HDF5_FOUND)
endif()
set(HDF5_${_lang}_FOUND TRUE)
- _HDF5_remove_duplicates_from_beginning(HDF5_${_lang}_DEFINITIONS)
- _HDF5_remove_duplicates_from_beginning(HDF5_${_lang}_INCLUDE_DIRS)
- _HDF5_remove_duplicates_from_beginning(HDF5_${_lang}_LIBRARIES)
- _HDF5_remove_duplicates_from_beginning(HDF5_${_lang}_HL_LIBRARIES)
+ list(REMOVE_DUPLICATES HDF5_${_lang}_DEFINITIONS)
+ list(REMOVE_DUPLICATES HDF5_${_lang}_INCLUDE_DIRS)
else()
set(_HDF5_NEED_TO_SEARCH TRUE)
endif()
@@ -772,10 +771,8 @@ elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH)
endif()
endif()
endforeach()
- _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS)
- _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS)
- _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES)
- _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES)
+ list(REMOVE_DUPLICATES HDF5_DEFINITIONS)
+ list(REMOVE_DUPLICATES HDF5_INCLUDE_DIRS)
set(HDF5_FOUND TRUE)
set(HDF5_REQUIRED_VARS HDF5_LIBRARIES)
if(HDF5_FIND_HL)
@@ -915,10 +912,8 @@ if( NOT HDF5_FOUND )
set(HDF5_HL_FOUND TRUE)
endif()
- _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS)
- _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS)
- _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES)
- _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES)
+ list(REMOVE_DUPLICATES HDF5_DEFINITIONS)
+ list(REMOVE_DUPLICATES HDF5_INCLUDE_DIRS)
# If the HDF5 include directory was found, open H5pubconf.h to determine if
# HDF5 was compiled with parallel IO support
@@ -1139,6 +1134,21 @@ if (HDF5_FIND_DEBUG)
message(STATUS "HDF5_${_lang}_HL_LIBRARY: ${HDF5_${_lang}_HL_LIBRARY}")
message(STATUS "HDF5_${_lang}_HL_LIBRARIES: ${HDF5_${_lang}_HL_LIBRARIES}")
endforeach()
+ message(STATUS "Defined targets (if any):")
+ foreach(_lang IN ITEMS "" "_cpp" "_fortran")
+ foreach(_hl IN ITEMS "" "_hl")
+ foreach(_prefix IN ITEMS "hdf5::" "")
+ foreach(_suffix IN ITEMS "-static" "-shared" "")
+ set (_target ${_prefix}hdf5${_hl}${_lang}${_suffix})
+ if (TARGET ${_target})
+ message(STATUS "... ${_target}")
+ else()
+ #message(STATUS "... ${_target} does not exist")
+ endif()
+ endforeach()
+ endforeach()
+ endforeach()
+ endforeach()
endif()
unset(_lang)
unset(_HDF5_NEED_TO_SEARCH)
diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake
index 1358363d2a..e9f2c8277c 100644
--- a/Modules/FindHg.cmake
+++ b/Modules/FindHg.cmake
@@ -15,7 +15,8 @@ The module defines the following variables:
HG_FOUND - true if the command line client was found
HG_VERSION_STRING - the version of mercurial found
-If the command line client executable is found the following macro is defined:
+.. versionadded:: 3.1
+ If the command line client executable is found the following macro is defined:
::
diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake
index c8b3e1fb75..2bb49adec1 100644
--- a/Modules/FindICU.cmake
+++ b/Modules/FindICU.cmake
@@ -18,6 +18,9 @@ Note that on Windows ``data`` is named ``dt`` and ``i18n`` is named
``in``; any of the names may be used, and the appropriate
platform-specific library name will be automatically selected.
+.. versionadded:: 3.11
+ Added support for static libraries on Windows.
+
This module reports information about the ICU installation in
several variables. General variables::
@@ -31,7 +34,7 @@ Imported targets::
ICU::<C>
Where ``<C>`` is the name of an ICU component, for example
-``ICU::i18n``.
+``ICU::i18n``; ``<C>`` is lower-case.
ICU programs are reported in::
@@ -54,16 +57,14 @@ ICU programs are reported in::
ICU component libraries are reported in::
- ICU_<C>_FOUND - ON if component was found
- ICU_<C>_LIBRARIES - libraries for component
+ ICU_<C>_FOUND - ON if component was found; ``<C>`` is upper-case.
+ ICU_<C>_LIBRARIES - libraries for component; ``<C>`` is upper-case.
ICU datafiles are reported in::
ICU_MAKEFILE_INC - Makefile.inc
ICU_PKGDATA_INC - pkgdata.inc
-Note that ``<C>`` is the uppercased name of the component.
-
This module reads hints about search results from::
ICU_ROOT - the root of the ICU installation
@@ -73,9 +74,9 @@ ICU_ROOT variable takes precedence.
The following cache variables may also be set::
- ICU_<P>_EXECUTABLE - the path to executable <P>
+ ICU_<P>_EXECUTABLE - the path to executable <P>; ``<P>`` is upper-case.
ICU_INCLUDE_DIR - the directory containing the ICU headers
- ICU_<C>_LIBRARY - the library for component <C>
+ ICU_<C>_LIBRARY - the library for component <C>; ``<C>`` is upper-case.
.. note::
@@ -188,7 +189,8 @@ function(_ICU_FIND)
set(component_cache "ICU_${component_upcase}_LIBRARY")
set(component_cache_release "${component_cache}_RELEASE")
set(component_cache_debug "${component_cache}_DEBUG")
- set(component_found "${component_upcase}_FOUND")
+ set(component_found "ICU_${component_upcase}_FOUND")
+ set(component_found_compat "${component_upcase}_FOUND")
set(component_libnames "icu${component}")
set(component_debug_libnames "icu${component}d")
@@ -250,12 +252,15 @@ function(_ICU_FIND)
mark_as_advanced("${component_cache_release}" "${component_cache_debug}")
if(${component_cache})
set("${component_found}" ON)
+ set("${component_found_compat}" ON)
list(APPEND ICU_LIBRARY "${${component_cache}}")
endif()
mark_as_advanced("${component_found}")
+ mark_as_advanced("${component_found_compat}")
set("${component_cache}" "${${component_cache}}" PARENT_SCOPE)
set("${component_found}" "${${component_found}}" PARENT_SCOPE)
- if(${component_found})
+ set("${component_found_compat}" "${${component_found_compat}}" PARENT_SCOPE)
+ if(component_found OR component_found_compat)
if (ICU_FIND_REQUIRED_${component})
list(APPEND ICU_LIBS_FOUND "${component} (required)")
else()
@@ -346,7 +351,7 @@ if(ICU_FOUND)
set(_ICU_component_cache_release "ICU_${_ICU_component_upcase}_LIBRARY_RELEASE")
set(_ICU_component_cache_debug "ICU_${_ICU_component_upcase}_LIBRARY_DEBUG")
set(_ICU_component_lib "ICU_${_ICU_component_upcase}_LIBRARIES")
- set(_ICU_component_found "${_ICU_component_upcase}_FOUND")
+ set(_ICU_component_found "ICU_${_ICU_component_upcase}_FOUND")
set(_ICU_imported_target "ICU::${_ICU_component}")
if(${_ICU_component_found})
set("${_ICU_component_lib}" "${${_ICU_component_cache}}")
@@ -400,7 +405,7 @@ if(ICU_DEBUG)
foreach(program IN LISTS icu_programs)
string(TOUPPER "${program}" program_upcase)
set(program_lib "ICU_${program_upcase}_EXECUTABLE")
- message(STATUS "${program} program: ${${program_lib}}")
+ message(STATUS "${program} program: ${program_lib}=${${program_lib}}")
unset(program_upcase)
unset(program_lib)
endforeach()
@@ -409,7 +414,7 @@ if(ICU_DEBUG)
string(TOUPPER "${data}" data_upcase)
string(REPLACE "." "_" data_upcase "${data_upcase}")
set(data_lib "ICU_${data_upcase}")
- message(STATUS "${data} data: ${${data_lib}}")
+ message(STATUS "${data} data: ${data_lib}=${${data_lib}}")
unset(data_upcase)
unset(data_lib)
endforeach()
@@ -417,12 +422,15 @@ if(ICU_DEBUG)
foreach(component IN LISTS ICU_FIND_COMPONENTS)
string(TOUPPER "${component}" component_upcase)
set(component_lib "ICU_${component_upcase}_LIBRARIES")
- set(component_found "${component_upcase}_FOUND")
- message(STATUS "${component} library found: ${${component_found}}")
- message(STATUS "${component} library: ${${component_lib}}")
+ set(component_found "ICU_${component_upcase}_FOUND")
+ set(component_found_compat "${component_upcase}_FOUND")
+ message(STATUS "${component} library found: ${component_found}=${${component_found}}")
+ message(STATUS "${component} library found (compat name): ${component_found_compat}=${${component_found_compat}}")
+ message(STATUS "${component} library: ${component_lib}=${${component_lib}}")
unset(component_upcase)
unset(component_lib)
unset(component_found)
+ unset(component_found_compat)
endforeach()
message(STATUS "----------------")
endif()
diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake
index 0f821e886f..543e10c38f 100644
--- a/Modules/FindIce.cmake
+++ b/Modules/FindIce.cmake
@@ -23,6 +23,15 @@ Ice 3.7 and later also include C++11-specific components:
Note that the set of supported components is Ice version-specific.
+.. versionadded:: 3.4
+ Imported targets for components and most ``EXECUTABLE`` variables.
+
+.. versionadded:: 3.7
+ Debug and Release variants are found separately.
+
+.. versionadded:: 3.10
+ Ice 3.7 support, including new components, programs and the Nuget package.
+
This module reports information about the Ice installation in
several variables. General variables::
@@ -56,6 +65,9 @@ Ice slice programs are reported in::
Ice_SLICE2PY_EXECUTABLE - path to slice2py executable
Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable
+.. versionadded:: 3.14
+ Variables for ``slice2confluence`` and ``slice2matlab``.
+
Ice programs are reported in::
Ice_GLACIER2ROUTER_EXECUTABLE - path to glacier2router executable
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 8bf5123b76..d7de0ddccf 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -7,6 +7,9 @@ FindImageMagick
Find ImageMagick binary suite.
+.. versionadded:: 3.9
+ Added support for ImageMagick 7.
+
This module will search for a set of ImageMagick tools specified as
components in the :command:`find_package` call. Typical components include,
but are not limited to (future versions of ImageMagick might have
diff --git a/Modules/FindIntl.cmake b/Modules/FindIntl.cmake
index 1a09a60972..686c818010 100644
--- a/Modules/FindIntl.cmake
+++ b/Modules/FindIntl.cmake
@@ -16,10 +16,21 @@ installation in several variables. General variables::
Intl_INCLUDE_DIRS - the directory containing the libintl headers
Intl_LIBRARIES - libintl libraries to be linked
+.. versionadded:: 3.20
+ This module defines :prop_tgt:`IMPORTED` target ``Intl::Intl``.
+
The following cache variables may also be set::
Intl_INCLUDE_DIR - the directory containing the libintl headers
Intl_LIBRARY - the libintl library (if any)
+ Intl_HAVE_GETTEXT_BUILTIN - check if gettext is in the C library
+ Intl_HAVE_DCGETTEXT_BUILTIN - check if dcgettext is in the C library
+ Intl_IS_BUILTIN - whether intl is a part of the C library determined
+ from the result of Intl_HAVE_GETTEXT_BUILTIN and Intl_HAVE_DCGETTEXT_BUILTIN
+
+.. versionadded:: 3.20
+ Added the ``Intl_HAVE_GETTEXT_BUILTIN``, ``Intl_HAVE_DCGETTEXT_BUILTIN`` and
+ ``Intl_IS_BUILTIN`` variables.
.. note::
On some platforms, such as Linux with GNU libc, the gettext
@@ -35,6 +46,22 @@ The following cache variables may also be set::
# Written by Roger Leigh <rleigh@codelibre.net>
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake)
+
+# Check if we have libintl is a part of libc
+cmake_push_check_state(RESET)
+set(CMAKE_REQUIRED_QUIET TRUE)
+check_symbol_exists(gettext libintl.h Intl_HAVE_GETTEXT_BUILTIN)
+check_symbol_exists(dcgettext libintl.h Intl_HAVE_DCGETTEXT_BUILTIN) # redundant check
+cmake_pop_check_state()
+
+if(Intl_HAVE_GETTEXT_BUILTIN AND Intl_HAVE_DCGETTEXT_BUILTIN)
+ set(Intl_IS_BUILTIN TRUE)
+else()
+ set(Intl_IS_BUILTIN FALSE)
+endif()
+
# Find include directory
find_path(Intl_INCLUDE_DIR
NAMES "libintl.h"
@@ -42,21 +69,28 @@ find_path(Intl_INCLUDE_DIR
mark_as_advanced(Intl_INCLUDE_DIR)
# Find all Intl libraries
-find_library(Intl_LIBRARY "intl" NAMES_PER_DIR
- DOC "libintl libraries (if not in the C library)")
-mark_as_advanced(Intl_LIBRARY)
+set(Intl_REQUIRED_VARS)
+if(NOT Intl_IS_BUILTIN)
+ find_library(Intl_LIBRARY "intl" "libintl" NAMES_PER_DIR
+ DOC "libintl libraries (if not in the C library)")
+ mark_as_advanced(Intl_LIBRARY)
+ list(APPEND Intl_REQUIRED_VARS Intl_LIBRARY)
+endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
FOUND_VAR Intl_FOUND
- REQUIRED_VARS Intl_INCLUDE_DIR
+ REQUIRED_VARS Intl_INCLUDE_DIR ${Intl_REQUIRED_VARS}
FAIL_MESSAGE "Failed to find Gettext libintl")
+unset(Intl_REQUIRED_VARS)
if(Intl_FOUND)
set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
- if(Intl_LIBRARY)
- set(Intl_LIBRARIES "${Intl_LIBRARY}")
- else()
- unset(Intl_LIBRARIES)
+ set(Intl_LIBRARIES "${Intl_LIBRARY}")
+ if(NOT TARGET Intl::Intl)
+ add_library(Intl::Intl INTERFACE IMPORTED)
+ set_target_properties(Intl::Intl PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Intl_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${Intl_LIBRARIES}")
endif()
endif()
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index 632fc9aa0f..add2486c36 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -10,6 +10,8 @@ Find the Joint Photographic Experts Group (JPEG) library (``libjpeg``)
Imported targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.12
+
This module defines the following :prop_tgt:`IMPORTED` targets:
``JPEG::JPEG``
@@ -27,7 +29,8 @@ This module will set the following variables in your project:
``JPEG_LIBRARIES``
the libraries needed to use JPEG.
``JPEG_VERSION``
- the version of the JPEG library found
+ .. versionadded:: 3.12
+ the version of the JPEG library found
Cache variables
^^^^^^^^^^^^^^^
@@ -41,6 +44,9 @@ The following cache variables may also be set:
``JPEG_LIBRARY_DEBUG``
where to find the JPEG library (debug).
+.. versionadded:: 3.12
+ Debug and Release variand are found separately.
+
Obsolete variables
^^^^^^^^^^^^^^^^^^
@@ -52,7 +58,7 @@ Obsolete variables
find_path(JPEG_INCLUDE_DIR jpeglib.h)
-set(jpeg_names ${JPEG_NAMES} jpeg jpeg-static libjpeg libjpeg-static)
+set(jpeg_names ${JPEG_NAMES} jpeg jpeg-static libjpeg libjpeg-static turbojpeg turbojpeg-static)
foreach(name ${jpeg_names})
list(APPEND jpeg_names_debug "${name}d")
endforeach()
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index 9db740b4f8..4f0e0feafe 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -13,6 +13,9 @@ to specify a Java installation prefix explicitly.
See also the :module:`FindJNI` module to find Java Native Interface (JNI).
+.. versionadded:: 3.10
+ Added support for Java 9+ version parsing.
+
Specify one or more of the following components as you call this find module. See example below.
::
@@ -41,7 +44,9 @@ This module sets the following result variables:
Java_VERSION_TWEAK = The tweak version of the package found (after '_')
Java_VERSION = This is set to: $major[.$minor[.$patch[.$tweak]]]
-
+.. versionadded:: 3.4
+ Added the ``Java_IDLJ_EXECUTABLE`` and ``Java_JARSIGNER_EXECUTABLE``
+ variables.
The minimum required version of Java can be specified using the
:command:`find_package` syntax, e.g.
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 4b71cee595..45e4be72ff 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -43,14 +43,46 @@ The following variables may be set to influence this module's behavior:
* ``Arm_mp``
* ``Arm_ilp64``
* ``Arm_ilp64_mp``
+ * ``EML``
+ * ``EML_mt``
* ``Generic``
+ .. versionadded:: 3.6
+ ``OpenBLAS`` support.
+
+ .. versionadded:: 3.11
+ ``FLAME`` support.
+
+ .. versionadded:: 3.13
+ Added ILP64 MKL variants (``Intel10_64ilp``, ``Intel10_64ilp_seq``).
+
+ .. versionadded:: 3.17
+ Added single dynamic library MKL variant (``Intel10_64_dyn``).
+
+ .. versionadded:: 3.18
+ Arm Performance Libraries support (``Arm``, ``Arm_mp``, ``Arm_ilp64``,
+ ``Arm_ilp64_mp``).
+
+ .. versionadded:: 3.19
+ ``FlexiBLAS`` support.
+
+ .. versionadded:: 3.20
+ Elbrus Math Library support (``EML``, ``EML_mt``).
+
``BLA_F95``
if ``ON`` tries to find the BLAS95/LAPACK95 interfaces
+``BLA_PREFER_PKGCONFIG``
+ .. versionadded:: 3.20
+
+ if set ``pkg-config`` will be used to search for a LAPACK library first
+ and if one is found that is preferred
+
Imported targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.18
+
This module defines the following :prop_tgt:`IMPORTED` target:
``LAPACK::LAPACK``
@@ -95,6 +127,26 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+function(_add_lapack_target)
+ if(LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK)
+ add_library(LAPACK::LAPACK INTERFACE IMPORTED)
+ set(_lapack_libs "${LAPACK_LIBRARIES}")
+ if(_lapack_libs AND TARGET BLAS::BLAS)
+ # remove the ${BLAS_LIBRARIES} from the interface and replace it
+ # with the BLAS::BLAS target
+ list(REMOVE_ITEM _lapack_libs "${BLAS_LIBRARIES}")
+ list(APPEND _lapack_libs BLAS::BLAS)
+ endif()
+
+ if(_lapack_libs)
+ set_target_properties(LAPACK::LAPACK PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${_lapack_libs}"
+ )
+ endif()
+ unset(_lapack_libs)
+ endif()
+endfunction()
+
macro(_lapack_find_library_setup)
cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY})
@@ -239,6 +291,21 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
_lapack_find_dependency(BLAS)
endif()
+# Search with pkg-config if specified
+if(BLA_PREFER_PKGCONFIG)
+ find_package(PkgConfig)
+ pkg_check_modules(PKGC_LAPACK lapack)
+ if(PKGC_LAPACK_FOUND)
+ set(LAPACK_FOUND TRUE)
+ set(LAPACK_LIBRARIES "${PKGC_LAPACK_LINK_LIBRARIES}")
+ if (BLAS_LIBRARIES)
+ list(APPEND LAPACK_LIBRARIES "${BLAS_LIBRARIES}")
+ endif()
+ _add_lapack_target()
+ return()
+ endif()
+endif()
+
# Search for different LAPACK distributions if BLAS is found
if(NOT LAPACK_NOT_FOUND_MESSAGE)
set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
@@ -494,6 +561,30 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
)
endif()
+ # Elbrus Math Library?
+ if(NOT LAPACK_LIBRARIES
+ AND (BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All"))
+
+ set(LAPACK_EML_LIB "eml")
+
+ # Check for OpenMP support, VIA BLA_VENDOR of eml_mt
+ if(BLA_VENDOR MATCHES "_mt")
+ set(LAPACK_EML_LIB "${LAPACK_EML_LIB}_mt")
+ endif()
+
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "${LAPACK_EML_LIB}"
+ ""
+ ""
+ ""
+ "${BLAS_LIBRARIES}"
+ )
+ endif()
+
# Generic LAPACK library?
if(NOT LAPACK_LIBRARIES
AND (BLA_VENDOR STREQUAL "Generic"
@@ -535,21 +626,6 @@ if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
set(LAPACK_LIBRARIES "")
endif()
-if(LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK)
- add_library(LAPACK::LAPACK INTERFACE IMPORTED)
- set(_lapack_libs "${LAPACK_LIBRARIES}")
- if(_lapack_libs AND TARGET BLAS::BLAS)
- # remove the ${BLAS_LIBRARIES} from the interface and replace it
- # with the BLAS::BLAS target
- list(REMOVE_ITEM _lapack_libs "${BLAS_LIBRARIES}")
- endif()
-
- if(_lapack_libs)
- set_target_properties(LAPACK::LAPACK PROPERTIES
- INTERFACE_LINK_LIBRARIES "${_lapack_libs}"
- )
- endif()
- unset(_lapack_libs)
-endif()
+_add_lapack_target()
_lapack_find_library_teardown()
diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake
index b0dad7da3a..1e82651fe1 100644
--- a/Modules/FindLATEX.cmake
+++ b/Modules/FindLATEX.cmake
@@ -11,6 +11,10 @@ This module finds an installed LaTeX and determines the location
of the compiler. Additionally the module looks for Latex-related
software like BibTeX.
+.. versionadded:: 3.2
+ Component processing; support for htlatex, pdftops, Biber, xindy, XeLaTeX,
+ LuaLaTeX.
+
This module sets the following result variables::
LATEX_FOUND: whether found Latex and requested components
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake
index ce3c8b8e8c..08078a295f 100644
--- a/Modules/FindLibArchive.cmake
+++ b/Modules/FindLibArchive.cmake
@@ -22,6 +22,10 @@ The module defines the following ``IMPORTED`` targets:
::
LibArchive::LibArchive - target for linking against libarchive
+
+.. versionadded:: 3.6
+ Support for new libarchive 3.2 version string format.
+
#]=======================================================================]
find_path(LibArchive_INCLUDE_DIR
diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake
index 4a79a1028b..9ec8f075df 100644
--- a/Modules/FindLibLZMA.cmake
+++ b/Modules/FindLibLZMA.cmake
@@ -11,6 +11,8 @@ Find LZMA compression algorithm headers and library.
Imported Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.14
+
This module defines :prop_tgt:`IMPORTED` target ``LibLZMA::LibLZMA``, if
liblzma has been found.
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index 0631607129..ce28d03026 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -10,12 +10,16 @@ Find the XML processing library (libxml2).
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.12
+
The following :prop_tgt:`IMPORTED` targets may be defined:
``LibXml2::LibXml2``
- If the libxml2 library has been found
+ libxml2 library.
``LibXml2::xmllint``
- If the xmllint command-line executable has been found
+ .. versionadded:: 3.17
+
+ xmllint command-line executable.
Result variables
^^^^^^^^^^^^^^^^
diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake
index fc7adeb0f7..97943d6d1d 100644
--- a/Modules/FindLibXslt.cmake
+++ b/Modules/FindLibXslt.cmake
@@ -11,6 +11,8 @@ Transformations (XSLT) library (LibXslt)
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.18
+
The following :prop_tgt:`IMPORTED` targets may be defined:
``LibXslt::LibXslt``
@@ -35,7 +37,8 @@ Additionally, the following two variables are set (but not required
for using xslt):
``LIBXSLT_EXSLT_INCLUDE_DIR``
- The include directory for exslt.
+ .. versionadded:: 3.18
+ The include directory for exslt.
``LIBXSLT_EXSLT_LIBRARIES``
Link to these if you need to link against the exslt library.
``LIBXSLT_XSLTPROC_EXECUTABLE``
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
index c4361b74b1..32642fe239 100644
--- a/Modules/FindLua.cmake
+++ b/Modules/FindLua.cmake
@@ -5,10 +5,11 @@
FindLua
-------
-
-
Locate Lua library.
+.. versionadded:: 3.18
+ Support for Lua 5.4.
+
This module defines::
::
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 789a72eb39..195ca49678 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -12,6 +12,10 @@ high-performance distributed-memory parallel applications, and is
typically deployed on a cluster. MPI is a standard interface (defined
by the MPI forum) for which many implementations are available.
+.. versionadded:: 3.10
+ Major overhaul of the module: many new variables, per-language components,
+ support for a wider variety of runtimes.
+
Variables for using MPI
^^^^^^^^^^^^^^^^^^^^^^^
@@ -50,7 +54,8 @@ project, where ``<lang>`` is one of C, CXX, or Fortran:
``MPI_<lang>_LIBRARIES``
All libraries to link MPI programs against.
-Additionally, the following :prop_tgt:`IMPORTED` targets are defined:
+.. versionadded:: 3.9
+ Additionally, the following :prop_tgt:`IMPORTED` targets are defined:
``MPI::MPI_<lang>``
Target for using MPI from ``<lang>``.
@@ -236,8 +241,10 @@ If the following variables are set to true, the respective search will be perfor
Backward Compatibility
^^^^^^^^^^^^^^^^^^^^^^
+.. deprecated:: 3.10
+
For backward compatibility with older versions of FindMPI, these
-variables are set, but deprecated:
+variables are set:
::
@@ -287,6 +294,11 @@ if(WIN32)
set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc.bat)
set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort.bat mpif77.bat mpif90.bat)
+ # Intel MPI compiler names
+ set(_MPI_IntelLLVM_C_COMPILER_NAMES mpiicc.bat)
+ set(_MPI_IntelLLVM_CXX_COMPILER_NAMES mpiicpc.bat)
+ set(_MPI_IntelLLVM_Fortran_COMPILER_NAMES mpiifort.bat mpif77.bat mpif90.bat)
+
# Intel MPI compiler names for MSMPI
set(_MPI_MSVC_C_COMPILER_NAMES mpicl.bat)
set(_MPI_MSVC_CXX_COMPILER_NAMES mpicl.bat)
@@ -295,6 +307,11 @@ else()
set(_MPI_Intel_C_COMPILER_NAMES mpiicc)
set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++)
set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77)
+
+ # Intel compiler names
+ set(_MPI_IntelLLVM_C_COMPILER_NAMES mpiicc)
+ set(_MPI_IntelLLVM_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++)
+ set(_MPI_IntelLLVM_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77)
endif()
# PGI compiler names
@@ -320,7 +337,7 @@ set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95
# pick up the right settings for it.
foreach (LANG IN ITEMS C CXX Fortran)
set(_MPI_${LANG}_COMPILER_NAMES "")
- foreach (id IN ITEMS GNU Intel MSVC PGI XL)
+ foreach (id IN ITEMS GNU Intel IntelLLVM MSVC PGI XL)
if (NOT CMAKE_${LANG}_COMPILER_ID OR CMAKE_${LANG}_COMPILER_ID STREQUAL id)
foreach(_COMPILER_NAME IN LISTS _MPI_${id}_${LANG}_COMPILER_NAMES)
list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_COMPILER_NAME}${MPI_EXECUTABLE_SUFFIX})
@@ -1411,7 +1428,9 @@ foreach(LANG IN ITEMS C CXX Fortran)
endif()
else()
set(_MPI_FIND_${LANG} FALSE)
- string(APPEND _MPI_FAIL_REASON "MPI component '${LANG}' was requested, but language ${LANG} is not enabled. ")
+ if(${LANG} IN_LIST MPI_FIND_COMPONENTS)
+ string(APPEND _MPI_FAIL_REASON "MPI component '${LANG}' was requested, but language ${LANG} is not enabled. ")
+ endif()
endif()
if(_MPI_FIND_${LANG})
if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS )
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 01f04922f9..efe871bc22 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -17,6 +17,9 @@ can also be used:
* to retrieve various information from Matlab (mex extensions, versions and
release queries, ...)
+.. versionadded:: 3.12
+ Added Matlab Compiler Runtime (MCR) support.
+
The module supports the following components:
* ``ENG_LIBRARY`` and ``MAT_LIBRARY``: respectively the ``ENG`` and ``MAT``
@@ -28,6 +31,17 @@ The module supports the following components:
* ``MCC_COMPILER`` the MCC compiler, included with the Matlab Compiler add-on.
* ``SIMULINK`` the Simulink environment.
+.. versionadded:: 3.7
+ Added the ``MAT_LIBRARY`` component.
+
+.. versionadded:: 3.13
+ Added the ``ENGINE_LIBRARY``, ``DATAARRAY_LIBRARY`` and ``MCC_COMPILER``
+ components.
+
+.. versionchanged:: 3.14
+ Removed the ``MX_LIBRARY``, ``ENGINE_LIBRARY`` and ``DATAARRAY_LIBRARY``
+ components. These libraries are found unconditionally.
+
.. note::
The version given to the :command:`find_package` directive is the Matlab
@@ -107,8 +121,12 @@ Result variables
Matlab matrix library. Available only if the component ``MAT_LIBRARY``
is requested.
``Matlab_ENGINE_LIBRARY``
+ .. versionadded:: 3.13
+
Matlab C++ engine library, always available for R2018a and newer.
``Matlab_DATAARRAY_LIBRARY``
+ .. versionadded:: 3.13
+
Matlab C++ data array library, always available for R2018a and newer.
``Matlab_LIBRARIES``
the whole set of libraries of Matlab
@@ -116,6 +134,8 @@ Result variables
the mex compiler of Matlab. Currently not used.
Available only if the component ``MEX_COMPILER`` is requested.
``Matlab_MCC_COMPILER``
+ .. versionadded:: 3.13
+
the mcc compiler of Matlab. Included with the Matlab Compiler add-on.
Available only if the component ``MCC_COMPILER`` is requested.
@@ -389,12 +409,12 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio
set(matlabs_from_registry)
- foreach(_installation_type IN ITEMS "MATLAB" "MATLAB Runtime")
+ foreach(_installation_type IN ITEMS "MATLAB" "MATLAB Runtime" "MATLAB Compiler Runtime")
# /reg:64 should be added on 64 bits capable OSs in order to enable the
# redirection of 64 bits applications
execute_process(
- COMMAND reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Mathworks\\${_installation_type} /f * /k ${APPEND_REG}
+ COMMAND reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Mathworks\\${_installation_type}" /f * /k ${APPEND_REG}
RESULT_VARIABLE resultMatlab
OUTPUT_VARIABLE varMatlab
ERROR_VARIABLE errMatlab
@@ -405,12 +425,12 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio
if(resultMatlab EQUAL 0)
string(
- REGEX MATCHALL "MATLAB\\\\([0-9]+(\\.[0-9]+)?)"
+ REGEX MATCHALL "${_installation_type}\\\\([0-9]+(\\.[0-9]+)?)"
matlab_versions_regex ${varMatlab})
foreach(match IN LISTS matlab_versions_regex)
string(
- REGEX MATCH "MATLAB\\\\(([0-9]+)(\\.([0-9]+))?)"
+ REGEX MATCH "${_installation_type}\\\\(([0-9]+)(\\.([0-9]+))?)"
current_match ${match})
set(_matlab_current_version ${CMAKE_MATCH_1})
@@ -517,7 +537,7 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\${_matlab_current_version};MATLABROOT]"
ABSOLUTE)
- if(EXISTS ${current_MATLAB_ROOT})
+ if(EXISTS "${current_MATLAB_ROOT}")
list(APPEND _matlab_roots_list "MATLAB" ${_matlab_current_version} ${current_MATLAB_ROOT})
endif()
@@ -533,7 +553,23 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_
# remove the dot
string(REPLACE "." "" _matlab_current_version_without_dot "${_matlab_current_version}")
- if(EXISTS ${current_MATLAB_ROOT})
+ if(EXISTS "${current_MATLAB_ROOT}")
+ list(APPEND _matlab_roots_list "MCR" ${_matlab_current_version} "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}")
+ endif()
+
+ endforeach()
+
+ # Check for old MCR installations
+ foreach(_matlab_current_version ${matlab_versions})
+ get_filename_component(
+ current_MATLAB_ROOT
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB Compiler Runtime\\${_matlab_current_version};MATLABROOT]"
+ ABSOLUTE)
+
+ # remove the dot
+ string(REPLACE "." "" _matlab_current_version_without_dot "${_matlab_current_version}")
+
+ if(EXISTS "${current_MATLAB_ROOT}")
list(APPEND _matlab_roots_list "MCR" ${_matlab_current_version} "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}")
endif()
@@ -923,14 +959,26 @@ endfunction()
the same folder without any processing, with the same name as the final
mex file, and with extension `.m`. In that case, typing ``help <name>``
in Matlab prints the documentation contained in this file.
- ``R2017b`` or ``R2018a`` may be given to specify the version of the C API
+ ``R2017b`` or ``R2018a``
+ .. versionadded:: 3.14
+
+ May be given to specify the version of the C API
to use: ``R2017b`` specifies the traditional (separate complex) C API,
and corresponds to the ``-R2017b`` flag for the `mex` command. ``R2018a``
specifies the new interleaved complex C API, and corresponds to the
``-R2018a`` flag for the `mex` command. Ignored if MATLAB version prior
to R2018a. Defaults to ``R2017b``.
- ``MODULE`` or ``SHARED`` may be given to specify the type of library to be
- created. ``EXECUTABLE`` may be given to create an executable instead of
+
+ ``MODULE`` or ``SHARED``
+ .. versionadded:: 3.7
+
+ May be given to specify the type of library to be
+ created.
+
+ ``EXECUTABLE``
+ .. versionadded:: 3.7
+
+ May be given to create an executable instead of
a library. If no type is given explicitly, the type is ``SHARED``.
``EXCLUDE_FROM_ALL``
This option has the same meaning as for :prop_tgt:`EXCLUDE_FROM_ALL` and
@@ -1035,7 +1083,12 @@ function(matlab_add_mex)
target_include_directories(${${prefix}_NAME} PRIVATE ${Matlab_INCLUDE_DIRS})
if(Matlab_HAS_CPP_API)
- target_link_libraries(${${prefix}_NAME} ${Matlab_ENGINE_LIBRARY} ${Matlab_DATAARRAY_LIBRARY})
+ if(Matlab_ENGINE_LIBRARY)
+ target_link_libraries(${${prefix}_NAME} ${Matlab_ENGINE_LIBRARY})
+ endif()
+ if(Matlab_DATAARRAY_LIBRARY)
+ target_link_libraries(${${prefix}_NAME} ${Matlab_DATAARRAY_LIBRARY})
+ endif()
endif()
target_link_libraries(${${prefix}_NAME} ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${${prefix}_LINK_TO})
@@ -1655,32 +1708,34 @@ find_path(
)
list(APPEND _matlab_required_variables Matlab_INCLUDE_DIRS)
-_Matlab_find_library(
- ${_matlab_lib_prefix_for_search}
- Matlab_MEX_LIBRARY
- mex
- PATHS ${_matlab_lib_dir_for_search}
- NO_DEFAULT_PATH
-)
-list(APPEND _matlab_required_variables Matlab_MEX_LIBRARY)
+if(Matlab_Or_MCR STREQUAL "MATLAB" OR Matlab_Or_MCR STREQUAL "UNKNOWN")
+ _Matlab_find_library(
+ ${_matlab_lib_prefix_for_search}
+ Matlab_MEX_LIBRARY
+ mex
+ PATHS ${_matlab_lib_dir_for_search}
+ NO_DEFAULT_PATH
+ )
+ list(APPEND _matlab_required_variables Matlab_MEX_LIBRARY)
-# the MEX extension is required
-list(APPEND _matlab_required_variables Matlab_MEX_EXTENSION)
+ # the MEX extension is required
+ list(APPEND _matlab_required_variables Matlab_MEX_EXTENSION)
-# the matlab root is required
-list(APPEND _matlab_required_variables Matlab_ROOT_DIR)
+ # the matlab root is required
+ list(APPEND _matlab_required_variables Matlab_ROOT_DIR)
-# The MX library is required
-_Matlab_find_library(
- ${_matlab_lib_prefix_for_search}
- Matlab_MX_LIBRARY
- mx
- PATHS ${_matlab_lib_dir_for_search}
- NO_DEFAULT_PATH
-)
-list(APPEND _matlab_required_variables Matlab_MX_LIBRARY)
-if(Matlab_MX_LIBRARY)
- set(Matlab_MX_LIBRARY_FOUND TRUE)
+ # The MX library is required
+ _Matlab_find_library(
+ ${_matlab_lib_prefix_for_search}
+ Matlab_MX_LIBRARY
+ mx
+ PATHS ${_matlab_lib_dir_for_search}
+ NO_DEFAULT_PATH
+ )
+ list(APPEND _matlab_required_variables Matlab_MX_LIBRARY)
+ if(Matlab_MX_LIBRARY)
+ set(Matlab_MX_LIBRARY_FOUND TRUE)
+ endif()
endif()
if(Matlab_HAS_CPP_API)
@@ -1694,7 +1749,6 @@ if(Matlab_HAS_CPP_API)
DOC "MatlabEngine Library"
NO_DEFAULT_PATH
)
- list(APPEND _matlab_required_variables Matlab_ENGINE_LIBRARY)
if(Matlab_ENGINE_LIBRARY)
set(Matlab_ENGINE_LIBRARY_FOUND TRUE)
endif()
@@ -1708,7 +1762,6 @@ if(Matlab_HAS_CPP_API)
DOC "MatlabDataArray Library"
NO_DEFAULT_PATH
)
- list(APPEND _matlab_required_variables Matlab_DATAARRAY_LIBRARY)
if(Matlab_DATAARRAY_LIBRARY)
set(Matlab_DATAARRAY_LIBRARY_FOUND TRUE)
endif()
@@ -1801,8 +1854,15 @@ endif()
set(Matlab_LIBRARIES
${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY}
- ${Matlab_ENG_LIBRARY} ${Matlab_MAT_LIBRARY}
- ${Matlab_DATAARRAY_LIBRARY} ${Matlab_ENGINE_LIBRARY})
+ ${Matlab_ENG_LIBRARY} ${Matlab_MAT_LIBRARY})
+
+if(Matlab_ENGINE_LIBRARY)
+ list(APPEND Matlab_LIBRARIES ${Matlab_ENGINE_LIBRARY})
+endif()
+
+if(Matlab_DATAARRAY_LIBRARY)
+ list(APPEND Matlab_LIBRARIES ${Matlab_DATAARRAY_LIBRARY})
+endif()
find_package_handle_standard_args(
Matlab
diff --git a/Modules/FindOpenACC.cmake b/Modules/FindOpenACC.cmake
index ed52e3591f..cf58f3b807 100644
--- a/Modules/FindOpenACC.cmake
+++ b/Modules/FindOpenACC.cmake
@@ -12,7 +12,17 @@ Detect OpenACC support by the compiler.
This module can be used to detect OpenACC support in a compiler.
If the compiler supports OpenACC, the flags required to compile with
OpenACC support are returned in variables for the different languages.
-Currently, only PGI, GNU and Cray compilers are supported.
+Currently, only NVHPC, PGI, GNU and Cray compilers are supported.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.16
+
+The module provides :prop_tgt:`IMPORTED` targets:
+
+``OpenACC::OpenACC_<lang>``
+ Target for using OpenACC from ``<lang>``.
Variables
^^^^^^^^^
@@ -25,14 +35,11 @@ project, where ``<lang>`` is one of C, CXX, or Fortran:
``OpenACC_<lang>_FLAGS``
OpenACC compiler flags for ``<lang>``, separated by spaces.
``OpenACC_<lang>_OPTIONS``
+ .. versionadded:: 3.16
+
OpenACC compiler flags for ``<lang>``, as a list. Suitable for usage
with target_compile_options or target_link_options.
-Additionally, the module provides :prop_tgt:`IMPORTED` targets:
-
-``OpenACC::OpenACC_<lang>``
- Target for using OpenACC from ``<lang>``.
-
The module will also try to provide the OpenACC version variables:
``OpenACC_<lang>_SPEC_DATE``
@@ -132,6 +139,7 @@ endfunction()
function(_OPENACC_GET_FLAGS_CANDIDATE LANG FLAG_VAR)
+ set(ACC_FLAG_NVHPC "-acc")
set(ACC_FLAG_PGI "-acc")
set(ACC_FLAG_GNU "-fopenacc")
set(ACC_FLAG_Cray "-h acc")
@@ -148,6 +156,7 @@ endfunction()
function(_OPENACC_GET_ACCEL_TARGET_FLAG LANG TARGET FLAG_VAR)
# Find target accelerator flags.
+ set(ACC_TARGET_FLAG_NVHPC "-ta")
set(ACC_TARGET_FLAG_PGI "-ta")
if(DEFINED ACC_TARGET_FLAG_${CMAKE_${LANG}_COMPILER_ID})
set("${FLAG_VAR}" "${ACC_TARGET_FLAG_${CMAKE_${LANG}_COMPILER_ID}}=${TARGET}" PARENT_SCOPE)
@@ -157,6 +166,7 @@ endfunction()
function(_OPENACC_GET_VERBOSE_FLAG LANG FLAG_VAR)
# Find compiler's verbose flag for OpenACC.
+ set(ACC_VERBOSE_FLAG_NVHPC "-Minfo=accel")
set(ACC_VERBOSE_FLAG_PGI "-Minfo=accel")
if(DEFINED ACC_VERBOSE_FLAG_${CMAKE_${LANG}_COMPILER_ID})
set("${FLAG_VAR}" "${ACC_VERBOSE_FLAG_${CMAKE_${LANG}_COMPILER_ID}}" PARENT_SCOPE)
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
index b3e5a9f8de..1b4662b76f 100644
--- a/Modules/FindOpenCL.cmake
+++ b/Modules/FindOpenCL.cmake
@@ -9,9 +9,14 @@ FindOpenCL
Finds Open Computing Language (OpenCL)
+.. versionadded:: 3.10
+ Detection of OpenCL 2.1 and 2.2.
+
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.7
+
This module defines :prop_tgt:`IMPORTED` target ``OpenCL::OpenCL``, if
OpenCL has been found.
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 110e7f9637..d6d1c0000c 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -7,27 +7,41 @@ FindOpenGL
FindModule for OpenGL and OpenGL Utility Library (GLU).
+.. versionchanged:: 3.2
+ X11 is no longer added as a dependency on Unix/Linux systems.
+
+.. versionadded:: 3.10
+ GLVND support on Linux. See the :ref:`Linux Specific` section below.
+
Optional COMPONENTS
^^^^^^^^^^^^^^^^^^^
+.. versionadded:: 3.10
+
This module respects several optional COMPONENTS: ``EGL``, ``GLX``, and
``OpenGL``. There are corresponding import targets for each of these flags.
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.8
+
This module defines the :prop_tgt:`IMPORTED` targets:
``OpenGL::GL``
- Defined to the platform-specific OpenGL libraries if the system has OpenGL.
-``OpenGL::OpenGL``
- Defined to libOpenGL if the system is GLVND-based.
+ Defined to the platform-specific OpenGL libraries if the system has OpenGL.
``OpenGL::GLU``
- Defined if the system has OpenGL Utility Library (GLU).
+ Defined if the system has OpenGL Utility Library (GLU).
+
+.. versionadded:: 3.10
+ Additionally, the following GLVND-specific library targets are defined:
+
+``OpenGL::OpenGL``
+ Defined to libOpenGL if the system is GLVND-based.
``OpenGL::GLX``
- Defined if the system has OpenGL Extension to the X Window System (GLX).
+ Defined if the system has OpenGL Extension to the X Window System (GLX).
``OpenGL::EGL``
- Defined if the system has EGL.
+ Defined if the system has EGL.
Result Variables
^^^^^^^^^^^^^^^^
@@ -55,6 +69,9 @@ This module sets the following variables:
On Linux, this assumes GLX and is never correct for EGL-based targets.
Clients are encouraged to use the ``OpenGL::*`` import targets instead.
+.. versionadded:: 3.10
+ Variables for GLVND-specific libraries ``OpenGL``, ``EGL`` and ``GLX``.
+
Cache variables
^^^^^^^^^^^^^^^
@@ -72,6 +89,11 @@ The following cache variables may also be set:
Path to the OpenGL library. New code should prefer the ``OpenGL::*`` import
targets.
+.. versionadded:: 3.10
+ Variables for GLVND-specific libraries ``OpenGL``, ``EGL`` and ``GLX``.
+
+.. _`Linux Specific`:
+
Linux-specific
^^^^^^^^^^^^^^
@@ -97,14 +119,14 @@ The value may be one of:
``GLVND``
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) or if policy :policy:`CMP0072` is
- set to ``NEW``.
+
+ .. versionchanged:: 3.11
+ This is the default, unless policy :policy:`CMP0072` is set to ``OLD``
+ and no components are requeted (since components
+ correspond to GLVND libraries).
``LEGACY``
Prefer to use the legacy libGL library, if available.
- 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*
@@ -443,7 +465,7 @@ if(OPENGL_FOUND)
# ::GLX is a GLVND library, and thus Linux-only: we don't bother checking
# for a framework version of this library.
- if(OpenGL_GLX_FOUND AND NOT TARGET OpenGL::GLX)
+ if(OpenGL_GLX_FOUND AND NOT TARGET OpenGL::GLX AND TARGET OpenGL::OpenGL)
if(IS_ABSOLUTE "${OPENGL_glx_LIBRARY}")
add_library(OpenGL::GLX UNKNOWN IMPORTED)
set_target_properties(OpenGL::GLX PROPERTIES IMPORTED_LOCATION
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index bb38e28e1a..a1ffc25184 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -13,11 +13,15 @@ OpenMP support are returned in variables for the different languages.
The variables may be empty if the compiler does not need a special
flag to support OpenMP.
+.. versionadded:: 3.5
+ Clang support.
+
Variables
^^^^^^^^^
-The module exposes the components ``C``, ``CXX``, and ``Fortran``.
-Each of these controls the various languages to search OpenMP support for.
+.. versionadded:: 3.10
+ The module exposes the components ``C``, ``CXX``, and ``Fortran``.
+ Each of these controls the various languages to search OpenMP support for.
Depending on the enabled components the following variables will be set:
@@ -65,6 +69,8 @@ Specifically for Fortran, the module sets the following variables:
The module will also try to provide the OpenMP version variables:
``OpenMP_<lang>_SPEC_DATE``
+ .. versionadded:: 3.7
+
Date of the OpenMP specification implemented by the ``<lang>`` compiler.
``OpenMP_<lang>_VERSION_MAJOR``
Major version of OpenMP implemented by the ``<lang>`` compiler.
@@ -107,10 +113,12 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
else()
set(OMP_FLAG_Intel "-qopenmp")
endif()
+ set(OMP_FLAG_IntelLLVM "-fiopenmp")
set(OMP_FLAG_MSVC "-openmp")
set(OMP_FLAG_PathScale "-openmp")
set(OMP_FLAG_NAG "-openmp")
set(OMP_FLAG_Absoft "-openmp")
+ set(OMP_FLAG_NVHPC "-mp")
set(OMP_FLAG_PGI "-mp")
set(OMP_FLAG_Flang "-fopenmp")
set(OMP_FLAG_SunPro "-xopenmp")
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 91a65fddaa..b1afa5f401 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -7,15 +7,29 @@ FindOpenSSL
Find the OpenSSL encryption library.
+This module finds an installed OpenSSL library and determines its version.
+
+.. versionadded:: 3.19
+ When a version is requested, it can be specified as a simple value or as a
+ range. For a detailed description of version range usage and capabilities,
+ refer to the :command:`find_package` command.
+
+.. versionadded:: 3.18
+ Support for OpenSSL 3.0.
+
Optional COMPONENTS
^^^^^^^^^^^^^^^^^^^
+.. versionadded:: 3.12
+
This module supports two optional COMPONENTS: ``Crypto`` and ``SSL``. Both
components have associated imported targets, as described below.
Imported Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.4
+
This module defines the following :prop_tgt:`IMPORTED` targets:
``OpenSSL::SSL``
@@ -23,6 +37,8 @@ This module defines the following :prop_tgt:`IMPORTED` targets:
``OpenSSL::Crypto``
The OpenSSL ``crypto`` library, if found.
``OpenSSL::applink``
+ .. versionadded:: 3.18
+
The OpenSSL ``applink`` components that might be need to be compiled into
projects under MSVC. This target is available only if found OpenSSL version
is not less than 0.9.8. By linking this target the above OpenSSL targets can
@@ -75,8 +91,12 @@ Hints
^^^^^
Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation.
-Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries.
-Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib.
+
+.. versionadded:: 3.4
+ Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries.
+
+.. versionadded:: 3.5
+ Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib.
#]=======================================================================]
macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library)
@@ -128,16 +148,30 @@ if (WIN32)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
ENV OPENSSL_ROOT_DIR
)
- file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
+
+ if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
+ set(_arch "Win64")
+ file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
+ else()
+ set(_arch "Win32")
+ set(_progfiles_x86 "ProgramFiles(x86)")
+ if(NOT "$ENV{${_progfiles_x86}}" STREQUAL "")
+ # under windows 64 bit machine
+ file(TO_CMAKE_PATH "$ENV{${_progfiles_x86}}" _programfiles)
+ else()
+ # under windows 32 bit machine
+ file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _programfiles)
+ endif()
+ endif()
+
set(_OPENSSL_ROOT_PATHS
"${_programfiles}/OpenSSL"
- "${_programfiles}/OpenSSL-Win32"
- "${_programfiles}/OpenSSL-Win64"
+ "${_programfiles}/OpenSSL-${_arch}"
"C:/OpenSSL/"
- "C:/OpenSSL-Win32/"
- "C:/OpenSSL-Win64/"
+ "C:/OpenSSL-${_arch}/"
)
unset(_programfiles)
+ unset(_arch)
else ()
set(_OPENSSL_ROOT_HINTS
${OPENSSL_ROOT_DIR}
@@ -539,6 +573,7 @@ find_package_handle_standard_args(OpenSSL
OPENSSL_INCLUDE_DIR
VERSION_VAR
OPENSSL_VERSION
+ HANDLE_VERSION_RANGE
HANDLE_COMPONENTS
FAIL_MESSAGE
"Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index fd0e4e93e9..94d15db5fc 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -10,6 +10,8 @@ Find libpng, the official reference library for the PNG image format.
Imported targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.5
+
This module defines the following :prop_tgt:`IMPORTED` target:
``PNG::PNG``
@@ -53,6 +55,7 @@ find_package(ZLIB ${_FIND_ZLIB_ARG})
if(ZLIB_FOUND)
find_path(PNG_PNG_INCLUDE_DIR png.h PATH_SUFFIXES include/libpng)
+ mark_as_advanced(PNG_PNG_INCLUDE_DIR)
list(APPEND PNG_NAMES png libpng)
unset(PNG_NAMES_DEBUG)
@@ -156,5 +159,3 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(PNG
REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR
VERSION_VAR PNG_VERSION_STRING)
-
-mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index 7e172779e4..fbcf7cd88b 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -51,7 +51,9 @@ implementing :command:`find_package(<PackageName>)` calls.
(recommended). Not valid in the full signature.
``FOUND_VAR <result-var>``
- Obsolete. Specifies either ``<PackageName>_FOUND`` or
+ .. deprecated:: 3.3
+
+ Specifies either ``<PackageName>_FOUND`` or
``<PACKAGENAME>_FOUND`` as the result variable. This exists only
for compatibility with older versions of CMake and is now ignored.
Result variables of both names are always set for compatibility.
@@ -61,8 +63,10 @@ implementing :command:`find_package(<PackageName>)` calls.
These may be named in the generated failure message asking the
user to set the missing variable values. Therefore these should
typically be cache entries such as ``FOO_LIBRARY`` and not output
- variables like ``FOO_LIBRARIES``. This option is mandatory if
- ``HANDLE_COMPONENTS`` is not specified.
+ variables like ``FOO_LIBRARIES``.
+
+ .. versionchanged:: 3.18
+ If ``HANDLE_COMPONENTS`` is specified, this option can be omitted.
``VERSION_VAR <version-var>``
Specify the name of a variable that holds the version of the package
@@ -74,6 +78,8 @@ implementing :command:`find_package(<PackageName>)` calls.
if the version is ok or not.
``HANDLE_VERSION_RANGE``
+ .. versionadded:: 3.19
+
Enable handling of a version range, if one is specified. Without this
option, a developer warning will be displayed if a version range is
specified.
@@ -94,6 +100,8 @@ implementing :command:`find_package(<PackageName>)` calls.
was found.
``REASON_FAILURE_MESSAGE <reason-failure-message>``
+ .. versionadded:: 3.16
+
Specify a custom message of the reason for the failure which will be
appended to the default generated message.
@@ -102,6 +110,8 @@ implementing :command:`find_package(<PackageName>)` calls.
generated message. Not recommended.
``NAME_MISMATCHED``
+ .. versionadded:: 3.17
+
Indicate that the ``<PackageName>`` does not match
``${CMAKE_FIND_PACKAGE_NAME}``. This is usually a mistake and raises a
warning, but it may be intentional for usage of the command for components
@@ -163,6 +173,8 @@ message.
.. command:: find_package_check_version
+ .. versionadded:: 3.19
+
Helper function which can be used to check if a ``<version>`` is valid
against version-related arguments of :command:`find_package`.
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 2ad2c7e174..b41c2c3d2d 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -632,19 +632,38 @@ endmacro()
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`. The ``GLOBAL`` argument will make the
- imported target available in global scope.
+ .. versionadded:: 3.1
+ 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 :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` variable set to ``FALSE``
+ disables this behavior globally.
+
+ .. This didn't actually work until 3.3.
+
+ .. versionadded:: 3.6
+ 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`.
+
+ .. This didn't actually work until 3.7.
+
+ .. versionadded:: 3.13
+ The ``GLOBAL`` argument will make the
+ imported target available in global scope.
+
+ .. versionadded:: 3.15
+ Non-library linker options reported by ``pkg-config`` are stored in the
+ :prop_tgt:`INTERFACE_LINK_OPTIONS` target property.
+
+ .. versionchanged:: 3.18
+ Include directories specified with ``-isystem`` are stored in the
+ :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property. Previous
+ versions of CMake left them in the :prop_tgt:`INTERFACE_COMPILE_OPTIONS`
+ property.
Each ``<moduleSpec>`` can be either a bare module name or it can be a
module name with a version constraint (operators ``=``, ``<``, ``>``,
@@ -683,6 +702,11 @@ endmacro()
All but ``<XXX>_FOUND`` may be a :ref:`;-list <CMake Language Lists>` if the
associated variable returned from ``pkg-config`` has multiple values.
+ .. versionchanged:: 3.18
+ Include directories specified with ``-isystem`` are stored in the
+ ``<XXX>_INCLUDE_DIRS`` variable. Previous versions of CMake left them
+ in ``<XXX>_CFLAGS_OTHER``.
+
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>``
@@ -697,6 +721,16 @@ endmacro()
``<YYY>_LIBDIR``
lib directory of the module
+ .. versionchanged:: 3.8
+ For any given ``<prefix>``, ``pkg_check_modules()`` can be called multiple
+ times with different parameters. Previous versions of CMake cached and
+ returned the first successful result.
+
+ .. versionchanged:: 3.16
+ If a full path to the found library can't be determined, but it's still
+ visible to the linker, pass it through as ``-l<name>``. Previous versions
+ of CMake failed in this case.
+
Examples:
.. code-block:: cmake
@@ -768,9 +802,10 @@ endmacro()
[IMPORTED_TARGET [GLOBAL]]
<moduleSpec> [<moduleSpec>...])
- If a module is found, the ``<prefix>_MODULE_NAME`` variable will contain the
- name of the matching module. This variable can be used if you need to run
- :command:`pkg_get_variable`.
+ .. versionadded:: 3.16
+ If a module is found, the ``<prefix>_MODULE_NAME`` variable will contain the
+ name of the matching module. This variable can be used if you need to run
+ :command:`pkg_get_variable`.
Example:
@@ -815,6 +850,8 @@ endmacro()
#[========================================[.rst:
.. command:: pkg_get_variable
+ .. versionadded:: 3.4
+
Retrieves the value of a pkg-config variable ``varName`` and stores it in the
result variable ``resultVar`` in the calling scope.
@@ -849,10 +886,15 @@ Variables Affecting Behavior
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.
+ internally.
+
+ .. versionadded:: 3.1
+ The ``PKG_CONFIG`` environment variable can be used as a hint.
.. variable:: PKG_CONFIG_USE_CMAKE_PREFIX_PATH
+ .. versionadded:: 3.1
+
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
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index 1970b26a31..147071a0f7 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -10,6 +10,8 @@ Find the PostgreSQL installation.
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.14
+
This module defines :prop_tgt:`IMPORTED` target ``PostgreSQL::PostgreSQL``
if PostgreSQL has been found.
@@ -28,6 +30,16 @@ This module will set the following variables in your project:
the link directories for PostgreSQL libraries
``PostgreSQL_VERSION_STRING``
the version of PostgreSQL found
+``PostgreSQL_TYPE_INCLUDE_DIR``
+ the directories of the PostgreSQL server headers
+
+Components
+^^^^^^^^^^
+
+This module contains additional ``Server`` component, that forcibly checks
+for the presence of server headers. Note that ``PostgreSQL_TYPE_INCLUDE_DIR``
+is set regardless of the presence of the ``Server`` component in find_package call.
+
#]=======================================================================]
# ----------------------------------------------------------------------------
@@ -79,6 +91,9 @@ This module will set the following variables in your project:
#
# ----------------------------------------------------------------------------
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include")
set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}")
set(PostgreSQL_LIBRARY_PATH_DESCRIPTION "top-level directory containing the PostgreSQL libraries.")
@@ -242,10 +257,18 @@ if (PostgreSQL_INCLUDE_DIR)
unset(pgsql_version_str)
endif()
+if("Server" IN_LIST PostgreSQL_FIND_COMPONENTS)
+ set(PostgreSQL_Server_FOUND TRUE)
+ if(NOT PostgreSQL_TYPE_INCLUDE_DIR)
+ set(PostgreSQL_Server_FOUND FALSE)
+ endif()
+endif()
+
# Did we find anything?
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(PostgreSQL
- REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR
+ REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR
+ HANDLE_COMPONENTS
VERSION_VAR PostgreSQL_VERSION_STRING)
set(PostgreSQL_FOUND ${POSTGRESQL_FOUND})
@@ -269,16 +292,21 @@ endfunction()
# Now try to get the include and library path.
if(PostgreSQL_FOUND)
+ set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR})
+ if(PostgreSQL_TYPE_INCLUDE_DIR)
+ list(APPEND PostgreSQL_INCLUDE_DIRS ${PostgreSQL_TYPE_INCLUDE_DIR})
+ endif()
+ set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR})
if (NOT TARGET PostgreSQL::PostgreSQL)
add_library(PostgreSQL::PostgreSQL UNKNOWN IMPORTED)
set_target_properties(PostgreSQL::PostgreSQL PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${PostgreSQL_INCLUDE_DIR};${PostgreSQL_TYPE_INCLUDE_DIR}")
+ INTERFACE_INCLUDE_DIRECTORIES "${PostgreSQL_INCLUDE_DIRS}")
__postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY "")
__postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY "RELEASE")
__postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY "DEBUG")
endif ()
- set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} )
- set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} )
endif()
mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR)
+
+cmake_policy(POP)
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 4bf54efe3c..4b1e336893 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -7,6 +7,13 @@ FindProtobuf
Locate and configure the Google Protocol Buffers library.
+.. versionadded:: 3.6
+ Support for :command:`find_package` version checks.
+
+.. versionchanged:: 3.6
+ All input and output variables use the ``Protobuf_`` prefix.
+ Variables with ``PROTOBUF_`` prefix are still supported for compatibility.
+
The following variables can be set and are optional:
``Protobuf_SRC_ROOT_FOLDER``
@@ -19,8 +26,12 @@ The following variables can be set and are optional:
List of additional directories to be searched for
imported .proto files.
``Protobuf_DEBUG``
+ .. versionadded:: 3.6
+
Show debug messages.
``Protobuf_USE_STATIC_LIBS``
+ .. versionadded:: 3.9
+
Set to ON to force the use of the static libraries.
Default is OFF.
@@ -30,6 +41,8 @@ Defines the following variables:
Found the Google Protocol Buffers library
(libprotobuf & header files)
``Protobuf_VERSION``
+ .. versionadded:: 3.6
+
Version of package found.
``Protobuf_INCLUDE_DIRS``
Include directories for Google Protocol Buffers
@@ -40,7 +53,8 @@ Defines the following variables:
``Protobuf_LITE_LIBRARIES``
The protobuf-lite libraries
-The following :prop_tgt:`IMPORTED` targets are also defined:
+.. versionadded:: 3.9
+ The following :prop_tgt:`IMPORTED` targets are also defined:
``protobuf::libprotobuf``
The protobuf library.
@@ -49,7 +63,8 @@ The following :prop_tgt:`IMPORTED` targets are also defined:
``protobuf::libprotoc``
The protoc library.
``protobuf::protoc``
- The protoc compiler.
+ .. versionadded:: 3.10
+ The protoc compiler.
The following cache variables are also available to set or use:
@@ -101,7 +116,8 @@ Example:
``HDRS``
Variable to define with autogenerated header files
``DESCRIPTORS``
- Variable to define with autogenerated descriptor files, if requested.
+ .. versionadded:: 3.10
+ Variable to define with autogenerated descriptor files, if requested.
``EXPORT_MACRO``
is a macro which should expand to ``__declspec(dllexport)`` or
``__declspec(dllimport)`` depending on what is being compiled.
@@ -110,6 +126,8 @@ Example:
.. command:: protobuf_generate_python
+ .. versionadded:: 3.4
+
Add custom commands to process ``.proto`` files to Python::
protobuf_generate_python (<PY> [<ARGN>...])
@@ -204,7 +222,7 @@ function(protobuf_generate)
foreach(_proto ${protobuf_generate_PROTOS})
get_filename_component(_abs_file ${_proto} ABSOLUTE)
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
- get_filename_component(_basename ${_proto} NAME_WE)
+ get_filename_component(_basename ${_proto} NAME_WLE)
file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir})
set(_possible_rel_dir)
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index 5fc6a3b21c..a4b7a0385c 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -10,25 +10,32 @@ FindPython
Find Python interpreter, compiler and development environment (include
directories and libraries).
-When a version is requested, it can be specified as a simple value or as a
-range. For a detailed description of version range usage and capabilities,
-refer to the :command:`find_package` command.
+.. versionadded:: 3.19
+ When a version is requested, it can be specified as a simple value or as a
+ range. For a detailed description of version range usage and capabilities,
+ refer to the :command:`find_package` command.
The following components are supported:
* ``Interpreter``: search for Python interpreter.
* ``Compiler``: search for Python compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
- libraries). This component includes two sub-components which can be specified
- independently:
+ libraries).
- * ``Development.Module``: search for artifacts for Python module
- developments.
- * ``Development.Embed``: search for artifacts for Python embedding
- developments.
+ .. versionadded:: 3.18
+ This component includes two sub-components which can be specified
+ independently:
+
+ * ``Development.Module``: search for artifacts for Python module
+ developments.
+ * ``Development.Embed``: search for artifacts for Python embedding
+ developments.
* ``NumPy``: search for NumPy include directories.
+.. versionadded:: 3.14
+ Added the ``NumPy`` component.
+
If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed.
If component ``Development`` is specified, it implies sub-components
@@ -56,20 +63,30 @@ To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and
Imported Targets
^^^^^^^^^^^^^^^^
-This module defines the following :ref:`Imported Targets <Imported Targets>`
-(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
+This module defines the following :ref:`Imported Targets <Imported Targets>`:
+
+.. versionchanged:: 3.14
+ :ref:`Imported Targets <Imported Targets>` are only created when
+ :prop_gbl:`CMAKE_ROLE` is ``PROJECT``.
``Python::Interpreter``
Python interpreter. Target defined if component ``Interpreter`` is found.
``Python::Compiler``
Python compiler. Target defined if component ``Compiler`` is found.
+
``Python::Module``
+ .. versionadded:: 3.15
+
Python library for Python module. Target defined if component
``Development.Module`` is found.
+
``Python::Python``
Python library for Python embedding. Target defined if component
``Development.Embed`` is found.
+
``Python::NumPy``
+ .. versionadded:: 3.14
+
NumPy Python library. Target defined if component ``NumPy`` is found.
Result Variables
@@ -116,7 +133,10 @@ This module will set the following variables in your project
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``
or else ``sysconfig.get_path('platlib')``.
+
``Python_SOABI``
+ .. versionadded:: 3.17
+
Extension suffix for modules.
Information returned by
@@ -125,6 +145,7 @@ This module will set the following variables in your project
``python-config --extension-suffix``. If package ``distutils.sysconfig`` is
not available, ``sysconfig.get_config_var('SOABI')`` or
``sysconfig.get_config_var('EXT_SUFFIX')`` are used.
+
``Python_Compiler_FOUND``
System has the Python compiler.
``Python_COMPILER``
@@ -132,19 +153,35 @@ This module will set the following variables in your project
``Python_COMPILER_ID``
A short string unique to the compiler. Possible values include:
* IronPython
+
``Python_DOTNET_LAUNCHER``
+ .. versionadded:: 3.18
+
The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
+
``Python_Development_FOUND``
System has the Python development artifacts.
+
``Python_Development.Module_FOUND``
+ .. versionadded:: 3.18
+
System has the Python development artifacts for Python module.
+
``Python_Development.Embed_FOUND``
+ .. versionadded:: 3.18
+
System has the Python development artifacts for Python embedding.
+
``Python_INCLUDE_DIRS``
+
The Python include directories.
+
``Python_LINK_OPTIONS``
+ .. versionadded:: 3.19
+
The Python link options. Some configurations require specific link options
for a correct build and execution.
+
``Python_LIBRARIES``
The Python libraries.
``Python_LIBRARY_DIRS``
@@ -159,13 +196,25 @@ This module will set the following variables in your project
Python minor version.
``Python_VERSION_PATCH``
Python patch version.
+
``Python_PyPy_VERSION``
+ .. versionadded:: 3.18
+
Python PyPy version.
+
``Python_NumPy_FOUND``
+ .. versionadded:: 3.14
+
System has the NumPy.
+
``Python_NumPy_INCLUDE_DIRS``
+ .. versionadded:: 3.14
+
The NumPy include directories.
+
``Python_NumPy_VERSION``
+ .. versionadded:: 3.14
+
The NumPy version.
Hints
@@ -181,6 +230,8 @@ Hints
* If set to FALSE, search **only** for shared libraries.
``Python_FIND_ABI``
+ .. versionadded:: 3.16
+
This variable defines which ABIs, as defined in
`PEP 3149 <https://www.python.org/dev/peps/pep-3149/>`_, should be searched.
@@ -226,6 +277,8 @@ Hints
each flag is ``OFF`` or ``ANY``.
``Python_FIND_STRATEGY``
+ .. versionadded:: 3.15
+
This variable defines how lookup will be done.
The ``Python_FIND_STRATEGY`` variable can be set to one of the following:
@@ -238,6 +291,8 @@ Hints
This is the default if policy :policy:`CMP0094` is set to ``NEW``.
``Python_FIND_REGISTRY``
+ .. versionadded:: 3.13
+
On Windows the ``Python_FIND_REGISTRY`` variable determine the order
of preference between registry and environment variables.
the ``Python_FIND_REGISTRY`` variable can be set to one of the following:
@@ -248,6 +303,8 @@ Hints
* ``NEVER``: Never try to use registry.
``Python_FIND_FRAMEWORK``
+ .. versionadded:: 3.15
+
On macOS the ``Python_FIND_FRAMEWORK`` variable determine the order of
preference between Apple-style and unix-style package components.
This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK`
@@ -261,6 +318,8 @@ Hints
variable will be used, if any.
``Python_FIND_VIRTUALENV``
+ .. versionadded:: 3.15
+
This variable defines the handling of virtual environments managed by
``virtualenv`` or ``conda``. It is meaningful only when a virtual environment
is active (i.e. the ``activate`` script has been evaluated). In this case, it
@@ -279,6 +338,9 @@ Hints
``NEVER`` to select preferably the interpreter from the virtual
environment.
+ .. versionadded:: 3.17
+ Added support for ``conda`` environments.
+
.. note::
If the component ``Development`` is requested, it is **strongly**
@@ -286,6 +348,8 @@ Hints
result.
``Python_FIND_IMPLEMENTATIONS``
+ .. versionadded:: 3.18
+
This variable defines, in an ordered list, the different implementations
which will be searched. The ``Python_FIND_IMPLEMENTATIONS`` variable can
hold the following values:
@@ -318,9 +382,26 @@ Hints
``.Net`` interpreter (i.e. ``mono`` command) is expected to be available
through the ``PATH`` variable.
+``Python_FIND_UNVERSIONED_NAMES``
+ .. versionadded:: 3.20
+
+ This variable defines how the generic names will be searched. Currently, it
+ only applies to the generic names of the interpreter, namely, ``python3`` or
+ ``python2`` and ``python``.
+ The ``Python_FIND_UNVERSIONED_NAMES`` variable can be set to one of the
+ following values:
+
+ * ``FIRST``: The generic names are searched before the more specialized ones
+ (such as ``python2.5`` for example).
+ * ``LAST``: The generic names are searched after the more specialized ones.
+ This is the default.
+ * ``NEVER``: The generic name are not searched at all.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
+.. versionadded:: 3.16
+
To solve special cases, it is possible to specify directly the artifacts by
setting the following variables:
@@ -331,6 +412,8 @@ setting the following variables:
The path to the compiler.
``Python_DOTNET_LAUNCHER``
+ .. versionadded:: 3.18
+
The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
``Python_LIBRARY``
@@ -367,6 +450,8 @@ specification. So, to enable also interactive specification, module behavior
can be controlled with the following variable:
``Python_ARTIFACTS_INTERACTIVE``
+ .. versionadded:: 3.18
+
Selects the behavior of the module. This is a boolean variable:
* If set to ``TRUE``: Create CMake cache entries for the above artifact
@@ -389,8 +474,9 @@ Python module naming rules::
If the library type is not specified, ``MODULE`` is assumed.
-For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the
-module suffix will include the ``Python_SOABI`` value, if any.
+.. versionadded:: 3.17
+ For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the
+ module suffix will include the ``Python_SOABI`` value, if any.
#]=======================================================================]
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 8b2d739486..8e70e111b7 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -337,6 +337,9 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES)
foreach (implementation IN LISTS _PGN_IMPLEMENTATIONS)
if (implementation STREQUAL "CPython")
+ if (_PGN_INTERPRETER AND _${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES STREQUAL "FIRST")
+ list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python)
+ endif()
foreach (version IN LISTS _PGN_VERSION)
if (_PGN_WIN32)
string (REPLACE "." "" version_no_dots ${version})
@@ -386,7 +389,7 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES)
endif()
endif()
endforeach()
- if (_PGN_INTERPRETER)
+ if (_PGN_INTERPRETER AND _${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES STREQUAL "LAST")
list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python)
endif()
elseif (implementation STREQUAL "IronPython")
@@ -1372,9 +1375,22 @@ else()
endif()
+# Python naming handling
+if (DEFINED ${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES)
+ if (NOT ${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES MATCHES "^(FIRST|LAST|NEVER)$")
+ message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES}: invalid value for '${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES'. 'FIRST', 'LAST' or 'NEVER' expected. 'LAST' will be used instead.")
+ set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES LAST)
+ else()
+ set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES ${${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES})
+ endif()
+else()
+ set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES LAST)
+endif()
+
+
# Compute search signature
# This signature will be used to check validity of cached variables on new search
-set (_${_PYTHON_PREFIX}_SIGNATURE "${${_PYTHON_PREFIX}_ROOT_DIR}:${_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS}:${_${_PYTHON_PREFIX}_FIND_STRATEGY}:${${_PYTHON_PREFIX}_FIND_VIRTUALENV}")
+set (_${_PYTHON_PREFIX}_SIGNATURE "${${_PYTHON_PREFIX}_ROOT_DIR}:${_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS}:${_${_PYTHON_PREFIX}_FIND_STRATEGY}:${${_PYTHON_PREFIX}_FIND_VIRTUALENV}${_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES}")
if (NOT WIN32)
string (APPEND _${_PYTHON_PREFIX}_SIGNATURE ":${${_PYTHON_PREFIX}_USE_STATIC_LIBS}:")
endif()
@@ -3005,8 +3021,9 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
unset(_${_PYTHON_PREFIX}_is_prefix)
foreach (_${_PYTHON_PREFIX}_implementation IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
foreach (_${_PYTHON_PREFIX}_framework IN LISTS _${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_implementation}_FRAMEWORKS)
- if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "^${_${_PYTHON_PREFIX}_framework}")
- get_filename_component (_${_PYTHON_PREFIX}_framework "${_${_PYTHON_PREFIX}_framework}" DIRECTORY)
+ cmake_path (IS_PREFIX _${_PYTHON_PREFIX}_framework "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}" _${_PYTHON_PREFIX}_is_prefix)
+ if (_${_PYTHON_PREFIX}_is_prefix)
+ cmake_path (GET _${_PYTHON_PREFIX}_framework PARENT_PATH _${_PYTHON_PREFIX}_framework)
set (${_PYTHON_PREFIX}_LINK_OPTIONS "LINKER:-rpath,${_${_PYTHON_PREFIX}_framework}")
break()
endif()
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index 9cd22e174a..bb965b9d3c 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -10,25 +10,32 @@ FindPython2
Find Python 2 interpreter, compiler and development environment (include
directories and libraries).
-When a version is requested, it can be specified as a simple value or as a
-range. For a detailed description of version range usage and capabilities,
-refer to the :command:`find_package` command.
+.. versionadded:: 3.19
+ When a version is requested, it can be specified as a simple value or as a
+ range. For a detailed description of version range usage and capabilities,
+ refer to the :command:`find_package` command.
The following components are supported:
* ``Interpreter``: search for Python 2 interpreter
* ``Compiler``: search for Python 2 compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
- libraries). This component includes two sub-components which can be specified
- independently:
+ libraries).
- * ``Development.Module``: search for artifacts for Python 2 module
- developments.
- * ``Development.Embed``: search for artifacts for Python 2 embedding
- developments.
+ .. versionadded:: 3.18
+ This component includes two sub-components which can be specified
+ independently:
+
+ * ``Development.Module``: search for artifacts for Python 2 module
+ developments.
+ * ``Development.Embed``: search for artifacts for Python 2 embedding
+ developments.
* ``NumPy``: search for NumPy include directories.
+.. versionadded:: 3.14
+ Added the ``NumPy`` component.
+
If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed.
If component ``Development`` is specified, it implies sub-components
@@ -57,20 +64,29 @@ for you.
Imported Targets
^^^^^^^^^^^^^^^^
-This module defines the following :ref:`Imported Targets <Imported Targets>`
-(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
+This module defines the following :ref:`Imported Targets <Imported Targets>`:
+
+.. versionchanged:: 3.14
+ :ref:`Imported Targets <Imported Targets>` are only created when
+ :prop_gbl:`CMAKE_ROLE` is ``PROJECT``.
``Python2::Interpreter``
Python 2 interpreter. Target defined if component ``Interpreter`` is found.
``Python2::Compiler``
Python 2 compiler. Target defined if component ``Compiler`` is found.
``Python2::Module``
+ .. versionadded:: 3.15
+
Python 2 library for Python module. Target defined if component
``Development.Module`` is found.
+
``Python2::Python``
Python 2 library for Python embedding. Target defined if component
``Development.Embed`` is found.
+
``Python2::NumPy``
+ .. versionadded:: 3.14
+
NumPy library for Python 2. Target defined if component ``NumPy`` is found.
Result Variables
@@ -124,19 +140,34 @@ This module will set the following variables in your project
``Python2_COMPILER_ID``
A short string unique to the compiler. Possible values include:
* IronPython
+
``Python2_DOTNET_LAUNCHER``
+ .. versionadded:: 3.18
+
The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
+
``Python2_Development_FOUND``
System has the Python 2 development artifacts.
+
``Python2_Development.Module_FOUND``
+ .. versionadded:: 3.18
+
System has the Python 2 development artifacts for Python module.
+
``Python2_Development.Embed_FOUND``
+ .. versionadded:: 3.18
+
System has the Python 2 development artifacts for Python embedding.
+
``Python2_INCLUDE_DIRS``
The Python 2 include directories.
+
``Python2_LINK_OPTIONS``
+ .. versionadded:: 3.19
+
The Python 2 link options. Some configurations require specific link options
for a correct build and execution.
+
``Python2_LIBRARIES``
The Python 2 libraries.
``Python2_LIBRARY_DIRS``
@@ -151,13 +182,25 @@ This module will set the following variables in your project
Python 2 minor version.
``Python2_VERSION_PATCH``
Python 2 patch version.
+
``Python2_PyPy_VERSION``
+ .. versionadded:: 3.18
+
Python 2 PyPy version.
+
``Python2_NumPy_FOUND``
+ .. versionadded:: 3.14
+
System has the NumPy.
+
``Python2_NumPy_INCLUDE_DIRS``
+ .. versionadded:: 3.14
+
The NumPy include directories.
+
``Python2_NumPy_VERSION``
+ .. versionadded:: 3.14
+
The NumPy version.
Hints
@@ -173,6 +216,8 @@ Hints
* If set to FALSE, search **only** for shared libraries.
``Python2_FIND_STRATEGY``
+ .. versionadded:: 3.15
+
This variable defines how lookup will be done.
The ``Python2_FIND_STRATEGY`` variable can be set to one of the following:
@@ -185,6 +230,8 @@ Hints
This is the default if policy :policy:`CMP0094` is set to ``NEW``.
``Python2_FIND_REGISTRY``
+ .. versionadded:: 3.13
+
On Windows the ``Python2_FIND_REGISTRY`` variable determine the order
of preference between registry and environment variables.
the ``Python2_FIND_REGISTRY`` variable can be set to one of the following:
@@ -195,6 +242,8 @@ Hints
* ``NEVER``: Never try to use registry.
``Python2_FIND_FRAMEWORK``
+ .. versionadded:: 3.15
+
On macOS the ``Python2_FIND_FRAMEWORK`` variable determine the order of
preference between Apple-style and unix-style package components.
This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK`
@@ -208,6 +257,8 @@ Hints
variable will be used, if any.
``Python2_FIND_VIRTUALENV``
+ .. versionadded:: 3.15
+
This variable defines the handling of virtual environments managed by
``virtualenv`` or ``conda``. It is meaningful only when a virtual environment
is active (i.e. the ``activate`` script has been evaluated). In this case, it
@@ -226,6 +277,9 @@ Hints
``NEVER`` to select preferably the interpreter from the virtual
environment.
+ .. versionadded:: 3.17
+ Added support for ``conda`` environments.
+
.. note::
If the component ``Development`` is requested, it is **strongly**
@@ -233,6 +287,8 @@ Hints
result.
``Python2_FIND_IMPLEMENTATIONS``
+ .. versionadded:: 3.18
+
This variable defines, in an ordered list, the different implementations
which will be searched. The ``Python2_FIND_IMPLEMENTATIONS`` variable can
hold the following values:
@@ -265,9 +321,26 @@ Hints
``.Net`` interpreter (i.e. ``mono`` command) is expected to be available
through the ``PATH`` variable.
+``Python2_FIND_UNVERSIONED_NAMES``
+ .. versionadded:: 3.20
+
+ This variable defines how the generic names will be searched. Currently, it
+ only applies to the generic names of the interpreter, namely, ``python2`` and
+ ``python``.
+ The ``Python2_FIND_UNVERSIONED_NAMES`` variable can be set to one of the
+ following values:
+
+ * ``FIRST``: The generic names are searched before the more specialized ones
+ (such as ``python2.5`` for example).
+ * ``LAST``: The generic names are searched after the more specialized ones.
+ This is the default.
+ * ``NEVER``: The generic name are not searched at all.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
+.. versionadded:: 3.16
+
To solve special cases, it is possible to specify directly the artifacts by
setting the following variables:
@@ -278,6 +351,8 @@ setting the following variables:
The path to the compiler.
``Python2_DOTNET_LAUNCHER``
+ .. versionadded:: 3.18
+
The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
``Python2_LIBRARY``
@@ -314,6 +389,8 @@ specification. So, to enable also interactive specification, module behavior
can be controlled with the following variable:
``Python2_ARTIFACTS_INTERACTIVE``
+ .. versionadded:: 3.18
+
Selects the behavior of the module. This is a boolean variable:
* If set to ``TRUE``: Create CMake cache entries for the above artifact
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index c79d482dd7..f826fcfe29 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -10,25 +10,32 @@ FindPython3
Find Python 3 interpreter, compiler and development environment (include
directories and libraries).
-When a version is requested, it can be specified as a simple value or as a
-range. For a detailed description of version range usage and capabilities,
-refer to the :command:`find_package` command.
+.. versionadded:: 3.19
+ When a version is requested, it can be specified as a simple value or as a
+ range. For a detailed description of version range usage and capabilities,
+ refer to the :command:`find_package` command.
The following components are supported:
* ``Interpreter``: search for Python 3 interpreter
* ``Compiler``: search for Python 3 compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
- libraries). This component includes two sub-components which can be specified
- independently:
+ libraries).
- * ``Development.Module``: search for artifacts for Python 3 module
- developments.
- * ``Development.Embed``: search for artifacts for Python 3 embedding
- developments.
+ .. versionadded:: 3.18
+ This component includes two sub-components which can be specified
+ independently:
+
+ * ``Development.Module``: search for artifacts for Python 3 module
+ developments.
+ * ``Development.Embed``: search for artifacts for Python 3 embedding
+ developments.
* ``NumPy``: search for NumPy include directories.
+.. versionadded:: 3.14
+ Added the ``NumPy`` component.
+
If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed.
If component ``Development`` is specified, it implies sub-components
@@ -57,20 +64,30 @@ for you.
Imported Targets
^^^^^^^^^^^^^^^^
-This module defines the following :ref:`Imported Targets <Imported Targets>`
-(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
+This module defines the following :ref:`Imported Targets <Imported Targets>`:
+
+.. versionchanged:: 3.14
+ :ref:`Imported Targets <Imported Targets>` are only created when
+ :prop_gbl:`CMAKE_ROLE` is ``PROJECT``.
``Python3::Interpreter``
Python 3 interpreter. Target defined if component ``Interpreter`` is found.
``Python3::Compiler``
Python 3 compiler. Target defined if component ``Compiler`` is found.
+
``Python3::Module``
+ .. versionadded:: 3.15
+
Python 3 library for Python module. Target defined if component
``Development.Module`` is found.
+
``Python3::Python``
Python 3 library for Python embedding. Target defined if component
``Development.Embed`` is found.
+
``Python3::NumPy``
+ .. versionadded:: 3.14
+
NumPy library for Python 3. Target defined if component ``NumPy`` is found.
Result Variables
@@ -117,7 +134,10 @@ This module will set the following variables in your project
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``
or else ``sysconfig.get_path('platlib')``.
+
``Python3_SOABI``
+ .. versionadded:: 3.17
+
Extension suffix for modules.
Information returned by
@@ -126,6 +146,7 @@ This module will set the following variables in your project
``python3-config --extension-suffix``. If package ``distutils.sysconfig`` is
not available, ``sysconfig.get_config_var('SOABI')`` or
``sysconfig.get_config_var('EXT_SUFFIX')`` are used.
+
``Python3_Compiler_FOUND``
System has the Python 3 compiler.
``Python3_COMPILER``
@@ -133,19 +154,36 @@ This module will set the following variables in your project
``Python3_COMPILER_ID``
A short string unique to the compiler. Possible values include:
* IronPython
+
``Python3_DOTNET_LAUNCHER``
+ .. versionadded:: 3.18
+
The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
+
``Python3_Development_FOUND``
+
System has the Python 3 development artifacts.
+
``Python3_Development.Module_FOUND``
+ .. versionadded:: 3.18
+
System has the Python 3 development artifacts for Python module.
+
``Python3_Development.Embed_FOUND``
+ .. versionadded:: 3.18
+
System has the Python 3 development artifacts for Python embedding.
+
``Python3_INCLUDE_DIRS``
+
The Python 3 include directories.
+
``Python3_LINK_OPTIONS``
+ .. versionadded:: 3.19
+
The Python 3 link options. Some configurations require specific link options
for a correct build and execution.
+
``Python3_LIBRARIES``
The Python 3 libraries.
``Python3_LIBRARY_DIRS``
@@ -160,13 +198,25 @@ This module will set the following variables in your project
Python 3 minor version.
``Python3_VERSION_PATCH``
Python 3 patch version.
+
``Python3_PyPy_VERSION``
+ .. versionadded:: 3.18
+
Python 3 PyPy version.
+
``Python3_NumPy_FOUND``
+ .. versionadded:: 3.14
+
System has the NumPy.
+
``Python3_NumPy_INCLUDE_DIRS``
+ .. versionadded:: 3.14
+
The NumPy include directories.
+
``Python3_NumPy_VERSION``
+ .. versionadded:: 3.14
+
The NumPy version.
Hints
@@ -182,6 +232,8 @@ Hints
* If set to FALSE, search **only** for shared libraries.
``Python3_FIND_ABI``
+ .. versionadded:: 3.16
+
This variable defines which ABIs, as defined in
`PEP 3149 <https://www.python.org/dev/peps/pep-3149/>`_, should be searched.
@@ -223,6 +275,8 @@ Hints
each flag is ``OFF`` or ``ANY``.
``Python3_FIND_STRATEGY``
+ .. versionadded:: 3.15
+
This variable defines how lookup will be done.
The ``Python3_FIND_STRATEGY`` variable can be set to one of the following:
@@ -235,6 +289,8 @@ Hints
This is the default if policy :policy:`CMP0094` is set to ``NEW``.
``Python3_FIND_REGISTRY``
+ .. versionadded:: 3.13
+
On Windows the ``Python3_FIND_REGISTRY`` variable determine the order
of preference between registry and environment variables.
The ``Python3_FIND_REGISTRY`` variable can be set to one of the following:
@@ -245,6 +301,8 @@ Hints
* ``NEVER``: Never try to use registry.
``Python3_FIND_FRAMEWORK``
+ .. versionadded:: 3.15
+
On macOS the ``Python3_FIND_FRAMEWORK`` variable determine the order of
preference between Apple-style and unix-style package components.
This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK`
@@ -258,6 +316,8 @@ Hints
variable will be used, if any.
``Python3_FIND_VIRTUALENV``
+ .. versionadded:: 3.15
+
This variable defines the handling of virtual environments managed by
``virtualenv`` or ``conda``. It is meaningful only when a virtual environment
is active (i.e. the ``activate`` script has been evaluated). In this case, it
@@ -276,6 +336,9 @@ Hints
``NEVER`` to select preferably the interpreter from the virtual
environment.
+ .. versionadded:: 3.17
+ Added support for ``conda`` environments.
+
.. note::
If the component ``Development`` is requested, it is **strongly**
@@ -283,6 +346,8 @@ Hints
result.
``Python3_FIND_IMPLEMENTATIONS``
+ .. versionadded:: 3.18
+
This variable defines, in an ordered list, the different implementations
which will be searched. The ``Python3_FIND_IMPLEMENTATIONS`` variable can
hold the following values:
@@ -315,9 +380,26 @@ Hints
``.Net`` interpreter (i.e. ``mono`` command) is expected to be available
through the ``PATH`` variable.
+``Python3_FIND_UNVERSIONED_NAMES``
+ .. versionadded:: 3.20
+
+ This variable defines how the generic names will be searched. Currently, it
+ only applies to the generic names of the interpreter, namely, ``python3`` and
+ ``python``.
+ The ``Python3_FIND_UNVERSIONED_NAMES`` variable can be set to one of the
+ following values:
+
+ * ``FIRST``: The generic names are searched before the more specialized ones
+ (such as ``python3.5`` for example).
+ * ``LAST``: The generic names are searched after the more specialized ones.
+ This is the default.
+ * ``NEVER``: The generic name are not searched at all.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
+.. versionadded:: 3.16
+
To solve special cases, it is possible to specify directly the artifacts by
setting the following variables:
@@ -328,6 +410,8 @@ setting the following variables:
The path to the compiler.
``Python3_DOTNET_LAUNCHER``
+ .. versionadded:: 3.18
+
The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
``Python3_LIBRARY``
@@ -364,6 +448,8 @@ specification. So, to enable also interactive specification, module behavior
can be controlled with the following variable:
``Python3_ARTIFACTS_INTERACTIVE``
+ .. versionadded:: 3.18
+
Selects the behavior of the module. This is a boolean variable:
* If set to ``TRUE``: Create CMake cache entries for the above artifact
@@ -386,8 +472,9 @@ of Python module naming rules::
If the library type is not specified, ``MODULE`` is assumed.
-For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the
-module suffix will include the ``Python3_SOABI`` value, if any.
+.. versionadded:: 3.17
+ For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the
+ module suffix will include the ``Python3_SOABI`` value, if any.
#]=======================================================================]
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake
index d6a06628e6..44a1f414c5 100644
--- a/Modules/FindQt.cmake
+++ b/Modules/FindQt.cmake
@@ -5,14 +5,14 @@
FindQt
------
+.. deprecated:: 3.14
+ This module is available only if policy :policy:`CMP0084` is not set to ``NEW``.
+
Searches for all installed versions of Qt3 or Qt4.
This module cannot handle Qt5 or any later versions.
For those, see :manual:`cmake-qt(7)`.
-This module exists for the :command:`find_package` command only if
-policy :policy:`CMP0084` is not set to ``NEW``.
-
This module should only be used if your project can work with multiple
versions of Qt. If not, you should just directly use FindQt4 or
FindQt3. If multiple versions of Qt are found on the machine, then
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index b5bc8b1cfa..da82e59292 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -56,7 +56,9 @@ file(GLOB GLOB_PATHS /usr/lib/qt-3*)
foreach(GLOB_PATH ${GLOB_PATHS})
list(APPEND GLOB_PATHS_BIN "${GLOB_PATH}/bin")
endforeach()
-find_path(QT_INCLUDE_DIR qt.h
+find_path(QT_INCLUDE_DIR
+ NAMES qt.h
+ PATHS
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
@@ -179,7 +181,8 @@ if(QT_UIC_EXECUTABLE)
endif()
if (WIN32)
- find_library(QT_QTMAIN_LIBRARY qtmain
+ find_library(QT_QTMAIN_LIBRARY
+ NAMES qtmain
HINTS
ENV QTDIR
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]"
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index d12f8255d5..ee07f83451 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -37,7 +37,8 @@ This module will set the following variables in your project:
``Ruby_INCLUDE_DIRS``
include dirs to be used when using the ruby library
``Ruby_LIBRARIES``
- libraries needed to use ruby from C.
+ .. versionadded:: 3.18
+ libraries needed to use ruby from C.
``Ruby_VERSION``
the version of ruby which was found, e.g. "1.8.7"
``Ruby_VERSION_MAJOR``
@@ -47,9 +48,10 @@ This module will set the following variables in your project:
``Ruby_VERSION_PATCH``
Ruby patch version.
-
-The following variables are also provided for compatibility reasons,
-don't use them in new code:
+.. versionchanged:: 3.18
+ Previous versions of CMake used the ``RUBY_`` prefix for all variables.
+ The following variables are provided for compatibility reasons,
+ don't use them in new code:
``RUBY_EXECUTABLE``
same as Ruby_EXECUTABLE.
@@ -67,6 +69,8 @@ don't use them in new code:
Hints
^^^^^
+.. versionadded:: 3.18
+
``Ruby_ROOT_DIR``
Define the root directory of a Ruby installation.
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index 59eddbbc99..c68e18d96a 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -11,6 +11,8 @@ Locate the SDL library
Imported targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.19
+
This module defines the following :prop_tgt:`IMPORTED` target:
``SDL::SDL``
@@ -36,6 +38,10 @@ This module will set the following variables in your project:
``SDL_VERSION_PATCH``
SDL patch version
+.. versionadded:: 3.19
+ Added the ``SDL_INCLUDE_DIRS``, ``SDL_LIBRARIES`` and ``SDL_VERSION[_<PART>]``
+ variables.
+
Cache variables
^^^^^^^^^^^^^^^
@@ -63,6 +69,8 @@ This module responds to the flag:
Obsolete variables
^^^^^^^^^^^^^^^^^^
+.. deprecated:: 3.19
+
These variables are obsolete and provided for backwards compatibility:
``SDL_VERSION_STRING``
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake
index 87a3894634..4c7ad89dca 100644
--- a/Modules/FindSWIG.cmake
+++ b/Modules/FindSWIG.cmake
@@ -7,14 +7,17 @@ FindSWIG
Find the Simplified Wrapper and Interface Generator (SWIG_) executable.
-This module finds an installed SWIG and determines its version. If a
-``COMPONENTS`` or ``OPTIONAL_COMPONENTS`` argument is given to the
-:command:`find_package` command, it will also determine supported target
-languages.
-
-When a version is requested, it can be specified as a simple value or as a
-range. For a detailed description of version range usage and capabilities,
-refer to the :command:`find_package` command.
+This module finds an installed SWIG and determines its version.
+
+.. versionadded:: 3.18
+ If a ``COMPONENTS`` or ``OPTIONAL_COMPONENTS`` argument is given to the
+ :command:`find_package` command, it will also determine supported target
+ languages.
+
+.. versionadded:: 3.19
+ When a version is requested, it can be specified as a simple value or as a
+ range. For a detailed description of version range usage and capabilities,
+ refer to the :command:`find_package` command.
The module defines the following variables:
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index 91d1410086..9a17fdbafa 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -47,7 +47,8 @@ to cmake using Squish >= 4.x:
AUT targetName SUITE suiteName TEST squishTestName
[SETTINGSGROUP group] [PRE_COMMAND command] [POST_COMMAND command] )
-
+.. versionchanged:: 3.18
+ In previous CMake versions, this function was named ``squish_v4_add_test``.
The arguments have the following meaning:
diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake
index 07cb770cf3..7a9c440f67 100644
--- a/Modules/FindSubversion.cmake
+++ b/Modules/FindSubversion.cmake
@@ -31,9 +31,12 @@ If the command line client executable is found two macros are defined:
``Subversion_WC_INFO`` extracts information of a subversion working copy at a
given location. This macro defines the following variables if running
Subversion's ``info`` command on ``<dir>`` succeeds; otherwise a
-``SEND_ERROR`` message is generated. The error can be ignored by providing the
-``IGNORE_SVN_FAILURE`` option, which causes these variables to remain
-undefined.
+``SEND_ERROR`` message is generated.
+
+.. versionadded:: 3.13
+ The error can be ignored by providing the
+ ``IGNORE_SVN_FAILURE`` option, which causes these variables to remain
+ undefined.
::
diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
index 3b74c94f0c..ed2657c4ab 100644
--- a/Modules/FindTIFF.cmake
+++ b/Modules/FindTIFF.cmake
@@ -17,12 +17,16 @@ imported target, as described below.
Imported targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.5
+
This module defines the following :prop_tgt:`IMPORTED` targets:
``TIFF::TIFF``
The TIFF library, if found.
``TIFF::CXX``
+ .. versionadded:: 3.19
+
The C++ wrapper libtiffxx, if requested by the `COMPONENTS CXX` option,
if the compiler is not MSVC (which includes the C++ wrapper in libtiff),
and if found.
@@ -56,6 +60,9 @@ The following cache variables may also be set:
the path to the TIFFXX library for release configurations
``TIFFXX_LIBRARY_DEBUG``
the path to the TIFFXX library for debug configurations
+
+.. versionadded:: 3.4
+ Debug and Release variants are found separately.
#]=======================================================================]
cmake_policy(PUSH)
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index e3e6591a36..87e88bc318 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -10,6 +10,8 @@ This module determines the thread library of the system.
Imported Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.1
+
This module defines the following :prop_tgt:`IMPORTED` target:
``Threads::Threads``
@@ -38,6 +40,8 @@ Variables Affecting Behavior
.. variable:: THREADS_PREFER_PTHREAD_FLAG
+ .. versionadded:: 3.1
+
If the use of the -pthread compiler and linker flag is preferred then
the caller can set this variable to TRUE. The compiler flag can only be
used with the imported target. Use of both the imported target as well
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake
index 0ec60133ce..ceb1921e9e 100644
--- a/Modules/FindVulkan.cmake
+++ b/Modules/FindVulkan.cmake
@@ -16,8 +16,9 @@ IMPORTED Targets
This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if
Vulkan has been found.
-This module defines :prop_tgt:`IMPORTED` target ``Vulkan::glslc``, if
-Vulkan and the GLSLC SPIR-V compiler has been found.
+.. versionadded:: 3.19
+ This module defines :prop_tgt:`IMPORTED` target ``Vulkan::glslc``, if
+ Vulkan and the GLSLC SPIR-V compiler has been found.
Result Variables
^^^^^^^^^^^^^^^^
@@ -37,6 +38,8 @@ The module will also define three cache variables::
Hints
^^^^^
+.. versionadded:: 3.18
+
The ``VULKAN_SDK`` environment variable optionally specifies the
location of the Vulkan SDK root directory for the given
architecture. It is typically set by sourcing the toplevel
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index a865597afa..d480fc4803 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -17,6 +17,9 @@ Try to find X11 on UNIX systems. The following values are defined
and also the following more fine grained variables and targets:
+.. versionadded:: 3.14
+ Imported targets.
+
::
X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND, X11::ICE
@@ -62,6 +65,23 @@ and also the following more fine grained variables and targets:
X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND
X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND
X11_Xaw_INCLUDE_PATH, X11_Xaw_LIB X11_Xaw_FOUND X11::Xaw
+
+.. versionadded:: 3.14
+ Renamed ``Xxf86misc``, ``X11_Xxf86misc``, ``X11_Xxf86vm``, ``X11_xkbfile``,
+ ``X11_Xtst``, and ``X11_Xss`` libraries to match their file names.
+ Deprecated the ``X11_Xinput`` library. Old names are still available
+ for compatibility.
+
+.. versionadded:: 3.14
+ Added the ``X11_Xext_INCLUDE_PATH`` variable.
+
+.. versionadded:: 3.18
+ Added the ``xcb``, ``X11-xcb``, ``xcb-icccm``, ``xcb-xkb``, ``xkbcommon``,
+ and ``xkbcommon-X11`` libraries.
+
+.. versionadded:: 3.19
+ Added the ``Xaw``, ``xcb_util``, and ``xcb_xfixes`` libraries.
+
#]=======================================================================]
if (UNIX)
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake
index abe18c0570..af1b0b438f 100644
--- a/Modules/FindXercesC.cmake
+++ b/Modules/FindXercesC.cmake
@@ -12,6 +12,8 @@ Find the Apache Xerces-C++ validating XML parser headers and libraries.
Imported targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.5
+
This module defines the following :prop_tgt:`IMPORTED` targets:
``XercesC::XercesC``
@@ -40,6 +42,9 @@ The following cache variables may also be set:
the directory containing the Xerces headers
``XercesC_LIBRARY``
the Xerces library
+
+.. versionadded:: 3.4
+ Debug and Release variants are found separately.
#]=======================================================================]
# Written by Roger Leigh <rleigh@codelibre.net>
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 79e2313d5a..5778b031b3 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -10,6 +10,8 @@ Find the native ZLIB includes and library.
IMPORTED Targets
^^^^^^^^^^^^^^^^
+.. versionadded:: 3.1
+
This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if
ZLIB has been found.
@@ -32,6 +34,9 @@ This module defines the following variables:
ZLIB_VERSION_PATCH - The patch version of zlib
ZLIB_VERSION_TWEAK - The tweak version of zlib
+.. versionadded:: 3.4
+ Debug and Release variants are found separately.
+
Backward Compatibility
^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index eab09f157a..63af9b68de 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -14,6 +14,12 @@ package:
find_package(wxWidgets COMPONENTS core base ... OPTIONAL_COMPONENTS net ...)
+.. versionadded:: 3.4
+ Support for :command:`find_package` version argument; ``webview`` component.
+
+.. versionadded:: 3.14
+ ``OPTIONAL_COMPONENTS`` support.
+
There are two search branches: a windows style and a unix style. For
windows, the following variables are searched for and set to defaults
in case of multiple choices. Change them if the defaults are not
@@ -82,6 +88,9 @@ and unix style:
"`wx-config --cxxflags`".
wxWidgets_USE_FILE - Convenience include file.
+.. versionadded:: 3.11
+ The following environment variables can be used as hints: ``WX_CONFIG``,
+ ``WXRC_CMD``.
Sample usage:
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index 547346ba90..733c7232c7 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -343,6 +343,13 @@ function(FortranCInterface_VERIFY)
set(_desc "Verifying Fortran/${lang} Compiler Compatibility")
message(CHECK_START "${_desc}")
+ cmake_policy(GET CMP0056 _FortranCInterface_CMP0056)
+ if(_FortranCInterface_CMP0056 STREQUAL "NEW")
+ set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}")
+ else()
+ set(_FortranCInterface_EXE_LINKER_FLAGS "")
+ endif()
+
# Build a sample project which reports symbols.
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
try_compile(FortranCInterface_VERIFY_${lang}_COMPILED
@@ -358,6 +365,7 @@ function(FortranCInterface_VERIFY)
"-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}"
"-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}"
"-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
+ ${_FortranCInterface_EXE_LINKER_FLAGS}
OUTPUT_VARIABLE _output)
file(WRITE "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" "${_output}")
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index c75067b32e..998faf1ecc 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -26,6 +26,14 @@ unset(FortranCInterface_VERIFIED_CXX CACHE)
set(_result)
+cmake_policy(GET CMP0056 _FortranCInterface_CMP0056)
+if(_FortranCInterface_CMP0056 STREQUAL "NEW")
+ set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}")
+else()
+ set(_FortranCInterface_EXE_LINKER_FLAGS "")
+endif()
+unset(_FortranCInterface_CMP0056)
+
# Build a sample project which reports symbols.
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
try_compile(FortranCInterface_COMPILED
@@ -38,9 +46,11 @@ try_compile(FortranCInterface_COMPILED
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
"-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}"
"-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
+ ${_FortranCInterface_EXE_LINKER_FLAGS}
OUTPUT_VARIABLE FortranCInterface_OUTPUT)
set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED})
unset(FortranCInterface_COMPILED CACHE)
+unset(_FortranCInterface_EXE_LINKER_FLAGS)
# Locate the sample project executable.
set(FortranCInterface_EXE)
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index 13d067a2db..37869fbabd 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -46,7 +46,8 @@ where ``<dir>`` is one of:
``LOCALSTATEDIR``
modifiable single-machine data (``var``)
``RUNSTATEDIR``
- run-time variable data (``LOCALSTATEDIR/run``)
+ .. versionadded:: 3.9
+ run-time variable data (``LOCALSTATEDIR/run``)
``LIBDIR``
object code libraries (``lib`` or ``lib64``
or ``lib/<multiarch-tuple>`` on Debian)
@@ -73,6 +74,8 @@ used and the value will appear in the cache for editing by the user.
Special Cases
^^^^^^^^^^^^^
+.. versionadded:: 3.4
+
The following values of :variable:`CMAKE_INSTALL_PREFIX` are special:
``/``
@@ -113,7 +116,9 @@ Macros
::
- GNUInstallDirs_get_absolute_install_dir(absvar var)
+ GNUInstallDirs_get_absolute_install_dir(absvar var dirname)
+
+ .. versionadded:: 3.7
Set the given variable ``absvar`` to the absolute path contained
within the variable ``var``. This is to allow the computation of an
@@ -121,7 +126,12 @@ Macros
above. While this macro is used to compute the various
``CMAKE_INSTALL_FULL_<dir>`` variables, it is exposed publicly to
allow users who create additional path variables to also compute
- absolute paths where necessary, using the same logic.
+ absolute paths where necessary, using the same logic. ``dirname`` is
+ the directory name to get, e.g. ``BINDIR``.
+
+ .. versionchanged:: 3.20
+ Added the ``<dirname>`` parameter. Previous versions of CMake passed
+ this value through the variable ``${dir}``.
#]=======================================================================]
cmake_policy(PUSH)
@@ -334,13 +344,25 @@ mark_as_advanced(
)
macro(GNUInstallDirs_get_absolute_install_dir absvar var)
+ set(GGAID_extra_args ${ARGN})
+ list(LENGTH GGAID_extra_args GGAID_extra_arg_count)
+ if(GGAID_extra_arg_count GREATER 0)
+ list(GET GGAID_extra_args 0 GGAID_dir)
+ else()
+ # Historical behaviour: use ${dir} from caller's scope
+ set(GGAID_dir "${dir}")
+ message(AUTHOR_WARNING
+ "GNUInstallDirs_get_absolute_install_dir called without third argument. "
+ "Using \${dir} from the caller's scope for compatibility with CMake 3.19 and below.")
+ endif()
+
if(NOT IS_ABSOLUTE "${${var}}")
# Handle special cases:
# - CMAKE_INSTALL_PREFIX == /
# - CMAKE_INSTALL_PREFIX == /usr
# - CMAKE_INSTALL_PREFIX == /opt/...
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/")
- if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR" OR "${dir}" STREQUAL "RUNSTATEDIR")
+ if("${GGAID_dir}" STREQUAL "SYSCONFDIR" OR "${GGAID_dir}" STREQUAL "LOCALSTATEDIR" OR "${GGAID_dir}" STREQUAL "RUNSTATEDIR")
set(${absvar} "/${${var}}")
else()
if (NOT "${${var}}" MATCHES "^usr/")
@@ -349,13 +371,13 @@ macro(GNUInstallDirs_get_absolute_install_dir absvar var)
set(${absvar} "/${${var}}")
endif()
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
- if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR" OR "${dir}" STREQUAL "RUNSTATEDIR")
+ if("${GGAID_dir}" STREQUAL "SYSCONFDIR" OR "${GGAID_dir}" STREQUAL "LOCALSTATEDIR" OR "${GGAID_dir}" STREQUAL "RUNSTATEDIR")
set(${absvar} "/${${var}}")
else()
set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*")
- if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR" OR "${dir}" STREQUAL "RUNSTATEDIR")
+ if("${GGAID_dir}" STREQUAL "SYSCONFDIR" OR "${GGAID_dir}" STREQUAL "LOCALSTATEDIR" OR "${GGAID_dir}" STREQUAL "RUNSTATEDIR")
set(${absvar} "/${${var}}${CMAKE_INSTALL_PREFIX}")
else()
set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
@@ -366,6 +388,10 @@ macro(GNUInstallDirs_get_absolute_install_dir absvar var)
else()
set(${absvar} "${${var}}")
endif()
+
+ unset(GGAID_dir)
+ unset(GGAID_extra_arg_count)
+ unset(GGAID_extra_args)
endmacro()
# Result directories
@@ -388,7 +414,7 @@ foreach(dir
MANDIR
DOCDIR
)
- GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir})
+ GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir} ${dir})
endforeach()
cmake_policy(POP)
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index e4481f66d1..a9a9c59354 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -9,6 +9,9 @@ Function for generation of export macros for libraries
This module provides the function ``GENERATE_EXPORT_HEADER()``.
+.. versionadded:: 3.12
+ Added support for C projects. Previous versions supported C++ project only.
+
The ``GENERATE_EXPORT_HEADER`` function can be used to generate a file
suitable for preprocessor inclusion which contains EXPORT macros to be
used in library classes::
@@ -27,7 +30,6 @@ used in library classes::
[CUSTOM_CONTENT_FROM_VARIABLE <variable>]
)
-
The target properties :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>`
and :prop_tgt:`VISIBILITY_INLINES_HIDDEN` can be used to add the appropriate
compile flags for targets. See the documentation of those target properties,
@@ -170,20 +172,30 @@ For example:
Generates the macros ``VTK_SOMELIB_EXPORT`` etc.
+.. versionadded:: 3.1
+ Library target can be an ``OBJECT`` library.
+
+.. versionadded:: 3.7
+ Added the ``CUSTOM_CONTENT_FROM_VARIABLE`` option.
+
+.. versionadded:: 3.11
+ Added the ``INCLUDE_GUARD_NAME`` option.
+
::
ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] )
+.. deprecated:: 3.0
+ Set the target properties
+ :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` and
+ :prop_tgt:`VISIBILITY_INLINES_HIDDEN` instead.
+
The ``ADD_COMPILER_EXPORT_FLAGS`` function adds ``-fvisibility=hidden`` to
:variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` if supported, and is a no-op
on Windows which does not need extra compiler flags for exporting support.
You may optionally pass a single argument to ``ADD_COMPILER_EXPORT_FLAGS``
that will be populated with the ``CXX_FLAGS`` required to enable visibility
support for the compiler/architecture in use.
-
-This function is deprecated. Set the target properties
-:prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` and
-:prop_tgt:`VISIBILITY_INLINES_HIDDEN` instead.
#]=======================================================================]
include(CheckCCompilerFlag)
@@ -209,7 +221,7 @@ macro(_test_compiler_hidden_visibility)
set(GCC_TOO_OLD TRUE)
elseif(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2")
set(GCC_TOO_OLD TRUE)
- elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0")
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0")
set(_INTEL_TOO_OLD TRUE)
endif()
@@ -220,7 +232,7 @@ macro(_test_compiler_hidden_visibility)
AND NOT WIN32
AND NOT CYGWIN
AND NOT CMAKE_CXX_COMPILER_ID MATCHES XL
- AND NOT CMAKE_CXX_COMPILER_ID MATCHES PGI
+ AND NOT CMAKE_CXX_COMPILER_ID MATCHES "^(PGI|NVHPC)$"
AND NOT CMAKE_CXX_COMPILER_ID MATCHES Watcom)
if (CMAKE_CXX_COMPILER_LOADED)
check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
@@ -242,7 +254,7 @@ macro(_test_compiler_has_deprecated)
OR CMAKE_CXX_COMPILER_ID MATCHES Embarcadero
OR CMAKE_CXX_COMPILER_ID MATCHES HP
OR GCC_TOO_OLD
- OR CMAKE_CXX_COMPILER_ID MATCHES PGI
+ OR CMAKE_CXX_COMPILER_ID MATCHES "^(PGI|NVHPC)$"
OR CMAKE_CXX_COMPILER_ID MATCHES Watcom)
set(COMPILER_HAS_DEPRECATED "" CACHE INTERNAL
"Compiler support for a deprecated attribute")
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 2d4765aaab..ed5c38b054 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -25,6 +25,9 @@ files:
ldd (Linux/Unix)
otool (Mac OSX)
+.. versionchanged:: 3.16
+ The tool specified by ``CMAKE_OBJDUMP`` will be used, if set.
+
The following functions are provided by this module:
::
@@ -42,9 +45,6 @@ The following functions are provided by this module:
(projects can override with gp_resolved_file_type_override)
gp_file_type
-Requires CMake 2.6 or greater because it uses function, break, return
-and PARENT_SCOPE.
-
::
GET_PREREQUISITES(<target> <prerequisites_var> <exclude_system> <recurse>
@@ -67,8 +67,9 @@ searched first when a target without any path info is given. Then
standard system locations are also searched: PATH, Framework
locations, /usr/lib...
-The variable GET_PREREQUISITES_VERBOSE can be set to true to enable verbose
-output.
+.. versionadded:: 3.14
+ The variable GET_PREREQUISITES_VERBOSE can be set to true to enable verbose
+ output.
::
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake
index 057b29d6da..2ea9e74250 100644
--- a/Modules/GoogleTest.cmake
+++ b/Modules/GoogleTest.cmake
@@ -101,6 +101,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
with the list of discovered test cases. This allows the caller to do
things like manipulate test properties of the discovered tests.
+ Usage example:
+
.. code-block:: cmake
include(GoogleTest)
@@ -157,6 +159,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
[DISCOVERY_MODE <POST_BUILD|PRE_TEST>]
)
+ .. versionadded:: 3.10
+
``gtest_discover_tests()`` sets up a post-build command on the test executable
that generates the list of tests by parsing the output from running the test
with the ``--gtest_list_tests`` argument. Compared to the source parsing
@@ -223,6 +227,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
Note that this variable is only available in CTest.
``DISCOVERY_TIMEOUT num``
+ .. versionadded:: 3.10.3
+
Specifies how long (in seconds) CMake will wait for the test to enumerate
available tests. If the test takes longer than this, discovery (and your
build) will fail. Most test executables will enumerate their tests very
@@ -241,6 +247,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
and 3.10.2 has not been preserved.
``XML_OUTPUT_DIR dir``
+ .. versionadded:: 3.18
+
If specified, the parameter is passed along with ``--gtest_output=xml:``
to test executable. The actual file name is the same as the test target,
including prefix and suffix. This should be used instead of
@@ -248,6 +256,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
XML result output when using parallel test execution.
``DISCOVERY_MODE``
+ .. versionadded:: 3.18
+
Provides greater control over when ``gtest_discover_tests()`` performs test
discovery. By default, ``POST_BUILD`` sets up a post-build command
to perform test discovery at build time. In certain scenarios, like
diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake
index 883e1f48d0..0f79c9afc0 100644
--- a/Modules/GoogleTestAddTests.cmake
+++ b/Modules/GoogleTestAddTests.cmake
@@ -136,7 +136,7 @@ function(gtest_discover_tests_impl)
${TEST_XML_OUTPUT_PARAM}
${extra_args}
)
- if(suite MATCHES "^DISABLED" OR test MATCHES "^DISABLED")
+ if(suite MATCHES "^DISABLED_" OR test MATCHES "^DISABLED_")
add_command(set_tests_properties
"${testname}"
PROPERTIES DISABLED TRUE
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 29d1ec0e7e..2d08e08457 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -27,14 +27,17 @@ may be set prior to including the module to adjust behavior:
tools even if the release runtime libraries are also available.
``CMAKE_INSTALL_UCRT_LIBRARIES``
+ .. versionadded:: 3.6
+
Set to TRUE to install the Windows Universal CRT libraries for
app-local deployment (e.g. to Windows XP). This is meaningful
only with MSVC from Visual Studio 2015 or higher.
- One may set a ``CMAKE_WINDOWS_KITS_10_DIR`` *environment variable*
- to an absolute path to tell CMake to look for Windows 10 SDKs in
- a custom location. The specified directory is expected to contain
- ``Redist/ucrt/DLLs/*`` directories.
+ .. versionadded:: 3.9
+ One may set a ``CMAKE_WINDOWS_KITS_10_DIR`` *environment variable*
+ to an absolute path to tell CMake to look for Windows 10 SDKs in
+ a custom location. The specified directory is expected to contain
+ ``Redist/ucrt/DLLs/*`` directories.
``CMAKE_INSTALL_MFC_LIBRARIES``
Set to TRUE to install the MSVC MFC runtime libraries.
@@ -53,8 +56,13 @@ may be set prior to including the module to adjust behavior:
not provide the redistributable files.)
``CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT``
+ .. versionadded:: 3.3
+
Specify the :command:`install(PROGRAMS)` command ``COMPONENT``
option. If not specified, no such option will be used.
+
+.. versionadded:: 3.10
+ Support for installing Intel compiler runtimes.
#]=======================================================================]
cmake_policy(PUSH)
@@ -63,7 +71,7 @@ cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
set(_IRSL_HAVE_Intel FALSE)
set(_IRSL_HAVE_MSVC FALSE)
foreach(LANG IN ITEMS C CXX Fortran)
- if("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Intel")
+ if("${CMAKE_${LANG}_COMPILER_ID}" MATCHES "Intel")
if(NOT _IRSL_HAVE_Intel)
get_filename_component(_Intel_basedir "${CMAKE_${LANG}_COMPILER}" PATH)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -93,16 +101,18 @@ endforeach()
if(MSVC)
file(TO_CMAKE_PATH "$ENV{SYSTEMROOT}" SYSTEMROOT)
- if(CMAKE_CL_64)
- if(MSVC_VERSION GREATER 1599)
- # VS 10 and later:
- set(CMAKE_MSVC_ARCH x64)
- else()
+ if(MSVC_C_ARCHITECTURE_ID)
+ string(TOLOWER "${MSVC_C_ARCHITECTURE_ID}" CMAKE_MSVC_ARCH)
+ elseif(MSVC_CXX_ARCHITECTURE_ID)
+ string(TOLOWER "${MSVC_CXX_ARCHITECTURE_ID}" CMAKE_MSVC_ARCH)
+ else()
+ set(CMAKE_MSVC_ARCH x86)
+ endif()
+ if(CMAKE_MSVC_ARCH STREQUAL "x64")
+ if(MSVC_VERSION LESS 1600)
# VS 9 and earlier:
set(CMAKE_MSVC_ARCH amd64)
endif()
- else()
- set(CMAKE_MSVC_ARCH x86)
endif()
get_filename_component(devenv_dir "${CMAKE_MAKE_PROGRAM}" PATH)
@@ -627,10 +637,10 @@ if(_IRSL_HAVE_Intel)
list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
endforeach()
- if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel)
+ if(CMAKE_C_COMPILER_ID MATCHES Intel OR CMAKE_CXX_COMPILER_ID MATCHES Intel)
list(APPEND __install_libs "${_Intel_redistdir}/libgfxoffload.dll")
endif()
- if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
+ if(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
foreach(__Intel_lib IN ITEMS ifdlg100.dll libicaf.dll libifcoremd.dll libifcoremdd.dll libifcorert.dll libifcorertd.dll libifportmd.dll)
list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
@@ -640,12 +650,12 @@ if(_IRSL_HAVE_Intel)
foreach(__Intel_lib IN ITEMS libchkp.dylib libcilkrts.5.dylib libcilkrts.dylib libimf.dylib libintlc.dylib libirc.dylib libirng.dylib libsvml.dylib)
list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
endforeach()
- if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel)
+ if(CMAKE_C_COMPILER_ID MATCHES Intel OR CMAKE_CXX_COMPILER_ID MATCHES Intel)
if(_Intel_compiler_ver VERSION_LESS 17)
list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.dylib")
endif()
endif()
- if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
+ if(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
foreach(__Intel_lib IN ITEMS libifcore.dylib libifcoremt.dylib libifport.dylib libifportmt.dylib)
list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
@@ -662,7 +672,7 @@ if(_IRSL_HAVE_Intel)
list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
endforeach()
endif()
- if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel)
+ if(CMAKE_C_COMPILER_ID MATCHES Intel OR CMAKE_CXX_COMPILER_ID MATCHES Intel)
set(__install_dirs "${_Intel_redistdir}/irml")
list(APPEND __install_libs "${_Intel_redistdir}/cilk_db.so")
if(_Intel_compiler_ver VERSION_GREATER_EQUAL 15)
@@ -681,7 +691,7 @@ if(_IRSL_HAVE_Intel)
list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
endforeach()
endif()
- if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
+ if(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
foreach(__Intel_lib IN ITEMS libicaf.so libifcore.so libifcore.so.5 libifcoremt.so libifcoremt.so.5 libifport.so libifport.so.5)
list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
diff --git a/Modules/Internal/CPack/CPack.NuGet.nuspec.in b/Modules/Internal/CPack/CPack.NuGet.nuspec.in
index b7beb5de0b..d89d69ff08 100644
--- a/Modules/Internal/CPack/CPack.NuGet.nuspec.in
+++ b/Modules/Internal/CPack/CPack.NuGet.nuspec.in
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<!-- Required elements-->
<id>@CPACK_NUGET_PACKAGE_NAME@</id>
@@ -12,11 +12,14 @@
@_CPACK_NUGET_OWNERS_TAG@
@_CPACK_NUGET_PROJECTURL_TAG@
@_CPACK_NUGET_LICENSEURL_TAG@
+ @_CPACK_NUGET_LICENSE_TAG@
@_CPACK_NUGET_ICONURL_TAG@
+ @_CPACK_NUGET_ICON_TAG@
@_CPACK_NUGET_REQUIRELICENSEACCEPTANCE_TAG@
@_CPACK_NUGET_SUMMARY_TAG@
@_CPACK_NUGET_RELEASENOTES_TAG@
@_CPACK_NUGET_COPYRIGHT_TAG@
+ @_CPACK_NUGET_LANGUAGE_TAG@
@_CPACK_NUGET_TAGS_TAG@
@_CPACK_NUGET_DEPENDENCIES_TAG@
</metadata>
diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake
index 431b074c91..2ef0489b66 100644
--- a/Modules/Internal/CPack/CPackDeb.cmake
+++ b/Modules/Internal/CPack/CPackDeb.cmake
@@ -310,10 +310,23 @@ function(cpack_deb_prepare_package_vars)
set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info")
endif()
+ if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS)
+ unset(PRIVATE_SEARCH_DIR_OPTIONS)
+ # Add -l option if the tool supports it
+ if(DEFINED SHLIBDEPS_EXECUTABLE_VERSION AND SHLIBDEPS_EXECUTABLE_VERSION VERSION_GREATER_EQUAL 1.17.0)
+ foreach(dir IN LISTS CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS)
+ list(APPEND PRIVATE_SEARCH_DIR_OPTIONS "-l${dir}")
+ endforeach()
+ else()
+ message(WARNING "CPackDeb: dkpg-shlibdeps is too old. \"CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS\" is therefore ignored.")
+ endif()
+ endif()
+
# Execute dpkg-shlibdeps
# --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package
+ # -l<dir>: make dpkg-shlibdeps also search in this directory for (private) shared library dependencies
# -O : print to STDOUT
- execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}
+ execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} ${PRIVATE_SEARCH_DIR_OPTIONS} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}
WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
OUTPUT_VARIABLE SHLIBDEPS_OUTPUT
RESULT_VARIABLE SHLIBDEPS_RESULT
@@ -325,7 +338,7 @@ function(cpack_deb_prepare_package_vars)
endif()
if(NOT SHLIBDEPS_RESULT EQUAL 0)
message(FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}';\n"
- "executed command: '${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}';\n"
+ "executed command: '${SHLIBDEPS_EXECUTABLE} ${PRIVATE_SEARCH_DIR_OPTIONS} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}';\n"
"found files: '${INSTALL_FILE_}';\n"
"files info: '${CPACK_DEB_INSTALL_FILES}';\n"
"binary files: '${CPACK_DEB_BINARY_FILES}'")
@@ -768,6 +781,10 @@ function(cpack_deb_prepare_package_vars)
set(GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME "${CPACK_DBGSYM_OUTPUT_FILE_NAME}" PARENT_SCOPE)
list(JOIN BUILD_IDS " " BUILD_IDS)
set(GEN_BUILD_IDS "${BUILD_IDS}" PARENT_SCOPE)
+ else()
+ unset(GEN_DBGSYMDIR PARENT_SCOPE)
+ unset(GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME PARENT_SCOPE)
+ unset(GEN_BUILD_IDS PARENT_SCOPE)
endif()
endfunction()
diff --git a/Modules/Internal/CPack/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake
index 20eed2eef8..fb363f4489 100644
--- a/Modules/Internal/CPack/CPackNuGet.cmake
+++ b/Modules/Internal/CPack/CPackNuGet.cmake
@@ -107,21 +107,44 @@ endfunction()
function(_cpack_nuget_variable_fallback_and_wrap_into_element ELEMENT NUGET_VAR_NAME)
set(_options)
set(_one_value_args)
- set(_multi_value_args FALLBACK_VARS)
- cmake_parse_arguments(PARSE_ARGV 0 _args "${_options}" "${_one_value_args}" "${_multi_value_args}")
+ set(_multi_value_args FALLBACK_VARS ATTRIBUTES)
+ cmake_parse_arguments(PARSE_ARGV 2 _args "${_options}" "${_one_value_args}" "${_multi_value_args}")
+
+ if(_args_ATTRIBUTES)
+ list(JOIN _args_ATTRIBUTES " " _attributes)
+ string(PREPEND _attributes " ")
+ endif()
_cpack_nuget_variable_fallback(_value ${NUGET_VAR_NAME} ${ARGN} USE_CDATA)
+ string(TOUPPER "${ELEMENT}" _ELEMENT_UP)
if(_value)
- string(TOUPPER "${ELEMENT}" _ELEMENT_UP)
set(
_CPACK_NUGET_${_ELEMENT_UP}_TAG
- "<${ELEMENT}>${_value}</${ELEMENT}>"
+ "<${ELEMENT}${_attributes}>${_value}</${ELEMENT}>"
+ PARENT_SCOPE
+ )
+ elseif(_attributes)
+ set(
+ _CPACK_NUGET_${_ELEMENT_UP}_TAG
+ "<${ELEMENT}${_attributes} />"
PARENT_SCOPE
)
endif()
endfunction()
+# Warn of obsolete nuspec fields, referencing CMake variables and suggested
+# replacement, if any
+function(_cpack_nuget_deprecation_warning NUGET_ELEMENT VARNAME REPLACEMENT)
+ if(${VARNAME})
+ if(REPLACEMENT)
+ message(DEPRECATION "nuspec element `${NUGET_ELEMENT}` is deprecated in NuGet; consider replacing `${VARNAME}` with `${REPLACEMENT}`")
+ else()
+ message(DEPRECATION "nuspec element `${NUGET_ELEMENT}` is deprecated in NuGet; consider removing `${VARNAME}`")
+ endif()
+ endif()
+endfunction()
+
# Print some debug info
_cpack_nuget_debug("---[CPack NuGet Input Variables]---")
_cpack_nuget_debug_var(CPACK_PACKAGE_NAME)
@@ -168,6 +191,21 @@ function(_cpack_nuget_render_spec)
set(CPACK_NUGET_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
endif()
+ # Warn about deprecated nuspec elements; warnings only display if
+ # variable is set
+ # Note that while nuspec's "summary" element is deprecated, there
+ # is no suggested replacement so (for now) no deprecation warning
+ # is shown for `CPACK_NUGET_*_DESCRIPTION_SUMMARY`
+ _cpack_nuget_deprecation_warning("licenseUrl" CPACK_NUGET_PACKAGE_LICENSEURL
+ "CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME or CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION")
+ _cpack_nuget_deprecation_warning("licenseUrl" CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSEURL
+ "CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSE_FILE_NAME or CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSE_EXPRESSION")
+ _cpack_nuget_deprecation_warning("iconUrl" CPACK_NUGET_PACKAGE_ICONURL
+ "CPACK_NUGET_PACKAGE_ICON")
+ _cpack_nuget_deprecation_warning("iconUrl" CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_ICONURL
+ "CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_ICON")
+
+ # Set nuspec fields
_cpack_nuget_variable_fallback(
CPACK_NUGET_PACKAGE_VERSION VERSION
FALLBACK_VARS
@@ -207,8 +245,35 @@ function(_cpack_nuget_render_spec)
FALLBACK_VARS
CPACK_PACKAGE_HOMEPAGE_URL
)
+
+ # "licenseUrl" is deprecated in favor of "license"
_cpack_nuget_variable_fallback_and_wrap_into_element(licenseUrl LICENSEURL)
+
+ # "iconUrl" is deprecated in favor of "icon"
_cpack_nuget_variable_fallback_and_wrap_into_element(iconUrl ICONURL)
+
+ # "license" takes a "type" attribute of either "file" or "expression"
+ # "file" refers to a file path of a .txt or .md file relative to the installation root
+ # "expression" refers to simple or compound expression of license identifiers
+ # listed at https://spdx.org/licenses/
+ # Note that only one of CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME and
+ # CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION may be specified. If both are specified,
+ # CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME takes precedence and CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION is ignored.
+ if(CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME)
+ _cpack_nuget_variable_fallback_and_wrap_into_element(
+ license LICENSE_FILE_NAME
+ ATTRIBUTES [[type="file"]]
+ )
+ elseif(CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION)
+ _cpack_nuget_variable_fallback_and_wrap_into_element(
+ license LICENSE_EXPRESSION
+ ATTRIBUTES [[type="expression"]]
+ )
+ endif()
+
+ # "icon" refers to a file path relative to the installation root
+ _cpack_nuget_variable_fallback_and_wrap_into_element(icon ICON)
+ # "summary" is deprecated in favor of "description"
_cpack_nuget_variable_fallback_and_wrap_into_element(
summary DESCRIPTION_SUMMARY
FALLBACK_VARS
@@ -222,7 +287,12 @@ function(_cpack_nuget_render_spec)
endif()
_cpack_nuget_variable_fallback_and_wrap_into_element(releaseNotes RELEASE_NOTES)
_cpack_nuget_variable_fallback_and_wrap_into_element(copyright COPYRIGHT)
+ # "language" is a locale identifier such as "en_CA"
+ _cpack_nuget_variable_fallback_and_wrap_into_element(language LANGUAGE)
_cpack_nuget_variable_fallback_and_wrap_into_element(tags TAGS LIST_GLUE " ")
+ # "repository" holds repository metadata consisting of four optional
+ # attributes: "type", "url", "branch", and "commit". While all fields are
+ # considered optional, they are not independent. Currently unsupported.
# Handle dependencies
_cpack_nuget_variable_fallback(_deps DEPENDENCIES)
@@ -262,7 +332,7 @@ endfunction()
function(_cpack_nuget_make_files_tag)
set(_files)
foreach(_comp IN LISTS ARGN)
- string(APPEND _files " <file src=\"${_comp}\\**\" target=\".\" />\n")
+ string(APPEND _files " <file src=\"${_comp}/**\" target=\".\" />\n")
endforeach()
set(_CPACK_NUGET_FILES_TAG "<files>\n${_files} </files>" PARENT_SCOPE)
endfunction()
diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in
index 6009ce0a6e..e6439ad7e0 100644
--- a/Modules/Internal/CPack/NSIS.template.in
+++ b/Modules/Internal/CPack/NSIS.template.in
@@ -1,4 +1,4 @@
-; CPack install script designed for a nmake build
+; CPack install script designed for a nmake build
;--------------------------------
; You must define these values
@@ -42,6 +42,7 @@
@CPACK_NSIS_DEFINES@
@CPACK_NSIS_MANIFEST_DPI_AWARE_CODE@
+@CPACK_NSIS_BRANDING_TEXT_CODE@
!include Sections.nsh
diff --git a/Modules/MacroAddFileDependencies.cmake b/Modules/MacroAddFileDependencies.cmake
index ca60b5702d..8fdc26452d 100644
--- a/Modules/MacroAddFileDependencies.cmake
+++ b/Modules/MacroAddFileDependencies.cmake
@@ -5,26 +5,25 @@
MacroAddFileDependencies
------------------------
-MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...)
+.. deprecated:: 3.14
-Using the macro MACRO_ADD_FILE_DEPENDENCIES() is discouraged. There
-are usually better ways to specify the correct dependencies.
+::
+
+ MACRO_ADD_FILE_DEPENDENCIES(<source> <files>...)
+
+Do not use this command in new code. It is just a wrapper around:
+
+.. code-block:: cmake
+
+ set_property(SOURCE <source> APPEND PROPERTY OBJECT_DEPENDS <files>...)
+
+Instead use the :command:`set_property` command to append to the
+:prop_sf:`OBJECT_DEPENDS` source file property directly.
-MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...) is just a
-convenience wrapper around the OBJECT_DEPENDS source file property.
-You can just use set_property(SOURCE <file> APPEND PROPERTY
-OBJECT_DEPENDS depend_files) instead.
#]=======================================================================]
macro (MACRO_ADD_FILE_DEPENDENCIES _file)
- get_source_file_property(_deps ${_file} OBJECT_DEPENDS)
- if (_deps)
- set(_deps ${_deps} ${ARGN})
- else ()
- set(_deps ${ARGN})
- endif ()
-
- set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}")
+ set_property(SOURCE "${_file}" APPEND PROPERTY OBJECT_DEPENDS "${ARGN}")
endmacro ()
diff --git a/Modules/Platform/Android-Clang.cmake b/Modules/Platform/Android-Clang.cmake
index 160eadae01..3a279cadcb 100644
--- a/Modules/Platform/Android-Clang.cmake
+++ b/Modules/Platform/Android-Clang.cmake
@@ -7,6 +7,23 @@ if(__ANDROID_COMPILER_CLANG)
endif()
set(__ANDROID_COMPILER_CLANG 1)
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Clang.cmake OPTIONAL)
+endif()
+
+# Load flags from NDK. This file may provides the following variables:
+# _ANDROID_NDK_INIT_CFLAGS
+# _ANDROID_NDK_INIT_CFLAGS_DEBUG
+# _ANDROID_NDK_INIT_CFLAGS_RELEASE
+# _ANDROID_NDK_INIT_LDFLAGS
+# _ANDROID_NDK_INIT_LDFLAGS_EXE
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/flags.cmake OPTIONAL
+ RESULT_VARIABLE _INCLUDED_FLAGS)
+endif()
+
# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
# implemented in the CMake VS IDE generators. Avoid interfering with
# that functionality for now. Later we may try to integrate this.
@@ -34,20 +51,29 @@ endif()
include(Platform/Android-Common)
-# The NDK toolchain configuration files at:
-#
-# <ndk>/[build/core/]toolchains/*-clang*/setup.mk
-#
-# contain logic to set LLVM_TRIPLE for Clang-based toolchains for each target.
-# We need to produce the same target here to produce compatible binaries.
-include(Platform/Android/abi-${CMAKE_ANDROID_ARCH_ABI}-Clang)
+if(_INCLUDED_FLAGS)
+ # NDK provides the flags.
+ set(_ANDROID_ABI_INIT_CFLAGS "${_ANDROID_NDK_INIT_CFLAGS}")
+ set(_ANDROID_ABI_INIT_CFLAGS_DEBUG "${_ANDROID_NDK_INIT_CFLAGS_DEBUG}")
+ set(_ANDROID_ABI_INIT_CFLAGS_RELEASE "${_ANDROID_NDK_INIT_CFLAGS_RELEASE}")
+ set(_ANDROID_ABI_INIT_LDFLAGS "${_ANDROID_NDK_INIT_LDFLAGS}")
+ set(_ANDROID_ABI_INIT_EXE_LDFLAGS "${_ANDROID_NDK_INIT_LDFLAGS_EXE}")
+else()
+ # The NDK toolchain configuration files at:
+ #
+ # <ndk>/[build/core/]toolchains/*-clang*/setup.mk
+ #
+ # contain logic to set LLVM_TRIPLE for Clang-based toolchains for each target.
+ # We need to produce the same target here to produce compatible binaries.
+ include(Platform/Android/abi-${CMAKE_ANDROID_ARCH_ABI}-Clang)
+endif()
macro(__android_compiler_clang lang)
if(NOT "x${lang}" STREQUAL "xASM")
__android_compiler_common(${lang})
endif()
if(NOT CMAKE_${lang}_COMPILER_TARGET)
- set(CMAKE_${lang}_COMPILER_TARGET "${_ANDROID_ABI_CLANG_TARGET}")
+ set(CMAKE_${lang}_COMPILER_TARGET "${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}")
if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
string(APPEND CMAKE_${lang}_COMPILER_TARGET "${CMAKE_SYSTEM_VERSION}")
endif()
@@ -57,3 +83,9 @@ macro(__android_compiler_clang lang)
set(_ANDROID_STL_NOSTDLIBXX 1)
endif()
endmacro()
+
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Clang.cmake OPTIONAL)
+endif()
diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake
index 581fde4c6f..39da933003 100644
--- a/Modules/Platform/Android-Common.cmake
+++ b/Modules/Platform/Android-Common.cmake
@@ -53,6 +53,12 @@ if(CMAKE_ANDROID_STL_TYPE)
set(_ANDROID_STL_RTTI 0)
macro(__android_stl lang)
string(APPEND CMAKE_${lang}_FLAGS_INIT " -stdlib=libstdc++")
+ if(_ANDROID_STL_EXCEPTIONS OR _ANDROID_STL_RTTI)
+ string(APPEND CMAKE_${lang}_STANDARD_LIBRARIES " -lc++abi")
+ if(CMAKE_SYSTEM_VERSION LESS 21)
+ list(APPEND CMAKE_${lang}_STANDARD_LIBRARIES "-landroid_support")
+ endif()
+ endif()
endmacro()
elseif(CMAKE_ANDROID_STL_TYPE STREQUAL "c++_static")
set(_ANDROID_STL_EXCEPTIONS 1)
@@ -81,6 +87,12 @@ if(CMAKE_ANDROID_STL_TYPE)
"Android: STL '${CMAKE_ANDROID_STL_TYPE}' not supported by this NDK."
)
endif()
+ if(DEFINED CMAKE_ANDROID_RTTI)
+ set(_ANDROID_STL_RTTI ${CMAKE_ANDROID_RTTI})
+ endif()
+ if(DEFINED CMAKE_ANDROID_EXCEPTIONS)
+ set(_ANDROID_STL_EXCEPTIONS ${CMAKE_ANDROID_EXCEPTIONS})
+ endif()
elseif(CMAKE_ANDROID_NDK)
macro(__android_stl_inc lang dir req)
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake
index bc66ba1dfe..2d2cd5c72b 100644
--- a/Modules/Platform/Android-Determine.cmake
+++ b/Modules/Platform/Android-Determine.cmake
@@ -5,6 +5,12 @@
# This module detects platform-wide information about the Android target
# in order to store it in "CMakeSystem.cmake".
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Determine.cmake OPTIONAL)
+endif()
+
# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
# implemented in the CMake VS IDE generators. Avoid interfering with
# that functionality for now.
@@ -209,9 +215,55 @@ if(CMAKE_ANDROID_NDK)
# NDK >= 18 has abis.cmake. It provides:
# NDK_KNOWN_DEVICE_ABI32S
# NDK_KNOWN_DEVICE_ABI64S
+ # NDK >= 23 also provides:
+ # NDK_KNOWN_DEVICE_ABIS
+ # NDK_ABI_<abi>_PROC
+ # NDK_ABI_<abi>_ARCH
+ # NDK_ABI_<abi>_TRIPLE
+ # NDK_ABI_<abi>_LLVM_TRIPLE
+ # NDK_PROC_<processor>_ABI
+ # NDK_ARCH_<arch>_ABI
include("${CMAKE_ANDROID_NDK}/build/cmake/abis.cmake" OPTIONAL RESULT_VARIABLE _INCLUDED_ABIS)
endif()
+if(CMAKE_ANDROID_NDK AND EXISTS "${CMAKE_ANDROID_NDK}/source.properties")
+ # Android NDK revision
+ # Possible formats:
+ # * r16, build 1234: 16.0.1234
+ # * r16b, build 1234: 16.1.1234
+ # * r16 beta 1, build 1234: 16.0.1234-beta1
+ #
+ # Canary builds are not specially marked.
+ file(READ "${CMAKE_ANDROID_NDK}/source.properties" _ANDROID_NDK_SOURCE_PROPERTIES)
+
+ set(_ANDROID_NDK_REVISION_REGEX
+ "^Pkg\\.Desc = Android NDK\nPkg\\.Revision = ([0-9]+)\\.([0-9]+)\\.([0-9]+)(-beta([0-9]+))?")
+ if(NOT _ANDROID_NDK_SOURCE_PROPERTIES MATCHES "${_ANDROID_NDK_REVISION_REGEX}")
+ string(REPLACE "\n" "\n " _ANDROID_NDK_SOURCE_PROPERTIES "${_ANDROID_NDK_SOURCE_PROPERTIES}")
+ message(FATAL_ERROR
+ "Android: Failed to parse NDK revision from:\n"
+ " ${CMAKE_ANDROID_NDK}/source.properties\n"
+ "with content:\n"
+ " ${_ANDROID_NDK_SOURCE_PROPERTIES}")
+ endif()
+
+ set(_ANDROID_NDK_MAJOR "${CMAKE_MATCH_1}")
+ set(_ANDROID_NDK_MINOR "${CMAKE_MATCH_2}")
+ set(_ANDROID_NDK_BUILD "${CMAKE_MATCH_3}")
+ set(_ANDROID_NDK_BETA "${CMAKE_MATCH_5}")
+ if(_ANDROID_NDK_BETA STREQUAL "")
+ set(_ANDROID_NDK_BETA "0")
+ endif()
+ set(CMAKE_ANDROID_NDK_VERSION "${_ANDROID_NDK_MAJOR}.${_ANDROID_NDK_MINOR}")
+
+ unset(_ANDROID_NDK_SOURCE_PROPERTIES)
+ unset(_ANDROID_NDK_REVISION_REGEX)
+ unset(_ANDROID_NDK_MAJOR)
+ unset(_ANDROID_NDK_MINOR)
+ unset(_ANDROID_NDK_BUILD)
+ unset(_ANDROID_NDK_BETA)
+endif()
+
if(CMAKE_ANDROID_NDK)
# Identify the host platform.
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
@@ -247,60 +299,75 @@ else()
endif()
if(_INCLUDED_ABIS)
- set(_ANDROID_KNOWN_ABIS ${NDK_KNOWN_DEVICE_ABI32S} ${NDK_KNOWN_DEVICE_ABI64S})
+ if(NDK_KNOWN_DEVICE_ABIS)
+ set(_ANDROID_KNOWN_ABIS ${NDK_KNOWN_DEVICE_ABIS})
+ else()
+ set(_ANDROID_KNOWN_ABIS ${NDK_KNOWN_DEVICE_ABI32S} ${NDK_KNOWN_DEVICE_ABI64S})
+ endif()
endif()
-# https://developer.android.com/ndk/guides/abis.html
-
-set(_ANDROID_ABI_arm64-v8a_PROC "aarch64")
-set(_ANDROID_ABI_arm64-v8a_ARCH "arm64")
-set(_ANDROID_ABI_arm64-v8a_TRIPLE "aarch64-linux-android")
-set(_ANDROID_ABI_armeabi-v7a_PROC "armv7-a")
-set(_ANDROID_ABI_armeabi-v7a_ARCH "arm")
-set(_ANDROID_ABI_armeabi-v7a_TRIPLE "arm-linux-androideabi")
-set(_ANDROID_ABI_armeabi-v6_PROC "armv6")
-set(_ANDROID_ABI_armeabi-v6_ARCH "arm")
-set(_ANDROID_ABI_armeabi-v6_TRIPLE "arm-linux-androideabi")
-set(_ANDROID_ABI_armeabi_PROC "armv5te")
-set(_ANDROID_ABI_armeabi_ARCH "arm")
-set(_ANDROID_ABI_armeabi_TRIPLE "arm-linux-androideabi")
-set(_ANDROID_ABI_mips_PROC "mips")
-set(_ANDROID_ABI_mips_ARCH "mips")
-set(_ANDROID_ABI_mips_TRIPLE "mipsel-linux-android")
-set(_ANDROID_ABI_mips64_PROC "mips64")
-set(_ANDROID_ABI_mips64_ARCH "mips64")
-set(_ANDROID_ABI_mips64_TRIPLE "mips64el-linux-android")
-set(_ANDROID_ABI_x86_PROC "i686")
-set(_ANDROID_ABI_x86_ARCH "x86")
-set(_ANDROID_ABI_x86_TRIPLE "i686-linux-android")
-set(_ANDROID_ABI_x86_64_PROC "x86_64")
-set(_ANDROID_ABI_x86_64_ARCH "x86_64")
-set(_ANDROID_ABI_x86_64_TRIPLE "x86_64-linux-android")
-
-set(_ANDROID_PROC_aarch64_ARCH_ABI "arm64-v8a")
-set(_ANDROID_PROC_armv7-a_ARCH_ABI "armeabi-v7a")
-set(_ANDROID_PROC_armv6_ARCH_ABI "armeabi-v6")
-set(_ANDROID_PROC_armv5te_ARCH_ABI "armeabi")
-set(_ANDROID_PROC_i686_ARCH_ABI "x86")
-set(_ANDROID_PROC_mips_ARCH_ABI "mips")
-set(_ANDROID_PROC_mips64_ARCH_ABI "mips64")
-set(_ANDROID_PROC_x86_64_ARCH_ABI "x86_64")
-
-set(_ANDROID_ARCH_arm64_ABI "arm64-v8a")
-set(_ANDROID_ARCH_arm_ABI "armeabi")
-set(_ANDROID_ARCH_mips_ABI "mips")
-set(_ANDROID_ARCH_mips64_ABI "mips64")
-set(_ANDROID_ARCH_x86_ABI "x86")
-set(_ANDROID_ARCH_x86_64_ABI "x86_64")
+if(NOT DEFINED NDK_KNOWN_DEVICE_ABIS)
+ # The NDK is not new enough to provide ABI information.
+ # https://developer.android.com/ndk/guides/abis.html
+
+ set(NDK_ABI_arm64-v8a_PROC "aarch64")
+ set(NDK_ABI_arm64-v8a_ARCH "arm64")
+ set(NDK_ABI_arm64-v8a_TRIPLE "aarch64-linux-android")
+ set(NDK_ABI_arm64-v8a_LLVM_TRIPLE "aarch64-none-linux-android")
+ set(NDK_ABI_armeabi-v7a_PROC "armv7-a")
+ set(NDK_ABI_armeabi-v7a_ARCH "arm")
+ set(NDK_ABI_armeabi-v7a_TRIPLE "arm-linux-androideabi")
+ set(NDK_ABI_armeabi-v7a_LLVM_TRIPLE "armv7-none-linux-androideabi")
+ set(NDK_ABI_armeabi-v6_PROC "armv6")
+ set(NDK_ABI_armeabi-v6_ARCH "arm")
+ set(NDK_ABI_armeabi-v6_TRIPLE "arm-linux-androideabi")
+ set(NDK_ABI_armeabi-v6_LLVM_TRIPLE "armv6-none-linux-androideabi")
+ set(NDK_ABI_armeabi_PROC "armv5te")
+ set(NDK_ABI_armeabi_ARCH "arm")
+ set(NDK_ABI_armeabi_TRIPLE "arm-linux-androideabi")
+ set(NDK_ABI_armeabi_LLVM_TRIPLE "armv5te-none-linux-androideabi")
+ set(NDK_ABI_mips_PROC "mips")
+ set(NDK_ABI_mips_ARCH "mips")
+ set(NDK_ABI_mips_TRIPLE "mipsel-linux-android")
+ set(NDK_ABI_mips_LLVM_TRIPLE "mipsel-none-linux-android")
+ set(NDK_ABI_mips64_PROC "mips64")
+ set(NDK_ABI_mips64_ARCH "mips64")
+ set(NDK_ABI_mips64_TRIPLE "mips64el-linux-android")
+ set(NDK_ABI_mips64_LLVM_TRIPLE "mips64el-none-linux-android")
+ set(NDK_ABI_x86_PROC "i686")
+ set(NDK_ABI_x86_ARCH "x86")
+ set(NDK_ABI_x86_TRIPLE "i686-linux-android")
+ set(NDK_ABI_x86_LLVM_TRIPLE "i686-none-linux-android")
+ set(NDK_ABI_x86_64_PROC "x86_64")
+ set(NDK_ABI_x86_64_ARCH "x86_64")
+ set(NDK_ABI_x86_64_TRIPLE "x86_64-linux-android")
+ set(NDK_ABI_x86_64_LLVM_TRIPLE "x86_64-none-linux-android")
+
+ set(NDK_PROC_aarch64_ABI "arm64-v8a")
+ set(NDK_PROC_armv7-a_ABI "armeabi-v7a")
+ set(NDK_PROC_armv6_ABI "armeabi-v6")
+ set(NDK_PROC_armv5te_ABI "armeabi")
+ set(NDK_PROC_i686_ABI "x86")
+ set(NDK_PROC_mips_ABI "mips")
+ set(NDK_PROC_mips64_ABI "mips64")
+ set(NDK_PROC_x86_64_ABI "x86_64")
+
+ set(NDK_ARCH_arm64_ABI "arm64-v8a")
+ set(NDK_ARCH_arm_ABI "armeabi")
+ set(NDK_ARCH_mips_ABI "mips")
+ set(NDK_ARCH_mips64_ABI "mips64")
+ set(NDK_ARCH_x86_ABI "x86")
+ set(NDK_ARCH_x86_64_ABI "x86_64")
+endif()
# Validate inputs.
-if(CMAKE_ANDROID_ARCH_ABI AND NOT DEFINED "_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC")
+if(CMAKE_ANDROID_ARCH_ABI AND NOT DEFINED "NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC")
message(FATAL_ERROR "Android: Unknown ABI CMAKE_ANDROID_ARCH_ABI='${CMAKE_ANDROID_ARCH_ABI}'.")
endif()
-if(CMAKE_SYSTEM_PROCESSOR AND NOT DEFINED "_ANDROID_PROC_${CMAKE_SYSTEM_PROCESSOR}_ARCH_ABI")
+if(CMAKE_SYSTEM_PROCESSOR AND NOT DEFINED "NDK_PROC_${CMAKE_SYSTEM_PROCESSOR}_ABI")
message(FATAL_ERROR "Android: Unknown processor CMAKE_SYSTEM_PROCESSOR='${CMAKE_SYSTEM_PROCESSOR}'.")
endif()
-if(_ANDROID_SYSROOT_ARCH AND NOT DEFINED "_ANDROID_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI")
+if(_ANDROID_SYSROOT_ARCH AND NOT DEFINED "NDK_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI")
message(FATAL_ERROR
"Android: Unknown architecture '${_ANDROID_SYSROOT_ARCH}' specified in CMAKE_SYSROOT:\n"
" ${CMAKE_SYSROOT}"
@@ -310,9 +377,9 @@ endif()
# Select an ABI.
if(NOT CMAKE_ANDROID_ARCH_ABI)
if(CMAKE_SYSTEM_PROCESSOR)
- set(CMAKE_ANDROID_ARCH_ABI "${_ANDROID_PROC_${CMAKE_SYSTEM_PROCESSOR}_ARCH_ABI}")
+ set(CMAKE_ANDROID_ARCH_ABI "${NDK_PROC_${CMAKE_SYSTEM_PROCESSOR}_ABI}")
elseif(_ANDROID_SYSROOT_ARCH)
- set(CMAKE_ANDROID_ARCH_ABI "${_ANDROID_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI}")
+ set(CMAKE_ANDROID_ARCH_ABI "${NDK_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI}")
elseif(_INCLUDED_ABIS)
# Default to the oldest ARM ABI.
foreach(abi armeabi armeabi-v7a arm64-v8a)
@@ -368,7 +435,7 @@ if(_INCLUDED_ABIS AND NOT CMAKE_ANDROID_ARCH_ABI IN_LIST _ANDROID_KNOWN_ABIS)
"Supported ABIS: ${_ANDROID_KNOWN_ABIS}."
)
endif()
-set(CMAKE_ANDROID_ARCH "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_ARCH}")
+set(CMAKE_ANDROID_ARCH "${NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_ARCH}")
if(_ANDROID_SYSROOT_ARCH AND NOT "x${_ANDROID_SYSROOT_ARCH}" STREQUAL "x${CMAKE_ANDROID_ARCH}")
message(FATAL_ERROR
"Android: Architecture '${_ANDROID_SYSROOT_ARCH}' specified in CMAKE_SYSROOT:\n"
@@ -376,15 +443,17 @@ if(_ANDROID_SYSROOT_ARCH AND NOT "x${_ANDROID_SYSROOT_ARCH}" STREQUAL "x${CMAKE_
"does not match architecture '${CMAKE_ANDROID_ARCH}' for the ABI '${CMAKE_ANDROID_ARCH_ABI}'."
)
endif()
-set(CMAKE_ANDROID_ARCH_TRIPLE "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_TRIPLE}")
+set(CMAKE_ANDROID_ARCH_TRIPLE "${NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_TRIPLE}")
+set(CMAKE_ANDROID_ARCH_LLVM_TRIPLE
+ "${NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_LLVM_TRIPLE}")
# Select a processor.
if(NOT CMAKE_SYSTEM_PROCESSOR)
- set(CMAKE_SYSTEM_PROCESSOR "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC}")
+ set(CMAKE_SYSTEM_PROCESSOR "${NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC}")
endif()
# If the user specified both an ABI and a processor then they might not match.
-if(NOT _ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC STREQUAL CMAKE_SYSTEM_PROCESSOR)
+if(NOT NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC STREQUAL CMAKE_SYSTEM_PROCESSOR)
message(FATAL_ERROR "Android: The specified CMAKE_ANDROID_ARCH_ABI='${CMAKE_ANDROID_ARCH_ABI}' and CMAKE_SYSTEM_PROCESSOR='${CMAKE_SYSTEM_PROCESSOR}' is not a valid combination.")
endif()
@@ -491,6 +560,8 @@ set(CMAKE_ANDROID_ARCH_ABI \"${CMAKE_ANDROID_ARCH_ABI}\")
if(CMAKE_ANDROID_NDK)
string(APPEND CMAKE_SYSTEM_CUSTOM_CODE
"set(CMAKE_ANDROID_ARCH_TRIPLE \"${CMAKE_ANDROID_ARCH_TRIPLE}\")\n"
+ "set(CMAKE_ANDROID_ARCH_LLVM_TRIPLE \"${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}\")\n"
+ "set(CMAKE_ANDROID_NDK_VERSION \"${CMAKE_ANDROID_NDK_VERSION}\")\n"
"set(CMAKE_ANDROID_NDK_DEPRECATED_HEADERS \"${CMAKE_ANDROID_NDK_DEPRECATED_HEADERS}\")\n"
"set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG \"${CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG}\")\n"
"set(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED \"${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}\")\n"
@@ -528,3 +599,9 @@ endif()
message(STATUS "Android: Targeting API '${CMAKE_SYSTEM_VERSION}' with architecture '${CMAKE_ANDROID_ARCH}', ABI '${CMAKE_ANDROID_ARCH_ABI}', and processor '${CMAKE_SYSTEM_PROCESSOR}'")
cmake_policy(POP)
+
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Determine.cmake OPTIONAL)
+endif()
diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake
index 5019c28bdc..6116ae1c80 100644
--- a/Modules/Platform/Android-Initialize.cmake
+++ b/Modules/Platform/Android-Initialize.cmake
@@ -4,6 +4,12 @@
# When CMAKE_SYSTEM_NAME is "Android", CMakeSystemSpecificInitialize loads this
# module.
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Initialize.cmake OPTIONAL)
+endif()
+
# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
# implemented in the CMake VS IDE generators. Avoid interfering with
# that functionality for now.
@@ -17,7 +23,7 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1)
return()
endif()
-set(CMAKE_BUILD_TYPE_INIT Debug)
+set(CMAKE_BUILD_TYPE_INIT "RelWithDebInfo")
# Skip sysroot selection if the NDK has a unified toolchain.
if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
@@ -53,3 +59,9 @@ else()
"Android: No CMAKE_SYSROOT was selected."
)
endif()
+
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Initialize.cmake OPTIONAL)
+endif()
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
index 8ffa1b2d3b..e4b9a0929e 100644
--- a/Modules/Platform/Android.cmake
+++ b/Modules/Platform/Android.cmake
@@ -1,3 +1,9 @@
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android.cmake OPTIONAL)
+endif()
+
include(Platform/Linux)
set(ANDROID 1)
@@ -22,3 +28,65 @@ set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
set(CMAKE_LINK_LIBRARY_FLAG "")
endif()
+
+# Commonly used Android toolchain files that pre-date CMake upstream support
+# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
+if(CMAKE_SYSTEM_VERSION EQUAL 1)
+ return()
+endif()
+
+if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
+ # Tell CMake not to search host sysroots for headers/libraries.
+
+ # All paths added to CMAKE_SYSTEM_*_PATH below will be rerooted under
+ # CMAKE_FIND_ROOT_PATH. This is set because:
+ # 1. Users may structure their libraries in a way similar to NDK. When they do that,
+ # they can simply append another path to CMAKE_FIND_ROOT_PATH.
+ # 2. CMAKE_FIND_ROOT_PATH must be non-empty for CMAKE_FIND_ROOT_PATH_MODE_* == ONLY
+ # to be meaningful. https://github.com/android-ndk/ndk/issues/890
+ list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/sysroot")
+
+ # Allow users to override these values in case they want more strict behaviors.
+ # For example, they may want to prevent the NDK's libz from being picked up so
+ # they can use their own.
+ # https://github.com/android-ndk/ndk/issues/517
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
+ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+ endif()
+
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
+ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+ endif()
+
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
+ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+ endif()
+
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
+ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+ endif()
+
+ # Don't search paths in PATH environment variable.
+ if(NOT DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH)
+ set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
+ endif()
+
+ # Allows CMake to find headers in the architecture-specific include directories.
+ set(CMAKE_LIBRARY_ARCHITECTURE "${CMAKE_ANDROID_ARCH_TRIPLE}")
+
+ # Instructs CMake to search the correct API level for libraries.
+ # Besides the paths like <root>/<prefix>/lib/<arch>, cmake also searches <root>/<prefix>.
+ # So we can add the API level specific directory directly.
+ # https://github.com/android/ndk/issues/929
+ list(PREPEND CMAKE_SYSTEM_PREFIX_PATH
+ "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_SYSTEM_VERSION}"
+ )
+
+ list(APPEND CMAKE_SYSTEM_PROGRAM_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/bin")
+endif()
+
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android.cmake OPTIONAL)
+endif()
diff --git a/Modules/Platform/Android/Determine-Compiler.cmake b/Modules/Platform/Android/Determine-Compiler.cmake
index f9c2d8968a..f8eae62214 100644
--- a/Modules/Platform/Android/Determine-Compiler.cmake
+++ b/Modules/Platform/Android/Determine-Compiler.cmake
@@ -7,6 +7,12 @@ if(__ANDROID_DETERMINE_COMPILER)
endif()
set(__ANDROID_DETERMINE_COMPILER 1)
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Determine-Compiler.cmake OPTIONAL)
+endif()
+
# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
# implemented in the CMake VS IDE generators. Avoid interfering with
# that functionality for now. Later we may try to integrate this.
@@ -83,3 +89,9 @@ set(CMAKE_${lang}_ANDROID_TOOLCHAIN_SUFFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_S
")
endif()
endmacro()
+
+# Include the NDK hook.
+# It can be used by NDK to inject necessary fixes for an earlier cmake.
+if(CMAKE_ANDROID_NDK)
+ include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Determine-Compiler.cmake OPTIONAL)
+endif()
diff --git a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
index f4717d5f60..c18c0a2699 100644
--- a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
+++ b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake
@@ -1,6 +1,3 @@
-# <ndk>/build/core/toolchains/aarch64-linux-android-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "aarch64-none-linux-android")
-
# Suppress -Wl,-z,nocopyreloc flag on arm64-v8a
set(_ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc 1)
diff --git a/Modules/Platform/Android/abi-armeabi-Clang.cmake b/Modules/Platform/Android/abi-armeabi-Clang.cmake
index b857bd3734..2b1de03f64 100644
--- a/Modules/Platform/Android/abi-armeabi-Clang.cmake
+++ b/Modules/Platform/Android/abi-armeabi-Clang.cmake
@@ -1,6 +1,3 @@
-# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "armv5te-none-linux-androideabi")
-
string(APPEND _ANDROID_ABI_INIT_CFLAGS
" -march=armv5te"
)
diff --git a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
index a7412f5bd7..bb176aed59 100644
--- a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
+++ b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake
@@ -1,6 +1,3 @@
-# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "armv6-none-linux-androideabi")
-
string(APPEND _ANDROID_ABI_INIT_CFLAGS
" -march=armv6"
)
diff --git a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake
index e2ab58b32f..6feeef6854 100644
--- a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake
+++ b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake
@@ -1,6 +1,3 @@
-# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "armv7-none-linux-androideabi")
-
string(APPEND _ANDROID_ABI_INIT_CFLAGS
" -march=armv7-a"
)
diff --git a/Modules/Platform/Android/abi-mips-Clang.cmake b/Modules/Platform/Android/abi-mips-Clang.cmake
index 73adddecfb..7df6a36769 100644
--- a/Modules/Platform/Android/abi-mips-Clang.cmake
+++ b/Modules/Platform/Android/abi-mips-Clang.cmake
@@ -1,4 +1 @@
-# <ndk>/build/core/toolchains/mipsel-linux-android-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "mipsel-none-linux-android")
-
include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-mips64-Clang.cmake b/Modules/Platform/Android/abi-mips64-Clang.cmake
index 603f1b2090..7df6a36769 100644
--- a/Modules/Platform/Android/abi-mips64-Clang.cmake
+++ b/Modules/Platform/Android/abi-mips64-Clang.cmake
@@ -1,4 +1 @@
-# <ndk>/build/core/toolchains/mips64el-linux-android-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "mips64el-none-linux-android")
-
include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-x86-Clang.cmake b/Modules/Platform/Android/abi-x86-Clang.cmake
index fe7eacef5d..7df6a36769 100644
--- a/Modules/Platform/Android/abi-x86-Clang.cmake
+++ b/Modules/Platform/Android/abi-x86-Clang.cmake
@@ -1,4 +1 @@
-# <ndk>/build/core/toolchains/x86-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "i686-none-linux-android")
-
include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Android/abi-x86_64-Clang.cmake b/Modules/Platform/Android/abi-x86_64-Clang.cmake
index 3cbcd491fb..7df6a36769 100644
--- a/Modules/Platform/Android/abi-x86_64-Clang.cmake
+++ b/Modules/Platform/Android/abi-x86_64-Clang.cmake
@@ -1,4 +1 @@
-# <ndk>/build/core/toolchains/x86_64-clang/setup.mk
-set(_ANDROID_ABI_CLANG_TARGET "x86_64-none-linux-android")
-
include(Platform/Android/abi-common-Clang)
diff --git a/Modules/Platform/Apple-IntelLLVM-C.cmake b/Modules/Platform/Apple-IntelLLVM-C.cmake
new file mode 100644
index 0000000000..8e7472909b
--- /dev/null
+++ b/Modules/Platform/Apple-IntelLLVM-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Apple-IntelLLVM)
+__apple_compiler_intel_llvm(C)
diff --git a/Modules/Platform/Apple-IntelLLVM-CXX.cmake b/Modules/Platform/Apple-IntelLLVM-CXX.cmake
new file mode 100644
index 0000000000..38640e13d6
--- /dev/null
+++ b/Modules/Platform/Apple-IntelLLVM-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Apple-IntelLLVM)
+__apple_compiler_intel_llvm(CXX)
diff --git a/Modules/Platform/Apple-IntelLLVM-Fortran.cmake b/Modules/Platform/Apple-IntelLLVM-Fortran.cmake
new file mode 100644
index 0000000000..d0486edca8
--- /dev/null
+++ b/Modules/Platform/Apple-IntelLLVM-Fortran.cmake
@@ -0,0 +1,8 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include(Platform/Apple-IntelLLVM)
+__apple_compiler_intel_llvm(Fortran)
+
+set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
+set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-current_version ")
diff --git a/Modules/Platform/Apple-IntelLLVM.cmake b/Modules/Platform/Apple-IntelLLVM.cmake
new file mode 100644
index 0000000000..2f9f0cabc3
--- /dev/null
+++ b/Modules/Platform/Apple-IntelLLVM.cmake
@@ -0,0 +1,17 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+include_guard()
+
+macro(__apple_compiler_intel_llvm lang)
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+ set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
+
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+
+ set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+endmacro()
diff --git a/Modules/Platform/Linux-IntelLLVM-C.cmake b/Modules/Platform/Linux-IntelLLVM-C.cmake
new file mode 100644
index 0000000000..5356c4f717
--- /dev/null
+++ b/Modules/Platform/Linux-IntelLLVM-C.cmake
@@ -0,0 +1,3 @@
+include(Platform/Linux-IntelLLVM)
+__linux_compiler_intel_llvm(C)
+set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
diff --git a/Modules/Platform/Linux-IntelLLVM-CXX.cmake b/Modules/Platform/Linux-IntelLLVM-CXX.cmake
new file mode 100644
index 0000000000..44ce0e8cdc
--- /dev/null
+++ b/Modules/Platform/Linux-IntelLLVM-CXX.cmake
@@ -0,0 +1,3 @@
+include(Platform/Linux-IntelLLVM)
+__linux_compiler_intel_llvm(CXX)
+set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
diff --git a/Modules/Platform/Linux-IntelLLVM-Fortran.cmake b/Modules/Platform/Linux-IntelLLVM-Fortran.cmake
new file mode 100644
index 0000000000..1cd9b1f81b
--- /dev/null
+++ b/Modules/Platform/Linux-IntelLLVM-Fortran.cmake
@@ -0,0 +1,4 @@
+include(Platform/Linux-IntelLLVM)
+__linux_compiler_intel_llvm(Fortran)
+string(APPEND CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS " -nofor-main")
+set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "")
diff --git a/Modules/Platform/Linux-IntelLLVM.cmake b/Modules/Platform/Linux-IntelLLVM.cmake
new file mode 100644
index 0000000000..1363b44271
--- /dev/null
+++ b/Modules/Platform/Linux-IntelLLVM.cmake
@@ -0,0 +1,55 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__LINUX_COMPILER_INTEL_LLVM)
+ return()
+endif()
+set(__LINUX_COMPILER_INTEL_LLVM 1)
+
+if(NOT XIAR)
+ set(_intel_xiar_hints)
+ foreach(lang C CXX Fortran)
+ if(IS_ABSOLUTE "${CMAKE_${lang}_COMPILER}")
+ get_filename_component(_hint "${CMAKE_${lang}_COMPILER}" PATH)
+ list(APPEND _intel_xiar_hints ${_hint})
+ endif()
+ endforeach()
+ find_program(XIAR NAMES xiar HINTS ${_intel_xiar_hints})
+ mark_as_advanced(XIAR)
+endif()
+
+macro(__linux_compiler_intel_llvm lang)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
+ set(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER YES)
+ set(CMAKE_${lang}_LINK_OPTIONS_PIE ${CMAKE_${lang}_COMPILE_OPTIONS_PIE} "-pie")
+ set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "-no-pie")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+
+ # We pass this for historical reasons. Projects may have
+ # executables that use dlopen but do not set ENABLE_EXPORTS.
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic")
+
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+
+ set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
+
+ if(XIAR)
+ # INTERPROCEDURAL_OPTIMIZATION
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO -ipo)
+ set(CMAKE_${lang}_CREATE_STATIC_LIBRARY_IPO
+ "${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> "
+ "${XIAR} -s <TARGET> ")
+ set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
+ set(_CMAKE_${lang}_IPO_LEGACY_BEHAVIOR YES)
+ else()
+ set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO)
+ endif()
+
+ set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+endmacro()
diff --git a/Modules/Platform/Linux-NVHPC-C.cmake b/Modules/Platform/Linux-NVHPC-C.cmake
new file mode 100644
index 0000000000..4aab327110
--- /dev/null
+++ b/Modules/Platform/Linux-NVHPC-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-NVHPC)
+__linux_compiler_nvhpc(C)
diff --git a/Modules/Platform/Linux-NVHPC-CXX.cmake b/Modules/Platform/Linux-NVHPC-CXX.cmake
new file mode 100644
index 0000000000..57380eb4e1
--- /dev/null
+++ b/Modules/Platform/Linux-NVHPC-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-NVHPC)
+__linux_compiler_nvhpc(CXX)
diff --git a/Modules/Platform/Linux-NVHPC-Fortran.cmake b/Modules/Platform/Linux-NVHPC-Fortran.cmake
new file mode 100644
index 0000000000..c68430c246
--- /dev/null
+++ b/Modules/Platform/Linux-NVHPC-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-NVHPC)
+__linux_compiler_nvhpc(Fortran)
diff --git a/Modules/Platform/Linux-NVHPC.cmake b/Modules/Platform/Linux-NVHPC.cmake
new file mode 100644
index 0000000000..aad17f1e9f
--- /dev/null
+++ b/Modules/Platform/Linux-NVHPC.cmake
@@ -0,0 +1,15 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__LINUX_COMPILER_NVIDIA)
+ return()
+endif()
+set(__LINUX_COMPILER_NVIDIA 1)
+
+include(Platform/Linux-PGI)
+
+macro(__linux_compiler_nvhpc lang)
+ __linux_compiler_pgi(${lang})
+endmacro()
diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
index b5d5464eae..23b48bdc7b 100644
--- a/Modules/Platform/Linux.cmake
+++ b/Modules/Platform/Linux.cmake
@@ -48,6 +48,7 @@ endif()
# Match multiarch library directory names.
set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*")
+set(CMAKE_LIBRARY_ARCHITECTURE_REGEX_VERSIONED "gcc/[a-z0-9_]+(-[a-z0-9_]+)?-linux(-gnu)?/[0-9]+(\\.[0-9]+\\.[0-9]+)*")
include(Platform/UnixPaths)
diff --git a/Modules/Platform/Windows-Clang-C.cmake b/Modules/Platform/Windows-Clang-C.cmake
index d00710579f..322e3fb686 100644
--- a/Modules/Platform/Windows-Clang-C.cmake
+++ b/Modules/Platform/Windows-Clang-C.cmake
@@ -1,2 +1,18 @@
include(Platform/Windows-Clang)
__windows_compiler_clang(C)
+
+if("x${MAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+ endif()
+elseif("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_C_DEPFILE_FORMAT gcc)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+ endif()
+endif()
diff --git a/Modules/Platform/Windows-Clang-CXX.cmake b/Modules/Platform/Windows-Clang-CXX.cmake
index f1d40f2653..b4aaf1e820 100644
--- a/Modules/Platform/Windows-Clang-CXX.cmake
+++ b/Modules/Platform/Windows-Clang-CXX.cmake
@@ -1,3 +1,19 @@
include(Platform/Windows-Clang)
set(_COMPILE_CXX_MSVC " -TP")
__windows_compiler_clang(CXX)
+
+if("x${MAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_CXX)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+ endif()
+elseif("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_CXX)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_CXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+ endif()
+endif()
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index 7697407fd7..c508ac1a59 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -27,7 +27,7 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_SHARED_MODULE_SUFFIX ".dll")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
if(NOT "${lang}" STREQUAL "ASM")
- set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <OBJECT> -MF <DEPFILE>")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
endif()
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
@@ -71,6 +71,9 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_${lang}_LINK_EXECUTABLE
"<CMAKE_${lang}_COMPILER> -fuse-ld=lld-link -nostartfiles -nostdlib <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
+ set(CMAKE_CREATE_WIN32_EXE "-Xlinker /subsystem:windows")
+ set(CMAKE_CREATE_CONSOLE_EXE "-Xlinker /subsystem:console")
+
if(NOT "${lang}" STREQUAL "ASM")
set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -Xclang -flto-visibility-public-std -D_MT -Xclang --dependent-lib=libcmt)
set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -D_DLL -D_MT -Xclang --dependent-lib=msvcrt)
@@ -114,8 +117,10 @@ macro(__enable_llvm_rc_preprocessing clang_option_prefix extra_pp_flags)
set(CMAKE_RC_PREPROCESSOR CMAKE_CXX_COMPILER)
endif()
if(DEFINED CMAKE_RC_PREPROCESSOR)
- set(CMAKE_DEPFILE_FLAGS_RC "${clang_option_prefix}-MD ${clang_option_prefix}-MF ${clang_option_prefix}<DEPFILE>")
- set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_COMMAND> -E cmake_llvm_rc <SOURCE> <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> ${extra_pp_flags} -E -- <SOURCE> ++ <CMAKE_RC_COMPILER> <DEFINES> -I <SOURCE_DIR> <INCLUDES> /fo <OBJECT> <OBJECT>.pp")
+ set(CMAKE_DEPFILE_FLAGS_RC "${clang_option_prefix}-MD ${clang_option_prefix}-MF ${clang_option_prefix}<DEP_FILE>")
+ # The <FLAGS> are passed to the preprocess and the resource compiler to pick
+ # up the eventual -D / -C options passed through the CMAKE_RC_FLAGS.
+ set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_COMMAND> -E cmake_llvm_rc <SOURCE> <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> ${extra_pp_flags} -E -- <SOURCE> ++ <CMAKE_RC_COMPILER> <DEFINES> -I <SOURCE_DIR> <INCLUDES> <FLAGS> /fo <OBJECT> <OBJECT>.pp")
if(CMAKE_GENERATOR MATCHES "Ninja")
set(CMAKE_NINJA_CMCLDEPS_RC 0)
set(CMAKE_NINJA_DEP_TYPE_RC gcc)
diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake
index 59f3ca59f5..8f1d02430a 100644
--- a/Modules/Platform/Windows-Embarcadero.cmake
+++ b/Modules/Platform/Windows-Embarcadero.cmake
@@ -35,8 +35,8 @@ else()
set(_tR "-tR") # Target uses the dynamic RTL
set(_tW "-tW") # Target is a Windows application
endif()
-set(_COMPILE_C "-c")
-set(_COMPILE_CXX "-P -c")
+set(_COMPILE_C "")
+set(_COMPILE_CXX " -P")
set(CMAKE_LIBRARY_PATH_FLAG "-L")
set(CMAKE_LINK_LIBRARY_FLAG "")
@@ -87,7 +87,7 @@ macro(__embarcadero_language lang)
# place <DEFINES> outside the response file because Borland refuses
# to parse quotes from the response file.
set(CMAKE_${lang}_COMPILE_OBJECT
- "<CMAKE_${lang}_COMPILER> ${_tR} -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<OBJECT> ${_COMPILE_${lang}} <SOURCE>"
+ "<CMAKE_${lang}_COMPILER> ${_tR} -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<OBJECT>${_COMPILE_${lang}} -c <SOURCE>"
)
set(CMAKE_${lang}_LINK_EXECUTABLE
@@ -98,7 +98,7 @@ macro(__embarcadero_language lang)
# place <DEFINES> outside the response file because Borland refuses
# to parse quotes from the response file.
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
- "cpp32 -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<PREPROCESSED_SOURCE> ${_COMPILE_${lang}} <SOURCE>"
+ "cpp32 -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<PREPROCESSED_SOURCE>${_COMPILE_${lang}} -c <SOURCE>"
)
# Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not
diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake
index 06d8f50ff9..152b27c30d 100644
--- a/Modules/Platform/Windows-Intel-C.cmake
+++ b/Modules/Platform/Windows-Intel-C.cmake
@@ -1,4 +1,27 @@
include(Platform/Windows-Intel)
__windows_compiler_intel(C)
-set(CMAKE_NINJA_DEPTYPE_C intel) # special value handled by CMake
-set(CMAKE_DEPFILE_FLAGS_C "-QMMD -QMT <OBJECT> -QMF <DEPFILE>")
+
+set(CMAKE_DEPFILE_FLAGS_C "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
+set(CMAKE_C_DEPFILE_FORMAT gcc)
+
+if(CMAKE_GENERATOR MATCHES "^Ninja")
+ if(_CMAKE_NINJA_VERSION VERSION_LESS 1.9)
+ # This ninja version is too old to support the Intel depfile format.
+ # Fall back to msvc depfile format.
+ set(CMAKE_DEPFILE_FLAGS_C "/showIncludes")
+ set(CMAKE_C_DEPFILE_FORMAT msvc)
+ endif()
+endif()
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")
+ # dependencies are computed by the compiler itself
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+endif()
+
+if("${CMAKE_SOURCE_DIR}${CMAKE_BINARY_DIR}" MATCHES " ")
+ # The Intel compiler does not properly escape spaces in a depfile.
+ # Fall back to msvc depfile format.
+ set(CMAKE_DEPFILE_FLAGS_C "/showIncludes")
+ set(CMAKE_C_DEPFILE_FORMAT msvc)
+endif()
diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake
index 666de6ee44..ce33ae186a 100644
--- a/Modules/Platform/Windows-Intel-CXX.cmake
+++ b/Modules/Platform/Windows-Intel-CXX.cmake
@@ -1,5 +1,28 @@
include(Platform/Windows-Intel)
set(_COMPILE_CXX " /TP")
__windows_compiler_intel(CXX)
-set(CMAKE_NINJA_DEPTYPE_CXX intel) # special value handled by CMake
-set(CMAKE_DEPFILE_FLAGS_CXX "-QMMD -QMT <OBJECT> -QMF <DEPFILE>")
+
+set(CMAKE_DEPFILE_FLAGS_CXX "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
+set(CMAKE_CXX_DEPFILE_FORMAT gcc)
+
+if(CMAKE_GENERATOR MATCHES "^Ninja")
+ if(_CMAKE_NINJA_VERSION VERSION_LESS 1.9)
+ # This ninja version is too old to support the Intel depfile format.
+ # Fall back to msvc depfile format.
+ set(CMAKE_DEPFILE_FLAGS_CXX "/showIncludes")
+ set(CMAKE_CXX_DEPFILE_FORMAT msvc)
+ endif()
+endif()
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")
+ # dependencies are computed by the compiler itself
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+endif()
+
+if("${CMAKE_SOURCE_DIR}${CMAKE_BINARY_DIR}" MATCHES " ")
+ # The Intel compiler does not properly escape spaces in a depfile.
+ # Fall back to msvc depfile format.
+ set(CMAKE_DEPFILE_FLAGS_CXX "/showIncludes")
+ set(CMAKE_CXX_DEPFILE_FORMAT msvc)
+endif()
diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake
index 5d8f7fc35f..01f8dd0b15 100644
--- a/Modules/Platform/Windows-Intel.cmake
+++ b/Modules/Platform/Windows-Intel.cmake
@@ -8,6 +8,20 @@ if(__WINDOWS_INTEL)
endif()
set(__WINDOWS_INTEL 1)
+
+if (CMAKE_GENERATOR MATCHES "^Ninja")
+ # retrieve ninja version to enable dependencies configuration
+ # against Ninja capabilities
+ execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" --version
+ RESULT_VARIABLE _CMAKE_NINJA_RESULT
+ OUTPUT_VARIABLE _CMAKE_NINJA_VERSION
+ ERROR_VARIABLE _CMAKE_NINJA_VERSION)
+ if (NOT _CMAKE_NINJA_RESULT AND _CMAKE_NINJA_VERSION MATCHES "[0-9]+(\\.[0-9]+)*")
+ set (_CMAKE_NINJA_VERSION "${CMAKE_MATCH_0}")
+ endif()
+ unset(_CMAKE_NINJA_RESULT)
+endif()
+
include(Platform/Windows-MSVC)
macro(__windows_compiler_intel lang)
__windows_compiler_msvc(${lang})
diff --git a/Modules/Platform/Windows-IntelLLVM-ASM.cmake b/Modules/Platform/Windows-IntelLLVM-ASM.cmake
new file mode 100644
index 0000000000..f355e49fab
--- /dev/null
+++ b/Modules/Platform/Windows-IntelLLVM-ASM.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-IntelLLVM)
+__windows_compiler_intel(ASM)
diff --git a/Modules/Platform/Windows-IntelLLVM-C.cmake b/Modules/Platform/Windows-IntelLLVM-C.cmake
new file mode 100644
index 0000000000..93c33648da
--- /dev/null
+++ b/Modules/Platform/Windows-IntelLLVM-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-IntelLLVM)
+__windows_compiler_intel(C)
diff --git a/Modules/Platform/Windows-IntelLLVM-CXX.cmake b/Modules/Platform/Windows-IntelLLVM-CXX.cmake
new file mode 100644
index 0000000000..46678952a5
--- /dev/null
+++ b/Modules/Platform/Windows-IntelLLVM-CXX.cmake
@@ -0,0 +1,3 @@
+include(Platform/Windows-IntelLLVM)
+set(_COMPILE_CXX " /TP")
+__windows_compiler_intel(CXX)
diff --git a/Modules/Platform/Windows-IntelLLVM-Fortran.cmake b/Modules/Platform/Windows-IntelLLVM-Fortran.cmake
new file mode 100644
index 0000000000..06d0a00d14
--- /dev/null
+++ b/Modules/Platform/Windows-IntelLLVM-Fortran.cmake
@@ -0,0 +1,44 @@
+include(Platform/Windows-IntelLLVM)
+set(CMAKE_BUILD_TYPE_INIT Debug)
+set(_COMPILE_Fortran " /fpp")
+set(CMAKE_Fortran_MODDIR_FLAG "-module:")
+set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib")
+__windows_compiler_intel(Fortran)
+if(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT)
+ set(_LIBSDLL "")
+ set(_DBGLIBS "")
+ set(_THREADS "")
+else()
+ set(_LIBSDLL " /libs:dll")
+ set(_DBGLIBS " /dbglibs")
+ set(_THREADS " /threads")
+endif()
+
+cmake_policy(GET CMP0092 _cmp0092)
+if(NOT _cmp0092 STREQUAL "NEW")
+ string(APPEND CMAKE_Fortran_FLAGS_INIT " /W1")
+endif()
+unset(_cmp0092)
+
+string(APPEND CMAKE_Fortran_FLAGS_INIT " /nologo /fpp${_LIBSDLL}${_THREADS}")
+string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " /Od /debug:full${_DBGLIBS}")
+string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " /O1 /DNDEBUG")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " /O2 /DNDEBUG")
+string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " /O2 /debug:full /DNDEBUG")
+unset(_LIBSDLL)
+unset(_DBGLIBS)
+unset(_THREADS)
+
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -threads -libs:static)
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -threads -libs:dll)
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -threads -libs:static -dbglibs)
+set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -threads -libs:dll -dbglibs)
+
+# Intel Fortran for Windows supports single-threaded RTL but it is
+# not implemented by the Visual Studio integration.
+if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_SingleThreaded -libs:static)
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_SingleThreadedDLL -libs:dll)
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_SingleThreadedDebug -libs:static -dbglibs)
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_SingleThreadedDebugDLL -libs:dll -dbglibs)
+endif()
diff --git a/Modules/Platform/Windows-IntelLLVM.cmake b/Modules/Platform/Windows-IntelLLVM.cmake
new file mode 100644
index 0000000000..b9ea037996
--- /dev/null
+++ b/Modules/Platform/Windows-IntelLLVM.cmake
@@ -0,0 +1,17 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__WINDOWS_INTEL)
+ return()
+endif()
+set(__WINDOWS_INTEL 1)
+
+include(Platform/Windows-MSVC)
+macro(__windows_compiler_intel lang)
+ __windows_compiler_msvc(${lang})
+
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
+ set(CMAKE_${lang}_DEPFILE_FORMAT gcc)
+endmacro()
diff --git a/Modules/Platform/Windows-MSVC-C.cmake b/Modules/Platform/Windows-MSVC-C.cmake
index cbe1586e1e..67b68277d1 100644
--- a/Modules/Platform/Windows-MSVC-C.cmake
+++ b/Modules/Platform/Windows-MSVC-C.cmake
@@ -3,3 +3,10 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0)
set(_FS_C " /FS")
endif()
__windows_compiler_msvc(C)
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+endif()
diff --git a/Modules/Platform/Windows-MSVC-CXX.cmake b/Modules/Platform/Windows-MSVC-CXX.cmake
index 0e85005322..6fea6174a3 100644
--- a/Modules/Platform/Windows-MSVC-CXX.cmake
+++ b/Modules/Platform/Windows-MSVC-CXX.cmake
@@ -4,3 +4,10 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0)
set(_FS_CXX " /FS")
endif()
__windows_compiler_msvc(CXX)
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_CXX)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+endif()
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index bd08718436..e384af4565 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -154,7 +154,9 @@ set(CMAKE_BUILD_TYPE_INIT Debug)
# Compute an architecture family from the architecture id.
foreach(lang C CXX)
set(_MSVC_${lang}_ARCHITECTURE_FAMILY "${MSVC_${lang}_ARCHITECTURE_ID}")
- if(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM64")
+ if(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM64EC")
+ set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM64EC")
+ elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM64")
set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM64")
elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM")
set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM")
@@ -163,6 +165,14 @@ foreach(lang C CXX)
endif()
endforeach()
+cmake_policy(GET CMP0117 __WINDOWS_MSVC_CMP0117)
+if(__WINDOWS_MSVC_CMP0117 STREQUAL "NEW")
+ set(_GR "")
+else()
+ set(_GR " /GR")
+endif()
+unset(__WINDOWS_MSVC_CMP0117)
+
if(WINCE)
foreach(lang C CXX)
string(TOUPPER "${_MSVC_${lang}_ARCHITECTURE_FAMILY}" _MSVC_${lang}_ARCHITECTURE_FAMILY_UPPER)
@@ -182,7 +192,7 @@ if(WINCE)
set(_RTC1 "")
set(_FLAGS_C "")
- set(_FLAGS_CXX " /GR /EHsc")
+ set(_FLAGS_CXX "${_GR} /EHsc")
foreach(lang C CXX)
if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "ARM")
@@ -204,7 +214,7 @@ if(WINCE)
elseif(WINDOWS_PHONE OR WINDOWS_STORE)
set(_PLATFORM_DEFINES "/DWIN32")
set(_FLAGS_C " /DUNICODE /D_UNICODE")
- set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc")
+ set(_FLAGS_CXX " /DUNICODE /D_UNICODE${_GR} /EHsc")
if(WINDOWS_STORE AND MSVC_VERSION GREATER 1899)
set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsApp.lib")
elseif(WINDOWS_PHONE)
@@ -216,7 +226,9 @@ elseif(WINDOWS_PHONE OR WINDOWS_STORE)
endif()
else()
set(_PLATFORM_DEFINES "/DWIN32")
-
+ if((_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64EC") OR (_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64EC"))
+ set(_PLATFORM_DEFINES "${_PLATFORM_DEFINES} /D_AMD64_ /DAMD64 /D_ARM64EC_ /DARM64EC /D_ARM64EC_WORKAROUND_")
+ endif()
if(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM")
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib")
elseif(MSVC_VERSION GREATER 1310)
@@ -226,12 +238,12 @@ else()
set(_FLAGS_CXX " -frtti -fexceptions")
else()
set(_RTC1 "/RTC1")
- set(_FLAGS_CXX " /GR /EHsc")
+ set(_FLAGS_CXX "${_GR} /EHsc")
endif()
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
else()
set(_RTC1 "/GZ")
- set(_FLAGS_CXX " /GR /GX")
+ set(_FLAGS_CXX "${_GR} /GX")
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
endif()
@@ -241,6 +253,8 @@ else()
endif()
endif()
+unset(_GR)
+
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
# executable linker flags
@@ -251,6 +265,8 @@ if(MSVC_C_ARCHITECTURE_ID)
set(_MACHINE_ARCH_FLAG "/machine:THUMB")
elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64")
set(_MACHINE_ARCH_FLAG "/machine:ARM64")
+ elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64EC")
+ set(_MACHINE_ARCH_FLAG "/machine:ARM64EC")
elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM")
set(_MACHINE_ARCH_FLAG "/machine:ARM")
else()
@@ -261,6 +277,8 @@ elseif(MSVC_CXX_ARCHITECTURE_ID)
set(_MACHINE_ARCH_FLAG "/machine:THUMB")
elseif(_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64")
set(_MACHINE_ARCH_FLAG "/machine:ARM64")
+ elseif(_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64EC")
+ set(_MACHINE_ARCH_FLAG "/machine:ARM64EC")
elseif(_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM")
set(_MACHINE_ARCH_FLAG "/machine:ARM")
else()
@@ -295,7 +313,11 @@ foreach(t EXE SHARED MODULE)
string(APPEND CMAKE_${t}_LINKER_FLAGS_RELEASE_INIT " /INCREMENTAL:NO")
endforeach()
-string(APPEND CMAKE_STATIC_LINKER_FLAGS_INIT " ${_MACHINE_ARCH_FLAG}")
+if((_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64EC") OR (_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64EC"))
+ string(APPEND CMAKE_STATIC_LINKER_FLAGS_INIT " /machine:ARM64X")
+else()
+ string(APPEND CMAKE_STATIC_LINKER_FLAGS_INIT " ${_MACHINE_ARCH_FLAG}")
+endif()
unset(_MACHINE_ARCH_FLAG)
cmake_policy(GET CMP0091 __WINDOWS_MSVC_CMP0091)
@@ -425,8 +447,14 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -MDd)
endif()
set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON)
- set(CMAKE_NINJA_DEPTYPE_${lang} msvc)
+
__windows_compiler_msvc_enable_rc("${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}")
+
+ # define generic information about compiler dependencies
+ if (MSVC_VERSION GREATER 1300)
+ set(CMAKE_DEPFILE_FLAGS_${lang} "/showIncludes")
+ set(CMAKE_${lang}_DEPFILE_FORMAT msvc)
+ endif()
endmacro()
macro(__windows_compiler_msvc_enable_rc flags)
diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index 43ec889b66..bda23ab682 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -15,6 +15,9 @@ Otherwise it is set to 0. Currently this functionality is implemented
for AIX, cygwin, FreeBSD, HPUX, Linux, macOS, QNX, Sun and
Windows.
+.. versionchanged:: 3.15
+ On Linux, returns the container CPU count instead of the host CPU count.
+
This function is guaranteed to return a positive integer (>=1) if it
succeeds. It returns 0 if there's a problem determining the processor
count.
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake
index 8a769b7e2c..ea8ca73b35 100644
--- a/Modules/TestBigEndian.cmake
+++ b/Modules/TestBigEndian.cmake
@@ -5,19 +5,41 @@
TestBigEndian
-------------
-Define macro to determine endian type
+.. deprecated:: 3.20
-Check if the system is big endian or little endian
+ Supserseded by the :variable:`CMAKE_<LANG>_BYTE_ORDER` variable.
-::
+Check if the target architecture is big endian or little endian.
+
+.. command:: test_big_endian
+
+ .. code-block:: cmake
+
+ test_big_endian(<var>)
+
+ Stores in variable ``<var>`` either 1 or 0 indicating whether the
+ target architecture is big or little endian.
- TEST_BIG_ENDIAN(VARIABLE)
- VARIABLE - variable to store the result to
#]=======================================================================]
+include_guard()
include(CheckTypeSize)
-macro(TEST_BIG_ENDIAN VARIABLE)
+function(TEST_BIG_ENDIAN VARIABLE)
+ if(";${CMAKE_C_BYTE_ORDER};${CMAKE_CXX_BYTE_ORDER};${CMAKE_CUDA_BYTE_ORDER};${CMAKE_OBJC_BYTE_ORDER};${CMAKE_OBJCXX_BYTE_ORDER};" MATCHES ";(BIG_ENDIAN|LITTLE_ENDIAN);")
+ set(order "${CMAKE_MATCH_1}")
+ if(order STREQUAL "BIG_ENDIAN")
+ set("${VARIABLE}" 1 PARENT_SCOPE)
+ else()
+ set("${VARIABLE}" 0 PARENT_SCOPE)
+ endif()
+ else()
+ __TEST_BIG_ENDIAN_LEGACY_IMPL(is_big)
+ set("${VARIABLE}" "${is_big}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+macro(__TEST_BIG_ENDIAN_LEGACY_IMPL VARIABLE)
if(NOT DEFINED HAVE_${VARIABLE})
message(CHECK_START "Check if the system is big endian")
message(CHECK_START "Searching 16 bit integer")
@@ -119,5 +141,3 @@ macro(TEST_BIG_ENDIAN VARIABLE)
endif()
endif()
endmacro()
-
-
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index db3fb953a7..120a54c845 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -23,7 +23,8 @@ Creating And Installing JARs
[VERSION <version>]
[OUTPUT_NAME <name>]
[OUTPUT_DIR <dir>]
- [GENERATE_NATIVE_HEADERS <target> [DESTINATION <dir>]]
+ [GENERATE_NATIVE_HEADERS <target>
+ [DESTINATION (<dir>|INSTALL <dir> [BUILD <dir>])]]
)
This command creates a ``<target_name>.jar``. It compiles the given
@@ -36,17 +37,27 @@ compiling the java sources and also to the dependencies of the target.
For backwards compatibility, jar files listed as sources are ignored (as
they have been since the first version of this module).
+.. versionadded:: 3.4
+ Support for response files (prefixed by ``@``) in the ``SOURCES`` list.
+
The default ``OUTPUT_DIR`` can also be changed by setting the variable
``CMAKE_JAVA_TARGET_OUTPUT_DIR``.
-Optionally, 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 the output directory for generated
-header files.
+.. versionadded:: 3.11
+ Optionally, 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 the output directory for generated
+ header files.
+
+ ``GENERATE_NATIVE_HEADERS`` option requires, at least, version 1.8 of the JDK.
-``GENERATE_NATIVE_HEADERS`` option requires, at least, version 1.8 of the JDK.
+.. versionadded:: 3.20
+ ``DESTINATION`` sub-option now supports the possibility to specify different
+ output directories for ``BUILD`` and ``INSTALL`` steps. This is required to
+ export the interface target generated by ``GENERATE_NATIVE_HEADERS`` option.
+ If ``BUILD`` directory is not specified, a default directory will be used.
The ``add_jar()`` function sets the following target properties on
``<target_name>``:
@@ -62,6 +73,11 @@ The ``add_jar()`` function sets the following target properties on
The directory where the class files can be found. For example to use them
with ``javah``.
+.. versionadded:: 3.20
+ The target generated by option ``GENERATE_NATIVE_HEADERS`` has the property
+ ``NATIVE_HEADERS_DIRECTORY`` which specify the directory holding the native
+ headers.
+
.. code-block:: cmake
install_jar(<target_name> <destination>)
@@ -77,6 +93,9 @@ described above, and is used by ``install_jar_exports()``. You can get this
information with :command:`get_property` and the ``INSTALL_DESTINATION``
property key.
+.. versionadded:: 3.4
+ The second signature with ``DESTINATION`` and ``COMPONENT`` options.
+
.. code-block:: cmake
install_jni_symlink(<target_name> <destination>)
@@ -86,6 +105,14 @@ This command installs the ``<target_name>`` JNI symlinks to the given
``<destination>``. It should be called in the same scope as ``add_jar()`` or
it will fail.
+.. versionadded:: 3.4
+ The second signature with ``DESTINATION`` and ``COMPONENT`` options.
+
+Exporting JAR Targets
+^^^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.7
+
.. code-block:: cmake
install_jar_exports(TARGETS <jars>...
@@ -97,6 +124,9 @@ This command installs a target export file ``<filename>`` for the named jar
targets to the given ``<destination>`` directory. Its function is similar to
that of :command:`install(EXPORTS)`.
+.. versionadded:: 3.9
+ The ``NAMESPACE`` option.
+
.. code-block:: cmake
export_jars(TARGETS <jars>...
@@ -106,6 +136,9 @@ that of :command:`install(EXPORTS)`.
This command writes a target export file ``<filename>`` for the named ``<jars>``
targets. Its function is similar to that of :command:`export`.
+.. versionadded:: 3.9
+ The ``NAMESPACE`` option.
+
Examples
""""""""
@@ -196,6 +229,18 @@ native headers can then be used to compile C/C++ sources with the
add_library(bar bar.cpp)
target_link_libraries(bar PRIVATE foo-native)
+.. versionadded:: 3.20
+ It is now possible to export the target generated by
+ ``GENERATE_NATIVE_HEADERS`` option.
+
+ .. code-block:: cmake
+
+ add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native
+ DESTINATION INSTALL include)
+ install(TARGETS foo-native EXPORT native)
+ install(DIRECTORY "$<TARGET_PROPERTY:foo-native,NATIVE_HEADERS_DIRECTORY>/"
+ DESTINATION include)
+ install(EXPORT native DESTINATION /to/export NAMESPACE foo)
Finding JARs
^^^^^^^^^^^^
@@ -316,17 +361,16 @@ Header Generation
[OUTPUT_NAME <path>|OUTPUT_DIR <path>]
)
-Create C header files from java classes. These files provide the connective glue
-that allow your Java and C code to interact.
+.. versionadded:: 3.4
.. deprecated:: 3.11
-
-.. note::
-
This command will no longer be supported starting with version 10 of the JDK
due to the `suppression of javah tool <http://openjdk.java.net/jeps/313>`_.
The ``add_jar(GENERATE_NATIVE_HEADERS)`` command should be used instead.
+Create C header files from java classes. These files provide the connective glue
+that allow your Java and C code to interact.
+
There are two main signatures for ``create_javah()``. The first signature
returns generated files through variable specified by the ``GENERATED_FILES``
option. For example:
@@ -406,8 +450,8 @@ function(__java_export_jar VAR TARGET PATH)
endfunction()
# define helper scripts
-set(_JAVA_EXPORT_TARGETS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/javaTargets.cmake.in)
-set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake)
+set(_JAVA_EXPORT_TARGETS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJava/javaTargets.cmake.in)
+set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJava/Symlinks.cmake)
if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
set(_UseJava_PATH_SEP "$<SEMICOLON>")
@@ -473,7 +517,10 @@ function(add_jar _TARGET_NAME)
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})
+
+ unset (_GENERATE_NATIVE_HEADERS_OUTPUT_DESC)
+
+ 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()
@@ -484,11 +531,30 @@ function(add_jar _TARGET_NAME)
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")
+ else()
+ list (LENGTH _add_jar_GENERATE_NATIVE_HEADERS_DESTINATION length)
+ if (NOT length EQUAL 1)
+ cmake_parse_arguments (_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION "" "BUILD;INSTALL" "" "${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION}")
+ if (_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_UNPARSED_ARGUMENTS)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: DESTINATION: ${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_UNPARSED_ARGUMENTS}: unexpected argument(s).")
+ endif()
+ if (NOT _add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_INSTALL)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: DESTINATION: INSTALL sub-option is required.")
+ endif()
+ if (NOT _add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_BUILD)
+ set(_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_BUILD "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir/native_headers")
+ endif()
+ set(_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION "${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_BUILD}")
+ set(_GENERATE_NATIVE_HEADERS_OUTPUT_DESC "$<BUILD_INTERFACE:${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_BUILD}>" "$<INSTALL_INTERFACE:${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION_INSTALL}>")
+ endif()
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}")
+ if(NOT _GENERATE_NATIVE_HEADERS_OUTPUT_DESC)
+ set(_GENERATE_NATIVE_HEADERS_OUTPUT_DESC "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
+ endif()
endif()
if (LIBRARY_OUTPUT_PATH)
@@ -636,7 +702,7 @@ function(add_jar _TARGET_NAME)
COMMAND ${CMAKE_COMMAND}
-DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH}
-DCMAKE_JAR_CLASSES_PREFIX=${CMAKE_JAR_CLASSES_PREFIX}
- -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/UseJavaClassFilelist.cmake
+ -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/UseJava/ClassFilelist.cmake
DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
@@ -742,8 +808,9 @@ function(add_jar _TARGET_NAME)
# 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}"
+ "${_GENERATE_NATIVE_HEADERS_OUTPUT_DESC}"
${JNI_INCLUDE_DIRS})
+ set_property(TARGET ${_GENERATE_NATIVE_HEADERS_TARGET} PROPERTY NATIVE_HEADERS_DIRECTORY "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
# this INTERFACE library depends on jar generation
add_dependencies (${_GENERATE_NATIVE_HEADERS_TARGET} ${_TARGET_NAME})
diff --git a/Modules/UseJavaClassFilelist.cmake b/Modules/UseJava/ClassFilelist.cmake
index 1c4baa9d45..aa9e35da84 100644
--- a/Modules/UseJavaClassFilelist.cmake
+++ b/Modules/UseJava/ClassFilelist.cmake
@@ -1,18 +1,9 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#[=======================================================================[.rst:
-UseJavaClassFilelist
---------------------
-
-
-
-
-
-This script create a list of compiled Java class files to be added to
-a jar file. This avoids including cmake files which get created in
-the binary directory.
-#]=======================================================================]
+# This script creates a list of compiled Java class files to be added to
+# a jar file. This avoids including cmake files which get created in
+# the binary directory.
if (CMAKE_JAVA_CLASS_OUTPUT_PATH)
if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}")
diff --git a/Modules/UseJavaSymlinks.cmake b/Modules/UseJava/Symlinks.cmake
index 3969f54fac..2788195c97 100644
--- a/Modules/UseJavaSymlinks.cmake
+++ b/Modules/UseJava/Symlinks.cmake
@@ -1,16 +1,7 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#[=======================================================================[.rst:
-UseJavaSymlinks
----------------
-
-
-
-
-
-Helper script for UseJava.cmake
-#]=======================================================================]
+# Helper script for UseJava.cmake
if (UNIX AND _JAVA_TARGET_OUTPUT_LINK)
if (_JAVA_TARGET_OUTPUT_NAME)
diff --git a/Modules/javaTargets.cmake.in b/Modules/UseJava/javaTargets.cmake.in
index c5f9c78354..6e14256a13 100644
--- a/Modules/javaTargets.cmake.in
+++ b/Modules/UseJava/javaTargets.cmake.in
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8.12)
cmake_policy(PUSH)
cmake_policy(VERSION 2.8)
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 757e5392b1..7d7f7377c5 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -12,6 +12,8 @@ Defines the following command for use with ``SWIG``:
.. command:: swig_add_library
+ .. versionadded:: 3.8
+
Define swig module with given name and specified language::
swig_add_library(<name>
@@ -28,13 +30,16 @@ Defines the following command for use with ``SWIG``:
those targets can be used with any command expecting a target (e.g.
:command:`target_link_libraries`).
- .. note::
-
+ .. versionchanged:: 3.13
This command creates a target with the specified ``<name>`` when
policy :policy:`CMP0078` is set to ``NEW``. Otherwise, the legacy
behavior will choose a different target name and store it in the
``SWIG_MODULE_<name>_REAL_NAME`` variable.
+ .. versionchanged:: 3.15
+ Alternate library name (set with the :prop_tgt:`OUTPUT_NAME` property,
+ for example) will be passed on to Python and CSharp wrapper libraries.
+
.. note::
For multi-config generators, this module does not support
@@ -43,11 +48,12 @@ Defines the following command for use with ``SWIG``:
.. note::
- For Make-based generators, ``swig_add_library`` does not track file
- dependencies, so depending on the ``<name>_swig_compilation`` custom target
- is required for targets which require the ``swig``-generated files to
- exist. Other generators may depend on the source files that would be
- generated by SWIG.
+ For :ref:`Makefile Generators`, if, for some sources, the
+ ``USE_SWIG_DEPENDENCIES`` property is ``FALSE``, ``swig_add_library`` does
+ not track file dependencies, so depending on the ``<name>_swig_compilation``
+ custom target is required for targets which require the ``swig``-generated
+ files to exist. Other generators may depend on the source files that would
+ be generated by SWIG.
``TYPE``
``SHARED``, ``MODULE`` and ``STATIC`` have the same semantic as for the
@@ -59,10 +65,23 @@ Defines the following command for use with ``SWIG``:
``LANGUAGE``
Specify the target language.
+ .. versionadded:: 3.1
+ Go and Lua language support.
+
+ .. versionadded:: 3.2
+ R language support.
+
+ .. versionadded:: 3.18
+ Fortran language support.
+
``NO_PROXY``
+ .. versionadded:: 3.12
+
Prevent the generation of the wrapper layer (swig ``-noproxy`` option).
``OUTPUT_DIR``
+ .. versionadded:: 3.12
+
Specify where to write the language specific files (swig ``-outdir``
option). If not given, the ``CMAKE_SWIG_OUTDIR`` variable will be used.
If neither is specified, the default depends on the value of the
@@ -75,6 +94,8 @@ Defines the following command for use with ``SWIG``:
``SWIG_SUPPORT_FILES_DIRECTORY`` target property.
``OUTFILE_DIR``
+ .. versionadded:: 3.12
+
Specify an output directory name where the generated source file will be
placed (swig ``-o`` option). If not specified, the ``SWIG_OUTFILE_DIR``
variable will be used. If neither is specified, ``OUTPUT_DIR`` or
@@ -83,8 +104,11 @@ Defines the following command for use with ``SWIG``:
``SOURCES``
List of sources for the library. Files with extension ``.i`` will be
identified as sources for the ``SWIG`` tool. Other files will be handled in
- the standard way. This behavior can be overridden by specifying the variable
- ``SWIG_SOURCE_FILE_EXTENSIONS``.
+ the standard way.
+
+ .. versionadded:: 3.14
+ This behavior can be overridden by specifying the variable
+ ``SWIG_SOURCE_FILE_EXTENSIONS``.
.. note::
@@ -122,12 +146,22 @@ ensure generated files will receive the required settings.
set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON)
swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
+``SWIG_FLAGS``
+ .. deprecated:: 3.12
+ Replaced with the fine-grained properties that follow.
+
+ Pass custom flags to the SWIG executable.
+
``INCLUDE_DIRECTORIES``, ``COMPILE_DEFINITIONS`` and ``COMPILE_OPTIONS``
+ .. versionadded:: 3.12
+
Add custom flags to SWIG compiler and have same semantic as properties
:prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
:prop_sf:`COMPILE_OPTIONS`.
``USE_TARGET_INCLUDE_DIRECTORIES``
+ .. versionadded:: 3.13
+
If set to ``TRUE``, contents of target property
:prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler.
If set to ``FALSE`` target property :prop_tgt:`INCLUDE_DIRECTORIES` will be
@@ -135,13 +169,25 @@ ensure generated files will receive the required settings.
will be considered.
``GENERATED_INCLUDE_DIRECTORIES``, ``GENERATED_COMPILE_DEFINITIONS`` and ``GENERATED_COMPILE_OPTIONS``
+ .. versionadded:: 3.12
+
Add custom flags to the C/C++ generated source. They will fill, respectively,
properties :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
:prop_sf:`COMPILE_OPTIONS` of generated C/C++ file.
``DEPENDS``
+ .. versionadded:: 3.12
+
Specify additional dependencies to the source file.
+``USE_SWIG_DEPENDENCIES``
+ .. versionadded:: 3.20
+
+ If set to ``TRUE``, implicit dependencies are generated by the ``swig`` tool
+ itself. This property is only meaningful for
+ :ref:`Makefile <Makefile Generators>` and
+ :ref:`Ninja <Ninja Generators>` generators. Default value is ``FALSE``.
+
``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
@@ -151,18 +197,21 @@ ensure generated files will receive the required settings.
set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname)
- .. note::
-
+ .. versionchanged:: 3.14
If policy :policy:`CMP0086` is set to ``NEW``, ``-module <module_name>``
is passed to ``SWIG`` compiler.
``OUTPUT_DIR``
+ .. versionadded:: 3.19
+
Specify where to write the language specific files (swig ``-outdir`` option)
for the considered source file. If not specified, the other ways to define
the output directory applies (see ``OUTPUT_DIR`` option of
``swig_add_library()`` command).
``OUTFILE_DIR``
+ .. versionadded:: 3.19
+
Specify an output directory where the generated source file will be placed
(swig ``-o`` option) for the considered source file. If not specified,
``OUTPUT_DIR`` source property will be used. If neither are specified, the
@@ -173,6 +222,8 @@ Target library properties can be set to apply same configuration to all SWIG
input files.
``SWIG_INCLUDE_DIRECTORIES``, ``SWIG_COMPILE_DEFINITIONS`` and ``SWIG_COMPILE_OPTIONS``
+ .. versionadded:: 3.12
+
These properties will be applied to all SWIG input files and have same
semantic as target properties :prop_tgt:`INCLUDE_DIRECTORIES`,
:prop_tgt:`COMPILE_DEFINITIONS` and :prop_tgt:`COMPILE_OPTIONS`.
@@ -185,6 +236,8 @@ input files.
set_property(TARGET mymod PROPERTY SWIG_COMPILE_OPTIONS -bla -blb)
``SWIG_USE_TARGET_INCLUDE_DIRECTORIES``
+ .. versionadded:: 3.13
+
If set to ``TRUE``, contents of target property
:prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler.
If set to ``FALSE`` or not defined, target property
@@ -192,17 +245,23 @@ input files.
overridden by specifying source property ``USE_TARGET_INCLUDE_DIRECTORIES``.
``SWIG_GENERATED_INCLUDE_DIRECTORIES``, ``SWIG_GENERATED_COMPILE_DEFINITIONS`` and ``SWIG_GENERATED_COMPILE_OPTIONS``
+ .. versionadded:: 3.12
+
These properties will populate, respectively, properties
:prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
:prop_sf:`COMPILE_FLAGS` of all generated C/C++ files.
``SWIG_DEPENDS``
+ .. versionadded:: 3.12
+
Add dependencies to all SWIG input files.
The following target properties are output properties and can be used to get
information about support files generated by ``SWIG`` interface compilation.
``SWIG_SUPPORT_FILES``
+ .. versionadded:: 3.12
+
This output property list of wrapper files generated during SWIG compilation.
.. code-block:: cmake
@@ -219,6 +278,8 @@ information about support files generated by ``SWIG`` interface compilation.
``SWIG_SUPPORT_FILES_DIRECTORY`` property to handle support files.
``SWIG_SUPPORT_FILES_DIRECTORY``
+ .. versionadded:: 3.12
+
This output property specifies the directory where support files will be
generated.
@@ -231,6 +292,8 @@ Some variables can be set to customize the behavior of ``swig_add_library``
as well as ``SWIG``:
``UseSWIG_MODULE_VERSION``
+ .. versionadded:: 3.12
+
Specify different behaviors for ``UseSWIG`` module.
* Set to 1 or undefined: Legacy behavior is applied.
@@ -244,6 +307,8 @@ as well as ``SWIG``:
Specify where to write the language specific files (swig ``-outdir`` option).
``SWIG_OUTFILE_DIR``
+ .. versionadded:: 3.8
+
Specify an output directory name where the generated source file will be
placed. If not specified, ``CMAKE_SWIG_OUTDIR`` is used.
@@ -251,6 +316,8 @@ as well as ``SWIG``:
Specify extra dependencies for the generated module for ``<name>``.
``SWIG_SOURCE_FILE_EXTENSIONS``
+ .. versionadded:: 3.14
+
Specify a list of source file extensions to override the default
behavior of considering only ``.i`` files as sources for the ``SWIG``
tool. For example:
@@ -258,6 +325,17 @@ as well as ``SWIG``:
.. code-block:: cmake
set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swg")
+
+``SWIG_USE_SWIG_DEPENDENCIES``
+ .. versionadded:: 3.20
+
+ If set to ``TRUE``, implicit dependencies are generated by the ``swig`` tool
+ itself. This property is only meaningful for
+ :ref:`Makefile <Makefile Generators>` and
+ :ref:`Ninja <Ninja Generators>` generators. Default value is ``FALSE``.
+
+ Source file property ``USE_SWIG_DEPENDENCIES``, if not defined, will be
+ initialized with the value of this variable.
#]=======================================================================]
cmake_policy(GET CMP0078 target_name_policy)
@@ -428,6 +506,14 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
set(target_name ${name})
endif()
+ set (use_swig_dependencies ${SWIG_USE_SWIG_DEPENDENCIES})
+ if (CMAKE_GENERATOR MATCHES "Make|Ninja")
+ get_property(use_swig_dependencies_set SOURCE "${infile}" PROPERTY USE_SWIG_DEPENDENCIES SET)
+ if (use_swig_dependencies_set)
+ get_property(use_swig_dependencies SOURCE "${infile}" PROPERTY USE_SWIG_DEPENDENCIES)
+ endif()
+ endif()
+
set (swig_source_file_flags ${CMAKE_SWIG_FLAGS})
# handle various swig compile flags properties
get_source_file_property (include_directories "${infile}" INCLUDE_DIRECTORIES)
@@ -533,7 +619,7 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
list (APPEND swig_extra_flags ${SWIG_MODULE_${name}_EXTRA_FLAGS})
# dependencies
- set (swig_dependencies ${SWIG_MODULE_${name}_EXTRA_DEPS} $<TARGET_PROPERTY:${target_name},SWIG_DEPENDS>)
+ set (swig_dependencies DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS} $<TARGET_PROPERTY:${target_name},SWIG_DEPENDS>)
get_source_file_property(file_depends "${infile}" DEPENDS)
if (file_depends)
list (APPEND swig_dependencies ${file_depends})
@@ -551,10 +637,11 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
unset (swig_copy_command)
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")
+ set(swig_depends_flags)
+ if(NOT use_swig_dependencies AND CMAKE_GENERATOR MATCHES "Make")
+ # IMPLICIT_DEPENDS 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
__swig_compute_timestamp(${name} ${SWIG_MODULE_${name}_LANGUAGE}
"${infile}" "${workingdir}" swig_generated_timestamp)
set(swig_custom_output "${swig_generated_timestamp}")
@@ -562,11 +649,19 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
BYPRODUCTS "${swig_generated_file_fullname}" ${swig_extra_generated_files})
set(swig_timestamp_command
COMMAND ${CMAKE_COMMAND} -E touch "${swig_generated_timestamp}")
+ list(APPEND swig_dependencies IMPLICIT_DEPENDS CXX "${swig_source_file_fullname}")
else()
+ set(swig_generated_timestamp)
set(swig_custom_output
"${swig_generated_file_fullname}" ${swig_extra_generated_files})
set(swig_custom_products)
set(swig_timestamp_command)
+ if (use_swig_dependencies)
+ cmake_path(GET infile FILENAME swig_depends_filename)
+ set(swig_depends_filename "${workingdir}/${swig_depends_filename}.d")
+ list(APPEND swig_dependencies DEPFILE "${swig_depends_filename}")
+ set(swig_depends_flags -MF "${swig_depends_filename}" -MD)
+ endif()
endif()
add_custom_command(
OUTPUT ${swig_custom_output}
@@ -581,13 +676,13 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
-outdir "${swig_file_outdir}"
${swig_special_flags}
${swig_extra_flags}
+ ${swig_depends_flags}
"${swig_include_dirs}"
-o "${swig_generated_file_fullname}"
"${swig_source_file_fullname}"
${swig_copy_command}
MAIN_DEPENDENCY "${swig_source_file_fullname}"
- DEPENDS ${swig_dependencies}
- IMPLICIT_DEPENDS CXX "${swig_source_file_fullname}"
+ ${swig_dependencies}
COMMENT "Swig compile ${infile} for ${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
COMMAND_EXPAND_LISTS)
set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files}
@@ -608,6 +703,7 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
endif()
set(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files} PARENT_SCOPE)
+ set(swig_timestamp "${swig_generated_timestamp}" PARENT_SCOPE)
# legacy support
set (swig_generated_file_fullname "${swig_generated_file_fullname}" PARENT_SCOPE)
@@ -736,6 +832,15 @@ function(SWIG_ADD_LIBRARY name)
set(SWIG_SOURCE_FILE_EXTENSIONS ".i")
endif()
+ if (CMAKE_GENERATOR MATCHES "Make|Ninja")
+ # For Makefiles and Ninja generators, use SWIG generated dependencies
+ if (NOT DEFINED SWIG_USE_SWIG_DEPENDENCIES)
+ set (SWIG_USE_SWIG_DEPENDENCIES OFF)
+ endif()
+ else()
+ set (SWIG_USE_SWIG_DEPENDENCIES OFF)
+ endif()
+
# Generate a regex out of file extensions.
string(REGEX REPLACE "([$^.*+?|()-])" "\\\\\\1" swig_source_ext_regex "${SWIG_SOURCE_FILE_EXTENSIONS}")
list (JOIN swig_source_ext_regex "|" swig_source_ext_regex)
@@ -763,9 +868,7 @@ function(SWIG_ADD_LIBRARY name)
foreach(swig_it IN LISTS swig_dot_i_sources)
SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source "${swig_it}")
list (APPEND swig_generated_sources "${swig_generated_source}")
- if(CMAKE_GENERATOR MATCHES "Make")
- __swig_compute_timestamp(${name} ${SWIG_MODULE_${name}_LANGUAGE} "${swig_it}"
- "${workingdir}" swig_timestamp)
+ if(swig_timestamp)
list (APPEND swig_generated_timestamps "${swig_timestamp}")
endif()
get_source_file_property(swig_source_file_outdir "${swig_it}" OUTPUT_DIR)
@@ -784,7 +887,7 @@ function(SWIG_ADD_LIBRARY name)
${_SAM_TYPE}
${swig_generated_sources}
${swig_other_sources})
- if(CMAKE_GENERATOR MATCHES "Make")
+ if(swig_generated_timestamps)
# see IMPLICIT_DEPENDS above
add_custom_target(${name}_swig_compilation DEPENDS ${swig_generated_timestamps})
add_dependencies(${target_name} ${name}_swig_compilation)
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 5100035b39..5e6828f3bb 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -5,6 +5,10 @@
WriteCompilerDetectionHeader
----------------------------
+.. deprecated:: 3.20
+ This module is available only if policy :policy:`CMP0120`
+ is not set to ``NEW``. Do not use it in new code.
+
.. versionadded:: 3.1
This module provides the function ``write_compiler_detection_header()``.
@@ -80,19 +84,28 @@ Possible compiler identifiers are documented with the
Available features in this version of CMake are listed in the
:prop_gbl:`CMAKE_C_KNOWN_FEATURES` and
:prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` global properties.
-The ``{c,cxx}_std_*`` meta-features are ignored if requested.
-
See the :manual:`cmake-compile-features(7)` manual for information on
compile features.
-``BARE_FEATURES`` will define the compatibility macros with the name used in
-newer versions of the language standard, so the code can use the new feature
-name unconditionally.
+.. versionadded:: 3.2
+ Added ``MSVC`` and ``AppleClang`` compiler support.
+
+.. versionadded:: 3.6
+ Added ``Intel`` compiler support.
+
+.. versionchanged:: 3.8
+ The ``{c,cxx}_std_*`` meta-features are ignored if requested.
-``ALLOW_UNKNOWN_COMPILERS`` and ``ALLOW_UNKNOWN_COMPILER_VERSIONS`` cause
-the module to generate conditions that treat unknown compilers as simply
-lacking all features. Without these options the default behavior is to
-generate a ``#error`` for unknown compilers and versions.
+.. versionadded:: 3.8
+ ``ALLOW_UNKNOWN_COMPILERS`` and ``ALLOW_UNKNOWN_COMPILER_VERSIONS`` cause
+ the module to generate conditions that treat unknown compilers as simply
+ lacking all features. Without these options the default behavior is to
+ generate a ``#error`` for unknown compilers and versions.
+
+.. versionadded:: 3.12
+ ``BARE_FEATURES`` will define the compatibility macros with the name used in
+ newer versions of the language standard, so the code can use the new feature
+ name unconditionally.
Feature Test Macros
===================
@@ -234,6 +247,18 @@ library:
)
#]=======================================================================]
+# Guard against inclusion by absolute path.
+cmake_policy(GET CMP0120 _WCDH_policy)
+if(_WCDH_policy STREQUAL "NEW")
+ message(FATAL_ERROR "The WriteCompilerDetectionHeader module has been removed by policy CMP0120.")
+elseif(_WCDH_policy STREQUAL "")
+ message(AUTHOR_WARNING
+ "The WriteCompilerDetectionHeader module will be removed by policy CMP0120. "
+ "Projects should be ported away from the module, perhaps by bundling a copy "
+ "of the generated header or using a third-party alternative."
+ )
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerIdDetection.cmake)
function(_load_compiler_variables CompilerId lang)