summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/AddFileDependencies.cmake19
-rw-r--r--Modules/AndroidTestUtilities.cmake2
-rw-r--r--Modules/BasicConfigVersion-AnyNewerVersion.cmake.in6
-rw-r--r--Modules/BasicConfigVersion-ExactVersion.cmake.in5
-rw-r--r--Modules/BasicConfigVersion-SameMajorVersion.cmake.in5
-rw-r--r--Modules/BasicConfigVersion-SameMinorVersion.cmake.in5
-rw-r--r--Modules/BundleUtilities.cmake81
-rw-r--r--Modules/CMakeASMCompiler.cmake.in1
-rw-r--r--Modules/CMakeAddFortranSubdirectory.cmake81
-rw-r--r--Modules/CMakeBackwardCompatibilityC.cmake4
-rw-r--r--Modules/CMakeBackwardCompatibilityCXX.cmake32
-rw-r--r--Modules/CMakeCCompiler.cmake.in2
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in4
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in2
-rw-r--r--Modules/CMakeCXXInformation.cmake7
-rw-r--r--Modules/CMakeCompilerABI.h8
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake6
-rw-r--r--Modules/CMakeDependentOption.cmake43
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake6
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake7
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake5
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake7
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake47
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake143
-rw-r--r--Modules/CMakeDetermineSystem.cmake1
-rw-r--r--Modules/CMakeDetermineVSServicePack.cmake64
-rw-r--r--Modules/CMakeExpandImportedTargets.cmake73
-rw-r--r--Modules/CMakeFindBinUtils.cmake53
-rw-r--r--Modules/CMakeFindFrameworks.cmake19
-rw-r--r--Modules/CMakeFindPackageMode.cmake55
-rw-r--r--Modules/CMakeForceCompiler.cmake129
-rw-r--r--Modules/CMakeFortranCompiler.cmake.in1
-rw-r--r--Modules/CMakeFortranCompilerABI.F8
-rw-r--r--Modules/CMakeFortranCompilerId.F.in16
-rw-r--r--Modules/CMakeFortranInformation.cmake6
-rw-r--r--Modules/CMakeGenericSystem.cmake2
-rw-r--r--Modules/CMakeGraphVizOptions.cmake239
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake420
-rw-r--r--Modules/CMakeParseArguments.cmake17
-rw-r--r--Modules/CMakeParseImplicitIncludeInfo.cmake237
-rw-r--r--Modules/CMakePlatformId.h.in31
-rw-r--r--Modules/CMakePrintHelpers.cmake82
-rw-r--r--Modules/CMakePrintSystemInformation.cmake17
-rw-r--r--Modules/CMakePushCheckState.cmake97
-rw-r--r--Modules/CMakeTestCCompiler.cmake10
-rw-r--r--Modules/CMakeTestCXXCompiler.cmake10
-rw-r--r--Modules/CMakeTestCompilerCommon.cmake20
-rw-r--r--Modules/CMakeVerifyManifest.cmake33
-rw-r--r--Modules/CPack.background.png.inbin47076 -> 44108 bytes
-rw-r--r--Modules/CPack.cmake33
-rw-r--r--Modules/CPackComponent.cmake615
-rw-r--r--Modules/CPackIFW.cmake8
-rw-r--r--Modules/CPackIFWConfigureFile.cmake53
-rw-r--r--Modules/CTest.cmake22
-rw-r--r--Modules/CTestCoverageCollectGCOV.cmake127
-rw-r--r--Modules/CTestScriptMode.cmake15
-rw-r--r--Modules/CTestUseLaunchers.cmake53
-rw-r--r--Modules/CheckCCompilerFlag.cmake2
-rw-r--r--Modules/CheckCSourceCompiles.cmake31
-rw-r--r--Modules/CheckCSourceRuns.cmake36
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake3
-rw-r--r--Modules/CheckCXXSourceCompiles.cmake31
-rw-r--r--Modules/CheckCXXSourceRuns.cmake43
-rw-r--r--Modules/CheckCXXSymbolExists.cmake73
-rw-r--r--Modules/CheckFortranCompilerFlag.cmake2
-rw-r--r--Modules/CheckFortranFunctionExists.cmake61
-rw-r--r--Modules/CheckFortranSourceCompiles.cmake57
-rw-r--r--Modules/CheckFortranSourceRuns.cmake175
-rw-r--r--Modules/CheckFunctionExists.cmake91
-rw-r--r--Modules/CheckIPOSupported.cmake2
-rw-r--r--Modules/CheckIncludeFile.cmake80
-rw-r--r--Modules/CheckIncludeFileCXX.cmake78
-rw-r--r--Modules/CheckIncludeFiles.cmake90
-rw-r--r--Modules/CheckLanguage.cmake59
-rw-r--r--Modules/CheckLibraryExists.cmake66
-rw-r--r--Modules/CheckPIESupported.cmake134
-rw-r--r--Modules/CheckPrototypeDefinition.cmake89
-rw-r--r--Modules/CheckStructHasMember.cmake79
-rw-r--r--Modules/CheckSymbolExists.cmake23
-rw-r--r--Modules/CheckTypeSize.cmake137
-rw-r--r--Modules/CheckVariableExists.cmake70
-rw-r--r--Modules/Compiler/Clang.cmake6
-rw-r--r--Modules/Compiler/Cray-CXX.cmake2
-rw-r--r--Modules/Compiler/CrayPrgEnv-C.cmake6
-rw-r--r--Modules/Compiler/CrayPrgEnv-CXX.cmake6
-rw-r--r--Modules/Compiler/CrayPrgEnv-Cray-C.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv-Fortran.cmake6
-rw-r--r--Modules/Compiler/CrayPrgEnv-GNU-C.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv-Intel-C.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv-PGI-C.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake7
-rw-r--r--Modules/Compiler/CrayPrgEnv.cmake57
-rw-r--r--Modules/Compiler/Flang-Fortran.cmake3
-rw-r--r--Modules/Compiler/GHS-C.cmake20
-rw-r--r--Modules/Compiler/GHS-CXX.cmake24
-rw-r--r--Modules/Compiler/GHS-DetermineCompiler.cmake11
-rw-r--r--Modules/Compiler/GHS.cmake6
-rw-r--r--Modules/Compiler/GNU-Fortran.cmake3
-rw-r--r--Modules/Compiler/GNU.cmake7
-rw-r--r--Modules/Compiler/IAR-C.cmake13
-rw-r--r--Modules/Compiler/IAR-CXX.cmake21
-rw-r--r--Modules/Compiler/IAR-DetermineCompiler.cmake22
-rw-r--r--Modules/Compiler/IAR.cmake21
-rw-r--r--Modules/Compiler/Intel-Fortran.cmake3
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake1
-rw-r--r--Modules/Compiler/PGI-Fortran.cmake3
-rw-r--r--Modules/Compiler/QCC-ASM.cmake2
-rw-r--r--Modules/Compiler/QCC-C-FeatureTests.cmake1
-rw-r--r--Modules/Compiler/QCC-C.cmake3
-rw-r--r--Modules/Compiler/QCC-CXX-FeatureTests.cmake1
-rw-r--r--Modules/Compiler/QCC-CXX.cmake3
-rw-r--r--Modules/Compiler/SunPro-C.cmake4
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake4
-rw-r--r--Modules/Compiler/SunPro-Fortran.cmake4
-rw-r--r--Modules/Compiler/XL-Fortran.cmake3
-rw-r--r--Modules/Compiler/XL.cmake2
-rw-r--r--Modules/CompilerId/GHS_default.gpj.in8
-rw-r--r--Modules/CompilerId/GHS_lib.gpj.in3
-rw-r--r--Modules/CompilerId/Xcode-3.pbxproj.in4
-rw-r--r--Modules/Dart.cmake43
-rw-r--r--Modules/DartConfiguration.tcl.in12
-rw-r--r--Modules/DeployQt4.cmake12
-rw-r--r--Modules/Documentation.cmake15
-rw-r--r--Modules/ExternalProject.cmake142
-rw-r--r--Modules/FeatureSummary.cmake2
-rw-r--r--Modules/FetchContent.cmake291
-rw-r--r--Modules/FetchContent/CMakeLists.cmake.in2
-rw-r--r--Modules/FindALSA.cmake77
-rw-r--r--Modules/FindASPELL.cmake31
-rw-r--r--Modules/FindAVIFile.cmake35
-rw-r--r--Modules/FindArmadillo.cmake59
-rw-r--r--Modules/FindBISON.cmake197
-rw-r--r--Modules/FindBLAS.cmake259
-rw-r--r--Modules/FindBZip2.cmake71
-rw-r--r--Modules/FindBacktrace.cmake71
-rw-r--r--Modules/FindBoost.cmake510
-rw-r--r--Modules/FindBullet.cmake67
-rw-r--r--Modules/FindCABLE.cmake43
-rw-r--r--Modules/FindCUDA.cmake767
-rw-r--r--Modules/FindCURL.cmake134
-rw-r--r--Modules/FindCVS.cmake43
-rw-r--r--Modules/FindCoin3D.cmake33
-rw-r--r--Modules/FindCups.cmake33
-rw-r--r--Modules/FindCurses.cmake81
-rw-r--r--Modules/FindCxxTest.cmake273
-rw-r--r--Modules/FindCygwin.cmake11
-rw-r--r--Modules/FindDCMTK.cmake154
-rw-r--r--Modules/FindDart.cmake17
-rw-r--r--Modules/FindDevIL.cmake59
-rw-r--r--Modules/FindDoxygen.cmake19
-rw-r--r--Modules/FindEXPAT.cmake53
-rw-r--r--Modules/FindFLEX.cmake189
-rw-r--r--Modules/FindFLTK.cmake153
-rw-r--r--Modules/FindFLTK2.cmake47
-rw-r--r--Modules/FindFontconfig.cmake101
-rw-r--r--Modules/FindFreetype.cmake79
-rw-r--r--Modules/FindGCCXML.cmake27
-rw-r--r--Modules/FindGDAL.cmake86
-rw-r--r--Modules/FindGIF.cmake85
-rw-r--r--Modules/FindGLEW.cmake45
-rw-r--r--Modules/FindGLUT.cmake65
-rw-r--r--Modules/FindGSL.cmake109
-rw-r--r--Modules/FindGTK.cmake25
-rw-r--r--Modules/FindGTK2.cmake193
-rw-r--r--Modules/FindGTest.cmake143
-rw-r--r--Modules/FindGettext.cmake111
-rw-r--r--Modules/FindGit.cmake55
-rw-r--r--Modules/FindGnuTLS.cmake33
-rw-r--r--Modules/FindGnuplot.cmake39
-rw-r--r--Modules/FindHDF5.cmake251
-rw-r--r--Modules/FindHSPELL.cmake45
-rw-r--r--Modules/FindHTMLHelp.cmake27
-rw-r--r--Modules/FindHg.cmake79
-rw-r--r--Modules/FindICU.cmake183
-rw-r--r--Modules/FindIce.cmake285
-rw-r--r--Modules/FindIcotool.cmake29
-rw-r--r--Modules/FindImageMagick.cmake163
-rw-r--r--Modules/FindIntl.cmake55
-rw-r--r--Modules/FindJNI.cmake99
-rw-r--r--Modules/FindJPEG.cmake133
-rw-r--r--Modules/FindJasper.cmake29
-rw-r--r--Modules/FindJava.cmake147
-rw-r--r--Modules/FindKDE3.cmake271
-rw-r--r--Modules/FindKDE4.cmake47
-rw-r--r--Modules/FindLAPACK.cmake271
-rw-r--r--Modules/FindLATEX.cmake101
-rw-r--r--Modules/FindLTTngUST.cmake63
-rw-r--r--Modules/FindLibArchive.cmake29
-rw-r--r--Modules/FindLibLZMA.cmake73
-rw-r--r--Modules/FindLibXml2.cmake83
-rw-r--r--Modules/FindLibXslt.cmake47
-rw-r--r--Modules/FindLibinput.cmake82
-rw-r--r--Modules/FindLua.cmake69
-rw-r--r--Modules/FindLua50.cmake61
-rw-r--r--Modules/FindLua51.cmake63
-rw-r--r--Modules/FindMFC.cmake29
-rw-r--r--Modules/FindMPEG.cmake41
-rw-r--r--Modules/FindMPEG2.cmake41
-rw-r--r--Modules/FindMPI.cmake483
-rw-r--r--Modules/FindMatlab.cmake1082
-rw-r--r--Modules/FindMotif.cmake27
-rw-r--r--Modules/FindODBC.cmake4
-rw-r--r--Modules/FindOpenAL.cmake31
-rw-r--r--Modules/FindOpenCL.cmake59
-rw-r--r--Modules/FindOpenGL.cmake245
-rw-r--r--Modules/FindOpenMP.cmake145
-rw-r--r--Modules/FindOpenSSL.cmake95
-rw-r--r--Modules/FindOpenSceneGraph.cmake193
-rw-r--r--Modules/FindOpenThreads.cmake49
-rw-r--r--Modules/FindPHP4.cmake29
-rw-r--r--Modules/FindPNG.cmake87
-rw-r--r--Modules/FindPackageMessage.cmake59
-rw-r--r--Modules/FindPatch.cmake49
-rw-r--r--Modules/FindPerl.cmake27
-rw-r--r--Modules/FindPerlLibs.cmake83
-rw-r--r--Modules/FindPhysFS.cmake29
-rw-r--r--Modules/FindPike.cmake29
-rw-r--r--Modules/FindPkgConfig.cmake94
-rw-r--r--Modules/FindPostgreSQL.cmake76
-rw-r--r--Modules/FindProducer.cmake59
-rw-r--r--Modules/FindProtobuf.cmake237
-rw-r--r--Modules/FindPython.cmake30
-rw-r--r--Modules/FindPython/Support.cmake268
-rw-r--r--Modules/FindPython2.cmake30
-rw-r--r--Modules/FindPython3.cmake30
-rw-r--r--Modules/FindPythonInterp.cmake91
-rw-r--r--Modules/FindPythonLibs.cmake85
-rw-r--r--Modules/FindQt.cmake71
-rw-r--r--Modules/FindQt3.cmake63
-rw-r--r--Modules/FindQt4.cmake597
-rw-r--r--Modules/FindQuickTime.cmake29
-rw-r--r--Modules/FindRTI.cmake63
-rw-r--r--Modules/FindRuby.cmake63
-rw-r--r--Modules/FindSDL.cmake139
-rw-r--r--Modules/FindSDL_image.cmake69
-rw-r--r--Modules/FindSDL_mixer.cmake69
-rw-r--r--Modules/FindSDL_net.cmake67
-rw-r--r--Modules/FindSDL_sound.cmake157
-rw-r--r--Modules/FindSDL_ttf.cmake67
-rw-r--r--Modules/FindSQLite3.cmake66
-rw-r--r--Modules/FindSWIG.cmake47
-rw-r--r--Modules/FindSelfPackers.cmake27
-rw-r--r--Modules/FindSquish.cmake235
-rw-r--r--Modules/FindSubversion.cmake125
-rw-r--r--Modules/FindTCL.cmake85
-rw-r--r--Modules/FindTIFF.cmake75
-rw-r--r--Modules/FindTclStub.cmake85
-rw-r--r--Modules/FindTclsh.cmake35
-rw-r--r--Modules/FindThreads.cmake154
-rw-r--r--Modules/FindUnixCommands.cmake17
-rw-r--r--Modules/FindVulkan.cmake53
-rw-r--r--Modules/FindWget.cmake25
-rw-r--r--Modules/FindWish.cmake35
-rw-r--r--Modules/FindX11.cmake513
-rw-r--r--Modules/FindXMLRPC.cmake59
-rw-r--r--Modules/FindXalanC.cmake81
-rw-r--r--Modules/FindXercesC.cmake77
-rw-r--r--Modules/FindZLIB.cmake95
-rw-r--r--Modules/Findosg.cmake73
-rw-r--r--Modules/FindosgAnimation.cmake61
-rw-r--r--Modules/FindosgDB.cmake61
-rw-r--r--Modules/FindosgFX.cmake61
-rw-r--r--Modules/FindosgGA.cmake61
-rw-r--r--Modules/FindosgIntrospection.cmake63
-rw-r--r--Modules/FindosgManipulator.cmake63
-rw-r--r--Modules/FindosgParticle.cmake61
-rw-r--r--Modules/FindosgPresentation.cmake65
-rw-r--r--Modules/FindosgProducer.cmake61
-rw-r--r--Modules/FindosgQt.cmake61
-rw-r--r--Modules/FindosgShadow.cmake61
-rw-r--r--Modules/FindosgSim.cmake61
-rw-r--r--Modules/FindosgTerrain.cmake61
-rw-r--r--Modules/FindosgText.cmake61
-rw-r--r--Modules/FindosgUtil.cmake61
-rw-r--r--Modules/FindosgViewer.cmake61
-rw-r--r--Modules/FindosgVolume.cmake61
-rw-r--r--Modules/FindosgWidget.cmake63
-rw-r--r--Modules/Findosg_functions.cmake23
-rw-r--r--Modules/FindwxWidgets.cmake251
-rw-r--r--Modules/FindwxWindows.cmake159
-rw-r--r--Modules/GNUInstallDirs.cmake253
-rw-r--r--Modules/GenerateExportHeader.cmake367
-rw-r--r--Modules/GetPrerequisites.cmake365
-rw-r--r--Modules/GoogleTestAddTests.cmake1
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake109
-rw-r--r--Modules/Internal/CMakeCheckCompilerFlag.cmake158
-rw-r--r--Modules/Internal/CPack/CPackDeb.cmake9
-rw-r--r--Modules/MacroAddFileDependencies.cmake27
-rw-r--r--Modules/Platform/Android/abi-common.cmake4
-rw-r--r--Modules/Platform/CYGWIN-GNU.cmake3
-rw-r--r--Modules/Platform/Darwin-Initialize.cmake8
-rw-r--r--Modules/Platform/Darwin.cmake10
-rw-r--r--Modules/Platform/DragonFly.cmake4
-rw-r--r--Modules/Platform/FreeBSD.cmake3
-rw-r--r--Modules/Platform/Fuchsia.cmake3
-rw-r--r--Modules/Platform/GHS-MULTI-Initialize.cmake8
-rw-r--r--Modules/Platform/Haiku.cmake1
-rw-r--r--Modules/Platform/IRIX.cmake53
-rw-r--r--Modules/Platform/IRIX64.cmake73
-rw-r--r--Modules/Platform/Linux-Intel.cmake6
-rw-r--r--Modules/Platform/Linux-PGI.cmake3
-rw-r--r--Modules/Platform/Linux.cmake1
-rw-r--r--Modules/Platform/NetBSD.cmake2
-rw-r--r--Modules/Platform/OpenBSD.cmake4
-rw-r--r--Modules/Platform/SINIX.cmake3
-rw-r--r--Modules/Platform/SunOS-GNU.cmake1
-rw-r--r--Modules/Platform/UNIX_SV.cmake3
-rw-r--r--Modules/Platform/UnixPaths.cmake25
-rw-r--r--Modules/Platform/UnixWare.cmake3
-rw-r--r--Modules/Platform/Windows-GNU.cmake3
-rw-r--r--Modules/Platform/Windows-Intel-C.cmake2
-rw-r--r--Modules/Platform/Windows-Intel-CXX.cmake2
-rw-r--r--Modules/Platform/Windows-MSVC.cmake9
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake6
-rw-r--r--Modules/Platform/iOS-Determine-CXX.cmake1
-rw-r--r--Modules/Platform/iOS-Initialize.cmake9
-rw-r--r--Modules/Platform/iOS.cmake1
-rw-r--r--Modules/Platform/tvOS-Determine-CXX.cmake1
-rw-r--r--Modules/Platform/tvOS-Initialize.cmake7
-rw-r--r--Modules/Platform/tvOS.cmake1
-rw-r--r--Modules/Platform/watchOS-Determine-CXX.cmake1
-rw-r--r--Modules/Platform/watchOS-Initialize.cmake7
-rw-r--r--Modules/Platform/watchOS.cmake1
-rw-r--r--Modules/ProcessorCount.cmake93
-rw-r--r--Modules/Qt4ConfigDependentSettings.cmake16
-rw-r--r--Modules/Qt4Macros.cmake15
-rw-r--r--Modules/SelectLibraryConfigurations.cmake61
-rw-r--r--Modules/SquishTestScript.cmake31
-rw-r--r--Modules/TestBigEndian.cmake25
-rw-r--r--Modules/TestCXXAcceptsFlag.cmake35
-rw-r--r--Modules/TestForANSIForScope.cmake25
-rw-r--r--Modules/TestForANSIStreamHeaders.cmake25
-rw-r--r--Modules/TestForSSTREAM.cmake23
-rw-r--r--Modules/TestForSTDNamespace.cmake23
-rw-r--r--Modules/UseEcos.cmake57
-rw-r--r--Modules/UseJava.cmake1161
-rw-r--r--Modules/UseJavaClassFilelist.cmake23
-rw-r--r--Modules/UseJavaSymlinks.cmake19
-rw-r--r--Modules/UsePkgConfig.cmake37
-rw-r--r--Modules/UseQt4.cmake19
-rw-r--r--Modules/UseSWIG.cmake58
-rw-r--r--Modules/Use_wxWindows.cmake61
-rw-r--r--Modules/UsewxWidgets.cmake71
-rw-r--r--Modules/WriteBasicConfigVersionFile.cmake37
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake460
352 files changed, 14191 insertions, 11577 deletions
diff --git a/Modules/AddFileDependencies.cmake b/Modules/AddFileDependencies.cmake
index fdd843266..4a4e645cd 100644
--- a/Modules/AddFileDependencies.cmake
+++ b/Modules/AddFileDependencies.cmake
@@ -1,13 +1,18 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# AddFileDependencies
-# -------------------
-#
-# ADD_FILE_DEPENDENCIES(source_file depend_files...)
-#
-# Adds the given files as dependencies to source_file
+#[=======================================================================[.rst:
+AddFileDependencies
+-------------------
+
+Add dependencies to a source file.
+
+.. code-block:: cmake
+
+ ADD_FILE_DEPENDENCIES(<source> <files>)
+
+Adds the given ``<files>`` to the dependencies of file ``<source>``.
+#]=======================================================================]
macro(ADD_FILE_DEPENDENCIES _file)
diff --git a/Modules/AndroidTestUtilities.cmake b/Modules/AndroidTestUtilities.cmake
index 62d04f3ef..e333cdbc6 100644
--- a/Modules/AndroidTestUtilities.cmake
+++ b/Modules/AndroidTestUtilities.cmake
@@ -40,7 +40,7 @@ Module Functions
.. command:: android_add_test_data
- ::
+ .. code-block:: cmake
android_add_test_data(<test-name>
[FILES <files>...] [FILES_DEST <device-dir>]
diff --git a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in
index bc78016df..afffc047f 100644
--- a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in
+++ b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in
@@ -18,6 +18,12 @@ else()
endif()
endif()
+
+# if the installed project requested no architecture check, don't perform the check
+if("@CVF_ARCH_INDEPENDENT@")
+ return()
+endif()
+
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
diff --git a/Modules/BasicConfigVersion-ExactVersion.cmake.in b/Modules/BasicConfigVersion-ExactVersion.cmake.in
index de4a23af0..fe5c2e5a8 100644
--- a/Modules/BasicConfigVersion-ExactVersion.cmake.in
+++ b/Modules/BasicConfigVersion-ExactVersion.cmake.in
@@ -34,6 +34,11 @@ if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
endif()
+# if the installed project requested no architecture check, don't perform the check
+if("@CVF_ARCH_INDEPENDENT@")
+ return()
+endif()
+
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
diff --git a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in
index a32245dd5..d885c0f93 100644
--- a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in
+++ b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in
@@ -33,6 +33,11 @@ else()
endif()
+# if the installed project requested no architecture check, don't perform the check
+if("@CVF_ARCH_INDEPENDENT@")
+ return()
+endif()
+
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
diff --git a/Modules/BasicConfigVersion-SameMinorVersion.cmake.in b/Modules/BasicConfigVersion-SameMinorVersion.cmake.in
index 59ca25376..bf055e8d4 100644
--- a/Modules/BasicConfigVersion-SameMinorVersion.cmake.in
+++ b/Modules/BasicConfigVersion-SameMinorVersion.cmake.in
@@ -37,6 +37,11 @@ else()
endif()
+# if the installed project requested no architecture check, don't perform the check
+if("@CVF_ARCH_INDEPENDENT@")
+ return()
+endif()
+
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 89ca918cb..8c7646e4d 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -12,7 +12,7 @@ bundles on the Mac and bundle-like directories on any OS.
The following functions are provided by this module:
-::
+.. code-block:: cmake
fixup_bundle
copy_and_fixup_bundle
@@ -39,9 +39,9 @@ DO NOT USE THESE FUNCTIONS AT CONFIGURE TIME (from ``CMakeLists.txt``)!
Instead, invoke them from an :command:`install(CODE)` or
:command:`install(SCRIPT)` rule.
-::
+.. code-block:: cmake
- FIXUP_BUNDLE(<app> <libs> <dirs>)
+ fixup_bundle(<app> <libs> <dirs>)
Fix up a bundle in-place and make it standalone, such that it can be
drag-n-drop copied to another machine and run on that machine as long
@@ -62,16 +62,16 @@ 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")
-::
+.. code-block:: cmake
- COPY_AND_FIXUP_BUNDLE(<src> <dst> <libs> <dirs>)
+ copy_and_fixup_bundle(<src> <dst> <libs> <dirs>)
Makes a copy of the bundle <src> at location <dst> and then fixes up
the new copied bundle in-place at <dst>...
-::
+.. code-block:: cmake
- VERIFY_APP(<app>)
+ verify_app(<app>)
Verifies that an application <app> appears valid based on running
analysis tools on it. Calls "message(FATAL_ERROR" if the application
@@ -80,16 +80,16 @@ 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")
-::
+.. code-block:: cmake
- GET_BUNDLE_MAIN_EXECUTABLE(<bundle> <result_var>)
+ get_bundle_main_executable(<bundle> <result_var>)
The result will be the full path name of the bundle's main executable
file or an "error:" prefixed string if it could not be determined.
-::
+.. code-block:: cmake
- GET_DOTAPP_DIR(<exe> <dotapp_dir_var>)
+ get_dotapp_dir(<exe> <dotapp_dir_var>)
Returns the nearest parent dir whose name ends with ".app" given the
full path to an executable. If there is no such parent dir, then
@@ -97,25 +97,25 @@ simply return the dir containing the executable.
The returned directory may or may not exist.
-::
+.. code-block:: cmake
- GET_BUNDLE_AND_EXECUTABLE(<app> <bundle_var> <executable_var> <valid_var>)
+ get_bundle_and_executable(<app> <bundle_var> <executable_var> <valid_var>)
Takes either a ".app" directory name or the name of an executable
nested inside a ".app" directory and returns the path to the ".app"
directory in <bundle_var> and the path to its main executable in
<executable_var>
-::
+.. code-block:: cmake
- GET_BUNDLE_ALL_EXECUTABLES(<bundle> <exes_var>)
+ get_bundle_all_executables(<bundle> <exes_var>)
Scans the given bundle recursively for all executable files and
accumulates them into a variable.
-::
+.. code-block:: cmake
- GET_ITEM_KEY(<item> <key_var>)
+ get_item_key(<item> <key_var>)
Given a file (item) name, generate a key that should be unique
considering the set of libraries that need copying or fixing up to
@@ -125,9 +125,9 @@ extension with "." replaced by "_"
This key is used as a prefix for CMake variables so that we can
associate a set of variables with a given item based on its key.
-::
+.. code-block:: cmake
- CLEAR_BUNDLE_KEYS(<keys_var>)
+ clear_bundle_keys(<keys_var>)
Loop over the list of keys, clearing all the variables associated with
each key. After the loop, clear the list of keys itself.
@@ -135,17 +135,17 @@ each key. After the loop, clear the list of keys itself.
Caller of get_bundle_keys should call clear_bundle_keys when done with
list of keys.
-::
+.. code-block:: cmake
- SET_BUNDLE_KEY_VALUES(<keys_var> <context> <item> <exepath> <dirs>
+ set_bundle_key_values(<keys_var> <context> <item> <exepath> <dirs>
<copyflag> [<rpaths>])
Add a key to the list (if necessary) for the given item. If added,
also set all the variables associated with that key.
-::
+.. code-block:: cmake
- GET_BUNDLE_KEYS(<app> <libs> <dirs> <keys_var>)
+ get_bundle_keys(<app> <libs> <dirs> <keys_var>)
Loop over all the executable and library files within the bundle (and
given as extra <libs>) and accumulate a list of keys representing
@@ -156,17 +156,17 @@ 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")
-::
+.. code-block:: cmake
- COPY_RESOLVED_ITEM_INTO_BUNDLE(<resolved_item> <resolved_embedded_item>)
+ copy_resolved_item_into_bundle(<resolved_item> <resolved_embedded_item>)
Copy a resolved item into the bundle if necessary. Copy is not
necessary if the resolved_item is "the same as" the
resolved_embedded_item.
-::
+.. code-block:: cmake
- COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE(<resolved_item> <resolved_embedded_item>)
+ copy_resolved_framework_into_bundle(<resolved_item> <resolved_embedded_item>)
Copy a resolved framework into the bundle if necessary. Copy is not
necessary if the resolved_item is "the same as" the
@@ -178,9 +178,9 @@ BU_COPY_FULL_FRAMEWORK_CONTENTS to ON before calling fixup_bundle. By
default, COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE copies the framework
dylib itself plus the framework Resources directory.
-::
+.. code-block:: cmake
- FIXUP_BUNDLE_ITEM(<resolved_embedded_item> <exepath> <dirs>)
+ fixup_bundle_item(<resolved_embedded_item> <exepath> <dirs>)
Get the direct/non-system prerequisites of the resolved embedded item.
For each prerequisite, change the way it is referenced to the value of
@@ -204,9 +204,9 @@ once.
If the BU_CHMOD_BUNDLE_ITEMS variable is set then bundle items will be
marked writable before install_name_tool tries to change them.
-::
+.. code-block:: cmake
- VERIFY_BUNDLE_PREREQUISITES(<bundle> <result_var> <info_var>)
+ verify_bundle_prerequisites(<bundle> <result_var> <info_var>)
Verifies that the sum of all prerequisites of all files inside the
bundle are contained within the bundle or are "system" libraries,
@@ -215,9 +215,9 @@ 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")
-::
+.. code-block:: cmake
- VERIFY_BUNDLE_SYMLINKS(<bundle> <result_var> <info_var>)
+ verify_bundle_symlinks(<bundle> <result_var> <info_var>)
Verifies that any symlinks found in the bundle point to other files
that are already also in the bundle... Anything that points to an
@@ -225,11 +225,8 @@ external file causes this function to fail the verification.
#]=======================================================================]
function(_warn_cmp0080)
- message(AUTHOR_WARNING
- "Policy CMP0080 is not set: BundleUtilities prefers not to be included at configure time. "
- "Run \"cmake --help-policy CMP0080\" for policy details. "
- "Use the cmake_policy command to set the policy and suppress this warning."
- )
+ cmake_policy(GET_WARNING CMP0080 _cmp0080_warning)
+ message(AUTHOR_WARNING "${_cmp0080_warning}\n")
endfunction()
# Do not include this module at configure time!
@@ -883,9 +880,13 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
execute_process(COMMAND chmod u+w "${resolved_embedded_item}")
endif()
+ # CMAKE_INSTALL_NAME_TOOL may not be set if executed in script mode
+ # Duplicated from CMakeFindBinUtils.cmake
+ find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+
# Only if install_name_tool supports -delete_rpath:
#
- execute_process(COMMAND install_name_tool
+ execute_process(COMMAND ${CMAKE_INSTALL_NAME_TOOL}
OUTPUT_VARIABLE install_name_tool_usage
ERROR_VARIABLE install_name_tool_usage
)
@@ -903,7 +904,7 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
# to install_name_tool:
#
if(changes)
- set(cmd install_name_tool ${changes} "${resolved_embedded_item}")
+ set(cmd ${CMAKE_INSTALL_NAME_TOOL} ${changes} "${resolved_embedded_item}")
execute_process(COMMAND ${cmd} RESULT_VARIABLE install_name_tool_result)
if(NOT install_name_tool_result EQUAL 0)
string(REPLACE ";" "' '" msg "'${cmd}'")
diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in
index a6465f695..b8e09fefa 100644
--- a/Modules/CMakeASMCompiler.cmake.in
+++ b/Modules/CMakeASMCompiler.cmake.in
@@ -5,6 +5,7 @@ set(CMAKE_ASM@ASM_DIALECT@_COMPILER_AR "@_CMAKE_ASM_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_RANLIB "@_CMAKE_ASM_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@")
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_VERSION "@_CMAKE_ASM_COMPILER_VERSION@")
diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index 4649f35a1..50b280721 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -1,46 +1,47 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakeAddFortranSubdirectory
-# ---------------------------
-#
-# Use MinGW gfortran from VS if a fortran compiler is not found.
-#
-# The 'add_fortran_subdirectory' function adds a subdirectory to a
-# project that contains a fortran only sub-project. The module will
-# check the current compiler and see if it can support fortran. If no
-# fortran compiler is found and the compiler is MSVC, then this module
-# will find the MinGW gfortran. It will then use an external project to
-# build with the MinGW tools. It will also create imported targets for
-# the libraries created. This will only work if the fortran code is
-# built into a dll, so BUILD_SHARED_LIBS is turned on in the project.
-# In addition the CMAKE_GNUtoMS option is set to on, so that the MS .lib
-# files are created. Usage is as follows:
-#
-# ::
-#
-# cmake_add_fortran_subdirectory(
-# <subdir> # name of subdirectory
-# PROJECT <project_name> # project name in subdir top CMakeLists.txt
-# ARCHIVE_DIR <dir> # dir where project places .lib files
-# RUNTIME_DIR <dir> # dir where project places .dll files
-# LIBRARIES <lib>... # names of library targets to import
-# LINK_LIBRARIES # link interface libraries for LIBRARIES
-# [LINK_LIBS <lib> <dep>...]...
-# CMAKE_COMMAND_LINE ... # extra command line flags to pass to cmake
-# NO_EXTERNAL_INSTALL # skip installation of external project
-# )
-#
-# Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with
-# respect to the build directory corresponding to the source directory
-# in which the function is invoked.
-#
-# Limitations:
-#
-# NO_EXTERNAL_INSTALL is required for forward compatibility with a
-# future version that supports installation of the external project
-# binaries during "make install".
+#[=======================================================================[.rst:
+CMakeAddFortranSubdirectory
+---------------------------
+
+Add a fortran-only subdirectory, find a fortran compiler, and build.
+
+The ``cmake_add_fortran_subdirectory`` function adds a subdirectory
+to a project that contains a fortran-only subproject. The module will
+check the current compiler and see if it can support fortran. If no
+fortran compiler is found and the compiler is MSVC, then this module
+will find the MinGW gfortran. It will then use an external project to
+build with the MinGW tools. It will also create imported targets for
+the libraries created. This will only work if the fortran code is
+built into a dll, so :variable:`BUILD_SHARED_LIBS` is turned on in
+the project. In addition the :variable:`CMAKE_GNUtoMS` option is set
+to on, so that Microsoft .lib files are created. Usage is as follows:
+
+::
+
+ cmake_add_fortran_subdirectory(
+ <subdir> # name of subdirectory
+ PROJECT <project_name> # project name in subdir top CMakeLists.txt
+ ARCHIVE_DIR <dir> # dir where project places .lib files
+ RUNTIME_DIR <dir> # dir where project places .dll files
+ LIBRARIES <lib>... # names of library targets to import
+ LINK_LIBRARIES # link interface libraries for LIBRARIES
+ [LINK_LIBS <lib> <dep>...]...
+ CMAKE_COMMAND_LINE ... # extra command line flags to pass to cmake
+ NO_EXTERNAL_INSTALL # skip installation of external project
+ )
+
+Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with
+respect to the build directory corresponding to the source directory
+in which the function is invoked.
+
+Limitations:
+
+NO_EXTERNAL_INSTALL is required for forward compatibility with a
+future version that supports installation of the external project
+binaries during "make install".
+#]=======================================================================]
set(_MS_MINGW_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
include(CheckLanguage)
diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake
index 5d86d7313..775a5137d 100644
--- a/Modules/CMakeBackwardCompatibilityC.cmake
+++ b/Modules/CMakeBackwardCompatibilityC.cmake
@@ -59,9 +59,6 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
set (CMAKE_HP_PTHREADS ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL
"Use HP pthreads.")
- set (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL
- "Use sproc libs.")
-
if(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
@@ -72,7 +69,6 @@ mark_as_advanced(
CMAKE_HP_PTHREADS
CMAKE_THREAD_LIBS
CMAKE_USE_PTHREADS
-CMAKE_USE_SPROC
CMAKE_USE_WIN32_THREADS
CMAKE_X_CFLAGS
CMAKE_X_LIBS
diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake
index cbd5ea76c..02744a985 100644
--- a/Modules/CMakeBackwardCompatibilityCXX.cmake
+++ b/Modules/CMakeBackwardCompatibilityCXX.cmake
@@ -1,29 +1,27 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakeBackwardCompatibilityCXX
-# -----------------------------
-#
-# define a bunch of backwards compatibility variables
-#
-# ::
-#
-# CMAKE_ANSI_CXXFLAGS - flag for ansi c++
-# CMAKE_HAS_ANSI_STRING_STREAM - has <strstream>
-# include(TestForANSIStreamHeaders)
-# include(CheckIncludeFileCXX)
-# include(TestForSTDNamespace)
-# include(TestForANSIForScope)
+#[=======================================================================[.rst:
+CMakeBackwardCompatibilityCXX
+-----------------------------
+
+define a bunch of backwards compatibility variables
+
+::
+
+ CMAKE_ANSI_CXXFLAGS - flag for ansi c++
+ CMAKE_HAS_ANSI_STRING_STREAM - has <strstream>
+ include(TestForANSIStreamHeaders)
+ include(CheckIncludeFileCXX)
+ include(TestForSTDNamespace)
+ include(TestForANSIForScope)
+#]=======================================================================]
if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
# check for some ANSI flags in the CXX compiler if it is not gnu
if(NOT CMAKE_COMPILER_IS_GNUCXX)
include(TestCXXAcceptsFlag)
set(CMAKE_TRY_ANSI_CXX_FLAGS "")
- if(CMAKE_SYSTEM_NAME MATCHES "IRIX")
- set(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std")
- endif()
if(CMAKE_SYSTEM_NAME MATCHES "OSF")
set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname")
endif()
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index 72144cf31..f473b0d1c 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -21,6 +21,7 @@ set(CMAKE_C_COMPILER_AR "@CMAKE_C_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_C_COMPILER_RANLIB "@CMAKE_C_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@)
set(CMAKE_C_COMPILER_LOADED 1)
set(CMAKE_C_COMPILER_WORKS @CMAKE_C_COMPILER_WORKS@)
@@ -68,6 +69,7 @@ endif()
@CMAKE_C_SYSROOT_FLAG_CODE@
@CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
+set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES@")
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
index 9761d8c12..711129a39 100644
--- a/Modules/CMakeCUDACompiler.cmake.in
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -23,6 +23,10 @@ set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBR
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
+set(CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES@")
set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
+
+set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_MT "@CMAKE_MT@")
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 8da6a8c1d..a1be02b5c 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -23,6 +23,7 @@ set(CMAKE_CXX_COMPILER_AR "@CMAKE_CXX_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_CXX_COMPILER_RANLIB "@CMAKE_CXX_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
set(CMAKE_CXX_COMPILER_LOADED 1)
set(CMAKE_CXX_COMPILER_WORKS @CMAKE_CXX_COMPILER_WORKS@)
@@ -71,6 +72,7 @@ endif()
@CMAKE_CXX_SYSROOT_FLAG_CODE@
@CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
+set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES@")
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 2975874d8..a896b99b6 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -105,6 +105,12 @@ endif()
if(NOT CMAKE_CXX_COMPILE_OPTIONS_PIE)
set(CMAKE_CXX_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE})
endif()
+if(NOT CMAKE_CXX_LINK_OPTIONS_PIE)
+ set(CMAKE_CXX_LINK_OPTIONS_PIE ${CMAKE_C_LINK_OPTIONS_PIE})
+endif()
+if(NOT CMAKE_CXX_LINK_OPTIONS_NO_PIE)
+ set(CMAKE_CXX_LINK_OPTIONS_NO_PIE ${CMAKE_C_LINK_OPTIONS_NO_PIE})
+endif()
if(NOT CMAKE_CXX_COMPILE_OPTIONS_DLL)
set(CMAKE_CXX_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL})
@@ -269,4 +275,3 @@ CMAKE_VERBOSE_MAKEFILE
)
set(CMAKE_CXX_INFORMATION_LOADED 1)
-
diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h
index 6f36b0303..45532afdb 100644
--- a/Modules/CMakeCompilerABI.h
+++ b/Modules/CMakeCompilerABI.h
@@ -10,16 +10,10 @@ const char info_sizeof_dptr[] = {
};
/* Application Binary Interface. */
-#if defined(__sgi) && defined(_ABIO32)
-# define ABI_ID "ELF O32"
-#elif defined(__sgi) && defined(_ABIN32)
-# define ABI_ID "ELF N32"
-#elif defined(__sgi) && defined(_ABI64)
-# define ABI_ID "ELF 64"
/* Check for (some) ARM ABIs.
* See e.g. http://wiki.debian.org/ArmEabiPort for some information on this. */
-#elif defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__)
+#if defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__)
# define ABI_ID "ELF ARMEABI"
#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEB__)
# define ABI_ID "ELF ARM"
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index f2d43b687..6a22d2768 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -63,6 +63,7 @@ function(compiler_id_detection outvar lang)
Cray
TI
Fujitsu
+ GHS
)
if (lang STREQUAL C)
list(APPEND ordered_compilers
@@ -72,13 +73,13 @@ function(compiler_id_detection outvar lang)
endif()
list(APPEND ordered_compilers
SCO
+ ARMCC
AppleClang
Clang
GNU
MSVC
ADSP
IAR
- ARMCC
)
if (lang STREQUAL C)
list(APPEND ordered_compilers
@@ -135,9 +136,6 @@ function(compiler_id_detection outvar lang)
/* These compilers are either not known or too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
-#elif defined(__sgi)
-# define ${CID_PREFIX}COMPILER_ID \"MIPSpro\"
-
#elif defined(__hpux) || defined(__hpua)
# define ${CID_PREFIX}COMPILER_ID \"HP\"
diff --git a/Modules/CMakeDependentOption.cmake b/Modules/CMakeDependentOption.cmake
index 21d3c96b3..6046d8585 100644
--- a/Modules/CMakeDependentOption.cmake
+++ b/Modules/CMakeDependentOption.cmake
@@ -1,27 +1,28 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakeDependentOption
-# --------------------
-#
-# Macro to provide an option dependent on other options.
-#
-# This macro presents an option to the user only if a set of other
-# conditions are true. When the option is not presented a default value
-# is used, but any value set by the user is preserved for when the
-# option is presented again. Example invocation:
-#
-# ::
-#
-# CMAKE_DEPENDENT_OPTION(USE_FOO "Use Foo" ON
-# "USE_BAR;NOT USE_ZOT" OFF)
-#
-# If USE_BAR is true and USE_ZOT is false, this provides an option
-# called USE_FOO that defaults to ON. Otherwise, it sets USE_FOO to
-# OFF. If the status of USE_BAR or USE_ZOT ever changes, any value for
-# the USE_FOO option is saved so that when the option is re-enabled it
-# retains its old value.
+#[=======================================================================[.rst:
+CMakeDependentOption
+--------------------
+
+Macro to provide an option dependent on other options.
+
+This macro presents an option to the user only if a set of other
+conditions are true. When the option is not presented a default value
+is used, but any value set by the user is preserved for when the
+option is presented again. Example invocation:
+
+::
+
+ CMAKE_DEPENDENT_OPTION(USE_FOO "Use Foo" ON
+ "USE_BAR;NOT USE_ZOT" OFF)
+
+If USE_BAR is true and USE_ZOT is false, this provides an option
+called USE_FOO that defaults to ON. Otherwise, it sets USE_FOO to
+OFF. If the status of USE_BAR or USE_ZOT ever changes, any value for
+the USE_FOO option is saved so that when the option is re-enabled it
+retains its old value.
+#]=======================================================================]
macro(CMAKE_DEPENDENT_OPTION option doc default depends force)
if(${option}_ISSET MATCHES "^${option}_ISSET$")
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index dbc41c8c7..b8c8c5d35 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -83,7 +83,7 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C")
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS MSVC )
- set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "/?")
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "-?")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_MSVC "Microsoft")
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI )
@@ -110,6 +110,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ADSP "-version")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ADSP "Analog Devices")
+ list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS QCC)
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_QCC "-V")
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_QCC "gcc_nto")
+
include(CMakeDetermineCompilerId)
set(userflags)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}")
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 17706ea50..d7f6f97d0 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -31,6 +31,7 @@ if(NOT CMAKE_C_COMPILER_NAMES)
endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(CMAKE_C_COMPILER_XCODE_TYPE sourcecode.c.c)
_cmake_find_compiler_path(C)
@@ -105,7 +106,7 @@ if(NOT CMAKE_C_COMPILER_ID_RUN)
# ...
# /path/to/cc ...CompilerIdC/...
# to extract the compiler front-end for the language.
- set(CMAKE_C_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdC/(\\./)?(CompilerIdC.xctest/)?CompilerIdC[ \t\n\\\"]")
+ set(CMAKE_C_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdC/(\\./)?(CompilerIdC.(framework|xctest)/)?CompilerIdC[ \t\n\\\"]")
set(CMAKE_C_COMPILER_ID_TOOL_MATCH_INDEX 2)
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
@@ -136,7 +137,7 @@ endif ()
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
- if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+ 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]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
@@ -145,7 +146,7 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-)
endif()
elseif(COMPILER_BASENAME MATCHES "qcc(\\.exe)?$")
- if(CMAKE_C_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?")
+ if(CMAKE_C_COMPILER_TARGET MATCHES "gcc_nto([a-z0-9]+_[0-9]+|[^_le]+)(le)?")
set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
endif()
endif ()
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 113b520a0..490d6592e 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -111,10 +111,15 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
if(_nvcc_libraries)
# Remove variable assignments.
string(REGEX REPLACE "#\\\$ *[^= ]+=[^\n]*\n" "" _nvcc_output "${_nvcc_output_orig}")
+ # Encode [] characters that break list expansion.
+ string(REPLACE "[" "{==={" _nvcc_output "${_nvcc_output}")
+ string(REPLACE "]" "}===}" _nvcc_output "${_nvcc_output}")
# Split lines.
string(REGEX REPLACE "\n+(#\\\$ )?" ";" _nvcc_output "${_nvcc_output}")
foreach(line IN LISTS _nvcc_output)
set(_nvcc_output_line "${line}")
+ string(REPLACE "{==={" "[" _nvcc_output_line "${_nvcc_output_line}")
+ string(REPLACE "}===}" "]" _nvcc_output_line "${_nvcc_output_line}")
string(APPEND _nvcc_log " considering line: [${_nvcc_output_line}]\n")
if("${_nvcc_output_line}" MATCHES "^ *nvlink")
string(APPEND _nvcc_log " ignoring nvlink line\n")
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 70d17a181..bd878b292 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -30,6 +30,7 @@ if(NOT CMAKE_CXX_COMPILER_NAMES)
endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(CMAKE_CXX_COMPILER_XCODE_TYPE sourcecode.cpp.cpp)
_cmake_find_compiler_path(CXX)
@@ -100,7 +101,7 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN)
# ...
# /path/to/cc ...CompilerIdCXX/...
# to extract the compiler front-end for the language.
- set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCXX/(\\./)?(CompilerIdCXX.xctest/)?CompilerIdCXX[ \t\n\\\"]")
+ set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCXX/(\\./)?(CompilerIdCXX.(framework|xctest)/)?CompilerIdCXX[ \t\n\\\"]")
set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_INDEX 2)
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
@@ -133,7 +134,7 @@ endif ()
if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
- if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+ 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]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
@@ -142,7 +143,7 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-)
endif()
elseif(COMPILER_BASENAME MATCHES "QCC(\\.exe)?$")
- if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?")
+ if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([a-z0-9]+_[0-9]+|[^_le]+)(le)")
set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
endif()
endif ()
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 604ac27e6..06f3ba22d 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -6,7 +6,9 @@
# This is used internally by CMake and should not be included by user
# code.
+include(${CMAKE_ROOT}/Modules/CMakeParseImplicitIncludeInfo.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
+include(CMakeTestCompilerCommon)
function(CMAKE_DETERMINE_COMPILER_ABI lang src)
if(NOT DEFINED CMAKE_${lang}_ABI_COMPILED)
@@ -15,23 +17,48 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
# Compile the ABI identification source.
set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerABI_${lang}.bin")
set(CMAKE_FLAGS )
+ set(COMPILE_DEFINITIONS )
if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
set(CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
+ set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_FLAG}")
+ endif()
+ if(DEFINED CMAKE_${lang}_VERBOSE_COMPILE_FLAG)
+ set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_COMPILE_FLAG}")
endif()
if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC")
# Avoid adding our own platform standard libraries for compilers
# from which we might detect implicit link libraries.
list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=")
endif()
+ __TestCompiler_setTryCompileTargetType()
+
+ # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
+ # and set them to "C" that way GCC's "search starts here" text is in
+ # English and we can grok it.
+ set(_orig_lc_all $ENV{LC_ALL})
+ set(_orig_lc_messages $ENV{LC_MESSAGES})
+ set(_orig_lang $ENV{LANG})
+ set(ENV{LC_ALL} C)
+ set(ENV{LC_MESSAGES} C)
+ set(ENV{LANG} C)
+
try_compile(CMAKE_${lang}_ABI_COMPILED
${CMAKE_BINARY_DIR} ${src}
CMAKE_FLAGS ${CMAKE_FLAGS}
# Ignore unused flags when we are just determining the ABI.
"--no-warn-unused-cli"
+ COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS}
OUTPUT_VARIABLE OUTPUT
COPY_FILE "${BIN}"
COPY_FILE_ERROR _copy_error
+ __CMAKE_INTERNAL ABI
)
+
+ # Restore original LC_ALL, LC_MESSAGES, and LANG
+ set(ENV{LC_ALL} ${_orig_lc_all})
+ set(ENV{LC_MESSAGES} ${_orig_lc_messages})
+ set(ENV{LANG} ${_orig_lang})
+
# Move result from cache to normal variable.
set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED})
unset(CMAKE_${lang}_ABI_COMPILED CACHE)
@@ -62,6 +89,26 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE)
endif()
+ # Parse implicit include directory for this language, if available.
+ if(CMAKE_${lang}_VERBOSE_FLAG)
+ set (implicit_incdirs "")
+ cmake_parse_implicit_include_info("${OUTPUT}" "${lang}"
+ implicit_incdirs log rv)
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Parsed ${lang} implicit include dir info from above output: rv=${rv}\n${log}\n\n")
+ if("${rv}" STREQUAL "done")
+ # Entries that we have been told to explicitly pass as standard include
+ # directories will not be implicitly added by the compiler.
+ if(CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES)
+ list(REMOVE_ITEM implicit_incdirs ${CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES})
+ endif()
+
+ # We parsed implicit include directories, so override the default initializer.
+ set(_CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT "${implicit_incdirs}")
+ endif()
+ endif()
+ set(CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES "${_CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT}" PARENT_SCOPE)
+
# Parse implicit linker information for this language, if available.
set(implicit_dirs "")
set(implicit_libs "")
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 5e2df26a6..59dab6de4 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -52,6 +52,13 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endforeach()
endif()
+ # If the compiler is still unknown, fallback to GHS
+ if(NOT CMAKE_${lang}_COMPILER_ID AND "${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
+ set(CMAKE_${lang}_COMPILER_ID GHS)
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "The ${lang} compiler identification is falling back to GHS.\n\n")
+ endif()
+
# CUDA < 7.5 is missing version macros
if(lang STREQUAL "CUDA"
AND CMAKE_${lang}_COMPILER_ID STREQUAL "NVIDIA"
@@ -174,7 +181,10 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(vs_version ${CMAKE_MATCH_1})
set(id_platform ${CMAKE_VS_PLATFORM_NAME})
set(id_lang "${lang}")
- if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*")
+ set(id_PostBuildEvent_Command "")
+ if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Ll][Ll][Vv][Mm]$")
+ set(id_cl_var "ClangClExecutable")
+ elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*")
set(id_cl clang.exe)
else()
set(id_cl cl.exe)
@@ -261,7 +271,11 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
set(id_src "${src}")
set(id_compile "ClCompile")
- set(id_PostBuildEvent_Command "for %%i in (${id_cl}) do %40echo CMAKE_${lang}_COMPILER=%%~$PATH:i")
+ if(id_cl_var)
+ set(id_PostBuildEvent_Command "echo CMAKE_${lang}_COMPILER=$(${id_cl_var})")
+ else()
+ set(id_PostBuildEvent_Command "for %%i in (${id_cl}) do %40echo CMAKE_${lang}_COMPILER=%%~$PATH:i")
+ endif()
set(id_Import_props "")
set(id_Import_targets "")
set(id_ItemDefinitionGroup_entry "")
@@ -325,6 +339,8 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
if("${lang}" STREQUAL "Swift")
if(CMAKE_Swift_LANGUAGE_VERSION)
set(id_lang_version "SWIFT_VERSION = ${CMAKE_Swift_LANGUAGE_VERSION};")
+ elseif(XCODE_VERSION VERSION_GREATER_EQUAL 10.2)
+ set(id_lang_version "SWIFT_VERSION = 4.0;")
elseif(XCODE_VERSION VERSION_GREATER_EQUAL 8.3)
set(id_lang_version "SWIFT_VERSION = 3.0;")
else()
@@ -345,21 +361,20 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]" OR
CMAKE_OSX_SYSROOT MATCHES "(^|/)[Aa][Pp][Pp][Ll][Ee][Tt][Vv]")
set(id_product_type "com.apple.product-type.bundle.unit-test")
+ elseif(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ww][Aa][Tt][Cc][Hh]")
+ set(id_product_type "com.apple.product-type.framework")
endif()
else()
set(id_sdkroot "")
endif()
- if(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM)
- set(id_development_team
- "DEVELOPMENT_TEAM = \"${CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM}\";")
- else()
- set(id_development_team "")
- endif()
- if(DEFINED CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY)
- set(id_code_sign_identity
- "CODE_SIGN_IDENTITY = \"${CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY}\";")
- else()
- set(id_code_sign_identity "")
+ set(id_clang_cxx_library "")
+ set(stdlib_regex "(^| )(-stdlib=)([^ ]+)( |$)")
+ string(REGEX MATCHALL "${stdlib_regex}" all_stdlib_matches "${CMAKE_CXX_FLAGS}")
+ if(all_stdlib_matches)
+ list(GET all_stdlib_matches "-1" last_stdlib_match)
+ if(last_stdlib_match MATCHES "${stdlib_regex}")
+ set(id_clang_cxx_library "CLANG_CXX_LIBRARY = \"${CMAKE_MATCH_3}\";")
+ endif()
endif()
configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)
@@ -391,6 +406,40 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
separate_arguments(CMAKE_${lang}_XCODE_ARCHS)
set(CMAKE_${lang}_XCODE_ARCHS "${CMAKE_${lang}_XCODE_ARCHS}" PARENT_SCOPE)
endif()
+ elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
+ set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
+ set(id_src "${src}")
+ if (GHS_PRIMARY_TARGET)
+ set(ghs_primary_target "${GHS_PRIMARY_TARGET}")
+ else()
+ set(ghs_primary_target "${CMAKE_GENERATOR_PLATFORM}_${GHS_TARGET_PLATFORM}.tgt")
+ endif()
+ if ("${GHS_TARGET_PLATFORM}" MATCHES "integrity")
+ set(bsp_name "macro GHS_BSP=${GHS_BSP_NAME}")
+ set(os_dir "macro GHS_OS=${GHS_OS_DIR}")
+ endif()
+ set(command "${CMAKE_MAKE_PROGRAM}" "-commands" "-top" "GHS_default.gpj")
+ configure_file(${CMAKE_ROOT}/Modules/CompilerId/GHS_default.gpj.in
+ ${id_dir}/GHS_default.gpj @ONLY)
+ configure_file(${CMAKE_ROOT}/Modules/CompilerId/GHS_lib.gpj.in
+ ${id_dir}/GHS_lib.gpj @ONLY)
+ execute_process(COMMAND ${command}
+ WORKING_DIRECTORY ${id_dir}
+ OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
+ ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
+ RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
+ )
+ # Match the compiler location line printed out.
+ set(ghs_toolpath "${CMAKE_MAKE_PROGRAM}")
+ string(REPLACE "/gbuild.exe" "/" ghs_toolpath ${ghs_toolpath})
+ string(REPLACE / "\\\\" ghs_toolpath ${ghs_toolpath})
+ if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "(${ghs_toolpath}[^ ]*)")
+ set(_comp "${CMAKE_MATCH_1}.exe")
+ if(EXISTS "${_comp}")
+ file(TO_CMAKE_PATH "${_comp}" _comp)
+ set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
+ endif()
+ endif()
else()
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}"
@@ -450,6 +499,9 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
# com.apple.package-type.bundle.unit-test
${_glob_id_dir}/*.xctest/*
+
+ # com.apple.product-type.framework
+ ${_glob_id_dir}/*.framework/*
)
list(REMOVE_ITEM files "${src}")
set(COMPILER_${lang}_PRODUCED_FILES "")
@@ -523,7 +575,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
file(STRINGS ${file}
CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 38
${CMAKE_${lang}_COMPILER_ID_STRINGS_PARAMETERS}
- REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ REGEX ".?I.?N.?F.?O.?:.?[A-Za-z0-9_]+\\[[^]]*\\]")
set(COMPILER_ID_TWICE)
# With the IAR Compiler, some strings are found twice, first time as incomplete
# list like "?<Constant "INFO:compiler[IAR]">". Remove the incomplete copies.
@@ -531,6 +583,12 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
# In C# binaries, some strings are found more than once.
list(REMOVE_DUPLICATES CMAKE_${lang}_COMPILER_ID_STRINGS)
foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
+ # The IAR-AVR compiler uses a binary format that places a '6'
+ # character (0x34) before each character in the string. Strip
+ # out these characters without removing any legitamate characters.
+ if("${info}" MATCHES "(.)I.N.F.O.:.")
+ string(REGEX REPLACE "${CMAKE_MATCH_1}(.)" "\\1" info "${info}")
+ endif()
if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]")
if(COMPILER_ID)
set(COMPILER_ID_TWICE 1)
@@ -544,7 +602,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(ARCHITECTURE_ID "${CMAKE_MATCH_1}")
endif()
if("${info}" MATCHES "INFO:compiler_version\\[([^]\"]*)\\]")
- string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}")
+ string(REGEX REPLACE "^0+([0-9]+)" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}")
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
endif()
if("${info}" MATCHES "INFO:compiler_version_internal\\[([^]\"]*)\\]")
@@ -596,26 +654,28 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
if(WIN32)
# The offset to the PE signature is stored at 0x3c.
file(READ ${file} peoffsethex LIMIT 1 OFFSET 60 HEX)
- string(SUBSTRING "${peoffsethex}" 0 1 peoffsethex1)
- string(SUBSTRING "${peoffsethex}" 1 1 peoffsethex2)
- set(peoffsetexpression "${peoffsethex1} * 16 + ${peoffsethex2}")
- string(REPLACE "a" "10" peoffsetexpression "${peoffsetexpression}")
- string(REPLACE "b" "11" peoffsetexpression "${peoffsetexpression}")
- string(REPLACE "c" "12" peoffsetexpression "${peoffsetexpression}")
- string(REPLACE "d" "13" peoffsetexpression "${peoffsetexpression}")
- string(REPLACE "e" "14" peoffsetexpression "${peoffsetexpression}")
- string(REPLACE "f" "15" peoffsetexpression "${peoffsetexpression}")
- math(EXPR peoffset "${peoffsetexpression}")
-
- file(READ ${file} peheader LIMIT 6 OFFSET ${peoffset} HEX)
- if(peheader STREQUAL "50450000a201")
- set(ARCHITECTURE_ID "SH3")
- elseif(peheader STREQUAL "50450000a301")
- set(ARCHITECTURE_ID "SH3DSP")
- elseif(peheader STREQUAL "50450000a601")
- set(ARCHITECTURE_ID "SH4")
- elseif(peheader STREQUAL "50450000a801")
- set(ARCHITECTURE_ID "SH5")
+ if(NOT peoffsethex STREQUAL "")
+ string(SUBSTRING "${peoffsethex}" 0 1 peoffsethex1)
+ string(SUBSTRING "${peoffsethex}" 1 1 peoffsethex2)
+ set(peoffsetexpression "${peoffsethex1} * 16 + ${peoffsethex2}")
+ string(REPLACE "a" "10" peoffsetexpression "${peoffsetexpression}")
+ string(REPLACE "b" "11" peoffsetexpression "${peoffsetexpression}")
+ string(REPLACE "c" "12" peoffsetexpression "${peoffsetexpression}")
+ string(REPLACE "d" "13" peoffsetexpression "${peoffsetexpression}")
+ string(REPLACE "e" "14" peoffsetexpression "${peoffsetexpression}")
+ string(REPLACE "f" "15" peoffsetexpression "${peoffsetexpression}")
+ math(EXPR peoffset "${peoffsetexpression}")
+
+ file(READ ${file} peheader LIMIT 6 OFFSET ${peoffset} HEX)
+ if(peheader STREQUAL "50450000a201")
+ set(ARCHITECTURE_ID "SH3")
+ elseif(peheader STREQUAL "50450000a301")
+ set(ARCHITECTURE_ID "SH3DSP")
+ elseif(peheader STREQUAL "50450000a601")
+ set(ARCHITECTURE_ID "SH4")
+ elseif(peheader STREQUAL "50450000a801")
+ set(ARCHITECTURE_ID "SH5")
+ endif()
endif()
endif()
@@ -659,13 +719,10 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
# set(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE STRING "Executable file format")
# endif()
#
-# # Mach-O files start with CAFEBABE or FEEDFACE, according to http://radio.weblogs.com/0100490/2003/01/28.html
-# if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe")
-# set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format")
-# endif()
-# if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface")
-# set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "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")
+ endif()
endif()
if(NOT DEFINED CMAKE_EXECUTABLE_FORMAT)
@@ -774,7 +831,7 @@ function(CMAKE_DIAGNOSE_UNSUPPORTED_CLANG lang envvar)
endif()
# Test whether an MSVC-like command-line option works.
- execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" /?
+ execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -?
RESULT_VARIABLE _clang_result
OUTPUT_VARIABLE _clang_stdout
ERROR_VARIABLE _clang_stderr)
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index 600d5580e..dc208c600 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -13,7 +13,6 @@
# BSD/OS BSD/OS
# FreeBSD FreeBSD
# HP-UX HP-UX
-# IRIX IRIX
# Linux Linux
# GNU/kFreeBSD GNU/kFreeBSD
# NetBSD NetBSD
diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake
index 026462144..a3c4d9cf1 100644
--- a/Modules/CMakeDetermineVSServicePack.cmake
+++ b/Modules/CMakeDetermineVSServicePack.cmake
@@ -1,35 +1,38 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakeDetermineVSServicePack
-# ---------------------------
-#
-# Deprecated. Do not use.
-#
-# The functionality of this module has been superseded by the
-# :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable that contains
-# the compiler version number.
-#
-# Determine the Visual Studio service pack of the 'cl' in use.
-#
-# Usage::
-#
-# if(MSVC)
-# include(CMakeDetermineVSServicePack)
-# DetermineVSServicePack( my_service_pack )
-# if( my_service_pack )
-# message(STATUS "Detected: ${my_service_pack}")
-# endif()
-# endif()
-#
-# Function DetermineVSServicePack sets the given variable to one of the
-# following values or an empty string if unknown::
-#
-# vc80, vc80sp1
-# vc90, vc90sp1
-# vc100, vc100sp1
-# vc110, vc110sp1, vc110sp2, vc110sp3, vc110sp4
+#[=======================================================================[.rst:
+CMakeDetermineVSServicePack
+---------------------------
+
+.. deprecated:: 3.0
+
+ Do not use.
+
+The functionality of this module has been superseded by the
+:variable:`CMAKE_<LANG>_COMPILER_VERSION` variable that contains
+the compiler version number.
+
+Determine the Visual Studio service pack of the 'cl' in use.
+
+Usage::
+
+ if(MSVC)
+ include(CMakeDetermineVSServicePack)
+ DetermineVSServicePack( my_service_pack )
+ if( my_service_pack )
+ message(STATUS "Detected: ${my_service_pack}")
+ endif()
+ endif()
+
+Function DetermineVSServicePack sets the given variable to one of the
+following values or an empty string if unknown::
+
+ vc80, vc80sp1
+ vc90, vc90sp1
+ vc100, vc100sp1
+ vc110, vc110sp1, vc110sp2, vc110sp3, vc110sp4
+#]=======================================================================]
if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.8)
message(DEPRECATION
@@ -76,7 +79,7 @@ endfunction()
function(_DetermineVSServicePack_FastCheckVersionWithCompiler _SUCCESS_VAR _VERSION_VAR)
if(EXISTS ${CMAKE_CXX_COMPILER})
execute_process(
- COMMAND ${CMAKE_CXX_COMPILER} /?
+ COMMAND ${CMAKE_CXX_COMPILER} -?
ERROR_VARIABLE _output
OUTPUT_QUIET
)
@@ -169,4 +172,3 @@ function(DetermineVSServicePack _pack)
endif()
endif()
endfunction()
-
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index 21a3065fe..ae26cc26e 100644
--- a/Modules/CMakeExpandImportedTargets.cmake
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -1,41 +1,44 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakeExpandImportedTargets
-# --------------------------
-#
-# Deprecated. Do not use.
-#
-# This module was once needed to expand imported targets to the underlying
-# libraries they reference on disk for use with the :command:`try_compile`
-# and :command:`try_run` commands. These commands now support imported
-# libraries in their ``LINK_LIBRARIES`` options (since CMake 2.8.11
-# for :command:`try_compile` and since CMake 3.2 for :command:`try_run`).
-#
-# This module does not support the policy :policy:`CMP0022` ``NEW``
-# behavior or use of the :prop_tgt:`INTERFACE_LINK_LIBRARIES` property
-# because :manual:`generator expressions <cmake-generator-expressions(7)>`
-# cannot be evaluated during configuration.
-#
-# ::
-#
-# CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN
-# [CONFIGURATION <config>])
-#
-# CMAKE_EXPAND_IMPORTED_TARGETS() takes a list of libraries and replaces
-# all imported targets contained in this list with their actual file
-# paths of the referenced libraries on disk, including the libraries
-# from their link interfaces. If a CONFIGURATION is given, it uses the
-# respective configuration of the imported targets if it exists. If no
-# CONFIGURATION is given, it uses the first configuration from
-# ${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}.
-#
-# ::
-#
-# cmake_expand_imported_targets(expandedLibs
-# LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
-# CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" )
+#[=======================================================================[.rst:
+CMakeExpandImportedTargets
+--------------------------
+
+.. deprecated:: 3.4
+
+ Do not use.
+
+This module was once needed to expand imported targets to the underlying
+libraries they reference on disk for use with the :command:`try_compile`
+and :command:`try_run` commands. These commands now support imported
+libraries in their ``LINK_LIBRARIES`` options (since CMake 2.8.11
+for :command:`try_compile` and since CMake 3.2 for :command:`try_run`).
+
+This module does not support the policy :policy:`CMP0022` ``NEW``
+behavior or use of the :prop_tgt:`INTERFACE_LINK_LIBRARIES` property
+because :manual:`generator expressions <cmake-generator-expressions(7)>`
+cannot be evaluated during configuration.
+
+::
+
+ CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN
+ [CONFIGURATION <config>])
+
+CMAKE_EXPAND_IMPORTED_TARGETS() takes a list of libraries and replaces
+all imported targets contained in this list with their actual file
+paths of the referenced libraries on disk, including the libraries
+from their link interfaces. If a CONFIGURATION is given, it uses the
+respective configuration of the imported targets if it exists. If no
+CONFIGURATION is given, it uses the first configuration from
+${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}.
+
+::
+
+ cmake_expand_imported_targets(expandedLibs
+ LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
+ CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" )
+#]=======================================================================]
function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 830639dff..35f75c938 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -14,29 +14,48 @@
# CMAKE_AR
# CMAKE_RANLIB
# CMAKE_LINKER
+# CMAKE_MT
# CMAKE_STRIP
# CMAKE_INSTALL_NAME_TOOL
# on UNIX, cygwin and mingw
-if(CMAKE_LINKER)
- # we only get here if CMAKE_LINKER was specified using -D or a pre-made CMakeCache.txt
- # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
- # find the linker in the PATH if necessary
- get_filename_component(_CMAKE_USER_LINKER_PATH "${CMAKE_LINKER}" PATH)
- if(NOT _CMAKE_USER_LINKER_PATH)
- find_program(CMAKE_LINKER_WITH_PATH NAMES ${CMAKE_LINKER} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- if(CMAKE_LINKER_WITH_PATH)
- set(CMAKE_LINKER ${CMAKE_LINKER_WITH_PATH})
- get_property(_CMAKE_LINKER_CACHED CACHE CMAKE_LINKER PROPERTY TYPE)
- if(_CMAKE_LINKER_CACHED)
- set(CMAKE_LINKER "${CMAKE_LINKER}" CACHE STRING "Default Linker" FORCE)
+# Resolve full path of CMAKE_TOOL from user-defined name and SEARCH_PATH.
+function(__resolve_tool_path CMAKE_TOOL SEARCH_PATH DOCSTRING)
+
+ if(${CMAKE_TOOL})
+ # We only get here if CMAKE_TOOL was
+ # specified using -D or a pre-made CMakeCache.txt (e.g. via ctest)
+ # or set in CMAKE_TOOLCHAIN_FILE.
+
+ get_filename_component(_CMAKE_USER_TOOL_PATH "${${CMAKE_TOOL}}" DIRECTORY)
+ # Is CMAKE_TOOL a user-defined name instead of a full path?
+ if(NOT _CMAKE_USER_TOOL_PATH)
+
+ # Find CMAKE_TOOL in the SEARCH_PATH directory by user-defined name.
+ find_program(_CMAKE_TOOL_WITH_PATH NAMES ${${CMAKE_TOOL}} HINTS ${SEARCH_PATH})
+ if(_CMAKE_TOOL_WITH_PATH)
+
+ # Overwrite CMAKE_TOOL with full path found in SEARCH_PATH.
+ set(${CMAKE_TOOL} ${_CMAKE_TOOL_WITH_PATH} PARENT_SCOPE)
+
+ get_property(_CMAKE_TOOL_CACHED CACHE ${CMAKE_TOOL} PROPERTY TYPE)
+ # If CMAKE_TOOL is present in the CMake Cache, then overwrit it as well.
+ if(_CMAKE_TOOL_CACHED)
+ set(${CMAKE_TOOL} "${_CMAKE_TOOL_WITH_PATH}" CACHE STRING ${DOCSTRING} FORCE)
+ endif()
+
endif()
- unset(_CMAKE_LINKER_CACHED)
+ unset(_CMAKE_TOOL_WITH_PATH CACHE)
+
endif()
- unset(CMAKE_LINKER_WITH_PATH CACHE)
+
endif()
-endif()
+
+endfunction()
+
+__resolve_tool_path(CMAKE_LINKER "${_CMAKE_TOOLCHAIN_LOCATION}" "Default Linker")
+__resolve_tool_path(CMAKE_MT "${_CMAKE_TOOLCHAIN_LOCATION}" "Default Manifest Tool")
set(_CMAKE_TOOL_VARS "")
@@ -44,12 +63,14 @@ set(_CMAKE_TOOL_VARS "")
if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xMSVC"
OR (CMAKE_HOST_WIN32 AND "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xPGI")
+ OR (CMAKE_HOST_WIN32 AND "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xNVIDIA")
OR (CMAKE_GENERATOR MATCHES "Visual Studio"
AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+ find_program(CMAKE_MT NAMES mt HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
- list(APPEND _CMAKE_TOOL_VARS CMAKE_LINKER)
+ list(APPEND _CMAKE_TOOL_VARS CMAKE_LINKER CMAKE_MT)
# in all other cases search for ar, ranlib, etc.
else()
diff --git a/Modules/CMakeFindFrameworks.cmake b/Modules/CMakeFindFrameworks.cmake
index 6c4c52729..06c05fb91 100644
--- a/Modules/CMakeFindFrameworks.cmake
+++ b/Modules/CMakeFindFrameworks.cmake
@@ -1,15 +1,16 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakeFindFrameworks
-# -------------------
-#
-# helper module to find OSX frameworks
-#
-# This module reads hints about search locations from variables::
-#
-# CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS - Extra directories
+#[=======================================================================[.rst:
+CMakeFindFrameworks
+-------------------
+
+helper module to find OSX frameworks
+
+This module reads hints about search locations from variables::
+
+ CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS - Extra directories
+#]=======================================================================]
if(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED)
set(CMAKE_FIND_FRAMEWORKS_INCLUDED 1)
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
index ec3652cfa..815dfc90d 100644
--- a/Modules/CMakeFindPackageMode.cmake
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -1,33 +1,34 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakeFindPackageMode
-# --------------------
-#
-#
-#
-# This file is executed by cmake when invoked with --find-package. It
-# expects that the following variables are set using -D:
-#
-# ``NAME``
-# name of the package
-# ``COMPILER_ID``
-# the CMake compiler ID for which the result is,
-# i.e. GNU/Intel/Clang/MSVC, etc.
-# ``LANGUAGE``
-# language for which the result will be used,
-# i.e. C/CXX/Fortran/ASM
-# ``MODE``
-# ``EXIST``
-# only check for existence of the given package
-# ``COMPILE``
-# print the flags needed for compiling an object file which uses
-# the given package
-# ``LINK``
-# print the flags needed for linking when using the given package
-# ``QUIET``
-# if TRUE, don't print anything
+#[=======================================================================[.rst:
+CMakeFindPackageMode
+--------------------
+
+
+
+This file is executed by cmake when invoked with --find-package. It
+expects that the following variables are set using -D:
+
+``NAME``
+ name of the package
+``COMPILER_ID``
+ the CMake compiler ID for which the result is,
+ i.e. GNU/Intel/Clang/MSVC, etc.
+``LANGUAGE``
+ language for which the result will be used,
+ i.e. C/CXX/Fortran/ASM
+``MODE``
+ ``EXIST``
+ only check for existence of the given package
+ ``COMPILE``
+ print the flags needed for compiling an object file which uses
+ the given package
+ ``LINK``
+ print the flags needed for linking when using the given package
+``QUIET``
+ if TRUE, don't print anything
+#]=======================================================================]
if(NOT NAME)
message(FATAL_ERROR "Name of the package to be searched not specified. Set the CMake variable NAME, e.g. -DNAME=JPEG .")
diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake
index 1bc80fd75..7ac09dcaa 100644
--- a/Modules/CMakeForceCompiler.cmake
+++ b/Modules/CMakeForceCompiler.cmake
@@ -1,69 +1,72 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakeForceCompiler
-# ------------------
-#
-# Deprecated. Do not use.
-#
-# The macros provided by this module were once intended for use by
-# cross-compiling toolchain files when CMake was not able to automatically
-# detect the compiler identification. Since the introduction of this module,
-# CMake's compiler identification capabilities have improved and can now be
-# taught to recognize any compiler. Furthermore, the suite of information
-# CMake detects from a compiler is now too extensive to be provided by
-# toolchain files using these macros.
-#
-# One common use case for this module was to skip CMake's checks for a
-# working compiler when using a cross-compiler that cannot link binaries
-# without special flags or custom linker scripts. This case is now supported
-# by setting the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable in the
-# toolchain file instead.
-#
-# -------------------------------------------------------------------------
-#
-# Macro CMAKE_FORCE_C_COMPILER has the following signature:
-#
-# ::
-#
-# CMAKE_FORCE_C_COMPILER(<compiler> <compiler-id>)
-#
-# It sets CMAKE_C_COMPILER to the given compiler and the cmake internal
-# variable CMAKE_C_COMPILER_ID to the given compiler-id. It also
-# bypasses the check for working compiler and basic compiler information
-# tests.
-#
-# Macro CMAKE_FORCE_CXX_COMPILER has the following signature:
-#
-# ::
-#
-# CMAKE_FORCE_CXX_COMPILER(<compiler> <compiler-id>)
-#
-# It sets CMAKE_CXX_COMPILER to the given compiler and the cmake
-# internal variable CMAKE_CXX_COMPILER_ID to the given compiler-id. It
-# also bypasses the check for working compiler and basic compiler
-# information tests.
-#
-# Macro CMAKE_FORCE_Fortran_COMPILER has the following signature:
-#
-# ::
-#
-# CMAKE_FORCE_Fortran_COMPILER(<compiler> <compiler-id>)
-#
-# It sets CMAKE_Fortran_COMPILER to the given compiler and the cmake
-# internal variable CMAKE_Fortran_COMPILER_ID to the given compiler-id.
-# It also bypasses the check for working compiler and basic compiler
-# information tests.
-#
-# So a simple toolchain file could look like this:
-#
-# ::
-#
-# include (CMakeForceCompiler)
-# set(CMAKE_SYSTEM_NAME Generic)
-# CMAKE_FORCE_C_COMPILER (chc12 MetrowerksHicross)
-# CMAKE_FORCE_CXX_COMPILER (chc12 MetrowerksHicross)
+#[=======================================================================[.rst:
+CMakeForceCompiler
+------------------
+
+.. deprecated:: 3.6
+
+ Do not use.
+
+The macros provided by this module were once intended for use by
+cross-compiling toolchain files when CMake was not able to automatically
+detect the compiler identification. Since the introduction of this module,
+CMake's compiler identification capabilities have improved and can now be
+taught to recognize any compiler. Furthermore, the suite of information
+CMake detects from a compiler is now too extensive to be provided by
+toolchain files using these macros.
+
+One common use case for this module was to skip CMake's checks for a
+working compiler when using a cross-compiler that cannot link binaries
+without special flags or custom linker scripts. This case is now supported
+by setting the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable in the
+toolchain file instead.
+
+-------------------------------------------------------------------------
+
+Macro CMAKE_FORCE_C_COMPILER has the following signature:
+
+::
+
+ CMAKE_FORCE_C_COMPILER(<compiler> <compiler-id>)
+
+It sets CMAKE_C_COMPILER to the given compiler and the cmake internal
+variable CMAKE_C_COMPILER_ID to the given compiler-id. It also
+bypasses the check for working compiler and basic compiler information
+tests.
+
+Macro CMAKE_FORCE_CXX_COMPILER has the following signature:
+
+::
+
+ CMAKE_FORCE_CXX_COMPILER(<compiler> <compiler-id>)
+
+It sets CMAKE_CXX_COMPILER to the given compiler and the cmake
+internal variable CMAKE_CXX_COMPILER_ID to the given compiler-id. It
+also bypasses the check for working compiler and basic compiler
+information tests.
+
+Macro CMAKE_FORCE_Fortran_COMPILER has the following signature:
+
+::
+
+ CMAKE_FORCE_Fortran_COMPILER(<compiler> <compiler-id>)
+
+It sets CMAKE_Fortran_COMPILER to the given compiler and the cmake
+internal variable CMAKE_Fortran_COMPILER_ID to the given compiler-id.
+It also bypasses the check for working compiler and basic compiler
+information tests.
+
+So a simple toolchain file could look like this:
+
+::
+
+ include (CMakeForceCompiler)
+ set(CMAKE_SYSTEM_NAME Generic)
+ CMAKE_FORCE_C_COMPILER (chc12 MetrowerksHicross)
+ CMAKE_FORCE_CXX_COMPILER (chc12 MetrowerksHicross)
+#]=======================================================================]
macro(CMAKE_FORCE_C_COMPILER compiler id)
message(DEPRECATION "The CMAKE_FORCE_C_COMPILER macro is deprecated. "
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in
index 9b951fc4e..ae7b73ac4 100644
--- a/Modules/CMakeFortranCompiler.cmake.in
+++ b/Modules/CMakeFortranCompiler.cmake.in
@@ -61,6 +61,7 @@ endif()
@CMAKE_Fortran_SYSROOT_FLAG_CODE@
@CMAKE_Fortran_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
+set(CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES@")
set(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
diff --git a/Modules/CMakeFortranCompilerABI.F b/Modules/CMakeFortranCompilerABI.F
index b34c28484..f4a5489a1 100644
--- a/Modules/CMakeFortranCompilerABI.F
+++ b/Modules/CMakeFortranCompilerABI.F
@@ -33,13 +33,7 @@
#if 0
! Application Binary Interface
#endif
-#if defined(__sgi) && defined(_ABIO32)
- PRINT *, 'INFO:abi[ELF O32]'
-#elif defined(__sgi) && defined(_ABIN32)
- PRINT *, 'INFO:abi[ELF N32]'
-#elif defined(__sgi) && defined(_ABI64)
- PRINT *, 'INFO:abi[ELF 64]'
-#elif defined(__ELF__)
+#if defined(__ELF__)
PRINT *, 'INFO:abi[ELF]'
#endif
PRINT *, 'ABI Detection'
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index da3d9533d..59956944b 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -105,8 +105,6 @@
# endif
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
PRINT *, 'INFO:compiler[VisualAge]'
-#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
- PRINT *, 'INFO:compiler[MIPSpro]'
#elif defined(__hpux) || defined(__hpux__)
PRINT *, 'INFO:compiler[HP]'
#elif defined(NAGFOR)
@@ -114,11 +112,7 @@
#define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10)
#define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10)
#define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD)
-#elif 1
-# if 0
-! The above 'elif 1' instead of 'else' is to work around a bug in the
-! SGI preprocessor which produces both the __sgi and else blocks.
-# endif
+#else
PRINT *, 'INFO:compiler[]'
#endif
#if defined(__CRAYXE) || defined(__CRAYXC)
@@ -148,8 +142,6 @@
PRINT *, 'INFO:platform[SunOS]'
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
PRINT *, 'INFO:platform[AIX]'
-#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
- PRINT *, 'INFO:platform[IRIX]'
#elif defined(__hpux) || defined(__hpux__)
PRINT *, 'INFO:platform[HP-UX]'
#elif defined(__HAIKU__)
@@ -178,11 +170,7 @@
PRINT *, 'INFO:platform[ULTRIX]'
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
PRINT *, 'INFO:platform[Xenix]'
-#elif 1
-# if 0
-! The above 'elif 1' instead of 'else' is to work around a bug in the
-! SGI preprocessor which produces both the __sgi and else blocks.
-# endif
+#else
PRINT *, 'INFO:platform[]'
#endif
#if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC))
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index cceac83c6..ffa6a2471 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -74,6 +74,12 @@ endif()
if(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIE)
set(CMAKE_Fortran_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE})
endif()
+if(NOT CMAKE_Fortran_LINK_OPTIONS_PIE)
+ set(CMAKE_Fortran_LINK_OPTIONS_PIE ${CMAKE_C_LINK_OPTIONS_PIE})
+endif()
+if(NOT CMAKE_Fortran_LINK_OPTIONS_NO_PIE)
+ set(CMAKE_Fortran_LINK_OPTIONS_NO_PIE ${CMAKE_C_LINK_OPTIONS_NO_PIE})
+endif()
if(NOT CMAKE_Fortran_COMPILE_OPTIONS_DLL)
set(CMAKE_Fortran_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL})
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index 02cb46450..ddfc7bd23 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -23,6 +23,8 @@ set(CMAKE_DL_LIBS "dl")
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
+
+set(CMAKE_AUTOGEN_ORIGIN_DEPENDS ON)
set(CMAKE_AUTOMOC_COMPILER_PREDEFINES ON)
set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE")
diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake
index 0d7f1d979..1911e7392 100644
--- a/Modules/CMakeGraphVizOptions.cmake
+++ b/Modules/CMakeGraphVizOptions.cmake
@@ -1,122 +1,123 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakeGraphVizOptions
-# --------------------
-#
-# The builtin graphviz support of CMake.
-#
-# Variables specific to the graphviz support
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# CMake
-# can generate `graphviz <http://www.graphviz.org/>`_ files, showing the dependencies between the
-# targets in a project and also external libraries which are linked
-# against. When CMake is run with the ``--graphviz=foo.dot`` option, it will
-# produce:
-#
-# * a ``foo.dot`` file showing all dependencies in the project
-# * a ``foo.dot.<target>`` file for each target, file showing on which other targets the respective target depends
-# * a ``foo.dot.<target>.dependers`` file, showing which other targets depend on the respective target
-#
-# The different dependency types ``PUBLIC``, ``PRIVATE`` and ``INTERFACE``
-# are represented as solid, dashed and dotted edges.
-#
-# This can result in huge graphs. Using the file
-# ``CMakeGraphVizOptions.cmake`` the look and content of the generated
-# graphs can be influenced. This file is searched first in
-# :variable:`CMAKE_BINARY_DIR` and then in :variable:`CMAKE_SOURCE_DIR`. If found, it is
-# read and the variables set in it are used to adjust options for the
-# generated graphviz files.
-#
-# .. variable:: GRAPHVIZ_GRAPH_TYPE
-#
-# The graph type.
-#
-# * Mandatory : NO
-# * Default : "digraph"
-#
-# Valid graph types are:
-#
-# * "graph" : Nodes are joined with lines
-# * "digraph" : Nodes are joined with arrows showing direction
-# * "strict graph" : Like "graph" but max one line between each node
-# * "strict digraph" : Like "graph" but max one line between each node in each direction
-#
-# .. variable:: GRAPHVIZ_GRAPH_NAME
-#
-# The graph name.
-#
-# * Mandatory : NO
-# * Default : "GG"
-#
-# .. variable:: GRAPHVIZ_GRAPH_HEADER
-#
-# The header written at the top of the graphviz file.
-#
-# * Mandatory : NO
-# * Default : "node [n fontsize = "12"];"
-#
-# .. variable:: GRAPHVIZ_NODE_PREFIX
-#
-# The prefix for each node in the graphviz file.
-#
-# * Mandatory : NO
-# * Default : "node"
-#
-# .. variable:: GRAPHVIZ_EXECUTABLES
-#
-# Set this to FALSE to exclude executables from the generated graphs.
-#
-# * Mandatory : NO
-# * Default : TRUE
-#
-# .. variable:: GRAPHVIZ_STATIC_LIBS
-#
-# Set this to FALSE to exclude static libraries from the generated graphs.
-#
-# * Mandatory : NO
-# * Default : TRUE
-#
-# .. variable:: GRAPHVIZ_SHARED_LIBS
-#
-# Set this to FALSE to exclude shared libraries from the generated graphs.
-#
-# * Mandatory : NO
-# * Default : TRUE
-#
-# .. variable:: GRAPHVIZ_MODULE_LIBS
-#
-# Set this to FALSE to exclude module libraries from the generated graphs.
-#
-# * Mandatory : NO
-# * Default : TRUE
-#
-# .. variable:: GRAPHVIZ_EXTERNAL_LIBS
-#
-# Set this to FALSE to exclude external libraries from the generated graphs.
-#
-# * Mandatory : NO
-# * Default : TRUE
-#
-# .. variable:: GRAPHVIZ_IGNORE_TARGETS
-#
-# A list of regular expressions for ignoring targets.
-#
-# * Mandatory : NO
-# * Default : empty
-#
-# .. variable:: GRAPHVIZ_GENERATE_PER_TARGET
-#
-# Set this to FALSE to exclude per target graphs ``foo.dot.<target>``.
-#
-# * Mandatory : NO
-# * Default : TRUE
-#
-# .. variable:: GRAPHVIZ_GENERATE_DEPENDERS
-#
-# Set this to FALSE to exclude depender graphs ``foo.dot.<target>.dependers``.
-#
-# * Mandatory : NO
-# * Default : TRUE
+#[=======================================================================[.rst:
+CMakeGraphVizOptions
+--------------------
+
+The builtin graphviz support of CMake.
+
+Variables specific to the graphviz support
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+CMake
+can generate `graphviz <http://www.graphviz.org/>`_ files, showing the dependencies between the
+targets in a project and also external libraries which are linked
+against. When CMake is run with the ``--graphviz=foo.dot`` option, it will
+produce:
+
+* a ``foo.dot`` file showing all dependencies in the project
+* a ``foo.dot.<target>`` file for each target, file showing on which other targets the respective target depends
+* a ``foo.dot.<target>.dependers`` file, showing which other targets depend on the respective target
+
+The different dependency types ``PUBLIC``, ``PRIVATE`` and ``INTERFACE``
+are represented as solid, dashed and dotted edges.
+
+This can result in huge graphs. Using the file
+``CMakeGraphVizOptions.cmake`` the look and content of the generated
+graphs can be influenced. This file is searched first in
+:variable:`CMAKE_BINARY_DIR` and then in :variable:`CMAKE_SOURCE_DIR`. If found, it is
+read and the variables set in it are used to adjust options for the
+generated graphviz files.
+
+.. variable:: GRAPHVIZ_GRAPH_TYPE
+
+ The graph type.
+
+ * Mandatory : NO
+ * Default : "digraph"
+
+ Valid graph types are:
+
+ * "graph" : Nodes are joined with lines
+ * "digraph" : Nodes are joined with arrows showing direction
+ * "strict graph" : Like "graph" but max one line between each node
+ * "strict digraph" : Like "graph" but max one line between each node in each direction
+
+.. variable:: GRAPHVIZ_GRAPH_NAME
+
+ The graph name.
+
+ * Mandatory : NO
+ * Default : "GG"
+
+.. variable:: GRAPHVIZ_GRAPH_HEADER
+
+ The header written at the top of the graphviz file.
+
+ * Mandatory : NO
+ * Default : "node [n fontsize = "12"];"
+
+.. variable:: GRAPHVIZ_NODE_PREFIX
+
+ The prefix for each node in the graphviz file.
+
+ * Mandatory : NO
+ * Default : "node"
+
+.. variable:: GRAPHVIZ_EXECUTABLES
+
+ Set this to FALSE to exclude executables from the generated graphs.
+
+ * Mandatory : NO
+ * Default : TRUE
+
+.. variable:: GRAPHVIZ_STATIC_LIBS
+
+ Set this to FALSE to exclude static libraries from the generated graphs.
+
+ * Mandatory : NO
+ * Default : TRUE
+
+.. variable:: GRAPHVIZ_SHARED_LIBS
+
+ Set this to FALSE to exclude shared libraries from the generated graphs.
+
+ * Mandatory : NO
+ * Default : TRUE
+
+.. variable:: GRAPHVIZ_MODULE_LIBS
+
+ Set this to FALSE to exclude module libraries from the generated graphs.
+
+ * Mandatory : NO
+ * Default : TRUE
+
+.. variable:: GRAPHVIZ_EXTERNAL_LIBS
+
+ Set this to FALSE to exclude external libraries from the generated graphs.
+
+ * Mandatory : NO
+ * Default : TRUE
+
+.. variable:: GRAPHVIZ_IGNORE_TARGETS
+
+ A list of regular expressions for ignoring targets.
+
+ * Mandatory : NO
+ * Default : empty
+
+.. variable:: GRAPHVIZ_GENERATE_PER_TARGET
+
+ Set this to FALSE to exclude per target graphs ``foo.dot.<target>``.
+
+ * Mandatory : NO
+ * Default : TRUE
+
+.. variable:: GRAPHVIZ_GENERATE_DEPENDERS
+
+ Set this to FALSE to exclude depender graphs ``foo.dot.<target>.dependers``.
+
+ * Mandatory : NO
+ * Default : TRUE
+#]=======================================================================]
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index d5301d737..22fc95366 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -1,209 +1,223 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakePackageConfigHelpers
-# -------------------------
-#
-# Helpers functions for creating config files that can be included by other
-# projects to find and use a package.
-#
-# Adds the :command:`configure_package_config_file()` and
-# :command:`write_basic_package_version_file()` commands.
-#
-# Generating a Package Configuration File
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# .. command:: configure_package_config_file
-#
-# Create a config file for a project::
-#
-# configure_package_config_file(<input> <output>
-# INSTALL_DESTINATION <path>
-# [PATH_VARS <var1> <var2> ... <varN>]
-# [NO_SET_AND_CHECK_MACRO]
-# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]
-# [INSTALL_PREFIX <path>]
-# )
-#
-# ``configure_package_config_file()`` should be used instead of the plain
-# :command:`configure_file()` command when creating the ``<PackageName>Config.cmake``
-# or ``<PackageName>-config.cmake`` file for installing a project or library.
-# It helps making the resulting package relocatable by avoiding hardcoded paths
-# in the installed ``Config.cmake`` file.
-#
-# In a ``FooConfig.cmake`` file there may be code like this to make the install
-# destinations know to the using project:
-#
-# .. code-block:: cmake
-#
-# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" )
-# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" )
-# set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" )
-# #...logic to determine installedPrefix from the own location...
-# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" )
-#
-# All 4 options shown above are not sufficient, since the first 3 hardcode the
-# absolute directory locations, and the 4th case works only if the logic to
-# determine the ``installedPrefix`` is correct, and if ``CONFIG_INSTALL_DIR``
-# contains a relative path, which in general cannot be guaranteed. This has the
-# effect that the resulting ``FooConfig.cmake`` file would work poorly under
-# Windows and OSX, where users are used to choose the install location of a
-# binary package at install time, independent from how
-# :variable:`CMAKE_INSTALL_PREFIX` was set at build/cmake time.
-#
-# Using ``configure_package_config_file`` helps. If used correctly, it makes
-# the resulting ``FooConfig.cmake`` file relocatable. Usage:
-#
-# 1. write a ``FooConfig.cmake.in`` file as you are used to
-# 2. insert a line containing only the string ``@PACKAGE_INIT@``
-# 3. instead of ``set(FOO_DIR "@SOME_INSTALL_DIR@")``, use
-# ``set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")`` (this must be after the
-# ``@PACKAGE_INIT@`` line)
-# 4. instead of using the normal :command:`configure_file()`, use
-# ``configure_package_config_file()``
-#
-#
-#
-# The ``<input>`` and ``<output>`` arguments are the input and output file, the
-# same way as in :command:`configure_file()`.
-#
-# The ``<path>`` given to ``INSTALL_DESTINATION`` must be the destination where
-# the ``FooConfig.cmake`` file will be installed to. This path can either be
-# absolute, or relative to the ``INSTALL_PREFIX`` path.
-#
-# The variables ``<var1>`` to ``<varN>`` given as ``PATH_VARS`` are the
-# variables which contain install destinations. For each of them the macro will
-# create a helper variable ``PACKAGE_<var...>``. These helper variables must be
-# used in the ``FooConfig.cmake.in`` file for setting the installed location.
-# They are calculated by ``configure_package_config_file`` so that they are
-# always relative to the installed location of the package. This works both for
-# relative and also for absolute locations. For absolute locations it works
-# only if the absolute location is a subdirectory of ``INSTALL_PREFIX``.
-#
-# If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to
-# calculate all the relative paths. The ``<path>`` argument must be an absolute
-# path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX`
-# variable will be used instead. The default value is good when generating a
-# FooConfig.cmake file to use your package from the install tree. When
-# generating a FooConfig.cmake file to use your package from the build tree this
-# option should be used.
-#
-# By default ``configure_package_config_file`` also generates two helper macros,
-# ``set_and_check()`` and ``check_required_components()`` into the
-# ``FooConfig.cmake`` file.
-#
-# ``set_and_check()`` should be used instead of the normal ``set()`` command for
-# setting directories and file locations. Additionally to setting the variable
-# it also checks that the referenced file or directory actually exists and fails
-# with a ``FATAL_ERROR`` otherwise. This makes sure that the created
-# ``FooConfig.cmake`` file does not contain wrong references.
-# When using the ``NO_SET_AND_CHECK_MACRO``, this macro is not generated
-# into the ``FooConfig.cmake`` file.
-#
-# ``check_required_components(<PackageName>)`` should be called at the end of
-# the ``FooConfig.cmake`` file. This macro checks whether all requested,
-# non-optional components have been found, and if this is not the case, sets
-# the ``Foo_FOUND`` variable to ``FALSE``, so that the package is considered to
-# be not found. It does that by testing the ``Foo_<Component>_FOUND``
-# variables for all requested required components. This macro should be
-# called even if the package doesn't provide any components to make sure
-# users are not specifying components erroneously. When using the
-# ``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is not generated
-# into the ``FooConfig.cmake`` file.
-#
-# For an example see below the documentation for
-# :command:`write_basic_package_version_file()`.
-#
-# Generating a Package Version File
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# .. command:: write_basic_package_version_file
-#
-# Create a version file for a project::
-#
-# write_basic_package_version_file(<filename>
-# [VERSION <major.minor.patch>]
-# COMPATIBILITY <AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion> )
-#
-#
-# Writes a file for use as ``<PackageName>ConfigVersion.cmake`` file to
-# ``<filename>``. See the documentation of :command:`find_package()` for
-# details on this.
-#
-# ``<filename>`` is the output filename, it should be in the build tree.
-# ``<major.minor.patch>`` is the version number of the project to be installed.
-#
-# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable is used.
-# If this hasn't been set, it errors out.
-#
-# The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed
-# package version will be considered compatible if it is newer or exactly the
-# same as the requested version. This mode should be used for packages which
-# are fully backward compatible, also across major versions.
-# If ``SameMajorVersion`` is used instead, then the behaviour differs from
-# ``AnyNewerVersion`` in that the major version number must be the same as
-# requested, e.g. version 2.0 will not be considered compatible if 1.0 is
-# requested. This mode should be used for packages which guarantee backward
-# compatibility within the same major version.
-# If ``SameMinorVersion`` is used, the behaviour is the same as
-# ``SameMajorVersion``, but both major and minor version must be the same as
-# requested, e.g version 0.2 will not be compatible if 0.1 is requested.
-# If ``ExactVersion`` is used, then the package is only considered compatible if
-# the requested version matches exactly its own version number (not considering
-# the tweak version). For example, version 1.2.3 of a package is only
-# considered compatible to requested version 1.2.3. This mode is for packages
-# without compatibility guarantees.
-# If your project has more elaborated version matching rules, you will need to
-# write your own custom ``ConfigVersion.cmake`` file instead of using this
-# macro.
-#
-# Internally, this macro executes :command:`configure_file()` to create the
-# resulting version file. Depending on the ``COMPATIBILITY``, the corresponding
-# ``BasicConfigVersion-<COMPATIBILITY>.cmake.in`` file is used.
-# Please note that these files are internal to CMake and you should not call
-# :command:`configure_file()` on them yourself, but they can be used as starting
-# point to create more sophisticted custom ``ConfigVersion.cmake`` files.
-#
-# Example Generating Package Files
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# Example using both :command:`configure_package_config_file` and
-# ``write_basic_package_version_file()``:
-#
-# ``CMakeLists.txt``:
-#
-# .. code-block:: cmake
-#
-# set(INCLUDE_INSTALL_DIR include/ ... CACHE )
-# set(LIB_INSTALL_DIR lib/ ... CACHE )
-# set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE )
-# #...
-# include(CMakePackageConfigHelpers)
-# configure_package_config_file(FooConfig.cmake.in
-# ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
-# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake
-# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR)
-# write_basic_package_version_file(
-# ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
-# VERSION 1.2.3
-# COMPATIBILITY SameMajorVersion )
-# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
-# ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
-# DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake )
-#
-# ``FooConfig.cmake.in``:
-#
-# ::
-#
-# set(FOO_VERSION x.y.z)
-# ...
-# @PACKAGE_INIT@
-# ...
-# set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
-# set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@")
-#
-# check_required_components(Foo)
+#[=======================================================================[.rst:
+CMakePackageConfigHelpers
+-------------------------
+
+Helpers functions for creating config files that can be included by other
+projects to find and use a package.
+
+Adds the :command:`configure_package_config_file()` and
+:command:`write_basic_package_version_file()` commands.
+
+Generating a Package Configuration File
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. command:: configure_package_config_file
+
+ Create a config file for a project::
+
+ configure_package_config_file(<input> <output>
+ INSTALL_DESTINATION <path>
+ [PATH_VARS <var1> <var2> ... <varN>]
+ [NO_SET_AND_CHECK_MACRO]
+ [NO_CHECK_REQUIRED_COMPONENTS_MACRO]
+ [INSTALL_PREFIX <path>]
+ )
+
+``configure_package_config_file()`` should be used instead of the plain
+:command:`configure_file()` command when creating the ``<PackageName>Config.cmake``
+or ``<PackageName>-config.cmake`` file for installing a project or library.
+It helps making the resulting package relocatable by avoiding hardcoded paths
+in the installed ``Config.cmake`` file.
+
+In a ``FooConfig.cmake`` file there may be code like this to make the install
+destinations know to the using project:
+
+.. code-block:: cmake
+
+ set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" )
+ set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" )
+ set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" )
+ #...logic to determine installedPrefix from the own location...
+ set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" )
+
+All 4 options shown above are not sufficient, since the first 3 hardcode the
+absolute directory locations, and the 4th case works only if the logic to
+determine the ``installedPrefix`` is correct, and if ``CONFIG_INSTALL_DIR``
+contains a relative path, which in general cannot be guaranteed. This has the
+effect that the resulting ``FooConfig.cmake`` file would work poorly under
+Windows and OSX, where users are used to choose the install location of a
+binary package at install time, independent from how
+:variable:`CMAKE_INSTALL_PREFIX` was set at build/cmake time.
+
+Using ``configure_package_config_file`` helps. If used correctly, it makes
+the resulting ``FooConfig.cmake`` file relocatable. Usage:
+
+1. write a ``FooConfig.cmake.in`` file as you are used to
+2. insert a line containing only the string ``@PACKAGE_INIT@``
+3. instead of ``set(FOO_DIR "@SOME_INSTALL_DIR@")``, use
+ ``set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")`` (this must be after the
+ ``@PACKAGE_INIT@`` line)
+4. instead of using the normal :command:`configure_file()`, use
+ ``configure_package_config_file()``
+
+
+
+The ``<input>`` and ``<output>`` arguments are the input and output file, the
+same way as in :command:`configure_file()`.
+
+The ``<path>`` given to ``INSTALL_DESTINATION`` must be the destination where
+the ``FooConfig.cmake`` file will be installed to. This path can either be
+absolute, or relative to the ``INSTALL_PREFIX`` path.
+
+The variables ``<var1>`` to ``<varN>`` given as ``PATH_VARS`` are the
+variables which contain install destinations. For each of them the macro will
+create a helper variable ``PACKAGE_<var...>``. These helper variables must be
+used in the ``FooConfig.cmake.in`` file for setting the installed location.
+They are calculated by ``configure_package_config_file`` so that they are
+always relative to the installed location of the package. This works both for
+relative and also for absolute locations. For absolute locations it works
+only if the absolute location is a subdirectory of ``INSTALL_PREFIX``.
+
+If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to
+calculate all the relative paths. The ``<path>`` argument must be an absolute
+path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX`
+variable will be used instead. The default value is good when generating a
+FooConfig.cmake file to use your package from the install tree. When
+generating a FooConfig.cmake file to use your package from the build tree this
+option should be used.
+
+By default ``configure_package_config_file`` also generates two helper macros,
+``set_and_check()`` and ``check_required_components()`` into the
+``FooConfig.cmake`` file.
+
+``set_and_check()`` should be used instead of the normal ``set()`` command for
+setting directories and file locations. Additionally to setting the variable
+it also checks that the referenced file or directory actually exists and fails
+with a ``FATAL_ERROR`` otherwise. This makes sure that the created
+``FooConfig.cmake`` file does not contain wrong references.
+When using the ``NO_SET_AND_CHECK_MACRO``, this macro is not generated
+into the ``FooConfig.cmake`` file.
+
+``check_required_components(<PackageName>)`` should be called at the end of
+the ``FooConfig.cmake`` file. This macro checks whether all requested,
+non-optional components have been found, and if this is not the case, sets
+the ``Foo_FOUND`` variable to ``FALSE``, so that the package is considered to
+be not found. It does that by testing the ``Foo_<Component>_FOUND``
+variables for all requested required components. This macro should be
+called even if the package doesn't provide any components to make sure
+users are not specifying components erroneously. When using the
+``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is not generated
+into the ``FooConfig.cmake`` file.
+
+For an example see below the documentation for
+:command:`write_basic_package_version_file()`.
+
+Generating a Package Version File
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. command:: write_basic_package_version_file
+
+ Create a version file for a project::
+
+ write_basic_package_version_file(<filename>
+ [VERSION <major.minor.patch>]
+ COMPATIBILITY <AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion>
+ [ARCH_INDEPENDENT] )
+
+
+Writes a file for use as ``<PackageName>ConfigVersion.cmake`` file to
+``<filename>``. See the documentation of :command:`find_package()` for
+details on this.
+
+``<filename>`` is the output filename, it should be in the build tree.
+``<major.minor.patch>`` is the version number of the project to be installed.
+
+If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable is used.
+If this hasn't been set, it errors out.
+
+The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed
+package version will be considered compatible if it is newer or exactly the
+same as the requested version. This mode should be used for packages which
+are fully backward compatible, also across major versions.
+If ``SameMajorVersion`` is used instead, then the behaviour differs from
+``AnyNewerVersion`` in that the major version number must be the same as
+requested, e.g. version 2.0 will not be considered compatible if 1.0 is
+requested. This mode should be used for packages which guarantee backward
+compatibility within the same major version.
+If ``SameMinorVersion`` is used, the behaviour is the same as
+``SameMajorVersion``, but both major and minor version must be the same as
+requested, e.g version 0.2 will not be compatible if 0.1 is requested.
+If ``ExactVersion`` is used, then the package is only considered compatible if
+the requested version matches exactly its own version number (not considering
+the tweak version). For example, version 1.2.3 of a package is only
+considered compatible to requested version 1.2.3. This mode is for packages
+without compatibility guarantees.
+If your project has more elaborated version matching rules, you will need to
+write your own custom ``ConfigVersion.cmake`` file instead of using this
+macro.
+
+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.
+
+Internally, this macro executes :command:`configure_file()` to create the
+resulting version file. Depending on the ``COMPATIBILITY``, the corresponding
+``BasicConfigVersion-<COMPATIBILITY>.cmake.in`` file is used.
+Please note that these files are internal to CMake and you should not call
+:command:`configure_file()` on them yourself, but they can be used as starting
+point to create more sophisticted custom ``ConfigVersion.cmake`` files.
+
+Example Generating Package Files
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Example using both :command:`configure_package_config_file` and
+``write_basic_package_version_file()``:
+
+``CMakeLists.txt``:
+
+.. code-block:: cmake
+
+ set(INCLUDE_INSTALL_DIR include/ ... CACHE )
+ set(LIB_INSTALL_DIR lib/ ... CACHE )
+ set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE )
+ #...
+ include(CMakePackageConfigHelpers)
+ configure_package_config_file(FooConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
+ INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake
+ PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR)
+ write_basic_package_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
+ VERSION 1.2.3
+ COMPATIBILITY SameMajorVersion )
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
+ DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake )
+
+``FooConfig.cmake.in``:
+
+::
+
+ set(FOO_VERSION x.y.z)
+ ...
+ @PACKAGE_INIT@
+ ...
+ set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
+ set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@")
+
+ check_required_components(Foo)
+#]=======================================================================]
include(WriteBasicConfigVersionFile)
diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake
index 7ee2bbace..c753b7f51 100644
--- a/Modules/CMakeParseArguments.cmake
+++ b/Modules/CMakeParseArguments.cmake
@@ -1,11 +1,12 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakeParseArguments
-# -------------------
-#
-# This module once implemented the :command:`cmake_parse_arguments` command
-# that is now implemented natively by CMake. It is now an empty placeholder
-# for compatibility with projects that include it to get the command from
-# CMake 3.4 and lower.
+#[=======================================================================[.rst:
+CMakeParseArguments
+-------------------
+
+This module once implemented the :command:`cmake_parse_arguments` command
+that is now implemented natively by CMake. It is now an empty placeholder
+for compatibility with projects that include it to get the command from
+CMake 3.4 and lower.
+#]=======================================================================]
diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake
new file mode 100644
index 000000000..c8d4c5acd
--- /dev/null
+++ b/Modules/CMakeParseImplicitIncludeInfo.cmake
@@ -0,0 +1,237 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# This is used internally by CMake and should not be included by user code.
+
+# helper function that parses implicit include dirs from a single line
+# for compilers that report them that way. on success we return the
+# list of dirs in id_var and set state_var to the 'done' state.
+function(cmake_parse_implicit_include_line line lang id_var log_var state_var)
+ # clear variables we append to (avoids possible polution from parent scopes)
+ unset(rv)
+ set(log "")
+
+ # Cray compiler (from cray wrapper, via PrgEnv-cray)
+ if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "Cray" AND
+ "${line}" MATCHES "^/" AND "${line}" MATCHES "/ccfe |/ftnfe " AND
+ "${line}" MATCHES " -isystem| -I")
+ string(REGEX MATCHALL " (-I ?|-isystem )([^ ]*)" incs "${line}")
+ foreach(inc IN LISTS incs)
+ string(REGEX REPLACE " (-I ?|-isystem )([^ ]*)" "\\2" idir "${inc}")
+ list(APPEND rv "${idir}")
+ endforeach()
+ if(rv)
+ string(APPEND log " got implicit includes via cray ccfe parser!\n")
+ else()
+ string(APPEND log " warning: cray ccfe parse failed!\n")
+ endif()
+ endif()
+
+ # PGI compiler
+ if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "PGI")
+ # pgc++ verbose output differs
+ if(("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "Fortran") AND
+ "${line}" MATCHES "^/" AND
+ "${line}" MATCHES "/pgc |/pgf901 |/pgftnc " AND
+ "${line}" MATCHES " -cmdline ")
+ # cmdline has unparsed cmdline, remove it
+ string(REGEX REPLACE "-cmdline .*" "" line "${line}")
+ if("${line}" MATCHES " -nostdinc ")
+ set(rv "") # defined, but empty
+ else()
+ string(REGEX MATCHALL " -stdinc ([^ ]*)" incs "${line}")
+ foreach(inc IN LISTS incs)
+ string(REGEX REPLACE " -stdinc ([^ ]*)" "\\1" idir "${inc}")
+ string(REPLACE ":" ";" idir "${idir}")
+ list(APPEND rv ${idir})
+ endforeach()
+ endif()
+ if(DEFINED rv)
+ string(APPEND log " got implicit includes via PGI C/F parser!\n")
+ else()
+ string(APPEND log " warning: PGI C/F parse failed!\n")
+ endif()
+ elseif("${lang}" STREQUAL "CXX" AND "${line}" MATCHES "^/" AND
+ "${line}" MATCHES "/pggpp1 " AND "${line}" MATCHES " -I")
+ # oddly, -Mnostdinc does not get rid of system -I's, at least in
+ # PGI 18.10.1 ...
+ string(REGEX MATCHALL " (-I ?)([^ ]*)" incs "${line}")
+ foreach(inc IN LISTS incs)
+ string(REGEX REPLACE " (-I ?)([^ ]*)" "\\2" idir "${inc}")
+ if(NOT "${idir}" STREQUAL "-") # filter out "-I-"
+ list(APPEND rv "${idir}")
+ endif()
+ endforeach()
+ if(DEFINED rv)
+ string(APPEND log " got implicit includes via PGI CXX parser!\n")
+ else()
+ string(APPEND log " warning: PGI CXX parse failed!\n")
+ endif()
+ endif()
+ endif()
+
+ # SunPro compiler
+ if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "SunPro" AND
+ ("${line}" MATCHES "-D__SUNPRO_C" OR "${line}" MATCHES "-D__SUNPRO_F") )
+ string(REGEX MATCHALL " (-I ?)([^ ]*)" incs "${line}")
+ foreach(inc IN LISTS incs)
+ string(REGEX REPLACE " (-I ?)([^ ]*)" "\\2" idir "${inc}")
+ if(NOT "${idir}" STREQUAL "-xbuiltin")
+ list(APPEND rv "${idir}")
+ endif()
+ endforeach()
+ if(rv)
+ if ("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "CXX")
+ # /usr/include appears to be hardwired in
+ list(APPEND rv "/usr/include")
+ endif()
+ string(APPEND log " got implicit includes via sunpro parser!\n")
+ else()
+ string(APPEND log " warning: sunpro parse failed!\n")
+ endif()
+ endif()
+
+ # XL compiler
+ if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL" AND "${line}" MATCHES "^/"
+ AND ( ("${lang}" STREQUAL "Fortran" AND
+ "${line}" MATCHES "/xl[fF]entry " AND
+ "${line}" MATCHES "OSVAR\\([^ ]+\\)")
+ OR
+ ( ("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "CXX") AND
+ "${line}" MATCHES "/xl[cC]entry " AND
+ "${line}" MATCHES " -qosvar=")
+ ) )
+ # -qnostdinc cancels other stdinc flags, even if present
+ string(FIND "${line}" " -qnostdinc" nostd)
+ if(NOT ${nostd} EQUAL -1)
+ set(rv "") # defined but empty
+ string(APPEND log " got implicit includes via XL parser (nostdinc)\n")
+ else()
+ if("${lang}" STREQUAL "CXX")
+ string(REGEX MATCHALL " -qcpp_stdinc=([^ ]*)" std "${line}")
+ string(REGEX MATCHALL " -qgcc_cpp_stdinc=([^ ]*)" gcc_std "${line}")
+ else()
+ string(REGEX MATCHALL " -qc_stdinc=([^ ]*)" std "${line}")
+ string(REGEX MATCHALL " -qgcc_c_stdinc=([^ ]*)" gcc_std "${line}")
+ endif()
+ set(xlstd ${std} ${gcc_std})
+ foreach(inc IN LISTS xlstd)
+ string(REGEX REPLACE " -q(cpp|gcc_cpp|c|gcc_c)_stdinc=([^ ]*)" "\\2"
+ ipath "${inc}")
+ string(REPLACE ":" ";" ipath "${ipath}")
+ list(APPEND rv ${ipath})
+ endforeach()
+ endif()
+ # user can add -I flags via CMAKE_{C,CXX}_FLAGS, look for that too
+ string(REGEX MATCHALL " (-I ?)([^ ]*)" incs "${line}")
+ unset(urv)
+ foreach(inc IN LISTS incs)
+ string(REGEX REPLACE " (-I ?)([^ ]*)" "\\2" idir "${inc}")
+ list(APPEND urv "${idir}")
+ endforeach()
+ if(urv)
+ if ("${rv}" STREQUAL "")
+ set(rv ${urv})
+ else()
+ list(APPEND rv ${urv})
+ endif()
+ endif()
+
+ if(DEFINED rv)
+ string(APPEND log " got implicit includes via XL parser!\n")
+ else()
+ string(APPEND log " warning: XL parse failed!\n")
+ endif()
+ endif()
+
+ if(log)
+ set(${log_var} "${log}" PARENT_SCOPE)
+ else()
+ unset(${log_var} PARENT_SCOPE)
+ endif()
+ if(DEFINED rv)
+ set(${id_var} "${rv}" PARENT_SCOPE)
+ set(${state_var} "done" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# top-level function to parse implicit include directory information
+# from verbose compiler output. sets state_var in parent to 'done' on success.
+function(cmake_parse_implicit_include_info text lang dir_var log_var state_var)
+ set(state start) # values: start, loading, done
+
+ # clear variables we append to (avoids possible polution from parent scopes)
+ set(implicit_dirs_tmp)
+ set(log "")
+
+ # go through each line of output...
+ string(REGEX REPLACE "\r?\n" ";" output_lines "${text}")
+ foreach(line IN LISTS output_lines)
+ if(state STREQUAL start)
+ string(FIND "${line}" "#include \"...\" search starts here:" rv)
+ if(rv GREATER -1)
+ set(state loading)
+ set(preload 1) # looking for include <...> now
+ string(APPEND log " found start of include info\n")
+ else()
+ cmake_parse_implicit_include_line("${line}" "${lang}" implicit_dirs_tmp
+ linelog state)
+ if(linelog)
+ string(APPEND log ${linelog})
+ endif()
+ if(state STREQUAL done)
+ break()
+ endif()
+ endif()
+ elseif(state STREQUAL loading)
+ string(FIND "${line}" "End of search list." rv)
+ if(rv GREATER -1)
+ set(state done)
+ string(APPEND log " end of search list found\n")
+ break()
+ endif()
+ if(preload)
+ string(FIND "${line}" "#include <...> search starts here:" rv)
+ if(rv GREATER -1)
+ set(preload 0)
+ string(APPEND log " found start of implicit include info\n")
+ endif()
+ continue()
+ endif()
+ if("${line}" MATCHES "^ ")
+ string(SUBSTRING "${line}" 1 -1 line) # remove leading space
+ endif()
+ if ("${line}" MATCHES " \\(framework directory\\)$")
+ continue() # frameworks are handled elsewhere, ignore them here
+ endif()
+ string(REPLACE "\\" "/" path "${line}")
+ list(APPEND implicit_dirs_tmp "${path}")
+ string(APPEND log " add: [${path}]\n")
+ endif()
+ endforeach()
+
+ set(implicit_dirs "")
+ foreach(d IN LISTS implicit_dirs_tmp)
+ if(IS_ABSOLUTE "${d}")
+ get_filename_component(dir "${d}" ABSOLUTE)
+ list(APPEND implicit_dirs "${dir}")
+ string(APPEND log " collapse include dir [${d}] ==> [${dir}]\n")
+ else()
+ string(APPEND log " skipping relative include dir [${d}]\n")
+ endif()
+ endforeach()
+ list(REMOVE_DUPLICATES implicit_dirs)
+
+ # Log results.
+ if(state STREQUAL done)
+ string(APPEND log " implicit include dirs: [${implicit_dirs}]\n")
+ else()
+ string(APPEND log " warn: unable to parse implicit include dirs!\n")
+ endif()
+
+ # Return results.
+ set(${dir_var} "${implicit_dirs}" PARENT_SCOPE)
+ set(${log_var} "${log}" PARENT_SCOPE)
+ set(${state_var} "${state}" PARENT_SCOPE)
+
+endfunction()
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index dd77379c3..3cb7f2474 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -32,9 +32,6 @@
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
# define PLATFORM_ID "AIX"
-#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
-# define PLATFORM_ID "IRIX"
-
#elif defined(__hpux) || defined(__hpux__)
# define PLATFORM_ID "HP-UX"
@@ -94,6 +91,14 @@
# define PLATFORM_ID
# endif
+#elif defined(__INTEGRITY)
+# if defined(INT_178B)
+# define PLATFORM_ID "Integrity178"
+
+# else /* regular Integrity */
+# define PLATFORM_ID "Integrity"
+# endif
+
#else /* unknown platform */
# define PLATFORM_ID
@@ -157,6 +162,26 @@
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
+
+#elif defined(__ghs__)
+# if defined(__PPC64__)
+# define ARCHITECTURE_ID "PPC64"
+
+# elif defined(__ppc__)
+# define ARCHITECTURE_ID "PPC"
+
+# elif defined(__ARM__)
+# define ARCHITECTURE_ID "ARM"
+
+# elif defined(__x86_64__)
+# define ARCHITECTURE_ID "x64"
+
+# elif defined(__i386__)
+# define ARCHITECTURE_ID "X86"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
#else
# define ARCHITECTURE_ID
#endif
diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake
index 21c333e31..1af0bb730 100644
--- a/Modules/CMakePrintHelpers.cmake
+++ b/Modules/CMakePrintHelpers.cmake
@@ -1,45 +1,47 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakePrintHelpers
-# -----------------
-#
-# Convenience macros for printing properties and variables, useful e.g. for debugging.
-#
-# ::
-#
-# CMAKE_PRINT_PROPERTIES([TARGETS target1 .. targetN]
-# [SOURCES source1 .. sourceN]
-# [DIRECTORIES dir1 .. dirN]
-# [TESTS test1 .. testN]
-# [CACHE_ENTRIES entry1 .. entryN]
-# PROPERTIES prop1 .. propN )
-#
-# This macro prints the values of the properties of the given targets,
-# source files, directories, tests or cache entries. Exactly one of the
-# scope keywords must be used. Example::
-#
-# cmake_print_properties(TARGETS foo bar PROPERTIES
-# LOCATION INTERFACE_INCLUDE_DIRS)
-#
-# This will print the LOCATION and INTERFACE_INCLUDE_DIRS properties for
-# both targets foo and bar.
-#
-#
-#
-# CMAKE_PRINT_VARIABLES(var1 var2 .. varN)
-#
-# This macro will print the name of each variable followed by its value.
-# Example::
-#
-# cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION DOES_NOT_EXIST)
-#
-# Gives::
-#
-# -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; DOES_NOT_EXIST=""
-
-function(CMAKE_PRINT_VARIABLES)
+#[=======================================================================[.rst:
+CMakePrintHelpers
+-----------------
+
+Convenience functions for printing properties and variables, useful
+e.g. for debugging.
+
+::
+
+ cmake_print_properties([TARGETS target1 .. targetN]
+ [SOURCES source1 .. sourceN]
+ [DIRECTORIES dir1 .. dirN]
+ [TESTS test1 .. testN]
+ [CACHE_ENTRIES entry1 .. entryN]
+ PROPERTIES prop1 .. propN )
+
+This function prints the values of the properties of the given targets,
+source files, directories, tests or cache entries. Exactly one of the
+scope keywords must be used. Example::
+
+ cmake_print_properties(TARGETS foo bar PROPERTIES
+ LOCATION INTERFACE_INCLUDE_DIRS)
+
+This will print the LOCATION and INTERFACE_INCLUDE_DIRS properties for
+both targets foo and bar.
+
+::
+
+ cmake_print_variables(var1 var2 .. varN)
+
+This function will print the name of each variable followed by its value.
+Example::
+
+ cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION DOES_NOT_EXIST)
+
+Gives::
+
+ -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; DOES_NOT_EXIST=""
+#]=======================================================================]
+
+function(cmake_print_variables)
set(msg "")
foreach(var ${ARGN})
if(msg)
@@ -51,7 +53,7 @@ function(CMAKE_PRINT_VARIABLES)
endfunction()
-function(CMAKE_PRINT_PROPERTIES )
+function(cmake_print_properties)
set(options )
set(oneValueArgs )
set(multiValueArgs TARGETS SOURCES TESTS DIRECTORIES CACHE_ENTRIES PROPERTIES )
diff --git a/Modules/CMakePrintSystemInformation.cmake b/Modules/CMakePrintSystemInformation.cmake
index e74c801db..f873a4d97 100644
--- a/Modules/CMakePrintSystemInformation.cmake
+++ b/Modules/CMakePrintSystemInformation.cmake
@@ -1,14 +1,15 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakePrintSystemInformation
-# ---------------------------
-#
-# print system information
-#
-# This file can be used for diagnostic purposes just include it in a
-# project to see various internal CMake variables.
+#[=======================================================================[.rst:
+CMakePrintSystemInformation
+---------------------------
+
+print system information
+
+This file can be used for diagnostic purposes just include it in a
+project to see various internal CMake variables.
+#]=======================================================================]
message("CMAKE_SYSTEM is ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}")
message("CMAKE_SYSTEM file is ${CMAKE_SYSTEM_INFO_FILE}")
diff --git a/Modules/CMakePushCheckState.cmake b/Modules/CMakePushCheckState.cmake
index 98eea0532..f6bfc120e 100644
--- a/Modules/CMakePushCheckState.cmake
+++ b/Modules/CMakePushCheckState.cmake
@@ -1,46 +1,49 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakePushCheckState
-# -------------------
-#
-#
-#
-# This module defines three macros: CMAKE_PUSH_CHECK_STATE()
-# CMAKE_POP_CHECK_STATE() and CMAKE_RESET_CHECK_STATE() These macros can
-# be used to save, restore and reset (i.e., clear contents) the state of
-# the variables CMAKE_REQUIRED_FLAGS, CMAKE_REQUIRED_DEFINITIONS,
-# CMAKE_REQUIRED_LIBRARIES, CMAKE_REQUIRED_INCLUDES and CMAKE_EXTRA_INCLUDE_FILES
-# used by the various Check-files coming with CMake, like e.g.
-# check_function_exists() etc. The variable contents are pushed on a
-# stack, pushing multiple times is supported. This is useful e.g. when
-# executing such tests in a Find-module, where they have to be set, but
-# after the Find-module has been executed they should have the same
-# value as they had before.
-#
-# CMAKE_PUSH_CHECK_STATE() macro receives optional argument RESET.
-# Whether it's specified, CMAKE_PUSH_CHECK_STATE() will set all
-# CMAKE_REQUIRED_* variables to empty values, same as
-# CMAKE_RESET_CHECK_STATE() call will do.
-#
-# Usage:
-#
-# ::
-#
-# cmake_push_check_state(RESET)
-# set(CMAKE_REQUIRED_DEFINITIONS -DSOME_MORE_DEF)
-# check_function_exists(...)
-# cmake_reset_check_state()
-# set(CMAKE_REQUIRED_DEFINITIONS -DANOTHER_DEF)
-# check_function_exists(...)
-# cmake_pop_check_state()
+#[=======================================================================[.rst:
+CMakePushCheckState
+-------------------
+
+
+
+This module defines three macros: ``CMAKE_PUSH_CHECK_STATE()``
+``CMAKE_POP_CHECK_STATE()`` and ``CMAKE_RESET_CHECK_STATE()`` These macros can
+be used to save, restore and reset (i.e., clear contents) the state of
+the variables ``CMAKE_REQUIRED_FLAGS``, ``CMAKE_REQUIRED_DEFINITIONS``,
+``CMAKE_REQUIRED_LINK_OPTIONS``, ``CMAKE_REQUIRED_LIBRARIES``,
+``CMAKE_REQUIRED_INCLUDES`` and ``CMAKE_EXTRA_INCLUDE_FILES`` used by the
+various Check-files coming with CMake, like e.g. ``check_function_exists()``
+etc.
+The variable contents are pushed on a stack, pushing multiple times is
+supported. This is useful e.g. when executing such tests in a Find-module,
+where they have to be set, but after the Find-module has been executed they
+should have the same value as they had before.
+
+``CMAKE_PUSH_CHECK_STATE()`` macro receives optional argument ``RESET``.
+Whether it's specified, ``CMAKE_PUSH_CHECK_STATE()`` will set all
+``CMAKE_REQUIRED_*`` variables to empty values, same as
+``CMAKE_RESET_CHECK_STATE()`` call will do.
+
+Usage:
+
+.. code-block:: cmake
+
+ cmake_push_check_state(RESET)
+ set(CMAKE_REQUIRED_DEFINITIONS -DSOME_MORE_DEF)
+ check_function_exists(...)
+ cmake_reset_check_state()
+ set(CMAKE_REQUIRED_DEFINITIONS -DANOTHER_DEF)
+ check_function_exists(...)
+ cmake_pop_check_state()
+#]=======================================================================]
macro(CMAKE_RESET_CHECK_STATE)
set(CMAKE_EXTRA_INCLUDE_FILES)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_DEFINITIONS)
+ set(CMAKE_REQUIRED_LINK_OPTIONS)
set(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_QUIET)
@@ -55,12 +58,13 @@ macro(CMAKE_PUSH_CHECK_STATE)
math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}+1")
- set(_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_EXTRA_INCLUDE_FILES})
- set(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES})
- set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
- set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
- set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS})
- set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET})
+ set(_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_EXTRA_INCLUDE_FILES})
+ set(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES})
+ set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
+ set(_CMAKE_REQUIRED_LINK_OPTIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LINK_OPTIONS})
+ set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
+ set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS})
+ set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET})
if (${ARGC} GREATER 0 AND "${ARGV0}" STREQUAL "RESET")
cmake_reset_check_state()
@@ -73,12 +77,13 @@ macro(CMAKE_POP_CHECK_STATE)
# don't pop more than we pushed
if("${_CMAKE_PUSH_CHECK_STATE_COUNTER}" GREATER "0")
- set(CMAKE_EXTRA_INCLUDE_FILES ${_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
- set(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
- set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
- set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
- set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
- set(CMAKE_REQUIRED_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ set(CMAKE_EXTRA_INCLUDE_FILES ${_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ set(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ set(CMAKE_REQUIRED_LINK_OPTIONS ${_CMAKE_REQUIRED_LINK_OPTIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ set(CMAKE_REQUIRED_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1")
endif()
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
index e34ae756d..7bf6fde3b 100644
--- a/Modules/CMakeTestCCompiler.cmake
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -11,6 +11,12 @@ endif()
include(CMakeTestCompilerCommon)
+# work around enforced code signing and / or missing exectuable target type
+set(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
+if(_CMAKE_FEATURE_DETECTION_TARGET_TYPE)
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_CMAKE_FEATURE_DETECTION_TARGET_TYPE})
+endif()
+
# Remove any cached result from an older CMake version.
# We now store this in CMakeCCompiler.cmake.
unset(CMAKE_C_COMPILER_WORKS CACHE)
@@ -22,6 +28,7 @@ unset(CMAKE_C_COMPILER_WORKS CACHE)
# any makefiles or projects.
if(NOT CMAKE_C_COMPILER_WORKS)
PrintTestCompilerStatus("C" "")
+ __TestCompiler_setTryCompileTargetType()
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c
"#ifdef __cplusplus\n"
"# error \"The CMAKE_C_COMPILER is set to a C++ compiler\"\n"
@@ -41,6 +48,7 @@ if(NOT CMAKE_C_COMPILER_WORKS)
set(CMAKE_C_COMPILER_WORKS ${CMAKE_C_COMPILER_WORKS})
unset(CMAKE_C_COMPILER_WORKS CACHE)
set(C_TEST_WAS_RUN 1)
+ __TestCompiler_restoreTryCompileTargetType()
endif()
if(NOT CMAKE_C_COMPILER_WORKS)
@@ -84,4 +92,6 @@ else()
endif()
endif()
+set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE})
+unset(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE)
unset(__CMAKE_C_COMPILER_OUTPUT)
diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake
index e4d49ae84..7e595b74f 100644
--- a/Modules/CMakeTestCXXCompiler.cmake
+++ b/Modules/CMakeTestCXXCompiler.cmake
@@ -11,6 +11,12 @@ endif()
include(CMakeTestCompilerCommon)
+# work around enforced code signing and / or missing exectuable target type
+set(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
+if(_CMAKE_FEATURE_DETECTION_TARGET_TYPE)
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_CMAKE_FEATURE_DETECTION_TARGET_TYPE})
+endif()
+
# Remove any cached result from an older CMake version.
# We now store this in CMakeCXXCompiler.cmake.
unset(CMAKE_CXX_COMPILER_WORKS CACHE)
@@ -22,6 +28,7 @@ unset(CMAKE_CXX_COMPILER_WORKS CACHE)
# any makefiles or projects.
if(NOT CMAKE_CXX_COMPILER_WORKS)
PrintTestCompilerStatus("CXX" "")
+ __TestCompiler_setTryCompileTargetType()
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
"#ifndef __cplusplus\n"
"# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n"
@@ -34,6 +41,7 @@ if(NOT CMAKE_CXX_COMPILER_WORKS)
set(CMAKE_CXX_COMPILER_WORKS ${CMAKE_CXX_COMPILER_WORKS})
unset(CMAKE_CXX_COMPILER_WORKS CACHE)
set(CXX_TEST_WAS_RUN 1)
+ __TestCompiler_restoreTryCompileTargetType()
endif()
if(NOT CMAKE_CXX_COMPILER_WORKS)
@@ -77,4 +85,6 @@ else()
endif()
endif()
+set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE})
+unset(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE)
unset(__CMAKE_CXX_COMPILER_OUTPUT)
diff --git a/Modules/CMakeTestCompilerCommon.cmake b/Modules/CMakeTestCompilerCommon.cmake
index f76076fe2..6ee5175dd 100644
--- a/Modules/CMakeTestCompilerCommon.cmake
+++ b/Modules/CMakeTestCompilerCommon.cmake
@@ -5,3 +5,23 @@
function(PrintTestCompilerStatus LANG MSG)
message(STATUS "Check for working ${LANG} compiler: ${CMAKE_${LANG}_COMPILER}${MSG}")
endfunction()
+
+# if required set the target type if not already explicitly set
+macro(__TestCompiler_setTryCompileTargetType)
+ if(NOT CMAKE_TRY_COMPILE_TARGET_TYPE)
+ if("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
+ #prefer static libraries to avoid linking issues
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+ set(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE 1)
+ endif()
+ endif()
+endmacro()
+
+# restore the original value
+# -- not necessary if __TestCompiler_setTryCompileTargetType() was used in function scope
+macro(__TestCompiler_restoreTryCompileTargetType)
+ if(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE)
+ unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
+ unset(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE)
+ endif()
+endmacro()
diff --git a/Modules/CMakeVerifyManifest.cmake b/Modules/CMakeVerifyManifest.cmake
index c477ab1c2..705ef8aa7 100644
--- a/Modules/CMakeVerifyManifest.cmake
+++ b/Modules/CMakeVerifyManifest.cmake
@@ -1,22 +1,23 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CMakeVerifyManifest
-# -------------------
-#
-#
-#
-# CMakeVerifyManifest.cmake
-#
-# This script is used to verify that embedded manifests and side by side
-# manifests for a project match. To run this script, cd to a directory
-# and run the script with cmake -P. On the command line you can pass in
-# versions that are OK even if not found in the .manifest files. For
-# example, cmake -Dallow_versions=8.0.50608.0
-# -PCmakeVerifyManifest.cmake could be used to allow an embedded manifest
-# of 8.0.50608.0 to be used in a project even if that version was not
-# found in the .manifest file.
+#[=======================================================================[.rst:
+CMakeVerifyManifest
+-------------------
+
+
+
+CMakeVerifyManifest.cmake
+
+This script is used to verify that embedded manifests and side by side
+manifests for a project match. To run this script, cd to a directory
+and run the script with cmake -P. On the command line you can pass in
+versions that are OK even if not found in the .manifest files. For
+example, cmake -Dallow_versions=8.0.50608.0
+-PCmakeVerifyManifest.cmake could be used to allow an embedded manifest
+of 8.0.50608.0 to be used in a project even if that version was not
+found in the .manifest file.
+#]=======================================================================]
# This script first recursively globs *.manifest files from
# the current directory. Then globs *.exe and *.dll. Each
diff --git a/Modules/CPack.background.png.in b/Modules/CPack.background.png.in
index 9339e7cad..a32ab3762 100644
--- a/Modules/CPack.background.png.in
+++ b/Modules/CPack.background.png.in
Binary files differ
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index f3e34233a..c9008dbf9 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -7,22 +7,28 @@ CPack
Build binary and source package installers.
-Variables common to all CPack generators
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Introduction
+^^^^^^^^^^^^
+
+The CPack module generates a file ``CPackConfig.cmake`` intended for
+use in a subsequent run of the :manual:`cpack <cpack(1)>` program
+where it steers the generation of installers or/and source packages.
-The CPack module generates binary and source installers in a variety of
-formats using the cpack program. Inclusion of the CPack module adds
-two new build targets, ``package`` and ``package_source``, which build
-the binary and source installers respectively. The generated binary
-installers contain everything installed via CMake's :command:`install`
-command (and the deprecated :command:`install_files`,
-:command:`install_programs` and :command:`install_targets` commands).
+Inclusion of the CPack module adds two new build targets, ``package``
+and ``package_source``, which build the binary and source installers
+respectively. The generated binary installers contain everything
+installed via CMake's :command:`install` command (and the deprecated
+commands :command:`install_files`, :command:`install_programs`, and
+:command:`install_targets`).
For certain kinds of binary installers (including the graphical
installers on macOS and Windows), CPack generates installers that
allow users to select individual application components to install.
See :module:`CPackComponent` module for further details.
+CPack Generators
+^^^^^^^^^^^^^^^^
+
The :variable:`CPACK_GENERATOR` variable has different meanings in different
contexts. In a ``CMakeLists.txt`` file, :variable:`CPACK_GENERATOR` is a
*list of generators*: and when :manual:`cpack <cpack(1)>` is run with no other
@@ -57,6 +63,9 @@ This is the key: For each generator listed in :variable:`CPACK_GENERATOR` in
internally to *the one currently being used* and then include the
:variable:`CPACK_PROJECT_CONFIG_FILE`.
+Variables common to all CPack Generators
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
Before including this CPack module in your ``CMakeLists.txt`` file, there
are a variety of variables that can be set to customize the resulting
installers. The most commonly-used variables are:
@@ -244,6 +253,9 @@ installers. The most commonly-used variables are:
received by the cpack program. Defaults to ``FALSE`` for backwards
compatibility.
+Variables for Source Package Generators
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
The following CPack variables are specific to source packages, and
will not affect binary packages:
@@ -278,6 +290,9 @@ will not affect binary packages:
must be properly escaped), e.g.,
``/CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*``
+Variables for Advanced Use
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
The following variables are for advanced uses of CPack:
.. variable:: CPACK_CMAKE_GENERATOR
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake
index a0d99354d..211d7673c 100644
--- a/Modules/CPackComponent.cmake
+++ b/Modules/CPackComponent.cmake
@@ -1,313 +1,314 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CPackComponent
-# --------------
-#
-# Build binary and source package installers
-#
-# Variables concerning CPack Components
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The CPackComponent module is the module which handles the component
-# part of CPack. See CPack module for general information about CPack.
-#
-# For certain kinds of binary installers (including the graphical
-# installers on macOS and Windows), CPack generates installers that
-# allow users to select individual application components to install.
-# The contents of each of the components are identified by the COMPONENT
-# argument of CMake's INSTALL command. These components can be
-# annotated with user-friendly names and descriptions, inter-component
-# dependencies, etc., and grouped in various ways to customize the
-# resulting installer. See the cpack_add_* commands, described below,
-# for more information about component-specific installations.
-#
-# Component-specific installation allows users to select specific sets
-# of components to install during the install process. Installation
-# components are identified by the COMPONENT argument of CMake's INSTALL
-# commands, and should be further described by the following CPack
-# commands:
-#
-# .. variable:: CPACK_COMPONENTS_ALL
-#
-# The list of component to install.
-#
-# The default value of this variable is computed by CPack and contains all
-# components defined by the project. The user may set it to only include the
-# specified components.
-#
-# Instead of specifying all the desired components, it is possible to obtain a
-# list of all defined components and then remove the unwanted ones from the
-# list. The :command:`get_cmake_property` command can be used to obtain the
-# ``COMPONENTS`` property, then the :command:`list(REMOVE_ITEM)` command can be
-# used to remove the unwanted ones. For example, to use all defined components
-# except ``foo`` and ``bar``::
-#
-# get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
-# list(REMOVE_ITEM CPACK_COMPONENTS_ALL "foo" "bar")
-#
-# .. variable:: CPACK_<GENNAME>_COMPONENT_INSTALL
-#
-# Enable/Disable component install for CPack generator <GENNAME>.
-#
-# Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a legacy
-# default behavior. e.g. RPM builds monolithic whereas NSIS builds
-# component. One can change the default behavior by setting this variable to
-# 0/1 or OFF/ON.
-#
-# .. variable:: CPACK_COMPONENTS_GROUPING
-#
-# Specify how components are grouped for multi-package component-aware CPack
-# generators.
-#
-# Some generators like RPM or ARCHIVE family (TGZ, ZIP, ...) generates
-# several packages files when asked for component packaging. They group
-# the component differently depending on the value of this variable:
-#
-# * ONE_PER_GROUP (default): creates one package file per component group
-# * ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) components
-# * IGNORE : creates one package per component, i.e. IGNORE component group
-#
-# One can specify different grouping for different CPack generator by
-# using a CPACK_PROJECT_CONFIG_FILE.
-#
-# .. variable:: CPACK_COMPONENT_<compName>_DISPLAY_NAME
-#
-# The name to be displayed for a component.
-#
-# .. variable:: CPACK_COMPONENT_<compName>_DESCRIPTION
-#
-# The description of a component.
-#
-# .. variable:: CPACK_COMPONENT_<compName>_GROUP
-#
-# The group of a component.
-#
-# .. variable:: CPACK_COMPONENT_<compName>_DEPENDS
-#
-# The dependencies (list of components) on which this component depends.
-#
-# .. variable:: CPACK_COMPONENT_<compName>_HIDDEN
-#
-# True if this component is hidden from the user.
-#
-# .. variable:: CPACK_COMPONENT_<compName>_REQUIRED
-#
-# True if this component is required.
-#
-# .. variable:: CPACK_COMPONENT_<compName>_DISABLED
-#
-# True if this component is not selected to be installed by default.
-#
-# .. command:: cpack_add_component
-#
-# Describes a CPack installation
-# component named by the COMPONENT argument to a CMake INSTALL command.
-#
-# ::
-#
-# cpack_add_component(compname
-# [DISPLAY_NAME name]
-# [DESCRIPTION description]
-# [HIDDEN | REQUIRED | DISABLED ]
-# [GROUP group]
-# [DEPENDS comp1 comp2 ... ]
-# [INSTALL_TYPES type1 type2 ... ]
-# [DOWNLOADED]
-# [ARCHIVE_FILE filename]
-# [PLIST filename])
-#
-#
-#
-# The cmake_add_component command describes an installation component,
-# which the user can opt to install or remove as part of the graphical
-# installation process. compname is the name of the component, as
-# provided to the COMPONENT argument of one or more CMake INSTALL
-# commands.
-#
-# DISPLAY_NAME is the displayed name of the component, used in graphical
-# installers to display the component name. This value can be any
-# string.
-#
-# DESCRIPTION is an extended description of the component, used in
-# graphical installers to give the user additional information about the
-# component. Descriptions can span multiple lines using ``\n`` as the
-# line separator. Typically, these descriptions should be no more than
-# a few lines long.
-#
-# HIDDEN indicates that this component will be hidden in the graphical
-# installer, so that the user cannot directly change whether it is
-# installed or not.
-#
-# REQUIRED indicates that this component is required, and therefore will
-# always be installed. It will be visible in the graphical installer,
-# but it cannot be unselected. (Typically, required components are
-# shown greyed out).
-#
-# DISABLED indicates that this component should be disabled (unselected)
-# by default. The user is free to select this component for
-# installation, unless it is also HIDDEN.
-#
-# DEPENDS lists the components on which this component depends. If this
-# component is selected, then each of the components listed must also be
-# selected. The dependency information is encoded within the installer
-# itself, so that users cannot install inconsistent sets of components.
-#
-# GROUP names the component group of which this component is a part. If
-# not provided, the component will be a standalone component, not part
-# of any component group. Component groups are described with the
-# cpack_add_component_group command, detailed below.
-#
-# INSTALL_TYPES lists the installation types of which this component is
-# a part. When one of these installations types is selected, this
-# component will automatically be selected. Installation types are
-# described with the cpack_add_install_type command, detailed below.
-#
-# DOWNLOADED indicates that this component should be downloaded
-# on-the-fly by the installer, rather than packaged in with the
-# installer itself. For more information, see the
-# cpack_configure_downloads command.
-#
-# ARCHIVE_FILE provides a name for the archive file created by CPack to
-# be used for downloaded components. If not supplied, CPack will create
-# a file with some name based on CPACK_PACKAGE_FILE_NAME and the name of
-# the component. See cpack_configure_downloads for more information.
-#
-# PLIST gives a filename that is passed to pkgbuild with the
-# ``--component-plist`` argument when using the productbuild generator.
-#
-# .. command:: cpack_add_component_group
-#
-# Describes a group of related CPack installation components.
-#
-# ::
-#
-# cpack_add_component_group(groupname
-# [DISPLAY_NAME name]
-# [DESCRIPTION description]
-# [PARENT_GROUP parent]
-# [EXPANDED]
-# [BOLD_TITLE])
-#
-#
-#
-# The cpack_add_component_group describes a group of installation
-# components, which will be placed together within the listing of
-# options. Typically, component groups allow the user to
-# select/deselect all of the components within a single group via a
-# single group-level option. Use component groups to reduce the
-# complexity of installers with many options. groupname is an arbitrary
-# name used to identify the group in the GROUP argument of the
-# cpack_add_component command, which is used to place a component in a
-# group. The name of the group must not conflict with the name of any
-# component.
-#
-# DISPLAY_NAME is the displayed name of the component group, used in
-# graphical installers to display the component group name. This value
-# can be any string.
-#
-# DESCRIPTION is an extended description of the component group, used in
-# graphical installers to give the user additional information about the
-# components within that group. Descriptions can span multiple lines
-# using ``\n`` as the line separator. Typically, these descriptions
-# should be no more than a few lines long.
-#
-# PARENT_GROUP, if supplied, names the parent group of this group.
-# Parent groups are used to establish a hierarchy of groups, providing
-# an arbitrary hierarchy of groups.
-#
-# EXPANDED indicates that, by default, the group should show up as
-# "expanded", so that the user immediately sees all of the components
-# within the group. Otherwise, the group will initially show up as a
-# single entry.
-#
-# BOLD_TITLE indicates that the group title should appear in bold, to
-# call the user's attention to the group.
-#
-# .. command:: cpack_add_install_type
-#
-# Add a new installation type containing
-# a set of predefined component selections to the graphical installer.
-#
-# ::
-#
-# cpack_add_install_type(typename
-# [DISPLAY_NAME name])
-#
-#
-#
-# The cpack_add_install_type command identifies a set of preselected
-# components that represents a common use case for an application. For
-# example, a "Developer" install type might include an application along
-# with its header and library files, while an "End user" install type
-# might just include the application's executable. Each component
-# identifies itself with one or more install types via the INSTALL_TYPES
-# argument to cpack_add_component.
-#
-# DISPLAY_NAME is the displayed name of the install type, which will
-# typically show up in a drop-down box within a graphical installer.
-# This value can be any string.
-#
-# .. command:: cpack_configure_downloads
-#
-# Configure CPack to download
-# selected components on-the-fly as part of the installation process.
-#
-# ::
-#
-# cpack_configure_downloads(site
-# [UPLOAD_DIRECTORY dirname]
-# [ALL]
-# [ADD_REMOVE|NO_ADD_REMOVE])
-#
-#
-#
-# The cpack_configure_downloads command configures installation-time
-# downloads of selected components. For each downloadable component,
-# CPack will create an archive containing the contents of that
-# component, which should be uploaded to the given site. When the user
-# selects that component for installation, the installer will download
-# and extract the component in place. This feature is useful for
-# creating small installers that only download the requested components,
-# saving bandwidth. Additionally, the installers are small enough that
-# they will be installed as part of the normal installation process, and
-# the "Change" button in Windows Add/Remove Programs control panel will
-# allow one to add or remove parts of the application after the original
-# installation. On Windows, the downloaded-components functionality
-# requires the ZipDLL plug-in for NSIS, available at:
-#
-# ::
-#
-# http://nsis.sourceforge.net/ZipDLL_plug-in
-#
-#
-#
-# On macOS, installers that download components on-the-fly can only
-# be built and installed on system using macOS 10.5 or later.
-#
-# The site argument is a URL where the archives for downloadable
-# components will reside, e.g.,
-# https://cmake.org/files/2.6.1/installer/ All of the archives
-# produced by CPack should be uploaded to that location.
-#
-# UPLOAD_DIRECTORY is the local directory where CPack will create the
-# various archives for each of the components. The contents of this
-# directory should be uploaded to a location accessible by the URL given
-# in the site argument. If omitted, CPack will use the directory
-# CPackUploads inside the CMake binary directory to store the generated
-# archives.
-#
-# The ALL flag indicates that all components be downloaded. Otherwise,
-# only those components explicitly marked as DOWNLOADED or that have a
-# specified ARCHIVE_FILE will be downloaded. Additionally, the ALL
-# option implies ADD_REMOVE (unless NO_ADD_REMOVE is specified).
-#
-# ADD_REMOVE indicates that CPack should install a copy of the installer
-# that can be called from Windows' Add/Remove Programs dialog (via the
-# "Modify" button) to change the set of installed components.
-# NO_ADD_REMOVE turns off this behavior. This option is ignored on Mac
-# OS X.
+#[=======================================================================[.rst:
+CPackComponent
+--------------
+
+Build binary and source package installers
+
+Variables concerning CPack Components
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The CPackComponent module is the module which handles the component
+part of CPack. See CPack module for general information about CPack.
+
+For certain kinds of binary installers (including the graphical
+installers on macOS and Windows), CPack generates installers that
+allow users to select individual application components to install.
+The contents of each of the components are identified by the COMPONENT
+argument of CMake's INSTALL command. These components can be
+annotated with user-friendly names and descriptions, inter-component
+dependencies, etc., and grouped in various ways to customize the
+resulting installer. See the cpack_add_* commands, described below,
+for more information about component-specific installations.
+
+Component-specific installation allows users to select specific sets
+of components to install during the install process. Installation
+components are identified by the COMPONENT argument of CMake's INSTALL
+commands, and should be further described by the following CPack
+commands:
+
+.. variable:: CPACK_COMPONENTS_ALL
+
+ The list of component to install.
+
+ The default value of this variable is computed by CPack and contains all
+ components defined by the project. The user may set it to only include the
+ specified components.
+
+ Instead of specifying all the desired components, it is possible to obtain a
+ list of all defined components and then remove the unwanted ones from the
+ list. The :command:`get_cmake_property` command can be used to obtain the
+ ``COMPONENTS`` property, then the :command:`list(REMOVE_ITEM)` command can be
+ used to remove the unwanted ones. For example, to use all defined components
+ except ``foo`` and ``bar``::
+
+ get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
+ list(REMOVE_ITEM CPACK_COMPONENTS_ALL "foo" "bar")
+
+.. variable:: CPACK_<GENNAME>_COMPONENT_INSTALL
+
+ Enable/Disable component install for CPack generator <GENNAME>.
+
+ Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a legacy
+ default behavior. e.g. RPM builds monolithic whereas NSIS builds
+ component. One can change the default behavior by setting this variable to
+ 0/1 or OFF/ON.
+
+.. variable:: CPACK_COMPONENTS_GROUPING
+
+ Specify how components are grouped for multi-package component-aware CPack
+ generators.
+
+ Some generators like RPM or ARCHIVE family (TGZ, ZIP, ...) generates
+ several packages files when asked for component packaging. They group
+ the component differently depending on the value of this variable:
+
+ * ONE_PER_GROUP (default): creates one package file per component group
+ * ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) components
+ * IGNORE : creates one package per component, i.e. IGNORE component group
+
+ One can specify different grouping for different CPack generator by
+ using a CPACK_PROJECT_CONFIG_FILE.
+
+.. variable:: CPACK_COMPONENT_<compName>_DISPLAY_NAME
+
+ The name to be displayed for a component.
+
+.. variable:: CPACK_COMPONENT_<compName>_DESCRIPTION
+
+ The description of a component.
+
+.. variable:: CPACK_COMPONENT_<compName>_GROUP
+
+ The group of a component.
+
+.. variable:: CPACK_COMPONENT_<compName>_DEPENDS
+
+ The dependencies (list of components) on which this component depends.
+
+.. variable:: CPACK_COMPONENT_<compName>_HIDDEN
+
+ True if this component is hidden from the user.
+
+.. variable:: CPACK_COMPONENT_<compName>_REQUIRED
+
+ True if this component is required.
+
+.. variable:: CPACK_COMPONENT_<compName>_DISABLED
+
+ True if this component is not selected to be installed by default.
+
+.. command:: cpack_add_component
+
+Describes a CPack installation
+component named by the COMPONENT argument to a CMake INSTALL command.
+
+::
+
+ cpack_add_component(compname
+ [DISPLAY_NAME name]
+ [DESCRIPTION description]
+ [HIDDEN | REQUIRED | DISABLED ]
+ [GROUP group]
+ [DEPENDS comp1 comp2 ... ]
+ [INSTALL_TYPES type1 type2 ... ]
+ [DOWNLOADED]
+ [ARCHIVE_FILE filename]
+ [PLIST filename])
+
+
+
+The cmake_add_component command describes an installation component,
+which the user can opt to install or remove as part of the graphical
+installation process. compname is the name of the component, as
+provided to the COMPONENT argument of one or more CMake INSTALL
+commands.
+
+DISPLAY_NAME is the displayed name of the component, used in graphical
+installers to display the component name. This value can be any
+string.
+
+DESCRIPTION is an extended description of the component, used in
+graphical installers to give the user additional information about the
+component. Descriptions can span multiple lines using ``\n`` as the
+line separator. Typically, these descriptions should be no more than
+a few lines long.
+
+HIDDEN indicates that this component will be hidden in the graphical
+installer, so that the user cannot directly change whether it is
+installed or not.
+
+REQUIRED indicates that this component is required, and therefore will
+always be installed. It will be visible in the graphical installer,
+but it cannot be unselected. (Typically, required components are
+shown greyed out).
+
+DISABLED indicates that this component should be disabled (unselected)
+by default. The user is free to select this component for
+installation, unless it is also HIDDEN.
+
+DEPENDS lists the components on which this component depends. If this
+component is selected, then each of the components listed must also be
+selected. The dependency information is encoded within the installer
+itself, so that users cannot install inconsistent sets of components.
+
+GROUP names the component group of which this component is a part. If
+not provided, the component will be a standalone component, not part
+of any component group. Component groups are described with the
+cpack_add_component_group command, detailed below.
+
+INSTALL_TYPES lists the installation types of which this component is
+a part. When one of these installations types is selected, this
+component will automatically be selected. Installation types are
+described with the cpack_add_install_type command, detailed below.
+
+DOWNLOADED indicates that this component should be downloaded
+on-the-fly by the installer, rather than packaged in with the
+installer itself. For more information, see the
+cpack_configure_downloads command.
+
+ARCHIVE_FILE provides a name for the archive file created by CPack to
+be used for downloaded components. If not supplied, CPack will create
+a file with some name based on CPACK_PACKAGE_FILE_NAME and the name of
+the component. See cpack_configure_downloads for more information.
+
+PLIST gives a filename that is passed to pkgbuild with the
+``--component-plist`` argument when using the productbuild generator.
+
+.. command:: cpack_add_component_group
+
+Describes a group of related CPack installation components.
+
+::
+
+ cpack_add_component_group(groupname
+ [DISPLAY_NAME name]
+ [DESCRIPTION description]
+ [PARENT_GROUP parent]
+ [EXPANDED]
+ [BOLD_TITLE])
+
+
+
+The cpack_add_component_group describes a group of installation
+components, which will be placed together within the listing of
+options. Typically, component groups allow the user to
+select/deselect all of the components within a single group via a
+single group-level option. Use component groups to reduce the
+complexity of installers with many options. groupname is an arbitrary
+name used to identify the group in the GROUP argument of the
+cpack_add_component command, which is used to place a component in a
+group. The name of the group must not conflict with the name of any
+component.
+
+DISPLAY_NAME is the displayed name of the component group, used in
+graphical installers to display the component group name. This value
+can be any string.
+
+DESCRIPTION is an extended description of the component group, used in
+graphical installers to give the user additional information about the
+components within that group. Descriptions can span multiple lines
+using ``\n`` as the line separator. Typically, these descriptions
+should be no more than a few lines long.
+
+PARENT_GROUP, if supplied, names the parent group of this group.
+Parent groups are used to establish a hierarchy of groups, providing
+an arbitrary hierarchy of groups.
+
+EXPANDED indicates that, by default, the group should show up as
+"expanded", so that the user immediately sees all of the components
+within the group. Otherwise, the group will initially show up as a
+single entry.
+
+BOLD_TITLE indicates that the group title should appear in bold, to
+call the user's attention to the group.
+
+.. command:: cpack_add_install_type
+
+Add a new installation type containing
+a set of predefined component selections to the graphical installer.
+
+::
+
+ cpack_add_install_type(typename
+ [DISPLAY_NAME name])
+
+
+
+The cpack_add_install_type command identifies a set of preselected
+components that represents a common use case for an application. For
+example, a "Developer" install type might include an application along
+with its header and library files, while an "End user" install type
+might just include the application's executable. Each component
+identifies itself with one or more install types via the INSTALL_TYPES
+argument to cpack_add_component.
+
+DISPLAY_NAME is the displayed name of the install type, which will
+typically show up in a drop-down box within a graphical installer.
+This value can be any string.
+
+.. command:: cpack_configure_downloads
+
+Configure CPack to download
+selected components on-the-fly as part of the installation process.
+
+::
+
+ cpack_configure_downloads(site
+ [UPLOAD_DIRECTORY dirname]
+ [ALL]
+ [ADD_REMOVE|NO_ADD_REMOVE])
+
+
+
+The cpack_configure_downloads command configures installation-time
+downloads of selected components. For each downloadable component,
+CPack will create an archive containing the contents of that
+component, which should be uploaded to the given site. When the user
+selects that component for installation, the installer will download
+and extract the component in place. This feature is useful for
+creating small installers that only download the requested components,
+saving bandwidth. Additionally, the installers are small enough that
+they will be installed as part of the normal installation process, and
+the "Change" button in Windows Add/Remove Programs control panel will
+allow one to add or remove parts of the application after the original
+installation. On Windows, the downloaded-components functionality
+requires the ZipDLL plug-in for NSIS, available at:
+
+::
+
+ http://nsis.sourceforge.net/ZipDLL_plug-in
+
+
+
+On macOS, installers that download components on-the-fly can only
+be built and installed on system using macOS 10.5 or later.
+
+The site argument is a URL where the archives for downloadable
+components will reside, e.g.,
+https://cmake.org/files/2.6.1/installer/ All of the archives
+produced by CPack should be uploaded to that location.
+
+UPLOAD_DIRECTORY is the local directory where CPack will create the
+various archives for each of the components. The contents of this
+directory should be uploaded to a location accessible by the URL given
+in the site argument. If omitted, CPack will use the directory
+CPackUploads inside the CMake binary directory to store the generated
+archives.
+
+The ALL flag indicates that all components be downloaded. Otherwise,
+only those components explicitly marked as DOWNLOADED or that have a
+specified ARCHIVE_FILE will be downloaded. Additionally, the ALL
+option implies ADD_REMOVE (unless NO_ADD_REMOVE is specified).
+
+ADD_REMOVE indicates that CPack should install a copy of the installer
+that can be called from Windows' Add/Remove Programs dialog (via the
+"Modify" button) to change the set of installed components.
+NO_ADD_REMOVE turns off this behavior. This option is ignored on Mac
+OS X.
+#]=======================================================================]
# Define var in order to avoid multiple inclusion
if(NOT CPackComponent_CMake_INCLUDED)
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 141e84254..42ef8c7b7 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -518,7 +518,7 @@ macro(_cpack_ifw_resolve_script _variable)
get_filename_component(${_ifw_script_macro} ${_ifw_script_file} ABSOLUTE)
set(_ifw_script_file ${${_ifw_script_macro}})
if(NOT EXISTS ${_ifw_script_file})
- message(WARNING "CPack IFW: script file \"${_ifw_script_file}\" is not exists")
+ message(WARNING "CPack IFW: script file \"${_ifw_script_file}\" does not exist")
set(${_ifw_script_macro})
endif()
endif()
@@ -616,6 +616,12 @@ macro(cpack_ifw_configure_component_group grpname)
set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n")
+ foreach(_IFW_ARG_NAME ${_IFW_OPT})
+ cpack_append_option_set_command(
+ CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWGRP_STR)
+ endforeach()
+
foreach(_IFW_ARG_NAME ${_IFW_ARGS})
cpack_append_string_variable_set_command(
CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
diff --git a/Modules/CPackIFWConfigureFile.cmake b/Modules/CPackIFWConfigureFile.cmake
index 790574a52..0abe0da37 100644
--- a/Modules/CPackIFWConfigureFile.cmake
+++ b/Modules/CPackIFWConfigureFile.cmake
@@ -1,32 +1,33 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CPackIFWConfigureFile
-# ---------------------
-#
-# The module defines :command:`configure_file` similar command to
-# configure file templates prepared in QtIFW/SDK/Creator style.
-#
-#
-# Commands
-# ^^^^^^^^
-#
-# The module defines the following commands:
-#
-# .. command:: cpack_ifw_configure_file
-#
-# Copy a file to another location and modify its contents.
-#
-# ::
-#
-# cpack_ifw_configure_file(<input> <output>)
-#
-# Copies an ``<input>`` file to an ``<output>`` file and substitutes variable
-# values referenced as ``%{VAR}`` or ``%VAR%`` in the input file content.
-# Each variable reference will be replaced with the current value of the
-# variable, or the empty string if the variable is not defined.
-#
+#[=======================================================================[.rst:
+CPackIFWConfigureFile
+---------------------
+
+The module defines :command:`configure_file` similar command to
+configure file templates prepared in QtIFW/SDK/Creator style.
+
+
+Commands
+^^^^^^^^
+
+The module defines the following commands:
+
+.. command:: cpack_ifw_configure_file
+
+ Copy a file to another location and modify its contents.
+
+ ::
+
+ cpack_ifw_configure_file(<input> <output>)
+
+ Copies an ``<input>`` file to an ``<output>`` file and substitutes variable
+ values referenced as ``%{VAR}`` or ``%VAR%`` in the input file content.
+ Each variable reference will be replaced with the current value of the
+ variable, or the empty string if the variable is not defined.
+
+#]=======================================================================]
# NOTE: This file used to himself packaging via CPack IFW generator and
# should be compatible with minimal CMake version defined in
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
index 2ea931d4a..d100704df 100644
--- a/Modules/CTest.cmake
+++ b/Modules/CTest.cmake
@@ -27,12 +27,8 @@ to creating tests when testing is enabled.
To enable submissions to a CDash server, create a ``CTestConfig.cmake``
file at the top of the project with content such as::
- set(CTEST_PROJECT_NAME "MyProject")
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
- set(CTEST_DROP_METHOD "http")
- set(CTEST_DROP_SITE "my.cdash.org")
- set(CTEST_DROP_LOCATION "/submit.php?project=MyProject")
- set(CTEST_DROP_SITE_CDASH TRUE)
+ set(CTEST_SUBMIT_URL "http://my.cdash.org/submit.php?project=MyProject")
(the CDash server can provide the file to a project administrator who
configures ``MyProject``). Settings in the config file are shared by
@@ -90,6 +86,7 @@ if(BUILD_TESTING)
if(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
include("${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
SET_IF_SET_AND_NOT_SET(NIGHTLY_START_TIME "${CTEST_NIGHTLY_START_TIME}")
+ SET_IF_SET_AND_NOT_SET(SUBMIT_URL "${CTEST_SUBMIT_URL}")
SET_IF_SET_AND_NOT_SET(DROP_METHOD "${CTEST_DROP_METHOD}")
SET_IF_SET_AND_NOT_SET(DROP_SITE "${CTEST_DROP_SITE}")
SET_IF_SET_AND_NOT_SET(DROP_SITE_USER "${CTEST_DROP_SITE_USER}")
@@ -112,6 +109,18 @@ if(BUILD_TESTING)
endif()
SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT")
+ if(NOT SUBMIT_URL)
+ set(SUBMIT_URL "${DROP_METHOD}://")
+ if(DROP_SITE_USER)
+ string(APPEND SUBMIT_URL "${DROP_SITE_USER}")
+ if(DROP_SITE_PASSWORD)
+ string(APPEND SUBMIT_URL ":${DROP_SITE_PASSWORD}")
+ endif()
+ string(APPEND SUBMIT_URL "@")
+ endif()
+ string(APPEND SUBMIT_URL "${DROP_SITE}${DROP_SITE_LOCATION}")
+ endif()
+
find_program(CVSCOMMAND cvs )
set(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING
"Options passed to the cvs update command.")
@@ -178,9 +187,6 @@ if(BUILD_TESTING)
)
set(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH
"File that contains suppressions for the memory checker")
- find_program(SCPCOMMAND scp DOC
- "Path to scp command, used by CTest for submitting results to a Dart server"
- )
find_program(COVERAGE_COMMAND gcov DOC
"Path to the coverage program that CTest uses for performing coverage inspection"
)
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index 1203be4c2..2258271cc 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -1,69 +1,70 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CTestCoverageCollectGCOV
-# ------------------------
-#
-# This module provides the ``ctest_coverage_collect_gcov`` function.
-#
-# This function runs gcov on all .gcda files found in the binary tree
-# and packages the resulting .gcov files into a tar file.
-# This tarball also contains the following:
-#
-# * *data.json* defines the source and build directories for use by CDash.
-# * *Labels.json* indicates any :prop_sf:`LABELS` that have been set on the
-# source files.
-# * The *uncovered* directory holds any uncovered files found by
-# :variable:`CTEST_EXTRA_COVERAGE_GLOB`.
-#
-# After generating this tar file, it can be sent to CDash for display with the
-# :command:`ctest_submit(CDASH_UPLOAD)` command.
-#
-# .. command:: cdash_coverage_collect_gcov
-#
-# ::
-#
-# ctest_coverage_collect_gcov(TARBALL <tarfile>
-# [SOURCE <source_dir>][BUILD <build_dir>]
-# [GCOV_COMMAND <gcov_command>]
-# [GCOV_OPTIONS <options>...]
-# )
-#
-# Run gcov and package a tar file for CDash. The options are:
-#
-# ``TARBALL <tarfile>``
-# Specify the location of the ``.tar`` file to be created for later
-# upload to CDash. Relative paths will be interpreted with respect
-# to the top-level build directory.
-#
-# ``SOURCE <source_dir>``
-# Specify the top-level source directory for the build.
-# Default is the value of :variable:`CTEST_SOURCE_DIRECTORY`.
-#
-# ``BUILD <build_dir>``
-# Specify the top-level build directory for the build.
-# Default is the value of :variable:`CTEST_BINARY_DIRECTORY`.
-#
-# ``GCOV_COMMAND <gcov_command>``
-# Specify the full path to the ``gcov`` command on the machine.
-# Default is the value of :variable:`CTEST_COVERAGE_COMMAND`.
-#
-# ``GCOV_OPTIONS <options>...``
-# Specify options to be passed to gcov. The ``gcov`` command
-# is run as ``gcov <options>... -o <gcov-dir> <file>.gcda``.
-# If not specified, the default option is just ``-b``.
-#
-# ``GLOB``
-# Recursively search for .gcda files in build_dir rather than
-# determining search locations by reading TargetDirectories.txt.
-#
-# ``DELETE``
-# 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.
+#[=======================================================================[.rst:
+CTestCoverageCollectGCOV
+------------------------
+
+This module provides the ``ctest_coverage_collect_gcov`` function.
+
+This function runs gcov on all .gcda files found in the binary tree
+and packages the resulting .gcov files into a tar file.
+This tarball also contains the following:
+
+* *data.json* defines the source and build directories for use by CDash.
+* *Labels.json* indicates any :prop_sf:`LABELS` that have been set on the
+ source files.
+* The *uncovered* directory holds any uncovered files found by
+ :variable:`CTEST_EXTRA_COVERAGE_GLOB`.
+
+After generating this tar file, it can be sent to CDash for display with the
+:command:`ctest_submit(CDASH_UPLOAD)` command.
+
+.. command:: cdash_coverage_collect_gcov
+
+ ::
+
+ ctest_coverage_collect_gcov(TARBALL <tarfile>
+ [SOURCE <source_dir>][BUILD <build_dir>]
+ [GCOV_COMMAND <gcov_command>]
+ [GCOV_OPTIONS <options>...]
+ )
+
+ Run gcov and package a tar file for CDash. The options are:
+
+ ``TARBALL <tarfile>``
+ Specify the location of the ``.tar`` file to be created for later
+ upload to CDash. Relative paths will be interpreted with respect
+ to the top-level build directory.
+
+ ``SOURCE <source_dir>``
+ Specify the top-level source directory for the build.
+ Default is the value of :variable:`CTEST_SOURCE_DIRECTORY`.
+
+ ``BUILD <build_dir>``
+ Specify the top-level build directory for the build.
+ Default is the value of :variable:`CTEST_BINARY_DIRECTORY`.
+
+ ``GCOV_COMMAND <gcov_command>``
+ Specify the full path to the ``gcov`` command on the machine.
+ Default is the value of :variable:`CTEST_COVERAGE_COMMAND`.
+
+ ``GCOV_OPTIONS <options>...``
+ Specify options to be passed to gcov. The ``gcov`` command
+ is run as ``gcov <options>... -o <gcov-dir> <file>.gcda``.
+ If not specified, the default option is just ``-b``.
+
+ ``GLOB``
+ Recursively search for .gcda files in build_dir rather than
+ determining search locations by reading TargetDirectories.txt.
+
+ ``DELETE``
+ 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.
+#]=======================================================================]
function(ctest_coverage_collect_gcov)
set(options QUIET GLOB DELETE)
diff --git a/Modules/CTestScriptMode.cmake b/Modules/CTestScriptMode.cmake
index 5be78d5a3..7af3577e0 100644
--- a/Modules/CTestScriptMode.cmake
+++ b/Modules/CTestScriptMode.cmake
@@ -1,13 +1,14 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CTestScriptMode
-# ---------------
-#
-#
-#
-# This file is read by ctest in script mode (-S)
+#[=======================================================================[.rst:
+CTestScriptMode
+---------------
+
+
+
+This file is read by ctest in script mode (-S)
+#]=======================================================================]
# Determine the current system, so this information can be used
# in ctest scripts
diff --git a/Modules/CTestUseLaunchers.cmake b/Modules/CTestUseLaunchers.cmake
index dc90513a9..3dff92605 100644
--- a/Modules/CTestUseLaunchers.cmake
+++ b/Modules/CTestUseLaunchers.cmake
@@ -1,32 +1,33 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CTestUseLaunchers
-# -----------------
-#
-# Set the RULE_LAUNCH_* global properties when CTEST_USE_LAUNCHERS is on.
-#
-# CTestUseLaunchers is automatically included when you include(CTest).
-# However, it is split out into its own module file so projects can use
-# the CTEST_USE_LAUNCHERS functionality independently.
-#
-# To use launchers, set CTEST_USE_LAUNCHERS to ON in a ctest -S
-# dashboard script, and then also set it in the cache of the configured
-# project. Both cmake and ctest need to know the value of it for the
-# launchers to work properly. CMake needs to know in order to generate
-# proper build rules, and ctest, in order to produce the proper error
-# and warning analysis.
-#
-# For convenience, you may set the ENV variable
-# CTEST_USE_LAUNCHERS_DEFAULT in your ctest -S script, too. Then, as
-# 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.
+#[=======================================================================[.rst:
+CTestUseLaunchers
+-----------------
+
+Set the RULE_LAUNCH_* global properties when CTEST_USE_LAUNCHERS is on.
+
+CTestUseLaunchers is automatically included when you include(CTest).
+However, it is split out into its own module file so projects can use
+the CTEST_USE_LAUNCHERS functionality independently.
+
+To use launchers, set CTEST_USE_LAUNCHERS to ON in a ctest -S
+dashboard script, and then also set it in the cache of the configured
+project. Both cmake and ctest need to know the value of it for the
+launchers to work properly. CMake needs to know in order to generate
+proper build rules, and ctest, in order to produce the proper error
+and warning analysis.
+
+For convenience, you may set the ENV variable
+CTEST_USE_LAUNCHERS_DEFAULT in your ctest -S script, too. Then, as
+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.
+#]=======================================================================]
if(NOT DEFINED CTEST_USE_LAUNCHERS AND DEFINED ENV{CTEST_USE_LAUNCHERS_DEFAULT})
set(CTEST_USE_LAUNCHERS "$ENV{CTEST_USE_LAUNCHERS_DEFAULT}"
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index 9d2c74dbd..f5c112717 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -9,7 +9,7 @@ Check whether the C compiler supports a given flag.
.. command:: check_c_compiler_flag
- ::
+ .. code-block:: cmake
check_c_compiler_flag(<flag> <var>)
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index 114213ac6..77ba0cc46 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -9,15 +9,16 @@ Check if given C source compiles and links into an executable.
.. command:: check_c_source_compiles
- ::
+ .. code-block:: cmake
- check_c_source_compiles(code resultVar [FAIL_REGEX regex1 [regex2...]])
+ check_c_source_compiles(<code> <resultVar>
+ [FAIL_REGEX <regex1> [<regex2>...]])
- Check that the source supplied in ``code`` can be compiled as a C source
+ Check that the source supplied in ``<code>`` can be compiled as a C source
file and linked as an executable (so it must contain at least a ``main()``
function). The result will be stored in the internal cache variable specified
- by ``resultVar``, with a boolean true value for success and boolean false for
- failure. If ``FAIL_REGEX`` is provided, then failure is determined by
+ by ``<resultVar>``, with a boolean true value for success and boolean false
+ for failure. If ``FAIL_REGEX`` is provided, then failure is determined by
checking if anything in the output matches any of the specified regular
expressions.
@@ -34,7 +35,7 @@ Check if given C source compiles and links into an executable.
``CMAKE_REQUIRED_DEFINITIONS``
A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
- ``resultVar`` will also be added automatically.
+ ``<resultVar>`` will also be added automatically.
``CMAKE_REQUIRED_INCLUDES``
A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
@@ -42,6 +43,10 @@ Check if given C source compiles and links into an executable.
``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
directory property will be ignored.
+ ``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).
+
``CMAKE_REQUIRED_LIBRARIES``
A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
command. These can be the name of system libraries or they can be
@@ -53,10 +58,10 @@ Check if given C source compiles and links into an executable.
associated with the check will be suppressed.
The check is only performed once, with the result cached in the variable
- named by ``resultVar``. Every subsequent CMake run will re-use this cached
- value rather than performing the check again, even if the ``code`` changes.
+ named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
+ value rather than performing the check again, even if the ``<code>`` changes.
In order to force the check to be re-evaluated, the variable named by
- ``resultVar`` must be manually removed from the cache.
+ ``<resultVar>`` must be manually removed from the cache.
#]=======================================================================]
@@ -77,6 +82,12 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
endforeach()
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_C_SOURCE_COMPILES_ADD_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_C_SOURCE_COMPILES_ADD_LINK_OPTIONS)
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -99,6 +110,7 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_C_SOURCE_COMPILES_ADD_LINK_OPTIONS}
${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
@@ -131,4 +143,3 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
endif()
endif()
endmacro()
-
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
index 7eb050cc6..eba70f2ba 100644
--- a/Modules/CheckCSourceRuns.cmake
+++ b/Modules/CheckCSourceRuns.cmake
@@ -10,16 +10,16 @@ subsequently be run.
.. command:: check_c_source_runs
- ::
+ .. code-block:: cmake
- check_c_source_runs(code resultVar)
+ check_c_source_runs(<code> <resultVar>)
- Check that the source supplied in ``code`` can be compiled as a C source
- file, linked as an executable and then run. The ``code`` must contain at
- least a ``main()`` function. If the code could be built and run successfully,
- the internal cache variable specified by ``resultVar`` will be set to 1,
- otherwise it will be set to an value that evaluates to boolean false (e.g.
- an empty string or an error message).
+ Check that the source supplied in ``<code>`` can be compiled as a C source
+ file, linked as an executable and then run. The ``<code>`` must contain at
+ least a ``main()`` function. If the ``<code>`` could be built and run
+ successfully, the internal cache variable specified by ``<resultVar>`` will
+ be set to 1, otherwise it will be set to an value that evaluates to boolean
+ false (e.g. an empty string or an error message).
The underlying check is performed by the :command:`try_run` command. The
compile and link commands can be influenced by setting any of the following
@@ -34,7 +34,7 @@ subsequently be run.
``CMAKE_REQUIRED_DEFINITIONS``
A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
- ``resultVar`` will also be added automatically.
+ ``<resultVar>`` will also be added automatically.
``CMAKE_REQUIRED_INCLUDES``
A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
@@ -42,6 +42,10 @@ subsequently be run.
``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
directory property will be ignored.
+ ``CMAKE_REQUIRED_LINK_OPTIONS``
+ A :ref:`;-list <CMake Language Lists>` of options to add to the link
+ command (see :command:`try_run` for further details).
+
``CMAKE_REQUIRED_LIBRARIES``
A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
command. These can be the name of system libraries or they can be
@@ -53,10 +57,10 @@ subsequently be run.
associated with the check will be suppressed.
The check is only performed once, with the result cached in the variable
- named by ``resultVar``. Every subsequent CMake run will re-use this cached
- value rather than performing the check again, even if the ``code`` changes.
+ named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
+ value rather than performing the check again, even if the ``<code>`` changes.
In order to force the check to be re-evaluated, the variable named by
- ``resultVar`` must be manually removed from the cache.
+ ``<resultVar>`` must be manually removed from the cache.
#]=======================================================================]
@@ -66,6 +70,12 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
if(NOT DEFINED "${VAR}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_C_SOURCE_COMPILES_ADD_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_C_SOURCE_COMPILES_ADD_LINK_OPTIONS)
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -88,6 +98,7 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_C_SOURCE_COMPILES_ADD_LINK_OPTIONS}
${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
-DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
@@ -132,4 +143,3 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
endif()
endif()
endmacro()
-
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
index dd6083531..a01e142ab 100644
--- a/Modules/CheckCXXCompilerFlag.cmake
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -9,7 +9,7 @@ Check whether the CXX compiler supports a given flag.
.. command:: check_cxx_compiler_flag
- ::
+ .. code-block:: cmake
check_cxx_compiler_flag(<flag> <var>)
@@ -61,4 +61,3 @@ macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
endmacro ()
-
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
index ed8661b11..cc457a565 100644
--- a/Modules/CheckCXXSourceCompiles.cmake
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -9,15 +9,16 @@ Check if given C++ source compiles and links into an executable.
.. command:: check_cxx_source_compiles
- ::
+ .. code-block:: cmake
- check_cxx_source_compiles(code resultVar [FAIL_REGEX regex1 [regex2...]])
+ check_cxx_source_compiles(<code> <resultVar>
+ [FAIL_REGEX <regex1> [<regex2>...]])
- Check that the source supplied in ``code`` can be compiled as a C++ source
+ Check that the source supplied in ``<code>`` can be compiled as a C++ source
file and linked as an executable (so it must contain at least a ``main()``
function). The result will be stored in the internal cache variable specified
- by ``resultVar``, with a boolean true value for success and boolean false for
- failure. If ``FAIL_REGEX`` is provided, then failure is determined by
+ by ``<resultVar>``, with a boolean true value for success and boolean false
+ for failure. If ``FAIL_REGEX`` is provided, then failure is determined by
checking if anything in the output matches any of the specified regular
expressions.
@@ -34,7 +35,7 @@ Check if given C++ source compiles and links into an executable.
``CMAKE_REQUIRED_DEFINITIONS``
A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
- ``resultVar`` will also be added automatically.
+ ``<resultVar>`` will also be added automatically.
``CMAKE_REQUIRED_INCLUDES``
A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
@@ -42,6 +43,10 @@ Check if given C++ source compiles and links into an executable.
``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
directory property will be ignored.
+ ``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).
+
``CMAKE_REQUIRED_LIBRARIES``
A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
command. These can be the name of system libraries or they can be
@@ -53,10 +58,10 @@ Check if given C++ source compiles and links into an executable.
associated with the check will be suppressed.
The check is only performed once, with the result cached in the variable
- named by ``resultVar``. Every subsequent CMake run will re-use this cached
- value rather than performing the check again, even if the ``code`` changes.
+ named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
+ value rather than performing the check again, even if the ``<code>`` changes.
In order to force the check to be re-evaluated, the variable named by
- ``resultVar`` must be manually removed from the cache.
+ ``<resultVar>`` must be manually removed from the cache.
#]=======================================================================]
@@ -78,6 +83,12 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_CXX_SOURCE_COMPILES_ADD_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_CXX_SOURCE_COMPILES_ADD_LINK_OPTIONS)
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -100,6 +111,7 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_CXX_SOURCE_COMPILES_ADD_LINK_OPTIONS}
${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
"${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
@@ -132,4 +144,3 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
endif()
endif()
endmacro()
-
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
index 83bf2f23d..5e3f19581 100644
--- a/Modules/CheckCXXSourceRuns.cmake
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -10,16 +10,16 @@ subsequently be run.
.. command:: check_cxx_source_runs
- ::
+ .. code-block:: cmake
- check_cxx_source_runs(code resultVar)
+ check_cxx_source_runs(<code> <resultVar>)
- Check that the source supplied in ``code`` can be compiled as a C++ source
- file, linked as an executable and then run. The ``code`` must contain at
- least a ``main()`` function. If the code could be built and run successfully,
- the internal cache variable specified by ``resultVar`` will be set to 1,
- otherwise it will be set to an value that evaluates to boolean false (e.g.
- an empty string or an error message).
+ Check that the source supplied in ``<code>`` can be compiled as a C++ source
+ file, linked as an executable and then run. The ``<code>`` must contain at
+ least a ``main()`` function. If the ``<code>`` could be built and run
+ successfully, the internal cache variable specified by ``<resultVar>`` will
+ be set to 1, otherwise it will be set to an value that evaluates to boolean
+ false (e.g. an empty string or an error message).
The underlying check is performed by the :command:`try_run` command. The
compile and link commands can be influenced by setting any of the following
@@ -34,7 +34,7 @@ subsequently be run.
``CMAKE_REQUIRED_DEFINITIONS``
A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
- ``resultVar`` will also be added automatically.
+ ``<resultVar>`` will also be added automatically.
``CMAKE_REQUIRED_INCLUDES``
A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
@@ -42,6 +42,10 @@ subsequently be run.
``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
directory property will be ignored.
+ ``CMAKE_REQUIRED_LINK_OPTIONS``
+ A :ref:`;-list <CMake Language Lists>` of options to add to the link
+ command (see :command:`try_run` for further details).
+
``CMAKE_REQUIRED_LIBRARIES``
A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
command. These can be the name of system libraries or they can be
@@ -53,10 +57,10 @@ subsequently be run.
associated with the check will be suppressed.
The check is only performed once, with the result cached in the variable
- named by ``resultVar``. Every subsequent CMake run will re-use this cached
- value rather than performing the check again, even if the ``code`` changes.
+ named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
+ value rather than performing the check again, even if the ``<code>`` changes.
In order to force the check to be re-evaluated, the variable named by
- ``resultVar`` must be manually removed from the cache.
+ ``<resultVar>`` must be manually removed from the cache.
#]=======================================================================]
@@ -66,6 +70,12 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
if(NOT DEFINED "${VAR}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_CXX_SOURCE_COMPILES_ADD_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_CXX_SOURCE_COMPILES_ADD_LINK_OPTIONS)
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -88,11 +98,13 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_CXX_SOURCE_COMPILES_ADD_LINK_OPTIONS}
${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
-DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
"${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
- COMPILE_OUTPUT_VARIABLE OUTPUT)
+ COMPILE_OUTPUT_VARIABLE OUTPUT
+ RUN_OUTPUT_VARIABLE RUN_OUTPUT)
# if it did not compile make the return value fail code of 1
if(NOT ${VAR}_COMPILED)
@@ -107,6 +119,8 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C++ SOURCE FILE Test ${VAR} succeeded with the following output:\n"
"${OUTPUT}\n"
+ "...and run output:\n"
+ "${RUN_OUTPUT}\n"
"Return value: ${${VAR}}\n"
"Source file was:\n${SOURCE}\n")
else()
@@ -122,9 +136,10 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
+ "...and run output:\n"
+ "${RUN_OUTPUT}\n"
"Return value: ${${VAR}_EXITCODE}\n"
"Source file was:\n${SOURCE}\n")
endif()
endif()
endmacro()
-
diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake
index 117a45808..970e301b4 100644
--- a/Modules/CheckCXXSymbolExists.cmake
+++ b/Modules/CheckCXXSymbolExists.cmake
@@ -1,36 +1,49 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckCXXSymbolExists
-# --------------------
-#
-# Check if a symbol exists as a function, variable, or macro in C++
-#
-# CHECK_CXX_SYMBOL_EXISTS(<symbol> <files> <variable>)
-#
-# Check that the <symbol> is available after including given header
-# <files> and store the result in a <variable>. Specify the list of
-# files in one argument as a semicolon-separated list.
-# CHECK_CXX_SYMBOL_EXISTS() can be used to check in C++ files, as
-# opposed to CHECK_SYMBOL_EXISTS(), which works only for C.
-#
-# If the header files define the symbol as a macro it is considered
-# available and assumed to work. If the header files declare the symbol
-# as a function or variable then the symbol must also be available for
-# linking. If the symbol is a type or enum value it will not be
-# recognized (consider using CheckTypeSize or CheckCSourceCompiles).
-#
-# The following variables may be set before calling this macro to modify
-# the way the check is run:
-#
-# ::
-#
-# CMAKE_REQUIRED_FLAGS = string of compile command line flags
-# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
-# CMAKE_REQUIRED_INCLUDES = list of include directories
-# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
-# CMAKE_REQUIRED_QUIET = execute quietly without messages
+#[=======================================================================[.rst:
+CheckCXXSymbolExists
+--------------------
+
+Check if a symbol exists as a function, variable, or macro in C++
+
+.. command:: CHECK_CXX_SYMBOL_EXISTS
+
+ .. code-block:: cmake
+
+ CHECK_CXX_SYMBOL_EXISTS(<symbol> <files> <variable>)
+
+ Check that the ``<symbol>`` is available after including given header
+ ``<files>`` and store the result in a ``<variable>``. Specify the list of
+ files in one argument as a semicolon-separated list.
+ ``CHECK_CXX_SYMBOL_EXISTS()`` can be used to check in C++ files, as
+ opposed to ``CHECK_SYMBOL_EXISTS()``, which works only for ``C``.
+
+ If the header files define the symbol as a macro it is considered
+ available and assumed to work. If the header files declare the symbol
+ as a function or variable then the symbol must also be available for
+ linking. If the symbol is a type or enum value it will not be
+ recognized (consider using :module:`CheckTypeSize`
+ or :module:`CheckCSourceCompiles`).
+
+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``
+ a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
+``CMAKE_REQUIRED_INCLUDES``
+ 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.
+``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.
+#]=======================================================================]
include_guard(GLOBAL)
include(CheckSymbolExists)
diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake
index 2cb25321e..299cd8cfc 100644
--- a/Modules/CheckFortranCompilerFlag.cmake
+++ b/Modules/CheckFortranCompilerFlag.cmake
@@ -9,7 +9,7 @@ Check whether the Fortran compiler supports a given flag.
.. command:: check_fortran_compiler_flag
- ::
+ .. code-block:: cmake
check_fortran_compiler_flag(<flag> <var>)
diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake
index f3ced93d7..7ca205a6d 100644
--- a/Modules/CheckFortranFunctionExists.cmake
+++ b/Modules/CheckFortranFunctionExists.cmake
@@ -1,34 +1,50 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckFortranFunctionExists
-# --------------------------
-#
-# macro which checks if the Fortran function exists
-#
-# CHECK_FORTRAN_FUNCTION_EXISTS(FUNCTION VARIABLE)
-#
-# ::
-#
-# FUNCTION - the name of the Fortran function
-# VARIABLE - variable to store the result
-# Will be created as an internal cache variable.
-#
-#
-#
-# The following variables may be set before calling this macro to modify
-# the way the check is run:
-#
-# ::
-#
-# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+#[=======================================================================[.rst:
+CheckFortranFunctionExists
+--------------------------
+
+Check if a Fortran function exists.
+
+.. command:: CHECK_FORTRAN_FUNCTION_EXISTS
+
+ .. code-block:: cmake
+
+ CHECK_FORTRAN_FUNCTION_EXISTS(<function> <result>)
+
+ where
+
+ ``<function>``
+ the name of the Fortran function
+ ``<result>``
+ variable to store the result; will be created as an internal cache variable.
+
+The following variables may be set before calling this macro to modify
+the way the check is run:
+
+``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).
+
+``CMAKE_REQUIRED_LIBRARIES``
+ A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
+ command. These can be the name of system libraries or they can be
+ :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for
+ further details).
+#]=======================================================================]
include_guard(GLOBAL)
macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
if(NOT DEFINED ${VARIABLE})
message(STATUS "Looking for Fortran ${FUNCTION}")
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_FUNCTION_EXISTS_ADD_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_FUNCTION_EXISTS_ADD_LINK_OPTIONS)
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -47,6 +63,7 @@ macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+ ${CHECK_FUNCTION_EXISTS_ADD_LINK_OPTIONS}
${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}
OUTPUT_VARIABLE OUTPUT
)
diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake
index d2b0ccaf4..f94b25468 100644
--- a/Modules/CheckFortranSourceCompiles.cmake
+++ b/Modules/CheckFortranSourceCompiles.cmake
@@ -9,23 +9,37 @@ Check if given Fortran source compiles and links into an executable.
.. command:: check_fortran_source_compiles
- ::
+ .. code-block:: cmake
- check_fortran_source_compiles(code resultVar
- [FAIL_REGEX regex1 [regex2...]]
- [SRC_EXT ext]
+ check_fortran_source_compiles(<code> <resultVar>
+ [FAIL_REGEX <regex>...]
+ [SRC_EXT <extension>]
)
- Check that the source supplied in ``code`` can be compiled as a Fortran
- source file and linked as an executable (so it must contain at least a
- ``PROGRAM`` entry point). The result will be stored in the internal cache
- variable specified by ``resultVar``, with a boolean true value for success
- and boolean false for failure. If ``FAIL_REGEX`` is provided, then failure is
- determined by checking if anything in the output matches any of the specified
- regular expressions.
+ Checks that the source supplied in ``<code>`` can be compiled as a Fortran
+ source file and linked as an executable. The ``<code>`` must be a Fortran program
+ containing at least an ``end`` statement--for example:
+
+ .. code-block:: cmake
+
+ check_fortran_source_compiles("character :: b; error stop b; end" F2018ESTOPOK SRC_EXT F90)
+
+ This command can help avoid costly build processes when a compiler lacks support
+ for a necessary feature, or a particular vendor library is not compatible with
+ the Fortran compiler version being used. This generate-time check may advise the
+ user of such before the main build process. See also the
+ :command:`check_fortran_source_runs` command to actually run the compiled code.
+
+ The result will be stored in the internal cache
+ variable ``<resultVar>``, with a boolean true value for success and boolean
+ false for failure.
+
+ If ``FAIL_REGEX`` is provided, then failure is determined by checking
+ if anything in the output matches any of the specified regular expressions.
By default, the test source file will be given a ``.F`` file extension. The
- ``SRC_EXT`` option can be used to override this with ``.ext`` instead.
+ ``SRC_EXT`` option can be used to override this with ``.<extension>`` instead--
+ ``.F90`` is a typical choice.
The underlying check is performed by the :command:`try_compile` command. The
compile and link commands can be influenced by setting any of the following
@@ -40,7 +54,7 @@ Check if given Fortran source compiles and links into an executable.
``CMAKE_REQUIRED_DEFINITIONS``
A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
- ``resultVar`` will also be added automatically.
+ ``<resultVar>`` will also be added automatically.
``CMAKE_REQUIRED_INCLUDES``
A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
@@ -48,6 +62,10 @@ Check if given Fortran source compiles and links into an executable.
``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
directory property will be ignored.
+ ``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).
+
``CMAKE_REQUIRED_LIBRARIES``
A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
command. These can be the name of system libraries or they can be
@@ -59,10 +77,10 @@ Check if given Fortran source compiles and links into an executable.
associated with the check will be suppressed.
The check is only performed once, with the result cached in the variable
- named by ``resultVar``. Every subsequent CMake run will re-use this cached
- value rather than performing the check again, even if the ``code`` changes.
+ named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
+ value rather than performing the check again, even if the ``<code>`` changes.
In order to force the check to be re-evaluated, the variable named by
- ``resultVar`` must be manually removed from the cache.
+ ``<resultVar>`` must be manually removed from the cache.
#]=======================================================================]
@@ -87,6 +105,12 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
endif()
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS)
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -109,6 +133,7 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS}
${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
"${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}"
diff --git a/Modules/CheckFortranSourceRuns.cmake b/Modules/CheckFortranSourceRuns.cmake
new file mode 100644
index 000000000..a80c13d00
--- /dev/null
+++ b/Modules/CheckFortranSourceRuns.cmake
@@ -0,0 +1,175 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+CheckFortranSourceRuns
+----------------------
+
+Check if given Fortran source compiles and links into an executable and can
+subsequently be run.
+
+.. command:: check_fortran_source_runs
+
+ .. code-block:: cmake
+
+ check_fortran_source_runs(<code> <resultVar>
+ [SRC_EXT <extension>])
+
+ Check that the source supplied in ``<code>`` can be compiled as a Fortran source
+ file, linked as an executable and then run. The ``<code>`` must be a Fortran program
+ containing at least an ``end`` statement--for example:
+
+ .. code-block:: cmake
+
+ check_fortran_source_runs("real :: x[*]; call co_sum(x); end" F2018coarrayOK)
+
+ This command can help avoid costly build processes when a compiler lacks support
+ for a necessary feature, or a particular vendor library is not compatible with
+ the Fortran compiler version being used. Some of these failures only occur at runtime
+ instead of linktime, and a trivial runtime example can catch the issue before the
+ main build process.
+
+ If the ``<code>`` could be built and run
+ successfully, the internal cache variable specified by ``<resultVar>`` will
+ be set to 1, otherwise it will be set to an value that evaluates to boolean
+ false (e.g. an empty string or an error message).
+
+ By default, the test source file will be given a ``.F90`` file extension. The
+ ``SRC_EXT`` option can be used to override this with ``.<extension>`` instead.
+
+ The underlying check is performed by the :command:`try_run` command. The
+ compile and link commands can be influenced by setting any of the following
+ variables prior to calling ``check_fortran_source_runs()``:
+
+ ``CMAKE_REQUIRED_FLAGS``
+ Additional flags to pass to the compiler. Note that the contents of
+ :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
+ configuration-specific variable are automatically added to the compiler
+ command before the contents of ``CMAKE_REQUIRED_FLAGS``.
+
+ ``CMAKE_REQUIRED_DEFINITIONS``
+ A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
+ ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
+ ``<resultVar>`` will also be added automatically.
+
+ ``CMAKE_REQUIRED_INCLUDES``
+ A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
+ the compiler. These will be the only header search paths used by
+ ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
+ directory property will be ignored.
+
+ ``CMAKE_REQUIRED_LINK_OPTIONS``
+ A :ref:`;-list <CMake Language Lists>` of options to add to the link
+ command (see :command:`try_run` for further details).
+
+ ``CMAKE_REQUIRED_LIBRARIES``
+ A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
+ command. These can be the name of system libraries or they can be
+ :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for
+ further details).
+
+ ``CMAKE_REQUIRED_QUIET``
+ If this variable evaluates to a boolean true value, all status messages
+ associated with the check will be suppressed.
+
+ The check is only performed once, with the result cached in the variable
+ named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
+ value rather than performing the check again, even if the ``<code>`` changes.
+ In order to force the check to be re-evaluated, the variable named by
+ ``<resultVar>`` must be manually removed from the cache.
+
+#]=======================================================================]
+
+include_guard(GLOBAL)
+
+macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR)
+ if(NOT DEFINED "${VAR}")
+ set(_SRC_EXT)
+ set(_key)
+ foreach(arg ${ARGN})
+ if("${arg}" MATCHES "^(SRC_EXT)$")
+ set(_key "${arg}")
+ elseif(_key)
+ list(APPEND _${_key} "${arg}")
+ else()
+ message(FATAL_ERROR "Unknown argument:\n ${arg}\n")
+ endif()
+ endforeach()
+ if(NOT _SRC_EXT)
+ set(_SRC_EXT F90)
+ endif()
+ set(MACRO_CHECK_FUNCTION_DEFINITIONS
+ "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS)
+ endif()
+ if(CMAKE_REQUIRED_LIBRARIES)
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+ else()
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES)
+ endif()
+ if(CMAKE_REQUIRED_INCLUDES)
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ else()
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES)
+ endif()
+ file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}"
+ "${SOURCE}\n")
+
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR}")
+ endif()
+ try_run(${VAR}_EXITCODE ${VAR}_COMPILED
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS}
+ ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
+ "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}"
+ COMPILE_OUTPUT_VARIABLE OUTPUT
+ RUN_OUTPUT_VARIABLE RUN_OUTPUT)
+
+ # if it did not compile make the return value fail code of 1
+ if(NOT ${VAR}_COMPILED)
+ set(${VAR}_EXITCODE 1)
+ endif()
+ # if the return value was 0 then it worked
+ if("${${VAR}_EXITCODE}" EQUAL 0)
+ set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Success")
+ endif()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing Fortran SOURCE FILE Test ${VAR} succeeded with the following output:\n"
+ "${OUTPUT}\n"
+ "...and run output:\n"
+ "${RUN_OUTPUT}\n"
+ "Return value: ${${VAR}}\n"
+ "Source file was:\n${SOURCE}\n")
+ else()
+ if(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
+ set(${VAR} "${${VAR}_EXITCODE}")
+ else()
+ set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+ endif()
+
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Failed")
+ endif()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n"
+ "${OUTPUT}\n"
+ "...and run output:\n"
+ "${RUN_OUTPUT}\n"
+ "Return value: ${${VAR}_EXITCODE}\n"
+ "Source file was:\n${SOURCE}\n")
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index d00aa8ade..c39144fa8 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -1,42 +1,54 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckFunctionExists
-# -------------------
-#
-# Check if a C function can be linked::
-#
-# check_function_exists(<function> <variable>)
-#
-# Check that the ``<function>`` is provided by libraries on the system and store
-# the result in a ``<variable>``. ``<variable>`` will be created as an internal
-# cache variable.
-#
-# The following variables may be set before calling this macro to modify the
-# way the check is run:
-#
-# ::
-#
-# CMAKE_REQUIRED_FLAGS = string of compile command line flags
-# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
-# CMAKE_REQUIRED_INCLUDES = list of include directories
-# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
-# CMAKE_REQUIRED_QUIET = execute quietly without messages
-#
-# .. note::
-#
-# Prefer using :Module:`CheckSymbolExists` instead of this module,
-# for the following reasons:
-#
-# * ``check_function_exists()`` can't detect functions that are inlined
-# in headers or specified as a macro.
-#
-# * ``check_function_exists()`` can't detect anything in the 32-bit
-# versions of the Win32 API, because of a mismatch in calling conventions.
-#
-# * ``check_function_exists()`` only verifies linking, it does not verify
-# that the function is declared in system headers.
+#[=======================================================================[.rst:
+CheckFunctionExists
+-------------------
+
+Check if a C function can be linked
+
+.. command:: check_function_exists
+
+ .. code-block:: cmake
+
+ check_function_exists(<function> <variable>)
+
+ Checks that the ``<function>`` is provided by libraries on the system and store
+ the result in a ``<variable>``, which will be created as an internal
+ cache variable.
+
+The following variables may be set before calling this macro to modify the
+way the check is run:
+
+``CMAKE_REQUIRED_FLAGS``
+ string of compile command line flags.
+``CMAKE_REQUIRED_DEFINITIONS``
+ a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
+``CMAKE_REQUIRED_INCLUDES``
+ 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.
+``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.
+
+.. note::
+
+ Prefer using :Module:`CheckSymbolExists` instead of this module,
+ for the following reasons:
+
+ * ``check_function_exists()`` can't detect functions that are inlined
+ in headers or specified as a macro.
+
+ * ``check_function_exists()`` can't detect anything in the 32-bit
+ versions of the Win32 API, because of a mismatch in calling conventions.
+
+ * ``check_function_exists()`` only verifies linking, it does not verify
+ that the function is declared in system headers.
+#]=======================================================================]
include_guard(GLOBAL)
@@ -47,6 +59,12 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${FUNCTION}")
endif()
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_FUNCTION_EXISTS_ADD_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_FUNCTION_EXISTS_ADD_LINK_OPTIONS)
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -73,6 +91,7 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
${CMAKE_BINARY_DIR}
${_cfe_source}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_FUNCTION_EXISTS_ADD_LINK_OPTIONS}
${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
"${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}"
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake
index ad8852c06..0d6ad20ae 100644
--- a/Modules/CheckIPOSupported.cmake
+++ b/Modules/CheckIPOSupported.cmake
@@ -51,8 +51,6 @@ Examples
#]=======================================================================]
-include(CMakeParseArguments) # cmake_parse_arguments
-
# X_RESULT - name of the final result variable
# X_OUTPUT - name of the variable with information about error
macro(_ipo_not_supported output)
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
index 24bc34964..d7b9481da 100644
--- a/Modules/CheckIncludeFile.cmake
+++ b/Modules/CheckIncludeFile.cmake
@@ -1,40 +1,45 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckIncludeFile
-# ----------------
-#
-# Provides a macro to check if a header file can be included in ``C``.
-#
-# .. command:: CHECK_INCLUDE_FILE
-#
-# ::
-#
-# CHECK_INCLUDE_FILE(<include> <variable> [<flags>])
-#
-# Check if the given ``<include>`` file may be included in a ``C``
-# source file and store the result in an internal cache entry named
-# ``<variable>``. The optional third argument may be used to add
-# compilation flags to the check (or use ``CMAKE_REQUIRED_FLAGS`` below).
-#
-# The following variables may be set before calling this macro to modify
-# the way the check is run:
-#
-# ``CMAKE_REQUIRED_FLAGS``
-# string of compile command line flags
-# ``CMAKE_REQUIRED_DEFINITIONS``
-# list of macros to define (-DFOO=bar)
-# ``CMAKE_REQUIRED_INCLUDES``
-# list of include directories
-# ``CMAKE_REQUIRED_LIBRARIES``
-# A list of libraries to link. See policy :policy:`CMP0075`.
-# ``CMAKE_REQUIRED_QUIET``
-# 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
-# using the ``CXX`` language.
+#[=======================================================================[.rst:
+CheckIncludeFile
+----------------
+
+Provides a macro to check if a header file can be included in ``C``.
+
+.. command:: CHECK_INCLUDE_FILE
+
+ .. code-block:: cmake
+
+ CHECK_INCLUDE_FILE(<include> <variable> [<flags>])
+
+ Check if the given ``<include>`` file may be included in a ``C``
+ source file and store the result in an internal cache entry named
+ ``<variable>``. The optional third argument may be used to add
+ compilation flags to the check (or use ``CMAKE_REQUIRED_FLAGS`` below).
+
+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``
+ a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
+``CMAKE_REQUIRED_INCLUDES``
+ 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.
+``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.
+
+See the :module:`CheckIncludeFiles` module to check for multiple headers
+at once. See the :module:`CheckIncludeFileCXX` module to check for headers
+using the ``CXX`` language.
+#]=======================================================================]
include_guard(GLOBAL)
@@ -57,6 +62,11 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
string(APPEND CMAKE_C_FLAGS " ${ARGV2}")
endif()
+ set(_CIF_LINK_OPTIONS)
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(_CIF_LINK_OPTIONS LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ endif()
+
set(_CIF_LINK_LIBRARIES "")
if(CMAKE_REQUIRED_LIBRARIES)
cmake_policy(GET CMP0075 _CIF_CMP0075
@@ -84,11 +94,13 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${_CIF_LINK_OPTIONS}
${_CIF_LINK_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
"${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}"
OUTPUT_VARIABLE OUTPUT)
+ unset(_CIF_LINK_OPTIONS)
unset(_CIF_LINK_LIBRARIES)
if(${ARGC} EQUAL 3)
diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake
index f13d983b6..de5a83b35 100644
--- a/Modules/CheckIncludeFileCXX.cmake
+++ b/Modules/CheckIncludeFileCXX.cmake
@@ -1,39 +1,44 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckIncludeFileCXX
-# -------------------
-#
-# Provides a macro to check if a header file can be included in ``CXX``.
-#
-# .. command:: CHECK_INCLUDE_FILE_CXX
-#
-# ::
-#
-# CHECK_INCLUDE_FILE_CXX(<include> <variable> [<flags>])
-#
-# Check if the given ``<include>`` file may be included in a ``CXX``
-# source file and store the result in an internal cache entry named
-# ``<variable>``. The optional third argument may be used to add
-# compilation flags to the check (or use ``CMAKE_REQUIRED_FLAGS`` below).
-#
-# The following variables may be set before calling this macro to modify
-# the way the check is run:
-#
-# ``CMAKE_REQUIRED_FLAGS``
-# string of compile command line flags
-# ``CMAKE_REQUIRED_DEFINITIONS``
-# list of macros to define (-DFOO=bar)
-# ``CMAKE_REQUIRED_INCLUDES``
-# list of include directories
-# ``CMAKE_REQUIRED_LIBRARIES``
-# A list of libraries to link. See policy :policy:`CMP0075`.
-# ``CMAKE_REQUIRED_QUIET``
-# execute quietly without messages
-#
-# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles`
-# to check for one or more ``C`` headers.
+#[=======================================================================[.rst:
+CheckIncludeFileCXX
+-------------------
+
+Provides a macro to check if a header file can be included in ``CXX``.
+
+.. command:: CHECK_INCLUDE_FILE_CXX
+
+ .. code-block:: cmake
+
+ CHECK_INCLUDE_FILE_CXX(<include> <variable> [<flags>])
+
+ Check if the given ``<include>`` file may be included in a ``CXX``
+ source file and store the result in an internal cache entry named
+ ``<variable>``. The optional third argument may be used to add
+ compilation flags to the check (or use ``CMAKE_REQUIRED_FLAGS`` below).
+
+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``
+ a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
+``CMAKE_REQUIRED_INCLUDES``
+ 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.
+``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.
+
+See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles`
+to check for one or more ``C`` headers.
+#]=======================================================================]
include_guard(GLOBAL)
@@ -56,6 +61,11 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
string(APPEND CMAKE_CXX_FLAGS " ${ARGV2}")
endif()
+ set(_CIF_LINK_OPTIONS)
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(_CIF_LINK_OPTIONS LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ endif()
+
set(_CIF_LINK_LIBRARIES "")
if(CMAKE_REQUIRED_LIBRARIES)
cmake_policy(GET CMP0075 _CIF_CMP0075
@@ -83,11 +93,13 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${_CIF_LINK_OPTIONS}
${_CIF_LINK_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
"${CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS}"
OUTPUT_VARIABLE OUTPUT)
+ unset(_CIF_LINK_OPTIONS)
unset(_CIF_LINK_LIBRARIES)
if(${ARGC} EQUAL 3)
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index c689f05e9..f52ab55fb 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -1,45 +1,50 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckIncludeFiles
-# -----------------
-#
-# Provides a macro to check if a list of one or more header files can
-# be included together.
-#
-# .. command:: CHECK_INCLUDE_FILES
-#
-# ::
-#
-# CHECK_INCLUDE_FILES("<includes>" <variable> [LANGUAGE <language>])
-#
-# Check if the given ``<includes>`` list may be included together
-# in a source file and store the result in an internal cache
-# entry named ``<variable>``. Specify the ``<includes>`` argument
-# as a :ref:`;-list <CMake Language Lists>` of header file names.
-#
-# If LANGUAGE is set, the specified compiler will be used to perform the
-# check. Acceptable values are ``C`` and ``CXX``. If not set, the C compiler
-# will be used if enabled. If the C compiler is not enabled, the C++
-# compiler will be used if enabled.
-#
-# The following variables may be set before calling this macro to modify
-# the way the check is run:
-#
-# ``CMAKE_REQUIRED_FLAGS``
-# string of compile command line flags
-# ``CMAKE_REQUIRED_DEFINITIONS``
-# list of macros to define (-DFOO=bar)
-# ``CMAKE_REQUIRED_INCLUDES``
-# list of include directories
-# ``CMAKE_REQUIRED_LIBRARIES``
-# A list of libraries to link. See policy :policy:`CMP0075`.
-# ``CMAKE_REQUIRED_QUIET``
-# execute quietly without messages
-#
-# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX`
-# to check for a single header file in ``C`` or ``CXX`` languages.
+#[=======================================================================[.rst:
+CheckIncludeFiles
+-----------------
+
+Provides a macro to check if a list of one or more header files can
+be included together.
+
+.. command:: CHECK_INCLUDE_FILES
+
+ .. code-block:: cmake
+
+ CHECK_INCLUDE_FILES("<includes>" <variable> [LANGUAGE <language>])
+
+ Check if the given ``<includes>`` list may be included together
+ in a source file and store the result in an internal cache
+ entry named ``<variable>``. Specify the ``<includes>`` argument
+ as a :ref:`;-list <CMake Language Lists>` of header file names.
+
+ If ``LANGUAGE`` is set, the specified compiler will be used to perform the
+ check. Acceptable values are ``C`` and ``CXX``. If not set, the C compiler
+ will be used if enabled. If the C compiler is not enabled, the C++
+ compiler will be used if enabled.
+
+The following variables may be set before calling this macro to modify
+the way the check is run:
+
+``CMAKE_REQUIRED_FLAGS``
+ string of compile command line flags.
+``CMAKE_REQUIRED_DEFINITIONS``
+ a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
+``CMAKE_REQUIRED_INCLUDES``
+ 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.
+``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.
+
+See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX`
+to check for a single header file in ``C`` or ``CXX`` languages.
+#]=======================================================================]
include_guard(GLOBAL)
@@ -97,6 +102,11 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
set(_description "include file ${_INCLUDE}")
endif()
+ set(_CIF_LINK_OPTIONS)
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(_CIF_LINK_OPTIONS LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ endif()
+
set(_CIF_LINK_LIBRARIES "")
if(CMAKE_REQUIRED_LIBRARIES)
cmake_policy(GET CMP0075 _CIF_CMP0075
@@ -127,11 +137,13 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
${CMAKE_BINARY_DIR}
${src}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${_CIF_LINK_OPTIONS}
${_CIF_LINK_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILES_FLAGS}
"${CHECK_INCLUDE_FILES_INCLUDE_DIRS}"
OUTPUT_VARIABLE OUTPUT)
+ unset(_CIF_LINK_OPTIONS)
unset(_CIF_LINK_LIBRARIES)
if(${VARIABLE})
if(NOT CMAKE_REQUIRED_QUIET)
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index ce92bfe6d..efa88bdab 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -1,35 +1,36 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckLanguage
-# -------------
-#
-# Check if a language can be enabled
-#
-# Usage:
-#
-# ::
-#
-# check_language(<lang>)
-#
-# where <lang> is a language that may be passed to enable_language()
-# such as "Fortran". If CMAKE_<lang>_COMPILER is already defined the
-# check does nothing. Otherwise it tries enabling the language in a
-# test project. The result is cached in CMAKE_<lang>_COMPILER as the
-# compiler that was found, or NOTFOUND if the language cannot be
-# enabled.
-#
-# Example:
-#
-# ::
-#
-# check_language(Fortran)
-# if(CMAKE_Fortran_COMPILER)
-# enable_language(Fortran)
-# else()
-# message(STATUS "No Fortran support")
-# endif()
+#[=======================================================================[.rst:
+CheckLanguage
+-------------
+
+Check if a language can be enabled
+
+Usage:
+
+::
+
+ check_language(<lang>)
+
+where <lang> is a language that may be passed to enable_language()
+such as "Fortran". If CMAKE_<lang>_COMPILER is already defined the
+check does nothing. Otherwise it tries enabling the language in a
+test project. The result is cached in CMAKE_<lang>_COMPILER as the
+compiler that was found, or NOTFOUND if the language cannot be
+enabled.
+
+Example:
+
+::
+
+ check_language(Fortran)
+ if(CMAKE_Fortran_COMPILER)
+ enable_language(Fortran)
+ else()
+ message(STATUS "No Fortran support")
+ endif()
+#]=======================================================================]
include_guard(GLOBAL)
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index 487cc592a..6504df5d7 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -1,33 +1,39 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckLibraryExists
-# ------------------
-#
-# Check if the function exists.
-#
-# CHECK_LIBRARY_EXISTS (LIBRARY FUNCTION LOCATION VARIABLE)
-#
-# ::
-#
-# LIBRARY - the name of the library you are looking for
-# FUNCTION - the name of the function
-# LOCATION - location where the library should be found
-# VARIABLE - variable to store the result
-# Will be created as an internal cache variable.
-#
-#
-#
-# 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_LIBRARIES = list of libraries to link
-# CMAKE_REQUIRED_QUIET = execute quietly without messages
+#[=======================================================================[.rst:
+CheckLibraryExists
+------------------
+
+Check if the function exists.
+
+.. command:: CHECK_LIBRARY_EXISTS
+
+ .. code-block:: cmake
+
+ CHECK_LIBRARY_EXISTS(LIBRARY FUNCTION LOCATION VARIABLE)
+
+ ::
+
+ LIBRARY - the name of the library you are looking for
+ FUNCTION - the name of the function
+ LOCATION - location where the library should be found
+ VARIABLE - variable to store the result
+ Will be created as an internal cache variable.
+
+
+
+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
+#]=======================================================================]
include_guard(GLOBAL)
@@ -38,6 +44,11 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
endif()
+ set(CHECK_LIBRARY_EXISTS_LINK_OPTIONS)
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_LIBRARY_EXISTS_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ endif()
set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY})
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_LIBRARY_EXISTS_LIBRARIES
@@ -57,6 +68,7 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
${CMAKE_BINARY_DIR}
${_cle_source}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_LIBRARY_EXISTS_LINK_OPTIONS}
LINK_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION}
diff --git a/Modules/CheckPIESupported.cmake b/Modules/CheckPIESupported.cmake
new file mode 100644
index 000000000..720217db6
--- /dev/null
+++ b/Modules/CheckPIESupported.cmake
@@ -0,0 +1,134 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+CheckPIESupported
+-----------------
+
+Check whether the linker supports position independent code (PIE) or no
+position independent code (NO_PIE) for executables.
+Use this to ensure that the :prop_tgt:`POSITION_INDEPENDENT_CODE` target
+property for executables will be honored at link time.
+
+.. command:: check_pie_supported
+
+ ::
+
+ check_pie_supported([OUTPUT_VARIABLE <output>]
+ [LANGUAGES <lang>...])
+
+ Options are:
+
+ ``OUTPUT_VARIABLE <output>``
+ Set ``<output>`` variable with details about any error.
+ ``LANGUAGES <lang>...``
+ Check the linkers used for each of the specified languages.
+ Supported languages are ``C``, ``CXX``, and ``Fortran``.
+
+It makes no sense to use this module when :policy:`CMP0083` is set to ``OLD``,
+so the command will return an error in this case. See policy :policy:`CMP0083`
+for details.
+
+Variables
+^^^^^^^^^
+
+For each language checked, two boolean cache variables are defined.
+
+ ``CMAKE_<lang>_LINK_PIE_SUPPORTED``
+ Set to ``YES`` if ``PIE`` is supported by the linker and ``NO`` otherwise.
+ ``CMAKE_<lang>_LINK_NO_PIE_SUPPORTED``
+ Set to ``YES`` if ``NO_PIE`` is supported by the linker and ``NO`` otherwise.
+
+Examples
+^^^^^^^^
+
+.. code-block:: cmake
+
+ check_pie_supported()
+ set_property(TARGET foo PROPERTY POSITION_INDEPENDENT_CODE TRUE)
+
+.. code-block:: cmake
+
+ # Retrieve any error message.
+ check_pie_supported(OUTPUT_VARIABLE output LANGUAGES C)
+ set_property(TARGET foo PROPERTY POSITION_INDEPENDENT_CODE TRUE)
+ if(NOT CMAKE_C_LINK_PIE_SUPPORTED)
+ message(WARNING "PIE is not supported at link time: ${output}.\n"
+ "PIE link options will not be passed to linker.")
+ endif()
+
+#]=======================================================================]
+
+
+include (Internal/CMakeCheckCompilerFlag)
+
+function (check_pie_supported)
+ cmake_policy(GET CMP0083 cmp0083)
+
+ if (NOT cmp0083)
+ message(FATAL_ERROR "check_pie_supported: Policy CMP0083 is not set")
+ endif()
+
+ if(cmp0083 STREQUAL "OLD")
+ message(FATAL_ERROR "check_pie_supported: Policy CMP0083 set to OLD")
+ endif()
+
+ set(optional)
+ set(one OUTPUT_VARIABLE)
+ set(multiple LANGUAGES)
+
+ cmake_parse_arguments(CHECK_PIE "${optional}" "${one}" "${multiple}" "${ARGN}")
+ if(CHECK_PIE_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "check_pie_supported: Unparsed arguments: ${CHECK_PIE_UNPARSED_ARGUMENTS}")
+ endif()
+
+ if (CHECK_PIE_LANGUAGES)
+ set (unsupported_languages "${CHECK_PIE_LANGUAGES}")
+ list (REMOVE_ITEM unsupported_languages "C" "CXX" "Fortran")
+ if(unsupported_languages)
+ message(FATAL_ERROR "check_pie_supported: language(s) '${unsupported_languages}' not supported")
+ endif()
+ else()
+ # User did not set any languages, use defaults
+ get_property (enabled_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+ if (NOT enabled_languages)
+ return()
+ endif()
+
+ list (FILTER enabled_languages INCLUDE REGEX "^(C|CXX|Fortran)$")
+ if (NOT enabled_languages)
+ return()
+ endif()
+
+ set (CHECK_PIE_LANGUAGES ${enabled_languages})
+ endif()
+
+ set (outputs)
+
+ foreach(lang IN LISTS CHECK_PIE_LANGUAGES)
+ if(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER)
+ cmake_check_compiler_flag(${lang} "${CMAKE_${lang}_LINK_OPTIONS_PIE}"
+ CMAKE_${lang}_LINK_PIE_SUPPORTED
+ OUTPUT_VARIABLE output)
+ if (NOT CMAKE_${lang}_LINK_PIE_SUPPORTED)
+ string (APPEND outputs "PIE (${lang}): ${output}\n")
+ endif()
+
+ cmake_check_compiler_flag(${lang} "${CMAKE_${lang}_LINK_OPTIONS_NO_PIE}"
+ CMAKE_${lang}_LINK_NO_PIE_SUPPORTED
+ OUTPUT_VARIABLE output)
+ if (NOT CMAKE_${lang}_LINK_NO_PIE_SUPPORTED)
+ string (APPEND outputs "NO_PIE (${lang}): ${output}\n")
+ endif()
+ else()
+ # no support at link time. Set cache variables to NO
+ set(CMAKE_${lang}_LINK_PIE_SUPPORTED NO CACHE INTERNAL "PIE (${lang})")
+ set(CMAKE_${lang}_LINK_NO_PIE_SUPPORTED NO CACHE INTERNAL "NO_PIE (${lang})")
+ string (APPEND outputs "PIE and NO_PIE are not supported by linker for ${lang}")
+ endif()
+ endforeach()
+
+ if (CHECK_PIE_OUTPUT_VARIABLE)
+ set (${CHECK_PIE_OUTPUT_VARIABLE} "${outputs}" PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
index dde077513..a7b020c06 100644
--- a/Modules/CheckPrototypeDefinition.cmake
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -1,43 +1,49 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckPrototypeDefinition
-# ------------------------
-#
-# Check if the prototype we expect is correct.
-#
-# check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE)
-#
-# ::
-#
-# FUNCTION - The name of the function (used to check if prototype exists)
-# PROTOTYPE- The prototype to check.
-# RETURN - The return value of the function.
-# HEADER - The header files required.
-# VARIABLE - The variable to store the result.
-# Will be created as an internal cache variable.
-#
-# Example:
-#
-# ::
-#
-# check_prototype_definition(getpwent_r
-# "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)"
-# "NULL"
-# "unistd.h;pwd.h"
-# SOLARIS_GETPWENT_R)
-#
-# The following variables may be set before calling this macro to modify
-# the way the check is run:
-#
-# ::
-#
-# CMAKE_REQUIRED_FLAGS = string of compile command line flags
-# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
-# CMAKE_REQUIRED_INCLUDES = list of include directories
-# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
-# CMAKE_REQUIRED_QUIET = execute quietly without messages
+#[=======================================================================[.rst:
+CheckPrototypeDefinition
+------------------------
+
+Check if the prototype we expect is correct.
+
+.. command:: check_prototype_definition
+
+ .. code-block:: cmake
+
+ check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE)
+
+ ::
+
+ FUNCTION - The name of the function (used to check if prototype exists)
+ PROTOTYPE- The prototype to check.
+ RETURN - The return value of the function.
+ HEADER - The header files required.
+ VARIABLE - The variable to store the result.
+ Will be created as an internal cache variable.
+
+ Example:
+
+ .. code-block:: cmake
+
+ check_prototype_definition(getpwent_r
+ "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)"
+ "NULL"
+ "unistd.h;pwd.h"
+ SOLARIS_GETPWENT_R)
+
+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
+#]=======================================================================]
#
@@ -45,12 +51,18 @@ get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
include_guard(GLOBAL)
-function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
+function(check_prototype_definition _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
if (NOT DEFINED ${_VARIABLE})
set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n")
set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ if (CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_PROTOTYPE_DEFINITION_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_PROTOTYPE_DEFINITION_LINK_OPTIONS)
+ endif()
if (CMAKE_REQUIRED_LIBRARIES)
set(CHECK_PROTOTYPE_DEFINITION_LIBS
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -82,6 +94,7 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_PROTOTYPE_DEFINITION_LINK_OPTIONS}
${CHECK_PROTOTYPE_DEFINITION_LIBS}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CHECK_PROTOTYPE_DEFINITION_FLAGS}
"${CMAKE_SYMBOL_EXISTS_INCLUDES}"
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index 8689a5cb9..7fef85770 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -1,42 +1,49 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckStructHasMember
-# --------------------
-#
-# Check if the given struct or class has the specified member variable
-#
-# ::
-#
-# CHECK_STRUCT_HAS_MEMBER(<struct> <member> <header> <variable>
-# [LANGUAGE <language>])
-#
-# ::
-#
-# <struct> - the name of the struct or class you are interested in
-# <member> - the member which existence you want to check
-# <header> - the header(s) where the prototype should be declared
-# <variable> - variable to store the result
-# <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_LIBRARIES = list of libraries to link
-# CMAKE_REQUIRED_QUIET = execute quietly without messages
-#
-#
-#
-# Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h
-# HAVE_TIMEVAL_TV_SEC LANGUAGE C)
+#[=======================================================================[.rst:
+CheckStructHasMember
+--------------------
+
+Check if the given struct or class has the specified member variable
+
+.. command:: CHECK_STRUCT_HAS_MEMBER
+
+ .. code-block:: cmake
+
+ CHECK_STRUCT_HAS_MEMBER(<struct> <member> <header> <variable>
+ [LANGUAGE <language>])
+
+ ::
+
+ <struct> - the name of the struct or class you are interested in
+ <member> - the member which existence you want to check
+ <header> - the header(s) where the prototype should be declared
+ <variable> - variable to store the result
+ <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
+
+
+Example:
+
+.. code-block:: cmake
+
+ CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h
+ HAVE_TIMEVAL_TV_SEC LANGUAGE C)
+#]=======================================================================]
include_guard(GLOBAL)
include(CheckCSourceCompiles)
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index 3483121dc..b9ef8088f 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -10,7 +10,7 @@ or macro in ``C``.
.. command:: check_symbol_exists
- ::
+ .. code-block:: cmake
check_symbol_exists(<symbol> <files> <variable>)
@@ -32,15 +32,19 @@ 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
+ string of compile command line flags.
``CMAKE_REQUIRED_DEFINITIONS``
- list of macros to define (-DFOO=bar)
+ a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
``CMAKE_REQUIRED_INCLUDES``
- list of include directories
+ 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.
``CMAKE_REQUIRED_LIBRARIES``
- list of libraries to link
+ 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
+ execute quietly without messages.
#]=======================================================================]
include_guard(GLOBAL)
@@ -62,6 +66,12 @@ macro(__CHECK_SYMBOL_EXISTS_IMPL SOURCEFILE SYMBOL FILES VARIABLE)
if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_SYMBOL_EXISTS_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_SYMBOL_EXISTS_LINK_OPTIONS)
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_SYMBOL_EXISTS_LIBS
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -91,6 +101,7 @@ macro(__CHECK_SYMBOL_EXISTS_IMPL SOURCEFILE SYMBOL FILES VARIABLE)
${CMAKE_BINARY_DIR}
"${SOURCEFILE}"
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_SYMBOL_EXISTS_LINK_OPTIONS}
${CHECK_SYMBOL_EXISTS_LIBS}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS}
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index 2b5deec81..372737307 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -1,72 +1,76 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckTypeSize
-# -------------
-#
-# Check sizeof a type
-#
-# ::
-#
-# CHECK_TYPE_SIZE(TYPE VARIABLE [BUILTIN_TYPES_ONLY]
-# [LANGUAGE <language>])
-#
-# Check if the type exists and determine its size. On return,
-# "HAVE_${VARIABLE}" holds the existence of the type, and "${VARIABLE}"
-# holds one of the following:
-#
-# ::
-#
-# <size> = type has non-zero size <size>
-# "0" = type has arch-dependent size (see below)
-# "" = type does not exist
-#
-# Both ``HAVE_${VARIABLE}`` and ``${VARIABLE}`` will be created as internal
-# cache variables.
-#
-# Furthermore, the variable "${VARIABLE}_CODE" holds C preprocessor code
-# to define the macro "${VARIABLE}" to the size of the type, or leave
-# the macro undefined if the type does not exist.
-#
-# The variable "${VARIABLE}" may be "0" when CMAKE_OSX_ARCHITECTURES has
-# multiple architectures for building OS X universal binaries. This
-# indicates that the type size varies across architectures. In this
-# case "${VARIABLE}_CODE" contains C preprocessor tests mapping from
-# each architecture macro to the corresponding type size. The list of
-# architecture macros is stored in "${VARIABLE}_KEYS", and the value for
-# each key is stored in "${VARIABLE}-${KEY}".
-#
-# If the BUILTIN_TYPES_ONLY option is not given, the macro checks for
-# headers <sys/types.h>, <stdint.h>, and <stddef.h>, and saves results
-# in HAVE_SYS_TYPES_H, HAVE_STDINT_H, and HAVE_STDDEF_H. The type size
-# check automatically includes the available headers, thus supporting
-# checks of types defined in the headers.
-#
-# If LANGUAGE is set, the specified compiler will be used to perform the
-# check. Acceptable values are C and CXX
-#
-# Despite the name of the macro you may use it to check the size of more
-# complex expressions, too. To check e.g. for the size of a struct
-# 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_LIBRARIES = list of libraries to link
-# CMAKE_REQUIRED_QUIET = execute quietly without messages
-# CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include
+#[=======================================================================[.rst:
+CheckTypeSize
+-------------
+
+Check sizeof a type
+
+.. command:: CHECK_TYPE_SIZE
+
+ .. code-block:: cmake
+
+ CHECK_TYPE_SIZE(TYPE VARIABLE [BUILTIN_TYPES_ONLY]
+ [LANGUAGE <language>])
+
+ Check if the type exists and determine its size. On return,
+ ``HAVE_${VARIABLE}`` holds the existence of the type, and ``${VARIABLE}``
+ holds one of the following:
+
+ ::
+
+ <size> = type has non-zero size <size>
+ "0" = type has arch-dependent size (see below)
+ "" = type does not exist
+
+ Both ``HAVE_${VARIABLE}`` and ``${VARIABLE}`` will be created as internal
+ cache variables.
+
+ Furthermore, the variable ``${VARIABLE}_CODE`` holds C preprocessor code
+ to define the macro ``${VARIABLE}`` to the size of the type, or leave
+ the macro undefined if the type does not exist.
+
+ The variable ``${VARIABLE}`` may be ``0`` when
+ :variable:`CMAKE_OSX_ARCHITECTURES` has multiple architectures for building
+ OS X universal binaries. This indicates that the type size varies across
+ architectures. In this case ``${VARIABLE}_CODE`` contains C preprocessor
+ tests mapping from each architecture macro to the corresponding type size.
+ The list of architecture macros is stored in ``${VARIABLE}_KEYS``, and the
+ value for each key is stored in ``${VARIABLE}-${KEY}``.
+
+ If the ``BUILTIN_TYPES_ONLY`` option is not given, the macro checks for
+ headers ``<sys/types.h>``, ``<stdint.h>``, and ``<stddef.h>``, and saves
+ results in ``HAVE_SYS_TYPES_H``, ``HAVE_STDINT_H``, and ``HAVE_STDDEF_H``.
+ The type size check automatically includes the available headers, thus
+ supporting checks of types defined in the headers.
+
+ If ``LANGUAGE`` is set, the specified compiler will be used to perform the
+ check. Acceptable values are ``C`` and ``CXX``.
+
+Despite the name of the macro you may use it to check the size of more
+complex expressions, too. To check e.g. for the size of a struct
+member you can do something like this:
+
+.. code-block:: cmake
+
+ 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
+#]=======================================================================]
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
@@ -115,6 +119,7 @@ function(__check_type_size_impl type var map builtin language)
configure_file(${__check_type_size_dir}/CheckTypeSize.c.in ${src} @ONLY)
try_compile(HAVE_${var} ${CMAKE_BINARY_DIR} ${src}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS}
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
CMAKE_FLAGS
"-DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}"
diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake
index ab456d14d..f4953a349 100644
--- a/Modules/CheckVariableExists.cmake
+++ b/Modules/CheckVariableExists.cmake
@@ -1,36 +1,39 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CheckVariableExists
-# -------------------
-#
-# Check if the variable exists.
-#
-# ::
-#
-# CHECK_VARIABLE_EXISTS(VAR VARIABLE)
-#
-#
-#
-# ::
-#
-# VAR - the name of the variable
-# VARIABLE - variable to store the result
-# Will be created as an internal cache variable.
-#
-#
-# This macro is only for C variables.
-#
-# 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_LIBRARIES = list of libraries to link
-# CMAKE_REQUIRED_QUIET = execute quietly without messages
+#[=======================================================================[.rst:
+CheckVariableExists
+-------------------
+
+Check if the variable exists.
+
+.. command:: CHECK_VARIABLE_EXISTS
+
+ .. code-block:: cmake
+
+ CHECK_VARIABLE_EXISTS(VAR VARIABLE)
+
+
+ ::
+
+ VAR - the name of the variable
+ VARIABLE - variable to store the result
+ Will be created as an internal cache variable.
+
+
+ This macro is only for ``C`` variables.
+
+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
+#]=======================================================================]
include_guard(GLOBAL)
@@ -41,6 +44,12 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${VAR}")
endif()
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_VARIABLE_EXISTS_ADD_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_VARIABLE_EXISTS_ADD_LINK_OPTIONS)
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -51,6 +60,7 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckVariableExists.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_VARIABLE_EXISTS_ADD_LINK_OPTIONS}
${CHECK_VARIABLE_EXISTS_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_VARIABLE_DEFINITIONS}
OUTPUT_VARIABLE OUTPUT)
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index e23470b14..c3f13f3a4 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -21,6 +21,12 @@ else()
macro(__compiler_clang lang)
__compiler_gnu(${lang})
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ # Link options for PIE are already set in 'Compiler/GNU.cmake'
+ # but clang may require alternate syntax on some platforms
+ if (APPLE)
+ set(CMAKE_${lang}_LINK_OPTIONS_PIE ${CMAKE_${lang}_COMPILE_OPTIONS_PIE} -Xlinker -pie)
+ set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE -Xlinker -no_pie)
+ endif()
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4.0)
diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake
index ff97e92aa..85a316793 100644
--- a/Modules/Compiler/Cray-CXX.cmake
+++ b/Modules/Compiler/Cray-CXX.cmake
@@ -2,7 +2,7 @@
# file Copyright.txt or https://cmake.org/licensing for details.
include(Compiler/Cray)
-__compiler_cray(C)
+__compiler_cray(CXX)
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
diff --git a/Modules/Compiler/CrayPrgEnv-C.cmake b/Modules/Compiler/CrayPrgEnv-C.cmake
index 6b461ce06..76aa93b95 100644
--- a/Modules/Compiler/CrayPrgEnv-C.cmake
+++ b/Modules/Compiler/CrayPrgEnv-C.cmake
@@ -4,8 +4,4 @@ endif()
set(__craylinux_crayprgenv_c 1)
include(Compiler/CrayPrgEnv)
-macro(__CrayPrgEnv_setup_C compiler_cmd link_cmd)
- __CrayPrgEnv_setup(C
- ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c
- ${compiler_cmd} ${link_cmd})
-endmacro()
+__CrayPrgEnv_setup(C)
diff --git a/Modules/Compiler/CrayPrgEnv-CXX.cmake b/Modules/Compiler/CrayPrgEnv-CXX.cmake
index aad85b67e..442370ecc 100644
--- a/Modules/Compiler/CrayPrgEnv-CXX.cmake
+++ b/Modules/Compiler/CrayPrgEnv-CXX.cmake
@@ -4,8 +4,4 @@ endif()
set(__craylinux_crayprgenv_cxx 1)
include(Compiler/CrayPrgEnv)
-macro(__CrayPrgEnv_setup_CXX compiler_cmd link_cmd)
- __CrayPrgEnv_setup(CXX
- ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp
- ${compiler_cmd} ${link_cmd})
-endmacro()
+__CrayPrgEnv_setup(CXX)
diff --git a/Modules/Compiler/CrayPrgEnv-Cray-C.cmake b/Modules/Compiler/CrayPrgEnv-Cray-C.cmake
deleted file mode 100644
index 547a4b4d5..000000000
--- a/Modules/Compiler/CrayPrgEnv-Cray-C.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_cray_c)
- return()
-endif()
-set(__craylinux_crayprgenv_cray_c 1)
-
-include(Compiler/CrayPrgEnv-C)
-__CrayPrgEnv_setup_C("/opt/cray/cce/.*/ccfe" "/opt/cray/cce/.*/ld")
diff --git a/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake b/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake
deleted file mode 100644
index df8452c15..000000000
--- a/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_cray_cxx)
- return()
-endif()
-set(__craylinux_crayprgenv_cray_cxx 1)
-
-include(Compiler/CrayPrgEnv-CXX)
-__CrayPrgEnv_setup_CXX("/opt/cray/cce/.*/ccfe" "/opt/cray/cce/.*/ld")
diff --git a/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake
deleted file mode 100644
index 9f46a04c8..000000000
--- a/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_cray_fortran)
- return()
-endif()
-set(__craylinux_crayprgenv_cray_fortran 1)
-
-include(Compiler/CrayPrgEnv-Fortran)
-__CrayPrgEnv_setup_Fortran("/opt/cray/cce/.*/ftnfe" "/opt/cray/cce/.*/ld")
diff --git a/Modules/Compiler/CrayPrgEnv-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Fortran.cmake
index 9c4d2694a..85f82d3f7 100644
--- a/Modules/Compiler/CrayPrgEnv-Fortran.cmake
+++ b/Modules/Compiler/CrayPrgEnv-Fortran.cmake
@@ -4,8 +4,4 @@ endif()
set(__craylinux_crayprgenv_fortran 1)
include(Compiler/CrayPrgEnv)
-macro(__CrayPrgEnv_setup_Fortran compiler_cmd link_cmd)
- __CrayPrgEnv_setup(Fortran
- ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F
- ${compiler_cmd} ${link_cmd})
-endmacro()
+__CrayPrgEnv_setup(Fortran)
diff --git a/Modules/Compiler/CrayPrgEnv-GNU-C.cmake b/Modules/Compiler/CrayPrgEnv-GNU-C.cmake
deleted file mode 100644
index 248081b87..000000000
--- a/Modules/Compiler/CrayPrgEnv-GNU-C.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_gnu_c)
- return()
-endif()
-set(__craylinux_crayprgenv_gnu_c 1)
-
-include(Compiler/CrayPrgEnv-C)
-__CrayPrgEnv_setup_C("/opt/gcc/.*/cc1" "/opt/gcc/.*/collect2")
diff --git a/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake b/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake
deleted file mode 100644
index be4eb6d54..000000000
--- a/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_gnu_cxx)
- return()
-endif()
-set(__craylinux_crayprgenv_gnu_cxx 1)
-
-include(Compiler/CrayPrgEnv-CXX)
-__CrayPrgEnv_setup_CXX("/opt/gcc/.*/cc1plus" "/opt/gcc/.*/collect2")
diff --git a/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake
deleted file mode 100644
index 8bd23ff88..000000000
--- a/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_gnu_fortran)
- return()
-endif()
-set(__craylinux_crayprgenv_gnu_fortran 1)
-
-include(Compiler/CrayPrgEnv-Fortran)
-__CrayPrgEnv_setup_Fortran("/opt/gcc/.*/f951" "/opt/gcc/.*/collect2")
diff --git a/Modules/Compiler/CrayPrgEnv-Intel-C.cmake b/Modules/Compiler/CrayPrgEnv-Intel-C.cmake
deleted file mode 100644
index 83c4e3801..000000000
--- a/Modules/Compiler/CrayPrgEnv-Intel-C.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_intel_c)
- return()
-endif()
-set(__craylinux_crayprgenv_intel_c 1)
-
-include(Compiler/CrayPrgEnv-C)
-__CrayPrgEnv_setup_C("/opt/intel/.*/mcpcom" "^ld ")
diff --git a/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake b/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake
deleted file mode 100644
index 3c3c3e63f..000000000
--- a/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_intel_cxx)
- return()
-endif()
-set(__craylinux_crayprgenv_intel_cxx 1)
-
-include(Compiler/CrayPrgEnv-CXX)
-__CrayPrgEnv_setup_CXX("/opt/intel/.*/mcpcom" "^ld ")
diff --git a/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake
deleted file mode 100644
index 08a316d2c..000000000
--- a/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_intel_fortran)
- return()
-endif()
-set(__craylinux_crayprgenv_intel_fortran 1)
-
-include(Compiler/CrayPrgEnv-Fortran)
-__CrayPrgEnv_setup_Fortran("/opt/intel/.*/fortcom" "^ld ")
diff --git a/Modules/Compiler/CrayPrgEnv-PGI-C.cmake b/Modules/Compiler/CrayPrgEnv-PGI-C.cmake
deleted file mode 100644
index f45767caf..000000000
--- a/Modules/Compiler/CrayPrgEnv-PGI-C.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_pgi_c)
- return()
-endif()
-set(__craylinux_crayprgenv_pgi_c 1)
-
-include(Compiler/CrayPrgEnv-C)
-__CrayPrgEnv_setup_C("/opt/pgi/[^ ]*/pgc" "/usr/bin/ld")
diff --git a/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake b/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake
deleted file mode 100644
index a2a286f8c..000000000
--- a/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_pgi_cxx)
- return()
-endif()
-set(__craylinux_crayprgenv_pgi_cxx 1)
-
-include(Compiler/CrayPrgEnv-CXX)
-__CrayPrgEnv_setup_CXX("/opt/pgi/[^ ]*/pgcpp" "/usr/bin/ld")
diff --git a/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake
deleted file mode 100644
index f6ba7c0fa..000000000
--- a/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-if(__craylinux_crayprgenv_pgi_fortran)
- return()
-endif()
-set(__craylinux_crayprgenv_pgi_fortran 1)
-
-include(Compiler/CrayPrgEnv-Fortran)
-__CrayPrgEnv_setup_Fortran("/opt/pgi/[^ ]*/pgf" "/usr/bin/ld")
diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake
index 05e3fc763..6c1c77016 100644
--- a/Modules/Compiler/CrayPrgEnv.cmake
+++ b/Modules/Compiler/CrayPrgEnv.cmake
@@ -4,54 +4,7 @@ if(__craylinux_crayprgenv)
endif()
set(__craylinux_crayprgenv 1)
-macro(__cray_extract_args cmd tag_regex out_var make_absolute)
- string(REGEX MATCHALL "${tag_regex}" args "${cmd}")
- foreach(arg IN LISTS args)
- string(REGEX REPLACE "^${tag_regex}$" "\\2" param "${arg}")
- if(make_absolute)
- get_filename_component(param "${param}" ABSOLUTE)
- endif()
- list(APPEND ${out_var} ${param})
- endforeach()
-endmacro()
-
-function(__cray_extract_implicit src compiler_cmd link_cmd lang include_dirs_var link_dirs_var link_libs_var)
- set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CrayExtractImplicit_${lang}.bin")
- execute_process(
- COMMAND ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_VERBOSE_FLAG} -o ${BIN}
- RESULT_VARIABLE result
- OUTPUT_VARIABLE output
- ERROR_VARIABLE error
- )
- if(EXISTS "${BIN}")
- file(REMOVE "${BIN}")
- endif()
- set(include_dirs)
- set(link_dirs)
- set(link_libs)
- string(REGEX REPLACE "\r?\n" ";" output_lines "${output}\n${error}")
- foreach(line IN LISTS output_lines)
- if("${line}" MATCHES "${compiler_cmd}")
- __cray_extract_args("${line}" " -(I ?|isystem )([^ ]*)" include_dirs 1)
- set(processed_include 1)
- endif()
- if("${line}" MATCHES "${link_cmd}")
- __cray_extract_args("${line}" " -(L ?)([^ ]*)" link_dirs 1)
- __cray_extract_args("${line}" " -(l ?)([^ ]*)" link_libs 0)
- set(processed_link 1)
- endif()
- if(processed_include AND processed_link)
- break()
- endif()
- endforeach()
-
- set(${include_dirs_var} "${include_dirs}" PARENT_SCOPE)
- set(${link_dirs_var} "${link_dirs}" PARENT_SCOPE)
- set(${link_libs_var} "${link_libs}" PARENT_SCOPE)
- set(CRAY_${lang}_EXTRACTED_IMPLICIT 1 CACHE INTERNAL "" FORCE)
-endfunction()
-
-macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd)
+macro(__CrayPrgEnv_setup lang)
if(DEFINED ENV{CRAYPE_VERSION})
message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION} ${lang}")
elseif(DEFINED ENV{ASYNCPE_VERSION})
@@ -81,12 +34,4 @@ macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_LINK_SEARCH_START_STATIC TRUE)
endif()
- if(NOT CRAY_${lang}_EXTRACTED_IMPLICIT)
- __cray_extract_implicit(
- ${test_src} ${compiler_cmd} ${link_cmd} ${lang}
- CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES
- CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES
- CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES
- )
- endif()
endmacro()
diff --git a/Modules/Compiler/Flang-Fortran.cmake b/Modules/Compiler/Flang-Fortran.cmake
index d52273947..f0e61d824 100644
--- a/Modules/Compiler/Flang-Fortran.cmake
+++ b/Modules/Compiler/Flang-Fortran.cmake
@@ -1,6 +1,9 @@
include(Compiler/Clang)
__compiler_clang(Fortran)
+set(CMAKE_Fortran_SUBMODULE_SEP "-")
+set(CMAKE_Fortran_SUBMODULE_EXT ".mod")
+
set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/GHS-C.cmake b/Modules/Compiler/GHS-C.cmake
index c30bdecaf..a825b0bba 100644
--- a/Modules/Compiler/GHS-C.cmake
+++ b/Modules/Compiler/GHS-C.cmake
@@ -8,23 +8,3 @@ string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -Odebug -g")
string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -Ospace")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -O")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -O -g")
-
-set(CMAKE_C_GHS_KERNEL_FLAGS_DEBUG_INIT "-ldebug ${CMAKE_C_FLAGS_DEBUG_INIT}")
-set(CMAKE_C_GHS_KERNEL_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT}")
-set(CMAKE_C_GHS_KERNEL_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT}")
-set(CMAKE_C_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT
- "-ldebug ${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}")
-
-if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
- set (CMAKE_C_GHS_KERNEL_FLAGS_DEBUG "${CMAKE_C_GHS_KERNEL_FLAGS_DEBUG_INIT}"
- CACHE STRING "Kernel flags used by the compiler during debug builds.")
- set (CMAKE_C_GHS_KERNEL_FLAGS_MINSIZEREL
- "${CMAKE_C_GHS_KERNEL_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Kernel flags used by the compiler during release builds for minimum size.")
- set (CMAKE_C_GHS_KERNEL_FLAGS_RELEASE
- "${CMAKE_C_GHS_KERNEL_FLAGS_RELEASE_INIT}"
- CACHE STRING "Kernel flags used by the compiler during release builds.")
- set (CMAKE_C_GHS_KERNEL_FLAGS_RELWITHDEBINFO
- "${CMAKE_C_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Kernel flags used by the compiler during release builds with debug info.")
-endif()
diff --git a/Modules/Compiler/GHS-CXX.cmake b/Modules/Compiler/GHS-CXX.cmake
index b3018a7b6..07b504424 100644
--- a/Modules/Compiler/GHS-CXX.cmake
+++ b/Modules/Compiler/GHS-CXX.cmake
@@ -8,27 +8,3 @@ string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " -Odebug -g")
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -Ospace")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -O")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -O -g")
-
-set(CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG_INIT
- "-ldebug ${CMAKE_CXX_FLAGS_DEBUG_INIT}")
-set(CMAKE_CXX_GHS_KERNEL_FLAGS_MINSIZEREL_INIT
- "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT}")
-set(CMAKE_CXX_GHS_KERNEL_FLAGS_RELEASE_INIT
- "${CMAKE_CXX_FLAGS_RELEASE_INIT}")
-set(CMAKE_CXX_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT
- "-ldebug ${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}")
-
-if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
- set (CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG
- "${CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG_INIT}"
- CACHE STRING "Kernel flags used by the compiler during debug builds.")
- set (CMAKE_CXX_GHS_KERNEL_FLAGS_MINSIZEREL
- "${CMAKE_CXX_GHS_KERNEL_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Kernel flags used by the compiler during release builds for minimum size.")
- set (CMAKE_CXX_GHS_KERNEL_FLAGS_RELEASE
- "${CMAKE_CXX_GHS_KERNEL_FLAGS_RELEASE_INIT}"
- CACHE STRING "Kernel flags used by the compiler during release builds.")
- set (CMAKE_CXX_GHS_KERNEL_FLAGS_RELWITHDEBINFO
- "${CMAKE_CXX_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Kernel flags used by the compiler during release builds with debug info.")
-endif()
diff --git a/Modules/Compiler/GHS-DetermineCompiler.cmake b/Modules/Compiler/GHS-DetermineCompiler.cmake
index 56d24e266..368b3759d 100644
--- a/Modules/Compiler/GHS-DetermineCompiler.cmake
+++ b/Modules/Compiler/GHS-DetermineCompiler.cmake
@@ -1,6 +1,9 @@
-set(_compiler_id_pp_test "defined(__INTEGRITY)")
+set(_compiler_id_pp_test "defined(__ghs__)")
set(_compiler_id_version_compute "
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEGRITY_MAJOR_VERSION)
-# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEGRITY_MINOR_VERSION)
-# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEGRITY_PATCH_VERSION)")
+/* __GHS_VERSION_NUMBER = VVVVRP */
+# ifdef __GHS_VERSION_NUMBER
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GHS_VERSION_NUMBER / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GHS_VERSION_NUMBER / 10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__GHS_VERSION_NUMBER % 10)
+# endif")
diff --git a/Modules/Compiler/GHS.cmake b/Modules/Compiler/GHS.cmake
index e6a867d04..b41c3ebf8 100644
--- a/Modules/Compiler/GHS.cmake
+++ b/Modules/Compiler/GHS.cmake
@@ -3,6 +3,6 @@ if(__COMPILER_GHS)
endif()
set(__COMPILER_GHS 1)
-set(CMAKE_EXECUTABLE_SUFFIX ".as")
-set(CMAKE_LIBRARY_PATH_TERMINATOR "\n")
-set(CMAKE_LIBRARY_PATH_FLAG " -L")
+set(CMAKE_EXECUTABLE_SUFFIX "")
+set(CMAKE_LIBRARY_PATH_TERMINATOR "")
+set(CMAKE_LIBRARY_PATH_FLAG "")
diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake
index c333d500b..6413769cf 100644
--- a/Modules/Compiler/GNU-Fortran.cmake
+++ b/Modules/Compiler/GNU-Fortran.cmake
@@ -1,6 +1,9 @@
include(Compiler/GNU)
__compiler_gnu(Fortran)
+set(CMAKE_Fortran_SUBMODULE_SEP "@")
+set(CMAKE_Fortran_SUBMODULE_EXT ".smod")
+
set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 4491d4b39..6b1bd3a13 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -9,13 +9,20 @@ endif()
set(__COMPILER_GNU 1)
include(Compiler/CMakeCommonCompilerMacros)
+include(Internal/CMakeCheckCompilerFlag)
macro(__compiler_gnu lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set (_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ # Support of PIE at link stage depends on various elements : platform, compiler, linker
+ # so to activate it, module CheckPIESupported must be used.
+ 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")
endif()
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake
index 2ed88188c..b5e61f070 100644
--- a/Modules/Compiler/IAR-C.cmake
+++ b/Modules/Compiler/IAR-C.cmake
@@ -29,7 +29,19 @@ if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
__compiler_check_default_language_standard(C 1.10 90 6.10 99 8.10 11)
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
+ if(NOT CMAKE_C_COMPILER_VERSION)
+ message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.")
+ endif()
+
+ set(CMAKE_C_EXTENSION_COMPILE_OPTION -e)
+
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION --c89)
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION -e)
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION -e)
+
__compiler_iar_AVR(C)
+ __compiler_check_default_language_standard(C 7.10 99)
set(CMAKE_C_OUTPUT_EXTENSION ".r90")
if(NOT CMAKE_C_LINK_FLAGS)
@@ -43,6 +55,7 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH)
get_filename_component(_compilerDir "${_compilerDir}" PATH)
include_directories("${_compilerDir}/inc" )
+ include_directories("${_compilerDir}/inc/Atmel" )
else()
message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic.")
diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake
index 5b783b29f..b7076f5cc 100644
--- a/Modules/Compiler/IAR-CXX.cmake
+++ b/Modules/Compiler/IAR-CXX.cmake
@@ -38,7 +38,27 @@ if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
__compiler_check_default_language_standard(CXX 6.10 98 8.10 14)
elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
+ # "embedded C++" --EC++ is probably closest to CXX98 but with no support for:
+ # Templates, multiple inheritance, virtual inheritance, exceptions, RTTI, C++ style casts,
+ # Namespaces, the mutable attribute, no STL, any library features related to the above features.
+ #
+ # "(extended) embedded C++" --EEC++ Mode but DOES NOT support any normal C++ standard
+ # probably closest to CXX98 but with no RTTI and no exceptions, and the library
+ # provided is not in the standard namespace
+ if(NOT CMAKE_IAR_CXX_FLAG)
+ if(NOT CMAKE_CXX_COMPILER_VERSION)
+ message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.")
+ endif()
+ set(CMAKE_IAR_CXX_FLAG --eec++)
+ endif()
+
+ set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -e)
+
__compiler_iar_AVR(CXX)
+ __compiler_check_default_language_standard(CXX 7.10 98)
+
set(CMAKE_CXX_OUTPUT_EXTENSION ".r90")
if(NOT CMAKE_CXX_LINK_FLAGS)
set(CMAKE_CXX_LINK_FLAGS "-Fmotorola")
@@ -51,6 +71,7 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH)
get_filename_component(_compilerDir "${_compilerDir}" PATH)
include_directories("${_compilerDir}/inc")
+ include_directories("${_compilerDir}/inc/Atmel")
else()
message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic." )
diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake
index a1bffebdb..43477acb1 100644
--- a/Modules/Compiler/IAR-DetermineCompiler.cmake
+++ b/Modules/Compiler/IAR-DetermineCompiler.cmake
@@ -1,4 +1,4 @@
-# IAR Systems compiler for embedded systems.
+# IAR Systems compiler for ARM embedded systems.
# http://www.iar.com
# http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf
#
@@ -9,13 +9,31 @@
# __ICCARM__ An integer that is set to 1 when the code is compiled with the IAR C/C++ Compiler for ARM
# __VER__ An integer that identifies the version number of the IAR compiler in use. For example,
# version 5.11.3 is returned as 5011003.
+#
+# IAR Systems Compiler for AVR embedded systems
+# http://supp.iar.com/FilesPublic/UPDINFO/007051/ew/doc/EWAVR_CompilerReference.pdf
+#
+# __IAR_SYSTEMS_ICC__ An integer that identifies the IAR compiler platform.
+# __ICCAVR__ An integer that is set to 1 when the code is compiled with the IAR C/C++ Compiler for AVR
+# __VER__ An integer that identifies the version number of the IAR compiler in use.
+# The value is calculated by (100 * VERSION_MAJOR + VERSION_MINOR). For example the version
+# 3.34 is given as 334
+# __SUBVERSION__ An integer that identifies the subversion number of the compiler version number
+# for example 3 in 1.2.3.4. THis is used as the patch version, as seen when running iccavr
+# from the command line
+#
set(_compiler_id_pp_test "defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)")
set(_compiler_id_version_compute "
-# if defined(__VER__)
+# if defined(__VER__) && defined(__ICCARM__)
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 1000000)
# 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__)
+# 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__)
+# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__)
# endif")
diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake
index 43243b9d6..bbcdea235 100644
--- a/Modules/Compiler/IAR.cmake
+++ b/Modules/Compiler/IAR.cmake
@@ -68,6 +68,27 @@ endmacro()
macro(__compiler_iar_AVR lang)
set(CMAKE_EXECUTABLE_SUFFIX ".bin")
+ if (${lang} STREQUAL "C" OR ${lang} STREQUAL "CXX")
+
+ set(CMAKE_${lang}_COMPILE_OBJECT "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
+ set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>")
+ 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>")
+
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -r")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Ohz -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -Oh -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -Oh -r -DNDEBUG")
+ endif()
+
+ set(CMAKE_${lang}_LINK_EXECUTABLE "\"${CMAKE_IAR_LINKER}\" -S <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>")
+ set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "\"${CMAKE_IAR_AR}\" <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_CREATE "\"${CMAKE_IAR_AR}\" <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_APPEND "")
+ set(CMAKE_${lang}_ARCHIVE_FINISH "")
set(CMAKE_LIBRARY_PATH_FLAG "-I")
diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake
index a1320555a..5275ddf64 100644
--- a/Modules/Compiler/Intel-Fortran.cmake
+++ b/Modules/Compiler/Intel-Fortran.cmake
@@ -1,6 +1,9 @@
include(Compiler/Intel)
__compiler_intel(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")
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 05db548f5..de9dd99ba 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -1,4 +1,5 @@
set(CMAKE_CUDA_VERBOSE_FLAG "-v")
+set(CMAKE_CUDA_VERBOSE_COMPILE_FLAG "-Xcompiler=-v")
if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE)
diff --git a/Modules/Compiler/PGI-Fortran.cmake b/Modules/Compiler/PGI-Fortran.cmake
index a183c339b..3daf7987e 100644
--- a/Modules/Compiler/PGI-Fortran.cmake
+++ b/Modules/Compiler/PGI-Fortran.cmake
@@ -1,6 +1,9 @@
include(Compiler/PGI)
__compiler_pgi(Fortran)
+set(CMAKE_Fortran_SUBMODULE_SEP "-")
+set(CMAKE_Fortran_SUBMODULE_EXT ".mod")
+
set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> -Mpreprocess <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/QCC-ASM.cmake b/Modules/Compiler/QCC-ASM.cmake
new file mode 100644
index 000000000..9a9935b27
--- /dev/null
+++ b/Modules/Compiler/QCC-ASM.cmake
@@ -0,0 +1,2 @@
+include(Compiler/QCC)
+__compiler_qcc(ASM)
diff --git a/Modules/Compiler/QCC-C-FeatureTests.cmake b/Modules/Compiler/QCC-C-FeatureTests.cmake
new file mode 100644
index 000000000..68f41970d
--- /dev/null
+++ b/Modules/Compiler/QCC-C-FeatureTests.cmake
@@ -0,0 +1 @@
+include(Compiler/GNU-C-FeatureTests)
diff --git a/Modules/Compiler/QCC-C.cmake b/Modules/Compiler/QCC-C.cmake
index ae4a2f491..6db619e57 100644
--- a/Modules/Compiler/QCC-C.cmake
+++ b/Modules/Compiler/QCC-C.cmake
@@ -1,2 +1,5 @@
+# To include compiler feature detection
+include(Compiler/GNU-C)
+
include(Compiler/QCC)
__compiler_qcc(C)
diff --git a/Modules/Compiler/QCC-CXX-FeatureTests.cmake b/Modules/Compiler/QCC-CXX-FeatureTests.cmake
new file mode 100644
index 000000000..c836b9416
--- /dev/null
+++ b/Modules/Compiler/QCC-CXX-FeatureTests.cmake
@@ -0,0 +1 @@
+include(Compiler/GNU-CXX-FeatureTests)
diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake
index e86d1fa47..0e7314ae5 100644
--- a/Modules/Compiler/QCC-CXX.cmake
+++ b/Modules/Compiler/QCC-CXX.cmake
@@ -1,3 +1,6 @@
+# To include compiler feature detection
+include(Compiler/GNU-CXX)
+
include(Compiler/QCC)
__compiler_qcc(CXX)
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index 047de43f0..c4aba8eca 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -6,6 +6,10 @@ include(Compiler/SunPro)
set(CMAKE_C_VERBOSE_FLAG "-#")
set(CMAKE_C_COMPILE_OPTIONS_PIC -KPIC)
+set(CMAKE_C_COMPILE_OPTIONS_PIE "")
+set(_CMAKE_C_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
+set(CMAKE_C_LINK_OPTIONS_PIE "")
+set(CMAKE_C_LINK_OPTIONS_NO_PIE "")
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R")
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index 4c1ac5be6..5ce58b221 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -6,6 +6,10 @@ include(Compiler/SunPro)
set(CMAKE_CXX_VERBOSE_FLAG "-v")
set(CMAKE_CXX_COMPILE_OPTIONS_PIC -KPIC)
+set(CMAKE_CXX_COMPILE_OPTIONS_PIE "")
+set(_CMAKE_CXX_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
+set(CMAKE_CXX_LINK_OPTIONS_PIE "")
+set(CMAKE_CXX_LINK_OPTIONS_NO_PIE "")
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G")
set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R")
diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake
index 2247dd085..0c93c94a8 100644
--- a/Modules/Compiler/SunPro-Fortran.cmake
+++ b/Modules/Compiler/SunPro-Fortran.cmake
@@ -3,6 +3,10 @@ set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-KPIC")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PIE "")
+set(_CMAKE_Fortran_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
+set(CMAKE_Fortran_LINK_OPTIONS_PIE "")
+set(CMAKE_Fortran_LINK_OPTIONS_NO_PIE "")
set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G")
set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R")
diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake
index 6bab6f69e..c4fb09712 100644
--- a/Modules/Compiler/XL-Fortran.cmake
+++ b/Modules/Compiler/XL-Fortran.cmake
@@ -1,6 +1,9 @@
include(Compiler/XL)
__compiler_xl(Fortran)
+set(CMAKE_Fortran_SUBMODULE_SEP "_")
+set(CMAKE_Fortran_SUBMODULE_EXT ".smod")
+
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-qfixed") # [=<right_margin>]
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-qfree") # [=f90|ibm]
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake
index 21fe5e8c3..68dc28a92 100644
--- a/Modules/Compiler/XL.cmake
+++ b/Modules/Compiler/XL.cmake
@@ -48,7 +48,7 @@ macro(__compiler_xl lang)
# files so that we export only the symbols actually provided by the sources.
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
"${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>"
- "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
+ "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
)
endif()
endmacro()
diff --git a/Modules/CompilerId/GHS_default.gpj.in b/Modules/CompilerId/GHS_default.gpj.in
new file mode 100644
index 000000000..b5cea5cf8
--- /dev/null
+++ b/Modules/CompilerId/GHS_default.gpj.in
@@ -0,0 +1,8 @@
+#!gbuild
+@bsp_name@
+@os_dir@
+primaryTarget=@ghs_primary_target@
+[Project]
+ {isdefined(GHS_BSP)} -bsp $GHS_BSP
+ {isdefined(GHS_OS)} -os_dir $GHS_OS
+GHS_lib.gpj [Library]
diff --git a/Modules/CompilerId/GHS_lib.gpj.in b/Modules/CompilerId/GHS_lib.gpj.in
new file mode 100644
index 000000000..149b98144
--- /dev/null
+++ b/Modules/CompilerId/GHS_lib.gpj.in
@@ -0,0 +1,3 @@
+#!gbuild
+[Library]
+@id_src@
diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in
index 4686b645b..672044e13 100644
--- a/Modules/CompilerId/Xcode-3.pbxproj.in
+++ b/Modules/CompilerId/Xcode-3.pbxproj.in
@@ -72,8 +72,7 @@
1DEB928608733DD80010E9CD = {
isa = XCBuildConfiguration;
buildSettings = {
- @id_development_team@
- @id_code_sign_identity@
+ CODE_SIGN_IDENTITY = "";
PRODUCT_NAME = CompilerId@id_lang@;
};
name = Debug;
@@ -87,6 +86,7 @@
SYMROOT = .;
@id_toolset@
@id_lang_version@
+ @id_clang_cxx_library@
@id_deployment_target@
@id_sdkroot@
};
diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake
index e003cd5cc..154fe9d7d 100644
--- a/Modules/Dart.cmake
+++ b/Modules/Dart.cmake
@@ -1,27 +1,28 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# Dart
-# ----
-#
-# Configure a project for testing with CTest or old Dart Tcl Client
-#
-# This file is the backwards-compatibility version of the CTest module.
-# It supports using the old Dart 1 Tcl client for driving dashboard
-# submissions as well as testing with CTest. This module should be
-# included in the CMakeLists.txt file at the top of a project. Typical
-# usage:
-#
-# ::
-#
-# include(Dart)
-# if(BUILD_TESTING)
-# # ... testing related CMake code ...
-# endif()
-#
-# The BUILD_TESTING option is created by the Dart module to determine
-# whether testing support should be enabled. The default is ON.
+#[=======================================================================[.rst:
+Dart
+----
+
+Configure a project for testing with CTest or old Dart Tcl Client
+
+This file is the backwards-compatibility version of the CTest module.
+It supports using the old Dart 1 Tcl client for driving dashboard
+submissions as well as testing with CTest. This module should be
+included in the CMakeLists.txt file at the top of a project. Typical
+usage:
+
+::
+
+ include(Dart)
+ if(BUILD_TESTING)
+ # ... testing related CMake code ...
+ endif()
+
+The BUILD_TESTING option is created by the Dart module to determine
+whether testing support should be enabled. The default is ON.
+#]=======================================================================]
# This file configures a project to use the Dart testing/dashboard process.
# It is broken into 3 sections.
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index b86a5a9a8..e4513b363 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -20,17 +20,7 @@ BuildName: @BUILDNAME@
LabelsForSubprojects: @CTEST_LABELS_FOR_SUBPROJECTS@
# Submission information
-IsCDash: @CTEST_DROP_SITE_CDASH@
-CDashVersion: @CTEST_CDASH_VERSION@
-QueryCDashVersion: @CTEST_CDASH_QUERY_VERSION@
-DropSite: @DROP_SITE@
-DropLocation: @DROP_LOCATION@
-DropSiteUser: @DROP_SITE_USER@
-DropSitePassword: @DROP_SITE_PASSWORD@
-DropSiteMode: @DROP_SITE_MODE@
-DropMethod: @DROP_METHOD@
-TriggerSite: @TRIGGER_SITE@
-ScpCommand: @SCPCOMMAND@
+SubmitURL: @SUBMIT_URL@
# Dashboard start time
NightlyStartTime: @NIGHTLY_START_TIME@
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
index c69cd3885..4a18927c2 100644
--- a/Modules/DeployQt4.cmake
+++ b/Modules/DeployQt4.cmake
@@ -26,13 +26,13 @@ PARENT_SCOPE. Also depends on BundleUtilities.cmake.
::
- WRITE_QT4_CONF(<qt_conf_dir> <qt_conf_contents>)
+ write_qt4_conf(<qt_conf_dir> <qt_conf_contents>)
Writes a qt.conf file with the <qt_conf_contents> into <qt_conf_dir>.
::
- RESOLVE_QT4_PATHS(<paths_var> [<executable_path>])
+ resolve_qt4_paths(<paths_var> [<executable_path>])
Loop through <paths_var> list and if any don't exist resolve them
relative to the <executable_path> (if supplied) or the
@@ -40,7 +40,7 @@ CMAKE_INSTALL_PREFIX.
::
- FIXUP_QT4_EXECUTABLE(<executable>
+ fixup_qt4_executable(<executable>
[<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>])
Copies Qt plugins, writes a Qt configuration file (if needed) and
@@ -67,7 +67,7 @@ needed.
::
- INSTALL_QT4_PLUGIN_PATH(plugin executable copy installed_plugin_path_var
+ install_qt4_plugin_path(plugin executable copy installed_plugin_path_var
<plugins_dir> <component> <configurations>)
Install (or copy) a resolved <plugin> to the default plugins directory
@@ -82,7 +82,7 @@ If <component> is set then anything installed will use this COMPONENT.
::
- INSTALL_QT4_PLUGIN(plugin executable copy installed_plugin_path_var
+ install_qt4_plugin(plugin executable copy installed_plugin_path_var
<plugins_dir> <component>)
Install (or copy) an unresolved <plugin> to the default plugins
@@ -92,7 +92,7 @@ INSTALL_QT4_PLUGIN_PATH.
::
- INSTALL_QT4_EXECUTABLE(<executable>
+ install_qt4_executable(<executable>
[<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf> <component>])
Installs Qt plugins, writes a Qt configuration file (if needed) and
diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake
index 6e212490e..aaf24f656 100644
--- a/Modules/Documentation.cmake
+++ b/Modules/Documentation.cmake
@@ -1,14 +1,13 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# Documentation
-# -------------
-#
-# DocumentationVTK.cmake
-#
-# This file provides support for the VTK documentation framework. It
-# relies on several tools (Doxygen, Perl, etc).
+#[=======================================================================[.rst:
+Documentation
+-------------
+
+This module provides support for the VTK documentation framework. It
+relies on several tools (Doxygen, Perl, etc).
+#]=======================================================================]
#
# Build the documentation ?
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index f987d2d8f..22e052334 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -16,7 +16,9 @@ External Project Definition
The ``ExternalProject_Add()`` function creates a custom target to drive
download, update/patch, configure, build, install and test steps of an
- external project::
+ external project:
+
+ .. code-block:: cmake
ExternalProject_Add(<name> [<option>...])
@@ -47,7 +49,11 @@ External Project Definition
``STAMP_DIR <dir>``
Directory in which to store the timestamps of each step. Log files from
- individual steps are also created in here (see *Logging Options* below).
+ individual steps are also created in here unless overriden by LOG_DIR
+ (see *Logging Options* below).
+
+ ``LOG_DIR <dir>``
+ Directory in which to store the logs of each step.
``DOWNLOAD_DIR <dir>``
Directory in which to store downloaded files before unpacking them. This
@@ -90,6 +96,7 @@ External Project Definition
SOURCE_DIR = <prefix>/src/<name>
BINARY_DIR = <prefix>/src/<name>-build
INSTALL_DIR = <prefix>
+ LOG_DIR = <STAMP_DIR>
Otherwise, if the ``EP_BASE`` directory property is set then components
of an external project are stored under the specified base::
@@ -100,6 +107,7 @@ External Project Definition
SOURCE_DIR = <base>/Source/<name>
BINARY_DIR = <base>/Build/<name>
INSTALL_DIR = <base>/Install/<name>
+ LOG_DIR = <STAMP_DIR>
If no ``PREFIX``, ``EP_PREFIX``, or ``EP_BASE`` is specified, then the
default is to set ``PREFIX`` to ``<name>-prefix``. Relative paths are
@@ -417,7 +425,9 @@ External Project Definition
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``.
+ ``SOURCE_DIR``. When ``BUILD_IN_SOURCE 1`` is specified, the
+ ``BUILD_COMMAND`` is used to point to an alternative directory within the
+ source tree.
**Build Step Options:**
If the configure step assumed the external project uses CMake as its build
@@ -515,7 +525,8 @@ External Project Definition
**Output Logging Options:**
Each of the following ``LOG_...`` options can be used to wrap the relevant
step in a script to capture its output to files. The log files will be
- created in the ``STAMP_DIR`` directory with step-specific file names.
+ created in ``LOG_DIR`` if supplied or otherwise the ``STAMP_DIR``
+ directory with step-specific file names.
``LOG_DOWNLOAD <bool>``
When enabled, the output of the download step is logged to files.
@@ -523,6 +534,9 @@ External Project Definition
``LOG_UPDATE <bool>``
When enabled, the output of the update step is logged to files.
+ ``LOG_PATCH <bool>``
+ When enabled, the output of the patch step is logged to files.
+
``LOG_CONFIGURE <bool>``
When enabled, the output of the configure step is logged to files.
@@ -535,6 +549,18 @@ External Project Definition
``LOG_TEST <bool>``
When enabled, the output of the test step is logged to files.
+ ``LOG_MERGED_STDOUTERR <bool>``
+ When enabled, stdout and stderr will be merged for any step whose
+ output is being logged to files.
+
+ ``LOG_OUTPUT_ON_FAILURE <bool>``
+ 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
+ ``LOG_OUTPUT_ON_FAILURE`` is set to true. For cases where a large amount
+ of output is recorded, just the end of that output may be printed to the
+ console.
+
**Terminal Access Options:**
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
@@ -608,7 +634,9 @@ External Project Definition
appended to them by following them with as many ``COMMAND ...`` options
as needed
(:manual:`generator expressions <cmake-generator-expressions(7)>` are
- supported). For example::
+ supported). For example:
+
+ .. code-block:: cmake
ExternalProject_Add(example
... # Download options, etc.
@@ -627,7 +655,9 @@ Obtaining Project Properties
.. command:: ExternalProject_Get_Property
The ``ExternalProject_Get_Property()`` function retrieves external project
- target properties::
+ target properties:
+
+ .. code-block:: cmake
ExternalProject_Get_Property(<name> <prop1> [<prop2>...])
@@ -655,7 +685,9 @@ control needed to implement such step-level capabilities.
The ``ExternalProject_Add_Step()`` function specifies an additional custom
step for an external project defined by an earlier call to
- :command:`ExternalProject_Add`::
+ :command:`ExternalProject_Add`:
+
+ .. code-block:: cmake
ExternalProject_Add_Step(<name> <step> [<option>...])
@@ -705,7 +737,7 @@ control needed to implement such step-level capabilities.
``LOG <bool>``
If set, this causes the output from the custom step to be captured to files
- in the external project's ``STAMP_DIR``.
+ in the external project's ``LOG_DIR`` if supplied or ``STAMP_DIR``.
``USES_TERMINAL <bool>``
If enabled, this gives the custom step direct access to the terminal if
@@ -722,7 +754,9 @@ control needed to implement such step-level capabilities.
The ``ExternalProject_Add_StepTargets()`` function generates targets for the
steps listed. The name of each created target will be of the form
- ``<name>-<step>``::
+ ``<name>-<step>``:
+
+ .. code-block:: cmake
ExternalProject_Add_StepTargets(<name> [NO_DEPENDS] <step1> [<step2>...])
@@ -773,7 +807,9 @@ control needed to implement such step-level capabilities.
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
- targets or even step targets of another external project)::
+ targets or even step targets of another external project):
+
+ .. code-block:: cmake
ExternalProject_Add_StepDependencies(<name> <step> <target1> [<target2>...])
@@ -1617,6 +1653,8 @@ function(_ep_set_directories name)
endif()
endif()
set(top "${CMAKE_CURRENT_BINARY_DIR}")
+
+ # Apply defaults and convert to absolute paths.
set(places stamp download source binary install tmp)
foreach(var ${places})
string(TOUPPER "${var}" VAR)
@@ -1629,6 +1667,17 @@ function(_ep_set_directories name)
endif()
set_property(TARGET ${name} PROPERTY _EP_${VAR}_DIR "${${var}_dir}")
endforeach()
+
+ # Special case for default log directory based on stamp directory.
+ get_property(log_dir TARGET ${name} PROPERTY _EP_LOG_DIR)
+ if(NOT log_dir)
+ get_property(log_dir TARGET ${name} PROPERTY _EP_STAMP_DIR)
+ endif()
+ if(NOT IS_ABSOLUTE "${log_dir}")
+ get_filename_component(log_dir "${top}/${log_dir}" ABSOLUTE)
+ endif()
+ set_property(TARGET ${name} PROPERTY _EP_LOG_DIR "${log_dir}")
+
get_property(source_subdir TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR)
if(NOT source_subdir)
set_property(TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR "")
@@ -1642,7 +1691,11 @@ function(_ep_set_directories name)
endif()
if(build_in_source)
get_property(source_dir TARGET ${name} PROPERTY _EP_SOURCE_DIR)
- set_property(TARGET ${name} PROPERTY _EP_BINARY_DIR "${source_dir}")
+ if(source_subdir)
+ set_property(TARGET ${name} PROPERTY _EP_BINARY_DIR "${source_dir}/${source_subdir}")
+ else()
+ set_property(TARGET ${name} PROPERTY _EP_BINARY_DIR "${source_dir}")
+ endif()
endif()
# Make the directories at CMake configure time *and* add a custom command
@@ -1671,7 +1724,7 @@ macro(_ep_replace_location_tags target_name)
set(vars ${ARGN})
foreach(var ${vars})
if(${var})
- foreach(dir SOURCE_DIR SOURCE_SUBDIR BINARY_DIR INSTALL_DIR TMP_DIR DOWNLOAD_DIR DOWNLOADED_FILE)
+ foreach(dir SOURCE_DIR SOURCE_SUBDIR BINARY_DIR INSTALL_DIR TMP_DIR DOWNLOAD_DIR DOWNLOADED_FILE LOG_DIR)
get_property(val TARGET ${target_name} PROPERTY _EP_${dir})
string(REPLACE "<${dir}>" "${val}" ${var} "${${var}}")
endforeach()
@@ -1853,6 +1906,7 @@ function(_ep_get_build_command name step cmd_var)
endfunction()
function(_ep_write_log_script name step cmd_var)
+ ExternalProject_Get_Property(${name} log_dir)
ExternalProject_Get_Property(${name} stamp_dir)
set(command "${${cmd_var}}")
@@ -1924,23 +1978,66 @@ endif()
# Wrap the command in a script to log output to files.
set(script ${stamp_dir}/${name}-${step}-$<CONFIG>.cmake)
- set(logbase ${stamp_dir}/${name}-${step})
+ set(logbase ${log_dir}/${name}-${step})
+ get_property(log_merged TARGET ${name} PROPERTY _EP_LOG_MERGED_STDOUTERR)
+ get_property(log_output_on_failure TARGET ${name} PROPERTY _EP_LOG_OUTPUT_ON_FAILURE)
+ if (log_merged)
+ set(stdout_log "${logbase}.log")
+ set(stderr_log "${logbase}.log")
+ else()
+ set(stdout_log "${logbase}-out.log")
+ set(stderr_log "${logbase}-err.log")
+ endif()
set(code "
+cmake_minimum_required(VERSION 3.13)
${code_cygpath_make}
set(command \"${command}\")
+set(log_merged \"${log_merged}\")
+set(log_output_on_failure \"${log_output_on_failure}\")
+set(stdout_log \"${stdout_log}\")
+set(stderr_log \"${stderr_log}\")
execute_process(
COMMAND \${command}
RESULT_VARIABLE result
- OUTPUT_FILE \"${logbase}-out.log\"
- ERROR_FILE \"${logbase}-err.log\"
+ OUTPUT_FILE \"\${stdout_log}\"
+ ERROR_FILE \"\${stderr_log}\"
)
+macro(read_up_to_max_size log_file output_var)
+ file(SIZE \${log_file} determined_size)
+ set(max_size 10240)
+ if (determined_size GREATER max_size)
+ math(EXPR seek_position \"\${determined_size} - \${max_size}\")
+ file(READ \${log_file} \${output_var} OFFSET \${seek_position})
+ set(\${output_var} \"...skipping to end...\\n\${\${output_var}}\")
+ else()
+ file(READ \${log_file} \${output_var})
+ endif()
+endmacro()
if(result)
set(msg \"Command failed: \${result}\\n\")
foreach(arg IN LISTS command)
set(msg \"\${msg} '\${arg}'\")
endforeach()
- set(msg \"\${msg}\\nSee also\\n ${logbase}-*.log\")
- message(FATAL_ERROR \"\${msg}\")
+ if (\${log_merged})
+ set(msg \"\${msg}\\nSee also\\n \${stderr_log}\")
+ else()
+ set(msg \"\${msg}\\nSee also\\n ${logbase}-*.log\")
+ endif()
+ if (\${log_output_on_failure})
+ message(SEND_ERROR \"\${msg}\")
+ if (\${log_merged})
+ read_up_to_max_size(\"\${stderr_log}\" error_log_contents)
+ message(STATUS \"Log output is:\\n\${error_log_contents}\")
+ else()
+ read_up_to_max_size(\"\${stdout_log}\" out_log_contents)
+ read_up_to_max_size(\"\${stderr_log}\" err_log_contents)
+ message(STATUS \"stdout output is:\\n\${out_log_contents}\")
+ message(STATUS \"stderr output is:\\n\${err_log_contents}\")
+ endif()
+ message(FATAL_ERROR \"Stopping after outputting logs.\")
+ else()
+ message(FATAL_ERROR \"\${msg}\")
+ endif()
else()
set(msg \"${name} ${step} command succeeded. See also ${logbase}-*.log\")
message(STATUS \"\${msg}\")
@@ -2212,7 +2309,7 @@ endfunction()
function(_ep_add_mkdir_command name)
ExternalProject_Get_Property(${name}
- source_dir binary_dir install_dir stamp_dir download_dir tmp_dir)
+ source_dir binary_dir install_dir stamp_dir download_dir tmp_dir log_dir)
_ep_get_configuration_subdir_suffix(cfgdir)
@@ -2224,6 +2321,7 @@ function(_ep_add_mkdir_command name)
COMMAND ${CMAKE_COMMAND} -E make_directory ${tmp_dir}
COMMAND ${CMAKE_COMMAND} -E make_directory ${stamp_dir}${cfgdir}
COMMAND ${CMAKE_COMMAND} -E make_directory ${download_dir}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${log_dir}
)
endfunction()
@@ -2727,10 +2825,18 @@ function(_ep_add_patch_command name)
set(work_dir ${source_dir})
endif()
+ get_property(log TARGET ${name} PROPERTY _EP_LOG_PATCH)
+ if(log)
+ set(log LOG 1)
+ else()
+ set(log "")
+ endif()
+
ExternalProject_Add_Step(${name} patch
COMMAND ${cmd}
WORKING_DIRECTORY ${work_dir}
DEPENDEES download
+ ${log}
)
endfunction()
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index fbce235f5..4a3e83af3 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -97,8 +97,6 @@ Functions
#]=======================================================================]
-include(CMakeParseArguments)
-
function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES)
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index 98cdf6cb9..5716b0112 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -20,9 +20,12 @@ configure step to use the content in commands like :command:`add_subdirectory`,
:command:`include` or :command:`file` operations.
Content population details would normally be defined separately from the
-command that performs the actual population. Projects should also
-check whether the content has already been populated somewhere else in the
-project hierarchy. Typical usage would look something like this:
+command that performs the actual population. This separation ensures that
+all of the dependency details are defined before anything may try to use those
+details to populate content. This is particularly important in more complex
+project hierarchies where dependencies may be shared between multiple projects.
+
+The following shows a typical example of declaring content details:
.. code-block:: cmake
@@ -32,21 +35,37 @@ project hierarchy. Typical usage would look something like this:
GIT_TAG release-1.8.0
)
+For most typical cases, populating the content can then be done with a single
+command like so:
+
+.. code-block:: cmake
+
+ FetchContent_MakeAvailable(googletest)
+
+The above command not only populates the content, it also adds it to the main
+build (if possible) so that the main build can use the populated project's
+targets, etc. In some cases, the main project may need to have more precise
+control over the population or may be required to explicitly define the
+population steps (e.g. if CMake versions earlier than 3.14 need to be
+supported). The typical pattern of such custom steps looks like this:
+
+.. code-block:: cmake
+
FetchContent_GetProperties(googletest)
if(NOT googletest_POPULATED)
FetchContent_Populate(googletest)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
endif()
-When using the above pattern with a hierarchical project arrangement,
-projects at higher levels in the hierarchy are able to define or override
-the population details of content specified anywhere lower in the project
-hierarchy. The ability to detect whether content has already been
-populated ensures that even if multiple child projects want certain content
-to be available, the first one to populate it wins. The other child project
-can simply make use of the already available content instead of repeating
-the population for itself. See the
-:ref:`Examples <fetch-content-examples>` section which demonstrates
+Regardless of which population method is used, when using the
+declare-populate pattern with a hierarchical project arrangement, projects at
+higher levels in the hierarchy are able to override the population details of
+content specified anywhere lower in the project hierarchy. The ability to
+detect whether content has already been populated ensures that even if
+multiple child projects want certain content to be available, the first one
+to populate it wins. The other child project can simply make use of the
+already available content instead of repeating the population for itself.
+See the :ref:`Examples <fetch-content-examples>` section which demonstrates
this scenario.
The ``FetchContent`` module also supports defining and populating
@@ -113,6 +132,38 @@ Declaring Content Details
Populating The Content
^^^^^^^^^^^^^^^^^^^^^^
+For most common scenarios, population means making content available to the
+main build according to previously declared details for that dependency.
+There are two main patterns for populating content, one based on calling
+:command:`FetchContent_GetProperties` and
+:command:`FetchContent_Populate` for more precise control and the other on
+calling :command:`FetchContent_MakeAvailable` for a simpler, more automated
+approach. The former generally follows this canonical pattern:
+
+.. _`fetch-content-canonical-pattern`:
+
+.. code-block:: cmake
+
+ # Check if population has already been performed
+ FetchContent_GetProperties(<name>)
+ string(TOLOWER "<name>" lcName)
+ if(NOT ${lcName}_POPULATED)
+ # Fetch the content using previously declared details
+ FetchContent_Populate(<name>)
+
+ # Set custom variables, policies, etc.
+ # ...
+
+ # Bring the populated content into the build
+ add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR})
+ endif()
+
+The above is such a common pattern that, where no custom steps are needed
+between the calls to :command:`FetchContent_Populate` and
+:command:`add_subdirectory`, equivalent logic can be obtained by calling
+:command:`FetchContent_MakeAvailable` instead (and should be preferred where
+it meets the needs of the project).
+
.. command:: FetchContent_Populate
.. code-block:: cmake
@@ -309,9 +360,6 @@ Populating The Content
on the command line invoking the script.
-Retrieve Population Properties
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
.. command:: FetchContent_GetProperties
When using saved content details, a call to :command:`FetchContent_Populate`
@@ -343,28 +391,65 @@ Retrieve Population Properties
FetchContent_GetProperties(foobar)
if(NOT foobar_POPULATED)
FetchContent_Populate(foobar)
-
- # Set any custom variables, etc. here, then
- # populate the content as part of this build
-
- add_subdirectory(${foobar_SOURCE_DIR} ${foobar_BINARY_DIR})
+ ...
endif()
The above pattern allows other parts of the overall project hierarchy to
re-use the same content and ensure that it is only populated once.
+.. command:: FetchContent_MakeAvailable
+
+ .. code-block:: cmake
+
+ FetchContent_MakeAvailable( <name1> [<name2>...] )
+
+ 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 same
+ :ref:`canonical pattern <fetch-content-canonical-pattern>` as
+ presented at the beginning of this section. One small difference to
+ that pattern is that it will only call :command:`add_subdirectory` on the
+ populated content if there is a ``CMakeLists.txt`` file in its top level
+ source directory. This allows the command to be used for dependencies
+ that make downloaded content available at a known location but which do
+ not need or support being added directly to the build.
+
+
.. _`fetch-content-examples`:
Examples
^^^^^^^^
-Consider a project hierarchy where ``projA`` is the top level project and it
-depends on projects ``projB`` and ``projC``. Both ``projB`` and ``projC``
-can be built standalone and they also both depend on another project
-``projD``. For simplicity, this example will assume that all four projects
-are available on a company git server. The ``CMakeLists.txt`` of each project
-might have sections like the following:
+This first fairly straightforward example ensures that some popular testing
+frameworks are available to the main build:
+
+.. code-block:: cmake
+
+ include(FetchContent)
+ FetchContent_Declare(
+ googletest
+ GIT_REPOSITORY https://github.com/google/googletest.git
+ GIT_TAG release-1.8.0
+ )
+ FetchContent_Declare(
+ Catch2
+ GIT_REPOSITORY https://github.com/catchorg/Catch2.git
+ GIT_TAG v2.5.0
+ )
+
+ # After the following call, the CMake targets defined by googletest and
+ # Catch2 will be defined and available to the rest of the build
+ FetchContent_MakeAvailable(googletest Catch2)
+
+
+In more complex project hierarchies, the dependency relationships can be more
+complicated. Consider a hierarchy where ``projA`` is the top level project and
+it depends directly on projects ``projB`` and ``projC``. Both ``projB`` and
+``projC`` can be built standalone and they also both depend on another project
+``projD``. ``projB`` additionally depends on ``projE``. This example assumes
+that all five projects are available on a company git server. The
+``CMakeLists.txt`` of each project might have sections like the following:
*projA*:
@@ -373,31 +458,27 @@ might have sections like the following:
include(FetchContent)
FetchContent_Declare(
projB
- GIT_REPOSITORY git@mycompany.com/git/projB.git
+ GIT_REPOSITORY git@mycompany.com:git/projB.git
GIT_TAG 4a89dc7e24ff212a7b5167bef7ab079d
)
FetchContent_Declare(
projC
- GIT_REPOSITORY git@mycompany.com/git/projC.git
+ GIT_REPOSITORY git@mycompany.com:git/projC.git
GIT_TAG 4ad4016bd1d8d5412d135cf8ceea1bb9
)
FetchContent_Declare(
projD
- GIT_REPOSITORY git@mycompany.com/git/projD.git
+ GIT_REPOSITORY git@mycompany.com:git/projD.git
GIT_TAG origin/integrationBranch
)
+ FetchContent_Declare(
+ projE
+ GIT_REPOSITORY git@mycompany.com:git/projE.git
+ GIT_TAG origin/release/2.3-rc1
+ )
- FetchContent_GetProperties(projB)
- if(NOT projb_POPULATED)
- FetchContent_Populate(projB)
- add_subdirectory(${projb_SOURCE_DIR} ${projb_BINARY_DIR})
- endif()
-
- FetchContent_GetProperties(projC)
- if(NOT projc_POPULATED)
- FetchContent_Populate(projC)
- add_subdirectory(${projc_SOURCE_DIR} ${projc_BINARY_DIR})
- endif()
+ # Order is important, see notes in the discussion further below
+ FetchContent_MakeAvailable(projD projB projC)
*projB*:
@@ -406,16 +487,16 @@ might have sections like the following:
include(FetchContent)
FetchContent_Declare(
projD
- GIT_REPOSITORY git@mycompany.com/git/projD.git
+ GIT_REPOSITORY git@mycompany.com:git/projD.git
GIT_TAG 20b415f9034bbd2a2e8216e9a5c9e632
)
+ FetchContent_Declare(
+ projE
+ GIT_REPOSITORY git@mycompany.com:git/projE.git
+ GIT_TAG 68e20f674a48be38d60e129f600faf7d
+ )
- FetchContent_GetProperties(projD)
- if(NOT projd_POPULATED)
- FetchContent_Populate(projD)
- add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR})
- endif()
-
+ FetchContent_MakeAvailable(projD projE)
*projC*:
@@ -424,48 +505,77 @@ might have sections like the following:
include(FetchContent)
FetchContent_Declare(
projD
- GIT_REPOSITORY git@mycompany.com/git/projD.git
+ GIT_REPOSITORY git@mycompany.com:git/projD.git
GIT_TAG 7d9a17ad2c962aa13e2fbb8043fb6b8a
)
+ # This particular version of projD requires workarounds
FetchContent_GetProperties(projD)
if(NOT projd_POPULATED)
FetchContent_Populate(projD)
+
+ # Copy an additional/replacement file into the populated source
+ file(COPY someFile.c DESTINATION ${projd_SOURCE_DIR}/src)
+
add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR})
endif()
A few key points should be noted in the above:
- ``projB`` and ``projC`` define different content details for ``projD``,
- but ``projA`` also defines a set of content details for ``projD`` and
- because ``projA`` will define them first, the details from ``projB`` and
+ but ``projA`` also defines a set of content details for ``projD``.
+ Because ``projA`` will define them first, the details from ``projB`` and
``projC`` will not be used. The override details defined by ``projA``
are not required to match either of those from ``projB`` or ``projC``, but
it is up to the higher level project to ensure that the details it does
define still make sense for the child projects.
-- While ``projA`` defined content details for ``projD``, it did not need
- to explicitly call ``FetchContent_Populate(projD)`` itself. Instead, it
- leaves that to a child project to do (in this case it will be ``projB``
- since it is added to the build ahead of ``projC``). If ``projA`` needed to
- customize how the ``projD`` content was brought into the build as well
- (e.g. define some CMake variables before calling
- :command:`add_subdirectory` after populating), it would do the call to
- ``FetchContent_Populate()``, etc. just as it did for the ``projB`` and
- ``projC`` content. For higher level projects, it is usually enough to
- just define the override content details and leave the actual population
- to the child projects. This saves repeating the same thing at each level
- of the project hierarchy unnecessarily.
-- Even though ``projA`` is the top level project in this example, it still
- checks whether ``projB`` and ``projC`` have already been populated before
- going ahead to do those populations. This makes ``projA`` able to be more
- easily incorporated as a child of some other higher level project in the
- future if required. Always protect a call to
- :command:`FetchContent_Populate` with a check to
- :command:`FetchContent_GetProperties`, even in what may be considered a top
- level project at the time.
-
-
-The following example demonstrates how one might download and unpack a
+- In the ``projA`` call to :command:`FetchContent_MakeAvailable`, ``projD``
+ is listed ahead of ``projB`` and ``projC`` to ensure that ``projA`` is in
+ control of how ``projD`` is populated.
+- While ``projA`` defines content details for ``projE``, it does not need
+ to explicitly call ``FetchContent_MakeAvailable(projE)`` or
+ ``FetchContent_Populate(projD)`` itself. Instead, it leaves that to the
+ child ``projB``. For higher level projects, it is often enough to just
+ define the override content details and leave the actual population to the
+ child projects. This saves repeating the same thing at each level of the
+ project hierarchy unnecessarily.
+
+
+Projects don't always need to add the populated content to the build.
+Sometimes the project just wants to make the downloaded content available at
+a predictable location. The next example ensures that a set of standard
+company toolchain files (and potentially even the toolchain binaries
+themselves) is available early enough to be used for that same build.
+
+.. code-block:: cmake
+
+ cmake_minimum_required(VERSION 3.14)
+
+ include(FetchContent)
+ FetchContent_Declare(
+ mycom_toolchains
+ URL https://intranet.mycompany.com//toolchains_1.3.2.tar.gz
+ )
+ FetchContent_MakeAvailable(mycom_toolchains)
+
+ project(CrossCompileExample)
+
+The project could be configured to use one of the downloaded toolchains like
+so:
+
+.. code-block:: shell
+
+ cmake -DCMAKE_TOOLCHAIN_FILE=_deps/mycom_toolchains-src/toolchain_arm.cmake /path/to/src
+
+When CMake processes the ``CMakeLists.txt`` file, it will download and unpack
+the tarball into ``_deps/mycompany_toolchains-src`` relative to the build
+directory. The :variable:`CMAKE_TOOLCHAIN_FILE` variable is not used until
+the :command:`project` command is reached, at which point CMake looks for the
+named toolchain file relative to the build directory. Because the tarball has
+already been downloaded and unpacked by then, the toolchain file will be in
+place, even the very first time that ``cmake`` is run in the build directory.
+
+Lastly, the following example demonstrates how one might download and unpack a
firmware tarball using CMake's :manual:`script mode <cmake(1)>`. The call to
:command:`FetchContent_Populate` specifies all the content details and the
unpacked firmware will be placed in a ``firmware`` directory below the
@@ -691,6 +801,13 @@ function(__FetchContent_directPopulate contentName)
BUILD_COMMAND
INSTALL_COMMAND
TEST_COMMAND
+ # We force both of these to be ON since we are always executing serially
+ # and we want all steps to have access to the terminal in case they
+ # need input from the command line (e.g. ask for a private key password)
+ # or they want to provide timely progress. We silently absorb and
+ # discard these if they are set by the caller.
+ USES_TERMINAL_DOWNLOAD
+ USES_TERMINAL_UPDATE
)
set(multiValueArgs "")
@@ -914,3 +1031,31 @@ function(FetchContent_Populate contentName)
set(${contentNameLower}_POPULATED True PARENT_SCOPE)
endfunction()
+
+# Arguments are assumed to be the names of dependencies that have been
+# declared previously and should be populated. It is not an error if
+# any of them have already been populated (they will just be skipped in
+# that case). The command is implemented as a macro so that the variables
+# defined by the FetchContent_GetProperties() and FetchContent_Populate()
+# calls will be available to the caller.
+macro(FetchContent_MakeAvailable)
+
+ foreach(contentName IN ITEMS ${ARGV})
+ string(TOLOWER ${contentName} contentNameLower)
+ FetchContent_GetProperties(${contentName})
+ if(NOT ${contentNameLower}_POPULATED)
+ FetchContent_Populate(${contentName})
+
+ # Only try to call add_subdirectory() if the populated content
+ # can be treated that way. Protecting the call with the check
+ # allows this function to be used for projects that just want
+ # to ensure the content exists, such as to provide content at
+ # a known location.
+ if(EXISTS ${${contentNameLower}_SOURCE_DIR}/CMakeLists.txt)
+ add_subdirectory(${${contentNameLower}_SOURCE_DIR}
+ ${${contentNameLower}_BINARY_DIR})
+ endif()
+ endif()
+ endforeach()
+
+endmacro()
diff --git a/Modules/FetchContent/CMakeLists.cmake.in b/Modules/FetchContent/CMakeLists.cmake.in
index 9a7a7715a..0095b111b 100644
--- a/Modules/FetchContent/CMakeLists.cmake.in
+++ b/Modules/FetchContent/CMakeLists.cmake.in
@@ -18,4 +18,6 @@ ExternalProject_Add(${contentName}-populate
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
+ USES_TERMINAL_DOWNLOAD YES
+ USES_TERMINAL_UPDATE YES
)
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake
index c9cfd60ff..f27d7fe97 100644
--- a/Modules/FindALSA.cmake
+++ b/Modules/FindALSA.cmake
@@ -1,44 +1,45 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindALSA
-# --------
-#
-# Find alsa
-#
-# Find the alsa libraries (asound)
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines :prop_tgt:`IMPORTED` target ``ALSA::ALSA``, if
-# ALSA has been found.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following variables:
-#
-# ``ALSA_FOUND``
-# True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found
-#
-# ``ALSA_LIBRARIES``
-# List of libraries when using ALSA.
-#
-# ``ALSA_INCLUDE_DIRS``
-# Where to find the ALSA headers.
-#
-# Cache variables
-# ^^^^^^^^^^^^^^^
-#
-# The following cache variables may also be set:
-#
-# ``ALSA_INCLUDE_DIR``
-# the ALSA include directory
-#
-# ``ALSA_LIBRARY``
-# the absolute path of the asound library
+#[=======================================================================[.rst:
+FindALSA
+--------
+
+Find alsa
+
+Find the alsa libraries (asound)
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``ALSA::ALSA``, if
+ALSA has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``ALSA_FOUND``
+ True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found
+
+``ALSA_LIBRARIES``
+ List of libraries when using ALSA.
+
+``ALSA_INCLUDE_DIRS``
+ Where to find the ALSA headers.
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``ALSA_INCLUDE_DIR``
+ the ALSA include directory
+
+``ALSA_LIBRARY``
+ the absolute path of the asound library
+#]=======================================================================]
find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h
DOC "The ALSA (asound) include directory"
diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake
index 6944ac192..c2d29e295 100644
--- a/Modules/FindASPELL.cmake
+++ b/Modules/FindASPELL.cmake
@@ -1,21 +1,22 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindASPELL
-# ----------
-#
-# Try to find ASPELL
-#
-# Once done this will define
-#
-# ::
-#
-# ASPELL_FOUND - system has ASPELL
-# ASPELL_EXECUTABLE - the ASPELL executable
-# ASPELL_INCLUDE_DIR - the ASPELL include directory
-# ASPELL_LIBRARIES - The libraries needed to use ASPELL
-# ASPELL_DEFINITIONS - Compiler switches required for using ASPELL
+#[=======================================================================[.rst:
+FindASPELL
+----------
+
+Try to find ASPELL
+
+Once done this will define
+
+::
+
+ ASPELL_FOUND - system has ASPELL
+ ASPELL_EXECUTABLE - the ASPELL executable
+ ASPELL_INCLUDE_DIR - the ASPELL include directory
+ ASPELL_LIBRARIES - The libraries needed to use ASPELL
+ ASPELL_DEFINITIONS - Compiler switches required for using ASPELL
+#]=======================================================================]
find_path(ASPELL_INCLUDE_DIR aspell.h )
diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake
index 2df29cacb..c12512f15 100644
--- a/Modules/FindAVIFile.cmake
+++ b/Modules/FindAVIFile.cmake
@@ -1,23 +1,24 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindAVIFile
-# -----------
-#
-# Locate AVIFILE library and include paths
-#
-# AVIFILE (http://avifile.sourceforge.net/)is a set of libraries for
-# i386 machines to use various AVI codecs. Support is limited beyond
-# Linux. Windows provides native AVI support, and so doesn't need this
-# library. This module defines
-#
-# ::
-#
-# AVIFILE_INCLUDE_DIR, where to find avifile.h , etc.
-# AVIFILE_LIBRARIES, the libraries to link against
-# AVIFILE_DEFINITIONS, definitions to use when compiling
-# AVIFILE_FOUND, If false, don't try to use AVIFILE
+#[=======================================================================[.rst:
+FindAVIFile
+-----------
+
+Locate AVIFILE library and include paths
+
+AVIFILE (http://avifile.sourceforge.net/)is a set of libraries for
+i386 machines to use various AVI codecs. Support is limited beyond
+Linux. Windows provides native AVI support, and so doesn't need this
+library. This module defines
+
+::
+
+ AVIFILE_INCLUDE_DIR, where to find avifile.h , etc.
+ AVIFILE_LIBRARIES, the libraries to link against
+ AVIFILE_DEFINITIONS, definitions to use when compiling
+ AVIFILE_FOUND, If false, don't try to use AVIFILE
+#]=======================================================================]
if (UNIX)
diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake
index 95f0c5629..ce76c99df 100644
--- a/Modules/FindArmadillo.cmake
+++ b/Modules/FindArmadillo.cmake
@@ -1,35 +1,36 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindArmadillo
-# -------------
-#
-# Find Armadillo
-#
-# Find the Armadillo C++ library
-#
-# Using Armadillo:
-#
-# ::
-#
-# find_package(Armadillo REQUIRED)
-# include_directories(${ARMADILLO_INCLUDE_DIRS})
-# add_executable(foo foo.cc)
-# target_link_libraries(foo ${ARMADILLO_LIBRARIES})
-#
-# This module sets the following variables:
-#
-# ::
-#
-# ARMADILLO_FOUND - set to true if the library is found
-# ARMADILLO_INCLUDE_DIRS - list of required include directories
-# ARMADILLO_LIBRARIES - list of libraries to be linked
-# ARMADILLO_VERSION_MAJOR - major version number
-# ARMADILLO_VERSION_MINOR - minor version number
-# ARMADILLO_VERSION_PATCH - patch version number
-# ARMADILLO_VERSION_STRING - version number as a string (ex: "1.0.4")
-# ARMADILLO_VERSION_NAME - name of the version (ex: "Antipodean Antileech")
+#[=======================================================================[.rst:
+FindArmadillo
+-------------
+
+Find Armadillo
+
+Find the Armadillo C++ library
+
+Using Armadillo:
+
+::
+
+ find_package(Armadillo REQUIRED)
+ include_directories(${ARMADILLO_INCLUDE_DIRS})
+ add_executable(foo foo.cc)
+ target_link_libraries(foo ${ARMADILLO_LIBRARIES})
+
+This module sets the following variables:
+
+::
+
+ ARMADILLO_FOUND - set to true if the library is found
+ ARMADILLO_INCLUDE_DIRS - list of required include directories
+ ARMADILLO_LIBRARIES - list of libraries to be linked
+ ARMADILLO_VERSION_MAJOR - major version number
+ ARMADILLO_VERSION_MINOR - minor version number
+ ARMADILLO_VERSION_PATCH - patch version number
+ ARMADILLO_VERSION_STRING - version number as a string (ex: "1.0.4")
+ ARMADILLO_VERSION_NAME - name of the version (ex: "Antipodean Antileech")
+#]=======================================================================]
# UNIX paths are standard, no need to write.
find_library(ARMADILLO_LIBRARY
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index 2000f7ff6..06ac2d93f 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -1,85 +1,86 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindBISON
-# ---------
-#
-# Find ``bison`` executable and provide a macro to generate custom build rules.
-#
-# The module defines the following variables:
-#
-# ``BISON_EXECUTABLE``
-# path to the ``bison`` program
-#
-# ``BISON_VERSION``
-# version of ``bison``
-#
-# ``BISON_FOUND``
-# true if the program was found
-#
-# The minimum required version of ``bison`` can be specified using the
-# standard CMake syntax, e.g. ``find_package(BISON 2.1.3)``.
-#
-# If ``bison`` is found, the module defines the macro::
-#
-# BISON_TARGET(<Name> <YaccInput> <CodeOutput>
-# [COMPILE_FLAGS <flags>]
-# [DEFINES_FILE <file>]
-# [VERBOSE [<file>]]
-# [REPORT_FILE <file>]
-# )
-#
-# which will create a custom rule to generate a parser. ``<YaccInput>`` is
-# 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.
-#
-# The options are:
-#
-# ``COMPILE_FLAGS <flags>``
-# Specify flags to be added to the ``bison`` command line.
-#
-# ``DEFINES_FILE <file>``
-# 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>``.
-#
-# ``REPORT_FILE <file>``
-# Specify a non-default report ``<file>``, if generated.
-#
-# The macro defines the following variables:
-#
-# ``BISON_<Name>_DEFINED``
-# true is the macro ran successfully
-#
-# ``BISON_<Name>_INPUT``
-# The input source file, an alias for <YaccInput>
-#
-# ``BISON_<Name>_OUTPUT_SOURCE``
-# The source file generated by bison
-#
-# ``BISON_<Name>_OUTPUT_HEADER``
-# The header file generated by bison
-#
-# ``BISON_<Name>_OUTPUTS``
-# All files generated by bison including the source, the header and the report
-#
-# ``BISON_<Name>_COMPILE_FLAGS``
-# Options used in the ``bison`` command line
-#
-# Example usage:
-#
-# .. code-block:: cmake
-#
-# find_package(BISON)
-# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
-# DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h)
-# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS})
+#[=======================================================================[.rst:
+FindBISON
+---------
+
+Find ``bison`` executable and provide a macro to generate custom build rules.
+
+The module defines the following variables:
+
+``BISON_EXECUTABLE``
+ path to the ``bison`` program
+
+``BISON_VERSION``
+ version of ``bison``
+
+``BISON_FOUND``
+ true if the program was found
+
+The minimum required version of ``bison`` can be specified using the
+standard CMake syntax, e.g. ``find_package(BISON 2.1.3)``.
+
+If ``bison`` is found, the module defines the macro::
+
+ BISON_TARGET(<Name> <YaccInput> <CodeOutput>
+ [COMPILE_FLAGS <flags>]
+ [DEFINES_FILE <file>]
+ [VERBOSE [<file>]]
+ [REPORT_FILE <file>]
+ )
+
+which will create a custom rule to generate a parser. ``<YaccInput>`` is
+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.
+
+The options are:
+
+``COMPILE_FLAGS <flags>``
+ Specify flags to be added to the ``bison`` command line.
+
+``DEFINES_FILE <file>``
+ 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>``.
+
+``REPORT_FILE <file>``
+ Specify a non-default report ``<file>``, if generated.
+
+The macro defines the following variables:
+
+``BISON_<Name>_DEFINED``
+ true is the macro ran successfully
+
+``BISON_<Name>_INPUT``
+ The input source file, an alias for <YaccInput>
+
+``BISON_<Name>_OUTPUT_SOURCE``
+ The source file generated by bison
+
+``BISON_<Name>_OUTPUT_HEADER``
+ The header file generated by bison
+
+``BISON_<Name>_OUTPUTS``
+ All files generated by bison including the source, the header and the report
+
+``BISON_<Name>_COMPILE_FLAGS``
+ Options used in the ``bison`` command line
+
+Example usage:
+
+.. code-block:: cmake
+
+ find_package(BISON)
+ BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
+ DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h)
+ add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS})
+#]=======================================================================]
find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable")
mark_as_advanced(BISON_EXECUTABLE)
@@ -150,7 +151,15 @@ if(BISON_EXECUTABLE)
list(APPEND BISON_TARGET_cmdopt "--report-file=${BISON_TARGET_verbose_file}")
endif()
if(NOT IS_ABSOLUTE "${BISON_TARGET_verbose_file}")
- set(BISON_TARGET_verbose_file "${CMAKE_CURRENT_SOURCE_DIR}/${BISON_TARGET_verbose_file}")
+ cmake_policy(GET CMP0088 _BISON_CMP0088
+ PARENT_SCOPE # undocumented, do not use outside of CMake
+ )
+ if("x${_BISON_CMP0088}x" STREQUAL "xNEWx")
+ set(BISON_TARGET_verbose_file "${CMAKE_CURRENT_BINARY_DIR}/${BISON_TARGET_verbose_file}")
+ else()
+ set(BISON_TARGET_verbose_file "${CMAKE_CURRENT_SOURCE_DIR}/${BISON_TARGET_verbose_file}")
+ endif()
+ unset(_BISON_CMP0088)
endif()
endmacro()
@@ -158,6 +167,15 @@ if(BISON_EXECUTABLE)
# adds a custom command and sets
# BISON_TARGET_cmdopt, BISON_TARGET_extraoutputs
macro(BISON_TARGET_option_verbose Name BisonOutput filename)
+ cmake_policy(GET CMP0088 _BISON_CMP0088
+ PARENT_SCOPE # undocumented, do not use outside of CMake
+ )
+ set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+ if("x${_BISON_CMP0088}x" STREQUAL "xNEWx")
+ set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ endif()
+ unset(_BISON_CMP0088)
+
list(APPEND BISON_TARGET_cmdopt "--verbose")
list(APPEND BISON_TARGET_outputs
"${BISON_TARGET_verbose_file}")
@@ -165,8 +183,9 @@ if(BISON_EXECUTABLE)
if(IS_ABSOLUTE "${filename}")
set(BISON_TARGET_verbose_extra_file "${filename}")
else()
- set(BISON_TARGET_verbose_extra_file "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
+ set(BISON_TARGET_verbose_extra_file "${_BISON_WORKING_DIRECTORY}/${filename}")
endif()
+
add_custom_command(OUTPUT ${BISON_TARGET_verbose_extra_file}
COMMAND ${CMAKE_COMMAND} -E copy
"${BISON_TARGET_verbose_file}"
@@ -175,10 +194,11 @@ if(BISON_EXECUTABLE)
DEPENDS
"${BISON_TARGET_verbose_file}"
COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+ WORKING_DIRECTORY ${_BISON_WORKING_DIRECTORY})
list(APPEND BISON_TARGET_extraoutputs
"${BISON_TARGET_verbose_extra_file}")
unset(BISON_TARGET_verbose_extra_file)
+ unset(_BISON_WORKING_DIRECTORY)
endif()
endmacro()
@@ -233,12 +253,23 @@ if(BISON_EXECUTABLE)
list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}")
+ cmake_policy(GET CMP0088 _BISON_CMP0088
+ PARENT_SCOPE # undocumented, do not use outside of CMake
+ )
+ set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+ if("x${_BISON_CMP0088}x" STREQUAL "xNEWx")
+ set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ endif()
+ unset(_BISON_CMP0088)
+
add_custom_command(OUTPUT ${BISON_TARGET_outputs}
COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput}
VERBATIM
DEPENDS ${BisonInput}
COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+ WORKING_DIRECTORY ${_BISON_WORKING_DIRECTORY})
+
+ unset(_BISON_WORKING_DIRECTORY)
# define target variables
set(BISON_${Name}_DEFINED TRUE)
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index b5546e094..0aa4f5035 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -1,74 +1,89 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindBLAS
-# --------
-#
-# Find BLAS library
-#
-# This module finds an installed fortran library that implements the
-# BLAS linear-algebra interface (see http://www.netlib.org/blas/). The
-# list of libraries searched for is taken from the autoconf macro file,
-# acx_blas.m4 (distributed at
-# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
-#
-# This module sets the following variables:
-#
-# ::
-#
-# BLAS_FOUND - set to true if a library implementing the BLAS interface
-# is found
-# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
-# and -L).
-# BLAS_LIBRARIES - uncached list of libraries (using full path name) to
-# link against to use BLAS (may be empty if compiler implicitly links
-# BLAS)
-# BLAS95_LIBRARIES - uncached list of libraries (using full path name)
-# to link against to use BLAS95 interface
-# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
-# is found
-#
-# The following variables can be used to control this module:
-#
-# ::
-#
-# BLA_STATIC if set on this determines what kind of linkage we do (static)
-# BLA_VENDOR if set checks only the specified vendor, if not set checks
-# all the possibilities
-# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
-# BLA_PREFER_PKGCONFIG if set pkg-config will be used to search for a BLAS
-# library first and if one is found that is preferred
-#
-# List of vendors (BLA_VENDOR) valid in this module:
-#
-# * Goto
-# * OpenBLAS
-# * FLAME
-# * ATLAS PhiPACK
-# * CXML
-# * DXML
-# * SunPerf
-# * SCSL
-# * SGIMATH
-# * IBMESSL
-# * Intel10_32 (intel mkl v10 32 bit)
-# * Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model)
-# * Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model)
-# * Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model)
-# * Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model)
-# * Intel (older versions of mkl 32 and 64 bit)
-# * ACML
-# * ACML_MP
-# * ACML_GPU
-# * Apple
-# * NAS
-# * Generic
-#
-# .. note::
-#
-# C/CXX should be enabled to use Intel mkl
-#
+#[=======================================================================[.rst:
+FindBLAS
+--------
+
+Find BLAS library
+
+This module finds an installed fortran library that implements the
+BLAS linear-algebra interface (see http://www.netlib.org/blas/). The
+list of libraries searched for is taken from the autoconf macro file,
+acx_blas.m4 (distributed at
+http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
+
+Input Variables
+^^^^^^^^^^^^^^^
+
+The following variables may be set to influence this module's behavior:
+
+``BLA_STATIC``
+ if ``ON`` use static linkage
+
+``BLA_VENDOR``
+ If set, checks only the specified vendor, if not set checks all the
+ possibilities. List of vendors valid in this module:
+
+ * Goto
+ * OpenBLAS
+ * FLAME
+ * ATLAS PhiPACK
+ * CXML
+ * DXML
+ * SunPerf
+ * SCSL
+ * SGIMATH
+ * IBMESSL
+ * Intel10_32 (intel mkl v10 32 bit)
+ * Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model)
+ * Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model)
+ * Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model)
+ * Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model)
+ * Intel (obsolete versions of mkl 32 and 64 bit)
+ * ACML
+ * ACML_MP
+ * ACML_GPU
+ * Apple
+ * NAS
+ * Generic
+
+``BLA_F95``
+ if ``ON`` tries to find the BLAS95 interfaces
+
+``BLA_PREFER_PKGCONFIG``
+ if set pkg-config will be used to search for a BLAS library first
+ and if one is found that is preferred
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``BLAS_FOUND``
+ library implementing the BLAS interface is found
+``BLAS_LINKER_FLAGS``
+ uncached list of required linker flags (excluding -l and -L).
+``BLAS_LIBRARIES``
+ uncached list of libraries (using full path name) to link against
+ to use BLAS (may be empty if compiler implicitly links BLAS)
+``BLAS95_LIBRARIES``
+ uncached list of libraries (using full path name) to link against
+ to use BLAS95 interface
+``BLAS95_FOUND``
+ library implementing the BLAS95 interface is found
+
+.. note::
+
+ C or CXX must be enabled to use Intel MKL
+
+ For example, to use Intel MKL libraries and/or Intel compiler:
+
+ .. code-block:: cmake
+
+ set(BLA_VENDOR Intel10_64lp)
+ find_package(BLAS)
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
@@ -126,6 +141,8 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
endif ()
endif ()
+ list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+
foreach(_library ${_list})
set(_combined_name ${_combined_name}_${_library})
@@ -164,12 +181,13 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
endif()
set(CMAKE_REQUIRED_LIBRARIES)
- mark_as_advanced(${_prefix}${_combined_name}_WORKS)
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
endif()
if(_libraries_work)
if("${_list}" STREQUAL "")
set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
+ else()
+ set(${LIBRARIES} ${${LIBRARIES}} ${_thread}) # for static link
endif()
else()
set(${LIBRARIES} FALSE)
@@ -205,14 +223,34 @@ endif ()
#BLAS in intel mkl 10+ library? (em64t 64bit)
if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
if (NOT BLAS_LIBRARIES)
+
+ # System-specific settings
+ if (WIN32)
+ if (BLA_STATIC)
+ set(BLAS_mkl_DLL_SUFFIX "")
+ else()
+ set(BLAS_mkl_DLL_SUFFIX "_dll")
+ endif()
+ else()
+ if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
+ set(BLAS_mkl_INTFACE "gf")
+ set(BLAS_mkl_THREADING "gnu")
+ set(BLAS_mkl_OMP "gomp")
+ else()
+ set(BLAS_mkl_INTFACE "intel")
+ set(BLAS_mkl_THREADING "intel")
+ set(BLAS_mkl_OMP "iomp5")
+ endif()
+ set(BLAS_mkl_LM "-lm")
+ set(BLAS_mkl_LDL "-ldl")
+ endif()
+
if (BLA_VENDOR MATCHES "_64ilp")
set(BLAS_mkl_ILP_MODE "ilp64")
else ()
set(BLAS_mkl_ILP_MODE "lp64")
endif ()
- if (NOT WIN32)
- set(LM "-lm")
- endif ()
+
if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
find_package(Threads)
@@ -226,12 +264,6 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
set(BLAS_mkl_SEARCH_SYMBOL sgemm_f95)
set(_LIBRARIES BLAS95_LIBRARIES)
if (WIN32)
- if (BLA_STATIC)
- set(BLAS_mkl_DLL_SUFFIX "")
- else()
- set(BLAS_mkl_DLL_SUFFIX "_dll")
- endif()
-
# Find the main file (32-bit or 64-bit)
set(BLAS_SEARCH_LIBS_WIN_MAIN "")
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
@@ -267,38 +299,32 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
endforeach()
else ()
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
+
+ # mkl >= 10.3
list(APPEND BLAS_SEARCH_LIBS
- "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide")
+ "mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
endif ()
if (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS
- "mkl_blas95 mkl_intel_${BLAS_mkl_ILP_MODE} mkl_intel_thread mkl_core guide")
+ "mkl_blas95 mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
# mkl >= 10.3
- if (CMAKE_C_COMPILER MATCHES ".+gcc")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_intel_${BLAS_mkl_ILP_MODE} mkl_gnu_thread mkl_core gomp")
- else ()
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_intel_${BLAS_mkl_ILP_MODE} mkl_intel_thread mkl_core iomp5")
- endif ()
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
endif ()
if (BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
- "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_intel_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core")
+ "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core")
endif ()
endif ()
else ()
set(BLAS_mkl_SEARCH_SYMBOL sgemm)
set(_LIBRARIES BLAS_LIBRARIES)
if (WIN32)
- if (BLA_STATIC)
- set(BLAS_mkl_DLL_SUFFIX "")
- else()
- set(BLAS_mkl_DLL_SUFFIX "_dll")
- endif()
-
# Find the main file (32-bit or 64-bit)
set(BLAS_SEARCH_LIBS_WIN_MAIN "")
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
@@ -334,27 +360,26 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
endforeach()
else ()
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
+
+ # mkl >= 10.3
list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel mkl_intel_thread mkl_core guide")
+ "mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
endif ()
if (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
-
# old version
list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel_${BLAS_mkl_ILP_MODE} mkl_intel_thread mkl_core guide")
+ "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
# mkl >= 10.3
- if (CMAKE_C_COMPILER MATCHES ".+gcc")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel_${BLAS_mkl_ILP_MODE} mkl_gnu_thread mkl_core gomp")
- else ()
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel_${BLAS_mkl_ILP_MODE} mkl_intel_thread mkl_core iomp5")
- endif ()
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
endif ()
if (BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core")
+ "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core")
endif ()
#older vesions of intel mkl libs
@@ -378,16 +403,30 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
${BLAS_mkl_SEARCH_SYMBOL}
""
"${SEARCH_LIBS}"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
+ "${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}"
)
endif ()
endforeach ()
endif ()
unset(BLAS_mkl_ILP_MODE)
+ unset(BLAS_mkl_INTFACE)
+ unset(BLAS_mkl_THREADING)
+ unset(BLAS_mkl_OMP)
+ unset(BLAS_mkl_DLL_SUFFIX)
+ unset(BLAS_mkl_LM)
+ unset(BLAS_mkl_LDL)
endif ()
endif ()
+if(BLA_F95)
+ find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS95_LIBRARIES)
+ set(BLAS95_FOUND ${BLAS_FOUND})
+ if(BLAS_FOUND)
+ set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
+ endif()
+endif()
+
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES)
# gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
@@ -723,13 +762,7 @@ if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
endif()
endif ()
-if(BLA_F95)
- find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS95_LIBRARIES)
- set(BLAS95_FOUND ${BLAS_FOUND})
- if(BLAS_FOUND)
- set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
- endif()
-else()
+if(NOT BLA_F95)
find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS_LIBRARIES)
endif()
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 4d7123dd5..249514864 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -1,41 +1,42 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindBZip2
-# ---------
-#
-# Try to find BZip2
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines :prop_tgt:`IMPORTED` target ``BZip2::BZip2``, if
-# BZip2 has been found.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following variables:
-#
-# ``BZIP2_FOUND``
-# system has BZip2
-# ``BZIP2_INCLUDE_DIRS``
-# the BZip2 include directories
-# ``BZIP2_LIBRARIES``
-# Link these to use BZip2
-# ``BZIP2_NEED_PREFIX``
-# this is set if the functions are prefixed with ``BZ2_``
-# ``BZIP2_VERSION_STRING``
-# the version of BZip2 found
-#
-# Cache variables
-# ^^^^^^^^^^^^^^^
-#
-# The following cache variables may also be set:
-#
-# ``BZIP2_INCLUDE_DIR``
-# the BZip2 include directory
+#[=======================================================================[.rst:
+FindBZip2
+---------
+
+Try to find BZip2
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``BZip2::BZip2``, if
+BZip2 has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``BZIP2_FOUND``
+ system has BZip2
+``BZIP2_INCLUDE_DIRS``
+ the BZip2 include directories
+``BZIP2_LIBRARIES``
+ Link these to use BZip2
+``BZIP2_NEED_PREFIX``
+ this is set if the functions are prefixed with ``BZ2_``
+``BZIP2_VERSION_STRING``
+ the version of BZip2 found
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``BZIP2_INCLUDE_DIR``
+ the BZip2 include directory
+#]=======================================================================]
set(_BZIP2_PATHS PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Bzip2;InstallPath]"
diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake
index 59ebdc26d..e1f45f7d4 100644
--- a/Modules/FindBacktrace.cmake
+++ b/Modules/FindBacktrace.cmake
@@ -1,41 +1,42 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindBacktrace
-# -------------
-#
-# Find provider for backtrace(3).
-#
-# Checks if OS supports backtrace(3) via either libc or custom library.
-# This module defines the following variables:
-#
-# ``Backtrace_HEADER``
-# The header file needed for backtrace(3). Cached.
-# Could be forcibly set by user.
-# ``Backtrace_INCLUDE_DIRS``
-# The include directories needed to use backtrace(3) header.
-# ``Backtrace_LIBRARIES``
-# The libraries (linker flags) needed to use backtrace(3), if any.
-# ``Backtrace_FOUND``
-# Is set if and only if backtrace(3) support detected.
-#
-# The following cache variables are also available to set or use:
-#
-# ``Backtrace_LIBRARY``
-# The external library providing backtrace, if any.
-# ``Backtrace_INCLUDE_DIR``
-# The directory holding the backtrace(3) header.
-#
-# Typical usage is to generate of header file using configure_file() with the
-# contents like the following::
-#
-# #cmakedefine01 Backtrace_FOUND
-# #if Backtrace_FOUND
-# # include <${Backtrace_HEADER}>
-# #endif
-#
-# And then reference that generated header file in actual source.
+#[=======================================================================[.rst:
+FindBacktrace
+-------------
+
+Find provider for backtrace(3).
+
+Checks if OS supports backtrace(3) via either libc or custom library.
+This module defines the following variables:
+
+``Backtrace_HEADER``
+ The header file needed for backtrace(3). Cached.
+ Could be forcibly set by user.
+``Backtrace_INCLUDE_DIRS``
+ The include directories needed to use backtrace(3) header.
+``Backtrace_LIBRARIES``
+ The libraries (linker flags) needed to use backtrace(3), if any.
+``Backtrace_FOUND``
+ Is set if and only if backtrace(3) support detected.
+
+The following cache variables are also available to set or use:
+
+``Backtrace_LIBRARY``
+ The external library providing backtrace, if any.
+``Backtrace_INCLUDE_DIR``
+ The directory holding the backtrace(3) header.
+
+Typical usage is to generate of header file using configure_file() with the
+contents like the following::
+
+ #cmakedefine01 Backtrace_FOUND
+ #if Backtrace_FOUND
+ # include <${Backtrace_HEADER}>
+ #endif
+
+And then reference that generated header file in actual source.
+#]=======================================================================]
include(CMakePushCheckState)
include(CheckSymbolExists)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index bfab4ca43..7882c4bdf 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1,240 +1,242 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindBoost
-# ---------
-#
-# Find Boost include dirs and libraries
-#
-# Use this module by invoking find_package with the form::
-#
-# find_package(Boost
-# [version] [EXACT] # Minimum or EXACT version e.g. 1.67.0
-# [REQUIRED] # Fail with error if Boost is not found
-# [COMPONENTS <libs>...] # Boost libraries by their canonical name
-# # e.g. "date_time" for "libboost_date_time"
-# [OPTIONAL_COMPONENTS <libs>...]
-# # Optional Boost libraries by their canonical name)
-# ) # e.g. "date_time" for "libboost_date_time"
-#
-# This module finds headers and requested component libraries OR a CMake
-# 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 - BOOST_VERSION value from boost/version.hpp
-# Boost_LIB_VERSION - Version string appended to library filenames
-# Boost_MAJOR_VERSION - Boost major version number (X in X.y.z)
-# Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z)
-# Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z)
-# 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::boost - Target for header-only dependencies
-# (Boost include directory)
-# 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)
-#
-# Implicit dependencies such as Boost::filesystem requiring
-# Boost::system will be automatically detected and satisfied, even
-# if system is not specified when using find_package and if
-# Boost::system is not added to 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
-# 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.
-#
-# 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
-# not specified as CMake variables or cache entries.
-#
-# 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
-# Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR,
-# 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.
-# 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.
-#
-# 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_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_DETAILED_FAILURE_MSG
-# - Set to ON to add detailed information to the
-# failure message even when the REQUIRED option
-# is not given to the find_package call.
-# 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.
-#
-# 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::
-#
-# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
-#
-# to ask Boost to report information about automatic linking requests.
-#
-# Example to find Boost headers only::
-#
-# find_package(Boost 1.36.0)
-# if(Boost_FOUND)
-# include_directories(${Boost_INCLUDE_DIRS})
-# add_executable(foo foo.cc)
-# endif()
-#
-# Example to find Boost libraries and use imported targets::
-#
-# find_package(Boost 1.56 REQUIRED COMPONENTS
-# date_time filesystem iostreams)
-# add_executable(foo foo.cc)
-# target_link_libraries(foo Boost::date_time Boost::filesystem
-# Boost::iostreams)
-#
-# Example to find Boost Python 3.6 libraries and use imported targets::
-#
-# find_package(Boost 1.67 REQUIRED COMPONENTS
-# python36 numpy36)
-# add_executable(foo foo.cc)
-# target_link_libraries(foo Boost::python36 Boost::numpy36)
-#
-# Example to find Boost headers and some *static* (release only) libraries::
-#
-# set(Boost_USE_STATIC_LIBS ON) # only find static libs
-# 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)
-# find_package(Boost 1.66.0 COMPONENTS date_time filesystem system ...)
-# if(Boost_FOUND)
-# include_directories(${Boost_INCLUDE_DIRS})
-# add_executable(foo foo.cc)
-# target_link_libraries(foo ${Boost_LIBRARIES})
-# endif()
-#
-# Boost CMake
-# ^^^^^^^^^^^
-#
-# If Boost was built using the boost-cmake project 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
-# and this module returns with no further action. See documentation of
-# the Boost CMake package configuration for details on what it provides.
-#
-# Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake.
+#[=======================================================================[.rst:
+FindBoost
+---------
+
+Find Boost include dirs and libraries
+
+Use this module by invoking find_package with the form::
+
+ find_package(Boost
+ [version] [EXACT] # Minimum or EXACT version e.g. 1.67.0
+ [REQUIRED] # Fail with error if Boost is not found
+ [COMPONENTS <libs>...] # Boost libraries by their canonical name
+ # e.g. "date_time" for "libboost_date_time"
+ [OPTIONAL_COMPONENTS <libs>...]
+ # Optional Boost libraries by their canonical name)
+ ) # e.g. "date_time" for "libboost_date_time"
+
+This module finds headers and requested component libraries OR a CMake
+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 - BOOST_VERSION value from boost/version.hpp
+ Boost_LIB_VERSION - Version string appended to library filenames
+ Boost_MAJOR_VERSION - Boost major version number (X in X.y.z)
+ Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z)
+ Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z)
+ Boost_VERSION_STRING - Boost version number in x.y.z format
+ 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::boost - Target for header-only dependencies
+ (Boost include directory)
+ 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)
+
+Implicit dependencies such as Boost::filesystem requiring
+Boost::system will be automatically detected and satisfied, even
+if system is not specified when using find_package and if
+Boost::system is not added to 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
+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.
+
+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
+not specified as CMake variables or cache entries.
+
+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
+Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR,
+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.
+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.
+
+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_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_DETAILED_FAILURE_MSG
+ - Set to ON to add detailed information to the
+ failure message even when the REQUIRED option
+ is not given to the find_package call.
+ 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.
+
+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::
+
+ add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
+
+to ask Boost to report information about automatic linking requests.
+
+Example to find Boost headers only::
+
+ find_package(Boost 1.36.0)
+ if(Boost_FOUND)
+ include_directories(${Boost_INCLUDE_DIRS})
+ add_executable(foo foo.cc)
+ endif()
+
+Example to find Boost libraries and use imported targets::
+
+ find_package(Boost 1.56 REQUIRED COMPONENTS
+ date_time filesystem iostreams)
+ add_executable(foo foo.cc)
+ target_link_libraries(foo Boost::date_time Boost::filesystem
+ Boost::iostreams)
+
+Example to find Boost Python 3.6 libraries and use imported targets::
+
+ find_package(Boost 1.67 REQUIRED COMPONENTS
+ python36 numpy36)
+ add_executable(foo foo.cc)
+ target_link_libraries(foo Boost::python36 Boost::numpy36)
+
+Example to find Boost headers and some *static* (release only) libraries::
+
+ set(Boost_USE_STATIC_LIBS ON) # only find static libs
+ 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)
+ find_package(Boost 1.66.0 COMPONENTS date_time filesystem system ...)
+ if(Boost_FOUND)
+ include_directories(${Boost_INCLUDE_DIRS})
+ add_executable(foo foo.cc)
+ target_link_libraries(foo ${Boost_LIBRARIES})
+ endif()
+
+Boost CMake
+^^^^^^^^^^^
+
+If Boost was built using the boost-cmake project 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
+and this module returns with no further action. See documentation of
+the Boost CMake package configuration for details on what it provides.
+
+Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake.
+#]=======================================================================]
# Save project's policies
cmake_policy(PUSH)
@@ -860,8 +862,22 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono system)
set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 106900 AND Boost_VERSION VERSION_LESS 107000)
+ set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time)
+ set(_Boost_COROUTINE_DEPENDENCIES context)
+ set(_Boost_FIBER_DEPENDENCIES context)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
+ set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
+ set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic)
+ set(_Boost_TIMER_DEPENDENCIES chrono system)
+ set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
else()
- if(NOT Boost_VERSION VERSION_LESS 106900)
+ if(NOT Boost_VERSION VERSION_LESS 107000)
set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time)
set(_Boost_COROUTINE_DEPENDENCIES context)
set(_Boost_FIBER_DEPENDENCIES context)
@@ -876,7 +892,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
endif()
- if(NOT Boost_VERSION VERSION_LESS 107000)
+ if(NOT Boost_VERSION VERSION_LESS 107100)
message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
endif()
endif()
@@ -1124,7 +1140,7 @@ else()
# _Boost_COMPONENT_HEADERS. See the instructions at the top of
# _Boost_COMPONENT_DEPENDENCIES.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.69.0" "1.69"
+ "1.70.0" "1.70" "1.69.0" "1.69"
"1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65"
"1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60"
"1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55"
@@ -1282,7 +1298,7 @@ if(NOT Boost_INCLUDE_DIR)
list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
else()
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
- foreach(ver ${_Boost_KNOWN_VERSIONS})
+ foreach(ver ${_boost_TEST_VERSIONS})
string(REPLACE "." "_" ver "${ver}")
list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS "C:/local/boost_${ver}")
endforeach()
@@ -1367,6 +1383,7 @@ if(Boost_INCLUDE_DIR)
math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
+ set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
string(APPEND Boost_ERROR_REASON
"Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
@@ -1426,6 +1443,13 @@ if ( NOT Boost_NAMESPACE )
set(Boost_NAMESPACE "boost")
endif()
+if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_LIB_PREFIX = ${Boost_LIB_PREFIX}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_NAMESPACE = ${Boost_NAMESPACE}")
+endif()
+
# ------------------------------------------------------------------------
# Suffix initialization and compiler suffix detection.
# ------------------------------------------------------------------------
@@ -1601,7 +1625,7 @@ foreach(c DEBUG RELEASE)
if( Boost_NO_SYSTEM_PATHS )
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
else()
- foreach(ver ${_Boost_KNOWN_VERSIONS})
+ foreach(ver ${_boost_TEST_VERSIONS})
string(REPLACE "." "_" ver "${ver}")
_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/local/boost_${ver}")
endforeach()
@@ -1783,10 +1807,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
foreach(compiler IN LISTS _boost_COMPILER)
list(APPEND _boost_RELEASE_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} )
endforeach()
list(APPEND _boost_RELEASE_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} )
@@ -1795,10 +1821,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
foreach(compiler IN LISTS _boost_COMPILER)
list(APPEND _boost_RELEASE_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
endforeach()
list(APPEND _boost_RELEASE_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
endif()
endforeach()
@@ -1836,10 +1864,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
foreach(compiler IN LISTS _boost_COMPILER)
list(APPEND _boost_DEBUG_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} )
endforeach()
list(APPEND _boost_DEBUG_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} )
@@ -1848,10 +1878,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
foreach(compiler IN LISTS _boost_COMPILER)
list(APPEND _boost_DEBUG_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
endforeach()
list(APPEND _boost_DEBUG_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
endif()
endforeach()
diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake
index fc6695c35..a3c9fc6d1 100644
--- a/Modules/FindBullet.cmake
+++ b/Modules/FindBullet.cmake
@@ -1,39 +1,40 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindBullet
-# ----------
-#
-# Try to find the Bullet physics engine
-#
-#
-#
-# ::
-#
-# This module defines the following variables
-#
-#
-#
-# ::
-#
-# BULLET_FOUND - Was bullet found
-# BULLET_INCLUDE_DIRS - the Bullet include directories
-# BULLET_LIBRARIES - Link to this, by default it includes
-# all bullet components (Dynamics,
-# Collision, LinearMath, & SoftBody)
-#
-#
-#
-# ::
-#
-# This module accepts the following variables
-#
-#
-#
-# ::
-#
-# BULLET_ROOT - Can be set to bullet install path or Windows build path
+#[=======================================================================[.rst:
+FindBullet
+----------
+
+Try to find the Bullet physics engine
+
+
+
+::
+
+ This module defines the following variables
+
+
+
+::
+
+ BULLET_FOUND - Was bullet found
+ BULLET_INCLUDE_DIRS - the Bullet include directories
+ BULLET_LIBRARIES - Link to this, by default it includes
+ all bullet components (Dynamics,
+ Collision, LinearMath, & SoftBody)
+
+
+
+::
+
+ This module accepts the following variables
+
+
+
+::
+
+ BULLET_ROOT - Can be set to bullet install path or Windows build path
+#]=======================================================================]
macro(_FIND_BULLET_LIBRARY _var)
find_library(${_var}
diff --git a/Modules/FindCABLE.cmake b/Modules/FindCABLE.cmake
index 450e32237..1f4ae7633 100644
--- a/Modules/FindCABLE.cmake
+++ b/Modules/FindCABLE.cmake
@@ -1,27 +1,28 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindCABLE
-# ---------
-#
-# Find CABLE
-#
-# This module finds if CABLE is installed and determines where the
-# include files and libraries are. This code sets the following
-# variables:
-#
-# ::
-#
-# CABLE the path to the cable executable
-# CABLE_TCL_LIBRARY the path to the Tcl wrapper library
-# CABLE_INCLUDE_DIR the path to the include directory
-#
-#
-#
-# To build Tcl wrappers, you should add shared library and link it to
-# ${CABLE_TCL_LIBRARY}. You should also add ${CABLE_INCLUDE_DIR} as an
-# include directory.
+#[=======================================================================[.rst:
+FindCABLE
+---------
+
+Find CABLE
+
+This module finds if CABLE is installed and determines where the
+include files and libraries are. This code sets the following
+variables:
+
+::
+
+ CABLE the path to the cable executable
+ CABLE_TCL_LIBRARY the path to the Tcl wrapper library
+ CABLE_INCLUDE_DIR the path to the include directory
+
+
+
+To build Tcl wrappers, you should add shared library and link it to
+${CABLE_TCL_LIBRARY}. You should also add ${CABLE_INCLUDE_DIR} as an
+include directory.
+#]=======================================================================]
if(NOT CABLE)
find_path(CABLE_BUILD_DIR cableVersion.h)
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 3527979e7..228eed4f7 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1,378 +1,382 @@
-#.rst:
-# FindCUDA
-# --------
-#
-# .. note::
-#
-# The FindCUDA module has been superseded by first-class support
-# for the CUDA language in CMake. It is no longer necessary to
-# use this module or call ``find_package(CUDA)``. This module
-# now exists only for compatibility with projects that have not
-# been ported.
-#
-# Instead, list ``CUDA`` among the languages named in the top-level
-# call to the :command:`project` command, or call the
-# :command:`enable_language` command with ``CUDA``.
-# Then one can add CUDA (``.cu``) sources to programs directly
-# in calls to :command:`add_library` and :command:`add_executable`.
-#
-# Tools for building CUDA C files: libraries and build dependencies.
-#
-# This script locates the NVIDIA CUDA C tools. It should work on Linux,
-# Windows, and macOS and should be reasonably up to date with CUDA C
-# releases.
-#
-# This script makes use of the standard :command:`find_package` arguments of
-# ``<VERSION>``, ``REQUIRED`` and ``QUIET``. ``CUDA_FOUND`` will report if an
-# acceptable version of CUDA was found.
-#
-# The script will prompt the user to specify ``CUDA_TOOLKIT_ROOT_DIR`` if
-# the prefix cannot be determined by the location of nvcc in the system
-# path and ``REQUIRED`` is specified to :command:`find_package`. To use
-# a different installed version of the toolkit set the environment variable
-# ``CUDA_BIN_PATH`` before running cmake (e.g.
-# ``CUDA_BIN_PATH=/usr/local/cuda1.0`` instead of the default
-# ``/usr/local/cuda``) or set ``CUDA_TOOLKIT_ROOT_DIR`` after configuring. If
-# you change the value of ``CUDA_TOOLKIT_ROOT_DIR``, various components that
-# depend on the path will be relocated.
-#
-# It might be necessary to set ``CUDA_TOOLKIT_ROOT_DIR`` manually on certain
-# platforms, or to use a CUDA runtime not installed in the default
-# location. In newer versions of the toolkit the CUDA library is
-# included with the graphics driver -- be sure that the driver version
-# matches what is needed by the CUDA runtime version.
-#
-# 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_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.
-# 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.
-#
+#[=======================================================================[.rst:
+FindCUDA
+--------
+
+.. deprecated:: 3.10
+
+ Superseded by first-class support for the CUDA language in CMake.
+
+Replacement
+^^^^^^^^^^^
+
+It is no longer necessary to use this module or call ``find_package(CUDA)``.
+Instead, list ``CUDA`` among the languages named in the top-level
+call to the :command:`project` command, or call the
+:command:`enable_language` command with ``CUDA``.
+Then one can add CUDA (``.cu``) sources to programs directly
+in calls to :command:`add_library` and :command:`add_executable`.
+
+Documentation of Deprecated Usage
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Tools for building CUDA C files: libraries and build dependencies.
+
+This script locates the NVIDIA CUDA C tools. It should work on Linux,
+Windows, and macOS and should be reasonably up to date with CUDA C
+releases.
+
+This script makes use of the standard :command:`find_package` arguments of
+``<VERSION>``, ``REQUIRED`` and ``QUIET``. ``CUDA_FOUND`` will report if an
+acceptable version of CUDA was found.
+
+The script will prompt the user to specify ``CUDA_TOOLKIT_ROOT_DIR`` if
+the prefix cannot be determined by the location of nvcc in the system
+path and ``REQUIRED`` is specified to :command:`find_package`. To use
+a different installed version of the toolkit set the environment variable
+``CUDA_BIN_PATH`` before running cmake (e.g.
+``CUDA_BIN_PATH=/usr/local/cuda1.0`` instead of the default
+``/usr/local/cuda``) or set ``CUDA_TOOLKIT_ROOT_DIR`` after configuring. If
+you change the value of ``CUDA_TOOLKIT_ROOT_DIR``, various components that
+depend on the path will be relocated.
+
+It might be necessary to set ``CUDA_TOOLKIT_ROOT_DIR`` manually on certain
+platforms, or to use a CUDA runtime not installed in the default
+location. In newer versions of the toolkit the CUDA library is
+included with the graphics driver -- be sure that the driver version
+matches what is needed by the CUDA runtime version.
+
+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_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.
+ 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.
+
+#]=======================================================================]
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
@@ -871,11 +875,7 @@ endif()
if(CUDA_USE_STATIC_CUDA_RUNTIME)
if(UNIX)
- # Check for the dependent libraries. Here we look for pthreads.
- if (DEFINED CMAKE_THREAD_PREFER_PTHREAD)
- set(_cuda_cmake_thread_prefer_pthread ${CMAKE_THREAD_PREFER_PTHREAD})
- endif()
- set(CMAKE_THREAD_PREFER_PTHREAD 1)
+ # Check for the dependent libraries.
# Many of the FindXYZ CMake comes with makes use of try_compile with int main(){return 0;}
# as the source file. Unfortunately this causes a warning with -Wstrict-prototypes and
@@ -886,13 +886,6 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME)
find_package(Threads REQUIRED)
set(CMAKE_C_FLAGS ${_cuda_cmake_c_flags})
- if (DEFINED _cuda_cmake_thread_prefer_pthread)
- set(CMAKE_THREAD_PREFER_PTHREAD ${_cuda_cmake_thread_prefer_pthread})
- unset(_cuda_cmake_thread_prefer_pthread)
- else()
- unset(CMAKE_THREAD_PREFER_PTHREAD)
- endif()
-
if(NOT APPLE)
#On Linux, you must link against librt when using the static cuda runtime.
find_library(CUDA_rt_LIBRARY rt)
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index 60ddf7b8f..b1989b10e 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -1,37 +1,58 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindCURL
-# --------
-#
-# Find the native CURL headers and libraries.
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines :prop_tgt:`IMPORTED` target ``CURL::libcurl``, if
-# curl has been found.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following variables:
-#
-# ``CURL_FOUND``
-# True if curl found.
-#
-# ``CURL_INCLUDE_DIRS``
-# where to find curl/curl.h, etc.
-#
-# ``CURL_LIBRARIES``
-# List of libraries when using curl.
-#
-# ``CURL_VERSION_STRING``
-# The version of curl found.
+#[=======================================================================[.rst:
+FindCURL
+--------
+
+Find the native CURL headers and libraries.
+
+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
+ FEATURES: SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO
+ Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``CURL::libcurl``, if
+curl has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``CURL_FOUND``
+ True if curl found.
+
+``CURL_INCLUDE_DIRS``
+ where to find curl/curl.h, etc.
+
+``CURL_LIBRARIES``
+ List of libraries when using curl.
+
+``CURL_VERSION_STRING``
+ The version of curl found.
+#]=======================================================================]
+
+find_package(PkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_CURL QUIET libcurl)
+ if(PC_CURL_FOUND)
+ set(CURL_VERSION_STRING ${PC_CURL_VERSION})
+ pkg_get_variable(CURL_SUPPORTED_PROTOCOLS libcurl supported_protocols)
+ pkg_get_variable(CURL_SUPPORTED_FEATURES libcurl supported_features)
+ endif()
+endif()
# Look for the header file.
-find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
+find_path(CURL_INCLUDE_DIR
+ NAMES curl/curl.h
+ HINTS ${PC_CURL_INCLUDE_DIRS})
mark_as_advanced(CURL_INCLUDE_DIR)
if(NOT CURL_LIBRARY)
@@ -44,6 +65,7 @@ if(NOT CURL_LIBRARY)
curllib_static
# Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
libcurl
+ HINTS ${PC_CURL_LIBRARY_DIRS}
)
mark_as_advanced(CURL_LIBRARY_RELEASE)
@@ -51,6 +73,7 @@ if(NOT CURL_LIBRARY)
# Windows MSVC CMake builds in debug configuration on vcpkg:
libcurl-d_imp
libcurl-d
+ HINTS ${PC_CURL_LIBRARY_DIRS}
)
mark_as_advanced(CURL_LIBRARY_DEBUG)
@@ -58,7 +81,7 @@ if(NOT CURL_LIBRARY)
select_library_configurations(CURL)
endif()
-if(CURL_INCLUDE_DIR)
+if(CURL_INCLUDE_DIR AND NOT CURL_VERSION_STRING)
foreach(_curl_version_header curlver.h curl.h)
if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}")
file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"")
@@ -70,10 +93,57 @@ if(CURL_INCLUDE_DIR)
endforeach()
endif()
+if(CURL_FIND_COMPONENTS)
+ set(CURL_KNOWN_PROTOCOLS ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP)
+ set(CURL_KNOWN_FEATURES SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy)
+ foreach(component IN LISTS CURL_KNOWN_PROTOCOLS CURL_KNOWN_FEATURES)
+ set(CURL_${component}_FOUND FALSE)
+ endforeach()
+ if(NOT PC_CURL_FOUND)
+ find_program(CURL_CONFIG_EXECUTABLE NAMES curl-config)
+ if(CURL_CONFIG_EXECUTABLE)
+ execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --version
+ OUTPUT_VARIABLE CURL_CONFIG_VERSION_STRING
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --feature
+ OUTPUT_VARIABLE CURL_CONFIG_FEATURES_STRING
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REPLACE "\n" ";" CURL_SUPPORTED_FEATURES "${CURL_CONFIG_FEATURES_STRING}")
+ execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --protocols
+ OUTPUT_VARIABLE CURL_CONFIG_PROTOCOLS_STRING
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REPLACE "\n" ";" CURL_SUPPORTED_PROTOCOLS "${CURL_CONFIG_PROTOCOLS_STRING}")
+ endif()
+
+ endif()
+ foreach(component IN LISTS CURL_FIND_COMPONENTS)
+ list(FIND CURL_KNOWN_PROTOCOLS ${component} _found)
+ if(_found)
+ list(FIND CURL_SUPPORTED_PROTOCOLS ${component} _found)
+ if(_found)
+ set(CURL_${component}_FOUND TRUE)
+ elseif(CURL_FIND_REQUIRED)
+ message(FATAL_ERROR "CURL: Required protocol ${component} is not found")
+ endif()
+ else()
+ list(FIND CURL_SUPPORTED_FEATURES ${component} _found)
+ if(_found)
+ set(CURL_${component}_FOUND TRUE)
+ elseif(CURL_FIND_REQUIRED)
+ message(FATAL_ERROR "CURL: Required feature ${component} is not found")
+ endif()
+ endif()
+ endforeach()
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL
+find_package_handle_standard_args(CURL
REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
- VERSION_VAR CURL_VERSION_STRING)
+ VERSION_VAR CURL_VERSION_STRING
+ HANDLE_COMPONENTS)
if(CURL_FOUND)
set(CURL_LIBRARIES ${CURL_LIBRARY})
diff --git a/Modules/FindCVS.cmake b/Modules/FindCVS.cmake
index d59dfb097..89dbc0e10 100644
--- a/Modules/FindCVS.cmake
+++ b/Modules/FindCVS.cmake
@@ -1,27 +1,28 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindCVS
-# -------
-#
-#
-#
-# The module defines the following variables:
-#
-# ::
-#
-# CVS_EXECUTABLE - path to cvs command line client
-# CVS_FOUND - true if the command line client was found
-#
-# Example usage:
-#
-# ::
-#
-# find_package(CVS)
-# if(CVS_FOUND)
-# message("CVS found: ${CVS_EXECUTABLE}")
-# endif()
+#[=======================================================================[.rst:
+FindCVS
+-------
+
+
+
+The module defines the following variables:
+
+::
+
+ CVS_EXECUTABLE - path to cvs command line client
+ CVS_FOUND - true if the command line client was found
+
+Example usage:
+
+::
+
+ find_package(CVS)
+ if(CVS_FOUND)
+ message("CVS found: ${CVS_EXECUTABLE}")
+ endif()
+#]=======================================================================]
# CVSNT
diff --git a/Modules/FindCoin3D.cmake b/Modules/FindCoin3D.cmake
index f11903d6a..301e70bd6 100644
--- a/Modules/FindCoin3D.cmake
+++ b/Modules/FindCoin3D.cmake
@@ -1,22 +1,23 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindCoin3D
-# ----------
-#
-# Find Coin3D (Open Inventor)
-#
-# Coin3D is an implementation of the Open Inventor API. It provides
-# data structures and algorithms for 3D visualization.
-#
-# This module defines the following variables
-#
-# ::
-#
-# COIN3D_FOUND - system has Coin3D - Open Inventor
-# COIN3D_INCLUDE_DIRS - where the Inventor include directory can be found
-# COIN3D_LIBRARIES - Link to this to use Coin3D
+#[=======================================================================[.rst:
+FindCoin3D
+----------
+
+Find Coin3D (Open Inventor)
+
+Coin3D is an implementation of the Open Inventor API. It provides
+data structures and algorithms for 3D visualization.
+
+This module defines the following variables
+
+::
+
+ COIN3D_FOUND - system has Coin3D - Open Inventor
+ COIN3D_INCLUDE_DIRS - where the Inventor include directory can be found
+ COIN3D_LIBRARIES - Link to this to use Coin3D
+#]=======================================================================]
if (WIN32)
if (CYGWIN)
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
index 13d3b98d6..10ce22968 100644
--- a/Modules/FindCups.cmake
+++ b/Modules/FindCups.cmake
@@ -1,22 +1,23 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindCups
-# --------
-#
-# Try to find the Cups printing system
-#
-# Once done this will define
-#
-# ::
-#
-# CUPS_FOUND - system has Cups
-# CUPS_INCLUDE_DIR - the Cups include directory
-# CUPS_LIBRARIES - Libraries needed to use Cups
-# CUPS_VERSION_STRING - version of Cups found (since CMake 2.8.8)
-# Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which
-# features this function (i.e. at least 1.1.19)
+#[=======================================================================[.rst:
+FindCups
+--------
+
+Try to find the Cups printing system
+
+Once done this will define
+
+::
+
+ CUPS_FOUND - system has Cups
+ CUPS_INCLUDE_DIR - the Cups include directory
+ CUPS_LIBRARIES - Libraries needed to use Cups
+ CUPS_VERSION_STRING - version of Cups found (since CMake 2.8.8)
+ Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which
+ features this function (i.e. at least 1.1.19)
+#]=======================================================================]
find_path(CUPS_INCLUDE_DIR cups/cups.h )
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index 4f59d2c1e..c22584782 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -1,46 +1,47 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindCurses
-# ----------
-#
-# Find the curses or ncurses include file and library.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following variables:
-#
-# ``CURSES_FOUND``
-# True if Curses is found.
-# ``CURSES_INCLUDE_DIRS``
-# The include directories needed to use Curses.
-# ``CURSES_LIBRARIES``
-# The libraries needed to use Curses.
-# ``CURSES_HAVE_CURSES_H``
-# True if curses.h is available.
-# ``CURSES_HAVE_NCURSES_H``
-# True if ncurses.h is available.
-# ``CURSES_HAVE_NCURSES_NCURSES_H``
-# True if ``ncurses/ncurses.h`` is available.
-# ``CURSES_HAVE_NCURSES_CURSES_H``
-# True if ``ncurses/curses.h`` is available.
-#
-# 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.
-#
-# Backward Compatibility
-# ^^^^^^^^^^^^^^^^^^^^^^
-#
-# The following variable are provided for backward compatibility:
-#
-# ``CURSES_INCLUDE_DIR``
-# Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead.
-# ``CURSES_LIBRARY``
-# Path to Curses library. Use ``CURSES_LIBRARIES`` instead.
+#[=======================================================================[.rst:
+FindCurses
+----------
+
+Find the curses or ncurses include file and library.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``CURSES_FOUND``
+ True if Curses is found.
+``CURSES_INCLUDE_DIRS``
+ The include directories needed to use Curses.
+``CURSES_LIBRARIES``
+ The libraries needed to use Curses.
+``CURSES_HAVE_CURSES_H``
+ True if curses.h is available.
+``CURSES_HAVE_NCURSES_H``
+ True if ncurses.h is available.
+``CURSES_HAVE_NCURSES_NCURSES_H``
+ True if ``ncurses/ncurses.h`` is available.
+``CURSES_HAVE_NCURSES_CURSES_H``
+ True if ``ncurses/curses.h`` is available.
+
+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.
+
+Backward Compatibility
+^^^^^^^^^^^^^^^^^^^^^^
+
+The following variable are provided for backward compatibility:
+
+``CURSES_INCLUDE_DIR``
+ Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead.
+``CURSES_LIBRARY``
+ Path to Curses library. Use ``CURSES_LIBRARIES`` instead.
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake
index 25454fd9e..4eec5fcec 100644
--- a/Modules/FindCxxTest.cmake
+++ b/Modules/FindCxxTest.cmake
@@ -1,142 +1,143 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindCxxTest
-# -----------
-#
-# Find CxxTest
-#
-# Find the CxxTest suite and declare a helper macro for creating unit
-# tests and integrating them with CTest. For more details on CxxTest
-# see http://cxxtest.tigris.org
-#
-# INPUT Variables
-#
-# ::
-#
-# CXXTEST_USE_PYTHON [deprecated since 1.3]
-# Only used in the case both Python & Perl
-# are detected on the system to control
-# which CxxTest code generator is used.
-# Valid only for CxxTest version 3.
-#
-#
-#
-# ::
-#
-# NOTE: In older versions of this Find Module,
-# this variable controlled if the Python test
-# generator was used instead of the Perl one,
-# regardless of which scripting language the
-# user had installed.
-#
-#
-#
-# ::
-#
-# CXXTEST_TESTGEN_ARGS (since CMake 2.8.3)
-# Specify a list of options to pass to the CxxTest code
-# generator. If not defined, --error-printer is
-# passed.
-#
-#
-#
-# OUTPUT Variables
-#
-# ::
-#
-# CXXTEST_FOUND
-# True if the CxxTest framework was found
-# CXXTEST_INCLUDE_DIRS
-# Where to find the CxxTest include directory
-# CXXTEST_PERL_TESTGEN_EXECUTABLE
-# The perl-based test generator
-# CXXTEST_PYTHON_TESTGEN_EXECUTABLE
-# The python-based test generator
-# CXXTEST_TESTGEN_EXECUTABLE (since CMake 2.8.3)
-# The test generator that is actually used (chosen using user preferences
-# and interpreters found in the system)
-# CXXTEST_TESTGEN_INTERPRETER (since CMake 2.8.3)
-# The full path to the Perl or Python executable on the system, on
-# platforms where the script cannot be executed using its shebang line.
-#
-#
-#
-# MACROS for optional use by CMake users:
-#
-# ::
-#
-# CXXTEST_ADD_TEST(<test_name> <gen_source_file> <input_files_to_testgen...>)
-# Creates a CxxTest runner and adds it to the CTest testing suite
-# Parameters:
-# test_name The name of the test
-# gen_source_file The generated source filename to be
-# generated by CxxTest
-# input_files_to_testgen The list of header files containing the
-# CxxTest::TestSuite's to be included in
-# this runner
-#
-#
-#
-# ::
-#
-# #==============
-# Example Usage:
-#
-#
-#
-# ::
-#
-# find_package(CxxTest)
-# if(CXXTEST_FOUND)
-# include_directories(${CXXTEST_INCLUDE_DIR})
-# enable_testing()
-#
-#
-#
-# ::
-#
-# CXXTEST_ADD_TEST(unittest_foo foo_test.cc
-# ${CMAKE_CURRENT_SOURCE_DIR}/foo_test.h)
-# target_link_libraries(unittest_foo foo) # as needed
-# endif()
-#
-#
-#
-# ::
-#
-# This will (if CxxTest is found):
-# 1. Invoke the testgen executable to autogenerate foo_test.cc in the
-# binary tree from "foo_test.h" in the current source directory.
-# 2. Create an executable and test called unittest_foo.
-#
-#
-#
-# ::
-#
-# #=============
-# Example foo_test.h:
-#
-#
-#
-# ::
-#
-# #include <cxxtest/TestSuite.h>
-#
-#
-#
-# ::
-#
-# class MyTestSuite : public CxxTest::TestSuite
-# {
-# public:
-# void testAddition( void )
-# {
-# TS_ASSERT( 1 + 1 > 1 );
-# TS_ASSERT_EQUALS( 1 + 1, 2 );
-# }
-# };
+#[=======================================================================[.rst:
+FindCxxTest
+-----------
+
+Find CxxTest
+
+Find the CxxTest suite and declare a helper macro for creating unit
+tests and integrating them with CTest. For more details on CxxTest
+see http://cxxtest.tigris.org
+
+INPUT Variables
+
+::
+
+ CXXTEST_USE_PYTHON [deprecated since 1.3]
+ Only used in the case both Python & Perl
+ are detected on the system to control
+ which CxxTest code generator is used.
+ Valid only for CxxTest version 3.
+
+
+
+::
+
+ NOTE: In older versions of this Find Module,
+ this variable controlled if the Python test
+ generator was used instead of the Perl one,
+ regardless of which scripting language the
+ user had installed.
+
+
+
+::
+
+ CXXTEST_TESTGEN_ARGS (since CMake 2.8.3)
+ Specify a list of options to pass to the CxxTest code
+ generator. If not defined, --error-printer is
+ passed.
+
+
+
+OUTPUT Variables
+
+::
+
+ CXXTEST_FOUND
+ True if the CxxTest framework was found
+ CXXTEST_INCLUDE_DIRS
+ Where to find the CxxTest include directory
+ CXXTEST_PERL_TESTGEN_EXECUTABLE
+ The perl-based test generator
+ CXXTEST_PYTHON_TESTGEN_EXECUTABLE
+ The python-based test generator
+ CXXTEST_TESTGEN_EXECUTABLE (since CMake 2.8.3)
+ The test generator that is actually used (chosen using user preferences
+ and interpreters found in the system)
+ CXXTEST_TESTGEN_INTERPRETER (since CMake 2.8.3)
+ The full path to the Perl or Python executable on the system, on
+ platforms where the script cannot be executed using its shebang line.
+
+
+
+MACROS for optional use by CMake users:
+
+::
+
+ CXXTEST_ADD_TEST(<test_name> <gen_source_file> <input_files_to_testgen...>)
+ Creates a CxxTest runner and adds it to the CTest testing suite
+ Parameters:
+ test_name The name of the test
+ gen_source_file The generated source filename to be
+ generated by CxxTest
+ input_files_to_testgen The list of header files containing the
+ CxxTest::TestSuite's to be included in
+ this runner
+
+
+
+::
+
+ #==============
+ Example Usage:
+
+
+
+::
+
+ find_package(CxxTest)
+ if(CXXTEST_FOUND)
+ include_directories(${CXXTEST_INCLUDE_DIR})
+ enable_testing()
+
+
+
+::
+
+ CXXTEST_ADD_TEST(unittest_foo foo_test.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/foo_test.h)
+ target_link_libraries(unittest_foo foo) # as needed
+ endif()
+
+
+
+::
+
+ This will (if CxxTest is found):
+ 1. Invoke the testgen executable to autogenerate foo_test.cc in the
+ binary tree from "foo_test.h" in the current source directory.
+ 2. Create an executable and test called unittest_foo.
+
+
+
+::
+
+ #=============
+ Example foo_test.h:
+
+
+
+::
+
+ #include <cxxtest/TestSuite.h>
+
+
+
+::
+
+ class MyTestSuite : public CxxTest::TestSuite
+ {
+ public:
+ void testAddition( void )
+ {
+ TS_ASSERT( 1 + 1 > 1 );
+ TS_ASSERT_EQUALS( 1 + 1, 2 );
+ }
+ };
+#]=======================================================================]
# Version 1.4 (11/18/10) (CMake 2.8.4)
# Issue 11384: Added support to the CXX_ADD_TEST macro so header
diff --git a/Modules/FindCygwin.cmake b/Modules/FindCygwin.cmake
index 092a3bd49..8811623a2 100644
--- a/Modules/FindCygwin.cmake
+++ b/Modules/FindCygwin.cmake
@@ -1,11 +1,12 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindCygwin
-# ----------
-#
-# this module looks for Cygwin
+#[=======================================================================[.rst:
+FindCygwin
+----------
+
+this module looks for Cygwin
+#]=======================================================================]
if (WIN32)
if(CYGWIN_INSTALL_PATH)
diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake
index 39c1a5b34..111e0ff2f 100644
--- a/Modules/FindDCMTK.cmake
+++ b/Modules/FindDCMTK.cmake
@@ -1,82 +1,83 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindDCMTK
-# ---------
-#
-# Find DCMTK libraries and applications
-#
-# The module defines the following variables::
-#
-# DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK
-# DCMTK_LIBRARIES - Files to link against to use DCMTK
-# DCMTK_FOUND - If false, don't try to use DCMTK
-# DCMTK_DIR - (optional) Source directory for DCMTK
-#
-# Compatibility
-# ^^^^^^^^^^^^^
-#
-# This module is able to find a version of DCMTK that does or does not export
-# a *DCMTKConfig.cmake* file. It applies a two step process:
-#
-# * Step 1: Attempt to find DCMTK version providing a *DCMTKConfig.cmake* file.
-# * Step 2: If step 1 failed, rely on *FindDCMTK.cmake* to set `DCMTK_*` variables details below.
-#
-#
-# `Recent DCMTK
-# <http://git.dcmtk.org/web?p=dcmtk.git;a=commit;h=662ae187c493c6b9a73dd5e3875372cebd0c11fe>`_
-# provides a *DCMTKConfig.cmake* :manual:`package configuration file
-# <cmake-packages(7)>`. To exclusively use the package configuration file
-# (recommended when possible), pass the `NO_MODULE` option to
-# :command:`find_package`. For example, `find_package(DCMTK NO_MODULE)`.
-# This requires official DCMTK snapshot *3.6.1_20140617* or newer.
-#
-#
-# Until all clients update to the more recent DCMTK, build systems will need
-# to support different versions of DCMTK.
-#
-# On any given system, the following combinations of DCMTK versions could be
-# considered:
-#
-# +--------+---------------------+-----------------------+-------------------+
-# | | SYSTEM DCMTK | LOCAL DCMTK | Supported ? |
-# +--------+---------------------+-----------------------+-------------------+
-# | Case A | NA | [ ] DCMTKConfig | YES |
-# +--------+---------------------+-----------------------+-------------------+
-# | Case B | NA | [X] DCMTKConfig | YES |
-# +--------+---------------------+-----------------------+-------------------+
-# | Case C | [ ] DCMTKConfig | NA | YES |
-# +--------+---------------------+-----------------------+-------------------+
-# | Case D | [X] DCMTKConfig | NA | YES |
-# +--------+---------------------+-----------------------+-------------------+
-# | Case E | [ ] DCMTKConfig | [ ] DCMTKConfig | YES (*) |
-# +--------+---------------------+-----------------------+-------------------+
-# | Case F | [X] DCMTKConfig | [ ] DCMTKConfig | NO |
-# +--------+---------------------+-----------------------+-------------------+
-# | Case G | [ ] DCMTKConfig | [X] DCMTKConfig | YES |
-# +--------+---------------------+-----------------------+-------------------+
-# | Case H | [X] DCMTKConfig | [X] DCMTKConfig | YES |
-# +--------+---------------------+-----------------------+-------------------+
-#
-# (*) See Troubleshooting section.
-#
-# Legend:
-#
-# NA ...............: Means that no System or Local DCMTK is available
-#
-# [ ] DCMTKConfig ..: Means that the version of DCMTK does NOT export a DCMTKConfig.cmake file.
-#
-# [X] DCMTKConfig ..: Means that the version of DCMTK exports a DCMTKConfig.cmake file.
-#
-#
-# Troubleshooting
-# ^^^^^^^^^^^^^^^
-#
-# What to do if my project finds a different version of DCMTK?
-#
-# Remove DCMTK entry from the CMake cache per :command:`find_package`
-# documentation.
+#[=======================================================================[.rst:
+FindDCMTK
+---------
+
+Find DCMTK libraries and applications
+
+The module defines the following variables::
+
+ DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK
+ DCMTK_LIBRARIES - Files to link against to use DCMTK
+ DCMTK_FOUND - If false, don't try to use DCMTK
+ DCMTK_DIR - (optional) Source directory for DCMTK
+
+Compatibility
+^^^^^^^^^^^^^
+
+This module is able to find a version of DCMTK that does or does not export
+a *DCMTKConfig.cmake* file. It applies a two step process:
+
+* Step 1: Attempt to find DCMTK version providing a *DCMTKConfig.cmake* file.
+* Step 2: If step 1 failed, rely on *FindDCMTK.cmake* to set `DCMTK_*` variables details below.
+
+
+`Recent DCMTK
+<http://git.dcmtk.org/web?p=dcmtk.git;a=commit;h=662ae187c493c6b9a73dd5e3875372cebd0c11fe>`_
+provides a *DCMTKConfig.cmake* :manual:`package configuration file
+<cmake-packages(7)>`. To exclusively use the package configuration file
+(recommended when possible), pass the `NO_MODULE` option to
+:command:`find_package`. For example, `find_package(DCMTK NO_MODULE)`.
+This requires official DCMTK snapshot *3.6.1_20140617* or newer.
+
+
+Until all clients update to the more recent DCMTK, build systems will need
+to support different versions of DCMTK.
+
+On any given system, the following combinations of DCMTK versions could be
+considered:
+
++--------+---------------------+-----------------------+-------------------+
+| | SYSTEM DCMTK | LOCAL DCMTK | Supported ? |
++--------+---------------------+-----------------------+-------------------+
+| Case A | NA | [ ] DCMTKConfig | YES |
++--------+---------------------+-----------------------+-------------------+
+| Case B | NA | [X] DCMTKConfig | YES |
++--------+---------------------+-----------------------+-------------------+
+| Case C | [ ] DCMTKConfig | NA | YES |
++--------+---------------------+-----------------------+-------------------+
+| Case D | [X] DCMTKConfig | NA | YES |
++--------+---------------------+-----------------------+-------------------+
+| Case E | [ ] DCMTKConfig | [ ] DCMTKConfig | YES (*) |
++--------+---------------------+-----------------------+-------------------+
+| Case F | [X] DCMTKConfig | [ ] DCMTKConfig | NO |
++--------+---------------------+-----------------------+-------------------+
+| Case G | [ ] DCMTKConfig | [X] DCMTKConfig | YES |
++--------+---------------------+-----------------------+-------------------+
+| Case H | [X] DCMTKConfig | [X] DCMTKConfig | YES |
++--------+---------------------+-----------------------+-------------------+
+
+ (*) See Troubleshooting section.
+
+Legend:
+
+ NA ...............: Means that no System or Local DCMTK is available
+
+ [ ] DCMTKConfig ..: Means that the version of DCMTK does NOT export a DCMTKConfig.cmake file.
+
+ [X] DCMTKConfig ..: Means that the version of DCMTK exports a DCMTKConfig.cmake file.
+
+
+Troubleshooting
+^^^^^^^^^^^^^^^
+
+What to do if my project finds a different version of DCMTK?
+
+Remove DCMTK entry from the CMake cache per :command:`find_package`
+documentation.
+#]=======================================================================]
#
# Written for VXL by Amitha Perera.
@@ -199,7 +200,6 @@ if(DCMTK_oflog_LIBRARY_RELEASE OR DCMTK_oflog_LIBRARY_DEBUG)
# Hack - Not having a DCMTKConfig.cmake file to read the settings from, we will attempt to
# find the library in all cases.
# Ideally, pthread library should be discovered only if DCMTK_WITH_THREADS is enabled.
- set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads)
endif()
diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake
index acd4ef62d..04925783b 100644
--- a/Modules/FindDart.cmake
+++ b/Modules/FindDart.cmake
@@ -1,14 +1,15 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindDart
-# --------
-#
-# Find DART
-#
-# This module looks for the dart testing software and sets DART_ROOT to
-# point to where it found it.
+#[=======================================================================[.rst:
+FindDart
+--------
+
+Find DART
+
+This module looks for the dart testing software and sets DART_ROOT to
+point to where it found it.
+#]=======================================================================]
find_path(DART_ROOT README.INSTALL
HINTS
diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake
index e904a30fc..998494365 100644
--- a/Modules/FindDevIL.cmake
+++ b/Modules/FindDevIL.cmake
@@ -1,35 +1,36 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindDevIL
-# ---------
-#
-#
-#
-# This module locates the developer's image library.
-# http://openil.sourceforge.net/
-#
-# This module sets:
-#
-# ::
-#
-# IL_LIBRARIES - the name of the IL library. These include the full path to
-# the core DevIL library. This one has to be linked into the
-# application.
-# ILU_LIBRARIES - the name of the ILU library. Again, the full path. This
-# library is for filters and effects, not actual loading. It
-# doesn't have to be linked if the functionality it provides
-# is not used.
-# ILUT_LIBRARIES - the name of the ILUT library. Full path. This part of the
-# library interfaces with OpenGL. It is not strictly needed
-# in applications.
-# IL_INCLUDE_DIR - where to find the il.h, ilu.h and ilut.h files.
-# DevIL_FOUND - this is set to TRUE if all the above variables were set.
-# This will be set to false if ILU or ILUT are not found,
-# even if they are not needed. In most systems, if one
-# library is found all the others are as well. That's the
-# way the DevIL developers release it.
+#[=======================================================================[.rst:
+FindDevIL
+---------
+
+
+
+This module locates the developer's image library.
+http://openil.sourceforge.net/
+
+This module sets:
+
+::
+
+ IL_LIBRARIES - the name of the IL library. These include the full path to
+ the core DevIL library. This one has to be linked into the
+ application.
+ ILU_LIBRARIES - the name of the ILU library. Again, the full path. This
+ library is for filters and effects, not actual loading. It
+ doesn't have to be linked if the functionality it provides
+ is not used.
+ ILUT_LIBRARIES - the name of the ILUT library. Full path. This part of the
+ library interfaces with OpenGL. It is not strictly needed
+ in applications.
+ IL_INCLUDE_DIR - where to find the il.h, ilu.h and ilut.h files.
+ DevIL_FOUND - this is set to TRUE if all the above variables were set.
+ This will be set to false if ILU or ILUT are not found,
+ even if they are not needed. In most systems, if one
+ library is found all the others are as well. That's the
+ way the DevIL developers release it.
+#]=======================================================================]
# TODO: Add version support.
# Tested under Linux and Windows (MSVC)
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index cb4738bab..32b4aa2c8 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -485,12 +485,18 @@ endmacro()
# Find Graphviz Dot...
#
macro(_Doxygen_find_dot)
- set(_x86 "(x86)")
- file(
- GLOB _Doxygen_GRAPHVIZ_BIN_DIRS
- "$ENV{ProgramFiles}/Graphviz*/bin"
- "$ENV{ProgramFiles${_x86}}/Graphviz*/bin"
- )
+ if(WIN32)
+ set(_x86 "(x86)")
+ file(
+ GLOB _Doxygen_GRAPHVIZ_BIN_DIRS
+ "$ENV{ProgramFiles}/Graphviz*/bin"
+ "$ENV{ProgramFiles${_x86}}/Graphviz*/bin"
+ )
+ unset(_x86)
+ else()
+ set(_Doxygen_GRAPHVIZ_BIN_DIRS "")
+ endif()
+
find_program(
DOXYGEN_DOT_EXECUTABLE
NAMES dot
@@ -529,7 +535,6 @@ macro(_Doxygen_find_dot)
endif()
unset(_Doxygen_GRAPHVIZ_BIN_DIRS)
- unset(_x86)
endmacro()
#
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index 39086e499..58e08418c 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -1,32 +1,33 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindEXPAT
-# ---------
-#
-# Find the native Expat headers and library.
-#
-# Imported Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following :prop_tgt:`IMPORTED` targets:
-#
-# ``EXPAT::EXPAT``
-# The Expat ``expat`` library, if found.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project:
-#
-# ``EXPAT_INCLUDE_DIRS``
-# where to find expat.h, etc.
-# ``EXPAT_LIBRARIES``
-# the libraries to link against to use Expat.
-# ``EXPAT_FOUND``
-# true if the Expat headers and libraries were found.
-#
+#[=======================================================================[.rst:
+FindEXPAT
+---------
+
+Find the native Expat headers and library.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` targets:
+
+``EXPAT::EXPAT``
+ The Expat ``expat`` library, if found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``EXPAT_INCLUDE_DIRS``
+ where to find expat.h, etc.
+``EXPAT_LIBRARIES``
+ the libraries to link against to use Expat.
+``EXPAT_FOUND``
+ true if the Expat headers and libraries were found.
+
+#]=======================================================================]
find_package(PkgConfig QUIET)
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index 3945b7884..edebe755c 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -1,100 +1,101 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindFLEX
-# --------
-#
-# Find flex executable and provides a macro to generate custom build rules
-#
-#
-#
-# The module defines the following variables:
-#
-# ::
-#
-# FLEX_FOUND - true is flex executable is found
-# FLEX_EXECUTABLE - the path to the flex executable
-# FLEX_VERSION - the version of flex
-# FLEX_LIBRARIES - The flex libraries
-# FLEX_INCLUDE_DIRS - The path to the flex headers
-#
-#
-#
-# The minimum required version of flex can be specified using the
-# standard syntax, e.g. find_package(FLEX 2.5.13)
-#
-#
-#
-# If flex is found on the system, the module provides the macro:
-#
-# ::
-#
-# FLEX_TARGET(Name FlexInput FlexOutput
-# [COMPILE_FLAGS <string>]
-# [DEFINES_FILE <string>]
-# )
-#
-# 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:
-#
-# ::
-#
-# FLEX_${Name}_DEFINED - true is the macro ran successfully
-# FLEX_${Name}_OUTPUTS - the source file generated by the custom rule, an
-# alias for FlexOutput
-# FLEX_${Name}_INPUT - the flex source file, an alias for ${FlexInput}
-# FLEX_${Name}_OUTPUT_HEADER - the header flex output, if any.
-#
-#
-#
-# Flex scanners often use tokens defined by Bison: the code generated
-# by Flex depends of the header generated by Bison. This module also
-# defines a macro:
-#
-# ::
-#
-# ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget)
-#
-# which adds the required dependency between a scanner and a parser
-# where <FlexTarget> and <BisonTarget> are the first parameters of
-# respectively FLEX_TARGET and BISON_TARGET macros.
-#
-# ::
-#
-# ====================================================================
-# Example:
-#
-#
-#
-# ::
-#
-# find_package(BISON)
-# find_package(FLEX)
-#
-#
-#
-# ::
-#
-# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp)
-# FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
-# ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
-#
-#
-#
-# ::
-#
-# include_directories(${CMAKE_CURRENT_BINARY_DIR})
-# add_executable(Foo
-# Foo.cc
-# ${BISON_MyParser_OUTPUTS}
-# ${FLEX_MyScanner_OUTPUTS}
-# )
-# ====================================================================
+#[=======================================================================[.rst:
+FindFLEX
+--------
+
+Find flex executable and provides a macro to generate custom build rules
+
+
+
+The module defines the following variables:
+
+::
+
+ FLEX_FOUND - true is flex executable is found
+ FLEX_EXECUTABLE - the path to the flex executable
+ FLEX_VERSION - the version of flex
+ FLEX_LIBRARIES - The flex libraries
+ FLEX_INCLUDE_DIRS - The path to the flex headers
+
+
+
+The minimum required version of flex can be specified using the
+standard syntax, e.g. find_package(FLEX 2.5.13)
+
+
+
+If flex is found on the system, the module provides the macro:
+
+::
+
+ FLEX_TARGET(Name FlexInput FlexOutput
+ [COMPILE_FLAGS <string>]
+ [DEFINES_FILE <string>]
+ )
+
+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:
+
+::
+
+ FLEX_${Name}_DEFINED - true is the macro ran successfully
+ FLEX_${Name}_OUTPUTS - the source file generated by the custom rule, an
+ alias for FlexOutput
+ FLEX_${Name}_INPUT - the flex source file, an alias for ${FlexInput}
+ FLEX_${Name}_OUTPUT_HEADER - the header flex output, if any.
+
+
+
+Flex scanners often use tokens defined by Bison: the code generated
+by Flex depends of the header generated by Bison. This module also
+defines a macro:
+
+::
+
+ ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget)
+
+which adds the required dependency between a scanner and a parser
+where <FlexTarget> and <BisonTarget> are the first parameters of
+respectively FLEX_TARGET and BISON_TARGET macros.
+
+::
+
+ ====================================================================
+ Example:
+
+
+
+::
+
+ find_package(BISON)
+ find_package(FLEX)
+
+
+
+::
+
+ BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp)
+ FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
+ ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
+
+
+
+::
+
+ include_directories(${CMAKE_CURRENT_BINARY_DIR})
+ add_executable(Foo
+ Foo.cc
+ ${BISON_MyParser_OUTPUTS}
+ ${FLEX_MyScanner_OUTPUTS}
+ )
+ ====================================================================
+#]=======================================================================]
find_program(FLEX_EXECUTABLE NAMES flex win_flex DOC "path to the flex executable")
mark_as_advanced(FLEX_EXECUTABLE)
diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake
index 82c63efd4..89122c045 100644
--- a/Modules/FindFLTK.cmake
+++ b/Modules/FindFLTK.cmake
@@ -1,82 +1,83 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindFLTK
-# --------
-#
-# Find the FLTK library
-#
-# Input Variables
-# ^^^^^^^^^^^^^^^
-#
-# By default this module will search for all of the FLTK components and
-# add them to the FLTK_LIBRARIES variable. You can limit the components
-# which get placed in FLTK_LIBRARIES by defining one or more of the
-# following three options:
-#
-# ``FLTK_SKIP_OPENGL``
-# Set to true to disable searching for the FLTK GL library
-#
-# ``FLTK_SKIP_FORMS``
-# Set to true to disable searching for the FLTK Forms library
-#
-# ``FLTK_SKIP_IMAGES``
-# Set to true to disable searching for the FLTK Images library
-#
-# FLTK is composed also by a binary tool. You can set the following option:
-#
-# ``FLTK_SKIP_FLUID``
-# Set to true to not look for the FLUID binary
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# The following variables will be defined:
-#
-# ``FLTK_FOUND``
-# True if all components not skipped were found
-#
-# ``FLTK_INCLUDE_DIR``
-# Path to the include directory for FLTK header files
-#
-# ``FLTK_LIBRARIES``
-# List of the FLTK libraries found
-#
-# ``FLTK_FLUID_EXECUTABLE``
-# Path to the FLUID binary tool
-#
-# ``FLTK_WRAP_UI``
-# True if FLUID is found, used to enable the FLTK_WRAP_UI command
-#
-# Cache Variables
-# ^^^^^^^^^^^^^^^
-#
-# The following cache variables are also available to set or use:
-#
-# ``FLTK_BASE_LIBRARY_RELEASE``
-# The FLTK base library (optimized)
-#
-# ``FLTK_BASE_LIBRARY_DEBUG``
-# The FLTK base library (debug)
-#
-# ``FLTK_GL_LIBRARY_RELEASE``
-# The FLTK GL library (optimized)
-#
-# ``FLTK_GL_LIBRARY_DEBUG``
-# The FLTK GL library (debug)
-#
-# ``FLTK_FORMS_LIBRARY_RELEASE``
-# The FLTK Forms library (optimized)
-#
-# ``FLTK_FORMS_LIBRARY_DEBUG``
-# The FLTK Forms library (debug)
-#
-# ``FLTK_IMAGES_LIBRARY_RELEASE``
-# The FLTK Images protobuf library (optimized)
-#
-# ``FLTK_IMAGES_LIBRARY_DEBUG``
-# The FLTK Images library (debug)
+#[=======================================================================[.rst:
+FindFLTK
+--------
+
+Find the FLTK library
+
+Input Variables
+^^^^^^^^^^^^^^^
+
+By default this module will search for all of the FLTK components and
+add them to the FLTK_LIBRARIES variable. You can limit the components
+which get placed in FLTK_LIBRARIES by defining one or more of the
+following three options:
+
+``FLTK_SKIP_OPENGL``
+ Set to true to disable searching for the FLTK GL library
+
+``FLTK_SKIP_FORMS``
+ Set to true to disable searching for the FLTK Forms library
+
+``FLTK_SKIP_IMAGES``
+ Set to true to disable searching for the FLTK Images library
+
+FLTK is composed also by a binary tool. You can set the following option:
+
+``FLTK_SKIP_FLUID``
+ Set to true to not look for the FLUID binary
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+The following variables will be defined:
+
+``FLTK_FOUND``
+ True if all components not skipped were found
+
+``FLTK_INCLUDE_DIR``
+ Path to the include directory for FLTK header files
+
+``FLTK_LIBRARIES``
+ List of the FLTK libraries found
+
+``FLTK_FLUID_EXECUTABLE``
+ Path to the FLUID binary tool
+
+``FLTK_WRAP_UI``
+ True if FLUID is found, used to enable the FLTK_WRAP_UI command
+
+Cache Variables
+^^^^^^^^^^^^^^^
+
+The following cache variables are also available to set or use:
+
+``FLTK_BASE_LIBRARY_RELEASE``
+ The FLTK base library (optimized)
+
+``FLTK_BASE_LIBRARY_DEBUG``
+ The FLTK base library (debug)
+
+``FLTK_GL_LIBRARY_RELEASE``
+ The FLTK GL library (optimized)
+
+``FLTK_GL_LIBRARY_DEBUG``
+ The FLTK GL library (debug)
+
+``FLTK_FORMS_LIBRARY_RELEASE``
+ The FLTK Forms library (optimized)
+
+``FLTK_FORMS_LIBRARY_DEBUG``
+ The FLTK Forms library (debug)
+
+``FLTK_IMAGES_LIBRARY_RELEASE``
+ The FLTK Images protobuf library (optimized)
+
+``FLTK_IMAGES_LIBRARY_DEBUG``
+ The FLTK Images library (debug)
+#]=======================================================================]
if(NOT FLTK_SKIP_OPENGL)
find_package(OpenGL)
diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake
index 365a82a55..161d15c4a 100644
--- a/Modules/FindFLTK2.cmake
+++ b/Modules/FindFLTK2.cmake
@@ -1,29 +1,30 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindFLTK2
-# ---------
-#
-# Find the native FLTK2 includes and library
-#
-# The following settings are defined
-#
-# ::
-#
-# FLTK2_FLUID_EXECUTABLE, where to find the Fluid tool
-# FLTK2_WRAP_UI, This enables the FLTK2_WRAP_UI command
-# FLTK2_INCLUDE_DIR, where to find include files
-# FLTK2_LIBRARIES, list of fltk2 libraries
-# FLTK2_FOUND, Don't use FLTK2 if false.
-#
-# The following settings should not be used in general.
-#
-# ::
-#
-# FLTK2_BASE_LIBRARY = the full path to fltk2.lib
-# FLTK2_GL_LIBRARY = the full path to fltk2_gl.lib
-# FLTK2_IMAGES_LIBRARY = the full path to fltk2_images.lib
+#[=======================================================================[.rst:
+FindFLTK2
+---------
+
+Find the native FLTK2 includes and library
+
+The following settings are defined
+
+::
+
+ FLTK2_FLUID_EXECUTABLE, where to find the Fluid tool
+ FLTK2_WRAP_UI, This enables the FLTK2_WRAP_UI command
+ FLTK2_INCLUDE_DIR, where to find include files
+ FLTK2_LIBRARIES, list of fltk2 libraries
+ FLTK2_FOUND, Don't use FLTK2 if false.
+
+The following settings should not be used in general.
+
+::
+
+ FLTK2_BASE_LIBRARY = the full path to fltk2.lib
+ FLTK2_GL_LIBRARY = the full path to fltk2_gl.lib
+ FLTK2_IMAGES_LIBRARY = the full path to fltk2_images.lib
+#]=======================================================================]
set (FLTK2_DIR $ENV{FLTK2_DIR} )
diff --git a/Modules/FindFontconfig.cmake b/Modules/FindFontconfig.cmake
new file mode 100644
index 000000000..a6f0180b3
--- /dev/null
+++ b/Modules/FindFontconfig.cmake
@@ -0,0 +1,101 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindFontconfig
+--------------
+
+Find Fontconfig headers and library.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+``Fontconfig::Fontconfig``
+ The Fontconfig library, if found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This will define the following variables in your project:
+
+``Fontconfig_FOUND``
+ true if (the requested version of) Fontconfig is available.
+``Fontconfig_VERSION``
+ the version of Fontconfig.
+``Fontconfig_LIBRARIES``
+ the libraries to link against to use Fontconfig.
+``Fontconfig_INCLUDE_DIRS``
+ where to find the Fontconfig headers.
+``Fontconfig_COMPILE_OPTIONS``
+ this should be passed to target_compile_options(), if the
+ target is not used for linking
+
+#]=======================================================================]
+
+
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+find_package(PkgConfig QUIET)
+pkg_check_modules(PKG_FONTCONFIG QUIET fontconfig)
+set(Fontconfig_COMPILE_OPTIONS ${PKG_FONTCONFIG_CFLAGS_OTHER})
+set(Fontconfig_VERSION ${PKG_FONTCONFIG_VERSION})
+
+find_path( Fontconfig_INCLUDE_DIR
+ NAMES
+ fontconfig/fontconfig.h
+ HINTS
+ ${PKG_FONTCONFIG_INCLUDE_DIRS}
+ /usr/X11/include
+)
+
+find_library( Fontconfig_LIBRARY
+ NAMES
+ fontconfig
+ PATHS
+ ${PKG_FONTCONFIG_LIBRARY_DIRS}
+)
+
+if (Fontconfig_INCLUDE_DIR AND NOT Fontconfig_VERSION)
+ file(STRINGS ${Fontconfig_INCLUDE_DIR}/fontconfig/fontconfig.h _contents REGEX "^#define[ \t]+FC_[A-Z]+[ \t]+[0-9]+$")
+ unset(Fontconfig_VERSION)
+ foreach(VPART MAJOR MINOR REVISION)
+ foreach(VLINE ${_contents})
+ if(VLINE MATCHES "^#define[\t ]+FC_${VPART}[\t ]+([0-9]+)$")
+ set(Fontconfig_VERSION_PART "${CMAKE_MATCH_1}")
+ if(Fontconfig_VERSION)
+ string(APPEND Fontconfig_VERSION ".${Fontconfig_VERSION_PART}")
+ else()
+ set(Fontconfig_VERSION "${Fontconfig_VERSION_PART}")
+ endif()
+ endif()
+ endforeach()
+ endforeach()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Fontconfig
+ FOUND_VAR
+ Fontconfig_FOUND
+ REQUIRED_VARS
+ Fontconfig_LIBRARY
+ Fontconfig_INCLUDE_DIR
+ VERSION_VAR
+ Fontconfig_VERSION
+)
+
+
+if(Fontconfig_FOUND AND NOT TARGET Fontconfig::Fontconfig)
+ add_library(Fontconfig::Fontconfig UNKNOWN IMPORTED)
+ set_target_properties(Fontconfig::Fontconfig PROPERTIES
+ IMPORTED_LOCATION "${Fontconfig_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${Fontconfig_COMPILE_OPTIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Fontconfig_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(Fontconfig_LIBRARY Fontconfig_INCLUDE_DIR)
+
+if(Fontconfig_FOUND)
+ set(Fontconfig_LIBRARIES ${Fontconfig_LIBRARY})
+ set(Fontconfig_INCLUDE_DIRS ${Fontconfig_INCLUDE_DIR})
+endif()
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 61643be45..3e6a177dc 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -1,45 +1,46 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindFreetype
-# ------------
-#
-# Find the FreeType font renderer includes and library.
-#
-# Imported Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following :prop_tgt:`IMPORTED` target:
-#
-# ``Freetype::Freetype``
-# The Freetype ``freetype`` library, if found
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project:
-#
-# ``FREETYPE_FOUND``
-# true if the Freetype headers and libraries were found
-# ``FREETYPE_INCLUDE_DIRS``
-# directories containing the Freetype headers. This is the
-# concatenation of the variables:
-#
-# ``FREETYPE_INCLUDE_DIR_ft2build``
-# directory holding the main Freetype API configuration header
-# ``FREETYPE_INCLUDE_DIR_freetype2``
-# directory holding Freetype public headers
-# ``FREETYPE_LIBRARIES``
-# the library to link against
-# ``FREETYPE_VERSION_STRING``
-# the version of freetype found (since CMake 2.8.8)
-#
-# Hints
-# ^^^^^
-#
-# The user may set the environment variable ``FREETYPE_DIR`` to the root
-# directory of a Freetype installation.
+#[=======================================================================[.rst:
+FindFreetype
+------------
+
+Find the FreeType font renderer includes and library.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` target:
+
+``Freetype::Freetype``
+ The Freetype ``freetype`` library, if found
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``FREETYPE_FOUND``
+ true if the Freetype headers and libraries were found
+``FREETYPE_INCLUDE_DIRS``
+ directories containing the Freetype headers. This is the
+ concatenation of the variables:
+
+ ``FREETYPE_INCLUDE_DIR_ft2build``
+ directory holding the main Freetype API configuration header
+ ``FREETYPE_INCLUDE_DIR_freetype2``
+ directory holding Freetype public headers
+``FREETYPE_LIBRARIES``
+ the library to link against
+``FREETYPE_VERSION_STRING``
+ the version of freetype found (since CMake 2.8.8)
+
+Hints
+^^^^^
+
+The user may set the environment variable ``FREETYPE_DIR`` to the root
+directory of a Freetype installation.
+#]=======================================================================]
# Created by Eric Wing.
# Modifications by Alexander Neundorf.
diff --git a/Modules/FindGCCXML.cmake b/Modules/FindGCCXML.cmake
index 1f8d738f8..e6c7f2434 100644
--- a/Modules/FindGCCXML.cmake
+++ b/Modules/FindGCCXML.cmake
@@ -1,19 +1,20 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGCCXML
-# ----------
-#
-# Find the GCC-XML front-end executable.
-#
-#
-#
-# This module will define the following variables:
-#
-# ::
-#
-# GCCXML - the GCC-XML front-end executable.
+#[=======================================================================[.rst:
+FindGCCXML
+----------
+
+Find the GCC-XML front-end executable.
+
+
+
+This module will define the following variables:
+
+::
+
+ GCCXML - the GCC-XML front-end executable.
+#]=======================================================================]
find_program(GCCXML
NAMES gccxml
diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake
index ff2976e6a..8522f9b59 100644
--- a/Modules/FindGDAL.cmake
+++ b/Modules/FindGDAL.cmake
@@ -1,31 +1,49 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGDAL
-# --------
-#
-#
-#
-# Locate gdal
-#
-# This module accepts the following environment variables:
-#
-# ::
-#
-# GDAL_DIR or GDAL_ROOT - Specify the location of GDAL
-#
-#
-#
-# This module defines the following CMake variables:
-#
-# ::
-#
-# GDAL_FOUND - True if libgdal is found
-# GDAL_LIBRARY - A variable pointing to the GDAL library
-# GDAL_INCLUDE_DIR - Where to find the headers
+#[=======================================================================[.rst:
+FindGDAL
+--------
+
+Find GDAL.
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``GDAL::GDAL``
+if GDAL has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``GDAL_FOUND``
+ True if GDAL is found.
+``GDAL_INCLUDE_DIRS``
+ Include directories for GDAL headers.
+``GDAL_LIBRARIES``
+ Libraries to link to GDAL.
+``GDAL_VERSION``
+ The version of GDAL found.
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``GDAL_LIBRARY``
+ The libgdal library file.
+``GDAL_INCLUDE_DIR``
+ The directory containing ``gdal.h``.
+
+Hints
+^^^^^
+
+Set ``GDAL_DIR`` or ``GDAL_ROOT`` in the environment to specify the
+GDAL installation prefix.
+#]=======================================================================]
-#
# $GDALDIR is an environment variable that would
# correspond to the ./configure --prefix=$GDAL_DIR
# used in building gdal.
@@ -122,8 +140,26 @@ find_library(GDAL_LIBRARY
PATH_SUFFIXES lib
)
+if (EXISTS "${GDAL_INCLUDE_DIR}/gdal_version.h")
+ file(STRINGS "${GDAL_INCLUDE_DIR}/gdal_version.h" _gdal_version
+ REGEX "GDAL_RELEASE_NAME")
+ string(REGEX REPLACE ".*\"\(.*\)\"" "\\1" GDAL_VERSION "${_gdal_version}")
+ unset(_gdal_version)
+else ()
+ set(GDAL_VERSION GDAL_VERSION-NOTFOUND)
+endif ()
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL DEFAULT_MSG GDAL_LIBRARY GDAL_INCLUDE_DIR)
+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 ()
set(GDAL_LIBRARIES ${GDAL_LIBRARY})
set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index efc397318..9687b57e5 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -1,28 +1,50 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGIF
-# -------
-#
-# This finds the GIF library (giflib)
-#
-# The module defines the following variables:
-#
-# ``GIF_FOUND``
-# True if giflib was found
-# ``GIF_LIBRARIES``
-# Libraries to link to in order to use giflib
-# ``GIF_INCLUDE_DIR``
-# where to find the headers
-# ``GIF_VERSION``
-# 3, 4 or a full version string (eg 5.1.4) for versions >= 4.1.6
-#
-# The minimum required version of giflib can be specified using the
-# standard syntax, e.g. find_package(GIF 4)
-#
-# $GIF_DIR is an environment variable that would correspond to the
-# ./configure --prefix=$GIF_DIR
+#[=======================================================================[.rst:
+FindGIF
+-------
+
+This finds the GIF library (giflib)
+
+Imported targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` target:
+
+``GIF::GIF``
+ The giflib library, if found.
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``GIF_FOUND``
+ If false, do not try to use GIF.
+``GIF_INCLUDE_DIRS``
+ where to find gif_lib.h, etc.
+``GIF_LIBRARIES``
+ the libraries needed to use GIF.
+``GIF_VERSION``
+ 3, 4 or a full version string (eg 5.1.4) for versions >= 4.1.6.
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``GIF_INCLUDE_DIR``
+ where to find the GIF headers.
+``GIF_LIBRARY``
+ where to find the GIF library.
+
+Hints
+^^^^^
+
+``GIF_DIR`` is an environment variable that would correspond to the
+``./configure --prefix=$GIF_DIR``.
+#]=======================================================================]
# Created by Eric Wing.
# Modifications by Alexander Neundorf, Ben Campbell
@@ -43,9 +65,6 @@ find_library(GIF_LIBRARY
PATH_SUFFIXES lib
)
-# see readme.txt
-set(GIF_LIBRARIES ${GIF_LIBRARY})
-
# Very basic version detection.
# The GIF_LIB_VERSION string in gif_lib.h seems to be unreliable, since it seems
# to be always " Version 2.0, " in versions 3.x of giflib.
@@ -89,4 +108,20 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR
VERSION_VAR GIF_VERSION )
+if(GIF_FOUND)
+ set(GIF_INCLUDE_DIRS "${GIF_INCLUDE_DIR}")
+ set(GIF_LIBRARIES ${GIF_LIBRARY})
+
+ if(NOT TARGET GIF::GIF)
+ add_library(GIF::GIF UNKNOWN IMPORTED)
+ set_target_properties(GIF::GIF PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${GIF_INCLUDE_DIRS}")
+ if(EXISTS "${GIF_LIBRARY}")
+ set_target_properties(GIF::GIF PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${GIF_LIBRARY}")
+ endif()
+ endif()
+endif()
+
mark_as_advanced(GIF_INCLUDE_DIR GIF_LIBRARY)
diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index 11e872446..ad8a810b5 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -1,28 +1,29 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGLEW
-# --------
-#
-# Find the OpenGL Extension Wrangler Library (GLEW)
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``,
-# if GLEW has been found.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following variables:
-#
-# ::
-#
-# GLEW_INCLUDE_DIRS - include directories for GLEW
-# GLEW_LIBRARIES - libraries to link against GLEW
-# GLEW_FOUND - true if GLEW has been found and can be used
+#[=======================================================================[.rst:
+FindGLEW
+--------
+
+Find the OpenGL Extension Wrangler Library (GLEW)
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``,
+if GLEW has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+::
+
+ GLEW_INCLUDE_DIRS - include directories for GLEW
+ GLEW_LIBRARIES - libraries to link against GLEW
+ GLEW_FOUND - true if GLEW has been found and can be used
+#]=======================================================================]
find_path(GLEW_INCLUDE_DIR GL/glew.h)
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index 177968387..d42db539f 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -1,38 +1,39 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGLUT
-# --------
-#
-# try to find glut library and include files.
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the :prop_tgt:`IMPORTED` targets:
-#
-# ``GLUT::GLUT``
-# Defined if the system has GLUT.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module sets the following variables:
-#
-# ::
-#
-# GLUT_INCLUDE_DIR, where to find GL/glut.h, etc.
-# GLUT_LIBRARIES, the libraries to link against
-# GLUT_FOUND, If false, do not try to use GLUT.
-#
-# 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.
+#[=======================================================================[.rst:
+FindGLUT
+--------
+
+try to find glut library and include files.
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines the :prop_tgt:`IMPORTED` targets:
+
+``GLUT::GLUT``
+ Defined if the system has GLUT.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module sets the following variables:
+
+::
+
+ GLUT_INCLUDE_DIR, where to find GL/glut.h, etc.
+ GLUT_LIBRARIES, the libraries to link against
+ GLUT_FOUND, If false, do not try to use GLUT.
+
+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.
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake
index 8d10b6ce5..db0512166 100644
--- a/Modules/FindGSL.cmake
+++ b/Modules/FindGSL.cmake
@@ -1,60 +1,61 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGSL
-# --------
-#
-# Find the native GSL includes and libraries.
-#
-# The GNU Scientific Library (GSL) is a numerical library for C and C++
-# programmers. It is free software under the GNU General Public
-# License.
-#
-# Imported Targets
-# ^^^^^^^^^^^^^^^^
-#
-# If GSL is found, this module defines the following :prop_tgt:`IMPORTED`
-# targets::
-#
-# GSL::gsl - The main GSL library.
-# GSL::gslcblas - The CBLAS support library used by GSL.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project::
-#
-# GSL_FOUND - True if GSL found on the local system
-# GSL_INCLUDE_DIRS - Location of GSL header files.
-# GSL_LIBRARIES - The GSL libraries.
-# GSL_VERSION - The version of the discovered GSL install.
-#
-# Hints
-# ^^^^^
-#
-# Set ``GSL_ROOT_DIR`` to a directory that contains a GSL installation.
-#
-# This script expects to find libraries at ``$GSL_ROOT_DIR/lib`` and the GSL
-# headers at ``$GSL_ROOT_DIR/include/gsl``. The library directory may
-# optionally provide Release and Debug folders. If available, the libraries
-# named ``gsld``, ``gslblasd`` or ``cblasd`` are recognized as debug libraries.
-# For Unix-like systems, this script will use ``$GSL_ROOT_DIR/bin/gsl-config``
-# (if found) to aid in the discovery of GSL.
-#
-# Cache Variables
-# ^^^^^^^^^^^^^^^
-#
-# This module may set the following variables depending on platform and type
-# of GSL installation discovered. These variables may optionally be set to
-# help this module find the correct files::
-#
-# GSL_CBLAS_LIBRARY - Location of the GSL CBLAS library.
-# GSL_CBLAS_LIBRARY_DEBUG - Location of the debug GSL CBLAS library (if any).
-# GSL_CONFIG_EXECUTABLE - Location of the ``gsl-config`` script (if any).
-# GSL_LIBRARY - Location of the GSL library.
-# GSL_LIBRARY_DEBUG - Location of the debug GSL library (if any).
-#
+#[=======================================================================[.rst:
+FindGSL
+--------
+
+Find the native GSL includes and libraries.
+
+The GNU Scientific Library (GSL) is a numerical library for C and C++
+programmers. It is free software under the GNU General Public
+License.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+If GSL is found, this module defines the following :prop_tgt:`IMPORTED`
+targets::
+
+ GSL::gsl - The main GSL library.
+ GSL::gslcblas - The CBLAS support library used by GSL.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project::
+
+ GSL_FOUND - True if GSL found on the local system
+ GSL_INCLUDE_DIRS - Location of GSL header files.
+ GSL_LIBRARIES - The GSL libraries.
+ GSL_VERSION - The version of the discovered GSL install.
+
+Hints
+^^^^^
+
+Set ``GSL_ROOT_DIR`` to a directory that contains a GSL installation.
+
+This script expects to find libraries at ``$GSL_ROOT_DIR/lib`` and the GSL
+headers at ``$GSL_ROOT_DIR/include/gsl``. The library directory may
+optionally provide Release and Debug folders. If available, the libraries
+named ``gsld``, ``gslblasd`` or ``cblasd`` are recognized as debug libraries.
+For Unix-like systems, this script will use ``$GSL_ROOT_DIR/bin/gsl-config``
+(if found) to aid in the discovery of GSL.
+
+Cache Variables
+^^^^^^^^^^^^^^^
+
+This module may set the following variables depending on platform and type
+of GSL installation discovered. These variables may optionally be set to
+help this module find the correct files::
+
+ GSL_CBLAS_LIBRARY - Location of the GSL CBLAS library.
+ GSL_CBLAS_LIBRARY_DEBUG - Location of the debug GSL CBLAS library (if any).
+ GSL_CONFIG_EXECUTABLE - Location of the ``gsl-config`` script (if any).
+ GSL_LIBRARY - Location of the GSL library.
+ GSL_LIBRARY_DEBUG - Location of the debug GSL library (if any).
+
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake
index 89fb54baf..8cc6c970d 100644
--- a/Modules/FindGTK.cmake
+++ b/Modules/FindGTK.cmake
@@ -1,18 +1,19 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGTK
-# -------
-#
-# try to find GTK (and glib) and GTKGLArea
-#
-# ::
-#
-# GTK_INCLUDE_DIR - Directories to include to use GTK
-# GTK_LIBRARIES - Files to link against to use GTK
-# GTK_FOUND - GTK was found
-# GTK_GL_FOUND - GTK's GL features were found
+#[=======================================================================[.rst:
+FindGTK
+-------
+
+try to find GTK (and glib) and GTKGLArea
+
+::
+
+ GTK_INCLUDE_DIR - Directories to include to use GTK
+ GTK_LIBRARIES - Files to link against to use GTK
+ GTK_FOUND - GTK was found
+ GTK_GL_FOUND - GTK's GL features were found
+#]=======================================================================]
# don't even bother under WIN32
if(UNIX)
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 15d123059..6c1897cae 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -1,102 +1,103 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGTK2
-# --------
-#
-# FindGTK2.cmake
-#
-# This module can find the GTK2 widget libraries and several of its
-# other optional components like gtkmm, glade, and glademm.
-#
-# NOTE: If you intend to use version checking, CMake 2.6.2 or later is
-#
-# ::
-#
-# required.
-#
-#
-#
-# Specify one or more of the following components as you call this find
-# module. See example below.
-#
-# ::
-#
-# gtk
-# gtkmm
-# glade
-# glademm
-#
-#
-#
-# The following variables will be defined for your use
-#
-# ::
-#
-# GTK2_FOUND - Were all of your specified components found?
-# GTK2_INCLUDE_DIRS - All include directories
-# GTK2_LIBRARIES - All libraries
-# GTK2_TARGETS - All imported targets
-# GTK2_DEFINITIONS - Additional compiler flags
-#
-#
-#
-# ::
-#
-# GTK2_VERSION - The version of GTK2 found (x.y.z)
-# GTK2_MAJOR_VERSION - The major version of GTK2
-# GTK2_MINOR_VERSION - The minor version of GTK2
-# GTK2_PATCH_VERSION - The patch version of GTK2
-#
-#
-#
-# Optional variables you can define prior to calling this module:
-#
-# ::
-#
-# GTK2_DEBUG - Enables verbose debugging of the module
-# GTK2_ADDITIONAL_SUFFIXES - Allows defining additional directories to
-# search for include files
-#
-#
-#
-# ================= Example Usage:
-#
-# ::
-#
-# Call find_package() once, here are some examples to pick from:
-#
-#
-#
-# ::
-#
-# Require GTK 2.6 or later
-# find_package(GTK2 2.6 REQUIRED gtk)
-#
-#
-#
-# ::
-#
-# Require GTK 2.10 or later and Glade
-# find_package(GTK2 2.10 REQUIRED gtk glade)
-#
-#
-#
-# ::
-#
-# Search for GTK/GTKMM 2.8 or later
-# find_package(GTK2 2.8 COMPONENTS gtk gtkmm)
-#
-#
-#
-# ::
-#
-# if(GTK2_FOUND)
-# include_directories(${GTK2_INCLUDE_DIRS})
-# add_executable(mygui mygui.cc)
-# target_link_libraries(mygui ${GTK2_LIBRARIES})
-# endif()
+#[=======================================================================[.rst:
+FindGTK2
+--------
+
+FindGTK2.cmake
+
+This module can find the GTK2 widget libraries and several of its
+other optional components like gtkmm, glade, and glademm.
+
+NOTE: If you intend to use version checking, CMake 2.6.2 or later is
+
+::
+
+ required.
+
+
+
+Specify one or more of the following components as you call this find
+module. See example below.
+
+::
+
+ gtk
+ gtkmm
+ glade
+ glademm
+
+
+
+The following variables will be defined for your use
+
+::
+
+ GTK2_FOUND - Were all of your specified components found?
+ GTK2_INCLUDE_DIRS - All include directories
+ GTK2_LIBRARIES - All libraries
+ GTK2_TARGETS - All imported targets
+ GTK2_DEFINITIONS - Additional compiler flags
+
+
+
+::
+
+ GTK2_VERSION - The version of GTK2 found (x.y.z)
+ GTK2_MAJOR_VERSION - The major version of GTK2
+ GTK2_MINOR_VERSION - The minor version of GTK2
+ GTK2_PATCH_VERSION - The patch version of GTK2
+
+
+
+Optional variables you can define prior to calling this module:
+
+::
+
+ GTK2_DEBUG - Enables verbose debugging of the module
+ GTK2_ADDITIONAL_SUFFIXES - Allows defining additional directories to
+ search for include files
+
+
+
+================= Example Usage:
+
+::
+
+ Call find_package() once, here are some examples to pick from:
+
+
+
+::
+
+ Require GTK 2.6 or later
+ find_package(GTK2 2.6 REQUIRED gtk)
+
+
+
+::
+
+ Require GTK 2.10 or later and Glade
+ find_package(GTK2 2.10 REQUIRED gtk glade)
+
+
+
+::
+
+ Search for GTK/GTKMM 2.8 or later
+ find_package(GTK2 2.8 COMPONENTS gtk gtkmm)
+
+
+
+::
+
+ if(GTK2_FOUND)
+ include_directories(${GTK2_INCLUDE_DIRS})
+ add_executable(mygui mygui.cc)
+ target_link_libraries(mygui ${GTK2_LIBRARIES})
+ endif()
+#]=======================================================================]
# Version 1.6 (CMake 3.0)
# * Create targets for each library
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index b0579d967..b0175febc 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -1,77 +1,78 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGTest
-# ---------
-#
-# Locate the Google C++ Testing Framework.
-#
-# Imported targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following :prop_tgt:`IMPORTED` targets:
-#
-# ``GTest::GTest``
-# The Google Test ``gtest`` library, if found; adds Thread::Thread
-# automatically
-# ``GTest::Main``
-# The Google Test ``gtest_main`` library, if found
-#
-#
-# Result variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project:
-#
-# ``GTEST_FOUND``
-# Found the Google Testing framework
-# ``GTEST_INCLUDE_DIRS``
-# the directory containing the Google Test headers
-#
-# The library variables below are set as normal variables. These
-# contain debug/optimized keywords when a debugging library is found.
-#
-# ``GTEST_LIBRARIES``
-# The Google Test ``gtest`` library; note it also requires linking
-# with an appropriate thread library
-# ``GTEST_MAIN_LIBRARIES``
-# The Google Test ``gtest_main`` library
-# ``GTEST_BOTH_LIBRARIES``
-# Both ``gtest`` and ``gtest_main``
-#
-# Cache variables
-# ^^^^^^^^^^^^^^^
-#
-# The following cache variables may also be set:
-#
-# ``GTEST_ROOT``
-# The root directory of the Google Test installation (may also be
-# set as an environment variable)
-# ``GTEST_MSVC_SEARCH``
-# If compiling with MSVC, this variable can be set to ``MT`` or
-# ``MD`` (the default) to enable searching a GTest build tree
-#
-#
-# Example usage
-# ^^^^^^^^^^^^^
-#
-# ::
-#
-# enable_testing()
-# find_package(GTest REQUIRED)
-#
-# add_executable(foo foo.cc)
-# target_link_libraries(foo GTest::GTest GTest::Main)
-#
-# add_test(AllTestsInFoo foo)
-#
-#
-# Deeper integration with CTest
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# See :module:`GoogleTest` for information on the :command:`gtest_add_tests`
-# and :command:`gtest_discover_tests` commands.
+#[=======================================================================[.rst:
+FindGTest
+---------
+
+Locate the Google C++ Testing Framework.
+
+Imported targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` targets:
+
+``GTest::GTest``
+ The Google Test ``gtest`` library, if found; adds Thread::Thread
+ automatically
+``GTest::Main``
+ The Google Test ``gtest_main`` library, if found
+
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``GTEST_FOUND``
+ Found the Google Testing framework
+``GTEST_INCLUDE_DIRS``
+ the directory containing the Google Test headers
+
+The library variables below are set as normal variables. These
+contain debug/optimized keywords when a debugging library is found.
+
+``GTEST_LIBRARIES``
+ The Google Test ``gtest`` library; note it also requires linking
+ with an appropriate thread library
+``GTEST_MAIN_LIBRARIES``
+ The Google Test ``gtest_main`` library
+``GTEST_BOTH_LIBRARIES``
+ Both ``gtest`` and ``gtest_main``
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``GTEST_ROOT``
+ The root directory of the Google Test installation (may also be
+ set as an environment variable)
+``GTEST_MSVC_SEARCH``
+ If compiling with MSVC, this variable can be set to ``MT`` or
+ ``MD`` (the default) to enable searching a GTest build tree
+
+
+Example usage
+^^^^^^^^^^^^^
+
+::
+
+ enable_testing()
+ find_package(GTest REQUIRED)
+
+ add_executable(foo foo.cc)
+ target_link_libraries(foo GTest::GTest GTest::Main)
+
+ add_test(AllTestsInFoo foo)
+
+
+Deeper integration with CTest
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+See :module:`GoogleTest` for information on the :command:`gtest_add_tests`
+and :command:`gtest_discover_tests` commands.
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/GoogleTest.cmake)
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake
index 9623b85dd..9e29e8d2d 100644
--- a/Modules/FindGettext.cmake
+++ b/Modules/FindGettext.cmake
@@ -1,61 +1,62 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGettext
-# -----------
-#
-# Find GNU gettext tools
-#
-# This module looks for the GNU gettext tools. This module defines the
-# following values:
-#
-# ::
-#
-# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
-# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
-# GETTEXT_FOUND: True if gettext has been found.
-# GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8)
-#
-#
-#
-# Additionally it provides the following macros:
-#
-# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
-#
-# ::
-#
-# This will create a target "translations" which will convert the
-# given input po files into the binary output mo file. If the
-# ALL option is used, the translations will also be created when
-# building the default target.
-#
-# GETTEXT_PROCESS_POT_FILE( <potfile> [ALL] [INSTALL_DESTINATION <destdir>]
-# LANGUAGES <lang1> <lang2> ... )
-#
-# ::
-#
-# Process the given pot file to mo files.
-# If INSTALL_DESTINATION is given then automatically install rules will
-# be created, the language subdirectory will be taken into account
-# (by default use share/locale/).
-# If ALL is specified, the pot file is processed when building the all traget.
-# It creates a custom target "potfile".
-#
-# GETTEXT_PROCESS_PO_FILES( <lang> [ALL] [INSTALL_DESTINATION <dir>]
-# PO_FILES <po1> <po2> ... )
-#
-# ::
-#
-# Process the given po files to mo files for the given language.
-# If INSTALL_DESTINATION is given then automatically install rules will
-# be created, the language subdirectory will be taken into account
-# (by default use share/locale/).
-# If ALL is specified, the po files are processed when building the all traget.
-# It creates a custom target "pofiles".
-#
-# .. note::
-# If you wish to use the Gettext library (libintl), use :module:`FindIntl`.
+#[=======================================================================[.rst:
+FindGettext
+-----------
+
+Find GNU gettext tools
+
+This module looks for the GNU gettext tools. This module defines the
+following values:
+
+::
+
+ GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
+ GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
+ GETTEXT_FOUND: True if gettext has been found.
+ GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8)
+
+
+
+Additionally it provides the following macros:
+
+GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
+
+::
+
+ This will create a target "translations" which will convert the
+ given input po files into the binary output mo file. If the
+ ALL option is used, the translations will also be created when
+ building the default target.
+
+GETTEXT_PROCESS_POT_FILE( <potfile> [ALL] [INSTALL_DESTINATION <destdir>]
+LANGUAGES <lang1> <lang2> ... )
+
+::
+
+ Process the given pot file to mo files.
+ If INSTALL_DESTINATION is given then automatically install rules will
+ be created, the language subdirectory will be taken into account
+ (by default use share/locale/).
+ If ALL is specified, the pot file is processed when building the all traget.
+ It creates a custom target "potfile".
+
+GETTEXT_PROCESS_PO_FILES( <lang> [ALL] [INSTALL_DESTINATION <dir>]
+PO_FILES <po1> <po2> ... )
+
+::
+
+ Process the given po files to mo files for the given language.
+ If INSTALL_DESTINATION is given then automatically install rules will
+ be created, the language subdirectory will be taken into account
+ (by default use share/locale/).
+ If ALL is specified, the po files are processed when building the all traget.
+ It creates a custom target "pofiles".
+
+.. note::
+ If you wish to use the Gettext library (libintl), use :module:`FindIntl`.
+#]=======================================================================]
find_program(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
index fae31eb83..3491cdcc2 100644
--- a/Modules/FindGit.cmake
+++ b/Modules/FindGit.cmake
@@ -1,27 +1,34 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGit
-# -------
-#
-# The module defines the following variables:
-#
-# ``GIT_EXECUTABLE``
-# Path to Git command-line client.
-# ``Git_FOUND``, ``GIT_FOUND``
-# True if the Git command-line client was found.
-# ``GIT_VERSION_STRING``
-# The version of Git found.
-#
-# Example usage:
-#
-# .. code-block:: cmake
-#
-# find_package(Git)
-# if(Git_FOUND)
-# message("Git found: ${GIT_EXECUTABLE}")
-# endif()
+#[=======================================================================[.rst:
+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``
+ Path to Git command-line client.
+``Git_FOUND``, ``GIT_FOUND``
+ True if the Git command-line client was found.
+``GIT_VERSION_STRING``
+ The version of Git found.
+
+Example usage:
+
+.. code-block:: cmake
+
+ find_package(Git)
+ if(Git_FOUND)
+ message("Git found: ${GIT_EXECUTABLE}")
+ endif()
+#]=======================================================================]
# Look for 'git' or 'eg' (easy git)
#
@@ -77,6 +84,12 @@ if(GIT_EXECUTABLE)
string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
endif()
unset(git_version)
+
+ 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()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake
index 1a97d99ea..9c0744415 100644
--- a/Modules/FindGnuTLS.cmake
+++ b/Modules/FindGnuTLS.cmake
@@ -1,22 +1,23 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGnuTLS
-# ----------
-#
-# Try to find the GNU Transport Layer Security library (gnutls)
-#
-#
-#
-# Once done this will define
-#
-# ::
-#
-# GNUTLS_FOUND - System has gnutls
-# GNUTLS_INCLUDE_DIR - The gnutls include directory
-# GNUTLS_LIBRARIES - The libraries needed to use gnutls
-# GNUTLS_DEFINITIONS - Compiler switches required for using gnutls
+#[=======================================================================[.rst:
+FindGnuTLS
+----------
+
+Try to find the GNU Transport Layer Security library (gnutls)
+
+
+
+Once done this will define
+
+::
+
+ GNUTLS_FOUND - System has gnutls
+ GNUTLS_INCLUDE_DIR - The gnutls include directory
+ GNUTLS_LIBRARIES - The libraries needed to use gnutls
+ GNUTLS_DEFINITIONS - Compiler switches required for using gnutls
+#]=======================================================================]
# Note that this doesn't try to find the gnutls-extra package.
diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake
index aa4cd6c26..ca2467d68 100644
--- a/Modules/FindGnuplot.cmake
+++ b/Modules/FindGnuplot.cmake
@@ -1,25 +1,26 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindGnuplot
-# -----------
-#
-# this module looks for gnuplot
-#
-#
-#
-# Once done this will define
-#
-# ::
-#
-# GNUPLOT_FOUND - system has Gnuplot
-# GNUPLOT_EXECUTABLE - the Gnuplot executable
-# GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8)
-#
-#
-#
-# GNUPLOT_VERSION_STRING will not work for old versions like 3.7.1.
+#[=======================================================================[.rst:
+FindGnuplot
+-----------
+
+this module looks for gnuplot
+
+
+
+Once done this will define
+
+::
+
+ GNUPLOT_FOUND - system has Gnuplot
+ GNUPLOT_EXECUTABLE - the Gnuplot executable
+ GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8)
+
+
+
+GNUPLOT_VERSION_STRING will not work for old versions like 3.7.1.
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 41b10025b..70bfc96f1 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -1,109 +1,130 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindHDF5
-# --------
-#
-# Find HDF5, a library for reading and writing self describing array data.
-#
-#
-#
-# This module invokes the HDF5 wrapper compiler that should be installed
-# alongside HDF5. Depending upon the HDF5 Configuration, the wrapper
-# compiler is called either h5cc or h5pcc. If this succeeds, the module
-# will then call the compiler with the -show argument to see what flags
-# are used when compiling an HDF5 client application.
-#
-# The module will optionally accept the COMPONENTS argument. If no
-# COMPONENTS are specified, then the find module will default to finding
-# only the HDF5 C library. If one or more COMPONENTS are specified, the
-# module will attempt to find the language bindings for the specified
-# components. The only valid components are C, CXX, Fortran, HL, and
-# Fortran_HL. If the COMPONENTS argument is not given, the module will
-# attempt to find only the C bindings.
-#
-# This module will read the variable
-# HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a
-# 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.
-#
-# To provide the module with a hint about where to find your HDF5
-# installation, you can set the environment variable HDF5_ROOT. The
-# Find module will then look in this path when searching for HDF5
-# executables, paths, and libraries.
-#
-# 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
-# behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to
-# true.
-#
-# In addition to finding the includes and libraries required to compile
-# an HDF5 client application, this module also makes an effort to find
-# tools that come with the HDF5 distribution that may be useful for
-# regression testing.
-#
-# This module will define the following variables:
-#
-# ::
-#
-# HDF5_FOUND - true if HDF5 was found on the system
-# HDF5_VERSION - HDF5 version in format Major.Minor.Release
-# HDF5_INCLUDE_DIRS - Location of the hdf5 includes
-# HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated)
-# HDF5_DEFINITIONS - Required compiler definitions for HDF5
-# HDF5_LIBRARIES - Required libraries for all requested bindings
-# HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API for all
-# bindings, if the HL component is enabled
-#
-# Available components are: C CXX Fortran and HL. For each enabled language
-# binding, a corresponding HDF5_${LANG}_LIBRARIES variable, and potentially
-# HDF5_${LANG}_DEFINITIONS, will be defined.
-# If the HL component is enabled, then an HDF5_${LANG}_HL_LIBRARIES will
-# also be defined. With all components enabled, the following variables will be defined:
-#
-# ::
-#
-# HDF5_C_DEFINITIONS -- Required compiler definitions for HDF5 C bindings
-# HDF5_CXX_DEFINITIONS -- Required compiler definitions for HDF5 C++ bindings
-# HDF5_Fortran_DEFINITIONS -- Required compiler definitions for HDF5 Fortran bindings
-# HDF5_C_INCLUDE_DIRS -- Required include directories for HDF5 C bindings
-# HDF5_CXX_INCLUDE_DIRS -- Required include directories for HDF5 C++ bindings
-# HDF5_Fortran_INCLUDE_DIRS -- Required include directories for HDF5 Fortran bindings
-# HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings
-# HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings
-# HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings
-# HDF5_C_HL_LIBRARIES - Required libraries for the high level C bindings
-# HDF5_CXX_HL_LIBRARIES - Required libraries for the high level C++ bindings
-# HDF5_Fortran_HL_LIBRARIES - Required libraries for the high level Fortran
-# bindings.
-#
-# HDF5_IS_PARALLEL - Whether or not HDF5 was found with parallel IO support
-# HDF5_C_COMPILER_EXECUTABLE - the path to the HDF5 C wrapper compiler
-# HDF5_CXX_COMPILER_EXECUTABLE - the path to the HDF5 C++ wrapper compiler
-# HDF5_Fortran_COMPILER_EXECUTABLE - the path to the HDF5 Fortran wrapper compiler
-# HDF5_C_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C compiler
-# which is also the HDF5 wrapper
-# HDF5_CXX_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C++
-# compiler which is also
-# the HDF5 wrapper
-# HDF5_Fortran_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary
-# Fortran compiler which
-# is also the HDF5 wrapper
-# HDF5_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool
-#
-# The following variable can be set to guide the search for HDF5 libraries and includes:
-#
-# ``HDF5_ROOT``
-# Specify the path to the HDF5 installation to use.
-#
-# ``HDF5_FIND_DEBUG``
-# Set to a true value to get some extra debugging output.
-#
-# ``HDF5_NO_FIND_PACKAGE_CONFIG_FILE``
-# Set to a true value to skip trying to find ``hdf5-config.cmake``.
+#[=======================================================================[.rst:
+FindHDF5
+--------
+
+Find HDF5, a library for reading and writing self describing array data.
+
+
+This module invokes the HDF5 wrapper compiler that should be installed
+alongside HDF5. Depending upon the HDF5 Configuration, the wrapper
+compiler is called either h5cc or h5pcc. If this succeeds, the module
+will then call the compiler with the -show argument to see what flags
+are used when compiling an HDF5 client application.
+
+The module will optionally accept the COMPONENTS argument. If no
+COMPONENTS are specified, then the find module will default to finding
+only the HDF5 C library. If one or more COMPONENTS are specified, the
+module will attempt to find the language bindings for the specified
+components. The only valid components are C, CXX, Fortran, HL, and
+Fortran_HL. If the COMPONENTS argument is not given, the module will
+attempt to find only the C bindings.
+
+This module will read the variable
+HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a
+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.
+
+To provide the module with a hint about where to find your HDF5
+installation, you can set the environment variable HDF5_ROOT. The
+Find module will then look in this path when searching for HDF5
+executables, paths, and libraries.
+
+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
+behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to
+true.
+
+In addition to finding the includes and libraries required to compile
+an HDF5 client application, this module also makes an effort to find
+tools that come with the HDF5 distribution that may be useful for
+regression testing.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``HDF5_FOUND``
+ HDF5 was found on the system
+``HDF5_VERSION``
+ HDF5 library version
+``HDF5_INCLUDE_DIRS``
+ Location of the HDF5 header files
+``HDF5_DEFINITIONS``
+ Required compiler definitions for HDF5
+``HDF5_LIBRARIES``
+ Required libraries for all requested bindings
+``HDF5_HL_LIBRARIES``
+ Required libraries for the HDF5 high level API for all bindings,
+ if the ``HL`` component is enabled
+
+Available components are: ``C`` ``CXX`` ``Fortran`` and ``HL``.
+For each enabled language binding, a corresponding ``HDF5_${LANG}_LIBRARIES``
+variable, and potentially ``HDF5_${LANG}_DEFINITIONS``, will be defined.
+If the ``HL`` component is enabled, then an ``HDF5_${LANG}_HL_LIBRARIES`` will
+also be defined. With all components enabled, the following variables will be defined:
+
+``HDF5_C_DEFINITIONS``
+ Required compiler definitions for HDF5 C bindings
+``HDF5_CXX_DEFINITIONS``
+ Required compiler definitions for HDF5 C++ bindings
+``HDF5_Fortran_DEFINITIONS``
+ Required compiler definitions for HDF5 Fortran bindings
+``HDF5_C_INCLUDE_DIRS``
+ Required include directories for HDF5 C bindings
+``HDF5_CXX_INCLUDE_DIRS``
+ Required include directories for HDF5 C++ bindings
+``HDF5_Fortran_INCLUDE_DIRS``
+ Required include directories for HDF5 Fortran bindings
+``HDF5_C_LIBRARIES``
+ Required libraries for the HDF5 C bindings
+``HDF5_CXX_LIBRARIES``
+ Required libraries for the HDF5 C++ bindings
+``HDF5_Fortran_LIBRARIES``
+ Required libraries for the HDF5 Fortran bindings
+``HDF5_C_HL_LIBRARIES``
+ Required libraries for the high level C bindings
+``HDF5_CXX_HL_LIBRARIES``
+ Required libraries for the high level C++ bindings
+``HDF5_Fortran_HL_LIBRARIES``
+ Required libraries for the high level Fortran bindings.
+
+``HDF5_IS_PARALLEL``
+ HDF5 library has parallel IO support
+``HDF5_C_COMPILER_EXECUTABLE``
+ path to the HDF5 C wrapper compiler
+``HDF5_CXX_COMPILER_EXECUTABLE``
+ path to the HDF5 C++ wrapper compiler
+``HDF5_Fortran_COMPILER_EXECUTABLE``
+ path to the HDF5 Fortran wrapper compiler
+``HDF5_C_COMPILER_EXECUTABLE_NO_INTERROGATE``
+ path to the primary C compiler which is also the HDF5 wrapper
+``HDF5_CXX_COMPILER_EXECUTABLE_NO_INTERROGATE``
+ path to the primary C++ compiler which is also the HDF5 wrapper
+``HDF5_Fortran_COMPILER_EXECUTABLE_NO_INTERROGATE``
+ path to the primary Fortran compiler which is also the HDF5 wrapper
+``HDF5_DIFF_EXECUTABLE``
+ path to the HDF5 dataset comparison tool
+
+Hints
+^^^^^
+
+The following variable can be set to guide the search for HDF5 libraries and includes:
+
+``HDF5_ROOT``
+ Specify the path to the HDF5 installation to use.
+
+``HDF5_FIND_DEBUG``
+ Set ``true`` to get extra debugging output.
+
+``HDF5_NO_FIND_PACKAGE_CONFIG_FILE``
+ Set ``true`` to skip trying to find ``hdf5-config.cmake``.
+#]=======================================================================]
# This module is maintained by Will Dicharry <wdicharry@stellarscience.com>.
@@ -321,20 +342,22 @@ macro( _HDF5_invoke_compiler language output return_value version is_parallel)
elseif("${language}" STREQUAL "Fortran")
set(test_file ${scratch_dir}/cmake_hdf5_test.f90)
endif()
- exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE}
- ARGS -show ${lib_type_args} ${test_file}
- OUTPUT_VARIABLE ${output}
- RETURN_VALUE ${return_value}
- )
+ execute_process(
+ COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} -show ${lib_type_args} ${test_file}
+ OUTPUT_VARIABLE ${output}
+ ERROR_VARIABLE ${output}
+ RESULT_VARIABLE ${return_value}
+ )
if(NOT ${${return_value}} EQUAL 0)
message(STATUS
"Unable to determine HDF5 ${language} flags from HDF5 wrapper.")
endif()
- exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE}
- ARGS -showconfig
- OUTPUT_VARIABLE config_output
- RETURN_VALUE config_return
- )
+ execute_process(
+ COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} -showconfig
+ OUTPUT_VARIABLE config_output
+ ERROR_VARIABLE config_output
+ RESULT_VARIABLE config_return
+ )
if(NOT ${return_value} EQUAL 0)
message( STATUS
"Unable to determine HDF5 ${language} version from HDF5 wrapper.")
@@ -817,7 +840,7 @@ if( NOT HDF5_FOUND )
set( THIS_LIBRARY_SEARCH_DEBUG
lib${LIB}d.a lib${LIB}_debug.a lib${LIB}d lib${LIB}_D lib${LIB}_debug
lib${LIB}d-static.a lib${LIB}_debug-static.a lib${LIB}d-static lib${LIB}_D-static lib${LIB}_debug-static )
- set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} lib${LIB}-static.a lib${LIB}-static)
+ set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a lib${LIB} lib${LIB}-static.a lib${LIB}-static)
else()
set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_D ${LIB}_debug ${LIB}d-shared ${LIB}_D-shared ${LIB}_debug-shared)
set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared)
diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake
index bb0e2f08e..ec077a5d0 100644
--- a/Modules/FindHSPELL.cmake
+++ b/Modules/FindHSPELL.cmake
@@ -1,28 +1,29 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindHSPELL
-# ----------
-#
-# Try to find Hspell
-#
-# Once done this will define
-#
-# ::
-#
-# HSPELL_FOUND - system has Hspell
-# HSPELL_INCLUDE_DIR - the Hspell include directory
-# HSPELL_LIBRARIES - The libraries needed to use Hspell
-# HSPELL_DEFINITIONS - Compiler switches required for using Hspell
-#
-#
-#
-# ::
-#
-# HSPELL_VERSION_STRING - The version of Hspell found (x.y)
-# HSPELL_MAJOR_VERSION - the major version of Hspell
-# HSPELL_MINOR_VERSION - The minor version of Hspell
+#[=======================================================================[.rst:
+FindHSPELL
+----------
+
+Try to find Hspell
+
+Once done this will define
+
+::
+
+ HSPELL_FOUND - system has Hspell
+ HSPELL_INCLUDE_DIR - the Hspell include directory
+ HSPELL_LIBRARIES - The libraries needed to use Hspell
+ HSPELL_DEFINITIONS - Compiler switches required for using Hspell
+
+
+
+::
+
+ HSPELL_VERSION_STRING - The version of Hspell found (x.y)
+ HSPELL_MAJOR_VERSION - the major version of Hspell
+ HSPELL_MINOR_VERSION - The minor version of Hspell
+#]=======================================================================]
find_path(HSPELL_INCLUDE_DIR hspell.h)
diff --git a/Modules/FindHTMLHelp.cmake b/Modules/FindHTMLHelp.cmake
index 6aab8a712..a11ad4d69 100644
--- a/Modules/FindHTMLHelp.cmake
+++ b/Modules/FindHTMLHelp.cmake
@@ -1,19 +1,20 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindHTMLHelp
-# ------------
-#
-# This module looks for Microsoft HTML Help Compiler
-#
-# It defines:
-#
-# ::
-#
-# HTML_HELP_COMPILER : full path to the Compiler (hhc.exe)
-# HTML_HELP_INCLUDE_PATH : include path to the API (htmlhelp.h)
-# HTML_HELP_LIBRARY : full path to the library (htmlhelp.lib)
+#[=======================================================================[.rst:
+FindHTMLHelp
+------------
+
+This module looks for Microsoft HTML Help Compiler
+
+It defines:
+
+::
+
+ HTML_HELP_COMPILER : full path to the Compiler (hhc.exe)
+ HTML_HELP_INCLUDE_PATH : include path to the API (htmlhelp.h)
+ HTML_HELP_LIBRARY : full path to the library (htmlhelp.lib)
+#]=======================================================================]
if(WIN32)
diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake
index 8aa553e79..1358363d2 100644
--- a/Modules/FindHg.cmake
+++ b/Modules/FindHg.cmake
@@ -1,45 +1,46 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindHg
-# ------
-#
-# Extract information from a mercurial working copy.
-#
-# The module defines the following variables:
-#
-# ::
-#
-# HG_EXECUTABLE - path to mercurial command line client (hg)
-# HG_FOUND - true if the command line client was found
-# HG_VERSION_STRING - the version of mercurial found
-#
-# If the command line client executable is found the following macro is defined:
-#
-# ::
-#
-# HG_WC_INFO(<dir> <var-prefix>)
-#
-# Hg_WC_INFO extracts information of a mercurial working copy
-# at a given location. This macro defines the following variables:
-#
-# ::
-#
-# <var-prefix>_WC_CHANGESET - current changeset
-# <var-prefix>_WC_REVISION - current revision
-#
-# Example usage:
-#
-# ::
-#
-# find_package(Hg)
-# if(HG_FOUND)
-# message("hg found: ${HG_EXECUTABLE}")
-# HG_WC_INFO(${PROJECT_SOURCE_DIR} Project)
-# message("Current revision is ${Project_WC_REVISION}")
-# message("Current changeset is ${Project_WC_CHANGESET}")
-# endif()
+#[=======================================================================[.rst:
+FindHg
+------
+
+Extract information from a mercurial working copy.
+
+The module defines the following variables:
+
+::
+
+ HG_EXECUTABLE - path to mercurial command line client (hg)
+ HG_FOUND - true if the command line client was found
+ HG_VERSION_STRING - the version of mercurial found
+
+If the command line client executable is found the following macro is defined:
+
+::
+
+ HG_WC_INFO(<dir> <var-prefix>)
+
+Hg_WC_INFO extracts information of a mercurial working copy
+at a given location. This macro defines the following variables:
+
+::
+
+ <var-prefix>_WC_CHANGESET - current changeset
+ <var-prefix>_WC_REVISION - current revision
+
+Example usage:
+
+::
+
+ find_package(Hg)
+ if(HG_FOUND)
+ message("hg found: ${HG_EXECUTABLE}")
+ HG_WC_INFO(${PROJECT_SOURCE_DIR} Project)
+ message("Current revision is ${Project_WC_REVISION}")
+ message("Current changeset is ${Project_WC_CHANGESET}")
+ endif()
+#]=======================================================================]
find_program(HG_EXECUTABLE
NAMES hg
diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake
index aa531d522..e4b4909b5 100644
--- a/Modules/FindICU.cmake
+++ b/Modules/FindICU.cmake
@@ -1,89 +1,90 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindICU
-# -------
-#
-# Find the International Components for Unicode (ICU) libraries and
-# programs.
-#
-# This module supports multiple components.
-# Components can include any of: ``data``, ``i18n``, ``io``, ``le``,
-# ``lx``, ``test``, ``tu`` and ``uc``.
-#
-# Note that on Windows ``data`` is named ``dt`` and ``i18n`` is named
-# ``in``; any of the names may be used, and the appropriate
-# platform-specific library name will be automatically selected.
-#
-# This module reports information about the ICU installation in
-# several variables. General variables::
-#
-# ICU_VERSION - ICU release version
-# ICU_FOUND - true if the main programs and libraries were found
-# ICU_LIBRARIES - component libraries to be linked
-# ICU_INCLUDE_DIRS - the directories containing the ICU headers
-#
-# Imported targets::
-#
-# ICU::<C>
-#
-# Where ``<C>`` is the name of an ICU component, for example
-# ``ICU::i18n``.
-#
-# ICU programs are reported in::
-#
-# ICU_GENCNVAL_EXECUTABLE - path to gencnval executable
-# ICU_ICUINFO_EXECUTABLE - path to icuinfo executable
-# ICU_GENBRK_EXECUTABLE - path to genbrk executable
-# ICU_ICU-CONFIG_EXECUTABLE - path to icu-config executable
-# ICU_GENRB_EXECUTABLE - path to genrb executable
-# ICU_GENDICT_EXECUTABLE - path to gendict executable
-# ICU_DERB_EXECUTABLE - path to derb executable
-# ICU_PKGDATA_EXECUTABLE - path to pkgdata executable
-# ICU_UCONV_EXECUTABLE - path to uconv executable
-# ICU_GENCFU_EXECUTABLE - path to gencfu executable
-# ICU_MAKECONV_EXECUTABLE - path to makeconv executable
-# ICU_GENNORM2_EXECUTABLE - path to gennorm2 executable
-# ICU_GENCCODE_EXECUTABLE - path to genccode executable
-# ICU_GENSPREP_EXECUTABLE - path to gensprep executable
-# ICU_ICUPKG_EXECUTABLE - path to icupkg executable
-# ICU_GENCMN_EXECUTABLE - path to gencmn executable
-#
-# ICU component libraries are reported in::
-#
-# ICU_<C>_FOUND - ON if component was found
-# ICU_<C>_LIBRARIES - libraries for component
-#
-# 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
-#
-# The environment variable ``ICU_ROOT`` may also be used; the
-# ICU_ROOT variable takes precedence.
-#
-# The following cache variables may also be set::
-#
-# ICU_<P>_EXECUTABLE - the path to executable <P>
-# ICU_INCLUDE_DIR - the directory containing the ICU headers
-# ICU_<C>_LIBRARY - the library for component <C>
-#
-# .. note::
-#
-# In most cases none of the above variables will require setting,
-# unless multiple ICU versions are available and a specific version
-# is required.
-#
-# Other variables one may set to control this module are::
-#
-# ICU_DEBUG - Set to ON to enable debug output from FindICU.
+#[=======================================================================[.rst:
+FindICU
+-------
+
+Find the International Components for Unicode (ICU) libraries and
+programs.
+
+This module supports multiple components.
+Components can include any of: ``data``, ``i18n``, ``io``, ``le``,
+``lx``, ``test``, ``tu`` and ``uc``.
+
+Note that on Windows ``data`` is named ``dt`` and ``i18n`` is named
+``in``; any of the names may be used, and the appropriate
+platform-specific library name will be automatically selected.
+
+This module reports information about the ICU installation in
+several variables. General variables::
+
+ ICU_VERSION - ICU release version
+ ICU_FOUND - true if the main programs and libraries were found
+ ICU_LIBRARIES - component libraries to be linked
+ ICU_INCLUDE_DIRS - the directories containing the ICU headers
+
+Imported targets::
+
+ ICU::<C>
+
+Where ``<C>`` is the name of an ICU component, for example
+``ICU::i18n``.
+
+ICU programs are reported in::
+
+ ICU_GENCNVAL_EXECUTABLE - path to gencnval executable
+ ICU_ICUINFO_EXECUTABLE - path to icuinfo executable
+ ICU_GENBRK_EXECUTABLE - path to genbrk executable
+ ICU_ICU-CONFIG_EXECUTABLE - path to icu-config executable
+ ICU_GENRB_EXECUTABLE - path to genrb executable
+ ICU_GENDICT_EXECUTABLE - path to gendict executable
+ ICU_DERB_EXECUTABLE - path to derb executable
+ ICU_PKGDATA_EXECUTABLE - path to pkgdata executable
+ ICU_UCONV_EXECUTABLE - path to uconv executable
+ ICU_GENCFU_EXECUTABLE - path to gencfu executable
+ ICU_MAKECONV_EXECUTABLE - path to makeconv executable
+ ICU_GENNORM2_EXECUTABLE - path to gennorm2 executable
+ ICU_GENCCODE_EXECUTABLE - path to genccode executable
+ ICU_GENSPREP_EXECUTABLE - path to gensprep executable
+ ICU_ICUPKG_EXECUTABLE - path to icupkg executable
+ ICU_GENCMN_EXECUTABLE - path to gencmn executable
+
+ICU component libraries are reported in::
+
+ ICU_<C>_FOUND - ON if component was found
+ ICU_<C>_LIBRARIES - libraries for component
+
+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
+
+The environment variable ``ICU_ROOT`` may also be used; the
+ICU_ROOT variable takes precedence.
+
+The following cache variables may also be set::
+
+ ICU_<P>_EXECUTABLE - the path to executable <P>
+ ICU_INCLUDE_DIR - the directory containing the ICU headers
+ ICU_<C>_LIBRARY - the library for component <C>
+
+.. note::
+
+ In most cases none of the above variables will require setting,
+ unless multiple ICU versions are available and a specific version
+ is required.
+
+Other variables one may set to control this module are::
+
+ ICU_DEBUG - Set to ON to enable debug output from FindICU.
+#]=======================================================================]
# Written by Roger Leigh <rleigh@codelibre.net>
@@ -164,7 +165,9 @@ function(_ICU_FIND)
find_program("${cache_var}" "${program}"
HINTS ${icu_roots}
PATH_SUFFIXES ${icu_binary_suffixes}
- DOC "ICU ${program} executable")
+ DOC "ICU ${program} executable"
+ NO_PACKAGE_ROOT_PATH
+ )
mark_as_advanced(cache_var)
set("${program_var}" "${${cache_var}}" PARENT_SCOPE)
endforeach()
@@ -228,11 +231,15 @@ function(_ICU_FIND)
find_library("${component_cache_release}" ${component_libnames}
HINTS ${icu_roots}
PATH_SUFFIXES ${icu_library_suffixes}
- DOC "ICU ${component} library (release)")
+ DOC "ICU ${component} library (release)"
+ NO_PACKAGE_ROOT_PATH
+ )
find_library("${component_cache_debug}" ${component_debug_libnames}
HINTS ${icu_roots}
PATH_SUFFIXES ${icu_library_suffixes}
- DOC "ICU ${component} library (debug)")
+ DOC "ICU ${component} library (debug)"
+ NO_PACKAGE_ROOT_PATH
+ )
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(ICU_${component_upcase})
mark_as_advanced("${component_cache_release}" "${component_cache_debug}")
@@ -362,6 +369,10 @@ if(ICU_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
IMPORTED_LOCATION_DEBUG "${${_ICU_component_cache_debug}}")
endif()
+ if(CMAKE_DL_LIBS AND _ICU_component STREQUAL "uc")
+ set_target_properties(${_ICU_imported_target} PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
+ endif()
endif()
endif()
unset(_ICU_component_upcase)
diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake
index df76e5a66..1e0f0b828 100644
--- a/Modules/FindIce.cmake
+++ b/Modules/FindIce.cmake
@@ -1,146 +1,149 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindIce
-# -------
-#
-# Find the ZeroC Internet Communication Engine (ICE) programs,
-# libraries and datafiles.
-#
-# This module supports multiple components.
-# Components can include any of: ``Freeze``, ``Glacier2``, ``Ice``,
-# ``IceBox``, ``IceDB``, ``IceDiscovery``, ``IceGrid``,
-# ``IceLocatorDiscovery``, ``IcePatch``, ``IceSSL``, ``IceStorm``,
-# ``IceUtil``, ``IceXML``, or ``Slice``.
-#
-# Ice 3.7 and later also include C++11-specific components:
-# ``Glacier2++11``, ``Ice++11``, ``IceBox++11``, ``IceDiscovery++11``
-# ``IceGrid``, ``IceLocatorDiscovery++11``, ``IceSSL++11``,
-# ``IceStorm++11``
-#
-# Note that the set of supported components is Ice version-specific.
-#
-# This module reports information about the Ice installation in
-# several variables. General variables::
-#
-# Ice_VERSION - Ice release version
-# Ice_FOUND - true if the main programs and libraries were found
-# Ice_LIBRARIES - component libraries to be linked
-# Ice_INCLUDE_DIRS - the directories containing the Ice headers
-# Ice_SLICE_DIRS - the directories containing the Ice slice interface
-# definitions
-#
-# Imported targets::
-#
-# Ice::<C>
-#
-# Where ``<C>`` is the name of an Ice component, for example
-# ``Ice::Glacier2`` or ``Ice++11``.
-#
-# Ice slice programs are reported in::
-#
-# Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable
-# Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable
-# Ice_SLICE2FREEZEJ_EXECUTABLE - path to slice2freezej executable
-# Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable
-# Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable
-# Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable
-# Ice_SLICE2JS_EXECUTABLE - path to slice2js executable
-# Ice_SLICE2OBJC_EXECUTABLE - path to slice2objc executable
-# Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable
-# Ice_SLICE2PY_EXECUTABLE - path to slice2py executable
-# Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable
-#
-# Ice programs are reported in::
-#
-# Ice_GLACIER2ROUTER_EXECUTABLE - path to glacier2router executable
-# Ice_ICEBOX_EXECUTABLE - path to icebox executable
-# Ice_ICEBOXXX11_EXECUTABLE - path to icebox++11 executable
-# Ice_ICEBOXADMIN_EXECUTABLE - path to iceboxadmin executable
-# Ice_ICEBOXD_EXECUTABLE - path to iceboxd executable
-# Ice_ICEBOXNET_EXECUTABLE - path to iceboxnet executable
-# Ice_ICEBRIDGE_EXECUTABLE - path to icebridge executable
-# Ice_ICEGRIDADMIN_EXECUTABLE - path to icegridadmin executable
-# Ice_ICEGRIDDB_EXECUTABLE - path to icegriddb executable
-# Ice_ICEGRIDNODE_EXECUTABLE - path to icegridnode executable
-# Ice_ICEGRIDNODED_EXECUTABLE - path to icegridnoded executable
-# Ice_ICEGRIDREGISTRY_EXECUTABLE - path to icegridregistry executable
-# Ice_ICEGRIDREGISTRYD_EXECUTABLE - path to icegridregistryd executable
-# Ice_ICEPATCH2CALC_EXECUTABLE - path to icepatch2calc executable
-# Ice_ICEPATCH2CLIENT_EXECUTABLE - path to icepatch2client executable
-# Ice_ICEPATCH2SERVER_EXECUTABLE - path to icepatch2server executable
-# Ice_ICESERVICEINSTALL_EXECUTABLE - path to iceserviceinstall executable
-# Ice_ICESTORMADMIN_EXECUTABLE - path to icestormadmin executable
-# Ice_ICESTORMDB_EXECUTABLE - path to icestormdb executable
-# Ice_ICESTORMMIGRATE_EXECUTABLE - path to icestormmigrate executable
-#
-# Ice db programs (Windows only; standard system versions on all other
-# platforms) are reported in::
-#
-# Ice_DB_ARCHIVE_EXECUTABLE - path to db_archive executable
-# Ice_DB_CHECKPOINT_EXECUTABLE - path to db_checkpoint executable
-# Ice_DB_DEADLOCK_EXECUTABLE - path to db_deadlock executable
-# Ice_DB_DUMP_EXECUTABLE - path to db_dump executable
-# Ice_DB_HOTBACKUP_EXECUTABLE - path to db_hotbackup executable
-# Ice_DB_LOAD_EXECUTABLE - path to db_load executable
-# Ice_DB_LOG_VERIFY_EXECUTABLE - path to db_log_verify executable
-# Ice_DB_PRINTLOG_EXECUTABLE - path to db_printlog executable
-# Ice_DB_RECOVER_EXECUTABLE - path to db_recover executable
-# Ice_DB_STAT_EXECUTABLE - path to db_stat executable
-# Ice_DB_TUNER_EXECUTABLE - path to db_tuner executable
-# Ice_DB_UPGRADE_EXECUTABLE - path to db_upgrade executable
-# Ice_DB_VERIFY_EXECUTABLE - path to db_verify executable
-# Ice_DUMPDB_EXECUTABLE - path to dumpdb executable
-# Ice_TRANSFORMDB_EXECUTABLE - path to transformdb executable
-#
-# Ice component libraries are reported in::
-#
-# Ice_<C>_FOUND - ON if component was found
-# Ice_<C>_LIBRARIES - libraries for component
-#
-# Note that ``<C>`` is the uppercased name of the component.
-#
-# This module reads hints about search results from::
-#
-# Ice_HOME - the root of the Ice installation
-#
-# The environment variable ``ICE_HOME`` may also be used; the
-# Ice_HOME variable takes precedence.
-#
-# .. note::
-# On Windows, Ice 3.7.0 and later provide libraries via the NuGet
-# package manager. Appropriate NuGet packages will be searched for
-# using ``CMAKE_PREFIX_PATH``, or alternatively ``Ice_HOME`` may be
-# set to the location of a specific NuGet package to restrict the
-# search.
-#
-# The following cache variables may also be set::
-#
-# Ice_<P>_EXECUTABLE - the path to executable <P>
-# Ice_INCLUDE_DIR - the directory containing the Ice headers
-# Ice_SLICE_DIR - the directory containing the Ice slice interface
-# definitions
-# Ice_<C>_LIBRARY - the library for component <C>
-#
-# .. note::
-#
-# In most cases none of the above variables will require setting,
-# unless multiple Ice versions are available and a specific version
-# is required. On Windows, the most recent version of Ice will be
-# found through the registry. On Unix, the programs, headers and
-# libraries will usually be in standard locations, but Ice_SLICE_DIRS
-# might not be automatically detected (commonly known locations are
-# searched). All the other variables are defaulted using Ice_HOME,
-# if set. It's possible to set Ice_HOME and selectively specify
-# alternative locations for the other components; this might be
-# required for e.g. newer versions of Visual Studio if the
-# heuristics are not sufficient to identify the correct programs and
-# libraries for the specific Visual Studio version.
-#
-# Other variables one may set to control this module are::
-#
-# Ice_DEBUG - Set to ON to enable debug output from FindIce.
+#[=======================================================================[.rst:
+FindIce
+-------
+
+Find the ZeroC Internet Communication Engine (ICE) programs,
+libraries and datafiles.
+
+This module supports multiple components.
+Components can include any of: ``Freeze``, ``Glacier2``, ``Ice``,
+``IceBox``, ``IceDB``, ``IceDiscovery``, ``IceGrid``,
+``IceLocatorDiscovery``, ``IcePatch``, ``IceSSL``, ``IceStorm``,
+``IceUtil``, ``IceXML``, or ``Slice``.
+
+Ice 3.7 and later also include C++11-specific components:
+``Glacier2++11``, ``Ice++11``, ``IceBox++11``, ``IceDiscovery++11``
+``IceGrid``, ``IceLocatorDiscovery++11``, ``IceSSL++11``,
+``IceStorm++11``
+
+Note that the set of supported components is Ice version-specific.
+
+This module reports information about the Ice installation in
+several variables. General variables::
+
+ Ice_VERSION - Ice release version
+ Ice_FOUND - true if the main programs and libraries were found
+ Ice_LIBRARIES - component libraries to be linked
+ Ice_INCLUDE_DIRS - the directories containing the Ice headers
+ Ice_SLICE_DIRS - the directories containing the Ice slice interface
+ definitions
+
+Imported targets::
+
+ Ice::<C>
+
+Where ``<C>`` is the name of an Ice component, for example
+``Ice::Glacier2`` or ``Ice++11``.
+
+Ice slice programs are reported in::
+
+ Ice_SLICE2CONFLUENCE_EXECUTABLE - path to slice2confluence executable
+ Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable
+ Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable
+ Ice_SLICE2FREEZEJ_EXECUTABLE - path to slice2freezej executable
+ Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable
+ Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable
+ Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable
+ Ice_SLICE2JS_EXECUTABLE - path to slice2js executable
+ Ice_SLICE2MATLAB_EXECUTABLE - path to slice2matlab executable
+ Ice_SLICE2OBJC_EXECUTABLE - path to slice2objc executable
+ Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable
+ Ice_SLICE2PY_EXECUTABLE - path to slice2py executable
+ Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable
+
+Ice programs are reported in::
+
+ Ice_GLACIER2ROUTER_EXECUTABLE - path to glacier2router executable
+ Ice_ICEBOX_EXECUTABLE - path to icebox executable
+ Ice_ICEBOXXX11_EXECUTABLE - path to icebox++11 executable
+ Ice_ICEBOXADMIN_EXECUTABLE - path to iceboxadmin executable
+ Ice_ICEBOXD_EXECUTABLE - path to iceboxd executable
+ Ice_ICEBOXNET_EXECUTABLE - path to iceboxnet executable
+ Ice_ICEBRIDGE_EXECUTABLE - path to icebridge executable
+ Ice_ICEGRIDADMIN_EXECUTABLE - path to icegridadmin executable
+ Ice_ICEGRIDDB_EXECUTABLE - path to icegriddb executable
+ Ice_ICEGRIDNODE_EXECUTABLE - path to icegridnode executable
+ Ice_ICEGRIDNODED_EXECUTABLE - path to icegridnoded executable
+ Ice_ICEGRIDREGISTRY_EXECUTABLE - path to icegridregistry executable
+ Ice_ICEGRIDREGISTRYD_EXECUTABLE - path to icegridregistryd executable
+ Ice_ICEPATCH2CALC_EXECUTABLE - path to icepatch2calc executable
+ Ice_ICEPATCH2CLIENT_EXECUTABLE - path to icepatch2client executable
+ Ice_ICEPATCH2SERVER_EXECUTABLE - path to icepatch2server executable
+ Ice_ICESERVICEINSTALL_EXECUTABLE - path to iceserviceinstall executable
+ Ice_ICESTORMADMIN_EXECUTABLE - path to icestormadmin executable
+ Ice_ICESTORMDB_EXECUTABLE - path to icestormdb executable
+ Ice_ICESTORMMIGRATE_EXECUTABLE - path to icestormmigrate executable
+
+Ice db programs (Windows only; standard system versions on all other
+platforms) are reported in::
+
+ Ice_DB_ARCHIVE_EXECUTABLE - path to db_archive executable
+ Ice_DB_CHECKPOINT_EXECUTABLE - path to db_checkpoint executable
+ Ice_DB_DEADLOCK_EXECUTABLE - path to db_deadlock executable
+ Ice_DB_DUMP_EXECUTABLE - path to db_dump executable
+ Ice_DB_HOTBACKUP_EXECUTABLE - path to db_hotbackup executable
+ Ice_DB_LOAD_EXECUTABLE - path to db_load executable
+ Ice_DB_LOG_VERIFY_EXECUTABLE - path to db_log_verify executable
+ Ice_DB_PRINTLOG_EXECUTABLE - path to db_printlog executable
+ Ice_DB_RECOVER_EXECUTABLE - path to db_recover executable
+ Ice_DB_STAT_EXECUTABLE - path to db_stat executable
+ Ice_DB_TUNER_EXECUTABLE - path to db_tuner executable
+ Ice_DB_UPGRADE_EXECUTABLE - path to db_upgrade executable
+ Ice_DB_VERIFY_EXECUTABLE - path to db_verify executable
+ Ice_DUMPDB_EXECUTABLE - path to dumpdb executable
+ Ice_TRANSFORMDB_EXECUTABLE - path to transformdb executable
+
+Ice component libraries are reported in::
+
+ Ice_<C>_FOUND - ON if component was found
+ Ice_<C>_LIBRARIES - libraries for component
+
+Note that ``<C>`` is the uppercased name of the component.
+
+This module reads hints about search results from::
+
+ Ice_HOME - the root of the Ice installation
+
+The environment variable ``ICE_HOME`` may also be used; the
+Ice_HOME variable takes precedence.
+
+.. note::
+ On Windows, Ice 3.7.0 and later provide libraries via the NuGet
+ package manager. Appropriate NuGet packages will be searched for
+ using ``CMAKE_PREFIX_PATH``, or alternatively ``Ice_HOME`` may be
+ set to the location of a specific NuGet package to restrict the
+ search.
+
+The following cache variables may also be set::
+
+ Ice_<P>_EXECUTABLE - the path to executable <P>
+ Ice_INCLUDE_DIR - the directory containing the Ice headers
+ Ice_SLICE_DIR - the directory containing the Ice slice interface
+ definitions
+ Ice_<C>_LIBRARY - the library for component <C>
+
+.. note::
+
+ In most cases none of the above variables will require setting,
+ unless multiple Ice versions are available and a specific version
+ is required. On Windows, the most recent version of Ice will be
+ found through the registry. On Unix, the programs, headers and
+ libraries will usually be in standard locations, but Ice_SLICE_DIRS
+ might not be automatically detected (commonly known locations are
+ searched). All the other variables are defaulted using Ice_HOME,
+ if set. It's possible to set Ice_HOME and selectively specify
+ alternative locations for the other components; this might be
+ required for e.g. newer versions of Visual Studio if the
+ heuristics are not sufficient to identify the correct programs and
+ libraries for the specific Visual Studio version.
+
+Other variables one may set to control this module are::
+
+ Ice_DEBUG - Set to ON to enable debug output from FindIce.
+#]=======================================================================]
# Written by Roger Leigh <rleigh@codelibre.net>
@@ -184,6 +187,7 @@
icestormmigrate)
set(_Ice_slice_programs
+ slice2confluence
slice2cpp
slice2cs
slice2freezej
@@ -191,6 +195,7 @@
slice2html
slice2java
slice2js
+ slice2matlab
slice2objc
slice2php
slice2py
diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake
index 26e95a0fa..32fc4aebd 100644
--- a/Modules/FindIcotool.cmake
+++ b/Modules/FindIcotool.cmake
@@ -1,20 +1,21 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindIcotool
-# -----------
-#
-# Find icotool
-#
-# This module looks for icotool. This module defines the following
-# values:
-#
-# ::
-#
-# ICOTOOL_EXECUTABLE: the full path to the icotool tool.
-# ICOTOOL_FOUND: True if icotool has been found.
-# ICOTOOL_VERSION_STRING: the version of icotool found.
+#[=======================================================================[.rst:
+FindIcotool
+-----------
+
+Find icotool
+
+This module looks for icotool. This module defines the following
+values:
+
+::
+
+ ICOTOOL_EXECUTABLE: the full path to the icotool tool.
+ ICOTOOL_FOUND: True if icotool has been found.
+ ICOTOOL_VERSION_STRING: the version of icotool found.
+#]=======================================================================]
find_program(ICOTOOL_EXECUTABLE
icotool
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 6d94d3b68..2ddd11c8d 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -1,87 +1,88 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindImageMagick
-# ---------------
-#
-# Find the ImageMagick binary suite.
-#
-# This module will search for a set of ImageMagick tools specified as
-# components in the FIND_PACKAGE call. Typical components include, but
-# are not limited to (future versions of ImageMagick might have
-# additional components not listed here):
-#
-# ::
-#
-# animate
-# compare
-# composite
-# conjure
-# convert
-# display
-# identify
-# import
-# mogrify
-# montage
-# stream
-#
-#
-#
-# If no component is specified in the FIND_PACKAGE call, then it only
-# searches for the ImageMagick executable directory. This code defines
-# the following variables:
-#
-# ::
-#
-# ImageMagick_FOUND - TRUE if all components are found.
-# ImageMagick_EXECUTABLE_DIR - Full path to executables directory.
-# ImageMagick_<component>_FOUND - TRUE if <component> is found.
-# ImageMagick_<component>_EXECUTABLE - Full path to <component> executable.
-# ImageMagick_VERSION_STRING - the version of ImageMagick found
-# (since CMake 2.8.8)
-#
-#
-#
-# ImageMagick_VERSION_STRING will not work for old versions like 5.2.3.
-#
-# There are also components for the following ImageMagick APIs:
-#
-# ::
-#
-# Magick++
-# MagickWand
-# MagickCore
-#
-#
-#
-# For these components the following variables are set:
-#
-# ::
-#
-# ImageMagick_FOUND - TRUE if all components are found.
-# ImageMagick_INCLUDE_DIRS - Full paths to all include dirs.
-# ImageMagick_LIBRARIES - Full paths to all libraries.
-# ImageMagick_<component>_FOUND - TRUE if <component> is found.
-# ImageMagick_<component>_INCLUDE_DIRS - Full path to <component> include dirs.
-# ImageMagick_<component>_LIBRARIES - Full path to <component> libraries.
-#
-#
-#
-# Example Usages:
-#
-# ::
-#
-# find_package(ImageMagick)
-# find_package(ImageMagick COMPONENTS convert)
-# find_package(ImageMagick COMPONENTS convert mogrify display)
-# find_package(ImageMagick COMPONENTS Magick++)
-# find_package(ImageMagick COMPONENTS Magick++ convert)
-#
-#
-#
-# Note that the standard FIND_PACKAGE features are supported (i.e.,
-# QUIET, REQUIRED, etc.).
+#[=======================================================================[.rst:
+FindImageMagick
+---------------
+
+Find the ImageMagick binary suite.
+
+This module will search for a set of ImageMagick tools specified as
+components in the FIND_PACKAGE call. Typical components include, but
+are not limited to (future versions of ImageMagick might have
+additional components not listed here):
+
+::
+
+ animate
+ compare
+ composite
+ conjure
+ convert
+ display
+ identify
+ import
+ mogrify
+ montage
+ stream
+
+
+
+If no component is specified in the FIND_PACKAGE call, then it only
+searches for the ImageMagick executable directory. This code defines
+the following variables:
+
+::
+
+ ImageMagick_FOUND - TRUE if all components are found.
+ ImageMagick_EXECUTABLE_DIR - Full path to executables directory.
+ ImageMagick_<component>_FOUND - TRUE if <component> is found.
+ ImageMagick_<component>_EXECUTABLE - Full path to <component> executable.
+ ImageMagick_VERSION_STRING - the version of ImageMagick found
+ (since CMake 2.8.8)
+
+
+
+ImageMagick_VERSION_STRING will not work for old versions like 5.2.3.
+
+There are also components for the following ImageMagick APIs:
+
+::
+
+ Magick++
+ MagickWand
+ MagickCore
+
+
+
+For these components the following variables are set:
+
+::
+
+ ImageMagick_FOUND - TRUE if all components are found.
+ ImageMagick_INCLUDE_DIRS - Full paths to all include dirs.
+ ImageMagick_LIBRARIES - Full paths to all libraries.
+ ImageMagick_<component>_FOUND - TRUE if <component> is found.
+ ImageMagick_<component>_INCLUDE_DIRS - Full path to <component> include dirs.
+ ImageMagick_<component>_LIBRARIES - Full path to <component> libraries.
+
+
+
+Example Usages:
+
+::
+
+ find_package(ImageMagick)
+ find_package(ImageMagick COMPONENTS convert)
+ find_package(ImageMagick COMPONENTS convert mogrify display)
+ find_package(ImageMagick COMPONENTS Magick++)
+ find_package(ImageMagick COMPONENTS Magick++ convert)
+
+
+
+Note that the standard FIND_PACKAGE features are supported (i.e.,
+QUIET, REQUIRED, etc.).
+#]=======================================================================]
find_package(PkgConfig QUIET)
diff --git a/Modules/FindIntl.cmake b/Modules/FindIntl.cmake
index f887721d6..3818d45ec 100644
--- a/Modules/FindIntl.cmake
+++ b/Modules/FindIntl.cmake
@@ -1,33 +1,34 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindIntl
-# --------
-#
-# Find the Gettext libintl headers and libraries.
-#
-# This module reports information about the Gettext libintl
-# installation in several variables. General variables::
-#
-# Intl_FOUND - true if the libintl headers and libraries were found
-# Intl_INCLUDE_DIRS - the directory containing the libintl headers
-# Intl_LIBRARIES - libintl libraries to be linked
-#
-# The following cache variables may also be set::
-#
-# Intl_INCLUDE_DIR - the directory containing the libintl headers
-# Intl_LIBRARY - the libintl library (if any)
-#
-# .. note::
-# On some platforms, such as Linux with GNU libc, the gettext
-# functions are present in the C standard library and libintl
-# is not required. ``Intl_LIBRARIES`` will be empty in this
-# case.
-#
-# .. note::
-# If you wish to use the Gettext tools (``msgmerge``,
-# ``msgfmt``, etc.), use :module:`FindGettext`.
+#[=======================================================================[.rst:
+FindIntl
+--------
+
+Find the Gettext libintl headers and libraries.
+
+This module reports information about the Gettext libintl
+installation in several variables. General variables::
+
+ Intl_FOUND - true if the libintl headers and libraries were found
+ Intl_INCLUDE_DIRS - the directory containing the libintl headers
+ Intl_LIBRARIES - libintl libraries to be linked
+
+The following cache variables may also be set::
+
+ Intl_INCLUDE_DIR - the directory containing the libintl headers
+ Intl_LIBRARY - the libintl library (if any)
+
+.. note::
+ On some platforms, such as Linux with GNU libc, the gettext
+ functions are present in the C standard library and libintl
+ is not required. ``Intl_LIBRARIES`` will be empty in this
+ case.
+
+.. note::
+ If you wish to use the Gettext tools (``msgmerge``,
+ ``msgfmt``, etc.), use :module:`FindGettext`.
+#]=======================================================================]
# Written by Roger Leigh <rleigh@codelibre.net>
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index fdddcc7e0..237ea96dc 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -185,40 +185,57 @@ if (WIN32)
)
endif()
-JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
- /usr/lib/jvm/java/lib
- /usr/lib/java/jre/lib/{libarch}
- /usr/lib/jvm/jre/lib/{libarch}
- /usr/local/lib/java/jre/lib/{libarch}
- /usr/local/share/java/jre/lib/{libarch}
- /usr/lib/j2sdk1.4-sun/jre/lib/{libarch}
- /usr/lib/j2sdk1.5-sun/jre/lib/{libarch}
- /opt/sun-jdk-1.5.0.04/jre/lib/{libarch}
- /usr/lib/jvm/java-6-sun/jre/lib/{libarch}
- /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch}
- /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex
- /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch}
- /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora
+set(_JNI_JAVA_DIRECTORIES_BASE
+ /usr/lib/jvm/java
+ /usr/lib/java
+ /usr/lib/jvm
+ /usr/local/lib/java
+ /usr/local/share/java
+ /usr/lib/j2sdk1.4-sun
+ /usr/lib/j2sdk1.5-sun
+ /opt/sun-jdk-1.5.0.04
+ /usr/lib/jvm/java-6-sun
+ /usr/lib/jvm/java-1.5.0-sun
+ /usr/lib/jvm/java-6-sun-1.6.0.00 # can this one be removed according to #8821 ? Alex
+ /usr/lib/jvm/java-6-openjdk
+ /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0 # fedora
# Debian specific paths for default JVM
- /usr/lib/jvm/default-java/jre/lib/{libarch}
- /usr/lib/jvm/default-java/jre/lib
- /usr/lib/jvm/default-java/lib
+ /usr/lib/jvm/default-java
# Arch Linux specific paths for default JVM
- /usr/lib/jvm/default/jre/lib/{libarch}
- /usr/lib/jvm/default/lib/{libarch}
+ /usr/lib/jvm/default
# Ubuntu specific paths for default JVM
- /usr/lib/jvm/java-11-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 18.04 LTS
- /usr/lib/jvm/java-8-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
- /usr/lib/jvm/java-7-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
- /usr/lib/jvm/java-6-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
+ /usr/lib/jvm/java-11-openjdk-{libarch} # Ubuntu 18.04 LTS
+ /usr/lib/jvm/java-8-openjdk-{libarch} # Ubuntu 15.10
+ /usr/lib/jvm/java-7-openjdk-{libarch} # Ubuntu 15.10
+ /usr/lib/jvm/java-6-openjdk-{libarch} # Ubuntu 15.10
# OpenBSD specific paths for default JVM
- /usr/local/jdk-1.7.0/jre/lib/{libarch}
- /usr/local/jre-1.7.0/lib/{libarch}
- /usr/local/jdk-1.6.0/jre/lib/{libarch}
- /usr/local/jre-1.6.0/lib/{libarch}
+ /usr/local/jdk-1.7.0
+ /usr/local/jre-1.7.0
+ /usr/local/jdk-1.6.0
+ /usr/local/jre-1.6.0
# SuSE specific paths for default JVM
- /usr/lib64/jvm/java/jre/lib/{libarch}
- /usr/lib64/jvm/jre/lib/{libarch}
+ /usr/lib64/jvm/java
+ /usr/lib64/jvm/jre
+ )
+
+set(_JNI_JAVA_AWT_LIBRARY_TRIES)
+set(_JNI_JAVA_INCLUDE_TRIES)
+
+foreach(_java_dir IN LISTS _JNI_JAVA_DIRECTORIES_BASE)
+ list(APPEND _JNI_JAVA_AWT_LIBRARY_TRIES
+ ${_java_dir}/jre/lib/{libarch}
+ ${_java_dir}/jre/lib
+ ${_java_dir}/lib/{libarch}
+ ${_java_dir}/lib
+ ${_java_dir}
+ )
+ list(APPEND _JNI_JAVA_INCLUDE_TRIES
+ ${_java_dir}/include
+ )
+endforeach()
+
+JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
+ ${_JNI_JAVA_AWT_LIBRARY_TRIES}
)
set(JAVA_JVM_LIBRARY_DIRECTORIES)
@@ -254,29 +271,7 @@ if (WIN32)
endif()
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_INCLUDE_DIRECTORIES
- /usr/lib/java/include
- /usr/local/lib/java/include
- /usr/lib/jvm/java/include
- /usr/lib/jvm/java-6-sun/include
- /usr/lib/jvm/java-1.5.0-sun/include
- /usr/lib/jvm/java-6-sun-1.6.0.00/include # can this one be removed according to #8821 ? Alex
- /usr/lib/jvm/java-6-openjdk/include
- /usr/lib/jvm/java-8-openjdk-{libarch}/include # ubuntu 15.10
- /usr/lib/jvm/java-7-openjdk-{libarch}/include # ubuntu 15.10
- /usr/lib/jvm/java-6-openjdk-{libarch}/include # ubuntu 15.10
- /usr/local/share/java/include
- /usr/lib/j2sdk1.4-sun/include
- /usr/lib/j2sdk1.5-sun/include
- /opt/sun-jdk-1.5.0.04/include
- # Debian specific path for default JVM
- /usr/lib/jvm/default-java/include
- # Arch specific path for default JVM
- /usr/lib/jvm/default/include
- # OpenBSD specific path for default JVM
- /usr/local/jdk-1.7.0/include
- /usr/local/jdk-1.6.0/include
- # SuSE specific paths for default JVM
- /usr/lib64/jvm/java/include
+ ${_JNI_JAVA_INCLUDE_TRIES}
)
foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index 7290724ce..f50f79e9b 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -1,53 +1,54 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindJPEG
-# --------
-#
-# Find the JPEG library (libjpeg)
-#
-# Imported targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following :prop_tgt:`IMPORTED` targets:
-#
-# ``JPEG::JPEG``
-# The JPEG library, if found.
-#
-# Result variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project:
-#
-# ``JPEG_FOUND``
-# If false, do not try to use JPEG.
-# ``JPEG_INCLUDE_DIRS``
-# where to find jpeglib.h, etc.
-# ``JPEG_LIBRARIES``
-# the libraries needed to use JPEG.
-# ``JPEG_VERSION``
-# the version of the JPEG library found
-#
-# Cache variables
-# ^^^^^^^^^^^^^^^
-#
-# The following cache variables may also be set:
-#
-# ``JPEG_INCLUDE_DIRS``
-# where to find jpeglib.h, etc.
-# ``JPEG_LIBRARY_RELEASE``
-# where to find the JPEG library (optimized).
-# ``JPEG_LIBRARY_DEBUG``
-# where to find the JPEG library (debug).
-#
-# Obsolete variables
-# ^^^^^^^^^^^^^^^^^^
-#
-# ``JPEG_INCLUDE_DIR``
-# where to find jpeglib.h, etc. (same as JPEG_INCLUDE_DIRS)
-# ``JPEG_LIBRARY``
-# where to find the JPEG library.
+#[=======================================================================[.rst:
+FindJPEG
+--------
+
+Find the JPEG library (libjpeg)
+
+Imported targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` targets:
+
+``JPEG::JPEG``
+ The JPEG library, if found.
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``JPEG_FOUND``
+ If false, do not try to use JPEG.
+``JPEG_INCLUDE_DIRS``
+ where to find jpeglib.h, etc.
+``JPEG_LIBRARIES``
+ the libraries needed to use JPEG.
+``JPEG_VERSION``
+ the version of the JPEG library found
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``JPEG_INCLUDE_DIRS``
+ where to find jpeglib.h, etc.
+``JPEG_LIBRARY_RELEASE``
+ where to find the JPEG library (optimized).
+``JPEG_LIBRARY_DEBUG``
+ where to find the JPEG library (debug).
+
+Obsolete variables
+^^^^^^^^^^^^^^^^^^
+
+``JPEG_INCLUDE_DIR``
+ where to find jpeglib.h, etc. (same as JPEG_INCLUDE_DIRS)
+``JPEG_LIBRARY``
+ where to find the JPEG library.
+#]=======================================================================]
find_path(JPEG_INCLUDE_DIR jpeglib.h)
@@ -66,23 +67,33 @@ endif()
unset(jpeg_names)
unset(jpeg_names_debug)
-if(JPEG_INCLUDE_DIR AND EXISTS "${JPEG_INCLUDE_DIR}/jpeglib.h")
- file(STRINGS "${JPEG_INCLUDE_DIR}/jpeglib.h"
- jpeg_lib_version REGEX "^#define[\t ]+JPEG_LIB_VERSION[\t ]+.*")
+if(JPEG_INCLUDE_DIR)
+ file(GLOB _JPEG_CONFIG_HEADERS_FEDORA "${JPEG_INCLUDE_DIR}/jconfig*.h")
+ file(GLOB _JPEG_CONFIG_HEADERS_DEBIAN "${JPEG_INCLUDE_DIR}/*/jconfig.h")
+ set(_JPEG_CONFIG_HEADERS
+ "${JPEG_INCLUDE_DIR}/jpeglib.h"
+ ${_JPEG_CONFIG_HEADERS_FEDORA}
+ ${_JPEG_CONFIG_HEADERS_DEBIAN})
+ foreach (_JPEG_CONFIG_HEADER IN LISTS _JPEG_CONFIG_HEADERS)
+ if (NOT EXISTS "${_JPEG_CONFIG_HEADER}")
+ continue ()
+ endif ()
+ file(STRINGS "${_JPEG_CONFIG_HEADER}"
+ jpeg_lib_version REGEX "^#define[\t ]+JPEG_LIB_VERSION[\t ]+.*")
- if (NOT jpeg_lib_version)
- # libjpeg-turbo sticks JPEG_LIB_VERSION in jconfig.h
- find_path(jconfig_dir jconfig.h)
- if (jconfig_dir)
- file(STRINGS "${jconfig_dir}/jconfig.h"
- jpeg_lib_version REGEX "^#define[\t ]+JPEG_LIB_VERSION[\t ]+.*")
- endif()
- unset(jconfig_dir)
- endif()
+ if (NOT jpeg_lib_version)
+ continue ()
+ endif ()
- string(REGEX REPLACE "^#define[\t ]+JPEG_LIB_VERSION[\t ]+([0-9]+).*"
- "\\1" JPEG_VERSION "${jpeg_lib_version}")
+ string(REGEX REPLACE "^#define[\t ]+JPEG_LIB_VERSION[\t ]+([0-9]+).*"
+ "\\1" JPEG_VERSION "${jpeg_lib_version}")
+ break ()
+ endforeach ()
unset(jpeg_lib_version)
+ unset(_JPEG_CONFIG_HEADER)
+ unset(_JPEG_CONFIG_HEADERS)
+ unset(_JPEG_CONFIG_HEADERS_FEDORA)
+ unset(_JPEG_CONFIG_HEADERS_DEBIAN)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake
index db766576b..dd0e98411 100644
--- a/Modules/FindJasper.cmake
+++ b/Modules/FindJasper.cmake
@@ -1,20 +1,21 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindJasper
-# ----------
-#
-# Try to find the Jasper JPEG2000 library
-#
-# Once done this will define
-#
-# ::
-#
-# JASPER_FOUND - system has Jasper
-# JASPER_INCLUDE_DIR - the Jasper include directory
-# JASPER_LIBRARIES - the libraries needed to use Jasper
-# JASPER_VERSION_STRING - the version of Jasper found (since CMake 2.8.8)
+#[=======================================================================[.rst:
+FindJasper
+----------
+
+Try to find the Jasper JPEG2000 library
+
+Once done this will define
+
+::
+
+ JASPER_FOUND - system has Jasper
+ JASPER_INCLUDE_DIR - the Jasper include directory
+ JASPER_LIBRARIES - the libraries needed to use Jasper
+ JASPER_VERSION_STRING - the version of Jasper found (since CMake 2.8.8)
+#]=======================================================================]
find_path(JASPER_INCLUDE_DIR jasper/jasper.h)
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index bcdf166fd..0d62cd669 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -1,79 +1,80 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindJava
-# --------
-#
-# Find Java
-#
-# This module finds if Java is installed and determines where the
-# include files and libraries are. The caller may set variable ``JAVA_HOME``
-# to specify a Java installation prefix explicitly.
-#
-# See also the :module:`FindJNI` module to find Java Native Interface (JNI).
-#
-# Specify one or more of the following components as you call this find module. See example below.
-#
-# ::
-#
-# Runtime = Java Runtime Environment used to execute Java byte-compiled applications
-# Development = Development tools (java, javac, javah, jar and javadoc), includes Runtime component
-# IdlJ = Interface Description Language (IDL) to Java compiler
-# JarSigner = Signer and verifier tool for Java Archive (JAR) files
-#
-#
-# This module sets the following result variables:
-#
-# ::
-#
-# Java_JAVA_EXECUTABLE = the full path to the Java runtime
-# Java_JAVAC_EXECUTABLE = the full path to the Java compiler
-# Java_JAVAH_EXECUTABLE = the full path to the Java header generator
-# Java_JAVADOC_EXECUTABLE = the full path to the Java documentation generator
-# Java_IDLJ_EXECUTABLE = the full path to the Java idl compiler
-# Java_JAR_EXECUTABLE = the full path to the Java archiver
-# Java_JARSIGNER_EXECUTABLE = the full path to the Java jar signer
-# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12
-# Java_VERSION_MAJOR = The major version of the package found.
-# Java_VERSION_MINOR = The minor version of the package found.
-# Java_VERSION_PATCH = The patch version of the package found.
-# Java_VERSION_TWEAK = The tweak version of the package found (after '_')
-# Java_VERSION = This is set to: $major[.$minor[.$patch[.$tweak]]]
-#
-#
-#
-# The minimum required version of Java can be specified using the
-# :command:`find_package` syntax, e.g.
-#
-# .. code-block:: cmake
-#
-# find_package(Java 1.8)
-#
-# NOTE: ``${Java_VERSION}`` and ``${Java_VERSION_STRING}`` are not guaranteed to
-# be identical. For example some java version may return:
-# ``Java_VERSION_STRING = 1.8.0_17`` and ``Java_VERSION = 1.8.0.17``
-#
-# another example is the Java OEM, with: ``Java_VERSION_STRING = 1.8.0-oem``
-# and ``Java_VERSION = 1.8.0``
-#
-# For these components the following variables are set:
-#
-# ::
-#
-# Java_FOUND - TRUE if all components are found.
-# Java_<component>_FOUND - TRUE if <component> is found.
-#
-#
-#
-# Example Usages:
-#
-# ::
-#
-# find_package(Java)
-# find_package(Java 1.8 REQUIRED)
-# find_package(Java COMPONENTS Runtime)
-# find_package(Java COMPONENTS Development)
+#[=======================================================================[.rst:
+FindJava
+--------
+
+Find Java
+
+This module finds if Java is installed and determines where the
+include files and libraries are. The caller may set variable ``JAVA_HOME``
+to specify a Java installation prefix explicitly.
+
+See also the :module:`FindJNI` module to find Java Native Interface (JNI).
+
+Specify one or more of the following components as you call this find module. See example below.
+
+::
+
+ Runtime = Java Runtime Environment used to execute Java byte-compiled applications
+ Development = Development tools (java, javac, javah, jar and javadoc), includes Runtime component
+ IdlJ = Interface Description Language (IDL) to Java compiler
+ JarSigner = Signer and verifier tool for Java Archive (JAR) files
+
+
+This module sets the following result variables:
+
+::
+
+ Java_JAVA_EXECUTABLE = the full path to the Java runtime
+ Java_JAVAC_EXECUTABLE = the full path to the Java compiler
+ Java_JAVAH_EXECUTABLE = the full path to the Java header generator
+ Java_JAVADOC_EXECUTABLE = the full path to the Java documentation generator
+ Java_IDLJ_EXECUTABLE = the full path to the Java idl compiler
+ Java_JAR_EXECUTABLE = the full path to the Java archiver
+ Java_JARSIGNER_EXECUTABLE = the full path to the Java jar signer
+ Java_VERSION_STRING = Version of java found, eg. 1.6.0_12
+ Java_VERSION_MAJOR = The major version of the package found.
+ Java_VERSION_MINOR = The minor version of the package found.
+ Java_VERSION_PATCH = The patch version of the package found.
+ Java_VERSION_TWEAK = The tweak version of the package found (after '_')
+ Java_VERSION = This is set to: $major[.$minor[.$patch[.$tweak]]]
+
+
+
+The minimum required version of Java can be specified using the
+:command:`find_package` syntax, e.g.
+
+.. code-block:: cmake
+
+ find_package(Java 1.8)
+
+NOTE: ``${Java_VERSION}`` and ``${Java_VERSION_STRING}`` are not guaranteed to
+be identical. For example some java version may return:
+``Java_VERSION_STRING = 1.8.0_17`` and ``Java_VERSION = 1.8.0.17``
+
+another example is the Java OEM, with: ``Java_VERSION_STRING = 1.8.0-oem``
+and ``Java_VERSION = 1.8.0``
+
+For these components the following variables are set:
+
+::
+
+ Java_FOUND - TRUE if all components are found.
+ Java_<component>_FOUND - TRUE if <component> is found.
+
+
+
+Example Usages:
+
+::
+
+ find_package(Java)
+ find_package(Java 1.8 REQUIRED)
+ find_package(Java COMPONENTS Runtime)
+ find_package(Java COMPONENTS Development)
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake
index daf681863..c7ad6e180 100644
--- a/Modules/FindKDE3.cmake
+++ b/Modules/FindKDE3.cmake
@@ -1,141 +1,142 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindKDE3
-# --------
-#
-# Find the KDE3 include and library dirs, KDE preprocessors and define a some macros
-#
-#
-#
-# This module defines the following variables:
-#
-# ``KDE3_DEFINITIONS``
-# compiler definitions required for compiling KDE software
-# ``KDE3_INCLUDE_DIR``
-# the KDE include directory
-# ``KDE3_INCLUDE_DIRS``
-# the KDE and the Qt include directory, for use with include_directories()
-# ``KDE3_LIB_DIR``
-# the directory where the KDE libraries are installed, for use with link_directories()
-# ``QT_AND_KDECORE_LIBS``
-# this contains both the Qt and the kdecore library
-# ``KDE3_DCOPIDL_EXECUTABLE``
-# the dcopidl executable
-# ``KDE3_DCOPIDL2CPP_EXECUTABLE``
-# the dcopidl2cpp executable
-# ``KDE3_KCFGC_EXECUTABLE``
-# the kconfig_compiler executable
-# ``KDE3_FOUND``
-# set to TRUE if all of the above has been found
-#
-# The following user adjustable options are provided:
-#
-# ``KDE3_BUILD_TESTS``
-# enable this to build KDE testcases
-#
-# It also adds the following macros (from KDE3Macros.cmake) SRCS_VAR is
-# always the variable which contains the list of source files for your
-# application or library.
-#
-# KDE3_AUTOMOC(file1 ... fileN)
-#
-# ::
-#
-# Call this if you want to have automatic moc file handling.
-# This means if you include "foo.moc" in the source file foo.cpp
-# a moc file for the header foo.h will be created automatically.
-# You can set the property SKIP_AUTOMAKE using set_source_files_properties()
-# to exclude some files in the list from being processed.
-#
-#
-#
-# KDE3_ADD_MOC_FILES(SRCS_VAR file1 ... fileN )
-#
-# ::
-#
-# If you don't use the KDE3_AUTOMOC() macro, for the files
-# listed here moc files will be created (named "foo.moc.cpp")
-#
-#
-#
-# KDE3_ADD_DCOP_SKELS(SRCS_VAR header1.h ... headerN.h )
-#
-# ::
-#
-# Use this to generate DCOP skeletions from the listed headers.
-#
-#
-#
-# KDE3_ADD_DCOP_STUBS(SRCS_VAR header1.h ... headerN.h )
-#
-# ::
-#
-# Use this to generate DCOP stubs from the listed headers.
-#
-#
-#
-# KDE3_ADD_UI_FILES(SRCS_VAR file1.ui ... fileN.ui )
-#
-# ::
-#
-# Use this to add the Qt designer ui files to your application/library.
-#
-#
-#
-# KDE3_ADD_KCFG_FILES(SRCS_VAR file1.kcfgc ... fileN.kcfgc )
-#
-# ::
-#
-# Use this to add KDE kconfig compiler files to your application/library.
-#
-#
-#
-# KDE3_INSTALL_LIBTOOL_FILE(target)
-#
-# ::
-#
-# This will create and install a simple libtool file for the given target.
-#
-#
-#
-# KDE3_ADD_EXECUTABLE(name file1 ... fileN )
-#
-# ::
-#
-# Currently identical to add_executable(), may provide some advanced
-# features in the future.
-#
-#
-#
-# KDE3_ADD_KPART(name [WITH_PREFIX] file1 ... fileN )
-#
-# ::
-#
-# Create a KDE plugin (KPart, kioslave, etc.) from the given source files.
-# If WITH_PREFIX is given, the resulting plugin will have the prefix "lib",
-# otherwise it won't.
-# It creates and installs an appropriate libtool la-file.
-#
-#
-#
-# KDE3_ADD_KDEINIT_EXECUTABLE(name file1 ... fileN )
-#
-# ::
-#
-# Create a KDE application in the form of a module loadable via kdeinit.
-# A library named kdeinit_<name> will be created and a small executable
-# which links to it.
-#
-#
-#
-# The option KDE3_ENABLE_FINAL to enable all-in-one compilation is no
-# longer supported.
-#
-#
-#
-# Author: Alexander Neundorf <neundorf@kde.org>
+#[=======================================================================[.rst:
+FindKDE3
+--------
+
+Find the KDE3 include and library dirs, KDE preprocessors and define a some macros
+
+
+
+This module defines the following variables:
+
+``KDE3_DEFINITIONS``
+ compiler definitions required for compiling KDE software
+``KDE3_INCLUDE_DIR``
+ the KDE include directory
+``KDE3_INCLUDE_DIRS``
+ the KDE and the Qt include directory, for use with include_directories()
+``KDE3_LIB_DIR``
+ the directory where the KDE libraries are installed, for use with link_directories()
+``QT_AND_KDECORE_LIBS``
+ this contains both the Qt and the kdecore library
+``KDE3_DCOPIDL_EXECUTABLE``
+ the dcopidl executable
+``KDE3_DCOPIDL2CPP_EXECUTABLE``
+ the dcopidl2cpp executable
+``KDE3_KCFGC_EXECUTABLE``
+ the kconfig_compiler executable
+``KDE3_FOUND``
+ set to TRUE if all of the above has been found
+
+The following user adjustable options are provided:
+
+``KDE3_BUILD_TESTS``
+ enable this to build KDE testcases
+
+It also adds the following macros (from KDE3Macros.cmake) SRCS_VAR is
+always the variable which contains the list of source files for your
+application or library.
+
+KDE3_AUTOMOC(file1 ... fileN)
+
+::
+
+ Call this if you want to have automatic moc file handling.
+ This means if you include "foo.moc" in the source file foo.cpp
+ a moc file for the header foo.h will be created automatically.
+ You can set the property SKIP_AUTOMAKE using set_source_files_properties()
+ to exclude some files in the list from being processed.
+
+
+
+KDE3_ADD_MOC_FILES(SRCS_VAR file1 ... fileN )
+
+::
+
+ If you don't use the KDE3_AUTOMOC() macro, for the files
+ listed here moc files will be created (named "foo.moc.cpp")
+
+
+
+KDE3_ADD_DCOP_SKELS(SRCS_VAR header1.h ... headerN.h )
+
+::
+
+ Use this to generate DCOP skeletions from the listed headers.
+
+
+
+KDE3_ADD_DCOP_STUBS(SRCS_VAR header1.h ... headerN.h )
+
+::
+
+ Use this to generate DCOP stubs from the listed headers.
+
+
+
+KDE3_ADD_UI_FILES(SRCS_VAR file1.ui ... fileN.ui )
+
+::
+
+ Use this to add the Qt designer ui files to your application/library.
+
+
+
+KDE3_ADD_KCFG_FILES(SRCS_VAR file1.kcfgc ... fileN.kcfgc )
+
+::
+
+ Use this to add KDE kconfig compiler files to your application/library.
+
+
+
+KDE3_INSTALL_LIBTOOL_FILE(target)
+
+::
+
+ This will create and install a simple libtool file for the given target.
+
+
+
+KDE3_ADD_EXECUTABLE(name file1 ... fileN )
+
+::
+
+ Currently identical to add_executable(), may provide some advanced
+ features in the future.
+
+
+
+KDE3_ADD_KPART(name [WITH_PREFIX] file1 ... fileN )
+
+::
+
+ Create a KDE plugin (KPart, kioslave, etc.) from the given source files.
+ If WITH_PREFIX is given, the resulting plugin will have the prefix "lib",
+ otherwise it won't.
+ It creates and installs an appropriate libtool la-file.
+
+
+
+KDE3_ADD_KDEINIT_EXECUTABLE(name file1 ... fileN )
+
+::
+
+ Create a KDE application in the form of a module loadable via kdeinit.
+ A library named kdeinit_<name> will be created and a small executable
+ which links to it.
+
+
+
+The option KDE3_ENABLE_FINAL to enable all-in-one compilation is no
+longer supported.
+
+
+
+Author: Alexander Neundorf <neundorf@kde.org>
+#]=======================================================================]
if(NOT UNIX AND KDE3_FIND_REQUIRED)
message(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported")
diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake
index bb98e53bd..c04804be9 100644
--- a/Modules/FindKDE4.cmake
+++ b/Modules/FindKDE4.cmake
@@ -1,29 +1,30 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindKDE4
-# --------
-#
-#
-#
-# Find KDE4 and provide all necessary variables and macros to compile
-# software for it. It looks for KDE 4 in the following directories in
-# the given order:
-#
-# ::
-#
-# CMAKE_INSTALL_PREFIX
-# KDEDIRS
-# /opt/kde4
-#
-#
-#
-# Please look in FindKDE4Internal.cmake and KDE4Macros.cmake for more
-# information. They are installed with the KDE 4 libraries in
-# $KDEDIRS/share/apps/cmake/modules/.
-#
-# Author: Alexander Neundorf <neundorf@kde.org>
+#[=======================================================================[.rst:
+FindKDE4
+--------
+
+
+
+Find KDE4 and provide all necessary variables and macros to compile
+software for it. It looks for KDE 4 in the following directories in
+the given order:
+
+::
+
+ CMAKE_INSTALL_PREFIX
+ KDEDIRS
+ /opt/kde4
+
+
+
+Please look in FindKDE4Internal.cmake and KDE4Macros.cmake for more
+information. They are installed with the KDE 4 libraries in
+$KDEDIRS/share/apps/cmake/modules/.
+
+Author: Alexander Neundorf <neundorf@kde.org>
+#]=======================================================================]
# If Qt3 has already been found, fail.
if(QT_QT_LIBRARY)
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index dc94079ef..d6646eaac 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -1,48 +1,76 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindLAPACK
-# ----------
-#
-# Find LAPACK library
-#
-# This module finds an installed fortran library that implements the
-# LAPACK linear-algebra interface (see http://www.netlib.org/lapack/).
-#
-# The approach follows that taken for the autoconf macro file,
-# acx_lapack.m4 (distributed at
-# http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).
-#
-# This module sets the following variables:
-#
-# ::
-#
-# LAPACK_FOUND - set to true if a library implementing the LAPACK interface
-# is found
-# LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l
-# and -L).
-# LAPACK_LIBRARIES - uncached list of libraries (using full path name) to
-# link against to use LAPACK
-# LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to
-# link against to use LAPACK95
-# LAPACK95_FOUND - set to true if a library implementing the LAPACK f95
-# interface is found
-# BLA_STATIC if set on this determines what kind of linkage we do (static)
-# BLA_VENDOR if set checks only the specified vendor, if not set checks
-# all the possibilities
-# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
-#
-# List of vendors (BLA_VENDOR) valid in this module:
-#
-# * Intel(mkl)
-# * OpenBLAS
-# * FLAME
-# * ACML
-# * Apple
-# * NAS
-# * Generic
-#
+#[=======================================================================[.rst:
+FindLAPACK
+----------
+
+Find LAPACK library
+
+This module finds an installed fortran library that implements the
+LAPACK linear-algebra interface (see http://www.netlib.org/lapack/).
+
+The approach follows that taken for the autoconf macro file,
+acx_lapack.m4 (distributed at
+http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).
+
+Input Variables
+^^^^^^^^^^^^^^^
+
+The following variables may be set to influence this module's behavior:
+
+``BLA_STATIC``
+ if ``ON`` use static linkage
+
+``BLA_VENDOR``
+ If set, checks only the specified vendor, if not set checks all the
+ possibilities. List of vendors valid in this module:
+
+ * ``Intel10_32`` (intel mkl v10 32 bit)
+ * ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model)
+ * ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model)
+ * ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model)
+ * ``Intel10_64ilp_seq`` (intel mkl v10+ 64 bit, sequential code, ilp64 model)
+ * ``Intel`` (obsolete versions of mkl 32 and 64 bit)
+ * ``OpenBLAS``
+ * ``FLAME``
+ * ``ACML``
+ * ``Apple``
+ * ``NAS``
+ * ``Generic``
+
+``BLA_F95``
+ if ``ON`` tries to find BLAS95/LAPACK95
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``LAPACK_FOUND``
+ library implementing the LAPACK interface is found
+``LAPACK_LINKER_FLAGS``
+ uncached list of required linker flags (excluding -l and -L).
+``LAPACK_LIBRARIES``
+ uncached list of libraries (using full path name) to link against
+ to use LAPACK
+``LAPACK95_LIBRARIES``
+ uncached list of libraries (using full path name) to link against
+ to use LAPACK95
+``LAPACK95_FOUND``
+ library implementing the LAPACK95 interface is found
+
+.. note::
+
+ C or CXX must be enabled to use Intel MKL
+
+ For example, to use Intel MKL libraries and/or Intel compiler:
+
+ .. code-block:: cmake
+
+ set(BLA_VENDOR Intel10_64lp)
+ find_package(LAPACK)
+#]=======================================================================]
set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
@@ -95,6 +123,9 @@ if (NOT _libdir)
set(_libdir ENV LD_LIBRARY_PATH)
endif ()
endif ()
+
+list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+
foreach(_library ${_list})
set(_combined_name ${_combined_name}_${_library})
@@ -109,7 +140,7 @@ foreach(_library ${_list})
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif ()
else ()
- if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# for ubuntu's libblas3gf and liblapack3gf packages
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
endif ()
@@ -138,7 +169,6 @@ if(_libraries_work)
check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
endif ()
set(CMAKE_REQUIRED_LIBRARIES)
- mark_as_advanced(${_prefix}${_combined_name}_WORKS)
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
endif()
@@ -174,6 +204,84 @@ if(BLAS_FOUND)
endif()
endif ()
+#intel lapack
+if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
+ if (NOT WIN32)
+ set(LAPACK_mkl_LM "-lm")
+ set(LAPACK_mkl_LDL "-ldl")
+ endif ()
+ if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
+ if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+ find_PACKAGE(Threads)
+ else()
+ find_package(Threads REQUIRED)
+ endif()
+
+ if (BLA_VENDOR MATCHES "_64ilp")
+ set(LAPACK_mkl_ILP_MODE "ilp64")
+ else ()
+ set(LAPACK_mkl_ILP_MODE "lp64")
+ endif ()
+
+ set(LAPACK_SEARCH_LIBS "")
+
+ if (BLA_F95)
+ set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95")
+ set(_LIBRARIES LAPACK95_LIBRARIES)
+ set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
+
+ # old
+ list(APPEND LAPACK_SEARCH_LIBS
+ "mkl_lapack95")
+ # new >= 10.3
+ list(APPEND LAPACK_SEARCH_LIBS
+ "mkl_intel_c")
+ list(APPEND LAPACK_SEARCH_LIBS
+ "mkl_lapack95_${LAPACK_mkl_ILP_MODE}")
+ else()
+ set(LAPACK_mkl_SEARCH_SYMBOL "cheev")
+ set(_LIBRARIES LAPACK_LIBRARIES)
+ set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
+
+ # old
+ list(APPEND LAPACK_SEARCH_LIBS
+ "mkl_lapack")
+ endif()
+
+ # First try empty lapack libs
+ if (NOT ${_LIBRARIES})
+ check_lapack_libraries(
+ ${_LIBRARIES}
+ LAPACK
+ ${LAPACK_mkl_SEARCH_SYMBOL}
+ ""
+ ""
+ "${_BLAS_LIBRARIES}"
+ ""
+ )
+ endif ()
+ # Then try the search libs
+ foreach (IT ${LAPACK_SEARCH_LIBS})
+ if (NOT ${_LIBRARIES})
+ check_lapack_libraries(
+ ${_LIBRARIES}
+ LAPACK
+ ${LAPACK_mkl_SEARCH_SYMBOL}
+ ""
+ "${IT}"
+ "${_BLAS_LIBRARIES}"
+ "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}"
+ )
+ endif ()
+ endforeach ()
+
+ unset(LAPACK_mkl_ILP_MODE)
+ unset(LAPACK_mkl_SEARCH_SYMBOL)
+ unset(LAPACK_mkl_LM)
+ unset(LAPACK_mkl_LDL)
+ endif ()
+endif()
+
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
@@ -266,82 +374,7 @@ if (BLA_VENDOR STREQUAL "Generic" OR
)
endif ()
endif ()
-#intel lapack
-if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
- if (NOT WIN32)
- set(LM "-lm")
- endif ()
- if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
- if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
- find_PACKAGE(Threads)
- else()
- find_package(Threads REQUIRED)
- endif()
- if (BLA_VENDOR MATCHES "_64ilp")
- set(BLAS_mkl_ILP_MODE "ilp64")
- else ()
- set(BLAS_mkl_ILP_MODE "lp64")
- endif ()
-
- set(LAPACK_SEARCH_LIBS "")
-
- if (BLA_F95)
- set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95")
- set(_LIBRARIES LAPACK95_LIBRARIES)
- set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
-
- # old
- list(APPEND LAPACK_SEARCH_LIBS
- "mkl_lapack95")
- # new >= 10.3
- list(APPEND LAPACK_SEARCH_LIBS
- "mkl_intel_c")
- list(APPEND LAPACK_SEARCH_LIBS
- "mkl_lapack95_${BLAS_mkl_ILP_MODE}")
- else()
- set(LAPACK_mkl_SEARCH_SYMBOL "cheev")
- set(_LIBRARIES LAPACK_LIBRARIES)
- set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
-
- # old
- list(APPEND LAPACK_SEARCH_LIBS
- "mkl_lapack")
- # new >= 10.3
- list(APPEND LAPACK_SEARCH_LIBS
- "mkl_gf_${BLAS_mkl_ILP_MODE}")
- endif()
-
- # First try empty lapack libs
- if (NOT ${_LIBRARIES})
- check_lapack_libraries(
- ${_LIBRARIES}
- LAPACK
- ${LAPACK_mkl_SEARCH_SYMBOL}
- ""
- ""
- "${_BLAS_LIBRARIES}"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif ()
- # Then try the search libs
- foreach (IT ${LAPACK_SEARCH_LIBS})
- if (NOT ${_LIBRARIES})
- check_lapack_libraries(
- ${_LIBRARIES}
- LAPACK
- ${LAPACK_mkl_SEARCH_SYMBOL}
- ""
- "${IT}"
- "${_BLAS_LIBRARIES}"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif ()
- endforeach ()
-
- unset(BLAS_mkl_ILP_MODE)
- endif ()
-endif()
else()
message(STATUS "LAPACK requires BLAS")
endif()
diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake
index d1f4fa497..01f479397 100644
--- a/Modules/FindLATEX.cmake
+++ b/Modules/FindLATEX.cmake
@@ -1,56 +1,57 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindLATEX
-# ---------
-#
-# Find Latex
-#
-# This module finds an installed Latex and determines the location
-# of the compiler. Additionally the module looks for Latex-related
-# software like BibTeX.
-#
-# This module sets the following result variables::
-#
-# LATEX_FOUND: whether found Latex and requested components
-# LATEX_<component>_FOUND: whether found <component>
-# LATEX_COMPILER: path to the LaTeX compiler
-# PDFLATEX_COMPILER: path to the PdfLaTeX compiler
-# XELATEX_COMPILER: path to the XeLaTeX compiler
-# LUALATEX_COMPILER: path to the LuaLaTeX compiler
-# BIBTEX_COMPILER: path to the BibTeX compiler
-# BIBER_COMPILER: path to the Biber compiler
-# MAKEINDEX_COMPILER: path to the MakeIndex compiler
-# XINDY_COMPILER: path to the xindy compiler
-# DVIPS_CONVERTER: path to the DVIPS converter
-# DVIPDF_CONVERTER: path to the DVIPDF converter
-# PS2PDF_CONVERTER: path to the PS2PDF converter
-# PDFTOPS_CONVERTER: path to the pdftops converter
-# LATEX2HTML_CONVERTER: path to the LaTeX2Html converter
-# HTLATEX_COMPILER: path to the htlatex compiler
-#
-# Possible components are::
-#
-# PDFLATEX
-# XELATEX
-# LUALATEX
-# BIBTEX
-# BIBER
-# MAKEINDEX
-# XINDY
-# DVIPS
-# DVIPDF
-# PS2PDF
-# PDFTOPS
-# LATEX2HTML
-# HTLATEX
-#
-# Example Usages::
-#
-# find_package(LATEX)
-# find_package(LATEX COMPONENTS PDFLATEX)
-# find_package(LATEX COMPONENTS BIBTEX PS2PDF)
+#[=======================================================================[.rst:
+FindLATEX
+---------
+
+Find Latex
+
+This module finds an installed Latex and determines the location
+of the compiler. Additionally the module looks for Latex-related
+software like BibTeX.
+
+This module sets the following result variables::
+
+ LATEX_FOUND: whether found Latex and requested components
+ LATEX_<component>_FOUND: whether found <component>
+ LATEX_COMPILER: path to the LaTeX compiler
+ PDFLATEX_COMPILER: path to the PdfLaTeX compiler
+ XELATEX_COMPILER: path to the XeLaTeX compiler
+ LUALATEX_COMPILER: path to the LuaLaTeX compiler
+ BIBTEX_COMPILER: path to the BibTeX compiler
+ BIBER_COMPILER: path to the Biber compiler
+ MAKEINDEX_COMPILER: path to the MakeIndex compiler
+ XINDY_COMPILER: path to the xindy compiler
+ DVIPS_CONVERTER: path to the DVIPS converter
+ DVIPDF_CONVERTER: path to the DVIPDF converter
+ PS2PDF_CONVERTER: path to the PS2PDF converter
+ PDFTOPS_CONVERTER: path to the pdftops converter
+ LATEX2HTML_CONVERTER: path to the LaTeX2Html converter
+ HTLATEX_COMPILER: path to the htlatex compiler
+
+Possible components are::
+
+ PDFLATEX
+ XELATEX
+ LUALATEX
+ BIBTEX
+ BIBER
+ MAKEINDEX
+ XINDY
+ DVIPS
+ DVIPDF
+ PS2PDF
+ PDFTOPS
+ LATEX2HTML
+ HTLATEX
+
+Example Usages::
+
+ find_package(LATEX)
+ find_package(LATEX COMPONENTS PDFLATEX)
+ find_package(LATEX COMPONENTS BIBTEX PS2PDF)
+#]=======================================================================]
if (WIN32)
# Try to find the MikTex binary path (look for its package manager).
diff --git a/Modules/FindLTTngUST.cmake b/Modules/FindLTTngUST.cmake
index 00d5e7aed..a074187ca 100644
--- a/Modules/FindLTTngUST.cmake
+++ b/Modules/FindLTTngUST.cmake
@@ -1,37 +1,38 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindLTTngUST
-# ------------
-#
-# This module finds the `LTTng-UST <http://lttng.org/>`__ library.
-#
-# Imported target
-# ^^^^^^^^^^^^^^^
-#
-# This module defines the following :prop_tgt:`IMPORTED` target:
-#
-# ``LTTng::UST``
-# The LTTng-UST library, if found
-#
-# Result variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module sets the following
-#
-# ``LTTNGUST_FOUND``
-# ``TRUE`` if system has LTTng-UST
-# ``LTTNGUST_INCLUDE_DIRS``
-# The LTTng-UST include directories
-# ``LTTNGUST_LIBRARIES``
-# The libraries needed to use LTTng-UST
-# ``LTTNGUST_VERSION_STRING``
-# The LTTng-UST version
-# ``LTTNGUST_HAS_TRACEF``
-# ``TRUE`` if the ``tracef()`` API is available in the system's LTTng-UST
-# ``LTTNGUST_HAS_TRACELOG``
-# ``TRUE`` if the ``tracelog()`` API is available in the system's LTTng-UST
+#[=======================================================================[.rst:
+FindLTTngUST
+------------
+
+This module finds the `LTTng-UST <http://lttng.org/>`__ library.
+
+Imported target
+^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` target:
+
+``LTTng::UST``
+ The LTTng-UST library, if found
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module sets the following
+
+``LTTNGUST_FOUND``
+ ``TRUE`` if system has LTTng-UST
+``LTTNGUST_INCLUDE_DIRS``
+ The LTTng-UST include directories
+``LTTNGUST_LIBRARIES``
+ The libraries needed to use LTTng-UST
+``LTTNGUST_VERSION_STRING``
+ The LTTng-UST version
+``LTTNGUST_HAS_TRACEF``
+ ``TRUE`` if the ``tracef()`` API is available in the system's LTTng-UST
+``LTTNGUST_HAS_TRACELOG``
+ ``TRUE`` if the ``tracelog()`` API is available in the system's LTTng-UST
+#]=======================================================================]
find_path(LTTNGUST_INCLUDE_DIRS NAMES lttng/tracepoint.h)
find_library(LTTNGUST_LIBRARIES NAMES lttng-ust)
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake
index 38e512fa3..34fc2e252 100644
--- a/Modules/FindLibArchive.cmake
+++ b/Modules/FindLibArchive.cmake
@@ -1,20 +1,21 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindLibArchive
-# --------------
-#
-# Find libarchive library and headers
-#
-# The module defines the following variables:
-#
-# ::
-#
-# LibArchive_FOUND - true if libarchive was found
-# LibArchive_INCLUDE_DIRS - include search path
-# LibArchive_LIBRARIES - libraries to link
-# LibArchive_VERSION - libarchive 3-component version number
+#[=======================================================================[.rst:
+FindLibArchive
+--------------
+
+Find libarchive library and headers
+
+The module defines the following variables:
+
+::
+
+ LibArchive_FOUND - true if libarchive was found
+ LibArchive_INCLUDE_DIRS - include search path
+ LibArchive_LIBRARIES - libraries to link
+ LibArchive_VERSION - libarchive 3-component version number
+#]=======================================================================]
find_path(LibArchive_INCLUDE_DIR
NAMES archive.h
diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake
index d203eafa1..622574438 100644
--- a/Modules/FindLibLZMA.cmake
+++ b/Modules/FindLibLZMA.cmake
@@ -1,26 +1,45 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindLibLZMA
-# -----------
-#
-# Find LibLZMA
-#
-# Find LibLZMA headers and library
-#
-# ::
-#
-# LIBLZMA_FOUND - True if liblzma is found.
-# LIBLZMA_INCLUDE_DIRS - Directory where liblzma headers are located.
-# LIBLZMA_LIBRARIES - Lzma libraries to link against.
-# LIBLZMA_HAS_AUTO_DECODER - True if lzma_auto_decoder() is found (required).
-# LIBLZMA_HAS_EASY_ENCODER - True if lzma_easy_encoder() is found (required).
-# LIBLZMA_HAS_LZMA_PRESET - True if lzma_lzma_preset() is found (required).
-# LIBLZMA_VERSION_MAJOR - The major version of lzma
-# LIBLZMA_VERSION_MINOR - The minor version of lzma
-# LIBLZMA_VERSION_PATCH - The patch version of lzma
-# LIBLZMA_VERSION_STRING - version number as a string (ex: "5.0.3")
+#[=======================================================================[.rst:
+FindLibLZMA
+-----------
+
+Find LZMA compression algorithm headers and library.
+
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``LibLZMA::LibLZMA``, if
+liblzma has been found.
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``LIBLZMA_FOUND``
+ True if liblzma headers and library were found.
+``LIBLZMA_INCLUDE_DIRS``
+ Directory where liblzma headers are located.
+``LIBLZMA_LIBRARIES``
+ Lzma libraries to link against.
+``LIBLZMA_HAS_AUTO_DECODER``
+ True if lzma_auto_decoder() is found (required).
+``LIBLZMA_HAS_EASY_ENCODER``
+ True if lzma_easy_encoder() is found (required).
+``LIBLZMA_HAS_LZMA_PRESET``
+ True if lzma_lzma_preset() is found (required).
+``LIBLZMA_VERSION_MAJOR``
+ The major version of lzma
+``LIBLZMA_VERSION_MINOR``
+ The minor version of lzma
+``LIBLZMA_VERSION_PATCH``
+ The patch version of lzma
+``LIBLZMA_VERSION_STRING``
+ version number as a string (ex: "5.0.3")
+#]=======================================================================]
find_path(LIBLZMA_INCLUDE_DIR lzma.h )
find_library(LIBLZMA_LIBRARY NAMES lzma liblzma)
@@ -50,17 +69,23 @@ if (LIBLZMA_LIBRARY)
endif ()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZMA REQUIRED_VARS LIBLZMA_INCLUDE_DIR
- LIBLZMA_LIBRARY
+find_package_handle_standard_args(LibLZMA REQUIRED_VARS LIBLZMA_LIBRARY
+ LIBLZMA_INCLUDE_DIR
LIBLZMA_HAS_AUTO_DECODER
LIBLZMA_HAS_EASY_ENCODER
LIBLZMA_HAS_LZMA_PRESET
VERSION_VAR LIBLZMA_VERSION_STRING
)
+mark_as_advanced( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY )
if (LIBLZMA_FOUND)
set(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY})
set(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR})
+ if(NOT TARGET LibLZMA::LibLZMA)
+ add_library(LibLZMA::LibLZMA UNKNOWN IMPORTED)
+ set_target_properties(LibLZMA::LibLZMA PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES ${LIBLZMA_INCLUDE_DIR}
+ IMPORTED_LINK_INTERFACE_LANGUAGES C
+ IMPORTED_LOCATION ${LIBLZMA_LIBRARY})
+ endif()
endif ()
-
-mark_as_advanced( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY )
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index 615de49e3..47c0e7907 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -1,47 +1,48 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindLibXml2
-# -----------
-#
-# Find the XML processing library (libxml2).
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines :prop_tgt:`IMPORTED` target ``LibXml2::LibXml2``, if
-# libxml2 has been found.
-#
-# Result variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project:
-#
-# ``LIBXML2_FOUND``
-# true if libxml2 headers and libraries were found
-# ``LIBXML2_INCLUDE_DIR``
-# the directory containing LibXml2 headers
-# ``LIBXML2_INCLUDE_DIRS``
-# list of the include directories needed to use LibXml2
-# ``LIBXML2_LIBRARIES``
-# LibXml2 libraries to be linked
-# ``LIBXML2_DEFINITIONS``
-# the compiler switches required for using LibXml2
-# ``LIBXML2_XMLLINT_EXECUTABLE``
-# path to the XML checking tool xmllint coming with LibXml2
-# ``LIBXML2_VERSION_STRING``
-# the version of LibXml2 found (since CMake 2.8.8)
-#
-# Cache variables
-# ^^^^^^^^^^^^^^^
-#
-# The following cache variables may also be set:
-#
-# ``LIBXML2_INCLUDE_DIR``
-# the directory containing LibXml2 headers
-# ``LIBXML2_LIBRARY``
-# path to the LibXml2 library
+#[=======================================================================[.rst:
+FindLibXml2
+-----------
+
+Find the XML processing library (libxml2).
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``LibXml2::LibXml2``, if
+libxml2 has been found.
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``LibXml2_FOUND``
+ true if libxml2 headers and libraries were found
+``LIBXML2_INCLUDE_DIR``
+ the directory containing LibXml2 headers
+``LIBXML2_INCLUDE_DIRS``
+ list of the include directories needed to use LibXml2
+``LIBXML2_LIBRARIES``
+ LibXml2 libraries to be linked
+``LIBXML2_DEFINITIONS``
+ the compiler switches required for using LibXml2
+``LIBXML2_XMLLINT_EXECUTABLE``
+ path to the XML checking tool xmllint coming with LibXml2
+``LIBXML2_VERSION_STRING``
+ the version of LibXml2 found (since CMake 2.8.8)
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``LIBXML2_INCLUDE_DIR``
+ the directory containing LibXml2 headers
+``LIBXML2_LIBRARY``
+ path to the LibXml2 library
+#]=======================================================================]
# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake
index abd1963d5..4cca64f2c 100644
--- a/Modules/FindLibXslt.cmake
+++ b/Modules/FindLibXslt.cmake
@@ -1,29 +1,30 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindLibXslt
-# -----------
-#
-# Try to find the LibXslt library
-#
-# Once done this will define
-#
-# ::
-#
-# LIBXSLT_FOUND - system has LibXslt
-# LIBXSLT_INCLUDE_DIR - the LibXslt include directory
-# LIBXSLT_LIBRARIES - Link these to LibXslt
-# LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt
-# LIBXSLT_VERSION_STRING - version of LibXslt found (since CMake 2.8.8)
-#
-# Additionally, the following two variables are set (but not required
-# for using xslt):
-#
-# ``LIBXSLT_EXSLT_LIBRARIES``
-# Link to these if you need to link against the exslt library.
-# ``LIBXSLT_XSLTPROC_EXECUTABLE``
-# Contains the full path to the xsltproc executable if found.
+#[=======================================================================[.rst:
+FindLibXslt
+-----------
+
+Try to find the LibXslt library
+
+Once done this will define
+
+::
+
+ LIBXSLT_FOUND - system has LibXslt
+ LIBXSLT_INCLUDE_DIR - the LibXslt include directory
+ LIBXSLT_LIBRARIES - Link these to LibXslt
+ LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt
+ LIBXSLT_VERSION_STRING - version of LibXslt found (since CMake 2.8.8)
+
+Additionally, the following two variables are set (but not required
+for using xslt):
+
+``LIBXSLT_EXSLT_LIBRARIES``
+ Link to these if you need to link against the exslt library.
+``LIBXSLT_XSLTPROC_EXECUTABLE``
+ Contains the full path to the xsltproc executable if found.
+#]=======================================================================]
# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
diff --git a/Modules/FindLibinput.cmake b/Modules/FindLibinput.cmake
new file mode 100644
index 000000000..c1fe45562
--- /dev/null
+++ b/Modules/FindLibinput.cmake
@@ -0,0 +1,82 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindLibinput
+------------
+
+Find libinput headers and library.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+``Libinput::Libinput``
+ The libinput library, if found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This will define the following variables in your project:
+
+``Libinput_FOUND``
+ true if (the requested version of) libinput is available.
+``Libinput_VERSION``
+ the version of libinput.
+``Libinput_LIBRARIES``
+ the libraries to link against to use libinput.
+``Libinput_INCLUDE_DIRS``
+ where to find the libinput headers.
+``Libinput_COMPILE_OPTIONS``
+ this should be passed to target_compile_options(), if the
+ target is not used for linking
+
+#]=======================================================================]
+
+
+# Use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+find_package(PkgConfig QUIET)
+pkg_check_modules(PKG_Libinput QUIET libinput)
+
+set(Libinput_COMPILE_OPTIONS ${PKG_Libinput_CFLAGS_OTHER})
+set(Libinput_VERSION ${PKG_Libinput_VERSION})
+
+find_path(Libinput_INCLUDE_DIR
+ NAMES
+ libinput.h
+ HINTS
+ ${PKG_Libinput_INCLUDE_DIRS}
+)
+find_library(Libinput_LIBRARY
+ NAMES
+ input
+ HINTS
+ ${PKG_Libinput_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libinput
+ FOUND_VAR
+ Libinput_FOUND
+ REQUIRED_VARS
+ Libinput_LIBRARY
+ Libinput_INCLUDE_DIR
+ VERSION_VAR
+ Libinput_VERSION
+)
+
+if(Libinput_FOUND AND NOT TARGET Libinput::Libinput)
+ add_library(Libinput::Libinput UNKNOWN IMPORTED)
+ set_target_properties(Libinput::Libinput PROPERTIES
+ IMPORTED_LOCATION "${Libinput_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${Libinput_COMPILE_OPTIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Libinput_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(Libinput_LIBRARY Libinput_INCLUDE_DIR)
+
+if(Libinput_FOUND)
+ set(Libinput_LIBRARIES ${Libinput_LIBRARY})
+ set(Libinput_INCLUDE_DIRS ${Libinput_INCLUDE_DIR})
+endif()
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
index 68530b353..eb3b5fb0d 100644
--- a/Modules/FindLua.cmake
+++ b/Modules/FindLua.cmake
@@ -1,40 +1,41 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindLua
-# -------
-#
-#
-#
-# Locate Lua library This module defines
-#
-# ::
-#
-# LUA_FOUND - if false, do not try to link to Lua
-# LUA_LIBRARIES - both lua and lualib
-# LUA_INCLUDE_DIR - where to find lua.h
-# LUA_VERSION_STRING - the version of Lua found
-# LUA_VERSION_MAJOR - the major version of Lua
-# LUA_VERSION_MINOR - the minor version of Lua
-# LUA_VERSION_PATCH - the patch version of Lua
-#
-#
-#
-# Note that the expected include convention is
-#
-# ::
-#
-# #include "lua.h"
-#
-# and not
-#
-# ::
-#
-# #include <lua/lua.h>
-#
-# This is because, the lua location is not standardized and may exist in
-# locations other than lua/
+#[=======================================================================[.rst:
+FindLua
+-------
+
+
+
+Locate Lua library This module defines
+
+::
+
+ LUA_FOUND - if false, do not try to link to Lua
+ LUA_LIBRARIES - both lua and lualib
+ LUA_INCLUDE_DIR - where to find lua.h
+ LUA_VERSION_STRING - the version of Lua found
+ LUA_VERSION_MAJOR - the major version of Lua
+ LUA_VERSION_MINOR - the minor version of Lua
+ LUA_VERSION_PATCH - the patch version of Lua
+
+
+
+Note that the expected include convention is
+
+::
+
+ #include "lua.h"
+
+and not
+
+::
+
+ #include <lua/lua.h>
+
+This is because, the lua location is not standardized and may exist in
+locations other than lua/
+#]=======================================================================]
cmake_policy(PUSH) # Policies apply to functions at definition-time
cmake_policy(SET CMP0012 NEW) # For while(TRUE)
diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake
index 315f301b7..aafc05664 100644
--- a/Modules/FindLua50.cmake
+++ b/Modules/FindLua50.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindLua50
-# ---------
-#
-#
-#
-# Locate Lua library This module defines
-#
-# ::
-#
-# LUA50_FOUND, if false, do not try to link to Lua
-# LUA_LIBRARIES, both lua and lualib
-# LUA_INCLUDE_DIR, where to find lua.h and lualib.h (and probably lauxlib.h)
-#
-#
-#
-# Note that the expected include convention is
-#
-# ::
-#
-# #include "lua.h"
-#
-# and not
-#
-# ::
-#
-# #include <lua/lua.h>
-#
-# This is because, the lua location is not standardized and may exist in
-# locations other than lua/
+#[=======================================================================[.rst:
+FindLua50
+---------
+
+
+
+Locate Lua library This module defines
+
+::
+
+ LUA50_FOUND, if false, do not try to link to Lua
+ LUA_LIBRARIES, both lua and lualib
+ LUA_INCLUDE_DIR, where to find lua.h and lualib.h (and probably lauxlib.h)
+
+
+
+Note that the expected include convention is
+
+::
+
+ #include "lua.h"
+
+and not
+
+::
+
+ #include <lua/lua.h>
+
+This is because, the lua location is not standardized and may exist in
+locations other than lua/
+#]=======================================================================]
find_path(LUA_INCLUDE_DIR lua.h
HINTS
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
index f2b232216..31eaf87bb 100644
--- a/Modules/FindLua51.cmake
+++ b/Modules/FindLua51.cmake
@@ -1,37 +1,38 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindLua51
-# ---------
-#
-#
-#
-# Locate Lua library This module defines
-#
-# ::
-#
-# LUA51_FOUND, if false, do not try to link to Lua
-# LUA_LIBRARIES
-# LUA_INCLUDE_DIR, where to find lua.h
-# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
-#
-#
-#
-# Note that the expected include convention is
-#
-# ::
-#
-# #include "lua.h"
-#
-# and not
-#
-# ::
-#
-# #include <lua/lua.h>
-#
-# This is because, the lua location is not standardized and may exist in
-# locations other than lua/
+#[=======================================================================[.rst:
+FindLua51
+---------
+
+
+
+Locate Lua library This module defines
+
+::
+
+ LUA51_FOUND, if false, do not try to link to Lua
+ LUA_LIBRARIES
+ LUA_INCLUDE_DIR, where to find lua.h
+ LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
+
+
+
+Note that the expected include convention is
+
+::
+
+ #include "lua.h"
+
+and not
+
+::
+
+ #include <lua/lua.h>
+
+This is because, the lua location is not standardized and may exist in
+locations other than lua/
+#]=======================================================================]
find_path(LUA_INCLUDE_DIR lua.h
HINTS
diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake
index 3baaf3208..9738ac56f 100644
--- a/Modules/FindMFC.cmake
+++ b/Modules/FindMFC.cmake
@@ -1,20 +1,21 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindMFC
-# -------
-#
-# Find MFC on Windows
-#
-# Find the native MFC - i.e. decide if an application can link to the
-# MFC libraries.
-#
-# ::
-#
-# MFC_FOUND - Was MFC support found
-#
-# You don't need to include anything or link anything to use it.
+#[=======================================================================[.rst:
+FindMFC
+-------
+
+Find MFC on Windows
+
+Find the native MFC - i.e. decide if an application can link to the
+MFC libraries.
+
+::
+
+ MFC_FOUND - Was MFC support found
+
+You don't need to include anything or link anything to use it.
+#]=======================================================================]
# Assume no MFC support
set(MFC_FOUND "NO")
diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake
index 850a57e4d..e5a80e389 100644
--- a/Modules/FindMPEG.cmake
+++ b/Modules/FindMPEG.cmake
@@ -1,26 +1,27 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindMPEG
-# --------
-#
-# Find the native MPEG includes and library
-#
-# This module defines
-#
-# ::
-#
-# MPEG_INCLUDE_DIR, where to find MPEG.h, etc.
-# MPEG_LIBRARIES, the libraries required to use MPEG.
-# MPEG_FOUND, If false, do not try to use MPEG.
-#
-# also defined, but not for general use are
-#
-# ::
-#
-# MPEG_mpeg2_LIBRARY, where to find the MPEG library.
-# MPEG_vo_LIBRARY, where to find the vo library.
+#[=======================================================================[.rst:
+FindMPEG
+--------
+
+Find the native MPEG includes and library
+
+This module defines
+
+::
+
+ MPEG_INCLUDE_DIR, where to find MPEG.h, etc.
+ MPEG_LIBRARIES, the libraries required to use MPEG.
+ MPEG_FOUND, If false, do not try to use MPEG.
+
+also defined, but not for general use are
+
+::
+
+ MPEG_mpeg2_LIBRARY, where to find the MPEG library.
+ MPEG_vo_LIBRARY, where to find the vo library.
+#]=======================================================================]
find_path(MPEG_INCLUDE_DIR
NAMES mpeg2.h mpeg2dec/mpeg2.h mpeg2dec/include/video_out.h)
diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake
index f9ccd6ae1..763d86a85 100644
--- a/Modules/FindMPEG2.cmake
+++ b/Modules/FindMPEG2.cmake
@@ -1,26 +1,27 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindMPEG2
-# ---------
-#
-# Find the native MPEG2 includes and library
-#
-# This module defines
-#
-# ::
-#
-# MPEG2_INCLUDE_DIR, path to mpeg2dec/mpeg2.h, etc.
-# MPEG2_LIBRARIES, the libraries required to use MPEG2.
-# MPEG2_FOUND, If false, do not try to use MPEG2.
-#
-# also defined, but not for general use are
-#
-# ::
-#
-# MPEG2_mpeg2_LIBRARY, where to find the MPEG2 library.
-# MPEG2_vo_LIBRARY, where to find the vo library.
+#[=======================================================================[.rst:
+FindMPEG2
+---------
+
+Find the native MPEG2 includes and library
+
+This module defines
+
+::
+
+ MPEG2_INCLUDE_DIR, path to mpeg2dec/mpeg2.h, etc.
+ MPEG2_LIBRARIES, the libraries required to use MPEG2.
+ MPEG2_FOUND, If false, do not try to use MPEG2.
+
+also defined, but not for general use are
+
+::
+
+ MPEG2_mpeg2_LIBRARY, where to find the MPEG2 library.
+ MPEG2_vo_LIBRARY, where to find the vo library.
+#]=======================================================================]
find_path(MPEG2_INCLUDE_DIR
NAMES mpeg2.h mpeg2dec/mpeg2.h)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index b94e69eac..8c45a8c5f 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1,247 +1,248 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindMPI
-# -------
-#
-# Find a Message Passing Interface (MPI) implementation.
-#
-# The Message Passing Interface (MPI) is a library used to write
-# 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.
-#
-# Variables for using MPI
-# ^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The module exposes the components ``C``, ``CXX``, ``MPICXX`` and ``Fortran``.
-# Each of these controls the various MPI languages to search for.
-# The difference between ``CXX`` and ``MPICXX`` is that ``CXX`` refers to the
-# MPI C API being usable from C++, whereas ``MPICXX`` refers to the MPI-2 C++ API
-# that was removed again in MPI-3.
-#
-# Depending on the enabled components the following variables will be set:
-#
-# ``MPI_FOUND``
-# Variable indicating that MPI settings for all requested languages have been found.
-# If no components are specified, this is true if MPI settings for all enabled languages
-# were detected. Note that the ``MPICXX`` component does not affect this variable.
-# ``MPI_VERSION``
-# Minimal version of MPI detected among the requested languages, or all enabled languages
-# if no components were specified.
-#
-# This module will set the following variables per language in your
-# project, where ``<lang>`` is one of C, CXX, or Fortran:
-#
-# ``MPI_<lang>_FOUND``
-# Variable indicating the MPI settings for ``<lang>`` were found and that
-# simple MPI test programs compile with the provided settings.
-# ``MPI_<lang>_COMPILER``
-# MPI compiler for ``<lang>`` if such a program exists.
-# ``MPI_<lang>_COMPILE_OPTIONS``
-# Compilation options for MPI programs in ``<lang>``, given as a :ref:`;-list <CMake Language Lists>`.
-# ``MPI_<lang>_COMPILE_DEFINITIONS``
-# Compilation definitions for MPI programs in ``<lang>``, given as a :ref:`;-list <CMake Language Lists>`.
-# ``MPI_<lang>_INCLUDE_DIRS``
-# Include path(s) for MPI header.
-# ``MPI_<lang>_LINK_FLAGS``
-# Linker flags for MPI programs.
-# ``MPI_<lang>_LIBRARIES``
-# All libraries to link MPI programs against.
-#
-# Additionally, the following :prop_tgt:`IMPORTED` targets are defined:
-#
-# ``MPI::MPI_<lang>``
-# Target for using MPI from ``<lang>``.
-#
-# The following variables indicating which bindings are present will be defined:
-#
-# ``MPI_MPICXX_FOUND``
-# Variable indicating whether the MPI-2 C++ bindings are present (introduced in MPI-2, removed with MPI-3).
-# ``MPI_Fortran_HAVE_F77_HEADER``
-# True if the Fortran 77 header ``mpif.h`` is available.
-# ``MPI_Fortran_HAVE_F90_MODULE``
-# True if the Fortran 90 module ``mpi`` can be used for accessing MPI (MPI-2 and higher only).
-# ``MPI_Fortran_HAVE_F08_MODULE``
-# True if the Fortran 2008 ``mpi_f08`` is available to MPI programs (MPI-3 and higher only).
-#
-# If possible, the MPI version will be determined by this module. The facilities to detect the MPI version
-# were introduced with MPI-1.2, and therefore cannot be found for older MPI versions.
-#
-# ``MPI_<lang>_VERSION_MAJOR``
-# Major version of MPI implemented for ``<lang>`` by the MPI distribution.
-# ``MPI_<lang>_VERSION_MINOR``
-# Minor version of MPI implemented for ``<lang>`` by the MPI distribution.
-# ``MPI_<lang>_VERSION``
-# MPI version implemented for ``<lang>`` by the MPI distribution.
-#
-# Note that there's no variable for the C bindings being accessible through ``mpi.h``, since the MPI standards
-# always have required this binding to work in both C and C++ code.
-#
-# For running MPI programs, the module sets the following variables
-#
-# ``MPIEXEC_EXECUTABLE``
-# Executable for running MPI programs, if such exists.
-# ``MPIEXEC_NUMPROC_FLAG``
-# Flag to pass to ``mpiexec`` before giving it the number of processors to run on.
-# ``MPIEXEC_MAX_NUMPROCS``
-# Number of MPI processors to utilize. Defaults to the number
-# of processors detected on the host system.
-# ``MPIEXEC_PREFLAGS``
-# Flags to pass to ``mpiexec`` directly before the executable to run.
-# ``MPIEXEC_POSTFLAGS``
-# Flags to pass to ``mpiexec`` after other flags.
-#
-# Variables for locating MPI
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# This module performs a three step search for an MPI implementation:
-#
-# 1. Check if the compiler has MPI support built-in. This is the case if the user passed a
-# compiler wrapper as ``CMAKE_<LANG>_COMPILER`` or if they're on a Cray system.
-# 2. Attempt to find an MPI compiler wrapper and determine the compiler information from it.
-# 3. Try to find an MPI implementation that does not ship such a wrapper by guessing settings.
-# Currently, only Microsoft MPI and MPICH2 on Windows are supported.
-#
-# For controlling the second step, the following variables may be set:
-#
-# ``MPI_<lang>_COMPILER``
-# Search for the specified compiler wrapper and use it.
-# ``MPI_<lang>_COMPILER_FLAGS``
-# Flags to pass to the MPI compiler wrapper during interrogation. Some compiler wrappers
-# support linking debug or tracing libraries if a specific flag is passed and this variable
-# may be used to obtain them.
-# ``MPI_COMPILER_FLAGS``
-# Used to initialize ``MPI_<lang>_COMPILER_FLAGS`` if no language specific flag has been given.
-# Empty by default.
-# ``MPI_EXECUTABLE_SUFFIX``
-# A suffix which is appended to all names that are being looked for. For instance you may set this
-# to ``.mpich`` or ``.openmpi`` to prefer the one or the other on Debian and its derivatives.
-#
-# In order to control the guessing step, the following variable may be set:
-#
-# ``MPI_GUESS_LIBRARY_NAME``
-# Valid values are ``MSMPI`` and ``MPICH2``. If set, only the given library will be searched for.
-# By default, ``MSMPI`` will be preferred over ``MPICH2`` if both are available.
-# This also sets ``MPI_SKIP_COMPILER_WRAPPER`` to ``true``, which may be overridden.
-#
-# Each of the search steps may be skipped with the following control variables:
-#
-# ``MPI_ASSUME_NO_BUILTIN_MPI``
-# If true, the module assumes that the compiler itself does not provide an MPI implementation and
-# skips to step 2.
-# ``MPI_SKIP_COMPILER_WRAPPER``
-# If true, no compiler wrapper will be searched for.
-# ``MPI_SKIP_GUESSING``
-# If true, the guessing step will be skipped.
-#
-# Additionally, the following control variable is available to change search behavior:
-#
-# ``MPI_CXX_SKIP_MPICXX``
-# Add some definitions that will disable the MPI-2 C++ bindings.
-# Currently supported are MPICH, Open MPI, Platform MPI and derivatives thereof,
-# for example MVAPICH or Intel MPI.
-#
-# If the find procedure fails for a variable ``MPI_<lang>_WORKS``, then the settings detected by or passed to
-# the module did not work and even a simple MPI test program failed to compile.
-#
-# If all of these parameters were not sufficient to find the right MPI implementation, a user may
-# disable the entire autodetection process by specifying both a list of libraries in ``MPI_<lang>_LIBRARIES``
-# and a list of include directories in ``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS``.
-# Any other variable may be set in addition to these two. The module will then validate the MPI settings and store the
-# settings in the cache.
-#
-# Cache variables for MPI
-# ^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The variable ``MPI_<lang>_INCLUDE_DIRS`` will be assembled from the following variables.
-# For C and CXX:
-#
-# ``MPI_<lang>_HEADER_DIR``
-# Location of the ``mpi.h`` header on disk.
-#
-# For Fortran:
-#
-# ``MPI_Fortran_F77_HEADER_DIR``
-# Location of the Fortran 77 header ``mpif.h``, if it exists.
-# ``MPI_Fortran_MODULE_DIR``
-# Location of the ``mpi`` or ``mpi_f08`` modules, if available.
-#
-# For all languages the following variables are additionally considered:
-#
-# ``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS``
-# A :ref:`;-list <CMake Language Lists>` of paths needed in addition to the normal include directories.
-# ``MPI_<include_name>_INCLUDE_DIR``
-# Path variables for include folders referred to by ``<include_name>``.
-# ``MPI_<lang>_ADDITIONAL_INCLUDE_VARS``
-# A :ref:`;-list <CMake Language Lists>` of ``<include_name>`` that will be added to the include locations of ``<lang>``.
-#
-# The variable ``MPI_<lang>_LIBRARIES`` will be assembled from the following variables:
-#
-# ``MPI_<lib_name>_LIBRARY``
-# The location of a library called ``<lib_name>`` for use with MPI.
-# ``MPI_<lang>_LIB_NAMES``
-# A :ref:`;-list <CMake Language Lists>` of ``<lib_name>`` that will be added to the include locations of ``<lang>``.
-#
-# Usage of mpiexec
-# ^^^^^^^^^^^^^^^^
-#
-# When using ``MPIEXEC_EXECUTABLE`` to execute MPI applications, you should typically
-# use all of the ``MPIEXEC_EXECUTABLE`` flags as follows:
-#
-# ::
-#
-# ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS}
-# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS
-#
-# where ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to
-# pass to the MPI program.
-#
-# Advanced variables for using MPI
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The module can perform some advanced feature detections upon explicit request.
-#
-# **Important notice:** The following checks cannot be performed without *executing* an MPI test program.
-# Consider the special considerations for the behavior of :command:`try_run` during cross compilation.
-# Moreover, running an MPI program can cause additional issues, like a firewall notification on some systems.
-# You should only enable these detections if you absolutely need the information.
-#
-# If the following variables are set to true, the respective search will be performed:
-#
-# ``MPI_DETERMINE_Fortran_CAPABILITIES``
-# Determine for all available Fortran bindings what the values of ``MPI_SUBARRAYS_SUPPORTED`` and
-# ``MPI_ASYNC_PROTECTS_NONBLOCKING`` are and make their values available as ``MPI_Fortran_<binding>_SUBARRAYS``
-# and ``MPI_Fortran_<binding>_ASYNCPROT``, where ``<binding>`` is one of ``F77_HEADER``, ``F90_MODULE`` and
-# ``F08_MODULE``.
-# ``MPI_DETERMINE_LIBRARY_VERSION``
-# For each language, find the output of ``MPI_Get_library_version`` and make it available as ``MPI_<lang>_LIBRARY_VERSION``.
-# This information is usually tied to the runtime component of an MPI implementation and might differ depending on ``<lang>``.
-# Note that the return value is entirely implementation defined. This information might be used to identify
-# the MPI vendor and for example pick the correct one of multiple third party binaries that matches the MPI vendor.
-#
-# Backward Compatibility
-# ^^^^^^^^^^^^^^^^^^^^^^
-#
-# For backward compatibility with older versions of FindMPI, these
-# variables are set, but deprecated:
-#
-# ::
-#
-# MPI_COMPILER MPI_LIBRARY MPI_EXTRA_LIBRARY
-# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_LINK_FLAGS
-# MPI_LIBRARIES
-#
-# In new projects, please use the ``MPI_<lang>_XXX`` equivalents.
-# Additionally, the following variables are deprecated:
-#
-# ``MPI_<lang>_COMPILE_FLAGS``
-# Use ``MPI_<lang>_COMPILE_OPTIONS`` and ``MPI_<lang>_COMPILE_DEFINITIONS`` instead.
-# ``MPI_<lang>_INCLUDE_PATH``
-# For consumption use ``MPI_<lang>_INCLUDE_DIRS`` and for specifying folders use ``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS`` instead.
-# ``MPIEXEC``
-# Use ``MPIEXEC_EXECUTABLE`` instead.
+#[=======================================================================[.rst:
+FindMPI
+-------
+
+Find a Message Passing Interface (MPI) implementation.
+
+The Message Passing Interface (MPI) is a library used to write
+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.
+
+Variables for using MPI
+^^^^^^^^^^^^^^^^^^^^^^^
+
+The module exposes the components ``C``, ``CXX``, ``MPICXX`` and ``Fortran``.
+Each of these controls the various MPI languages to search for.
+The difference between ``CXX`` and ``MPICXX`` is that ``CXX`` refers to the
+MPI C API being usable from C++, whereas ``MPICXX`` refers to the MPI-2 C++ API
+that was removed again in MPI-3.
+
+Depending on the enabled components the following variables will be set:
+
+``MPI_FOUND``
+ Variable indicating that MPI settings for all requested languages have been found.
+ If no components are specified, this is true if MPI settings for all enabled languages
+ were detected. Note that the ``MPICXX`` component does not affect this variable.
+``MPI_VERSION``
+ Minimal version of MPI detected among the requested languages, or all enabled languages
+ if no components were specified.
+
+This module will set the following variables per language in your
+project, where ``<lang>`` is one of C, CXX, or Fortran:
+
+``MPI_<lang>_FOUND``
+ Variable indicating the MPI settings for ``<lang>`` were found and that
+ simple MPI test programs compile with the provided settings.
+``MPI_<lang>_COMPILER``
+ MPI compiler for ``<lang>`` if such a program exists.
+``MPI_<lang>_COMPILE_OPTIONS``
+ Compilation options for MPI programs in ``<lang>``, given as a :ref:`;-list <CMake Language Lists>`.
+``MPI_<lang>_COMPILE_DEFINITIONS``
+ Compilation definitions for MPI programs in ``<lang>``, given as a :ref:`;-list <CMake Language Lists>`.
+``MPI_<lang>_INCLUDE_DIRS``
+ Include path(s) for MPI header.
+``MPI_<lang>_LINK_FLAGS``
+ Linker flags for MPI programs.
+``MPI_<lang>_LIBRARIES``
+ All libraries to link MPI programs against.
+
+Additionally, the following :prop_tgt:`IMPORTED` targets are defined:
+
+``MPI::MPI_<lang>``
+ Target for using MPI from ``<lang>``.
+
+The following variables indicating which bindings are present will be defined:
+
+``MPI_MPICXX_FOUND``
+ Variable indicating whether the MPI-2 C++ bindings are present (introduced in MPI-2, removed with MPI-3).
+``MPI_Fortran_HAVE_F77_HEADER``
+ True if the Fortran 77 header ``mpif.h`` is available.
+``MPI_Fortran_HAVE_F90_MODULE``
+ True if the Fortran 90 module ``mpi`` can be used for accessing MPI (MPI-2 and higher only).
+``MPI_Fortran_HAVE_F08_MODULE``
+ True if the Fortran 2008 ``mpi_f08`` is available to MPI programs (MPI-3 and higher only).
+
+If possible, the MPI version will be determined by this module. The facilities to detect the MPI version
+were introduced with MPI-1.2, and therefore cannot be found for older MPI versions.
+
+``MPI_<lang>_VERSION_MAJOR``
+ Major version of MPI implemented for ``<lang>`` by the MPI distribution.
+``MPI_<lang>_VERSION_MINOR``
+ Minor version of MPI implemented for ``<lang>`` by the MPI distribution.
+``MPI_<lang>_VERSION``
+ MPI version implemented for ``<lang>`` by the MPI distribution.
+
+Note that there's no variable for the C bindings being accessible through ``mpi.h``, since the MPI standards
+always have required this binding to work in both C and C++ code.
+
+For running MPI programs, the module sets the following variables
+
+``MPIEXEC_EXECUTABLE``
+ Executable for running MPI programs, if such exists.
+``MPIEXEC_NUMPROC_FLAG``
+ Flag to pass to ``mpiexec`` before giving it the number of processors to run on.
+``MPIEXEC_MAX_NUMPROCS``
+ Number of MPI processors to utilize. Defaults to the number
+ of processors detected on the host system.
+``MPIEXEC_PREFLAGS``
+ Flags to pass to ``mpiexec`` directly before the executable to run.
+``MPIEXEC_POSTFLAGS``
+ Flags to pass to ``mpiexec`` after other flags.
+
+Variables for locating MPI
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This module performs a three step search for an MPI implementation:
+
+1. Check if the compiler has MPI support built-in. This is the case if the user passed a
+ compiler wrapper as ``CMAKE_<LANG>_COMPILER`` or if they're on a Cray system.
+2. Attempt to find an MPI compiler wrapper and determine the compiler information from it.
+3. Try to find an MPI implementation that does not ship such a wrapper by guessing settings.
+ Currently, only Microsoft MPI and MPICH2 on Windows are supported.
+
+For controlling the second step, the following variables may be set:
+
+``MPI_<lang>_COMPILER``
+ Search for the specified compiler wrapper and use it.
+``MPI_<lang>_COMPILER_FLAGS``
+ Flags to pass to the MPI compiler wrapper during interrogation. Some compiler wrappers
+ support linking debug or tracing libraries if a specific flag is passed and this variable
+ may be used to obtain them.
+``MPI_COMPILER_FLAGS``
+ Used to initialize ``MPI_<lang>_COMPILER_FLAGS`` if no language specific flag has been given.
+ Empty by default.
+``MPI_EXECUTABLE_SUFFIX``
+ A suffix which is appended to all names that are being looked for. For instance you may set this
+ to ``.mpich`` or ``.openmpi`` to prefer the one or the other on Debian and its derivatives.
+
+In order to control the guessing step, the following variable may be set:
+
+``MPI_GUESS_LIBRARY_NAME``
+ Valid values are ``MSMPI`` and ``MPICH2``. If set, only the given library will be searched for.
+ By default, ``MSMPI`` will be preferred over ``MPICH2`` if both are available.
+ This also sets ``MPI_SKIP_COMPILER_WRAPPER`` to ``true``, which may be overridden.
+
+Each of the search steps may be skipped with the following control variables:
+
+``MPI_ASSUME_NO_BUILTIN_MPI``
+ If true, the module assumes that the compiler itself does not provide an MPI implementation and
+ skips to step 2.
+``MPI_SKIP_COMPILER_WRAPPER``
+ If true, no compiler wrapper will be searched for.
+``MPI_SKIP_GUESSING``
+ If true, the guessing step will be skipped.
+
+Additionally, the following control variable is available to change search behavior:
+
+``MPI_CXX_SKIP_MPICXX``
+ Add some definitions that will disable the MPI-2 C++ bindings.
+ Currently supported are MPICH, Open MPI, Platform MPI and derivatives thereof,
+ for example MVAPICH or Intel MPI.
+
+If the find procedure fails for a variable ``MPI_<lang>_WORKS``, then the settings detected by or passed to
+the module did not work and even a simple MPI test program failed to compile.
+
+If all of these parameters were not sufficient to find the right MPI implementation, a user may
+disable the entire autodetection process by specifying both a list of libraries in ``MPI_<lang>_LIBRARIES``
+and a list of include directories in ``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS``.
+Any other variable may be set in addition to these two. The module will then validate the MPI settings and store the
+settings in the cache.
+
+Cache variables for MPI
+^^^^^^^^^^^^^^^^^^^^^^^
+
+The variable ``MPI_<lang>_INCLUDE_DIRS`` will be assembled from the following variables.
+For C and CXX:
+
+``MPI_<lang>_HEADER_DIR``
+ Location of the ``mpi.h`` header on disk.
+
+For Fortran:
+
+``MPI_Fortran_F77_HEADER_DIR``
+ Location of the Fortran 77 header ``mpif.h``, if it exists.
+``MPI_Fortran_MODULE_DIR``
+ Location of the ``mpi`` or ``mpi_f08`` modules, if available.
+
+For all languages the following variables are additionally considered:
+
+``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS``
+ A :ref:`;-list <CMake Language Lists>` of paths needed in addition to the normal include directories.
+``MPI_<include_name>_INCLUDE_DIR``
+ Path variables for include folders referred to by ``<include_name>``.
+``MPI_<lang>_ADDITIONAL_INCLUDE_VARS``
+ A :ref:`;-list <CMake Language Lists>` of ``<include_name>`` that will be added to the include locations of ``<lang>``.
+
+The variable ``MPI_<lang>_LIBRARIES`` will be assembled from the following variables:
+
+``MPI_<lib_name>_LIBRARY``
+ The location of a library called ``<lib_name>`` for use with MPI.
+``MPI_<lang>_LIB_NAMES``
+ A :ref:`;-list <CMake Language Lists>` of ``<lib_name>`` that will be added to the include locations of ``<lang>``.
+
+Usage of mpiexec
+^^^^^^^^^^^^^^^^
+
+When using ``MPIEXEC_EXECUTABLE`` to execute MPI applications, you should typically
+use all of the ``MPIEXEC_EXECUTABLE`` flags as follows:
+
+::
+
+ ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS}
+ ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS
+
+where ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to
+pass to the MPI program.
+
+Advanced variables for using MPI
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The module can perform some advanced feature detections upon explicit request.
+
+**Important notice:** The following checks cannot be performed without *executing* an MPI test program.
+Consider the special considerations for the behavior of :command:`try_run` during cross compilation.
+Moreover, running an MPI program can cause additional issues, like a firewall notification on some systems.
+You should only enable these detections if you absolutely need the information.
+
+If the following variables are set to true, the respective search will be performed:
+
+``MPI_DETERMINE_Fortran_CAPABILITIES``
+ Determine for all available Fortran bindings what the values of ``MPI_SUBARRAYS_SUPPORTED`` and
+ ``MPI_ASYNC_PROTECTS_NONBLOCKING`` are and make their values available as ``MPI_Fortran_<binding>_SUBARRAYS``
+ and ``MPI_Fortran_<binding>_ASYNCPROT``, where ``<binding>`` is one of ``F77_HEADER``, ``F90_MODULE`` and
+ ``F08_MODULE``.
+``MPI_DETERMINE_LIBRARY_VERSION``
+ For each language, find the output of ``MPI_Get_library_version`` and make it available as ``MPI_<lang>_LIBRARY_VERSION``.
+ This information is usually tied to the runtime component of an MPI implementation and might differ depending on ``<lang>``.
+ Note that the return value is entirely implementation defined. This information might be used to identify
+ the MPI vendor and for example pick the correct one of multiple third party binaries that matches the MPI vendor.
+
+Backward Compatibility
+^^^^^^^^^^^^^^^^^^^^^^
+
+For backward compatibility with older versions of FindMPI, these
+variables are set, but deprecated:
+
+::
+
+ MPI_COMPILER MPI_LIBRARY MPI_EXTRA_LIBRARY
+ MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_LINK_FLAGS
+ MPI_LIBRARIES
+
+In new projects, please use the ``MPI_<lang>_XXX`` equivalents.
+Additionally, the following variables are deprecated:
+
+``MPI_<lang>_COMPILE_FLAGS``
+ Use ``MPI_<lang>_COMPILE_OPTIONS`` and ``MPI_<lang>_COMPILE_DEFINITIONS`` instead.
+``MPI_<lang>_INCLUDE_PATH``
+ For consumption use ``MPI_<lang>_INCLUDE_DIRS`` and for specifying folders use ``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS`` instead.
+``MPIEXEC``
+ Use ``MPIEXEC_EXECUTABLE`` instead.
+#]=======================================================================]
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 547a33085..354764217 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -1,232 +1,228 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindMatlab
-# ----------
-#
-# Finds Matlab or Matlab Compiler Runtime (MCR) and provides Matlab tools,
-# libraries and compilers to CMake.
-#
-# This package primary purpose is to find the libraries associated with Matlab
-# or the MCR in order to be able to build Matlab extensions (mex files). It
-# can also be used:
-#
-# * to run specific commands in Matlab in case Matlab is available
-# * for declaring Matlab unit test
-# * to retrieve various information from Matlab (mex extensions, versions and
-# release queries, ...)
-#
-# The module supports the following components:
-#
-# * ``MX_LIBRARY``, ``ENG_LIBRARY`` and ``MAT_LIBRARY``: respectively the ``MX``,
-# ``ENG`` and ``MAT`` libraries of Matlab
-# * ``ENGINE_LIBRARY``, ``DATAARRAY_LIBRARY``: respectively the ``MatlabEngine``
-# and ``MatlabDataArray`` libraries of Matlab (Matlab 2018a and later)
-# * ``MAIN_PROGRAM`` the Matlab binary program. Note that this component is not
-# available on the MCR version, and will yield an error if the MCR is found
-# instead of the regular Matlab installation.
-# * ``MEX_COMPILER`` the MEX compiler.
-# * ``MCC_COMPILER`` the MCC compiler, included with the Matlab Compiler add-on.
-# * ``SIMULINK`` the Simulink environment.
-#
-# .. note::
-#
-# The version given to the :command:`find_package` directive is the Matlab
-# **version**, which should not be confused with the Matlab *release* name
-# (eg. `R2014`).
-# The :command:`matlab_get_version_from_release_name` and
-# :command:`matlab_get_release_name_from_version` provide a mapping
-# between the release name and the version.
-#
-# The variable :variable:`Matlab_ROOT_DIR` may be specified in order to give
-# the path of the desired Matlab version. Otherwise, the behaviour is platform
-# specific:
-#
-# * Windows: The installed versions of Matlab/MCR are retrieved from the
-# Windows registry
-# * OS X: The installed versions of Matlab/MCR are given by the MATLAB
-# default installation paths in ``/Application``. If no such application is
-# found, it falls back to the one that might be accessible from the ``PATH``.
-# * Unix: The desired Matlab should be accessible from the ``PATH``. This does
-# not work for MCR installation and :variable:`Matlab_ROOT_DIR` should be
-# specified on this platform.
-#
-# Additional information is provided when :variable:`MATLAB_FIND_DEBUG` is set.
-# When a Matlab/MCR installation is found automatically and the ``MATLAB_VERSION``
-# is not given, the version is queried from Matlab directly (on Windows this
-# may pop up a Matlab window) or from the MCR installation.
-#
-# The mapping of the release names and the version of Matlab is performed by
-# defining pairs (name, version). The variable
-# :variable:`MATLAB_ADDITIONAL_VERSIONS` may be provided before the call to
-# the :command:`find_package` in order to handle additional versions.
-#
-# A Matlab scripts can be added to the set of tests using the
-# :command:`matlab_add_unit_test`. By default, the Matlab unit test framework
-# will be used (>= 2013a) to run this script, but regular ``.m`` files
-# returning an exit code can be used as well (0 indicating a success).
-#
-# Module Input Variables
-# ^^^^^^^^^^^^^^^^^^^^^^
-#
-# Users or projects may set the following variables to configure the module
-# behaviour:
-#
-# :variable:`Matlab_ROOT_DIR`
-# the root of the Matlab installation.
-# :variable:`MATLAB_FIND_DEBUG`
-# outputs debug information
-# :variable:`MATLAB_ADDITIONAL_VERSIONS`
-# additional versions of Matlab for the automatic retrieval of the installed
-# versions.
-#
-# Variables defined by the module
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# Result variables
-# """"""""""""""""
-#
-# ``Matlab_FOUND``
-# ``TRUE`` if the Matlab installation is found, ``FALSE``
-# otherwise. All variable below are defined if Matlab is found.
-# ``Matlab_ROOT_DIR``
-# the final root of the Matlab installation determined by the FindMatlab
-# module.
-# ``Matlab_MAIN_PROGRAM``
-# the Matlab binary program. Available only if the component ``MAIN_PROGRAM``
-# is given in the :command:`find_package` directive.
-# ``Matlab_INCLUDE_DIRS``
-# the path of the Matlab libraries headers
-# ``Matlab_MEX_LIBRARY``
-# library for mex, always available.
-# ``Matlab_MX_LIBRARY``
-# mx library of Matlab (arrays). Available only if the component
-# ``MX_LIBRARY`` has been requested.
-# ``Matlab_ENG_LIBRARY``
-# Matlab engine library. Available only if the component ``ENG_LIBRARY``
-# is requested.
-# ``Matlab_MAT_LIBRARY``
-# Matlab matrix library. Available only if the component ``MAT_LIBRARY``
-# is requested.
-# ``Matlab_ENGINE_LIBRARY``
-# Matlab C++ engine library. Available only if the component ``ENGINE_LIBRARY``
-# is requested.
-# ``Matlab_DATAARRAY_LIBRARY``
-# Matlab C++ data array library. Available only if the component ``DATAARRAY_LIBRARY``
-# is requested.
-# ``Matlab_LIBRARIES``
-# the whole set of libraries of Matlab
-# ``Matlab_MEX_COMPILER``
-# the mex compiler of Matlab. Currently not used.
-# Available only if the component ``MEX_COMPILER`` is requested.
-# ``Matlab_MCC_COMPILER``
-# the mcc compiler of Matlab. Included with the Matlab Compiler add-on.
-# Available only if the component ``MCC_COMPILER`` is requested.
-#
-# Cached variables
-# """"""""""""""""
-#
-# ``Matlab_MEX_EXTENSION``
-# the extension of the mex files for the current platform (given by Matlab).
-# ``Matlab_ROOT_DIR``
-# the location of the root of the Matlab installation found. If this value
-# is changed by the user, the result variables are recomputed.
-#
-# Provided macros
-# ^^^^^^^^^^^^^^^
-#
-# :command:`matlab_get_version_from_release_name`
-# returns the version from the release name
-# :command:`matlab_get_release_name_from_version`
-# returns the release name from the Matlab version
-#
-# Provided functions
-# ^^^^^^^^^^^^^^^^^^
-#
-# :command:`matlab_add_mex`
-# adds a target compiling a MEX file.
-# :command:`matlab_add_unit_test`
-# adds a Matlab unit test file as a test to the project.
-# :command:`matlab_extract_all_installed_versions_from_registry`
-# parses the registry for all Matlab versions. Available on Windows only.
-# The part of the registry parsed is dependent on the host processor
-# :command:`matlab_get_all_valid_matlab_roots_from_registry`
-# returns all the possible Matlab or MCR paths, according to a previously
-# given list. Only the existing/accessible paths are kept. This is mainly
-# useful for the searching all possible Matlab installation.
-# :command:`matlab_get_mex_suffix`
-# returns the suffix to be used for the mex files
-# (platform/architecture dependent)
-# :command:`matlab_get_version_from_matlab_run`
-# returns the version of Matlab/MCR, given the full directory of the Matlab/MCR
-# installation path.
-#
-#
-# Known issues
-# ^^^^^^^^^^^^
-#
-# **Symbol clash in a MEX target**
-# By default, every symbols inside a MEX
-# file defined with the command :command:`matlab_add_mex` have hidden
-# visibility, except for the entry point. This is the default behaviour of
-# the MEX compiler, which lowers the risk of symbol collision between the
-# libraries shipped with Matlab, and the libraries to which the MEX file is
-# linking to. This is also the default on Windows platforms.
-#
-# However, this is not sufficient in certain case, where for instance your
-# MEX file is linking against libraries that are already loaded by Matlab,
-# even if those libraries have different SONAMES.
-# A possible solution is to hide the symbols of the libraries to which the
-# MEX target is linking to. This can be achieved in GNU GCC compilers with
-# the linker option ``-Wl,--exclude-libs,ALL``.
-#
-# **Tests using GPU resources**
-# in case your MEX file is using the GPU and
-# in order to be able to run unit tests on this MEX file, the GPU resources
-# should be properly released by Matlab. A possible solution is to make
-# Matlab aware of the use of the GPU resources in the session, which can be
-# performed by a command such as ``D = gpuDevice()`` at the beginning of
-# the test script (or via a fixture).
-#
-#
-# Reference
-# ^^^^^^^^^
-#
-# .. variable:: Matlab_ROOT_DIR
-#
-# The root folder of the Matlab installation. If set before the call to
-# :command:`find_package`, the module will look for the components in that
-# path. If not set, then an automatic search of Matlab
-# will be performed. If set, it should point to a valid version of Matlab.
-#
-# .. variable:: MATLAB_FIND_DEBUG
-#
-# If set, the lookup of Matlab and the intermediate configuration steps are
-# outputted to the console.
-#
-# .. variable:: MATLAB_ADDITIONAL_VERSIONS
-#
-# If set, specifies additional versions of Matlab that may be looked for.
-# The variable should be a list of strings, organised by pairs of release
-# name and versions, such as follows::
-#
-# set(MATLAB_ADDITIONAL_VERSIONS
-# "release_name1=corresponding_version1"
-# "release_name2=corresponding_version2"
-# ...
-# )
-#
-# Example::
-#
-# set(MATLAB_ADDITIONAL_VERSIONS
-# "R2013b=8.2"
-# "R2013a=8.1"
-# "R2012b=8.0")
-#
-# The order of entries in this list matters when several versions of
-# Matlab are installed. The priority is set according to the ordering in
-# this list.
+#[=======================================================================[.rst:
+FindMatlab
+----------
+
+Finds Matlab or Matlab Compiler Runtime (MCR) and provides Matlab tools,
+libraries and compilers to CMake.
+
+This package primary purpose is to find the libraries associated with Matlab
+or the MCR in order to be able to build Matlab extensions (mex files). It
+can also be used:
+
+* to run specific commands in Matlab in case Matlab is available
+* for declaring Matlab unit test
+* to retrieve various information from Matlab (mex extensions, versions and
+ release queries, ...)
+
+The module supports the following components:
+
+* ``ENG_LIBRARY`` and ``MAT_LIBRARY``: respectively the ``ENG`` and ``MAT``
+ libraries of Matlab
+* ``MAIN_PROGRAM`` the Matlab binary program. Note that this component is not
+ available on the MCR version, and will yield an error if the MCR is found
+ instead of the regular Matlab installation.
+* ``MEX_COMPILER`` the MEX compiler.
+* ``MCC_COMPILER`` the MCC compiler, included with the Matlab Compiler add-on.
+* ``SIMULINK`` the Simulink environment.
+
+.. note::
+
+ The version given to the :command:`find_package` directive is the Matlab
+ **version**, which should not be confused with the Matlab *release* name
+ (eg. `R2014`).
+ The :command:`matlab_get_version_from_release_name` and
+ :command:`matlab_get_release_name_from_version` provide a mapping
+ between the release name and the version.
+
+The variable :variable:`Matlab_ROOT_DIR` may be specified in order to give
+the path of the desired Matlab version. Otherwise, the behaviour is platform
+specific:
+
+* Windows: The installed versions of Matlab/MCR are retrieved from the
+ Windows registry
+* OS X: The installed versions of Matlab/MCR are given by the MATLAB
+ default installation paths in ``/Application``. If no such application is
+ found, it falls back to the one that might be accessible from the ``PATH``.
+* Unix: The desired Matlab should be accessible from the ``PATH``. This does
+ not work for MCR installation and :variable:`Matlab_ROOT_DIR` should be
+ specified on this platform.
+
+Additional information is provided when :variable:`MATLAB_FIND_DEBUG` is set.
+When a Matlab/MCR installation is found automatically and the ``MATLAB_VERSION``
+is not given, the version is queried from Matlab directly (on Windows this
+may pop up a Matlab window) or from the MCR installation.
+
+The mapping of the release names and the version of Matlab is performed by
+defining pairs (name, version). The variable
+:variable:`MATLAB_ADDITIONAL_VERSIONS` may be provided before the call to
+the :command:`find_package` in order to handle additional versions.
+
+A Matlab scripts can be added to the set of tests using the
+:command:`matlab_add_unit_test`. By default, the Matlab unit test framework
+will be used (>= 2013a) to run this script, but regular ``.m`` files
+returning an exit code can be used as well (0 indicating a success).
+
+Module Input Variables
+^^^^^^^^^^^^^^^^^^^^^^
+
+Users or projects may set the following variables to configure the module
+behaviour:
+
+:variable:`Matlab_ROOT_DIR`
+ the root of the Matlab installation.
+:variable:`MATLAB_FIND_DEBUG`
+ outputs debug information
+:variable:`MATLAB_ADDITIONAL_VERSIONS`
+ additional versions of Matlab for the automatic retrieval of the installed
+ versions.
+
+Variables defined by the module
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Result variables
+""""""""""""""""
+
+``Matlab_FOUND``
+ ``TRUE`` if the Matlab installation is found, ``FALSE``
+ otherwise. All variable below are defined if Matlab is found.
+``Matlab_ROOT_DIR``
+ the final root of the Matlab installation determined by the FindMatlab
+ module.
+``Matlab_MAIN_PROGRAM``
+ the Matlab binary program. Available only if the component ``MAIN_PROGRAM``
+ is given in the :command:`find_package` directive.
+``Matlab_INCLUDE_DIRS``
+ the path of the Matlab libraries headers
+``Matlab_MEX_LIBRARY``
+ library for mex, always available.
+``Matlab_MX_LIBRARY``
+ mx library of Matlab (arrays), always available.
+``Matlab_ENG_LIBRARY``
+ Matlab engine library. Available only if the component ``ENG_LIBRARY``
+ is requested.
+``Matlab_MAT_LIBRARY``
+ Matlab matrix library. Available only if the component ``MAT_LIBRARY``
+ is requested.
+``Matlab_ENGINE_LIBRARY``
+ Matlab C++ engine library, always available for R2018a and newer.
+``Matlab_DATAARRAY_LIBRARY``
+ Matlab C++ data array library, always available for R2018a and newer.
+``Matlab_LIBRARIES``
+ the whole set of libraries of Matlab
+``Matlab_MEX_COMPILER``
+ the mex compiler of Matlab. Currently not used.
+ Available only if the component ``MEX_COMPILER`` is requested.
+``Matlab_MCC_COMPILER``
+ the mcc compiler of Matlab. Included with the Matlab Compiler add-on.
+ Available only if the component ``MCC_COMPILER`` is requested.
+
+Cached variables
+""""""""""""""""
+
+``Matlab_MEX_EXTENSION``
+ the extension of the mex files for the current platform (given by Matlab).
+``Matlab_ROOT_DIR``
+ the location of the root of the Matlab installation found. If this value
+ is changed by the user, the result variables are recomputed.
+
+Provided macros
+^^^^^^^^^^^^^^^
+
+:command:`matlab_get_version_from_release_name`
+ returns the version from the release name
+:command:`matlab_get_release_name_from_version`
+ returns the release name from the Matlab version
+
+Provided functions
+^^^^^^^^^^^^^^^^^^
+
+:command:`matlab_add_mex`
+ adds a target compiling a MEX file.
+:command:`matlab_add_unit_test`
+ adds a Matlab unit test file as a test to the project.
+:command:`matlab_extract_all_installed_versions_from_registry`
+ parses the registry for all Matlab versions. Available on Windows only.
+ The part of the registry parsed is dependent on the host processor
+:command:`matlab_get_all_valid_matlab_roots_from_registry`
+ returns all the possible Matlab or MCR paths, according to a previously
+ given list. Only the existing/accessible paths are kept. This is mainly
+ useful for the searching all possible Matlab installation.
+:command:`matlab_get_mex_suffix`
+ returns the suffix to be used for the mex files
+ (platform/architecture dependent)
+:command:`matlab_get_version_from_matlab_run`
+ returns the version of Matlab/MCR, given the full directory of the Matlab/MCR
+ installation path.
+
+
+Known issues
+^^^^^^^^^^^^
+
+**Symbol clash in a MEX target**
+ By default, every symbols inside a MEX
+ file defined with the command :command:`matlab_add_mex` have hidden
+ visibility, except for the entry point. This is the default behaviour of
+ the MEX compiler, which lowers the risk of symbol collision between the
+ libraries shipped with Matlab, and the libraries to which the MEX file is
+ linking to. This is also the default on Windows platforms.
+
+ However, this is not sufficient in certain case, where for instance your
+ MEX file is linking against libraries that are already loaded by Matlab,
+ even if those libraries have different SONAMES.
+ A possible solution is to hide the symbols of the libraries to which the
+ MEX target is linking to. This can be achieved in GNU GCC compilers with
+ the linker option ``-Wl,--exclude-libs,ALL``.
+
+**Tests using GPU resources**
+ in case your MEX file is using the GPU and
+ in order to be able to run unit tests on this MEX file, the GPU resources
+ should be properly released by Matlab. A possible solution is to make
+ Matlab aware of the use of the GPU resources in the session, which can be
+ performed by a command such as ``D = gpuDevice()`` at the beginning of
+ the test script (or via a fixture).
+
+
+Reference
+^^^^^^^^^
+
+.. variable:: Matlab_ROOT_DIR
+
+ The root folder of the Matlab installation. If set before the call to
+ :command:`find_package`, the module will look for the components in that
+ path. If not set, then an automatic search of Matlab
+ will be performed. If set, it should point to a valid version of Matlab.
+
+.. variable:: MATLAB_FIND_DEBUG
+
+ If set, the lookup of Matlab and the intermediate configuration steps are
+ outputted to the console.
+
+.. variable:: MATLAB_ADDITIONAL_VERSIONS
+
+ If set, specifies additional versions of Matlab that may be looked for.
+ The variable should be a list of strings, organised by pairs of release
+ name and versions, such as follows::
+
+ set(MATLAB_ADDITIONAL_VERSIONS
+ "release_name1=corresponding_version1"
+ "release_name2=corresponding_version2"
+ ...
+ )
+
+ Example::
+
+ set(MATLAB_ADDITIONAL_VERSIONS
+ "R2013b=8.2"
+ "R2013a=8.1"
+ "R2012b=8.0")
+
+ The order of entries in this list matters when several versions of
+ Matlab are installed. The priority is set according to the ordering in
+ this list.
+#]=======================================================================]
set(_FindMatlab_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}")
@@ -271,10 +267,11 @@ if(NOT EXISTS "${_matlab_temporary_folder}")
file(MAKE_DIRECTORY "${_matlab_temporary_folder}")
endif()
-#.rst:
-# .. command:: matlab_get_version_from_release_name
-#
-# Returns the version of Matlab (17.58) from a release name (R2017k)
+#[=======================================================================[.rst:
+.. command:: matlab_get_version_from_release_name
+
+ Returns the version of Matlab (17.58) from a release name (R2017k)
+#]=======================================================================]
macro(matlab_get_version_from_release_name release_name version_name)
string(REGEX MATCHALL "${release_name}=([0-9]+\\.?[0-9]*)" _matched ${MATLAB_VERSIONS_MAPPING})
@@ -293,10 +290,11 @@ endmacro()
-#.rst:
-# .. command:: matlab_get_release_name_from_version
-#
-# Returns the release name (R2017k) from the version of Matlab (17.58)
+#[=======================================================================[.rst:
+.. command:: matlab_get_release_name_from_version
+
+ Returns the release name (R2017k) from the version of Matlab (17.58)
+#]=======================================================================]
macro(matlab_get_release_name_from_version version release_name)
set(${release_name} "")
@@ -353,22 +351,23 @@ macro(matlab_get_supported_versions list_versions)
endmacro()
-#.rst:
-# .. command:: matlab_extract_all_installed_versions_from_registry
-#
-# This function parses the registry and founds the Matlab versions that are
-# installed. The found versions are returned in `matlab_versions`.
-# Set `win64` to `TRUE` if the 64 bit version of Matlab should be looked for
-# The returned list contains all versions under
-# ``HKLM\\SOFTWARE\\Mathworks\\MATLAB`` and
-# ``HKLM\\SOFTWARE\\Mathworks\\MATLAB Runtime`` or an empty list in case an
-# error occurred (or nothing found).
-#
-# .. note::
-#
-# Only the versions are provided. No check is made over the existence of the
-# installation referenced in the registry,
-#
+#[=======================================================================[.rst:
+.. command:: matlab_extract_all_installed_versions_from_registry
+
+ This function parses the registry and founds the Matlab versions that are
+ installed. The found versions are returned in `matlab_versions`.
+ Set `win64` to `TRUE` if the 64 bit version of Matlab should be looked for
+ The returned list contains all versions under
+ ``HKLM\\SOFTWARE\\Mathworks\\MATLAB`` and
+ ``HKLM\\SOFTWARE\\Mathworks\\MATLAB Runtime`` or an empty list in case an
+ error occurred (or nothing found).
+
+ .. note::
+
+ Only the versions are provided. No check is made over the existence of the
+ installation referenced in the registry,
+
+#]=======================================================================]
function(matlab_extract_all_installed_versions_from_registry win64 matlab_versions)
if(NOT CMAKE_HOST_WIN32)
@@ -477,25 +476,26 @@ endmacro()
-#.rst:
-# .. command:: matlab_get_all_valid_matlab_roots_from_registry
-#
-# Populates the Matlab root with valid versions of Matlab or
-# Matlab Runtime (MCR).
-# The returned matlab_roots is organized in triplets
-# ``(type,version_number,matlab_root_path)``, where ``type``
-# indicates either ``MATLAB`` or ``MCR``.
-#
-# ::
-#
-# matlab_get_all_valid_matlab_roots_from_registry(
-# matlab_versions
-# matlab_roots)
-#
-# ``matlab_versions``
-# the versions of each of the Matlab or MCR installations
-# ``matlab_roots``
-# the location of each of the Matlab or MCR installations
+#[=======================================================================[.rst:
+.. command:: matlab_get_all_valid_matlab_roots_from_registry
+
+ Populates the Matlab root with valid versions of Matlab or
+ Matlab Runtime (MCR).
+ The returned matlab_roots is organized in triplets
+ ``(type,version_number,matlab_root_path)``, where ``type``
+ indicates either ``MATLAB`` or ``MCR``.
+
+ ::
+
+ matlab_get_all_valid_matlab_roots_from_registry(
+ matlab_versions
+ matlab_roots)
+
+ ``matlab_versions``
+ the versions of each of the Matlab or MCR installations
+ ``matlab_roots``
+ the location of each of the Matlab or MCR installations
+#]=======================================================================]
function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_roots)
# The matlab_versions comes either from
@@ -534,23 +534,24 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_
set(${matlab_roots} ${_matlab_roots_list} PARENT_SCOPE)
endfunction()
-#.rst:
-# .. command:: matlab_get_mex_suffix
-#
-# Returns the extension of the mex files (the suffixes).
-# This function should not be called before the appropriate Matlab root has
-# been found.
-#
-# ::
-#
-# matlab_get_mex_suffix(
-# matlab_root
-# mex_suffix)
-#
-# ``matlab_root``
-# the root of the Matlab/MCR installation
-# ``mex_suffix``
-# the variable name in which the suffix will be returned.
+#[=======================================================================[.rst:
+.. command:: matlab_get_mex_suffix
+
+ Returns the extension of the mex files (the suffixes).
+ This function should not be called before the appropriate Matlab root has
+ been found.
+
+ ::
+
+ matlab_get_mex_suffix(
+ matlab_root
+ mex_suffix)
+
+ ``matlab_root``
+ the root of the Matlab/MCR installation
+ ``mex_suffix``
+ the variable name in which the suffix will be returned.
+#]=======================================================================]
function(matlab_get_mex_suffix matlab_root mex_suffix)
# todo setup the extension properly. Currently I do not know if this is
@@ -636,23 +637,24 @@ endfunction()
-#.rst:
-# .. command:: matlab_get_version_from_matlab_run
-#
-# This function runs Matlab program specified on arguments and extracts its
-# version. If the path provided for the Matlab installation points to an MCR
-# installation, the version is extracted from the installed files.
-#
-# ::
-#
-# matlab_get_version_from_matlab_run(
-# matlab_binary_path
-# matlab_list_versions)
-#
-# ``matlab_binary_path``
-# the location of the `matlab` binary executable
-# ``matlab_list_versions``
-# the version extracted from Matlab
+#[=======================================================================[.rst:
+.. command:: matlab_get_version_from_matlab_run
+
+ This function runs Matlab program specified on arguments and extracts its
+ version. If the path provided for the Matlab installation points to an MCR
+ installation, the version is extracted from the installed files.
+
+ ::
+
+ matlab_get_version_from_matlab_run(
+ matlab_binary_path
+ matlab_list_versions)
+
+ ``matlab_binary_path``
+ the location of the `matlab` binary executable
+ ``matlab_list_versions``
+ the version extracted from Matlab
+#]=======================================================================]
function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_versions)
set(${matlab_list_versions} "" PARENT_SCOPE)
@@ -723,7 +725,7 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve
file(REMOVE "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp")
set(index -1)
- string(FIND ${_matlab_version_from_cmd} "ans" index)
+ string(FIND "${_matlab_version_from_cmd}" "ans" index)
if(index EQUAL -1)
if(MATLAB_FIND_DEBUG)
@@ -733,7 +735,7 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve
else()
set(matlab_list_of_all_versions_tmp)
- string(SUBSTRING ${_matlab_version_from_cmd} ${index} -1 substring_ans)
+ string(SUBSTRING "${_matlab_version_from_cmd}" ${index} -1 substring_ans)
string(
REGEX MATCHALL "ans[\r\n\t ]*=[\r\n\t ]*'?([0-9]+(\\.[0-9]+)?)"
matlab_versions_regex
@@ -754,76 +756,77 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve
endfunction()
-#.rst:
-# .. command:: matlab_add_unit_test
-#
-# Adds a Matlab unit test to the test set of cmake/ctest.
-# This command requires the component ``MAIN_PROGRAM`` and hence is not
-# available for an MCR installation.
-#
-# The unit test uses the Matlab unittest framework (default, available
-# starting Matlab 2013b+) except if the option ``NO_UNITTEST_FRAMEWORK``
-# is given.
-#
-# The function expects one Matlab test script file to be given.
-# In the case ``NO_UNITTEST_FRAMEWORK`` is given, the unittest script file
-# should contain the script to be run, plus an exit command with the exit
-# value. This exit value will be passed to the ctest framework (0 success,
-# non 0 failure). Additional arguments accepted by :command:`add_test` can be
-# passed through ``TEST_ARGS`` (eg. ``CONFIGURATION <config> ...``).
-#
-# ::
-#
-# matlab_add_unit_test(
-# NAME <name>
-# UNITTEST_FILE matlab_file_containing_unittest.m
-# [CUSTOM_TEST_COMMAND matlab_command_to_run_as_test]
-# [UNITTEST_PRECOMMAND matlab_command_to_run]
-# [TIMEOUT timeout]
-# [ADDITIONAL_PATH path1 [path2 ...]]
-# [MATLAB_ADDITIONAL_STARTUP_OPTIONS option1 [option2 ...]]
-# [TEST_ARGS arg1 [arg2 ...]]
-# [NO_UNITTEST_FRAMEWORK]
-# )
-#
-# The function arguments are:
-#
-# ``NAME``
-# name of the unittest in ctest.
-# ``UNITTEST_FILE``
-# the matlab unittest file. Its path will be automatically
-# added to the Matlab path.
-# ``CUSTOM_TEST_COMMAND``
-# Matlab script command to run as the test.
-# If this is not set, then the following is run:
-# ``runtests('matlab_file_name'), exit(max([ans(1,:).Failed]))``
-# where ``matlab_file_name`` is the ``UNITTEST_FILE`` without the extension.
-# ``UNITTEST_PRECOMMAND``
-# Matlab script command to be ran before the file
-# containing the test (eg. GPU device initialisation based on CMake
-# variables).
-# ``TIMEOUT``
-# the test timeout in seconds. Defaults to 180 seconds as the
-# Matlab unit test may hang.
-# ``ADDITIONAL_PATH``
-# a list of paths to add to the Matlab path prior to
-# running the unit test.
-# ``MATLAB_ADDITIONAL_STARTUP_OPTIONS``
-# a list of additional option in order
-# to run Matlab from the command line.
-# ``-nosplash -nodesktop -nodisplay`` are always added.
-# ``TEST_ARGS``
-# Additional options provided to the add_test command. These
-# options are added to the default options (eg. "CONFIGURATIONS Release")
-# ``NO_UNITTEST_FRAMEWORK``
-# when set, indicates that the test should not
-# use the unittest framework of Matlab (available for versions >= R2013a).
-# ``WORKING_DIRECTORY``
-# This will be the working directory for the test. If specified it will
-# also be the output directory used for the log file of the test run.
-# If not specified the temporary directory ``${CMAKE_BINARY_DIR}/Matlab`` will
-# be used as the working directory and the log location.
-#
+#[=======================================================================[.rst:
+.. command:: matlab_add_unit_test
+
+ Adds a Matlab unit test to the test set of cmake/ctest.
+ This command requires the component ``MAIN_PROGRAM`` and hence is not
+ available for an MCR installation.
+
+ The unit test uses the Matlab unittest framework (default, available
+ starting Matlab 2013b+) except if the option ``NO_UNITTEST_FRAMEWORK``
+ is given.
+
+ The function expects one Matlab test script file to be given.
+ In the case ``NO_UNITTEST_FRAMEWORK`` is given, the unittest script file
+ should contain the script to be run, plus an exit command with the exit
+ value. This exit value will be passed to the ctest framework (0 success,
+ non 0 failure). Additional arguments accepted by :command:`add_test` can be
+ passed through ``TEST_ARGS`` (eg. ``CONFIGURATION <config> ...``).
+
+ ::
+
+ matlab_add_unit_test(
+ NAME <name>
+ UNITTEST_FILE matlab_file_containing_unittest.m
+ [CUSTOM_TEST_COMMAND matlab_command_to_run_as_test]
+ [UNITTEST_PRECOMMAND matlab_command_to_run]
+ [TIMEOUT timeout]
+ [ADDITIONAL_PATH path1 [path2 ...]]
+ [MATLAB_ADDITIONAL_STARTUP_OPTIONS option1 [option2 ...]]
+ [TEST_ARGS arg1 [arg2 ...]]
+ [NO_UNITTEST_FRAMEWORK]
+ )
+
+ The function arguments are:
+
+ ``NAME``
+ name of the unittest in ctest.
+ ``UNITTEST_FILE``
+ the matlab unittest file. Its path will be automatically
+ added to the Matlab path.
+ ``CUSTOM_TEST_COMMAND``
+ Matlab script command to run as the test.
+ If this is not set, then the following is run:
+ ``runtests('matlab_file_name'), exit(max([ans(1,:).Failed]))``
+ where ``matlab_file_name`` is the ``UNITTEST_FILE`` without the extension.
+ ``UNITTEST_PRECOMMAND``
+ Matlab script command to be ran before the file
+ containing the test (eg. GPU device initialisation based on CMake
+ variables).
+ ``TIMEOUT``
+ the test timeout in seconds. Defaults to 180 seconds as the
+ Matlab unit test may hang.
+ ``ADDITIONAL_PATH``
+ a list of paths to add to the Matlab path prior to
+ running the unit test.
+ ``MATLAB_ADDITIONAL_STARTUP_OPTIONS``
+ a list of additional option in order
+ to run Matlab from the command line.
+ ``-nosplash -nodesktop -nodisplay`` are always added.
+ ``TEST_ARGS``
+ Additional options provided to the add_test command. These
+ options are added to the default options (eg. "CONFIGURATIONS Release")
+ ``NO_UNITTEST_FRAMEWORK``
+ when set, indicates that the test should not
+ use the unittest framework of Matlab (available for versions >= R2013a).
+ ``WORKING_DIRECTORY``
+ This will be the working directory for the test. If specified it will
+ also be the output directory used for the log file of the test run.
+ If not specified the temporary directory ``${CMAKE_BINARY_DIR}/Matlab`` will
+ be used as the working directory and the log location.
+
+#]=======================================================================]
function(matlab_add_unit_test)
if(NOT Matlab_MAIN_PROGRAM)
@@ -862,58 +865,65 @@ function(matlab_add_unit_test)
endfunction()
-#.rst:
-# .. command:: matlab_add_mex
-#
-# Adds a Matlab MEX target.
-# This commands compiles the given sources with the current tool-chain in
-# order to produce a MEX file. The final name of the produced output may be
-# specified, as well as additional link libraries, and a documentation entry
-# for the MEX file. Remaining arguments of the call are passed to the
-# :command:`add_library` or :command:`add_executable` command.
-#
-# ::
-#
-# matlab_add_mex(
-# NAME <name>
-# [EXECUTABLE | MODULE | SHARED]
-# SRC src1 [src2 ...]
-# [OUTPUT_NAME output_name]
-# [DOCUMENTATION file.txt]
-# [LINK_TO target1 target2 ...]
-# [...]
-# )
-#
-# ``NAME``
-# name of the target.
-# ``SRC``
-# list of source files.
-# ``LINK_TO``
-# a list of additional link dependencies. The target links to ``libmex``
-# by default. If ``Matlab_MX_LIBRARY`` is defined, it also
-# links to ``libmx``.
-# ``OUTPUT_NAME``
-# if given, overrides the default name. The default name is
-# the name of the target without any prefix and
-# with ``Matlab_MEX_EXTENSION`` suffix.
-# ``DOCUMENTATION``
-# if given, the file ``file.txt`` will be considered as
-# being the documentation file for the MEX file. This file is copied into
-# 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.
-# ``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
-# a library. If no type is given explicitly, the type is ``SHARED``.
-#
-# The documentation file is not processed and should be in the following
-# format:
-#
-# ::
-#
-# % This is the documentation
-# function ret = mex_target_output_name(input1)
-#
+#[=======================================================================[.rst:
+.. command:: matlab_add_mex
+
+ Adds a Matlab MEX target.
+ This commands compiles the given sources with the current tool-chain in
+ order to produce a MEX file. The final name of the produced output may be
+ specified, as well as additional link libraries, and a documentation entry
+ for the MEX file. Remaining arguments of the call are passed to the
+ :command:`add_library` or :command:`add_executable` command.
+
+ ::
+
+ matlab_add_mex(
+ NAME <name>
+ [EXECUTABLE | MODULE | SHARED]
+ SRC src1 [src2 ...]
+ [OUTPUT_NAME output_name]
+ [DOCUMENTATION file.txt]
+ [LINK_TO target1 target2 ...]
+ [R2017b | R2018a]
+ [...]
+ )
+
+ ``NAME``
+ name of the target.
+ ``SRC``
+ list of source files.
+ ``LINK_TO``
+ a list of additional link dependencies. The target links to ``libmex``
+ and ``libmx`` by default.
+ ``OUTPUT_NAME``
+ if given, overrides the default name. The default name is
+ the name of the target without any prefix and
+ with ``Matlab_MEX_EXTENSION`` suffix.
+ ``DOCUMENTATION``
+ if given, the file ``file.txt`` will be considered as
+ being the documentation file for the MEX file. This file is copied into
+ 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
+ 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
+ a library. If no type is given explicitly, the type is ``SHARED``.
+
+ The documentation file is not processed and should be in the following
+ format:
+
+ ::
+
+ % This is the documentation
+ function ret = mex_target_output_name(input1)
+
+#]=======================================================================]
function(matlab_add_mex)
if(NOT WIN32)
@@ -930,7 +940,7 @@ function(matlab_add_mex)
endif()
- set(options EXECUTABLE MODULE SHARED)
+ set(options EXECUTABLE MODULE SHARED R2017b R2018a)
set(oneValueArgs NAME DOCUMENTATION OUTPUT_NAME)
set(multiValueArgs LINK_TO SRC)
@@ -945,9 +955,25 @@ function(matlab_add_mex)
set(${prefix}_OUTPUT_NAME ${${prefix}_NAME})
endif()
+ if(NOT ${Matlab_VERSION_STRING} VERSION_LESS "9.1") # For 9.1 (R2016b) and newer, add version source file
+ # TODO: check the file extensions in ${${prefix}_SRC} to see if they're C or C++ files
+ # Currently, the C and C++ versions of the version files are identical, so this doesn't matter.
+ set(MEX_VERSION_FILE "${Matlab_ROOT_DIR}/extern/version/c_mexapi_version.c")
+ #set(MEX_VERSION_FILE "${Matlab_ROOT_DIR}/extern/version/cpp_mexapi_version.cpp")
+ endif()
+
+ if(NOT ${Matlab_VERSION_STRING} VERSION_LESS "9.4") # For 9.4 (R2018a) and newer, add API macro
+ if(${${prefix}_R2018a})
+ set(MEX_API_MACRO "MATLAB_DEFAULT_RELEASE=R2018a")
+ else()
+ set(MEX_API_MACRO "MATLAB_DEFAULT_RELEASE=R2017b")
+ endif()
+ endif()
+
if(${prefix}_EXECUTABLE)
add_executable(${${prefix}_NAME}
${${prefix}_SRC}
+ ${MEX_VERSION_FILE}
${${prefix}_DOCUMENTATION}
${${prefix}_UNPARSED_ARGUMENTS})
else()
@@ -960,31 +986,25 @@ function(matlab_add_mex)
add_library(${${prefix}_NAME}
${type}
${${prefix}_SRC}
+ ${MEX_VERSION_FILE}
${${prefix}_DOCUMENTATION}
${${prefix}_UNPARSED_ARGUMENTS})
endif()
target_include_directories(${${prefix}_NAME} PRIVATE ${Matlab_INCLUDE_DIRS})
- if(DEFINED Matlab_MX_LIBRARY)
- target_link_libraries(${${prefix}_NAME} ${Matlab_MX_LIBRARY})
+ if(Matlab_HAS_CPP_API)
+ target_link_libraries(${${prefix}_NAME} ${Matlab_ENGINE_LIBRARY} ${Matlab_DATAARRAY_LIBRARY})
endif()
- if(DEFINED Matlab_ENGINE_LIBRARY)
- target_link_libraries(${${prefix}_NAME} ${Matlab_ENGINE_LIBRARY})
- endif()
-
- if(DEFINED Matlab_DATAARRAY_LIBRARY)
- target_link_libraries(${${prefix}_NAME} ${Matlab_DATAARRAY_LIBRARY})
- endif()
-
- target_link_libraries(${${prefix}_NAME} ${Matlab_MEX_LIBRARY} ${${prefix}_LINK_TO})
+ target_link_libraries(${${prefix}_NAME} ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${${prefix}_LINK_TO})
set_target_properties(${${prefix}_NAME}
PROPERTIES
PREFIX ""
OUTPUT_NAME ${${prefix}_OUTPUT_NAME}
SUFFIX ".${Matlab_MEX_EXTENSION}")
+ target_compile_definitions(${${prefix}_NAME} PRIVATE ${MEX_API_MACRO} MATLAB_MEX_FILE)
# documentation
if(NOT ${${prefix}_DOCUMENTATION} STREQUAL "")
@@ -998,82 +1018,82 @@ function(matlab_add_mex)
endif() # documentation
# entry point in the mex file + taking care of visibility and symbol clashes.
- if (MSVC)
- get_target_property(
- _previous_link_flags
- ${${prefix}_NAME}
- LINK_FLAGS)
- if(NOT _previous_link_flags)
- set(_previous_link_flags)
- endif()
+ if(WIN32)
- set_target_properties(${${prefix}_NAME}
- PROPERTIES
- LINK_FLAGS "${_previous_link_flags} /EXPORT:mexFunction")
- endif()
+ if (MSVC)
+
+ set(_link_flags "${_link_flags} /EXPORT:mexFunction")
+ if(NOT ${Matlab_VERSION_STRING} VERSION_LESS "9.1") # For 9.1 (R2016b) and newer, export version
+ set(_link_flags "${_link_flags} /EXPORT:mexfilerequiredapiversion")
+ endif()
+
+ if(Matlab_HAS_CPP_API)
+ set(_link_flags "${_link_flags} /EXPORT:mexCreateMexFunction /EXPORT:mexDestroyMexFunction /EXPORT:mexFunctionAdapter")
+ #TODO: Is this necessary?
+ endif()
+
+ set_property(TARGET ${${prefix}_NAME} APPEND PROPERTY LINK_FLAGS ${_link_flags})
+
+ endif() # TODO: what if there's a different compiler on Windows?
- if(WIN32)
set_target_properties(${${prefix}_NAME}
PROPERTIES
DEFINE_SYMBOL "DLL_EXPORT_SYM=__declspec(dllexport)")
+
else()
- if(HAS_MINUS_PTHREAD AND NOT APPLE)
- # Apparently, compiling with -pthread generated the proper link flags
- # and some defines at compilation
- target_compile_options(${${prefix}_NAME} PRIVATE "-pthread")
+ if(${Matlab_VERSION_STRING} VERSION_LESS "9.1") # For versions prior to 9.1 (R2016b)
+ set(_ver_map_files ${Matlab_EXTERN_LIBRARY_DIR}/mexFunction.map)
+ else() # For 9.1 (R2016b) and newer
+ set(_ver_map_files ${Matlab_EXTERN_LIBRARY_DIR}/c_exportsmexfileversion.map)
endif()
+ if(NOT ${Matlab_VERSION_STRING} VERSION_LESS "9.5") # For 9.5 (R2018b) (and newer?)
+ target_compile_options(${${prefix}_NAME} PRIVATE "-fvisibility=default")
+ # This one is weird, it might be a bug in <mex.h> for R2018b. When compiling with
+ # -fvisibility=hidden, the symbol `mexFunction` cannot be exported. Reading the
+ # source code for <mex.h>, it seems that the preprocessor macro `MW_NEEDS_VERSION_H`
+ # needs to be defined for `__attribute__ ((visibility("default")))` to be added
+ # in front of the declaration of `mexFunction`. In previous versions of MATLAB this
+ # was not the case, there `DLL_EXPORT_SYM` needed to be defined.
+ # Adding `-fvisibility=hidden` to the `mex` command causes the build to fail.
+ # TODO: Check that this is still necessary in R2019a when it comes out.
+ endif()
- # if we do not do that, the symbols linked from eg. boost remain weak and
- # then clash with the ones defined in the matlab process. So by default
- # the symbols are hidden.
- # This also means that for shared libraries (like MEX), the entry point
- # should be explicitly declared with default visibility, otherwise Matlab
- # cannot find the entry point.
- # Note that this is particularly meaningful if the MEX wrapper itself
- # contains symbols that are clashing with Matlab (that are compiled in the
- # MEX file). In order to propagate the visibility options to the libraries
- # to which the MEX file is linked against, the -Wl,--exclude-libs,ALL
- # option should also be specified.
+ if(APPLE)
- set_target_properties(${${prefix}_NAME}
- PROPERTIES
- CXX_VISIBILITY_PRESET "hidden"
- C_VISIBILITY_PRESET "hidden"
- VISIBILITY_INLINES_HIDDEN ON
- )
+ if(Matlab_HAS_CPP_API)
+ list(APPEND _ver_map_files ${Matlab_EXTERN_LIBRARY_DIR}/cppMexFunction.map) # This one doesn't exist on Linux
+ set(_link_flags "${_link_flags} -Wl,-U,_mexCreateMexFunction -Wl,-U,_mexDestroyMexFunction -Wl,-U,_mexFunctionAdapter")
+ # On MacOS, the MEX command adds the above, without it the link breaks
+ # because we indiscriminately use "cppMexFunction.map" even for C API MEX-files.
+ endif()
- # get_target_property(
- # _previous_link_flags
- # ${${prefix}_NAME}
- # LINK_FLAGS)
- # if(NOT _previous_link_flags)
- # set(_previous_link_flags)
- # endif()
-
- # if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
- # set_target_properties(${${prefix}_NAME}
- # PROPERTIES
- # LINK_FLAGS "${_previous_link_flags} -Wl,--exclude-libs,ALL"
- # # -Wl,--version-script=${_FindMatlab_SELF_DIR}/MatlabLinuxVisibility.map"
- # )
- # elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- # # in this case, all other symbols become hidden.
- # set_target_properties(${${prefix}_NAME}
- # PROPERTIES
- # LINK_FLAGS "${_previous_link_flags} -Wl,-exported_symbol,_mexFunction"
- # #-Wl,-exported_symbols_list,${_FindMatlab_SELF_DIR}/MatlabOSXVisilibity.map"
- # )
- # endif()
+ set(_export_flag_name -exported_symbols_list)
+ else() # Linux
+
+ if(HAS_MINUS_PTHREAD)
+ # Apparently, compiling with -pthread generated the proper link flags
+ # and some defines at compilation
+ target_compile_options(${${prefix}_NAME} PRIVATE "-pthread")
+ endif()
+ set(_link_flags "${_link_flags} -Wl,--as-needed")
+
+ set(_export_flag_name --version-script)
+
+ endif()
+
+ foreach(_file ${_ver_map_files})
+ set(_link_flags "${_link_flags} -Wl,${_export_flag_name},${_file}")
+ endforeach()
set_target_properties(${${prefix}_NAME}
PROPERTIES
DEFINE_SYMBOL "DLL_EXPORT_SYM=__attribute__ ((visibility (\"default\")))"
- )
-
+ LINK_FLAGS "${_link_flags}"
+ ) # The `mex` command doesn't add this define. Is it necessary?
endif()
@@ -1440,6 +1460,7 @@ if(DEFINED Matlab_ROOT_DIR_LAST_CACHED)
if(NOT Matlab_ROOT_DIR_LAST_CACHED STREQUAL Matlab_ROOT_DIR)
set(_Matlab_cached_vars
+ Matlab_VERSION_STRING
Matlab_INCLUDE_DIRS
Matlab_MEX_LIBRARY
Matlab_MEX_COMPILER
@@ -1457,7 +1478,7 @@ if(DEFINED Matlab_ROOT_DIR_LAST_CACHED)
Matlab_MEXEXTENSIONS_PROG
Matlab_ROOT_DIR_LAST_CACHED
#Matlab_PROG_VERSION_STRING_AUTO_DETECT
- Matlab_VERSION_STRING_INTERNAL
+ #Matlab_VERSION_STRING_INTERNAL
)
foreach(_var IN LISTS _Matlab_cached_vars)
if(DEFINED ${_var})
@@ -1482,7 +1503,9 @@ if(MATLAB_FIND_DEBUG)
message(STATUS "[MATLAB] Current version is ${Matlab_VERSION_STRING} located ${Matlab_ROOT_DIR}")
endif()
-
+if(NOT ${Matlab_VERSION_STRING} VERSION_LESS "9.4") # MATLAB 9.4 (R2018a) and newer have a new C++ API
+ set(Matlab_HAS_CPP_API 1)
+endif()
if(Matlab_ROOT_DIR)
file(TO_CMAKE_PATH ${Matlab_ROOT_DIR} Matlab_ROOT_DIR)
@@ -1521,6 +1544,8 @@ set(Matlab_BINARIES_DIR
${Matlab_ROOT_DIR}/bin/${_matlab_bin_prefix}${_matlab_current_suffix})
set(Matlab_EXTERN_LIBRARY_DIR
${Matlab_ROOT_DIR}/extern/lib/${_matlab_bin_prefix}${_matlab_current_suffix})
+set(Matlab_EXTERN_BINARIES_DIR
+ ${Matlab_ROOT_DIR}/extern/bin/${_matlab_bin_prefix}${_matlab_current_suffix})
if(WIN32)
if(MINGW)
@@ -1530,7 +1555,7 @@ if(WIN32)
endif()
set(_matlab_lib_prefix_for_search "lib")
else()
- set(_matlab_lib_dir_for_search ${Matlab_BINARIES_DIR})
+ set(_matlab_lib_dir_for_search ${Matlab_BINARIES_DIR} ${Matlab_EXTERN_BINARIES_DIR})
set(_matlab_lib_prefix_for_search "lib")
endif()
@@ -1581,7 +1606,6 @@ _Matlab_find_library(
PATHS ${_matlab_lib_dir_for_search}
NO_DEFAULT_PATH
)
-
list(APPEND _matlab_required_variables Matlab_MEX_LIBRARY)
# the MEX extension is required
@@ -1622,21 +1646,18 @@ if(_matlab_find_matlab_program GREATER -1)
endif()
unset(_matlab_find_matlab_program)
-# Component MX library
-list(FIND Matlab_FIND_COMPONENTS MX_LIBRARY _matlab_find_mx)
-if(_matlab_find_mx GREATER -1)
- _Matlab_find_library(
- ${_matlab_lib_prefix_for_search}
- Matlab_MX_LIBRARY
- mx
- PATHS ${_matlab_lib_dir_for_search}
- NO_DEFAULT_PATH
- )
- if(Matlab_MX_LIBRARY)
- set(Matlab_MX_LIBRARY_FOUND TRUE)
- endif()
+# 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()
-unset(_matlab_find_mx)
# Component ENG library
list(FIND Matlab_FIND_COMPONENTS ENG_LIBRARY _matlab_find_eng)
@@ -1702,9 +1723,9 @@ if(_matlab_find_mcc_compiler GREATER -1)
endif()
unset(_matlab_find_mcc_compiler)
-# component MatlabEngine
-list(FIND Matlab_FIND_COMPONENTS ENGINE_LIBRARY _matlab_find_matlab_engine)
-if(_matlab_find_matlab_engine GREATER -1)
+if(Matlab_HAS_CPP_API)
+
+ # The MatlabEngine library is required for R2018a+
_Matlab_find_library(
${_matlab_lib_prefix_for_search}
Matlab_ENGINE_LIBRARY
@@ -1713,40 +1734,33 @@ if(_matlab_find_matlab_engine GREATER -1)
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()
-endif()
-unset(_matlab_find_matlab_engine)
-# component MatlabDataArray
-list(FIND Matlab_FIND_COMPONENTS DATAARRAY_LIBRARY _matlab_find_matlab_dataarray)
-if(_matlab_find_matlab_dataarray GREATER -1)
+ # The MatlabDataArray library is required for R2018a+
_Matlab_find_library(
- ${_matlab_lib_prefix_for_search}
+ ${_matlab_lib_prefix_for_search}
Matlab_DATAARRAY_LIBRARY
MatlabDataArray
PATHS ${_matlab_lib_dir_for_search}
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()
+
endif()
-unset(_matlab_find_matlab_dataarray)
unset(_matlab_lib_dir_for_search)
-set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY} ${Matlab_MAT_LIBRARY})
-
-if(Matlab_DATAARRAY_LIBRARY_FOUND)
- set(Matlab_LIBRARIES ${Matlab_LIBRARIES} ${Matlab_DATAARRAY_LIBRARY})
-endif()
-
-if(Matlab_ENGINE_LIBRARY_FOUND)
- set(Matlab_LIBRARIES ${Matlab_LIBRARIES} ${Matlab_ENGINE_LIBRARY})
-endif()
+set(Matlab_LIBRARIES
+ ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY}
+ ${Matlab_ENG_LIBRARY} ${Matlab_MAT_LIBRARY}
+ ${Matlab_DATAARRAY_LIBRARY} ${Matlab_ENGINE_LIBRARY})
find_package_handle_standard_args(
Matlab
diff --git a/Modules/FindMotif.cmake b/Modules/FindMotif.cmake
index 7304d957c..4f7080a44 100644
--- a/Modules/FindMotif.cmake
+++ b/Modules/FindMotif.cmake
@@ -1,19 +1,20 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindMotif
-# ---------
-#
-# Try to find Motif (or lesstif)
-#
-# Once done this will define:
-#
-# ::
-#
-# MOTIF_FOUND - system has MOTIF
-# MOTIF_INCLUDE_DIR - include paths to use Motif
-# MOTIF_LIBRARIES - Link these to use Motif
+#[=======================================================================[.rst:
+FindMotif
+---------
+
+Try to find Motif (or lesstif)
+
+Once done this will define:
+
+::
+
+ MOTIF_FOUND - system has MOTIF
+ MOTIF_INCLUDE_DIR - include paths to use Motif
+ MOTIF_LIBRARIES - Link these to use Motif
+#]=======================================================================]
set(MOTIF_FOUND 0)
diff --git a/Modules/FindODBC.cmake b/Modules/FindODBC.cmake
index c8ca477cc..29d7af9e8 100644
--- a/Modules/FindODBC.cmake
+++ b/Modules/FindODBC.cmake
@@ -90,7 +90,9 @@ set(_odbc_required_libs_names)
### Try Windows Kits ##########################################################
if(WIN32)
# List names of ODBC libraries on Windows
- set(ODBC_LIBRARY odbc32.lib)
+ if(NOT MINGW)
+ set(ODBC_LIBRARY odbc32.lib)
+ endif()
set(_odbc_lib_names odbc32;)
# List additional libraries required to use ODBC library
diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake
index 7521d5121..dbd796101 100644
--- a/Modules/FindOpenAL.cmake
+++ b/Modules/FindOpenAL.cmake
@@ -1,21 +1,22 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindOpenAL
-# ----------
-#
-#
-#
-# Locate OpenAL This module defines OPENAL_LIBRARY OPENAL_FOUND, if
-# false, do not try to link to OpenAL OPENAL_INCLUDE_DIR, where to find
-# the headers
-#
-# $OPENALDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OPENALDIR used in building OpenAL.
-#
-# Created by Eric Wing. This was influenced by the FindSDL.cmake
-# module.
+#[=======================================================================[.rst:
+FindOpenAL
+----------
+
+
+
+Locate OpenAL This module defines OPENAL_LIBRARY OPENAL_FOUND, if
+false, do not try to link to OpenAL OPENAL_INCLUDE_DIR, where to find
+the headers
+
+$OPENALDIR is an environment variable that would correspond to the
+./configure --prefix=$OPENALDIR used in building OpenAL.
+
+Created by Eric Wing. This was influenced by the FindSDL.cmake
+module.
+#]=======================================================================]
# This makes the presumption that you are include al.h like
# #include "al.h"
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
index fe162b49b..79c0382d3 100644
--- a/Modules/FindOpenCL.cmake
+++ b/Modules/FindOpenCL.cmake
@@ -1,35 +1,36 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindOpenCL
-# ----------
-#
-# Try to find OpenCL
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines :prop_tgt:`IMPORTED` target ``OpenCL::OpenCL``, if
-# OpenCL has been found.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following variables::
-#
-# OpenCL_FOUND - True if OpenCL was found
-# OpenCL_INCLUDE_DIRS - include directories for OpenCL
-# OpenCL_LIBRARIES - link against this library to use OpenCL
-# OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
-# OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation
-# OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation
-#
-# The module will also define two cache variables::
-#
-# OpenCL_INCLUDE_DIR - the OpenCL include directory
-# OpenCL_LIBRARY - the path to the OpenCL library
-#
+#[=======================================================================[.rst:
+FindOpenCL
+----------
+
+Try to find OpenCL
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``OpenCL::OpenCL``, if
+OpenCL has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables::
+
+ OpenCL_FOUND - True if OpenCL was found
+ OpenCL_INCLUDE_DIRS - include directories for OpenCL
+ OpenCL_LIBRARIES - link against this library to use OpenCL
+ OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
+ OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation
+ OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation
+
+The module will also define two cache variables::
+
+ OpenCL_INCLUDE_DIR - the OpenCL include directory
+ OpenCL_LIBRARY - the path to the OpenCL library
+
+#]=======================================================================]
function(_FIND_OPENCL_VERSION)
include(CheckSymbolExists)
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 4d0786cd2..832dca274 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -1,125 +1,126 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindOpenGL
-# ----------
-#
-# FindModule for OpenGL and GLU.
-#
-# Optional COMPONENTS
-# ^^^^^^^^^^^^^^^^^^^
-#
-# This module respects several optional COMPONENTS: ``EGL``, ``GLX``, and
-# ``OpenGL``. There are corresponding import targets for each of these flags.
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# 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.
-# ``OpenGL::GLU``
-# Defined if the system has GLU.
-# ``OpenGL::GLX``
-# Defined if the system has GLX.
-# ``OpenGL::EGL``
-# Defined if the system has EGL.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module sets the following variables:
-#
-# ``OPENGL_FOUND``
-# True, if the system has OpenGL and all components are found.
-# ``OPENGL_XMESA_FOUND``
-# True, if the system has XMESA.
-# ``OPENGL_GLU_FOUND``
-# True, if the system has GLU.
-# ``OpenGL_OpenGL_FOUND``
-# True, if the system has an OpenGL library.
-# ``OpenGL_GLX_FOUND``
-# True, if the system has GLX.
-# ``OpenGL_EGL_FOUND``
-# True, if the system has EGL.
-# ``OPENGL_INCLUDE_DIR``
-# Path to the OpenGL include directory.
-# ``OPENGL_EGL_INCLUDE_DIRS``
-# Path to the EGL include directory.
-# ``OPENGL_LIBRARIES``
-# Paths to the OpenGL library, windowing system libraries, and GLU libraries.
-# On Linux, this assumes GLX and is never correct for EGL-based targets.
-# Clients are encouraged to use the ``OpenGL::*`` import targets instead.
-#
-# Cache variables
-# ^^^^^^^^^^^^^^^
-#
-# The following cache variables may also be set:
-#
-# ``OPENGL_egl_LIBRARY``
-# Path to the EGL library.
-# ``OPENGL_glu_LIBRARY``
-# Path to the GLU library.
-# ``OPENGL_glx_LIBRARY``
-# Path to the GLVND 'GLX' library.
-# ``OPENGL_opengl_LIBRARY``
-# Path to the GLVND 'OpenGL' library
-# ``OPENGL_gl_LIBRARY``
-# Path to the OpenGL library. New code should prefer the ``OpenGL::*`` import
-# targets.
-#
-# Linux-specific
-# ^^^^^^^^^^^^^^
-#
-# Some Linux systems utilize GLVND as a new ABI for OpenGL. GLVND separates
-# context libraries from OpenGL itself; OpenGL lives in "libOpenGL", and
-# contexts are defined in "libGLX" or "libEGL". GLVND is currently the only way
-# to get OpenGL 3+ functionality via EGL in a manner portable across vendors.
-# Projects may use GLVND explicitly with target ``OpenGL::OpenGL`` and either
-# ``OpenGL::GLX`` or ``OpenGL::EGL``.
-#
-# Projects may use the ``OpenGL::GL`` target (or ``OPENGL_LIBRARIES`` variable)
-# to use legacy GL interfaces. These will use the legacy GL library located
-# by ``OPENGL_gl_LIBRARY``, if available. If ``OPENGL_gl_LIBRARY`` is empty or
-# not found and GLVND is available, the ``OpenGL::GL`` target will use GLVND
-# ``OpenGL::OpenGL`` and ``OpenGL::GLX`` (and the ``OPENGL_LIBRARIES``
-# variable will use the corresponding libraries). Thus, for non-EGL-based
-# Linux targets, the ``OpenGL::GL`` target is most portable.
-#
-# A ``OpenGL_GL_PREFERENCE`` variable may be set to specify the preferred way
-# to provide legacy GL interfaces in case multiple choices are available.
-# 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``.
-#
-# ``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*
-# libraries is theoretically possible in place of ``OpenGL::OpenGL``, but this
-# module does not currently support that; contributions welcome.
-#
-# ``OPENGL_egl_LIBRARY`` and ``OPENGL_EGL_INCLUDE_DIRS`` are defined in the case of
-# GLVND. For non-GLVND Linux and other systems these are left undefined.
-#
-# macOS-Specific
-# ^^^^^^^^^^^^^^
-#
-# On OSX FindOpenGL defaults to using the framework version of OpenGL. People
-# will have to change the cache values of OPENGL_glu_LIBRARY and
-# OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX.
+#[=======================================================================[.rst:
+FindOpenGL
+----------
+
+FindModule for OpenGL and GLU.
+
+Optional COMPONENTS
+^^^^^^^^^^^^^^^^^^^
+
+This module respects several optional COMPONENTS: ``EGL``, ``GLX``, and
+``OpenGL``. There are corresponding import targets for each of these flags.
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+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.
+``OpenGL::GLU``
+ Defined if the system has GLU.
+``OpenGL::GLX``
+ Defined if the system has GLX.
+``OpenGL::EGL``
+ Defined if the system has EGL.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module sets the following variables:
+
+``OPENGL_FOUND``
+ True, if the system has OpenGL and all components are found.
+``OPENGL_XMESA_FOUND``
+ True, if the system has XMESA.
+``OPENGL_GLU_FOUND``
+ True, if the system has GLU.
+``OpenGL_OpenGL_FOUND``
+ True, if the system has an OpenGL library.
+``OpenGL_GLX_FOUND``
+ True, if the system has GLX.
+``OpenGL_EGL_FOUND``
+ True, if the system has EGL.
+``OPENGL_INCLUDE_DIR``
+ Path to the OpenGL include directory.
+``OPENGL_EGL_INCLUDE_DIRS``
+ Path to the EGL include directory.
+``OPENGL_LIBRARIES``
+ Paths to the OpenGL library, windowing system libraries, and GLU libraries.
+ On Linux, this assumes GLX and is never correct for EGL-based targets.
+ Clients are encouraged to use the ``OpenGL::*`` import targets instead.
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``OPENGL_egl_LIBRARY``
+ Path to the EGL library.
+``OPENGL_glu_LIBRARY``
+ Path to the GLU library.
+``OPENGL_glx_LIBRARY``
+ Path to the GLVND 'GLX' library.
+``OPENGL_opengl_LIBRARY``
+ Path to the GLVND 'OpenGL' library
+``OPENGL_gl_LIBRARY``
+ Path to the OpenGL library. New code should prefer the ``OpenGL::*`` import
+ targets.
+
+Linux-specific
+^^^^^^^^^^^^^^
+
+Some Linux systems utilize GLVND as a new ABI for OpenGL. GLVND separates
+context libraries from OpenGL itself; OpenGL lives in "libOpenGL", and
+contexts are defined in "libGLX" or "libEGL". GLVND is currently the only way
+to get OpenGL 3+ functionality via EGL in a manner portable across vendors.
+Projects may use GLVND explicitly with target ``OpenGL::OpenGL`` and either
+``OpenGL::GLX`` or ``OpenGL::EGL``.
+
+Projects may use the ``OpenGL::GL`` target (or ``OPENGL_LIBRARIES`` variable)
+to use legacy GL interfaces. These will use the legacy GL library located
+by ``OPENGL_gl_LIBRARY``, if available. If ``OPENGL_gl_LIBRARY`` is empty or
+not found and GLVND is available, the ``OpenGL::GL`` target will use GLVND
+``OpenGL::OpenGL`` and ``OpenGL::GLX`` (and the ``OPENGL_LIBRARIES``
+variable will use the corresponding libraries). Thus, for non-EGL-based
+Linux targets, the ``OpenGL::GL`` target is most portable.
+
+A ``OpenGL_GL_PREFERENCE`` variable may be set to specify the preferred way
+to provide legacy GL interfaces in case multiple choices are available.
+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``.
+
+``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*
+libraries is theoretically possible in place of ``OpenGL::OpenGL``, but this
+module does not currently support that; contributions welcome.
+
+``OPENGL_egl_LIBRARY`` and ``OPENGL_EGL_INCLUDE_DIRS`` are defined in the case of
+GLVND. For non-GLVND Linux and other systems these are left undefined.
+
+macOS-Specific
+^^^^^^^^^^^^^^
+
+On OSX FindOpenGL defaults to using the framework version of OpenGL. People
+will have to change the cache values of OPENGL_glu_LIBRARY and
+OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX.
+#]=======================================================================]
set(_OpenGL_REQUIRED_VARS OPENGL_gl_LIBRARY)
@@ -267,11 +268,9 @@ else()
endif()
if(_OpenGL_GL_POLICY_WARN AND OPENGL_gl_LIBRARY AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY)
+ cmake_policy(GET_WARNING CMP0072 _cmp0072_warning)
message(AUTHOR_WARNING
- "Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when available. "
- "Run \"cmake --help-policy CMP0072\" for policy details. "
- "Use the cmake_policy command to set the policy and suppress this warning."
- "\n"
+ "${_cmp0072_warning}\n"
"FindOpenGL found both a legacy GL library:\n"
" OPENGL_gl_LIBRARY: ${OPENGL_gl_LIBRARY}\n"
"and GLVND libraries for OpenGL and GLX:\n"
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index cbc6ed846..7e3721276 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -1,78 +1,79 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindOpenMP
-# ----------
-#
-# Finds OpenMP support
-#
-# This module can be used to detect OpenMP support in a compiler. If
-# the compiler supports OpenMP, the flags required to compile with
-# 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.
-#
-# Variables
-# ^^^^^^^^^
-#
-# 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:
-#
-# ``OpenMP_FOUND``
-# Variable indicating that OpenMP flags for all requested languages have been found.
-# If no components are specified, this is true if OpenMP settings for all enabled languages
-# were detected.
-# ``OpenMP_VERSION``
-# Minimal version of the OpenMP standard detected among the requested languages,
-# or all enabled languages if no components were specified.
-#
-# This module will set the following variables per language in your
-# project, where ``<lang>`` is one of C, CXX, or Fortran:
-#
-# ``OpenMP_<lang>_FOUND``
-# Variable indicating if OpenMP support for ``<lang>`` was detected.
-# ``OpenMP_<lang>_FLAGS``
-# OpenMP compiler flags for ``<lang>``, separated by spaces.
-#
-# For linking with OpenMP code written in ``<lang>``, the following
-# variables are provided:
-#
-# ``OpenMP_<lang>_LIB_NAMES``
-# :ref:`;-list <CMake Language Lists>` of libraries for OpenMP programs for ``<lang>``.
-# ``OpenMP_<libname>_LIBRARY``
-# Location of the individual libraries needed for OpenMP support in ``<lang>``.
-# ``OpenMP_<lang>_LIBRARIES``
-# A list of libraries needed to link with OpenMP code written in ``<lang>``.
-#
-# Additionally, the module provides :prop_tgt:`IMPORTED` targets:
-#
-# ``OpenMP::OpenMP_<lang>``
-# Target for using OpenMP from ``<lang>``.
-#
-# Specifically for Fortran, the module sets the following variables:
-#
-# ``OpenMP_Fortran_HAVE_OMPLIB_HEADER``
-# Boolean indicating if OpenMP is accessible through ``omp_lib.h``.
-# ``OpenMP_Fortran_HAVE_OMPLIB_MODULE``
-# Boolean indicating if OpenMP is accessible through the ``omp_lib`` Fortran module.
-#
-# The module will also try to provide the OpenMP version variables:
-#
-# ``OpenMP_<lang>_SPEC_DATE``
-# Date of the OpenMP specification implemented by the ``<lang>`` compiler.
-# ``OpenMP_<lang>_VERSION_MAJOR``
-# Major version of OpenMP implemented by the ``<lang>`` compiler.
-# ``OpenMP_<lang>_VERSION_MINOR``
-# Minor version of OpenMP implemented by the ``<lang>`` compiler.
-# ``OpenMP_<lang>_VERSION``
-# OpenMP version implemented by the ``<lang>`` compiler.
-#
-# The specification date is formatted as given in the OpenMP standard:
-# ``yyyymm`` where ``yyyy`` and ``mm`` represents the year and month of
-# the OpenMP specification implemented by the ``<lang>`` compiler.
+#[=======================================================================[.rst:
+FindOpenMP
+----------
+
+Finds OpenMP support
+
+This module can be used to detect OpenMP support in a compiler. If
+the compiler supports OpenMP, the flags required to compile with
+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.
+
+Variables
+^^^^^^^^^
+
+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:
+
+``OpenMP_FOUND``
+ Variable indicating that OpenMP flags for all requested languages have been found.
+ If no components are specified, this is true if OpenMP settings for all enabled languages
+ were detected.
+``OpenMP_VERSION``
+ Minimal version of the OpenMP standard detected among the requested languages,
+ or all enabled languages if no components were specified.
+
+This module will set the following variables per language in your
+project, where ``<lang>`` is one of C, CXX, or Fortran:
+
+``OpenMP_<lang>_FOUND``
+ Variable indicating if OpenMP support for ``<lang>`` was detected.
+``OpenMP_<lang>_FLAGS``
+ OpenMP compiler flags for ``<lang>``, separated by spaces.
+
+For linking with OpenMP code written in ``<lang>``, the following
+variables are provided:
+
+``OpenMP_<lang>_LIB_NAMES``
+ :ref:`;-list <CMake Language Lists>` of libraries for OpenMP programs for ``<lang>``.
+``OpenMP_<libname>_LIBRARY``
+ Location of the individual libraries needed for OpenMP support in ``<lang>``.
+``OpenMP_<lang>_LIBRARIES``
+ A list of libraries needed to link with OpenMP code written in ``<lang>``.
+
+Additionally, the module provides :prop_tgt:`IMPORTED` targets:
+
+``OpenMP::OpenMP_<lang>``
+ Target for using OpenMP from ``<lang>``.
+
+Specifically for Fortran, the module sets the following variables:
+
+``OpenMP_Fortran_HAVE_OMPLIB_HEADER``
+ Boolean indicating if OpenMP is accessible through ``omp_lib.h``.
+``OpenMP_Fortran_HAVE_OMPLIB_MODULE``
+ Boolean indicating if OpenMP is accessible through the ``omp_lib`` Fortran module.
+
+The module will also try to provide the OpenMP version variables:
+
+``OpenMP_<lang>_SPEC_DATE``
+ Date of the OpenMP specification implemented by the ``<lang>`` compiler.
+``OpenMP_<lang>_VERSION_MAJOR``
+ Major version of OpenMP implemented by the ``<lang>`` compiler.
+``OpenMP_<lang>_VERSION_MINOR``
+ Minor version of OpenMP implemented by the ``<lang>`` compiler.
+``OpenMP_<lang>_VERSION``
+ OpenMP version implemented by the ``<lang>`` compiler.
+
+The specification date is formatted as given in the OpenMP standard:
+``yyyymm`` where ``yyyy`` and ``mm`` represents the year and month of
+the OpenMP specification implemented by the ``<lang>`` compiler.
+#]=======================================================================]
cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW) # if() recognizes numbers and booleans
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index d5cd8bc02..5f947fe54 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -1,53 +1,54 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindOpenSSL
-# -----------
-#
-# Find the OpenSSL encryption library.
-#
-# Optional COMPONENTS
-# ^^^^^^^^^^^^^^^^^^^
-#
-# This module supports two optional COMPONENTS: ``Crypto`` and ``SSL``. Both
-# components have associated imported targets, as described below.
-#
-# Imported Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following :prop_tgt:`IMPORTED` targets:
-#
-# ``OpenSSL::SSL``
-# The OpenSSL ``ssl`` library, if found.
-# ``OpenSSL::Crypto``
-# The OpenSSL ``crypto`` library, if found.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project:
-#
-# ``OPENSSL_FOUND``
-# System has the OpenSSL library. If no components are requested it only
-# requires the crypto library.
-# ``OPENSSL_INCLUDE_DIR``
-# The OpenSSL include directory.
-# ``OPENSSL_CRYPTO_LIBRARY``
-# The OpenSSL crypto library.
-# ``OPENSSL_SSL_LIBRARY``
-# The OpenSSL SSL library.
-# ``OPENSSL_LIBRARIES``
-# All OpenSSL libraries.
-# ``OPENSSL_VERSION``
-# This is set to ``$major.$minor.$revision$patch`` (e.g. ``0.9.8s``).
-#
-# 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.
+#[=======================================================================[.rst:
+FindOpenSSL
+-----------
+
+Find the OpenSSL encryption library.
+
+Optional COMPONENTS
+^^^^^^^^^^^^^^^^^^^
+
+This module supports two optional COMPONENTS: ``Crypto`` and ``SSL``. Both
+components have associated imported targets, as described below.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` targets:
+
+``OpenSSL::SSL``
+ The OpenSSL ``ssl`` library, if found.
+``OpenSSL::Crypto``
+ The OpenSSL ``crypto`` library, if found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``OPENSSL_FOUND``
+ System has the OpenSSL library. If no components are requested it only
+ requires the crypto library.
+``OPENSSL_INCLUDE_DIR``
+ The OpenSSL include directory.
+``OPENSSL_CRYPTO_LIBRARY``
+ The OpenSSL crypto library.
+``OPENSSL_SSL_LIBRARY``
+ The OpenSSL SSL library.
+``OPENSSL_LIBRARIES``
+ All OpenSSL libraries.
+``OPENSSL_VERSION``
+ This is set to ``$major.$minor.$revision$patch`` (e.g. ``0.9.8s``).
+
+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.
+#]=======================================================================]
if (UNIX)
find_package(PkgConfig QUIET)
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 425aa4581..6f7d3c836 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -1,102 +1,103 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindOpenSceneGraph
-# ------------------
-#
-# Find OpenSceneGraph
-#
-# This module searches for the OpenSceneGraph core "osg" library as well
-# as OpenThreads, and whatever additional COMPONENTS (nodekits) that you
-# specify.
-#
-# ::
-#
-# See http://www.openscenegraph.org
-#
-#
-#
-# NOTE: To use this module effectively you must either require CMake >=
-# 2.6.3 with cmake_minimum_required(VERSION 2.6.3) or download and place
-# FindOpenThreads.cmake, Findosg_functions.cmake, Findosg.cmake, and
-# Find<etc>.cmake files into your CMAKE_MODULE_PATH.
-#
-# ==================================
-#
-# This module accepts the following variables (note mixed case)
-#
-# ::
-#
-# OpenSceneGraph_DEBUG - Enable debugging output
-#
-#
-#
-# ::
-#
-# OpenSceneGraph_MARK_AS_ADVANCED - Mark cache variables as advanced
-# automatically
-#
-#
-#
-# The following environment variables are also respected for finding the
-# OSG and it's various components. CMAKE_PREFIX_PATH can also be used
-# for this (see find_library() CMake documentation).
-#
-# ``<MODULE>_DIR``
-# (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file)
-# ``OSG_DIR``
-# ..
-# ``OSGDIR``
-# ..
-# ``OSG_ROOT``
-# ..
-#
-#
-# [CMake 2.8.10]: The CMake variable OSG_DIR can now be used as well to
-# influence detection, instead of needing to specify an environment
-# variable.
-#
-# This module defines the following output variables:
-#
-# ::
-#
-# OPENSCENEGRAPH_FOUND - Was the OSG and all of the specified components found?
-#
-#
-#
-# ::
-#
-# OPENSCENEGRAPH_VERSION - The version of the OSG which was found
-#
-#
-#
-# ::
-#
-# OPENSCENEGRAPH_INCLUDE_DIRS - Where to find the headers
-#
-#
-#
-# ::
-#
-# OPENSCENEGRAPH_LIBRARIES - The OSG libraries
-#
-#
-#
-# ================================== Example Usage:
-#
-# ::
-#
-# find_package(OpenSceneGraph 2.0.0 REQUIRED osgDB osgUtil)
-# # libOpenThreads & libosg automatically searched
-# include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
-#
-#
-#
-# ::
-#
-# add_executable(foo foo.cc)
-# target_link_libraries(foo ${OPENSCENEGRAPH_LIBRARIES})
+#[=======================================================================[.rst:
+FindOpenSceneGraph
+------------------
+
+Find OpenSceneGraph
+
+This module searches for the OpenSceneGraph core "osg" library as well
+as OpenThreads, and whatever additional COMPONENTS (nodekits) that you
+specify.
+
+::
+
+ See http://www.openscenegraph.org
+
+
+
+NOTE: To use this module effectively you must either require CMake >=
+2.6.3 with cmake_minimum_required(VERSION 2.6.3) or download and place
+FindOpenThreads.cmake, Findosg_functions.cmake, Findosg.cmake, and
+Find<etc>.cmake files into your CMAKE_MODULE_PATH.
+
+==================================
+
+This module accepts the following variables (note mixed case)
+
+::
+
+ OpenSceneGraph_DEBUG - Enable debugging output
+
+
+
+::
+
+ OpenSceneGraph_MARK_AS_ADVANCED - Mark cache variables as advanced
+ automatically
+
+
+
+The following environment variables are also respected for finding the
+OSG and it's various components. CMAKE_PREFIX_PATH can also be used
+for this (see find_library() CMake documentation).
+
+``<MODULE>_DIR``
+ (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file)
+``OSG_DIR``
+ ..
+``OSGDIR``
+ ..
+``OSG_ROOT``
+ ..
+
+
+[CMake 2.8.10]: The CMake variable OSG_DIR can now be used as well to
+influence detection, instead of needing to specify an environment
+variable.
+
+This module defines the following output variables:
+
+::
+
+ OPENSCENEGRAPH_FOUND - Was the OSG and all of the specified components found?
+
+
+
+::
+
+ OPENSCENEGRAPH_VERSION - The version of the OSG which was found
+
+
+
+::
+
+ OPENSCENEGRAPH_INCLUDE_DIRS - Where to find the headers
+
+
+
+::
+
+ OPENSCENEGRAPH_LIBRARIES - The OSG libraries
+
+
+
+================================== Example Usage:
+
+::
+
+ find_package(OpenSceneGraph 2.0.0 REQUIRED osgDB osgUtil)
+ # libOpenThreads & libosg automatically searched
+ include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
+
+
+
+::
+
+ add_executable(foo foo.cc)
+ target_link_libraries(foo ${OPENSCENEGRAPH_LIBRARIES})
+#]=======================================================================]
#
# Naming convention:
diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake
index 91545e0ea..bc45eea7b 100644
--- a/Modules/FindOpenThreads.cmake
+++ b/Modules/FindOpenThreads.cmake
@@ -1,30 +1,31 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindOpenThreads
-# ---------------
-#
-#
-#
-# OpenThreads is a C++ based threading library. Its largest userbase
-# seems to OpenSceneGraph so you might notice I accept OSGDIR as an
-# environment path. I consider this part of the Findosg* suite used to
-# find OpenSceneGraph components. Each component is separate and you
-# must opt in to each module.
-#
-# Locate OpenThreads This module defines OPENTHREADS_LIBRARY
-# OPENTHREADS_FOUND, if false, do not try to link to OpenThreads
-# OPENTHREADS_INCLUDE_DIR, where to find the headers
-#
-# $OPENTHREADS_DIR is an environment variable that would correspond to
-# the ./configure --prefix=$OPENTHREADS_DIR used in building osg.
-#
-# [CMake 2.8.10]: The CMake variables OPENTHREADS_DIR or OSG_DIR can now
-# be used as well to influence detection, instead of needing to specify
-# an environment variable.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindOpenThreads
+---------------
+
+
+
+OpenThreads is a C++ based threading library. Its largest userbase
+seems to OpenSceneGraph so you might notice I accept OSGDIR as an
+environment path. I consider this part of the Findosg* suite used to
+find OpenSceneGraph components. Each component is separate and you
+must opt in to each module.
+
+Locate OpenThreads This module defines OPENTHREADS_LIBRARY
+OPENTHREADS_FOUND, if false, do not try to link to OpenThreads
+OPENTHREADS_INCLUDE_DIR, where to find the headers
+
+$OPENTHREADS_DIR is an environment variable that would correspond to
+the ./configure --prefix=$OPENTHREADS_DIR used in building osg.
+
+[CMake 2.8.10]: The CMake variables OPENTHREADS_DIR or OSG_DIR can now
+be used as well to influence detection, instead of needing to specify
+an environment variable.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <OpenThreads/Thread>
diff --git a/Modules/FindPHP4.cmake b/Modules/FindPHP4.cmake
index 426453bd4..34b4adb01 100644
--- a/Modules/FindPHP4.cmake
+++ b/Modules/FindPHP4.cmake
@@ -1,20 +1,21 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPHP4
-# --------
-#
-# Find PHP4
-#
-# This module finds if PHP4 is installed and determines where the
-# include files and libraries are. It also determines what the name of
-# the library is. This code sets the following variables:
-#
-# ::
-#
-# PHP4_INCLUDE_PATH = path to where php.h can be found
-# PHP4_EXECUTABLE = full path to the php4 binary
+#[=======================================================================[.rst:
+FindPHP4
+--------
+
+Find PHP4
+
+This module finds if PHP4 is installed and determines where the
+include files and libraries are. It also determines what the name of
+the library is. This code sets the following variables:
+
+::
+
+ PHP4_INCLUDE_PATH = path to where php.h can be found
+ PHP4_EXECUTABLE = full path to the php4 binary
+#]=======================================================================]
set(PHP4_POSSIBLE_INCLUDE_PATHS
/usr/include/php4
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index 936f01fed..2208b4847 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -1,49 +1,50 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPNG
-# -------
-#
-# Find libpng, the official reference library for the PNG image format.
-#
-# Imported targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following :prop_tgt:`IMPORTED` target:
-#
-# ``PNG::PNG``
-# The libpng library, if found.
-#
-# Result variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project:
-#
-# ``PNG_INCLUDE_DIRS``
-# where to find png.h, etc.
-# ``PNG_LIBRARIES``
-# the libraries to link against to use PNG.
-# ``PNG_DEFINITIONS``
-# You should add_definitions(${PNG_DEFINITIONS}) before compiling code
-# that includes png library files.
-# ``PNG_FOUND``
-# If false, do not try to use PNG.
-# ``PNG_VERSION_STRING``
-# the version of the PNG library found (since CMake 2.8.8)
-#
-# Obsolete variables
-# ^^^^^^^^^^^^^^^^^^
-#
-# The following variables may also be set, for backwards compatibility:
-#
-# ``PNG_LIBRARY``
-# where to find the PNG library.
-# ``PNG_INCLUDE_DIR``
-# where to find the PNG headers (same as PNG_INCLUDE_DIRS)
-#
-# Since PNG depends on the ZLib compression library, none of the above
-# will be defined unless ZLib can be found.
+#[=======================================================================[.rst:
+FindPNG
+-------
+
+Find libpng, the official reference library for the PNG image format.
+
+Imported targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` target:
+
+``PNG::PNG``
+ The libpng library, if found.
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``PNG_INCLUDE_DIRS``
+ where to find png.h, etc.
+``PNG_LIBRARIES``
+ the libraries to link against to use PNG.
+``PNG_DEFINITIONS``
+ You should add_definitions(${PNG_DEFINITIONS}) before compiling code
+ that includes png library files.
+``PNG_FOUND``
+ If false, do not try to use PNG.
+``PNG_VERSION_STRING``
+ the version of the PNG library found (since CMake 2.8.8)
+
+Obsolete variables
+^^^^^^^^^^^^^^^^^^
+
+The following variables may also be set, for backwards compatibility:
+
+``PNG_LIBRARY``
+ where to find the PNG library.
+``PNG_INCLUDE_DIR``
+ where to find the PNG headers (same as PNG_INCLUDE_DIRS)
+
+Since PNG depends on the ZLib compression library, none of the above
+will be defined unless ZLib can be found.
+#]=======================================================================]
if(PNG_FIND_QUIETLY)
set(_FIND_ZLIB_ARG QUIET)
diff --git a/Modules/FindPackageMessage.cmake b/Modules/FindPackageMessage.cmake
index 6821cee4f..0628b9816 100644
--- a/Modules/FindPackageMessage.cmake
+++ b/Modules/FindPackageMessage.cmake
@@ -1,35 +1,36 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPackageMessage
-# ------------------
-#
-#
-#
-# FIND_PACKAGE_MESSAGE(<name> "message for user" "find result details")
-#
-# This macro is intended to be used in FindXXX.cmake modules files. It
-# will print a message once for each unique find result. This is useful
-# for telling the user where a package was found. The first argument
-# specifies the name (XXX) of the package. The second argument
-# specifies the message to display. The third argument lists details
-# about the find result so that if they change the message will be
-# displayed again. The macro also obeys the QUIET argument to the
-# find_package command.
-#
-# Example:
-#
-# ::
-#
-# if(X11_FOUND)
-# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
-# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
-# else()
-# ...
-# endif()
-
-function(FIND_PACKAGE_MESSAGE pkg msg details)
+#[=======================================================================[.rst:
+FindPackageMessage
+------------------
+
+.. code-block:: cmake
+
+ find_package_message(<name> "message for user" "find result details")
+
+This function is intended to be used in FindXXX.cmake modules files.
+It will print a message once for each unique find result. This is
+useful for telling the user where a package was found. The first
+argument specifies the name (XXX) of the package. The second argument
+specifies the message to display. The third argument lists details
+about the find result so that if they change the message will be
+displayed again. The macro also obeys the QUIET argument to the
+find_package command.
+
+Example:
+
+.. code-block:: cmake
+
+ if(X11_FOUND)
+ find_package_message(X11 "Found X11: ${X11_X11_LIB}"
+ "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
+ else()
+ ...
+ endif()
+#]=======================================================================]
+
+function(find_package_message pkg msg details)
# Avoid printing a message repeatedly for the same find result.
if(NOT ${pkg}_FIND_QUIETLY)
string(REPLACE "\n" "" details "${details}")
diff --git a/Modules/FindPatch.cmake b/Modules/FindPatch.cmake
index 3ebcae909..49988395b 100644
--- a/Modules/FindPatch.cmake
+++ b/Modules/FindPatch.cmake
@@ -1,30 +1,31 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPatch
-# ---------
-#
-# The module defines the following variables:
-#
-# ``Patch_EXECUTABLE``
-# Path to patch command-line executable.
-# ``Patch_FOUND``
-# True if the patch command-line executable was found.
-#
-# The following :prop_tgt:`IMPORTED` targets are also defined:
-#
-# ``Patch::patch``
-# The command-line executable.
-#
-# Example usage:
-#
-# .. code-block:: cmake
-#
-# find_package(Patch)
-# if(Patch_FOUND)
-# message("Patch found: ${Patch_EXECUTABLE}")
-# endif()
+#[=======================================================================[.rst:
+FindPatch
+---------
+
+The module defines the following variables:
+
+``Patch_EXECUTABLE``
+ Path to patch command-line executable.
+``Patch_FOUND``
+ True if the patch command-line executable was found.
+
+The following :prop_tgt:`IMPORTED` targets are also defined:
+
+``Patch::patch``
+ The command-line executable.
+
+Example usage:
+
+.. code-block:: cmake
+
+ find_package(Patch)
+ if(Patch_FOUND)
+ message("Patch found: ${Patch_EXECUTABLE}")
+ endif()
+#]=======================================================================]
set(_doc "Patch command line executable")
set(_patch_path )
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake
index c38527cfa..fd120bf8e 100644
--- a/Modules/FindPerl.cmake
+++ b/Modules/FindPerl.cmake
@@ -1,19 +1,20 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPerl
-# --------
-#
-# Find perl
-#
-# this module looks for Perl
-#
-# ::
-#
-# PERL_EXECUTABLE - the full path to perl
-# PERL_FOUND - If false, don't attempt to use perl.
-# PERL_VERSION_STRING - version of perl found (since CMake 2.8.8)
+#[=======================================================================[.rst:
+FindPerl
+--------
+
+Find perl
+
+this module looks for Perl
+
+::
+
+ PERL_EXECUTABLE - the full path to perl
+ PERL_FOUND - If false, don't attempt to use perl.
+ PERL_VERSION_STRING - version of perl found (since CMake 2.8.8)
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake
index 0b902e74d..7e27f3188 100644
--- a/Modules/FindPerlLibs.cmake
+++ b/Modules/FindPerlLibs.cmake
@@ -1,47 +1,48 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPerlLibs
-# ------------
-#
-# Find Perl libraries
-#
-# This module finds if PERL is installed and determines where the
-# include files and libraries are. It also determines what the name of
-# the library is. This code sets the following variables:
-#
-# ::
-#
-# PERLLIBS_FOUND = True if perl.h & libperl were found
-# PERL_INCLUDE_PATH = path to where perl.h is found
-# PERL_LIBRARY = path to libperl
-# PERL_EXECUTABLE = full path to the perl binary
-#
-#
-#
-# The minimum required version of Perl can be specified using the
-# standard syntax, e.g. find_package(PerlLibs 6.0)
-#
-# ::
-#
-# The following variables are also available if needed
-# (introduced after CMake 2.6.4)
-#
-#
-#
-# ::
-#
-# PERL_SITESEARCH = path to the sitesearch install dir (-V:installsitesearch)
-# PERL_SITEARCH = path to the sitelib install directory (-V:installsitearch)
-# PERL_SITELIB = path to the sitelib install directory (-V:installsitelib)
-# PERL_VENDORARCH = path to the vendor arch install directory (-V:installvendorarch)
-# PERL_VENDORLIB = path to the vendor lib install directory (-V:installvendorlib)
-# PERL_ARCHLIB = path to the core arch lib install directory (-V:archlib)
-# PERL_PRIVLIB = path to the core priv lib install directory (-V:privlib)
-# PERL_UPDATE_ARCHLIB = path to the update arch lib install directory (-V:installarchlib)
-# PERL_UPDATE_PRIVLIB = path to the update priv lib install directory (-V:installprivlib)
-# PERL_EXTRA_C_FLAGS = Compilation flags used to build perl
+#[=======================================================================[.rst:
+FindPerlLibs
+------------
+
+Find Perl libraries
+
+This module finds if PERL is installed and determines where the
+include files and libraries are. It also determines what the name of
+the library is. This code sets the following variables:
+
+::
+
+ PERLLIBS_FOUND = True if perl.h & libperl were found
+ PERL_INCLUDE_PATH = path to where perl.h is found
+ PERL_LIBRARY = path to libperl
+ PERL_EXECUTABLE = full path to the perl binary
+
+
+
+The minimum required version of Perl can be specified using the
+standard syntax, e.g. find_package(PerlLibs 6.0)
+
+::
+
+ The following variables are also available if needed
+ (introduced after CMake 2.6.4)
+
+
+
+::
+
+ PERL_SITESEARCH = path to the sitesearch install dir (-V:installsitesearch)
+ PERL_SITEARCH = path to the sitelib install directory (-V:installsitearch)
+ PERL_SITELIB = path to the sitelib install directory (-V:installsitelib)
+ PERL_VENDORARCH = path to the vendor arch install directory (-V:installvendorarch)
+ PERL_VENDORLIB = path to the vendor lib install directory (-V:installvendorlib)
+ PERL_ARCHLIB = path to the core arch lib install directory (-V:archlib)
+ PERL_PRIVLIB = path to the core priv lib install directory (-V:privlib)
+ PERL_UPDATE_ARCHLIB = path to the update arch lib install directory (-V:installarchlib)
+ PERL_UPDATE_PRIVLIB = path to the update priv lib install directory (-V:installprivlib)
+ PERL_EXTRA_C_FLAGS = Compilation flags used to build perl
+#]=======================================================================]
# find the perl executable
include(${CMAKE_CURRENT_LIST_DIR}/FindPerl.cmake)
diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake
index cfe9b0f19..0366f77a3 100644
--- a/Modules/FindPhysFS.cmake
+++ b/Modules/FindPhysFS.cmake
@@ -1,20 +1,21 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPhysFS
-# ----------
-#
-#
-#
-# Locate PhysFS library This module defines PHYSFS_LIBRARY, the name of
-# the library to link against PHYSFS_FOUND, if false, do not try to link
-# to PHYSFS PHYSFS_INCLUDE_DIR, where to find physfs.h
-#
-# $PHYSFSDIR is an environment variable that would correspond to the
-# ./configure --prefix=$PHYSFSDIR used in building PHYSFS.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindPhysFS
+----------
+
+
+
+Locate PhysFS library This module defines PHYSFS_LIBRARY, the name of
+the library to link against PHYSFS_FOUND, if false, do not try to link
+to PHYSFS PHYSFS_INCLUDE_DIR, where to find physfs.h
+
+$PHYSFSDIR is an environment variable that would correspond to the
+./configure --prefix=$PHYSFSDIR used in building PHYSFS.
+
+Created by Eric Wing.
+#]=======================================================================]
find_path(PHYSFS_INCLUDE_DIR physfs.h
HINTS
diff --git a/Modules/FindPike.cmake b/Modules/FindPike.cmake
index ec71c949a..b78db2adb 100644
--- a/Modules/FindPike.cmake
+++ b/Modules/FindPike.cmake
@@ -1,20 +1,21 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPike
-# --------
-#
-# Find Pike
-#
-# This module finds if PIKE is installed and determines where the
-# include files and libraries are. It also determines what the name of
-# the library is. This code sets the following variables:
-#
-# ::
-#
-# PIKE_INCLUDE_PATH = path to where program.h is found
-# PIKE_EXECUTABLE = full path to the pike binary
+#[=======================================================================[.rst:
+FindPike
+--------
+
+Find Pike
+
+This module finds if PIKE is installed and determines where the
+include files and libraries are. It also determines what the name of
+the library is. This code sets the following variables:
+
+::
+
+ PIKE_INCLUDE_PATH = path to where program.h is found
+ PIKE_EXECUTABLE = full path to the pike binary
+#]=======================================================================]
find_path(PIKE_INCLUDE_PATH program.h
${PIKE_POSSIBLE_INCLUDE_PATHS}
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 06beb7d84..e19242626 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -9,12 +9,14 @@ A ``pkg-config`` module for CMake.
Finds the ``pkg-config`` executable and adds the :command:`pkg_get_variable`,
:command:`pkg_check_modules` and :command:`pkg_search_module` commands. The
-following variables will also be set::
+following variables will also be set:
- PKG_CONFIG_FOUND ... if pkg-config executable was found
- PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
- PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
- (since CMake 2.8.8)
+``PKG_CONFIG_FOUND``
+ if pkg-config executable was found
+``PKG_CONFIG_EXECUTABLE``
+ pathname of the pkg-config program
+``PKG_CONFIG_VERSION_STRING``
+ version of pkg-config (since CMake 2.8.8)
#]========================================]
@@ -86,7 +88,9 @@ endmacro()
.. command:: pkg_get_variable
Retrieves the value of a pkg-config variable ``varName`` and stores it in the
- result variable ``resultVar`` in the calling scope. ::
+ result variable ``resultVar`` in the calling scope.
+
+ .. code-block:: cmake
pkg_get_variable(<resultVar> <moduleName> <varName>)
@@ -227,6 +231,7 @@ function(_pkg_find_libs _prefix _no_cmake_path _no_cmake_environment_path)
find_library(pkgcfg_lib_${_prefix}_${_pkg_search}
NAMES ${_pkg_search}
${_find_opts})
+ mark_as_advanced(pkgcfg_lib_${_prefix}_${_pkg_search})
list(APPEND _libs "${pkgcfg_lib_${_prefix}_${_pkg_search}}")
endforeach()
@@ -512,7 +517,9 @@ endmacro()
.. command:: pkg_check_modules
Checks for all the given modules, setting a variety of result variables in
- the calling scope. ::
+ the calling scope.
+
+ .. code-block:: cmake
pkg_check_modules(<prefix>
[REQUIRED] [QUIET]
@@ -543,27 +550,36 @@ endmacro()
Each ``<moduleSpec>`` can be either a bare module name or it can be a
module name with a version constraint (operators ``=``, ``<``, ``>``,
``<=`` and ``>=`` are supported). The following are examples for a module
- named ``foo`` with various constraints::
-
- foo # Any version matches
- foo<2 # Only match versions before 2
- foo>=3.1 # Match any version from 3.1 or later
- foo=1.2.3 # Foo must be exactly version 1.2.3
-
- The following variables may be set upon return. Two sets of values exist,
- one for the common case (``<XXX> = <prefix>``) and another for the
- information ``pkg-config`` provides when it is called with the ``--static``
- option (``<XXX> = <prefix>_STATIC``)::
-
- <XXX>_FOUND ... set to 1 if module(s) exist
- <XXX>_LIBRARIES ... only the libraries (without the '-l')
- <XXX>_LINK_LIBRARIES ... the libraries and their absolute paths
- <XXX>_LIBRARY_DIRS ... the paths of the libraries (without the '-L')
- <XXX>_LDFLAGS ... all required linker flags
- <XXX>_LDFLAGS_OTHER ... all other linker flags
- <XXX>_INCLUDE_DIRS ... the '-I' preprocessor flags (without the '-I')
- <XXX>_CFLAGS ... all required cflags
- <XXX>_CFLAGS_OTHER ... the other compiler flags
+ named ``foo`` with various constraints:
+
+ - ``foo`` matches any version.
+ - ``foo<2`` only matches versions before 2.
+ - ``foo>=3.1`` matches any version from 3.1 or later.
+ - ``foo=1.2.3`` requires that foo must be exactly version 1.2.3.
+
+ The following variables may be set upon return. Two sets of values exist:
+ One for the common case (``<XXX> = <prefix>``) and another for the
+ information ``pkg-config`` provides when called with the ``--static``
+ option (``<XXX> = <prefix>_STATIC``).
+
+ ``<XXX>_FOUND``
+ set to 1 if module(s) exist
+ ``<XXX>_LIBRARIES``
+ only the libraries (without the '-l')
+ ``<XXX>_LINK_LIBRARIES``
+ the libraries and their absolute paths
+ ``<XXX>_LIBRARY_DIRS``
+ the paths of the libraries (without the '-L')
+ ``<XXX>_LDFLAGS``
+ all required linker flags
+ ``<XXX>_LDFLAGS_OTHER``
+ all other linker flags
+ ``<XXX>_INCLUDE_DIRS``
+ the '-I' preprocessor flags (without the '-I')
+ ``<XXX>_CFLAGS``
+ all required cflags
+ ``<XXX>_CFLAGS_OTHER``
+ the other compiler flags
All but ``<XXX>_FOUND`` may be a :ref:`;-list <CMake Language Lists>` if the
associated variable returned from ``pkg-config`` has multiple values.
@@ -571,14 +587,18 @@ endmacro()
There are some special variables whose prefix depends on the number of
``<moduleSpec>`` given. When there is only one ``<moduleSpec>``,
``<YYY>`` will simply be ``<prefix>``, but if two or more ``<moduleSpec>``
- items are given, ``<YYY>`` will be ``<prefix>_<moduleName>``::
+ items are given, ``<YYY>`` will be ``<prefix>_<moduleName>``.
- <YYY>_VERSION ... version of the module
- <YYY>_PREFIX ... prefix directory of the module
- <YYY>_INCLUDEDIR ... include directory of the module
- <YYY>_LIBDIR ... lib directory of the module
+ ``<YYY>_VERSION``
+ version of the module
+ ``<YYY>_PREFIX``
+ prefix directory of the module
+ ``<YYY>_INCLUDEDIR``
+ include directory of the module
+ ``<YYY>_LIBDIR``
+ lib directory of the module
- Examples
+ Examples:
.. code-block:: cmake
@@ -638,7 +658,9 @@ endmacro()
The behavior of this command is the same as :command:`pkg_check_modules`,
except that rather than checking for all the specified modules, it searches
- for just the first successful match. ::
+ for just the first successful match.
+
+ .. code-block:: cmake
pkg_search_module(<prefix>
[REQUIRED] [QUIET]
@@ -647,7 +669,7 @@ endmacro()
[IMPORTED_TARGET [GLOBAL]]
<moduleSpec> [<moduleSpec>...])
- Examples
+ Example:
.. code-block:: cmake
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index c044ab3b7..4b5e60e21 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -1,20 +1,34 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPostgreSQL
-# --------------
-#
-# Find the PostgreSQL installation.
-#
-# This module defines
-#
-# ::
-#
-# PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking
-# PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers
-# PostgreSQL_LIBRARY_DIRS - the link directories for PostgreSQL libraries
-# PostgreSQL_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8)
+#[=======================================================================[.rst:
+FindPostgreSQL
+--------------
+
+Find the PostgreSQL installation.
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``PostgreSQL::PostgreSQL``
+if PostgreSQL has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``PostgreSQL_FOUND``
+ True if PostgreSQL is found.
+``PostgreSQL_LIBRARIES``
+ the PostgreSQL libraries needed for linking
+``PostgreSQL_INCLUDE_DIRS``
+ the directories of the PostgreSQL headers
+``PostgreSQL_LIBRARY_DIRS``
+ the link directories for PostgreSQL libraries
+``PostgreSQL_VERSION_STRING``
+ the version of PostgreSQL found
+#]=======================================================================]
# ----------------------------------------------------------------------------
# History:
@@ -48,6 +62,8 @@
# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries
# PostgreSQL_LIBRARIES - The PostgreSQL libraries.
#
+# The ``PostgreSQL::PostgreSQL`` imported target is also created.
+#
# ----------------------------------------------------------------------------
# If you have installed PostgreSQL in a non-standard location.
# (Please note that in the following comments, it is assumed that <Your Path>
@@ -159,14 +175,34 @@ if (PostgreSQL_INCLUDE_DIR)
foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS})
if(EXISTS "${_PG_CONFIG_HEADER}")
file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str
- REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
+ REGEX "^#define[\t ]+PG_VERSION_NUM[\t ]+.*")
if(pgsql_version_str)
- string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*"
- "\\1" PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+ string(REGEX REPLACE "^#define[\t ]+PG_VERSION_NUM[\t ]+([0-9]*).*"
+ "\\1" _PostgreSQL_VERSION_NUM "${pgsql_version_str}")
break()
endif()
endif()
endforeach()
+ if (_PostgreSQL_VERSION_NUM)
+ math(EXPR _PostgreSQL_major_version "${_PostgreSQL_VERSION_NUM} / 10000")
+ math(EXPR _PostgreSQL_minor_version "${_PostgreSQL_VERSION_NUM} % 10000")
+ set(PostgreSQL_VERSION_STRING "${_PostgreSQL_major_version}.${_PostgreSQL_minor_version}")
+ unset(_PostgreSQL_major_version)
+ unset(_PostgreSQL_minor_version)
+ else ()
+ foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS})
+ if(EXISTS "${_PG_CONFIG_HEADER}")
+ file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str
+ REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
+ if(pgsql_version_str)
+ string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*"
+ "\\1" PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+ break()
+ endif()
+ endif()
+ endforeach()
+ endif ()
+ unset(_PostgreSQL_VERSION_NUM)
unset(pgsql_version_str)
endif()
@@ -179,6 +215,12 @@ set(PostgreSQL_FOUND ${POSTGRESQL_FOUND})
# Now try to get the include and library path.
if(PostgreSQL_FOUND)
+ if (NOT TARGET PostgreSQL::PostgreSQL)
+ add_library(PostgreSQL::PostgreSQL UNKNOWN IMPORTED)
+ set_target_properties(PostgreSQL::PostgreSQL PROPERTIES
+ IMPORTED_LOCATION "${PostgreSQL_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PostgreSQL_INCLUDE_DIR};${PostgreSQL_TYPE_INCLUDE_DIR}")
+ endif ()
set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} )
set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} )
set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY})
diff --git a/Modules/FindProducer.cmake b/Modules/FindProducer.cmake
index 500c8edf6..fba0494e3 100644
--- a/Modules/FindProducer.cmake
+++ b/Modules/FindProducer.cmake
@@ -1,35 +1,36 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindProducer
-# ------------
-#
-#
-#
-# Though Producer isn't directly part of OpenSceneGraph, its primary
-# user is OSG so I consider this part of the Findosg* suite used to find
-# OpenSceneGraph components. You'll notice that I accept OSGDIR as an
-# environment path.
-#
-# Each component is separate and you must opt in to each module. You
-# must also opt into OpenGL (and OpenThreads?) as these modules won't do
-# it for you. This is to allow you control over your own system piece
-# by piece in case you need to opt out of certain components or change
-# the Find behavior for a particular module (perhaps because the default
-# FindOpenGL.cmake module doesn't work with your system as an example).
-# If you want to use a more convenient module that includes everything,
-# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake
-# modules.
-#
-# Locate Producer This module defines PRODUCER_LIBRARY PRODUCER_FOUND,
-# if false, do not try to link to Producer PRODUCER_INCLUDE_DIR, where
-# to find the headers
-#
-# $PRODUCER_DIR is an environment variable that would correspond to the
-# ./configure --prefix=$PRODUCER_DIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindProducer
+------------
+
+
+
+Though Producer isn't directly part of OpenSceneGraph, its primary
+user is OSG so I consider this part of the Findosg* suite used to find
+OpenSceneGraph components. You'll notice that I accept OSGDIR as an
+environment path.
+
+Each component is separate and you must opt in to each module. You
+must also opt into OpenGL (and OpenThreads?) as these modules won't do
+it for you. This is to allow you control over your own system piece
+by piece in case you need to opt out of certain components or change
+the Find behavior for a particular module (perhaps because the default
+FindOpenGL.cmake module doesn't work with your system as an example).
+If you want to use a more convenient module that includes everything,
+use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake
+modules.
+
+Locate Producer This module defines PRODUCER_LIBRARY PRODUCER_FOUND,
+if false, do not try to link to Producer PRODUCER_INCLUDE_DIR, where
+to find the headers
+
+$PRODUCER_DIR is an environment variable that would correspond to the
+./configure --prefix=$PRODUCER_DIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <Producer/CameraGroup>
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index eda036158..1758fb355 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -1,127 +1,126 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindProtobuf
-# ------------
-#
-# Locate and configure the Google Protocol Buffers library.
-#
-# The following variables can be set and are optional:
-#
-# ``Protobuf_SRC_ROOT_FOLDER``
-# When compiling with MSVC, if this cache variable is set
-# the protobuf-default VS project build locations
-# (vsprojects/Debug and vsprojects/Release
-# or vsprojects/x64/Debug and vsprojects/x64/Release)
-# will be searched for libraries and binaries.
-# ``Protobuf_IMPORT_DIRS``
-# List of additional directories to be searched for
-# imported .proto files.
-# ``Protobuf_DEBUG``
-# Show debug messages.
-# ``Protobuf_USE_STATIC_LIBS``
-# Set to ON to force the use of the static libraries.
-# Default is OFF.
-#
-# Defines the following variables:
-#
-# ``Protobuf_FOUND``
-# Found the Google Protocol Buffers library
-# (libprotobuf & header files)
-# ``Protobuf_VERSION``
-# Version of package found.
-# ``Protobuf_INCLUDE_DIRS``
-# Include directories for Google Protocol Buffers
-# ``Protobuf_LIBRARIES``
-# The protobuf libraries
-# ``Protobuf_PROTOC_LIBRARIES``
-# The protoc libraries
-# ``Protobuf_LITE_LIBRARIES``
-# The protobuf-lite libraries
-#
-# The following :prop_tgt:`IMPORTED` targets are also defined:
-#
-# ``protobuf::libprotobuf``
-# The protobuf library.
-# ``protobuf::libprotobuf-lite``
-# The protobuf lite library.
-# ``protobuf::libprotoc``
-# The protoc library.
-# ``protobuf::protoc``
-# The protoc compiler.
-#
-# The following cache variables are also available to set or use:
-#
-# ``Protobuf_LIBRARY``
-# The protobuf library
-# ``Protobuf_PROTOC_LIBRARY``
-# The protoc library
-# ``Protobuf_INCLUDE_DIR``
-# The include directory for protocol buffers
-# ``Protobuf_PROTOC_EXECUTABLE``
-# The protoc compiler
-# ``Protobuf_LIBRARY_DEBUG``
-# The protobuf library (debug)
-# ``Protobuf_PROTOC_LIBRARY_DEBUG``
-# The protoc library (debug)
-# ``Protobuf_LITE_LIBRARY``
-# The protobuf lite library
-# ``Protobuf_LITE_LIBRARY_DEBUG``
-# The protobuf lite library (debug)
-#
-# Example:
-#
-# .. code-block:: cmake
-#
-# find_package(Protobuf REQUIRED)
-# include_directories(${Protobuf_INCLUDE_DIRS})
-# include_directories(${CMAKE_CURRENT_BINARY_DIR})
-# protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS foo.proto)
-# protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS EXPORT_MACRO DLL_EXPORT foo.proto)
-# protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS DESCRIPTORS PROTO_DESCS foo.proto)
-# protobuf_generate_python(PROTO_PY foo.proto)
-# add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS})
-# target_link_libraries(bar ${Protobuf_LIBRARIES})
-#
-# .. note::
-# The ``protobuf_generate_cpp`` and ``protobuf_generate_python``
-# functions and :command:`add_executable` or :command:`add_library`
-# calls only work properly within the same directory.
-#
-# .. command:: protobuf_generate_cpp
-#
-# Add custom commands to process ``.proto`` files to C++::
-#
-# protobuf_generate_cpp (<SRCS> <HDRS>
-# [DESCRIPTORS <DESC>] [EXPORT_MACRO <MACRO>] [<ARGN>...])
-#
-# ``SRCS``
-# Variable to define with autogenerated source files
-# ``HDRS``
-# Variable to define with autogenerated header files
-# ``DESCRIPTORS``
-# 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.
-# ``ARGN``
-# ``.proto`` files
-#
-# .. command:: protobuf_generate_python
-#
-# Add custom commands to process ``.proto`` files to Python::
-#
-# protobuf_generate_python (<PY> [<ARGN>...])
-#
-# ``PY``
-# Variable to define with autogenerated Python files
-# ``ARGN``
-# ``.proto`` filess
+#[=======================================================================[.rst:
+FindProtobuf
+------------
+
+Locate and configure the Google Protocol Buffers library.
+
+The following variables can be set and are optional:
+
+``Protobuf_SRC_ROOT_FOLDER``
+ When compiling with MSVC, if this cache variable is set
+ the protobuf-default VS project build locations
+ (vsprojects/Debug and vsprojects/Release
+ or vsprojects/x64/Debug and vsprojects/x64/Release)
+ will be searched for libraries and binaries.
+``Protobuf_IMPORT_DIRS``
+ List of additional directories to be searched for
+ imported .proto files.
+``Protobuf_DEBUG``
+ Show debug messages.
+``Protobuf_USE_STATIC_LIBS``
+ Set to ON to force the use of the static libraries.
+ Default is OFF.
+
+Defines the following variables:
+
+``Protobuf_FOUND``
+ Found the Google Protocol Buffers library
+ (libprotobuf & header files)
+``Protobuf_VERSION``
+ Version of package found.
+``Protobuf_INCLUDE_DIRS``
+ Include directories for Google Protocol Buffers
+``Protobuf_LIBRARIES``
+ The protobuf libraries
+``Protobuf_PROTOC_LIBRARIES``
+ The protoc libraries
+``Protobuf_LITE_LIBRARIES``
+ The protobuf-lite libraries
+
+The following :prop_tgt:`IMPORTED` targets are also defined:
+
+``protobuf::libprotobuf``
+ The protobuf library.
+``protobuf::libprotobuf-lite``
+ The protobuf lite library.
+``protobuf::libprotoc``
+ The protoc library.
+``protobuf::protoc``
+ The protoc compiler.
+
+The following cache variables are also available to set or use:
+
+``Protobuf_LIBRARY``
+ The protobuf library
+``Protobuf_PROTOC_LIBRARY``
+ The protoc library
+``Protobuf_INCLUDE_DIR``
+ The include directory for protocol buffers
+``Protobuf_PROTOC_EXECUTABLE``
+ The protoc compiler
+``Protobuf_LIBRARY_DEBUG``
+ The protobuf library (debug)
+``Protobuf_PROTOC_LIBRARY_DEBUG``
+ The protoc library (debug)
+``Protobuf_LITE_LIBRARY``
+ The protobuf lite library
+``Protobuf_LITE_LIBRARY_DEBUG``
+ The protobuf lite library (debug)
+
+Example:
+
+.. code-block:: cmake
+
+ find_package(Protobuf REQUIRED)
+ include_directories(${Protobuf_INCLUDE_DIRS})
+ include_directories(${CMAKE_CURRENT_BINARY_DIR})
+ protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS foo.proto)
+ protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS EXPORT_MACRO DLL_EXPORT foo.proto)
+ protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS DESCRIPTORS PROTO_DESCS foo.proto)
+ protobuf_generate_python(PROTO_PY foo.proto)
+ add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS})
+ target_link_libraries(bar ${Protobuf_LIBRARIES})
+
+.. note::
+ The ``protobuf_generate_cpp`` and ``protobuf_generate_python``
+ functions and :command:`add_executable` or :command:`add_library`
+ calls only work properly within the same directory.
+
+.. command:: protobuf_generate_cpp
+
+ Add custom commands to process ``.proto`` files to C++::
+
+ protobuf_generate_cpp (<SRCS> <HDRS>
+ [DESCRIPTORS <DESC>] [EXPORT_MACRO <MACRO>] [<ARGN>...])
+
+ ``SRCS``
+ Variable to define with autogenerated source files
+ ``HDRS``
+ Variable to define with autogenerated header files
+ ``DESCRIPTORS``
+ 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.
+ ``ARGN``
+ ``.proto`` files
+
+.. command:: protobuf_generate_python
+
+ Add custom commands to process ``.proto`` files to Python::
+
+ protobuf_generate_python (<PY> [<ARGN>...])
+
+ ``PY``
+ Variable to define with autogenerated Python files
+ ``ARGN``
+ ``.proto`` filess
+#]=======================================================================]
function(protobuf_generate)
- include(CMakeParseArguments)
-
set(_options APPEND_PATH DESCRIPTORS)
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR)
if(COMMAND target_sources)
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index 8645a0db5..1c134e278 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -14,11 +14,12 @@ Three components are supported:
* ``Compiler``: search for Python compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
libraries).
+* ``NumPy``: search for NumPy include directories.
If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed.
-To ensure consistent versions between components ``Interpreter``, ``Compiler``
-and ``Development``, specify all components at the same time::
+To ensure consistent versions between components ``Interpreter``, ``Compiler``,
+``Development`` and ``NumPy``, specify all components at the same time::
find_package (Python COMPONENTS Interpreter Development)
@@ -27,10 +28,18 @@ is searched.
To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and
:module:`FindPython2` modules rather than this one.
+.. note::
+
+ If components ``Interpreter`` and ``Development`` are both specified, this
+ module search only for interpreter with same platform architecture as the one
+ defined by ``CMake`` configuration. This contraint does not apply if only
+ ``Interpreter`` component is specified.
+
Imported Targets
^^^^^^^^^^^^^^^^
-This module defines the following :ref:`Imported Targets <Imported Targets>`:
+This module defines the following :ref:`Imported Targets <Imported Targets>`
+(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
``Python::Interpreter``
Python interpreter. Target defined if component ``Interpreter`` is found.
@@ -38,6 +47,8 @@ This module defines the following :ref:`Imported Targets <Imported Targets>`:
Python compiler. Target defined if component ``Compiler`` is found.
``Python::Python``
Python library. Target defined if component ``Development`` is found.
+``Python::NumPy``
+ NumPy Python library. Target defined if component ``NumPy`` is found.
Result Variables
^^^^^^^^^^^^^^^^
@@ -103,6 +114,12 @@ This module will set the following variables in your project
Python minor version.
``Python_VERSION_PATCH``
Python patch version.
+``Python_NumPy_FOUND``
+ System has the NumPy.
+``Python_NumPy_INCLUDE_DIRS``
+ The NumPy include directries.
+``Python_NumPy_VERSION``
+ The NumPy version.
Hints
^^^^^
@@ -144,9 +161,10 @@ Hints
Commands
^^^^^^^^
-This module defines the command ``Python_add_library`` which have the same
-semantic as :command:`add_library` but take care of Python module naming rules
-(only applied if library is of type ``MODULE``) and add dependency to target
+This module defines the command ``Python_add_library`` (when
+:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as
+:command:`add_library`, but takes care of Python module naming rules
+(only applied if library is of type ``MODULE``), and adds a dependency to target
``Python::Python``::
Python_add_library (my_module MODULE src1.cpp)
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index e0ebb9033..1236bf8f8 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -24,6 +24,8 @@ else()
message (FATAL_ERROR "FindPython: INTERNAL ERROR")
endif()
+get_property(_${_PYTHON_PREFIX}_CMAKE_ROLE GLOBAL PROPERTY CMAKE_ROLE)
+
#
# helper commands
@@ -207,6 +209,10 @@ if (NOT ${_PYTHON_PREFIX}_FIND_COMPONENTS)
set (${_PYTHON_PREFIX}_FIND_COMPONENTS Interpreter)
set (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter TRUE)
endif()
+if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+ list (APPEND ${_PYTHON_PREFIX}_FIND_COMPONENTS "Interpreter" "Development")
+ list (REMOVE_DUPLICATES ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+endif()
foreach (_${_PYTHON_PREFIX}_COMPONENT IN LISTS ${_PYTHON_PREFIX}_FIND_COMPONENTS)
set (${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_COMPONENT}_FOUND FALSE)
endforeach()
@@ -335,14 +341,14 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_HINTS}
- PATHS [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
+ PATHS [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
@@ -396,14 +402,14 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
python
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
NAMES_PER_DIR
- PATHS [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
+ PATHS [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
@@ -810,14 +816,14 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
_python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_VERSION})
set (_${_PYTHON_PREFIX}_REGISTRY_PATHS
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath])
@@ -1120,6 +1126,40 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
endif()
endif()
+if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Interpreter_FOUND)
+ if (${_PYTHON_PREFIX}_FIND_REQUIRED_NumPy)
+ list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
+ list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
+ endif()
+ execute_process(
+ COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n"
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_PATH
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (NOT _${_PYTHON_PREFIX}_RESULT)
+ find_path(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR
+ NAMES "numpy/arrayobject.h" "numpy/numpyconfig.h"
+ HINTS "${_${_PYTHON_PREFIX}_NumPy_PATH}"
+ NO_DEFAULT_PATH)
+ endif()
+ if(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
+ set(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIRS "${${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}")
+ set(${_PYTHON_PREFIX}_NumPy_FOUND TRUE)
+ endif()
+ if(${_PYTHON_PREFIX}_NumPy_FOUND)
+ execute_process(
+ COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n"
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_VERSION)
+ if (NOT _${_PYTHON_PREFIX}_RESULT)
+ set(${_PYTHON_PREFIX}_NumPy_VERSION "${_${_PYTHON_PREFIX}_NumPy_VERSION}")
+ endif()
+ endif()
+endif()
+
# final validation
if (${_PYTHON_PREFIX}_VERSION_MAJOR AND
NOT ${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
@@ -1133,118 +1173,128 @@ find_package_handle_standard_args (${_PYTHON_PREFIX}
HANDLE_COMPONENTS)
# Create imported targets and helper functions
-if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- AND ${_PYTHON_PREFIX}_Interpreter_FOUND
- AND NOT TARGET ${_PYTHON_PREFIX}::Interpreter)
- add_executable (${_PYTHON_PREFIX}::Interpreter IMPORTED)
- set_property (TARGET ${_PYTHON_PREFIX}::Interpreter
- PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_EXECUTABLE}")
-endif()
-
-if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- AND ${_PYTHON_PREFIX}_Compiler_FOUND
- AND NOT TARGET ${_PYTHON_PREFIX}::Compiler)
- add_executable (${_PYTHON_PREFIX}::Compiler IMPORTED)
- set_property (TARGET ${_PYTHON_PREFIX}::Compiler
- PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_COMPILER}")
-endif()
-
-if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- AND ${_PYTHON_PREFIX}_Development_FOUND AND NOT TARGET ${_PYTHON_PREFIX}::Python)
+if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
+ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ AND ${_PYTHON_PREFIX}_Interpreter_FOUND
+ AND NOT TARGET ${_PYTHON_PREFIX}::Interpreter)
+ add_executable (${_PYTHON_PREFIX}::Interpreter IMPORTED)
+ set_property (TARGET ${_PYTHON_PREFIX}::Interpreter
+ PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_EXECUTABLE}")
+ endif()
- if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$"
- OR ${_PYTHON_PREFIX}_LIBRARY_DEBUG MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$"
- OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
- set (_${_PYTHON_PREFIX}_LIBRARY_TYPE SHARED)
- else()
- set (_${_PYTHON_PREFIX}_LIBRARY_TYPE STATIC)
+ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ AND ${_PYTHON_PREFIX}_Compiler_FOUND
+ AND NOT TARGET ${_PYTHON_PREFIX}::Compiler)
+ add_executable (${_PYTHON_PREFIX}::Compiler IMPORTED)
+ set_property (TARGET ${_PYTHON_PREFIX}::Compiler
+ PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_COMPILER}")
endif()
- add_library (${_PYTHON_PREFIX}::Python ${_${_PYTHON_PREFIX}_LIBRARY_TYPE} IMPORTED)
-
- set_property (TARGET ${_PYTHON_PREFIX}::Python
- PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_INCLUDE_DIR}")
-
- if ((${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE)
- OR (${_PYTHON_PREFIX}_LIBRARY_DEBUG AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG))
- # System manage shared libraries in two parts: import and runtime
- if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG)
- set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
- IMPORTED_IMPLIB_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}"
- IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}")
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
- IMPORTED_IMPLIB_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}"
- IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}")
+ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ AND ${_PYTHON_PREFIX}_Development_FOUND AND NOT TARGET ${_PYTHON_PREFIX}::Python)
+
+ if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$"
+ OR ${_PYTHON_PREFIX}_LIBRARY_DEBUG MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$"
+ OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
+ set (_${_PYTHON_PREFIX}_LIBRARY_TYPE SHARED)
else()
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
- IMPORTED_IMPLIB "${${_PYTHON_PREFIX}_LIBRARY}"
- IMPORTED_LOCATION "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY}")
+ set (_${_PYTHON_PREFIX}_LIBRARY_TYPE STATIC)
endif()
- else()
- if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG)
- set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
- IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
- IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}")
+
+ add_library (${_PYTHON_PREFIX}::Python ${_${_PYTHON_PREFIX}_LIBRARY_TYPE} IMPORTED)
+
+ set_property (TARGET ${_PYTHON_PREFIX}::Python
+ PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_INCLUDE_DIR}")
+
+ if ((${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE)
+ OR (${_PYTHON_PREFIX}_LIBRARY_DEBUG AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG))
+ # System manage shared libraries in two parts: import and runtime
+ if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG)
+ set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
+ IMPORTED_IMPLIB_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}"
+ IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}")
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_IMPLIB_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}"
+ IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}")
+ else()
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_IMPLIB "${${_PYTHON_PREFIX}_LIBRARY}"
+ IMPORTED_LOCATION "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY}")
+ endif()
else()
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
- IMPORTED_LOCATION "${${_PYTHON_PREFIX}_LIBRARY}")
+ if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG)
+ set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
+ IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}")
+ else()
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${${_PYTHON_PREFIX}_LIBRARY}")
+ endif()
endif()
- endif()
- if (_${_PYTHON_PREFIX}_CONFIG AND _${_PYTHON_PREFIX}_LIBRARY_TYPE STREQUAL "STATIC")
- # extend link information with dependent libraries
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --ldflags
- RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
- OUTPUT_VARIABLE _${_PYTHON_PREFIX}_FLAGS
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (NOT _${_PYTHON_PREFIX}_RESULT)
- string (REGEX MATCHALL "-[Ll][^ ]+" _${_PYTHON_PREFIX}_LINK_LIBRARIES "${_${_PYTHON_PREFIX}_FLAGS}")
- # remove elements relative to python library itself
- list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-lpython")
- foreach (_${_PYTHON_PREFIX}_DIR IN LISTS ${_PYTHON_PREFIX}_LIBRARY_DIRS)
- list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-L${${_PYTHON_PREFIX}_DIR}")
- endforeach()
- set_property (TARGET ${_PYTHON_PREFIX}::Python
- PROPERTY INTERFACE_LINK_LIBRARIES ${_${_PYTHON_PREFIX}_LINK_LIBRARIES})
+ if (_${_PYTHON_PREFIX}_CONFIG AND _${_PYTHON_PREFIX}_LIBRARY_TYPE STREQUAL "STATIC")
+ # extend link information with dependent libraries
+ execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --ldflags
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_FLAGS
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (NOT _${_PYTHON_PREFIX}_RESULT)
+ string (REGEX MATCHALL "-[Ll][^ ]+" _${_PYTHON_PREFIX}_LINK_LIBRARIES "${_${_PYTHON_PREFIX}_FLAGS}")
+ # remove elements relative to python library itself
+ list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-lpython")
+ foreach (_${_PYTHON_PREFIX}_DIR IN LISTS ${_PYTHON_PREFIX}_LIBRARY_DIRS)
+ list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-L${${_PYTHON_PREFIX}_DIR}")
+ endforeach()
+ set_property (TARGET ${_PYTHON_PREFIX}::Python
+ PROPERTY INTERFACE_LINK_LIBRARIES ${_${_PYTHON_PREFIX}_LINK_LIBRARIES})
+ endif()
endif()
- endif()
- #
- # PYTHON_ADD_LIBRARY (<name> [STATIC|SHARED|MODULE] src1 src2 ... srcN)
- # It is used to build modules for python.
- #
- function (__${_PYTHON_PREFIX}_ADD_LIBRARY prefix name)
- cmake_parse_arguments (PARSE_ARGV 2 PYTHON_ADD_LIBRARY
- "STATIC;SHARED;MODULE" "" "")
-
- unset (type)
- if (NOT (PYTHON_ADD_LIBRARY_STATIC
- OR PYTHON_ADD_LIBRARY_SHARED
- OR PYTHON_ADD_LIBRARY_MODULE))
- set (type MODULE)
- endif()
- add_library (${name} ${type} ${ARGN})
- target_link_libraries (${name} PRIVATE ${prefix}::Python)
-
- # customize library name to follow module name rules
- get_property (type TARGET ${name} PROPERTY TYPE)
- if (type STREQUAL "MODULE_LIBRARY")
- set_property (TARGET ${name} PROPERTY PREFIX "")
- if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
- set_property (TARGET ${name} PROPERTY SUFFIX ".pyd")
+ #
+ # PYTHON_ADD_LIBRARY (<name> [STATIC|SHARED|MODULE] src1 src2 ... srcN)
+ # It is used to build modules for python.
+ #
+ function (__${_PYTHON_PREFIX}_ADD_LIBRARY prefix name)
+ cmake_parse_arguments (PARSE_ARGV 2 PYTHON_ADD_LIBRARY
+ "STATIC;SHARED;MODULE" "" "")
+
+ unset (type)
+ if (NOT (PYTHON_ADD_LIBRARY_STATIC
+ OR PYTHON_ADD_LIBRARY_SHARED
+ OR PYTHON_ADD_LIBRARY_MODULE))
+ set (type MODULE)
endif()
- endif()
- endfunction()
+ add_library (${name} ${type} ${ARGN})
+ target_link_libraries (${name} PRIVATE ${prefix}::Python)
+
+ # customize library name to follow module name rules
+ get_property (type TARGET ${name} PROPERTY TYPE)
+ if (type STREQUAL "MODULE_LIBRARY")
+ set_property (TARGET ${name} PROPERTY PREFIX "")
+ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ set_property (TARGET ${name} PROPERTY SUFFIX ".pyd")
+ endif()
+ endif()
+ endfunction()
+ endif()
+
+ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_NumPy_FOUND
+ AND NOT TARGET ${_PYTHON_PREFIX}::NumPy AND TARGET ${_PYTHON_PREFIX}::Python)
+ add_library (${_PYTHON_PREFIX}::NumPy INTERFACE IMPORTED)
+ set_property (TARGET ${_PYTHON_PREFIX}::NumPy
+ PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}")
+ target_link_libraries (${_PYTHON_PREFIX}::NumPy INTERFACE ${_PYTHON_PREFIX}::Python)
+ endif()
endif()
# final clean-up
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index 998e99223..b9c0b6b73 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -14,11 +14,12 @@ Three components are supported:
* ``Compiler``: search for Python 2 compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
libraries)
+* ``NumPy``: search for NumPy include directories.
If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed.
-To ensure consistent versions between components ``Interpreter``, ``Compiler``
-and ``Development``, specify all components at the same time::
+To ensure consistent versions between components ``Interpreter``, ``Compiler``,
+``Development`` and ``NumPy``, specify all components at the same time::
find_package (Python2 COMPONENTS Interpreter Development)
@@ -28,10 +29,18 @@ concurrently with :module:`FindPython3` module to use both Python versions.
The :module:`FindPython` module can be used if Python version does not matter
for you.
+.. note::
+
+ If components ``Interpreter`` and ``Development`` are both specified, this
+ module search only for interpreter with same platform architecture as the one
+ defined by ``CMake`` configuration. This contraint does not apply if only
+ ``Interpreter`` component is specified.
+
Imported Targets
^^^^^^^^^^^^^^^^
-This module defines the following :ref:`Imported Targets <Imported Targets>`:
+This module defines the following :ref:`Imported Targets <Imported Targets>`
+(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
``Python2::Interpreter``
Python 2 interpreter. Target defined if component ``Interpreter`` is found.
@@ -39,6 +48,8 @@ This module defines the following :ref:`Imported Targets <Imported Targets>`:
Python 2 compiler. Target defined if component ``Compiler`` is found.
``Python2::Python``
Python 2 library. Target defined if component ``Development`` is found.
+``Python2::NumPy``
+ NumPy library for Python 2. Target defined if component ``NumPy`` is found.
Result Variables
^^^^^^^^^^^^^^^^
@@ -104,6 +115,12 @@ This module will set the following variables in your project
Python 2 minor version.
``Python2_VERSION_PATCH``
Python 2 patch version.
+``Python2_NumPy_FOUND``
+ System has the NumPy.
+``Python2_NumPy_INCLUDE_DIRS``
+ The NumPy include directries.
+``Python2_NumPy_VERSION``
+ The NumPy version.
Hints
^^^^^
@@ -145,9 +162,10 @@ Hints
Commands
^^^^^^^^
-This module defines the command ``Python2_add_library`` which have the same
-semantic as :command:`add_library` but take care of Python module naming rules
-(only applied if library is of type ``MODULE``) and add dependency to target
+This module defines the command ``Python2_add_library`` (when
+:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as
+:command:`add_library`, but takes care of Python module naming rules
+(only applied if library is of type ``MODULE``), and adds a dependency to target
``Python2::Python``::
Python2_add_library (my_module MODULE src1.cpp)
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index 2176f3f4f..c2f338469 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -14,11 +14,12 @@ Three components are supported:
* ``Compiler``: search for Python 3 compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
libraries)
+* ``NumPy``: search for NumPy include directories.
If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed.
-To ensure consistent versions between components ``Interpreter``, ``Compiler``
-and ``Development``, specify all components at the same time::
+To ensure consistent versions between components ``Interpreter``, ``Compiler``,
+``Development`` and ``NumPy``, specify all components at the same time::
find_package (Python3 COMPONENTS Interpreter Development)
@@ -28,10 +29,18 @@ concurrently with :module:`FindPython2` module to use both Python versions.
The :module:`FindPython` module can be used if Python version does not matter
for you.
+.. note::
+
+ If components ``Interpreter`` and ``Development`` are both specified, this
+ module search only for interpreter with same platform architecture as the one
+ defined by ``CMake`` configuration. This contraint does not apply if only
+ ``Interpreter`` component is specified.
+
Imported Targets
^^^^^^^^^^^^^^^^
-This module defines the following :ref:`Imported Targets <Imported Targets>`:
+This module defines the following :ref:`Imported Targets <Imported Targets>`
+(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
``Python3::Interpreter``
Python 3 interpreter. Target defined if component ``Interpreter`` is found.
@@ -39,6 +48,8 @@ This module defines the following :ref:`Imported Targets <Imported Targets>`:
Python 3 compiler. Target defined if component ``Compiler`` is found.
``Python3::Python``
Python 3 library. Target defined if component ``Development`` is found.
+``Python3::NumPy``
+ NumPy library for Python 3. Target defined if component ``NumPy`` is found.
Result Variables
^^^^^^^^^^^^^^^^
@@ -104,6 +115,12 @@ This module will set the following variables in your project
Python 3 minor version.
``Python3_VERSION_PATCH``
Python 3 patch version.
+``Python3_NumPy_FOUND``
+ System has the NumPy.
+``Python3_NumPy_INCLUDE_DIRS``
+ The NumPy include directries.
+``Python3_NumPy_VERSION``
+ The NumPy version.
Hints
^^^^^
@@ -145,9 +162,10 @@ Hints
Commands
^^^^^^^^
-This module defines the command ``Python3_add_library`` which have the same
-semantic as :command:`add_library` but take care of Python module naming rules
-(only applied if library is of type ``MODULE``) and add dependency to target
+This module defines the command ``Python3_add_library`` (when
+:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as
+:command:`add_library`, but takes care of Python module naming rules
+(only applied if library is of type ``MODULE``), and adds a dependency to target
``Python3::Python``::
Python3_add_library (my_module MODULE src1.cpp)
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 370e5e422..da33301af 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -1,44 +1,45 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPythonInterp
-# ----------------
-#
-# Find python interpreter
-#
-# .. deprecated:: 3.12
-#
-# Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead.
-#
-# This module finds if Python interpreter is installed and determines
-# where the executables are. This code sets the following variables:
-#
-# ::
-#
-# PYTHONINTERP_FOUND - Was the Python executable found
-# PYTHON_EXECUTABLE - path to the Python interpreter
-#
-#
-#
-# ::
-#
-# PYTHON_VERSION_STRING - Python version found e.g. 2.5.2
-# PYTHON_VERSION_MAJOR - Python major version found e.g. 2
-# PYTHON_VERSION_MINOR - Python minor version found e.g. 5
-# PYTHON_VERSION_PATCH - Python patch version found e.g. 2
-#
-#
-#
-# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list
-# of version numbers that should be taken into account when searching
-# for Python. You need to set this variable before calling
-# find_package(PythonInterp).
-#
-# If calling both ``find_package(PythonInterp)`` and
-# ``find_package(PythonLibs)``, call ``find_package(PythonInterp)`` first to
-# get the currently active Python version by default with a consistent version
-# of PYTHON_LIBRARIES.
+#[=======================================================================[.rst:
+FindPythonInterp
+----------------
+
+.. deprecated:: 3.12
+
+ Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead.
+
+Find python interpreter
+
+This module finds if Python interpreter is installed and determines
+where the executables are. This code sets the following variables:
+
+::
+
+ PYTHONINTERP_FOUND - Was the Python executable found
+ PYTHON_EXECUTABLE - path to the Python interpreter
+
+
+
+::
+
+ PYTHON_VERSION_STRING - Python version found e.g. 2.5.2
+ PYTHON_VERSION_MAJOR - Python major version found e.g. 2
+ PYTHON_VERSION_MINOR - Python minor version found e.g. 5
+ PYTHON_VERSION_PATCH - Python patch version found e.g. 2
+
+
+
+The Python_ADDITIONAL_VERSIONS variable can be used to specify a list
+of version numbers that should be taken into account when searching
+for Python. You need to set this variable before calling
+find_package(PythonInterp).
+
+If calling both ``find_package(PythonInterp)`` and
+``find_package(PythonLibs)``, call ``find_package(PythonInterp)`` first to
+get the currently active Python version by default with a consistent version
+of PYTHON_LIBRARIES.
+#]=======================================================================]
unset(_Python_NAMES)
@@ -129,7 +130,9 @@ if(PYTHON_EXECUTABLE)
endif()
else()
# sys.version predates sys.version_info, so use that
- execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)"
+ # sys.version was first documented for Python 1.5, so assume version 1.4
+ # if retrieving sys.version fails.
+ execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "try: import sys; sys.stdout.write(sys.version)\nexcept: sys.stdout.write(\"1.4.0\")"
OUTPUT_VARIABLE _VERSION
RESULT_VARIABLE _PYTHON_VERSION_RESULT
ERROR_QUIET)
@@ -143,12 +146,10 @@ if(PYTHON_EXECUTABLE)
set(PYTHON_VERSION_PATCH "0")
endif()
else()
- # sys.version was first documented for Python 1.5, so assume
- # this is older.
- set(PYTHON_VERSION_STRING "1.4")
- set(PYTHON_VERSION_MAJOR "1")
- set(PYTHON_VERSION_MINOR "4")
- set(PYTHON_VERSION_PATCH "0")
+ unset(PYTHON_VERSION_STRING)
+ unset(PYTHON_VERSION_MAJOR)
+ unset(PYTHON_VERSION_MINOR)
+ unset(PYTHON_VERSION_PATCH)
endif()
endif()
unset(_PYTHON_VERSION_RESULT)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 6da87a88f..1d62ac43e 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -1,48 +1,49 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindPythonLibs
-# --------------
-#
-# Find python libraries
-#
-# .. deprecated:: 3.12
-#
-# Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead.
-#
-# This module finds if Python is installed and determines where the
-# include files and libraries are. It also determines what the name of
-# the library is. This code sets the following variables:
-#
-# ::
-#
-# PYTHONLIBS_FOUND - have the Python libs been found
-# PYTHON_LIBRARIES - path to the python library
-# PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated)
-# PYTHON_INCLUDE_DIRS - path to where Python.h is found
-# PYTHON_DEBUG_LIBRARIES - path to the debug library (deprecated)
-# PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8)
-#
-#
-#
-# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list
-# of version numbers that should be taken into account when searching
-# for Python. You need to set this variable before calling
-# find_package(PythonLibs).
-#
-# If you'd like to specify the installation of Python to use, you should
-# modify the following cache variables:
-#
-# ::
-#
-# PYTHON_LIBRARY - path to the python library
-# PYTHON_INCLUDE_DIR - path to where Python.h is found
-#
-# If calling both ``find_package(PythonInterp)`` and
-# ``find_package(PythonLibs)``, call ``find_package(PythonInterp)`` first to
-# get the currently active Python version by default with a consistent version
-# of PYTHON_LIBRARIES.
+#[=======================================================================[.rst:
+FindPythonLibs
+--------------
+
+.. deprecated:: 3.12
+
+ Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead.
+
+Find python libraries
+
+This module finds if Python is installed and determines where the
+include files and libraries are. It also determines what the name of
+the library is. This code sets the following variables:
+
+::
+
+ PYTHONLIBS_FOUND - have the Python libs been found
+ PYTHON_LIBRARIES - path to the python library
+ PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated)
+ PYTHON_INCLUDE_DIRS - path to where Python.h is found
+ PYTHON_DEBUG_LIBRARIES - path to the debug library (deprecated)
+ PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8)
+
+
+
+The Python_ADDITIONAL_VERSIONS variable can be used to specify a list
+of version numbers that should be taken into account when searching
+for Python. You need to set this variable before calling
+find_package(PythonLibs).
+
+If you'd like to specify the installation of Python to use, you should
+modify the following cache variables:
+
+::
+
+ PYTHON_LIBRARY - path to the python library
+ PYTHON_INCLUDE_DIR - path to where Python.h is found
+
+If calling both ``find_package(PythonInterp)`` and
+``find_package(PythonLibs)``, call ``find_package(PythonInterp)`` first to
+get the currently active Python version by default with a consistent version
+of PYTHON_LIBRARIES.
+#]=======================================================================]
# Use the executable's path as a hint
set(_Python_LIBRARY_PATH_HINT)
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake
index 68dfa7d28..d6a06628e 100644
--- a/Modules/FindQt.cmake
+++ b/Modules/FindQt.cmake
@@ -1,37 +1,46 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindQt
-# ------
-#
-# Searches for all installed versions of Qt.
-#
-# This 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
-# The user must set the option DESIRED_QT_VERSION to the version they
-# want to use. If only one version of qt is found on the machine, then
-# the DESIRED_QT_VERSION is set to that version and the matching FindQt3
-# or FindQt4 module is included. Once the user sets DESIRED_QT_VERSION,
-# then the FindQt3 or FindQt4 module is included.
-#
-# This module can only detect and switch between Qt versions 3 and 4. It
-# cannot handle Qt5 or any later versions.
-#
-# ::
-#
-# QT_REQUIRED if this is set to TRUE then if CMake can
-# not find Qt4 or Qt3 an error is raised
-# and a message is sent to the user.
-#
-#
-#
-# ::
-#
-# DESIRED_QT_VERSION OPTION is created
-# QT4_INSTALLED is set to TRUE if qt4 is found.
-# QT3_INSTALLED is set to TRUE if qt3 is found.
+#[=======================================================================[.rst:
+FindQt
+------
+
+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
+The user must set the option DESIRED_QT_VERSION to the version they
+want to use. If only one version of qt is found on the machine, then
+the DESIRED_QT_VERSION is set to that version and the matching FindQt3
+or FindQt4 module is included. Once the user sets DESIRED_QT_VERSION,
+then the FindQt3 or FindQt4 module is included.
+
+::
+
+ QT_REQUIRED if this is set to TRUE then if CMake can
+ not find Qt4 or Qt3 an error is raised
+ and a message is sent to the user.
+
+
+
+::
+
+ DESIRED_QT_VERSION OPTION is created
+ QT4_INSTALLED is set to TRUE if qt4 is found.
+ QT3_INSTALLED is set to TRUE if qt3 is found.
+#]=======================================================================]
+
+if(_findqt_testing)
+ set(_findqt_included TRUE)
+ return()
+endif()
# look for signs of qt3 installations
file(GLOB GLOB_TEMP_VAR /usr/lib*/qt-3*/bin/qmake /usr/lib*/qt3*/bin/qmake)
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index a034210d8..4a8e28b1b 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -1,37 +1,38 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindQt3
-# -------
-#
-# Locate Qt include paths and libraries
-#
-# This module defines:
-#
-# ::
-#
-# QT_INCLUDE_DIR - where to find qt.h, etc.
-# QT_LIBRARIES - the libraries to link against to use Qt.
-# QT_DEFINITIONS - definitions to use when
-# compiling code that uses Qt.
-# QT_FOUND - If false, don't try to use Qt.
-# QT_VERSION_STRING - the version of Qt found
-#
-#
-#
-# If you need the multithreaded version of Qt, set QT_MT_REQUIRED to
-# TRUE
-#
-# Also defined, but not for general use are:
-#
-# ::
-#
-# QT_MOC_EXECUTABLE, where to find the moc tool.
-# QT_UIC_EXECUTABLE, where to find the uic tool.
-# QT_QT_LIBRARY, where to find the Qt library.
-# QT_QTMAIN_LIBRARY, where to find the qtmain
-# library. This is only required by Qt3 on Windows.
+#[=======================================================================[.rst:
+FindQt3
+-------
+
+Locate Qt include paths and libraries
+
+This module defines:
+
+::
+
+ QT_INCLUDE_DIR - where to find qt.h, etc.
+ QT_LIBRARIES - the libraries to link against to use Qt.
+ QT_DEFINITIONS - definitions to use when
+ compiling code that uses Qt.
+ QT_FOUND - If false, don't try to use Qt.
+ QT_VERSION_STRING - the version of Qt found
+
+
+
+If you need the multithreaded version of Qt, set QT_MT_REQUIRED to
+TRUE
+
+Also defined, but not for general use are:
+
+::
+
+ QT_MOC_EXECUTABLE, where to find the moc tool.
+ QT_UIC_EXECUTABLE, where to find the uic tool.
+ QT_QT_LIBRARY, where to find the Qt library.
+ QT_QTMAIN_LIBRARY, where to find the qtmain
+ library. This is only required by Qt3 on Windows.
+#]=======================================================================]
# These are around for backwards compatibility
# they will be set
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 847a798af..a145b4649 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -1,304 +1,305 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindQt4
-# -------
-#
-# Finding and Using Qt4
-# ^^^^^^^^^^^^^^^^^^^^^
-#
-# This module can be used to find Qt4. The most important issue is that
-# the Qt4 qmake is available via the system path. This qmake is then
-# used to detect basically everything else. This module defines a
-# number of :prop_tgt:`IMPORTED` targets, macros and variables.
-#
-# Typical usage could be something like:
-#
-# .. code-block:: cmake
-#
-# set(CMAKE_AUTOMOC ON)
-# set(CMAKE_INCLUDE_CURRENT_DIR ON)
-# find_package(Qt4 4.4.3 REQUIRED QtGui QtXml)
-# add_executable(myexe main.cpp)
-# target_link_libraries(myexe Qt4::QtGui Qt4::QtXml)
-#
-# .. note::
-#
-# When using :prop_tgt:`IMPORTED` targets, the qtmain.lib static library is
-# automatically linked on Windows for :prop_tgt:`WIN32 <WIN32_EXECUTABLE>`
-# executables. To disable that globally, set the
-# ``QT4_NO_LINK_QTMAIN`` variable before finding Qt4. To disable that
-# for a particular executable, set the ``QT4_NO_LINK_QTMAIN`` target
-# property to ``TRUE`` on the executable.
-#
-# Qt Build Tools
-# ^^^^^^^^^^^^^^
-#
-# Qt relies on some bundled tools for code generation, such as ``moc`` for
-# meta-object code generation,``uic`` for widget layout and population,
-# and ``rcc`` for virtual filesystem content generation. These tools may be
-# automatically invoked by :manual:`cmake(1)` if the appropriate conditions
-# are met. See :manual:`cmake-qt(7)` for more.
-#
-# Qt Macros
-# ^^^^^^^^^
-#
-# In some cases it can be necessary or useful to invoke the Qt build tools in a
-# more-manual way. Several macros are available to add targets for such uses.
-#
-# ::
-#
-# macro QT4_WRAP_CPP(outfiles inputfile ... [TARGET tgt] OPTIONS ...)
-# create moc code from a list of files containing Qt class with
-# the Q_OBJECT declaration. Per-directory preprocessor definitions
-# are also added. If the <tgt> is specified, the
-# INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITIONS from
-# the <tgt> are passed to moc. Options may be given to moc, such as
-# those found when executing "moc -help".
-#
-#
-# ::
-#
-# macro QT4_WRAP_UI(outfiles inputfile ... OPTIONS ...)
-# create code from a list of Qt designer ui files.
-# Options may be given to uic, such as those found
-# when executing "uic -help"
-#
-#
-# ::
-#
-# macro QT4_ADD_RESOURCES(outfiles inputfile ... OPTIONS ...)
-# create code from a list of Qt resource files.
-# Options may be given to rcc, such as those found
-# when executing "rcc -help"
-#
-#
-# ::
-#
-# macro QT4_GENERATE_MOC(inputfile outputfile [TARGET tgt])
-# creates a rule to run moc on infile and create outfile.
-# Use this if for some reason QT4_WRAP_CPP() isn't appropriate, e.g.
-# because you need a custom filename for the moc file or something
-# similar. If the <tgt> is specified, the
-# INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITIONS from
-# the <tgt> are passed to moc.
-#
-#
-# ::
-#
-# macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename)
-# Create the interface header and implementation files with the
-# given basename from the given interface xml file and add it to
-# the list of sources.
-#
-# You can pass additional parameters to the qdbusxml2cpp call by setting
-# properties on the input file:
-#
-# INCLUDE the given file will be included in the generate interface header
-#
-# CLASSNAME the generated class is named accordingly
-#
-# NO_NAMESPACE the generated class is not wrapped in a namespace
-#
-#
-# ::
-#
-# macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... )
-# Create the interface header and implementation files
-# for all listed interface xml files.
-# The basename will be automatically determined from the name
-# of the xml file.
-#
-# The source file properties described for
-# QT4_ADD_DBUS_INTERFACE also apply here.
-#
-#
-# ::
-#
-# macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname
-# [basename] [classname])
-# create a dbus adaptor (header and implementation file) from the xml file
-# describing the interface, and add it to the list of sources. The adaptor
-# forwards the calls to a parent class, defined in parentheader and named
-# parentclassname. The name of the generated files will be
-# <basename>adaptor.{cpp,h} where basename defaults to the basename of the
-# xml file.
-# If <classname> is provided, then it will be used as the classname of the
-# adaptor itself.
-#
-#
-# ::
-#
-# macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] OPTIONS ...)
-# generate the xml interface file from the given header.
-# If the optional argument interfacename is omitted, the name of the
-# interface file is constructed from the basename of the header with
-# the suffix .xml appended.
-# Options may be given to qdbuscpp2xml, such as those found when
-# executing "qdbuscpp2xml --help"
-#
-#
-# ::
-#
-# macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ...
-# ts_files ... OPTIONS ...)
-# out: qm_files
-# in: directories sources ts_files
-# options: flags to pass to lupdate, such as -extensions to specify
-# extensions for a directory scan.
-# generates commands to create .ts (vie lupdate) and .qm
-# (via lrelease) - files from directories and/or sources. The ts files are
-# created and/or updated in the source tree (unless given with full paths).
-# The qm files are generated in the build tree.
-# Updating the translations can be done by adding the qm_files
-# to the source list of your library/executable, so they are
-# always updated, or by adding a custom target to control when
-# they get updated/generated.
-#
-#
-# ::
-#
-# macro QT4_ADD_TRANSLATION( qm_files ts_files ... )
-# out: qm_files
-# in: ts_files
-# generates commands to create .qm from .ts - files. The generated
-# filenames can be found in qm_files. The ts_files
-# must exist and are not updated in any way.
-#
-#
-# ::
-#
-# macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... [TARGET tgt])
-# The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.
-# This macro is still experimental.
-# It can be used to have moc automatically handled.
-# So if you have the files foo.h and foo.cpp, and in foo.h a
-# a class uses the Q_OBJECT macro, moc has to run on it. If you don't
-# want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert
-# #include "foo.moc"
-# in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will
-# scan all listed files at cmake-time for such included moc files and if it
-# finds them cause a rule to be generated to run moc at build time on the
-# accompanying header file foo.h.
-# If a source file has the SKIP_AUTOMOC property set it will be ignored by
-# this macro.
-# If the <tgt> is specified, the INTERFACE_INCLUDE_DIRECTORIES and
-# INTERFACE_COMPILE_DEFINITIONS from the <tgt> are passed to moc.
-#
-#
-# ::
-#
-# function QT4_USE_MODULES( target [link_type] modules...)
-# This function is obsolete. Use target_link_libraries with IMPORTED targets
-# instead.
-# Make <target> use the <modules> from Qt. Using a Qt module means
-# to link to the library, add the relevant include directories for the
-# module, and add the relevant compiler defines for using the module.
-# Modules are roughly equivalent to components of Qt4, so usage would be
-# something like:
-# qt4_use_modules(myexe Core Gui Declarative)
-# to use QtCore, QtGui and QtDeclarative. The optional <link_type> argument
-# can be specified as either LINK_PUBLIC or LINK_PRIVATE to specify the
-# same argument to the target_link_libraries call.
-#
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# A particular Qt library may be used by using the corresponding
-# :prop_tgt:`IMPORTED` target with the :command:`target_link_libraries`
-# command:
-#
-# .. code-block:: cmake
-#
-# target_link_libraries(myexe Qt4::QtGui Qt4::QtXml)
-#
-# Using a target in this way causes :cmake(1)` to use the appropriate include
-# directories and compile definitions for the target when compiling ``myexe``.
-#
-# Targets are aware of their dependencies, so for example it is not necessary
-# to list ``Qt4::QtCore`` if another Qt library is listed, and it is not
-# necessary to list ``Qt4::QtGui`` if ``Qt4::QtDeclarative`` is listed.
-# Targets may be tested for existence in the usual way with the
-# :command:`if(TARGET)` command.
-#
-# The Qt toolkit may contain both debug and release libraries.
-# :manual:`cmake(1)` will choose the appropriate version based on the build
-# configuration.
-#
-# ``Qt4::QtCore``
-# The QtCore target
-# ``Qt4::QtGui``
-# The QtGui target
-# ``Qt4::Qt3Support``
-# The Qt3Support target
-# ``Qt4::QtAssistant``
-# The QtAssistant target
-# ``Qt4::QtAssistantClient``
-# The QtAssistantClient target
-# ``Qt4::QAxContainer``
-# The QAxContainer target (Windows only)
-# ``Qt4::QAxServer``
-# The QAxServer target (Windows only)
-# ``Qt4::QtDBus``
-# The QtDBus target
-# ``Qt4::QtDeclarative``
-# The QtDeclarative target
-# ``Qt4::QtDesigner``
-# The QtDesigner target
-# ``Qt4::QtDesignerComponents``
-# The QtDesignerComponents target
-# ``Qt4::QtHelp``
-# The QtHelp target
-# ``Qt4::QtMotif``
-# The QtMotif target
-# ``Qt4::QtMultimedia``
-# The QtMultimedia target
-# ``Qt4::QtNetwork``
-# The QtNetwork target
-# ``Qt4::QtNsPLugin``
-# The QtNsPLugin target
-# ``Qt4::QtOpenGL``
-# The QtOpenGL target
-# ``Qt4::QtScript``
-# The QtScript target
-# ``Qt4::QtScriptTools``
-# The QtScriptTools target
-# ``Qt4::QtSql``
-# The QtSql target
-# ``Qt4::QtSvg``
-# The QtSvg target
-# ``Qt4::QtTest``
-# The QtTest target
-# ``Qt4::QtUiTools``
-# The QtUiTools target
-# ``Qt4::QtWebKit``
-# The QtWebKit target
-# ``Qt4::QtXml``
-# The QtXml target
-# ``Qt4::QtXmlPatterns``
-# The QtXmlPatterns target
-# ``Qt4::phonon``
-# The phonon target
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# Below is a detailed list of variables that FindQt4.cmake sets.
-#
-# ``Qt4_FOUND``
-# If false, don't try to use Qt 4.
-# ``QT_FOUND``
-# If false, don't try to use Qt. This variable is for compatibility only.
-# ``QT4_FOUND``
-# If false, don't try to use Qt 4. This variable is for compatibility only.
-# ``QT_VERSION_MAJOR``
-# The major version of Qt found.
-# ``QT_VERSION_MINOR``
-# The minor version of Qt found.
-# ``QT_VERSION_PATCH``
-# The patch version of Qt found.
+#[=======================================================================[.rst:
+FindQt4
+-------
+
+Finding and Using Qt4
+^^^^^^^^^^^^^^^^^^^^^
+
+This module can be used to find Qt4. The most important issue is that
+the Qt4 qmake is available via the system path. This qmake is then
+used to detect basically everything else. This module defines a
+number of :prop_tgt:`IMPORTED` targets, macros and variables.
+
+Typical usage could be something like:
+
+.. code-block:: cmake
+
+ set(CMAKE_AUTOMOC ON)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ find_package(Qt4 4.4.3 REQUIRED QtGui QtXml)
+ add_executable(myexe main.cpp)
+ target_link_libraries(myexe Qt4::QtGui Qt4::QtXml)
+
+.. note::
+
+ When using :prop_tgt:`IMPORTED` targets, the qtmain.lib static library is
+ automatically linked on Windows for :prop_tgt:`WIN32 <WIN32_EXECUTABLE>`
+ executables. To disable that globally, set the
+ ``QT4_NO_LINK_QTMAIN`` variable before finding Qt4. To disable that
+ for a particular executable, set the ``QT4_NO_LINK_QTMAIN`` target
+ property to ``TRUE`` on the executable.
+
+Qt Build Tools
+^^^^^^^^^^^^^^
+
+Qt relies on some bundled tools for code generation, such as ``moc`` for
+meta-object code generation,``uic`` for widget layout and population,
+and ``rcc`` for virtual filesystem content generation. These tools may be
+automatically invoked by :manual:`cmake(1)` if the appropriate conditions
+are met. See :manual:`cmake-qt(7)` for more.
+
+Qt Macros
+^^^^^^^^^
+
+In some cases it can be necessary or useful to invoke the Qt build tools in a
+more-manual way. Several macros are available to add targets for such uses.
+
+::
+
+ macro QT4_WRAP_CPP(outfiles inputfile ... [TARGET tgt] OPTIONS ...)
+ create moc code from a list of files containing Qt class with
+ the Q_OBJECT declaration. Per-directory preprocessor definitions
+ are also added. If the <tgt> is specified, the
+ INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITIONS from
+ the <tgt> are passed to moc. Options may be given to moc, such as
+ those found when executing "moc -help".
+
+
+::
+
+ macro QT4_WRAP_UI(outfiles inputfile ... OPTIONS ...)
+ create code from a list of Qt designer ui files.
+ Options may be given to uic, such as those found
+ when executing "uic -help"
+
+
+::
+
+ macro QT4_ADD_RESOURCES(outfiles inputfile ... OPTIONS ...)
+ create code from a list of Qt resource files.
+ Options may be given to rcc, such as those found
+ when executing "rcc -help"
+
+
+::
+
+ macro QT4_GENERATE_MOC(inputfile outputfile [TARGET tgt])
+ creates a rule to run moc on infile and create outfile.
+ Use this if for some reason QT4_WRAP_CPP() isn't appropriate, e.g.
+ because you need a custom filename for the moc file or something
+ similar. If the <tgt> is specified, the
+ INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITIONS from
+ the <tgt> are passed to moc.
+
+
+::
+
+ macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename)
+ Create the interface header and implementation files with the
+ given basename from the given interface xml file and add it to
+ the list of sources.
+
+ You can pass additional parameters to the qdbusxml2cpp call by setting
+ properties on the input file:
+
+ INCLUDE the given file will be included in the generate interface header
+
+ CLASSNAME the generated class is named accordingly
+
+ NO_NAMESPACE the generated class is not wrapped in a namespace
+
+
+::
+
+ macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... )
+ Create the interface header and implementation files
+ for all listed interface xml files.
+ The basename will be automatically determined from the name
+ of the xml file.
+
+ The source file properties described for
+ QT4_ADD_DBUS_INTERFACE also apply here.
+
+
+::
+
+ macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname
+ [basename] [classname])
+ create a dbus adaptor (header and implementation file) from the xml file
+ describing the interface, and add it to the list of sources. The adaptor
+ forwards the calls to a parent class, defined in parentheader and named
+ parentclassname. The name of the generated files will be
+ <basename>adaptor.{cpp,h} where basename defaults to the basename of the
+ xml file.
+ If <classname> is provided, then it will be used as the classname of the
+ adaptor itself.
+
+
+::
+
+ macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] OPTIONS ...)
+ generate the xml interface file from the given header.
+ If the optional argument interfacename is omitted, the name of the
+ interface file is constructed from the basename of the header with
+ the suffix .xml appended.
+ Options may be given to qdbuscpp2xml, such as those found when
+ executing "qdbuscpp2xml --help"
+
+
+::
+
+ macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ...
+ ts_files ... OPTIONS ...)
+ out: qm_files
+ in: directories sources ts_files
+ options: flags to pass to lupdate, such as -extensions to specify
+ extensions for a directory scan.
+ generates commands to create .ts (vie lupdate) and .qm
+ (via lrelease) - files from directories and/or sources. The ts files are
+ created and/or updated in the source tree (unless given with full paths).
+ The qm files are generated in the build tree.
+ Updating the translations can be done by adding the qm_files
+ to the source list of your library/executable, so they are
+ always updated, or by adding a custom target to control when
+ they get updated/generated.
+
+
+::
+
+ macro QT4_ADD_TRANSLATION( qm_files ts_files ... )
+ out: qm_files
+ in: ts_files
+ generates commands to create .qm from .ts - files. The generated
+ filenames can be found in qm_files. The ts_files
+ must exist and are not updated in any way.
+
+
+::
+
+ macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... [TARGET tgt])
+ The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.
+ This macro is still experimental.
+ It can be used to have moc automatically handled.
+ So if you have the files foo.h and foo.cpp, and in foo.h a
+ a class uses the Q_OBJECT macro, moc has to run on it. If you don't
+ want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert
+ #include "foo.moc"
+ in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will
+ scan all listed files at cmake-time for such included moc files and if it
+ finds them cause a rule to be generated to run moc at build time on the
+ accompanying header file foo.h.
+ If a source file has the SKIP_AUTOMOC property set it will be ignored by
+ this macro.
+ If the <tgt> is specified, the INTERFACE_INCLUDE_DIRECTORIES and
+ INTERFACE_COMPILE_DEFINITIONS from the <tgt> are passed to moc.
+
+
+::
+
+ function QT4_USE_MODULES( target [link_type] modules...)
+ This function is obsolete. Use target_link_libraries with IMPORTED targets
+ instead.
+ Make <target> use the <modules> from Qt. Using a Qt module means
+ to link to the library, add the relevant include directories for the
+ module, and add the relevant compiler defines for using the module.
+ Modules are roughly equivalent to components of Qt4, so usage would be
+ something like:
+ qt4_use_modules(myexe Core Gui Declarative)
+ to use QtCore, QtGui and QtDeclarative. The optional <link_type> argument
+ can be specified as either LINK_PUBLIC or LINK_PRIVATE to specify the
+ same argument to the target_link_libraries call.
+
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+A particular Qt library may be used by using the corresponding
+:prop_tgt:`IMPORTED` target with the :command:`target_link_libraries`
+command:
+
+.. code-block:: cmake
+
+ target_link_libraries(myexe Qt4::QtGui Qt4::QtXml)
+
+Using a target in this way causes :cmake(1)` to use the appropriate include
+directories and compile definitions for the target when compiling ``myexe``.
+
+Targets are aware of their dependencies, so for example it is not necessary
+to list ``Qt4::QtCore`` if another Qt library is listed, and it is not
+necessary to list ``Qt4::QtGui`` if ``Qt4::QtDeclarative`` is listed.
+Targets may be tested for existence in the usual way with the
+:command:`if(TARGET)` command.
+
+The Qt toolkit may contain both debug and release libraries.
+:manual:`cmake(1)` will choose the appropriate version based on the build
+configuration.
+
+``Qt4::QtCore``
+ The QtCore target
+``Qt4::QtGui``
+ The QtGui target
+``Qt4::Qt3Support``
+ The Qt3Support target
+``Qt4::QtAssistant``
+ The QtAssistant target
+``Qt4::QtAssistantClient``
+ The QtAssistantClient target
+``Qt4::QAxContainer``
+ The QAxContainer target (Windows only)
+``Qt4::QAxServer``
+ The QAxServer target (Windows only)
+``Qt4::QtDBus``
+ The QtDBus target
+``Qt4::QtDeclarative``
+ The QtDeclarative target
+``Qt4::QtDesigner``
+ The QtDesigner target
+``Qt4::QtDesignerComponents``
+ The QtDesignerComponents target
+``Qt4::QtHelp``
+ The QtHelp target
+``Qt4::QtMotif``
+ The QtMotif target
+``Qt4::QtMultimedia``
+ The QtMultimedia target
+``Qt4::QtNetwork``
+ The QtNetwork target
+``Qt4::QtNsPLugin``
+ The QtNsPLugin target
+``Qt4::QtOpenGL``
+ The QtOpenGL target
+``Qt4::QtScript``
+ The QtScript target
+``Qt4::QtScriptTools``
+ The QtScriptTools target
+``Qt4::QtSql``
+ The QtSql target
+``Qt4::QtSvg``
+ The QtSvg target
+``Qt4::QtTest``
+ The QtTest target
+``Qt4::QtUiTools``
+ The QtUiTools target
+``Qt4::QtWebKit``
+ The QtWebKit target
+``Qt4::QtXml``
+ The QtXml target
+``Qt4::QtXmlPatterns``
+ The QtXmlPatterns target
+``Qt4::phonon``
+ The phonon target
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+ Below is a detailed list of variables that FindQt4.cmake sets.
+
+``Qt4_FOUND``
+ If false, don't try to use Qt 4.
+``QT_FOUND``
+ If false, don't try to use Qt. This variable is for compatibility only.
+``QT4_FOUND``
+ If false, don't try to use Qt 4. This variable is for compatibility only.
+``QT_VERSION_MAJOR``
+ The major version of Qt found.
+``QT_VERSION_MINOR``
+ The minor version of Qt found.
+``QT_VERSION_PATCH``
+ The patch version of Qt found.
+#]=======================================================================]
# Use find_package( Qt4 COMPONENTS ... ) to enable modules
if( Qt4_FIND_COMPONENTS )
diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake
index 995d8826b..107486daa 100644
--- a/Modules/FindQuickTime.cmake
+++ b/Modules/FindQuickTime.cmake
@@ -1,20 +1,21 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindQuickTime
-# -------------
-#
-#
-#
-# Locate QuickTime This module defines QUICKTIME_LIBRARY
-# QUICKTIME_FOUND, if false, do not try to link to gdal
-# QUICKTIME_INCLUDE_DIR, where to find the headers
-#
-# $QUICKTIME_DIR is an environment variable that would correspond to the
-# ./configure --prefix=$QUICKTIME_DIR
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindQuickTime
+-------------
+
+
+
+Locate QuickTime This module defines QUICKTIME_LIBRARY
+QUICKTIME_FOUND, if false, do not try to link to gdal
+QUICKTIME_INCLUDE_DIR, where to find the headers
+
+$QUICKTIME_DIR is an environment variable that would correspond to the
+./configure --prefix=$QUICKTIME_DIR
+
+Created by Eric Wing.
+#]=======================================================================]
find_path(QUICKTIME_INCLUDE_DIR QuickTime/QuickTime.h QuickTime.h
HINTS
diff --git a/Modules/FindRTI.cmake b/Modules/FindRTI.cmake
index b2ef0761a..54d2bec9f 100644
--- a/Modules/FindRTI.cmake
+++ b/Modules/FindRTI.cmake
@@ -1,37 +1,38 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindRTI
-# -------
-#
-# Try to find M&S HLA RTI libraries
-#
-# This module finds if any HLA RTI is installed and locates the standard
-# RTI include files and libraries.
-#
-# RTI is a simulation infrastructure standardized by IEEE and SISO. It
-# has a well defined C++ API that assures that simulation applications
-# are independent on a particular RTI implementation.
-#
-# ::
-#
-# http://en.wikipedia.org/wiki/Run-Time_Infrastructure_(simulation)
-#
-#
-#
-# This code sets the following variables:
-#
-# ::
-#
-# RTI_INCLUDE_DIR = the directory where RTI includes file are found
-# RTI_LIBRARIES = The libraries to link against to use RTI
-# RTI_DEFINITIONS = -DRTI_USES_STD_FSTREAM
-# RTI_FOUND = Set to FALSE if any HLA RTI was not found
-#
-#
-#
-# Report problems to <certi-devel@nongnu.org>
+#[=======================================================================[.rst:
+FindRTI
+-------
+
+Try to find M&S HLA RTI libraries
+
+This module finds if any HLA RTI is installed and locates the standard
+RTI include files and libraries.
+
+RTI is a simulation infrastructure standardized by IEEE and SISO. It
+has a well defined C++ API that assures that simulation applications
+are independent on a particular RTI implementation.
+
+::
+
+ http://en.wikipedia.org/wiki/Run-Time_Infrastructure_(simulation)
+
+
+
+This code sets the following variables:
+
+::
+
+ RTI_INCLUDE_DIR = the directory where RTI includes file are found
+ RTI_LIBRARIES = The libraries to link against to use RTI
+ RTI_DEFINITIONS = -DRTI_USES_STD_FSTREAM
+ RTI_FOUND = Set to FALSE if any HLA RTI was not found
+
+
+
+Report problems to <certi-devel@nongnu.org>
+#]=======================================================================]
macro(RTI_MESSAGE_QUIETLY QUIET TYPE MSG)
if(NOT ${QUIET})
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index bd9f8357d..58debdd2a 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -1,37 +1,38 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindRuby
-# --------
-#
-# Find Ruby
-#
-# This module finds if Ruby is installed and determines where the
-# include files and libraries are. Ruby 1.8, 1.9, 2.0 and 2.1 are
-# supported.
-#
-# The minimum required version of Ruby can be specified using the
-# standard syntax, e.g. find_package(Ruby 1.8)
-#
-# It also determines what the name of the library is. This code sets
-# the following variables:
-#
-# ``RUBY_EXECUTABLE``
-# full path to the ruby binary
-# ``RUBY_INCLUDE_DIRS``
-# include dirs to be used when using the ruby library
-# ``RUBY_LIBRARY``
-# full path to the ruby library
-# ``RUBY_VERSION``
-# the version of ruby which was found, e.g. "1.8.7"
-# ``RUBY_FOUND``
-# set to true if ruby ws found successfully
-#
-# Also:
-#
-# ``RUBY_INCLUDE_PATH``
-# same as RUBY_INCLUDE_DIRS, only provided for compatibility reasons, don't use it
+#[=======================================================================[.rst:
+FindRuby
+--------
+
+Find Ruby
+
+This module finds if Ruby is installed and determines where the
+include files and libraries are. Ruby 1.8, 1.9, 2.0 and 2.1 are
+supported.
+
+The minimum required version of Ruby can be specified using the
+standard syntax, e.g. find_package(Ruby 1.8)
+
+It also determines what the name of the library is. This code sets
+the following variables:
+
+``RUBY_EXECUTABLE``
+ full path to the ruby binary
+``RUBY_INCLUDE_DIRS``
+ include dirs to be used when using the ruby library
+``RUBY_LIBRARY``
+ full path to the ruby library
+``RUBY_VERSION``
+ the version of ruby which was found, e.g. "1.8.7"
+``RUBY_FOUND``
+ set to true if ruby ws found successfully
+
+Also:
+
+``RUBY_INCLUDE_PATH``
+ same as RUBY_INCLUDE_DIRS, only provided for compatibility reasons, don't use it
+#]=======================================================================]
# RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'`
# RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'`
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index 341001897..281383151 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -1,75 +1,76 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindSDL
-# -------
-#
-# Locate SDL library
-#
-# This module defines
-#
-# ::
-#
-# SDL_LIBRARY, the name of the library to link against
-# SDL_FOUND, if false, do not try to link to SDL
-# SDL_INCLUDE_DIR, where to find SDL.h
-# SDL_VERSION_STRING, human-readable string containing the version of SDL
-#
-#
-#
-# This module responds to the flag:
-#
-# ::
-#
-# SDL_BUILDING_LIBRARY
-# If this is defined, then no SDL_main will be linked in because
-# only applications need main().
-# Otherwise, it is assumed you are building an application and this
-# module will attempt to locate and set the proper link flags
-# as part of the returned SDL_LIBRARY variable.
-#
-#
-#
-# Don't forget to include SDLmain.h and SDLmain.m your project for the
-# OS X framework based version. (Other versions link to -lSDLmain which
-# this module will try to find on your behalf.) Also for OS X, this
-# module will automatically add the -framework Cocoa on your behalf.
-#
-#
-#
-# Additional Note: If you see an empty SDL_LIBRARY_TEMP in your
-# configuration and no SDL_LIBRARY, it means CMake did not find your SDL
-# library (SDL.dll, libsdl.so, SDL.framework, etc). Set
-# SDL_LIBRARY_TEMP to point to your SDL library, and configure again.
-# Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this
-# value as appropriate. These values are used to generate the final
-# SDL_LIBRARY variable, but when these values are unset, SDL_LIBRARY
-# does not get created.
-#
-#
-#
-# $SDLDIR is an environment variable that would correspond to the
-# ./configure --prefix=$SDLDIR used in building SDL. l.e.galup 9-20-02
-#
-# Modified by Eric Wing. Added code to assist with automated building
-# by using environmental variables and providing a more
-# controlled/consistent search behavior. Added new modifications to
-# recognize OS X frameworks and additional Unix paths (FreeBSD, etc).
-# Also corrected the header search path to follow "proper" SDL
-# guidelines. Added a search for SDLmain which is needed by some
-# platforms. Added a search for threads which is needed by some
-# platforms. Added needed compile switches for MinGW.
-#
-# On OSX, this will prefer the Framework version (if found) over others.
-# People will have to manually change the cache values of SDL_LIBRARY to
-# override this selection or set the CMake environment
-# CMAKE_INCLUDE_PATH to modify the search paths.
-#
-# Note that the header path has changed from SDL/SDL.h to just SDL.h
-# This needed to change because "proper" SDL convention is #include
-# "SDL.h", not <SDL/SDL.h>. This is done for portability reasons
-# because not all systems place things in SDL/ (see FreeBSD).
+#[=======================================================================[.rst:
+FindSDL
+-------
+
+Locate SDL library
+
+This module defines
+
+::
+
+ SDL_LIBRARY, the name of the library to link against
+ SDL_FOUND, if false, do not try to link to SDL
+ SDL_INCLUDE_DIR, where to find SDL.h
+ SDL_VERSION_STRING, human-readable string containing the version of SDL
+
+
+
+This module responds to the flag:
+
+::
+
+ SDL_BUILDING_LIBRARY
+ If this is defined, then no SDL_main will be linked in because
+ only applications need main().
+ Otherwise, it is assumed you are building an application and this
+ module will attempt to locate and set the proper link flags
+ as part of the returned SDL_LIBRARY variable.
+
+
+
+Don't forget to include SDLmain.h and SDLmain.m your project for the
+OS X framework based version. (Other versions link to -lSDLmain which
+this module will try to find on your behalf.) Also for OS X, this
+module will automatically add the -framework Cocoa on your behalf.
+
+
+
+Additional Note: If you see an empty SDL_LIBRARY_TEMP in your
+configuration and no SDL_LIBRARY, it means CMake did not find your SDL
+library (SDL.dll, libsdl.so, SDL.framework, etc). Set
+SDL_LIBRARY_TEMP to point to your SDL library, and configure again.
+Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this
+value as appropriate. These values are used to generate the final
+SDL_LIBRARY variable, but when these values are unset, SDL_LIBRARY
+does not get created.
+
+
+
+$SDLDIR is an environment variable that would correspond to the
+./configure --prefix=$SDLDIR used in building SDL. l.e.galup 9-20-02
+
+Modified by Eric Wing. Added code to assist with automated building
+by using environmental variables and providing a more
+controlled/consistent search behavior. Added new modifications to
+recognize OS X frameworks and additional Unix paths (FreeBSD, etc).
+Also corrected the header search path to follow "proper" SDL
+guidelines. Added a search for SDLmain which is needed by some
+platforms. Added a search for threads which is needed by some
+platforms. Added needed compile switches for MinGW.
+
+On OSX, this will prefer the Framework version (if found) over others.
+People will have to manually change the cache values of SDL_LIBRARY to
+override this selection or set the CMake environment
+CMAKE_INCLUDE_PATH to modify the search paths.
+
+Note that the header path has changed from SDL/SDL.h to just SDL.h
+This needed to change because "proper" SDL convention is #include
+"SDL.h", not <SDL/SDL.h>. This is done for portability reasons
+because not all systems place things in SDL/ (see FreeBSD).
+#]=======================================================================]
find_path(SDL_INCLUDE_DIR SDL.h
HINTS
diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake
index 8cdaa7a05..e687b4983 100644
--- a/Modules/FindSDL_image.cmake
+++ b/Modules/FindSDL_image.cmake
@@ -1,40 +1,41 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindSDL_image
-# -------------
-#
-# Locate SDL_image library
-#
-# This module defines:
-#
-# ::
-#
-# SDL_IMAGE_LIBRARIES, the name of the library to link against
-# SDL_IMAGE_INCLUDE_DIRS, where to find the headers
-# SDL_IMAGE_FOUND, if false, do not try to link against
-# SDL_IMAGE_VERSION_STRING - human-readable string containing the
-# version of SDL_image
-#
-#
-#
-# For backward compatibility the following variables are also set:
-#
-# ::
-#
-# SDLIMAGE_LIBRARY (same value as SDL_IMAGE_LIBRARIES)
-# SDLIMAGE_INCLUDE_DIR (same value as SDL_IMAGE_INCLUDE_DIRS)
-# SDLIMAGE_FOUND (same value as SDL_IMAGE_FOUND)
-#
-#
-#
-# $SDLDIR is an environment variable that would correspond to the
-# ./configure --prefix=$SDLDIR used in building SDL.
-#
-# Created by Eric Wing. This was influenced by the FindSDL.cmake
-# module, but with modifications to recognize OS X frameworks and
-# additional Unix paths (FreeBSD, etc).
+#[=======================================================================[.rst:
+FindSDL_image
+-------------
+
+Locate SDL_image library
+
+This module defines:
+
+::
+
+ SDL_IMAGE_LIBRARIES, the name of the library to link against
+ SDL_IMAGE_INCLUDE_DIRS, where to find the headers
+ SDL_IMAGE_FOUND, if false, do not try to link against
+ SDL_IMAGE_VERSION_STRING - human-readable string containing the
+ version of SDL_image
+
+
+
+For backward compatibility the following variables are also set:
+
+::
+
+ SDLIMAGE_LIBRARY (same value as SDL_IMAGE_LIBRARIES)
+ SDLIMAGE_INCLUDE_DIR (same value as SDL_IMAGE_INCLUDE_DIRS)
+ SDLIMAGE_FOUND (same value as SDL_IMAGE_FOUND)
+
+
+
+$SDLDIR is an environment variable that would correspond to the
+./configure --prefix=$SDLDIR used in building SDL.
+
+Created by Eric Wing. This was influenced by the FindSDL.cmake
+module, but with modifications to recognize OS X frameworks and
+additional Unix paths (FreeBSD, etc).
+#]=======================================================================]
if(NOT SDL_IMAGE_INCLUDE_DIR AND SDLIMAGE_INCLUDE_DIR)
set(SDL_IMAGE_INCLUDE_DIR ${SDLIMAGE_INCLUDE_DIR} CACHE PATH "directory cache
diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake
index 35233d121..315400a30 100644
--- a/Modules/FindSDL_mixer.cmake
+++ b/Modules/FindSDL_mixer.cmake
@@ -1,40 +1,41 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindSDL_mixer
-# -------------
-#
-# Locate SDL_mixer library
-#
-# This module defines:
-#
-# ::
-#
-# SDL_MIXER_LIBRARIES, the name of the library to link against
-# SDL_MIXER_INCLUDE_DIRS, where to find the headers
-# SDL_MIXER_FOUND, if false, do not try to link against
-# SDL_MIXER_VERSION_STRING - human-readable string containing the
-# version of SDL_mixer
-#
-#
-#
-# For backward compatibility the following variables are also set:
-#
-# ::
-#
-# SDLMIXER_LIBRARY (same value as SDL_MIXER_LIBRARIES)
-# SDLMIXER_INCLUDE_DIR (same value as SDL_MIXER_INCLUDE_DIRS)
-# SDLMIXER_FOUND (same value as SDL_MIXER_FOUND)
-#
-#
-#
-# $SDLDIR is an environment variable that would correspond to the
-# ./configure --prefix=$SDLDIR used in building SDL.
-#
-# Created by Eric Wing. This was influenced by the FindSDL.cmake
-# module, but with modifications to recognize OS X frameworks and
-# additional Unix paths (FreeBSD, etc).
+#[=======================================================================[.rst:
+FindSDL_mixer
+-------------
+
+Locate SDL_mixer library
+
+This module defines:
+
+::
+
+ SDL_MIXER_LIBRARIES, the name of the library to link against
+ SDL_MIXER_INCLUDE_DIRS, where to find the headers
+ SDL_MIXER_FOUND, if false, do not try to link against
+ SDL_MIXER_VERSION_STRING - human-readable string containing the
+ version of SDL_mixer
+
+
+
+For backward compatibility the following variables are also set:
+
+::
+
+ SDLMIXER_LIBRARY (same value as SDL_MIXER_LIBRARIES)
+ SDLMIXER_INCLUDE_DIR (same value as SDL_MIXER_INCLUDE_DIRS)
+ SDLMIXER_FOUND (same value as SDL_MIXER_FOUND)
+
+
+
+$SDLDIR is an environment variable that would correspond to the
+./configure --prefix=$SDLDIR used in building SDL.
+
+Created by Eric Wing. This was influenced by the FindSDL.cmake
+module, but with modifications to recognize OS X frameworks and
+additional Unix paths (FreeBSD, etc).
+#]=======================================================================]
if(NOT SDL_MIXER_INCLUDE_DIR AND SDLMIXER_INCLUDE_DIR)
set(SDL_MIXER_INCLUDE_DIR ${SDLMIXER_INCLUDE_DIR} CACHE PATH "directory cache
diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake
index b40694668..28cb4d6c2 100644
--- a/Modules/FindSDL_net.cmake
+++ b/Modules/FindSDL_net.cmake
@@ -1,39 +1,40 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindSDL_net
-# -----------
-#
-# Locate SDL_net library
-#
-# This module defines:
-#
-# ::
-#
-# SDL_NET_LIBRARIES, the name of the library to link against
-# SDL_NET_INCLUDE_DIRS, where to find the headers
-# SDL_NET_FOUND, if false, do not try to link against
-# SDL_NET_VERSION_STRING - human-readable string containing the version of SDL_net
-#
-#
-#
-# For backward compatibility the following variables are also set:
-#
-# ::
-#
-# SDLNET_LIBRARY (same value as SDL_NET_LIBRARIES)
-# SDLNET_INCLUDE_DIR (same value as SDL_NET_INCLUDE_DIRS)
-# SDLNET_FOUND (same value as SDL_NET_FOUND)
-#
-#
-#
-# $SDLDIR is an environment variable that would correspond to the
-# ./configure --prefix=$SDLDIR used in building SDL.
-#
-# Created by Eric Wing. This was influenced by the FindSDL.cmake
-# module, but with modifications to recognize OS X frameworks and
-# additional Unix paths (FreeBSD, etc).
+#[=======================================================================[.rst:
+FindSDL_net
+-----------
+
+Locate SDL_net library
+
+This module defines:
+
+::
+
+ SDL_NET_LIBRARIES, the name of the library to link against
+ SDL_NET_INCLUDE_DIRS, where to find the headers
+ SDL_NET_FOUND, if false, do not try to link against
+ SDL_NET_VERSION_STRING - human-readable string containing the version of SDL_net
+
+
+
+For backward compatibility the following variables are also set:
+
+::
+
+ SDLNET_LIBRARY (same value as SDL_NET_LIBRARIES)
+ SDLNET_INCLUDE_DIR (same value as SDL_NET_INCLUDE_DIRS)
+ SDLNET_FOUND (same value as SDL_NET_FOUND)
+
+
+
+$SDLDIR is an environment variable that would correspond to the
+./configure --prefix=$SDLDIR used in building SDL.
+
+Created by Eric Wing. This was influenced by the FindSDL.cmake
+module, but with modifications to recognize OS X frameworks and
+additional Unix paths (FreeBSD, etc).
+#]=======================================================================]
if(NOT SDL_NET_INCLUDE_DIR AND SDLNET_INCLUDE_DIR)
set(SDL_NET_INCLUDE_DIR ${SDLNET_INCLUDE_DIR} CACHE PATH "directory cache
diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake
index cf33a4c2c..e2179811e 100644
--- a/Modules/FindSDL_sound.cmake
+++ b/Modules/FindSDL_sound.cmake
@@ -1,84 +1,85 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindSDL_sound
-# -------------
-#
-# Locates the SDL_sound library
-#
-#
-#
-# This module depends on SDL being found and must be called AFTER
-# FindSDL.cmake is called.
-#
-# This module defines
-#
-# ::
-#
-# SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h
-# SDL_SOUND_FOUND, if false, do not try to link to SDL_sound
-# SDL_SOUND_LIBRARIES, this contains the list of libraries that you need
-# to link against.
-# SDL_SOUND_EXTRAS, this is an optional variable for you to add your own
-# flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES.
-# This is available mostly for cases this module failed to anticipate for
-# and you must add additional flags. This is marked as ADVANCED.
-# SDL_SOUND_VERSION_STRING, human-readable string containing the
-# version of SDL_sound
-#
-#
-#
-# This module also defines (but you shouldn't need to use directly)
-#
-# ::
-#
-# SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link
-# against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one.
-#
-# And might define the following as needed
-#
-# ::
-#
-# MIKMOD_LIBRARY
-# MODPLUG_LIBRARY
-# OGG_LIBRARY
-# VORBIS_LIBRARY
-# SMPEG_LIBRARY
-# FLAC_LIBRARY
-# SPEEX_LIBRARY
-#
-#
-#
-# Typically, you should not use these variables directly, and you should
-# use SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other
-# audio libraries (if needed) to successfully compile on your system.
-#
-# Created by Eric Wing. This module is a bit more complicated than the
-# other FindSDL* family modules. The reason is that SDL_sound can be
-# compiled in a large variety of different ways which are independent of
-# platform. SDL_sound may dynamically link against other 3rd party
-# libraries to get additional codec support, such as Ogg Vorbis, SMPEG,
-# ModPlug, MikMod, FLAC, Speex, and potentially others. Under some
-# circumstances which I don't fully understand, there seems to be a
-# requirement that dependent libraries of libraries you use must also be
-# explicitly linked against in order to successfully compile. SDL_sound
-# does not currently have any system in place to know how it was
-# compiled. So this CMake module does the hard work in trying to
-# discover which 3rd party libraries are required for building (if any).
-# This module uses a brute force approach to create a test program that
-# uses SDL_sound, and then tries to build it. If the build fails, it
-# parses the error output for known symbol names to figure out which
-# libraries are needed.
-#
-# Responds to the $SDLDIR and $SDLSOUNDDIR environmental variable that
-# would correspond to the ./configure --prefix=$SDLDIR used in building
-# SDL.
-#
-# On OSX, this will prefer the Framework version (if found) over others.
-# People will have to manually change the cache values of SDL_LIBRARY to
-# override this selectionor set the CMake environment CMAKE_INCLUDE_PATH
-# to modify the search paths.
+#[=======================================================================[.rst:
+FindSDL_sound
+-------------
+
+Locates the SDL_sound library
+
+
+
+This module depends on SDL being found and must be called AFTER
+FindSDL.cmake is called.
+
+This module defines
+
+::
+
+ SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h
+ SDL_SOUND_FOUND, if false, do not try to link to SDL_sound
+ SDL_SOUND_LIBRARIES, this contains the list of libraries that you need
+ to link against.
+ SDL_SOUND_EXTRAS, this is an optional variable for you to add your own
+ flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES.
+ This is available mostly for cases this module failed to anticipate for
+ and you must add additional flags. This is marked as ADVANCED.
+ SDL_SOUND_VERSION_STRING, human-readable string containing the
+ version of SDL_sound
+
+
+
+This module also defines (but you shouldn't need to use directly)
+
+::
+
+ SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link
+ against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one.
+
+And might define the following as needed
+
+::
+
+ MIKMOD_LIBRARY
+ MODPLUG_LIBRARY
+ OGG_LIBRARY
+ VORBIS_LIBRARY
+ SMPEG_LIBRARY
+ FLAC_LIBRARY
+ SPEEX_LIBRARY
+
+
+
+Typically, you should not use these variables directly, and you should
+use SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other
+audio libraries (if needed) to successfully compile on your system.
+
+Created by Eric Wing. This module is a bit more complicated than the
+other FindSDL* family modules. The reason is that SDL_sound can be
+compiled in a large variety of different ways which are independent of
+platform. SDL_sound may dynamically link against other 3rd party
+libraries to get additional codec support, such as Ogg Vorbis, SMPEG,
+ModPlug, MikMod, FLAC, Speex, and potentially others. Under some
+circumstances which I don't fully understand, there seems to be a
+requirement that dependent libraries of libraries you use must also be
+explicitly linked against in order to successfully compile. SDL_sound
+does not currently have any system in place to know how it was
+compiled. So this CMake module does the hard work in trying to
+discover which 3rd party libraries are required for building (if any).
+This module uses a brute force approach to create a test program that
+uses SDL_sound, and then tries to build it. If the build fails, it
+parses the error output for known symbol names to figure out which
+libraries are needed.
+
+Responds to the $SDLDIR and $SDLSOUNDDIR environmental variable that
+would correspond to the ./configure --prefix=$SDLDIR used in building
+SDL.
+
+On OSX, this will prefer the Framework version (if found) over others.
+People will have to manually change the cache values of SDL_LIBRARY to
+override this selectionor set the CMake environment CMAKE_INCLUDE_PATH
+to modify the search paths.
+#]=======================================================================]
set(SDL_SOUND_EXTRAS "" CACHE STRING "SDL_sound extra flags")
mark_as_advanced(SDL_SOUND_EXTRAS)
diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake
index aa705f226..d5721da0a 100644
--- a/Modules/FindSDL_ttf.cmake
+++ b/Modules/FindSDL_ttf.cmake
@@ -1,39 +1,40 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindSDL_ttf
-# -----------
-#
-# Locate SDL_ttf library
-#
-# This module defines:
-#
-# ::
-#
-# SDL_TTF_LIBRARIES, the name of the library to link against
-# SDL_TTF_INCLUDE_DIRS, where to find the headers
-# SDL_TTF_FOUND, if false, do not try to link against
-# SDL_TTF_VERSION_STRING - human-readable string containing the version of SDL_ttf
-#
-#
-#
-# For backward compatibility the following variables are also set:
-#
-# ::
-#
-# SDLTTF_LIBRARY (same value as SDL_TTF_LIBRARIES)
-# SDLTTF_INCLUDE_DIR (same value as SDL_TTF_INCLUDE_DIRS)
-# SDLTTF_FOUND (same value as SDL_TTF_FOUND)
-#
-#
-#
-# $SDLDIR is an environment variable that would correspond to the
-# ./configure --prefix=$SDLDIR used in building SDL.
-#
-# Created by Eric Wing. This was influenced by the FindSDL.cmake
-# module, but with modifications to recognize OS X frameworks and
-# additional Unix paths (FreeBSD, etc).
+#[=======================================================================[.rst:
+FindSDL_ttf
+-----------
+
+Locate SDL_ttf library
+
+This module defines:
+
+::
+
+ SDL_TTF_LIBRARIES, the name of the library to link against
+ SDL_TTF_INCLUDE_DIRS, where to find the headers
+ SDL_TTF_FOUND, if false, do not try to link against
+ SDL_TTF_VERSION_STRING - human-readable string containing the version of SDL_ttf
+
+
+
+For backward compatibility the following variables are also set:
+
+::
+
+ SDLTTF_LIBRARY (same value as SDL_TTF_LIBRARIES)
+ SDLTTF_INCLUDE_DIR (same value as SDL_TTF_INCLUDE_DIRS)
+ SDLTTF_FOUND (same value as SDL_TTF_FOUND)
+
+
+
+$SDLDIR is an environment variable that would correspond to the
+./configure --prefix=$SDLDIR used in building SDL.
+
+Created by Eric Wing. This was influenced by the FindSDL.cmake
+module, but with modifications to recognize OS X frameworks and
+additional Unix paths (FreeBSD, etc).
+#]=======================================================================]
if(NOT SDL_TTF_INCLUDE_DIR AND SDLTTF_INCLUDE_DIR)
set(SDL_TTF_INCLUDE_DIR ${SDLTTF_INCLUDE_DIR} CACHE PATH "directory cache
diff --git a/Modules/FindSQLite3.cmake b/Modules/FindSQLite3.cmake
new file mode 100644
index 000000000..374d7af6c
--- /dev/null
+++ b/Modules/FindSQLite3.cmake
@@ -0,0 +1,66 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindSQLite3
+-----------
+
+Find the SQLite libraries, v3
+
+IMPORTED targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` target:
+
+``SQLite::SQLite3``
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables if found:
+
+``SQLite3_INCLUDE_DIRS``
+ where to find sqlite3.h, etc.
+``SQLite3_LIBRARIES``
+ the libraries to link against to use SQLite3.
+``SQLite3_VERSION``
+ version of the SQLite3 library found
+``SQLite3_FOUND``
+ TRUE if found
+
+#]=======================================================================]
+
+# Look for the necessary header
+find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h)
+mark_as_advanced(SQLite3_INCLUDE_DIR)
+
+# Look for the necessary library
+find_library(SQLite3_LIBRARY NAMES sqlite3 sqlite)
+mark_as_advanced(SQLite3_LIBRARY)
+
+# Extract version information from the header file
+if(SQLite3_INCLUDE_DIR)
+ file(STRINGS ${SQLite3_INCLUDE_DIR}/sqlite3.h _ver_line
+ REGEX "^#define SQLITE_VERSION *\"[0-9]+\\.[0-9]+\\.[0-9]+\""
+ LIMIT_COUNT 1)
+ string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+"
+ SQLite3_VERSION "${_ver_line}")
+ unset(_ver_line)
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(SQLite3
+ REQUIRED_VARS SQLite3_INCLUDE_DIR SQLite3_LIBRARY
+ VERSION_VAR SQLite3_VERSION)
+
+# Create the imported target
+if(SQLite3_FOUND)
+ set(SQLite3_INCLUDE_DIRS ${SQLite3_INCLUDE_DIR})
+ set(SQLite3_LIBRARIES ${SQLite3_LIBRARY})
+ if(NOT TARGET SQLite::SQLite3)
+ add_library(SQLite::SQLite3 UNKNOWN IMPORTED)
+ set_target_properties(SQLite::SQLite3 PROPERTIES
+ IMPORTED_LOCATION "${SQLite3_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}")
+ endif()
+endif()
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake
index 92c032f6a..fc0ed009d 100644
--- a/Modules/FindSWIG.cmake
+++ b/Modules/FindSWIG.cmake
@@ -1,29 +1,30 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindSWIG
-# --------
-#
-# Find SWIG
-#
-# This module finds an installed SWIG. It sets the following variables:
-#
-# ::
-#
-# SWIG_FOUND - set to true if SWIG is found
-# SWIG_DIR - the directory where swig is installed
-# SWIG_EXECUTABLE - the path to the swig executable
-# SWIG_VERSION - the version number of the swig executable
-#
-#
-#
-# The minimum required version of SWIG can be specified using the
-# standard syntax, e.g. find_package(SWIG 1.1)
-#
-# All information is collected from the SWIG_EXECUTABLE so the version
-# to be found can be changed from the command line by means of setting
-# SWIG_EXECUTABLE
+#[=======================================================================[.rst:
+FindSWIG
+--------
+
+Find SWIG
+
+This module finds an installed SWIG. It sets the following variables:
+
+::
+
+ SWIG_FOUND - set to true if SWIG is found
+ SWIG_DIR - the directory where swig is installed
+ SWIG_EXECUTABLE - the path to the swig executable
+ SWIG_VERSION - the version number of the swig executable
+
+
+
+The minimum required version of SWIG can be specified using the
+standard syntax, e.g. find_package(SWIG 1.1)
+
+All information is collected from the SWIG_EXECUTABLE so the version
+to be found can be changed from the command line by means of setting
+SWIG_EXECUTABLE
+#]=======================================================================]
find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig)
diff --git a/Modules/FindSelfPackers.cmake b/Modules/FindSelfPackers.cmake
index ac2c7cf88..1abbcbd7a 100644
--- a/Modules/FindSelfPackers.cmake
+++ b/Modules/FindSelfPackers.cmake
@@ -1,19 +1,20 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindSelfPackers
-# ---------------
-#
-# Find upx
-#
-# This module looks for some executable packers (i.e. software that
-# compress executables or shared libs into on-the-fly self-extracting
-# executables or shared libs. Examples:
-#
-# ::
-#
-# UPX: http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
+#[=======================================================================[.rst:
+FindSelfPackers
+---------------
+
+Find upx
+
+This module looks for some executable packers (i.e. software that
+compress executables or shared libs into on-the-fly self-extracting
+executables or shared libs. Examples:
+
+::
+
+ UPX: http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index d1ce2002a..7d495059a 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -1,123 +1,124 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindSquish
-# ----------
-#
-# -- Typical Use
-#
-#
-#
-# This module can be used to find Squish. Currently Squish versions 3
-# and 4 are supported.
-#
-# ::
-#
-# SQUISH_FOUND If false, don't try to use Squish
-# SQUISH_VERSION The full version of Squish found
-# SQUISH_VERSION_MAJOR The major version of Squish found
-# SQUISH_VERSION_MINOR The minor version of Squish found
-# SQUISH_VERSION_PATCH The patch version of Squish found
-#
-#
-#
-# ::
-#
-# SQUISH_INSTALL_DIR The Squish installation directory
-# (containing bin, lib, etc)
-# SQUISH_SERVER_EXECUTABLE The squishserver executable
-# SQUISH_CLIENT_EXECUTABLE The squishrunner executable
-#
-#
-#
-# ::
-#
-# SQUISH_INSTALL_DIR_FOUND Was the install directory found?
-# SQUISH_SERVER_EXECUTABLE_FOUND Was the server executable found?
-# SQUISH_CLIENT_EXECUTABLE_FOUND Was the client executable found?
-#
-#
-#
-# It provides the function squish_v4_add_test() for adding a squish test
-# to cmake using Squish 4.x:
-#
-# ::
-#
-# squish_v4_add_test(cmakeTestName
-# AUT targetName SUITE suiteName TEST squishTestName
-# [SETTINGSGROUP group] [PRE_COMMAND command] [POST_COMMAND command] )
-#
-#
-#
-# The arguments have the following meaning:
-#
-# ``cmakeTestName``
-# this will be used as the first argument for add_test()
-# ``AUT targetName``
-# the name of the cmake target which will be used as AUT, i.e. the
-# executable which will be tested.
-# ``SUITE suiteName``
-# this is either the full path to the squish suite, or just the
-# last directory of the suite, i.e. the suite name. In this case
-# the CMakeLists.txt which calls squish_add_test() must be located
-# in the parent directory of the suite directory.
-# ``TEST squishTestName``
-# the name of the squish test, i.e. the name of the subdirectory
-# of the test inside the suite directory.
-# ``SETTINGSGROUP group``
-# if specified, the given settings group will be used for executing the test.
-# If not specified, the groupname will be "CTest_<username>"
-# ``PRE_COMMAND command``
-# if specified, the given command will be executed before starting the squish test.
-# ``POST_COMMAND command``
-# same as PRE_COMMAND, but after the squish test has been executed.
-#
-#
-#
-# ::
-#
-# enable_testing()
-# find_package(Squish 4.0)
-# if (SQUISH_FOUND)
-# squish_v4_add_test(myTestName
-# AUT myApp
-# SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite
-# TEST someSquishTest
-# SETTINGSGROUP myGroup
-# )
-# endif ()
-#
-#
-#
-#
-#
-# For users of Squish version 3.x the macro squish_v3_add_test() is
-# provided:
-#
-# ::
-#
-# squish_v3_add_test(testName applicationUnderTest testCase envVars testWrapper)
-# Use this macro to add a test using Squish 3.x.
-#
-#
-#
-# ::
-#
-# enable_testing()
-# find_package(Squish)
-# if (SQUISH_FOUND)
-# squish_v3_add_test(myTestName myApplication testCase envVars testWrapper)
-# endif ()
-#
-#
-#
-# macro SQUISH_ADD_TEST(testName applicationUnderTest testCase envVars
-# testWrapper)
-#
-# ::
-#
-# This is deprecated. Use SQUISH_V3_ADD_TEST() if you are using Squish 3.x instead.
+#[=======================================================================[.rst:
+FindSquish
+----------
+
+-- Typical Use
+
+
+
+This module can be used to find Squish. Currently Squish versions 3
+and 4 are supported.
+
+::
+
+ SQUISH_FOUND If false, don't try to use Squish
+ SQUISH_VERSION The full version of Squish found
+ SQUISH_VERSION_MAJOR The major version of Squish found
+ SQUISH_VERSION_MINOR The minor version of Squish found
+ SQUISH_VERSION_PATCH The patch version of Squish found
+
+
+
+::
+
+ SQUISH_INSTALL_DIR The Squish installation directory
+ (containing bin, lib, etc)
+ SQUISH_SERVER_EXECUTABLE The squishserver executable
+ SQUISH_CLIENT_EXECUTABLE The squishrunner executable
+
+
+
+::
+
+ SQUISH_INSTALL_DIR_FOUND Was the install directory found?
+ SQUISH_SERVER_EXECUTABLE_FOUND Was the server executable found?
+ SQUISH_CLIENT_EXECUTABLE_FOUND Was the client executable found?
+
+
+
+It provides the function squish_v4_add_test() for adding a squish test
+to cmake using Squish 4.x:
+
+::
+
+ squish_v4_add_test(cmakeTestName
+ AUT targetName SUITE suiteName TEST squishTestName
+ [SETTINGSGROUP group] [PRE_COMMAND command] [POST_COMMAND command] )
+
+
+
+The arguments have the following meaning:
+
+``cmakeTestName``
+ this will be used as the first argument for add_test()
+``AUT targetName``
+ the name of the cmake target which will be used as AUT, i.e. the
+ executable which will be tested.
+``SUITE suiteName``
+ this is either the full path to the squish suite, or just the
+ last directory of the suite, i.e. the suite name. In this case
+ the CMakeLists.txt which calls squish_add_test() must be located
+ in the parent directory of the suite directory.
+``TEST squishTestName``
+ the name of the squish test, i.e. the name of the subdirectory
+ of the test inside the suite directory.
+``SETTINGSGROUP group``
+ if specified, the given settings group will be used for executing the test.
+ If not specified, the groupname will be "CTest_<username>"
+``PRE_COMMAND command``
+ if specified, the given command will be executed before starting the squish test.
+``POST_COMMAND command``
+ same as PRE_COMMAND, but after the squish test has been executed.
+
+
+
+::
+
+ enable_testing()
+ find_package(Squish 4.0)
+ if (SQUISH_FOUND)
+ squish_v4_add_test(myTestName
+ AUT myApp
+ SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite
+ TEST someSquishTest
+ SETTINGSGROUP myGroup
+ )
+ endif ()
+
+
+
+
+
+For users of Squish version 3.x the macro squish_v3_add_test() is
+provided:
+
+::
+
+ squish_v3_add_test(testName applicationUnderTest testCase envVars testWrapper)
+ Use this macro to add a test using Squish 3.x.
+
+
+
+::
+
+ enable_testing()
+ find_package(Squish)
+ if (SQUISH_FOUND)
+ squish_v3_add_test(myTestName myApplication testCase envVars testWrapper)
+ endif ()
+
+
+
+macro SQUISH_ADD_TEST(testName applicationUnderTest testCase envVars
+testWrapper)
+
+::
+
+ This is deprecated. Use SQUISH_V3_ADD_TEST() if you are using Squish 3.x instead.
+#]=======================================================================]
set(SQUISH_INSTALL_DIR_STRING "Directory containing the bin, doc, and lib directories for Squish; this should be the root of the installation directory.")
set(SQUISH_SERVER_EXECUTABLE_STRING "The squishserver executable program.")
diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake
index e18ae880f..ce280e277 100644
--- a/Modules/FindSubversion.cmake
+++ b/Modules/FindSubversion.cmake
@@ -1,68 +1,69 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindSubversion
-# --------------
-#
-# Extract information from a subversion working copy
-#
-# The module defines the following variables:
-#
-# ::
-#
-# Subversion_SVN_EXECUTABLE - path to svn command line client
-# Subversion_VERSION_SVN - version of svn command line client
-# Subversion_FOUND - true if the command line client was found
-# SUBVERSION_FOUND - same as Subversion_FOUND, set for compatibility reasons
-#
-#
-#
-# The minimum required version of Subversion can be specified using the
-# standard syntax, e.g. ``find_package(Subversion 1.4)``.
-#
-# If the command line client executable is found two macros are defined:
-#
-# ::
-#
-# Subversion_WC_INFO(<dir> <var-prefix> [IGNORE_SVN_FAILURE])
-# Subversion_WC_LOG(<dir> <var-prefix>)
-#
-# ``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.
-#
-# ::
-#
-# <var-prefix>_WC_URL - url of the repository (at <dir>)
-# <var-prefix>_WC_ROOT - root url of the repository
-# <var-prefix>_WC_REVISION - current revision
-# <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit
-# <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
-# <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit
-# <var-prefix>_WC_INFO - output of command `svn info <dir>'
-#
-# ``Subversion_WC_LOG`` retrieves the log message of the base revision of a
-# subversion working copy at a given location. This macro defines the variable:
-#
-# ::
-#
-# <var-prefix>_LAST_CHANGED_LOG - last log of base revision
-#
-# Example usage:
-#
-# ::
-#
-# find_package(Subversion)
-# if(SUBVERSION_FOUND)
-# Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
-# message("Current revision is ${Project_WC_REVISION}")
-# Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
-# message("Last changed log is ${Project_LAST_CHANGED_LOG}")
-# endif()
+#[=======================================================================[.rst:
+FindSubversion
+--------------
+
+Extract information from a subversion working copy
+
+The module defines the following variables:
+
+::
+
+ Subversion_SVN_EXECUTABLE - path to svn command line client
+ Subversion_VERSION_SVN - version of svn command line client
+ Subversion_FOUND - true if the command line client was found
+ SUBVERSION_FOUND - same as Subversion_FOUND, set for compatibility reasons
+
+
+
+The minimum required version of Subversion can be specified using the
+standard syntax, e.g. ``find_package(Subversion 1.4)``.
+
+If the command line client executable is found two macros are defined:
+
+::
+
+ Subversion_WC_INFO(<dir> <var-prefix> [IGNORE_SVN_FAILURE])
+ Subversion_WC_LOG(<dir> <var-prefix>)
+
+``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.
+
+::
+
+ <var-prefix>_WC_URL - url of the repository (at <dir>)
+ <var-prefix>_WC_ROOT - root url of the repository
+ <var-prefix>_WC_REVISION - current revision
+ <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit
+ <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
+ <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit
+ <var-prefix>_WC_INFO - output of command `svn info <dir>'
+
+``Subversion_WC_LOG`` retrieves the log message of the base revision of a
+subversion working copy at a given location. This macro defines the variable:
+
+::
+
+ <var-prefix>_LAST_CHANGED_LOG - last log of base revision
+
+Example usage:
+
+::
+
+ find_package(Subversion)
+ if(SUBVERSION_FOUND)
+ Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
+ message("Current revision is ${Project_WC_REVISION}")
+ Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
+ message("Last changed log is ${Project_LAST_CHANGED_LOG}")
+ endif()
+#]=======================================================================]
find_program(Subversion_SVN_EXECUTABLE svn
PATHS
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index ad16e0de1..be47c39a0 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -1,48 +1,49 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindTCL
-# -------
-#
-# TK_INTERNAL_PATH was removed.
-#
-# This module finds if Tcl is installed and determines where the include
-# files and libraries are. It also determines what the name of the
-# library is. This code sets the following variables:
-#
-# ::
-#
-# TCL_FOUND = Tcl was found
-# TK_FOUND = Tk was found
-# TCLTK_FOUND = Tcl and Tk were found
-# TCL_LIBRARY = path to Tcl library (tcl tcl80)
-# TCL_INCLUDE_PATH = path to where tcl.h can be found
-# TCL_TCLSH = path to tclsh binary (tcl tcl80)
-# TK_LIBRARY = path to Tk library (tk tk80 etc)
-# TK_INCLUDE_PATH = path to where tk.h can be found
-# TK_WISH = full path to the wish executable
-#
-#
-#
-# In an effort to remove some clutter and clear up some issues for
-# people who are not necessarily Tcl/Tk gurus/developers, some
-# variables were moved or removed. Changes compared to CMake 2.4 are:
-#
-# ::
-#
-# => they were only useful for people writing Tcl/Tk extensions.
-# => these libs are not packaged by default with Tcl/Tk distributions.
-# Even when Tcl/Tk is built from source, several flavors of debug libs
-# are created and there is no real reason to pick a single one
-# specifically (say, amongst tcl84g, tcl84gs, or tcl84sgx).
-# Let's leave that choice to the user by allowing him to assign
-# TCL_LIBRARY to any Tcl library, debug or not.
-# => this ended up being only a Win32 variable, and there is a lot of
-# confusion regarding the location of this file in an installed Tcl/Tk
-# tree anyway (see 8.5 for example). If you need the internal path at
-# this point it is safer you ask directly where the *source* tree is
-# and dig from there.
+#[=======================================================================[.rst:
+FindTCL
+-------
+
+TK_INTERNAL_PATH was removed.
+
+This module finds if Tcl is installed and determines where the include
+files and libraries are. It also determines what the name of the
+library is. This code sets the following variables:
+
+::
+
+ TCL_FOUND = Tcl was found
+ TK_FOUND = Tk was found
+ TCLTK_FOUND = Tcl and Tk were found
+ TCL_LIBRARY = path to Tcl library (tcl tcl80)
+ TCL_INCLUDE_PATH = path to where tcl.h can be found
+ TCL_TCLSH = path to tclsh binary (tcl tcl80)
+ TK_LIBRARY = path to Tk library (tk tk80 etc)
+ TK_INCLUDE_PATH = path to where tk.h can be found
+ TK_WISH = full path to the wish executable
+
+
+
+In an effort to remove some clutter and clear up some issues for
+people who are not necessarily Tcl/Tk gurus/developers, some
+variables were moved or removed. Changes compared to CMake 2.4 are:
+
+::
+
+ => they were only useful for people writing Tcl/Tk extensions.
+ => these libs are not packaged by default with Tcl/Tk distributions.
+ Even when Tcl/Tk is built from source, several flavors of debug libs
+ are created and there is no real reason to pick a single one
+ specifically (say, amongst tcl84g, tcl84gs, or tcl84sgx).
+ Let's leave that choice to the user by allowing him to assign
+ TCL_LIBRARY to any Tcl library, debug or not.
+ => this ended up being only a Win32 variable, and there is a lot of
+ confusion regarding the location of this file in an installed Tcl/Tk
+ tree anyway (see 8.5 for example). If you need the internal path at
+ this point it is safer you ask directly where the *source* tree is
+ and dig from there.
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/FindTclsh.cmake)
diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
index b622ca61c..63ca936c4 100644
--- a/Modules/FindTIFF.cmake
+++ b/Modules/FindTIFF.cmake
@@ -1,43 +1,44 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindTIFF
-# --------
-#
-# Find the TIFF library (libtiff).
-#
-# Imported targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following :prop_tgt:`IMPORTED` targets:
-#
-# ``TIFF::TIFF``
-# The TIFF library, if found.
-#
-# Result variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project:
-#
-# ``TIFF_FOUND``
-# true if the TIFF headers and libraries were found
-# ``TIFF_INCLUDE_DIR``
-# the directory containing the TIFF headers
-# ``TIFF_INCLUDE_DIRS``
-# the directory containing the TIFF headers
-# ``TIFF_LIBRARIES``
-# TIFF libraries to be linked
-#
-# Cache variables
-# ^^^^^^^^^^^^^^^
-#
-# The following cache variables may also be set:
-#
-# ``TIFF_INCLUDE_DIR``
-# the directory containing the TIFF headers
-# ``TIFF_LIBRARY``
-# the path to the TIFF library
+#[=======================================================================[.rst:
+FindTIFF
+--------
+
+Find the TIFF library (libtiff).
+
+Imported targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` targets:
+
+``TIFF::TIFF``
+ The TIFF library, if found.
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``TIFF_FOUND``
+ true if the TIFF headers and libraries were found
+``TIFF_INCLUDE_DIR``
+ the directory containing the TIFF headers
+``TIFF_INCLUDE_DIRS``
+ the directory containing the TIFF headers
+``TIFF_LIBRARIES``
+ TIFF libraries to be linked
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``TIFF_INCLUDE_DIR``
+ the directory containing the TIFF headers
+``TIFF_LIBRARY``
+ the path to the TIFF library
+#]=======================================================================]
find_path(TIFF_INCLUDE_DIR tiff.h)
diff --git a/Modules/FindTclStub.cmake b/Modules/FindTclStub.cmake
index db0a7a176..8f634809e 100644
--- a/Modules/FindTclStub.cmake
+++ b/Modules/FindTclStub.cmake
@@ -1,48 +1,49 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindTclStub
-# -----------
-#
-# TCL_STUB_LIBRARY_DEBUG and TK_STUB_LIBRARY_DEBUG were removed.
-#
-# This module finds Tcl stub libraries. It first finds Tcl include
-# files and libraries by calling FindTCL.cmake. How to Use the Tcl
-# Stubs Library:
-#
-# ::
-#
-# http://tcl.activestate.com/doc/howto/stubs.html
-#
-# Using Stub Libraries:
-#
-# ::
-#
-# http://safari.oreilly.com/0130385603/ch48lev1sec3
-#
-# This code sets the following variables:
-#
-# ::
-#
-# TCL_STUB_LIBRARY = path to Tcl stub library
-# TK_STUB_LIBRARY = path to Tk stub library
-# TTK_STUB_LIBRARY = path to ttk stub library
-#
-#
-#
-# In an effort to remove some clutter and clear up some issues for
-# people who are not necessarily Tcl/Tk gurus/developers, some
-# variables were moved or removed. Changes compared to CMake 2.4 are:
-#
-# ::
-#
-# => these libs are not packaged by default with Tcl/Tk distributions.
-# Even when Tcl/Tk is built from source, several flavors of debug libs
-# are created and there is no real reason to pick a single one
-# specifically (say, amongst tclstub84g, tclstub84gs, or tclstub84sgx).
-# Let's leave that choice to the user by allowing him to assign
-# TCL_STUB_LIBRARY to any Tcl library, debug or not.
+#[=======================================================================[.rst:
+FindTclStub
+-----------
+
+TCL_STUB_LIBRARY_DEBUG and TK_STUB_LIBRARY_DEBUG were removed.
+
+This module finds Tcl stub libraries. It first finds Tcl include
+files and libraries by calling FindTCL.cmake. How to Use the Tcl
+Stubs Library:
+
+::
+
+ http://tcl.activestate.com/doc/howto/stubs.html
+
+Using Stub Libraries:
+
+::
+
+ http://safari.oreilly.com/0130385603/ch48lev1sec3
+
+This code sets the following variables:
+
+::
+
+ TCL_STUB_LIBRARY = path to Tcl stub library
+ TK_STUB_LIBRARY = path to Tk stub library
+ TTK_STUB_LIBRARY = path to ttk stub library
+
+
+
+In an effort to remove some clutter and clear up some issues for
+people who are not necessarily Tcl/Tk gurus/developers, some
+variables were moved or removed. Changes compared to CMake 2.4 are:
+
+::
+
+ => these libs are not packaged by default with Tcl/Tk distributions.
+ Even when Tcl/Tk is built from source, several flavors of debug libs
+ are created and there is no real reason to pick a single one
+ specifically (say, amongst tclstub84g, tclstub84gs, or tclstub84sgx).
+ Let's leave that choice to the user by allowing him to assign
+ TCL_STUB_LIBRARY to any Tcl library, debug or not.
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindTCL.cmake)
diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake
index 9bf935d8e..e3bd11040 100644
--- a/Modules/FindTclsh.cmake
+++ b/Modules/FindTclsh.cmake
@@ -1,23 +1,24 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindTclsh
-# ---------
-#
-# Find tclsh
-#
-# This module finds if TCL is installed and determines where the include
-# files and libraries are. It also determines what the name of the
-# library is. This code sets the following variables:
-#
-# ::
-#
-# TCLSH_FOUND = TRUE if tclsh has been found
-# TCL_TCLSH = the path to the tclsh executable
-#
-# In cygwin, look for the cygwin version first. Don't look for it later
-# to avoid finding the cygwin version on a Win32 build.
+#[=======================================================================[.rst:
+FindTclsh
+---------
+
+Find tclsh
+
+This module finds if TCL is installed and determines where the include
+files and libraries are. It also determines what the name of the
+library is. This code sets the following variables:
+
+::
+
+ TCLSH_FOUND = TRUE if tclsh has been found
+ TCL_TCLSH = the path to the tclsh executable
+
+In cygwin, look for the cygwin version first. Don't look for it later
+to avoid finding the cygwin version on a Win32 build.
+#]=======================================================================]
if(CYGWIN)
find_program(TCL_TCLSH NAMES cygtclsh83 cygtclsh80)
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 75e83ea4a..919392ab9 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -1,44 +1,41 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindThreads
-# -----------
-#
-# This module determines the thread library of the system.
-#
-# The following variables are set
-#
-# ::
-#
-# CMAKE_THREAD_LIBS_INIT - the thread library
-# CMAKE_USE_SPROC_INIT - are we using sproc?
-# CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
-# CMAKE_USE_PTHREADS_INIT - are we using pthreads
-# CMAKE_HP_PTHREADS_INIT - are we using hp pthreads
-#
-# The following import target is created
-#
-# ::
-#
-# Threads::Threads
-#
-# For systems with multiple thread libraries, caller can set
-#
-# ::
-#
-# CMAKE_THREAD_PREFER_PTHREAD
-#
-# If the use of the -pthread compiler and linker flag is preferred then the
-# caller can set
-#
-# ::
-#
-# THREADS_PREFER_PTHREAD_FLAG
-#
-# Please note that the compiler flag can only be used with the imported
-# target. Use of both the imported target as well as this switch is highly
-# recommended for new code.
+#[=======================================================================[.rst:
+FindThreads
+-----------
+
+This module determines the thread library of the system.
+
+The following variables are set
+
+::
+
+ CMAKE_THREAD_LIBS_INIT - the thread library
+ CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
+ CMAKE_USE_PTHREADS_INIT - are we using pthreads
+ CMAKE_HP_PTHREADS_INIT - are we using hp pthreads
+
+The following import target is created
+
+::
+
+ Threads::Threads
+
+If the use of the -pthread compiler and linker flag is preferred then the
+caller can set
+
+::
+
+ THREADS_PREFER_PTHREAD_FLAG
+
+The compiler flag can only be used with the imported
+target. Use of both the imported target as well as this switch is highly
+recommended for new code.
+
+This module is not needed for C++11 and later if threading is done using
+``std::thread`` from the standard library.
+#]=======================================================================]
include (CheckLibraryExists)
include (CheckSymbolExists)
@@ -54,12 +51,6 @@ else()
message(FATAL_ERROR "FindThreads only works if either C or CXX language is enabled")
endif()
-# Do we have sproc?
-if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
- include (CheckIncludeFiles)
- CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H)
-endif()
-
# Internal helper macro.
# Do NOT even think about using it outside of this file!
macro(_check_threads_lib LIBNAME FUNCNAME VARNAME)
@@ -112,50 +103,45 @@ macro(_check_pthreads_flag)
endif()
endmacro()
-if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD)
- # We have sproc
- set(CMAKE_USE_SPROC_INIT 1)
+# Do we have pthreads?
+if(CMAKE_C_COMPILER_LOADED)
+ CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H)
else()
- # Do we have pthreads?
- if(CMAKE_C_COMPILER_LOADED)
- CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H)
- else()
- CHECK_INCLUDE_FILE_CXX("pthread.h" CMAKE_HAVE_PTHREAD_H)
- endif()
- if(CMAKE_HAVE_PTHREAD_H)
-
- #
- # We have pthread.h
- # Let's check for the library now.
- #
- set(CMAKE_HAVE_THREADS_LIBRARY)
- if(NOT THREADS_HAVE_PTHREAD_ARG)
- # Check if pthread functions are in normal C library
- CHECK_SYMBOL_EXISTS(pthread_create pthread.h CMAKE_HAVE_LIBC_CREATE)
- if(CMAKE_HAVE_LIBC_CREATE)
- set(CMAKE_THREAD_LIBS_INIT "")
- set(CMAKE_HAVE_THREADS_LIBRARY 1)
- set(Threads_FOUND TRUE)
- else()
-
- # Check for -pthread first if enabled. This is the recommended
- # way, but not backwards compatible as one must also pass -pthread
- # as compiler flag then.
- if (THREADS_PREFER_PTHREAD_FLAG)
- _check_pthreads_flag()
- endif ()
-
- _check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE)
- _check_threads_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE)
- if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
- # On sun also check for -lthread
- _check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE)
- endif()
+ CHECK_INCLUDE_FILE_CXX("pthread.h" CMAKE_HAVE_PTHREAD_H)
+endif()
+if(CMAKE_HAVE_PTHREAD_H)
+
+ #
+ # We have pthread.h
+ # Let's check for the library now.
+ #
+ set(CMAKE_HAVE_THREADS_LIBRARY)
+ if(NOT THREADS_HAVE_PTHREAD_ARG)
+ # Check if pthread functions are in normal C library.
+ CHECK_SYMBOL_EXISTS(pthread_create pthread.h CMAKE_HAVE_LIBC_CREATE)
+ if(CMAKE_HAVE_LIBC_CREATE)
+ set(CMAKE_THREAD_LIBS_INIT "")
+ set(CMAKE_HAVE_THREADS_LIBRARY 1)
+ set(Threads_FOUND TRUE)
+ else()
+
+ # Check for -pthread first if enabled. This is the recommended
+ # way, but not backwards compatible as one must also pass -pthread
+ # as compiler flag then.
+ if (THREADS_PREFER_PTHREAD_FLAG)
+ _check_pthreads_flag()
+ endif ()
+
+ _check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE)
+ _check_threads_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE)
+ if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ # On sun also check for -lthread
+ _check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE)
endif()
endif()
-
- _check_pthreads_flag()
endif()
+
+ _check_pthreads_flag()
endif()
if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE)
diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake
index 45047a949..3a735f79b 100644
--- a/Modules/FindUnixCommands.cmake
+++ b/Modules/FindUnixCommands.cmake
@@ -1,14 +1,15 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindUnixCommands
-# ----------------
-#
-# Find Unix commands, including the ones from Cygwin
-#
-# This module looks for the Unix commands bash, cp, gzip, mv, rm, and tar
-# and stores the result in the variables BASH, CP, GZIP, MV, RM, and TAR.
+#[=======================================================================[.rst:
+FindUnixCommands
+----------------
+
+Find Unix commands, including the ones from Cygwin
+
+This module looks for the Unix commands bash, cp, gzip, mv, rm, and tar
+and stores the result in the variables BASH, CP, GZIP, MV, RM, and TAR.
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake
index 4c60ed7da..b1201b4ef 100644
--- a/Modules/FindVulkan.cmake
+++ b/Modules/FindVulkan.cmake
@@ -1,32 +1,33 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindVulkan
-# ----------
-#
-# Try to find Vulkan
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if
-# Vulkan has been found.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following variables::
-#
-# Vulkan_FOUND - True if Vulkan was found
-# Vulkan_INCLUDE_DIRS - include directories for Vulkan
-# Vulkan_LIBRARIES - link against this library to use Vulkan
-#
-# The module will also define two cache variables::
-#
-# Vulkan_INCLUDE_DIR - the Vulkan include directory
-# Vulkan_LIBRARY - the path to the Vulkan library
-#
+#[=======================================================================[.rst:
+FindVulkan
+----------
+
+Try to find Vulkan
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if
+Vulkan has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables::
+
+ Vulkan_FOUND - True if Vulkan was found
+ Vulkan_INCLUDE_DIRS - include directories for Vulkan
+ Vulkan_LIBRARIES - link against this library to use Vulkan
+
+The module will also define two cache variables::
+
+ Vulkan_INCLUDE_DIR - the Vulkan include directory
+ Vulkan_LIBRARY - the path to the Vulkan library
+
+#]=======================================================================]
if(WIN32)
find_path(Vulkan_INCLUDE_DIR
diff --git a/Modules/FindWget.cmake b/Modules/FindWget.cmake
index 4fcb2fa37..bd01ec201 100644
--- a/Modules/FindWget.cmake
+++ b/Modules/FindWget.cmake
@@ -1,18 +1,19 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindWget
-# --------
-#
-# Find wget
-#
-# This module looks for wget. This module defines the following values:
-#
-# ::
-#
-# WGET_EXECUTABLE: the full path to the wget tool.
-# WGET_FOUND: True if wget has been found.
+#[=======================================================================[.rst:
+FindWget
+--------
+
+Find wget
+
+This module looks for wget. This module defines the following values:
+
+::
+
+ WGET_EXECUTABLE: the full path to the wget tool.
+ WGET_FOUND: True if wget has been found.
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
diff --git a/Modules/FindWish.cmake b/Modules/FindWish.cmake
index b64b04138..b332bde9b 100644
--- a/Modules/FindWish.cmake
+++ b/Modules/FindWish.cmake
@@ -1,23 +1,24 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindWish
-# --------
-#
-# Find wish installation
-#
-# This module finds if TCL is installed and determines where the include
-# files and libraries are. It also determines what the name of the
-# library is. This code sets the following variables:
-#
-# ::
-#
-# TK_WISH = the path to the wish executable
-#
-#
-#
-# if UNIX is defined, then it will look for the cygwin version first
+#[=======================================================================[.rst:
+FindWish
+--------
+
+Find wish installation
+
+This module finds if TCL is installed and determines where the include
+files and libraries are. It also determines what the name of the
+library is. This code sets the following variables:
+
+::
+
+ TK_WISH = the path to the wish executable
+
+
+
+if UNIX is defined, then it will look for the cygwin version first
+#]=======================================================================]
if(UNIX)
find_program(TK_WISH cygwish80 )
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index f7dfc8257..b28dd125d 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -1,58 +1,59 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindX11
-# -------
-#
-# Find X11 installation
-#
-# Try to find X11 on UNIX systems. The following values are defined
-#
-# ::
-#
-# X11_FOUND - True if X11 is available
-# X11_INCLUDE_DIR - include directories to use X11
-# X11_LIBRARIES - link against these to use X11
-#
-# and also the following more fine grained variables:
-#
-# ::
-#
-# X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND
-# X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND
-# X11_X11_INCLUDE_PATH, X11_X11_LIB
-# X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND
-# X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND
-# X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND
-# X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND
-# X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND
-# X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND
-# X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND
-# X11_Xext_LIB, X11_Xext_FOUND
-# X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND
-# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND
-# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND
-# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND
-# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND
-# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND
-# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND
-# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND
-# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND
-# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND
-# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND
-# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND
-# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND
-# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND
-# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND
-# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND
-# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND
-# X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND
-# X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND
-# X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND
-# X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND
-# X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND
-# X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND
+#[=======================================================================[.rst:
+FindX11
+-------
+
+Find X11 installation
+
+Try to find X11 on UNIX systems. The following values are defined
+
+::
+
+ X11_FOUND - True if X11 is available
+ X11_INCLUDE_DIR - include directories to use X11
+ X11_LIBRARIES - link against these to use X11
+
+and also the following more fine grained variables and targets:
+
+::
+
+ X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND, X11::ICE
+ X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND, X11::SM
+ X11_X11_INCLUDE_PATH, X11_X11_LIB, X11::X11
+ X11_Xaccessrules_INCLUDE_PATH,
+ X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND
+ X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND, X11::Xau
+ X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND, X11::Xcomposite
+ X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND, X11::Xcursor
+ X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND, X11::Xdamage
+ X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND, X11::Xdmcp
+ X11_Xext_INCLUDE_PATH, X11_Xext_LIB, X11_Xext_FOUND, X11::Xext
+ X11_Xxf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_Xxf86misc_FOUND, X11::Xxf86misc
+ X11_Xxf86vm_INCLUDE_PATH, X11_Xxf86vm_LIB X11_Xxf86vm_FOUND, X11::Xxf86vm
+ X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND, X11::Xfixes
+ X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND, X11::Xft
+ X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND, X11::Xi
+ X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND, X11::Xinerama
+ X11_Xkb_INCLUDE_PATH,
+ X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND, X11::Xkb
+ X11_xkbfile_INCLUDE_PATH, X11_xkbfile_LIB, X11_xkbfile_FOUND, X11::xkbfile
+ X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND, X11::Xmu
+ X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND, X11::Xpm
+ X11_Xtst_INCLUDE_PATH, X11_Xtst_LIB, X11_Xtst_FOUND, X11::Xtst
+ X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND, X11::Xrandr
+ X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND, X11::Xrender
+ X11_XRes_INCLUDE_PATH, X11_XRes_LIB, X11_XRes_FOUND, X11::XRes
+ X11_Xss_INCLUDE_PATH, X11_Xss_LIB, X11_Xss_FOUND, X11::Xss
+ X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND, X11::Xt
+ X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND, X11::Xutil
+ X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND, X11::Xv
+ X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND
+ X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND
+ X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND
+ X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND
+#]=======================================================================]
if (UNIX)
set(X11_FOUND 0)
@@ -97,31 +98,38 @@ if (UNIX)
find_path(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH})
+ find_path(X11_Xext_INCLUDE_PATH X11/extensions/Xext.h ${X11_INC_SEARCH_PATH})
find_path(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH})
- find_path(X11_xf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH})
- find_path(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH})
+ find_path(X11_Xxf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH})
+ find_path(X11_Xxf86vm_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xi_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH})
- find_path(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH})
- find_path(X11_Xkbfile_INCLUDE_PATH X11/extensions/XKBfile.h ${X11_INC_SEARCH_PATH})
+ find_path(X11_xkbfile_INCLUDE_PATH X11/extensions/XKBfile.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xmu_INCLUDE_PATH X11/Xmu/Xmu.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH})
- find_path(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH})
+ find_path(X11_Xtst_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH})
find_path(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH})
find_path(X11_XRes_INCLUDE_PATH X11/extensions/XRes.h ${X11_INC_SEARCH_PATH})
- find_path(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH})
+ find_path(X11_Xss_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xt_INCLUDE_PATH X11/Intrinsic.h ${X11_INC_SEARCH_PATH})
find_path(X11_Xv_INCLUDE_PATH X11/extensions/Xvlib.h ${X11_INC_SEARCH_PATH})
find_path(X11_XSync_INCLUDE_PATH X11/extensions/sync.h ${X11_INC_SEARCH_PATH})
+ # Backwards compatibility.
+ set(X11_Xinput_INCLUDE_PATH "${X11_Xi_INCLUDE_PATH}")
+ set(X11_xf86misc_INCLUDE_PATH "${X11_Xxf86misc_INCLUDE_PATH}")
+ set(X11_xf86vmode_INCLUDE_PATH "${X11_Xxf8vm_INCLUDE_PATH}")
+ set(X11_Xkbfile_INCLUDE_PATH "${X11_xkbfile_INCLUDE_PATH}")
+ set(X11_XTest_INCLUDE_PATH "${X11_Xtst_INCLUDE_PATH}")
+ set(X11_Xscreensaver_INCLUDE_PATH "${X11_Xss_INCLUDE_PATH}")
find_library(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH})
@@ -138,20 +146,25 @@ if (UNIX)
find_library(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH})
find_library(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH})
find_library(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH})
- find_library(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH})
- find_library(X11_Xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH})
+ find_library(X11_xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH})
find_library(X11_Xmu_LIB Xmu ${X11_LIB_SEARCH_PATH})
find_library(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH})
find_library(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH})
find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
find_library(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH})
- find_library(X11_Xscreensaver_LIB Xss ${X11_LIB_SEARCH_PATH})
+ find_library(X11_Xss_LIB Xss ${X11_LIB_SEARCH_PATH})
find_library(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH})
- find_library(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH})
+ find_library(X11_Xtst_LIB Xtst ${X11_LIB_SEARCH_PATH})
find_library(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH})
find_library(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH})
find_library(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH})
+ # Backwards compatibility.
+ set(X11_Xinput_LIB "${X11_Xi_LIB}")
+ set(X11_Xkbfile_LIB "${X11_xkbfile_LIB}")
+ set(X11_XTest_LIB "${X11_Xtst_LIB}")
+ set(X11_Xscreensaver_LIB "${X11_Xss_LIB}")
+
set(X11_LIBRARY_DIR "")
if(X11_X11_LIB)
get_filename_component(X11_LIBRARY_DIR ${X11_X11_LIB} PATH)
@@ -159,31 +172,31 @@ if (UNIX)
set(X11_INCLUDE_DIR) # start with empty list
if(X11_X11_INCLUDE_PATH)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_X11_INCLUDE_PATH})
endif()
if(X11_Xlib_INCLUDE_PATH)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xlib_INCLUDE_PATH})
endif()
if(X11_Xutil_INCLUDE_PATH)
set(X11_Xutil_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xutil_INCLUDE_PATH})
endif()
if(X11_Xshape_INCLUDE_PATH)
set(X11_Xshape_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xshape_INCLUDE_PATH})
endif()
set(X11_LIBRARIES) # start with empty list
if(X11_X11_LIB)
- set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB})
+ list(APPEND X11_LIBRARIES ${X11_X11_LIB})
endif()
if(X11_Xext_LIB)
set(X11_Xext_FOUND TRUE)
- set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB})
+ list(APPEND X11_LIBRARIES ${X11_Xext_LIB})
endif()
if(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH)
@@ -191,13 +204,17 @@ if (UNIX)
endif()
if(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH)
- set(X11_Xft_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xft_INCLUDE_PATH})
+ find_package(Freetype QUIET)
+ find_package(Fontconfig QUIET)
+ if (FREETYPE_FOUND AND Fontconfig_FOUND)
+ set(X11_Xft_FOUND TRUE)
+ endif ()
+ list(APPEND X11_INCLUDE_DIR ${X11_Xft_INCLUDE_PATH})
endif()
if(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH)
set(X11_Xv_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xv_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xv_INCLUDE_PATH})
endif()
if (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH)
@@ -206,118 +223,124 @@ if (UNIX)
if (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB)
set(X11_Xdmcp_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdmcp_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xdmcp_INCLUDE_PATH})
endif ()
if (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH)
set(X11_Xaccess_FOUND TRUE)
set(X11_Xaccess_INCLUDE_PATH ${X11_Xaccessstr_INCLUDE_PATH})
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xaccess_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xaccess_INCLUDE_PATH})
endif ()
if (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB)
set(X11_Xpm_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xpm_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xpm_INCLUDE_PATH})
endif ()
if (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB)
set(X11_Xcomposite_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcomposite_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xcomposite_INCLUDE_PATH})
endif ()
if (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB)
set(X11_Xdamage_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdamage_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xdamage_INCLUDE_PATH})
endif ()
if (X11_XShm_INCLUDE_PATH)
set(X11_XShm_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XShm_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_XShm_INCLUDE_PATH})
endif ()
- if (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB)
+ if (X11_Xtst_INCLUDE_PATH AND X11_Xtst_LIB)
+ set(X11_Xtst_FOUND TRUE)
+ # Backwards compatibility.
set(X11_XTest_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xtst_INCLUDE_PATH})
endif ()
if (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB)
set(X11_Xi_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xi_INCLUDE_PATH})
+ # Backwards compatibility.
+ set(X11_Xinput_FOUND TRUE)
+ list(APPEND X11_INCLUDE_DIR ${X11_Xi_INCLUDE_PATH})
endif ()
if (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB)
set(X11_Xinerama_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xinerama_INCLUDE_PATH})
endif ()
if (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB)
set(X11_Xfixes_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xfixes_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xfixes_INCLUDE_PATH})
endif ()
if (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB)
set(X11_Xrender_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xrender_INCLUDE_PATH})
endif ()
if (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB)
set(X11_XRes_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XRes_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_XRes_INCLUDE_PATH})
endif ()
if (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB)
set(X11_Xrandr_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xrandr_INCLUDE_PATH})
endif ()
- if (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB)
+ if (X11_Xxf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB)
+ set(X11_Xxf86misc_FOUND TRUE)
+ # Backwards compatibility.
set(X11_xf86misc_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xxf86misc_INCLUDE_PATH})
endif ()
- if (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB)
+ if (X11_Xxf86vm_INCLUDE_PATH AND X11_Xxf86vm_LIB)
+ set(X11_Xxf86vm_FOUND TRUE)
+ # Backwards compatibility.
set(X11_xf86vmode_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xxf86vm_INCLUDE_PATH})
endif ()
if (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB)
set(X11_Xcursor_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcursor_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xcursor_INCLUDE_PATH})
endif ()
- if (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB)
+ if (X11_Xss_INCLUDE_PATH AND X11_Xss_LIB)
+ set(X11_Xss_FOUND TRUE)
set(X11_Xscreensaver_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xscreensaver_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xss_INCLUDE_PATH})
endif ()
if (X11_dpms_INCLUDE_PATH)
set(X11_dpms_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_dpms_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_dpms_INCLUDE_PATH})
endif ()
if (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH)
set(X11_Xkb_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkb_INCLUDE_PATH} )
+ list(APPEND X11_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH} )
endif ()
- if (X11_Xkbfile_INCLUDE_PATH AND X11_Xkbfile_LIB AND X11_Xlib_INCLUDE_PATH)
+ if (X11_xkbfile_INCLUDE_PATH AND X11_xkbfile_LIB AND X11_Xlib_INCLUDE_PATH)
+ set(X11_xkbfile_FOUND TRUE)
+ # Backwards compatibility.
set(X11_Xkbfile_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkbfile_INCLUDE_PATH} )
+ list(APPEND X11_INCLUDE_DIR ${X11_xkbfile_INCLUDE_PATH} )
endif ()
if (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB)
set(X11_Xmu_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xmu_INCLUDE_PATH})
- endif ()
-
- if (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB)
- set(X11_Xinput_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_Xmu_INCLUDE_PATH})
endif ()
if (X11_XSync_INCLUDE_PATH)
set(X11_XSync_FOUND TRUE)
- set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XSync_INCLUDE_PATH})
+ list(APPEND X11_INCLUDE_DIR ${X11_XSync_INCLUDE_PATH})
endif ()
if(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH)
@@ -339,6 +362,11 @@ if (UNIX)
set(X11_FOUND 1)
endif ()
+ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+ find_package_handle_standard_args(X11
+ REQUIRED_VARS X11_X11_INCLUDE_PATH X11_X11_LIB
+ HANDLE_COMPONENTS)
+
if(X11_FOUND)
include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
@@ -351,69 +379,69 @@ if (UNIX)
set(X11_X_EXTRA_LIBS "")
# See if XOpenDisplay in X11 works by itself.
- CHECK_LIBRARY_EXISTS("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO)
+ check_library_exists("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO)
if(NOT X11_LIB_X11_SOLO)
# Find library needed for dnet_ntoa.
- CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA)
+ check_library_exists("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA)
if (X11_LIB_DNET_HAS_DNET_NTOA)
- set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet)
+ list(APPEND X11_X_EXTRA_LIBS -ldnet)
else ()
- CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA)
+ check_library_exists("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA)
if (X11_LIB_DNET_STUB_HAS_DNET_NTOA)
- set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub)
+ list(APPEND X11_X_EXTRA_LIBS -ldnet_stub)
endif ()
endif ()
endif()
# Find library needed for gethostbyname.
- CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME)
+ check_function_exists("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME)
if(NOT CMAKE_HAVE_GETHOSTBYNAME)
- CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
+ check_library_exists("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
if (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
- set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lnsl)
+ list(APPEND X11_X_EXTRA_LIBS -lnsl)
else ()
- CHECK_LIBRARY_EXISTS("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
+ check_library_exists("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
if (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
- set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd)
+ list(APPEND X11_X_EXTRA_LIBS -lbsd)
endif ()
endif ()
endif()
# Find library needed for connect.
- CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT)
+ check_function_exists("connect" CMAKE_HAVE_CONNECT)
if(NOT CMAKE_HAVE_CONNECT)
- CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT)
+ check_library_exists("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT)
if (CMAKE_LIB_SOCKET_HAS_CONNECT)
- set (X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS})
+ list(INSERT X11_X_EXTRA_LIBS 0 -lsocket)
endif ()
endif()
# Find library needed for remove.
- CHECK_FUNCTION_EXISTS("remove" CMAKE_HAVE_REMOVE)
+ check_function_exists("remove" CMAKE_HAVE_REMOVE)
if(NOT CMAKE_HAVE_REMOVE)
- CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE)
+ check_library_exists("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE)
if (CMAKE_LIB_POSIX_HAS_REMOVE)
- set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix)
+ list(APPEND X11_X_EXTRA_LIBS -lposix)
endif ()
endif()
# Find library needed for shmat.
- CHECK_FUNCTION_EXISTS("shmat" CMAKE_HAVE_SHMAT)
+ check_function_exists("shmat" CMAKE_HAVE_SHMAT)
if(NOT CMAKE_HAVE_SHMAT)
- CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT)
+ check_library_exists("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT)
if (CMAKE_LIB_IPS_HAS_SHMAT)
- set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc)
+ list(APPEND X11_X_EXTRA_LIBS -lipc)
endif ()
endif()
endif()
if (X11_ICE_FOUND)
- CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}"
+ check_library_exists("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}"
CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
if(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
set (X11_X_PRE_LIBS ${X11_ICE_LIB})
if(X11_SM_LIB)
- set (X11_X_PRE_LIBS ${X11_SM_LIB} ${X11_X_PRE_LIBS})
+ list(INSERT X11_X_PRE_LIBS 0 ${X11_SM_LIB})
endif()
endif()
endif ()
@@ -421,18 +449,222 @@ if (UNIX)
# Build the final list of libraries.
set(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS})
- include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
- FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
- "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
- else ()
- if (X11_FIND_REQUIRED)
- message(FATAL_ERROR "Could not find X11")
+ if (NOT TARGET X11::X11)
+ add_library(X11::X11 UNKNOWN IMPORTED)
+ set_target_properties(X11::X11 PROPERTIES
+ IMPORTED_LOCATION "${X11_X11_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_X11_INCLUDE_PATH}")
endif ()
endif ()
+ if (X11_ICE_FOUND AND NOT TARGET X11::ICE)
+ add_library(X11::ICE UNKNOWN IMPORTED)
+ set_target_properties(X11::ICE PROPERTIES
+ IMPORTED_LOCATION "${X11_ICE_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_ICE_INCLUDE_PATH}")
+ endif ()
+
+ if (X11_SM_FOUND AND NOT TARGET X11::SM)
+ add_library(X11::SM UNKNOWN IMPORTED)
+ set_target_properties(X11::SM PROPERTIES
+ IMPORTED_LOCATION "${X11_SM_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_SM_INCLUDE_PATH}")
+ endif ()
+
+ if (X11_Xau_FOUND AND NOT TARGET X11::Xau)
+ add_library(X11::Xau UNKNOWN IMPORTED)
+ set_target_properties(X11::Xau PROPERTIES
+ IMPORTED_LOCATION "${X11_Xau_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xau_INCLUDE_PATH}")
+ endif ()
+
+ if (X11_Xcomposite_FOUND AND NOT TARGET X11::Xcomposite)
+ add_library(X11::Xcomposite UNKNOWN IMPORTED)
+ set_target_properties(X11::Xcomposite PROPERTIES
+ IMPORTED_LOCATION "${X11_Xcomposite_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xcomposite_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::X11")
+ endif ()
+
+ if (X11_Xcursor_FOUND AND NOT TARGET X11::Xcursor)
+ add_library(X11::Xcursor UNKNOWN IMPORTED)
+ set_target_properties(X11::Xcursor PROPERTIES
+ IMPORTED_LOCATION "${X11_Xcursor_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xcursor_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::Xrender;X11::Xfixes;X11::X11")
+ endif ()
+
+ if (X11_Xdamage_FOUND AND NOT TARGET X11::Xdamage)
+ add_library(X11::Xdamage UNKNOWN IMPORTED)
+ set_target_properties(X11::Xdamage PROPERTIES
+ IMPORTED_LOCATION "${X11_Xdamage_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xdamage_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::Xfixes;X11::X11")
+ endif ()
+
+ if (X11_Xdmcp_FOUND AND NOT TARGET X11::Xdmcp)
+ add_library(X11::Xdmcp UNKNOWN IMPORTED)
+ set_target_properties(X11::Xdmcp PROPERTIES
+ IMPORTED_LOCATION "${X11_Xdmcp_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xdmcp_INCLUDE_PATH}")
+ endif ()
+
+ if (X11_Xext_FOUND AND NOT TARGET X11::Xext)
+ add_library(X11::Xext UNKNOWN IMPORTED)
+ set_target_properties(X11::Xext PROPERTIES
+ IMPORTED_LOCATION "${X11_Xext_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xext_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::X11")
+ endif ()
+
+ if (X11_Xxf86misc_FOUND AND NOT TARGET X11::Xxf86misc)
+ add_library(X11::Xxf86misc UNKNOWN IMPORTED)
+ set_target_properties(X11::Xxf86misc PROPERTIES
+ IMPORTED_LOCATION "${X11_Xxf86misc_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xxf86misc_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::X11;X11::Xext")
+ endif ()
+
+ if (X11_Xxf86vm_FOUND AND NOT TARGET X11::Xxf86vm)
+ add_library(X11::Xxf86vm UNKNOWN IMPORTED)
+ set_target_properties(X11::Xxf86vm PROPERTIES
+ IMPORTED_LOCATION "${X11_Xxf86vm_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xxf86vm_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::X11;X11::Xext")
+ endif ()
+
+ if (X11_Xfixes_FOUND AND NOT TARGET X11::Xfixes)
+ add_library(X11::Xfixes UNKNOWN IMPORTED)
+ set_target_properties(X11::Xfixes PROPERTIES
+ IMPORTED_LOCATION "${X11_Xfixes_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xfixes_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::X11")
+ endif ()
+
+ if (X11_Xft_FOUND AND NOT TARGET X11::Xft)
+ add_library(X11::Xft UNKNOWN IMPORTED)
+ set_target_properties(X11::Xft PROPERTIES
+ IMPORTED_LOCATION "${X11_Xft_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xft_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::Xrender;X11::X11;Fontconfig::Fontconfig;Freetype::Freetype")
+ endif ()
+
+ if (X11_Xi_FOUND AND NOT TARGET X11::Xi)
+ add_library(X11::Xi UNKNOWN IMPORTED)
+ set_target_properties(X11::Xi PROPERTIES
+ IMPORTED_LOCATION "${X11_Xi_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xi_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::Xext;X11::X11")
+ endif ()
+
+ if (X11_Xinerama_FOUND AND NOT TARGET X11::Xinerama)
+ add_library(X11::Xinerama UNKNOWN IMPORTED)
+ set_target_properties(X11::Xinerama PROPERTIES
+ IMPORTED_LOCATION "${X11_Xinerama_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xinerama_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::Xext;X11::X11")
+ endif ()
+
+ if (X11_Xkb_FOUND AND NOT TARGET X11::Xkb)
+ add_library(X11::Xkb INTERFACE IMPORTED)
+ set_target_properties(X11::Xkb PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xkb_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::X11")
+ endif ()
+
+ if (X11_xkbfile_FOUND AND NOT TARGET X11::xkbfile)
+ add_library(X11::xkbfile UNKNOWN IMPORTED)
+ set_target_properties(X11::xkbfile PROPERTIES
+ IMPORTED_LOCATION "${X11_xkbfile_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_xkbfile_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::X11")
+ endif ()
+
+ if (X11_Xmu_FOUND AND NOT TARGET X11::Xmu)
+ add_library(X11::Xmu UNKNOWN IMPORTED)
+ set_target_properties(X11::Xmu PROPERTIES
+ IMPORTED_LOCATION "${X11_Xmu_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xmu_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::Xt;X11::Xext;X11::X11")
+ endif ()
+
+ if (X11_Xpm_FOUND AND NOT TARGET X11::Xpm)
+ add_library(X11::Xpm UNKNOWN IMPORTED)
+ set_target_properties(X11::Xpm PROPERTIES
+ IMPORTED_LOCATION "${X11_Xpm_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xpm_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::X11")
+ endif ()
+
+ if (X11_Xtst_FOUND AND NOT TARGET X11::Xtst)
+ add_library(X11::Xtst UNKNOWN IMPORTED)
+ set_target_properties(X11::Xtst PROPERTIES
+ IMPORTED_LOCATION "${X11_Xtst_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xtst_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::Xi;X11::Xext;X11::X11")
+ endif ()
+
+ if (X11_Xrandr_FOUND AND NOT TARGET X11::Xrandr)
+ add_library(X11::Xrandr UNKNOWN IMPORTED)
+ set_target_properties(X11::Xrandr PROPERTIES
+ IMPORTED_LOCATION "${X11_Xrandr_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xrandr_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::Xrender;X11::Xext;X11::X11")
+ endif ()
+
+ if (X11_Xrender_FOUND AND NOT TARGET X11::Xrender)
+ add_library(X11::Xrender UNKNOWN IMPORTED)
+ set_target_properties(X11::Xrender PROPERTIES
+ IMPORTED_LOCATION "${X11_Xrender_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xrender_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::X11")
+ endif ()
+
+ if (X11_XRes_FOUND AND NOT TARGET X11::XRes)
+ add_library(X11::XRes UNKNOWN IMPORTED)
+ set_target_properties(X11::XRes PROPERTIES
+ IMPORTED_LOCATION "${X11_XRes_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_XRes_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::Xext;X11::X11")
+ endif ()
+
+ if (X11_Xss_FOUND AND NOT TARGET X11::Xss)
+ add_library(X11::Xss UNKNOWN IMPORTED)
+ set_target_properties(X11::Xss PROPERTIES
+ IMPORTED_LOCATION "${X11_Xss_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xss_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::Xext;X11::X11")
+ endif ()
+
+ if (X11_Xt_FOUND AND NOT TARGET X11::Xt)
+ add_library(X11::Xt UNKNOWN IMPORTED)
+ set_target_properties(X11::Xt PROPERTIES
+ IMPORTED_LOCATION "${X11_Xt_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xt_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::ICE;X11::SM;X11::X11")
+ endif ()
+
+ if (X11_Xutil_FOUND AND NOT TARGET X11::Xutil)
+ add_library(X11::Xutil INTERFACE IMPORTED)
+ set_target_properties(X11::Xutil PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xutil_INCLUDE_PATH}"
+ # libX11 contains the implementations for functions in the Xutil.h
+ # header.
+ INTERFACE_LINK_LIBRARIES "X11::X11")
+ endif ()
+
+ if (X11_Xv_FOUND AND NOT TARGET X11::Xv)
+ add_library(X11::Xv UNKNOWN IMPORTED)
+ set_target_properties(X11::Xv PROPERTIES
+ IMPORTED_LOCATION "${X11_Xv_LIB}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_Xv_INCLUDE_PATH}"
+ INTERFACE_LINK_LIBRARIES "X11::Xext;X11::X11")
+ endif ()
+
mark_as_advanced(
X11_X11_INCLUDE_PATH
X11_X11_LIB
+ X11_Xext_INCLUDE_PATH
X11_Xext_LIB
X11_Xau_LIB
X11_Xau_INCLUDE_PATH
@@ -440,7 +672,6 @@ if (UNIX)
X11_Xutil_INCLUDE_PATH
X11_Xcomposite_INCLUDE_PATH
X11_Xcomposite_LIB
- X11_Xaccess_INCLUDE_PATH
X11_Xfixes_LIB
X11_Xfixes_INCLUDE_PATH
X11_Xrandr_LIB
@@ -452,15 +683,15 @@ if (UNIX)
X11_XRes_LIB
X11_XRes_INCLUDE_PATH
X11_Xxf86misc_LIB
- X11_xf86misc_INCLUDE_PATH
+ X11_Xxf86misc_INCLUDE_PATH
X11_Xxf86vm_LIB
- X11_xf86vmode_INCLUDE_PATH
+ X11_Xxf86vm_INCLUDE_PATH
X11_Xi_LIB
X11_Xi_INCLUDE_PATH
X11_Xinerama_LIB
X11_Xinerama_INCLUDE_PATH
- X11_XTest_LIB
- X11_XTest_INCLUDE_PATH
+ X11_Xtst_LIB
+ X11_Xtst_INCLUDE_PATH
X11_Xcursor_LIB
X11_Xcursor_INCLUDE_PATH
X11_dpms_INCLUDE_PATH
@@ -473,16 +704,14 @@ if (UNIX)
X11_Xdmcp_INCLUDE_PATH
X11_Xkb_INCLUDE_PATH
X11_Xkblib_INCLUDE_PATH
- X11_Xkbfile_INCLUDE_PATH
- X11_Xkbfile_LIB
+ X11_xkbfile_INCLUDE_PATH
+ X11_xkbfile_LIB
X11_Xmu_INCLUDE_PATH
X11_Xmu_LIB
- X11_Xscreensaver_INCLUDE_PATH
- X11_Xscreensaver_LIB
+ X11_Xss_INCLUDE_PATH
+ X11_Xss_LIB
X11_Xpm_INCLUDE_PATH
X11_Xpm_LIB
- X11_Xinput_LIB
- X11_Xinput_INCLUDE_PATH
X11_Xft_LIB
X11_Xft_INCLUDE_PATH
X11_Xshape_INCLUDE_PATH
@@ -498,5 +727,3 @@ if (UNIX)
set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE})
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
endif ()
-
-# X11_FIND_REQUIRED_<component> could be checked too
diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake
index e7ae9197d..69e6df22b 100644
--- a/Modules/FindXMLRPC.cmake
+++ b/Modules/FindXMLRPC.cmake
@@ -1,35 +1,36 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindXMLRPC
-# ----------
-#
-# Find xmlrpc
-#
-# Find the native XMLRPC headers and libraries.
-#
-# ::
-#
-# XMLRPC_INCLUDE_DIRS - where to find xmlrpc.h, etc.
-# XMLRPC_LIBRARIES - List of libraries when using xmlrpc.
-# XMLRPC_FOUND - True if xmlrpc found.
-#
-# XMLRPC modules may be specified as components for this find module.
-# Modules may be listed by running "xmlrpc-c-config". Modules include:
-#
-# ::
-#
-# c++ C++ wrapper code
-# libwww-client libwww-based client
-# cgi-server CGI-based server
-# abyss-server ABYSS-based server
-#
-# Typical usage:
-#
-# ::
-#
-# find_package(XMLRPC REQUIRED libwww-client)
+#[=======================================================================[.rst:
+FindXMLRPC
+----------
+
+Find xmlrpc
+
+Find the native XMLRPC headers and libraries.
+
+::
+
+ XMLRPC_INCLUDE_DIRS - where to find xmlrpc.h, etc.
+ XMLRPC_LIBRARIES - List of libraries when using xmlrpc.
+ XMLRPC_FOUND - True if xmlrpc found.
+
+XMLRPC modules may be specified as components for this find module.
+Modules may be listed by running "xmlrpc-c-config". Modules include:
+
+::
+
+ c++ C++ wrapper code
+ libwww-client libwww-based client
+ cgi-server CGI-based server
+ abyss-server ABYSS-based server
+
+Typical usage:
+
+::
+
+ find_package(XMLRPC REQUIRED libwww-client)
+#]=======================================================================]
# First find the config script from which to obtain other values.
find_program(XMLRPC_C_CONFIG NAMES xmlrpc-c-config)
diff --git a/Modules/FindXalanC.cmake b/Modules/FindXalanC.cmake
index 1951b49e1..3adaa44d3 100644
--- a/Modules/FindXalanC.cmake
+++ b/Modules/FindXalanC.cmake
@@ -1,45 +1,46 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindXalanC
-# -----------
-#
-# Find the Apache Xalan-C++ XSL transform processor headers and libraries.
-#
-# Imported targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following :prop_tgt:`IMPORTED` targets:
-#
-# ``XalanC::XalanC``
-# The Xalan-C++ ``xalan-c`` library, if found.
-#
-# Result variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project:
-#
-# ``XalanC_FOUND``
-# true if the Xalan headers and libraries were found
-# ``XalanC_VERSION``
-# Xalan release version
-# ``XalanC_INCLUDE_DIRS``
-# the directory containing the Xalan headers; note
-# ``XercesC_INCLUDE_DIRS`` is also required
-# ``XalanC_LIBRARIES``
-# Xalan libraries to be linked; note ``XercesC_LIBRARIES`` is also
-# required
-#
-# Cache variables
-# ^^^^^^^^^^^^^^^
-#
-# The following cache variables may also be set:
-#
-# ``XalanC_INCLUDE_DIR``
-# the directory containing the Xalan headers
-# ``XalanC_LIBRARY``
-# the Xalan library
+#[=======================================================================[.rst:
+FindXalanC
+-----------
+
+Find the Apache Xalan-C++ XSL transform processor headers and libraries.
+
+Imported targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` targets:
+
+``XalanC::XalanC``
+ The Xalan-C++ ``xalan-c`` library, if found.
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``XalanC_FOUND``
+ true if the Xalan headers and libraries were found
+``XalanC_VERSION``
+ Xalan release version
+``XalanC_INCLUDE_DIRS``
+ the directory containing the Xalan headers; note
+ ``XercesC_INCLUDE_DIRS`` is also required
+``XalanC_LIBRARIES``
+ Xalan libraries to be linked; note ``XercesC_LIBRARIES`` is also
+ required
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``XalanC_INCLUDE_DIR``
+ the directory containing the Xalan headers
+``XalanC_LIBRARY``
+ the Xalan library
+#]=======================================================================]
# Written by Roger Leigh <rleigh@codelibre.net>
@@ -75,7 +76,7 @@ find_path(XalanC_INCLUDE_DIR
DOC "Xalan-C++ include directory")
mark_as_advanced(XalanC_INCLUDE_DIR)
-if(XalanC_INCLUDE_DIR)
+if(XalanC_INCLUDE_DIR AND EXISTS "${XalanC_INCLUDE_DIR}/xalanc/Include/XalanVersion.hpp")
_XalanC_GET_VERSION("${XalanC_INCLUDE_DIR}/xalanc/Include/XalanVersion.hpp")
endif()
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake
index 55db7aeb7..47bfd6288 100644
--- a/Modules/FindXercesC.cmake
+++ b/Modules/FindXercesC.cmake
@@ -1,43 +1,44 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindXercesC
-# -----------
-#
-# Find the Apache Xerces-C++ validating XML parser headers and libraries.
-#
-# Imported targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following :prop_tgt:`IMPORTED` targets:
-#
-# ``XercesC::XercesC``
-# The Xerces-C++ ``xerces-c`` library, if found.
-#
-# Result variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project:
-#
-# ``XercesC_FOUND``
-# true if the Xerces headers and libraries were found
-# ``XercesC_VERSION``
-# Xerces release version
-# ``XercesC_INCLUDE_DIRS``
-# the directory containing the Xerces headers
-# ``XercesC_LIBRARIES``
-# Xerces libraries to be linked
-#
-# Cache variables
-# ^^^^^^^^^^^^^^^
-#
-# The following cache variables may also be set:
-#
-# ``XercesC_INCLUDE_DIR``
-# the directory containing the Xerces headers
-# ``XercesC_LIBRARY``
-# the Xerces library
+#[=======================================================================[.rst:
+FindXercesC
+-----------
+
+Find the Apache Xerces-C++ validating XML parser headers and libraries.
+
+Imported targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` targets:
+
+``XercesC::XercesC``
+ The Xerces-C++ ``xerces-c`` library, if found.
+
+Result variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``XercesC_FOUND``
+ true if the Xerces headers and libraries were found
+``XercesC_VERSION``
+ Xerces release version
+``XercesC_INCLUDE_DIRS``
+ the directory containing the Xerces headers
+``XercesC_LIBRARIES``
+ Xerces libraries to be linked
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``XercesC_INCLUDE_DIR``
+ the directory containing the Xerces headers
+``XercesC_LIBRARY``
+ the Xerces library
+#]=======================================================================]
# Written by Roger Leigh <rleigh@codelibre.net>
@@ -73,7 +74,7 @@ find_path(XercesC_INCLUDE_DIR
DOC "Xerces-C++ include directory")
mark_as_advanced(XercesC_INCLUDE_DIR)
-if(XercesC_INCLUDE_DIR)
+if(XercesC_INCLUDE_DIR AND EXISTS "${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp")
_XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp")
endif()
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 1a4635a7d..790eb423c 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -1,53 +1,54 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindZLIB
-# --------
-#
-# Find the native ZLIB includes and library.
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if
-# ZLIB has been found.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following variables:
-#
-# ::
-#
-# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
-# ZLIB_LIBRARIES - List of libraries when using zlib.
-# ZLIB_FOUND - True if zlib found.
-#
-# ::
-#
-# ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
-# ZLIB_VERSION_MAJOR - The major version of zlib
-# ZLIB_VERSION_MINOR - The minor version of zlib
-# ZLIB_VERSION_PATCH - The patch version of zlib
-# ZLIB_VERSION_TWEAK - The tweak version of zlib
-#
-# Backward Compatibility
-# ^^^^^^^^^^^^^^^^^^^^^^
-#
-# The following variable are provided for backward compatibility
-#
-# ::
-#
-# ZLIB_MAJOR_VERSION - The major version of zlib
-# ZLIB_MINOR_VERSION - The minor version of zlib
-# ZLIB_PATCH_VERSION - The patch version of zlib
-#
-# Hints
-# ^^^^^
-#
-# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this
-# module where to look.
+#[=======================================================================[.rst:
+FindZLIB
+--------
+
+Find the native ZLIB includes and library.
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if
+ZLIB has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+::
+
+ ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
+ ZLIB_LIBRARIES - List of libraries when using zlib.
+ ZLIB_FOUND - True if zlib found.
+
+::
+
+ ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
+ ZLIB_VERSION_MAJOR - The major version of zlib
+ ZLIB_VERSION_MINOR - The minor version of zlib
+ ZLIB_VERSION_PATCH - The patch version of zlib
+ ZLIB_VERSION_TWEAK - The tweak version of zlib
+
+Backward Compatibility
+^^^^^^^^^^^^^^^^^^^^^^
+
+The following variable are provided for backward compatibility
+
+::
+
+ ZLIB_MAJOR_VERSION - The major version of zlib
+ ZLIB_MINOR_VERSION - The minor version of zlib
+ ZLIB_PATCH_VERSION - The patch version of zlib
+
+Hints
+^^^^^
+
+A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this
+module where to look.
+#]=======================================================================]
set(_ZLIB_SEARCHES)
diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake
index 474ea82b5..bb2845489 100644
--- a/Modules/Findosg.cmake
+++ b/Modules/Findosg.cmake
@@ -1,42 +1,43 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# Findosg
-# -------
-#
-#
-#
-#
-#
-# NOTE: It is highly recommended that you use the new
-# FindOpenSceneGraph.cmake introduced in CMake 2.6.3 and not use this
-# Find module directly.
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osg This module defines
-#
-# OSG_FOUND - Was the Osg found? OSG_INCLUDE_DIR - Where to find the
-# headers OSG_LIBRARIES - The libraries to link against for the OSG (use
-# this)
-#
-# OSG_LIBRARY - The OSG library OSG_LIBRARY_DEBUG - The OSG debug
-# library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+Findosg
+-------
+
+
+
+
+
+NOTE: It is highly recommended that you use the new
+FindOpenSceneGraph.cmake introduced in CMake 2.6.3 and not use this
+Find module directly.
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osg This module defines
+
+OSG_FOUND - Was the Osg found? OSG_INCLUDE_DIR - Where to find the
+headers OSG_LIBRARIES - The libraries to link against for the OSG (use
+this)
+
+OSG_LIBRARY - The OSG library OSG_LIBRARY_DEBUG - The OSG debug
+library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgAnimation.cmake b/Modules/FindosgAnimation.cmake
index 5b26b6485..65e301649 100644
--- a/Modules/FindosgAnimation.cmake
+++ b/Modules/FindosgAnimation.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgAnimation
-# ----------------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgAnimation This module defines
-#
-# OSGANIMATION_FOUND - Was osgAnimation found? OSGANIMATION_INCLUDE_DIR
-# - Where to find the headers OSGANIMATION_LIBRARIES - The libraries to
-# link against for the OSG (use this)
-#
-# OSGANIMATION_LIBRARY - The OSG library OSGANIMATION_LIBRARY_DEBUG -
-# The OSG debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgAnimation
+----------------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgAnimation This module defines
+
+OSGANIMATION_FOUND - Was osgAnimation found? OSGANIMATION_INCLUDE_DIR
+- Where to find the headers OSGANIMATION_LIBRARIES - The libraries to
+link against for the OSG (use this)
+
+OSGANIMATION_LIBRARY - The OSG library OSGANIMATION_LIBRARY_DEBUG -
+The OSG debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake
index 6ddf53ce0..d0789badb 100644
--- a/Modules/FindosgDB.cmake
+++ b/Modules/FindosgDB.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgDB
-# ---------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgDB This module defines
-#
-# OSGDB_FOUND - Was osgDB found? OSGDB_INCLUDE_DIR - Where to find the
-# headers OSGDB_LIBRARIES - The libraries to link against for the osgDB
-# (use this)
-#
-# OSGDB_LIBRARY - The osgDB library OSGDB_LIBRARY_DEBUG - The osgDB
-# debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgDB
+---------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgDB This module defines
+
+OSGDB_FOUND - Was osgDB found? OSGDB_INCLUDE_DIR - Where to find the
+headers OSGDB_LIBRARIES - The libraries to link against for the osgDB
+(use this)
+
+OSGDB_LIBRARY - The osgDB library OSGDB_LIBRARY_DEBUG - The osgDB
+debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake
index e4bc276d7..438fab7d5 100644
--- a/Modules/FindosgFX.cmake
+++ b/Modules/FindosgFX.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgFX
-# ---------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgFX This module defines
-#
-# OSGFX_FOUND - Was osgFX found? OSGFX_INCLUDE_DIR - Where to find the
-# headers OSGFX_LIBRARIES - The libraries to link against for the osgFX
-# (use this)
-#
-# OSGFX_LIBRARY - The osgFX library OSGFX_LIBRARY_DEBUG - The osgFX
-# debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgFX
+---------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgFX This module defines
+
+OSGFX_FOUND - Was osgFX found? OSGFX_INCLUDE_DIR - Where to find the
+headers OSGFX_LIBRARIES - The libraries to link against for the osgFX
+(use this)
+
+OSGFX_LIBRARY - The osgFX library OSGFX_LIBRARY_DEBUG - The osgFX
+debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake
index 97adeb7af..7b6ef30a2 100644
--- a/Modules/FindosgGA.cmake
+++ b/Modules/FindosgGA.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgGA
-# ---------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgGA This module defines
-#
-# OSGGA_FOUND - Was osgGA found? OSGGA_INCLUDE_DIR - Where to find the
-# headers OSGGA_LIBRARIES - The libraries to link against for the osgGA
-# (use this)
-#
-# OSGGA_LIBRARY - The osgGA library OSGGA_LIBRARY_DEBUG - The osgGA
-# debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgGA
+---------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgGA This module defines
+
+OSGGA_FOUND - Was osgGA found? OSGGA_INCLUDE_DIR - Where to find the
+headers OSGGA_LIBRARIES - The libraries to link against for the osgGA
+(use this)
+
+OSGGA_LIBRARY - The osgGA library OSGGA_LIBRARY_DEBUG - The osgGA
+debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake
index e735942c3..625e4c26e 100644
--- a/Modules/FindosgIntrospection.cmake
+++ b/Modules/FindosgIntrospection.cmake
@@ -1,37 +1,38 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgIntrospection
-# --------------------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgINTROSPECTION This module defines
-#
-# OSGINTROSPECTION_FOUND - Was osgIntrospection found?
-# OSGINTROSPECTION_INCLUDE_DIR - Where to find the headers
-# OSGINTROSPECTION_LIBRARIES - The libraries to link for
-# osgIntrospection (use this)
-#
-# OSGINTROSPECTION_LIBRARY - The osgIntrospection library
-# OSGINTROSPECTION_LIBRARY_DEBUG - The osgIntrospection debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgIntrospection
+--------------------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgINTROSPECTION This module defines
+
+OSGINTROSPECTION_FOUND - Was osgIntrospection found?
+OSGINTROSPECTION_INCLUDE_DIR - Where to find the headers
+OSGINTROSPECTION_LIBRARIES - The libraries to link for
+osgIntrospection (use this)
+
+OSGINTROSPECTION_LIBRARY - The osgIntrospection library
+OSGINTROSPECTION_LIBRARY_DEBUG - The osgIntrospection debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake
index b88f1a414..857ff5d57 100644
--- a/Modules/FindosgManipulator.cmake
+++ b/Modules/FindosgManipulator.cmake
@@ -1,37 +1,38 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgManipulator
-# ------------------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgManipulator This module defines
-#
-# OSGMANIPULATOR_FOUND - Was osgManipulator found?
-# OSGMANIPULATOR_INCLUDE_DIR - Where to find the headers
-# OSGMANIPULATOR_LIBRARIES - The libraries to link for osgManipulator
-# (use this)
-#
-# OSGMANIPULATOR_LIBRARY - The osgManipulator library
-# OSGMANIPULATOR_LIBRARY_DEBUG - The osgManipulator debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgManipulator
+------------------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgManipulator This module defines
+
+OSGMANIPULATOR_FOUND - Was osgManipulator found?
+OSGMANIPULATOR_INCLUDE_DIR - Where to find the headers
+OSGMANIPULATOR_LIBRARIES - The libraries to link for osgManipulator
+(use this)
+
+OSGMANIPULATOR_LIBRARY - The osgManipulator library
+OSGMANIPULATOR_LIBRARY_DEBUG - The osgManipulator debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake
index 059746a61..91a30dc7e 100644
--- a/Modules/FindosgParticle.cmake
+++ b/Modules/FindosgParticle.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgParticle
-# ---------------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgParticle This module defines
-#
-# OSGPARTICLE_FOUND - Was osgParticle found? OSGPARTICLE_INCLUDE_DIR -
-# Where to find the headers OSGPARTICLE_LIBRARIES - The libraries to
-# link for osgParticle (use this)
-#
-# OSGPARTICLE_LIBRARY - The osgParticle library
-# OSGPARTICLE_LIBRARY_DEBUG - The osgParticle debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgParticle
+---------------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgParticle This module defines
+
+OSGPARTICLE_FOUND - Was osgParticle found? OSGPARTICLE_INCLUDE_DIR -
+Where to find the headers OSGPARTICLE_LIBRARIES - The libraries to
+link for osgParticle (use this)
+
+OSGPARTICLE_LIBRARY - The osgParticle library
+OSGPARTICLE_LIBRARY_DEBUG - The osgParticle debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgPresentation.cmake b/Modules/FindosgPresentation.cmake
index 84a410526..eae75d638 100644
--- a/Modules/FindosgPresentation.cmake
+++ b/Modules/FindosgPresentation.cmake
@@ -1,38 +1,39 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgPresentation
-# -------------------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgPresentation This module defines
-#
-# OSGPRESENTATION_FOUND - Was osgPresentation found?
-# OSGPRESENTATION_INCLUDE_DIR - Where to find the headers
-# OSGPRESENTATION_LIBRARIES - The libraries to link for osgPresentation
-# (use this)
-#
-# OSGPRESENTATION_LIBRARY - The osgPresentation library
-# OSGPRESENTATION_LIBRARY_DEBUG - The osgPresentation debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing. Modified to work with osgPresentation by Robert
-# Osfield, January 2012.
+#[=======================================================================[.rst:
+FindosgPresentation
+-------------------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgPresentation This module defines
+
+OSGPRESENTATION_FOUND - Was osgPresentation found?
+OSGPRESENTATION_INCLUDE_DIR - Where to find the headers
+OSGPRESENTATION_LIBRARIES - The libraries to link for osgPresentation
+(use this)
+
+OSGPRESENTATION_LIBRARY - The osgPresentation library
+OSGPRESENTATION_LIBRARY_DEBUG - The osgPresentation debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing. Modified to work with osgPresentation by Robert
+Osfield, January 2012.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake
index e5700bfc4..33b9f7311 100644
--- a/Modules/FindosgProducer.cmake
+++ b/Modules/FindosgProducer.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgProducer
-# ---------------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgProducer This module defines
-#
-# OSGPRODUCER_FOUND - Was osgProducer found? OSGPRODUCER_INCLUDE_DIR -
-# Where to find the headers OSGPRODUCER_LIBRARIES - The libraries to
-# link for osgProducer (use this)
-#
-# OSGPRODUCER_LIBRARY - The osgProducer library
-# OSGPRODUCER_LIBRARY_DEBUG - The osgProducer debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgProducer
+---------------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgProducer This module defines
+
+OSGPRODUCER_FOUND - Was osgProducer found? OSGPRODUCER_INCLUDE_DIR -
+Where to find the headers OSGPRODUCER_LIBRARIES - The libraries to
+link for osgProducer (use this)
+
+OSGPRODUCER_LIBRARY - The osgProducer library
+OSGPRODUCER_LIBRARY_DEBUG - The osgProducer debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgQt.cmake b/Modules/FindosgQt.cmake
index 04a2393e5..cf356303c 100644
--- a/Modules/FindosgQt.cmake
+++ b/Modules/FindosgQt.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgQt
-# ---------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgQt This module defines
-#
-# OSGQT_FOUND - Was osgQt found? OSGQT_INCLUDE_DIR - Where to find the
-# headers OSGQT_LIBRARIES - The libraries to link for osgQt (use this)
-#
-# OSGQT_LIBRARY - The osgQt library OSGQT_LIBRARY_DEBUG - The osgQt
-# debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing. Modified to work with osgQt by Robert Osfield,
-# January 2012.
+#[=======================================================================[.rst:
+FindosgQt
+---------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgQt This module defines
+
+OSGQT_FOUND - Was osgQt found? OSGQT_INCLUDE_DIR - Where to find the
+headers OSGQT_LIBRARIES - The libraries to link for osgQt (use this)
+
+OSGQT_LIBRARY - The osgQt library OSGQT_LIBRARY_DEBUG - The osgQt
+debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing. Modified to work with osgQt by Robert Osfield,
+January 2012.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake
index 0a7ba2379..0049c4e1d 100644
--- a/Modules/FindosgShadow.cmake
+++ b/Modules/FindosgShadow.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgShadow
-# -------------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgShadow This module defines
-#
-# OSGSHADOW_FOUND - Was osgShadow found? OSGSHADOW_INCLUDE_DIR - Where
-# to find the headers OSGSHADOW_LIBRARIES - The libraries to link for
-# osgShadow (use this)
-#
-# OSGSHADOW_LIBRARY - The osgShadow library OSGSHADOW_LIBRARY_DEBUG -
-# The osgShadow debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgShadow
+-------------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgShadow This module defines
+
+OSGSHADOW_FOUND - Was osgShadow found? OSGSHADOW_INCLUDE_DIR - Where
+to find the headers OSGSHADOW_LIBRARIES - The libraries to link for
+osgShadow (use this)
+
+OSGSHADOW_LIBRARY - The osgShadow library OSGSHADOW_LIBRARY_DEBUG -
+The osgShadow debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake
index 15426a273..43ba54211 100644
--- a/Modules/FindosgSim.cmake
+++ b/Modules/FindosgSim.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgSim
-# ----------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgSim This module defines
-#
-# OSGSIM_FOUND - Was osgSim found? OSGSIM_INCLUDE_DIR - Where to find
-# the headers OSGSIM_LIBRARIES - The libraries to link for osgSim (use
-# this)
-#
-# OSGSIM_LIBRARY - The osgSim library OSGSIM_LIBRARY_DEBUG - The osgSim
-# debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgSim
+----------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgSim This module defines
+
+OSGSIM_FOUND - Was osgSim found? OSGSIM_INCLUDE_DIR - Where to find
+the headers OSGSIM_LIBRARIES - The libraries to link for osgSim (use
+this)
+
+OSGSIM_LIBRARY - The osgSim library OSGSIM_LIBRARY_DEBUG - The osgSim
+debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake
index 04eae1450..c6f5b690a 100644
--- a/Modules/FindosgTerrain.cmake
+++ b/Modules/FindosgTerrain.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgTerrain
-# --------------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgTerrain This module defines
-#
-# OSGTERRAIN_FOUND - Was osgTerrain found? OSGTERRAIN_INCLUDE_DIR -
-# Where to find the headers OSGTERRAIN_LIBRARIES - The libraries to link
-# for osgTerrain (use this)
-#
-# OSGTERRAIN_LIBRARY - The osgTerrain library OSGTERRAIN_LIBRARY_DEBUG -
-# The osgTerrain debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgTerrain
+--------------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgTerrain This module defines
+
+OSGTERRAIN_FOUND - Was osgTerrain found? OSGTERRAIN_INCLUDE_DIR -
+Where to find the headers OSGTERRAIN_LIBRARIES - The libraries to link
+for osgTerrain (use this)
+
+OSGTERRAIN_LIBRARY - The osgTerrain library OSGTERRAIN_LIBRARY_DEBUG -
+The osgTerrain debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake
index 1e2d9fdfd..fd3c2324f 100644
--- a/Modules/FindosgText.cmake
+++ b/Modules/FindosgText.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgText
-# -----------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgText This module defines
-#
-# OSGTEXT_FOUND - Was osgText found? OSGTEXT_INCLUDE_DIR - Where to find
-# the headers OSGTEXT_LIBRARIES - The libraries to link for osgText (use
-# this)
-#
-# OSGTEXT_LIBRARY - The osgText library OSGTEXT_LIBRARY_DEBUG - The
-# osgText debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgText
+-----------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgText This module defines
+
+OSGTEXT_FOUND - Was osgText found? OSGTEXT_INCLUDE_DIR - Where to find
+the headers OSGTEXT_LIBRARIES - The libraries to link for osgText (use
+this)
+
+OSGTEXT_LIBRARY - The osgText library OSGTEXT_LIBRARY_DEBUG - The
+osgText debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake
index 13e0b803e..e84727aef 100644
--- a/Modules/FindosgUtil.cmake
+++ b/Modules/FindosgUtil.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgUtil
-# -----------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgUtil This module defines
-#
-# OSGUTIL_FOUND - Was osgUtil found? OSGUTIL_INCLUDE_DIR - Where to find
-# the headers OSGUTIL_LIBRARIES - The libraries to link for osgUtil (use
-# this)
-#
-# OSGUTIL_LIBRARY - The osgUtil library OSGUTIL_LIBRARY_DEBUG - The
-# osgUtil debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgUtil
+-----------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgUtil This module defines
+
+OSGUTIL_FOUND - Was osgUtil found? OSGUTIL_INCLUDE_DIR - Where to find
+the headers OSGUTIL_LIBRARIES - The libraries to link for osgUtil (use
+this)
+
+OSGUTIL_LIBRARY - The osgUtil library OSGUTIL_LIBRARY_DEBUG - The
+osgUtil debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake
index a91c49c14..2174357ec 100644
--- a/Modules/FindosgViewer.cmake
+++ b/Modules/FindosgViewer.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgViewer
-# -------------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgViewer This module defines
-#
-# OSGVIEWER_FOUND - Was osgViewer found? OSGVIEWER_INCLUDE_DIR - Where
-# to find the headers OSGVIEWER_LIBRARIES - The libraries to link for
-# osgViewer (use this)
-#
-# OSGVIEWER_LIBRARY - The osgViewer library OSGVIEWER_LIBRARY_DEBUG -
-# The osgViewer debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgViewer
+-------------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgViewer This module defines
+
+OSGVIEWER_FOUND - Was osgViewer found? OSGVIEWER_INCLUDE_DIR - Where
+to find the headers OSGVIEWER_LIBRARIES - The libraries to link for
+osgViewer (use this)
+
+OSGVIEWER_LIBRARY - The osgViewer library OSGVIEWER_LIBRARY_DEBUG -
+The osgViewer debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgVolume.cmake b/Modules/FindosgVolume.cmake
index 1178ed37d..35defef6b 100644
--- a/Modules/FindosgVolume.cmake
+++ b/Modules/FindosgVolume.cmake
@@ -1,36 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgVolume
-# -------------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgVolume This module defines
-#
-# OSGVOLUME_FOUND - Was osgVolume found? OSGVOLUME_INCLUDE_DIR - Where
-# to find the headers OSGVOLUME_LIBRARIES - The libraries to link for
-# osgVolume (use this)
-#
-# OSGVOLUME_LIBRARY - The osgVolume library OSGVOLUME_LIBRARY_DEBUG -
-# The osgVolume debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# Created by Eric Wing.
+#[=======================================================================[.rst:
+FindosgVolume
+-------------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgVolume This module defines
+
+OSGVOLUME_FOUND - Was osgVolume found? OSGVOLUME_INCLUDE_DIR - Where
+to find the headers OSGVOLUME_LIBRARIES - The libraries to link for
+osgVolume (use this)
+
+OSGVOLUME_LIBRARY - The osgVolume library OSGVOLUME_LIBRARY_DEBUG -
+The osgVolume debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+Created by Eric Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/FindosgWidget.cmake b/Modules/FindosgWidget.cmake
index 78999ec3f..c7aae448e 100644
--- a/Modules/FindosgWidget.cmake
+++ b/Modules/FindosgWidget.cmake
@@ -1,37 +1,38 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindosgWidget
-# -------------
-#
-#
-#
-# This is part of the Findosg* suite used to find OpenSceneGraph
-# components. Each component is separate and you must opt in to each
-# module. You must also opt into OpenGL and OpenThreads (and Producer
-# if needed) as these modules won't do it for you. This is to allow you
-# control over your own system piece by piece in case you need to opt
-# out of certain components or change the Find behavior for a particular
-# module (perhaps because the default FindOpenGL.cmake module doesn't
-# work with your system as an example). If you want to use a more
-# convenient module that includes everything, use the
-# FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
-#
-# Locate osgWidget This module defines
-#
-# OSGWIDGET_FOUND - Was osgWidget found? OSGWIDGET_INCLUDE_DIR - Where
-# to find the headers OSGWIDGET_LIBRARIES - The libraries to link for
-# osgWidget (use this)
-#
-# OSGWIDGET_LIBRARY - The osgWidget library OSGWIDGET_LIBRARY_DEBUG -
-# The osgWidget debug library
-#
-# $OSGDIR is an environment variable that would correspond to the
-# ./configure --prefix=$OSGDIR used in building osg.
-#
-# FindosgWidget.cmake tweaked from Findosg* suite as created by Eric
-# Wing.
+#[=======================================================================[.rst:
+FindosgWidget
+-------------
+
+
+
+This is part of the Findosg* suite used to find OpenSceneGraph
+components. Each component is separate and you must opt in to each
+module. You must also opt into OpenGL and OpenThreads (and Producer
+if needed) as these modules won't do it for you. This is to allow you
+control over your own system piece by piece in case you need to opt
+out of certain components or change the Find behavior for a particular
+module (perhaps because the default FindOpenGL.cmake module doesn't
+work with your system as an example). If you want to use a more
+convenient module that includes everything, use the
+FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+
+Locate osgWidget This module defines
+
+OSGWIDGET_FOUND - Was osgWidget found? OSGWIDGET_INCLUDE_DIR - Where
+to find the headers OSGWIDGET_LIBRARIES - The libraries to link for
+osgWidget (use this)
+
+OSGWIDGET_LIBRARY - The osgWidget library OSGWIDGET_LIBRARY_DEBUG -
+The osgWidget debug library
+
+$OSGDIR is an environment variable that would correspond to the
+./configure --prefix=$OSGDIR used in building osg.
+
+FindosgWidget.cmake tweaked from Findosg* suite as created by Eric
+Wing.
+#]=======================================================================]
# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake
index adaeb6b1d..40df4d5dd 100644
--- a/Modules/Findosg_functions.cmake
+++ b/Modules/Findosg_functions.cmake
@@ -1,17 +1,18 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# Findosg_functions
-# -----------------
-#
-#
-#
-#
-#
-# This CMake file contains two macros to assist with searching for OSG
-# libraries and nodekits. Please see FindOpenSceneGraph.cmake for full
-# documentation.
+#[=======================================================================[.rst:
+Findosg_functions
+-----------------
+
+
+
+
+
+This CMake file contains two macros to assist with searching for OSG
+libraries and nodekits. Please see FindOpenSceneGraph.cmake for full
+documentation.
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index f2d628543..c813ead47 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -1,111 +1,112 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindwxWidgets
-# -------------
-#
-# Find a wxWidgets (a.k.a., wxWindows) installation.
-#
-# This module finds if wxWidgets is installed and selects a default
-# configuration to use. wxWidgets is a modular library. To specify the
-# modules that you will use, you need to name them as components to the
-# package:
-#
-# find_package(wxWidgets COMPONENTS core base ...)
-#
-# 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
-# desired (i.e., these are the only variables you should change to
-# select a configuration):
-#
-# ::
-#
-# wxWidgets_ROOT_DIR - Base wxWidgets directory
-# (e.g., C:/wxWidgets-2.6.3).
-# wxWidgets_LIB_DIR - Path to wxWidgets libraries
-# (e.g., C:/wxWidgets-2.6.3/lib/vc_lib).
-# wxWidgets_CONFIGURATION - Configuration to use
-# (e.g., msw, mswd, mswu, mswunivud, etc.)
-# wxWidgets_EXCLUDE_COMMON_LIBRARIES
-# - Set to TRUE to exclude linking of
-# commonly required libs (e.g., png tiff
-# jpeg zlib regex expat).
-#
-#
-#
-# For unix style it uses the wx-config utility. You can select between
-# debug/release, unicode/ansi, universal/non-universal, and
-# static/shared in the QtDialog or ccmake interfaces by turning ON/OFF
-# the following variables:
-#
-# ::
-#
-# wxWidgets_USE_DEBUG
-# wxWidgets_USE_UNICODE
-# wxWidgets_USE_UNIVERSAL
-# wxWidgets_USE_STATIC
-#
-#
-#
-# There is also a wxWidgets_CONFIG_OPTIONS variable for all other
-# options that need to be passed to the wx-config utility. For example,
-# to use the base toolkit found in the /usr/local path, set the variable
-# (before calling the FIND_PACKAGE command) as such:
-#
-# ::
-#
-# set(wxWidgets_CONFIG_OPTIONS --toolkit=base --prefix=/usr)
-#
-#
-#
-# The following are set after the configuration is done for both windows
-# and unix style:
-#
-# ::
-#
-# wxWidgets_FOUND - Set to TRUE if wxWidgets was found.
-# wxWidgets_INCLUDE_DIRS - Include directories for WIN32
-# i.e., where to find "wx/wx.h" and
-# "wx/setup.h"; possibly empty for unices.
-# wxWidgets_LIBRARIES - Path to the wxWidgets libraries.
-# wxWidgets_LIBRARY_DIRS - compile time link dirs, useful for
-# rpath on UNIX. Typically an empty string
-# in WIN32 environment.
-# wxWidgets_DEFINITIONS - Contains defines required to compile/link
-# against WX, e.g. WXUSINGDLL
-# wxWidgets_DEFINITIONS_DEBUG- Contains defines required to compile/link
-# against WX debug builds, e.g. __WXDEBUG__
-# wxWidgets_CXX_FLAGS - Include dirs and compiler flags for
-# unices, empty on WIN32. Essentially
-# "`wx-config --cxxflags`".
-# wxWidgets_USE_FILE - Convenience include file.
-#
-#
-#
-# Sample usage:
-#
-# ::
-#
-# # Note that for MinGW users the order of libs is important!
-# find_package(wxWidgets COMPONENTS net gl core base)
-# if(wxWidgets_FOUND)
-# include(${wxWidgets_USE_FILE})
-# # and for each of your dependent executable/library targets:
-# target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
-# endif()
-#
-#
-#
-# If wxWidgets is required (i.e., not an optional part):
-#
-# ::
-#
-# find_package(wxWidgets REQUIRED net gl core base)
-# include(${wxWidgets_USE_FILE})
-# # and for each of your dependent executable/library targets:
-# target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
+#[=======================================================================[.rst:
+FindwxWidgets
+-------------
+
+Find a wxWidgets (a.k.a., wxWindows) installation.
+
+This module finds if wxWidgets is installed and selects a default
+configuration to use. wxWidgets is a modular library. To specify the
+modules that you will use, you need to name them as components to the
+package:
+
+find_package(wxWidgets COMPONENTS core base ... OPTIONAL_COMPONENTS net ...)
+
+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
+desired (i.e., these are the only variables you should change to
+select a configuration):
+
+::
+
+ wxWidgets_ROOT_DIR - Base wxWidgets directory
+ (e.g., C:/wxWidgets-2.6.3).
+ wxWidgets_LIB_DIR - Path to wxWidgets libraries
+ (e.g., C:/wxWidgets-2.6.3/lib/vc_lib).
+ wxWidgets_CONFIGURATION - Configuration to use
+ (e.g., msw, mswd, mswu, mswunivud, etc.)
+ wxWidgets_EXCLUDE_COMMON_LIBRARIES
+ - Set to TRUE to exclude linking of
+ commonly required libs (e.g., png tiff
+ jpeg zlib regex expat).
+
+
+
+For unix style it uses the wx-config utility. You can select between
+debug/release, unicode/ansi, universal/non-universal, and
+static/shared in the QtDialog or ccmake interfaces by turning ON/OFF
+the following variables:
+
+::
+
+ wxWidgets_USE_DEBUG
+ wxWidgets_USE_UNICODE
+ wxWidgets_USE_UNIVERSAL
+ wxWidgets_USE_STATIC
+
+
+
+There is also a wxWidgets_CONFIG_OPTIONS variable for all other
+options that need to be passed to the wx-config utility. For example,
+to use the base toolkit found in the /usr/local path, set the variable
+(before calling the FIND_PACKAGE command) as such:
+
+::
+
+ set(wxWidgets_CONFIG_OPTIONS --toolkit=base --prefix=/usr)
+
+
+
+The following are set after the configuration is done for both windows
+and unix style:
+
+::
+
+ wxWidgets_FOUND - Set to TRUE if wxWidgets was found.
+ wxWidgets_INCLUDE_DIRS - Include directories for WIN32
+ i.e., where to find "wx/wx.h" and
+ "wx/setup.h"; possibly empty for unices.
+ wxWidgets_LIBRARIES - Path to the wxWidgets libraries.
+ wxWidgets_LIBRARY_DIRS - compile time link dirs, useful for
+ rpath on UNIX. Typically an empty string
+ in WIN32 environment.
+ wxWidgets_DEFINITIONS - Contains defines required to compile/link
+ against WX, e.g. WXUSINGDLL
+ wxWidgets_DEFINITIONS_DEBUG- Contains defines required to compile/link
+ against WX debug builds, e.g. __WXDEBUG__
+ wxWidgets_CXX_FLAGS - Include dirs and compiler flags for
+ unices, empty on WIN32. Essentially
+ "`wx-config --cxxflags`".
+ wxWidgets_USE_FILE - Convenience include file.
+
+
+
+Sample usage:
+
+::
+
+ # Note that for MinGW users the order of libs is important!
+ find_package(wxWidgets COMPONENTS gl core base OPTIONAL_COMPONENTS net)
+ if(wxWidgets_FOUND)
+ include(${wxWidgets_USE_FILE})
+ # and for each of your dependent executable/library targets:
+ target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
+ endif()
+
+
+
+If wxWidgets is required (i.e., not an optional part):
+
+::
+
+ find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net)
+ include(${wxWidgets_USE_FILE})
+ # and for each of your dependent executable/library targets:
+ target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
+#]=======================================================================]
#
# FIXME: check this and provide a correct sample usage...
@@ -396,6 +397,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
list(APPEND wxWidgets_LIBRARIES
debug ${WX_${LIB}d} optimized ${WX_${LIB}}
)
+ set(wxWidgets_${LIB}_FOUND TRUE)
+ elseif(NOT wxWidgets_FIND_REQUIRED_${LIB})
+ DBG_MSG_V("- ignored optional missing WX_${LIB}=${WX_${LIB}} or WX_${LIB}d=${WX_${LIB}d}")
else()
DBG_MSG_V("- not found due to missing WX_${LIB}=${WX_${LIB}} or WX_${LIB}d=${WX_${LIB}d}")
set(wxWidgets_FOUND FALSE)
@@ -408,9 +412,11 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
if(WX_${LIB}${_DBG})
DBG_MSG_V("Found ${LIB}${_DBG}")
list(APPEND wxWidgets_LIBRARIES ${WX_${LIB}${_DBG}})
+ set(wxWidgets_${LIB}_FOUND TRUE)
+ elseif(NOT wxWidgets_FIND_REQUIRED_${LIB})
+ DBG_MSG_V("- ignored optional missing WX_${LIB}${_DBG}=${WX_${LIB}${_DBG}}")
else()
- DBG_MSG_V(
- "- not found due to missing WX_${LIB}${_DBG}=${WX_${LIB}${_DBG}}")
+ DBG_MSG_V("- not found due to missing WX_${LIB}${_DBG}=${WX_${LIB}${_DBG}}")
set(wxWidgets_FOUND FALSE)
endif()
endforeach()
@@ -803,11 +809,24 @@ else()
# - NOTE: wx-config doesn't verify that the libs requested exist
# it just produces the names. Maybe a TRY_COMPILE would
# be useful here...
- string(REPLACE ";" ","
- wxWidgets_FIND_COMPONENTS "${wxWidgets_FIND_COMPONENTS}")
+ unset(_cmp_req)
+ unset(_cmp_opt)
+ foreach(_cmp IN LISTS wxWidgets_FIND_COMPONENTS)
+ if(wxWidgets_FIND_REQUIRED_${_cmp})
+ list(APPEND _cmp_req "${_cmp}")
+ else()
+ list(APPEND _cmp_opt "${_cmp}")
+ endif()
+ endforeach()
+ DBG_MSG_V("wxWidgets required components : ${_cmp_req}")
+ DBG_MSG_V("wxWidgets optional components : ${_cmp_opt}")
+ if(DEFINED _cmp_opt)
+ string(REPLACE ";" "," _cmp_opt "--optional-libs ${_cmp_opt}")
+ endif()
+ string(REPLACE ";" "," _cmp_req "${_cmp_req}")
execute_process(
COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
- ${wxWidgets_SELECT_OPTIONS} --libs ${wxWidgets_FIND_COMPONENTS}
+ ${wxWidgets_SELECT_OPTIONS} --libs ${_cmp_req} ${_cmp_opt}
OUTPUT_VARIABLE wxWidgets_LIBRARIES
RESULT_VARIABLE RET
ERROR_QUIET
@@ -833,8 +852,10 @@ else()
else()
set(wxWidgets_FOUND FALSE)
- DBG_MSG("${wxWidgets_CONFIG_EXECUTABLE} --libs ${wxWidgets_FIND_COMPONENTS} FAILED with RET=${RET}")
+ DBG_MSG("${wxWidgets_CONFIG_EXECUTABLE} --libs ${_cmp_req} ${_cmp_opt} FAILED with RET=${RET}")
endif()
+ unset(_cmp_req)
+ unset(_cmp_opt)
endif()
# When using wx-config in MSYS, the include paths are UNIX style paths which may or may
@@ -960,10 +981,18 @@ DBG_MSG("wxWidgets_USE_FILE : ${wxWidgets_USE_FILE}")
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+# FIXME: set wxWidgets_<comp>_FOUND for wx-config branch
+# and use HANDLE_COMPONENTS on Unix too
+if(wxWidgets_FIND_STYLE STREQUAL "win32")
+ set(wxWidgets_HANDLE_COMPONENTS "HANDLE_COMPONENTS")
+endif()
+
find_package_handle_standard_args(wxWidgets
REQUIRED_VARS wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS
VERSION_VAR wxWidgets_VERSION_STRING
+ ${wxWidgets_HANDLE_COMPONENTS}
)
+unset(wxWidgets_HANDLE_COMPONENTS)
#=====================================================================
# Macros for use in wxWidgets apps.
diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake
index 115cdc6fe..35840f5f9 100644
--- a/Modules/FindwxWindows.cmake
+++ b/Modules/FindwxWindows.cmake
@@ -1,84 +1,87 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindwxWindows
-# -------------
-#
-# Find wxWindows (wxWidgets) installation
-#
-# This module finds if wxWindows/wxWidgets is installed and determines
-# where the include files and libraries are. It also determines what
-# the name of the library is. Please note this file is DEPRECATED and
-# replaced by FindwxWidgets.cmake. This code sets the following
-# variables:
-#
-# ::
-#
-# WXWINDOWS_FOUND = system has WxWindows
-# WXWINDOWS_LIBRARIES = path to the wxWindows libraries
-# on Unix/Linux with additional
-# linker flags from
-# "wx-config --libs"
-# CMAKE_WXWINDOWS_CXX_FLAGS = Compiler flags for wxWindows,
-# essentially "`wx-config --cxxflags`"
-# on Linux
-# WXWINDOWS_INCLUDE_DIR = where to find "wx/wx.h" and "wx/setup.h"
-# WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on
-# Unix
-# WXWINDOWS_DEFINITIONS = extra defines
-#
-#
-#
-# OPTIONS If you need OpenGL support please
-#
-# ::
-#
-# set(WXWINDOWS_USE_GL 1)
-#
-# in your CMakeLists.txt *before* you include this file.
-#
-# ::
-#
-# HAVE_ISYSTEM - true required to replace -I by -isystem on g++
-#
-#
-#
-# For convenience include Use_wxWindows.cmake in your project's
-# CMakeLists.txt using
-# include(${CMAKE_CURRENT_LIST_DIR}/Use_wxWindows.cmake).
-#
-# USAGE
-#
-# ::
-#
-# set(WXWINDOWS_USE_GL 1)
-# find_package(wxWindows)
-#
-#
-#
-# NOTES wxWidgets 2.6.x is supported for monolithic builds e.g.
-# compiled in wx/build/msw dir as:
-#
-# ::
-#
-# nmake -f makefile.vc BUILD=debug SHARED=0 USE_OPENGL=1 MONOLITHIC=1
-#
-#
-#
-# DEPRECATED
-#
-# ::
-#
-# CMAKE_WX_CAN_COMPILE
-# WXWINDOWS_LIBRARY
-# CMAKE_WX_CXX_FLAGS
-# WXWINDOWS_INCLUDE_PATH
-#
-#
-#
-# AUTHOR Jan Woetzel <http://www.mip.informatik.uni-kiel.de/~jw>
-# (07/2003-01/2006)
+#[=======================================================================[.rst:
+FindwxWindows
+-------------
+
+.. deprecated:: 3.0
+
+ Replaced by :module:`FindwxWidgets`.
+
+Find wxWindows (wxWidgets) installation
+
+This module finds if wxWindows/wxWidgets is installed and determines
+where the include files and libraries are. It also determines what
+the name of the library is. This code sets the following variables:
+
+::
+
+ WXWINDOWS_FOUND = system has WxWindows
+ WXWINDOWS_LIBRARIES = path to the wxWindows libraries
+ on Unix/Linux with additional
+ linker flags from
+ "wx-config --libs"
+ CMAKE_WXWINDOWS_CXX_FLAGS = Compiler flags for wxWindows,
+ essentially "`wx-config --cxxflags`"
+ on Linux
+ WXWINDOWS_INCLUDE_DIR = where to find "wx/wx.h" and "wx/setup.h"
+ WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on
+ Unix
+ WXWINDOWS_DEFINITIONS = extra defines
+
+
+
+OPTIONS If you need OpenGL support please
+
+::
+
+ set(WXWINDOWS_USE_GL 1)
+
+in your CMakeLists.txt *before* you include this file.
+
+::
+
+ HAVE_ISYSTEM - true required to replace -I by -isystem on g++
+
+
+
+For convenience include Use_wxWindows.cmake in your project's
+CMakeLists.txt using
+include(${CMAKE_CURRENT_LIST_DIR}/Use_wxWindows.cmake).
+
+USAGE
+
+::
+
+ set(WXWINDOWS_USE_GL 1)
+ find_package(wxWindows)
+
+
+
+NOTES wxWidgets 2.6.x is supported for monolithic builds e.g.
+compiled in wx/build/msw dir as:
+
+::
+
+ nmake -f makefile.vc BUILD=debug SHARED=0 USE_OPENGL=1 MONOLITHIC=1
+
+
+
+DEPRECATED
+
+::
+
+ CMAKE_WX_CAN_COMPILE
+ WXWINDOWS_LIBRARY
+ CMAKE_WX_CXX_FLAGS
+ WXWINDOWS_INCLUDE_PATH
+
+
+
+AUTHOR Jan Woetzel <http://www.mip.informatik.uni-kiel.de/~jw>
+(07/2003-01/2006)
+#]=======================================================================]
# ------------------------------------------------------------------
#
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index 3dfcf8c95..4db4e18fd 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -1,127 +1,128 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# GNUInstallDirs
-# --------------
-#
-# Define GNU standard installation directories
-#
-# Provides install directory variables as defined by the
-# `GNU Coding Standards`_.
-#
-# .. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# Inclusion of this module defines the following variables:
-#
-# ``CMAKE_INSTALL_<dir>``
-#
-# Destination for files of a given type. This value may be passed to
-# the ``DESTINATION`` options of :command:`install` commands for the
-# corresponding file type.
-#
-# ``CMAKE_INSTALL_FULL_<dir>``
-#
-# The absolute path generated from the corresponding ``CMAKE_INSTALL_<dir>``
-# value. If the value is not already an absolute path, an absolute path
-# is constructed typically by prepending the value of the
-# :variable:`CMAKE_INSTALL_PREFIX` variable. However, there are some
-# `special cases`_ as documented below.
-#
-# where ``<dir>`` is one of:
-#
-# ``BINDIR``
-# user executables (``bin``)
-# ``SBINDIR``
-# system admin executables (``sbin``)
-# ``LIBEXECDIR``
-# program executables (``libexec``)
-# ``SYSCONFDIR``
-# read-only single-machine data (``etc``)
-# ``SHAREDSTATEDIR``
-# modifiable architecture-independent data (``com``)
-# ``LOCALSTATEDIR``
-# modifiable single-machine data (``var``)
-# ``RUNSTATEDIR``
-# run-time variable data (``LOCALSTATEDIR/run``)
-# ``LIBDIR``
-# object code libraries (``lib`` or ``lib64``
-# or ``lib/<multiarch-tuple>`` on Debian)
-# ``INCLUDEDIR``
-# C header files (``include``)
-# ``OLDINCLUDEDIR``
-# C header files for non-gcc (``/usr/include``)
-# ``DATAROOTDIR``
-# read-only architecture-independent data root (``share``)
-# ``DATADIR``
-# read-only architecture-independent data (``DATAROOTDIR``)
-# ``INFODIR``
-# info documentation (``DATAROOTDIR/info``)
-# ``LOCALEDIR``
-# locale-dependent data (``DATAROOTDIR/locale``)
-# ``MANDIR``
-# man documentation (``DATAROOTDIR/man``)
-# ``DOCDIR``
-# documentation root (``DATAROOTDIR/doc/PROJECT_NAME``)
-#
-# If the includer does not define a value the above-shown default will be
-# used and the value will appear in the cache for editing by the user.
-#
-# Special Cases
-# ^^^^^^^^^^^^^
-#
-# The following values of :variable:`CMAKE_INSTALL_PREFIX` are special:
-#
-# ``/``
-#
-# For ``<dir>`` other than the ``SYSCONFDIR``, ``LOCALSTATEDIR`` and
-# ``RUNSTATEDIR``, the value of ``CMAKE_INSTALL_<dir>`` is prefixed
-# with ``usr/`` if it is not user-specified as an absolute path.
-# For example, the ``INCLUDEDIR`` value ``include`` becomes ``usr/include``.
-# This is required by the `GNU Coding Standards`_, which state:
-#
-# When building the complete GNU system, the prefix will be empty
-# and ``/usr`` will be a symbolic link to ``/``.
-#
-# ``/usr``
-#
-# For ``<dir>`` equal to ``SYSCONFDIR``, ``LOCALSTATEDIR`` or
-# ``RUNSTATEDIR``, the ``CMAKE_INSTALL_FULL_<dir>`` is computed by
-# prepending just ``/`` to the value of ``CMAKE_INSTALL_<dir>``
-# if it is not user-specified as an absolute path.
-# For example, the ``SYSCONFDIR`` value ``etc`` becomes ``/etc``.
-# This is required by the `GNU Coding Standards`_.
-#
-# ``/opt/...``
-#
-# For ``<dir>`` equal to ``SYSCONFDIR``, ``LOCALSTATEDIR`` or
-# ``RUNSTATEDIR``, the ``CMAKE_INSTALL_FULL_<dir>`` is computed by
-# *appending* the prefix to the value of ``CMAKE_INSTALL_<dir>``
-# if it is not user-specified as an absolute path.
-# For example, the ``SYSCONFDIR`` value ``etc`` becomes ``/etc/opt/...``.
-# This is defined by the `Filesystem Hierarchy Standard`_.
-#
-# .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
-#
-# Macros
-# ^^^^^^
-#
-# .. command:: GNUInstallDirs_get_absolute_install_dir
-#
-# ::
-#
-# GNUInstallDirs_get_absolute_install_dir(absvar var)
-#
-# Set the given variable ``absvar`` to the absolute path contained
-# within the variable ``var``. This is to allow the computation of an
-# absolute path, accounting for all the special cases documented
-# above. While this macro is used to compute the various
-# ``CMAKE_INSTALL_FULL_<dir>`` variables, it is exposed publicly to
-# allow users who create additional path variables to also compute
-# absolute paths where necessary, using the same logic.
+#[=======================================================================[.rst:
+GNUInstallDirs
+--------------
+
+Define GNU standard installation directories
+
+Provides install directory variables as defined by the
+`GNU Coding Standards`_.
+
+.. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+Inclusion of this module defines the following variables:
+
+``CMAKE_INSTALL_<dir>``
+
+ Destination for files of a given type. This value may be passed to
+ the ``DESTINATION`` options of :command:`install` commands for the
+ corresponding file type.
+
+``CMAKE_INSTALL_FULL_<dir>``
+
+ The absolute path generated from the corresponding ``CMAKE_INSTALL_<dir>``
+ value. If the value is not already an absolute path, an absolute path
+ is constructed typically by prepending the value of the
+ :variable:`CMAKE_INSTALL_PREFIX` variable. However, there are some
+ `special cases`_ as documented below.
+
+where ``<dir>`` is one of:
+
+``BINDIR``
+ user executables (``bin``)
+``SBINDIR``
+ system admin executables (``sbin``)
+``LIBEXECDIR``
+ program executables (``libexec``)
+``SYSCONFDIR``
+ read-only single-machine data (``etc``)
+``SHAREDSTATEDIR``
+ modifiable architecture-independent data (``com``)
+``LOCALSTATEDIR``
+ modifiable single-machine data (``var``)
+``RUNSTATEDIR``
+ run-time variable data (``LOCALSTATEDIR/run``)
+``LIBDIR``
+ object code libraries (``lib`` or ``lib64``
+ or ``lib/<multiarch-tuple>`` on Debian)
+``INCLUDEDIR``
+ C header files (``include``)
+``OLDINCLUDEDIR``
+ C header files for non-gcc (``/usr/include``)
+``DATAROOTDIR``
+ read-only architecture-independent data root (``share``)
+``DATADIR``
+ read-only architecture-independent data (``DATAROOTDIR``)
+``INFODIR``
+ info documentation (``DATAROOTDIR/info``)
+``LOCALEDIR``
+ locale-dependent data (``DATAROOTDIR/locale``)
+``MANDIR``
+ man documentation (``DATAROOTDIR/man``)
+``DOCDIR``
+ documentation root (``DATAROOTDIR/doc/PROJECT_NAME``)
+
+If the includer does not define a value the above-shown default will be
+used and the value will appear in the cache for editing by the user.
+
+Special Cases
+^^^^^^^^^^^^^
+
+The following values of :variable:`CMAKE_INSTALL_PREFIX` are special:
+
+``/``
+
+ For ``<dir>`` other than the ``SYSCONFDIR``, ``LOCALSTATEDIR`` and
+ ``RUNSTATEDIR``, the value of ``CMAKE_INSTALL_<dir>`` is prefixed
+ with ``usr/`` if it is not user-specified as an absolute path.
+ For example, the ``INCLUDEDIR`` value ``include`` becomes ``usr/include``.
+ This is required by the `GNU Coding Standards`_, which state:
+
+ When building the complete GNU system, the prefix will be empty
+ and ``/usr`` will be a symbolic link to ``/``.
+
+``/usr``
+
+ For ``<dir>`` equal to ``SYSCONFDIR``, ``LOCALSTATEDIR`` or
+ ``RUNSTATEDIR``, the ``CMAKE_INSTALL_FULL_<dir>`` is computed by
+ prepending just ``/`` to the value of ``CMAKE_INSTALL_<dir>``
+ if it is not user-specified as an absolute path.
+ For example, the ``SYSCONFDIR`` value ``etc`` becomes ``/etc``.
+ This is required by the `GNU Coding Standards`_.
+
+``/opt/...``
+
+ For ``<dir>`` equal to ``SYSCONFDIR``, ``LOCALSTATEDIR`` or
+ ``RUNSTATEDIR``, the ``CMAKE_INSTALL_FULL_<dir>`` is computed by
+ *appending* the prefix to the value of ``CMAKE_INSTALL_<dir>``
+ if it is not user-specified as an absolute path.
+ For example, the ``SYSCONFDIR`` value ``etc`` becomes ``/etc/opt/...``.
+ This is defined by the `Filesystem Hierarchy Standard`_.
+
+.. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
+
+Macros
+^^^^^^
+
+.. command:: GNUInstallDirs_get_absolute_install_dir
+
+ ::
+
+ GNUInstallDirs_get_absolute_install_dir(absvar var)
+
+ Set the given variable ``absvar`` to the absolute path contained
+ within the variable ``var``. This is to allow the computation of an
+ absolute path, accounting for all the special cases documented
+ above. While this macro is used to compute the various
+ ``CMAKE_INSTALL_FULL_<dir>`` variables, it is exposed publicly to
+ allow users who create additional path variables to also compute
+ absolute paths where necessary, using the same logic.
+#]=======================================================================]
cmake_policy(PUSH)
cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
@@ -276,14 +277,18 @@ _GNUInstallDirs_cache_path(CMAKE_INSTALL_DATAROOTDIR "share"
_GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}"
"Read-only architecture-independent data (DATAROOTDIR)")
-if(CMAKE_SYSTEM_NAME MATCHES "^(([^k].*)?BSD|DragonFly)$")
+if(CMAKE_SYSTEM_NAME MATCHES "^(([^kF].*)?BSD|DragonFly)$")
_GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_INFODIR "info"
"Info documentation (info)")
- _GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_MANDIR "man"
- "Man documentation (man)")
else()
_GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info"
"Info documentation (DATAROOTDIR/info)")
+endif()
+
+if(CMAKE_SYSTEM_NAME MATCHES "^(([^k].*)?BSD|DragonFly)$")
+ _GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_MANDIR "man"
+ "Man documentation (man)")
+else()
_GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man"
"Man documentation (DATAROOTDIR/man)")
endif()
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index e6dcd00f7..f2e452766 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -1,189 +1,190 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# GenerateExportHeader
-# --------------------
-#
-# Function for generation of export macros for libraries
-#
-# This module provides the function GENERATE_EXPORT_HEADER().
-#
-# 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::
-#
-# GENERATE_EXPORT_HEADER( LIBRARY_TARGET
-# [BASE_NAME <base_name>]
-# [EXPORT_MACRO_NAME <export_macro_name>]
-# [EXPORT_FILE_NAME <export_file_name>]
-# [DEPRECATED_MACRO_NAME <deprecated_macro_name>]
-# [NO_EXPORT_MACRO_NAME <no_export_macro_name>]
-# [INCLUDE_GUARD_NAME <include_guard_name>]
-# [STATIC_DEFINE <static_define>]
-# [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>]
-# [DEFINE_NO_DEPRECATED]
-# [PREFIX_NAME <prefix_name>]
-# [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,
-# and the convenience variables
-# :variable:`CMAKE_CXX_VISIBILITY_PRESET <CMAKE_<LANG>_VISIBILITY_PRESET>` and
-# :variable:`CMAKE_VISIBILITY_INLINES_HIDDEN`.
-#
-# By default ``GENERATE_EXPORT_HEADER()`` generates macro names in a file
-# name determined by the name of the library. This means that in the
-# simplest case, users of ``GenerateExportHeader`` will be equivalent to:
-#
-# .. code-block:: cmake
-#
-# set(CMAKE_CXX_VISIBILITY_PRESET hidden)
-# set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
-# add_library(somelib someclass.cpp)
-# generate_export_header(somelib)
-# install(TARGETS somelib DESTINATION ${LIBRARY_INSTALL_DIR})
-# install(FILES
-# someclass.h
-# ${PROJECT_BINARY_DIR}/somelib_export.h DESTINATION ${INCLUDE_INSTALL_DIR}
-# )
-#
-#
-# And in the ABI header files:
-#
-# .. code-block:: c++
-#
-# #include "somelib_export.h"
-# class SOMELIB_EXPORT SomeClass {
-# ...
-# };
-#
-#
-# The CMake fragment will generate a file in the
-# ``${CMAKE_CURRENT_BINARY_DIR}`` called ``somelib_export.h`` containing the
-# macros ``SOMELIB_EXPORT``, ``SOMELIB_NO_EXPORT``, ``SOMELIB_DEPRECATED``,
-# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``.
-# They will be followed by content taken from the variable specified by
-# the ``CUSTOM_CONTENT_FROM_VARIABLE`` option, if any.
-# The resulting file should be installed with other headers in the library.
-#
-# The ``BASE_NAME`` argument can be used to override the file name and the
-# names used for the macros:
-#
-# .. code-block:: cmake
-#
-# add_library(somelib someclass.cpp)
-# generate_export_header(somelib
-# BASE_NAME other_name
-# )
-#
-#
-# Generates a file called ``other_name_export.h`` containing the macros
-# ``OTHER_NAME_EXPORT``, ``OTHER_NAME_NO_EXPORT`` and ``OTHER_NAME_DEPRECATED``
-# etc.
-#
-# The ``BASE_NAME`` may be overridden by specifying other options in the
-# function. For example:
-#
-# .. code-block:: cmake
-#
-# add_library(somelib someclass.cpp)
-# generate_export_header(somelib
-# EXPORT_MACRO_NAME OTHER_NAME_EXPORT
-# )
-#
-#
-# creates the macro ``OTHER_NAME_EXPORT`` instead of ``SOMELIB_EXPORT``, but
-# other macros and the generated file name is as default:
-#
-# .. code-block:: cmake
-#
-# add_library(somelib someclass.cpp)
-# generate_export_header(somelib
-# DEPRECATED_MACRO_NAME KDE_DEPRECATED
-# )
-#
-#
-# creates the macro ``KDE_DEPRECATED`` instead of ``SOMELIB_DEPRECATED``.
-#
-# If ``LIBRARY_TARGET`` is a static library, macros are defined without
-# values.
-#
-# If the same sources are used to create both a shared and a static
-# library, the uppercased symbol ``${BASE_NAME}_STATIC_DEFINE`` should be
-# used when building the static library:
-#
-# .. code-block:: cmake
-#
-# add_library(shared_variant SHARED ${lib_SRCS})
-# add_library(static_variant ${lib_SRCS})
-# generate_export_header(shared_variant BASE_NAME libshared_and_static)
-# set_target_properties(static_variant PROPERTIES
-# COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE)
-#
-# This will cause the export macros to expand to nothing when building
-# the static library.
-#
-# If ``DEFINE_NO_DEPRECATED`` is specified, then a macro
-# ``${BASE_NAME}_NO_DEPRECATED`` will be defined This macro can be used to
-# remove deprecated code from preprocessor output:
-#
-# .. code-block:: cmake
-#
-# option(EXCLUDE_DEPRECATED "Exclude deprecated parts of the library" FALSE)
-# if (EXCLUDE_DEPRECATED)
-# set(NO_BUILD_DEPRECATED DEFINE_NO_DEPRECATED)
-# endif()
-# generate_export_header(somelib ${NO_BUILD_DEPRECATED})
-#
-#
-# And then in somelib:
-#
-# .. code-block:: c++
-#
-# class SOMELIB_EXPORT SomeClass
-# {
-# public:
-# #ifndef SOMELIB_NO_DEPRECATED
-# SOMELIB_DEPRECATED void oldMethod();
-# #endif
-# };
-#
-# .. code-block:: c++
-#
-# #ifndef SOMELIB_NO_DEPRECATED
-# void SomeClass::oldMethod() { }
-# #endif
-#
-#
-# If ``PREFIX_NAME`` is specified, the argument will be used as a prefix to
-# all generated macros.
-#
-# For example:
-#
-# .. code-block:: cmake
-#
-# generate_export_header(somelib PREFIX_NAME VTK_)
-#
-# Generates the macros ``VTK_SOMELIB_EXPORT`` etc.
-#
-# ::
-#
-# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] )
-#
-# 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.
+#[=======================================================================[.rst:
+GenerateExportHeader
+--------------------
+
+Function for generation of export macros for libraries
+
+This module provides the function GENERATE_EXPORT_HEADER().
+
+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::
+
+ GENERATE_EXPORT_HEADER( LIBRARY_TARGET
+ [BASE_NAME <base_name>]
+ [EXPORT_MACRO_NAME <export_macro_name>]
+ [EXPORT_FILE_NAME <export_file_name>]
+ [DEPRECATED_MACRO_NAME <deprecated_macro_name>]
+ [NO_EXPORT_MACRO_NAME <no_export_macro_name>]
+ [INCLUDE_GUARD_NAME <include_guard_name>]
+ [STATIC_DEFINE <static_define>]
+ [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>]
+ [DEFINE_NO_DEPRECATED]
+ [PREFIX_NAME <prefix_name>]
+ [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,
+and the convenience variables
+:variable:`CMAKE_CXX_VISIBILITY_PRESET <CMAKE_<LANG>_VISIBILITY_PRESET>` and
+:variable:`CMAKE_VISIBILITY_INLINES_HIDDEN`.
+
+By default ``GENERATE_EXPORT_HEADER()`` generates macro names in a file
+name determined by the name of the library. This means that in the
+simplest case, users of ``GenerateExportHeader`` will be equivalent to:
+
+.. code-block:: cmake
+
+ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+ set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+ add_library(somelib someclass.cpp)
+ generate_export_header(somelib)
+ install(TARGETS somelib DESTINATION ${LIBRARY_INSTALL_DIR})
+ install(FILES
+ someclass.h
+ ${PROJECT_BINARY_DIR}/somelib_export.h DESTINATION ${INCLUDE_INSTALL_DIR}
+ )
+
+
+And in the ABI header files:
+
+.. code-block:: c++
+
+ #include "somelib_export.h"
+ class SOMELIB_EXPORT SomeClass {
+ ...
+ };
+
+
+The CMake fragment will generate a file in the
+``${CMAKE_CURRENT_BINARY_DIR}`` called ``somelib_export.h`` containing the
+macros ``SOMELIB_EXPORT``, ``SOMELIB_NO_EXPORT``, ``SOMELIB_DEPRECATED``,
+``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``.
+They will be followed by content taken from the variable specified by
+the ``CUSTOM_CONTENT_FROM_VARIABLE`` option, if any.
+The resulting file should be installed with other headers in the library.
+
+The ``BASE_NAME`` argument can be used to override the file name and the
+names used for the macros:
+
+.. code-block:: cmake
+
+ add_library(somelib someclass.cpp)
+ generate_export_header(somelib
+ BASE_NAME other_name
+ )
+
+
+Generates a file called ``other_name_export.h`` containing the macros
+``OTHER_NAME_EXPORT``, ``OTHER_NAME_NO_EXPORT`` and ``OTHER_NAME_DEPRECATED``
+etc.
+
+The ``BASE_NAME`` may be overridden by specifying other options in the
+function. For example:
+
+.. code-block:: cmake
+
+ add_library(somelib someclass.cpp)
+ generate_export_header(somelib
+ EXPORT_MACRO_NAME OTHER_NAME_EXPORT
+ )
+
+
+creates the macro ``OTHER_NAME_EXPORT`` instead of ``SOMELIB_EXPORT``, but
+other macros and the generated file name is as default:
+
+.. code-block:: cmake
+
+ add_library(somelib someclass.cpp)
+ generate_export_header(somelib
+ DEPRECATED_MACRO_NAME KDE_DEPRECATED
+ )
+
+
+creates the macro ``KDE_DEPRECATED`` instead of ``SOMELIB_DEPRECATED``.
+
+If ``LIBRARY_TARGET`` is a static library, macros are defined without
+values.
+
+If the same sources are used to create both a shared and a static
+library, the uppercased symbol ``${BASE_NAME}_STATIC_DEFINE`` should be
+used when building the static library:
+
+.. code-block:: cmake
+
+ add_library(shared_variant SHARED ${lib_SRCS})
+ add_library(static_variant ${lib_SRCS})
+ generate_export_header(shared_variant BASE_NAME libshared_and_static)
+ set_target_properties(static_variant PROPERTIES
+ COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE)
+
+This will cause the export macros to expand to nothing when building
+the static library.
+
+If ``DEFINE_NO_DEPRECATED`` is specified, then a macro
+``${BASE_NAME}_NO_DEPRECATED`` will be defined This macro can be used to
+remove deprecated code from preprocessor output:
+
+.. code-block:: cmake
+
+ option(EXCLUDE_DEPRECATED "Exclude deprecated parts of the library" FALSE)
+ if (EXCLUDE_DEPRECATED)
+ set(NO_BUILD_DEPRECATED DEFINE_NO_DEPRECATED)
+ endif()
+ generate_export_header(somelib ${NO_BUILD_DEPRECATED})
+
+
+And then in somelib:
+
+.. code-block:: c++
+
+ class SOMELIB_EXPORT SomeClass
+ {
+ public:
+ #ifndef SOMELIB_NO_DEPRECATED
+ SOMELIB_DEPRECATED void oldMethod();
+ #endif
+ };
+
+.. code-block:: c++
+
+ #ifndef SOMELIB_NO_DEPRECATED
+ void SomeClass::oldMethod() { }
+ #endif
+
+
+If ``PREFIX_NAME`` is specified, the argument will be used as a prefix to
+all generated macros.
+
+For example:
+
+.. code-block:: cmake
+
+ generate_export_header(somelib PREFIX_NAME VTK_)
+
+Generates the macros ``VTK_SOMELIB_EXPORT`` etc.
+
+::
+
+ ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] )
+
+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)
include(CheckCXXCompilerFlag)
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index ca710090f..fa6d75ae4 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -1,169 +1,173 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# GetPrerequisites
-# ----------------
-#
-# Functions to analyze and list executable file prerequisites.
-#
-# This module provides functions to list the .dll, .dylib or .so files
-# that an executable or shared library file depends on. (Its
-# prerequisites.)
-#
-# It uses various tools to obtain the list of required shared library
-# files:
-#
-# ::
-#
-# dumpbin (Windows)
-# objdump (MinGW on Windows)
-# ldd (Linux/Unix)
-# otool (Mac OSX)
-#
-# The following functions are provided by this module:
-#
-# ::
-#
-# get_prerequisites
-# list_prerequisites
-# list_prerequisites_by_glob
-# gp_append_unique
-# is_file_executable
-# gp_item_default_embedded_path
-# (projects can override with gp_item_default_embedded_path_override)
-# gp_resolve_item
-# (projects can override with gp_resolve_item_override)
-# gp_resolved_file_type
-# (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>
-# <exepath> <dirs> [<rpaths>])
-#
-# Get the list of shared library files required by <target>. The list
-# in the variable named <prerequisites_var> should be empty on first
-# entry to this function. On exit, <prerequisites_var> will contain the
-# list of required shared library files.
-#
-# <target> is the full path to an executable file. <prerequisites_var>
-# is the name of a CMake variable to contain the results.
-# <exclude_system> must be 0 or 1 indicating whether to include or
-# exclude "system" prerequisites. If <recurse> is set to 1 all
-# prerequisites will be found recursively, if set to 0 only direct
-# prerequisites are listed. <exepath> is the path to the top level
-# executable used for @executable_path replacment on the Mac. <dirs> is
-# a list of paths where libraries might be found: these paths are
-# searched first when a target without any path info is given. Then
-# standard system locations are also searched: PATH, Framework
-# locations, /usr/lib...
-#
-# ::
-#
-# LIST_PREREQUISITES(<target> [<recurse> [<exclude_system> [<verbose>]]])
-#
-# Print a message listing the prerequisites of <target>.
-#
-# <target> is the name of a shared library or executable target or the
-# full path to a shared library or executable file. If <recurse> is set
-# to 1 all prerequisites will be found recursively, if set to 0 only
-# direct prerequisites are listed. <exclude_system> must be 0 or 1
-# indicating whether to include or exclude "system" prerequisites. With
-# <verbose> set to 0 only the full path names of the prerequisites are
-# printed, set to 1 extra informatin will be displayed.
-#
-# ::
-#
-# LIST_PREREQUISITES_BY_GLOB(<glob_arg> <glob_exp>)
-#
-# Print the prerequisites of shared library and executable files
-# matching a globbing pattern. <glob_arg> is GLOB or GLOB_RECURSE and
-# <glob_exp> is a globbing expression used with "file(GLOB" or
-# "file(GLOB_RECURSE" to retrieve a list of matching files. If a
-# matching file is executable, its prerequisites are listed.
-#
-# Any additional (optional) arguments provided are passed along as the
-# optional arguments to the list_prerequisites calls.
-#
-# ::
-#
-# GP_APPEND_UNIQUE(<list_var> <value>)
-#
-# Append <value> to the list variable <list_var> only if the value is
-# not already in the list.
-#
-# ::
-#
-# IS_FILE_EXECUTABLE(<file> <result_var>)
-#
-# Return 1 in <result_var> if <file> is a binary executable, 0
-# otherwise.
-#
-# ::
-#
-# GP_ITEM_DEFAULT_EMBEDDED_PATH(<item> <default_embedded_path_var>)
-#
-# Return the path that others should refer to the item by when the item
-# is embedded inside a bundle.
-#
-# Override on a per-project basis by providing a project-specific
-# gp_item_default_embedded_path_override function.
-#
-# ::
-#
-# GP_RESOLVE_ITEM(<context> <item> <exepath> <dirs> <resolved_item_var>
-# [<rpaths>])
-#
-# Resolve an item into an existing full path file.
-#
-# Override on a per-project basis by providing a project-specific
-# gp_resolve_item_override function.
-#
-# ::
-#
-# GP_RESOLVED_FILE_TYPE(<original_file> <file> <exepath> <dirs> <type_var>
-# [<rpaths>])
-#
-# Return the type of <file> with respect to <original_file>. String
-# describing type of prerequisite is returned in variable named
-# <type_var>.
-#
-# Use <exepath> and <dirs> if necessary to resolve non-absolute <file>
-# values -- but only for non-embedded items.
-#
-# Possible types are:
-#
-# ::
-#
-# system
-# local
-# embedded
-# other
-#
-# Override on a per-project basis by providing a project-specific
-# gp_resolved_file_type_override function.
-#
-# ::
-#
-# GP_FILE_TYPE(<original_file> <file> <type_var>)
-#
-# Return the type of <file> with respect to <original_file>. String
-# describing type of prerequisite is returned in variable named
-# <type_var>.
-#
-# Possible types are:
-#
-# ::
-#
-# system
-# local
-# embedded
-# other
+#[=======================================================================[.rst:
+GetPrerequisites
+----------------
+
+Functions to analyze and list executable file prerequisites.
+
+This module provides functions to list the .dll, .dylib or .so files
+that an executable or shared library file depends on. (Its
+prerequisites.)
+
+It uses various tools to obtain the list of required shared library
+files:
+
+::
+
+ dumpbin (Windows)
+ objdump (MinGW on Windows)
+ ldd (Linux/Unix)
+ otool (Mac OSX)
+
+The following functions are provided by this module:
+
+::
+
+ get_prerequisites
+ list_prerequisites
+ list_prerequisites_by_glob
+ gp_append_unique
+ is_file_executable
+ gp_item_default_embedded_path
+ (projects can override with gp_item_default_embedded_path_override)
+ gp_resolve_item
+ (projects can override with gp_resolve_item_override)
+ gp_resolved_file_type
+ (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>
+ <exepath> <dirs> [<rpaths>])
+
+Get the list of shared library files required by <target>. The list
+in the variable named <prerequisites_var> should be empty on first
+entry to this function. On exit, <prerequisites_var> will contain the
+list of required shared library files.
+
+<target> is the full path to an executable file. <prerequisites_var>
+is the name of a CMake variable to contain the results.
+<exclude_system> must be 0 or 1 indicating whether to include or
+exclude "system" prerequisites. If <recurse> is set to 1 all
+prerequisites will be found recursively, if set to 0 only direct
+prerequisites are listed. <exepath> is the path to the top level
+executable used for @executable_path replacment on the Mac. <dirs> is
+a list of paths where libraries might be found: these paths are
+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.
+
+::
+
+ LIST_PREREQUISITES(<target> [<recurse> [<exclude_system> [<verbose>]]])
+
+Print a message listing the prerequisites of <target>.
+
+<target> is the name of a shared library or executable target or the
+full path to a shared library or executable file. If <recurse> is set
+to 1 all prerequisites will be found recursively, if set to 0 only
+direct prerequisites are listed. <exclude_system> must be 0 or 1
+indicating whether to include or exclude "system" prerequisites. With
+<verbose> set to 0 only the full path names of the prerequisites are
+printed, set to 1 extra informatin will be displayed.
+
+::
+
+ LIST_PREREQUISITES_BY_GLOB(<glob_arg> <glob_exp>)
+
+Print the prerequisites of shared library and executable files
+matching a globbing pattern. <glob_arg> is GLOB or GLOB_RECURSE and
+<glob_exp> is a globbing expression used with "file(GLOB" or
+"file(GLOB_RECURSE" to retrieve a list of matching files. If a
+matching file is executable, its prerequisites are listed.
+
+Any additional (optional) arguments provided are passed along as the
+optional arguments to the list_prerequisites calls.
+
+::
+
+ GP_APPEND_UNIQUE(<list_var> <value>)
+
+Append <value> to the list variable <list_var> only if the value is
+not already in the list.
+
+::
+
+ IS_FILE_EXECUTABLE(<file> <result_var>)
+
+Return 1 in <result_var> if <file> is a binary executable, 0
+otherwise.
+
+::
+
+ GP_ITEM_DEFAULT_EMBEDDED_PATH(<item> <default_embedded_path_var>)
+
+Return the path that others should refer to the item by when the item
+is embedded inside a bundle.
+
+Override on a per-project basis by providing a project-specific
+gp_item_default_embedded_path_override function.
+
+::
+
+ GP_RESOLVE_ITEM(<context> <item> <exepath> <dirs> <resolved_item_var>
+ [<rpaths>])
+
+Resolve an item into an existing full path file.
+
+Override on a per-project basis by providing a project-specific
+gp_resolve_item_override function.
+
+::
+
+ GP_RESOLVED_FILE_TYPE(<original_file> <file> <exepath> <dirs> <type_var>
+ [<rpaths>])
+
+Return the type of <file> with respect to <original_file>. String
+describing type of prerequisite is returned in variable named
+<type_var>.
+
+Use <exepath> and <dirs> if necessary to resolve non-absolute <file>
+values -- but only for non-embedded items.
+
+Possible types are:
+
+::
+
+ system
+ local
+ embedded
+ other
+
+Override on a per-project basis by providing a project-specific
+gp_resolved_file_type_override function.
+
+::
+
+ GP_FILE_TYPE(<original_file> <file> <type_var>)
+
+Return the type of <file> with respect to <original_file>. String
+describing type of prerequisite is returned in variable named
+<type_var>.
+
+Possible types are:
+
+::
+
+ system
+ local
+ embedded
+ other
+#]=======================================================================]
function(gp_append_unique list_var value)
set(contains 0)
@@ -643,6 +647,10 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(rpaths "")
endif()
+ if(GET_PREREQUISITES_VERBOSE)
+ set(verbose 1)
+ endif()
+
if(NOT IS_ABSOLUTE "${target}")
message("warning: target '${target}' is not absolute...")
endif()
@@ -652,6 +660,15 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
return()
endif()
+ # Check for a script by extension (.bat,.sh,...) or if the file starts with "#!" (shebang)
+ file(READ ${target} file_contents LIMIT 5)
+ if(target MATCHES "\\.(bat|c?sh|bash|ksh|cmd)$" OR file_contents MATCHES "^#!")
+ message(STATUS "GetPrequisites(${target}) : ignoring script file")
+ # Clear var
+ set(${prerequisites_var} "" PARENT_SCOPE)
+ return()
+ endif()
+
set(gp_cmd_paths ${gp_cmd_paths}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]/../../VC/bin"
"$ENV{VS140COMNTOOLS}/../../VC/bin"
@@ -710,25 +727,25 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(gp_cmd_maybe_filter) # optional command to pre-filter gp_tool results
- if(gp_tool STREQUAL "ldd")
+ if(gp_tool MATCHES "ldd$")
set(gp_cmd_args "")
set(gp_regex "^[\t ]*[^\t ]+ => ([^\t\(]+) .*${eol_char}$")
set(gp_regex_error "not found${eol_char}$")
set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$")
set(gp_regex_cmp_count 1)
- elseif(gp_tool STREQUAL "otool")
+ elseif(gp_tool MATCHES "otool$")
set(gp_cmd_args "-L")
set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
set(gp_regex_error "")
set(gp_regex_fallback "")
set(gp_regex_cmp_count 3)
- elseif(gp_tool STREQUAL "dumpbin")
+ elseif(gp_tool MATCHES "dumpbin$")
set(gp_cmd_args "/dependents")
set(gp_regex "^ ([^ ].*[Dd][Ll][Ll])${eol_char}$")
set(gp_regex_error "")
set(gp_regex_fallback "")
set(gp_regex_cmp_count 1)
- elseif(gp_tool STREQUAL "objdump")
+ elseif(gp_tool MATCHES "objdump$")
set(gp_cmd_args "-p")
set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$")
set(gp_regex_error "")
@@ -751,7 +768,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
endif()
- if(gp_tool STREQUAL "dumpbin")
+ if(gp_tool MATCHES "dumpbin$")
# When running dumpbin, it also needs the "Common7/IDE" directory in the
# PATH. It will already be in the PATH if being run from a Visual Studio
# command prompt. Add it to the PATH here in case we are running from a
@@ -780,7 +797,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
#
# </setup-gp_tool-vars>
- if(gp_tool STREQUAL "ldd")
+ if(gp_tool MATCHES "ldd$")
set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
set(new_ld_env "${exepath}")
foreach(dir ${dirs})
@@ -805,7 +822,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
ERROR_VARIABLE gp_ev
)
- if(gp_tool STREQUAL "dumpbin")
+ if(gp_tool MATCHES "dumpbin$")
# Exclude delay load dependencies under windows (they are listed in dumpbin output after the message below)
string(FIND "${gp_cmd_ov}" "Image has the following delay load dependencies" gp_delayload_pos)
if (${gp_delayload_pos} GREATER -1)
@@ -819,7 +836,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
endif()
if(NOT gp_rv STREQUAL "0")
- if(gp_tool STREQUAL "dumpbin")
+ if(gp_tool MATCHES "dumpbin$")
# dumpbin error messages seem to go to stdout
message(FATAL_ERROR "${gp_cmd} failed: ${gp_rv}\n${gp_ev}\n${gp_cmd_ov}")
else()
@@ -827,7 +844,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
endif()
endif()
- if(gp_tool STREQUAL "ldd")
+ if(gp_tool MATCHES "ldd$")
set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
endif()
@@ -847,9 +864,9 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# check for install id and remove it from list, since otool -L can include a
# reference to itself
set(gp_install_id)
- if(gp_tool STREQUAL "otool")
+ if(gp_tool MATCHES "otool$")
execute_process(
- COMMAND otool -D ${target}
+ COMMAND ${gp_cmd} -D ${target}
RESULT_VARIABLE otool_rv
OUTPUT_VARIABLE gp_install_id_ov
ERROR_VARIABLE otool_ev
diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake
index 5a4bdcad3..4abbbecf7 100644
--- a/Modules/GoogleTestAddTests.cmake
+++ b/Modules/GoogleTestAddTests.cmake
@@ -30,6 +30,7 @@ if(NOT EXISTS "${TEST_EXECUTABLE}")
endif()
execute_process(
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" --gtest_list_tests
+ WORKING_DIRECTORY "${TEST_WORKING_DIR}"
TIMEOUT ${TEST_DISCOVERY_TIMEOUT}
OUTPUT_VARIABLE output
RESULT_VARIABLE result
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index b5e5d69f8..5ba8687ec 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -1,60 +1,61 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# InstallRequiredSystemLibraries
-# ------------------------------
-#
-# Include this module to search for compiler-provided system runtime
-# libraries and add install rules for them. Some optional variables
-# may be set prior to including the module to adjust behavior:
-#
-# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS``
-# Specify additional runtime libraries that may not be detected.
-# After inclusion any detected libraries will be appended to this.
-#
-# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP``
-# Set to TRUE to skip calling the :command:`install(PROGRAMS)` command to
-# allow the includer to specify its own install rule, using the value of
-# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS`` to get the list of libraries.
-#
-# ``CMAKE_INSTALL_DEBUG_LIBRARIES``
-# Set to TRUE to install the debug runtime libraries when available
-# with MSVC tools.
-#
-# ``CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY``
-# Set to TRUE to install only the debug runtime libraries with MSVC
-# tools even if the release runtime libraries are also available.
-#
-# ``CMAKE_INSTALL_UCRT_LIBRARIES``
-# 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.
-#
-# ``CMAKE_INSTALL_MFC_LIBRARIES``
-# Set to TRUE to install the MSVC MFC runtime libraries.
-#
-# ``CMAKE_INSTALL_OPENMP_LIBRARIES``
-# Set to TRUE to install the MSVC OpenMP runtime libraries
-#
-# ``CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION``
-# Specify the :command:`install(PROGRAMS)` command ``DESTINATION``
-# option. If not specified, the default is ``bin`` on Windows
-# and ``lib`` elsewhere.
-#
-# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS``
-# Set to TRUE to disable warnings about required library files that
-# do not exist. (For example, Visual Studio Express editions may
-# not provide the redistributable files.)
-#
-# ``CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT``
-# Specify the :command:`install(PROGRAMS)` command ``COMPONENT``
-# option. If not specified, no such option will be used.
+#[=======================================================================[.rst:
+InstallRequiredSystemLibraries
+------------------------------
+
+Include this module to search for compiler-provided system runtime
+libraries and add install rules for them. Some optional variables
+may be set prior to including the module to adjust behavior:
+
+``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS``
+ Specify additional runtime libraries that may not be detected.
+ After inclusion any detected libraries will be appended to this.
+
+``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP``
+ Set to TRUE to skip calling the :command:`install(PROGRAMS)` command to
+ allow the includer to specify its own install rule, using the value of
+ ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS`` to get the list of libraries.
+
+``CMAKE_INSTALL_DEBUG_LIBRARIES``
+ Set to TRUE to install the debug runtime libraries when available
+ with MSVC tools.
+
+``CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY``
+ Set to TRUE to install only the debug runtime libraries with MSVC
+ tools even if the release runtime libraries are also available.
+
+``CMAKE_INSTALL_UCRT_LIBRARIES``
+ 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.
+
+``CMAKE_INSTALL_MFC_LIBRARIES``
+ Set to TRUE to install the MSVC MFC runtime libraries.
+
+``CMAKE_INSTALL_OPENMP_LIBRARIES``
+ Set to TRUE to install the MSVC OpenMP runtime libraries
+
+``CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION``
+ Specify the :command:`install(PROGRAMS)` command ``DESTINATION``
+ option. If not specified, the default is ``bin`` on Windows
+ and ``lib`` elsewhere.
+
+``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS``
+ Set to TRUE to disable warnings about required library files that
+ do not exist. (For example, Visual Studio Express editions may
+ not provide the redistributable files.)
+
+``CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT``
+ Specify the :command:`install(PROGRAMS)` command ``COMPONENT``
+ option. If not specified, no such option will be used.
+#]=======================================================================]
cmake_policy(PUSH)
cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
diff --git a/Modules/Internal/CMakeCheckCompilerFlag.cmake b/Modules/Internal/CMakeCheckCompilerFlag.cmake
new file mode 100644
index 000000000..9c8dfb617
--- /dev/null
+++ b/Modules/Internal/CMakeCheckCompilerFlag.cmake
@@ -0,0 +1,158 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=[
+
+NOTE: This function is used internally by CMake. Projects should not include
+ this file directly.
+
+The cmake_check_compiler_flag() function can be used to compile and link a
+source file to check whether a specific compiler or linker flag is supported.
+The function does not use the try_compile() command so as to avoid infinite
+recursion. It may not work for all platforms or toolchains, the caller is
+responsible for ensuring it is only called in valid situations.
+
+ cmake_check_compiler_flag(<lang> <flag> <result>
+ [SRC_EXT <ext>] [COMMAND_PATTERN <pattern>]
+ [FAIL_REGEX <regex> ...]
+ [OUTPUT_VARIABLE <output>])
+
+Parameters:
+ <lang> - Language to check.
+ <flag> - The flag to add to the compile/link command line.
+ <result> - Boolean output variable. It will be stored in the cache as an
+ internal variable and if true, will cause future tests that assign
+ to that variable to be bypassed.
+
+Optional parameters:
+ SRC_EXT - Overrides the extension of the source file used for the
+ check. Defaults are 'c' (C), 'cxx' (CXX), 'F' (Fortran).
+ COMMAND_PATTERN - Pattern to be used for the command line. The default is
+ '<FLAG> -o <OUTPUT> <SOURCE>'
+ FAIL_REGEX - List of additional regular expressions that, if matched by
+ the output, give a failed result for the check. A common
+ set of regular expressions will be included in addition to
+ those given by FAIL_REGEX.
+ OUTPUT_VARIABLE - Set <output> variable with details about any error.
+#]=]
+
+include_guard(GLOBAL)
+include(CMakeCheckCompilerFlagCommonPatterns)
+
+function(CMAKE_CHECK_COMPILER_FLAG lang flag result)
+ # Cache results between runs similar to check_<lang>_source_compiles()
+ if(DEFINED ${result})
+ return()
+ endif()
+
+ set(comment "Is the '${flag}' option(s) supported")
+ string(REPLACE ";" " " comment "${comment}")
+
+ if (NOT lang MATCHES "^(C|CXX|Fortran|ASM)$")
+ # other possible languages are not supported
+ # log message to keep trace of this problem...
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Function 'CMAKE_CHECK_COMPILER_FLAG' called with unsupported language: ${lang}\n")
+ set(${result} FALSE CACHE INTERNAL ${comment})
+ return()
+ endif()
+ if (lang STREQUAL "ASM")
+ # assume ASM compiler is a multi-language compiler, so supports C language as well
+ set(check_lang C)
+ else()
+ set(check_lang ${lang})
+ endif()
+
+ cmake_parse_arguments(CCCF "" "SRC_EXT;COMMAND_PATTERN;OUTPUT_VARIABLE" "FAIL_REGEX" ${ARGN})
+
+ if (NOT CCCF_COMMAND_PATTERN)
+ set (CCCF_COMMAND_PATTERN "<FLAG> -o <OUTPUT> <SOURCE>")
+ endif()
+
+ list (APPEND CCCF_FAIL_REGEX "argument unused during compilation") # clang
+ if (check_lang STREQUAL "C")
+ list(APPEND CCCF_FAIL_REGEX
+ "command line option .* is valid for .* but not for C") # GNU
+ elseif(check_lang STREQUAL "CXX")
+ list(APPEND CCCF_FAIL_REGEX
+ "command line option .* is valid for .* but not for C\\+\\+") # GNU
+ elseif(check_lang STREQUAL "Fortran")
+ list(APPEND CCCF_FAIL_REGEX
+ "command line option .* is valid for .* but not for Fortran") # GNU
+ endif()
+
+ # Add patterns for common errors
+ check_compiler_flag_common_patterns(COMPILER_FLAG_COMMON_PATTERNS)
+ foreach(arg IN LISTS COMPILER_FLAG_COMMON_PATTERNS)
+ if(arg MATCHES "^FAIL_REGEX$")
+ continue()
+ endif()
+ list(APPEND CCCF_FAIL_REGEX "${arg}")
+ endforeach()
+
+ if(NOT CCCF_SRC_EXT)
+ if (check_lang STREQUAL "C")
+ set(CCCF_SRC_EXT c)
+ elseif(check_lang STREQUAL "CXX")
+ set(CCCF_SRC_EXT cxx)
+ elseif(check_lang STREQUAL "Fortran")
+ set(CCCF_SRC_EXT F)
+ endif()
+ endif()
+
+ if (CCCF_OUTPUT_VARIABLE)
+ unset(${CCCF_OUTPUT_VARIABLE} PARENT_SCOPE)
+ endif()
+
+ # Compute the directory in which to run the test.
+ set(COMPILER_FLAG_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp")
+ # Compute source and output files.
+ set(COMPILER_FLAG_SRC
+ "${COMPILER_FLAG_DIR}/CompilerFlag${lang}.${CCCF_SRC_EXT}")
+ if(check_lang STREQUAL "Fortran")
+ file(WRITE "${COMPILER_FLAG_SRC}"
+ " program simple\n end program simple\n")
+ else()
+ file(WRITE "${COMPILER_FLAG_SRC}" "int main (void)\n{ return 0; }\n")
+ endif()
+ get_filename_component(COMPILER_FLAG_EXE "${COMPILER_FLAG_SRC}" NAME_WE)
+ string(APPEND COMPILER_FLAG_EXE "${CMAKE_EXECUTABLE_SUFFIX}")
+
+ # Build command line
+ separate_arguments(CCCF_COMMAND_PATTERN UNIX_COMMAND
+ "${CCCF_COMMAND_PATTERN}")
+ list(TRANSFORM CCCF_COMMAND_PATTERN REPLACE "<SOURCE>" "${COMPILER_FLAG_SRC}")
+ list(TRANSFORM CCCF_COMMAND_PATTERN REPLACE "<OUTPUT>" "${COMPILER_FLAG_EXE}")
+ list(TRANSFORM CCCF_COMMAND_PATTERN REPLACE "<FLAG>" "${flag}")
+
+ execute_process(
+ COMMAND "${CMAKE_COMMAND}" -E env LC_ALL=C LC_MESSAGES=C LANG=C
+ "${CMAKE_${lang}_COMPILER}" ${CCCF_COMMAND_PATTERN}
+ WORKING_DIRECTORY "${COMPILER_FLAG_DIR}"
+ OUTPUT_VARIABLE COMPILER_FLAG_OUTPUT
+ ERROR_VARIABLE COMPILER_FLAG_OUTPUT
+ RESULT_VARIABLE COMPILER_FLAG_RESULT)
+
+ # Record result in the cache so we can avoid re-testing every CMake run
+ if (COMPILER_FLAG_RESULT)
+ set(${result} FALSE CACHE INTERNAL ${comment})
+ else()
+ foreach(regex IN LISTS CCCF_FAIL_REGEX)
+ if(COMPILER_FLAG_OUTPUT MATCHES "${regex}")
+ set(${result} FALSE CACHE INTERNAL ${comment})
+ endif()
+ endforeach()
+ endif()
+ if (DEFINED ${result})
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the ${flag} option "
+ "is supported for ${lang} language failed with the following output:\n"
+ "${COMPILER_FLAG_OUTPUT}\n")
+ if (CCCF_OUTPUT_VARIABLE)
+ set(${CCCF_OUTPUT_VARIABLE} "${COMPILER_FLAG_OUTPUT}" PARENT_SCOPE)
+ endif()
+ return()
+ endif()
+
+ set(${result} TRUE CACHE INTERNAL ${comment})
+endfunction()
diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake
index 3042a16f8..89dc6f024 100644
--- a/Modules/Internal/CPack/CPackDeb.cmake
+++ b/Modules/Internal/CPack/CPackDeb.cmake
@@ -482,13 +482,16 @@ function(cpack_deb_prepare_package_vars)
endif()
if(CPACK_DEBIAN_ARCHIVE_TYPE)
- set(archive_types_ "paxr;gnutar")
- if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_)
+ if(CPACK_DEBIAN_ARCHIVE_TYPE STREQUAL "paxr")
+ message(DEPRECATION "CPACK_DEBIAN_ARCHIVE_TYPE set to old and invalid "
+ "type 'paxr', mapping to 'gnutar'")
+ set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar")
+ elseif(NOT CPACK_DEBIAN_ARCHIVE_TYPE STREQUAL "gnutar")
message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported"
"type ${CPACK_DEBIAN_ARCHIVE_TYPE}")
endif()
else()
- set(CPACK_DEBIAN_ARCHIVE_TYPE "paxr")
+ set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar")
endif()
# Compression: (recommended)
diff --git a/Modules/MacroAddFileDependencies.cmake b/Modules/MacroAddFileDependencies.cmake
index db2681478..39393d6cc 100644
--- a/Modules/MacroAddFileDependencies.cmake
+++ b/Modules/MacroAddFileDependencies.cmake
@@ -1,19 +1,20 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# MacroAddFileDependencies
-# ------------------------
-#
-# MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...)
-#
-# Using the macro MACRO_ADD_FILE_DEPENDENCIES() is discouraged. There
-# are usually better ways to specify the correct dependencies.
-#
-# 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.
+#[=======================================================================[.rst:
+MacroAddFileDependencies
+------------------------
+
+MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...)
+
+Using the macro MACRO_ADD_FILE_DEPENDENCIES() is discouraged. There
+are usually better ways to specify the correct dependencies.
+
+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)
diff --git a/Modules/Platform/Android/abi-common.cmake b/Modules/Platform/Android/abi-common.cmake
index 10fb8972d..a0b47f4e6 100644
--- a/Modules/Platform/Android/abi-common.cmake
+++ b/Modules/Platform/Android/abi-common.cmake
@@ -12,10 +12,6 @@ if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
-if(CMAKE_POSITION_INDEPENDENT_CODE)
- string(APPEND _ANDROID_ABI_INIT_EXE_LDFLAGS " -fPIE -pie")
-endif()
-
string(APPEND _ANDROID_ABI_INIT_EXE_LDFLAGS " -Wl,--gc-sections")
if(NOT _ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc)
diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake
index 784c8c676..ca90712dc 100644
--- a/Modules/Platform/CYGWIN-GNU.cmake
+++ b/Modules/Platform/CYGWIN-GNU.cmake
@@ -27,6 +27,9 @@ macro(__cygwin_compiler_gnu lang)
# No -fPIC on cygwin
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
+ set(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
+ set(CMAKE_${lang}_LINK_OPTIONS_PIE "")
+ set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
# Initialize C link type selection flags. These flags are used when
diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake
index 3db77aacb..2d797f68f 100644
--- a/Modules/Platform/Darwin-Initialize.cmake
+++ b/Modules/Platform/Darwin-Initialize.cmake
@@ -34,7 +34,7 @@ string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1"
# CMAKE_OSX_DEPLOYMENT_TARGET
# Set cache variable - end user may change this during ccmake or cmake-gui configure.
-if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3)
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND _CURRENT_OSX_VERSION VERSION_GREATER 10.3)
set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING
"Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.")
endif()
@@ -49,6 +49,12 @@ elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND
(NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}"))
# Use the value of SDKROOT from the environment.
set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}")
+elseif(CMAKE_SYSTEM_NAME STREQUAL iOS)
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "iphoneos")
+elseif(CMAKE_SYSTEM_NAME STREQUAL tvOS)
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "appletvos")
+elseif(CMAKE_SYSTEM_NAME STREQUAL watchOS)
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "watchos")
elseif("${CMAKE_GENERATOR}" MATCHES Xcode
OR CMAKE_OSX_DEPLOYMENT_TARGET
OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]"
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 727baa6e1..5590433a3 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -1,5 +1,13 @@
set(APPLE 1)
+if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
+ set(CMAKE_MACOSX_BUNDLE ON)
+
+ set(CMAKE_FIND_ROOT_PATH "${_CMAKE_OSX_SYSROOT_PATH}")
+ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+endif()
+
# Darwin versions:
# 6.x == Mac OSX 10.2 (Jaguar)
# 7.x == Mac OSX 10.3 (Panther)
@@ -206,7 +214,7 @@ include(Platform/UnixPaths)
if(_CMAKE_OSX_SYSROOT_PATH AND EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_CMAKE_OSX_SYSROOT_PATH}/usr)
foreach(lang C CXX)
- list(APPEND CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
+ list(APPEND _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
endforeach()
endif()
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
diff --git a/Modules/Platform/DragonFly.cmake b/Modules/Platform/DragonFly.cmake
index c22677b9d..12e5f3ccc 100644
--- a/Modules/Platform/DragonFly.cmake
+++ b/Modules/Platform/DragonFly.cmake
@@ -3,3 +3,7 @@
# see http://archive.netbsd.se/?ml=dfbsd-users&a=2007-07&m=4678361
include(Platform/FreeBSD)
+
+# DragonFly BSD requires -z origin to enable $ORIGIN expansion in RPATH.
+# This is not required for FreeBSD since 10.2-RELEASE.
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-z,origin,-rpath,")
diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake
index ce4d3ce49..4a4c00dc4 100644
--- a/Modules/Platform/FreeBSD.cmake
+++ b/Modules/Platform/FreeBSD.cmake
@@ -1,11 +1,14 @@
set(CMAKE_DL_LIBS "")
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+# PIE link options are managed in Compiler/<compiler>.cmake file
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
+# Does not require -z origin since 10.2-RELEASE
+set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
diff --git a/Modules/Platform/Fuchsia.cmake b/Modules/Platform/Fuchsia.cmake
index 896da7bfb..4b1380506 100644
--- a/Modules/Platform/Fuchsia.cmake
+++ b/Modules/Platform/Fuchsia.cmake
@@ -3,6 +3,9 @@ set(FUCHSIA 1)
set(CMAKE_DL_LIBS "")
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+set(_CMAKE_C_PIE_MAY_BE_SUPPORTED_BY_LINKER YES)
+set(CMAKE_C_LINK_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE} "-pie")
+set(CMAKE_C_LINK_OPTIONS_NO_PIE "-no-pie")
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake
index 9b384df8a..25004c60b 100644
--- a/Modules/Platform/GHS-MULTI-Initialize.cmake
+++ b/Modules/Platform/GHS-MULTI-Initialize.cmake
@@ -9,6 +9,9 @@ mark_as_advanced(GHS_OS_ROOT)
set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory")
mark_as_advanced(GHS_OS_DIR)
+set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler os option")
+mark_as_advanced(GHS_OS_DIR)
+
#set GHS_OS_DIR if not set by user
if ( NOT GHS_OS_DIR )
if (EXISTS ${GHS_OS_ROOT})
@@ -23,8 +26,11 @@ if ( NOT GHS_OS_DIR )
endif ()
#filter based on platform name
- if (GHS_TARGET_PLATFORM STREQUAL "integrity")
+ if (GHS_TARGET_PLATFORM MATCHES "integrity")
list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z].*")
+ else() #fall-back for standalone
+ unset(GHS_CANDIDATE_OS_DIRS)
+ set(GHS_OS_DIR "IGNORE")
endif ()
if (GHS_CANDIDATE_OS_DIRS)
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
index dfc2664d3..7e0af6166 100644
--- a/Modules/Platform/Haiku.cmake
+++ b/Modules/Platform/Haiku.cmake
@@ -11,6 +11,7 @@ set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake
deleted file mode 100644
index 12b0f3774..000000000
--- a/Modules/Platform/IRIX.cmake
+++ /dev/null
@@ -1,53 +0,0 @@
-set(CMAKE_DL_LIBS "")
-set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared")
-set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
-set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
-if(NOT CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_CREATE_STATIC_LIBRARY
- "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>")
- set (CMAKE_CXX_FLAGS_INIT "")
- set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
- set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG")
- set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
- set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2")
- set (CMAKE_C_FLAGS_INIT "")
-endif()
-# set flags for gcc support
-include(Platform/UnixPaths)
-
-if(NOT CMAKE_COMPILER_IS_GNUCC)
- set (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
- set (CMAKE_C_CREATE_ASSEMBLY_SOURCE
- "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE>"
- "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
- )
-endif()
-
-if(NOT CMAKE_COMPILER_IS_GNUCXX)
- set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
- set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE
- "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>"
- "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
- )
-endif()
-
-if(NOT CMAKE_COMPILER_IS_GNUG77)
- set (CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
- set (CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE
- "<CMAKE_Fortran_COMPILER> <FLAGS> -S <SOURCE>"
- "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
- )
-endif()
-
-# Initialize C link type selection flags. These flags are used when
-# building a shared library, shared module, or executable that links
-# to other libraries to select whether to use the static or shared
-# versions of the libraries.
-foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
- set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
- set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
-endforeach()
-
-# The IRIX linker needs to find transitive shared library dependencies
-# in the -L path.
-set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake
deleted file mode 100644
index ee9b96e89..000000000
--- a/Modules/Platform/IRIX64.cmake
+++ /dev/null
@@ -1,73 +0,0 @@
-set(CMAKE_DL_LIBS "")
-set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared")
-set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
-set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
-set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
-if(NOT CMAKE_COMPILER_IS_GNUCC)
- # Set default flags init.
- set(CMAKE_C_FLAGS_INIT "")
- set(CMAKE_CXX_FLAGS_INIT "")
- set(CMAKE_Fortran_FLAGS_INIT "")
- set(CMAKE_EXE_LINKER_FLAGS_INIT "")
- set(CMAKE_SHARED_LINKER_FLAGS_INIT "")
- set(CMAKE_MODULE_LINKER_FLAGS_INIT "")
-
- # If no -o32, -n32, or -64 flag is given, set a reasonable default.
- if("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)")
- else()
- # Check if this is a 64-bit CMake.
- if(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$")
- exec_program(file ARGS ${CMAKE_COMMAND} OUTPUT_VARIABLE CMAKE_FILE_SELF)
- set(CMAKE_FILE_SELF "${CMAKE_FILE_SELF}" CACHE INTERNAL
- "Output of file command on ${CMAKE_COMMAND}.")
- endif()
-
- # Set initial flags to match cmake executable.
- if(CMAKE_FILE_SELF MATCHES " 64-bit ")
- set(CMAKE_C_FLAGS_INIT "-64")
- set(CMAKE_CXX_FLAGS_INIT "-64")
- set(CMAKE_Fortran_FLAGS_INIT "-64")
- set(CMAKE_EXE_LINKER_FLAGS_INIT "-64")
- set(CMAKE_SHARED_LINKER_FLAGS_INIT "-64")
- set(CMAKE_MODULE_LINKER_FLAGS_INIT "-64")
- endif()
- endif()
-
- # Set remaining defaults.
- set(CMAKE_CXX_CREATE_STATIC_LIBRARY
- "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>")
- set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
- set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG")
- set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
- set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2")
-endif()
-include(Platform/UnixPaths)
-
-if(NOT CMAKE_COMPILER_IS_GNUCC)
- set (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
- set (CMAKE_C_CREATE_ASSEMBLY_SOURCE
- "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE>"
- "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
- )
-endif()
-
-if(NOT CMAKE_COMPILER_IS_GNUCXX)
- set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
- set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE
- "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE>"
- "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
- )
-endif()
-
-# Initialize C link type selection flags. These flags are used when
-# building a shared library, shared module, or executable that links
-# to other libraries to select whether to use the static or shared
-# versions of the libraries.
-foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
- set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
- set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
-endforeach()
-
-# The IRIX linker needs to find transitive shared library dependencies
-# in the -L path.
-set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake
index f712e2b5f..3b5ca59ca 100644
--- a/Modules/Platform/Linux-Intel.cmake
+++ b/Modules/Platform/Linux-Intel.cmake
@@ -23,6 +23,12 @@ endif()
macro(__linux_compiler_intel 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)
+ if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 13.0)
+ 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")
+ endif()
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake
index db032c292..034165454 100644
--- a/Modules/Platform/Linux-PGI.cmake
+++ b/Modules/Platform/Linux-PGI.cmake
@@ -12,6 +12,9 @@ macro(__linux_compiler_pgi lang)
# Shared library compile and link flags.
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
+ set(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
+ set(CMAKE_${lang}_LINK_OPTIONS_PIE "")
+ set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS " ")
diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
index 1f8c1b4c1..b5d5464ea 100644
--- a/Modules/Platform/Linux.cmake
+++ b/Modules/Platform/Linux.cmake
@@ -1,6 +1,7 @@
set(CMAKE_DL_LIBS "dl")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake
index 1004eb310..d99cb4a77 100644
--- a/Modules/Platform/NetBSD.cmake
+++ b/Modules/Platform/NetBSD.cmake
@@ -1,11 +1,13 @@
set(CMAKE_DL_LIBS "")
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+# PIE link options are managed in Compiler/<compiler>.cmake file
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
+set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake
index 6466a0a01..97e2a6a83 100644
--- a/Modules/Platform/OpenBSD.cmake
+++ b/Modules/Platform/OpenBSD.cmake
@@ -15,6 +15,10 @@ if(NOT CMAKE_PLATFORM_RUNTIME_PATH)
"${LDCONFIG_HINTS}")
endif()
+# OpenBSD requires -z origin to enable $ORIGIN expansion in RPATH.
+# This is not required for NetBSD.
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-z,origin,-rpath,")
+
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1)
# OpenBSD has no multilib
diff --git a/Modules/Platform/SINIX.cmake b/Modules/Platform/SINIX.cmake
index c37a113d3..e3b0a0516 100644
--- a/Modules/Platform/SINIX.cmake
+++ b/Modules/Platform/SINIX.cmake
@@ -1,4 +1,7 @@
set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
set(CMAKE_C_COMPILE_OPTIONS_PIE "")
+set(_CMAKE_C_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
+set(CMAKE_C_LINK_OPTIONS_PIE "")
+set(CMAKE_C_LINK_OPTIONS_NO_PIE "")
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
include(Platform/UnixPaths)
diff --git a/Modules/Platform/SunOS-GNU.cmake b/Modules/Platform/SunOS-GNU.cmake
index 485f23533..47334d6cb 100644
--- a/Modules/Platform/SunOS-GNU.cmake
+++ b/Modules/Platform/SunOS-GNU.cmake
@@ -11,6 +11,7 @@ set(__SUNOS_COMPILER_GNU 1)
macro(__sunos_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-R")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
+ set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-h")
# Initialize C link type selection flags. These flags are used when
diff --git a/Modules/Platform/UNIX_SV.cmake b/Modules/Platform/UNIX_SV.cmake
index 1ec96aea2..bd1ffce3a 100644
--- a/Modules/Platform/UNIX_SV.cmake
+++ b/Modules/Platform/UNIX_SV.cmake
@@ -1,5 +1,8 @@
set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
set(CMAKE_C_COMPILE_OPTIONS_PIE "")
+set(_CMAKE_C_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
+set(CMAKE_C_LINK_OPTIONS_PIE "")
+set(CMAKE_C_LINK_OPTIONS_NO_PIE "")
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport")
include(Platform/UnixPaths)
diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
index 328d3c6d3..97f744d52 100644
--- a/Modules/Platform/UnixPaths.cmake
+++ b/Modules/Platform/UnixPaths.cmake
@@ -63,16 +63,29 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
/lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64
)
-list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
- /usr/include
+if(CMAKE_SYSROOT_COMPILE)
+ set(_cmake_sysroot_compile "${CMAKE_SYSROOT_COMPILE}")
+else()
+ set(_cmake_sysroot_compile "${CMAKE_SYSROOT}")
+endif()
+
+# Default per-language values. These may be later replaced after
+# parsing the implicit directory information from compiler output.
+set(_CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES_INIT
+ ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}
+ "${_cmake_sysroot_compile}/usr/include"
)
-list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
- /usr/include
+set(_CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES_INIT
+ ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
+ "${_cmake_sysroot_compile}/usr/include"
)
-list(APPEND CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES
- /usr/include
+set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT
+ ${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES}
+ "${_cmake_sysroot_compile}/usr/include"
)
+unset(_cmake_sysroot_compile)
+
# Enable use of lib32 and lib64 search path variants by default.
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE)
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
diff --git a/Modules/Platform/UnixWare.cmake b/Modules/Platform/UnixWare.cmake
index e649bd2a4..94888d9c0 100644
--- a/Modules/Platform/UnixWare.cmake
+++ b/Modules/Platform/UnixWare.cmake
@@ -1,5 +1,8 @@
set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
set(CMAKE_C_COMPILE_OPTIONS_PIE "")
+set(_CMAKE_C_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
+set(CMAKE_C_LINK_OPTIONS_PIE "")
+set(CMAKE_C_LINK_OPTIONS_NO_PIE "")
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-Wl,-Bexport")
include(Platform/UnixPaths)
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index cfb325b9d..71189b169 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -72,6 +72,9 @@ macro(__windows_compiler_gnu lang)
# No -fPIC on Windows
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
+ set(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
+ set(CMAKE_${lang}_LINK_OPTIONS_PIE "")
+ set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE})
diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake
index 767fec541..06d8f50ff 100644
--- a/Modules/Platform/Windows-Intel-C.cmake
+++ b/Modules/Platform/Windows-Intel-C.cmake
@@ -1,2 +1,4 @@
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>")
diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake
index 84cd303ec..666de6ee4 100644
--- a/Modules/Platform/Windows-Intel-CXX.cmake
+++ b/Modules/Platform/Windows-Intel-CXX.cmake
@@ -1,3 +1,5 @@
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>")
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index ae180ed7c..2daf313bc 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -298,8 +298,8 @@ unset(_MACHINE_ARCH_FLAG)
macro(__windows_compiler_msvc lang)
if(NOT MSVC_VERSION LESS 1400)
# for 2005 make sure the manifest is put in the dll with mt
- set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ")
- set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ")
+ set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ")
+ set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ")
endif()
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
"${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
@@ -366,12 +366,15 @@ macro(__windows_compiler_msvc lang)
endif()
set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON)
set(CMAKE_NINJA_DEPTYPE_${lang} msvc)
+ __windows_compiler_msvc_enable_rc("${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}")
+endmacro()
+macro(__windows_compiler_msvc_enable_rc flags)
if(NOT CMAKE_RC_COMPILER_INIT)
set(CMAKE_RC_COMPILER_INIT rc)
endif()
if(NOT CMAKE_RC_FLAGS_INIT)
- string(APPEND CMAKE_RC_FLAGS_INIT " ${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}")
+ string(APPEND CMAKE_RC_FLAGS_INIT " ${flags}")
endif()
if(NOT CMAKE_RC_FLAGS_DEBUG_INIT)
string(APPEND CMAKE_RC_FLAGS_DEBUG_INIT " /D_DEBUG")
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index ba1638f87..6a2667aa6 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -17,8 +17,8 @@ endforeach()
set(CMAKE_CUDA_LINK_EXECUTABLE
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
-set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ")
-set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ")
+set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ")
+set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ")
set(CMAKE_CUDA_CREATE_SHARED_LIBRARY
"${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICT_LINKS} ${CMAKE_END_TEMP_FILE}")
@@ -67,3 +67,5 @@ string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -Xcompiler=\"-MD -Zi -O2 -O
string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Xcompiler=\"-MD -O1 -Ob1\" -DNDEBUG")
set(CMAKE_CUDA_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
+
+__windows_compiler_msvc_enable_rc("${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_CXX}")
diff --git a/Modules/Platform/iOS-Determine-CXX.cmake b/Modules/Platform/iOS-Determine-CXX.cmake
new file mode 100644
index 000000000..ac80fa62d
--- /dev/null
+++ b/Modules/Platform/iOS-Determine-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin-Determine-CXX)
diff --git a/Modules/Platform/iOS-Initialize.cmake b/Modules/Platform/iOS-Initialize.cmake
new file mode 100644
index 000000000..301ca4cbd
--- /dev/null
+++ b/Modules/Platform/iOS-Initialize.cmake
@@ -0,0 +1,9 @@
+include(Platform/Darwin-Initialize)
+
+if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhone(OS|Simulator)")
+ message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an iOS SDK")
+endif()
+
+set(IOS 1)
+
+set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)
diff --git a/Modules/Platform/iOS.cmake b/Modules/Platform/iOS.cmake
new file mode 100644
index 000000000..850ddc241
--- /dev/null
+++ b/Modules/Platform/iOS.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin)
diff --git a/Modules/Platform/tvOS-Determine-CXX.cmake b/Modules/Platform/tvOS-Determine-CXX.cmake
new file mode 100644
index 000000000..ac80fa62d
--- /dev/null
+++ b/Modules/Platform/tvOS-Determine-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin-Determine-CXX)
diff --git a/Modules/Platform/tvOS-Initialize.cmake b/Modules/Platform/tvOS-Initialize.cmake
new file mode 100644
index 000000000..6834c8031
--- /dev/null
+++ b/Modules/Platform/tvOS-Initialize.cmake
@@ -0,0 +1,7 @@
+include(Platform/Darwin-Initialize)
+
+if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTV(OS|Simulator)")
+ message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an tvOS SDK")
+endif()
+
+set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)
diff --git a/Modules/Platform/tvOS.cmake b/Modules/Platform/tvOS.cmake
new file mode 100644
index 000000000..850ddc241
--- /dev/null
+++ b/Modules/Platform/tvOS.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin)
diff --git a/Modules/Platform/watchOS-Determine-CXX.cmake b/Modules/Platform/watchOS-Determine-CXX.cmake
new file mode 100644
index 000000000..ac80fa62d
--- /dev/null
+++ b/Modules/Platform/watchOS-Determine-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin-Determine-CXX)
diff --git a/Modules/Platform/watchOS-Initialize.cmake b/Modules/Platform/watchOS-Initialize.cmake
new file mode 100644
index 000000000..2f396d394
--- /dev/null
+++ b/Modules/Platform/watchOS-Initialize.cmake
@@ -0,0 +1,7 @@
+include(Platform/Darwin-Initialize)
+
+if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/Watch(OS|Simulator)")
+ message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an watchOS SDK")
+endif()
+
+set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)
diff --git a/Modules/Platform/watchOS.cmake b/Modules/Platform/watchOS.cmake
new file mode 100644
index 000000000..850ddc241
--- /dev/null
+++ b/Modules/Platform/watchOS.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin)
diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index 8a37884b7..e4b4e5372 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -1,44 +1,45 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# ProcessorCount
-# --------------
-#
-# ProcessorCount(var)
-#
-# Determine the number of processors/cores and save value in ${var}
-#
-# Sets the variable named ${var} to the number of physical cores
-# available on the machine if the information can be determined.
-# Otherwise it is set to 0. Currently this functionality is implemented
-# for AIX, cygwin, FreeBSD, HPUX, IRIX, Linux, macOS, QNX, Sun and
-# Windows.
-#
-# 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.
-#
-# Example use, in a ctest -S dashboard script:
-#
-# ::
-#
-# include(ProcessorCount)
-# ProcessorCount(N)
-# if(NOT N EQUAL 0)
-# set(CTEST_BUILD_FLAGS -j${N})
-# set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
-# endif()
-#
-#
-#
-# This function is intended to offer an approximation of the value of
-# the number of compute cores available on the current machine, such
-# that you may use that value for parallel building and parallel
-# testing. It is meant to help utilize as much of the machine as seems
-# reasonable. Of course, knowledge of what else might be running on the
-# machine simultaneously should be used when deciding whether to request
-# a machine's full capacity all for yourself.
+#[=======================================================================[.rst:
+ProcessorCount
+--------------
+
+ProcessorCount(var)
+
+Determine the number of processors/cores and save value in ${var}
+
+Sets the variable named ${var} to the number of physical cores
+available on the machine if the information can be determined.
+Otherwise it is set to 0. Currently this functionality is implemented
+for AIX, cygwin, FreeBSD, HPUX, Linux, macOS, QNX, Sun and
+Windows.
+
+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.
+
+Example use, in a ctest -S dashboard script:
+
+::
+
+ include(ProcessorCount)
+ ProcessorCount(N)
+ if(NOT N EQUAL 0)
+ set(CTEST_BUILD_FLAGS -j${N})
+ set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
+ endif()
+
+
+
+This function is intended to offer an approximation of the value of
+the number of compute cores available on the current machine, such
+that you may use that value for parallel building and parallel
+testing. It is meant to help utilize as much of the machine as seems
+reasonable. Of course, knowledge of what else might be running on the
+machine simultaneously should be used when deciding whether to request
+a machine's full capacity all for yourself.
+#]=======================================================================]
# A more reliable way might be to compile a small C program that uses the CPUID
# instruction, but that again requires compiler support or compiling assembler
@@ -114,22 +115,6 @@ function(ProcessorCount var)
endif()
if(NOT count)
- # IRIX (systems with hinv):
- find_program(ProcessorCount_cmd_hinv hinv
- PATHS /sbin)
- mark_as_advanced(ProcessorCount_cmd_hinv)
- if(ProcessorCount_cmd_hinv)
- execute_process(COMMAND ${ProcessorCount_cmd_hinv}
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE
- OUTPUT_VARIABLE hinv_output)
- string(REGEX MATCHALL "([0-9]+) .* Processors" procs "${hinv_output}")
- set(count "${CMAKE_MATCH_1}")
- #message("ProcessorCount: trying hinv '${ProcessorCount_cmd_hinv}'")
- endif()
- endif()
-
- if(NOT count)
# AIX (systems with lsconf):
find_program(ProcessorCount_cmd_lsconf lsconf
PATHS /usr/sbin)
diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake
index e21ecf42e..4699ecdad 100644
--- a/Modules/Qt4ConfigDependentSettings.cmake
+++ b/Modules/Qt4ConfigDependentSettings.cmake
@@ -1,13 +1,14 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# Qt4ConfigDependentSettings
-# --------------------------
-#
-#
-#
-# This file is included by FindQt4.cmake, don't include it directly.
+#[=======================================================================[.rst:
+Qt4ConfigDependentSettings
+--------------------------
+
+
+
+This file is included by FindQt4.cmake, don't include it directly.
+#]=======================================================================]
###############################################
#
@@ -255,7 +256,6 @@ if(Q_WS_X11)
# X11 libraries Qt always depends on
set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB})
- set(CMAKE_THREAD_PREFER_PTHREAD 1)
find_package(Threads)
if(CMAKE_USE_PTHREADS_INIT)
set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT})
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index a2c8d853c..5c489709d 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -1,13 +1,14 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# Qt4Macros
-# ---------
-#
-#
-#
-# This file is included by FindQt4.cmake, don't include it directly.
+#[=======================================================================[.rst:
+Qt4Macros
+---------
+
+
+
+This file is included by FindQt4.cmake, don't include it directly.
+#]=======================================================================]
######################################
#
diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake
index fe3bb00a6..4c0e9a8c0 100644
--- a/Modules/SelectLibraryConfigurations.cmake
+++ b/Modules/SelectLibraryConfigurations.cmake
@@ -1,36 +1,45 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# SelectLibraryConfigurations
-# ---------------------------
-#
-#
-#
-# select_library_configurations( basename )
-#
-# This macro takes a library base name as an argument, and will choose
-# good values for basename_LIBRARY, basename_LIBRARIES,
-# basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what
-# has been found and set. If only basename_LIBRARY_RELEASE is defined,
-# basename_LIBRARY will be set to the release value, and
-# basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND.
-# If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will
-# take the debug value, and basename_LIBRARY_RELEASE will be set to
-# basename_LIBRARY_RELEASE-NOTFOUND.
-#
-# If the generator supports configuration types, then basename_LIBRARY
-# and basename_LIBRARIES will be set with debug and optimized flags
-# specifying the library to be used for the given configuration. If no
-# build type has been set or the generator in use does not support
-# configuration types, then basename_LIBRARY and basename_LIBRARIES will
-# take only the release value, or the debug value if the release one is
-# not set.
+#[=======================================================================[.rst:
+SelectLibraryConfigurations
+---------------------------
+
+.. code-block:: cmake
+
+ select_library_configurations(basename)
+
+This macro takes a library base name as an argument, and will choose
+good values for the variables
+
+::
+
+ basename_LIBRARY
+ basename_LIBRARIES
+ basename_LIBRARY_DEBUG
+ basename_LIBRARY_RELEASE
+
+depending on what has been found and set.
+
+If only ``basename_LIBRARY_RELEASE`` is defined, ``basename_LIBRARY`` will
+be set to the release value, and ``basename_LIBRARY_DEBUG`` will be set
+to ``basename_LIBRARY_DEBUG-NOTFOUND``. If only ``basename_LIBRARY_DEBUG``
+is defined, then ``basename_LIBRARY`` will take the debug value, and
+``basename_LIBRARY_RELEASE`` will be set to ``basename_LIBRARY_RELEASE-NOTFOUND``.
+
+If the generator supports configuration types, then ``basename_LIBRARY``
+and ``basename_LIBRARIES`` will be set with debug and optimized flags
+specifying the library to be used for the given configuration. If no
+build type has been set or the generator in use does not support
+configuration types, then ``basename_LIBRARY`` and ``basename_LIBRARIES``
+will take only the release value, or the debug value if the release one
+is not set.
+#]=======================================================================]
# This macro was adapted from the FindQt4 CMake module and is maintained by Will
# Dicharry <wdicharry@stellarscience.com>.
-macro( select_library_configurations basename )
+macro(select_library_configurations basename)
if(NOT ${basename}_LIBRARY_RELEASE)
set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.")
endif()
diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake
index c0e1bea59..2a80be56f 100644
--- a/Modules/SquishTestScript.cmake
+++ b/Modules/SquishTestScript.cmake
@@ -1,21 +1,22 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# SquishTestScript
-# ----------------
-#
-#
-#
-#
-#
-# This script launches a GUI test using Squish. You should not call the
-# script directly; instead, you should access it via the SQUISH_ADD_TEST
-# macro that is defined in FindSquish.cmake.
-#
-# This script starts the Squish server, launches the test on the client,
-# and finally stops the squish server. If any of these steps fail
-# (including if the tests do not pass) then a fatal error is raised.
+#[=======================================================================[.rst:
+SquishTestScript
+----------------
+
+
+
+
+
+This script launches a GUI test using Squish. You should not call the
+script directly; instead, you should access it via the SQUISH_ADD_TEST
+macro that is defined in FindSquish.cmake.
+
+This script starts the Squish server, launches the test on the client,
+and finally stops the squish server. If any of these steps fail
+(including if the tests do not pass) then a fatal error is raised.
+#]=======================================================================]
# print out the variable that we are using
message(STATUS "squish_aut='${squish_aut}'")
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake
index 9a4bce535..0c6e188c0 100644
--- a/Modules/TestBigEndian.cmake
+++ b/Modules/TestBigEndian.cmake
@@ -1,18 +1,19 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# TestBigEndian
-# -------------
-#
-# Define macro to determine endian type
-#
-# Check if the system is big endian or little endian
-#
-# ::
-#
-# TEST_BIG_ENDIAN(VARIABLE)
-# VARIABLE - variable to store the result to
+#[=======================================================================[.rst:
+TestBigEndian
+-------------
+
+Define macro to determine endian type
+
+Check if the system is big endian or little endian
+
+::
+
+ TEST_BIG_ENDIAN(VARIABLE)
+ VARIABLE - variable to store the result to
+#]=======================================================================]
include(CheckTypeSize)
diff --git a/Modules/TestCXXAcceptsFlag.cmake b/Modules/TestCXXAcceptsFlag.cmake
index 10019ec68..92a362e2f 100644
--- a/Modules/TestCXXAcceptsFlag.cmake
+++ b/Modules/TestCXXAcceptsFlag.cmake
@@ -1,22 +1,25 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# TestCXXAcceptsFlag
-# ------------------
-#
-# Deprecated. See :module:`CheckCXXCompilerFlag`.
-#
-# Check if the CXX compiler accepts a flag.
-#
-# .. code-block:: cmake
-#
-# CHECK_CXX_ACCEPTS_FLAG(<flags> <variable>)
-#
-# ``<flags>``
-# the flags to try
-# ``<variable>``
-# variable to store the result
+#[=======================================================================[.rst:
+TestCXXAcceptsFlag
+------------------
+
+.. deprecated:: 3.0
+
+ See :module:`CheckCXXCompilerFlag`.
+
+Check if the CXX compiler accepts a flag.
+
+.. code-block:: cmake
+
+ CHECK_CXX_ACCEPTS_FLAG(<flags> <variable>)
+
+``<flags>``
+ the flags to try
+``<variable>``
+ variable to store the result
+#]=======================================================================]
macro(CHECK_CXX_ACCEPTS_FLAG FLAGS VARIABLE)
if(NOT DEFINED ${VARIABLE})
diff --git a/Modules/TestForANSIForScope.cmake b/Modules/TestForANSIForScope.cmake
index 7d2aad61b..272e4ec8b 100644
--- a/Modules/TestForANSIForScope.cmake
+++ b/Modules/TestForANSIForScope.cmake
@@ -1,18 +1,19 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# TestForANSIForScope
-# -------------------
-#
-# Check for ANSI for scope support
-#
-# Check if the compiler restricts the scope of variables declared in a
-# for-init-statement to the loop body.
-#
-# ::
-#
-# CMAKE_NO_ANSI_FOR_SCOPE - holds result
+#[=======================================================================[.rst:
+TestForANSIForScope
+-------------------
+
+Check for ANSI for scope support
+
+Check if the compiler restricts the scope of variables declared in a
+for-init-statement to the loop body.
+
+::
+
+ CMAKE_NO_ANSI_FOR_SCOPE - holds result
+#]=======================================================================]
if(NOT DEFINED CMAKE_ANSI_FOR_SCOPE)
message(STATUS "Check for ANSI scope")
diff --git a/Modules/TestForANSIStreamHeaders.cmake b/Modules/TestForANSIStreamHeaders.cmake
index e890c677f..e532a71b7 100644
--- a/Modules/TestForANSIStreamHeaders.cmake
+++ b/Modules/TestForANSIStreamHeaders.cmake
@@ -1,18 +1,19 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# TestForANSIStreamHeaders
-# ------------------------
-#
-# Test for compiler support of ANSI stream headers iostream, etc.
-#
-# check if the compiler supports the standard ANSI iostream header
-# (without the .h)
-#
-# ::
-#
-# CMAKE_NO_ANSI_STREAM_HEADERS - defined by the results
+#[=======================================================================[.rst:
+TestForANSIStreamHeaders
+------------------------
+
+Test for compiler support of ANSI stream headers iostream, etc.
+
+check if the compiler supports the standard ANSI iostream header
+(without the .h)
+
+::
+
+ CMAKE_NO_ANSI_STREAM_HEADERS - defined by the results
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/CheckIncludeFileCXX.cmake)
diff --git a/Modules/TestForSSTREAM.cmake b/Modules/TestForSSTREAM.cmake
index 0bfbfbbbd..e70df00ab 100644
--- a/Modules/TestForSSTREAM.cmake
+++ b/Modules/TestForSSTREAM.cmake
@@ -1,17 +1,18 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# TestForSSTREAM
-# --------------
-#
-# Test for compiler support of ANSI sstream header
-#
-# check if the compiler supports the standard ANSI sstream header
-#
-# ::
-#
-# CMAKE_NO_ANSI_STRING_STREAM - defined by the results
+#[=======================================================================[.rst:
+TestForSSTREAM
+--------------
+
+Test for compiler support of ANSI sstream header
+
+check if the compiler supports the standard ANSI sstream header
+
+::
+
+ CMAKE_NO_ANSI_STRING_STREAM - defined by the results
+#]=======================================================================]
if(NOT DEFINED CMAKE_HAS_ANSI_STRING_STREAM)
message(STATUS "Check for sstream")
diff --git a/Modules/TestForSTDNamespace.cmake b/Modules/TestForSTDNamespace.cmake
index 3ae80c744..703e631eb 100644
--- a/Modules/TestForSTDNamespace.cmake
+++ b/Modules/TestForSTDNamespace.cmake
@@ -1,17 +1,18 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# TestForSTDNamespace
-# -------------------
-#
-# Test for std:: namespace support
-#
-# check if the compiler supports std:: on stl classes
-#
-# ::
-#
-# CMAKE_NO_STD_NAMESPACE - defined by the results
+#[=======================================================================[.rst:
+TestForSTDNamespace
+-------------------
+
+Test for std:: namespace support
+
+check if the compiler supports std:: on stl classes
+
+::
+
+ CMAKE_NO_STD_NAMESPACE - defined by the results
+#]=======================================================================]
if(NOT DEFINED CMAKE_STD_NAMESPACE)
message(STATUS "Check for STD namespace")
diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake
index 700bfe6cc..9f848475b 100644
--- a/Modules/UseEcos.cmake
+++ b/Modules/UseEcos.cmake
@@ -1,32 +1,33 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# UseEcos
-# -------
-#
-# This module defines variables and macros required to build eCos application.
-#
-# This file contains the following macros:
-# ECOS_ADD_INCLUDE_DIRECTORIES() - add the eCos include dirs
-# ECOS_ADD_EXECUTABLE(name source1 ... sourceN ) - create an eCos
-# executable ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN ) - adjusts
-# the path of the source files and puts the result into VAR
-#
-# Macros for selecting the toolchain: ECOS_USE_ARM_ELF_TOOLS() - enable
-# the ARM ELF toolchain for the directory where it is called
-# ECOS_USE_I386_ELF_TOOLS() - enable the i386 ELF toolchain for the
-# directory where it is called ECOS_USE_PPC_EABI_TOOLS() - enable the
-# PowerPC toolchain for the directory where it is called
-#
-# It contains the following variables: ECOS_DEFINITIONS
-# ECOSCONFIG_EXECUTABLE ECOS_CONFIG_FILE - defaults to ecos.ecc, if your
-# eCos configuration file has a different name, adjust this variable for
-# internal use only:
-#
-# ::
-#
-# ECOS_ADD_TARGET_LIB
+#[=======================================================================[.rst:
+UseEcos
+-------
+
+This module defines variables and macros required to build eCos application.
+
+This file contains the following macros:
+ECOS_ADD_INCLUDE_DIRECTORIES() - add the eCos include dirs
+ECOS_ADD_EXECUTABLE(name source1 ... sourceN ) - create an eCos
+executable ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN ) - adjusts
+the path of the source files and puts the result into VAR
+
+Macros for selecting the toolchain: ECOS_USE_ARM_ELF_TOOLS() - enable
+the ARM ELF toolchain for the directory where it is called
+ECOS_USE_I386_ELF_TOOLS() - enable the i386 ELF toolchain for the
+directory where it is called ECOS_USE_PPC_EABI_TOOLS() - enable the
+PowerPC toolchain for the directory where it is called
+
+It contains the following variables: ECOS_DEFINITIONS
+ECOSCONFIG_EXECUTABLE ECOS_CONFIG_FILE - defaults to ecos.ecc, if your
+eCos configuration file has a different name, adjust this variable for
+internal use only:
+
+::
+
+ ECOS_ADD_TARGET_LIB
+#]=======================================================================]
# first check that ecosconfig is available
find_program(ECOSCONFIG_EXECUTABLE NAMES ecosconfig)
@@ -190,8 +191,8 @@ macro(ECOS_ADD_EXECUTABLE _exe_NAME )
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}")
# some strict compiler flags
- set (CMAKE_C_FLAGS "-Wstrict-prototypes")
- set (CMAKE_CXX_FLAGS "-Woverloaded-virtual -fno-rtti -Wctor-dtor-privacy -fno-strict-aliasing -fno-exceptions")
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual -fno-rtti -Wctor-dtor-privacy -fno-strict-aliasing -fno-exceptions")
add_executable(${_exe_NAME} ${ARGN})
set_target_properties(${_exe_NAME} PROPERTIES SUFFIX ".elf")
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 6e2c51100..5600b4c1c 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -1,438 +1,439 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# UseJava
-# -------
-#
-# Use Module for Java
-#
-# This file provides functions for Java. It is assumed that
-# FindJava.cmake has already been loaded. See FindJava.cmake for
-# information on how to load Java into your CMake project.
-#
-# ::
-#
-# add_jar(target_name
-# [SOURCES] source1 [source2 ...] [resource1 ...]
-# [INCLUDE_JARS jar1 [jar2 ...]]
-# [ENTRY_POINT entry]
-# [VERSION version]
-# [OUTPUT_NAME name]
-# [OUTPUT_DIR dir]
-# [GENERATE_NATIVE_HEADERS target [DESTINATION dir]]
-# )
-#
-# This command creates a <target_name>.jar. It compiles the given
-# source files (source) and adds the given resource files (resource) to
-# the jar file. Source files can be java files or listing files
-# (prefixed by '@'). If only resource files are given then just a jar file
-# is created. The list of include jars are added to the classpath when
-# compiling the java sources and also to the dependencies of the target.
-# INCLUDE_JARS also accepts other target names created by add_jar. For
-# backwards compatibility, jar files listed as sources are ignored (as
-# they have been since the first version of this module).
-#
-# 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 output directory for
-# generated header files.
-#
-# GENERATE_NATIVE_HEADERS option requires, at least, version 1.8 of the JDK.
-#
-# Additional instructions:
-#
-# ::
-#
-# To add compile flags to the target you can set these flags with
-# the following variable:
-#
-#
-#
-# ::
-#
-# set(CMAKE_JAVA_COMPILE_FLAGS -nowarn)
-#
-#
-#
-# ::
-#
-# To add a path or a jar file to the class path you can do this
-# with the CMAKE_JAVA_INCLUDE_PATH variable.
-#
-#
-#
-# ::
-#
-# set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar)
-#
-#
-#
-# ::
-#
-# To use a different output name for the target you can set it with:
-#
-#
-#
-# ::
-#
-# add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar)
-#
-#
-#
-# ::
-#
-# To use a different output directory than CMAKE_CURRENT_BINARY_DIR
-# you can set it with:
-#
-#
-#
-# ::
-#
-# add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin)
-#
-#
-#
-# ::
-#
-# To define an entry point in your jar you can set it with the ENTRY_POINT
-# named argument:
-#
-#
-#
-# ::
-#
-# add_jar(example ENTRY_POINT com/examples/MyProject/Main)
-#
-#
-#
-# ::
-#
-# To define a custom manifest for the jar, you can set it with the manifest
-# named argument:
-#
-#
-#
-# ::
-#
-# add_jar(example MANIFEST /path/to/manifest)
-#
-#
-#
-# ::
-#
-# To add a VERSION to the target output name you can set it using
-# the VERSION named argument to add_jar. This will create a jar file with the
-# name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar
-# pointing to the jar with the version information.
-#
-#
-#
-# ::
-#
-# add_jar(shibboleet shibbotleet.java VERSION 1.2.0)
-#
-#
-#
-# ::
-#
-# If the target is a JNI library, utilize the following commands to
-# create a JNI symbolic link:
-#
-#
-#
-# ::
-#
-# set(CMAKE_JNI_TARGET TRUE)
-# add_jar(shibboleet shibbotleet.java VERSION 1.2.0)
-# install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet)
-# install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR})
-#
-#
-#
-# ::
-#
-# If a single target needs to produce more than one jar from its
-# java source code, to prevent the accumulation of duplicate class
-# files in subsequent jars, set/reset CMAKE_JAR_CLASSES_PREFIX prior
-# to calling the add_jar() function:
-#
-#
-#
-# ::
-#
-# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo)
-# add_jar(foo foo.java)
-#
-#
-#
-# ::
-#
-# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar)
-# add_jar(bar bar.java)
-#
-#
-#
-# ::
-#
-# For an optimum usage of option GENERATE_NATIVE_HEADERS, it is recommended to
-# include module JNI before any call to add_jar. The produced target for native
-# headers can then be used to compile C/C++ sources with command
-# target_link_libraries.
-#
-#
-# ::
-#
-# find_package(JNI)
-# add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native)
-# add_library(bar bar.cpp)
-# target_link_libraries(bar PRIVATE foo-native)
-#
-#
-# Target Properties:
-#
-# ::
-#
-# The add_jar() function sets some target properties. You can get these
-# properties with the
-# get_property(TARGET <target_name> PROPERTY <propery_name>)
-# command.
-#
-#
-#
-# ::
-#
-# INSTALL_FILES The files which should be installed. This is used by
-# install_jar().
-# JNI_SYMLINK The JNI symlink which should be installed.
-# This is used by install_jni_symlink().
-# JAR_FILE The location of the jar file so that you can include
-# it.
-# CLASSDIR The directory where the class files can be found. For
-# example to use them with javah.
-#
-# ::
-#
-# find_jar(<VAR>
-# name | NAMES name1 [name2 ...]
-# [PATHS path1 [path2 ... ENV var]]
-# [VERSIONS version1 [version2]]
-# [DOC "cache documentation string"]
-# )
-#
-# This command is used to find a full path to the named jar. A cache
-# entry named by <VAR> is created to stor the result of this command.
-# If the full path to a jar is found the result is stored in the
-# variable and the search will not repeated unless the variable is
-# cleared. If nothing is found, the result will be <VAR>-NOTFOUND, and
-# the search will be attempted again next time find_jar is invoked with
-# the same variable. The name of the full path to a file that is
-# searched for is specified by the names listed after NAMES argument.
-# Additional search locations can be specified after the PATHS argument.
-# If you require special a version of a jar file you can specify it with
-# the VERSIONS argument. The argument after DOC will be used for the
-# documentation string in the cache.
-#
-# ::
-#
-# install_jar(target_name destination)
-# install_jar(target_name DESTINATION destination [COMPONENT component])
-#
-# This command installs the TARGET_NAME files to the given DESTINATION.
-# It should be called in the same scope as add_jar() or it will fail.
-#
-# Target Properties:
-#
-# ::
-#
-# The install_jar() function sets the INSTALL_DESTINATION target property
-# on jars so installed. This property holds the DESTINATION as described
-# above, and is used by install_jar_exports(). You can get this property
-# with the
-# get_property(TARGET <target_name> PROPERTY INSTALL_DESTINATION)
-# command.
-#
-#
-#
-# ::
-#
-# install_jni_symlink(target_name destination)
-# install_jni_symlink(target_name DESTINATION destination [COMPONENT component])
-#
-# 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.
-#
-# ::
-#
-# install_jar_exports(TARGETS jars...
-# [NAMESPACE <namespace>]
-# FILE <filename>
-# DESTINATION <dir> [COMPONENT <component>])
-#
-# This command installs a target export file ``<filename>`` for the named jar
-# targets to the given ``DESTINATION``. Its function is similar to that of
-# :command:`install(EXPORTS ...)`.
-#
-# ::
-#
-# export_jars(TARGETS jars...
-# [NAMESPACE <namespace>]
-# FILE <filename>)
-#
-# This command writes a target export file ``<filename>`` for the named jar
-# targets. Its function is similar to that of :command:`export(...)`.
-#
-# ::
-#
-# create_javadoc(<VAR>
-# PACKAGES pkg1 [pkg2 ...]
-# [SOURCEPATH <sourcepath>]
-# [CLASSPATH <classpath>]
-# [INSTALLPATH <install path>]
-# [DOCTITLE "the documentation title"]
-# [WINDOWTITLE "the title of the document"]
-# [AUTHOR TRUE|FALSE]
-# [USE TRUE|FALSE]
-# [VERSION TRUE|FALSE]
-# )
-#
-# Create java documentation based on files or packages. For more
-# details please read the javadoc manpage.
-#
-# There are two main signatures for create_javadoc. The first signature
-# works with package names on a path with source files:
-#
-# ::
-#
-# Example:
-# create_javadoc(my_example_doc
-# PACKAGES com.example.foo com.example.bar
-# SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}"
-# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
-# WINDOWTITLE "My example"
-# DOCTITLE "<h1>My example</h1>"
-# AUTHOR TRUE
-# USE TRUE
-# VERSION TRUE
-# )
-#
-#
-#
-# The second signature for create_javadoc works on a given list of
-# files.
-#
-# ::
-#
-# create_javadoc(<VAR>
-# FILES file1 [file2 ...]
-# [CLASSPATH <classpath>]
-# [INSTALLPATH <install path>]
-# [DOCTITLE "the documentation title"]
-# [WINDOWTITLE "the title of the document"]
-# [AUTHOR TRUE|FALSE]
-# [USE TRUE|FALSE]
-# [VERSION TRUE|FALSE]
-# )
-#
-#
-#
-# Example:
-#
-# ::
-#
-# create_javadoc(my_example_doc
-# FILES ${example_SRCS}
-# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
-# WINDOWTITLE "My example"
-# DOCTITLE "<h1>My example</h1>"
-# AUTHOR TRUE
-# USE TRUE
-# VERSION TRUE
-# )
-#
-#
-#
-# Both signatures share most of the options. These options are the same
-# as what you can find in the javadoc manpage. Please look at the
-# manpage for CLASSPATH, DOCTITLE, WINDOWTITLE, AUTHOR, USE and VERSION.
-#
-# The documentation will be by default installed to
-#
-# ::
-#
-# ${CMAKE_INSTALL_PREFIX}/share/javadoc/<VAR>
-#
-#
-#
-# if you don't set the INSTALLPATH.
-#
-# ::
-#
-# create_javah(TARGET <target>
-# GENERATED_FILES <VAR>
-# CLASSES <class>...
-# [CLASSPATH <classpath>...]
-# [DEPENDS <depend>...]
-# [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.
-#
-# 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>`_.
-# Command ``add_jar(GENERATE_NATIVE_HEADERS)`` must be used instead.
-#
-# There are two main signatures for create_javah. The first signature
-# returns generated files through variable specified by GENERATED_FILES option:
-#
-# ::
-#
-# Example:
-# Create_javah(GENERATED_FILES files_headers
-# CLASSES org.cmake.HelloWorld
-# CLASSPATH hello.jar
-# )
-#
-#
-#
-# The second signature for create_javah creates a target which encapsulates
-# header files generation.
-#
-# ::
-#
-# Example:
-# Create_javah(TARGET target_headers
-# CLASSES org.cmake.HelloWorld
-# CLASSPATH hello.jar
-# )
-#
-#
-#
-# Both signatures share same options.
-#
-# ``CLASSES <class>...``
-# Specifies Java classes used to generate headers.
-#
-# ``CLASSPATH <classpath>...``
-# Specifies various paths to look up classes. Here .class files, jar files or targets
-# created by command add_jar can be used.
-#
-# ``DEPENDS <depend>...``
-# Targets on which the javah target depends
-#
-# ``OUTPUT_NAME <path>``
-# Concatenates the resulting header files for all the classes listed by option CLASSES
-# into <path>. Same behavior as option '-o' of javah tool.
-#
-# ``OUTPUT_DIR <path>``
-# Sets the directory where the header files will be generated. Same behavior as option
-# '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory.
+#[=======================================================================[.rst:
+UseJava
+-------
+
+Use Module for Java
+
+This file provides functions for Java. It is assumed that
+FindJava.cmake has already been loaded. See FindJava.cmake for
+information on how to load Java into your CMake project.
+
+::
+
+ add_jar(target_name
+ [SOURCES] source1 [source2 ...] [resource1 ...]
+ [INCLUDE_JARS jar1 [jar2 ...]]
+ [ENTRY_POINT entry]
+ [VERSION version]
+ [OUTPUT_NAME name]
+ [OUTPUT_DIR dir]
+ [GENERATE_NATIVE_HEADERS target [DESTINATION dir]]
+ )
+
+This command creates a <target_name>.jar. It compiles the given
+source files (source) and adds the given resource files (resource) to
+the jar file. Source files can be java files or listing files
+(prefixed by '@'). If only resource files are given then just a jar file
+is created. The list of include jars are added to the classpath when
+compiling the java sources and also to the dependencies of the target.
+INCLUDE_JARS also accepts other target names created by add_jar. For
+backwards compatibility, jar files listed as sources are ignored (as
+they have been since the first version of this module).
+
+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 output directory for
+generated header files.
+
+GENERATE_NATIVE_HEADERS option requires, at least, version 1.8 of the JDK.
+
+Additional instructions:
+
+::
+
+ To add compile flags to the target you can set these flags with
+ the following variable:
+
+
+
+::
+
+ set(CMAKE_JAVA_COMPILE_FLAGS -nowarn)
+
+
+
+::
+
+ To add a path or a jar file to the class path you can do this
+ with the CMAKE_JAVA_INCLUDE_PATH variable.
+
+
+
+::
+
+ set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar)
+
+
+
+::
+
+ To use a different output name for the target you can set it with:
+
+
+
+::
+
+ add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar)
+
+
+
+::
+
+ To use a different output directory than CMAKE_CURRENT_BINARY_DIR
+ you can set it with:
+
+
+
+::
+
+ add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin)
+
+
+
+::
+
+ To define an entry point in your jar you can set it with the ENTRY_POINT
+ named argument:
+
+
+
+::
+
+ add_jar(example ENTRY_POINT com/examples/MyProject/Main)
+
+
+
+::
+
+ To define a custom manifest for the jar, you can set it with the manifest
+ named argument:
+
+
+
+::
+
+ add_jar(example MANIFEST /path/to/manifest)
+
+
+
+::
+
+ To add a VERSION to the target output name you can set it using
+ the VERSION named argument to add_jar. This will create a jar file with the
+ name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar
+ pointing to the jar with the version information.
+
+
+
+::
+
+ add_jar(shibboleet shibbotleet.java VERSION 1.2.0)
+
+
+
+::
+
+ If the target is a JNI library, utilize the following commands to
+ create a JNI symbolic link:
+
+
+
+::
+
+ set(CMAKE_JNI_TARGET TRUE)
+ add_jar(shibboleet shibbotleet.java VERSION 1.2.0)
+ install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet)
+ install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR})
+
+
+
+::
+
+ If a single target needs to produce more than one jar from its
+ java source code, to prevent the accumulation of duplicate class
+ files in subsequent jars, set/reset CMAKE_JAR_CLASSES_PREFIX prior
+ to calling the add_jar() function:
+
+
+
+::
+
+ set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo)
+ add_jar(foo foo.java)
+
+
+
+::
+
+ set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar)
+ add_jar(bar bar.java)
+
+
+
+::
+
+ For an optimum usage of option GENERATE_NATIVE_HEADERS, it is recommended to
+ include module JNI before any call to add_jar. The produced target for native
+ headers can then be used to compile C/C++ sources with command
+ target_link_libraries.
+
+
+::
+
+ find_package(JNI)
+ add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native)
+ add_library(bar bar.cpp)
+ target_link_libraries(bar PRIVATE foo-native)
+
+
+Target Properties:
+
+::
+
+ The add_jar() function sets some target properties. You can get these
+ properties with the
+ get_property(TARGET <target_name> PROPERTY <propery_name>)
+ command.
+
+
+
+::
+
+ INSTALL_FILES The files which should be installed. This is used by
+ install_jar().
+ JNI_SYMLINK The JNI symlink which should be installed.
+ This is used by install_jni_symlink().
+ JAR_FILE The location of the jar file so that you can include
+ it.
+ CLASSDIR The directory where the class files can be found. For
+ example to use them with javah.
+
+::
+
+ find_jar(<VAR>
+ name | NAMES name1 [name2 ...]
+ [PATHS path1 [path2 ... ENV var]]
+ [VERSIONS version1 [version2]]
+ [DOC "cache documentation string"]
+ )
+
+This command is used to find a full path to the named jar. A cache
+entry named by <VAR> is created to stor the result of this command.
+If the full path to a jar is found the result is stored in the
+variable and the search will not repeated unless the variable is
+cleared. If nothing is found, the result will be <VAR>-NOTFOUND, and
+the search will be attempted again next time find_jar is invoked with
+the same variable. The name of the full path to a file that is
+searched for is specified by the names listed after NAMES argument.
+Additional search locations can be specified after the PATHS argument.
+If you require special a version of a jar file you can specify it with
+the VERSIONS argument. The argument after DOC will be used for the
+documentation string in the cache.
+
+::
+
+ install_jar(target_name destination)
+ install_jar(target_name DESTINATION destination [COMPONENT component])
+
+This command installs the TARGET_NAME files to the given DESTINATION.
+It should be called in the same scope as add_jar() or it will fail.
+
+Target Properties:
+
+::
+
+ The install_jar() function sets the INSTALL_DESTINATION target property
+ on jars so installed. This property holds the DESTINATION as described
+ above, and is used by install_jar_exports(). You can get this property
+ with the
+ get_property(TARGET <target_name> PROPERTY INSTALL_DESTINATION)
+ command.
+
+
+
+::
+
+ install_jni_symlink(target_name destination)
+ install_jni_symlink(target_name DESTINATION destination [COMPONENT component])
+
+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.
+
+::
+
+ install_jar_exports(TARGETS jars...
+ [NAMESPACE <namespace>]
+ FILE <filename>
+ DESTINATION <dir> [COMPONENT <component>])
+
+This command installs a target export file ``<filename>`` for the named jar
+targets to the given ``DESTINATION``. Its function is similar to that of
+:command:`install(EXPORTS ...)`.
+
+::
+
+ export_jars(TARGETS jars...
+ [NAMESPACE <namespace>]
+ FILE <filename>)
+
+This command writes a target export file ``<filename>`` for the named jar
+targets. Its function is similar to that of :command:`export(...)`.
+
+::
+
+ create_javadoc(<VAR>
+ PACKAGES pkg1 [pkg2 ...]
+ [SOURCEPATH <sourcepath>]
+ [CLASSPATH <classpath>]
+ [INSTALLPATH <install path>]
+ [DOCTITLE "the documentation title"]
+ [WINDOWTITLE "the title of the document"]
+ [AUTHOR TRUE|FALSE]
+ [USE TRUE|FALSE]
+ [VERSION TRUE|FALSE]
+ )
+
+Create java documentation based on files or packages. For more
+details please read the javadoc manpage.
+
+There are two main signatures for create_javadoc. The first signature
+works with package names on a path with source files:
+
+::
+
+ Example:
+ create_javadoc(my_example_doc
+ PACKAGES com.example.foo com.example.bar
+ SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}"
+ CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
+ WINDOWTITLE "My example"
+ DOCTITLE "<h1>My example</h1>"
+ AUTHOR TRUE
+ USE TRUE
+ VERSION TRUE
+ )
+
+
+
+The second signature for create_javadoc works on a given list of
+files.
+
+::
+
+ create_javadoc(<VAR>
+ FILES file1 [file2 ...]
+ [CLASSPATH <classpath>]
+ [INSTALLPATH <install path>]
+ [DOCTITLE "the documentation title"]
+ [WINDOWTITLE "the title of the document"]
+ [AUTHOR TRUE|FALSE]
+ [USE TRUE|FALSE]
+ [VERSION TRUE|FALSE]
+ )
+
+
+
+Example:
+
+::
+
+ create_javadoc(my_example_doc
+ FILES ${example_SRCS}
+ CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
+ WINDOWTITLE "My example"
+ DOCTITLE "<h1>My example</h1>"
+ AUTHOR TRUE
+ USE TRUE
+ VERSION TRUE
+ )
+
+
+
+Both signatures share most of the options. These options are the same
+as what you can find in the javadoc manpage. Please look at the
+manpage for CLASSPATH, DOCTITLE, WINDOWTITLE, AUTHOR, USE and VERSION.
+
+The documentation will be by default installed to
+
+::
+
+ ${CMAKE_INSTALL_PREFIX}/share/javadoc/<VAR>
+
+
+
+if you don't set the INSTALLPATH.
+
+::
+
+ create_javah(TARGET <target>
+ GENERATED_FILES <VAR>
+ CLASSES <class>...
+ [CLASSPATH <classpath>...]
+ [DEPENDS <depend>...]
+ [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.
+
+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>`_.
+Command ``add_jar(GENERATE_NATIVE_HEADERS)`` must be used instead.
+
+There are two main signatures for create_javah. The first signature
+returns generated files through variable specified by GENERATED_FILES option:
+
+::
+
+ Example:
+ Create_javah(GENERATED_FILES files_headers
+ CLASSES org.cmake.HelloWorld
+ CLASSPATH hello.jar
+ )
+
+
+
+The second signature for create_javah creates a target which encapsulates
+header files generation.
+
+::
+
+ Example:
+ Create_javah(TARGET target_headers
+ CLASSES org.cmake.HelloWorld
+ CLASSPATH hello.jar
+ )
+
+
+
+Both signatures share same options.
+
+ ``CLASSES <class>...``
+ Specifies Java classes used to generate headers.
+
+ ``CLASSPATH <classpath>...``
+ Specifies various paths to look up classes. Here .class files, jar files or targets
+ created by command add_jar can be used.
+
+ ``DEPENDS <depend>...``
+ Targets on which the javah target depends
+
+ ``OUTPUT_NAME <path>``
+ Concatenates the resulting header files for all the classes listed by option CLASSES
+ into <path>. Same behavior as option '-o' of javah tool.
+
+ ``OUTPUT_DIR <path>``
+ Sets the directory where the header files will be generated. Same behavior as option
+ '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory.
+#]=======================================================================]
function (__java_copy_file src dest comment)
add_custom_command(
@@ -445,7 +446,7 @@ function (__java_copy_file src dest comment)
endfunction ()
function(__java_lcat VAR)
- foreach(_line ${ARGN})
+ foreach(_line IN LISTS ARGN)
string(APPEND ${VAR} "${_line}\n")
endforeach()
@@ -567,7 +568,7 @@ function(add_jar _TARGET_NAME)
set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
endif()
- foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH})
+ foreach (JAVA_INCLUDE_DIR IN LISTS CMAKE_JAVA_INCLUDE_PATH)
string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
endforeach()
@@ -591,7 +592,7 @@ function(add_jar _TARGET_NAME)
set(_JAVA_COMPILE_DEPENDS)
set(_JAVA_RESOURCE_FILES)
set(_JAVA_RESOURCE_FILES_RELATIVE)
- foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES})
+ foreach(_JAVA_SOURCE_FILE IN LISTS _JAVA_SOURCE_FILES)
get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT)
get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE)
get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH)
@@ -606,7 +607,7 @@ function(add_jar _TARGET_NAME)
file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
- if (${_BIN_LEN} LESS ${_SRC_LEN})
+ if (_BIN_LEN LESS _SRC_LEN)
set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH})
else ()
set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH})
@@ -636,14 +637,14 @@ function(add_jar _TARGET_NAME)
endif ()
endforeach()
- foreach(_JAVA_INCLUDE_JAR ${_add_jar_INCLUDE_JARS})
+ foreach(_JAVA_INCLUDE_JAR IN LISTS _add_jar_INCLUDE_JARS)
if (TARGET ${_JAVA_INCLUDE_JAR})
get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE)
if (_JAVA_JAR_PATH)
string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}")
list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH})
list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR})
- list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_INCLUDE_JAR})
+ list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_JAR_PATH})
else ()
message(SEND_ERROR "add_jar: INCLUDE_JARS target ${_JAVA_INCLUDE_JAR} is not a jar")
endif ()
@@ -704,7 +705,7 @@ function(add_jar _TARGET_NAME)
# create the jar file
set(_JAVA_JAR_OUTPUT_PATH
- ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME})
+ "${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}")
if (CMAKE_JNI_TARGET)
add_custom_command(
OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
@@ -902,15 +903,15 @@ function (find_jar VARIABLE)
set(_state "name")
- foreach (arg ${ARGN})
- if (${_state} STREQUAL "name")
- if (${arg} STREQUAL "VERSIONS")
+ foreach (arg IN LISTS ARGN)
+ if (_state STREQUAL "name")
+ if (arg STREQUAL "VERSIONS")
set(_state "versions")
- elseif (${arg} STREQUAL "NAMES")
+ elseif (arg STREQUAL "NAMES")
set(_state "names")
- elseif (${arg} STREQUAL "PATHS")
+ elseif (arg STREQUAL "PATHS")
set(_state "paths")
- elseif (${arg} STREQUAL "DOC")
+ elseif (arg STREQUAL "DOC")
set(_state "doc")
else ()
set(_jar_names ${arg})
@@ -918,22 +919,22 @@ function (find_jar VARIABLE)
set(_jar_doc "Finding ${arg} jar")
endif ()
endif ()
- elseif (${_state} STREQUAL "versions")
- if (${arg} STREQUAL "NAMES")
+ elseif (_state STREQUAL "versions")
+ if (arg STREQUAL "NAMES")
set(_state "names")
- elseif (${arg} STREQUAL "PATHS")
+ elseif (arg STREQUAL "PATHS")
set(_state "paths")
- elseif (${arg} STREQUAL "DOC")
+ elseif (arg STREQUAL "DOC")
set(_state "doc")
else ()
set(_jar_versions ${_jar_versions} ${arg})
endif ()
- elseif (${_state} STREQUAL "names")
- if (${arg} STREQUAL "VERSIONS")
+ elseif (_state STREQUAL "names")
+ if (arg STREQUAL "VERSIONS")
set(_state "versions")
- elseif (${arg} STREQUAL "PATHS")
+ elseif (arg STREQUAL "PATHS")
set(_state "paths")
- elseif (${arg} STREQUAL "DOC")
+ elseif (arg STREQUAL "DOC")
set(_state "doc")
else ()
set(_jar_names ${_jar_names} ${arg})
@@ -941,22 +942,22 @@ function (find_jar VARIABLE)
set(_jar_doc "Finding ${arg} jar")
endif ()
endif ()
- elseif (${_state} STREQUAL "paths")
- if (${arg} STREQUAL "VERSIONS")
+ elseif (_state STREQUAL "paths")
+ if (arg STREQUAL "VERSIONS")
set(_state "versions")
- elseif (${arg} STREQUAL "NAMES")
+ elseif (arg STREQUAL "NAMES")
set(_state "names")
- elseif (${arg} STREQUAL "DOC")
+ elseif (arg STREQUAL "DOC")
set(_state "doc")
else ()
set(_jar_paths ${_jar_paths} ${arg})
endif ()
- elseif (${_state} STREQUAL "doc")
- if (${arg} STREQUAL "VERSIONS")
+ elseif (_state STREQUAL "doc")
+ if (arg STREQUAL "VERSIONS")
set(_state "versions")
- elseif (${arg} STREQUAL "NAMES")
+ elseif (arg STREQUAL "NAMES")
set(_state "names")
- elseif (${arg} STREQUAL "PATHS")
+ elseif (arg STREQUAL "PATHS")
set(_state "paths")
else ()
set(_jar_doc ${arg})
@@ -968,8 +969,8 @@ function (find_jar VARIABLE)
message(FATAL_ERROR "find_jar: No name to search for given")
endif ()
- foreach (jar_name ${_jar_names})
- foreach (version ${_jar_versions})
+ foreach (jar_name IN LISTS _jar_names)
+ foreach (version IN LISTS _jar_versions)
set(_jar_files ${_jar_files} ${jar_name}-${version}.jar)
endforeach ()
set(_jar_files ${_jar_files} ${jar_name}.jar)
@@ -996,252 +997,252 @@ function(create_javadoc _target)
set(_state "package")
- foreach (arg ${ARGN})
- if (${_state} STREQUAL "package")
- if (${arg} STREQUAL "PACKAGES")
+ foreach (arg IN LISTS ARGN)
+ if (_state STREQUAL "package")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_packages ${arg})
set(_state "packages")
endif ()
- elseif (${_state} STREQUAL "packages")
- if (${arg} STREQUAL "FILES")
+ elseif (_state STREQUAL "packages")
+ if (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
list(APPEND _javadoc_packages ${arg})
endif ()
- elseif (${_state} STREQUAL "files")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "files")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
list(APPEND _javadoc_files ${arg})
endif ()
- elseif (${_state} STREQUAL "sourcepath")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "sourcepath")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
list(APPEND _javadoc_sourcepath ${arg})
endif ()
- elseif (${_state} STREQUAL "classpath")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "classpath")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
list(APPEND _javadoc_classpath ${arg})
endif ()
- elseif (${_state} STREQUAL "installpath")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "installpath")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_installpath ${arg})
endif ()
- elseif (${_state} STREQUAL "doctitle")
+ elseif (_state STREQUAL "doctitle")
if (${arg} STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_doctitle ${arg})
endif ()
- elseif (${_state} STREQUAL "windowtitle")
+ elseif (_state STREQUAL "windowtitle")
if (${arg} STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_windowtitle ${arg})
endif ()
- elseif (${_state} STREQUAL "author")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "author")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_author ${arg})
endif ()
- elseif (${_state} STREQUAL "use")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "use")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_use ${arg})
endif ()
- elseif (${_state} STREQUAL "version")
- if (${arg} STREQUAL "PACKAGES")
+ elseif (_state STREQUAL "version")
+ if (arg STREQUAL "PACKAGES")
set(_state "packages")
- elseif (${arg} STREQUAL "FILES")
+ elseif (arg STREQUAL "FILES")
set(_state "files")
- elseif (${arg} STREQUAL "SOURCEPATH")
+ elseif (arg STREQUAL "SOURCEPATH")
set(_state "sourcepath")
- elseif (${arg} STREQUAL "CLASSPATH")
+ elseif (arg STREQUAL "CLASSPATH")
set(_state "classpath")
- elseif (${arg} STREQUAL "INSTALLPATH")
+ elseif (arg STREQUAL "INSTALLPATH")
set(_state "installpath")
- elseif (${arg} STREQUAL "DOCTITLE")
+ elseif (arg STREQUAL "DOCTITLE")
set(_state "doctitle")
- elseif (${arg} STREQUAL "WINDOWTITLE")
+ elseif (arg STREQUAL "WINDOWTITLE")
set(_state "windowtitle")
- elseif (${arg} STREQUAL "AUTHOR")
+ elseif (arg STREQUAL "AUTHOR")
set(_state "author")
- elseif (${arg} STREQUAL "USE")
+ elseif (arg STREQUAL "USE")
set(_state "use")
- elseif (${arg} STREQUAL "VERSION")
+ elseif (arg STREQUAL "VERSION")
set(_state "version")
else ()
set(_javadoc_version ${arg})
@@ -1254,7 +1255,7 @@ function(create_javadoc _target)
if (_javadoc_sourcepath)
set(_start TRUE)
- foreach(_path ${_javadoc_sourcepath})
+ foreach(_path IN LISTS _javadoc_sourcepath)
if (_start)
set(_sourcepath ${_path})
set(_start FALSE)
@@ -1267,7 +1268,7 @@ function(create_javadoc _target)
if (_javadoc_classpath)
set(_start TRUE)
- foreach(_path ${_javadoc_classpath})
+ foreach(_path IN LISTS _javadoc_classpath)
if (_start)
set(_classpath ${_path})
set(_start FALSE)
@@ -1434,7 +1435,7 @@ function(export_jars)
# Set content of generated exports file
string(REPLACE ";" " " __targets__ "${_export_jars_TARGETS}")
set(__targetdefs__ "")
- foreach(_target ${_export_jars_TARGETS})
+ foreach(_target IN LISTS _export_jars_TARGETS)
get_target_property(_jarpath ${_target} JAR_FILE)
get_filename_component(_jarpath ${_jarpath} PATH)
__java_export_jar(__targetdefs__ ${_target} "${_jarpath}")
@@ -1472,7 +1473,7 @@ function(install_jar_exports)
endif()
# Determine relative path from installed export file to install prefix
- if(IS_ABSOLUTE ${_install_jar_exports_DESTINATION})
+ if(IS_ABSOLUTE "${_install_jar_exports_DESTINATION}")
file(RELATIVE_PATH _relpath
${_install_jar_exports_DESTINATION}
${CMAKE_INSTALL_PREFIX}
@@ -1491,7 +1492,7 @@ function(install_jar_exports)
# Set content of generated exports file
string(REPLACE ";" " " __targets__ "${_install_jar_exports_TARGETS}")
set(__targetdefs__ "set(_prefix \${CMAKE_CURRENT_LIST_DIR}/${_relpath})\n\n")
- foreach(_target ${_install_jar_exports_TARGETS})
+ foreach(_target IN LISTS _install_jar_exports_TARGETS)
get_target_property(_dir ${_target} INSTALL_DESTINATION)
__java_export_jar(__targetdefs__ ${_target} "\${_prefix}/${_dir}")
endforeach()
diff --git a/Modules/UseJavaClassFilelist.cmake b/Modules/UseJavaClassFilelist.cmake
index c2f9afa4f..1c4baa9d4 100644
--- a/Modules/UseJavaClassFilelist.cmake
+++ b/Modules/UseJavaClassFilelist.cmake
@@ -1,17 +1,18 @@
# 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.
+#[=======================================================================[.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.
+#]=======================================================================]
if (CMAKE_JAVA_CLASS_OUTPUT_PATH)
if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}")
diff --git a/Modules/UseJavaSymlinks.cmake b/Modules/UseJavaSymlinks.cmake
index 358b9ef5c..3969f54fa 100644
--- a/Modules/UseJavaSymlinks.cmake
+++ b/Modules/UseJavaSymlinks.cmake
@@ -1,15 +1,16 @@
# 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
+#[=======================================================================[.rst:
+UseJavaSymlinks
+---------------
+
+
+
+
+
+Helper script for UseJava.cmake
+#]=======================================================================]
if (UNIX AND _JAVA_TARGET_OUTPUT_LINK)
if (_JAVA_TARGET_OUTPUT_NAME)
diff --git a/Modules/UsePkgConfig.cmake b/Modules/UsePkgConfig.cmake
index 28618eb10..32d228dab 100644
--- a/Modules/UsePkgConfig.cmake
+++ b/Modules/UsePkgConfig.cmake
@@ -1,24 +1,25 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# UsePkgConfig
-# ------------
-#
-# Obsolete pkg-config module for CMake, use FindPkgConfig instead.
-#
-#
-#
-# This module defines the following macro:
-#
-# PKGCONFIG(package includedir libdir linkflags cflags)
-#
-# Calling PKGCONFIG will fill the desired information into the 4 given
-# arguments, e.g. PKGCONFIG(libart-2.0 LIBART_INCLUDE_DIR
-# LIBART_LINK_DIR LIBART_LINK_FLAGS LIBART_CFLAGS) if pkg-config was NOT
-# found or the specified software package doesn't exist, the variable
-# will be empty when the function returns, otherwise they will contain
-# the respective information
+#[=======================================================================[.rst:
+UsePkgConfig
+------------
+
+Obsolete pkg-config module for CMake, use FindPkgConfig instead.
+
+
+
+This module defines the following macro:
+
+PKGCONFIG(package includedir libdir linkflags cflags)
+
+Calling PKGCONFIG will fill the desired information into the 4 given
+arguments, e.g. PKGCONFIG(libart-2.0 LIBART_INCLUDE_DIR
+LIBART_LINK_DIR LIBART_LINK_FLAGS LIBART_CFLAGS) if pkg-config was NOT
+found or the specified software package doesn't exist, the variable
+will be empty when the function returns, otherwise they will contain
+the respective information
+#]=======================================================================]
find_program(PKGCONFIG_EXECUTABLE NAMES pkg-config )
diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake
index c8eab7766..dc2348ed1 100644
--- a/Modules/UseQt4.cmake
+++ b/Modules/UseQt4.cmake
@@ -1,15 +1,16 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# UseQt4
-# ------
-#
-# Use Module for QT4
-#
-# Sets up C and C++ to use Qt 4. It is assumed that FindQt.cmake has
-# already been loaded. See FindQt.cmake for information on how to load
-# Qt 4 into your CMake project.
+#[=======================================================================[.rst:
+UseQt4
+------
+
+Use Module for QT4
+
+Sets up C and C++ to use Qt 4. It is assumed that FindQt.cmake has
+already been loaded. See FindQt.cmake for information on how to load
+Qt 4 into your CMake project.
+#]=======================================================================]
add_definitions(${QT_DEFINITIONS})
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 82fbc4bbc..18ea55c42 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -75,7 +75,8 @@ 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.
+ the standard way. This behavior can be overriden by specifying the variable
+ ``SWIG_SOURCE_FILE_EXTENSIONS``.
.. note::
@@ -142,6 +143,11 @@ ensure generated files will receive the required settings.
set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname)
+ .. note::
+
+ If policy :policy:`CMP0086` is set to ``NEW``, ``-module <module_name>``
+ is passed to ``SWIG`` compiler.
+
Target library properties can be set to apply same configuration to all SWIG
input files.
@@ -217,15 +223,31 @@ as well as ``SWIG``:
``SWIG_MODULE_<name>_EXTRA_DEPS``
Specify extra dependencies for the generated module for ``<name>``.
+
+``SWIG_SOURCE_FILE_EXTENSIONS``
+ 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:
+
+ .. code-block:: cmake
+
+ set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swg")
#]=======================================================================]
cmake_policy(GET CMP0078 target_name_policy)
+cmake_policy(GET CMP0086 module_name_policy)
+
cmake_policy (VERSION 3.12)
if (target_name_policy)
# respect user choice regarding CMP0078 policy
cmake_policy(SET CMP0078 ${target_name_policy})
endif()
+if (module_name_policy)
+ # respect user choice regarding CMP0086 policy
+ cmake_policy(SET CMP0086 ${module_name_policy})
+endif()
unset(target_name_policy)
+unset(module_name_policy)
set(SWIG_CXX_EXTENSION "cxx")
set(SWIG_EXTRA_LIBRARIES "")
@@ -426,6 +448,19 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
list (APPEND swig_special_flags "-c++")
endif()
+ cmake_policy(GET CMP0086 module_name_policy)
+ if (module_name_policy STREQUAL "NEW")
+ get_source_file_property(module_name "${infile}" SWIG_MODULE_NAME)
+ if (module_name)
+ list (APPEND swig_special_flags "-module" "${module_name}")
+ endif()
+ else()
+ if (NOT module_name_policy)
+ cmake_policy(GET_WARNING CMP0086 _cmp0086_warning)
+ message(AUTHOR_WARNING "${_cmp0086_warning}\n")
+ endif()
+ endif()
+
set (swig_extra_flags)
if(SWIG_MODULE_${name}_LANGUAGE STREQUAL "CSHARP")
if(NOT ("-dllimport" IN_LIST swig_source_file_flags OR "-dllimport" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS))
@@ -561,11 +596,8 @@ function(SWIG_ADD_LIBRARY name)
set (UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
else()
if (NOT target_name_policy)
- message(AUTHOR_WARNING
- "Policy CMP0078 is not set. "
- "Run \"cmake --help-policy CMP0078\" for policy details. "
- "Use the cmake_policy command to set the policy and suppress this warning."
- )
+ cmake_policy(GET_WARNING CMP0078 _cmp0078_warning)
+ message(AUTHOR_WARNING "${_cmp0078_warning}\n")
endif()
if (NOT DEFINED UseSWIG_TARGET_NAME_PREFERENCE)
set (UseSWIG_TARGET_NAME_PREFERENCE LEGACY)
@@ -637,8 +669,20 @@ function(SWIG_ADD_LIBRARY name)
set(CMAKE_SWIG_OUTDIR "${outputdir}")
set(SWIG_OUTFILE_DIR "${outfiledir}")
+ # See if the user has specified source extensions for swig files?
+ if (NOT DEFINED SWIG_SOURCE_FILE_EXTENSIONS)
+ # Assume the default (*.i) file extension for Swig source files
+ set(SWIG_SOURCE_FILE_EXTENSIONS ".i")
+ 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)
+ string (PREPEND swig_source_ext_regex "(")
+ string (APPEND swig_source_ext_regex ")$")
+
set(swig_dot_i_sources ${_SAM_SOURCES})
- list(FILTER swig_dot_i_sources INCLUDE REGEX "\\.i$")
+ list(FILTER swig_dot_i_sources INCLUDE REGEX ${swig_source_ext_regex})
if (NOT swig_dot_i_sources)
message(FATAL_ERROR "SWIG_ADD_LIBRARY: no SWIG interface files specified")
endif()
diff --git a/Modules/Use_wxWindows.cmake b/Modules/Use_wxWindows.cmake
index bd8cc01c1..782874c10 100644
--- a/Modules/Use_wxWindows.cmake
+++ b/Modules/Use_wxWindows.cmake
@@ -1,35 +1,37 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# Use_wxWindows
-# -------------
-#
-#
-#
-#
-# This convenience include finds if wxWindows is installed and set the
-# appropriate libs, incdirs, flags etc. author Jan Woetzel <jw -at-
-# mip.informatik.uni-kiel.de> (07/2003)
-#
-# USAGE:
-#
-# ::
-#
-# just include Use_wxWindows.cmake
-# in your projects CMakeLists.txt
-#
-# include( ${CMAKE_MODULE_PATH}/Use_wxWindows.cmake)
-#
-# ::
-#
-# if you are sure you need GL then
-#
-# set(WXWINDOWS_USE_GL 1)
-#
-# ::
-#
-# *before* you include this file.
+#[=======================================================================[.rst:
+Use_wxWindows
+-------------
+
+.. deprecated:: 2.8.10
+
+ Use ``find_package(wxWidgets)`` and ``include(${wxWidgets_USE_FILE})`` instead.
+
+This convenience include finds if wxWindows is installed and set the
+appropriate libs, incdirs, flags etc. author Jan Woetzel <jw -at-
+mip.informatik.uni-kiel.de> (07/2003)
+
+USAGE:
+
+::
+
+ just include Use_wxWindows.cmake
+ in your projects CMakeLists.txt
+
+include( ${CMAKE_MODULE_PATH}/Use_wxWindows.cmake)
+
+::
+
+ if you are sure you need GL then
+
+set(WXWINDOWS_USE_GL 1)
+
+::
+
+ *before* you include this file.
+#]=======================================================================]
# -----------------------------------------------------
# 16.Feb.2004: changed INCLUDE to FIND_PACKAGE to read from users own non-system CMAKE_MODULE_PATH (Jan Woetzel JW)
@@ -65,4 +67,3 @@ if(WXWINDOWS_FOUND)
else()
message(SEND_ERROR "wxWindows not found by Use_wxWindows.cmake")
endif()
-
diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake
index a50d03d53..eed041021 100644
--- a/Modules/UsewxWidgets.cmake
+++ b/Modules/UsewxWidgets.cmake
@@ -1,41 +1,42 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# UsewxWidgets
-# ------------
-#
-# Convenience include for using wxWidgets library.
-#
-# Determines if wxWidgets was FOUND and sets the appropriate libs,
-# incdirs, flags, etc. INCLUDE_DIRECTORIES and LINK_DIRECTORIES are
-# called.
-#
-# USAGE
-#
-# ::
-#
-# # Note that for MinGW users the order of libs is important!
-# find_package(wxWidgets REQUIRED net gl core base)
-# include(${wxWidgets_USE_FILE})
-# # and for each of your dependent executable/library targets:
-# target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
-#
-#
-#
-# DEPRECATED
-#
-# ::
-#
-# LINK_LIBRARIES is not called in favor of adding dependencies per target.
-#
-#
-#
-# AUTHOR
-#
-# ::
-#
-# Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
+#[=======================================================================[.rst:
+UsewxWidgets
+------------
+
+Convenience include for using wxWidgets library.
+
+Determines if wxWidgets was FOUND and sets the appropriate libs,
+incdirs, flags, etc. INCLUDE_DIRECTORIES and LINK_DIRECTORIES are
+called.
+
+USAGE
+
+::
+
+ # Note that for MinGW users the order of libs is important!
+ find_package(wxWidgets REQUIRED net gl core base)
+ include(${wxWidgets_USE_FILE})
+ # and for each of your dependent executable/library targets:
+ target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
+
+
+
+DEPRECATED
+
+::
+
+ LINK_LIBRARIES is not called in favor of adding dependencies per target.
+
+
+
+AUTHOR
+
+::
+
+ Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
+#]=======================================================================]
# debug message and logging.
# comment these out for distribution
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 2f7c80ab8..45f9e587a 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -1,26 +1,29 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# WriteBasicConfigVersionFile
-# ---------------------------
-#
-#
-#
-# ::
-#
-# WRITE_BASIC_CONFIG_VERSION_FILE( filename
-# [VERSION major.minor.patch]
-# COMPATIBILITY (AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion)
-# )
-#
-#
-#
-# Deprecated, see WRITE_BASIC_PACKAGE_VERSION_FILE(), it is identical.
+#[=======================================================================[.rst:
+WriteBasicConfigVersionFile
+---------------------------
+
+.. deprecated:: 3.0
+
+ Use the identical command :command:`write_basic_package_version_file()`
+ from module :module:`CMakePackageConfigHelpers`.
+
+::
+
+ WRITE_BASIC_CONFIG_VERSION_FILE( filename
+ [VERSION major.minor.patch]
+ COMPATIBILITY (AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion)
+ [ARCH_INDEPENDENT]
+ )
+
+
+#]=======================================================================]
function(WRITE_BASIC_CONFIG_VERSION_FILE _filename)
- set(options )
+ set(options ARCH_INDEPENDENT )
set(oneValueArgs VERSION COMPATIBILITY )
set(multiValueArgs )
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 3718e9ddf..21ccd7ca8 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -1,236 +1,236 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# WriteCompilerDetectionHeader
-# ----------------------------
-#
-# This module provides the function write_compiler_detection_header().
-#
-# The ``WRITE_COMPILER_DETECTION_HEADER`` function can be used to generate
-# a file suitable for preprocessor inclusion which contains macros to be
-# used in source code::
-#
-# write_compiler_detection_header(
-# FILE <file>
-# PREFIX <prefix>
-# [OUTPUT_FILES_VAR <output_files_var> OUTPUT_DIR <output_dir>]
-# COMPILERS <compiler> [...]
-# FEATURES <feature> [...]
-# [BARE_FEATURES <feature> [...]]
-# [VERSION <version>]
-# [PROLOG <prolog>]
-# [EPILOG <epilog>]
-# [ALLOW_UNKNOWN_COMPILERS]
-# [ALLOW_UNKNOWN_COMPILER_VERSIONS]
-# )
-#
-# The ``write_compiler_detection_header`` function generates the
-# file ``<file>`` with macros which all have the prefix ``<prefix>``.
-#
-# By default, all content is written directly to the ``<file>``. The
-# ``OUTPUT_FILES_VAR`` may be specified to cause the compiler-specific
-# content to be written to separate files. The separate files are then
-# available in the ``<output_files_var>`` and may be consumed by the caller
-# for installation for example. The ``OUTPUT_DIR`` specifies a relative
-# path from the main ``<file>`` to the compiler-specific files. For example:
-#
-# .. code-block:: cmake
-#
-# write_compiler_detection_header(
-# FILE climbingstats_compiler_detection.h
-# PREFIX ClimbingStats
-# OUTPUT_FILES_VAR support_files
-# OUTPUT_DIR compilers
-# COMPILERS GNU Clang MSVC Intel
-# FEATURES cxx_variadic_templates
-# )
-# install(FILES
-# ${CMAKE_CURRENT_BINARY_DIR}/climbingstats_compiler_detection.h
-# DESTINATION include
-# )
-# install(FILES
-# ${support_files}
-# DESTINATION include/compilers
-# )
-#
-#
-# ``VERSION`` may be used to specify the API version to be generated.
-# Future versions of CMake may introduce alternative APIs. A given
-# API is selected by any ``<version>`` value greater than or equal
-# to the version of CMake that introduced the given API and less
-# than the version of CMake that introduced its succeeding API.
-# The value of the :variable:`CMAKE_MINIMUM_REQUIRED_VERSION`
-# variable is used if no explicit version is specified.
-# (As of CMake version |release| there is only one API version.)
-#
-# ``PROLOG`` may be specified as text content to write at the start of the
-# header. ``EPILOG`` may be specified as text content to write at the end
-# of the header
-#
-# At least one ``<compiler>`` and one ``<feature>`` must be listed. Compilers
-# which are known to CMake, but not specified are detected and a preprocessor
-# ``#error`` is generated for them. A preprocessor macro matching
-# ``<PREFIX>_COMPILER_IS_<compiler>`` is generated for each compiler
-# known to CMake to contain the value ``0`` or ``1``.
-#
-# Possible compiler identifiers are documented with the
-# :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
-# Available features in this version of CMake are listed in the
-# :prop_gbl:`CMAKE_C_KNOWN_FEATURES` and
-# :prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` global properties.
-# 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.
-#
-# ``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.
-#
-# Feature Test Macros
-# ===================
-#
-# For each compiler, a preprocessor macro is generated matching
-# ``<PREFIX>_COMPILER_IS_<compiler>`` which has the content either ``0``
-# or ``1``, depending on the compiler in use. Preprocessor macros for
-# compiler version components are generated matching
-# ``<PREFIX>_COMPILER_VERSION_MAJOR`` ``<PREFIX>_COMPILER_VERSION_MINOR``
-# and ``<PREFIX>_COMPILER_VERSION_PATCH`` containing decimal values
-# for the corresponding compiler version components, if defined.
-#
-# A preprocessor test is generated based on the compiler version
-# denoting whether each feature is enabled. A preprocessor macro
-# matching ``<PREFIX>_COMPILER_<FEATURE>``, where ``<FEATURE>`` is the
-# upper-case ``<feature>`` name, is generated to contain the value
-# ``0`` or ``1`` depending on whether the compiler in use supports the
-# feature:
-#
-# .. code-block:: cmake
-#
-# write_compiler_detection_header(
-# FILE climbingstats_compiler_detection.h
-# PREFIX ClimbingStats
-# COMPILERS GNU Clang AppleClang MSVC Intel
-# FEATURES cxx_variadic_templates
-# )
-#
-# .. code-block:: c++
-#
-# #if ClimbingStats_COMPILER_CXX_VARIADIC_TEMPLATES
-# template<typename... T>
-# void someInterface(T t...) { /* ... */ }
-# #else
-# // Compatibility versions
-# template<typename T1>
-# void someInterface(T1 t1) { /* ... */ }
-# template<typename T1, typename T2>
-# void someInterface(T1 t1, T2 t2) { /* ... */ }
-# template<typename T1, typename T2, typename T3>
-# void someInterface(T1 t1, T2 t2, T3 t3) { /* ... */ }
-# #endif
-#
-# Symbol Macros
-# =============
-#
-# Some additional symbol-defines are created for particular features for
-# use as symbols which may be conditionally defined empty:
-#
-# .. code-block:: c++
-#
-# class MyClass ClimbingStats_FINAL
-# {
-# ClimbingStats_CONSTEXPR int someInterface() { return 42; }
-# };
-#
-# The ``ClimbingStats_FINAL`` macro will expand to ``final`` if the
-# compiler (and its flags) support the ``cxx_final`` feature, and the
-# ``ClimbingStats_CONSTEXPR`` macro will expand to ``constexpr``
-# if ``cxx_constexpr`` is supported.
-#
-# If ``BARE_FEATURES cxx_final`` was given as argument the ``final`` keyword
-# will be defined for old compilers, too.
-#
-# The following features generate corresponding symbol defines and if they
-# are available as ``BARE_FEATURES``:
-#
-# ========================== =================================== ================= ======
-# Feature Define Symbol bare
-# ========================== =================================== ================= ======
-# ``c_restrict`` ``<PREFIX>_RESTRICT`` ``restrict`` yes
-# ``cxx_constexpr`` ``<PREFIX>_CONSTEXPR`` ``constexpr`` yes
-# ``cxx_deleted_functions`` ``<PREFIX>_DELETED_FUNCTION`` ``= delete``
-# ``cxx_extern_templates`` ``<PREFIX>_EXTERN_TEMPLATE`` ``extern``
-# ``cxx_final`` ``<PREFIX>_FINAL`` ``final`` yes
-# ``cxx_noexcept`` ``<PREFIX>_NOEXCEPT`` ``noexcept`` yes
-# ``cxx_noexcept`` ``<PREFIX>_NOEXCEPT_EXPR(X)`` ``noexcept(X)``
-# ``cxx_override`` ``<PREFIX>_OVERRIDE`` ``override`` yes
-# ========================== =================================== ================= ======
-#
-# Compatibility Implementation Macros
-# ===================================
-#
-# Some features are suitable for wrapping in a macro with a backward
-# compatibility implementation if the compiler does not support the feature.
-#
-# When the ``cxx_static_assert`` feature is not provided by the compiler,
-# a compatibility implementation is available via the
-# ``<PREFIX>_STATIC_ASSERT(COND)`` and
-# ``<PREFIX>_STATIC_ASSERT_MSG(COND, MSG)`` function-like macros. The macros
-# expand to ``static_assert`` where that compiler feature is available, and
-# to a compatibility implementation otherwise. In the first form, the
-# condition is stringified in the message field of ``static_assert``. In
-# the second form, the message ``MSG`` is passed to the message field of
-# ``static_assert``, or ignored if using the backward compatibility
-# implementation.
-#
-# The ``cxx_attribute_deprecated`` feature provides a macro definition
-# ``<PREFIX>_DEPRECATED``, which expands to either the standard
-# ``[[deprecated]]`` attribute or a compiler-specific decorator such
-# as ``__attribute__((__deprecated__))`` used by GNU compilers.
-#
-# The ``cxx_alignas`` feature provides a macro definition
-# ``<PREFIX>_ALIGNAS`` which expands to either the standard ``alignas``
-# decorator or a compiler-specific decorator such as
-# ``__attribute__ ((__aligned__))`` used by GNU compilers.
-#
-# The ``cxx_alignof`` feature provides a macro definition
-# ``<PREFIX>_ALIGNOF`` which expands to either the standard ``alignof``
-# decorator or a compiler-specific decorator such as ``__alignof__``
-# used by GNU compilers.
-#
-# ============================= ================================ ===================== ======
-# Feature Define Symbol bare
-# ============================= ================================ ===================== ======
-# ``cxx_alignas`` ``<PREFIX>_ALIGNAS`` ``alignas``
-# ``cxx_alignof`` ``<PREFIX>_ALIGNOF`` ``alignof``
-# ``cxx_nullptr`` ``<PREFIX>_NULLPTR`` ``nullptr`` yes
-# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT`` ``static_assert``
-# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT_MSG`` ``static_assert``
-# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED`` ``[[deprecated]]``
-# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED_MSG`` ``[[deprecated]]``
-# ``cxx_thread_local`` ``<PREFIX>_THREAD_LOCAL`` ``thread_local``
-# ============================= ================================ ===================== ======
-#
-# A use-case which arises with such deprecation macros is the deprecation
-# of an entire library. In that case, all public API in the library may
-# be decorated with the ``<PREFIX>_DEPRECATED`` macro. This results in
-# very noisy build output when building the library itself, so the macro
-# may be may be defined to empty in that case when building the deprecated
-# library:
-#
-# .. code-block:: cmake
-#
-# add_library(compat_support ${srcs})
-# target_compile_definitions(compat_support
-# PRIVATE
-# CompatSupport_DEPRECATED=
-# )
+#[=======================================================================[.rst:
+WriteCompilerDetectionHeader
+----------------------------
+
+This module provides the function write_compiler_detection_header().
+
+This function can be used to generate a file suitable for preprocessor
+inclusion which contains macros to be used in source code::
+
+ write_compiler_detection_header(
+ FILE <file>
+ PREFIX <prefix>
+ [OUTPUT_FILES_VAR <output_files_var> OUTPUT_DIR <output_dir>]
+ COMPILERS <compiler> [...]
+ FEATURES <feature> [...]
+ [BARE_FEATURES <feature> [...]]
+ [VERSION <version>]
+ [PROLOG <prolog>]
+ [EPILOG <epilog>]
+ [ALLOW_UNKNOWN_COMPILERS]
+ [ALLOW_UNKNOWN_COMPILER_VERSIONS]
+ )
+
+This generates the file ``<file>`` with macros which all have the prefix
+``<prefix>``.
+
+By default, all content is written directly to the ``<file>``. The
+``OUTPUT_FILES_VAR`` may be specified to cause the compiler-specific
+content to be written to separate files. The separate files are then
+available in the ``<output_files_var>`` and may be consumed by the caller
+for installation for example. The ``OUTPUT_DIR`` specifies a relative
+path from the main ``<file>`` to the compiler-specific files. For example:
+
+.. code-block:: cmake
+
+ write_compiler_detection_header(
+ FILE climbingstats_compiler_detection.h
+ PREFIX ClimbingStats
+ OUTPUT_FILES_VAR support_files
+ OUTPUT_DIR compilers
+ COMPILERS GNU Clang MSVC Intel
+ FEATURES cxx_variadic_templates
+ )
+ install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/climbingstats_compiler_detection.h
+ DESTINATION include
+ )
+ install(FILES
+ ${support_files}
+ DESTINATION include/compilers
+ )
+
+
+``VERSION`` may be used to specify the API version to be generated.
+Future versions of CMake may introduce alternative APIs. A given
+API is selected by any ``<version>`` value greater than or equal
+to the version of CMake that introduced the given API and less
+than the version of CMake that introduced its succeeding API.
+The value of the :variable:`CMAKE_MINIMUM_REQUIRED_VERSION`
+variable is used if no explicit version is specified.
+(As of CMake version |release| there is only one API version.)
+
+``PROLOG`` may be specified as text content to write at the start of the
+header. ``EPILOG`` may be specified as text content to write at the end
+of the header
+
+At least one ``<compiler>`` and one ``<feature>`` must be listed. Compilers
+which are known to CMake, but not specified are detected and a preprocessor
+``#error`` is generated for them. A preprocessor macro matching
+``<PREFIX>_COMPILER_IS_<compiler>`` is generated for each compiler
+known to CMake to contain the value ``0`` or ``1``.
+
+Possible compiler identifiers are documented with the
+:variable:`CMAKE_<LANG>_COMPILER_ID` variable.
+Available features in this version of CMake are listed in the
+:prop_gbl:`CMAKE_C_KNOWN_FEATURES` and
+:prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` global properties.
+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.
+
+``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.
+
+Feature Test Macros
+===================
+
+For each compiler, a preprocessor macro is generated matching
+``<PREFIX>_COMPILER_IS_<compiler>`` which has the content either ``0``
+or ``1``, depending on the compiler in use. Preprocessor macros for
+compiler version components are generated matching
+``<PREFIX>_COMPILER_VERSION_MAJOR`` ``<PREFIX>_COMPILER_VERSION_MINOR``
+and ``<PREFIX>_COMPILER_VERSION_PATCH`` containing decimal values
+for the corresponding compiler version components, if defined.
+
+A preprocessor test is generated based on the compiler version
+denoting whether each feature is enabled. A preprocessor macro
+matching ``<PREFIX>_COMPILER_<FEATURE>``, where ``<FEATURE>`` is the
+upper-case ``<feature>`` name, is generated to contain the value
+``0`` or ``1`` depending on whether the compiler in use supports the
+feature:
+
+.. code-block:: cmake
+
+ write_compiler_detection_header(
+ FILE climbingstats_compiler_detection.h
+ PREFIX ClimbingStats
+ COMPILERS GNU Clang AppleClang MSVC Intel
+ FEATURES cxx_variadic_templates
+ )
+
+.. code-block:: c++
+
+ #if ClimbingStats_COMPILER_CXX_VARIADIC_TEMPLATES
+ template<typename... T>
+ void someInterface(T t...) { /* ... */ }
+ #else
+ // Compatibility versions
+ template<typename T1>
+ void someInterface(T1 t1) { /* ... */ }
+ template<typename T1, typename T2>
+ void someInterface(T1 t1, T2 t2) { /* ... */ }
+ template<typename T1, typename T2, typename T3>
+ void someInterface(T1 t1, T2 t2, T3 t3) { /* ... */ }
+ #endif
+
+Symbol Macros
+=============
+
+Some additional symbol-defines are created for particular features for
+use as symbols which may be conditionally defined empty:
+
+.. code-block:: c++
+
+ class MyClass ClimbingStats_FINAL
+ {
+ ClimbingStats_CONSTEXPR int someInterface() { return 42; }
+ };
+
+The ``ClimbingStats_FINAL`` macro will expand to ``final`` if the
+compiler (and its flags) support the ``cxx_final`` feature, and the
+``ClimbingStats_CONSTEXPR`` macro will expand to ``constexpr``
+if ``cxx_constexpr`` is supported.
+
+If ``BARE_FEATURES cxx_final`` was given as argument the ``final`` keyword
+will be defined for old compilers, too.
+
+The following features generate corresponding symbol defines and if they
+are available as ``BARE_FEATURES``:
+
+========================== =================================== ================= ======
+ Feature Define Symbol bare
+========================== =================================== ================= ======
+``c_restrict`` ``<PREFIX>_RESTRICT`` ``restrict`` yes
+``cxx_constexpr`` ``<PREFIX>_CONSTEXPR`` ``constexpr`` yes
+``cxx_deleted_functions`` ``<PREFIX>_DELETED_FUNCTION`` ``= delete``
+``cxx_extern_templates`` ``<PREFIX>_EXTERN_TEMPLATE`` ``extern``
+``cxx_final`` ``<PREFIX>_FINAL`` ``final`` yes
+``cxx_noexcept`` ``<PREFIX>_NOEXCEPT`` ``noexcept`` yes
+``cxx_noexcept`` ``<PREFIX>_NOEXCEPT_EXPR(X)`` ``noexcept(X)``
+``cxx_override`` ``<PREFIX>_OVERRIDE`` ``override`` yes
+========================== =================================== ================= ======
+
+Compatibility Implementation Macros
+===================================
+
+Some features are suitable for wrapping in a macro with a backward
+compatibility implementation if the compiler does not support the feature.
+
+When the ``cxx_static_assert`` feature is not provided by the compiler,
+a compatibility implementation is available via the
+``<PREFIX>_STATIC_ASSERT(COND)`` and
+``<PREFIX>_STATIC_ASSERT_MSG(COND, MSG)`` function-like macros. The macros
+expand to ``static_assert`` where that compiler feature is available, and
+to a compatibility implementation otherwise. In the first form, the
+condition is stringified in the message field of ``static_assert``. In
+the second form, the message ``MSG`` is passed to the message field of
+``static_assert``, or ignored if using the backward compatibility
+implementation.
+
+The ``cxx_attribute_deprecated`` feature provides a macro definition
+``<PREFIX>_DEPRECATED``, which expands to either the standard
+``[[deprecated]]`` attribute or a compiler-specific decorator such
+as ``__attribute__((__deprecated__))`` used by GNU compilers.
+
+The ``cxx_alignas`` feature provides a macro definition
+``<PREFIX>_ALIGNAS`` which expands to either the standard ``alignas``
+decorator or a compiler-specific decorator such as
+``__attribute__ ((__aligned__))`` used by GNU compilers.
+
+The ``cxx_alignof`` feature provides a macro definition
+``<PREFIX>_ALIGNOF`` which expands to either the standard ``alignof``
+decorator or a compiler-specific decorator such as ``__alignof__``
+used by GNU compilers.
+
+============================= ================================ ===================== ======
+ Feature Define Symbol bare
+============================= ================================ ===================== ======
+``cxx_alignas`` ``<PREFIX>_ALIGNAS`` ``alignas``
+``cxx_alignof`` ``<PREFIX>_ALIGNOF`` ``alignof``
+``cxx_nullptr`` ``<PREFIX>_NULLPTR`` ``nullptr`` yes
+``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT`` ``static_assert``
+``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT_MSG`` ``static_assert``
+``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED`` ``[[deprecated]]``
+``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED_MSG`` ``[[deprecated]]``
+``cxx_thread_local`` ``<PREFIX>_THREAD_LOCAL`` ``thread_local``
+============================= ================================ ===================== ======
+
+A use-case which arises with such deprecation macros is the deprecation
+of an entire library. In that case, all public API in the library may
+be decorated with the ``<PREFIX>_DEPRECATED`` macro. This results in
+very noisy build output when building the library itself, so the macro
+may be may be defined to empty in that case when building the deprecated
+library:
+
+.. code-block:: cmake
+
+ add_library(compat_support ${srcs})
+ target_compile_definitions(compat_support
+ PRIVATE
+ CompatSupport_DEPRECATED=
+ )
+#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerIdDetection.cmake)