summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/AddFileDependencies.cmake8
-rw-r--r--Modules/AutogenInfo.cmake.in (renamed from Modules/AutomocInfo.cmake.in)14
-rw-r--r--Modules/BasicConfigVersion-AnyNewerVersion.cmake.in8
-rw-r--r--Modules/BasicConfigVersion-ExactVersion.cmake.in12
-rw-r--r--Modules/BasicConfigVersion-SameMajorVersion.cmake.in10
-rw-r--r--Modules/BundleUtilities.cmake453
-rw-r--r--Modules/CMakeASMInformation.cmake20
-rw-r--r--Modules/CMakeASM_MASMInformation.cmake2
-rw-r--r--Modules/CMakeAddFortranSubdirectory.cmake60
-rw-r--r--Modules/CMakeBackwardCompatibilityCXX.cmake27
-rw-r--r--Modules/CMakeCCompiler.cmake.in19
-rw-r--r--Modules/CMakeCCompilerId.c.in228
-rw-r--r--Modules/CMakeCInformation.cmake24
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in19
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in221
-rw-r--r--Modules/CMakeCXXInformation.cmake25
-rw-r--r--Modules/CMakeCheckCompilerFlagCommonPatterns.cmake45
-rw-r--r--Modules/CMakeClDeps.cmake34
-rw-r--r--Modules/CMakeCommonLanguageInclude.cmake24
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake158
-rw-r--r--Modules/CMakeConfigurableFile.in1
-rw-r--r--Modules/CMakeDependentOption.cmake30
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake27
-rw-r--r--Modules/CMakeDetermineASM_MASMCompiler.cmake3
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake67
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake66
-rw-r--r--Modules/CMakeDetermineCompileFeatures.cmake94
-rw-r--r--Modules/CMakeDetermineCompiler.cmake61
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake24
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake384
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake110
-rw-r--r--Modules/CMakeDetermineJavaCompiler.cmake8
-rw-r--r--Modules/CMakeDetermineRCCompiler.cmake4
-rw-r--r--Modules/CMakeDetermineSwiftCompiler.cmake53
-rw-r--r--Modules/CMakeDetermineSystem.cmake19
-rw-r--r--Modules/CMakeDetermineVSServicePack.cmake91
-rw-r--r--Modules/CMakeExpandImportedTargets.cmake59
-rw-r--r--Modules/CMakeExportBuildSettings.cmake4
-rw-r--r--Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake15
-rw-r--r--Modules/CMakeFindBinUtils.cmake21
-rw-r--r--Modules/CMakeFindDependencyMacro.cmake85
-rw-r--r--Modules/CMakeFindEclipseCDT4.cmake48
-rw-r--r--Modules/CMakeFindFrameworks.cmake6
-rw-r--r--Modules/CMakeFindJavaCommon.cmake41
-rw-r--r--Modules/CMakeFindKate.cmake31
-rw-r--r--Modules/CMakeFindPackageMode.cmake43
-rw-r--r--Modules/CMakeFindXCode.cmake8
-rw-r--r--Modules/CMakeForceCompiler.cmake71
-rw-r--r--Modules/CMakeFortranCompiler.cmake.in4
-rw-r--r--Modules/CMakeFortranCompilerABI.F8
-rw-r--r--Modules/CMakeFortranCompilerId.F.in91
-rw-r--r--Modules/CMakeFortranInformation.cmake24
-rw-r--r--Modules/CMakeGenericSystem.cmake5
-rw-r--r--Modules/CMakeGraphVizOptions.cmake178
-rw-r--r--Modules/CMakeIOSInstallCombined.cmake307
-rw-r--r--Modules/CMakeImportBuildSettings.cmake3
-rw-r--r--Modules/CMakeLanguageInformation.cmake37
-rw-r--r--Modules/CMakeNinjaFindMake.cmake3
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake351
-rw-r--r--Modules/CMakeParseArguments.cmake131
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake13
-rw-r--r--Modules/CMakePlatformId.h.in57
-rw-r--r--Modules/CMakePrintHelpers.cmake47
-rw-r--r--Modules/CMakePrintSystemInformation.cmake12
-rw-r--r--Modules/CMakePushCheckState.cmake58
-rw-r--r--Modules/CMakeRCCompiler.cmake.in2
-rw-r--r--Modules/CMakeRCInformation.cmake13
-rw-r--r--Modules/CMakeSwiftCompiler.cmake.in5
-rw-r--r--Modules/CMakeSwiftInformation.cmake41
-rw-r--r--Modules/CMakeSystemSpecificInitialize.cmake (renamed from Modules/CMakeVS7FindMake.cmake)19
-rw-r--r--Modules/CMakeTestCCompiler.cmake5
-rw-r--r--Modules/CMakeTestCXXCompiler.cmake5
-rw-r--r--Modules/CMakeTestFortranCompiler.cmake2
-rw-r--r--Modules/CMakeTestSwiftCompiler.cmake65
-rw-r--r--Modules/CMakeVS10FindMake.cmake54
-rw-r--r--Modules/CMakeVS11FindMake.cmake53
-rw-r--r--Modules/CMakeVS8FindMake.cmake34
-rw-r--r--Modules/CMakeVS9FindMake.cmake39
-rw-r--r--Modules/CMakeVerifyManifest.cmake23
-rw-r--r--Modules/CPack.cmake725
-rw-r--r--Modules/CPackBundle.cmake94
-rw-r--r--Modules/CPackComponent.cmake604
-rw-r--r--Modules/CPackCygwin.cmake44
-rw-r--r--Modules/CPackDMG.cmake150
-rw-r--r--Modules/CPackDeb.cmake1067
-rw-r--r--Modules/CPackIFW.cmake614
-rw-r--r--Modules/CPackNSIS.cmake252
-rw-r--r--Modules/CPackPackageMaker.cmake44
-rw-r--r--Modules/CPackRPM.cmake2434
-rw-r--r--Modules/CPackWIX.cmake289
-rw-r--r--Modules/CTest.cmake102
-rw-r--r--Modules/CTestCoverageCollectGCOV.cmake204
-rw-r--r--Modules/CTestScriptMode.cmake6
-rw-r--r--Modules/CTestTargets.cmake3
-rw-r--r--Modules/CTestUseLaunchers.cmake60
-rw-r--r--Modules/CheckCCompilerFlag.cmake45
-rw-r--r--Modules/CheckCSourceCompiles.cmake49
-rw-r--r--Modules/CheckCSourceRuns.cmake49
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake47
-rw-r--r--Modules/CheckCXXSourceCompiles.cmake49
-rw-r--r--Modules/CheckCXXSourceRuns.cmake49
-rw-r--r--Modules/CheckCXXSymbolExists.cmake43
-rw-r--r--Modules/CheckForPthreads.c6
-rw-r--r--Modules/CheckFortranCompilerFlag.cmake66
-rw-r--r--Modules/CheckFortranFunctionExists.cmake26
-rw-r--r--Modules/CheckFortranSourceCompiles.cmake111
-rw-r--r--Modules/CheckFunctionExists.c3
-rw-r--r--Modules/CheckFunctionExists.cmake55
-rw-r--r--Modules/CheckIncludeFile.cmake56
-rw-r--r--Modules/CheckIncludeFileCXX.cmake53
-rw-r--r--Modules/CheckIncludeFiles.cmake55
-rw-r--r--Modules/CheckLanguage.cmake33
-rw-r--r--Modules/CheckLibraryExists.cmake60
-rw-r--r--Modules/CheckPrototypeDefinition.cmake61
-rw-r--r--Modules/CheckStructHasMember.cmake67
-rw-r--r--Modules/CheckSymbolExists.cmake67
-rw-r--r--Modules/CheckTypeSize.cmake165
-rw-r--r--Modules/CheckVariableExists.cmake48
-rw-r--r--Modules/Compiler/ADSP-DetermineCompiler.cmake10
-rw-r--r--Modules/Compiler/ARMCC-ASM.cmake7
-rw-r--r--Modules/Compiler/ARMCC-C.cmake2
-rw-r--r--Modules/Compiler/ARMCC-CXX.cmake2
-rw-r--r--Modules/Compiler/ARMCC-DetermineCompiler.cmake16
-rw-r--r--Modules/Compiler/ARMCC.cmake36
-rw-r--r--Modules/Compiler/AppleClang-ASM.cmake1
-rw-r--r--Modules/Compiler/AppleClang-C-FeatureTests.cmake11
-rw-r--r--Modules/Compiler/AppleClang-C.cmake42
-rw-r--r--Modules/Compiler/AppleClang-CXX-FeatureTests.cmake52
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake56
-rw-r--r--Modules/Compiler/AppleClang-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/Borland-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/CCur-Fortran.cmake1
-rw-r--r--Modules/Compiler/Clang-C-FeatureTests.cmake11
-rw-r--r--Modules/Compiler/Clang-C.cmake49
-rw-r--r--Modules/Compiler/Clang-CXX-FeatureTests.cmake34
-rw-r--r--Modules/Compiler/Clang-CXX-TestableFeatures.cmake54
-rw-r--r--Modules/Compiler/Clang-CXX.cmake59
-rw-r--r--Modules/Compiler/Clang-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/Clang-DetermineCompilerInternal.cmake15
-rw-r--r--Modules/Compiler/Clang.cmake27
-rw-r--r--Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/Compaq-C-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/Cray-DetermineCompiler.cmake6
-rw-r--r--Modules/Compiler/CrayPrgEnv-C.cmake11
-rw-r--r--Modules/Compiler/CrayPrgEnv-CXX.cmake11
-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.cmake11
-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.cmake91
-rw-r--r--Modules/Compiler/Embarcadero-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/Fujitsu-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/GHS-C.cmake27
-rw-r--r--Modules/Compiler/GHS-CXX.cmake31
-rw-r--r--Modules/Compiler/GHS-DetermineCompiler.cmake6
-rw-r--r--Modules/Compiler/GNU-C-FeatureTests.cmake17
-rw-r--r--Modules/Compiler/GNU-C.cmake57
-rw-r--r--Modules/Compiler/GNU-CXX-FeatureTests.cmake109
-rw-r--r--Modules/Compiler/GNU-CXX.cmake54
-rw-r--r--Modules/Compiler/GNU-DetermineCompiler.cmake11
-rw-r--r--Modules/Compiler/GNU-Fortran.cmake6
-rw-r--r--Modules/Compiler/GNU.cmake5
-rw-r--r--Modules/Compiler/HP-C-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/HP-C.cmake4
-rw-r--r--Modules/Compiler/HP-CXX-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/HP-CXX.cmake13
-rw-r--r--Modules/Compiler/HP-Fortran.cmake3
-rw-r--r--Modules/Compiler/IAR-ASM.cmake2
-rw-r--r--Modules/Compiler/IAR-C.cmake6
-rw-r--r--Modules/Compiler/IAR-CXX.cmake6
-rw-r--r--Modules/Compiler/IAR-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/IAR.cmake4
-rw-r--r--Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake6
-rw-r--r--Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake6
-rw-r--r--Modules/Compiler/Intel-C.cmake8
-rw-r--r--Modules/Compiler/Intel-CXX.cmake8
-rw-r--r--Modules/Compiler/Intel-DetermineCompiler.cmake26
-rw-r--r--Modules/Compiler/Intel-Fortran.cmake3
-rw-r--r--Modules/Compiler/MIPSpro-DetermineCompiler.cmake15
-rw-r--r--Modules/Compiler/MSVC-CXX-FeatureTests.cmake111
-rw-r--r--Modules/Compiler/MSVC-CXX.cmake9
-rw-r--r--Modules/Compiler/MSVC-DetermineCompiler.cmake19
-rw-r--r--Modules/Compiler/OpenWatcom-DetermineCompiler.cmake10
-rw-r--r--Modules/Compiler/PGI-DetermineCompiler.cmake9
-rw-r--r--Modules/Compiler/PGI-Fortran.cmake5
-rw-r--r--Modules/Compiler/PGI.cmake4
-rw-r--r--Modules/Compiler/PathScale-DetermineCompiler.cmake9
-rw-r--r--Modules/Compiler/QCC-C.cmake2
-rw-r--r--Modules/Compiler/QCC-CXX.cmake12
-rw-r--r--Modules/Compiler/QCC.cmake (renamed from Modules/CMakeVS6FindMake.cmake)23
-rw-r--r--Modules/Compiler/SCO-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/SDCC-C-DetermineCompiler.cmake10
-rw-r--r--Modules/Compiler/SunPro-C-DetermineCompiler.cmake15
-rw-r--r--Modules/Compiler/SunPro-C.cmake5
-rw-r--r--Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake15
-rw-r--r--Modules/Compiler/SunPro-CXX-FeatureTests.cmake52
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake36
-rw-r--r--Modules/Compiler/SunPro-Fortran.cmake4
-rw-r--r--Modules/Compiler/TI-ASM.cmake2
-rw-r--r--Modules/Compiler/TI-C.cmake6
-rw-r--r--Modules/Compiler/TI-CXX.cmake6
-rw-r--r--Modules/Compiler/TI-DetermineCompiler.cmake8
-rw-r--r--Modules/Compiler/TinyCC-C-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/VisualAge-C-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/Watcom-DetermineCompiler.cmake10
-rw-r--r--Modules/Compiler/XL-ASM.cmake3
-rw-r--r--Modules/Compiler/XL-C-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/XL-C.cmake3
-rw-r--r--Modules/Compiler/XL-CXX-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/XL-CXX.cmake2
-rw-r--r--Modules/Compiler/XL-Fortran.cmake2
-rw-r--r--Modules/Compiler/XL.cmake4
-rw-r--r--Modules/Compiler/zOS-C-DetermineCompiler.cmake4
-rw-r--r--Modules/Compiler/zOS-CXX-DetermineCompiler.cmake4
-rw-r--r--Modules/CompilerId/VS-10.vcxproj.in4
-rw-r--r--Modules/CompilerId/VS-Intel.vfproj.in42
-rw-r--r--Modules/CompilerId/VS-NsightTegra.vcxproj.in56
-rw-r--r--Modules/CompilerId/Xcode-3.pbxproj.in6
-rw-r--r--Modules/CompilerId/main.swift.in1
-rw-r--r--Modules/Dart.cmake24
-rw-r--r--Modules/DartConfiguration.tcl.in17
-rw-r--r--Modules/DeployQt4.cmake205
-rw-r--r--Modules/Documentation.cmake11
-rw-r--r--Modules/ExternalData.cmake649
-rw-r--r--Modules/ExternalData_config.cmake.in2
-rw-r--r--Modules/ExternalProject.cmake1196
-rw-r--r--Modules/FeatureSummary.cmake460
-rw-r--r--Modules/FindALSA.cmake26
-rw-r--r--Modules/FindASPELL.cmake19
-rw-r--r--Modules/FindAVIFile.cmake25
-rw-r--r--Modules/FindArmadillo.cmake38
-rw-r--r--Modules/FindBISON.cmake186
-rw-r--r--Modules/FindBLAS.cmake172
-rw-r--r--Modules/FindBZip2.cmake29
-rw-r--r--Modules/FindBacktrace.cmake101
-rw-r--r--Modules/FindBoost.cmake960
-rw-r--r--Modules/FindBullet.cmake37
-rw-r--r--Modules/FindCABLE.cmake24
-rw-r--r--Modules/FindCUDA.cmake855
-rw-r--r--Modules/FindCUDA/make2cmake.cmake5
-rw-r--r--Modules/FindCUDA/parse_cubin.cmake15
-rw-r--r--Modules/FindCUDA/run_nvcc.cmake8
-rw-r--r--Modules/FindCURL.cmake17
-rw-r--r--Modules/FindCVS.cmake25
-rw-r--r--Modules/FindCoin3D.cmake20
-rw-r--r--Modules/FindCups.cmake30
-rw-r--r--Modules/FindCurses.cmake198
-rw-r--r--Modules/FindCxxTest.cmake196
-rw-r--r--Modules/FindCygwin.cmake5
-rw-r--r--Modules/FindDCMTK.cmake278
-rw-r--r--Modules/FindDart.cmake10
-rw-r--r--Modules/FindDevIL.cmake43
-rw-r--r--Modules/FindDoxygen.cmake53
-rw-r--r--Modules/FindEXPAT.cmake20
-rw-r--r--Modules/FindFLEX.cmake192
-rw-r--r--Modules/FindFLTK.cmake84
-rw-r--r--Modules/FindFLTK2.cmake47
-rw-r--r--Modules/FindFreetype.cmake117
-rw-r--r--Modules/FindGCCXML.cmake13
-rw-r--r--Modules/FindGDAL.cmake24
-rw-r--r--Modules/FindGIF.cmake22
-rw-r--r--Modules/FindGLEW.cmake32
-rw-r--r--Modules/FindGLUT.cmake100
-rw-r--r--Modules/FindGSL.cmake238
-rw-r--r--Modules/FindGTK.cmake17
-rw-r--r--Modules/FindGTK2.cmake587
-rw-r--r--Modules/FindGTest.cmake196
-rw-r--r--Modules/FindGettext.cmake79
-rw-r--r--Modules/FindGit.cmake41
-rw-r--r--Modules/FindGnuTLS.cmake18
-rw-r--r--Modules/FindGnuplot.cmake18
-rw-r--r--Modules/FindHDF5.cmake154
-rw-r--r--Modules/FindHSPELL.cmake27
-rw-r--r--Modules/FindHTMLHelp.cmake15
-rw-r--r--Modules/FindHg.cmake76
-rw-r--r--Modules/FindITK.cmake57
-rw-r--r--Modules/FindIce.cmake521
-rw-r--r--Modules/FindIcotool.cmake21
-rw-r--r--Modules/FindImageMagick.cmake144
-rw-r--r--Modules/FindIntl.cmake69
-rw-r--r--Modules/FindJNI.cmake186
-rw-r--r--Modules/FindJPEG.cmake27
-rw-r--r--Modules/FindJasper.cmake17
-rw-r--r--Modules/FindJava.cmake180
-rw-r--r--Modules/FindKDE3.cmake157
-rw-r--r--Modules/FindKDE4.cmake29
-rw-r--r--Modules/FindLAPACK.cmake157
-rw-r--r--Modules/FindLATEX.cmake196
-rw-r--r--Modules/FindLibArchive.cmake17
-rw-r--r--Modules/FindLibLZMA.cmake32
-rw-r--r--Modules/FindLibXml2.cmake21
-rw-r--r--Modules/FindLibXslt.cmake30
-rw-r--r--Modules/FindLua.cmake171
-rw-r--r--Modules/FindLua50.cmake36
-rw-r--r--Modules/FindLua51.cmake40
-rw-r--r--Modules/FindMFC.cmake19
-rw-r--r--Modules/FindMPEG.cmake24
-rw-r--r--Modules/FindMPEG2.cmake24
-rw-r--r--Modules/FindMPI.cmake207
-rw-r--r--Modules/FindMatlab.cmake1517
-rw-r--r--Modules/FindMotif.cmake16
-rw-r--r--Modules/FindOpenAL.cmake31
-rw-r--r--Modules/FindOpenCL.cmake136
-rw-r--r--Modules/FindOpenGL.cmake71
-rw-r--r--Modules/FindOpenMP.cmake92
-rw-r--r--Modules/FindOpenSSL.cmake219
-rw-r--r--Modules/FindOpenSceneGraph.cmake117
-rw-r--r--Modules/FindOpenThreads.cmake30
-rw-r--r--Modules/FindPHP4.cmake20
-rw-r--r--Modules/FindPNG.cmake86
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake283
-rw-r--r--Modules/FindPackageMessage.cmake38
-rw-r--r--Modules/FindPerl.cmake19
-rw-r--r--Modules/FindPerlLibs.cmake50
-rw-r--r--Modules/FindPhysFS.cmake19
-rw-r--r--Modules/FindPike.cmake18
-rw-r--r--Modules/FindPkgConfig.cmake423
-rw-r--r--Modules/FindPostgreSQL.cmake80
-rw-r--r--Modules/FindProducer.cmake41
-rw-r--r--Modules/FindProtobuf.cmake174
-rw-r--r--Modules/FindPythonInterp.cmake92
-rw-r--r--Modules/FindPythonLibs.cmake193
-rw-r--r--Modules/FindQt.cmake59
-rw-r--r--Modules/FindQt3.cmake48
-rw-r--r--Modules/FindQt4.cmake804
-rw-r--r--Modules/FindQuickTime.cmake14
-rw-r--r--Modules/FindRTI.cmake37
-rw-r--r--Modules/FindRuby.cmake76
-rw-r--r--Modules/FindSDL.cmake109
-rw-r--r--Modules/FindSDL_image.cmake51
-rw-r--r--Modules/FindSDL_mixer.cmake51
-rw-r--r--Modules/FindSDL_net.cmake50
-rw-r--r--Modules/FindSDL_sound.cmake120
-rw-r--r--Modules/FindSDL_ttf.cmake50
-rw-r--r--Modules/FindSWIG.cmake40
-rw-r--r--Modules/FindSelfPackers.cmake17
-rw-r--r--Modules/FindSquish.cmake151
-rw-r--r--Modules/FindSubversion.cmake79
-rw-r--r--Modules/FindTCL.cmake72
-rw-r--r--Modules/FindTIFF.cmake90
-rw-r--r--Modules/FindTclStub.cmake60
-rw-r--r--Modules/FindTclsh.cmake25
-rw-r--r--Modules/FindThreads.cmake221
-rw-r--r--Modules/FindUnixCommands.cmake16
-rw-r--r--Modules/FindVTK.cmake141
-rw-r--r--Modules/FindWget.cmake17
-rw-r--r--Modules/FindWish.cmake19
-rw-r--r--Modules/FindX11.cmake91
-rw-r--r--Modules/FindXCTest.cmake196
-rw-r--r--Modules/FindXMLRPC.cmake53
-rw-r--r--Modules/FindXalanC.cmake162
-rw-r--r--Modules/FindXercesC.cmake140
-rw-r--r--Modules/FindZLIB.cmake108
-rw-r--r--Modules/Findosg.cmake60
-rw-r--r--Modules/FindosgAnimation.cmake52
-rw-r--r--Modules/FindosgDB.cmake52
-rw-r--r--Modules/FindosgFX.cmake52
-rw-r--r--Modules/FindosgGA.cmake52
-rw-r--r--Modules/FindosgIntrospection.cmake39
-rw-r--r--Modules/FindosgManipulator.cmake39
-rw-r--r--Modules/FindosgParticle.cmake44
-rw-r--r--Modules/FindosgPresentation.cmake43
-rw-r--r--Modules/FindosgProducer.cmake44
-rw-r--r--Modules/FindosgQt.cmake57
-rw-r--r--Modules/FindosgShadow.cmake52
-rw-r--r--Modules/FindosgSim.cmake52
-rw-r--r--Modules/FindosgTerrain.cmake52
-rw-r--r--Modules/FindosgText.cmake52
-rw-r--r--Modules/FindosgUtil.cmake52
-rw-r--r--Modules/FindosgViewer.cmake52
-rw-r--r--Modules/FindosgVolume.cmake52
-rw-r--r--Modules/FindosgWidget.cmake57
-rw-r--r--Modules/Findosg_functions.cmake8
-rw-r--r--Modules/FindwxWidgets.cmake216
-rw-r--r--Modules/FindwxWindows.cmake104
-rw-r--r--Modules/FortranCInterface.cmake167
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt4
-rw-r--r--Modules/FortranCInterface/Detect.cmake9
-rw-r--r--Modules/FortranCInterface/Verify/CMakeLists.txt2
-rw-r--r--Modules/GNUInstallDirs.cmake254
-rw-r--r--Modules/GenerateExportHeader.cmake282
-rw-r--r--Modules/GetPrerequisites.cmake365
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake183
-rw-r--r--Modules/IntelVSImplicitPath/CMakeLists.txt2
-rw-r--r--Modules/Internal/FeatureTesting.cmake60
-rw-r--r--Modules/MacroAddFileDependencies.cmake18
-rw-r--r--Modules/MatlabTestsRedirect.cmake91
-rw-r--r--Modules/NSIS.template.in2
-rw-r--r--Modules/Platform/AIX-GNU.cmake12
-rw-r--r--Modules/Platform/AIX-XL.cmake12
-rw-r--r--Modules/Platform/ARTOS-GNU-C.cmake9
-rw-r--r--Modules/Platform/ARTOS.cmake17
-rw-r--r--Modules/Platform/Android.cmake15
-rw-r--r--Modules/Platform/BlueGeneQ-base.cmake177
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake (renamed from Modules/CMakeVS71FindMake.cmake)16
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake16
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake16
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake16
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake16
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake16
-rw-r--r--Modules/Platform/BlueGeneQ-dynamic.cmake17
-rw-r--r--Modules/Platform/BlueGeneQ-static-GNU-C.cmake16
-rw-r--r--Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake16
-rw-r--r--Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake16
-rw-r--r--Modules/Platform/BlueGeneQ-static-XL-C.cmake16
-rw-r--r--Modules/Platform/BlueGeneQ-static-XL-CXX.cmake16
-rw-r--r--Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake16
-rw-r--r--Modules/Platform/BlueGeneQ-static.cmake17
-rw-r--r--Modules/Platform/CYGWIN-GNU.cmake7
-rw-r--r--Modules/Platform/CYGWIN-windres.cmake2
-rw-r--r--Modules/Platform/CrayLinuxEnvironment.cmake143
-rw-r--r--Modules/Platform/Darwin-AppleClang-C.cmake6
-rw-r--r--Modules/Platform/Darwin-AppleClang-CXX.cmake6
-rw-r--r--Modules/Platform/Darwin-Clang.cmake3
-rw-r--r--Modules/Platform/Darwin-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Darwin-GNU.cmake4
-rw-r--r--Modules/Platform/Darwin-Initialize.cmake155
-rw-r--r--Modules/Platform/Darwin-Intel-C.cmake2
-rw-r--r--Modules/Platform/Darwin-Intel-CXX.cmake2
-rw-r--r--Modules/Platform/Darwin-Intel-Fortran.cmake3
-rw-r--r--Modules/Platform/Darwin-Intel.cmake29
-rw-r--r--Modules/Platform/Darwin-NAG-Fortran.cmake2
-rw-r--r--Modules/Platform/Darwin-icc.cmake131
-rw-r--r--Modules/Platform/Darwin-icpc.cmake3
-rw-r--r--Modules/Platform/Darwin.cmake172
-rw-r--r--Modules/Platform/Euros.cmake19
-rw-r--r--Modules/Platform/GHS-MULTI-Initialize.cmake51
-rw-r--r--Modules/Platform/GHS-MULTI.cmake (renamed from Modules/CMakeVS12FindMake.cmake)26
-rw-r--r--Modules/Platform/Generic-SDCC-C.cmake2
-rw-r--r--Modules/Platform/HP-UX-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/HP-UX-GNU.cmake4
-rw-r--r--Modules/Platform/HP-UX-HP-C.cmake6
-rw-r--r--Modules/Platform/HP-UX-HP-CXX.cmake4
-rw-r--r--Modules/Platform/HP-UX-HP-Fortran.cmake3
-rw-r--r--Modules/Platform/HP-UX-HP.cmake4
-rw-r--r--Modules/Platform/HP-UX.cmake25
-rw-r--r--Modules/Platform/Haiku.cmake134
-rw-r--r--Modules/Platform/IRIX.cmake8
-rw-r--r--Modules/Platform/IRIX64.cmake8
-rw-r--r--Modules/Platform/Linux-CCur-Fortran.cmake1
-rw-r--r--Modules/Platform/Linux-GNU-Fortran.cmake1
-rw-r--r--Modules/Platform/Linux-Intel-C.cmake1
-rw-r--r--Modules/Platform/Linux-Intel-CXX.cmake1
-rw-r--r--Modules/Platform/Linux-Intel-Fortran.cmake4
-rw-r--r--Modules/Platform/Linux-Intel.cmake4
-rw-r--r--Modules/Platform/Linux-PGI.cmake2
-rw-r--r--Modules/Platform/Linux-XL-C.cmake1
-rw-r--r--Modules/Platform/Linux-XL-CXX.cmake1
-rw-r--r--Modules/Platform/Linux-XL-Fortran.cmake1
-rw-r--r--Modules/Platform/Linux.cmake2
-rw-r--r--Modules/Platform/MirBSD.cmake1
-rw-r--r--Modules/Platform/OSF1.cmake4
-rw-r--r--Modules/Platform/OpenBSD.cmake18
-rw-r--r--Modules/Platform/QNX.cmake18
-rw-r--r--Modules/Platform/SunOS.cmake16
-rw-r--r--Modules/Platform/UnixPaths.cmake17
-rw-r--r--Modules/Platform/Windows-Clang-C.cmake2
-rw-r--r--Modules/Platform/Windows-Clang-CXX.cmake2
-rw-r--r--Modules/Platform/Windows-Clang.cmake32
-rw-r--r--Modules/Platform/Windows-Embarcadero.cmake14
-rw-r--r--Modules/Platform/Windows-GNU.cmake25
-rw-r--r--Modules/Platform/Windows-Intel-CXX.cmake1
-rw-r--r--Modules/Platform/Windows-Intel-Fortran.cmake2
-rw-r--r--Modules/Platform/Windows-Intel.cmake93
-rw-r--r--Modules/Platform/Windows-MSVC.cmake142
-rw-r--r--Modules/Platform/Windows-df.cmake5
-rw-r--r--Modules/Platform/Windows-wcl386.cmake88
-rw-r--r--Modules/Platform/Windows-windres.cmake2
-rw-r--r--Modules/Platform/Windows.cmake8
-rw-r--r--Modules/Platform/WindowsCE-MSVC.cmake1
-rw-r--r--Modules/Platform/WindowsPaths.cmake80
-rw-r--r--Modules/Platform/WindowsPhone-MSVC-C.cmake1
-rw-r--r--Modules/Platform/WindowsPhone-MSVC-CXX.cmake1
-rw-r--r--Modules/Platform/WindowsPhone.cmake1
-rw-r--r--Modules/Platform/WindowsStore-MSVC-C.cmake1
-rw-r--r--Modules/Platform/WindowsStore-MSVC-CXX.cmake1
-rw-r--r--Modules/Platform/WindowsStore.cmake1
-rw-r--r--Modules/Platform/eCos.cmake2
-rw-r--r--Modules/ProcessorCount.cmake108
-rw-r--r--Modules/Qt4ConfigDependentSettings.cmake6
-rw-r--r--Modules/Qt4Macros.cmake80
-rw-r--r--Modules/SelectLibraryConfigurations.cmake36
-rwxr-xr-xModules/Squish4RunTestCase.sh4
-rw-r--r--Modules/SquishTestScript.cmake19
-rw-r--r--Modules/TestBigEndian.cmake17
-rw-r--r--Modules/TestCXXAcceptsFlag.cmake20
-rw-r--r--Modules/TestForANSIForScope.cmake16
-rw-r--r--Modules/TestForANSIStreamHeaders.cmake14
-rw-r--r--Modules/TestForSSTREAM.cmake13
-rw-r--r--Modules/TestForSTDNamespace.cmake13
-rw-r--r--Modules/UseEcos.cmake35
-rw-r--r--Modules/UseJava.cmake690
-rw-r--r--Modules/UseJavaClassFilelist.cmake12
-rw-r--r--Modules/UseJavaSymlinks.cmake8
-rw-r--r--Modules/UsePkgConfig.cmake18
-rw-r--r--Modules/UseQt4.cmake27
-rw-r--r--Modules/UseSWIG.cmake176
-rw-r--r--Modules/UseVTK40.cmake29
-rw-r--r--Modules/UseVTKBuildSettings40.cmake38
-rw-r--r--Modules/UseVTKConfig40.cmake409
-rw-r--r--Modules/Use_wxWindows.cmake35
-rw-r--r--Modules/UsewxWidgets.cmake46
-rw-r--r--Modules/WIX.template.in5
-rw-r--r--Modules/WriteBasicConfigVersionFile.cmake21
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake664
-rw-r--r--Modules/exportheader.cmake.in10
-rw-r--r--Modules/readme.txt174
518 files changed, 27728 insertions, 11405 deletions
diff --git a/Modules/AddFileDependencies.cmake b/Modules/AddFileDependencies.cmake
index e88025c14..4d01a526c 100644
--- a/Modules/AddFileDependencies.cmake
+++ b/Modules/AddFileDependencies.cmake
@@ -1,6 +1,10 @@
-# - ADD_FILE_DEPENDENCIES(source_file depend_files...)
-# Adds the given files as dependencies to source_file
+#.rst:
+# AddFileDependencies
+# -------------------
+#
+# ADD_FILE_DEPENDENCIES(source_file depend_files...)
#
+# Adds the given files as dependencies to source_file
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/AutomocInfo.cmake.in b/Modules/AutogenInfo.cmake.in
index 9cff735fb..7d894202e 100644
--- a/Modules/AutomocInfo.cmake.in
+++ b/Modules/AutogenInfo.cmake.in
@@ -1,4 +1,8 @@
-set(AM_SOURCES @_moc_files@ )
+set(AM_SOURCES @_cpp_files@ )
+set(AM_RCC_SOURCES @_rcc_files@ )
+set(AM_RCC_INPUTS @_qt_rcc_inputs@)
+set(AM_SKIP_MOC @_skip_moc@ )
+set(AM_SKIP_UIC @_skip_uic@ )
set(AM_HEADERS @_moc_headers@ )
set(AM_MOC_COMPILE_DEFINITIONS @_moc_compile_defs@)
set(AM_MOC_INCLUDES @_moc_incs@)
@@ -7,8 +11,16 @@ set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJ
set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/")
set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
set(AM_QT_MOC_EXECUTABLE "@_qt_moc_executable@")
+set(AM_QT_UIC_EXECUTABLE "@_qt_uic_executable@")
+set(AM_QT_RCC_EXECUTABLE "@_qt_rcc_executable@")
set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
set(AM_QT_VERSION_MAJOR "@_target_qt_version@")
set(AM_TARGET_NAME @_moc_target_name@)
+set(AM_ORIGIN_TARGET_NAME @_origin_target_name@)
set(AM_RELAXED_MODE "@_moc_relaxed_mode@")
+set(AM_UIC_TARGET_OPTIONS @_uic_target_options@)
+set(AM_UIC_OPTIONS_FILES @_qt_uic_options_files@)
+set(AM_UIC_OPTIONS_OPTIONS @_qt_uic_options_options@)
+set(AM_RCC_OPTIONS_FILES @_qt_rcc_options_files@)
+set(AM_RCC_OPTIONS_OPTIONS @_qt_rcc_options_options@)
diff --git a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in
index b1c4fdf81..bc78016df 100644
--- a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in
+++ b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in
@@ -9,22 +9,22 @@
set(PACKAGE_VERSION "@CVF_VERSION@")
-if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
- if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+ if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
-if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
-if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
diff --git a/Modules/BasicConfigVersion-ExactVersion.cmake.in b/Modules/BasicConfigVersion-ExactVersion.cmake.in
index 63f3f0339..de4a23af0 100644
--- a/Modules/BasicConfigVersion-ExactVersion.cmake.in
+++ b/Modules/BasicConfigVersion-ExactVersion.cmake.in
@@ -11,36 +11,36 @@
set(PACKAGE_VERSION "@CVF_VERSION@")
-if("@CVF_VERSION@" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\..*") # strip the tweak version
+if("@CVF_VERSION@" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
set(CVF_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_NO_TWEAK "@CVF_VERSION@")
endif()
-if("${PACKAGE_FIND_VERSION}" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\..*") # strip the tweak version
+if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
else()
set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}")
endif()
-if("${REQUESTED_VERSION_NO_TWEAK}" STREQUAL "${CVF_VERSION_NO_TWEAK}")
+if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
-if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
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 "")
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
-if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
diff --git a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in
index 4acd9bb5e..a32245dd5 100644
--- a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in
+++ b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in
@@ -11,7 +11,7 @@
set(PACKAGE_VERSION "@CVF_VERSION@")
-if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
@@ -21,25 +21,25 @@ else()
set(CVF_VERSION_MAJOR "@CVF_VERSION@")
endif()
- if("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "${CVF_VERSION_MAJOR}")
+ if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
- if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+ if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
-if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
-if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 0f6cd059e..45dda40c8 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -1,146 +1,208 @@
-# - Functions to help assemble a standalone bundle application.
+#.rst:
+# BundleUtilities
+# ---------------
+#
+# Functions to help assemble a standalone bundle application.
+#
# A collection of CMake utility functions useful for dealing with .app
# bundles on the Mac and bundle-like directories on any OS.
#
# The following functions are provided by this module:
-# fixup_bundle
-# copy_and_fixup_bundle
-# verify_app
-# get_bundle_main_executable
-# get_dotapp_dir
-# get_bundle_and_executable
-# get_bundle_all_executables
-# get_item_key
-# clear_bundle_keys
-# set_bundle_key_values
-# get_bundle_keys
-# copy_resolved_item_into_bundle
-# copy_resolved_framework_into_bundle
-# fixup_bundle_item
-# verify_bundle_prerequisites
-# verify_bundle_symlinks
+#
+# ::
+#
+# fixup_bundle
+# copy_and_fixup_bundle
+# verify_app
+# get_bundle_main_executable
+# get_dotapp_dir
+# get_bundle_and_executable
+# get_bundle_all_executables
+# get_item_key
+# get_item_rpaths
+# clear_bundle_keys
+# set_bundle_key_values
+# get_bundle_keys
+# copy_resolved_item_into_bundle
+# copy_resolved_framework_into_bundle
+# fixup_bundle_item
+# verify_bundle_prerequisites
+# verify_bundle_symlinks
+#
# Requires CMake 2.6 or greater because it uses function, break and
-# PARENT_SCOPE. Also depends on GetPrerequisites.cmake.
+# PARENT_SCOPE. Also depends on GetPrerequisites.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 as all
-# of the system libraries are compatible.
+# drag-n-drop copied to another machine and run on that machine as long
+# as all of the system libraries are compatible.
+#
+# If you pass plugins to fixup_bundle as the libs parameter, you should
+# install them or copy them into the bundle before calling fixup_bundle.
+# The "libs" parameter is a list of libraries that must be fixed up, but
+# that cannot be determined by otool output analysis. (i.e., plugins)
+#
+# Gather all the keys for all the executables and libraries in a bundle,
+# and then, for each key, copy each prerequisite into the bundle. Then
+# fix each one up according to its own list of prerequisites.
+#
+# Then clear all the keys and call verify_app on the final bundle to
+# ensure that it is truly standalone.
+#
+# ::
+#
+# COPY_AND_FIXUP_BUNDLE(<src> <dst> <libs> <dirs>)
#
-# If you pass plugins to fixup_bundle as the libs parameter, you should install
-# them or copy them into the bundle before calling fixup_bundle. The "libs"
-# parameter is a list of libraries that must be fixed up, but that cannot be
-# determined by otool output analysis. (i.e., plugins)
+# Makes a copy of the bundle <src> at location <dst> and then fixes up
+# the new copied bundle in-place at <dst>...
#
-# Gather all the keys for all the executables and libraries in a bundle, and
-# then, for each key, copy each prerequisite into the bundle. Then fix each one
-# up according to its own list of prerequisites.
+# ::
#
-# Then clear all the keys and call verify_app on the final bundle to ensure
-# that it is truly standalone.
+# VERIFY_APP(<app>)
#
-# 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>...
+# Verifies that an application <app> appears valid based on running
+# analysis tools on it. Calls "message(FATAL_ERROR" if the application
+# is not verified.
#
-# VERIFY_APP(<app>)
-# Verifies that an application <app> appears valid based on running analysis
-# tools on it. Calls "message(FATAL_ERROR" if the application is not verified.
+# ::
#
-# 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.
+# GET_BUNDLE_MAIN_EXECUTABLE(<bundle> <result_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 simply return
-# the dir containing the executable.
+# 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.
+#
+# ::
+#
+# 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
+# simply return the dir containing the executable.
#
# The returned directory may or may not exist.
#
-# 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>
#
-# GET_BUNDLE_ALL_EXECUTABLES(<bundle> <exes_var>)
-# Scans the given bundle recursively for all executable files and accumulates
-# them into a variable.
+# ::
+#
+# GET_BUNDLE_ALL_EXECUTABLES(<bundle> <exes_var>)
+#
+# Scans the given bundle recursively for all executable files and
+# accumulates them into a variable.
+#
+# ::
+#
+# 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
+# make a bundle standalone. This is essentially the file name including
+# 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.
#
-# 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 make a bundle
-# standalone. This is essentially the file name including 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.
+# 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.
+# Loop over the list of keys, clearing all the variables associated with
+# 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.
+# Caller of get_bundle_keys should call clear_bundle_keys when done with
+# list of keys.
#
-# SET_BUNDLE_KEY_VALUES(<keys_var> <context> <item> <exepath> <dirs>
-# <copyflag>)
-# Add a key to the list (if necessary) for the given item. If added,
+# ::
+#
+# 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.
#
-# 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 them. Set
-# values associated with each key such that we can loop over all of them and
-# copy prerequisite libs into the bundle and then do appropriate
-# install_name_tool fixups.
-#
-# 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.
-#
-# 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 resolved_embedded_item.
-#
-# By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want full
-# frameworks embedded in your bundles, set 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.
-#
-# 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 the
-# _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely changing to
-# an "@executable_path" style reference.)
-#
-# This function requires that the resolved_embedded_item be "inside" the bundle
-# already. In other words, if you pass plugins to fixup_bundle as the libs
-# parameter, you should install them or copy them into the bundle before
-# calling fixup_bundle. The "libs" parameter is a list of libraries that must
-# be fixed up, but that cannot be determined by otool output analysis. (i.e.,
-# plugins)
-#
-# Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM
-# value.
+# ::
+#
+# 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
+# them. Set values associated with each key such that we can loop over
+# all of them and copy prerequisite libs into the bundle and then do
+# appropriate install_name_tool fixups.
+#
+# ::
+#
+# 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.
+#
+# ::
+#
+# 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
+# resolved_embedded_item.
+#
+# By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want
+# full frameworks embedded in your bundles, set
+# 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.
+#
+# ::
+#
+# 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
+# the _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely
+# changing to an "@executable_path" style reference.)
+#
+# This function requires that the resolved_embedded_item be "inside" the
+# bundle already. In other words, if you pass plugins to fixup_bundle
+# as the libs parameter, you should install them or copy them into the
+# bundle before calling fixup_bundle. The "libs" parameter is a list of
+# libraries that must be fixed up, but that cannot be determined by
+# otool output analysis. (i.e., plugins)
+#
+# Also, change the id of the item being fixed up to its own
+# _EMBEDDED_ITEM value.
#
# Accumulate changes in a local variable and make *one* call to
-# install_name_tool at the end of the function with all the changes at once.
+# install_name_tool at the end of the function with all the changes at
+# 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.
#
-# 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, presumed to exist
-# everywhere.
+# ::
+#
+# 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,
+# presumed to exist everywhere.
#
-# 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 external file causes
-# this function to fail the verification.
+# ::
+#
+# 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
+# external file causes this function to fail the verification.
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
@@ -174,8 +236,9 @@ function(get_bundle_main_executable bundle result_var)
#
set(eol_char "E")
file(READ "${bundle}/Contents/Info.plist" info_plist)
- string(REGEX REPLACE ";" "\\\\;" info_plist "${info_plist}")
- string(REGEX REPLACE "\n" "${eol_char};" info_plist "${info_plist}")
+ string(REPLACE ";" "\\;" info_plist "${info_plist}")
+ string(REPLACE "\n" "${eol_char};" info_plist "${info_plist}")
+ string(REPLACE "\r" "${eol_char};" info_plist "${info_plist}")
# Scan the lines for "<key>CFBundleExecutable</key>" - the line after that
# is the name of the main executable.
@@ -186,7 +249,7 @@ function(get_bundle_main_executable bundle result_var)
break()
endif()
- if(line MATCHES "^.*<key>CFBundleExecutable</key>.*$")
+ if(line MATCHES "<key>CFBundleExecutable</key>")
set(line_is_main_executable 1)
endif()
endforeach()
@@ -226,7 +289,7 @@ endfunction()
function(get_dotapp_dir exe dotapp_dir_var)
set(s "${exe}")
- if(s MATCHES "^.*/.*\\.app/.*$")
+ if(s MATCHES "/.*\\.app/")
# If there is a ".app" parent directory,
# ascend until we hit it:
# (typical of a Mac bundle executable)
@@ -316,7 +379,25 @@ endfunction()
function(get_bundle_all_executables bundle exes_var)
set(exes "")
- file(GLOB_RECURSE file_list "${bundle}/*")
+ if(UNIX)
+ find_program(find_cmd "find")
+ mark_as_advanced(find_cmd)
+ endif()
+
+ # find command is much quicker than checking every file one by one on Unix
+ # which can take long time for large bundles, and since anyway we expect
+ # executable to have execute flag set we can narrow the list much quicker.
+ if(find_cmd)
+ execute_process(COMMAND "${find_cmd}" "${bundle}"
+ -type f \( -perm -0100 -o -perm -0010 -o -perm -0001 \)
+ OUTPUT_VARIABLE file_list
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ string(REPLACE "\n" ";" file_list "${file_list}")
+ else()
+ file(GLOB_RECURSE file_list "${bundle}/*")
+ endif()
+
foreach(f ${file_list})
is_file_executable("${f}" is_executable)
if(is_executable)
@@ -328,12 +409,37 @@ function(get_bundle_all_executables bundle exes_var)
endfunction()
+function(get_item_rpaths item rpaths_var)
+ if(APPLE)
+ find_program(otool_cmd "otool")
+ mark_as_advanced(otool_cmd)
+ endif()
+
+ if(otool_cmd)
+ execute_process(
+ COMMAND "${otool_cmd}" -l "${item}"
+ OUTPUT_VARIABLE load_cmds_ov
+ )
+ string(REGEX REPLACE "[^\n]+cmd LC_RPATH\n[^\n]+\n[^\n]+path ([^\n]+) \\(offset[^\n]+\n" "rpath \\1\n" load_cmds_ov "${load_cmds_ov}")
+ string(REGEX MATCHALL "rpath [^\n]+" load_cmds_ov "${load_cmds_ov}")
+ string(REGEX REPLACE "rpath " "" load_cmds_ov "${load_cmds_ov}")
+ if(load_cmds_ov)
+ foreach(rpath ${load_cmds_ov})
+ gp_append_unique(${rpaths_var} "${rpath}")
+ endforeach()
+ endif()
+ endif()
+
+ set(${rpaths_var} ${${rpaths_var}} PARENT_SCOPE)
+endfunction()
+
+
function(get_item_key item key_var)
get_filename_component(item_name "${item}" NAME)
if(WIN32)
string(TOLOWER "${item_name}" item_name)
endif()
- string(REGEX REPLACE "\\." "_" ${key_var} "${item_name}")
+ string(REPLACE "." "_" ${key_var} "${item_name}")
set(${key_var} ${${key_var}} PARENT_SCOPE)
endfunction()
@@ -346,12 +452,18 @@ function(clear_bundle_keys keys_var)
set(${key}_EMBEDDED_ITEM PARENT_SCOPE)
set(${key}_RESOLVED_EMBEDDED_ITEM PARENT_SCOPE)
set(${key}_COPYFLAG PARENT_SCOPE)
+ set(${key}_RPATHS PARENT_SCOPE)
endforeach()
set(${keys_var} PARENT_SCOPE)
endfunction()
function(set_bundle_key_values keys_var context item exepath dirs copyflag)
+ if(ARGC GREATER 6)
+ set(rpaths "${ARGV6}")
+ else()
+ set(rpaths "")
+ endif()
get_filename_component(item_name "${item}" NAME)
get_item_key("${item}" key)
@@ -361,10 +473,12 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag)
list(LENGTH ${keys_var} length_after)
if(NOT length_before EQUAL length_after)
- gp_resolve_item("${context}" "${item}" "${exepath}" "${dirs}" resolved_item)
+ gp_resolve_item("${context}" "${item}" "${exepath}" "${dirs}" resolved_item "${rpaths}")
gp_item_default_embedded_path("${item}" default_embedded_path)
+ get_item_rpaths("${resolved_item}" item_rpaths)
+
if(item MATCHES "[^/]+\\.framework/")
# For frameworks, construct the name under the embedded path from the
# opening "${item_name}.framework/" to the closing "/${item_name}":
@@ -400,6 +514,8 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag)
set(${key}_EMBEDDED_ITEM "${embedded_item}" PARENT_SCOPE)
set(${key}_RESOLVED_EMBEDDED_ITEM "${resolved_embedded_item}" PARENT_SCOPE)
set(${key}_COPYFLAG "${copyflag}" PARENT_SCOPE)
+ set(${key}_RPATHS "${item_rpaths}" PARENT_SCOPE)
+ set(${key}_RDEP_RPATHS "${rpaths}" PARENT_SCOPE)
else()
#message("warning: item key '${key}' already in the list, subsequent references assumed identical to first")
endif()
@@ -420,18 +536,27 @@ function(get_bundle_keys app libs dirs keys_var)
#
get_bundle_all_executables("${bundle}" exes)
+ # Set keys for main executable first:
+ #
+ set_bundle_key_values(${keys_var} "${executable}" "${executable}" "${exepath}" "${dirs}" 0)
+
+ # Get rpaths specified by main executable:
+ #
+ get_item_key("${executable}" executable_key)
+ set(main_rpaths "${${executable_key}_RPATHS}")
+
# For each extra lib, accumulate a key as well and then also accumulate
# any of its prerequisites. (Extra libs are typically dynamically loaded
# plugins: libraries that are prerequisites for full runtime functionality
# but that do not show up in otool -L output...)
#
foreach(lib ${libs})
- set_bundle_key_values(${keys_var} "${lib}" "${lib}" "${exepath}" "${dirs}" 0)
+ set_bundle_key_values(${keys_var} "${lib}" "${lib}" "${exepath}" "${dirs}" 0 "${main_rpaths}")
set(prereqs "")
- get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}")
+ get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}" "${main_rpaths}")
foreach(pr ${prereqs})
- set_bundle_key_values(${keys_var} "${lib}" "${pr}" "${exepath}" "${dirs}" 1)
+ set_bundle_key_values(${keys_var} "${lib}" "${pr}" "${exepath}" "${dirs}" 1 "${main_rpaths}")
endforeach()
endforeach()
@@ -440,16 +565,27 @@ function(get_bundle_keys app libs dirs keys_var)
# binaries in the bundle have been analyzed.
#
foreach(exe ${exes})
- # Add the exe itself to the keys:
+ # Main executable is scanned first above:
#
- set_bundle_key_values(${keys_var} "${exe}" "${exe}" "${exepath}" "${dirs}" 0)
+ if(NOT "${exe}" STREQUAL "${executable}")
+ # Add the exe itself to the keys:
+ #
+ set_bundle_key_values(${keys_var} "${exe}" "${exe}" "${exepath}" "${dirs}" 0 "${main_rpaths}")
+
+ # Get rpaths specified by executable:
+ #
+ get_item_key("${exe}" exe_key)
+ set(exe_rpaths "${main_rpaths}" "${${exe_key}_RPATHS}")
+ else()
+ set(exe_rpaths "${main_rpaths}")
+ endif()
# Add each prerequisite to the keys:
#
set(prereqs "")
- get_prerequisites("${exe}" prereqs 1 1 "${exepath}" "${dirs}")
+ get_prerequisites("${exe}" prereqs 1 1 "${exepath}" "${dirs}" "${exe_rpaths}")
foreach(pr ${prereqs})
- set_bundle_key_values(${keys_var} "${exe}" "${pr}" "${exepath}" "${dirs}" 1)
+ set_bundle_key_values(${keys_var} "${exe}" "${pr}" "${exepath}" "${dirs}" 1 "${exe_rpaths}")
endforeach()
endforeach()
@@ -463,6 +599,8 @@ function(get_bundle_keys app libs dirs keys_var)
set(${key}_EMBEDDED_ITEM "${${key}_EMBEDDED_ITEM}" PARENT_SCOPE)
set(${key}_RESOLVED_EMBEDDED_ITEM "${${key}_RESOLVED_EMBEDDED_ITEM}" PARENT_SCOPE)
set(${key}_COPYFLAG "${${key}_COPYFLAG}" PARENT_SCOPE)
+ set(${key}_RPATHS "${${key}_RPATHS}" PARENT_SCOPE)
+ set(${key}_RDEP_RPATHS "${${key}_RDEP_RPATHS}" PARENT_SCOPE)
endforeach()
endif()
endfunction()
@@ -518,12 +656,45 @@ function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_ite
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_item}" "${resolved_embedded_item}")
# Plus Resources, if they exist:
- string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_resources "${resolved_item}")
- string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_embedded_resources "${resolved_embedded_item}")
+ string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources" resolved_resources "${resolved_item}")
+ string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources" resolved_embedded_resources "${resolved_embedded_item}")
if(EXISTS "${resolved_resources}")
#message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_resources}' '${resolved_embedded_resources}'")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${resolved_resources}" "${resolved_embedded_resources}")
endif()
+
+ # Some frameworks e.g. Qt put Info.plist in wrong place, so when it is
+ # missing in resources, copy it from other well known incorrect locations:
+ if(NOT EXISTS "${resolved_resources}/Info.plist")
+ # Check for Contents/Info.plist in framework root (older Qt SDK):
+ string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Contents/Info.plist" resolved_info_plist "${resolved_item}")
+ string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources/Info.plist" resolved_embedded_info_plist "${resolved_embedded_item}")
+ if(EXISTS "${resolved_info_plist}")
+ #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_info_plist}' '${resolved_embedded_info_plist}'")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_info_plist}" "${resolved_embedded_info_plist}")
+ endif()
+ endif()
+
+ # Check if framework is versioned and fix it layout
+ string(REGEX REPLACE "^.*/([^/]+)/[^/]+$" "\\1" resolved_embedded_version "${resolved_embedded_item}")
+ string(REGEX REPLACE "^(.*)/[^/]+/[^/]+$" "\\1" resolved_embedded_versions "${resolved_embedded_item}")
+ string(REGEX REPLACE "^.*/([^/]+)/[^/]+/[^/]+$" "\\1" resolved_embedded_versions_basename "${resolved_embedded_item}")
+ if(resolved_embedded_versions_basename STREQUAL "Versions")
+ # Ensure Current symlink points to the framework version
+ if(NOT EXISTS "${resolved_embedded_versions}/Current")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${resolved_embedded_version}" "${resolved_embedded_versions}/Current")
+ endif()
+ # Restore symlinks in framework root pointing to current framework
+ # binary and resources:
+ string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1" resolved_embedded_root "${resolved_embedded_item}")
+ string(REGEX REPLACE "^.*/([^/]+)$" "\\1" resolved_embedded_item_basename "${resolved_embedded_item}")
+ if(NOT EXISTS "${resolved_embedded_root}/${resolved_embedded_item_basename}")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "Versions/Current/${resolved_embedded_item_basename}" "${resolved_embedded_root}/${resolved_embedded_item_basename}")
+ endif()
+ if(NOT EXISTS "${resolved_embedded_root}/Resources")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "Versions/Current/Resources" "${resolved_embedded_root}/Resources")
+ endif()
+ endif()
endif()
if(UNIX AND NOT APPLE)
file(RPATH_REMOVE FILE "${resolved_embedded_item}")
@@ -568,8 +739,10 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
message(FATAL_ERROR "cannot fixup an item that is not in the bundle...")
endif()
+ set(rpaths "${${ikey}_RPATHS}" "${${ikey}_RDEP_RPATHS}")
+
set(prereqs "")
- get_prerequisites("${resolved_embedded_item}" prereqs 1 0 "${exepath}" "${dirs}")
+ get_prerequisites("${resolved_embedded_item}" prereqs 1 0 "${exepath}" "${dirs}" "${rpaths}")
set(changes "")
@@ -589,12 +762,33 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
execute_process(COMMAND chmod u+w "${resolved_embedded_item}")
endif()
+ # Only if install_name_tool supports -delete_rpath:
+ #
+ execute_process(COMMAND install_name_tool
+ OUTPUT_VARIABLE install_name_tool_usage
+ ERROR_VARIABLE install_name_tool_usage
+ )
+ if(install_name_tool_usage MATCHES ".*-delete_rpath.*")
+ foreach(rpath ${${ikey}_RPATHS})
+ set(changes ${changes} -delete_rpath "${rpath}")
+ endforeach()
+ endif()
+
+ if(${ikey}_EMBEDDED_ITEM)
+ set(changes ${changes} -id "${${ikey}_EMBEDDED_ITEM}")
+ endif()
+
# Change this item's id and all of its references in one call
# to install_name_tool:
#
- execute_process(COMMAND install_name_tool
- ${changes} -id "${${ikey}_EMBEDDED_ITEM}" "${resolved_embedded_item}"
- )
+ if(changes)
+ set(cmd 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}'")
+ message(FATAL_ERROR "Command failed:\n ${msg}")
+ endif()
+ endif()
endfunction()
@@ -685,10 +879,8 @@ function(verify_bundle_prerequisites bundle result_var info_var)
get_bundle_main_executable("${bundle}" main_bundle_exe)
- file(GLOB_RECURSE file_list "${bundle}/*")
+ get_bundle_all_executables("${bundle}" file_list)
foreach(f ${file_list})
- is_file_executable("${f}" is_executable)
- if(is_executable)
get_filename_component(exepath "${f}" PATH)
math(EXPR count "${count} + 1")
@@ -727,7 +919,6 @@ function(verify_bundle_prerequisites bundle result_var info_var)
set(result 0)
set(info ${info} "external prerequisites found:\nf='${f}'\nexternal_prereqs='${external_prereqs}'\n")
endif()
- endif()
endforeach()
if(result)
diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake
index dce162496..0e547c467 100644
--- a/Modules/CMakeASMInformation.cmake
+++ b/Modules/CMakeASMInformation.cmake
@@ -50,6 +50,24 @@ if(NOT _INCLUDED_FILE)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
endif()
+# This should be included before the _INIT variables are
+# used to initialize the cache. Since the rule variables
+# have if blocks on them, users can still define them here.
+# But, it should still be after the platform file so changes can
+# be made to those values.
+
+if(CMAKE_USER_MAKE_RULES_OVERRIDE)
+ # Save the full path of the file so try_compile can use it.
+ include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
+ set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
+endif()
+
+if(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM)
+ # Save the full path of the file so try_compile can use it.
+ include(${CMAKE_USER_MAKE_RULES_OVERRIDE_ASM} RESULT_VARIABLE _override)
+ set(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM "${_override}")
+endif()
+
# Set default assembler file extensions:
if(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS)
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm)
@@ -90,7 +108,7 @@ mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_FLAGS
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
- set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
endif()
if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake
index eb105ab10..bd76b9842 100644
--- a/Modules/CMakeASM_MASMInformation.cmake
+++ b/Modules/CMakeASM_MASMInformation.cmake
@@ -18,7 +18,7 @@ set(ASM_DIALECT "_MASM")
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
-set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> /c /Fo <OBJECT> <SOURCE>")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /c /Fo <OBJECT> <SOURCE>")
include(CMakeASMInformation)
set(ASM_DIALECT)
diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index abd910055..2e5a76f4c 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -1,29 +1,37 @@
-# - 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.
+#.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:
#
diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake
index cfc1d91f9..f1db46e54 100644
--- a/Modules/CMakeBackwardCompatibilityCXX.cmake
+++ b/Modules/CMakeBackwardCompatibilityCXX.cmake
@@ -1,10 +1,17 @@
-# - 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)
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -24,15 +31,15 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
if(NOT CMAKE_COMPILER_IS_GNUCXX)
include(TestCXXAcceptsFlag)
set(CMAKE_TRY_ANSI_CXX_FLAGS "")
- if(CMAKE_SYSTEM MATCHES "IRIX.*")
+ if(CMAKE_SYSTEM_NAME MATCHES "IRIX")
set(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std")
endif()
- if(CMAKE_SYSTEM MATCHES "OSF.*")
+ if(CMAKE_SYSTEM_NAME MATCHES "OSF")
set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname")
endif()
# if CMAKE_TRY_ANSI_CXX_FLAGS has something in it, see
# if the compiler accepts it
- if( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+")
+ if(NOT CMAKE_TRY_ANSI_CXX_FLAGS STREQUAL "")
CHECK_CXX_ACCEPTS_FLAG(${CMAKE_TRY_ANSI_CXX_FLAGS} CMAKE_CXX_ACCEPTS_FLAGS)
# if the compiler liked the flag then set CMAKE_ANSI_CXXFLAGS
# to the flag
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index c41adc956..f109a1479 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -2,7 +2,16 @@ set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@")
+set(CMAKE_C_COMPILER_WRAPPER "@CMAKE_C_COMPILER_WRAPPER@")
+set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@")
+set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@")
+set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@")
+set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@")
+set(CMAKE_C11_COMPILE_FEATURES "@CMAKE_C11_COMPILE_FEATURES@")
+
set(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
+set(CMAKE_C_SIMULATE_ID "@CMAKE_C_SIMULATE_ID@")
+set(CMAKE_C_SIMULATE_VERSION "@CMAKE_C_SIMULATE_VERSION@")
@SET_MSVC_C_ARCHITECTURE_ID@
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
@@ -24,7 +33,7 @@ if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_C_COMPILER_ID_RUN 1)
-set(CMAKE_C_SOURCE_FILE_EXTENSIONS c)
+set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_C_LINKER_PREFERENCE 10)
@@ -45,12 +54,14 @@ if(CMAKE_C_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@")
endif()
+set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "@CMAKE_C_CL_SHOWINCLUDES_PREFIX@")
+if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
+ set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
+endif()
+
@CMAKE_C_SYSROOT_FLAG_CODE@
@CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
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@")
-
-@SET_CMAKE_CMCLDEPS_EXECUTABLE@
-@SET_CMAKE_CL_SHOWINCLUDE_PREFIX@
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 66a558265..5bfe0fdfa 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -2,212 +2,42 @@
# error "A C++ compiler has been selected for C."
#endif
-/* Version number components: V=Version, R=Revision, P=Patch
- Version date components: YYYY=Year, MM=Month, DD=Day */
-
#if defined(__18CXX)
# define ID_VOID_MAIN
#endif
-#if defined(__INTEL_COMPILER) || defined(__ICC)
-# define COMPILER_ID "Intel"
- /* __INTEL_COMPILER = VRP */
-# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
-# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
-# if defined(__INTEL_COMPILER_BUILD_DATE)
- /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
-# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
-# endif
-
-#elif defined(__PATHCC__)
-# define COMPILER_ID "PathScale"
-# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
-# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
-# if defined(__PATHCC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
-# endif
-
-#elif defined(__clang__)
-# define COMPILER_ID "Clang"
-# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
-# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
-# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
-
-#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
-# define COMPILER_ID "Embarcadero"
-# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
-# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
-# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF)
-
-#elif defined(__BORLANDC__)
-# define COMPILER_ID "Borland"
- /* __BORLANDC__ = 0xVRR */
-# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
-# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
-
-#elif defined(__WATCOMC__)
-# define COMPILER_ID "Watcom"
- /* __WATCOMC__ = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
-
-#elif defined(__SUNPRO_C)
-# define COMPILER_ID "SunPro"
-# if __SUNPRO_C >= 0x5100
- /* __SUNPRO_C = 0xVRRP */
-# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
-# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
-# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
-# else
- /* __SUNPRO_C = 0xVRP */
-# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
-# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
-# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
-# endif
-
-#elif defined(__HP_cc)
-# define COMPILER_ID "HP"
- /* __HP_cc = VVRRPP */
-# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
-# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
-# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
-
-#elif defined(__DECC)
-# define COMPILER_ID "Compaq"
- /* __DECC_VER = VVRRTPPPP */
-# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
-# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
-# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
-
-#elif defined(__IBMC__)
-# if defined(__COMPILER_VER__)
-# define COMPILER_ID "zOS"
-# else
-# if __IBMC__ >= 800
-# define COMPILER_ID "XL"
-# else
-# define COMPILER_ID "VisualAge"
-# endif
- /* __IBMC__ = VRP */
-# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
-# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
-# endif
-
-#elif defined(__PGI)
-# define COMPILER_ID "PGI"
-# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
-# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
-# if defined(__PGIC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
-# endif
-
-#elif defined(_CRAYC)
-# define COMPILER_ID "Cray"
-# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
-# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
-
-#elif defined(__TI_COMPILER_VERSION__)
-# define COMPILER_ID "TI"
- /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
-# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
-# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
-# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
-
-#elif defined(__TINYC__)
-# define COMPILER_ID "TinyCC"
-
-#elif defined(__SCO_VERSION__)
-# define COMPILER_ID "SCO"
-
-#elif defined(__GNUC__)
-# define COMPILER_ID "GNU"
-# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
-# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
-# if defined(__GNUC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
-# endif
-
-#elif defined(_MSC_VER)
-# define COMPILER_ID "MSVC"
- /* _MSC_VER = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
-# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
-# if defined(_MSC_FULL_VER)
-# if _MSC_VER >= 1400
- /* _MSC_FULL_VER = VVRRPPPPP */
-# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
-# else
- /* _MSC_FULL_VER = VVRRPPPP */
-# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
-# endif
-# endif
-# if defined(_MSC_BUILD)
-# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
-# endif
-
-/* Analog VisualDSP++ >= 4.5.6 */
-#elif defined(__VISUALDSPVERSION__)
-# define COMPILER_ID "ADSP"
- /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
-# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
-# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
-# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
-
-/* Analog VisualDSP++ < 4.5.6 */
-#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
-# define COMPILER_ID "ADSP"
-
-/* IAR Systems compiler for embedded systems.
- http://www.iar.com */
-#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
-# define COMPILER_ID "IAR"
-
-/* sdcc, the small devices C compiler for embedded systems,
- http://sdcc.sourceforge.net */
-#elif defined(SDCC)
-# define COMPILER_ID "SDCC"
- /* SDCC = VRP */
-# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
-# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
-
-#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
-# define COMPILER_ID "MIPSpro"
-# if defined(_SGI_COMPILER_VERSION)
- /* _SGI_COMPILER_VERSION = VRP */
-# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
-# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
-# else
- /* _COMPILER_VERSION = VRP */
-# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
-# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
-# endif
-
-/* This compiler is either not known or is too old to define an
- identification macro. Try to identify the platform and guess that
- it is the native compiler. */
-#elif defined(__sgi)
-# define COMPILER_ID "MIPSpro"
-
-#elif defined(__hpux) || defined(__hpua)
-# define COMPILER_ID "HP"
-
-#else /* unknown compiler */
-# define COMPILER_ID ""
-
-#endif
+@CMAKE_C_COMPILER_ID_CONTENT@
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+#ifdef SIMULATE_ID
+char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
+#endif
+
+#ifdef __QNXNTO__
+char const* qnxnto = "INFO" ":" "qnxnto[]";
+#endif
+
+#if defined(__CRAYXE) || defined(__CRAYXC)
+char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
+#endif
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
+@CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
+
+const char* info_language_dialect_default = "INFO" ":" "dialect_default["
+#if !defined(__STDC_VERSION__)
+ "90"
+#elif __STDC_VERSION__ >= 201000L
+ "11"
+#elif __STDC_VERSION__ >= 199901L
+ "99"
+#else
+#endif
+"]";
/*--------------------------------------------------------------------------*/
@@ -223,6 +53,16 @@ int main(int argc, char* argv[])
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
+#ifdef SIMULATE_ID
+ require += info_simulate[argc];
+#endif
+#ifdef SIMULATE_VERSION_MAJOR
+ require += info_simulate_version[argc];
+#endif
+#if defined(__CRAYXE) || defined(__CRAYXC)
+ require += info_cray[argc];
+#endif
+ require += info_language_dialect_default[argc];
(void)argv;
return require;
}
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index ce5ce4409..fa87ca84c 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -18,6 +18,8 @@
# It also loads a system - compiler - processor (or target hardware)
# specific file, which is mainly useful for crosscompiling and embedded systems.
+include(CMakeLanguageInformation)
+
# some compilers use different extensions (e.g. sdcc uses .rel)
# so set the extension here first so it can be overridden by the compiler specific file
if(UNIX)
@@ -34,7 +36,7 @@ if(CMAKE_C_COMPILER_ID)
endif()
set(CMAKE_BASE_NAME)
-get_filename_component(CMAKE_BASE_NAME ${CMAKE_C_COMPILER} NAME_WE)
+get_filename_component(CMAKE_BASE_NAME "${CMAKE_C_COMPILER}" NAME_WE)
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_BASE_NAME gcc)
endif()
@@ -60,6 +62,12 @@ if (NOT _INCLUDED_FILE)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
endif ()
+
+# load any compiler-wrapper specific information
+if (CMAKE_C_COMPILER_WRAPPER)
+ __cmake_include_compiler_wrapper(C)
+endif ()
+
# We specify the compiler information in the system file for some
# platforms, but this language may not have been enabled when the file
# was first included. Include it again to get the language info.
@@ -119,16 +127,16 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT}" CACHE STRING
"Flags used by the compiler during debug builds.")
set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Flags used by the compiler during release minsize builds.")
+ "Flags used by the compiler during release builds for minimum size.")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT}" CACHE STRING
- "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
+ "Flags used by the compiler during release builds.")
set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Flags used by the compiler during Release with Debug Info builds.")
+ "Flags used by the compiler during release builds with debug info.")
endif()
if(CMAKE_C_STANDARD_LIBRARIES_INIT)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INIT}"
- CACHE STRING "Libraries linked by defalut with all C applications.")
+ CACHE STRING "Libraries linked by default with all C applications.")
mark_as_advanced(CMAKE_C_STANDARD_LIBRARIES)
endif()
@@ -175,10 +183,10 @@ endif()
# Create a static archive incrementally for large object file counts.
# If CMAKE_C_CREATE_STATIC_LIBRARY is set it will override these.
if(NOT DEFINED CMAKE_C_ARCHIVE_CREATE)
- set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_C_ARCHIVE_APPEND)
- set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_C_ARCHIVE_FINISH)
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
@@ -187,7 +195,7 @@ endif()
# compile a C file into an object file
if(NOT CMAKE_C_COMPILE_OBJECT)
set(CMAKE_C_COMPILE_OBJECT
- "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+ "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
endif()
if(NOT CMAKE_C_LINK_EXECUTABLE)
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 9287b8194..9e90aea59 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -2,7 +2,16 @@ set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@")
+set(CMAKE_CXX_COMPILER_WRAPPER "@CMAKE_CXX_COMPILER_WRAPPER@")
+set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@")
+set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@")
+set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@")
+set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@")
+set(CMAKE_CXX14_COMPILE_FEATURES "@CMAKE_CXX14_COMPILE_FEATURES@")
+
set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
+set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@")
+set(CMAKE_CXX_SIMULATE_VERSION "@CMAKE_CXX_SIMULATE_VERSION@")
@SET_MSVC_CXX_ARCHITECTURE_ID@
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
@@ -25,7 +34,7 @@ if(CMAKE_COMPILER_IS_MINGW)
endif()
set(CMAKE_CXX_COMPILER_ID_RUN 1)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
-set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
+set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP)
set(CMAKE_CXX_LINKER_PREFERENCE 30)
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
@@ -46,12 +55,14 @@ if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
endif()
+set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "@CMAKE_CXX_CL_SHOWINCLUDES_PREFIX@")
+if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
+ set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
+endif()
+
@CMAKE_CXX_SYSROOT_FLAG_CODE@
@CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
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@")
-
-@SET_CMAKE_CMCLDEPS_EXECUTABLE@
-@SET_CMAKE_CL_SHOWINCLUDE_PREFIX@
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 5e87715c0..3e5c0fcff 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -5,202 +5,37 @@
# error "A C compiler has been selected for C++."
#endif
-/* Version number components: V=Version, R=Revision, P=Patch
- Version date components: YYYY=Year, MM=Month, DD=Day */
-
-#if defined(__COMO__)
-# define COMPILER_ID "Comeau"
- /* __COMO_VERSION__ = VRR */
-# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
-
-#elif defined(__INTEL_COMPILER) || defined(__ICC)
-# define COMPILER_ID "Intel"
- /* __INTEL_COMPILER = VRP */
-# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
-# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
-# if defined(__INTEL_COMPILER_BUILD_DATE)
- /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
-# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
-# endif
-
-#elif defined(__PATHCC__)
-# define COMPILER_ID "PathScale"
-# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
-# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
-# if defined(__PATHCC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
-# endif
-
-#elif defined(__clang__)
-# define COMPILER_ID "Clang"
-# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
-# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
-# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
-
-#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
-# define COMPILER_ID "Embarcadero"
-# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
-# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
-# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF)
-
-#elif defined(__BORLANDC__)
-# define COMPILER_ID "Borland"
- /* __BORLANDC__ = 0xVRR */
-# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
-# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
-
-#elif defined(__WATCOMC__)
-# define COMPILER_ID "Watcom"
- /* __WATCOMC__ = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
-
-#elif defined(__SUNPRO_CC)
-# define COMPILER_ID "SunPro"
-# if __SUNPRO_CC >= 0x5100
- /* __SUNPRO_CC = 0xVRRP */
-# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
-# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
-# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
-# else
- /* __SUNPRO_CC = 0xVRP */
-# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
-# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
-# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
-# endif
-
-#elif defined(__HP_aCC)
-# define COMPILER_ID "HP"
- /* __HP_aCC = VVRRPP */
-# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
-# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
-# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
-
-#elif defined(__DECCXX)
-# define COMPILER_ID "Compaq"
- /* __DECCXX_VER = VVRRTPPPP */
-# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
-# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
-# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
-
-#elif defined(__IBMCPP__)
-# if defined(__COMPILER_VER__)
-# define COMPILER_ID "zOS"
-# else
-# if __IBMCPP__ >= 800
-# define COMPILER_ID "XL"
-# else
-# define COMPILER_ID "VisualAge"
-# endif
- /* __IBMCPP__ = VRP */
-# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
-# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
-# endif
-
-#elif defined(__PGI)
-# define COMPILER_ID "PGI"
-# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
-# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
-# if defined(__PGIC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
-# endif
-
-#elif defined(_CRAYC)
-# define COMPILER_ID "Cray"
-# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
-# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
-
-#elif defined(__TI_COMPILER_VERSION__)
-# define COMPILER_ID "TI"
- /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
-# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
-# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
-# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
-
-#elif defined(__SCO_VERSION__)
-# define COMPILER_ID "SCO"
-
-#elif defined(__GNUC__)
-# define COMPILER_ID "GNU"
-# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
-# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
-# if defined(__GNUC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
-# endif
-
-#elif defined(_MSC_VER)
-# define COMPILER_ID "MSVC"
- /* _MSC_VER = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
-# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
-# if defined(_MSC_FULL_VER)
-# if _MSC_VER >= 1400
- /* _MSC_FULL_VER = VVRRPPPPP */
-# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
-# else
- /* _MSC_FULL_VER = VVRRPPPP */
-# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
-# endif
-# endif
-# if defined(_MSC_BUILD)
-# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
-# endif
-
-/* Analog VisualDSP++ >= 4.5.6 */
-#elif defined(__VISUALDSPVERSION__)
-# define COMPILER_ID "ADSP"
- /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
-# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
-# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
-# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
-
-/* Analog VisualDSP++ < 4.5.6 */
-#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
-# define COMPILER_ID "ADSP"
-
-/* IAR Systems compiler for embedded systems.
- http://www.iar.com */
-#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
-# define COMPILER_ID "IAR"
-
-#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
-# define COMPILER_ID "MIPSpro"
-# if defined(_SGI_COMPILER_VERSION)
- /* _SGI_COMPILER_VERSION = VRP */
-# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
-# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
-# else
- /* _COMPILER_VERSION = VRP */
-# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
-# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
-# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
-# endif
-
-/* This compiler is either not known or is too old to define an
- identification macro. Try to identify the platform and guess that
- it is the native compiler. */
-#elif defined(__sgi)
-# define COMPILER_ID "MIPSpro"
-
-#elif defined(__hpux) || defined(__hpua)
-# define COMPILER_ID "HP"
-
-#else /* unknown compiler */
-# define COMPILER_ID ""
-
-#endif
+@CMAKE_CXX_COMPILER_ID_CONTENT@
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+#ifdef SIMULATE_ID
+char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
+#endif
+
+#ifdef __QNXNTO__
+char const* qnxnto = "INFO" ":" "qnxnto[]";
+#endif
+
+#if defined(__CRAYXE) || defined(__CRAYXC)
+char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
+#endif
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
+@CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@
+
+const char* info_language_dialect_default = "INFO" ":" "dialect_default["
+#if __cplusplus >= 201402L
+ "14"
+#elif __cplusplus >= 201103L
+ "11"
+#else
+ "98"
+#endif
+"]";
/*--------------------------------------------------------------------------*/
@@ -212,6 +47,16 @@ int main(int argc, char* argv[])
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
+#ifdef SIMULATE_ID
+ require += info_simulate[argc];
+#endif
+#ifdef SIMULATE_VERSION_MAJOR
+ require += info_simulate_version[argc];
+#endif
+#if defined(__CRAYXE) || defined(__CRAYXC)
+ require += info_cray[argc];
+#endif
+ require += info_language_dialect_default[argc];
(void)argv;
return require;
}
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 933c15a82..b35280f96 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -18,6 +18,8 @@
# It also loads a system - compiler - processor (or target hardware)
# specific file, which is mainly useful for crosscompiling and embedded systems.
+include(CMakeLanguageInformation)
+
# some compilers use different extensions (e.g. sdcc uses .rel)
# so set the extension here first so it can be overridden by the compiler specific file
if(UNIX)
@@ -34,7 +36,7 @@ if(CMAKE_CXX_COMPILER_ID)
endif()
set(CMAKE_BASE_NAME)
-get_filename_component(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE)
+get_filename_component(CMAKE_BASE_NAME "${CMAKE_CXX_COMPILER}" NAME_WE)
# since the gnu compiler has several names force g++
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_BASE_NAME g++)
@@ -59,6 +61,12 @@ if (NOT _INCLUDED_FILE)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL
RESULT_VARIABLE _INCLUDED_FILE)
endif ()
+
+# load any compiler-wrapper specific information
+if (CMAKE_CXX_COMPILER_WRAPPER)
+ __cmake_include_compiler_wrapper(CXX)
+endif ()
+
# We specify the compiler information in the system file for some
# platforms, but this language may not have been enabled when the file
# was first included. Include it again to get the language info.
@@ -209,17 +217,17 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT}" CACHE STRING
"Flags used by the compiler during debug builds.")
set (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Flags used by the compiler during release minsize builds.")
+ "Flags used by the compiler during release builds for minimum size.")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT}" CACHE STRING
- "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
+ "Flags used by the compiler during release builds.")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Flags used by the compiler during Release with Debug Info builds.")
+ "Flags used by the compiler during release builds with debug info.")
endif()
if(CMAKE_CXX_STANDARD_LIBRARIES_INIT)
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES_INIT}"
- CACHE STRING "Libraries linked by defalut with all C++ applications.")
+ CACHE STRING "Libraries linked by default with all C++ applications.")
mark_as_advanced(CMAKE_CXX_STANDARD_LIBRARIES)
endif()
@@ -266,10 +274,10 @@ endif()
# Create a static archive incrementally for large object file counts.
# If CMAKE_CXX_CREATE_STATIC_LIBRARY is set it will override these.
if(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE)
- set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND)
- set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH)
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
@@ -278,7 +286,7 @@ endif()
# compile a C++ file into an object file
if(NOT CMAKE_CXX_COMPILE_OBJECT)
set(CMAKE_CXX_COMPILE_OBJECT
- "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+ "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
endif()
if(NOT CMAKE_CXX_LINK_EXECUTABLE)
@@ -287,7 +295,6 @@ if(NOT CMAKE_CXX_LINK_EXECUTABLE)
endif()
mark_as_advanced(
-CMAKE_BUILD_TOOL
CMAKE_VERBOSE_MAKEFILE
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_RELEASE
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
new file mode 100644
index 000000000..07d8b1e3f
--- /dev/null
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -0,0 +1,45 @@
+
+#=============================================================================
+# Copyright 2006-2011 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2011 Matthias Kretz <kretz@kde.org>
+# Copyright 2013 Rolf Eike Beer <eike@sf-mail.de>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Do NOT include this module directly into any of your code. It is meant as
+# a library for Check*CompilerFlag.cmake modules. It's content may change in
+# any way between releases.
+
+macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
+ set(${_VAR}
+ FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG
+ FAIL_REGEX "unknown .*option" # Clang
+ FAIL_REGEX "optimization flag .* not supported" # Clang
+ FAIL_REGEX "ignoring unknown option" # MSVC, Intel
+ FAIL_REGEX "warning D9002" # MSVC, any lang
+ FAIL_REGEX "option.*not supported" # Intel
+ FAIL_REGEX "invalid argument .*option" # Intel
+ FAIL_REGEX "ignoring option .*argument required" # Intel
+ FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel
+ FAIL_REGEX "[Uu]nknown option" # HP
+ FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
+ FAIL_REGEX "command option .* is not recognized" # XL
+ FAIL_REGEX "command option .* contains an incorrect subargument" # XL
+ FAIL_REGEX "not supported in this configuration. ignored" # AIX
+ FAIL_REGEX "File with unknown suffix passed to linker" # PGI
+ FAIL_REGEX "[Uu]nknown switch" # PGI
+ FAIL_REGEX "WARNING: unknown flag:" # Open64
+ FAIL_REGEX "Incorrect command line option:" # Borland
+ FAIL_REGEX "Warning: illegal option" # SunStudio 12
+ FAIL_REGEX "[Ww]arning: Invalid suboption" # Fujitsu
+ )
+endmacro ()
diff --git a/Modules/CMakeClDeps.cmake b/Modules/CMakeClDeps.cmake
deleted file mode 100644
index 0214ead2b..000000000
--- a/Modules/CMakeClDeps.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-
-#=============================================================================
-# Copyright 2012 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-#
-# When using Ninja cl.exe is wrapped by cmcldeps to extract the included
-# headers for dependency tracking.
-#
-# cmcldeps path is set, and cmcldeps needs to know the localized string
-# in front of each include path, so it can remove it.
-#
-
-if(MSVC_C_ARCHITECTURE_ID AND CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_C_COMPILER AND CMAKE_COMMAND)
- string(REPLACE "cmake.exe" "cmcldeps.exe" CMAKE_CMCLDEPS_EXECUTABLE ${CMAKE_COMMAND})
- set(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes)
- file(WRITE ${showdir}/foo.h "\n")
- file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n")
- execute_process(COMMAND ${CMAKE_C_COMPILER} /nologo /showIncludes ${showdir}/main.c
- WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE outLine)
- string(REGEX MATCH "\n([^:]*:[^:]*:[ \t]*)" tmp "${outLine}")
- set(localizedPrefix "${CMAKE_MATCH_1}")
- set(SET_CMAKE_CMCLDEPS_EXECUTABLE "set(CMAKE_CMCLDEPS_EXECUTABLE \"${CMAKE_CMCLDEPS_EXECUTABLE}\")")
- set(SET_CMAKE_CL_SHOWINCLUDE_PREFIX "set(CMAKE_CL_SHOWINCLUDE_PREFIX \"${localizedPrefix}\")")
-endif()
diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake
index e945aa7c8..fa025a892 100644
--- a/Modules/CMakeCommonLanguageInclude.cmake
+++ b/Modules/CMakeCommonLanguageInclude.cmake
@@ -16,9 +16,11 @@
# cache values that can be initialized in the platform-compiler.cmake file
# it may be included by more than one language.
-set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
- CACHE STRING "Flags used by the linker.")
-
+if(NOT "x$ENV{LDFLAGS}" STREQUAL "x")
+ set (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
+ set (CMAKE_SHARED_LINKER_FLAGS_INIT "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
+ set (CMAKE_MODULE_LINKER_FLAGS_INIT "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
+endif()
if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
# default build type is none
@@ -82,24 +84,27 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
"Flags used by the linker during Release with Debug Info builds.")
endif()
+
+# executable linker flags
+set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT}"
+ CACHE STRING "Flags used by the linker.")
+
# shared linker flags
-set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
+set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT}"
CACHE STRING "Flags used by the linker during the creation of dll's.")
# module linker flags
-set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
+set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT}"
CACHE STRING "Flags used by the linker during the creation of modules.")
# static linker flags
set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS_INIT}"
CACHE STRING "Flags used by the linker during the creation of static libraries.")
-set(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL
- "What is the target build tool cmake is generating for.")
-
+# Alias the build tool variable for backward compatibility.
+set(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM})
mark_as_advanced(
-CMAKE_BUILD_TOOL
CMAKE_VERBOSE_MAKEFILE
CMAKE_EXE_LINKER_FLAGS
@@ -126,4 +131,3 @@ CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
CMAKE_STATIC_LINKER_FLAGS_RELEASE
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
)
-
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
new file mode 100644
index 000000000..cbc005570
--- /dev/null
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -0,0 +1,158 @@
+
+#=============================================================================
+# Copyright 2014 Stephen Kelly <steveire@gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+function(_readFile file)
+ include(${file})
+ get_filename_component(name ${file} NAME_WE)
+ string(REGEX REPLACE "-.*" "" CompilerId ${name})
+ set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
+ set(_compiler_id_simulate_${CompilerId} ${_compiler_id_simulate} PARENT_SCOPE)
+ set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE)
+endfunction()
+
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
+
+function(compiler_id_detection outvar lang)
+
+ if (NOT lang STREQUAL Fortran)
+ file(GLOB lang_files
+ "${CMAKE_ROOT}/Modules/Compiler/*-DetermineCompiler.cmake")
+ set(nonlang CXX)
+ if (lang STREQUAL CXX)
+ set(nonlang C)
+ endif()
+
+ file(GLOB nonlang_files
+ "${CMAKE_ROOT}/Modules/Compiler/*-${nonlang}-DetermineCompiler.cmake")
+ list(REMOVE_ITEM lang_files ${nonlang_files})
+ endif()
+
+ set(files ${lang_files})
+ if (files)
+ foreach(file ${files})
+ _readFile(${file})
+ endforeach()
+
+ set(options ID_STRING VERSION_STRINGS ID_DEFINE PLATFORM_DEFAULT_COMPILER)
+ set(oneValueArgs PREFIX)
+ cmake_parse_arguments(CID "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ if (CID_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unrecognized arguments: \"${CID_UNPARSED_ARGUMENTS}\"")
+ endif()
+
+ # Order is relevant here. For example, compilers which pretend to be
+ # GCC must appear before the actual GCC.
+ if (lang STREQUAL CXX)
+ list(APPEND ordered_compilers
+ Comeau
+ )
+ endif()
+ list(APPEND ordered_compilers
+ Intel
+ PathScale
+ Embarcadero
+ Borland
+ Watcom
+ OpenWatcom
+ SunPro
+ HP
+ Compaq
+ zOS
+ XL
+ VisualAge
+ PGI
+ Cray
+ TI
+ Fujitsu
+ )
+ if (lang STREQUAL C)
+ list(APPEND ordered_compilers
+ TinyCC
+ )
+ endif()
+ list(APPEND ordered_compilers
+ SCO
+ AppleClang
+ Clang
+ GNU
+ MSVC
+ ADSP
+ IAR
+ ARMCC
+ )
+ if (lang STREQUAL C)
+ list(APPEND ordered_compilers
+ SDCC
+ )
+ endif()
+ list(APPEND ordered_compilers
+ MIPSpro)
+
+ if(CID_ID_DEFINE)
+ foreach(Id ${ordered_compilers})
+ set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n")
+ endforeach()
+ endif()
+
+ set(pp_if "#if")
+ if (CID_VERSION_STRINGS)
+ set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n/* Version number components: V=Version, R=Revision, P=Patch
+ Version date components: YYYY=Year, MM=Month, DD=Day */\n")
+ endif()
+
+ foreach(Id ${ordered_compilers})
+ if (NOT _compiler_id_pp_test_${Id})
+ message(FATAL_ERROR "No preprocessor test for \"${Id}\"")
+ endif()
+ set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n")
+ if (CID_ID_STRING)
+ set(PREFIX ${CID_PREFIX})
+ string(CONFIGURE "${_compiler_id_simulate_${Id}}" SIMULATE_BLOCK @ONLY)
+ set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"${SIMULATE_BLOCK}")
+ endif()
+ if (CID_ID_DEFINE)
+ set(id_content "${id_content}# undef ${CID_PREFIX}COMPILER_IS_${Id}\n")
+ set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_IS_${Id} 1\n")
+ endif()
+ if (CID_VERSION_STRINGS)
+ set(PREFIX ${CID_PREFIX})
+ set(MACRO_DEC DEC)
+ set(MACRO_HEX HEX)
+ string(CONFIGURE "${_compiler_id_version_compute_${Id}}" VERSION_BLOCK @ONLY)
+ set(id_content "${id_content}${VERSION_BLOCK}\n")
+ endif()
+ set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${id_content}")
+ set(pp_if "#elif")
+ endforeach()
+
+ if (CID_PLATFORM_DEFAULT_COMPILER)
+ set(platform_compiler_detection "
+/* These compilers are either not known or too old to define an
+ identification macro. Try to identify the platform and guess that
+ it is the native compiler. */
+#elif defined(__sgi)
+# define ${CID_PREFIX}COMPILER_ID \"MIPSpro\"
+
+#elif defined(__hpux) || defined(__hpua)
+# define ${CID_PREFIX}COMPILER_ID \"HP\"
+
+#else /* unknown compiler */
+# define ${CID_PREFIX}COMPILER_ID \"\"")
+ endif()
+
+ set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${platform_compiler_detection}\n#endif")
+ endif()
+
+ set(${outvar} ${CMAKE_${lang}_COMPILER_ID_CONTENT} PARENT_SCOPE)
+endfunction()
diff --git a/Modules/CMakeConfigurableFile.in b/Modules/CMakeConfigurableFile.in
index 4cf74a12b..df2c382e9 100644
--- a/Modules/CMakeConfigurableFile.in
+++ b/Modules/CMakeConfigurableFile.in
@@ -1,2 +1 @@
@CMAKE_CONFIGURABLE_FILE_CONTENT@
-
diff --git a/Modules/CMakeDependentOption.cmake b/Modules/CMakeDependentOption.cmake
index 990728f9f..7e9f183f1 100644
--- a/Modules/CMakeDependentOption.cmake
+++ b/Modules/CMakeDependentOption.cmake
@@ -1,15 +1,23 @@
-# - Macro to provide an option dependent on other options.
+#.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
+# 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.
#=============================================================================
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index 0fecb5db6..91111d299 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -18,7 +18,7 @@ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
# prefer the environment variable ASM
- if($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
+ if(NOT $ENV{ASM${ASM_DIALECT}} STREQUAL "")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}")
endif()
@@ -48,22 +48,7 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
_cmake_find_compiler(ASM${ASM_DIALECT})
else()
-
- # we only get here if CMAKE_ASM${ASM_DIALECT}_COMPILER was specified using -D or a pre-made CMakeCache.txt
- # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
- #
- # if a compiler was specified by the user but without path,
- # now try to find it with the full path
- # if it is found, force it into the cache,
- # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
- get_filename_component(_CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
- if(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH)
- find_program(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER})
- mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
- if(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
- set(CMAKE_ASM${ASM_DIALECT}_COMPILER ${CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH} CACHE FILEPATH "Assembler" FORCE)
- endif()
- endif()
+ _cmake_find_compiler_path(ASM${ASM_DIALECT})
endif()
mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_COMPILER)
@@ -107,6 +92,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_IAR )
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_IAR "IAR Assembler")
+ list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ARMCC)
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMCC )
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMCC "(ARM Compiler)|(ARM Assembler)")
+
include(CMakeDetermineCompilerId)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
@@ -124,7 +113,7 @@ endif()
# e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas , optionally
# with a 3-component version number at the end
# The other tools of the toolchain usually have the same prefix
-# NAME_WE cannot be used since then this test will fail for names lile
+# NAME_WE cannot be used since then this test will fail for names like
# "arm-unknown-nto-qnx6.3.0-gas.exe", where BASENAME would be
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
if (NOT _CMAKE_TOOLCHAIN_PREFIX)
@@ -167,7 +156,7 @@ set(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}")
# configure variables set in this file for fast reload later on
configure_file(${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in
- ${CMAKE_PLATFORM_INFO_DIR}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY)
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeASM${ASM_DIALECT}Compiler.cmake @ONLY)
set(_CMAKE_ASM_COMPILER)
set(_CMAKE_ASM_COMPILER_ARG1)
diff --git a/Modules/CMakeDetermineASM_MASMCompiler.cmake b/Modules/CMakeDetermineASM_MASMCompiler.cmake
index 665a65cc5..142ef950a 100644
--- a/Modules/CMakeDetermineASM_MASMCompiler.cmake
+++ b/Modules/CMakeDetermineASM_MASMCompiler.cmake
@@ -17,7 +17,8 @@
set(ASM_DIALECT "_MASM")
# if we are using the 64bit cl compiler, assume we also want the 64bit assembler
-if(CMAKE_CL_64)
+if(";${CMAKE_VS_PLATFORM_NAME};${MSVC_C_ARCHITECTURE_ID};${MSVC_CXX_ARCHITECTURE_ID};"
+ MATCHES ";(Win64|Itanium|x64|IA64);")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64)
else()
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml)
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 8769c668b..e0b54686a 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -42,12 +42,13 @@ endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(CMAKE_C_COMPILER_XCODE_TYPE sourcecode.c.c)
+ _cmake_find_compiler_path(C)
else()
if(NOT CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER_INIT NOTFOUND)
# prefer the environment variable CC
- if($ENV{CC} MATCHES ".+")
+ if(NOT $ENV{CC} STREQUAL "")
get_filename_component(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT)
if(CMAKE_C_FLAGS_ENV_INIT)
set(CMAKE_C_COMPILER_ARG1 "${CMAKE_C_FLAGS_ENV_INIT}" CACHE STRING "First argument to C compiler")
@@ -72,37 +73,14 @@ else()
_cmake_find_compiler(C)
else()
-
- # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt
- # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
- # if CMAKE_C_COMPILER is a list of length 2, use the first item as
- # CMAKE_C_COMPILER and the 2nd one as CMAKE_C_COMPILER_ARG1
-
- list(LENGTH CMAKE_C_COMPILER _CMAKE_C_COMPILER_LIST_LENGTH)
- if("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2)
- list(GET CMAKE_C_COMPILER 1 CMAKE_C_COMPILER_ARG1)
- list(GET CMAKE_C_COMPILER 0 CMAKE_C_COMPILER)
- endif()
-
- # if a compiler was specified by the user but without path,
- # now try to find it with the full path
- # if it is found, force it into the cache,
- # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
- # if the C compiler already had a path, reuse it for searching the CXX compiler
- get_filename_component(_CMAKE_USER_C_COMPILER_PATH "${CMAKE_C_COMPILER}" PATH)
- if(NOT _CMAKE_USER_C_COMPILER_PATH)
- find_program(CMAKE_C_COMPILER_WITH_PATH NAMES ${CMAKE_C_COMPILER})
- mark_as_advanced(CMAKE_C_COMPILER_WITH_PATH)
- if(CMAKE_C_COMPILER_WITH_PATH)
- set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE STRING "C compiler" FORCE)
- endif()
- endif()
+ _cmake_find_compiler_path(C)
endif()
mark_as_advanced(CMAKE_C_COMPILER)
# Each entry in this list is a set of extra flags to try
# adding to the compile line to see if it helps produce
# a valid identification file.
+ set(CMAKE_C_COMPILER_ID_TEST_FLAGS_FIRST)
set(CMAKE_C_COMPILER_ID_TEST_FLAGS
# Try compiling to an object file only.
"-c"
@@ -118,25 +96,34 @@ if(NOT CMAKE_C_COMPILER_ID_RUN)
# Try to identify the compiler.
set(CMAKE_C_COMPILER_ID)
+ set(CMAKE_C_PLATFORM_ID)
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
CMAKE_C_COMPILER_ID_PLATFORM_CONTENT)
# The IAR compiler produces weird output.
- # See http://www.cmake.org/Bug/view.php?id=10176#c19598
+ # See https://cmake.org/Bug/view.php?id=10176#c19598
list(APPEND CMAKE_C_COMPILER_ID_VENDORS IAR)
set(CMAKE_C_COMPILER_ID_VENDOR_FLAGS_IAR )
set(CMAKE_C_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler")
+ # Match the link line from xcodebuild output of the form
+ # Ld ...
+ # ...
+ # /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_INDEX 2)
+
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c)
# Set old compiler and platform id variables.
- if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+ if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(CMAKE_COMPILER_IS_GNUCC 1)
endif()
- if("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")
+ if(CMAKE_C_PLATFORM_ID MATCHES "MinGW")
set(CMAKE_COMPILER_IS_MINGW 1)
- elseif("${CMAKE_C_PLATFORM_ID}" MATCHES "Cygwin")
+ elseif(CMAKE_C_PLATFORM_ID MATCHES "Cygwin")
set(CMAKE_COMPILER_IS_CYGWIN 1)
endif()
endif()
@@ -149,15 +136,23 @@ endif ()
# e.g. powerpc-linux-gcc, arm-elf-gcc or i586-mingw32msvc-gcc, optionally
# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2).
# The other tools of the toolchain usually have the same prefix
-# NAME_WE cannot be used since then this test will fail for names lile
+# NAME_WE cannot be used since then this test will fail for names like
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
# "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")
+ if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
- if (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
+ if(CMAKE_C_COMPILER_TARGET)
+ 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)?")
+ set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
+ endif()
endif ()
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
@@ -165,7 +160,7 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
endif ()
- elseif("${CMAKE_C_COMPILER_ID}" MATCHES "TI")
+ elseif(CMAKE_C_COMPILER_ID MATCHES "TI")
# TI compilers are named e.g. cl6x, cl470 or armcl.exe
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+)?cl([^.]+)?(\\.exe)?$")
@@ -176,15 +171,15 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
-include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake)
include(CMakeFindBinUtils)
if(MSVC_C_ARCHITECTURE_ID)
set(SET_MSVC_C_ARCHITECTURE_ID
"set(MSVC_C_ARCHITECTURE_ID ${MSVC_C_ARCHITECTURE_ID})")
endif()
+
# configure variables set in this file for fast reload later on
configure_file(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake
- @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ @ONLY
)
set(CMAKE_C_COMPILER_ENV_VAR "CC")
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index c79ba898d..3c9bbc26a 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -41,12 +41,13 @@ endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(CMAKE_CXX_COMPILER_XCODE_TYPE sourcecode.cpp.cpp)
+ _cmake_find_compiler_path(CXX)
else()
if(NOT CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER_INIT NOTFOUND)
# prefer the environment variable CXX
- if($ENV{CXX} MATCHES ".+")
+ if(NOT $ENV{CXX} STREQUAL "")
get_filename_component(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT)
if(CMAKE_CXX_FLAGS_ENV_INIT)
set(CMAKE_CXX_COMPILER_ARG1 "${CMAKE_CXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler")
@@ -70,38 +71,14 @@ else()
_cmake_find_compiler(CXX)
else()
-
- # we only get here if CMAKE_CXX_COMPILER was specified using -D or a pre-made CMakeCache.txt
- # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
- #
- # if CMAKE_CXX_COMPILER is a list of length 2, use the first item as
- # CMAKE_CXX_COMPILER and the 2nd one as CMAKE_CXX_COMPILER_ARG1
-
- list(LENGTH CMAKE_CXX_COMPILER _CMAKE_CXX_COMPILER_LIST_LENGTH)
- if("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2)
- list(GET CMAKE_CXX_COMPILER 1 CMAKE_CXX_COMPILER_ARG1)
- list(GET CMAKE_CXX_COMPILER 0 CMAKE_CXX_COMPILER)
- endif()
-
- # if a compiler was specified by the user but without path,
- # now try to find it with the full path
- # if it is found, force it into the cache,
- # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
- # if the CXX compiler already had a path, reuse it for searching the C compiler
- get_filename_component(_CMAKE_USER_CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH)
- if(NOT _CMAKE_USER_CXX_COMPILER_PATH)
- find_program(CMAKE_CXX_COMPILER_WITH_PATH NAMES ${CMAKE_CXX_COMPILER})
- mark_as_advanced(CMAKE_CXX_COMPILER_WITH_PATH)
- if(CMAKE_CXX_COMPILER_WITH_PATH)
- set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE STRING "CXX compiler" FORCE)
- endif()
- endif()
+ _cmake_find_compiler_path(CXX)
endif()
mark_as_advanced(CMAKE_CXX_COMPILER)
# Each entry in this list is a set of extra flags to try
# adding to the compile line to see if it helps produce
# a valid identification file.
+ set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS_FIRST)
set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS
# Try compiling to an object file only.
"-c"
@@ -114,25 +91,34 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN)
# Try to identify the compiler.
set(CMAKE_CXX_COMPILER_ID)
+ set(CMAKE_CXX_PLATFORM_ID)
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT)
# The IAR compiler produces weird output.
- # See http://www.cmake.org/Bug/view.php?id=10176#c19598
+ # See https://cmake.org/Bug/view.php?id=10176#c19598
list(APPEND CMAKE_CXX_COMPILER_ID_VENDORS IAR)
set(CMAKE_CXX_COMPILER_ID_VENDOR_FLAGS_IAR )
set(CMAKE_CXX_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler")
+ # Match the link line from xcodebuild output of the form
+ # Ld ...
+ # ...
+ # /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_INDEX 2)
+
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp)
# Set old compiler and platform id variables.
- if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_COMPILER_IS_GNUCXX 1)
endif()
- if("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")
+ if(CMAKE_CXX_PLATFORM_ID MATCHES "MinGW")
set(CMAKE_COMPILER_IS_MINGW 1)
- elseif("${CMAKE_CXX_PLATFORM_ID}" MATCHES "Cygwin")
+ elseif(CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin")
set(CMAKE_COMPILER_IS_CYGWIN 1)
endif()
endif()
@@ -145,17 +131,25 @@ endif ()
# e.g. powerpc-linux-g++, arm-elf-g++ or i586-mingw32msvc-g++ , optionally
# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2).
# The other tools of the toolchain usually have the same prefix
-# NAME_WE cannot be used since then this test will fail for names lile
+# NAME_WE cannot be used since then this test will fail for names like
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
- if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
- if (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+ if(CMAKE_CXX_COMPILER_TARGET)
+ 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)?")
+ set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
+ endif()
endif ()
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
@@ -175,16 +169,16 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
-include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake)
include(CMakeFindBinUtils)
if(MSVC_CXX_ARCHITECTURE_ID)
set(SET_MSVC_CXX_ARCHITECTURE_ID
"set(MSVC_CXX_ARCHITECTURE_ID ${MSVC_CXX_ARCHITECTURE_ID})")
endif()
+
# configure all variables set in this file
configure_file(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake
- @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ @ONLY
)
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake
new file mode 100644
index 000000000..2bb7a74e7
--- /dev/null
+++ b/Modules/CMakeDetermineCompileFeatures.cmake
@@ -0,0 +1,94 @@
+
+#=============================================================================
+# Copyright 2013 Stephen Kelly <steveire@gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+function(cmake_determine_compile_features lang)
+
+ if(lang STREQUAL C AND COMMAND cmake_record_c_compile_features)
+ message(STATUS "Detecting ${lang} compile features")
+
+ set(CMAKE_C90_COMPILE_FEATURES)
+ set(CMAKE_C99_COMPILE_FEATURES)
+ set(CMAKE_C11_COMPILE_FEATURES)
+
+ include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
+
+ cmake_record_c_compile_features()
+
+ if(NOT _result EQUAL 0)
+ message(STATUS "Detecting ${lang} compile features - failed")
+ return()
+ endif()
+
+ if (CMAKE_C99_COMPILE_FEATURES AND CMAKE_C11_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_C11_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES})
+ endif()
+ if (CMAKE_C90_COMPILE_FEATURES AND CMAKE_C99_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_C99_COMPILE_FEATURES ${CMAKE_C90_COMPILE_FEATURES})
+ endif()
+
+ if(NOT CMAKE_C_COMPILE_FEATURES)
+ set(CMAKE_C_COMPILE_FEATURES
+ ${CMAKE_C90_COMPILE_FEATURES}
+ ${CMAKE_C99_COMPILE_FEATURES}
+ ${CMAKE_C11_COMPILE_FEATURES}
+ )
+ endif()
+
+ set(CMAKE_C_COMPILE_FEATURES ${CMAKE_C_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_C90_COMPILE_FEATURES ${CMAKE_C90_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_C99_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_C11_COMPILE_FEATURES ${CMAKE_C11_COMPILE_FEATURES} PARENT_SCOPE)
+
+ message(STATUS "Detecting ${lang} compile features - done")
+
+ elseif(lang STREQUAL CXX AND COMMAND cmake_record_cxx_compile_features)
+ message(STATUS "Detecting ${lang} compile features")
+
+ set(CMAKE_CXX98_COMPILE_FEATURES)
+ set(CMAKE_CXX11_COMPILE_FEATURES)
+ set(CMAKE_CXX14_COMPILE_FEATURES)
+
+ include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
+
+ cmake_record_cxx_compile_features()
+
+ if(NOT _result EQUAL 0)
+ message(STATUS "Detecting ${lang} compile features - failed")
+ return()
+ endif()
+
+ if (CMAKE_CXX11_COMPILE_FEATURES AND CMAKE_CXX14_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES})
+ endif()
+ if (CMAKE_CXX98_COMPILE_FEATURES AND CMAKE_CXX11_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES})
+ endif()
+
+ if(NOT CMAKE_CXX_COMPILE_FEATURES)
+ set(CMAKE_CXX_COMPILE_FEATURES
+ ${CMAKE_CXX98_COMPILE_FEATURES}
+ ${CMAKE_CXX11_COMPILE_FEATURES}
+ ${CMAKE_CXX14_COMPILE_FEATURES}
+ )
+ endif()
+
+ set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CXX98_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES} PARENT_SCOPE)
+
+ message(STATUS "Detecting ${lang} compile features - done")
+ endif()
+
+endfunction()
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake
index f522c4408..85c866276 100644
--- a/Modules/CMakeDetermineCompiler.cmake
+++ b/Modules/CMakeDetermineCompiler.cmake
@@ -65,21 +65,66 @@ macro(_cmake_find_compiler lang)
endif()
find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler")
if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER)
- set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_INIT}" CACHE FILEPATH "${lang} compiler" FORCE)
+ set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}")
endif()
unset(_${lang}_COMPILER_HINTS)
unset(_languages)
# Look for a make tool provided by Xcode
- if(CMAKE_${lang}_COMPILER STREQUAL "CMAKE_${lang}_COMPILER-NOTFOUND" AND CMAKE_HOST_APPLE)
- foreach(comp ${CMAKE_${lang}_COMPILER_LIST})
- execute_process(COMMAND xcrun --find ${comp}
+ if(CMAKE_HOST_APPLE)
+ macro(_query_xcrun compiler_name result_var_keyword result_var)
+ if(NOT "x${result_var_keyword}" STREQUAL "xRESULT_VAR")
+ message(FATAL_ERROR "Bad arguments to macro")
+ endif()
+ execute_process(COMMAND xcrun --find ${compiler_name}
OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE _xcrun_err)
- if(_xcrun_out)
- set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${_xcrun_out}")
- break()
+ set("${result_var}" "${_xcrun_out}")
+ endmacro()
+
+ set(xcrun_result)
+ if (CMAKE_${lang}_COMPILER MATCHES "^/usr/bin/(.+)$")
+ _query_xcrun("${CMAKE_MATCH_1}" RESULT_VAR xcrun_result)
+ elseif (CMAKE_${lang}_COMPILER STREQUAL "CMAKE_${lang}_COMPILER-NOTFOUND")
+ foreach(comp ${CMAKE_${lang}_COMPILER_LIST})
+ _query_xcrun("${comp}" RESULT_VAR xcrun_result)
+ if(xcrun_result)
+ break()
+ endif()
+ endforeach()
+ endif()
+ if (xcrun_result)
+ set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${xcrun_result}")
+ endif()
+ endif()
+endmacro()
+
+macro(_cmake_find_compiler_path lang)
+ if(CMAKE_${lang}_COMPILER)
+ # we only get here if CMAKE_${lang}_COMPILER was specified using -D or a pre-made CMakeCache.txt
+ # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
+ # if CMAKE_${lang}_COMPILER is a list of length 2, use the first item as
+ # CMAKE_${lang}_COMPILER and the 2nd one as CMAKE_${lang}_COMPILER_ARG1
+ list(LENGTH CMAKE_${lang}_COMPILER _CMAKE_${lang}_COMPILER_LIST_LENGTH)
+ if("${_CMAKE_${lang}_COMPILER_LIST_LENGTH}" EQUAL 2)
+ list(GET CMAKE_${lang}_COMPILER 1 CMAKE_${lang}_COMPILER_ARG1)
+ list(GET CMAKE_${lang}_COMPILER 0 CMAKE_${lang}_COMPILER)
+ endif()
+ unset(_CMAKE_${lang}_COMPILER_LIST_LENGTH)
+
+ # find the compiler in the PATH if necessary
+ get_filename_component(_CMAKE_USER_${lang}_COMPILER_PATH "${CMAKE_${lang}_COMPILER}" PATH)
+ if(NOT _CMAKE_USER_${lang}_COMPILER_PATH)
+ find_program(CMAKE_${lang}_COMPILER_WITH_PATH NAMES ${CMAKE_${lang}_COMPILER})
+ if(CMAKE_${lang}_COMPILER_WITH_PATH)
+ set(CMAKE_${lang}_COMPILER ${CMAKE_${lang}_COMPILER_WITH_PATH})
+ get_property(_CMAKE_${lang}_COMPILER_CACHED CACHE CMAKE_${lang}_COMPILER PROPERTY TYPE)
+ if(_CMAKE_${lang}_COMPILER_CACHED)
+ set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE STRING "${lang} compiler" FORCE)
+ endif()
+ unset(_CMAKE_${lang}_COMPILER_CACHED)
endif()
- endforeach()
+ unset(CMAKE_${lang}_COMPILER_WITH_PATH CACHE)
+ endif()
endif()
endmacro()
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 5d35ce378..344ae475d 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -26,15 +26,17 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerABI_${lang}.bin")
set(CMAKE_FLAGS )
if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
- set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
+ set(CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
+ endif()
+ if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC")
+ # Avoid adding our own platform standard libraries for compilers
+ # from which we might detect implicit link libraries.
+ list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=")
endif()
try_compile(CMAKE_${lang}_ABI_COMPILED
${CMAKE_BINARY_DIR} ${src}
- CMAKE_FLAGS "${CMAKE_FLAGS}"
- "-DCMAKE_${lang}_STANDARD_LIBRARIES="
- # We need ignore these warnings because some platforms need
- # CMAKE_${lang}_STANDARD_LIBRARIES to link properly and we
- # don't care when we are just determining the ABI.
+ CMAKE_FLAGS ${CMAKE_FLAGS}
+ # Ignore unused flags when we are just determining the ABI.
"--no-warn-unused-cli"
OUTPUT_VARIABLE OUTPUT
COPY_FILE "${BIN}"
@@ -50,13 +52,13 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
message(STATUS "Detecting ${lang} compiler ABI info - done")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n")
- file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[")
+ file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
foreach(info ${ABI_STRINGS})
- if("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
- string(REGEX REPLACE ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*" "\\1" ABI_SIZEOF_DPTR "${info}")
+ if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]")
+ set(ABI_SIZEOF_DPTR "${CMAKE_MATCH_1}")
endif()
- if("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
- string(REGEX REPLACE ".*INFO:abi\\[([^]]*)\\].*" "\\1" ABI_NAME "${info}")
+ if("${info}" MATCHES "INFO:abi\\[([^]]*)\\]")
+ set(ABI_NAME "${CMAKE_MATCH_1}")
endif()
endforeach()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index dd0c2bdcf..feae1c425 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -27,32 +27,60 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
else()
set(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}})
endif()
- string(REGEX REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}")
+ string(REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}")
# Compute the directory in which to run the test.
set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang})
# Try building with no extra flags and then try each set
# of helper flags. Stop when the compiler is identified.
- foreach(flags "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
- if(NOT CMAKE_${lang}_COMPILER_ID)
- CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}")
- foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
- CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
- endforeach()
+ foreach(flags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}
+ ""
+ ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
+ CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}")
+ CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}")
+ if(CMAKE_${lang}_COMPILER_ID)
+ break()
+ endif()
+ foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
+ CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
+ endforeach()
+ if(CMAKE_${lang}_COMPILER_ID)
+ break()
endif()
endforeach()
# If the compiler is still unknown, try to query its vendor.
- if(NOT CMAKE_${lang}_COMPILER_ID)
+ if(CMAKE_${lang}_COMPILER AND NOT CMAKE_${lang}_COMPILER_ID)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang})
endif()
+ if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU")
+ execute_process(
+ COMMAND "${CMAKE_${lang}_COMPILER}"
+ -V
+ OUTPUT_VARIABLE output ERROR_VARIABLE output
+ RESULT_VARIABLE result
+ TIMEOUT 10
+ )
+ if (output MATCHES "targets available")
+ set(CMAKE_${lang}_COMPILER_ID QCC)
+ # http://community.qnx.com/sf/discussion/do/listPosts/projects.community/discussion.qnx_momentics_community_support.topc3555?_pagenum=2
+ # The qcc driver does not itself have a version.
+ endif()
+ endif()
+
# if the format is unknown after all files have been checked, put "Unknown" in the cache
if(NOT CMAKE_EXECUTABLE_FORMAT)
set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format")
endif()
+ if(CMAKE_GENERATOR STREQUAL "Ninja" AND MSVC_${lang}_ARCHITECTURE_ID)
+ CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX(${lang})
+ else()
+ set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "")
+ endif()
+
# Display the final identification result.
if(CMAKE_${lang}_COMPILER_ID)
if(CMAKE_${lang}_COMPILER_VERSION)
@@ -67,25 +95,39 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
# Check if compiler id detection gave us the compiler tool.
- if(NOT CMAKE_${lang}_COMPILER)
- if(CMAKE_${lang}_COMPILER_ID_TOOL)
- set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}" PARENT_SCOPE)
- else()
- set(CMAKE_${lang}_COMPILER "CMAKE_${lang}_COMPILER-NOTFOUND" PARENT_SCOPE)
- endif()
+ if(CMAKE_${lang}_COMPILER_ID_TOOL)
+ set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}" PARENT_SCOPE)
+ elseif(NOT CMAKE_${lang}_COMPILER)
+ set(CMAKE_${lang}_COMPILER "CMAKE_${lang}_COMPILER-NOTFOUND" PARENT_SCOPE)
endif()
set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE)
set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE)
set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
PARENT_SCOPE)
+ set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX}" PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
+ set(CMAKE_${lang}_COMPILER_WRAPPER "${CMAKE_${lang}_COMPILER_WRAPPER}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
+ set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE)
endfunction()
+include(CMakeCompilerIdDetection)
+
#-----------------------------------------------------------------------------
# Function to write the compiler id source file.
function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
- file(READ ${CMAKE_ROOT}/Modules/${src}.in ID_CONTENT_IN)
+ find_file(src_in ${src}.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ file(READ ${src_in} ID_CONTENT_IN)
+
+ compiler_id_detection(CMAKE_${lang}_COMPILER_ID_CONTENT ${lang}
+ ID_STRING
+ VERSION_STRINGS
+ PLATFORM_DEFAULT_COMPILER
+ )
+
+ unset(src_in CACHE)
string(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY)
file(WRITE ${CMAKE_${lang}_COMPILER_ID_DIR}/${src} "${ID_CONTENT_OUT}")
endfunction()
@@ -107,12 +149,30 @@ Id flags: ${testflags}
")
# Compile the compiler identification source.
- if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)")
+ if(CMAKE_GENERATOR STREQUAL "Visual Studio 6" AND
+ lang STREQUAL "Fortran")
+ set(CMAKE_${lang}_COMPILER_ID_RESULT 1)
+ set(CMAKE_${lang}_COMPILER_ID_OUTPUT "No Intel Fortran in VS 6")
+ elseif("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)")
set(vs_version ${CMAKE_MATCH_1})
set(id_platform ${CMAKE_VS_PLATFORM_NAME})
set(id_lang "${lang}")
set(id_cl cl.exe)
- if(NOT "${vs_version}" VERSION_LESS 10)
+ if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ set(v NsightTegra)
+ set(ext vcxproj)
+ if(lang STREQUAL CXX)
+ set(id_gcc g++)
+ set(id_clang clang++)
+ else()
+ set(id_gcc gcc)
+ set(id_clang clang)
+ endif()
+ elseif(lang STREQUAL Fortran)
+ set(v Intel)
+ set(ext vfproj)
+ set(id_cl ifort.exe)
+ elseif(NOT "${vs_version}" VERSION_LESS 10)
set(v 10)
set(ext vcxproj)
elseif(NOT "${vs_version}" VERSION_LESS 7)
@@ -123,14 +183,38 @@ Id flags: ${testflags}
set(v 6)
set(ext dsp)
endif()
- if("${id_platform}" STREQUAL "Itanium")
- set(id_platform ia64)
- endif()
if(CMAKE_VS_PLATFORM_TOOLSET)
- set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
+ if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ set(id_toolset "<NdkToolchainVersion>${CMAKE_VS_PLATFORM_TOOLSET}</NdkToolchainVersion>")
+ else()
+ set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
+ if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel")
+ set(id_cl icl.exe)
+ endif()
+ endif()
else()
set(id_toolset "")
endif()
+ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
+ set(id_system "<ApplicationType>Windows Phone</ApplicationType>")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set(id_system "<ApplicationType>Windows Store</ApplicationType>")
+ else()
+ set(id_system "")
+ endif()
+ if(id_system AND CMAKE_SYSTEM_VERSION)
+ set(id_system_version "<ApplicationTypeRevision>${CMAKE_SYSTEM_VERSION}</ApplicationTypeRevision>")
+ else()
+ set(id_system_version "")
+ endif()
+ if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
+ set(id_WindowsTargetPlatformVersion "<WindowsTargetPlatformVersion>${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}</WindowsTargetPlatformVersion>")
+ endif()
+ if(id_platform STREQUAL ARM)
+ set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>")
+ else()
+ set(id_WindowsSDKDesktopARMSupport "")
+ endif()
if(CMAKE_VS_WINCE_VERSION)
set(id_entrypoint "mainACRTStartup")
if("${vs_version}" VERSION_LESS 9)
@@ -141,27 +225,37 @@ Id flags: ${testflags}
else()
set(id_subsystem 1)
endif()
- if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]")
- set(build /p:Configuration=Debug /p:Platform=@id_platform@ /p:VisualStudioVersion=${vs_version}.0)
- elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]")
- set(build /make)
- else()
- set(build /build Debug)
- endif()
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
- get_filename_component(id_src "${src}" NAME)
+ set(id_src "${src}")
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
- ${id_dir}/CompilerId${lang}.${ext} @ONLY IMMEDIATE)
- execute_process(
- COMMAND ${CMAKE_MAKE_PROGRAM} CompilerId${lang}.${ext} ${build}
- WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
- OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
- ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
- RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
- )
+ ${id_dir}/CompilerId${lang}.${ext} @ONLY)
+ if(CMAKE_VS_MSBUILD_COMMAND AND NOT lang STREQUAL "Fortran")
+ set(command "${CMAKE_VS_MSBUILD_COMMAND}" "CompilerId${lang}.${ext}"
+ "/p:Configuration=Debug" "/p:Platform=${id_platform}" "/p:VisualStudioVersion=${vs_version}.0"
+ )
+ elseif(CMAKE_VS_DEVENV_COMMAND)
+ set(command "${CMAKE_VS_DEVENV_COMMAND}" "CompilerId${lang}.${ext}" "/build" "Debug")
+ elseif(CMAKE_VS_MSDEV_COMMAND)
+ set(command "${CMAKE_VS_MSDEV_COMMAND}" "CompilerId${lang}.${ext}" "/make")
+ else()
+ set(command "")
+ endif()
+ if(command)
+ execute_process(
+ COMMAND ${command}
+ WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
+ OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
+ ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
+ RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
+ )
+ else()
+ set(CMAKE_${lang}_COMPILER_ID_RESULT 1)
+ set(CMAKE_${lang}_COMPILER_ID_OUTPUT "VS environment not known to support ${lang}")
+ endif()
# Match the compiler location line printed out.
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]")
- set(_comp "${CMAKE_MATCH_1}")
+ # Strip VS diagnostic output from the end of the line.
+ string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _comp "${CMAKE_MATCH_1}")
if(EXISTS "${_comp}")
file(TO_CMAKE_PATH "${_comp}" _comp)
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
@@ -171,12 +265,27 @@ Id flags: ${testflags}
set(id_lang "${lang}")
set(id_type ${CMAKE_${lang}_COMPILER_XCODE_TYPE})
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
- get_filename_component(id_src "${src}" NAME)
+ set(id_src "${src}")
if(CMAKE_XCODE_PLATFORM_TOOLSET)
set(id_toolset "GCC_VERSION = ${CMAKE_XCODE_PLATFORM_TOOLSET};")
else()
set(id_toolset "")
endif()
+ if(CMAKE_OSX_DEPLOYMENT_TARGET)
+ set(id_deployment_target
+ "MACOSX_DEPLOYMENT_TARGET = \"${CMAKE_OSX_DEPLOYMENT_TARGET}\";")
+ else()
+ set(id_deployment_target "")
+ endif()
+ set(id_product_type "com.apple.product-type.tool")
+ if(CMAKE_OSX_SYSROOT)
+ set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";")
+ if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]")
+ set(id_product_type "com.apple.product-type.bundle.unit-test")
+ endif()
+ else()
+ set(id_sdkroot "")
+ endif()
if(NOT ${XCODE_VERSION} VERSION_LESS 3)
set(v 3)
set(ext xcodeproj)
@@ -188,7 +297,7 @@ Id flags: ${testflags}
set(ext xcode)
endif()
configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-${v}.pbxproj.in
- ${id_dir}/CompilerId${lang}.${ext}/project.pbxproj @ONLY IMMEDIATE)
+ ${id_dir}/CompilerId${lang}.${ext}/project.pbxproj @ONLY)
unset(_ENV_MACOSX_DEPLOYMENT_TARGET)
if(DEFINED ENV{MACOSX_DEPLOYMENT_TARGET})
set(_ENV_MACOSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}")
@@ -204,45 +313,33 @@ Id flags: ${testflags}
set(ENV{MACOSX_DEPLOYMENT_TARGET} "${_ENV_MACOSX_DEPLOYMENT_TARGET}")
endif()
- # Match the link line from xcodebuild output of the form
- # Ld ...
- # ...
- # /path/to/cc ...CompilerId${lang}/...
- # to extract the compiler front-end for the language.
- if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/(\\./)?CompilerId${lang}[ \t\n\\\"]")
- set(_comp "${CMAKE_MATCH_2}")
- if(EXISTS "${_comp}")
- set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
+ if(DEFINED CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX)
+ if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX}")
+ set(_comp "${CMAKE_MATCH_${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_INDEX}}")
+ if(EXISTS "${_comp}")
+ set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
+ endif()
endif()
endif()
else()
- if(COMMAND EXECUTE_PROCESS)
- execute_process(
- COMMAND ${CMAKE_${lang}_COMPILER}
- ${CMAKE_${lang}_COMPILER_ID_ARG1}
- ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
- ${testflags}
- "${src}"
- WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
- OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
- ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
- RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
- )
- else()
- exec_program(
- ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR}
- ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1}
- ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
- ${testflags}
- \"${src}\"
- OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
- RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT
- )
- endif()
+ execute_process(
+ COMMAND "${CMAKE_${lang}_COMPILER}"
+ ${CMAKE_${lang}_COMPILER_ID_ARG1}
+ ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
+ ${testflags}
+ "${src}"
+ WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
+ OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
+ ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
+ RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
+ )
endif()
# Check the result of compilation.
- if(CMAKE_${lang}_COMPILER_ID_RESULT)
+ if(CMAKE_${lang}_COMPILER_ID_RESULT
+ # Intel Fortran warns and ignores preprocessor lines without /fpp
+ OR CMAKE_${lang}_COMPILER_ID_OUTPUT MATCHES "Bad # preprocessor line"
+ )
# Compilation failed.
set(MSG
"Compiling the ${lang} compiler identification source file \"${src}\" failed.
@@ -259,6 +356,7 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
# No output files should be inspected.
set(COMPILER_${lang}_PRODUCED_FILES)
+ set(COMPILER_${lang}_PRODUCED_OUTPUT)
else()
# Compilation succeeded.
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
@@ -274,7 +372,13 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
# binary dir.
file(GLOB files
RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR}
- ${CMAKE_${lang}_COMPILER_ID_DIR}/*)
+
+ # normal case
+ ${CMAKE_${lang}_COMPILER_ID_DIR}/*
+
+ # com.apple.package-type.bundle.unit-test
+ ${CMAKE_${lang}_COMPILER_ID_DIR}/*.xctest/*
+ )
list(REMOVE_ITEM files "${src}")
set(COMPILER_${lang}_PRODUCED_FILES "")
foreach(file ${files})
@@ -293,10 +397,24 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
"${src}\" did not produce an executable in \""
"${CMAKE_${lang}_COMPILER_ID_DIR}\".\n\n")
endif()
+
+ set(COMPILER_${lang}_PRODUCED_OUTPUT "${CMAKE_${lang}_COMPILER_ID_OUTPUT}")
endif()
# Return the files produced by the compilation.
set(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE)
+ set(COMPILER_${lang}_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE)
+endfunction()
+
+#-----------------------------------------------------------------------------
+# Function to extract the compiler id from compiler output.
+function(CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR lang output)
+ foreach(vendor ${CMAKE_${lang}_COMPILER_ID_MATCH_VENDORS})
+ if(output MATCHES "${CMAKE_${lang}_COMPILER_ID_MATCH_VENDOR_REGEX_${vendor}}")
+ set(CMAKE_${lang}_COMPILER_ID "${vendor}")
+ endif()
+ endforeach()
+ set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE)
endfunction()
#-----------------------------------------------------------------------------
@@ -307,33 +425,88 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
# Read the compiler identification string from the executable file.
set(COMPILER_ID)
set(COMPILER_VERSION)
+ set(COMPILER_VERSION_MAJOR 0)
+ set(COMPILER_VERSION_MINOR 0)
+ set(COMPILER_VERSION_PATCH 0)
+ set(COMPILER_VERSION_TWEAK 0)
+ set(HAVE_COMPILER_VERSION_MAJOR 0)
+ set(HAVE_COMPILER_VERSION_MINOR 0)
+ set(HAVE_COMPILER_VERSION_PATCH 0)
+ set(HAVE_COMPILER_VERSION_TWEAK 0)
+ set(COMPILER_WRAPPER)
+ set(DIGIT_VALUE_1 1)
+ set(DIGIT_VALUE_2 10)
+ set(DIGIT_VALUE_3 100)
+ set(DIGIT_VALUE_4 1000)
+ set(DIGIT_VALUE_5 10000)
+ set(DIGIT_VALUE_6 100000)
+ set(DIGIT_VALUE_7 1000000)
+ set(DIGIT_VALUE_8 10000000)
set(PLATFORM_ID)
+ set(ARCHITECTURE_ID)
+ set(SIMULATE_ID)
+ set(SIMULATE_VERSION)
file(STRINGS ${file}
- CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 4 REGEX "INFO:")
- set(HAVE_COMPILER_TWICE 0)
+ CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 38 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ set(COMPILER_ID_TWICE)
foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
- if("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*")
+ if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]")
if(COMPILER_ID)
set(COMPILER_ID_TWICE 1)
endif()
- string(REGEX REPLACE ".*INFO:compiler\\[([^]]*)\\].*" "\\1"
- COMPILER_ID "${info}")
+ set(COMPILER_ID "${CMAKE_MATCH_1}")
endif()
- if("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*")
- string(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1"
- PLATFORM_ID "${info}")
+ if("${info}" MATCHES "INFO:platform\\[([^]\"]*)\\]")
+ set(PLATFORM_ID "${CMAKE_MATCH_1}")
endif()
- if("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*")
- string(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1"
- ARCHITECTURE_ID "${info}")
+ if("${info}" MATCHES "INFO:arch\\[([^]\"]*)\\]")
+ set(ARCHITECTURE_ID "${CMAKE_MATCH_1}")
endif()
- if("${info}" MATCHES ".*INFO:compiler_version\\[([^]\"]*)\\].*")
- string(REGEX REPLACE ".*INFO:compiler_version\\[([^]]*)\\].*" "\\1" COMPILER_VERSION "${info}")
- string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${COMPILER_VERSION}")
+ if("${info}" MATCHES "INFO:compiler_version\\[([^]\"]*)\\]")
+ string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}")
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
endif()
+ foreach(comp MAJOR MINOR PATCH TWEAK)
+ foreach(digit 1 2 3 4 5 6 7 8 9)
+ if("${info}" MATCHES "INFO:compiler_version_${comp}_digit_${digit}\\[([0-9])\\]")
+ set(value ${CMAKE_MATCH_1})
+ math(EXPR COMPILER_VERSION_${comp} "${COMPILER_VERSION_${comp}} + ${value} * ${DIGIT_VALUE_${digit}}")
+ set(HAVE_COMPILER_VERSION_${comp} 1)
+ endif()
+ endforeach()
+ endforeach()
+ if("${info}" MATCHES "INFO:compiler_wrapper\\[([^]\"]*)\\]")
+ set(COMPILER_WRAPPER "${CMAKE_MATCH_1}")
+ endif()
+ if("${info}" MATCHES "INFO:simulate\\[([^]\"]*)\\]")
+ set(SIMULATE_ID "${CMAKE_MATCH_1}")
+ endif()
+ if("${info}" MATCHES "INFO:simulate_version\\[([^]\"]*)\\]")
+ string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${CMAKE_MATCH_1}")
+ string(REGEX REPLACE "\\.0+([0-9])" ".\\1" SIMULATE_VERSION "${SIMULATE_VERSION}")
+ endif()
+ if("${info}" MATCHES "INFO:qnxnto\\[\\]")
+ set(COMPILER_QNXNTO 1)
+ endif()
+ if("${info}" MATCHES "INFO:dialect_default\\[([^]\"]*)\\]")
+ set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_MATCH_1}")
+ endif()
endforeach()
+ # Construct compiler version from components if needed.
+ if(NOT DEFINED COMPILER_VERSION AND HAVE_COMPILER_VERSION_MAJOR)
+ set(COMPILER_VERSION "${COMPILER_VERSION_MAJOR}")
+ if(HAVE_COMPILER_VERSION_MINOR)
+ set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_MINOR}")
+ if(HAVE_COMPILER_VERSION_PATCH)
+ set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_PATCH}")
+ if(HAVE_COMPILER_VERSION_TWEAK)
+ set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_TWEAK}")
+ endif()
+ endif()
+ endif()
+ endif()
+
# Detect the exact architecture from the PE header.
if(WIN32)
# The offset to the PE signature is stored at 0x3c.
@@ -358,8 +531,6 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(ARCHITECTURE_ID "SH4")
elseif(peheader STREQUAL "50450000a801")
set(ARCHITECTURE_ID "SH5")
- elseif(peheader STREQUAL "50450000c201")
- set(ARCHITECTURE_ID "THUMB")
endif()
endif()
@@ -369,6 +540,8 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}")
set(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}")
set(CMAKE_${lang}_COMPILER_VERSION "${COMPILER_VERSION}")
+ set(CMAKE_${lang}_SIMULATE_ID "${SIMULATE_ID}")
+ set(CMAKE_${lang}_SIMULATE_VERSION "${SIMULATE_VERSION}")
endif()
# Check the compiler identification string.
@@ -417,7 +590,12 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
+ set(CMAKE_${lang}_COMPILER_WRAPPER "${COMPILER_WRAPPER}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE)
+ set(COMPILER_QNXNTO "${COMPILER_QNXNTO}" PARENT_SCOPE)
+ set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE)
endfunction()
#-----------------------------------------------------------------------------
@@ -444,7 +622,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
set(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}})
set(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}})
execute_process(
- COMMAND ${CMAKE_${lang}_COMPILER}
+ COMMAND "${CMAKE_${lang}_COMPILER}"
${CMAKE_${lang}_COMPILER_ID_ARG1}
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
${flags}
@@ -473,3 +651,27 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
endif()
endforeach()
endfunction()
+
+function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang)
+ # Run this MSVC-compatible compiler to detect what the /showIncludes
+ # option displays. We can use a C source even with the C++ compiler
+ # because MSVC-compatible compilers handle both and show the same output.
+ set(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes)
+ file(WRITE ${showdir}/foo.h "\n")
+ file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n")
+ execute_process(
+ COMMAND "${CMAKE_${lang}_COMPILER}"
+ ${CMAKE_${lang}_COMPILER_ID_ARG1}
+ ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
+ /nologo /showIncludes /c main.c
+ WORKING_DIRECTORY ${showdir}
+ OUTPUT_VARIABLE out
+ ERROR_VARIABLE err
+ RESULT_VARIABLE res
+ )
+ if(res EQUAL 0 AND "${out}" MATCHES "\n([^:]*:[^:]*:[ \t]*)")
+ set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_1}" PARENT_SCOPE)
+ else()
+ set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "" PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 4d3fb9076..ccafb0779 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -26,16 +26,13 @@ if(NOT CMAKE_Fortran_COMPILER_NAMES)
endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
- set(CMAKE_Fortran_COMPILER_ID_RUN 1)
- set(CMAKE_Fortran_PLATFORM_ID "Windows")
- set(CMAKE_Fortran_COMPILER_ID "Intel")
- set(CMAKE_Fortran_COMPILER "${CMAKE_GENERATOR_FC}")
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(CMAKE_Fortran_COMPILER_XCODE_TYPE sourcecode.fortran.f90)
+ _cmake_find_compiler_path(Fortran)
else()
if(NOT CMAKE_Fortran_COMPILER)
# prefer the environment variable CC
- if($ENV{FC} MATCHES ".+")
+ if(NOT $ENV{FC} STREQUAL "")
get_filename_component(CMAKE_Fortran_COMPILER_INIT $ENV{FC} PROGRAM PROGRAM_ARGS CMAKE_Fortran_FLAGS_ENV_INIT)
if(CMAKE_Fortran_FLAGS_ENV_INIT)
set(CMAKE_Fortran_COMPILER_ARG1 "${CMAKE_Fortran_FLAGS_ENV_INIT}" CACHE STRING "First argument to Fortran compiler")
@@ -57,6 +54,7 @@ else()
if(NOT CMAKE_Fortran_COMPILER_INIT)
# Known compilers:
# f77/f90/f95: generic compiler names
+ # ftn: Cray fortran compiler wrapper
# g77: GNU Fortran 77 compiler
# gfortran: putative GNU Fortran 95+ compiler (in progress)
# fort77: native F77 compiler under HP-UX (and some older Crays)
@@ -76,6 +74,7 @@ else()
# then 77 or older compilers, gnu is always last in the group,
# so if you paid for a compiler it is picked by default.
set(CMAKE_Fortran_COMPILER_LIST
+ ftn
ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95
fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77
frt pgf77 xlf fl32 af77 g77 f77
@@ -94,37 +93,17 @@ else()
_cmake_find_compiler(Fortran)
else()
- # we only get here if CMAKE_Fortran_COMPILER was specified using -D or a pre-made CMakeCache.txt
- # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
- # if CMAKE_Fortran_COMPILER is a list of length 2, use the first item as
- # CMAKE_Fortran_COMPILER and the 2nd one as CMAKE_Fortran_COMPILER_ARG1
-
- list(LENGTH CMAKE_Fortran_COMPILER _CMAKE_Fortran_COMPILER_LIST_LENGTH)
- if("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2)
- list(GET CMAKE_Fortran_COMPILER 1 CMAKE_Fortran_COMPILER_ARG1)
- list(GET CMAKE_Fortran_COMPILER 0 CMAKE_Fortran_COMPILER)
- endif()
-
- # if a compiler was specified by the user but without path,
- # now try to find it with the full path
- # if it is found, force it into the cache,
- # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
- # if the C compiler already had a path, reuse it for searching the CXX compiler
- get_filename_component(_CMAKE_USER_Fortran_COMPILER_PATH "${CMAKE_Fortran_COMPILER}" PATH)
- if(NOT _CMAKE_USER_Fortran_COMPILER_PATH)
- find_program(CMAKE_Fortran_COMPILER_WITH_PATH NAMES ${CMAKE_Fortran_COMPILER})
- mark_as_advanced(CMAKE_Fortran_COMPILER_WITH_PATH)
- if(CMAKE_Fortran_COMPILER_WITH_PATH)
- set(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_WITH_PATH}
- CACHE STRING "Fortran compiler" FORCE)
- endif()
- endif()
+ _cmake_find_compiler_path(Fortran)
endif()
mark_as_advanced(CMAKE_Fortran_COMPILER)
# Each entry in this list is a set of extra flags to try
# adding to the compile line to see if it helps produce
# a valid identification executable.
+ set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS_FIRST
+ # Get verbose output to help distinguish compilers.
+ "-v"
+ )
set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS
# Try compiling to an object file only.
"-c"
@@ -138,6 +117,10 @@ endif()
if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
set(CMAKE_Fortran_COMPILER_ID_RUN 1)
+ # Table of per-vendor compiler output regular expressions.
+ list(APPEND CMAKE_Fortran_COMPILER_ID_MATCH_VENDORS CCur)
+ set(CMAKE_Fortran_COMPILER_ID_MATCH_VENDOR_REGEX_CCur "Concurrent Fortran [0-9]+ Compiler")
+
# Table of per-vendor compiler id flags with expected output.
list(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq)
set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what")
@@ -146,6 +129,55 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V")
set(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler")
+ # Match the link line from xcodebuild output of the form
+ # Ld ...
+ # ...
+ # /path/to/cc ...CompilerIdFortran/...
+ # to extract the compiler front-end for the language.
+ set(CMAKE_Fortran_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdFortran/(\\./)?(CompilerIdFortran.xctest/)?CompilerIdFortran[ \t\n\\\"]")
+ set(CMAKE_Fortran_COMPILER_ID_TOOL_MATCH_INDEX 2)
+
+ set(_version_info "")
+ foreach(m MAJOR MINOR PATCH TWEAK)
+ set(_COMP "_${m}")
+ set(_version_info "${_version_info}
+#if defined(COMPILER_VERSION${_COMP})")
+ foreach(d 1 2 3 4 5 6 7 8)
+ set(_version_info "${_version_info}
+# undef DEC
+# undef HEX
+# define DEC(n) DEC_${d}(n)
+# define HEX(n) HEX_${d}(n)
+# if COMPILER_VERSION${_COMP} == 0
+ PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[0]'
+# elif COMPILER_VERSION${_COMP} == 1
+ PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[1]'
+# elif COMPILER_VERSION${_COMP} == 2
+ PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[2]'
+# elif COMPILER_VERSION${_COMP} == 3
+ PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[3]'
+# elif COMPILER_VERSION${_COMP} == 4
+ PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[4]'
+# elif COMPILER_VERSION${_COMP} == 5
+ PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[5]'
+# elif COMPILER_VERSION${_COMP} == 6
+ PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[6]'
+# elif COMPILER_VERSION${_COMP} == 7
+ PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[7]'
+# elif COMPILER_VERSION${_COMP} == 8
+ PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[8]'
+# elif COMPILER_VERSION${_COMP} == 9
+ PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[9]'
+# endif
+")
+ endforeach()
+ set(_version_info "${_version_info}
+#endif")
+ endforeach()
+ set(CMAKE_Fortran_COMPILER_ID_VERSION_INFO "${_version_info}")
+ unset(_version_info)
+ unset(_COMP)
+
# Try to identify the compiler.
set(CMAKE_Fortran_COMPILER_ID)
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
@@ -157,7 +189,7 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
ARGS ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\""
OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
if(NOT CMAKE_COMPILER_RETURN)
- if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
+ if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_GNU")
set(CMAKE_Fortran_COMPILER_ID "GNU")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the Fortran compiler is GNU succeeded with "
@@ -168,10 +200,10 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
"the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
endif()
if(NOT CMAKE_Fortran_PLATFORM_ID)
- if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" )
+ if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_MINGW")
set(CMAKE_Fortran_PLATFORM_ID "MinGW")
endif()
- if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
+ if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_CYGWIN")
set(CMAKE_Fortran_PLATFORM_ID "Cygwin")
endif()
endif()
@@ -179,12 +211,12 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
endif()
# Set old compiler and platform id variables.
- if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+ if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_COMPILER_IS_GNUG77 1)
endif()
- if("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "MinGW")
+ if(CMAKE_Fortran_PLATFORM_ID MATCHES "MinGW")
set(CMAKE_COMPILER_IS_MINGW 1)
- elseif("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "Cygwin")
+ elseif(CMAKE_Fortran_PLATFORM_ID MATCHES "Cygwin")
set(CMAKE_COMPILER_IS_CYGWIN 1)
endif()
endif()
@@ -197,12 +229,12 @@ endif ()
# e.g. powerpc-linux-gfortran, arm-elf-gfortran or i586-mingw32msvc-gfortran , optionally
# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2).
# The other tools of the toolchain usually have the same prefix
-# NAME_WE cannot be used since then this test will fail for names lile
+# NAME_WE cannot be used since then this test will fail for names like
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
- if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+ if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)g?fortran(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
@@ -226,6 +258,6 @@ endif()
# configure variables set in this file for fast reload later on
configure_file(${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake
- @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ @ONLY
)
set(CMAKE_Fortran_COMPILER_ENV_VAR "FC")
diff --git a/Modules/CMakeDetermineJavaCompiler.cmake b/Modules/CMakeDetermineJavaCompiler.cmake
index ae9f5fcaf..f6578016a 100644
--- a/Modules/CMakeDetermineJavaCompiler.cmake
+++ b/Modules/CMakeDetermineJavaCompiler.cmake
@@ -18,7 +18,7 @@
if(NOT CMAKE_Java_COMPILER)
# prefer the environment variable CC
- if($ENV{JAVA_COMPILER} MATCHES ".+")
+ if(NOT $ENV{JAVA_COMPILER} STREQUAL "")
get_filename_component(CMAKE_Java_COMPILER_INIT $ENV{JAVA_COMPILER} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
if(CMAKE_Java_FLAGS_ENV_INIT)
set(CMAKE_Java_COMPILER_ARG1 "${CMAKE_Java_FLAGS_ENV_INIT}" CACHE STRING "First argument to Java compiler")
@@ -28,14 +28,14 @@ if(NOT CMAKE_Java_COMPILER)
endif()
endif()
- if($ENV{JAVA_RUNTIME} MATCHES ".+")
+ if(NOT $ENV{JAVA_RUNTIME} STREQUAL "")
get_filename_component(CMAKE_Java_RUNTIME_INIT $ENV{JAVA_RUNTIME} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
if(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT})
message(SEND_ERROR "Could not find compiler set in environment variable JAVA_RUNTIME:\n$ENV{JAVA_RUNTIME}.")
endif()
endif()
- if($ENV{JAVA_ARCHIVE} MATCHES ".+")
+ if(NOT $ENV{JAVA_ARCHIVE} STREQUAL "")
get_filename_component(CMAKE_Java_ARCHIVE_INIT $ENV{JAVA_ARCHIVE} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
if(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT})
message(SEND_ERROR "Could not find compiler set in environment variable JAVA_ARCHIVE:\n$ENV{JAVA_ARCHIVE}.")
@@ -100,5 +100,5 @@ mark_as_advanced(CMAKE_Java_COMPILER)
# configure variables set in this file for fast reload later on
configure_file(${CMAKE_ROOT}/Modules/CMakeJavaCompiler.cmake.in
- ${CMAKE_PLATFORM_INFO_DIR}/CMakeJavaCompiler.cmake IMMEDIATE @ONLY)
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeJavaCompiler.cmake @ONLY)
set(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER")
diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake
index c4600c7fe..e5414eb99 100644
--- a/Modules/CMakeDetermineRCCompiler.cmake
+++ b/Modules/CMakeDetermineRCCompiler.cmake
@@ -20,7 +20,7 @@
# as a default compiler
if(NOT CMAKE_RC_COMPILER)
# prefer the environment variable RC
- if($ENV{RC} MATCHES ".+")
+ if(NOT $ENV{RC} STREQUAL "")
get_filename_component(CMAKE_RC_COMPILER_INIT $ENV{RC} PROGRAM PROGRAM_ARGS CMAKE_RC_FLAGS_ENV_INIT)
if(CMAKE_RC_FLAGS_ENV_INIT)
set(CMAKE_RC_COMPILER_ARG1 "${CMAKE_RC_FLAGS_ENV_INIT}" CACHE STRING "First argument to RC compiler")
@@ -63,5 +63,5 @@ endif()
# configure variables set in this file for fast reload later on
configure_file(${CMAKE_ROOT}/Modules/CMakeRCCompiler.cmake.in
- ${CMAKE_PLATFORM_INFO_DIR}/CMakeRCCompiler.cmake IMMEDIATE)
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeRCCompiler.cmake)
set(CMAKE_RC_COMPILER_ENV_VAR "RC")
diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake
new file mode 100644
index 000000000..bff1ae9cd
--- /dev/null
+++ b/Modules/CMakeDetermineSwiftCompiler.cmake
@@ -0,0 +1,53 @@
+
+#=============================================================================
+# Copyright 2002-2015 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
+
+if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
+ if(XCODE_VERSION VERSION_LESS 6.1)
+ message(FATAL_ERROR "Swift language not supported by Xcode ${XCODE_VERSION}")
+ endif()
+ set(CMAKE_Swift_COMPILER_XCODE_TYPE sourcecode.swift)
+ _cmake_find_compiler_path(Swift)
+else()
+ message(FATAL_ERROR "Swift language not supported by \"${CMAKE_GENERATOR}\" generator")
+endif()
+
+# Build a small source file to identify the compiler.
+if(NOT CMAKE_Swift_COMPILER_ID_RUN)
+ set(CMAKE_Swift_COMPILER_ID_RUN 1)
+
+ list(APPEND CMAKE_Swift_COMPILER_ID_MATCH_VENDORS Apple)
+ set(CMAKE_Swift_COMPILER_ID_MATCH_VENDOR_REGEX_Apple "com.apple.xcode.tools.swift.compiler")
+
+ set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_REGEX "\nCompileSwiftSources[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]* -c[^\r\n]*CompilerIdSwift/CompilerId/main.swift")
+ set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_INDEX 2)
+
+ # Try to identify the compiler.
+ set(CMAKE_Swift_COMPILER_ID)
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
+ CMAKE_DETERMINE_COMPILER_ID(Swift "" CompilerId/main.swift)
+endif()
+
+if (NOT _CMAKE_TOOLCHAIN_LOCATION)
+ get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Swift_COMPILER}" PATH)
+endif ()
+
+include(CMakeFindBinUtils)
+
+# configure variables set in this file for fast reload later on
+configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake
+ @ONLY
+ )
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index 3a95d2a6f..d9f7579e3 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -47,9 +47,14 @@ if(CMAKE_HOST_UNIX)
if(CMAKE_UNAME)
exec_program(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME)
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
- if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*")
+ if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin|^GNU$")
exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val)
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND
+ CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "Power Macintosh")
+ # OS X ppc 'uname -m' may report 'Power Macintosh' instead of 'powerpc'
+ set(CMAKE_HOST_SYSTEM_PROCESSOR "powerpc")
+ endif()
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD")
exec_program(arch ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val)
@@ -67,8 +72,8 @@ if(CMAKE_HOST_UNIX)
endif()
set(CMAKE_UNAME ${CMAKE_UNAME} CACHE INTERNAL "uname command")
# processor may have double quote in the name, and that needs to be removed
- string(REGEX REPLACE "\"" "" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
- string(REGEX REPLACE "/" "_" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
+ string(REPLACE "\"" "" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
+ string(REPLACE "/" "_" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
endif()
else()
if(CMAKE_HOST_WIN32)
@@ -118,7 +123,9 @@ elseif(CMAKE_VS_WINCE_VERSION)
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
else()
set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
- set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
+ if(NOT DEFINED CMAKE_SYSTEM_VERSION)
+ set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
+ endif()
set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
set(CMAKE_CROSSCOMPILING FALSE)
set(PRESET_CMAKE_SYSTEM_NAME FALSE)
@@ -174,13 +181,13 @@ if(CMAKE_BINARY_DIR)
# if a toolchain file is used, it needs to be included in the configured file,
# so settings done there are also available if they don't go in the cache and in try_compile()
set(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED)
- if(DEFINED CMAKE_TOOLCHAIN_FILE)
+ if(CMAKE_TOOLCHAIN_FILE)
set(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED "include(\"${CMAKE_TOOLCHAIN_FILE}\")")
endif()
# configure variables set in this file for fast reload, the template file is defined at the top of this file
configure_file(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeSystem.cmake
- IMMEDIATE @ONLY)
+ @ONLY)
endif()
diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake
index f49482e7f..688608479 100644
--- a/Modules/CMakeDetermineVSServicePack.cmake
+++ b/Modules/CMakeDetermineVSServicePack.cmake
@@ -1,22 +1,32 @@
-# - Determine the Visual Studio service pack of the 'cl' in use.
-# The functionality of this module has been superseded by the platform
-# variable CMAKE_<LANG>_COMPILER_VERSION that contains the compiler version
-# number.
+#.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()
#
-# 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
+# following values or an empty string if unknown::
+#
+# vc80, vc80sp1
+# vc90, vc90sp1
+# vc100, vc100sp1
+# vc110, vc110sp1, vc110sp2, vc110sp3, vc110sp4
#=============================================================================
# Copyright 2009-2013 Kitware, Inc.
@@ -33,6 +43,13 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.8)
+ message(DEPRECATION
+ "This module is deprecated and should not be used. "
+ "Use the CMAKE_<LANG>_COMPILER_VERSION variable instead."
+ )
+endif()
+
# [INTERNAL]
# Please do not call this function directly
function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version)
@@ -56,6 +73,8 @@ function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version)
set(_version "vc110sp2")
elseif(${_cl_version} VERSION_EQUAL "17.00.60610.1")
set(_version "vc110sp3")
+ elseif(${_cl_version} VERSION_EQUAL "17.00.61030")
+ set(_version "vc110sp4")
else()
set(_version "")
endif()
@@ -74,27 +93,14 @@ function(_DetermineVSServicePack_FastCheckVersionWithCompiler _SUCCESS_VAR _VER
OUTPUT_QUIET
)
- string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+"
- _cl_version "${_output}")
-
- if(_cl_version)
- string(REGEX MATCHALL "[0-9]+"
- _cl_version_list "${_cl_version}")
- list(GET _cl_version_list 0 _major)
- list(GET _cl_version_list 1 _minor)
- list(GET _cl_version_list 2 _patch)
- list(GET _cl_version_list 3 _tweak)
-
+ if(_output MATCHES "Compiler Version (([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\.([0-9]+))?)")
+ set(_cl_version ${CMAKE_MATCH_1})
+ set(_major ${CMAKE_MATCH_2})
+ set(_minor ${CMAKE_MATCH_3})
if("${_major}${_minor}" STREQUAL "${MSVC_VERSION}")
- set(_cl_version ${_major}.${_minor}.${_patch}.${_tweak})
- else()
- unset(_cl_version)
- endif()
- endif()
-
- if(_cl_version)
set(${_SUCCESS_VAR} true PARENT_SCOPE)
set(${_VERSION_VAR} ${_cl_version} PARENT_SCOPE)
+ endif()
endif()
endif()
endfunction()
@@ -115,20 +121,9 @@ function(_DetermineVSServicePack_CheckVersionWithTryCompile _SUCCESS_VAR _VERSI
file(REMOVE "${CMAKE_BINARY_DIR}/return0.cc")
- string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+"
- _cl_version "${_output}")
-
- if(_cl_version)
- string(REGEX MATCHALL "[0-9]+"
- _cl_version_list "${_cl_version}")
-
- list(GET _cl_version_list 0 _major)
- list(GET _cl_version_list 1 _minor)
- list(GET _cl_version_list 2 _patch)
- list(GET _cl_version_list 3 _tweak)
-
+ if(_output MATCHES "Compiler Version (([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\.([0-9]+))?)")
set(${_SUCCESS_VAR} true PARENT_SCOPE)
- set(${_VERSION_VAR} ${_major}.${_minor}.${_patch}.${_tweak} PARENT_SCOPE)
+ set(${_VERSION_VAR} "${CMAKE_MATCH_1}" PARENT_SCOPE)
endif()
endfunction()
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index f5c009cad..28f2e468d 100644
--- a/Modules/CMakeExpandImportedTargets.cmake
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -1,19 +1,38 @@
-# CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN
-# [CONFIGURATION <config>] )
+#.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}.
-# This macro is used by all Check*.cmake files which use
-# try_compile() or try_run() and support CMAKE_REQUIRED_LIBRARIES , so that
-# these checks support imported targets in CMAKE_REQUIRED_LIBRARIES:
-# cmake_expand_imported_targets(expandedLibs LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
-# CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" )
+# 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}" )
#=============================================================================
@@ -63,7 +82,11 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
set(_CCSR_NEW_REQ_LIBS )
set(_CHECK_FOR_IMPORTED_TARGETS FALSE)
foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
- get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+ if(TARGET "${_CURRENT_LIB}")
+ get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+ else()
+ set(_importedConfigs "")
+ endif()
if (_importedConfigs)
# message(STATUS "Detected imported target ${_CURRENT_LIB}")
# Ok, so this is an imported target.
@@ -115,7 +138,11 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
# all remaining imported target names (there shouldn't be any left anyway).
set(_CCSR_NEW_REQ_LIBS )
foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
- get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+ if(TARGET "${_CURRENT_LIB}")
+ get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+ else()
+ set(_importedConfigs "")
+ endif()
if (NOT _importedConfigs)
list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" )
# message(STATUS "final: appending ${_CURRENT_LIB}")
diff --git a/Modules/CMakeExportBuildSettings.cmake b/Modules/CMakeExportBuildSettings.cmake
index a18f95062..a8dd8c282 100644
--- a/Modules/CMakeExportBuildSettings.cmake
+++ b/Modules/CMakeExportBuildSettings.cmake
@@ -27,9 +27,9 @@ endif()
# loaded by another project using CMAKE_IMPORT_BUILD_SETTINGS. Now it
# creates a file that refuses to load (with comment explaining why).
macro(CMAKE_EXPORT_BUILD_SETTINGS SETTINGS_FILE)
- if(${SETTINGS_FILE} MATCHES ".+")
+ if(NOT ${SETTINGS_FILE} STREQUAL "")
configure_file(${CMAKE_ROOT}/Modules/CMakeBuildSettings.cmake.in
- ${SETTINGS_FILE} @ONLY IMMEDIATE)
+ ${SETTINGS_FILE} @ONLY)
else()
message(SEND_ERROR "CMAKE_EXPORT_BUILD_SETTINGS called with no argument.")
endif()
diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
index 365d381ef..3bfb876f1 100644
--- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
+++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
@@ -26,11 +26,18 @@ macro(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines
if (${_lang} STREQUAL "c++")
set(_compilerExecutable "${CMAKE_CXX_COMPILER}")
set(_arg1 "${CMAKE_CXX_COMPILER_ARG1}")
+
+ if (CMAKE_CXX_FLAGS MATCHES "(-stdlib=[^ ]+)")
+ set(_stdlib "${CMAKE_MATCH_1}")
+ endif ()
+ if (CMAKE_CXX_FLAGS MATCHES "(-std=[^ ]+)")
+ set(_stdver "${CMAKE_MATCH_1}")
+ endif ()
else ()
set(_compilerExecutable "${CMAKE_C_COMPILER}")
set(_arg1 "${CMAKE_C_COMPILER_ARG1}")
endif ()
- execute_process(COMMAND ${_compilerExecutable} ${_arg1} -v -E -x ${_lang} -dD dummy
+ execute_process(COMMAND ${_compilerExecutable} ${_arg1} ${_stdver} ${_stdlib} -v -E -x ${_lang} -dD dummy
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles
ERROR_VARIABLE _gccOutput
OUTPUT_VARIABLE _gccStdout )
@@ -90,10 +97,12 @@ set(ENV{LANG} C)
# Now check for C, works for gcc and Intel compiler at least
if (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS)
- if ("${CMAKE_C_COMPILER_ID}" MATCHES GNU OR "${CMAKE_C_COMPILER_ID}" MATCHES Intel OR "${CMAKE_C_COMPILER_ID}" MATCHES Clang)
+ if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES Intel OR CMAKE_C_COMPILER_ID MATCHES Clang)
_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs _defines)
set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories")
set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "C compiler system defined macros")
+ elseif ("${CMAKE_C_COMPILER_ID}" MATCHES MSVC)
+ set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "$ENV{INCLUDE}" CACHE INTERNAL "C compiler system include directories")
endif ()
endif ()
@@ -103,6 +112,8 @@ if (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS)
_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c++ _dirs _defines)
set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories")
set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "CXX compiler system defined macros")
+ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES MSVC)
+ set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "$ENV{INCLUDE}" CACHE INTERNAL "CXX compiler system include directories")
endif ()
endif ()
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index e70c013be..376a6dcf7 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -30,9 +30,13 @@
# License text for the above reference.)
# if it's the MS C/CXX compiler, search for link
-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
- OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
- OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
+if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
+ OR (CMAKE_GENERATOR MATCHES "Visual Studio"
+ AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
@@ -40,7 +44,12 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
# in all other cases search for ar, ranlib, etc.
else()
-
+ if(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN)
+ set(_CMAKE_TOOLCHAIN_LOCATION ${_CMAKE_TOOLCHAIN_LOCATION} ${CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN}/bin)
+ endif()
+ if(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
+ set(_CMAKE_TOOLCHAIN_LOCATION ${_CMAKE_TOOLCHAIN_LOCATION} ${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}/bin)
+ endif()
find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar${_CMAKE_TOOLCHAIN_SUFFIX} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
@@ -58,9 +67,7 @@ else()
endif()
-
-# on Apple there really should be install_name_tool
-if(APPLE)
+if(CMAKE_PLATFORM_HAS_INSTALLNAME)
find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
if(NOT CMAKE_INSTALL_NAME_TOOL)
diff --git a/Modules/CMakeFindDependencyMacro.cmake b/Modules/CMakeFindDependencyMacro.cmake
new file mode 100644
index 000000000..73efaae7c
--- /dev/null
+++ b/Modules/CMakeFindDependencyMacro.cmake
@@ -0,0 +1,85 @@
+#.rst:
+# CMakeFindDependencyMacro
+# -------------------------
+#
+# ::
+#
+# find_dependency(<dep> [<version> [EXACT]])
+#
+#
+# ``find_dependency()`` wraps a :command:`find_package` call for a package
+# dependency. It is designed to be used in a <package>Config.cmake file, and it
+# forwards the correct parameters for EXACT, QUIET and REQUIRED which were
+# passed to the original :command:`find_package` call. It also sets an
+# informative diagnostic message if the dependency could not be found.
+#
+
+#=============================================================================
+# Copyright 2013 Stephen Kelly <steveire@gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+macro(find_dependency dep)
+ if (NOT ${dep}_FOUND)
+ set(cmake_fd_version)
+ if (${ARGC} GREATER 1)
+ if ("${ARGV1}" STREQUAL "")
+ message(FATAL_ERROR "Invalid arguments to find_dependency. VERSION is empty")
+ endif()
+ if ("${ARGV1}" STREQUAL EXACT)
+ message(FATAL_ERROR "Invalid arguments to find_dependency. EXACT may only be specified if a VERSION is specified")
+ endif()
+ set(cmake_fd_version ${ARGV1})
+ endif()
+ set(cmake_fd_exact_arg)
+ if(${ARGC} GREATER 2)
+ if (NOT "${ARGV2}" STREQUAL EXACT)
+ message(FATAL_ERROR "Invalid arguments to find_dependency")
+ endif()
+ set(cmake_fd_exact_arg EXACT)
+ endif()
+ if(${ARGC} GREATER 3)
+ message(FATAL_ERROR "Invalid arguments to find_dependency")
+ endif()
+ set(cmake_fd_quiet_arg)
+ if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
+ set(cmake_fd_quiet_arg QUIET)
+ endif()
+ set(cmake_fd_required_arg)
+ if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
+ set(cmake_fd_required_arg REQUIRED)
+ endif()
+
+ get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY
+ _CMAKE_${dep}_TRANSITIVE_DEPENDENCY
+ )
+
+ find_package(${dep} ${cmake_fd_version}
+ ${cmake_fd_exact_arg}
+ ${cmake_fd_quiet_arg}
+ ${cmake_fd_required_arg}
+ )
+
+ if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_alreadyTransitive)
+ set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE)
+ endif()
+
+ if (NOT ${dep}_FOUND)
+ set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.")
+ set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
+ return()
+ endif()
+ set(cmake_fd_version)
+ set(cmake_fd_required_arg)
+ set(cmake_fd_quiet_arg)
+ set(cmake_fd_exact_arg)
+ endif()
+endmacro()
diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake
index ae174544b..85c1fdf5b 100644
--- a/Modules/CMakeFindEclipseCDT4.cmake
+++ b/Modules/CMakeFindEclipseCDT4.cmake
@@ -19,18 +19,6 @@ find_program(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable"
function(_FIND_ECLIPSE_VERSION)
# This code is in a function so the variables used here have only local scope
- if(CMAKE_ECLIPSE_EXECUTABLE)
- # use REALPATH to resolve symlinks (http://public.kitware.com/Bug/view.php?id=13036)
- get_filename_component(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH)
- get_filename_component(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH)
- file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*")
- if(APPLE AND NOT _ECLIPSE_FEATURE_DIR)
- file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/../../../features/org.eclipse.platform*")
- endif()
- if("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+")
- set(_ECLIPSE_VERSION ${CMAKE_MATCH_1})
- endif()
- endif()
# Set up a map with the names of the Eclipse releases:
set(_ECLIPSE_VERSION_NAME_ "Unknown" )
@@ -41,15 +29,34 @@ function(_FIND_ECLIPSE_VERSION)
set(_ECLIPSE_VERSION_NAME_3.6 "Helios" )
set(_ECLIPSE_VERSION_NAME_3.7 "Indigo" )
set(_ECLIPSE_VERSION_NAME_4.2 "Juno" )
+ set(_ECLIPSE_VERSION_NAME_4.3 "Kepler" )
+
+ if(NOT DEFINED CMAKE_ECLIPSE_VERSION)
+ if(CMAKE_ECLIPSE_EXECUTABLE)
+ # use REALPATH to resolve symlinks (http://public.kitware.com/Bug/view.php?id=13036)
+ get_filename_component(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH)
+ get_filename_component(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH)
+ file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*")
+ if(APPLE AND NOT _ECLIPSE_FEATURE_DIR)
+ file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/../../../features/org.eclipse.platform*")
+ endif()
+ if("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+")
+ set(_ECLIPSE_VERSION ${CMAKE_MATCH_1})
+ endif()
+ endif()
+
+ if(_ECLIPSE_VERSION)
+ message(STATUS "Found Eclipse version ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})")
+ else()
+ set(_ECLIPSE_VERSION "3.6" )
+ message(STATUS "Could not determine Eclipse version, assuming at least ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}}). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.")
+ endif()
- if(_ECLIPSE_VERSION)
- message(STATUS "Found Eclipse version ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})")
+ set(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.")
else()
- set(_ECLIPSE_VERSION "3.6" )
- message(STATUS "Could not determine Eclipse version, assuming at least ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}}). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.")
+ message(STATUS "Eclipse version is set to ${CMAKE_ECLIPSE_VERSION}. Adjust CMAKE_ECLIPSE_VERSION if this is wrong.")
endif()
- set(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.")
set_property(CACHE CMAKE_ECLIPSE_VERSION PROPERTY STRINGS "3.2 (${_ECLIPSE_VERSION_NAME_3.2})"
"3.3 (${_ECLIPSE_VERSION_NAME_3.3})"
"3.4 (${_ECLIPSE_VERSION_NAME_3.4})"
@@ -57,20 +64,21 @@ function(_FIND_ECLIPSE_VERSION)
"3.6 (${_ECLIPSE_VERSION_NAME_3.6})"
"3.7 (${_ECLIPSE_VERSION_NAME_3.7})"
"4.2 (${_ECLIPSE_VERSION_NAME_4.2})"
+ "4.3 (${_ECLIPSE_VERSION_NAME_4.3})"
)
endfunction()
-_FIND_ECLIPSE_VERSION()
+_find_eclipse_version()
# Try to find out how many CPUs we have and set the -j argument for make accordingly
set(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "")
include(ProcessorCount)
-PROCESSORCOUNT(_CMAKE_ECLIPSE_PROCESSOR_COUNT)
+processorcount(_CMAKE_ECLIPSE_PROCESSOR_COUNT)
# Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name
# (we may also get here in the future e.g. for ninja)
-if("${_CMAKE_ECLIPSE_PROCESSOR_COUNT}" GREATER 1 AND UNIX AND "${CMAKE_MAKE_PROGRAM}" MATCHES make)
+if("${_CMAKE_ECLIPSE_PROCESSOR_COUNT}" GREATER 1 AND CMAKE_HOST_UNIX AND "${CMAKE_MAKE_PROGRAM}" MATCHES make)
set(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "-j${_CMAKE_ECLIPSE_PROCESSOR_COUNT}")
endif()
diff --git a/Modules/CMakeFindFrameworks.cmake b/Modules/CMakeFindFrameworks.cmake
index 7fdeb84be..6a8bcd454 100644
--- a/Modules/CMakeFindFrameworks.cmake
+++ b/Modules/CMakeFindFrameworks.cmake
@@ -1,4 +1,8 @@
-# - helper module to find OSX frameworks
+#.rst:
+# CMakeFindFrameworks
+# -------------------
+#
+# helper module to find OSX frameworks
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
diff --git a/Modules/CMakeFindJavaCommon.cmake b/Modules/CMakeFindJavaCommon.cmake
new file mode 100644
index 000000000..fcf038970
--- /dev/null
+++ b/Modules/CMakeFindJavaCommon.cmake
@@ -0,0 +1,41 @@
+
+#=============================================================================
+# Copyright 2013-2014 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Do not include this module directly from code outside CMake!
+set(_JAVA_HOME "")
+if(JAVA_HOME AND IS_DIRECTORY "${JAVA_HOME}")
+ set(_JAVA_HOME "${JAVA_HOME}")
+ set(_JAVA_HOME_EXPLICIT 1)
+else()
+ set(_ENV_JAVA_HOME "")
+ if(DEFINED ENV{JAVA_HOME})
+ file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _ENV_JAVA_HOME)
+ endif()
+ if(_ENV_JAVA_HOME AND IS_DIRECTORY "${_ENV_JAVA_HOME}")
+ set(_JAVA_HOME "${_ENV_JAVA_HOME}")
+ set(_JAVA_HOME_EXPLICIT 1)
+ else()
+ set(_CMD_JAVA_HOME "")
+ if(APPLE AND EXISTS /usr/libexec/java_home)
+ execute_process(COMMAND /usr/libexec/java_home
+ OUTPUT_VARIABLE _CMD_JAVA_HOME OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+ if(_CMD_JAVA_HOME AND IS_DIRECTORY "${_CMD_JAVA_HOME}")
+ set(_JAVA_HOME "${_CMD_JAVA_HOME}")
+ set(_JAVA_HOME_EXPLICIT 0)
+ endif()
+ unset(_CMD_JAVA_HOME)
+ endif()
+ unset(_ENV_JAVA_HOME)
+endif()
diff --git a/Modules/CMakeFindKate.cmake b/Modules/CMakeFindKate.cmake
new file mode 100644
index 000000000..4dcdb2841
--- /dev/null
+++ b/Modules/CMakeFindKate.cmake
@@ -0,0 +1,31 @@
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# This file is included in CMakeSystemSpecificInformation.cmake if
+# the Eclipse CDT4 extra generator has been selected.
+
+
+# Try to find out how many CPUs we have and set the -j argument for make accordingly
+
+include(ProcessorCount)
+processorcount(_CMAKE_KATE_PROCESSOR_COUNT)
+
+# Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name
+# (we may also get here in the future e.g. for ninja)
+if("${_CMAKE_KATE_PROCESSOR_COUNT}" GREATER 1 AND CMAKE_HOST_UNIX AND "${CMAKE_MAKE_PROGRAM}" MATCHES make)
+ set(_CMAKE_KATE_INITIAL_MAKE_ARGS "-j${_CMAKE_KATE_PROCESSOR_COUNT}")
+endif()
+
+# This variable is used by the Eclipse generator and appended to the make invocation commands.
+set(CMAKE_KATE_MAKE_ARGUMENTS "${_CMAKE_KATE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Kate invokes make. Enter e.g. -j<some_number> to get parallel builds")
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
index e5216f4e0..26731dc6e 100644
--- a/Modules/CMakeFindPackageMode.cmake
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -1,12 +1,30 @@
-# 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/Fortan/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/Fortan/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
#=============================================================================
# Copyright 2006-2011 Alexander Neundorf, <neundorf@kde.org>
@@ -84,15 +102,18 @@ if(UNIX)
# guess Debian multiarch if it has not been set:
if(EXISTS /etc/debian_version)
- if(NOT CMAKE_${LANGUAGE}_LANGUAGE_ARCHITECTURE )
+ if(NOT CMAKE_${LANGUAGE}_LIBRARY_ARCHITECTURE )
file(GLOB filesInLib RELATIVE /lib /lib/*-linux-gnu* )
foreach(file ${filesInLib})
if("${file}" MATCHES "${CMAKE_LIBRARY_ARCHITECTURE_REGEX}")
- set(CMAKE_${LANGUAGE}_LANGUAGE_ARCHITECTURE ${file})
+ set(CMAKE_${LANGUAGE}_LIBRARY_ARCHITECTURE ${file})
break()
endif()
endforeach()
endif()
+ if(NOT CMAKE_LIBRARY_ARCHITECTURE)
+ set(CMAKE_LIBRARY_ARCHITECTURE ${CMAKE_${LANGUAGE}_LIBRARY_ARCHITECTURE})
+ endif()
endif()
endif()
diff --git a/Modules/CMakeFindXCode.cmake b/Modules/CMakeFindXCode.cmake
index 5c4f59639..da0b97b0d 100644
--- a/Modules/CMakeFindXCode.cmake
+++ b/Modules/CMakeFindXCode.cmake
@@ -12,9 +12,5 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-find_program(CMAKE_MAKE_PROGRAM
- NAMES xcodebuild
- PATHS
- /usr/bin
- )
-mark_as_advanced(CMAKE_MAKE_PROGRAM)
+# Empty placeholder for input dependencies in existing
+# build trees produced by older versions of CMake.
diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake
index 207c8ad35..faa0dc58c 100644
--- a/Modules/CMakeForceCompiler.cmake
+++ b/Modules/CMakeForceCompiler.cmake
@@ -1,33 +1,68 @@
-# This module defines macros intended for use by cross-compiling
-# toolchain files when CMake is not able to automatically detect the
-# compiler identification.
+#.rst:
+# CMakeForceCompiler
+# ------------------
+#
+# Discouraged. Avoid using this module if possible. It will be deprecated
+# by a future version of CMake once alternatives have been provided for all
+# toolchain file use cases.
+#
+# 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.
+#
+# The only known remaining use case for these macros is to write toolchain
+# files for cross-compilers that cannot link binaries without special flags or
+# custom linker scripts. These macros cause CMake to skip checks it normally
+# performs as part of enabling a language and introspecting the toolchain.
+# However, skipping these checks may limit some generation functionality.
+#
+# -------------------------------------------------------------------------
#
# 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.
+#
+# ::
+#
+# 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>)
+#
+# ::
+#
+# 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
+# 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>)
+#
+# ::
+#
+# 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)
+#
+# ::
+#
+# include (CMakeForceCompiler)
+# set(CMAKE_SYSTEM_NAME Generic)
+# CMAKE_FORCE_C_COMPILER (chc12 MetrowerksHicross)
+# CMAKE_FORCE_CXX_COMPILER (chc12 MetrowerksHicross)
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -49,7 +84,7 @@ macro(CMAKE_FORCE_C_COMPILER compiler id)
set(CMAKE_C_COMPILER_FORCED TRUE)
# Set old compiler id variables.
- if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+ if(CMAKE_C_COMPILER_ID MATCHES "GNU")
set(CMAKE_COMPILER_IS_GNUCC 1)
endif()
endmacro()
@@ -73,7 +108,7 @@ macro(CMAKE_FORCE_Fortran_COMPILER compiler id)
set(CMAKE_Fortran_COMPILER_FORCED TRUE)
# Set old compiler id variables.
- if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+ if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_COMPILER_IS_GNUG77 1)
endif()
endmacro()
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in
index d193881d9..2a4bea494 100644
--- a/Modules/CMakeFortranCompiler.cmake.in
+++ b/Modules/CMakeFortranCompiler.cmake.in
@@ -1,7 +1,11 @@
set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@")
set(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@")
set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@")
+set(CMAKE_Fortran_COMPILER_VERSION "@CMAKE_Fortran_COMPILER_VERSION@")
+set(CMAKE_Fortran_COMPILER_WRAPPER "@CMAKE_Fortran_COMPILER_WRAPPER@")
set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@")
+set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@")
+set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@")
@SET_MSVC_Fortran_ARCHITECTURE_ID@
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
diff --git a/Modules/CMakeFortranCompilerABI.F b/Modules/CMakeFortranCompilerABI.F
index 7e24553fb..b34c28484 100644
--- a/Modules/CMakeFortranCompilerABI.F
+++ b/Modules/CMakeFortranCompilerABI.F
@@ -10,16 +10,24 @@
PRINT *, 'INFO:sizeof_dptr[8]'
#elif defined(_M_AMD64)
PRINT *, 'INFO:sizeof_dptr[8]'
+#elif defined(__x86_64__)
+ PRINT *, 'INFO:sizeof_dptr[8]'
#elif defined(_ILP32)
PRINT *, 'INFO:sizeof_dptr[4]'
#elif defined(_M_IX86)
PRINT *, 'INFO:sizeof_dptr[4]'
+#elif defined(__i386__)
+ PRINT *, 'INFO:sizeof_dptr[4]'
#elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 8
PRINT *, 'INFO:sizeof_dptr[8]'
#elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 4
PRINT *, 'INFO:sizeof_dptr[4]'
+#elif defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__ == 8
+ PRINT *, 'INFO:sizeof_dptr[8]'
+#elif defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__ == 4
+ PRINT *, 'INFO:sizeof_dptr[4]'
#endif
#if 0
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index f84852aeb..67cda3b61 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -4,28 +4,92 @@
#endif
#if defined(__INTEL_COMPILER) || defined(__ICC)
PRINT *, 'INFO:compiler[Intel]'
-#elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95)
+# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
+# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
+# if defined(__INTEL_COMPILER_UPDATE)
+# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+# else
+# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
+# endif
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
+# endif
+
+# if defined(_MSC_VER)
+ PRINT *, 'INFO:simulate[MSVC]'
+# if _MSC_VER >= 1900
+ PRINT *, 'INFO:simulate_version[019.00]'
+# elif _MSC_VER >= 1800
+ PRINT *, 'INFO:simulate_version[018.00]'
+# elif _MSC_VER >= 1700
+ PRINT *, 'INFO:simulate_version[017.00]'
+# elif _MSC_VER >= 1600
+ PRINT *, 'INFO:simulate_version[016.00]'
+# elif _MSC_VER >= 1500
+ PRINT *, 'INFO:simulate_version[015.00]'
+# elif _MSC_VER >= 1400
+ PRINT *, 'INFO:simulate_version[014.00]'
+# elif _MSC_VER >= 1310
+ PRINT *, 'INFO:simulate_version[013.01]'
+# else
+ PRINT *, 'INFO:simulate_version[013.00]'
+# endif
+# endif
+#elif defined(__SUNPRO_F95)
+ PRINT *, 'INFO:compiler[SunPro]'
+# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F95>>8)
+# define COMPILER_VERSION_MINOR HEX(__SUNPRO_F95>>4 & 0xF)
+# define COMPILER_VERSION_PATCH HEX(__SUNPRO_F95 & 0xF)
+#elif defined(__SUNPRO_F90)
PRINT *, 'INFO:compiler[SunPro]'
+# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F90>>8)
+# define COMPILER_VERSION_MINOR HEX(__SUNPRO_F90>>4 & 0xF)
+# define COMPILER_VERSION_PATCH HEX(__SUNPRO_F90 & 0xF)
#elif defined(_CRAYFTN)
PRINT *, 'INFO:compiler[Cray]'
+# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
+# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
#elif defined(__G95__)
PRINT *, 'INFO:compiler[G95]'
+# define COMPILER_VERSION_MAJOR DEC(__G95__)
+# define COMPILER_VERSION_MINOR DEC(__G95_MINOR__)
#elif defined(__PATHSCALE__)
PRINT *, 'INFO:compiler[PathScale]'
+# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
+# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
+# if defined(__PATHCC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
+# endif
#elif defined(__ABSOFT__)
PRINT *, 'INFO:compiler[Absoft]'
#elif defined(__GNUC__)
PRINT *, 'INFO:compiler[GNU]'
+# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
+# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
+# if defined(__GNUC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
+# endif
#elif defined(__IBMC__)
# if defined(__COMPILER_VER__)
PRINT *, 'INFO:compiler[zOS]'
# elif __IBMC__ >= 800
PRINT *, 'INFO:compiler[XL]'
+# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
# else
PRINT *, 'INFO:compiler[VisualAge]'
+# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
# endif
#elif defined(__PGI)
PRINT *, 'INFO:compiler[PGI]'
+# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
+# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
+# if defined(__PGIC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
+# endif
#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
PRINT *, 'INFO:compiler[MIPSpro]'
# if 0
@@ -46,6 +110,9 @@
# endif
PRINT *, 'INFO:compiler[]'
#endif
+#if defined(__CRAYXE) || defined(__CRAYXC)
+ PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]'
+#endif
#if 0
! Identify the platform
@@ -116,4 +183,26 @@
PRINT *, 'INFO:arch[X86]'
# endif
#endif
+
+#if 0
+! Encode compiler version digits
+#endif
+#define DEC_8(n) (((n) / 10000000) % 10)
+#define DEC_7(n) (((n) / 1000000) % 10)
+#define DEC_6(n) (((n) / 100000) % 10)
+#define DEC_5(n) (((n) / 10000) % 10)
+#define DEC_4(n) (((n) / 1000) % 10)
+#define DEC_3(n) (((n) / 100) % 10)
+#define DEC_2(n) (((n) / 10) % 10)
+#define DEC_1(n) (((n) ) % 10)
+#define HEX_8(n) ((n)>>28 & 0xF)
+#define HEX_7(n) ((n)>>24 & 0xF)
+#define HEX_6(n) ((n)>>20 & 0xF)
+#define HEX_5(n) ((n)>>16 & 0xF)
+#define HEX_4(n) ((n)>>12 & 0xF)
+#define HEX_3(n) ((n)>>8 & 0xF)
+#define HEX_2(n) ((n)>>4 & 0xF)
+#define HEX_1(n) ((n) & 0xF)
+@CMAKE_Fortran_COMPILER_ID_VERSION_INFO@
+
END
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index 512ec4864..1fd097235 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -12,6 +12,8 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+include(CMakeLanguageInformation)
+
# This file sets the basic flags for the Fortran language in CMake.
# It also loads the available platform file for the system-compiler
# if it exists.
@@ -24,7 +26,7 @@ if(CMAKE_Fortran_COMPILER_ID)
endif()
set(CMAKE_BASE_NAME)
-get_filename_component(CMAKE_BASE_NAME ${CMAKE_Fortran_COMPILER} NAME_WE)
+get_filename_component(CMAKE_BASE_NAME "${CMAKE_Fortran_COMPILER}" NAME_WE)
# since the gnu compiler has several names force g++
if(CMAKE_COMPILER_IS_GNUG77)
set(CMAKE_BASE_NAME g77)
@@ -36,6 +38,12 @@ if (NOT _INCLUDED_FILE)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL
RESULT_VARIABLE _INCLUDED_FILE)
endif ()
+
+# load any compiler-wrapper specific information
+if (CMAKE_Fortran_COMPILER_WRAPPER)
+ __cmake_include_compiler_wrapper(Fortran)
+endif ()
+
# We specify the compiler information in the system file for some
# platforms, but this language may not have been enabled when the file
# was first included. Include it again to get the language info.
@@ -194,10 +202,10 @@ endif()
# Create a static archive incrementally for large object file counts.
# If CMAKE_Fortran_CREATE_STATIC_LIBRARY is set it will override these.
if(NOT DEFINED CMAKE_Fortran_ARCHIVE_CREATE)
- set(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND)
- set(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH)
set(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
@@ -207,7 +215,7 @@ endif()
# (put -o after -c to workaround bug in at least one mpif77 wrapper)
if(NOT CMAKE_Fortran_COMPILE_OBJECT)
set(CMAKE_Fortran_COMPILE_OBJECT
- "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -c <SOURCE> -o <OBJECT>")
+ "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE> -o <OBJECT>")
endif()
# link a fortran program
@@ -218,7 +226,7 @@ endif()
if(CMAKE_Fortran_STANDARD_LIBRARIES_INIT)
set(CMAKE_Fortran_STANDARD_LIBRARIES "${CMAKE_Fortran_STANDARD_LIBRARIES_INIT}"
- CACHE STRING "Libraries linked by defalut with all Fortran applications.")
+ CACHE STRING "Libraries linked by default with all Fortran applications.")
mark_as_advanced(CMAKE_Fortran_STANDARD_LIBRARIES)
endif()
@@ -226,11 +234,11 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG_INIT}" CACHE STRING
"Flags used by the compiler during debug builds.")
set (CMAKE_Fortran_FLAGS_MINSIZEREL "${CMAKE_Fortran_FLAGS_MINSIZEREL_INIT}" CACHE STRING
- "Flags used by the compiler during release minsize builds.")
+ "Flags used by the compiler during release builds for minimum size.")
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE_INIT}" CACHE STRING
- "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
+ "Flags used by the compiler during release builds.")
set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
- "Flags used by the compiler during Release with Debug Info builds.")
+ "Flags used by the compiler during release builds with debug info.")
endif()
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index 8a14aea60..5ae757d69 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -44,7 +44,7 @@ set (CMAKE_SKIP_INSTALL_RPATH "NO" CACHE BOOL
set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
-if(CMAKE_GENERATOR MATCHES "Makefiles")
+if(CMAKE_GENERATOR MATCHES "Make")
set(CMAKE_COLOR_MAKEFILE ON CACHE BOOL
"Enable/Disable color output during build."
)
@@ -52,6 +52,9 @@ if(CMAKE_GENERATOR MATCHES "Makefiles")
if(DEFINED CMAKE_RULE_MESSAGES)
set_property(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES})
endif()
+ if(DEFINED CMAKE_TARGET_MESSAGES)
+ set_property(GLOBAL PROPERTY TARGET_MESSAGES ${CMAKE_TARGET_MESSAGES})
+ endif()
if(CMAKE_GENERATOR MATCHES "Unix Makefiles")
set(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL
"Enable/Disable output of compile commands during generation."
diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake
index e4af54c0a..ff182672e 100644
--- a/Modules/CMakeGraphVizOptions.cmake
+++ b/Modules/CMakeGraphVizOptions.cmake
@@ -1,72 +1,112 @@
-##section Variables specific to the graphviz support
-##end
-##module
-# - The builtin graphviz support of CMake.
-# CMake can generate graphviz files, showing the dependencies between
-# the targets in a project and also external libraries which are linked
-# against.
-# When CMake is run with the --graphiz=foo 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
-#
-# 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 ${CMAKE_BINARY_DIR} and then in
-# ${CMAKE_SOURCE_DIR}. If found, it is read and the variables set in it
-# are used to adjust options for the generated graphviz files.
-##end
-#
-##variable
-# GRAPHVIZ_GRAPH_TYPE - The graph type
-# Mandatory : NO
-# Default : "digraph"
-##end
-##variable
-# GRAPHVIZ_GRAPH_NAME - The graph name.
-# Mandatory : NO
-# Default : "GG"
-##end
-##variable
-# GRAPHVIZ_GRAPH_HEADER - The header written at the top of the graphviz file.
-# Mandatory : NO
-# Default : "node [n fontsize = "12"];"
-##end
-##variable
-# GRAPHVIZ_NODE_PREFIX - The prefix for each node in the graphviz file.
-# Mandatory : NO
-# Default : "node"
-##end
-##variable
-# GRAPHVIZ_EXECUTABLES - Set this to FALSE to exclude executables from the generated graphs.
-# Mandatory : NO
-# Default : TRUE
-##end
-##variable
-# GRAPHVIZ_STATIC_LIBS - Set this to FALSE to exclude static libraries from the generated graphs.
-# Mandatory : NO
-# Default : TRUE
-##end
-##variable
-# GRAPHVIZ_SHARED_LIBS - Set this to FALSE to exclude shared libraries from the generated graphs.
-# Mandatory : NO
-# Default : TRUE
-##end
-##variable
-# GRAPHVIZ_MODULE_LIBS - Set this to FALSE to exclude static libraries from the generated graphs.
-# Mandatory : NO
-# Default : TRUE
-##end
-##variable
-# GRAPHVIZ_EXTERNAL_LIBS - Set this to FALSE to exclude external libraries from the generated graphs.
-# Mandatory : NO
-# Default : TRUE
-##end
-##variable
-# GRAPHVIZ_IGNORE_TARGETS - A list of regular expressions for ignoring targets.
-# Mandatory : NO
-# Default : empty
-##end
+#.rst:
+# CMakeGraphVizOptions
+# --------------------
+#
+# The builtin graphviz support of CMake.
+#
+# Variables specific to the graphviz support
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# CMake
+# can generate graphviz 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 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
+#
+# 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
+# ${CMAKE_BINARY_DIR} and then in ${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"
+#
+# .. 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
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake
new file mode 100644
index 000000000..1256f563e
--- /dev/null
+++ b/Modules/CMakeIOSInstallCombined.cmake
@@ -0,0 +1,307 @@
+
+#=============================================================================
+# Copyright 2014-2015 Ruslan Baratov, Gregor Jasny
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Function to print messages of this module
+function(_ios_install_combined_message)
+ message("[iOS combined] " ${ARGN})
+endfunction()
+
+# Get build settings for the current target/config/SDK by running
+# `xcodebuild -sdk ... -showBuildSettings` and parsing it's output
+function(_ios_install_combined_get_build_setting sdk variable resultvar)
+ if("${sdk}" STREQUAL "")
+ message(FATAL_ERROR "`sdk` is empty")
+ endif()
+
+ if("${variable}" STREQUAL "")
+ message(FATAL_ERROR "`variable` is empty")
+ endif()
+
+ if("${resultvar}" STREQUAL "")
+ message(FATAL_ERROR "`resultvar` is empty")
+ endif()
+
+ set(
+ cmd
+ xcodebuild -showBuildSettings
+ -sdk "${sdk}"
+ -target "${CURRENT_TARGET}"
+ -config "${CURRENT_CONFIG}"
+ )
+
+ execute_process(
+ COMMAND ${cmd}
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE output
+ )
+
+ if(NOT result EQUAL 0)
+ message(FATAL_ERROR "Command failed (${result}): ${cmd}")
+ endif()
+
+ if(NOT output MATCHES " ${variable} = ([^\n]*)")
+ if("${variable}" STREQUAL "VALID_ARCHS")
+ # VALID_ARCHS may be unset by user for given SDK
+ # (e.g. for build without simulator).
+ set("${resultvar}" "" PARENT_SCOPE)
+ return()
+ else()
+ message(FATAL_ERROR "${variable} not found.")
+ endif()
+ endif()
+
+ set("${resultvar}" "${CMAKE_MATCH_1}" PARENT_SCOPE)
+endfunction()
+
+# Get architectures of given SDK (iphonesimulator/iphoneos)
+function(_ios_install_combined_get_valid_archs sdk resultvar)
+ cmake_policy(SET CMP0007 NEW)
+
+ if("${resultvar}" STREQUAL "")
+ message(FATAL_ERROR "`resultvar` is empty")
+ endif()
+
+ _ios_install_combined_get_build_setting("${sdk}" "VALID_ARCHS" valid_archs)
+
+ separate_arguments(valid_archs)
+ list(REMOVE_ITEM valid_archs "") # remove empty elements
+ list(REMOVE_DUPLICATES valid_archs)
+
+ string(REPLACE ";" " " printable "${valid_archs}")
+ _ios_install_combined_message("Architectures (${sdk}): ${printable}")
+
+ set("${resultvar}" "${valid_archs}" PARENT_SCOPE)
+endfunction()
+
+# Final target can contain more architectures that specified by SDK. This
+# function will run 'lipo -info' and parse output. Result will be returned
+# as a CMake list.
+function(_ios_install_combined_get_real_archs filename resultvar)
+ set(cmd "${_lipo_path}" -info "${filename}")
+ execute_process(
+ COMMAND ${cmd}
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_STRIP_TRAILING_WHITESPACE
+ )
+ if(NOT result EQUAL 0)
+ message(
+ FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}"
+ )
+ endif()
+
+ if(NOT output MATCHES "(Architectures in the fat file: [^\n]+ are|Non-fat file: [^\n]+ is architecture): ([^\n]*)")
+ message(FATAL_ERROR "Could not detect architecture from: ${output}")
+ endif()
+
+ separate_arguments(CMAKE_MATCH_2)
+ set(${resultvar} ${CMAKE_MATCH_2} PARENT_SCOPE)
+endfunction()
+
+# Run build command for the given SDK
+function(_ios_install_combined_build sdk)
+ if("${sdk}" STREQUAL "")
+ message(FATAL_ERROR "`sdk` is empty")
+ endif()
+
+ _ios_install_combined_message("Build `${CURRENT_TARGET}` for `${sdk}`")
+
+ execute_process(
+ COMMAND
+ "${CMAKE_COMMAND}"
+ --build
+ .
+ --target "${CURRENT_TARGET}"
+ --config ${CURRENT_CONFIG}
+ --
+ -sdk "${sdk}"
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ RESULT_VARIABLE result
+ )
+
+ if(NOT result EQUAL 0)
+ message(FATAL_ERROR "Build failed")
+ endif()
+endfunction()
+
+# Remove given architecture from file. This step needed only in rare cases
+# when target was built in "unusual" way. Emit warning message.
+function(_ios_install_combined_remove_arch lib arch)
+ _ios_install_combined_message(
+ "Warning! Unexpected architecture `${arch}` detected and will be removed "
+ "from file `${lib}`")
+ set(cmd "${_lipo_path}" -remove ${arch} -output ${lib} ${lib})
+ execute_process(
+ COMMAND ${cmd}
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_STRIP_TRAILING_WHITESPACE
+ )
+ if(NOT result EQUAL 0)
+ message(
+ FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}"
+ )
+ endif()
+endfunction()
+
+# Check that 'lib' contains only 'archs' architectures (remove others).
+function(_ios_install_combined_keep_archs lib archs)
+ _ios_install_combined_get_real_archs("${lib}" real_archs)
+ set(archs_to_remove ${real_archs})
+ list(REMOVE_ITEM archs_to_remove ${archs})
+ foreach(x ${archs_to_remove})
+ _ios_install_combined_remove_arch("${lib}" "${x}")
+ endforeach()
+endfunction()
+
+function(_ios_install_combined_detect_sdks this_sdk_var corr_sdk_var)
+ cmake_policy(SET CMP0057 NEW)
+
+ set(this_sdk "$ENV{PLATFORM_NAME}")
+ if("${this_sdk}" STREQUAL "")
+ message(FATAL_ERROR "Environment variable PLATFORM_NAME is empty")
+ endif()
+
+ set(all_platforms "$ENV{SUPPORTED_PLATFORMS}")
+ if("${all_platforms}" STREQUAL "")
+ message(FATAL_ERROR "Environment variable SUPPORTED_PLATFORMS is empty")
+ endif()
+
+ separate_arguments(all_platforms)
+ if(NOT this_sdk IN_LIST all_platforms)
+ message(FATAL_ERROR "`${this_sdk}` not found in `${all_platforms}`")
+ endif()
+
+ list(REMOVE_ITEM all_platforms "" "${this_sdk}")
+ list(LENGTH all_platforms all_platforms_length)
+ if(NOT all_platforms_length EQUAL 1)
+ message(FATAL_ERROR "Expected one element: ${all_platforms}")
+ endif()
+
+ set(${this_sdk_var} "${this_sdk}" PARENT_SCOPE)
+ set(${corr_sdk_var} "${all_platforms}" PARENT_SCOPE)
+endfunction()
+
+# Create combined binary for the given target.
+#
+# Preconditions:
+# * Target already installed at ${destination}
+# for the ${PLATFORM_NAME} platform
+#
+# This function will:
+# * Run build for the lacking platform, i.e. opposite to the ${PLATFORM_NAME}
+# * Fuse both libraries by running lipo
+function(ios_install_combined target destination)
+ if("${target}" STREQUAL "")
+ message(FATAL_ERROR "`target` is empty")
+ endif()
+
+ if("${destination}" STREQUAL "")
+ message(FATAL_ERROR "`destination` is empty")
+ endif()
+
+ if(NOT IS_ABSOLUTE "${destination}")
+ message(FATAL_ERROR "`destination` is not absolute: ${destination}")
+ endif()
+
+ if(IS_DIRECTORY "${destination}" OR IS_SYMLINK "${destination}")
+ message(FATAL_ERROR "`destination` is no regular file: ${destination}")
+ endif()
+
+ if("${CMAKE_BINARY_DIR}" STREQUAL "")
+ message(FATAL_ERROR "`CMAKE_BINARY_DIR` is empty")
+ endif()
+
+ if(NOT IS_DIRECTORY "${CMAKE_BINARY_DIR}")
+ message(FATAL_ERROR "Is not a directory: ${CMAKE_BINARY_DIR}")
+ endif()
+
+ if("${CMAKE_INSTALL_CONFIG_NAME}" STREQUAL "")
+ message(FATAL_ERROR "CMAKE_INSTALL_CONFIG_NAME is empty")
+ endif()
+
+ set(cmd xcrun -f lipo)
+ execute_process(
+ COMMAND ${cmd}
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_STRIP_TRAILING_WHITESPACE
+ )
+ if(NOT result EQUAL 0)
+ message(
+ FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}"
+ )
+ endif()
+ set(_lipo_path ${output})
+
+ set(CURRENT_CONFIG "${CMAKE_INSTALL_CONFIG_NAME}")
+ set(CURRENT_TARGET "${target}")
+
+ _ios_install_combined_message("Target: ${CURRENT_TARGET}")
+ _ios_install_combined_message("Config: ${CURRENT_CONFIG}")
+ _ios_install_combined_message("Destination: ${destination}")
+
+ # Get SDKs
+ _ios_install_combined_detect_sdks(this_sdk corr_sdk)
+
+ # Get architectures of the target
+ _ios_install_combined_get_valid_archs("${corr_sdk}" corr_valid_archs)
+ _ios_install_combined_get_valid_archs("${this_sdk}" this_valid_archs)
+
+ # Return if there are no valid architectures for the SDK.
+ # (note that library already installed)
+ if("${corr_valid_archs}" STREQUAL "")
+ _ios_install_combined_message(
+ "No architectures detected for `${corr_sdk}` (skip)"
+ )
+ return()
+ endif()
+
+ # Trigger build of corresponding target
+ _ios_install_combined_build("${corr_sdk}")
+
+ # Get location of the library in build directory
+ _ios_install_combined_get_build_setting(
+ "${corr_sdk}" "CONFIGURATION_BUILD_DIR" corr_build_dir)
+ _ios_install_combined_get_build_setting(
+ "${corr_sdk}" "EXECUTABLE_PATH" corr_executable_path)
+ set(corr "${corr_build_dir}/${corr_executable_path}")
+
+ _ios_install_combined_keep_archs("${corr}" "${corr_valid_archs}")
+ _ios_install_combined_keep_archs("${destination}" "${this_valid_archs}")
+
+ _ios_install_combined_message("Current: ${destination}")
+ _ios_install_combined_message("Corresponding: ${corr}")
+
+ set(cmd "${_lipo_path}" -create ${corr} ${destination} -output ${destination})
+
+ execute_process(
+ COMMAND ${cmd}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ RESULT_VARIABLE result
+ )
+
+ if(NOT result EQUAL 0)
+ message(FATAL_ERROR "Command failed: ${cmd}")
+ endif()
+
+ _ios_install_combined_message("Install done: ${destination}")
+endfunction()
diff --git a/Modules/CMakeImportBuildSettings.cmake b/Modules/CMakeImportBuildSettings.cmake
index 60b887aed..edecc1fa0 100644
--- a/Modules/CMakeImportBuildSettings.cmake
+++ b/Modules/CMakeImportBuildSettings.cmake
@@ -17,8 +17,7 @@
# This macro used to load build settings from another project that
# stored settings using the CMAKE_EXPORT_BUILD_SETTINGS macro.
macro(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
- if(${SETTINGS_FILE} MATCHES ".+")
- else()
+ if("${SETTINGS_FILE}" STREQUAL "")
message(SEND_ERROR "CMAKE_IMPORT_BUILD_SETTINGS called with no argument.")
endif()
endmacro()
diff --git a/Modules/CMakeLanguageInformation.cmake b/Modules/CMakeLanguageInformation.cmake
new file mode 100644
index 000000000..e03d149c0
--- /dev/null
+++ b/Modules/CMakeLanguageInformation.cmake
@@ -0,0 +1,37 @@
+
+#=============================================================================
+# Copyright 2015 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# This file contains common code blocks used by all the language information
+# files
+
+# load any compiler-wrapper specific information
+macro(__cmake_include_compiler_wrapper lang)
+ set(_INCLUDED_WRAPPER_FILE 0)
+ if (CMAKE_${lang}_COMPILER_ID)
+ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
+ endif()
+ if (NOT _INCLUDED_WRAPPER_FILE)
+ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
+ endif ()
+
+ # No platform - wrapper - lang information so maybe there's just wrapper - lang information
+ if(NOT _INCLUDED_WRAPPER_FILE)
+ if (CMAKE_${lang}_COMPILER_ID)
+ include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
+ endif()
+ if (NOT _INCLUDED_WRAPPER_FILE)
+ include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
+ endif ()
+ endif ()
+endmacro ()
diff --git a/Modules/CMakeNinjaFindMake.cmake b/Modules/CMakeNinjaFindMake.cmake
index c3ca7671c..2f35cf407 100644
--- a/Modules/CMakeNinjaFindMake.cmake
+++ b/Modules/CMakeNinjaFindMake.cmake
@@ -12,6 +12,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-find_program(CMAKE_MAKE_PROGRAM ninja
+find_program(CMAKE_MAKE_PROGRAM
+ NAMES ninja-build ninja
DOC "Program used to build from build.ninja files.")
mark_as_advanced(CMAKE_MAKE_PROGRAM)
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index d042d5e0f..206ea7a48 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -1,134 +1,202 @@
-# - CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE()
-#
-# CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path>
-# [PATH_VARS <var1> <var2> ... <varN>]
-# [NO_SET_AND_CHECK_MACRO]
-# [NO_CHECK_REQUIRED_COMPONENTS_MACRO])
-#
-# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain
-# configure_file() command when creating the <Name>Config.cmake or <Name>-config.cmake
-# file for installing a project or library. It helps making the resulting package
-# relocatable by avoiding hardcoded paths in the installed Config.cmake file.
-#
-# In a FooConfig.cmake file there may be code like this to make the
-# install destinations know to the using project:
-# 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 CMAKE_INSTALL_PREFIX
-# was set at build/cmake time.
-#
-# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it makes the
-# resulting FooConfig.cmake file relocatable.
-# Usage:
-# 1. write a FooConfig.cmake.in file as you are used to
-# 2. insert a line containing only the string "@PACKAGE_INIT@"
-# 3. instead of set(FOO_DIR "@SOME_INSTALL_DIR@"), use set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")
-# (this must be after the @PACKAGE_INIT@ line)
-# 4. instead of using the normal configure_file(), use CONFIGURE_PACKAGE_CONFIG_FILE()
-#
-# The <input> and <output> arguments are the input and output file, the same way
-# as in configure_file().
-#
-# The <path> given to INSTALL_DESTINATION must be the destination where the FooConfig.cmake
-# file will be installed to. This can either be a relative or absolute path, both work.
-#
-# The variables <var1> to <varN> given as PATH_VARS are the variables which contain
-# install destinations. For each of them the macro will create a helper variable
-# PACKAGE_<var...>. These helper variables must be used
-# in the FooConfig.cmake.in file for setting the installed location. They are calculated
-# by CONFIGURE_PACKAGE_CONFIG_FILE() so that they are always relative to the
-# installed location of the package. This works both for relative and also for absolute locations.
-# For absolute locations it works only if the absolute location is a subdirectory
-# of CMAKE_INSTALL_PREFIX.
-#
-# By default configure_package_config_file() also generates two helper macros,
-# set_and_check() and check_required_components() into the FooConfig.cmake file.
-#
-# set_and_check() should be used instead of the normal set()
-# command for setting directories and file locations. Additionally to setting the
-# variable it also checks that the referenced file or directory actually exists
-# and fails with a FATAL_ERROR otherwise. This makes sure that the created
-# FooConfig.cmake file does not contain wrong references.
-# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated into the
-# FooConfig.cmake file.
-#
-# check_required_components(<package_name>) should be called at the end of the
-# FooConfig.cmake file if the package supports components.
-# This macro checks whether all requested, non-optional components have been found,
-# and if this is not the case, sets the Foo_FOUND variable to FALSE, so that the package
-# is considered to be not found.
-# It does that by testing the Foo_<Component>_FOUND variables for all requested
-# required components.
-# When using the NO_CHECK_REQUIRED_COMPONENTS option, this macro is not generated
-# into the FooConfig.cmake file.
-#
-# For an example see below the documentation for WRITE_BASIC_PACKAGE_VERSION_FILE().
-#
-#
-# WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) )
-#
-# Writes a file for use as <package>ConfigVersion.cmake file to <filename>.
-# See the documentation of find_package() for details on this.
-# filename is the output filename, it should be in the build tree.
-# major.minor.patch is the version number of the project to be installed
-# The COMPATIBILITY mode AnyNewerVersion means that the installed package version
-# will be considered compatible if it is newer or exactly the same as the requested version.
-# This mode should be used for packages which are fully backward compatible,
-# also across major versions.
-# If SameMajorVersion is used instead, then the behaviour differs from AnyNewerVersion
-# in that the major version number must be the same as requested, e.g. version 2.0 will
-# not be considered compatible if 1.0 is requested.
-# This mode should be used for packages which guarantee backward compatibility within the
-# same major version.
-# If ExactVersion is used, then the package is only considered compatible if the requested
-# version matches exactly its own version number (not considering the tweak version).
-# For example, version 1.2.3 of a package is only considered compatible to requested version 1.2.3.
-# This mode is for packages without compatibility guarantees.
-# If your project has more elaborated version matching rules, you will need to write your
-# own custom ConfigVersion.cmake file instead of using this macro.
-#
-# Internally, this macro executes configure_file() to create the resulting
-# version file. Depending on the COMPATIBLITY, either the file
-# BasicConfigVersion-SameMajorVersion.cmake.in or BasicConfigVersion-AnyNewerVersion.cmake.in
-# is used. Please note that these two files are internal to CMake and you should
-# not call configure_file() on them yourself, but they can be used as starting
-# point to create more sophisticted custom ConfigVersion.cmake files.
-#
-#
-# Example using both configure_package_config_file() and write_basic_package_version_file():
-# CMakeLists.txt:
-# 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 )
-#
-# With a 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 ``<Name>Config.cmake``
+# or ``<Name>-config.cmake`` file for installing a project or library. It helps
+# making the resulting package relocatable by avoiding hardcoded paths in the
+# installed ``Config.cmake`` file.
+#
+# In a ``FooConfig.cmake`` file there may be code like this to make the install
+# destinations know to the using project:
+#
+# .. 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(<package_name>)`` should be called at the end of
+# the ``FooConfig.cmake`` file if the package supports components. This macro
+# checks whether all requested, non-optional components have been found, and if
+# this is not the case, sets the ``Foo_FOUND`` variable to ``FALSE``, so that
+# the package is considered to be not found. It does that by testing the
+# ``Foo_<Component>_FOUND`` variables for all requested required components.
+# When using the ``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is
+# not generated into the ``FooConfig.cmake`` file.
+#
+# For an example see below the documentation for
+# :command:`write_basic_package_version_file()`.
+#
+# Generating a Package Version File
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# .. command:: write_basic_package_version_file
+#
+# Create a version file for a project::
+#
+# write_basic_package_version_file(<filename>
+# [VERSION <major.minor.patch>]
+# COMPATIBILITY <AnyNewerVersion|SameMajorVersion|ExactVersion> )
+#
+#
+# Writes a file for use as ``<package>ConfigVersion.cmake`` file to
+# ``<filename>``. See the documentation of :command:`find_package()` for
+# details on this.
+#
+# ``<filename>`` is the output filename, it should be in the build tree.
+# ``<major.minor.patch>`` is the version number of the project to be installed.
+#
+# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable is used.
+# If this hasn't been set, it errors out.
+#
+# The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed
+# package version will be considered compatible if it is newer or exactly the
+# same as the requested version. This mode should be used for packages which
+# are fully backward compatible, also across major versions.
+# If ``SameMajorVersion`` is used instead, then the behaviour differs from
+# ``AnyNewerVersion`` in that the major version number must be the same as
+# requested, e.g. version 2.0 will not be considered compatible if 1.0 is
+# requested. This mode should be used for packages which guarantee backward
+# compatibility within the same major version.
+# If ``ExactVersion`` is used, then the package is only considered compatible if
+# the requested version matches exactly its own version number (not considering
+# the tweak version). For example, version 1.2.3 of a package is only
+# considered compatible to requested version 1.2.3. This mode is for packages
+# without compatibility guarantees.
+# If your project has more elaborated version matching rules, you will need to
+# write your own custom ``ConfigVersion.cmake`` file instead of using this
+# macro.
+#
+# Internally, this macro executes :command:`configure_file()` to create the
+# resulting version file. Depending on the ``COMPATIBLITY``, either the file
+# ``BasicConfigVersion-SameMajorVersion.cmake.in`` or
+# ``BasicConfigVersion-AnyNewerVersion.cmake.in`` is used. Please note that
+# these two files are internal to CMake and you should not call
+# :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``:
+#
+# .. code-block:: cmake
+#
+# 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)
#=============================================================================
@@ -152,10 +220,9 @@ macro(WRITE_BASIC_PACKAGE_VERSION_FILE)
write_basic_config_version_file(${ARGN})
endmacro()
-
function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
- set(oneValueArgs INSTALL_DESTINATION )
+ set(oneValueArgs INSTALL_DESTINATION INSTALL_PREFIX)
set(multiValueArgs PATH_VARS )
cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@@ -168,20 +235,30 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()")
endif()
+ if(DEFINED CCF_INSTALL_PREFIX)
+ if(IS_ABSOLUTE "${CCF_INSTALL_PREFIX}")
+ set(installPrefix "${CCF_INSTALL_PREFIX}")
+ else()
+ message(FATAL_ERROR "INSTALL_PREFIX must be an absolute path")
+ endif()
+ else()
+ set(installPrefix "${CMAKE_INSTALL_PREFIX}")
+ endif()
+
if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}")
set(absInstallDir "${CCF_INSTALL_DESTINATION}")
else()
- set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
+ set(absInstallDir "${installPrefix}/${CCF_INSTALL_DESTINATION}")
endif()
- file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" )
+ file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${installPrefix}" )
foreach(var ${CCF_PATH_VARS})
if(NOT DEFINED ${var})
message(FATAL_ERROR "Variable ${var} does not exist")
else()
if(IS_ABSOLUTE "${${var}}")
- string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}"
+ string(REPLACE "${installPrefix}" "\${PACKAGE_PREFIX_DIR}"
PACKAGE_${var} "${${var}}")
else()
set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
@@ -207,7 +284,7 @@ get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE
get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH)
get_filename_component(_realOrig \"${absInstallDir}\" REALPATH)
if(_realCurr STREQUAL _realOrig)
- set(PACKAGE_PREFIX_DIR \"${CMAKE_INSTALL_PREFIX}\")
+ set(PACKAGE_PREFIX_DIR \"${installPrefix}\")
endif()
unset(_realOrig)
unset(_realCurr)
diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake
index 016da0c97..fc64ab9a2 100644
--- a/Modules/CMakeParseArguments.cmake
+++ b/Modules/CMakeParseArguments.cmake
@@ -1,64 +1,11 @@
-# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
+#.rst:
+# CMakeParseArguments
+# -------------------
#
-# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
-# parsing the arguments given to that macro or function.
-# It processes the arguments and defines a set of variables which hold the
-# values of the respective options.
-#
-# The <options> argument contains all options for the respective macro,
-# i.e. keywords which can be used when calling the macro without any value
-# following, like e.g. the OPTIONAL keyword of the install() command.
-#
-# The <one_value_keywords> argument contains all keywords for this macro
-# which are followed by one value, like e.g. DESTINATION keyword of the
-# install() command.
-#
-# The <multi_value_keywords> argument contains all keywords for this macro
-# which can be followed by more than one value, like e.g. the TARGETS or
-# FILES keywords of the install() command.
-#
-# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
-# keywords listed in <options>, <one_value_keywords> and
-# <multi_value_keywords> a variable composed of the given <prefix>
-# followed by "_" and the name of the respective keyword.
-# These variables will then hold the respective value from the argument list.
-# For the <options> keywords this will be TRUE or FALSE.
-#
-# All remaining arguments are collected in a variable
-# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
-# your macro was called with unrecognized parameters.
-#
-# As an example here a my_install() macro, which takes similar arguments as the
-# real install() command:
-#
-# function(MY_INSTALL)
-# set(options OPTIONAL FAST)
-# set(oneValueArgs DESTINATION RENAME)
-# set(multiValueArgs TARGETS CONFIGURATIONS)
-# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
-# ...
-#
-# Assume my_install() has been called like this:
-# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
-#
-# After the cmake_parse_arguments() call the macro will have set the following
-# variables:
-# MY_INSTALL_OPTIONAL = TRUE
-# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
-# MY_INSTALL_DESTINATION = "bin"
-# MY_INSTALL_RENAME = "" (was not used)
-# MY_INSTALL_TARGETS = "foo;bar"
-# MY_INSTALL_CONFIGURATIONS = "" (was not used)
-# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
-#
-# You can then continue and process these variables.
-#
-# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
-# another recognized keyword follows, this is interpreted as the beginning of
-# the new option.
-# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
-# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
-# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
+# 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.
#=============================================================================
# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
@@ -72,67 +19,3 @@
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-
-
-if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
- return()
-endif()
-set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
-
-
-function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
- # first set all result variables to empty/FALSE
- foreach(arg_name ${_singleArgNames} ${_multiArgNames})
- set(${prefix}_${arg_name})
- endforeach()
-
- foreach(option ${_optionNames})
- set(${prefix}_${option} FALSE)
- endforeach()
-
- set(${prefix}_UNPARSED_ARGUMENTS)
-
- set(insideValues FALSE)
- set(currentArgName)
-
- # now iterate over all arguments and fill the result variables
- foreach(currentArg ${ARGN})
- list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
- list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
- list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
-
- if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
- if(insideValues)
- if("${insideValues}" STREQUAL "SINGLE")
- set(${prefix}_${currentArgName} ${currentArg})
- set(insideValues FALSE)
- elseif("${insideValues}" STREQUAL "MULTI")
- list(APPEND ${prefix}_${currentArgName} ${currentArg})
- endif()
- else()
- list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
- endif()
- else()
- if(NOT ${optionIndex} EQUAL -1)
- set(${prefix}_${currentArg} TRUE)
- set(insideValues FALSE)
- elseif(NOT ${singleArgIndex} EQUAL -1)
- set(currentArgName ${currentArg})
- set(${prefix}_${currentArgName})
- set(insideValues "SINGLE")
- elseif(NOT ${multiArgIndex} EQUAL -1)
- set(currentArgName ${currentArg})
- set(${prefix}_${currentArgName})
- set(insideValues "MULTI")
- endif()
- endif()
-
- endforeach()
-
- # propagate the result variables to the caller:
- foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
- set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
- endforeach()
- set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
-
-endfunction()
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index 4724a8c7b..59092bd2c 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -31,7 +31,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
# Construct a regex to match linker lines. It must match both the
# whole line and just the command (argv[0]).
set(linker_regex "^( *|.*[/\\])(${linker}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)")
- set(linker_exclude_regex "collect2 version ")
+ set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=")
set(log "${log} link line regex: [${linker_regex}]\n")
string(REGEX REPLACE "\r?\n" ";" output_lines "${text}")
foreach(line IN LISTS output_lines)
@@ -64,9 +64,9 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
string(REGEX REPLACE "^-L" "" dir "${arg}")
list(APPEND implicit_dirs_tmp ${dir})
set(log "${log} arg [${arg}] ==> dir [${dir}]\n")
- elseif("${arg}" MATCHES "^-l[^:]")
+ elseif("${arg}" MATCHES "^-l([^:].*)$")
# Unix library.
- string(REGEX REPLACE "^-l" "" lib "${arg}")
+ set(lib "${CMAKE_MATCH_1}")
list(APPEND implicit_libs_tmp ${lib})
set(log "${log} arg [${arg}] ==> lib [${lib}]\n")
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$")
@@ -97,11 +97,10 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
endif()
endforeach()
break()
- elseif("${line}" MATCHES "LPATH(=| is:? )")
+ elseif("${line}" MATCHES "LPATH(=| is:? *)(.*)$")
set(log "${log} LPATH line: [${line}]\n")
# HP search path.
- string(REGEX REPLACE ".*LPATH(=| is:? *)" "" paths "${line}")
- string(REPLACE ":" ";" paths "${paths}")
+ string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}")
list(APPEND implicit_dirs_tmp ${paths})
set(log "${log} dirs [${paths}]\n")
else()
@@ -125,7 +124,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
# We remove items that are not language-specific.
set(implicit_libs "")
foreach(lib IN LISTS implicit_libs_tmp)
- if("${lib}" MATCHES "^(crt.*\\.o|gcc.*|System.*)$")
+ if("x${lib}" MATCHES "^x(crt.*\\.o|gcc.*|System.*)$")
set(log "${log} remove lib [${lib}]\n")
elseif(IS_ABSOLUTE "${lib}")
get_filename_component(abs "${lib}" ABSOLUTE)
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index 69171c2a3..da99b9e6d 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -1,3 +1,6 @@
+#define STRINGIFY_HELPER(X) #X
+#define STRINGIFY(X) STRINGIFY_HELPER(X)
+
/* Identify known platforms by name. */
#if defined(__linux) || defined(__linux__) || defined(linux)
# define PLATFORM_ID "Linux"
@@ -74,6 +77,23 @@
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
+#elif defined(__WATCOMC__)
+# if defined(__LINUX__)
+# define PLATFORM_ID "Linux"
+
+# elif defined(__DOS__)
+# define PLATFORM_ID "DOS"
+
+# elif defined(__OS2__)
+# define PLATFORM_ID "OS2"
+
+# elif defined(__WINDOWS__)
+# define PLATFORM_ID "Windows3x"
+
+# else /* unknown platform */
+# define PLATFORM_ID ""
+# endif
+
#else /* unknown platform */
# define PLATFORM_ID ""
@@ -95,7 +115,13 @@
# define ARCHITECTURE_ID "X86"
# elif defined(_M_ARM)
-# define ARCHITECTURE_ID "ARM"
+# if _M_ARM == 4
+# define ARCHITECTURE_ID "ARMV4I"
+# elif _M_ARM == 5
+# define ARCHITECTURE_ID "ARMV5I"
+# else
+# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
+# endif
# elif defined(_M_MIPS)
# define ARCHITECTURE_ID "MIPS"
@@ -107,6 +133,17 @@
# define ARCHITECTURE_ID ""
# endif
+#elif defined(__WATCOMC__)
+# if defined(_M_I86)
+# define ARCHITECTURE_ID "I86"
+
+# elif defined(_M_IX86)
+# define ARCHITECTURE_ID "X86"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
+
#else
# define ARCHITECTURE_ID ""
#endif
@@ -151,6 +188,24 @@ char const info_version[] = {
']','\0'};
#endif
+/* Construct a string literal encoding the version number components. */
+#ifdef SIMULATE_VERSION_MAJOR
+char const info_simulate_version[] = {
+ 'I', 'N', 'F', 'O', ':',
+ 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
+ SIMULATE_VERSION_MAJOR,
+# ifdef SIMULATE_VERSION_MINOR
+ '.', SIMULATE_VERSION_MINOR,
+# ifdef SIMULATE_VERSION_PATCH
+ '.', SIMULATE_VERSION_PATCH,
+# ifdef SIMULATE_VERSION_TWEAK
+ '.', SIMULATE_VERSION_TWEAK,
+# endif
+# endif
+# endif
+ ']','\0'};
+#endif
+
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake
index ef5d857b6..474fa41b9 100644
--- a/Modules/CMakePrintHelpers.cmake
+++ b/Modules/CMakePrintHelpers.cmake
@@ -1,29 +1,40 @@
-# - Convenience macros for printing properties and variables, useful e.g. for debugging.
+#.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 )
+# ::
+#
+# 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.
+# 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)
+# 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 THIS_ONE_DOES_NOT_EXIST)
-# Gives:
-# -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; THIS_ONE_DOES_NOT_EXIST=""
+# 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=""
#=============================================================================
# Copyright 2013 Alexander Neundorf, <neundorf@kde.org>
diff --git a/Modules/CMakePrintSystemInformation.cmake b/Modules/CMakePrintSystemInformation.cmake
index e0c73346b..355c47dac 100644
--- a/Modules/CMakePrintSystemInformation.cmake
+++ b/Modules/CMakePrintSystemInformation.cmake
@@ -1,7 +1,11 @@
-# - 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.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
diff --git a/Modules/CMakePushCheckState.cmake b/Modules/CMakePushCheckState.cmake
index b37b706ac..bf4ec0e9c 100644
--- a/Modules/CMakePushCheckState.cmake
+++ b/Modules/CMakePushCheckState.cmake
@@ -1,30 +1,37 @@
-# 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
-# and CMAKE_REQUIRED_INCLUDES 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.
+#.rst:
+# CMakePushCheckState
+# -------------------
#
-# 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.
+#
+#
+# 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 and CMAKE_REQUIRED_INCLUDES 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()
+#
+# ::
+#
+# 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()
#=============================================================================
# Copyright 2006-2011 Alexander Neundorf, <neundorf@kde.org>
@@ -46,6 +53,7 @@ macro(CMAKE_RESET_CHECK_STATE)
set(CMAKE_REQUIRED_DEFINITIONS)
set(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_FLAGS)
+ set(CMAKE_REQUIRED_QUIET)
endmacro()
@@ -61,6 +69,7 @@ macro(CMAKE_PUSH_CHECK_STATE)
set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS})
+ set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET})
if (ARGC GREATER 0 AND ARGV0 STREQUAL "RESET")
cmake_reset_check_state()
@@ -77,6 +86,7 @@ macro(CMAKE_POP_CHECK_STATE)
set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ set(CMAKE_REQUIRED_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1")
endif()
diff --git a/Modules/CMakeRCCompiler.cmake.in b/Modules/CMakeRCCompiler.cmake.in
index 0fc314220..8257cd6a1 100644
--- a/Modules/CMakeRCCompiler.cmake.in
+++ b/Modules/CMakeRCCompiler.cmake.in
@@ -1,6 +1,6 @@
set(CMAKE_RC_COMPILER "@CMAKE_RC_COMPILER@")
set(CMAKE_RC_COMPILER_ARG1 "@CMAKE_RC_COMPILER_ARG1@")
set(CMAKE_RC_COMPILER_LOADED 1)
-set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc)
+set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc;RC)
set(CMAKE_RC_OUTPUT_EXTENSION @CMAKE_RC_OUTPUT_EXTENSION@)
set(CMAKE_RC_COMPILER_ENV_VAR "RC")
diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake
index 8ffe50aba..94abd4be8 100644
--- a/Modules/CMakeRCInformation.cmake
+++ b/Modules/CMakeRCInformation.cmake
@@ -13,15 +13,16 @@
# License text for the above reference.)
-# This file sets the basic flags for the Fortran language in CMake.
+# This file sets the basic flags for the Windows Resource Compiler.
# It also loads the available platform file for the system-compiler
# if it exists.
# make sure we don't use CMAKE_BASE_NAME from somewhere else
set(CMAKE_BASE_NAME)
-get_filename_component(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE)
-if("${CMAKE_BASE_NAME}" MATCHES "windres")
- set(CMAKE_BASE_NAME "windres")
+if(CMAKE_RC_COMPILER MATCHES "windres[^/]*$")
+ set(CMAKE_BASE_NAME "windres")
+else()
+ get_filename_component(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE)
endif()
set(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
@@ -30,7 +31,7 @@ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
set (CMAKE_RC_FLAGS "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}" CACHE STRING
- "Flags for Fortran compiler.")
+ "Flags for Windows Resource Compiler.")
# These are the only types of flags that should be passed to the rc
# command, if COMPILE_FLAGS is used on a target this will be used
@@ -43,7 +44,7 @@ set(CMAKE_INCLUDE_FLAG_RC "-I")
# compile a Resource file into an object file
if(NOT CMAKE_RC_COMPILE_OBJECT)
set(CMAKE_RC_COMPILE_OBJECT
- "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> /fo<OBJECT> <SOURCE>")
+ "<CMAKE_RC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /fo<OBJECT> <SOURCE>")
endif()
mark_as_advanced(
diff --git a/Modules/CMakeSwiftCompiler.cmake.in b/Modules/CMakeSwiftCompiler.cmake.in
new file mode 100644
index 000000000..45f0a3105
--- /dev/null
+++ b/Modules/CMakeSwiftCompiler.cmake.in
@@ -0,0 +1,5 @@
+set(CMAKE_Swift_COMPILER "@CMAKE_Swift_COMPILER@")
+set(CMAKE_Swift_COMPILER_ID "@CMAKE_Swift_COMPILER_ID@")
+
+set(CMAKE_Swift_COMPILER_ID_RUN 1)
+set(CMAKE_Swift_SOURCE_FILE_EXTENSIONS swift)
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
new file mode 100644
index 000000000..61ad92834
--- /dev/null
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -0,0 +1,41 @@
+
+#=============================================================================
+# Copyright 2004-2015 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+set(CMAKE_Swift_OUTPUT_EXTENSION .o)
+
+# Load compiler-specific information.
+if(CMAKE_Swift_COMPILER_ID)
+ include(Compiler/${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL)
+endif()
+
+# load the system- and compiler specific files
+if(CMAKE_Swift_COMPILER_ID)
+ # load a hardware specific file, mostly useful for embedded compilers
+ if(CMAKE_SYSTEM_PROCESSOR)
+ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
+ endif()
+ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL)
+endif()
+
+# for most systems a module is the same as a shared library
+# so unless the variable CMAKE_MODULE_EXISTS is set just
+# copy the values from the LIBRARY variables
+if(NOT CMAKE_MODULE_EXISTS)
+ set(CMAKE_SHARED_MODULE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_Swift_FLAGS})
+ set(CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Swift_FLAGS})
+endif()
+
+include(CMakeCommonLanguageInclude)
+
+set(CMAKE_Swift_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeVS7FindMake.cmake b/Modules/CMakeSystemSpecificInitialize.cmake
index 218c5f2df..5327ac19b 100644
--- a/Modules/CMakeVS7FindMake.cmake
+++ b/Modules/CMakeSystemSpecificInitialize.cmake
@@ -1,6 +1,6 @@
#=============================================================================
-# Copyright 2002-2009 Kitware, Inc.
+# Copyright 2002-2014 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -12,14 +12,9 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-find_program(CMAKE_MAKE_PROGRAM
- NAMES devenv
- PATHS
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0\\Setup\\VS;EnvironmentDirectory]
- "c:/Program Files/Microsoft Visual Studio .NET/Common7/IDE"
- "c:/Program Files/Microsoft Visual Studio.NET/Common7/IDE"
- "/Program Files/Microsoft Visual Studio .NET/Common7/IDE/"
- )
-mark_as_advanced(CMAKE_MAKE_PROGRAM)
-set(MSVC70 1)
-set(MSVC_VERSION 1300)
+# This file is included by cmGlobalGenerator::EnableLanguage.
+# It is included before the compiler has been determined.
+
+include(Platform/${CMAKE_SYSTEM_NAME}-Initialize OPTIONAL)
+
+set(CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED 1)
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
index 2c751471a..29a58bdc9 100644
--- a/Modules/CMakeTestCCompiler.cmake
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -73,12 +73,15 @@ else()
# Try to identify the ABI and configure it into CMakeCCompiler.cmake
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
CMAKE_DETERMINE_COMPILER_ABI(C ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c)
+ # Try to identify the compiler features
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake)
+ CMAKE_DETERMINE_COMPILE_FEATURES(C)
# Re-configure to save learned information.
configure_file(
${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake
- @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ @ONLY
)
include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake)
diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake
index a5cdf5669..81561b2cb 100644
--- a/Modules/CMakeTestCXXCompiler.cmake
+++ b/Modules/CMakeTestCXXCompiler.cmake
@@ -66,12 +66,15 @@ else()
# Try to identify the ABI and configure it into CMakeCXXCompiler.cmake
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
CMAKE_DETERMINE_COMPILER_ABI(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp)
+ # Try to identify the compiler features
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake)
+ CMAKE_DETERMINE_COMPILE_FEATURES(CXX)
# Re-configure to save learned information.
configure_file(
${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake
- @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ @ONLY
)
include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake)
diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake
index b9e77c5f5..b50e83276 100644
--- a/Modules/CMakeTestFortranCompiler.cmake
+++ b/Modules/CMakeTestFortranCompiler.cmake
@@ -98,7 +98,7 @@ else()
configure_file(
${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake
- @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ @ONLY
)
include(${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake)
diff --git a/Modules/CMakeTestSwiftCompiler.cmake b/Modules/CMakeTestSwiftCompiler.cmake
new file mode 100644
index 000000000..89849fb8c
--- /dev/null
+++ b/Modules/CMakeTestSwiftCompiler.cmake
@@ -0,0 +1,65 @@
+
+#=============================================================================
+# Copyright 2003-2015 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+if(CMAKE_Swift_COMPILER_FORCED)
+ # The compiler configuration was forced by the user.
+ # Assume the user has configured all compiler information.
+ set(CMAKE_Swift_COMPILER_WORKS TRUE)
+ return()
+endif()
+
+include(CMakeTestCompilerCommon)
+
+# Remove any cached result from an older CMake version.
+# We now store this in CMakeSwiftCompiler.cmake.
+unset(CMAKE_Swift_COMPILER_WORKS CACHE)
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that that selected C++ compiler can actually compile
+# and link the most basic of programs. If not, a fatal error
+# is set and cmake stops processing commands and will not generate
+# any makefiles or projects.
+if(NOT CMAKE_Swift_COMPILER_WORKS)
+ PrintTestCompilerStatus("Swift" "")
+ file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift
+ "import Foundation\n"
+ "print(\"CMake\")\n")
+ try_compile(CMAKE_Swift_COMPILER_WORKS ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift
+ OUTPUT_VARIABLE __CMAKE_Swift_COMPILER_OUTPUT)
+ # Move result from cache to normal variable.
+ set(CMAKE_Swift_COMPILER_WORKS ${CMAKE_Swift_COMPILER_WORKS})
+ unset(CMAKE_Swift_COMPILER_WORKS CACHE)
+ set(Swift_TEST_WAS_RUN 1)
+endif()
+
+if(NOT CMAKE_Swift_COMPILER_WORKS)
+ PrintTestCompilerStatus("Swift" " -- broken")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the Swift compiler works failed with "
+ "the following output:\n${__CMAKE_Swift_COMPILER_OUTPUT}\n\n")
+ message(FATAL_ERROR "The Swift compiler \"${CMAKE_Swift_COMPILER}\" "
+ "is not able to compile a simple test program.\nIt fails "
+ "with the following output:\n ${__CMAKE_Swift_COMPILER_OUTPUT}\n\n"
+ "CMake will not be able to correctly generate this project.")
+else()
+ if(Swift_TEST_WAS_RUN)
+ PrintTestCompilerStatus("Swift" " -- works")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the Swift compiler works passed with "
+ "the following output:\n${__CMAKE_Swift_COMPILER_OUTPUT}\n\n")
+ endif()
+endif()
+
+unset(__CMAKE_Swift_COMPILER_OUTPUT)
diff --git a/Modules/CMakeVS10FindMake.cmake b/Modules/CMakeVS10FindMake.cmake
deleted file mode 100644
index 189b62698..000000000
--- a/Modules/CMakeVS10FindMake.cmake
+++ /dev/null
@@ -1,54 +0,0 @@
-
-#=============================================================================
-# Copyright 2007-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# Look for devenv as a build program. We need to use this to support
-# Intel Fortran integration into VS. MSBuild can not be used for that case
-# since Intel Fortran uses the older devenv file format.
-find_program(CMAKE_MAKE_PROGRAM
- NAMES devenv
- HINTS
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;EnvironmentDirectory]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup;Dbghelp_path]
- "$ENV{ProgramFiles}/Microsoft Visual Studio 10.0/Common7/IDE"
- "$ENV{ProgramFiles}/Microsoft Visual Studio10.0/Common7/IDE"
- "$ENV{ProgramFiles}/Microsoft Visual Studio 10/Common7/IDE"
- "$ENV{ProgramFiles}/Microsoft Visual Studio10/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10.0/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10.0/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10/Common7/IDE"
- "/Program Files/Microsoft Visual Studio 10.0/Common7/IDE/"
- "/Program Files/Microsoft Visual Studio 10/Common7/IDE/"
- )
-
-# if devenv is not found, then use MSBuild.
-# it is expected that if devenv is not found, then we are
-# dealing with Visual Studio Express. VCExpress has random
-# failures when being run as a command line build tool which
-# causes the compiler checks and try-compile stuff to fail. MSbuild
-# is a better choice for this. However, VCExpress does not support
-# cross compiling needed for Win CE.
-if(NOT CMAKE_CROSSCOMPILING)
- find_program(CMAKE_MAKE_PROGRAM
- NAMES MSBuild
- HINTS
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;ProductDir]
- "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/"
- "c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/"
- "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0;CLR Version]/")
-endif()
-
-mark_as_advanced(CMAKE_MAKE_PROGRAM)
-set(MSVC10 1)
-set(MSVC_VERSION 1600)
diff --git a/Modules/CMakeVS11FindMake.cmake b/Modules/CMakeVS11FindMake.cmake
deleted file mode 100644
index 2df015d40..000000000
--- a/Modules/CMakeVS11FindMake.cmake
+++ /dev/null
@@ -1,53 +0,0 @@
-
-#=============================================================================
-# Copyright 2007-2011 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# Look for devenv as a build program. We need to use this to support
-# Intel Fortran integration into VS. MSBuild can not be used for that case
-# since Intel Fortran uses the older devenv file format.
-find_program(CMAKE_MAKE_PROGRAM
- NAMES devenv
- HINTS
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;EnvironmentDirectory]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup;Dbghelp_path]
- "$ENV{ProgramFiles}/Microsoft Visual Studio 11.0/Common7/IDE"
- "$ENV{ProgramFiles}/Microsoft Visual Studio11.0/Common7/IDE"
- "$ENV{ProgramFiles}/Microsoft Visual Studio 11/Common7/IDE"
- "$ENV{ProgramFiles}/Microsoft Visual Studio11/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 11.0/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio11.0/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 11/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio11/Common7/IDE"
- "/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/"
- "/Program Files/Microsoft Visual Studio 11/Common7/IDE/"
- )
-
-# if devenv is not found, then use MSBuild.
-# it is expected that if devenv is not found, then we are
-# dealing with Visual Studio Express.
-if(NOT CMAKE_CROSSCOMPILING)
- set(_FDIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkDir32]")
- set(_FVER "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkVer32]")
- find_program(CMAKE_MAKE_PROGRAM
- NAMES MSBuild
- HINTS
- ${_FDIR}/${_FVER}
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir]
- "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;CLR Version]/"
- "c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;CLR Version]/"
- "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0;CLR Version]/")
-endif()
-
-mark_as_advanced(CMAKE_MAKE_PROGRAM)
-set(MSVC11 1)
-set(MSVC_VERSION 1700)
diff --git a/Modules/CMakeVS8FindMake.cmake b/Modules/CMakeVS8FindMake.cmake
deleted file mode 100644
index 31df0268d..000000000
--- a/Modules/CMakeVS8FindMake.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-
-#=============================================================================
-# Copyright 2004-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# VCExpress does not support cross compiling, which is necessary for Win CE
-set( _CMAKE_MAKE_PROGRAM_NAMES devenv)
-if(NOT CMAKE_CROSSCOMPILING)
- set( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress)
-endif()
-
-find_program(CMAKE_MAKE_PROGRAM
- NAMES ${_CMAKE_MAKE_PROGRAM_NAMES}
- HINTS
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VS;EnvironmentDirectory]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup;Dbghelp_path]
- "$ENV{ProgramFiles}/Microsoft Visual Studio 8/Common7/IDE"
- "$ENV{ProgramFiles}/Microsoft Visual Studio8/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/Common7/IDE"
- "/Program Files/Microsoft Visual Studio 8/Common7/IDE/"
- )
-mark_as_advanced(CMAKE_MAKE_PROGRAM)
-set(MSVC80 1)
-set(MSVC_VERSION 1400)
diff --git a/Modules/CMakeVS9FindMake.cmake b/Modules/CMakeVS9FindMake.cmake
deleted file mode 100644
index 35e9f981a..000000000
--- a/Modules/CMakeVS9FindMake.cmake
+++ /dev/null
@@ -1,39 +0,0 @@
-
-#=============================================================================
-# Copyright 2007-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# VCExpress does not support cross compiling, which is necessary for Win CE
-set( _CMAKE_MAKE_PROGRAM_NAMES devenv)
-if(NOT CMAKE_CROSSCOMPILING)
- set( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress)
-endif()
-
-find_program(CMAKE_MAKE_PROGRAM
- NAMES ${_CMAKE_MAKE_PROGRAM_NAMES}
- HINTS
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VS;EnvironmentDirectory]
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup;Dbghelp_path]
- "$ENV{ProgramFiles}/Microsoft Visual Studio 9.0/Common7/IDE"
- "$ENV{ProgramFiles}/Microsoft Visual Studio9.0/Common7/IDE"
- "$ENV{ProgramFiles}/Microsoft Visual Studio 9/Common7/IDE"
- "$ENV{ProgramFiles}/Microsoft Visual Studio9/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9.0/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9.0/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/Common7/IDE"
- "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/Common7/IDE"
- "/Program Files/Microsoft Visual Studio 9.0/Common7/IDE/"
- "/Program Files/Microsoft Visual Studio 9/Common7/IDE/"
- )
-mark_as_advanced(CMAKE_MAKE_PROGRAM)
-set(MSVC90 1)
-set(MSVC_VERSION 1500)
diff --git a/Modules/CMakeVerifyManifest.cmake b/Modules/CMakeVerifyManifest.cmake
index aebe77ea1..bff4e1e94 100644
--- a/Modules/CMakeVerifyManifest.cmake
+++ b/Modules/CMakeVerifyManifest.cmake
@@ -1,14 +1,19 @@
+#.rst:
+# CMakeVerifyManifest
+# -------------------
+#
+#
+#
# CMakeVerifyManifest.cmake
#
-# This script is used to verify that embeded 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 embeded 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 is used to verify that embeded 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 embeded 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.cmake b/Modules/CPack.cmake
index b0260ab16..77f854d5e 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -1,275 +1,279 @@
-##section Variables common to all CPack generators
-##end
-##module
-# - Build binary and source package installers.
-# 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 targets to the resulting makefiles, package and
+#.rst:
+# CPack
+# -----
+#
+# Build binary and source package installers.
+#
+# Variables common to all CPack generators
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# 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 targets to the resulting makefiles, package and
# package_source, which build the binary and source installers,
-# respectively. The generated binary installers contain everything
+# respectively. The generated binary installers contain everything
# installed via CMake's INSTALL command (and the deprecated
# INSTALL_FILES, INSTALL_PROGRAMS, and INSTALL_TARGETS commands).
#
# For certain kinds of binary installers (including the graphical
# installers on Mac OS X and Windows), CPack generates installers that
-# allow users to select individual application components to
-# install. See CPackComponent module for that.
+# allow users to select individual application components to install.
+# See CPackComponent module for that.
#
# The CPACK_GENERATOR variable has different meanings in different
-# contexts. In your CMakeLists.txt file, CPACK_GENERATOR is a
-# *list of generators*: when run with no other arguments, CPack
-# will iterate over that list and produce one package for each
-# generator. In a CPACK_PROJECT_CONFIG_FILE, though, CPACK_GENERATOR
-# is a *string naming a single generator*. If you need per-cpack-
-# generator logic to control *other* cpack settings, then you need
-# a CPACK_PROJECT_CONFIG_FILE.
+# contexts. In your CMakeLists.txt file, CPACK_GENERATOR is a *list of
+# generators*: when run with no other arguments, CPack will iterate over
+# that list and produce one package for each generator. In a
+# CPACK_PROJECT_CONFIG_FILE, though, CPACK_GENERATOR is a *string naming
+# a single generator*. If you need per-cpack- generator logic to
+# control *other* cpack settings, then you need a
+# CPACK_PROJECT_CONFIG_FILE.
#
# The CMake source tree itself contains a CPACK_PROJECT_CONFIG_FILE.
# See the top level file CMakeCPackOptions.cmake.in for an example.
#
-# If set, the CPACK_PROJECT_CONFIG_FILE is included automatically
-# on a per-generator basis. It only need contain overrides.
+# If set, the CPACK_PROJECT_CONFIG_FILE is included automatically on a
+# per-generator basis. It only need contain overrides.
#
# Here's how it works:
-# - cpack runs
-# - it includes CPackConfig.cmake
-# - it iterates over the generators listed in that file's
-# CPACK_GENERATOR list variable (unless told to use just a
-# specific one via -G on the command line...)
-#
-# - foreach generator, it then
-# - sets CPACK_GENERATOR to the one currently being iterated
-# - includes the CPACK_PROJECT_CONFIG_FILE
-# - produces the package for that generator
-#
-# This is the key: For each generator listed in CPACK_GENERATOR
-# in CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR
-# internally to *the one currently being used* and then include
-# the CPACK_PROJECT_CONFIG_FILE.
-#
-# 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:
-##end
-#
-##variable
-# CPACK_PACKAGE_NAME - The name of the package (or application). If
-# not specified, defaults to the project name.
-##end
-#
-##variable
-# CPACK_PACKAGE_VENDOR - The name of the package vendor. (e.g.,
-# "Kitware").
-##end
-#
-##variable
-# CPACK_PACKAGE_DIRECTORY - The directory in which CPack is doing its
-# packaging. If it is not set then this will default (internally) to the
-# build dir. This variable may be defined in CPack config file or from
-# the cpack command line option "-B". If set the command line option
-# override the value found in the config file.
-##end
-#
-##variable
-# CPACK_PACKAGE_VERSION_MAJOR - Package major Version
-##end
-#
-##variable
-# CPACK_PACKAGE_VERSION_MINOR - Package minor Version
-##end
-#
-##variable
-# CPACK_PACKAGE_VERSION_PATCH - Package patch Version
-##end
-#
-##variable
-# CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the
-# project. Used, for example, the introduction screen of a
-# CPack-generated Windows installer to describe the project.
-##end
-#
-##variable
-# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the
-# project (only a few words).
-##end
-#
-##variable
-# CPACK_PACKAGE_FILE_NAME - The name of the package file to generate,
-# not including the extension. For example, cmake-2.6.1-Linux-i686.
-# The default value is
-#
-# ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}.
-##end
-#
-##variable
-# CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the
-# target system. This may be used by some CPack generators
-# like NSIS to create an installation directory e.g., "CMake 2.5"
-# below the installation prefix. All installed element will be
+#
+# * cpack runs
+# * it includes CPackConfig.cmake
+# * it iterates over the generators listed in that file's
+# CPACK_GENERATOR list variable (unless told to use just a
+# specific one via -G on the command line...)
+# * foreach generator, it then
+#
+# - sets CPACK_GENERATOR to the one currently being iterated
+# - includes the CPACK_PROJECT_CONFIG_FILE
+# - produces the package for that generator
+#
+# This is the key: For each generator listed in CPACK_GENERATOR in
+# CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR internally to
+# *the one currently being used* and then include the
+# CPACK_PROJECT_CONFIG_FILE.
+#
+# 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:
+#
+# .. variable:: CPACK_PACKAGE_NAME
+#
+# The name of the package (or application). If not specified, defaults to
+# the project name.
+#
+# .. variable:: CPACK_PACKAGE_VENDOR
+#
+# The name of the package vendor. (e.g., "Kitware").
+#
+# .. variable:: CPACK_PACKAGE_DIRECTORY
+#
+# The directory in which CPack is doing its packaging. If it is not set
+# then this will default (internally) to the build dir. This variable may
+# be defined in CPack config file or from the cpack command line option
+# "-B". If set the command line option override the value found in the
+# config file.
+#
+# .. variable:: CPACK_PACKAGE_VERSION_MAJOR
+#
+# Package major Version
+#
+# .. variable:: CPACK_PACKAGE_VERSION_MINOR
+#
+# Package minor Version
+#
+# .. variable:: CPACK_PACKAGE_VERSION_PATCH
+#
+# Package patch Version
+#
+# .. variable:: CPACK_PACKAGE_DESCRIPTION_FILE
+#
+# A text file used to describe the project. Used, for example, the
+# introduction screen of a CPack-generated Windows installer to describe
+# the project.
+#
+# .. variable:: CPACK_PACKAGE_DESCRIPTION_SUMMARY
+#
+# Short description of the project (only a few words).
+#
+# .. variable:: CPACK_PACKAGE_FILE_NAME
+#
+# The name of the package file to generate, not including the
+# extension. For example, cmake-2.6.1-Linux-i686. The default value is::
+#
+# ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}.
+#
+# .. variable:: CPACK_PACKAGE_INSTALL_DIRECTORY
+#
+# Installation directory on the target system. This may be used by some
+# CPack generators like NSIS to create an installation directory e.g.,
+# "CMake 2.5" below the installation prefix. All installed element will be
# put inside this directory.
-##end
-#
-##variable
-# CPACK_PACKAGE_ICON - A branding image that will be displayed inside
-# the installer (used by GUI installers).
-##end
-#
-##variable
-# CPACK_PROJECT_CONFIG_FILE - CPack-time project CPack configuration
-# file. This file included at cpack time, once per
-# generator after CPack has set CPACK_GENERATOR to the actual generator
-# being used. It allows per-generator setting of CPACK_* variables at
-# cpack time.
-##end
-#
-##variable
-# CPACK_RESOURCE_FILE_LICENSE - License to be embedded in the installer. It
-# will typically be displayed to the user by the produced installer
-# (often with an explicit "Accept" button, for graphical installers)
-# prior to installation. This license file is NOT added to installed
-# file but is used by some CPack generators like NSIS. If you want
-# to install a license file (may be the same as this one)
-# along with your project you must add an appropriate CMake INSTALL
+#
+# .. variable:: CPACK_PACKAGE_ICON
+#
+# A branding image that will be displayed inside the installer (used by GUI
+# installers).
+#
+# .. variable:: CPACK_PROJECT_CONFIG_FILE
+#
+# CPack-time project CPack configuration file. This file included at cpack
+# time, once per generator after CPack has set CPACK_GENERATOR to the
+# actual generator being used. It allows per-generator setting of CPACK_*
+# variables at cpack time.
+#
+# .. variable:: CPACK_RESOURCE_FILE_LICENSE
+#
+# License to be embedded in the installer. It will typically be displayed
+# to the user by the produced installer (often with an explicit "Accept"
+# button, for graphical installers) prior to installation. This license
+# file is NOT added to installed file but is used by some CPack generators
+# like NSIS. If you want to install a license file (may be the same as this
+# one) along with your project you must add an appropriate CMake INSTALL
# command in your CMakeLists.txt.
-##end
-#
-##variable
-# CPACK_RESOURCE_FILE_README - ReadMe file to be embedded in the installer. It
-# typically describes in some detail the purpose of the project
-# during the installation. Not all CPack generators uses
-# this file.
-##end
-#
-##variable
-# CPACK_RESOURCE_FILE_WELCOME - Welcome file to be embedded in the
-# installer. It welcomes users to this installer.
-# Typically used in the graphical installers on Windows and Mac OS X.
-##end
-#
-##variable
-# CPACK_MONOLITHIC_INSTALL - Disables the component-based
-# installation mechanism. When set the component specification is ignored
-# and all installed items are put in a single "MONOLITHIC" package.
-# Some CPack generators do monolithic packaging by default and
-# may be asked to do component packaging by setting
-# CPACK_<GENNAME>_COMPONENT_INSTALL to 1/TRUE.
-##end
-#
-##variable
-# CPACK_GENERATOR - List of CPack generators to use. If not
-# specified, CPack will create a set of options CPACK_BINARY_<GENNAME> (e.g.,
-# CPACK_BINARY_NSIS) allowing the user to enable/disable individual
-# generators. This variable may be used on the command line
-# as well as in:
-#
-# cpack -D CPACK_GENERATOR="ZIP;TGZ" /path/to/build/tree
-##end
-#
-##variable
-# CPACK_OUTPUT_CONFIG_FILE - The name of the CPack binary configuration
-# file. This file is the CPack configuration generated by the CPack module
-# for binary installers. Defaults to CPackConfig.cmake.
-##end
-#
-##variable
-# CPACK_PACKAGE_EXECUTABLES - Lists each of the executables and associated
-# text label to be used to create Start Menu shortcuts. For example,
-# setting this to the list ccmake;CMake will
-# create a shortcut named "CMake" that will execute the installed
-# executable ccmake. Not all CPack generators use it (at least NSIS and
-# OSXX11 do).
-##end
-#
-##variable
-# CPACK_STRIP_FILES - List of files to be stripped. Starting with
-# CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which
-# enables stripping of all files (a list of files evaluates to TRUE
-# in CMake, so this change is compatible).
-##end
+#
+# .. variable:: CPACK_RESOURCE_FILE_README
+#
+# ReadMe file to be embedded in the installer. It typically describes in
+# some detail the purpose of the project during the installation. Not all
+# CPack generators uses this file.
+#
+# .. variable:: CPACK_RESOURCE_FILE_WELCOME
+#
+# Welcome file to be embedded in the installer. It welcomes users to this
+# installer. Typically used in the graphical installers on Windows and Mac
+# OS X.
+#
+# .. variable:: CPACK_MONOLITHIC_INSTALL
+#
+# Disables the component-based installation mechanism. When set the
+# component specification is ignored and all installed items are put in a
+# single "MONOLITHIC" package. Some CPack generators do monolithic
+# packaging by default and may be asked to do component packaging by
+# setting CPACK_<GENNAME>_COMPONENT_INSTALL to 1/TRUE.
+#
+# .. variable:: CPACK_GENERATOR
+#
+# List of CPack generators to use. If not specified, CPack will create a
+# set of options CPACK_BINARY_<GENNAME> (e.g., CPACK_BINARY_NSIS) allowing
+# the user to enable/disable individual generators. This variable may be
+# used on the command line as well as in::
+#
+# cpack -D CPACK_GENERATOR="ZIP;TGZ" /path/to/build/tree
+#
+# .. variable:: CPACK_OUTPUT_CONFIG_FILE
+#
+# The name of the CPack binary configuration file. This file is the CPack
+# configuration generated by the CPack module for binary
+# installers. Defaults to CPackConfig.cmake.
+#
+# .. variable:: CPACK_PACKAGE_EXECUTABLES
+#
+# Lists each of the executables and associated text label to be used to
+# create Start Menu shortcuts. For example, setting this to the list
+# ccmake;CMake will create a shortcut named "CMake" that will execute the
+# installed executable ccmake. Not all CPack generators use it (at least
+# NSIS, WIX and OSXX11 do).
+#
+# .. variable:: CPACK_STRIP_FILES
+#
+# List of files to be stripped. Starting with CMake 2.6.0 CPACK_STRIP_FILES
+# will be a boolean variable which enables stripping of all files (a list
+# of files evaluates to TRUE in CMake, so this change is compatible).
+#
+# .. variable:: CPACK_VERBATIM_VARIABLES
+#
+# If set to TRUE, values of variables prefixed with CPACK_ will be escaped
+# before being written to the configuration files, so that the cpack program
+# receives them exactly as they were specified. If not, characters like quotes
+# and backslashes can cause parsing errors or alter the value received by the
+# cpack program. Defaults to FALSE for backwards compatibility.
+#
+# * Mandatory : NO
+# * Default : FALSE
#
# The following CPack variables are specific to source packages, and
# will not affect binary packages:
#
-##variable
-# CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package. For
-# example cmake-2.6.1.
-##end
-#
-##variable
-# CPACK_SOURCE_STRIP_FILES - List of files in the source tree that
-# will be stripped. Starting with CMake 2.6.0
-# CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables
-# stripping of all files (a list of files evaluates to TRUE in CMake,
-# so this change is compatible).
-##end
-#
-##variable
-# CPACK_SOURCE_GENERATOR - List of generators used for the source
-# packages. As with CPACK_GENERATOR, if this is not specified then
-# CPack will create a set of options (e.g., CPACK_SOURCE_ZIP)
-# allowing users to select which packages will be generated.
-##end
-#
-##variable
-# CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack source
-# configuration file. This file is the CPack configuration generated by the
-# CPack module for source installers. Defaults to CPackSourceConfig.cmake.
-##end
-#
-##variable
-# CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree
-# that won't be packaged when building a source package. This is a
-# list of regular expression patterns (that must be properly escaped),
-# e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*
-##end
+# .. variable:: CPACK_SOURCE_PACKAGE_FILE_NAME
+#
+# The name of the source package. For example cmake-2.6.1.
+#
+# .. variable:: CPACK_SOURCE_STRIP_FILES
+#
+# List of files in the source tree that will be stripped. Starting with
+# CMake 2.6.0 CPACK_SOURCE_STRIP_FILES will be a boolean variable which
+# enables stripping of all files (a list of files evaluates to TRUE in
+# CMake, so this change is compatible).
+#
+# .. variable:: CPACK_SOURCE_GENERATOR
+#
+# List of generators used for the source packages. As with CPACK_GENERATOR,
+# if this is not specified then CPack will create a set of options (e.g.,
+# CPACK_SOURCE_ZIP) allowing users to select which packages will be
+# generated.
+#
+# .. variable:: CPACK_SOURCE_OUTPUT_CONFIG_FILE
+#
+# The name of the CPack source configuration file. This file is the CPack
+# configuration generated by the CPack module for source
+# installers. Defaults to CPackSourceConfig.cmake.
+#
+# .. variable:: CPACK_SOURCE_IGNORE_FILES
+#
+# Pattern of files in the source tree that won't be packaged when building
+# a source package. This is a list of regular expression patterns (that
+# must be properly escaped), e.g.,
+# /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*
#
# The following variables are for advanced uses of CPack:
#
-##variable
-# CPACK_CMAKE_GENERATOR - What CMake generator should be used if the
-# project is CMake project. Defaults to the value of CMAKE_GENERATOR
-# few users will want to change this setting.
-##end
-#
-##variable
-# CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify
-# what project to install. The four values are: Build directory,
-# Project Name, Project Component, Directory. If omitted, CPack will
-# build an installer that installers everything.
-##end
-#
-##variable
-# CPACK_SYSTEM_NAME - System name, defaults to the value of
-# ${CMAKE_SYSTEM_NAME}.
-##end
-#
-##variable
-# CPACK_PACKAGE_VERSION - Package full version, used internally. By
-# default, this is built from CPACK_PACKAGE_VERSION_MAJOR,
-# CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH.
-##end
-#
-##variable
-# CPACK_TOPLEVEL_TAG - Directory for the installed files.
-##end
-#
-##variable
-# CPACK_INSTALL_COMMANDS - Extra commands to install components.
-##end
-#
-##variable
-# CPACK_INSTALLED_DIRECTORIES - Extra directories to install.
-##end
-#
-##variable
-# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when
-# installing this project. This is only used by installer for Windows.
-# The default value is based on the installation directory.
-##end
-##variable
-# CPACK_CREATE_DESKTOP_LINKS - List of desktop links to create.
-##end
+# .. variable:: CPACK_CMAKE_GENERATOR
+#
+# What CMake generator should be used if the project is CMake
+# project. Defaults to the value of CMAKE_GENERATOR few users will want to
+# change this setting.
+#
+# .. variable:: CPACK_INSTALL_CMAKE_PROJECTS
+#
+# List of four values that specify what project to install. The four values
+# are: Build directory, Project Name, Project Component, Directory. If
+# omitted, CPack will build an installer that installs everything.
+#
+# .. variable:: CPACK_SYSTEM_NAME
+#
+# System name, defaults to the value of ${CMAKE_SYSTEM_NAME}.
+#
+# .. variable:: CPACK_PACKAGE_VERSION
+#
+# Package full version, used internally. By default, this is built from
+# CPACK_PACKAGE_VERSION_MAJOR, CPACK_PACKAGE_VERSION_MINOR, and
+# CPACK_PACKAGE_VERSION_PATCH.
+#
+# .. variable:: CPACK_TOPLEVEL_TAG
+#
+# Directory for the installed files.
+#
+# .. variable:: CPACK_INSTALL_COMMANDS
+#
+# Extra commands to install components.
+#
+# .. variable:: CPACK_INSTALLED_DIRECTORIES
+#
+# Extra directories to install.
#
+# .. variable:: CPACK_PACKAGE_INSTALL_REGISTRY_KEY
+#
+# Registry key used when installing this project. This is only used by
+# installer for Windows. The default value is based on the installation
+# directory.
+#
+# .. variable:: CPACK_CREATE_DESKTOP_LINKS
+#
+# List of desktop links to create.
+# Each desktop link requires a corresponding start menu shortcut
+# as created by :variable:`CPACK_PACKAGE_EXECUTABLES`.
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -306,49 +310,68 @@ endif()
include(CPackComponent)
# Macro for setting values if a user did not overwrite them
+# Mangles CMake-special characters. Only kept for backwards compatibility.
macro(cpack_set_if_not_set name value)
- if(NOT DEFINED "${name}")
- set(${name} "${value}")
- endif()
+ message(DEPRECATION "cpack_set_if_not_set is obsolete; do not use.")
+ _cpack_set_default("${name}" "${value}")
endmacro()
-# cpack_encode_variables - Macro to encode variables for the configuration file
+# cpack_encode_variables - Function to encode variables for the configuration file
# find any variable that starts with CPACK and create a variable
# _CPACK_OTHER_VARIABLES_ that contains SET commands for
# each cpack variable. _CPACK_OTHER_VARIABLES_ is then
# used as an @ replacment in configure_file for the CPackConfig.
-macro(cpack_encode_variables)
- set(_CPACK_OTHER_VARIABLES_)
+function(cpack_encode_variables)
+ set(commands "")
get_cmake_property(res VARIABLES)
foreach(var ${res})
- if("xxx${var}" MATCHES "xxxCPACK")
- set(_CPACK_OTHER_VARIABLES_
- "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")")
+ if(var MATCHES "^CPACK")
+ if(CPACK_VERBATIM_VARIABLES)
+ _cpack_escape_for_cmake(value "${${var}}")
+ else()
+ set(value "${${var}}")
endif()
+
+ set(commands "${commands}\nSET(${var} \"${value}\")")
+ endif()
endforeach()
-endmacro()
+
+ set(_CPACK_OTHER_VARIABLES_ "${commands}" PARENT_SCOPE)
+endfunction()
+
+# Internal use functions
+function(_cpack_set_default name value)
+ if(NOT DEFINED "${name}")
+ set("${name}" "${value}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(_cpack_escape_for_cmake var value)
+ string(REGEX REPLACE "([\\\$\"])" "\\\\\\1" escaped "${value}")
+ set("${var}" "${escaped}" PARENT_SCOPE)
+endfunction()
# Set the package name
-cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
-cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MAJOR "0")
-cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MINOR "1")
-cpack_set_if_not_set(CPACK_PACKAGE_VERSION_PATCH "1")
-cpack_set_if_not_set(CPACK_PACKAGE_VERSION
+_cpack_set_default(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
+_cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0")
+_cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "1")
+_cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "1")
+_cpack_set_default(CPACK_PACKAGE_VERSION
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
-cpack_set_if_not_set(CPACK_PACKAGE_VENDOR "Humanity")
-cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
+_cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity")
+_cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"${CMAKE_PROJECT_NAME} built using CMake")
-cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_FILE
+_cpack_set_default(CPACK_PACKAGE_DESCRIPTION_FILE
"${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
-cpack_set_if_not_set(CPACK_RESOURCE_FILE_LICENSE
+_cpack_set_default(CPACK_RESOURCE_FILE_LICENSE
"${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
-cpack_set_if_not_set(CPACK_RESOURCE_FILE_README
+_cpack_set_default(CPACK_RESOURCE_FILE_README
"${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
-cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME
+_cpack_set_default(CPACK_RESOURCE_FILE_WELCOME
"${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt")
-cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
+_cpack_set_default(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
if(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL)
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
@@ -359,29 +382,34 @@ if(CPACK_NSIS_MODIFY_PATH)
endif()
set(__cpack_system_name ${CMAKE_SYSTEM_NAME})
-if(${__cpack_system_name} MATCHES Windows)
- if(CMAKE_CL_64)
+if(__cpack_system_name MATCHES "Windows")
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(__cpack_system_name win64)
else()
set(__cpack_system_name win32)
endif()
endif()
-cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}")
+_cpack_set_default(CPACK_SYSTEM_NAME "${__cpack_system_name}")
# Root dir: default value should be the string literal "$PROGRAMFILES"
# for backwards compatibility. Projects may set this value to anything.
-set(__cpack_root_default "$PROGRAMFILES")
-cpack_set_if_not_set(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")
+# When creating 64 bit binaries we set the default value to "$PROGRAMFILES64"
+if("x${__cpack_system_name}" STREQUAL "xwin64")
+ set(__cpack_root_default "$PROGRAMFILES64")
+else()
+ set(__cpack_root_default "$PROGRAMFILES")
+endif()
+_cpack_set_default(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")
# <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
-cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME
+_cpack_set_default(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
-cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY
+_cpack_set_default(CPACK_PACKAGE_INSTALL_DIRECTORY
"${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
-cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
+_cpack_set_default(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
"${CPACK_PACKAGE_INSTALL_DIRECTORY}")
-cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
-cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true")
+_cpack_set_default(CPACK_PACKAGE_DEFAULT_LOCATION "/")
+_cpack_set_default(CPACK_PACKAGE_RELOCATABLE "true")
# always force to exactly "true" or "false" for CPack.Info.plist.in:
if(CPACK_PACKAGE_RELOCATABLE)
@@ -407,15 +435,16 @@ macro(cpack_optional_append _list _cond _item)
endif()
endmacro()
-##variable
-# CPACK_BINARY_<GENNAME> - CPack generated options for binary generators. The
-# CPack.cmake module generates (when CPACK_GENERATOR is not set)
-# a set of CMake options (see CMake option command) which may then be used to
-# select the CPack generator(s) to be used when launching the package target.
-##end
-# Provide options to choose generators
-# we might check here if the required tools for the generates exist
-# and set the defaults according to the results
+#.rst:
+# .. variable:: CPACK_BINARY_<GENNAME>
+#
+# CPack generated options for binary generators. The CPack.cmake module
+# generates (when CPACK_GENERATOR is not set) a set of CMake options (see
+# CMake option command) which may then be used to select the CPack
+# generator(s) to be used when launching the package target.
+#
+# Provide options to choose generators we might check here if the required
+# tools for the generates exist and set the defaults according to the results
if(NOT CPACK_GENERATOR)
if(UNIX)
if(CYGWIN)
@@ -424,35 +453,41 @@ if(NOT CPACK_GENERATOR)
if(APPLE)
option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF)
option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF)
- option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" ON)
option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF)
+ option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" OFF)
else()
option(CPACK_BINARY_TZ "Enable to build TZ packages" ON)
endif()
- option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON)
- option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON)
- option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF)
option(CPACK_BINARY_DEB "Enable to build Debian packages" OFF)
- option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF)
option(CPACK_BINARY_NSIS "Enable to build NSIS packages" OFF)
+ option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF)
+ option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON)
+ option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF)
+ option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON)
+ option(CPACK_BINARY_TXZ "Enable to build TXZ packages" OFF)
endif()
else()
+ option(CPACK_BINARY_7Z "Enable to build 7-Zip packages" OFF)
option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF)
option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF)
endif()
+ option(CPACK_BINARY_IFW "Enable to build IFW packages" OFF)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_7Z 7Z)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle)
- cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop)
- cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker)
- cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_CYGWIN CygwinBinary)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DEB DEB)
- cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_IFW IFW)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_STGZ STGZ)
- cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TXZ TXZ)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_WIX WIX)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP)
@@ -467,33 +502,57 @@ if(NOT CPACK_SOURCE_GENERATOR)
else()
option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON)
option(CPACK_SOURCE_TGZ "Enable to build TGZ source packages" ON)
+ option(CPACK_SOURCE_TXZ "Enable to build TXZ source packages" ON)
option(CPACK_SOURCE_TZ "Enable to build TZ source packages" ON)
option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF)
endif()
else()
+ option(CPACK_SOURCE_7Z "Enable to build 7-Zip source packages" ON)
option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON)
endif()
+ cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_7Z 7Z)
cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_CYGWIN CygwinSource)
- cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ)
cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TBZ2 TBZ2)
+ cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ)
+ cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TXZ TXZ)
cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TZ TZ)
cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP)
endif()
# mark the above options as advanced
-mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11
- CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2
- CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ
- CPACK_BINARY_NSIS CPACK_BINARY_WIX CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
- CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
- CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
+mark_as_advanced(
+ CPACK_BINARY_7Z
+ CPACK_BINARY_BUNDLE
+ CPACK_BINARY_CYGWIN
+ CPACK_BINARY_DEB
+ CPACK_BINARY_DRAGNDROP
+ CPACK_BINARY_IFW
+ CPACK_BINARY_NSIS
+ CPACK_BINARY_OSXX11
+ CPACK_BINARY_PACKAGEMAKER
+ CPACK_BINARY_RPM
+ CPACK_BINARY_STGZ
+ CPACK_BINARY_TBZ2
+ CPACK_BINARY_TGZ
+ CPACK_BINARY_TXZ
+ CPACK_BINARY_TZ
+ CPACK_BINARY_WIX
+ CPACK_BINARY_ZIP
+ CPACK_SOURCE_7Z
+ CPACK_SOURCE_CYGWIN
+ CPACK_SOURCE_TBZ2
+ CPACK_SOURCE_TGZ
+ CPACK_SOURCE_TXZ
+ CPACK_SOURCE_TZ
+ CPACK_SOURCE_ZIP
+ )
# Set some other variables
-cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
+_cpack_set_default(CPACK_INSTALL_CMAKE_PROJECTS
"${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
-cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
-cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
+_cpack_set_default(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
+_cpack_set_default(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
# if the user has set CPACK_NSIS_DISPLAY_NAME remember it
if(DEFINED CPACK_NSIS_DISPLAY_NAME)
set(CPACK_NSIS_DISPLAY_NAME_SET TRUE)
@@ -502,30 +561,33 @@ endif()
# explicitly, then use that as the default
# value of CPACK_NSIS_PACKAGE_NAME instead
# of CPACK_PACKAGE_INSTALL_DIRECTORY
-cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+_cpack_set_default(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
if(CPACK_NSIS_DISPLAY_NAME_SET)
- string(REPLACE "\\" "\\\\"
- _NSIS_DISPLAY_NAME_TMP "${CPACK_NSIS_DISPLAY_NAME}")
- cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${_NSIS_DISPLAY_NAME_TMP}")
+ _cpack_set_default(CPACK_NSIS_PACKAGE_NAME "${CPACK_NSIS_DISPLAY_NAME}")
else()
- cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+ _cpack_set_default(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
endif()
-cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE
+_cpack_set_default(CPACK_OUTPUT_CONFIG_FILE
"${CMAKE_BINARY_DIR}/CPackConfig.cmake")
-cpack_set_if_not_set(CPACK_SOURCE_OUTPUT_CONFIG_FILE
+_cpack_set_default(CPACK_SOURCE_OUTPUT_CONFIG_FILE
"${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")
-cpack_set_if_not_set(CPACK_SET_DESTDIR OFF)
-cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+_cpack_set_default(CPACK_SET_DESTDIR OFF)
+_cpack_set_default(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
-cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
-cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
+_cpack_set_default(CPACK_NSIS_INSTALLER_ICON_CODE "")
+_cpack_set_default(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
# WiX specific variables
-cpack_set_if_not_set(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
+_cpack_set_default(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
+
+# set sysroot so SDK tools can be used
+if(CMAKE_OSX_SYSROOT)
+ _cpack_set_default(CPACK_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}")
+endif()
if(DEFINED CPACK_COMPONENTS_ALL)
if(CPACK_MONOLITHIC_INSTALL)
@@ -561,16 +623,23 @@ set(CPACK_COMPONENT_UNSPECIFIED_HIDDEN TRUE)
set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED TRUE)
cpack_encode_variables()
-configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)
+configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY)
# Generate source file
-cpack_set_if_not_set(CPACK_SOURCE_INSTALLED_DIRECTORIES
+_cpack_set_default(CPACK_SOURCE_INSTALLED_DIRECTORIES
"${CMAKE_SOURCE_DIR};/")
-cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source")
-cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME
+_cpack_set_default(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source")
+_cpack_set_default(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")
-cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES
- "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#")
+
+set(__cpack_source_ignore_files_default
+ "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#")
+if(NOT CPACK_VERBATIM_VARIABLES)
+ _cpack_escape_for_cmake(__cpack_source_ignore_files_default
+ "${__cpack_source_ignore_files_default}")
+endif()
+_cpack_set_default(CPACK_SOURCE_IGNORE_FILES "${__cpack_source_ignore_files_default}")
+
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")
set(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}")
set(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}")
@@ -581,4 +650,4 @@ set(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}")
cpack_encode_variables()
configure_file("${cpack_source_input_file}"
- "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)
+ "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY)
diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake
index 0da51e30b..b41221612 100644
--- a/Modules/CPackBundle.cmake
+++ b/Modules/CPackBundle.cmake
@@ -1,36 +1,68 @@
-##section Variables specific to CPack Bundle generator
-##end
-##module
-# - CPack Bundle generator (Mac OS X) specific options
+#.rst:
+# CPackBundle
+# -----------
+#
+# CPack Bundle generator (Mac OS X) specific options
+#
+# Variables specific to CPack Bundle generator
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# Installers built on Mac OS X using the Bundle generator use the
-# aforementioned DragNDrop (CPACK_DMG_xxx) variables, plus
-# the following Bundle-specific parameters (CPACK_BUNDLE_xxx).
-##end
-#
-##variable
-# CPACK_BUNDLE_NAME - The name of the generated bundle. This
-# appears in the OSX finder as the bundle name. Required.
-##end
-#
-##variable
-# CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used
-# for the generated bundle. This assumes that the caller has generated
-# or specified their own Info.plist file. Required.
-##end
-#
-##variable
-# CPACK_BUNDLE_ICON - Path to an OSX icon file that will be used as
-# the icon for the generated bundle. This is the icon that appears in the
-# OSX finder for the bundle, and in the OSX dock when the bundle is opened.
-# Required.
-##end
-#
-##variable
-# CPACK_BUNDLE_STARTUP_COMMAND - Path to a startup script. This is a path to
-# an executable or script that will be run whenever an end-user double-clicks
-# the generated bundle in the OSX Finder. Optional.
-##end
+# aforementioned DragNDrop (CPACK_DMG_xxx) variables, plus the following
+# Bundle-specific parameters (CPACK_BUNDLE_xxx).
+#
+# .. variable:: CPACK_BUNDLE_NAME
+#
+# The name of the generated bundle. This appears in the OSX finder as the
+# bundle name. Required.
+#
+# .. variable:: CPACK_BUNDLE_PLIST
+#
+# Path to an OSX plist file that will be used for the generated bundle. This
+# assumes that the caller has generated or specified their own Info.plist
+# file. Required.
+#
+# .. variable:: CPACK_BUNDLE_ICON
+#
+# Path to an OSX icon file that will be used as the icon for the generated
+# bundle. This is the icon that appears in the OSX finder for the bundle, and
+# in the OSX dock when the bundle is opened. Required.
+#
+# .. variable:: CPACK_BUNDLE_STARTUP_COMMAND
+#
+# Path to a startup script. This is a path to an executable or script that
+# will be run whenever an end-user double-clicks the generated bundle in the
+# OSX Finder. Optional.
+#
+# .. variable:: CPACK_BUNDLE_APPLE_CERT_APP
+#
+# The name of your Apple supplied code signing certificate for the application.
+# The name usually takes the form "Developer ID Application: [Name]" or
+# "3rd Party Mac Developer Application: [Name]". If this variable is not set
+# the application will not be signed.
+#
+# .. variable:: CPACK_BUNDLE_APPLE_ENTITLEMENTS
+#
+# The name of the plist file that contains your apple entitlements for sandboxing
+# your application. This file is required for submission to the Mac App Store.
+#
+# .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_FILES
+#
+# A list of additional files that you wish to be signed. You do not need to
+# list the main application folder, or the main executable. You should
+# list any frameworks and plugins that are included in your app bundle.
+#
+# .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER
+#
+# Additional parameter that will passed to codesign.
+# Default value: "--deep -f"
+#
+# .. variable:: CPACK_COMMAND_CODESIGN
+#
+# Path to the codesign(1) command used to sign applications with an
+# Apple cert. This variable can be used to override the automatically
+# detected command (or specify its location if the auto-detection fails
+# to find it.)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake
index c85cfb454..96d5609ee 100644
--- a/Modules/CPackComponent.cmake
+++ b/Modules/CPackComponent.cmake
@@ -1,265 +1,288 @@
-##section Variables concerning CPack Components
-##end
-##module
-# - Build binary and source package installers
+#.rst:
+# CPackComponent
+# --------------
#
-# The CPackComponent module is the module which handles
-# the component part of CPack. See CPack module for
-# general information about CPack.
+# 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 Mac OS X 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.
+# 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:
-##end
-#
-##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.
-##end
-#
-##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.
-##end
-##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) component
-# - 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.
-##end
-##variable
-# CPACK_COMPONENT_<compName>_DISPLAY_NAME - The name to be displayed for a component.
-##end
-##variable
-# CPACK_COMPONENT_<compName>_DESCRIPTION - The description of a component.
-##end
-##variable
-# CPACK_COMPONENT_<compName>_GROUP - The group of a component.
-##end
-##variable
-# CPACK_COMPONENT_<compName>_DEPENDS - The dependencies (list of components)
-# on which this component depends.
-##end
-##variable
-# CPACK_COMPONENT_<compName>_REQUIRED - True is this component is required.
-##end
-##macro
-#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])
-#
-#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.
-##end
-#
-##macro
-#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.
-##end
-#
-##macro
-#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.
-##end
-#
-##macro
-#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 Mac OS X, installers that download components on-the-fly can
-#only be built and installed on system using Mac OS X 10.5 or
-#later.
-#
-#The site argument is a URL where the archives for downloadable
-#components will reside, e.g., http://www.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.
-##endmacro
+# 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.
+#
+# .. 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) component
+# * 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>_REQUIRED
+#
+# True is this component is required.
+#
+# .. 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])
+#
+#
+#
+# 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.
+#
+# .. 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 Mac OS X, installers that download components on-the-fly can only
+# be built and installed on system using Mac OS X 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.
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -278,7 +301,7 @@
if(NOT CPackComponent_CMake_INCLUDED)
set(CPackComponent_CMake_INCLUDED 1)
-# Argument-parsing macro from http://www.cmake.org/Wiki/CMakeMacroParseArguments
+# Argument-parsing macro from https://cmake.org/Wiki/CMakeMacroParseArguments
macro(cpack_parse_arguments prefix arg_names option_names)
set(${prefix}_DEFAULT_ARGS)
foreach(arg_name ${arg_names})
@@ -352,17 +375,17 @@ endmacro()
# Macro that adds a component to the CPack installer
macro(cpack_add_component compname)
- string(TOUPPER ${compname} CPACK_ADDCOMP_UNAME)
- cpack_parse_arguments(CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}
+ string(TOUPPER ${compname} _CPACK_ADDCOMP_UNAME)
+ cpack_parse_arguments(CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}
"DISPLAY_NAME;DESCRIPTION;GROUP;DEPENDS;INSTALL_TYPES;ARCHIVE_FILE"
"HIDDEN;REQUIRED;DISABLED;DOWNLOADED"
${ARGN}
)
- if (CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED)
- set(CPACK_ADDCOMP_STR "\n# Configuration for downloaded component \"${compname}\"\n")
+ if (CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_DOWNLOADED)
+ set(_CPACK_ADDCOMP_STR "\n# Configuration for downloaded component \"${compname}\"\n")
else ()
- set(CPACK_ADDCOMP_STR "\n# Configuration for component \"${compname}\"\n")
+ set(_CPACK_ADDCOMP_STR "\n# Configuration for component \"${compname}\"\n")
endif ()
if(NOT CPACK_MONOLITHIC_INSTALL)
@@ -371,51 +394,51 @@ macro(cpack_add_component compname)
# take care of any components that have been added after the CPack
# moduled was included.
if(NOT CPACK_COMPONENTS_ALL_SET_BY_USER)
- get_cmake_property(CPACK_ADDCOMP_COMPONENTS COMPONENTS)
- set(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL")
- foreach(COMP ${CPACK_ADDCOMP_COMPONENTS})
- set(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR} ${COMP}")
+ get_cmake_property(_CPACK_ADDCOMP_COMPONENTS COMPONENTS)
+ set(_CPACK_ADDCOMP_STR "${_CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL")
+ foreach(COMP ${_CPACK_ADDCOMP_COMPONENTS})
+ set(_CPACK_ADDCOMP_STR "${_CPACK_ADDCOMP_STR} ${COMP}")
endforeach()
- set(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR})\n")
+ set(_CPACK_ADDCOMP_STR "${_CPACK_ADDCOMP_STR})\n")
endif()
endif()
cpack_append_string_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISPLAY_NAME
- CPACK_ADDCOMP_STR)
+ CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_DISPLAY_NAME
+ _CPACK_ADDCOMP_STR)
cpack_append_string_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DESCRIPTION
- CPACK_ADDCOMP_STR)
+ CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_DESCRIPTION
+ _CPACK_ADDCOMP_STR)
cpack_append_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_GROUP
- CPACK_ADDCOMP_STR)
+ CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_GROUP
+ _CPACK_ADDCOMP_STR)
cpack_append_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DEPENDS
- CPACK_ADDCOMP_STR)
+ CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_DEPENDS
+ _CPACK_ADDCOMP_STR)
cpack_append_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_INSTALL_TYPES
- CPACK_ADDCOMP_STR)
+ CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_INSTALL_TYPES
+ _CPACK_ADDCOMP_STR)
cpack_append_string_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_ARCHIVE_FILE
- CPACK_ADDCOMP_STR)
+ CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_ARCHIVE_FILE
+ _CPACK_ADDCOMP_STR)
cpack_append_option_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_HIDDEN
- CPACK_ADDCOMP_STR)
+ CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_HIDDEN
+ _CPACK_ADDCOMP_STR)
cpack_append_option_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_REQUIRED
- CPACK_ADDCOMP_STR)
+ CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_REQUIRED
+ _CPACK_ADDCOMP_STR)
cpack_append_option_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISABLED
- CPACK_ADDCOMP_STR)
+ CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_DISABLED
+ _CPACK_ADDCOMP_STR)
cpack_append_option_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED
- CPACK_ADDCOMP_STR)
+ CPACK_COMPONENT_${_CPACK_ADDCOMP_UNAME}_DOWNLOADED
+ _CPACK_ADDCOMP_STR)
# Backward compatibility issue.
# Write to config iff the macros is used after CPack.cmake has been
# included, other it's not necessary because the variables
# will be encoded by cpack_encode_variables.
if(CPack_CMake_INCLUDED)
- file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDCOMP_STR}")
+ file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_ADDCOMP_STR}")
endif()
endmacro()
@@ -423,7 +446,7 @@ endmacro()
macro(cpack_add_component_group grpname)
string(TOUPPER ${grpname} CPACK_ADDGRP_UNAME)
cpack_parse_arguments(CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}
- "DISPLAY_NAME;DESCRIPTION"
+ "DISPLAY_NAME;DESCRIPTION;PARENT_GROUP"
"EXPANDED;BOLD_TITLE"
${ARGN}
)
@@ -435,6 +458,9 @@ macro(cpack_add_component_group grpname)
cpack_append_string_variable_set_command(
CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION
CPACK_ADDGRP_STR)
+ cpack_append_string_variable_set_command(
+ CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_PARENT_GROUP
+ CPACK_ADDGRP_STR)
cpack_append_option_set_command(
CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED
CPACK_ADDGRP_STR)
diff --git a/Modules/CPackCygwin.cmake b/Modules/CPackCygwin.cmake
index 7ed7f678b..abfc1f619 100644
--- a/Modules/CPackCygwin.cmake
+++ b/Modules/CPackCygwin.cmake
@@ -1,23 +1,27 @@
-##section Variables specific to CPack Cygwin generator
-##end
-##module
-# - Cygwin CPack generator (Cygwin).
-# The following variable is specific to installers build on
-# and/or for Cygwin:
-##end
-#
-##variable
-# CPACK_CYGWIN_PATCH_NUMBER - The Cygwin patch number.
-# FIXME: This documentation is incomplete.
-##end
-##variable
-# CPACK_CYGWIN_PATCH_FILE - The Cygwin patch file.
-# FIXME: This documentation is incomplete.
-##end
-##variable
-# CPACK_CYGWIN_BUILD_SCRIPT - The Cygwin build script.
-# FIXME: This documentation is incomplete.
-##end
+#.rst:
+# CPackCygwin
+# -----------
+#
+# Cygwin CPack generator (Cygwin).
+#
+# Variables specific to CPack Cygwin generator
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# The
+# following variable is specific to installers build on and/or for
+# Cygwin:
+#
+# .. variable:: CPACK_CYGWIN_PATCH_NUMBER
+#
+# The Cygwin patch number. FIXME: This documentation is incomplete.
+#
+# .. variable:: CPACK_CYGWIN_PATCH_FILE
+#
+# The Cygwin patch file. FIXME: This documentation is incomplete.
+#
+# .. variable:: CPACK_CYGWIN_BUILD_SCRIPT
+#
+# The Cygwin build script. FIXME: This documentation is incomplete.
#=============================================================================
# Copyright 2006-2012 Kitware, Inc.
diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake
index e866bab80..e34f8cd1a 100644
--- a/Modules/CPackDMG.cmake
+++ b/Modules/CPackDMG.cmake
@@ -1,60 +1,100 @@
-##section Variables specific to CPack DragNDrop generator
-##end
-##module
-# - DragNDrop CPack generator (Mac OS X).
-# The following variables are specific to the DragNDrop installers
-# built on Mac OS X:
-##end
-#
-##variable
-# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk
-# image. Defaults to CPACK_PACKAGE_FILE_NAME.
-##end
-#
-##variable
-# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO
-# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF
-# bzip2-compressed). Refer to hdiutil(1) for more information on
-# other available formats.
-##end
-#
-##variable
-# CPACK_DMG_DS_STORE - Path to a custom DS_Store file. This .DS_Store
-# file e.g. can be used to specify the Finder window
-# position/geometry and layout (such as hidden toolbars, placement of the
-# icons etc.). This file has to be generated by the Finder (either manually or
-# through OSA-script) using a normal folder from which the .DS_Store
-# file can then be extracted.
-##end
-#
-##variable
-# CPACK_DMG_BACKGROUND_IMAGE - Path to a background image file. This
-# file will be used as the background for the Finder Window when the disk
-# image is opened. By default no background image is set. The background
-# image is applied after applying the custom .DS_Store file.
-##end
-#
-##variable
-# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to
-# operate on disk image files on Mac OS X. This variable can be used
-# to override the automatically detected command (or specify its
-# location if the auto-detection fails to find it.)
-##end
-#
-##variable
-# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set
-# extended attributes on files and directories on Mac OS X. This
-# variable can be used to override the automatically detected
-# command (or specify its location if the auto-detection fails to
-# find it.)
-##end
-#
-##variable
-# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile
-# resources on Mac OS X. This variable can be used to override the
+#.rst:
+# CPackDMG
+# --------
+#
+# DragNDrop CPack generator (Mac OS X).
+#
+# Variables specific to CPack DragNDrop generator
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# The following variables are specific to the DragNDrop installers built
+# on Mac OS X:
+#
+# .. variable:: CPACK_DMG_VOLUME_NAME
+#
+# The volume name of the generated disk image. Defaults to
+# CPACK_PACKAGE_FILE_NAME.
+#
+# .. variable:: CPACK_DMG_FORMAT
+#
+# The disk image format. Common values are UDRO (UDIF read-only), UDZO (UDIF
+# zlib-compressed) or UDBZ (UDIF bzip2-compressed). Refer to hdiutil(1) for
+# more information on other available formats.
+#
+# .. variable:: CPACK_DMG_DS_STORE
+#
+# Path to a custom DS_Store file. This .DS_Store file e.g. can be used to
+# specify the Finder window position/geometry and layout (such as hidden
+# toolbars, placement of the icons etc.). This file has to be generated by
+# the Finder (either manually or through AppleScript) using a normal folder
+# from which the .DS_Store file can then be extracted.
+#
+# .. variable:: CPACK_DMG_DS_STORE_SETUP_SCRIPT
+#
+# Path to a custom AppleScript file. This AppleScript is used to generate
+# a .DS_Store file which specifies the Finder window position/geometry and
+# layout (such as hidden toolbars, placement of the icons etc.).
+# By specifying a custom AppleScript there is no need to use
+# CPACK_DMG_DS_STORE, as the .DS_Store that is generated by the AppleScript
+# will be packaged.
+#
+# .. variable:: CPACK_DMG_BACKGROUND_IMAGE
+#
+# Path to an image file to be used as the background. This file will be
+# copied to .background/background.<ext>, where ext is the original image file
+# extension. The background image is installed into the image before
+# CPACK_DMG_DS_STORE_SETUP_SCRIPT is executed or CPACK_DMG_DS_STORE is
+# installed. By default no background image is set.
+#
+# .. variable:: CPACK_DMG_SLA_DIR
+#
+# Directory where license and menu files for different languages are stored.
+# Setting this causes CPack to look for a ``<language>.menu.txt`` and
+# ``<language>.license.txt`` file for every language defined in
+# ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and
+# ``CPACK_RESOURCE_FILE_LICENSE`` are set, CPack will only look for the menu
+# files and use the same license file for all languages.
+#
+# .. variable:: CPACK_DMG_SLA_LANGUAGES
+#
+# Languages for which a license agreement is provided when mounting the
+# generated DMG. A menu file consists of 9 lines of text. The first line is
+# is the name of the language itself, uppercase, in English (e.g. German).
+# The other lines are translations of the following strings:
+#
+# - Agree
+# - Disagree
+# - Print
+# - Save...
+# - You agree to the terms of the License Agreement when you click the
+# "Agree" button.
+# - Software License Agreement
+# - This text cannot be saved. The disk may be full or locked, or the file
+# may be locked.
+# - Unable to print. Make sure you have selected a printer.
+#
+# For every language in this list, CPack will try to find files
+# ``<language>.menu.txt`` and ``<language>.license.txt`` in the directory
+# specified by the :variable:`CPACK_DMG_SLA_DIR` variable.
+#
+# .. variable:: CPACK_COMMAND_HDIUTIL
+#
+# Path to the hdiutil(1) command used to operate on disk image files on Mac
+# OS X. This variable can be used to override the automatically detected
+# command (or specify its location if the auto-detection fails to find it.)
+#
+# .. variable:: CPACK_COMMAND_SETFILE
+#
+# Path to the SetFile(1) command used to set extended attributes on files and
+# directories on Mac OS X. This variable can be used to override the
# automatically detected command (or specify its location if the
# auto-detection fails to find it.)
-##end
+#
+# .. variable:: CPACK_COMMAND_REZ
+#
+# Path to the Rez(1) command used to compile resources on Mac OS X. This
+# variable can be used to override the automatically detected command (or
+# specify its location if the auto-detection fails to find it.)
#=============================================================================
# Copyright 2006-2012 Kitware, Inc.
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 75ff3bef1..2aaef6161 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -1,170 +1,400 @@
-##section Variables specific to CPack Debian (DEB) generator
-##end
-##module
-# - The builtin (binary) CPack Deb generator (Unix only)
+#.rst:
+# CPackDeb
+# --------
+#
+# The builtin (binary) CPack Deb generator (Unix only)
+#
+# Variables specific to CPack Debian (DEB) generator
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
# CPackDeb may be used to create Deb package using CPack.
-# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables
-# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration.
-# CPackDeb generator should work on any linux host but it will
-# produce better deb package when Debian specific tools 'dpkg-xxx'
-# are usable on the build system.
-#
-# CPackDeb has specific features which are controlled by
-# the specifics CPACK_DEBIAN_XXX variables.You'll find a detailed usage on
-# the wiki:
-# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
+# CPackDeb is a CPack generator thus it uses the ``CPACK_XXX`` variables
+# used by CPack : https://cmake.org/Wiki/CMake:CPackConfiguration.
+# CPackDeb generator should work on any linux host but it will produce
+# better deb package when Debian specific tools 'dpkg-xxx' are usable on
+# the build system.
+#
+# CPackDeb has specific features which are controlled by the specifics
+# :code:`CPACK_DEBIAN_XXX` variables.
+#
+# :code:`CPACK_DEBIAN_<COMPONENT>_XXXX` variables may be used in order to have
+# **component** specific values. Note however that ``<COMPONENT>`` refers to the
+# **grouping name** written in upper case. It may be either a component name or
+# a component GROUP name.
+#
+# You'll find a detailed usage on the wiki:
+# https://cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 .
# However as a handy reminder here comes the list of specific variables:
-##end
-#
-##variable
-# CPACK_DEBIAN_PACKAGE_NAME
-# Mandatory : YES
-# Default : CPACK_PACKAGE_NAME (lower case)
-# The debian package summary
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_VERSION
-# Mandatory : YES
-# Default : CPACK_PACKAGE_VERSION
-# The debian package version
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_ARCHITECTURE
-# Mandatory : YES
-# Default : Output of dpkg --print-architecture (or i386 if dpkg is not found)
-# The debian package architecture
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_DEPENDS
-# Mandatory : NO
-# Default : -
-# May be used to set deb dependencies.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_MAINTAINER
-# Mandatory : YES
-# Default : CPACK_PACKAGE_CONTACT
-# The debian package maintainer
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_DESCRIPTION
-# Mandatory : YES
-# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY
-# The debian package description
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_SECTION
-# Mandatory : YES
-# Default : 'devel'
-# The debian package section
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_PRIORITY
-# Mandatory : YES
-# Default : 'optional'
-# The debian package priority
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_HOMEPAGE
-# Mandatory : NO
-# Default : -
-# The URL of the web site for this package, preferably (when applicable) the
-# site from which the original source can be obtained and any additional
-# upstream documentation or information may be found.
-# The content of this field is a simple URL without any surrounding
-# characters such as <>.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_SHLIBDEPS
-# Mandatory : NO
-# Default : OFF
-# May be set to ON in order to use dpkg-shlibdeps to generate
-# better package dependency list.
-# You may need set CMAKE_INSTALL_RPATH toi appropriate value
-# if you use this feature, because if you don't dpkg-shlibdeps
-# may fail to find your own shared libs.
-# See http://www.cmake.org/Wiki/CMake_RPATH_handling.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_DEBUG
-# Mandatory : NO
-# Default : -
-# May be set when invoking cpack in order to trace debug information
-# during CPackDeb run.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_PREDEPENDS
-# Mandatory : NO
-# Default : -
-# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-# This field is like Depends, except that it also forces dpkg to complete installation of
-# the packages named before even starting the installation of the package which declares
-# the pre-dependency.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_ENHANCES
-# Mandatory : NO
-# Default : -
-# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-# This field is similar to Suggests but works in the opposite direction.
-# It is used to declare that a package can enhance the functionality of another package.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_BREAKS
-# Mandatory : NO
-# Default : -
-# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-# When one binary package declares that it breaks another, dpkg will refuse to allow the
-# package which declares Breaks be installed unless the broken package is deconfigured first,
-# and it will refuse to allow the broken package to be reconfigured.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_CONFLICTS
-# Mandatory : NO
-# Default : -
-# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-# When one binary package declares a conflict with another using a Conflicts field,
-# dpkg will refuse to allow them to be installed on the system at the same time.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_PROVIDES
-# Mandatory : NO
-# Default : -
-# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-# A virtual package is one which appears in the Provides control field of another package.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_REPLACES
-# Mandatory : NO
-# Default : -
-# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-# Packages can declare in their control file that they should overwrite
-# files in certain other packages, or completely replace other packages.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_RECOMMENDS
-# Mandatory : NO
-# Default : -
-# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-# Allows packages to declare a strong, but not absolute, dependency on other packages.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_SUGGESTS
-# Mandatory : NO
-# Default : -
-# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-# Allows packages to declare a suggested package install grouping.
-##end
-##variable
-# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
-# Mandatory : NO
-# Default : -
-# This variable allow advanced user to add custom script to the control.tar.gz
-# Typical usage is for conffiles, postinst, postrm, prerm.
-# Usage: set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
-# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
-##end
-
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_NAME
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME
+#
+# Set Package control field (variable is automatically transformed to lower
+# case).
+#
+# * Mandatory : YES
+# * Default :
+#
+# - :variable:`CPACK_PACKAGE_NAME` for non-component based
+# installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with -<COMPONENT>
+# for component-based installations.
+#
+# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_VERSION
+#
+# The Debian package version
+#
+# * Mandatory : YES
+# * Default : :variable:`CPACK_PACKAGE_VERSION`
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_ARCHITECTURE
+#
+# The Debian package architecture
+#
+# * Mandatory : YES
+# * Default : Output of :code:`dpkg --print-architecture` (or :code:`i386`
+# if :code:`dpkg` is not found)
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS
+#
+# Sets the Debian dependencies of this package.
+#
+# * Mandatory : NO
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS` for component-based
+# installations.
+#
+# .. note::
+#
+# If :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or
+# more specifically :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS`
+# is set for this component, the discovered dependencies will be appended
+# to :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` instead of
+# :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`. If
+# :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` is an empty string,
+# only the automatically discovered dependencies will be set for this
+# component.
+#
+# Example::
+#
+# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)")
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER
+#
+# The Debian package maintainer
+#
+# * Mandatory : YES
+# * Default : :code:`CPACK_PACKAGE_CONTACT`
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION
+# CPACK_COMPONENT_<COMPONENT>_DESCRIPTION
+#
+# The Debian package description
+#
+# * Mandatory : YES
+# * Default :
+#
+# - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set or
+# - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_SECTION
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION
+#
+# Set Section control field e.g. admin, devel, doc, ...
+#
+# * Mandatory : YES
+# * Default : 'devel'
+#
+# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
+#
+#
+# .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
+#
+# The compression used for creating the Debian package.
+# Possible values are: lzma, xz, bzip2 and gzip.
+#
+# * Mandatory : YES
+# * Default : 'gzip'
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY
+#
+# Set Priority control field e.g. required, important, standard, optional,
+# extra
+#
+# * Mandatory : YES
+# * Default : 'optional'
+#
+# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE
+#
+# The URL of the web site for this package, preferably (when applicable) the
+# site from which the original source can be obtained and any additional
+# upstream documentation or information may be found.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# .. note::
+#
+# The content of this field is a simple URL without any surrounding
+# characters such as <>.
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS
+#
+# May be set to ON in order to use :code:`dpkg-shlibdeps` to generate
+# better package dependency list.
+#
+# * Mandatory : NO
+# * Default :
+#
+# - :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` if set or
+# - OFF
+#
+# .. note::
+#
+# You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value
+# if you use this feature, because if you don't :code:`dpkg-shlibdeps`
+# may fail to find your own shared libs.
+# See https://cmake.org/Wiki/CMake_RPATH_handling.
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG
+#
+# May be set when invoking cpack in order to trace debug information
+# during CPackDeb run.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS
+#
+# Sets the `Pre-Depends` field of the Debian package.
+# Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it
+# also forces :code:`dpkg` to complete installation of the packages named
+# before even starting the installation of the package which declares the
+# pre-dependency.
+#
+# * Mandatory : NO
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based
+# installations.
+#
+# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES
+#
+# Sets the `Enhances` field of the Debian package.
+# Similar to :variable:`Suggests <CPACK_DEBIAN_PACKAGE_SUGGESTS>` but works
+# in the opposite direction: declares that a package can enhance the
+# functionality of another package.
+#
+# * Mandatory : NO
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based
+# installations.
+#
+# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS
+#
+# Sets the `Breaks` field of the Debian package.
+# When a binary package (P) declares that it breaks other packages (B),
+# :code:`dpkg` will not allow the package (P) which declares `Breaks` be
+# **unpacked** unless the packages that will be broken (B) are deconfigured
+# first.
+# As long as the package (P) is configured, the previously deconfigured
+# packages (B) cannot be reconfigured again.
+#
+# * Mandatory : NO
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based
+# installations.
+#
+# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS
+#
+# Sets the `Conflicts` field of the Debian package.
+# When one binary package declares a conflict with another using a `Conflicts`
+# field, :code:`dpkg` will not allow them to be unpacked on the system at
+# the same time.
+#
+# * Mandatory : NO
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based
+# installations.
+#
+# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts
+#
+# .. note::
+#
+# This is a stronger restriction than
+# :variable:`Breaks <CPACK_DEBIAN_PACKAGE_BREAKS>`, which prevents the
+# broken package from being configured while the breaking package is in
+# the "Unpacked" state but allows both packages to be unpacked at the same
+# time.
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES
+#
+# Sets the `Provides` field of the Debian package.
+# A virtual package is one which appears in the `Provides` control field of
+# another package.
+#
+# * Mandatory : NO
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based
+# installations.
+#
+# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES
+#
+# Sets the `Replaces` field of the Debian package.
+# Packages can declare in their control file that they should overwrite
+# files in certain other packages, or completely replace other packages.
+#
+# * Mandatory : NO
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based
+# installations.
+#
+# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS
+#
+# Sets the `Recommends` field of the Debian package.
+# Allows packages to declare a strong, but not absolute, dependency on other
+# packages.
+#
+# * Mandatory : NO
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based
+# installations.
+#
+# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS
+#
+# Sets the `Suggests` field of the Debian package.
+# Allows packages to declare a suggested package install grouping.
+#
+# * Mandatory : NO
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based
+# installations.
+#
+# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+#
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_EXTRA
+#
+# This variable allow advanced user to add custom script to the
+# control.tar.gz.
+# Typical usage is for conffiles, postinst, postrm, prerm.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# Usage::
+#
+# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
+# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
+#
+# .. note::
+#
+# The original permissions of the files will be used in the final
+# package unless the variable
+# :variable:`CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION` is set.
+# In particular, the scripts should have the proper executable
+# flag prior to the generation of the package.
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_STRICT_PERMISSION
+#
+# This variable indicates if the Debian policy on control files should be
+# strictly followed.
+#
+# * Mandatory : NO
+# * Default : FALSE
+#
+# Usage::
+#
+# set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
+#
+# .. note::
+#
+# This overrides the permissions on the original files, following the rules
+# set by Debian policy
+# https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_SOURCE
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SOURCE
+#
+# Sets the ``Source`` field of the binary Debian package.
+# When the binary package name is not the same as the source package name
+# (in particular when several components/binaries are generated from one
+# source) the source from which the binary has been generated should be
+# indicated with the field ``Source``.
+#
+# * Mandatory : NO
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based
+# installations.
+#
+# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source
+#
+# .. note::
+#
+# This value is not interpreted. It is possible to pass an optional
+# revision number of the referenced source package as well.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -193,227 +423,356 @@ if(NOT UNIX)
message(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.")
endif()
-# CPACK_DEBIAN_PACKAGE_SHLIBDEPS
-# If specify OFF, only user depends are used
-if(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
- set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
-endif()
+function(cpack_deb_prepare_package_vars)
+ # CPACK_DEBIAN_PACKAGE_SHLIBDEPS
+ # If specify OFF, only user depends are used
+ if(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
+ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
+ endif()
-find_program(FAKEROOT_EXECUTABLE fakeroot)
-if(FAKEROOT_EXECUTABLE)
- set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE})
-endif()
+ set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}")
-if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
- # dpkg-shlibdeps is a Debian utility for generating dependency list
- find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps)
-
- # Check version of the dpkg-shlibdeps tool using CPackRPM method
- if(SHLIBDEPS_EXECUTABLE)
- execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} --version
- OUTPUT_VARIABLE _TMP_VERSION
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX MATCH "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)"
- SHLIBDEPS_EXECUTABLE_VERSION
- ${_TMP_VERSION})
- set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}")
- if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message( "CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>")
+ # per component automatic discover: some of the component might not have
+ # binaries.
+ if(CPACK_DEB_PACKAGE_COMPONENT)
+ string(TOUPPER "${CPACK_DEB_PACKAGE_COMPONENT}" _local_component_name)
+ set(_component_shlibdeps_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_SHLIBDEPS")
+
+ # if set, overrides the global configuration
+ if(DEFINED ${_component_shlibdeps_var})
+ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS "${${_component_shlibdeps_var}}")
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ message("CPackDeb Debug: component '${CPACK_DEB_PACKAGE_COMPONENT}' dpkg-shlibdeps set to ${CPACK_DEBIAN_PACKAGE_SHLIBDEPS}")
+ endif()
endif()
+ endif()
- # Generating binary list - Get type of all install files
- execute_process(COMMAND find -type f
- COMMAND xargs file
- WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
- OUTPUT_VARIABLE CPACK_DEB_INSTALL_FILES)
-
- # Convert to CMake list
- string(REGEX REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES})
-
- # Only dynamically linked ELF files are included
- # Extract only file name infront of ":"
- foreach ( _FILE ${CPACK_DEB_INSTALL_FILES})
- if ( ${_FILE} MATCHES "ELF.*dynamically linked")
- string(REGEX MATCH "(^.*):" _FILE_NAME ${_FILE})
- list(APPEND CPACK_DEB_BINARY_FILES ${CMAKE_MATCH_1})
+ if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
+ # dpkg-shlibdeps is a Debian utility for generating dependency list
+ find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps)
+
+ if(SHLIBDEPS_EXECUTABLE)
+ # Check version of the dpkg-shlibdeps tool using CPackRPM method
+ execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --version
+ OUTPUT_VARIABLE _TMP_VERSION
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(_TMP_VERSION MATCHES "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)")
+ set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}")
+ else()
+ set(SHLIBDEPS_EXECUTABLE_VERSION "")
endif()
- endforeach()
- message( "CPackDeb: - Generating dependency list")
-
- # Create blank control file for running dpkg-shlibdeps
- # There might be some other way to invoke dpkg-shlibdeps without creating this file
- # but standard debian package should not have anything that can collide with this file or directory
- file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian)
- file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "")
-
- # Execute dpkg-shlibdeps
- # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package
- # -O : print to STDOUT
- execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} --ignore-missing-info -O ${CPACK_DEB_BINARY_FILES}
- WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
- OUTPUT_VARIABLE SHLIBDEPS_OUTPUT
- RESULT_VARIABLE SHLIBDEPS_RESULT
- ERROR_VARIABLE SHLIBDEPS_ERROR
- OUTPUT_STRIP_TRAILING_WHITESPACE )
- if(CPACK_DEBIAN_PACKAGE_DEBUG)
- # dpkg-shlibdeps will throw some warnings if some input files are not binary
- message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}")
- endif()
- if (NOT SHLIBDEPS_RESULT EQUAL 0)
- message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: ${SHLIBDEPS_ERROR}")
- endif ()
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ message("CPackDeb Debug: dpkg-shlibdeps --version output is '${_TMP_VERSION}'")
+ message("CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>")
+ endif()
- #Get rid of prefix generated by dpkg-shlibdeps
- string (REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS ${SHLIBDEPS_OUTPUT})
+ # Generating binary list - Get type of all install files
+ cmake_policy(PUSH)
+ # Tell file(GLOB_RECURSE) not to follow directory symlinks
+ # even if the project does not set this policy to NEW.
+ cmake_policy(SET CMP0009 NEW)
+ file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*")
+ cmake_policy(POP)
+
+ # get file info so that we can determine if file is executable or not
+ unset(CPACK_DEB_INSTALL_FILES)
+ foreach(FILE_ IN LISTS FILE_PATHS_)
+ execute_process(COMMAND file "./${FILE_}"
+ WORKING_DIRECTORY "${WDIR}"
+ OUTPUT_VARIABLE INSTALL_FILE_)
+ list(APPEND CPACK_DEB_INSTALL_FILES "${INSTALL_FILE_}")
+ endforeach()
+
+ # Only dynamically linked ELF files are included
+ # Extract only file name infront of ":"
+ foreach(_FILE ${CPACK_DEB_INSTALL_FILES})
+ if( ${_FILE} MATCHES "ELF.*dynamically linked")
+ string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}")
+ list(APPEND CPACK_DEB_BINARY_FILES "${CMAKE_MATCH_1}")
+ set(CONTAINS_EXECUTABLE_FILES_ TRUE)
+ endif()
+ endforeach()
+
+ if(CONTAINS_EXECUTABLE_FILES_)
+ message("CPackDeb: - Generating dependency list")
+
+ # Create blank control file for running dpkg-shlibdeps
+ # There might be some other way to invoke dpkg-shlibdeps without creating this file
+ # but standard debian package should not have anything that can collide with this file or directory
+ file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian)
+ file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "")
+
+ # Add --ignore-missing-info if the tool supports it
+ execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --help
+ OUTPUT_VARIABLE _TMP_HELP
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(_TMP_HELP MATCHES "--ignore-missing-info")
+ set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info")
+ endif()
+
+ # Execute dpkg-shlibdeps
+ # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package
+ # -O : print to STDOUT
+ execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}
+ WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
+ OUTPUT_VARIABLE SHLIBDEPS_OUTPUT
+ RESULT_VARIABLE SHLIBDEPS_RESULT
+ ERROR_VARIABLE SHLIBDEPS_ERROR
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ # dpkg-shlibdeps will throw some warnings if some input files are not binary
+ message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}")
+ endif()
+ if(NOT SHLIBDEPS_RESULT EQUAL 0)
+ message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}';\n"
+ "executed command: '${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}';\n"
+ "found files: '${INSTALL_FILE_}';\n"
+ "files info: '${CPACK_DEB_INSTALL_FILES}';\n"
+ "binary files: '${CPACK_DEB_BINARY_FILES}'")
+ endif()
+
+ #Get rid of prefix generated by dpkg-shlibdeps
+ string(REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS "${SHLIBDEPS_OUTPUT}")
+
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ message("CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS} from output ${SHLIBDEPS_OUTPUT}")
+ endif()
+
+ # Remove blank control file
+ # Might not be safe if package actual contain file or directory named debian
+ file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian")
+ else()
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ message(AUTHOR_WARNING "CPackDeb Debug: Using only user-provided depends because package does not contain executable files that link to shared libraries.")
+ endif()
+ endif()
+ else()
+ message("CPackDeb: Using only user-provided dependencies because dpkg-shlibdeps is not found.")
+ endif()
+ else()
if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}")
+ message("CPackDeb Debug: Using only user-provided dependencies")
endif()
+ endif()
- # Remove blank control file
- # Might not be safe if package actual contain file or directory named debian
- file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian")
+ # Let's define the control file found in debian package:
- # Append user depend if set
- if (CPACK_DEBIAN_PACKAGE_DEPENDS)
- set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
- else ()
- set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}")
- endif ()
+ # Binary package:
+ # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
- else ()
- if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message( "CPackDeb Debug: Using only user-provided depends because dpkg-shlibdeps is not found.")
- endif()
+ # DEBIAN/control
+ # debian policy enforce lower case for package name
+ # Package: (mandatory)
+ if(NOT CPACK_DEBIAN_PACKAGE_NAME)
+ string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
endif()
-else ()
- if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message( "CPackDeb Debug: Using only user-provided depends")
+ # Version: (mandatory)
+ if(NOT CPACK_DEBIAN_PACKAGE_VERSION)
+ if(NOT CPACK_PACKAGE_VERSION)
+ message(FATAL_ERROR "CPackDeb: Debian package requires a package version")
+ endif()
+ set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
endif()
-endif()
-# Let's define the control file found in debian package:
+ # Architecture: (mandatory)
+ if(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
+ # There is no such thing as i686 architecture on debian, you should use i386 instead
+ # $ dpkg --print-architecture
+ find_program(DPKG_CMD dpkg)
+ if(NOT DPKG_CMD)
+ message(STATUS "CPackDeb: Can not find dpkg in your path, default to i386.")
+ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
+ endif()
+ execute_process(COMMAND "${DPKG_CMD}" --print-architecture
+ OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ endif()
-# Binary package:
-# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
+ # Source: (optional)
+ # in case several packages are constructed from a unique source
+ # (multipackaging), the source may be indicated as well.
+ # The source might contain a version if the generated package
+ # version is different from the source version
+ if(NOT CPACK_DEBIAN_PACKAGE_SOURCE)
+ set(CPACK_DEBIAN_PACKAGE_SOURCE "")
+ endif()
-# DEBIAN/control
-# debian policy enforce lower case for package name
-# Package: (mandatory)
-if(NOT CPACK_DEBIAN_PACKAGE_NAME)
- string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
-endif()
+ # have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES),
+ # this returns the successful find_package() calls, maybe this can help
+ # Depends:
+ # You should set: DEBIAN_PACKAGE_DEPENDS
+ # TODO: automate 'objdump -p | grep NEEDED'
+
+ # if per-component variable, overrides the global CPACK_DEBIAN_PACKAGE_${variable_type_}
+ # automatic dependency discovery will be performed afterwards.
+ if(CPACK_DEB_PACKAGE_COMPONENT)
+ foreach(value_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES SOURCE SECTION PRIORITY NAME)
+ set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${value_type_}")
+
+ # if set, overrides the global variable
+ if(DEFINED ${_component_var})
+ set(CPACK_DEBIAN_PACKAGE_${value_type_} "${${_component_var}}")
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ message("CPackDeb Debug: component '${_local_component_name}' ${value_type_} "
+ "value set to '${CPACK_DEBIAN_PACKAGE_${value_type_}}'")
+ endif()
+ endif()
+ endforeach()
+ endif()
-# Version: (mandatory)
-if(NOT CPACK_DEBIAN_PACKAGE_VERSION)
- if(NOT CPACK_PACKAGE_VERSION)
- message(FATAL_ERROR "CPackDeb: Debian package requires a package version")
+ # at this point, the CPACK_DEBIAN_PACKAGE_DEPENDS is properly set
+ # to the minimal dependency of the package
+ # Append automatically discovered dependencies .
+ if(NOT "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}" STREQUAL "")
+ if (CPACK_DEBIAN_PACKAGE_DEPENDS)
+ set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
+ else ()
+ set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}")
+ endif ()
endif()
- set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
-endif()
-# Architecture: (mandatory)
-if(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
- # There is no such thing as i686 architecture on debian, you should use i386 instead
- # $ dpkg --print-architecture
- find_program(DPKG_CMD dpkg)
- if(NOT DPKG_CMD)
- message(STATUS "CPackDeb: Can not find dpkg in your path, default to i386.")
- set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
+ if(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
+ message(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
endif()
- execute_process(COMMAND "${DPKG_CMD}" --print-architecture
- OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-endif()
-# have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES),
-# this returns the successful find_package() calls, maybe this can help
-# Depends:
-# You should set: DEBIAN_PACKAGE_DEPENDS
-# TODO: automate 'objdump -p | grep NEEDED'
-if(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
- message(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
-endif()
+ # Maintainer: (mandatory)
+ if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
+ if(NOT CPACK_PACKAGE_CONTACT)
+ message(FATAL_ERROR "CPackDeb: Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER")
+ endif()
+ set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
+ endif()
-# Maintainer: (mandatory)
-if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
- if(NOT CPACK_PACKAGE_CONTACT)
- message(FATAL_ERROR "CPackDeb: Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER")
+ # Description: (mandatory)
+ if(NOT CPACK_DEB_PACKAGE_COMPONENT)
+ if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
+ if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+ message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
+ endif()
+ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+ endif()
+ else()
+ set(component_description_var CPACK_COMPONENT_${_local_component_name}_DESCRIPTION)
+
+ # component description overrides package description
+ if(${component_description_var})
+ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${${component_description_var}})
+ elseif(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
+ if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+ message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION or ${component_description_var}")
+ endif()
+ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+ endif()
endif()
- set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
-endif()
-# Description: (mandatory)
-if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
- if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
- message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
+ # Section: (recommended)
+ if(NOT CPACK_DEBIAN_PACKAGE_SECTION)
+ set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
endif()
- set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
-endif()
-# Section: (recommended)
-if(NOT CPACK_DEBIAN_PACKAGE_SECTION)
- set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
-endif()
+ # Priority: (recommended)
+ if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
+ set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
+ endif()
-# Priority: (recommended)
-if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
- set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
-endif()
+ # Compression: (recommended)
+ if(NOT CPACK_DEBIAN_COMPRESSION_TYPE)
+ set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
+ endif()
-# Recommends:
-# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
-
-# Suggests:
-# You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS
-
-# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
-# This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive)
-# Typical examples are:
-# - conffiles
-# - postinst
-# - postrm
-# - prerm"
-# Usage:
-# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
-# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
-
-# Are we packaging components ?
-if(CPACK_DEB_PACKAGE_COMPONENT)
- set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}")
- string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
-else()
- set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "")
-endif()
-set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}")
-
-# Print out some debug information if we were asked for that
-if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
- message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
- message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
- message("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
- message("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
- message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
- message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
- message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
-endif()
+ # Recommends:
+ # You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
+
+ # Suggests:
+ # You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS
+
+ # CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
+ # This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive)
+ # Typical examples are:
+ # - conffiles
+ # - postinst
+ # - postrm
+ # - prerm
+ # Usage:
+ # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
+ # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
+
+ # Are we packaging components ?
+ if(CPACK_DEB_PACKAGE_COMPONENT)
+ # override values with per component version if set
+ foreach(VAR_NAME_ "PACKAGE_CONTROL_EXTRA" "PACKAGE_CONTROL_STRICT_PERMISSION")
+ if(CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_})
+ set(CPACK_DEBIAN_${VAR_NAME_} "${CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}}")
+ endif()
+ endforeach()
-# For debian source packages:
-# debian/control
-# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles
+ if(CPACK_DEBIAN_${_local_component_name}_PACKAGE_NAME)
+ string(TOLOWER "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
+ else()
+ string(TOLOWER "${CPACK_DEBIAN_PACKAGE_NAME}-${CPACK_DEB_PACKAGE_COMPONENT}" CPACK_DEBIAN_PACKAGE_NAME)
+ endif()
+ endif()
-# .dsc
-# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles
+ # Print out some debug information if we were asked for that
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = '${CPACK_TOPLEVEL_DIRECTORY}'")
+ message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = '${CPACK_TOPLEVEL_TAG}'")
+ message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = '${CPACK_TEMPORARY_DIRECTORY}'")
+ message("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = '${CPACK_OUTPUT_FILE_NAME}'")
+ message("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = '${CPACK_OUTPUT_FILE_PATH}'")
+ message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = '${CPACK_PACKAGE_FILE_NAME}'")
+ message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = '${CPACK_PACKAGE_INSTALL_DIRECTORY}'")
+ message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = '${CPACK_TEMPORARY_PACKAGE_FILE_NAME}'")
+ message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION = '${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}'")
+ message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_SOURCE = '${CPACK_DEBIAN_PACKAGE_SOURCE}'")
+ endif()
-# Builds-Depends:
-#if(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
-# set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
-# "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"
-# )
-#endif()
+ # For debian source packages:
+ # debian/control
+ # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles
+
+ # .dsc
+ # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles
+
+ # Builds-Depends:
+ #if(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
+ # set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
+ # "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"
+ # )
+ #endif()
+
+ # move variables to parent scope so that they may be used to create debian package
+ set(GEN_CPACK_DEBIAN_PACKAGE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_DEBIAN_PACKAGE_VERSION}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_SECTION "${CPACK_DEBIAN_PACKAGE_SECTION}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_PRIORITY "${CPACK_DEBIAN_PACKAGE_PRIORITY}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_DEBIAN_PACKAGE_MAINTAINER}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_COMPRESSION_TYPE "${CPACK_DEBIAN_COMPRESSION_TYPE}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_RECOMMENDS "${CPACK_DEBIAN_PACKAGE_RECOMMENDS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_SUGGESTS "${CPACK_DEBIAN_PACKAGE_SUGGESTS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_DEBIAN_PACKAGE_HOMEPAGE}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_PREDEPENDS "${CPACK_DEBIAN_PACKAGE_PREDEPENDS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_ENHANCES "${CPACK_DEBIAN_PACKAGE_ENHANCES}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_BREAKS "${CPACK_DEBIAN_PACKAGE_BREAKS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_CONFLICTS "${CPACK_DEBIAN_PACKAGE_CONFLICTS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_PROVIDES "${CPACK_DEBIAN_PACKAGE_PROVIDES}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_REPLACES "${CPACK_DEBIAN_PACKAGE_REPLACES}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION
+ "${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_SOURCE
+ "${CPACK_DEBIAN_PACKAGE_SOURCE}" PARENT_SCOPE)
+ set(GEN_WDIR "${WDIR}" PARENT_SCOPE)
+endfunction()
+
+cpack_deb_prepare_package_vars()
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
new file mode 100644
index 000000000..6649933b6
--- /dev/null
+++ b/Modules/CPackIFW.cmake
@@ -0,0 +1,614 @@
+#.rst:
+# CPackIFW
+# --------
+#
+# .. _QtIFW: http://doc.qt.io/qtinstallerframework/index.html
+#
+# This module looks for the location of the command line utilities supplied with
+# the Qt Installer Framework (QtIFW_).
+#
+# The module also defines several commands to control the behavior of the
+# CPack ``IFW`` generator.
+#
+#
+# Overview
+# ^^^^^^^^
+#
+# CPack ``IFW`` generator helps you to create online and offline
+# binary cross-platform installers with a graphical user interface.
+#
+# CPack IFW generator prepares project installation and generates configuration
+# and meta information for QtIFW_ tools.
+#
+# The QtIFW_ provides a set of tools and utilities to create
+# installers for the supported desktop Qt platforms: Linux, Microsoft Windows,
+# and Mac OS X.
+#
+# You should also install QtIFW_ to use CPack ``IFW`` generator.
+# If you don't use a default path for the installation, please set
+# the used path in the variable ``QTIFWDIR``.
+#
+# Variables
+# ^^^^^^^^^
+#
+# You can use the following variables to change behavior of CPack ``IFW`` generator.
+#
+# Debug
+# """"""
+#
+# .. variable:: CPACK_IFW_VERBOSE
+#
+# Set to ``ON`` to enable addition debug output.
+# By default is ``OFF``.
+#
+# Package
+# """""""
+#
+# .. variable:: CPACK_IFW_PACKAGE_TITLE
+#
+# Name of the installer as displayed on the title bar.
+# By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`.
+#
+# .. variable:: CPACK_IFW_PACKAGE_PUBLISHER
+#
+# Publisher of the software (as shown in the Windows Control Panel).
+# By default used :variable:`CPACK_PACKAGE_VENDOR`.
+#
+# .. variable:: CPACK_IFW_PRODUCT_URL
+#
+# URL to a page that contains product information on your web site.
+#
+# .. variable:: CPACK_IFW_PACKAGE_ICON
+#
+# Filename for a custom installer icon. The actual file is '.icns' (Mac OS X),
+# '.ico' (Windows). No functionality on Unix.
+#
+# .. variable:: CPACK_IFW_PACKAGE_WINDOW_ICON
+#
+# Filename for a custom window icon in PNG format for the Installer application.
+#
+# .. variable:: CPACK_IFW_PACKAGE_LOGO
+#
+# Filename for a logo is used as QWizard::LogoPixmap.
+#
+# .. variable:: CPACK_IFW_PACKAGE_START_MENU_DIRECTORY
+#
+# Name of the default program group for the product in the Windows Start menu.
+#
+# By default used :variable:`CPACK_IFW_PACKAGE_NAME`.
+#
+# .. variable:: CPACK_IFW_TARGET_DIRECTORY
+#
+# Default target directory for installation.
+# By default used "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`"
+#
+# You can use predefined variables.
+#
+# .. variable:: CPACK_IFW_ADMIN_TARGET_DIRECTORY
+#
+# Default target directory for installation with administrator rights.
+#
+# You can use predefined variables.
+#
+# .. variable:: CPACK_IFW_PACKAGE_GROUP
+#
+# The group, which will be used to configure the root package
+#
+# .. variable:: CPACK_IFW_PACKAGE_NAME
+#
+# The root package name, which will be used if configuration group is not
+# specified
+#
+# .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME
+#
+# Filename of the generated maintenance tool.
+# The platform-specific executable file extension is appended.
+#
+# By default used QtIFW_ defaults (``maintenancetool``).
+#
+# .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE
+#
+# Filename for the configuration of the generated maintenance tool.
+#
+# By default used QtIFW_ defaults (``maintenancetool.ini``).
+#
+# .. variable:: CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS
+#
+# Set to ``ON`` if the installation path can contain non-ASCII characters.
+#
+# Is ``ON`` for QtIFW_ less 2.0 tools.
+#
+# .. variable:: CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH
+#
+# Set to ``OFF`` if the installation path cannot contain space characters.
+#
+# Is ``ON`` for QtIFW_ less 2.0 tools.
+#
+# .. variable:: CPACK_IFW_PACKAGE_CONTROL_SCRIPT
+#
+# Filename for a custom installer control script.
+#
+# .. variable:: CPACK_IFW_REPOSITORIES_ALL
+#
+# The list of remote repositories.
+#
+# The default value of this variable is computed by CPack and contains
+# all repositories added with command :command:`cpack_ifw_add_repository`
+#
+# .. variable:: CPACK_IFW_DOWNLOAD_ALL
+#
+# If this is ``ON`` all components will be downloaded.
+# By default is ``OFF`` or used value
+# from ``CPACK_DOWNLOAD_ALL`` if set
+#
+# Components
+# """"""""""
+#
+# .. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES
+#
+# Resolve duplicate names when installing components with groups.
+#
+# .. variable:: CPACK_IFW_PACKAGES_DIRECTORIES
+#
+# Additional prepared packages dirs that will be used to resolve
+# dependent components.
+#
+# Tools
+# """"""""
+#
+# .. variable:: CPACK_IFW_FRAMEWORK_VERSION
+#
+# The version of used QtIFW_ tools.
+#
+# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
+#
+# The path to "binarycreator" command line client.
+#
+# This variable is cached and can be configured user if need.
+#
+# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE
+#
+# The path to "repogen" command line client.
+#
+# This variable is cached and can be configured user if need.
+#
+# Commands
+# ^^^^^^^^^
+#
+# The module defines the following commands:
+#
+# --------------------------------------------------------------------------
+#
+# .. command:: cpack_ifw_configure_component
+#
+# Sets the arguments specific to the CPack IFW generator.
+#
+# ::
+#
+# cpack_ifw_configure_component(<compname> [COMMON]
+# [NAME <name>]
+# [VERSION <version>]
+# [SCRIPT <script>]
+# [PRIORITY <priority>]
+# [DEPENDS <com_id> ...]
+# [LICENSES <display_name> <file_path> ...])
+#
+# This command should be called after cpack_add_component command.
+#
+# ``COMMON`` if set, then the component will be packaged and installed as part
+# of a group to which it belongs.
+#
+# ``VERSION`` is version of component.
+# By default used :variable:`CPACK_PACKAGE_VERSION`.
+#
+# ``SCRIPT`` is a relative or absolute path to operations script
+# for this component.
+#
+# ``NAME`` is used to create domain-like identification for this component.
+# By default used origin component name.
+#
+# ``PRIORITY`` is priority of the component in the tree.
+#
+# ``DEPENDS`` list of dependency component identifiers in QtIFW_ style.
+#
+# ``LICENSES`` pair of <display_name> and <file_path> of license text for this
+# component. You can specify more then one license.
+#
+# --------------------------------------------------------------------------
+#
+# .. command:: cpack_ifw_configure_component_group
+#
+# Sets the arguments specific to the CPack IFW generator.
+#
+# ::
+#
+# cpack_ifw_configure_component_group(<grpname>
+# [VERSION <version>]
+# [NAME <name>]
+# [SCRIPT <script>]
+# [PRIORITY <priority>]
+# [LICENSES <display_name> <file_path> ...])
+#
+# This command should be called after cpack_add_component_group command.
+#
+# ``VERSION`` is version of component group.
+# By default used :variable:`CPACK_PACKAGE_VERSION`.
+#
+# ``NAME`` is used to create domain-like identification for this component group.
+# By default used origin component group name.
+#
+# ``SCRIPT`` is a relative or absolute path to operations script
+# for this component group.
+#
+# ``PRIORITY`` is priority of the component group in the tree.
+#
+# ``LICENSES`` pair of <display_name> and <file_path> of license text for this
+# component group. You can specify more then one license.
+#
+# --------------------------------------------------------------------------
+#
+# .. command:: cpack_ifw_add_repository
+#
+# Add QtIFW_ specific remote repository.
+#
+# ::
+#
+# cpack_ifw_add_repository(<reponame> [DISABLED]
+# URL <url>
+# [USERNAME <username>]
+# [PASSWORD <password>]
+# [DISPLAY_NAME <display_name>])
+#
+# This macro will also add the <reponame> repository
+# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`
+#
+# ``DISABLED`` if set, then the repository will be disabled by default.
+#
+# ``URL`` is points to a list of available components.
+#
+# ``USERNAME`` is used as user on a protected repository.
+#
+# ``PASSWORD`` is password to use on a protected repository.
+#
+# ``DISPLAY_NAME`` is string to display instead of the URL.
+#
+# Example usage
+# ^^^^^^^^^^^^^
+#
+# .. code-block:: cmake
+#
+# set(CPACK_PACKAGE_NAME "MyPackage")
+# set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyPackage Installation Example")
+# set(CPACK_PACKAGE_VERSION "1.0.0") # Version of installer
+#
+# include(CPack)
+# include(CPackIFW)
+#
+# cpack_add_component(myapp
+# DISPLAY_NAME "MyApp"
+# DESCRIPTION "My Application")
+# cpack_ifw_configure_component(myapp
+# VERSION "1.2.3" # Version of component
+# SCRIPT "operations.qs")
+# cpack_add_component(mybigplugin
+# DISPLAY_NAME "MyBigPlugin"
+# DESCRIPTION "My Big Downloadable Plugin"
+# DOWNLOADED)
+# cpack_ifw_add_repository(myrepo
+# URL "http://example.com/ifw/repo/myapp"
+# DISPLAY_NAME "My Application Repository")
+#
+#
+# Online installer
+# ^^^^^^^^^^^^^^^^
+#
+# By default CPack IFW generator makes offline installer. This means that all
+# components will be packaged into a binary file.
+#
+# To make a component downloaded, you must set the ``DOWNLOADED`` option in
+# :command:`cpack_add_component`.
+#
+# Then you would use the command :command:`cpack_configure_downloads`.
+# If you set ``ALL`` option all components will be downloaded.
+#
+# You also can use command :command:`cpack_ifw_add_repository` and
+# variable :variable:`CPACK_IFW_DOWNLOAD_ALL` for more specific configuration.
+#
+# CPack IFW generator creates "repository" dir in current binary dir. You
+# would copy content of this dir to specified ``site`` (``url``).
+#
+# See Also
+# ^^^^^^^^
+#
+# Qt Installer Framework Manual:
+#
+# Index page
+# http://doc.qt.io/qtinstallerframework/index.html
+#
+# Component Scripting
+# http://doc.qt.io/qtinstallerframework/scripting.html
+#
+# Predefined Variables
+# http://doc.qt.io/qtinstallerframework/scripting.html#predefined-variables
+#
+# Download Qt Installer Framework for you platform from Qt site:
+# http://download.qt.io/official_releases/qt-installer-framework
+#
+
+#=============================================================================
+# Copyright 2014 Kitware, Inc.
+# Copyright 2014 Konstantin Podsvirov <konstantin@podsvirov.pro>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+#=============================================================================
+# Search Qt Installer Framework tools
+#=============================================================================
+
+# Default path
+
+set(_CPACK_IFW_PATHS
+ "${QTIFWDIR}"
+ "$ENV{QTIFWDIR}"
+ "${QTDIR}"
+ "$ENV{QTIFWDIR}")
+if(WIN32)
+ list(APPEND _CPACK_IFW_PATHS
+ "$ENV{HOMEDRIVE}/Qt"
+ "C:/Qt")
+else()
+ list(APPEND _CPACK_IFW_PATHS
+ "$ENV{HOME}/Qt"
+ "/opt/Qt")
+endif()
+
+set(_CPACK_IFW_SUFFIXES
+# Common
+ "bin"
+# Second branch
+ "QtIFW2.3.0/bin"
+ "QtIFW2.2.0/bin"
+ "QtIFW2.1.0/bin"
+ "QtIFW2.0.0/bin"
+# First branch
+ "QtIFW-1.6.0/bin"
+ "QtIFW-1.5.0/bin"
+ "QtIFW-1.4.0/bin"
+ "QtIFW-1.3.0/bin")
+
+# Look for 'binarycreator'
+
+find_program(CPACK_IFW_BINARYCREATOR_EXECUTABLE
+ NAMES binarycreator
+ PATHS ${_CPACK_IFW_PATHS}
+ PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
+ DOC "QtIFW binarycreator command line client")
+
+mark_as_advanced(CPACK_IFW_BINARYCREATOR_EXECUTABLE)
+
+# Look for 'repogen'
+
+find_program(CPACK_IFW_REPOGEN_EXECUTABLE
+ NAMES repogen
+ PATHS ${_CPACK_IFW_PATHS}
+ PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
+ DOC "QtIFW repogen command line client"
+ )
+mark_as_advanced(CPACK_IFW_REPOGEN_EXECUTABLE)
+
+# Look for 'installerbase'
+
+find_program(CPACK_IFW_INSTALLERBASE_EXECUTABLE
+ NAMES installerbase
+ PATHS ${_CPACK_IFW_PATHS}
+ PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
+ DOC "QtIFW installer executable base"
+ )
+mark_as_advanced(CPACK_IFW_INSTALLERBASE_EXECUTABLE)
+
+# Look for 'devtool' (appeared in the second branch)
+
+find_program(CPACK_IFW_DEVTOOL_EXECUTABLE
+ NAMES devtool
+ PATHS ${_CPACK_IFW_PATHS}
+ PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
+ DOC "QtIFW devtool command line client"
+ )
+mark_as_advanced(CPACK_IFW_DEVTOOL_EXECUTABLE)
+
+#
+## Next code is included only once
+#
+
+if(NOT CPackIFW_CMake_INCLUDED)
+set(CPackIFW_CMake_INCLUDED 1)
+
+#=============================================================================
+# Framework version
+#=============================================================================
+
+if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND CPACK_IFW_DEVTOOL_EXECUTABLE)
+ execute_process(COMMAND
+ "${CPACK_IFW_INSTALLERBASE_EXECUTABLE}" --framework-version
+ OUTPUT_VARIABLE CPACK_IFW_FRAMEWORK_VERSION)
+ if(CPACK_IFW_FRAMEWORK_VERSION)
+ string(REPLACE " " ""
+ CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}")
+ string(REPLACE "\t" ""
+ CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}")
+ string(REPLACE "\n" ""
+ CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}")
+ if(CPACK_IFW_VERBOSE)
+ message(STATUS "Found QtIFW ${CPACK_IFW_FRAMEWORK_VERSION} version")
+ endif()
+ endif()
+endif()
+
+#=============================================================================
+# Macro definition
+#=============================================================================
+
+# Macro definition based on CPackComponent
+
+if(NOT CPackComponent_CMake_INCLUDED)
+ include(CPackComponent)
+endif()
+
+if(NOT __CMAKE_PARSE_ARGUMENTS_INCLUDED)
+ include(CMakeParseArguments)
+endif()
+
+# Resolve full filename for script file
+macro(_cpack_ifw_resolve_script _variable)
+ set(_ifw_script_macro ${_variable})
+ set(_ifw_script_file ${${_ifw_script_macro}})
+ if(DEFINED ${_ifw_script_macro})
+ get_filename_component(${_ifw_script_macro} ${_ifw_script_file} ABSOLUTE)
+ set(_ifw_script_file ${${_ifw_script_macro}})
+ if(NOT EXISTS ${_ifw_script_file})
+ message(WARNING "CPack IFW: script file \"${_ifw_script_file}\" is not exists")
+ set(${_ifw_script_macro})
+ endif()
+ endif()
+endmacro()
+
+# Resolve full path to lisense file
+macro(_cpack_ifw_resolve_lisenses _variable)
+ if(${_variable})
+ set(_ifw_license_file FALSE)
+ set(_ifw_licenses_fix)
+ foreach(_ifw_licenses_arg ${${_variable}})
+ if(_ifw_license_file)
+ get_filename_component(_ifw_licenses_arg "${_ifw_licenses_arg}" ABSOLUTE)
+ set(_ifw_license_file FALSE)
+ else()
+ set(_ifw_license_file TRUE)
+ endif()
+ list(APPEND _ifw_licenses_fix "${_ifw_licenses_arg}")
+ endforeach(_ifw_licenses_arg)
+ set(${_variable} "${_ifw_licenses_fix}")
+ endif()
+endmacro()
+
+# Macro for configure component
+macro(cpack_ifw_configure_component compname)
+
+ string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME)
+
+ set(_IFW_OPT COMMON)
+ set(_IFW_ARGS VERSION SCRIPT NAME PRIORITY)
+ set(_IFW_MULTI_ARGS DEPENDS LICENSES)
+ cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
+
+ _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT)
+ _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES)
+
+ set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n")
+
+ foreach(_IFW_ARG_NAME ${_IFW_OPT})
+ cpack_append_option_set_command(
+ CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWCOMP_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_ARGS})
+ cpack_append_string_variable_set_command(
+ CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWCOMP_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
+ cpack_append_variable_set_command(
+ CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWCOMP_STR)
+ endforeach()
+
+ if(CPack_CMake_INCLUDED)
+ file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWCOMP_STR}")
+ endif()
+
+endmacro()
+
+# Macro for configure group
+macro(cpack_ifw_configure_component_group grpname)
+
+ string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME)
+
+ set(_IFW_OPT)
+ set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
+ set(_IFW_MULTI_ARGS LICENSES)
+ cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
+
+ _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT)
+ _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES)
+
+ set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n")
+
+ foreach(_IFW_ARG_NAME ${_IFW_ARGS})
+ cpack_append_string_variable_set_command(
+ CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWGRP_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
+ cpack_append_variable_set_command(
+ CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWGRP_STR)
+ endforeach()
+
+ if(CPack_CMake_INCLUDED)
+ file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWGRP_STR}")
+ endif()
+endmacro()
+
+# Macro for adding repository
+macro(cpack_ifw_add_repository reponame)
+
+ string(TOUPPER ${reponame} _CPACK_IFWREPO_UNAME)
+
+ set(_IFW_OPT DISABLED)
+ set(_IFW_ARGS URL USERNAME PASSWORD DISPLAY_NAME)
+ set(_IFW_MULTI_ARGS)
+ cmake_parse_arguments(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
+
+ set(_CPACK_IFWREPO_STR "\n# Configuration for IFW repository \"${reponame}\"\n")
+
+ foreach(_IFW_ARG_NAME ${_IFW_OPT})
+ cpack_append_option_set_command(
+ CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWREPO_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_ARGS})
+ cpack_append_string_variable_set_command(
+ CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWREPO_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
+ cpack_append_variable_set_command(
+ CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWREPO_STR)
+ endforeach()
+
+ list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})
+ set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
+
+ if(CPack_CMake_INCLUDED)
+ file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}")
+ endif()
+
+endmacro()
+
+# Resolve package control script
+_cpack_ifw_resolve_script(CPACK_IFW_PACKAGE_CONTROL_SCRIPT)
+
+endif() # NOT CPackIFW_CMake_INCLUDED
diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake
index d14005369..db5984a66 100644
--- a/Modules/CPackNSIS.cmake
+++ b/Modules/CPackNSIS.cmake
@@ -1,134 +1,130 @@
-##section Variables specific to CPack NSIS generator
-##end
-##module
-# - CPack NSIS generator specific options
+#.rst:
+# CPackNSIS
+# ---------
+#
+# CPack NSIS generator specific options
+#
+# Variables specific to CPack NSIS generator
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# The following variables are specific to the graphical installers built
# on Windows using the Nullsoft Installation System.
-##end
-#
-##variable
-# CPACK_NSIS_INSTALL_ROOT - The default installation directory presented
-# to the end user by the NSIS installer is under this root dir. The full
-# directory presented to the end user is:
-# ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY}
-##end
-#
-##variable
-# CPACK_NSIS_MUI_ICON - An icon filename.
-# The name of a *.ico file used as the main icon for the generated
-# install program.
-##end
-#
-##variable
-# CPACK_NSIS_MUI_UNIICON - An icon filename.
-# The name of a *.ico file used as the main icon for the generated
-# uninstall program.
-##end
-#
-##variable
-# CPACK_NSIS_INSTALLER_MUI_ICON_CODE - undocumented.
-##end
-#
-##variable
-# CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS - Extra NSIS commands that
-# will be added to the beginning of the install Section, before your
-# install tree is available on the target system.
-##end
-#
-##variable
-# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra NSIS commands that
-# will be added to the end of the install Section, after your
-# install tree is available on the target system.
-##end
-#
-##variable
-# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra NSIS commands that will
-# be added to the uninstall Section, before your install tree is
-# removed from the target system.
-##end
-#
-##variable
-# CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the
-# NSIS SetCompressor command.
-##end
-#
-##variable
-# CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL - Ask about uninstalling
-# previous versions first.
-# If this is set to "ON", then an installer will look for previous
-# installed versions and if one is found, ask the user whether to
-# uninstall it before proceeding with the install.
-##end
-#
-##variable
-# CPACK_NSIS_MODIFY_PATH - Modify PATH toggle.
-# If this is set to "ON", then an extra page
-# will appear in the installer that will allow the user to choose
-# whether the program directory should be added to the system PATH
-# variable.
-##end
-#
-##variable
-# CPACK_NSIS_DISPLAY_NAME - The display name string that appears in
-# the Windows Add/Remove Program control panel
-##end
-#
-##variable
-# CPACK_NSIS_PACKAGE_NAME - The title displayed at the top of the
-# installer.
-##end
-#
-##variable
-# CPACK_NSIS_INSTALLED_ICON_NAME - A path to the executable that
-# contains the installer icon.
-##end
-#
-##variable
-# CPACK_NSIS_HELP_LINK - URL to a web site providing assistance in
-# installing your application.
-##end
-#
-##variable
-# CPACK_NSIS_URL_INFO_ABOUT - URL to a web site providing more
-# information about your application.
-##end
-#
-##variable
-# CPACK_NSIS_CONTACT - Contact information for questions and comments
-# about the installation process.
-##end
-#
-##variable
-# CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for
-# creating start menu shortcuts.
-##end
-#
-##variable
-# CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to
-# uninstall start menu shortcuts.
-##end
-#
-##variable
-# CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links
-# assumes that they are in 'bin' unless this variable is set.
-# For example, you would set this to 'exec' if your executables are
-# in an exec directory.
-##end
-#
-##variable
-# CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option
-# to run on the finish page of the NSIS installer.
-##end
-##variable
-# CPACK_NSIS_MENU_LINKS - Specify links in [application] menu.
-# This should contain a list of pair "link" "link name". The link
-# may be an URL or a path relative to installation prefix.
-# Like:
-# set(CPACK_NSIS_MENU_LINKS
-# "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html" "CMake Help"
-# "http://www.cmake.org" "CMake Web Site")
-##end
+#
+# .. variable:: CPACK_NSIS_INSTALL_ROOT
+#
+# The default installation directory presented to the end user by the NSIS
+# installer is under this root dir. The full directory presented to the end
+# user is: ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY}
+#
+# .. variable:: CPACK_NSIS_MUI_ICON
+#
+# An icon filename. The name of a ``*.ico`` file used as the main icon for the
+# generated install program.
+#
+# .. variable:: CPACK_NSIS_MUI_UNIICON
+#
+# An icon filename. The name of a ``*.ico`` file used as the main icon for the
+# generated uninstall program.
+#
+# .. variable:: CPACK_NSIS_INSTALLER_MUI_ICON_CODE
+#
+# undocumented.
+#
+# .. variable:: CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP
+#
+# The filename of a bitmap to use as the NSIS MUI_WELCOMEFINISHPAGE_BITMAP.
+#
+# .. variable:: CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP
+#
+# The filename of a bitmap to use as the NSIS MUI_UNWELCOMEFINISHPAGE_BITMAP.
+#
+# .. variable:: CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS
+#
+# Extra NSIS commands that will be added to the beginning of the install
+# Section, before your install tree is available on the target system.
+#
+# .. variable:: CPACK_NSIS_EXTRA_INSTALL_COMMANDS
+#
+# Extra NSIS commands that will be added to the end of the install Section,
+# after your install tree is available on the target system.
+#
+# .. variable:: CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
+#
+# Extra NSIS commands that will be added to the uninstall Section, before
+# your install tree is removed from the target system.
+#
+# .. variable:: CPACK_NSIS_COMPRESSOR
+#
+# The arguments that will be passed to the NSIS SetCompressor command.
+#
+# .. variable:: CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL
+#
+# Ask about uninstalling previous versions first. If this is set to "ON",
+# then an installer will look for previous installed versions and if one is
+# found, ask the user whether to uninstall it before proceeding with the
+# install.
+#
+# .. variable:: CPACK_NSIS_MODIFY_PATH
+#
+# Modify PATH toggle. If this is set to "ON", then an extra page will appear
+# in the installer that will allow the user to choose whether the program
+# directory should be added to the system PATH variable.
+#
+# .. variable:: CPACK_NSIS_DISPLAY_NAME
+#
+# The display name string that appears in the Windows Add/Remove Program
+# control panel
+#
+# .. variable:: CPACK_NSIS_PACKAGE_NAME
+#
+# The title displayed at the top of the installer.
+#
+# .. variable:: CPACK_NSIS_INSTALLED_ICON_NAME
+#
+# A path to the executable that contains the installer icon.
+#
+# .. variable:: CPACK_NSIS_HELP_LINK
+#
+# URL to a web site providing assistance in installing your application.
+#
+# .. variable:: CPACK_NSIS_URL_INFO_ABOUT
+#
+# URL to a web site providing more information about your application.
+#
+# .. variable:: CPACK_NSIS_CONTACT
+#
+# Contact information for questions and comments about the installation
+# process.
+#
+# .. variable:: CPACK_NSIS_CREATE_ICONS_EXTRA
+#
+# Additional NSIS commands for creating start menu shortcuts.
+#
+# .. variable:: CPACK_NSIS_DELETE_ICONS_EXTRA
+#
+# Additional NSIS commands to uninstall start menu shortcuts.
+#
+# .. variable:: CPACK_NSIS_EXECUTABLES_DIRECTORY
+#
+# Creating NSIS start menu links assumes that they are in 'bin' unless this
+# variable is set. For example, you would set this to 'exec' if your
+# executables are in an exec directory.
+#
+# .. variable:: CPACK_NSIS_MUI_FINISHPAGE_RUN
+#
+# Specify an executable to add an option to run on the finish page of the
+# NSIS installer.
+#
+# .. variable:: CPACK_NSIS_MENU_LINKS
+#
+# Specify links in [application] menu. This should contain a list of pair
+# "link" "link name". The link may be an URL or a path relative to
+# installation prefix. Like::
+#
+# set(CPACK_NSIS_MENU_LINKS
+# "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html"
+# "CMake Help" "https://cmake.org" "CMake Web Site")
+#
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake
index 98ca9e2d5..416042519 100644
--- a/Modules/CPackPackageMaker.cmake
+++ b/Modules/CPackPackageMaker.cmake
@@ -1,25 +1,27 @@
-##section Variables specific to CPack PackageMaker generator
-##end
-##module
-# - PackageMaker CPack generator (Mac OS X).
-# The following variable is specific to installers built on Mac OS X
-# using PackageMaker:
-##end
+#.rst:
+# CPackPackageMaker
+# -----------------
#
-##variable
-# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the
-# resulting PackageMaker archive should be compatible with. Different
-# versions of Mac OS X support different
-# features. For example, CPack can only build component-based
-# installers for Mac OS X 10.4 or newer, and can only build
-# installers that download component son-the-fly for Mac OS X 10.5
-# or newer. If left blank, this value will be set to the minimum
-# version of Mac OS X that supports the requested features. Set this
-# variable to some value (e.g., 10.4) only if you want to guarantee
-# that your installer will work on that version of Mac OS X, and
-# don't mind missing extra features available in the installer
-# shipping with later versions of Mac OS X.
-##end
+# PackageMaker CPack generator (Mac OS X).
+#
+# Variables specific to CPack PackageMaker generator
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# The following variable is specific to installers built on Mac
+# OS X using PackageMaker:
+#
+# .. variable:: CPACK_OSX_PACKAGE_VERSION
+#
+# The version of Mac OS X that the resulting PackageMaker archive should be
+# compatible with. Different versions of Mac OS X support different
+# features. For example, CPack can only build component-based installers for
+# Mac OS X 10.4 or newer, and can only build installers that download
+# component son-the-fly for Mac OS X 10.5 or newer. If left blank, this value
+# will be set to the minimum version of Mac OS X that supports the requested
+# features. Set this variable to some value (e.g., 10.4) only if you want to
+# guarantee that your installer will work on that version of Mac OS X, and
+# don't mind missing extra features available in the installer shipping with
+# later versions of Mac OS X.
#=============================================================================
# Copyright 2006-2012 Kitware, Inc.
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index bf5b5bc62..7fb11c3b4 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -1,248 +1,560 @@
-##section Variables specific to CPack RPM generator
-##end
-##module
-# - The builtin (binary) CPack RPM generator (Unix only)
-# CPackRPM may be used to create RPM package using CPack.
-# CPackRPM is a CPack generator thus it uses the CPACK_XXX variables
-# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration
-#
-# However CPackRPM has specific features which are controlled by
-# the specifics CPACK_RPM_XXX variables. CPackRPM is a component aware
+#.rst:
+# CPackRPM
+# --------
+#
+# The builtin (binary) CPack RPM generator (Unix only)
+#
+# Variables specific to CPack RPM generator
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# CPackRPM may be used to create RPM package using CPack. CPackRPM is a
+# CPack generator thus it uses the CPACK_XXX variables used by CPack :
+# https://cmake.org/Wiki/CMake:CPackConfiguration
+#
+# However CPackRPM has specific features which are controlled by the
+# specifics CPACK_RPM_XXX variables. CPackRPM is a component aware
# generator so when CPACK_RPM_COMPONENT_INSTALL is ON some more
-# CPACK_RPM_<ComponentName>_XXXX variables may be used in order
-# to have component specific values. Note however that <componentName>
-# refers to the **grouping name**. This may be either a component name
-# or a component GROUP name.
-# Usually those vars correspond to RPM spec file entities, one may find
-# information about spec files here http://www.rpm.org/wiki/Docs.
-# You'll find a detailed usage of CPackRPM on the wiki:
-# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29
+# CPACK_RPM_<ComponentName>_XXXX variables may be used in order to have
+# component specific values. Note however that <componentName> refers
+# to the **grouping name**. This may be either a component name or a
+# component GROUP name. Usually those vars correspond to RPM spec file
+# entities, one may find information about spec files here
+# http://www.rpm.org/wiki/Docs. You'll find a detailed usage of
+# CPackRPM on the wiki:
+#
+# ::
+#
+# https://cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29
+#
# However as a handy reminder here comes the list of specific variables:
-##end
-#
-##variable
-# CPACK_RPM_PACKAGE_SUMMARY - The RPM package summary.
-# Mandatory : YES
-# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY
-##end
-##variable
-# CPACK_RPM_PACKAGE_NAME - The RPM package name.
-# Mandatory : YES
-# Default : CPACK_PACKAGE_NAME
-##end
-##variable
-# CPACK_RPM_PACKAGE_VERSION - The RPM package version.
-# Mandatory : YES
-# Default : CPACK_PACKAGE_VERSION
-##end
-##variable
-# CPACK_RPM_PACKAGE_ARCHITECTURE - The RPM package architecture.
-# Mandatory : NO
-# Default : -
-# This may be set to "noarch" if you
-# know you are building a noarch package.
-##end
-##variable
-# CPACK_RPM_PACKAGE_RELEASE - The RPM package release.
-# Mandatory : YES
-# Default : 1
-# This is the numbering of the RPM package
-# itself, i.e. the version of the packaging and not the version of the
-# content (see CPACK_RPM_PACKAGE_VERSION). One may change the default
-# value if the previous packaging was buggy and/or you want to put here
-# a fancy Linux distro specific numbering.
-##end
-##variable
-# CPACK_RPM_PACKAGE_LICENSE - The RPM package license policy.
-# Mandatory : YES
-# Default : "unknown"
-##end
-##variable
-# CPACK_RPM_PACKAGE_GROUP - The RPM package group.
-# Mandatory : YES
-# Default : "unknown"
-##end
-##variable
-# CPACK_RPM_PACKAGE_VENDOR - The RPM package vendor.
-# Mandatory : YES
-# Default : CPACK_PACKAGE_VENDOR if set or "unknown"
-##end
-##variable
-# CPACK_RPM_PACKAGE_URL - The projects URL.
-# Mandatory : NO
-# Default : -
-##end
-##variable
-# CPACK_RPM_PACKAGE_DESCRIPTION - RPM package description.
-# Mandatory : YES
-# Default : CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package description available"
-##end
-##variable
-# CPACK_RPM_COMPRESSION_TYPE - RPM compression type.
-# Mandatory : NO
-# Default : -
-# May be used to override RPM compression type to be used
-# to build the RPM. For example some Linux distribution now default
-# to lzma or xz compression whereas older cannot use such RPM.
-# Using this one can enforce compression type to be used.
-# Possible value are: lzma, xz, bzip2 and gzip.
-##end
-##variable
-# CPACK_RPM_PACKAGE_REQUIRES - RPM spec requires field.
-# Mandatory : NO
-# Default : -
-# May be used to set RPM dependencies (requires).
-# Note that you must enclose the complete requires string between quotes,
-# for example:
-# set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8")
-# The required package list of an RPM file could be printed with
-# rpm -qp --requires file.rpm
-##end
-##variable
-# CPACK_RPM_PACKAGE_SUGGESTS - RPM spec suggest field.
-# Mandatory : NO
-# Default : -
-# May be used to set weak RPM dependencies (suggests).
-# Note that you must enclose the complete requires string between quotes.
-##end
-##variable
-# CPACK_RPM_PACKAGE_PROVIDES - RPM spec provides field.
-# Mandatory : NO
-# Default : -
-# May be used to set RPM dependencies (provides).
-# The provided package list of an RPM file could be printed with
-# rpm -qp --provides file.rpm
-##end
-##variable
-# CPACK_RPM_PACKAGE_OBSOLETES - RPM spec obsoletes field.
-# Mandatory : NO
-# Default : -
-# May be used to set RPM packages that are obsoleted by this one.
-##end
-##variable
-# CPACK_RPM_PACKAGE_RELOCATABLE - build a relocatable RPM.
-# Mandatory : NO
-# Default : CPACK_PACKAGE_RELOCATABLE
-# If this variable is set to TRUE or ON CPackRPM will try
-# to build a relocatable RPM package. A relocatable RPM may
-# be installed using rpm --prefix or --relocate in order to
-# install it at an alternate place see rpm(8).
-# Note that currently this may fail if CPACK_SET_DESTDIR is set to ON.
-# If CPACK_SET_DESTDIR is set then you will get a warning message
-# but if there is file installed with absolute path you'll get
-# unexpected behavior.
-##end
-##variable
-# CPACK_RPM_SPEC_INSTALL_POST - [deprecated].
-# Mandatory : NO
-# Default : -
-# This way of specifying post-install script is deprecated use
-# CPACK_RPM_POST_INSTALL_SCRIPT_FILE
-# May be used to set an RPM post-install command inside the spec file.
-# For example setting it to "/bin/true" may be used to prevent
-# rpmbuild to strip binaries.
-##end
-##variable
-# CPACK_RPM_SPEC_MORE_DEFINE - RPM extended spec definitions lines.
-# Mandatory : NO
-# Default : -
-# May be used to add any %define lines to the generated spec file.
-##end
-##variable
-# CPACK_RPM_PACKAGE_DEBUG - Toggle CPackRPM debug output.
-# Mandatory : NO
-# Default : -
-# May be set when invoking cpack in order to trace debug information
-# during CPack RPM run. For example you may launch CPack like this
-# cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
-##end
-##variable
-# CPACK_RPM_USER_BINARY_SPECFILE - A user provided spec file.
-# Mandatory : NO
-# Default : -
-# May be set by the user in order to specify a USER binary spec file
-# to be used by CPackRPM instead of generating the file.
-# The specified file will be processed by configure_file( @ONLY).
-# One can provide a component specific file by setting
-# CPACK_RPM_<componentName>_USER_BINARY_SPECFILE.
-##end
-##variable
-# CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE - Spec file template.
-# Mandatory : NO
-# Default : -
-# If set CPack will generate a template for USER specified binary
-# spec file and stop with an error. For example launch CPack like this
-# cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM
-# The user may then use this file in order to hand-craft is own
-# binary spec file which may be used with CPACK_RPM_USER_BINARY_SPECFILE.
-##end
-##variable
-# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
-# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
-# Mandatory : NO
-# Default : -
-# May be used to embed a pre (un)installation script in the spec file.
-# The refered script file(s) will be read and directly
-# put after the %pre or %preun section
-# If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for
-# each component can be overridden with
-# CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE and
-# CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE
-# One may verify which scriptlet has been included with
-# rpm -qp --scripts package.rpm
-##end
-##variable
-# CPACK_RPM_POST_INSTALL_SCRIPT_FILE
-# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
-# Mandatory : NO
-# Default : -
-# May be used to embed a post (un)installation script in the spec file.
-# The refered script file(s) will be read and directly
-# put after the %post or %postun section
-# If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for
-# each component can be overridden with
-# CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE and
-# CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE
-# One may verify which scriptlet has been included with
-# rpm -qp --scripts package.rpm
-##end
-##variable
-# CPACK_RPM_USER_FILELIST
-# CPACK_RPM_<COMPONENT>_USER_FILELIST
-# Mandatory : NO
-# Default : -
-# May be used to explicitly specify %(<directive>) file line
-# in the spec file. Like %config(noreplace) or any other directive
-# that be found in the %files section. Since CPackRPM is generating
-# the list of files (and directories) the user specified files of
-# the CPACK_RPM_<COMPONENT>_USER_FILELIST list will be removed from the generated list.
-##end
-##variable
-# CPACK_RPM_CHANGELOG_FILE - RPM changelog file.
-# Mandatory : NO
-# Default : -
-# May be used to embed a changelog in the spec file.
-# The refered file will be read and directly put after the %changelog
-# section.
-##end
-##variable
-# CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST - list of path to be excluded.
-# Mandatory : NO
-# Default : /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include
-# May be used to exclude path (directories or files) from the auto-generated
-# list of paths discovered by CPack RPM. The defaut value contains a reasonable
-# set of values if the variable is not defined by the user. If the variable
-# is defined by the user then CPackRPM will NOT any of the default path.
-# If you want to add some path to the default list then you can use
-# CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION variable.
-##end
-##variable
-# CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION - additional list of path to be excluded.
-# Mandatory : NO
-# Default : -
-# May be used to add more exclude path (directories or files) from the initial
-# default list of excluded paths. See CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST.
-##end
+#
+# .. variable:: CPACK_RPM_PACKAGE_SUMMARY
+# CPACK_RPM_<component>_PACKAGE_SUMMARY
+#
+# The RPM package summary.
+#
+# * Mandatory : YES
+# * Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY
+#
+# .. variable:: CPACK_RPM_PACKAGE_NAME
+# CPACK_RPM_<component>_PACKAGE_NAME
+#
+# The RPM package name.
+#
+# * Mandatory : YES
+# * Default : CPACK_PACKAGE_NAME
+#
+# .. variable:: CPACK_RPM_PACKAGE_VERSION
+#
+# The RPM package version.
+#
+# * Mandatory : YES
+# * Default : CPACK_PACKAGE_VERSION
+#
+# .. variable:: CPACK_RPM_PACKAGE_ARCHITECTURE
+# CPACK_RPM_<component>_PACKAGE_ARCHITECTURE
+#
+# The RPM package architecture.
+#
+# * Mandatory : YES
+# * Default : Native architecture output by "uname -m"
+#
+# This may be set to "noarch" if you know you are building a noarch package.
+#
+# .. variable:: CPACK_RPM_PACKAGE_RELEASE
+#
+# The RPM package release.
+#
+# * Mandatory : YES
+# * Default : 1
+#
+# This is the numbering of the RPM package itself, i.e. the version of the
+# packaging and not the version of the content (see
+# CPACK_RPM_PACKAGE_VERSION). One may change the default value if the
+# previous packaging was buggy and/or you want to put here a fancy Linux
+# distro specific numbering.
+#
+# .. variable:: CPACK_RPM_PACKAGE_LICENSE
+#
+# The RPM package license policy.
+#
+# * Mandatory : YES
+# * Default : "unknown"
+#
+# .. variable:: CPACK_RPM_PACKAGE_GROUP
+# CPACK_RPM_<component>_PACKAGE_GROUP
+#
+# The RPM package group.
+#
+# * Mandatory : YES
+# * Default : "unknown"
+#
+# .. variable:: CPACK_RPM_PACKAGE_VENDOR
+#
+# The RPM package vendor.
+#
+# * Mandatory : YES
+# * Default : CPACK_PACKAGE_VENDOR if set or "unknown"
+#
+# .. variable:: CPACK_RPM_PACKAGE_URL
+# CPACK_RPM_<component>_PACKAGE_URL
+#
+# The projects URL.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# .. variable:: CPACK_RPM_PACKAGE_DESCRIPTION
+# CPACK_RPM_<component>_PACKAGE_DESCRIPTION
+#
+# RPM package description.
+#
+# * Mandatory : YES
+# * Default : CPACK_COMPONENT_<compName>_DESCRIPTION (component based installers
+# only) if set, CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package
+# description available"
+#
+# .. variable:: CPACK_RPM_COMPRESSION_TYPE
+#
+# RPM compression type.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to override RPM compression type to be used to build the
+# RPM. For example some Linux distribution now default to lzma or xz
+# compression whereas older cannot use such RPM. Using this one can enforce
+# compression type to be used. Possible value are: lzma, xz, bzip2 and gzip.
+#
+# .. variable:: CPACK_RPM_PACKAGE_AUTOREQ
+# CPACK_RPM_<component>_PACKAGE_AUTOREQ
+#
+# RPM spec autoreq field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to enable (1, yes) or disable (0, no) automatic shared libraries
+# dependency detection. Dependencies are added to requires list.
+#
+# .. note::
+#
+# By defalut automatic dependency detection is enabled by rpm generator.
+#
+# .. variable:: CPACK_RPM_PACKAGE_AUTOPROV
+# CPACK_RPM_<component>_PACKAGE_AUTOPROV
+#
+# RPM spec autoprov field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to enable (1, yes) or disable (0, no) automatic listing of shared
+# libraries that are provided by the package. Shared libraries are added to
+# provides list.
+#
+# .. note::
+#
+# By defalut automatic provides detection is enabled by rpm generator.
+#
+# .. variable:: CPACK_RPM_PACKAGE_AUTOREQPROV
+# CPACK_RPM_<component>_PACKAGE_AUTOREQPROV
+#
+# RPM spec autoreqprov field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# Variable enables/disables autoreq and autoprov at the same time.
+# See :variable:`CPACK_RPM_PACKAGE_AUTOREQ` and :variable:`CPACK_RPM_PACKAGE_AUTOPROV`
+# for more details.
+#
+# .. note::
+#
+# By defalut automatic detection feature is enabled by rpm.
+#
+# .. variable:: CPACK_RPM_PACKAGE_REQUIRES
+# CPACK_RPM_<component>_PACKAGE_REQUIRES
+#
+# RPM spec requires field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to set RPM dependencies (requires). Note that you must enclose
+# the complete requires string between quotes, for example::
+#
+# set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8")
+#
+# The required package list of an RPM file could be printed with::
+#
+# rpm -qp --requires file.rpm
+#
+# .. variable:: CPACK_RPM_PACKAGE_CONFLICTS
+# CPACK_RPM_<component>_PACKAGE_CONFLICTS
+#
+# RPM spec conflicts field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to set negative RPM dependencies (conflicts). Note that you must enclose
+# the complete requires string between quotes, for example::
+#
+# set(CPACK_RPM_PACKAGE_CONFLICTS "libxml2")
+#
+# The conflicting package list of an RPM file could be printed with::
+#
+# rpm -qp --conflicts file.rpm
+#
+# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PRE
+# CPACK_RPM_<component>_PACKAGE_REQUIRES_PRE
+#
+# RPM spec requires(pre) field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to set RPM preinstall dependencies (requires(pre)). Note that you must enclose
+# the complete requires string between quotes, for example::
+#
+# set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts")
+#
+# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POST
+# CPACK_RPM_<component>_PACKAGE_REQUIRES_POST
+#
+# RPM spec requires(post) field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to set RPM postinstall dependencies (requires(post)). Note that you must enclose
+# the complete requires string between quotes, for example::
+#
+# set(CPACK_RPM_PACKAGE_REQUIRES_POST "shadow-utils, initscripts")
+#
+#
+# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN
+# CPACK_RPM_<component>_PACKAGE_REQUIRES_POSTUN
+#
+# RPM spec requires(postun) field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to set RPM postuninstall dependencies (requires(postun)). Note that you must enclose
+# the complete requires string between quotes, for example::
+#
+# set(CPACK_RPM_PACKAGE_REQUIRES_POSTUN "shadow-utils, initscripts")
+#
+#
+# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN
+# CPACK_RPM_<component>_PACKAGE_REQUIRES_PREUN
+#
+# RPM spec requires(preun) field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to set RPM preuninstall dependencies (requires(preun)). Note that you must enclose
+# the complete requires string between quotes, for example::
+#
+# set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts")
+#
+# .. variable:: CPACK_RPM_PACKAGE_SUGGESTS
+# CPACK_RPM_<component>_PACKAGE_SUGGESTS
+#
+# RPM spec suggest field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to set weak RPM dependencies (suggests). Note that you must
+# enclose the complete requires string between quotes.
+#
+# .. variable:: CPACK_RPM_PACKAGE_PROVIDES
+# CPACK_RPM_<component>_PACKAGE_PROVIDES
+#
+# RPM spec provides field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to set RPM dependencies (provides). The provided package list
+# of an RPM file could be printed with::
+#
+# rpm -qp --provides file.rpm
+#
+# .. variable:: CPACK_RPM_PACKAGE_OBSOLETES
+# CPACK_RPM_<component>_PACKAGE_OBSOLETES
+#
+# RPM spec obsoletes field.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to set RPM packages that are obsoleted by this one.
+#
+# .. variable:: CPACK_RPM_PACKAGE_RELOCATABLE
+#
+# build a relocatable RPM.
+#
+# * Mandatory : NO
+# * Default : CPACK_PACKAGE_RELOCATABLE
+#
+# If this variable is set to TRUE or ON CPackRPM will try
+# to build a relocatable RPM package. A relocatable RPM may
+# be installed using::
+#
+# rpm --prefix or --relocate
+#
+# in order to install it at an alternate place see rpm(8). Note that
+# currently this may fail if CPACK_SET_DESTDIR is set to ON. If
+# CPACK_SET_DESTDIR is set then you will get a warning message but if there
+# is file installed with absolute path you'll get unexpected behavior.
+#
+# .. variable:: CPACK_RPM_SPEC_INSTALL_POST
+#
+# * Mandatory : NO
+# * Default : -
+# * Deprecated: YES
+#
+# This way of specifying post-install script is deprecated, use
+# CPACK_RPM_POST_INSTALL_SCRIPT_FILE.
+# May be used to set an RPM post-install command inside the spec file.
+# For example setting it to "/bin/true" may be used to prevent
+# rpmbuild to strip binaries.
+#
+# .. variable:: CPACK_RPM_SPEC_MORE_DEFINE
+#
+# RPM extended spec definitions lines.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to add any %define lines to the generated spec file.
+#
+# .. variable:: CPACK_RPM_PACKAGE_DEBUG
+#
+# Toggle CPackRPM debug output.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be set when invoking cpack in order to trace debug information
+# during CPack RPM run. For example you may launch CPack like this::
+#
+# cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
+#
+# .. variable:: CPACK_RPM_USER_BINARY_SPECFILE
+#
+# A user provided spec file.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be set by the user in order to specify a USER binary spec file
+# to be used by CPackRPM instead of generating the file.
+# The specified file will be processed by configure_file( @ONLY).
+# One can provide a component specific file by setting
+# CPACK_RPM_<componentName>_USER_BINARY_SPECFILE.
+#
+# .. variable:: CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
+#
+# Spec file template.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# If set CPack will generate a template for USER specified binary
+# spec file and stop with an error. For example launch CPack like this::
+#
+# cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM
+#
+# The user may then use this file in order to hand-craft is own
+# binary spec file which may be used with CPACK_RPM_USER_BINARY_SPECFILE.
+#
+# .. variable:: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
+# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to embed a pre (un)installation script in the spec file.
+# The refered script file(s) will be read and directly
+# put after the %pre or %preun section
+# If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for
+# each component can be overridden with
+# CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE and
+# CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE.
+# One may verify which scriptlet has been included with::
+#
+# rpm -qp --scripts package.rpm
+#
+# .. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE
+# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to embed a post (un)installation script in the spec file.
+# The refered script file(s) will be read and directly
+# put after the %post or %postun section.
+# If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for
+# each component can be overridden with
+# CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE and
+# CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE.
+# One may verify which scriptlet has been included with::
+#
+# rpm -qp --scripts package.rpm
+#
+# .. variable:: CPACK_RPM_USER_FILELIST
+# CPACK_RPM_<COMPONENT>_USER_FILELIST
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to explicitly specify %(<directive>) file line
+# in the spec file. Like %config(noreplace) or any other directive
+# that be found in the %files section. Since CPackRPM is generating
+# the list of files (and directories) the user specified files of
+# the CPACK_RPM_<COMPONENT>_USER_FILELIST list will be removed from
+# the generated list.
+#
+# .. variable:: CPACK_RPM_CHANGELOG_FILE
+#
+# RPM changelog file.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to embed a changelog in the spec file.
+# The refered file will be read and directly put after the %changelog
+# section.
+#
+# .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST
+#
+# list of path to be excluded.
+#
+# * Mandatory : NO
+# * Default : /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include
+#
+# May be used to exclude path (directories or files) from the auto-generated
+# list of paths discovered by CPack RPM. The defaut value contains a
+# reasonable set of values if the variable is not defined by the user. If the
+# variable is defined by the user then CPackRPM will NOT any of the default
+# path. If you want to add some path to the default list then you can use
+# CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION variable.
+#
+# .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
+#
+# additional list of path to be excluded.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to add more exclude path (directories or files) from the initial
+# default list of excluded paths. See CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST.
+#
+# .. variable:: CPACK_RPM_RELOCATION_PATHS
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to specify more than one relocation path per relocatable RPM.
+# Variable contains a list of relocation paths that if relative are prefixed
+# by the value of CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX or by the value of
+# CPACK_PACKAGING_INSTALL_PREFIX if the component version is not provided.
+# Variable is not component based as its content can be used to set a different
+# path prefix for e.g. binary dir and documentation dir at the same time.
+# Only prefixes that are required by a certain component are added to that
+# component - component must contain at least one file/directory/symbolic link
+# with CPACK_RPM_RELOCATION_PATHS prefix for a certain relocation path
+# to be added. Package will not contain any relocation paths if there are no
+# files/directories/symbolic links on any of the provided prefix locations.
+# Packages that either do not contain any relocation paths or contain
+# files/directories/symbolic links that are outside relocation paths print
+# out an AUTHOR_WARNING that RPM will be partially relocatable.
+#
+# .. variable:: CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
+#
+# * Mandatory : NO
+# * Default : CPACK_PACKAGING_INSTALL_PREFIX
+#
+# May be used to set per component CPACK_PACKAGING_INSTALL_PREFIX for
+# relocatable RPM packages.
+#
+# .. variable:: CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION
+# CPACK_RPM_NO_<COMPONENT>_INSTALL_PREFIX_RELOCATION
+#
+# * Mandatory : NO
+# * Default : CPACK_PACKAGING_INSTALL_PREFIX or CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
+# are treated as one of relocation paths
+#
+# May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
+# from relocatable RPM prefix paths.
+#
+# .. variable:: CPACK_RPM_ADDITIONAL_MAN_DIRS
+#
+# * Mandatory : NO
+# * Default : -
+#
+# May be used to set additional man dirs that could potentially be compressed
+# by brp-compress RPM macro. Variable content must be a list of regular
+# expressions that point to directories containing man files or to man files
+# directly. Note that in order to compress man pages a path must also be
+# present in brp-compress RPM script and that brp-compress script must be
+# added to RPM configuration by the operating system.
+#
+# Regular expressions that are added by default were taken from brp-compress
+# RPM macro:
+#
+# - /usr/man/man.*
+# - /usr/man/.*/man.*
+# - /usr/info.*
+# - /usr/share/man/man.*
+# - /usr/share/man/.*/man.*
+# - /usr/share/info.*
+# - /usr/kerberos/man.*
+# - /usr/X11R6/man/man.*
+# - /usr/lib/perl5/man/man.*
+# - /usr/share/doc/.*/man/man.*
+# - /usr/lib/.*/man/man.*
+#
+# Packaging of Symbolic Links
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# CPackRPM supports packaging of symbolic links::
+#
+# execute_process(COMMAND ${CMAKE_COMMAND}
+# -E create_symlink <relative_path_location> <symlink_name>)
+# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/<symlink_name>
+# DESTINATION <symlink_location> COMPONENT libraries)
+#
+# Symbolic links will be optimized (paths will be shortened if possible)
+# before being added to the package or if multiple relocation paths are
+# detected, a post install symlink relocation script will be generated.
+#
+# Symbolic links may point to locations that are not packaged by the same
+# package (either a different component or even not packaged at all) but
+# those locations will be treated as if they were a part of the package
+# while determining if symlink should be either created or present in a
+# post install script - depending on relocation paths.
+#
+# Currenty there are a few limitations though:
+#
+# * Only symbolic links with relative path can be packaged.
+#
+# * For component based packaging component interdependency is not checked
+# when processing symbolic links. Symbolic links pointing to content of
+# a different component are treated the same way as if pointing to location
+# that will not be packaged.
+#
+# * Symbolic links pointing to a location through one or more intermediate
+# symbolic links will not be handled differently - if the intermediate
+# symbolic link(s) is also on a relocatable path, relocating it during
+# package installation may cause initial symbolic link to point to an
+# invalid location.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -259,6 +571,471 @@
# Author: Eric Noulard with the help of Alexander Neundorf.
+function(cpack_rpm_prepare_relocation_paths)
+ # set appropriate prefix, remove possible trailing slash and convert backslashes to slashes
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX)
+ file(TO_CMAKE_PATH "${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX}" PATH_PREFIX)
+ else()
+ file(TO_CMAKE_PATH "${CPACK_PACKAGING_INSTALL_PREFIX}" PATH_PREFIX)
+ endif()
+
+ set(RPM_RELOCATION_PATHS "${CPACK_RPM_RELOCATION_PATHS}")
+ list(REMOVE_DUPLICATES RPM_RELOCATION_PATHS)
+
+ # set base path prefix
+ if(EXISTS "${WDIR}/${PATH_PREFIX}")
+ if(NOT CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION AND
+ NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT}_INSTALL_PREFIX_RELOCATION)
+ set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n")
+ list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}")
+
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: removing '${PATH_PREFIX}' from relocation paths")
+ endif()
+ endif()
+ endif()
+
+ # set other path prefixes
+ foreach(RELOCATION_PATH ${RPM_RELOCATION_PATHS})
+ if(IS_ABSOLUTE "${RELOCATION_PATH}")
+ set(PREPARED_RELOCATION_PATH "${RELOCATION_PATH}")
+ else()
+ set(PREPARED_RELOCATION_PATH "${PATH_PREFIX}/${RELOCATION_PATH}")
+ endif()
+
+ if(EXISTS "${WDIR}/${PREPARED_RELOCATION_PATH}")
+ set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PREPARED_RELOCATION_PATH}\n")
+ list(APPEND RPM_USED_PACKAGE_PREFIXES "${PREPARED_RELOCATION_PATH}")
+ endif()
+ endforeach()
+
+ # warn about all the paths that are not relocatable
+ cmake_policy(PUSH)
+ # Tell file(GLOB_RECURSE) not to follow directory symlinks
+ # even if the project does not set this policy to NEW.
+ cmake_policy(SET CMP0009 NEW)
+ file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*")
+ cmake_policy(POP)
+ foreach(TMP_PATH ${FILE_PATHS_})
+ string(LENGTH "${WDIR}" WDIR_LEN)
+ string(SUBSTRING "${TMP_PATH}" ${WDIR_LEN} -1 TMP_PATH)
+ unset(TMP_PATH_FOUND_)
+
+ foreach(RELOCATION_PATH ${RPM_USED_PACKAGE_PREFIXES})
+ file(RELATIVE_PATH REL_PATH_ "${RELOCATION_PATH}" "${TMP_PATH}")
+ string(SUBSTRING "${REL_PATH_}" 0 2 PREFIX_)
+
+ if(NOT "${PREFIX_}" STREQUAL "..")
+ set(TPM_PATH_FOUND_ TRUE)
+ break()
+ endif()
+ endforeach()
+
+ if(NOT TPM_PATH_FOUND_)
+ message(AUTHOR_WARNING "CPackRPM:Warning: Path ${TMP_PATH} is not on one of the relocatable paths! Package will be partially relocatable.")
+ endif()
+ endforeach()
+
+ set(RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}" PARENT_SCOPE)
+ set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE)
+endfunction()
+
+function(cpack_rpm_prepare_content_list)
+ # get files list
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0009 NEW)
+ file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*")
+ cmake_policy(POP)
+ set(CPACK_RPM_INSTALL_FILES "/${CPACK_RPM_INSTALL_FILES}")
+ string(REPLACE ";" ";/" CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}")
+
+ # if we are creating a relocatable package, omit parent directories of
+ # CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list"
+ # which is passed to the find command that generates the content-list
+ if(CPACK_RPM_PACKAGE_RELOCATABLE)
+ # get a list of the elements in CPACK_RPM_PACKAGE_PREFIXES that are
+ # destinct parent paths of other relocation paths and remove the
+ # final element (so the install-prefix dir itself is not omitted
+ # from the RPM's content-list)
+ list(SORT RPM_USED_PACKAGE_PREFIXES)
+ set(_DISTINCT_PATH "NOT_SET")
+ foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES})
+ if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*")
+ set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}")
+
+ string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS " ${_RPM_RELOCATION_PREFIX}")
+ list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
+ unset(_TMP_LIST)
+ # Now generate all of the parent dirs of the relocation path
+ foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
+ list(APPEND _TMP_LIST "${_PREFIX_PATH_ELEM}")
+ string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}")
+ separate_arguments(_OMIT_DIR)
+ list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR})
+ endforeach()
+ endif()
+ endforeach()
+ endif()
+
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: Initial list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}")
+ endif()
+
+ if(NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST)
+ set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include)
+ if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION)
+ message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.")
+ list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}")
+ endif()
+ endif()
+
+ if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST)
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST= ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}")
+ endif()
+ list(APPEND _RPM_DIRS_TO_OMIT ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST})
+ endif()
+
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: Final list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}")
+ endif()
+
+ list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES ${_RPM_DIRS_TO_OMIT})
+
+ # add man paths that will be compressed
+ # (copied from /usr/lib/rpm/brp-compress - script that does the actual
+ # compressing)
+ list(APPEND MAN_LOCATIONS "/usr/man/man.*" "/usr/man/.*/man.*" "/usr/info.*"
+ "/usr/share/man/man.*" "/usr/share/man/.*/man.*" "/usr/share/info.*"
+ "/usr/kerberos/man.*" "/usr/X11R6/man/man.*" "/usr/lib/perl5/man/man.*"
+ "/usr/share/doc/.*/man/man.*" "/usr/lib/.*/man/man.*")
+
+ if(CPACK_RPM_ADDITIONAL_MAN_DIRS)
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: CPACK_RPM_ADDITIONAL_MAN_DIRS= ${CPACK_RPM_ADDITIONAL_MAN_DIRS}")
+ endif()
+ list(APPEND MAN_LOCATIONS ${CPACK_RPM_ADDITIONAL_MAN_DIRS})
+ endif()
+
+ foreach(PACK_LOCATION IN LISTS CPACK_RPM_INSTALL_FILES)
+ foreach(MAN_LOCATION IN LISTS MAN_LOCATIONS)
+ # man pages are files inside a certain location
+ if(PACK_LOCATION MATCHES "${MAN_LOCATION}/"
+ AND NOT IS_DIRECTORY "${WDIR}${PACK_LOCATION}"
+ AND NOT IS_SYMLINK "${WDIR}${PACK_LOCATION}")
+ list(FIND CPACK_RPM_INSTALL_FILES "${PACK_LOCATION}" INDEX)
+ # insert file location that covers compressed man pages
+ # even if using a wildcard causes duplicates as those are
+ # handled by RPM and we still keep the same file list
+ # in spec file - wildcard only represents file type (e.g. .gz)
+ list(INSERT CPACK_RPM_INSTALL_FILES ${INDEX} "${PACK_LOCATION}*")
+ # remove file location that doesn't cover compressed man pages
+ math(EXPR INDEX ${INDEX}+1)
+ list(REMOVE_AT CPACK_RPM_INSTALL_FILES ${INDEX})
+
+ break()
+ endif()
+ endforeach()
+ endforeach()
+
+ set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}" PARENT_SCOPE)
+endfunction()
+
+function(cpack_rpm_symlink_get_relocation_prefixes LOCATION PACKAGE_PREFIXES RETURN_VARIABLE)
+ foreach(PKG_PREFIX IN LISTS PACKAGE_PREFIXES)
+ string(REGEX MATCH "^${PKG_PREFIX}/.*" FOUND_ "${LOCATION}")
+ if(FOUND_)
+ list(APPEND TMP_PREFIXES "${PKG_PREFIX}")
+ endif()
+ endforeach()
+
+ set(${RETURN_VARIABLE} "${TMP_PREFIXES}" PARENT_SCOPE)
+endfunction()
+
+function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES)
+ list(LENGTH PACKAGE_PREFIXES LAST_INDEX)
+ set(SORTED_PACKAGE_PREFIXES "${PACKAGE_PREFIXES}")
+ list(SORT SORTED_PACKAGE_PREFIXES)
+ list(REVERSE SORTED_PACKAGE_PREFIXES)
+ math(EXPR LAST_INDEX ${LAST_INDEX}-1)
+
+ foreach(SYMLINK_INDEX RANGE ${LAST_INDEX})
+ list(GET SORTED_PACKAGE_PREFIXES ${SYMLINK_INDEX} SRC_PATH)
+ list(FIND PACKAGE_PREFIXES "${SRC_PATH}" SYMLINK_INDEX) # reverse magic
+ string(LENGTH "${SRC_PATH}" SRC_PATH_LEN)
+
+ set(PARTS_CNT 0)
+ set(SCRIPT_PART "if [ \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}\" != \"${SRC_PATH}\" ]; then\n")
+
+ # both paths relocated
+ foreach(POINT_INDEX RANGE ${LAST_INDEX})
+ list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH)
+ list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic
+ string(LENGTH "${POINT_PATH}" POINT_PATH_LEN)
+
+ if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX})
+ if("${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}")
+ set(INDENT "")
+ else()
+ set(SCRIPT_PART "${SCRIPT_PART} if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n")
+ set(INDENT " ")
+ endif()
+
+ foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX})
+ math(EXPR PARTS_CNT ${PARTS_CNT}+1)
+
+ math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1)
+ list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR)
+ string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX)
+
+ math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN})
+ string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_)
+
+ math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN})
+ string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_)
+
+ set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
+ set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n")
+ set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n")
+ set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}fi\n")
+ endforeach()
+
+ if(NOT "${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}")
+ set(SCRIPT_PART "${SCRIPT_PART} fi\n")
+ endif()
+ endif()
+ endforeach()
+
+ # source path relocated
+ if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X)
+ foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X)
+ math(EXPR PARTS_CNT ${PARTS_CNT}+1)
+
+ math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1)
+ list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR)
+ string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX)
+
+ math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN})
+ string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_)
+
+ math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1)
+ string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_)
+
+ set(SCRIPT_PART "${SCRIPT_PART} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
+ set(SCRIPT_PART "${SCRIPT_PART} ln -s \"${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n")
+ set(SCRIPT_PART "${SCRIPT_PART} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n")
+ set(SCRIPT_PART "${SCRIPT_PART} fi\n")
+ endforeach()
+ endif()
+
+ if(PARTS_CNT)
+ set(SCRIPT "${SCRIPT_PART}")
+ set(SCRIPT "${SCRIPT}fi\n")
+ endif()
+ endforeach()
+
+ # point path relocated
+ foreach(POINT_INDEX RANGE ${LAST_INDEX})
+ list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH)
+ list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic
+ string(LENGTH "${POINT_PATH}" POINT_PATH_LEN)
+
+ if(_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX})
+ set(SCRIPT "${SCRIPT}if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n")
+
+ foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX})
+ math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1)
+ list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR)
+ string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX)
+
+ string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_)
+
+ math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN})
+ string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_)
+
+ set(SCRIPT "${SCRIPT} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
+ set(SCRIPT "${SCRIPT} ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"${SYMLINK_}\"\n")
+ set(SCRIPT "${SCRIPT} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n")
+ set(SCRIPT "${SCRIPT} fi\n")
+ endforeach()
+
+ set(SCRIPT "${SCRIPT}fi\n")
+ endif()
+ endforeach()
+
+ # no path relocated
+ if(_RPM_RELOCATION_SCRIPT_X_X)
+ foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_X)
+ math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1)
+ list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR)
+ string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX)
+
+ string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_)
+
+ math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1)
+ string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_)
+
+ set(SCRIPT "${SCRIPT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n")
+ set(SCRIPT "${SCRIPT} ln -s \"${POINT_}\" \"${SYMLINK_}\"\n")
+ set(SCRIPT "${SCRIPT}fi\n")
+ endforeach()
+ endif()
+
+ set(RPM_SYMLINK_POSTINSTALL "${SCRIPT}" PARENT_SCOPE)
+endfunction()
+
+function(cpack_rpm_symlink_add_for_relocation_script PACKAGE_PREFIXES SYMLINK SYMLINK_RELOCATION_PATHS POINT POINT_RELOCATION_PATHS)
+ list(LENGTH SYMLINK_RELOCATION_PATHS SYMLINK_PATHS_COUTN)
+ list(LENGTH POINT_RELOCATION_PATHS POINT_PATHS_COUNT)
+
+ list(APPEND _RPM_RELOCATION_SCRIPT_PAIRS "${SYMLINK}:${POINT}")
+ list(LENGTH _RPM_RELOCATION_SCRIPT_PAIRS PAIR_NO)
+
+ if(SYMLINK_PATHS_COUTN)
+ foreach(SYMLINK_RELOC_PATH IN LISTS SYMLINK_RELOCATION_PATHS)
+ list(FIND PACKAGE_PREFIXES "${SYMLINK_RELOC_PATH}" SYMLINK_INDEX)
+
+ # source path relocated
+ list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X "${PAIR_NO}")
+ list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X")
+
+ foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS)
+ list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX)
+
+ # both paths relocated
+ list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX} "${PAIR_NO}")
+ list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}")
+
+ # point path relocated
+ list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}")
+ list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}")
+ endforeach()
+ endforeach()
+ elseif(POINT_PATHS_COUNT)
+ foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS)
+ list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX)
+
+ # point path relocated
+ list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}")
+ list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}")
+ endforeach()
+ endif()
+
+ # no path relocated
+ list(APPEND _RPM_RELOCATION_SCRIPT_X_X "${PAIR_NO}")
+ list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_X")
+
+ # place variables into parent scope
+ foreach(VAR IN LISTS RELOCATION_VARS)
+ set(${VAR} "${${VAR}}" PARENT_SCOPE)
+ endforeach()
+ set(_RPM_RELOCATION_SCRIPT_PAIRS "${_RPM_RELOCATION_SCRIPT_PAIRS}" PARENT_SCOPE)
+ set(REQUIRES_SYMLINK_RELOCATION_SCRIPT "true" PARENT_SCOPE)
+ set(DIRECTIVE "%ghost " PARENT_SCOPE)
+endfunction()
+
+function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXES IS_RELOCATABLE)
+ # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir
+ # This is necessary to avoid duplicate files since rpmbuild does
+ # recursion on its own when encountering a pathname which is a directory
+ # which is not flagged as %dir
+ string(STRIP "${INSTALL_FILES_LIST}" INSTALL_FILES_LIST)
+ string(REPLACE "\n" ";" INSTALL_FILES_LIST
+ "${INSTALL_FILES_LIST}")
+ string(REPLACE "\"" "" INSTALL_FILES_LIST
+ "${INSTALL_FILES_LIST}")
+ string(LENGTH "${WDIR}" WDR_LEN_)
+
+ list(SORT INSTALL_FILES_LIST) # make file order consistent on all platforms
+
+ foreach(F IN LISTS INSTALL_FILES_LIST)
+ unset(DIRECTIVE)
+
+ if(IS_SYMLINK "${WDIR}/${F}")
+ if(IS_RELOCATABLE)
+ # check that symlink has relocatable format
+ get_filename_component(SYMLINK_LOCATION_ "${WDIR}/${F}" DIRECTORY)
+ execute_process(COMMAND ls -la "${WDIR}/${F}"
+ WORKING_DIRECTORY "${WDIR}"
+ OUTPUT_VARIABLE SYMLINK_POINT_
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ string(FIND "${SYMLINK_POINT_}" "->" SYMLINK_POINT_INDEX_ REVERSE)
+ math(EXPR SYMLINK_POINT_INDEX_ ${SYMLINK_POINT_INDEX_}+3)
+ string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_)
+
+ # get destination path
+ string(SUBSTRING "${SYMLINK_POINT_}" ${SYMLINK_POINT_INDEX_} ${SYMLINK_POINT_LENGTH_} SYMLINK_POINT_)
+
+ # check if path is relative or absolute
+ string(SUBSTRING "${SYMLINK_POINT_}" 0 1 SYMLINK_IS_ABSOLUTE_)
+
+ if(${SYMLINK_IS_ABSOLUTE_} STREQUAL "/")
+ # prevent absolute paths from having /../ or /./ section inside of them
+ get_filename_component(SYMLINK_POINT_ "${SYMLINK_POINT_}" ABSOLUTE)
+ else()
+ # handle relative path
+ get_filename_component(SYMLINK_POINT_ "${SYMLINK_LOCATION_}/${SYMLINK_POINT_}" ABSOLUTE)
+ endif()
+
+ string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_)
+
+ cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS")
+ cpack_rpm_symlink_get_relocation_prefixes("${SYMLINK_POINT_WD_}" "${PACKAGE_PREFIXES}" "POINT_RELOCATIONS")
+
+ list(LENGTH SYMLINK_RELOCATIONS SYMLINK_RELOCATIONS_COUNT)
+ list(LENGTH POINT_RELOCATIONS POINT_RELOCATIONS_COUNT)
+
+ if(SYMLINK_RELOCATIONS_COUNT AND POINT_RELOCATIONS_COUNT)
+ # find matching
+ foreach(SYMLINK_RELOCATION_PREFIX IN LISTS SYMLINK_RELOCATIONS)
+ list(FIND POINT_RELOCATIONS "${SYMLINK_RELOCATION_PREFIX}" FOUND_INDEX)
+ if(NOT ${FOUND_INDEX} EQUAL -1)
+ break()
+ endif()
+ endforeach()
+
+ if(NOT ${FOUND_INDEX} EQUAL -1)
+ # symlinks have the same subpath
+ if(${SYMLINK_RELOCATIONS_COUNT} EQUAL 1 AND ${POINT_RELOCATIONS_COUNT} EQUAL 1)
+ # permanent symlink
+ get_filename_component(SYMLINK_LOCATION_ "${F}" DIRECTORY)
+ file(RELATIVE_PATH FINAL_PATH_ ${SYMLINK_LOCATION_} ${SYMLINK_POINT_WD_})
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${FINAL_PATH_}" "${WDIR}/${F}")
+ else()
+ # relocation subpaths
+ cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}"
+ "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}")
+ endif()
+ else()
+ # not on the same relocation path
+ cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}"
+ "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}")
+ endif()
+ elseif(POINT_RELOCATIONS_COUNT)
+ # point is relocatable
+ cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}"
+ "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}")
+ else()
+ # is not relocatable or points to non relocatable path - permanent symlink
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${SYMLINK_POINT_WD_}" "${WDIR}/${F}")
+ endif()
+ endif()
+ elseif(IS_DIRECTORY "${WDIR}/${F}")
+ set(DIRECTIVE "%dir ")
+ endif()
+
+ set(INSTALL_FILES "${INSTALL_FILES}${DIRECTIVE}\"${F}\"\n")
+ endforeach()
+
+ if(REQUIRES_SYMLINK_RELOCATION_SCRIPT)
+ cpack_rpm_symlink_create_relocation_script("${PACKAGE_PREFIXES}")
+ endif()
+
+ set(RPM_SYMLINK_POSTINSTALL "${RPM_SYMLINK_POSTINSTALL}" PARENT_SCOPE)
+ set(CPACK_RPM_INSTALL_FILES "${INSTALL_FILES}" PARENT_SCOPE)
+endfunction()
+
if(CMAKE_BINARY_DIR)
message(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.")
endif()
@@ -267,640 +1044,625 @@ if(NOT UNIX)
message(FATAL_ERROR "CPackRPM.cmake may only be used under UNIX.")
endif()
-# rpmbuild is the basic command for building RPM package
-# it may be a simple (symbolic) link to rpm command.
-find_program(RPMBUILD_EXECUTABLE rpmbuild)
-
-# Check version of the rpmbuild tool this would be easier to
-# track bugs with users and CPackRPM debug mode.
-# We may use RPM version in order to check for available version dependent features
-if(RPMBUILD_EXECUTABLE)
- execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version
- OUTPUT_VARIABLE _TMP_VERSION
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX REPLACE "^.* " ""
- RPMBUILD_EXECUTABLE_VERSION
- ${_TMP_VERSION})
+function(cpack_rpm_generate_package)
+ # rpmbuild is the basic command for building RPM package
+ # it may be a simple (symbolic) link to rpm command.
+ find_program(RPMBUILD_EXECUTABLE rpmbuild)
+
+ # Check version of the rpmbuild tool this would be easier to
+ # track bugs with users and CPackRPM debug mode.
+ # We may use RPM version in order to check for available version dependent features
+ if(RPMBUILD_EXECUTABLE)
+ execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version
+ OUTPUT_VARIABLE _TMP_VERSION
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE "^.* " ""
+ RPMBUILD_EXECUTABLE_VERSION
+ ${_TMP_VERSION})
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>")
+ endif()
+ endif()
+
+ if(NOT RPMBUILD_EXECUTABLE)
+ message(FATAL_ERROR "RPM package requires rpmbuild executable")
+ endif()
+
+ # Display lsb_release output if DEBUG mode enable
+ # This will help to diagnose problem with CPackRPM
+ # because we will know on which kind of Linux we are
if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>")
+ find_program(LSB_RELEASE_EXECUTABLE lsb_release)
+ if(LSB_RELEASE_EXECUTABLE)
+ execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -a
+ OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE "\n" ", "
+ LSB_RELEASE_OUTPUT
+ ${_TMP_LSB_RELEASE_OUTPUT})
+ else ()
+ set(LSB_RELEASE_OUTPUT "lsb_release not installed/found!")
+ endif()
+ message("CPackRPM:Debug: LSB_RELEASE = ${LSB_RELEASE_OUTPUT}")
endif()
-endif()
-if(NOT RPMBUILD_EXECUTABLE)
- message(FATAL_ERROR "RPM package requires rpmbuild executable")
-endif()
+ # We may use RPM version in the future in order
+ # to shut down warning about space in buildtree
+ # some recent RPM version should support space in different places.
+ # not checked [yet].
+ if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*")
+ message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.")
+ endif()
-# Display lsb_release output if DEBUG mode enable
-# This will help to diagnose problem with CPackRPM
-# because we will know on which kind of Linux we are
-if(CPACK_RPM_PACKAGE_DEBUG)
- find_program(LSB_RELEASE_EXECUTABLE lsb_release)
- if(LSB_RELEASE_EXECUTABLE)
- execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -a
- OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX REPLACE "\n" ", "
- LSB_RELEASE_OUTPUT
- ${_TMP_LSB_RELEASE_OUTPUT})
- else ()
- set(LSB_RELEASE_OUTPUT "lsb_release not installed/found!")
+ # If rpmbuild is found
+ # we try to discover alien since we may be on non RPM distro like Debian.
+ # In this case we may try to to use more advanced features
+ # like generating RPM directly from DEB using alien.
+ # FIXME feature not finished (yet)
+ find_program(ALIEN_EXECUTABLE alien)
+ if(ALIEN_EXECUTABLE)
+ message(STATUS "alien found, we may be on a Debian based distro.")
endif()
- message("CPackRPM:Debug: LSB_RELEASE = ${LSB_RELEASE_OUTPUT}")
-endif()
-# We may use RPM version in the future in order
-# to shut down warning about space in buildtree
-# some recent RPM version should support space in different places.
-# not checked [yet].
-if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*")
- message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.")
-endif()
+ # Are we packaging components ?
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ string(TOUPPER ${CPACK_RPM_PACKAGE_COMPONENT} CPACK_RPM_PACKAGE_COMPONENT_UPPER)
+ endif()
-# If rpmbuild is found
-# we try to discover alien since we may be on non RPM distro like Debian.
-# In this case we may try to to use more advanced features
-# like generating RPM directly from DEB using alien.
-# FIXME feature not finished (yet)
-find_program(ALIEN_EXECUTABLE alien)
-if(ALIEN_EXECUTABLE)
- message(STATUS "alien found, we may be on a Debian based distro.")
-endif()
+ set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}")
-# Are we packaging components ?
-if(CPACK_RPM_PACKAGE_COMPONENT)
- set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
-else()
- set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "")
-endif()
+ #
+ # Use user-defined RPM specific variables value
+ # or generate reasonable default value from
+ # CPACK_xxx generic values.
+ # The variables comes from the needed (mandatory or not)
+ # values found in the RPM specification file aka ".spec" file.
+ # The variables which may/should be defined are:
+ #
-set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}")
+ # CPACK_RPM_PACKAGE_SUMMARY (mandatory)
-#
-# Use user-defined RPM specific variables value
-# or generate reasonable default value from
-# CPACK_xxx generic values.
-# The variables comes from the needed (mandatory or not)
-# values found in the RPM specification file aka ".spec" file.
-# The variables which may/should be defined are:
-#
+ #Check for component summary first.
+ #If not set, it will use regular package summary logic.
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY)
+ set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY})
+ endif()
+ endif()
-# CPACK_RPM_PACKAGE_SUMMARY (mandatory)
-if(NOT CPACK_RPM_PACKAGE_SUMMARY)
- # if neither var is defined lets use the name as summary
- if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
- string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY)
+ if(NOT CPACK_RPM_PACKAGE_SUMMARY)
+ if(CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+ set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+ else()
+ # if neither var is defined lets use the name as summary
+ string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY)
+ endif()
+ endif()
+
+ # CPACK_RPM_PACKAGE_NAME (mandatory)
+
+ if(NOT CPACK_RPM_PACKAGE_NAME)
+ string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME)
+ endif()
+
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME)
+ set(CPACK_RPM_PACKAGE_NAME ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME})
+ else()
+ set(CPACK_RPM_PACKAGE_NAME ${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_COMPONENT})
+ endif()
+ endif()
+
+ # CPACK_RPM_PACKAGE_VERSION (mandatory)
+ if(NOT CPACK_RPM_PACKAGE_VERSION)
+ if(NOT CPACK_PACKAGE_VERSION)
+ message(FATAL_ERROR "RPM package requires a package version")
+ endif()
+ set(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
+ endif()
+ # Replace '-' in version with '_'
+ # '-' character is an Illegal RPM version character
+ # it is illegal because it is used to separate
+ # RPM "Version" from RPM "Release"
+ string(REPLACE "-" "_" CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION})
+
+ # CPACK_RPM_PACKAGE_ARCHITECTURE (mandatory)
+ if(NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
+ execute_process(COMMAND uname "-m"
+ OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
- set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}")
+ endif()
endif()
-endif()
-# CPACK_RPM_PACKAGE_NAME (mandatory)
-if(NOT CPACK_RPM_PACKAGE_NAME)
- string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME)
-endif()
+ set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_PACKAGE_ARCHITECTURE})
-# CPACK_RPM_PACKAGE_VERSION (mandatory)
-if(NOT CPACK_RPM_PACKAGE_VERSION)
- if(NOT CPACK_PACKAGE_VERSION)
- message(FATAL_ERROR "RPM package requires a package version")
+ #prefer component architecture
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE)
+ set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE})
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: using component build arch = ${_CPACK_RPM_PACKAGE_ARCHITECTURE}")
+ endif()
+ endif()
endif()
- set(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
-endif()
-# Replace '-' in version with '_'
-# '-' character is an Illegal RPM version character
-# it is illegal because it is used to separate
-# RPM "Version" from RPM "Release"
-string(REPLACE "-" "_" CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION})
-
-# CPACK_RPM_PACKAGE_ARCHITECTURE (optional)
-if(CPACK_RPM_PACKAGE_ARCHITECTURE)
- set(TMP_RPM_BUILDARCH "Buildarch: ${CPACK_RPM_PACKAGE_ARCHITECTURE}")
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}")
+ if(${_CPACK_RPM_PACKAGE_ARCHITECTURE} STREQUAL "noarch")
+ set(TMP_RPM_BUILDARCH "Buildarch: ${_CPACK_RPM_PACKAGE_ARCHITECTURE}")
+ else()
+ set(TMP_RPM_BUILDARCH "")
endif()
-else()
- set(TMP_RPM_BUILDARCH "")
-endif()
-# CPACK_RPM_PACKAGE_RELEASE
-# The RPM release is the numbering of the RPM package ITSELF
-# this is the version of the PACKAGING and NOT the version
-# of the CONTENT of the package.
-# You may well need to generate a new RPM package release
-# without changing the version of the packaged software.
-# This is the case when the packaging is buggy (not) the software :=)
-# If not set, 1 is a good candidate
-if(NOT CPACK_RPM_PACKAGE_RELEASE)
- set(CPACK_RPM_PACKAGE_RELEASE 1)
-endif()
+ # CPACK_RPM_PACKAGE_RELEASE
+ # The RPM release is the numbering of the RPM package ITSELF
+ # this is the version of the PACKAGING and NOT the version
+ # of the CONTENT of the package.
+ # You may well need to generate a new RPM package release
+ # without changing the version of the packaged software.
+ # This is the case when the packaging is buggy (not) the software :=)
+ # If not set, 1 is a good candidate
+ if(NOT CPACK_RPM_PACKAGE_RELEASE)
+ set(CPACK_RPM_PACKAGE_RELEASE 1)
+ endif()
-# CPACK_RPM_PACKAGE_LICENSE
-if(NOT CPACK_RPM_PACKAGE_LICENSE)
- set(CPACK_RPM_PACKAGE_LICENSE "unknown")
-endif()
+ # CPACK_RPM_PACKAGE_LICENSE
+ if(NOT CPACK_RPM_PACKAGE_LICENSE)
+ set(CPACK_RPM_PACKAGE_LICENSE "unknown")
+ endif()
-# CPACK_RPM_PACKAGE_GROUP
-if(NOT CPACK_RPM_PACKAGE_GROUP)
- set(CPACK_RPM_PACKAGE_GROUP "unknown")
-endif()
+ # CPACK_RPM_PACKAGE_GROUP
-# CPACK_RPM_PACKAGE_VENDOR
-if(NOT CPACK_RPM_PACKAGE_VENDOR)
- if(CPACK_PACKAGE_VENDOR)
- set(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}")
- else()
- set(CPACK_RPM_PACKAGE_VENDOR "unknown")
+ #Check for component group first.
+ #If not set, it will use regular package group logic.
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP)
+ set(CPACK_RPM_PACKAGE_GROUP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP})
+ endif()
endif()
-endif()
-# CPACK_RPM_PACKAGE_SOURCE
-# The name of the source tarball in case we generate a source RPM
-
-# CPACK_RPM_PACKAGE_DESCRIPTION
-# The variable content may be either
-# - explicitly given by the user or
-# - filled with the content of CPACK_PACKAGE_DESCRIPTION_FILE
-# if it is defined
-# - set to a default value
-#
-if (NOT CPACK_RPM_PACKAGE_DESCRIPTION)
- if (CPACK_PACKAGE_DESCRIPTION_FILE)
- file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION)
- else ()
- set(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available")
- endif ()
-endif ()
-
-# CPACK_RPM_COMPRESSION_TYPE
-#
-if (CPACK_RPM_COMPRESSION_TYPE)
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}")
- endif()
- if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")
- set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio")
- endif()
- if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")
- set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio")
- endif()
- if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")
- set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio")
- endif()
- if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")
- set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio")
- endif()
-else()
- set(CPACK_RPM_COMPRESSION_TYPE_TMP "")
-endif()
+ if(NOT CPACK_RPM_PACKAGE_GROUP)
+ set(CPACK_RPM_PACKAGE_GROUP "unknown")
+ endif()
-if(CPACK_PACKAGE_RELOCATABLE)
- set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE)
-endif()
-if(CPACK_RPM_PACKAGE_RELOCATABLE)
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: Trying to build a relocatable package")
+ # CPACK_RPM_PACKAGE_VENDOR
+ if(NOT CPACK_RPM_PACKAGE_VENDOR)
+ if(CPACK_PACKAGE_VENDOR)
+ set(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}")
+ else()
+ set(CPACK_RPM_PACKAGE_VENDOR "unknown")
+ endif()
+ endif()
+
+ # CPACK_RPM_PACKAGE_SOURCE
+ # The name of the source tarball in case we generate a source RPM
+
+ # CPACK_RPM_PACKAGE_DESCRIPTION
+ # The variable content may be either
+ # - explicitly given by the user or
+ # - filled with the content of CPACK_PACKAGE_DESCRIPTION_FILE
+ # if it is defined
+ # - set to a default value
+ #
+
+ #Check for a component description first.
+ #If not set, it will use regular package description logic.
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION)
+ set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION})
+ elseif(CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION)
+ set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION})
+ endif()
endif()
- if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON"))
- message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.")
+
+ if(NOT CPACK_RPM_PACKAGE_DESCRIPTION)
+ if(CPACK_PACKAGE_DESCRIPTION_FILE)
+ file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION)
+ else ()
+ set(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available")
+ endif ()
+ endif ()
+
+ # CPACK_RPM_COMPRESSION_TYPE
+ #
+ if (CPACK_RPM_COMPRESSION_TYPE)
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}")
+ endif()
+ if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")
+ set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio")
+ endif()
+ if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")
+ set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio")
+ endif()
+ if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")
+ set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio")
+ endif()
+ if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")
+ set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio")
+ endif()
else()
- set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX})
+ set(CPACK_RPM_COMPRESSION_TYPE_TMP "")
endif()
-endif()
-# Check if additional fields for RPM spec header are given
-# There may be some COMPONENT specific variables as well
-# If component specific var is not provided we use the global one
-# for each component
-foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV)
+ if(CPACK_PACKAGE_RELOCATABLE OR CPACK_RPM_PACKAGE_RELOCATABLE)
if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}")
+ message("CPackRPM:Debug: Trying to build a relocatable package")
endif()
- if(CPACK_RPM_PACKAGE_COMPONENT)
- if(DEFINED CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER})
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: using CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}")
- endif()
- set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}})
- else()
- if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
+ if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON"))
+ message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.")
+ set(CPACK_RPM_PACKAGE_RELOCATABLE FALSE)
+ else()
+ set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) # kept for back compatibility (provided external RPM spec files)
+ cpack_rpm_prepare_relocation_paths()
+ set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE)
+ endif()
+ endif()
+
+ # Check if additional fields for RPM spec header are given
+ # There may be some COMPONENT specific variables as well
+ # If component specific var is not provided we use the global one
+ # for each component
+ foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN)
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}")
+ endif()
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(DEFINED CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER})
if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER} not defined")
- message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}")
+ message("CPackRPM:Debug: using CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}")
+ endif()
+ set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}})
+ else()
+ if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER} not defined")
+ message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}")
+ endif()
+ set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}})
endif()
- set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}})
+ endif()
+ else()
+ if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}")
endif()
- endif()
- else()
- if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}")
+ set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}})
endif()
- set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}})
- endif()
+ endif()
+
+ # Treat the RPM Spec keyword iff it has been properly defined
+ if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP)
+ # Transform NAME --> Name e.g. PROVIDES --> Provides
+ # The Upper-case first letter and lowercase tail is the
+ # appropriate value required in the final RPM spec file.
+ string(SUBSTRING ${_RPM_SPEC_HEADER} 1 -1 _PACKAGE_HEADER_TAIL)
+ string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL)
+ string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME)
+ set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}")
+ # The following keywords require parentheses around the "pre" or "post" suffix in the final RPM spec file.
+ set(SCRIPTS_REQUIREMENTS_LIST REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN)
+ list(FIND SCRIPTS_REQUIREMENTS_LIST ${_RPM_SPEC_HEADER} IS_SCRIPTS_REQUIREMENT_FOUND)
+ if(NOT ${IS_SCRIPTS_REQUIREMENT_FOUND} EQUAL -1)
+ string(REPLACE "_" "(" _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}")
+ set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME})")
+ endif()
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}")
+ endif()
+ set(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}")
+ unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP)
endif()
+ endforeach()
- # Treat the RPM Spec keyword iff it has been properly defined
- if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP)
- # Transform NAME --> Name e.g. PROVIDES --> Provides
- # The Upper-case first letter and lowercase tail is the
- # appropriate value required in the final RPM spec file.
- string(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH)
- math(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1")
- string(SUBSTRING ${_RPM_SPEC_HEADER} 1 ${_PACKAGE_HEADER_STRLENGTH} _PACKAGE_HEADER_TAIL)
- string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL)
- string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME)
- set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}")
+ # CPACK_RPM_SPEC_INSTALL_POST
+ # May be used to define a RPM post intallation script
+ # for example setting it to "/bin/true" may prevent
+ # rpmbuild from stripping binaries.
+ if(CPACK_RPM_SPEC_INSTALL_POST)
if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}")
+ message("CPackRPM:Debug: User defined CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}")
endif()
- set(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}")
- else()
- # Do not forget to unset previously set header (from previous component)
- unset(TMP_RPM_${_RPM_SPEC_HEADER})
+ set(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}")
endif()
-endforeach()
-# CPACK_RPM_SPEC_INSTALL_POST
-# May be used to define a RPM post intallation script
-# for example setting it to "/bin/true" may prevent
-# rpmbuild from stripping binaries.
-if(CPACK_RPM_SPEC_INSTALL_POST)
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: User defined CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}")
- endif()
- set(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}")
-endif()
-
-# CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE)
-# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE)
-# May be used to embed a post (un)installation script in the spec file.
-# The refered script file(s) will be read and directly
-# put after the %post or %postun section
-if(CPACK_RPM_PACKAGE_COMPONENT)
- if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE)
- set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE})
+ # CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE)
+ # CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE)
+ # May be used to embed a post (un)installation script in the spec file.
+ # The refered script file(s) will be read and directly
+ # put after the %post or %postun section
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE)
+ set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE})
+ else()
+ set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE})
+ endif()
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE)
+ set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE})
+ else()
+ set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE})
+ endif()
else()
set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE})
- endif()
- if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE)
- set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE})
- else()
set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE})
endif()
-else()
- set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE})
- set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE})
-endif()
-# Handle post-install file if it has been specified
-if(CPACK_RPM_POST_INSTALL_READ_FILE)
- if(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE})
- file(READ ${CPACK_RPM_POST_INSTALL_READ_FILE} CPACK_RPM_SPEC_POSTINSTALL)
+ # Handle post-install file if it has been specified
+ if(CPACK_RPM_POST_INSTALL_READ_FILE)
+ if(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE})
+ file(READ ${CPACK_RPM_POST_INSTALL_READ_FILE} CPACK_RPM_SPEC_POSTINSTALL)
+ else()
+ message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_READ_FILE}> does not exists - ignoring")
+ endif()
else()
- message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_READ_FILE}> does not exists - ignoring")
+ # reset SPEC var value if no post install file has been specified
+ # (either globally or component-wise)
+ set(CPACK_RPM_SPEC_POSTINSTALL "")
endif()
-else()
- # reset SPEC var value if no post install file has been specified
- # (either globally or component-wise)
- set(CPACK_RPM_SPEC_POSTINSTALL "")
-endif()
-# Handle post-uninstall file if it has been specified
-if(CPACK_RPM_POST_UNINSTALL_READ_FILE)
- if(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE})
- file(READ ${CPACK_RPM_POST_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_POSTUNINSTALL)
+ # Handle post-uninstall file if it has been specified
+ if(CPACK_RPM_POST_UNINSTALL_READ_FILE)
+ if(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE})
+ file(READ ${CPACK_RPM_POST_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_POSTUNINSTALL)
+ else()
+ message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_READ_FILE}> does not exists - ignoring")
+ endif()
else()
- message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_READ_FILE}> does not exists - ignoring")
+ # reset SPEC var value if no post uninstall file has been specified
+ # (either globally or component-wise)
+ set(CPACK_RPM_SPEC_POSTUNINSTALL "")
endif()
-else()
- # reset SPEC var value if no post uninstall file has been specified
- # (either globally or component-wise)
- set(CPACK_RPM_SPEC_POSTUNINSTALL "")
-endif()
-# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE)
-# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE)
-# May be used to embed a pre (un)installation script in the spec file.
-# The refered script file(s) will be read and directly
-# put after the %pre or %preun section
-if(CPACK_RPM_PACKAGE_COMPONENT)
- if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE)
- set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE})
+ # CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE)
+ # CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE)
+ # May be used to embed a pre (un)installation script in the spec file.
+ # The refered script file(s) will be read and directly
+ # put after the %pre or %preun section
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE)
+ set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE})
+ else()
+ set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE})
+ endif()
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE)
+ set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE})
+ else()
+ set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE})
+ endif()
else()
set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE})
- endif()
- if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE)
- set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE})
- else()
set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE})
endif()
-else()
- set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE})
- set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE})
-endif()
-# Handle pre-install file if it has been specified
-if(CPACK_RPM_PRE_INSTALL_READ_FILE)
- if(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE})
- file(READ ${CPACK_RPM_PRE_INSTALL_READ_FILE} CPACK_RPM_SPEC_PREINSTALL)
+ # Handle pre-install file if it has been specified
+ if(CPACK_RPM_PRE_INSTALL_READ_FILE)
+ if(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE})
+ file(READ ${CPACK_RPM_PRE_INSTALL_READ_FILE} CPACK_RPM_SPEC_PREINSTALL)
+ else()
+ message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_READ_FILE}> does not exists - ignoring")
+ endif()
else()
- message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_READ_FILE}> does not exists - ignoring")
+ # reset SPEC var value if no pre-install file has been specified
+ # (either globally or component-wise)
+ set(CPACK_RPM_SPEC_PREINSTALL "")
endif()
-else()
- # reset SPEC var value if no pre-install file has been specified
- # (either globally or component-wise)
- set(CPACK_RPM_SPEC_PREINSTALL "")
-endif()
-# Handle pre-uninstall file if it has been specified
-if(CPACK_RPM_PRE_UNINSTALL_READ_FILE)
- if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE})
- file(READ ${CPACK_RPM_PRE_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_PREUNINSTALL)
+ # Handle pre-uninstall file if it has been specified
+ if(CPACK_RPM_PRE_UNINSTALL_READ_FILE)
+ if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE})
+ file(READ ${CPACK_RPM_PRE_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_PREUNINSTALL)
+ else()
+ message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_READ_FILE}> does not exists - ignoring")
+ endif()
else()
- message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_READ_FILE}> does not exists - ignoring")
+ # reset SPEC var value if no pre-uninstall file has been specified
+ # (either globally or component-wise)
+ set(CPACK_RPM_SPEC_PREUNINSTALL "")
endif()
-else()
- # reset SPEC var value if no pre-uninstall file has been specified
- # (either globally or component-wise)
- set(CPACK_RPM_SPEC_PREUNINSTALL "")
-endif()
-# CPACK_RPM_CHANGELOG_FILE
-# May be used to embed a changelog in the spec file.
-# The refered file will be read and directly put after the %changelog section
-if(CPACK_RPM_CHANGELOG_FILE)
- if(EXISTS ${CPACK_RPM_CHANGELOG_FILE})
- file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG)
+ # CPACK_RPM_CHANGELOG_FILE
+ # May be used to embed a changelog in the spec file.
+ # The refered file will be read and directly put after the %changelog section
+ if(CPACK_RPM_CHANGELOG_FILE)
+ if(EXISTS ${CPACK_RPM_CHANGELOG_FILE})
+ file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG)
+ else()
+ message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring")
+ endif()
else()
- message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring")
+ set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Eric Noulard <eric.noulard@gmail.com> - ${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}\n Generated by CPack RPM (no Changelog file were provided)")
endif()
-else()
- set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Eric Noulard <eric.noulard@gmail.com> - ${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}\n Generated by CPack RPM (no Changelog file were provided)")
-endif()
-# CPACK_RPM_SPEC_MORE_DEFINE
-# This is a generated spec rpm file spaceholder
-if(CPACK_RPM_SPEC_MORE_DEFINE)
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: User defined more define spec line specified:\n ${CPACK_RPM_SPEC_MORE_DEFINE}")
+ # CPACK_RPM_SPEC_MORE_DEFINE
+ # This is a generated spec rpm file spaceholder
+ if(CPACK_RPM_SPEC_MORE_DEFINE)
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: User defined more define spec line specified:\n ${CPACK_RPM_SPEC_MORE_DEFINE}")
+ endif()
endif()
-endif()
-# Now we may create the RPM build tree structure
-set(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}")
-message(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}")
-# Prepare RPM build tree
-file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR})
-file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp)
-file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/BUILD)
-file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/RPMS)
-file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SOURCES)
-file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS)
-file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS)
-
-#set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm")
-set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}")
-# it seems rpmbuild can't handle spaces in the path
-# neither escaping (as below) nor putting quotes around the path seem to help
-#string(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
-set(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
-
-# if we are creating a relocatable package, omit parent directories of
-# CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list"
-# which is passed to the find command that generates the content-list
-if(CPACK_RPM_PACKAGE_RELOCATABLE)
- # get a list of the elements in CPACK_RPM_PACKAGE_PREFIX and remove
- # the final element (so the install-prefix dir itself is not omitted
- # from the RPM's content-list)
- string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${CPACK_RPM_PACKAGE_PREFIX}")
- list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
- # Now generate all of the parent dirs of CPACK_RPM_PACKAGE_PREFIX
- foreach(_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
- list(APPEND _TMP_LIST "${_ELEM}")
- string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}")
- set(_OMIT_DIR "-o -path ${_OMIT_DIR}")
- separate_arguments(_OMIT_DIR)
- list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR})
- endforeach()
-endif()
-
-if (CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: Initial list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}")
-endif()
-
-if (NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST)
- set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include)
- if (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION)
- message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.")
- list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}")
+ # Now we may create the RPM build tree structure
+ set(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}")
+ message(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}")
+ # Prepare RPM build tree
+ file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR})
+ file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp)
+ file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/BUILD)
+ file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/RPMS)
+ file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SOURCES)
+ file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS)
+ file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS)
+
+ #set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${_CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm")
+ set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}")
+ # it seems rpmbuild can't handle spaces in the path
+ # neither escaping (as below) nor putting quotes around the path seem to help
+ #string(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
+ set(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
+
+ cpack_rpm_prepare_content_list()
+
+ # In component case, put CPACK_ABSOLUTE_DESTINATION_FILES_<COMPONENT>
+ # into CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL
+ # otherwise, put CPACK_ABSOLUTE_DESTINATION_FILES
+ # This must be done BEFORE the CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL handling
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(CPACK_ABSOLUTE_DESTINATION_FILES)
+ set(COMPONENT_FILES_TAG "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT}")
+ set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${${COMPONENT_FILES_TAG}}")
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: Handling Absolute Destination Files: <${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}>")
+ message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}")
+ endif()
+ endif()
+ else()
+ if(CPACK_ABSOLUTE_DESTINATION_FILES)
+ set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${CPACK_ABSOLUTE_DESTINATION_FILES}")
+ endif()
endif()
-endif()
-if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST)
- if (CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST= ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}")
- endif()
- foreach(_DIR ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST})
- list(APPEND _RPM_DIRS_TO_OMIT "-o;-path;.${_DIR}")
- endforeach()
-endif()
-if (CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: Final list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}")
-endif()
-
-# Use files tree to construct files command (spec file)
-# We should not forget to include symlinks (thus -o -type l)
-# We should include directory as well (thus -type d)
-# but not the main local dir "." (thus -a -not -name ".")
-# We must remove the './' due to the local search and escape the
-# file name by enclosing it between double quotes (thus the sed)
-# Then we must authorize any man pages extension (adding * at the end)
-# because rpmbuild may automatically compress those files
-execute_process(COMMAND find . -type f -o -type l -o (-type d -a -not ( -name "." ${_RPM_DIRS_TO_OMIT} ) )
- COMMAND sed s:.*/man.*/.*:&*:
- COMMAND sed s/\\.\\\(.*\\\)/\"\\1\"/
- WORKING_DIRECTORY "${WDIR}"
- OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES)
-
-# In component case, put CPACK_ABSOLUTE_DESTINATION_FILES_<COMPONENT>
-# into CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL
-# otherwise, put CPACK_ABSOLUTE_DESTINATION_FILES
-# This must be done BEFORE the CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL handling
-if(CPACK_RPM_PACKAGE_COMPONENT)
- if(CPACK_ABSOLUTE_DESTINATION_FILES)
- set(COMPONENT_FILES_TAG "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT}")
- set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${${COMPONENT_FILES_TAG}}")
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: Handling Absolute Destination Files: <${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}>")
- message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}")
- endif()
- endif()
-else()
- if(CPACK_ABSOLUTE_DESTINATION_FILES)
- set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${CPACK_ABSOLUTE_DESTINATION_FILES}")
+ # In component case, set CPACK_RPM_USER_FILELIST_INTERNAL with CPACK_RPM_<COMPONENT>_USER_FILELIST.
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST)
+ set(CPACK_RPM_USER_FILELIST_INTERNAL ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST})
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>")
+ message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}")
+ endif()
+ else()
+ set(CPACK_RPM_USER_FILELIST_INTERNAL "")
+ endif()
+ else()
+ if(CPACK_RPM_USER_FILELIST)
+ set(CPACK_RPM_USER_FILELIST_INTERNAL "${CPACK_RPM_USER_FILELIST}")
+ else()
+ set(CPACK_RPM_USER_FILELIST_INTERNAL "")
+ endif()
endif()
-endif()
-# In component case, set CPACK_RPM_USER_FILELIST_INTERNAL with CPACK_RPM_<COMPONENT>_USER_FILELIST.
-if(CPACK_RPM_PACKAGE_COMPONENT)
- if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST)
- set(CPACK_RPM_USER_FILELIST_INTERNAL ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST})
+ # Handle user specified file line list in CPACK_RPM_USER_FILELIST_INTERNAL
+ # Remove those files from CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL
+ # or CPACK_RPM_INSTALL_FILES,
+ # hence it must be done before these auto-generated lists are processed.
+ if(CPACK_RPM_USER_FILELIST_INTERNAL)
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>")
- message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}")
endif()
- else()
- set(CPACK_RPM_USER_FILELIST_INTERNAL "")
- endif()
-else()
- if(CPACK_RPM_USER_FILELIST)
- set(CPACK_RPM_USER_FILELIST_INTERNAL "${CPACK_RPM_USER_FILELIST}")
- else()
- set(CPACK_RPM_USER_FILELIST_INTERNAL "")
- endif()
-endif()
-# Handle user specified file line list in CPACK_RPM_USER_FILELIST_INTERNAL
-# Remove those files from CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL
-# or CPACK_RPM_INSTALL_FILES,
-# hence it must be done before these auto-generated lists are processed.
-if(CPACK_RPM_USER_FILELIST_INTERNAL)
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>")
+ # Create CMake list from CPACK_RPM_INSTALL_FILES
+ string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST)
+ string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST
+ "${CPACK_RPM_INSTALL_FILES_LIST}")
+ string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST
+ "${CPACK_RPM_INSTALL_FILES_LIST}")
+
+ set(CPACK_RPM_USER_INSTALL_FILES "")
+ foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL)
+ string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F})
+ string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F})
+
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>")
+ endif()
+ if(F_PREFIX)
+ set(F_PREFIX "${F_PREFIX} ")
+ endif()
+ # Rebuild the user list file
+ set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n")
+
+ # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL
+ list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH})
+ # ABSOLUTE destination files list may not exists at all
+ if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
+ list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH})
+ endif()
+
+ endforeach()
+
+ # Rebuild CPACK_RPM_INSTALL_FILES
+ set(CPACK_RPM_INSTALL_FILES "")
+ foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST)
+ set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n")
+ endforeach()
+ else()
+ set(CPACK_RPM_USER_INSTALL_FILES "")
endif()
- # Create CMake list from CPACK_RPM_INSTALL_FILES
- string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST)
- string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST
- "${CPACK_RPM_INSTALL_FILES_LIST}")
- string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST
- "${CPACK_RPM_INSTALL_FILES_LIST}")
-
- set(CPACK_RPM_USER_INSTALL_FILES "")
- foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL)
- string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F})
- string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F})
-
+ if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>")
- endif()
- if(F_PREFIX)
- set(F_PREFIX "${F_PREFIX} ")
+ message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}")
endif()
- # Rebuild the user list file
- set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n")
-
- # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL
- list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH})
- # ABSOLUTE destination files list may not exists at all
- if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
- list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH})
+ # Remove trailing space
+ string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST)
+ # Transform endline separated - string into CMake List
+ string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}")
+ # Remove unecessary quotes
+ string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}")
+ # Remove ABSOLUTE install file from INSTALL FILE LIST
+ list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL})
+ # Rebuild INSTALL_FILES
+ set(CPACK_RPM_INSTALL_FILES "")
+ foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST)
+ set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n")
+ endforeach()
+ # Build ABSOLUTE_INSTALL_FILES
+ set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "")
+ foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
+ set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "${CPACK_RPM_ABSOLUTE_INSTALL_FILES}%config \"${F}\"\n")
+ endforeach()
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}")
+ message("CPackRPM:Debug: CPACK_RPM_INSTALL_FILES=${CPACK_RPM_INSTALL_FILES}")
endif()
+ else()
+ # reset vars in order to avoid leakage of value(s) from one component to another
+ set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "")
+ endif()
- endforeach()
+ # Prepare install files
+ cpack_rpm_prepare_install_files(
+ "${CPACK_RPM_INSTALL_FILES}"
+ "${WDIR}"
+ "${RPM_USED_PACKAGE_PREFIXES}"
+ "${CPACK_RPM_PACKAGE_RELOCATABLE}"
+ )
- # Rebuild CPACK_RPM_INSTALL_FILES
- set(CPACK_RPM_INSTALL_FILES "")
- foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST)
- set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n")
- endforeach()
-else()
- set(CPACK_RPM_USER_INSTALL_FILES "")
-endif()
+ # The name of the final spec file to be used by rpmbuild
+ set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec")
-if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
+ # Print out some debug information if we were asked for that
if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}")
- endif()
- # Remove trailing space
- string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST)
- # Transform endline separated - string into CMake List
- string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}")
- # Remove unecessary quotes
- string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}")
- # Remove ABSOLUTE install file from INSTALL FILE LIST
- list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL})
- # Rebuild INSTALL_FILES
- set(CPACK_RPM_INSTALL_FILES "")
- foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST)
- set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n")
- endforeach()
- # Build ABSOLUTE_INSTALL_FILES
- set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "")
- foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
- set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "${CPACK_RPM_ABSOLUTE_INSTALL_FILES}%config \"${F}\"\n")
- endforeach()
- if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}")
- message("CPackRPM:Debug: CPACK_RPM_INSTALL_FILES=${CPACK_RPM_INSTALL_FILES}")
+ message("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
+ message("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
+ message("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
+ message("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
+ message("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
+ message("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
+ message("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}")
+ message("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+ message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
endif()
-else()
- # reset vars in order to avoid leakage of value(s) from one component to another
- set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "")
-endif()
-# Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir
-# This is necessary to avoid duplicate files since rpmbuild do
-# recursion on its own when encountering a pathname which is a directory
-# which is not flagged as %dir
-string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST)
-string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST
- "${CPACK_RPM_INSTALL_FILES_LIST}")
-string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST
- "${CPACK_RPM_INSTALL_FILES_LIST}")
-set(CPACK_RPM_INSTALL_FILES "")
-foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST)
- if(IS_DIRECTORY "${WDIR}/${F}")
- set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}%dir \"${F}\"\n")
- else()
- set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n")
- endif()
-endforeach()
-set(CPACK_RPM_INSTALL_FILES_LIST "")
-
-# The name of the final spec file to be used by rpmbuild
-set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec")
-
-# Print out some debug information if we were asked for that
-if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
- message("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
- message("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
- message("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
- message("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
- message("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
- message("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}")
- message("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
- message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
-endif()
+ #
+ # USER generated/provided spec file handling.
+ #
-# protect @ in pathname in order to avoid their
-# interpretation during the configure_file step
-set(CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES}")
-set(PROTECTED_AT "@")
-string(REPLACE "@" "\@PROTECTED_AT\@" CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES_LIST}")
-set(CPACK_RPM_INSTALL_FILES_LIST "")
-
-#
-# USER generated/provided spec file handling.
-#
-
-# We can have a component specific spec file.
-if(CPACK_RPM_PACKAGE_COMPONENT AND CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE)
- set(CPACK_RPM_USER_BINARY_SPECFILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE})
-endif()
+ # We can have a component specific spec file.
+ if(CPACK_RPM_PACKAGE_COMPONENT AND CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE)
+ set(CPACK_RPM_USER_BINARY_SPECFILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE})
+ endif()
-# We should generate a USER spec file template:
-# - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
-# - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE
-if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
- file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
+ # We should generate a USER spec file template:
+ # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
+ # - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE
+ if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
+ file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
"# -*- rpm-spec -*-
BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@
Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@
-Name: \@CPACK_RPM_PACKAGE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_NAME\@
+Name: \@CPACK_RPM_PACKAGE_NAME\@
Version: \@CPACK_RPM_PACKAGE_VERSION\@
Release: \@CPACK_RPM_PACKAGE_RELEASE\@
License: \@CPACK_RPM_PACKAGE_LICENSE\@
@@ -908,6 +1670,10 @@ Group: \@CPACK_RPM_PACKAGE_GROUP\@
Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@TMP_RPM_URL\@
\@TMP_RPM_REQUIRES\@
+\@TMP_RPM_REQUIRES_PRE\@
+\@TMP_RPM_REQUIRES_POST\@
+\@TMP_RPM_REQUIRES_PREUN\@
+\@TMP_RPM_REQUIRES_POSTUN\@
\@TMP_RPM_PROVIDES\@
\@TMP_RPM_OBSOLETES\@
\@TMP_RPM_CONFLICTS\@
@@ -915,7 +1681,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@TMP_RPM_AUTOREQ\@
\@TMP_RPM_AUTOREQPROV\@
\@TMP_RPM_BUILDARCH\@
-\@TMP_RPM_PREFIX\@
+\@TMP_RPM_PREFIXES\@
%define _rpmdir \@CPACK_RPM_DIRECTORY\@
%define _rpmfilename \@CPACK_RPM_FILE_NAME\@
@@ -947,6 +1713,7 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
%clean
%post
+\@RPM_SYMLINK_POSTINSTALL\@
\@CPACK_RPM_SPEC_POSTINSTALL\@
%postun
@@ -967,53 +1734,54 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
%changelog
\@CPACK_RPM_SPEC_CHANGELOG\@
")
- # Stop here if we were asked to only generate a template USER spec file
- # The generated file may then be used as a template by user who wants
- # to customize their own spec file.
- if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
- message(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in")
+ # Stop here if we were asked to only generate a template USER spec file
+ # The generated file may then be used as a template by user who wants
+ # to customize their own spec file.
+ if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
+ message(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in")
+ endif()
endif()
-endif()
-# After that we may either use a user provided spec file
-# or generate one using appropriate variables value.
-if(CPACK_RPM_USER_BINARY_SPECFILE)
- # User may have specified SPECFILE just use it
- message("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}")
- # The user provided file is processed for @var replacement
- configure_file(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
-else()
- # No User specified spec file, will use the generated spec file
- message("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}")
- # Note the just created file is processed for @var replacement
- configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
-endif()
+ # After that we may either use a user provided spec file
+ # or generate one using appropriate variables value.
+ if(CPACK_RPM_USER_BINARY_SPECFILE)
+ # User may have specified SPECFILE just use it
+ message("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}")
+ # The user provided file is processed for @var replacement
+ configure_file(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
+ else()
+ # No User specified spec file, will use the generated spec file
+ message("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}")
+ # Note the just created file is processed for @var replacement
+ configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
+ endif()
-# remove AT protection
-unset(PROTECTED_AT)
-
-if(RPMBUILD_EXECUTABLE)
- # Now call rpmbuild using the SPECFILE
- execute_process(
- COMMAND "${RPMBUILD_EXECUTABLE}" -bb
- --define "_topdir ${CPACK_RPM_DIRECTORY}"
- --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
- "${CPACK_RPM_BINARY_SPECFILE}"
- WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
- RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT
- ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err"
- OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out")
- if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT)
- file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err RPMBUILDERR)
- file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out RPMBUILDOUT)
- message("CPackRPM:Debug: You may consult rpmbuild logs in: ")
- message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err")
- message("CPackRPM:Debug: *** ${RPMBUILDERR} ***")
- message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out")
- message("CPackRPM:Debug: *** ${RPMBUILDERR} ***")
- endif()
-else()
- if(ALIEN_EXECUTABLE)
- message(FATAL_ERROR "RPM packaging through alien not done (yet)")
+ if(RPMBUILD_EXECUTABLE)
+ # Now call rpmbuild using the SPECFILE
+ execute_process(
+ COMMAND "${RPMBUILD_EXECUTABLE}" -bb
+ --define "_topdir ${CPACK_RPM_DIRECTORY}"
+ --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
+ --target "${_CPACK_RPM_PACKAGE_ARCHITECTURE}"
+ "${CPACK_RPM_BINARY_SPECFILE}"
+ WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
+ RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT
+ ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err"
+ OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
+ if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT)
+ file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err RPMBUILDERR)
+ file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out RPMBUILDOUT)
+ message("CPackRPM:Debug: You may consult rpmbuild logs in: ")
+ message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err")
+ message("CPackRPM:Debug: *** ${RPMBUILDERR} ***")
+ message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
+ message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***")
+ endif()
+ else()
+ if(ALIEN_EXECUTABLE)
+ message(FATAL_ERROR "RPM packaging through alien not done (yet)")
+ endif()
endif()
-endif()
+endfunction()
+
+cpack_rpm_generate_package()
diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake
index fce25f07a..499400515 100644
--- a/Modules/CPackWIX.cmake
+++ b/Modules/CPackWIX.cmake
@@ -1,110 +1,245 @@
-##section Variables specific to CPack WiX generator
-##end
-##module
-# - CPack WiX generator specific options
-#
-# The following variables are specific to the installers built
-# on Windows using WiX.
-##end
-##variable
-# CPACK_WIX_UPGRADE_GUID - Upgrade GUID (Product/@UpgradeCode)
-#
-# Will be automatically generated unless explicitly provided.
-#
-# It should be explicitly set to a constant generated
-# gloabally unique identifier (GUID) to allow your installers
-# to replace existing installations that use the same GUID.
-#
-# You may for example explicitly set this variable in
-# your CMakeLists.txt to the value that has been generated per default.
-# You should not use GUIDs that you did not generate yourself or which may
-# belong to other projects.
-#
-# A GUID shall have the following fixed length syntax:
-# XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+#.rst:
+# CPackWIX
+# --------
+#
+# CPack WiX generator specific options
+#
+# Variables specific to CPack WiX generator
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# The following variables are specific to the installers built on
+# Windows using WiX.
+#
+# .. variable:: CPACK_WIX_UPGRADE_GUID
+#
+# Upgrade GUID (``Product/@UpgradeCode``)
+#
+# Will be automatically generated unless explicitly provided.
+#
+# It should be explicitly set to a constant generated globally unique
+# identifier (GUID) to allow your installers to replace existing
+# installations that use the same GUID.
+#
+# You may for example explicitly set this variable in your
+# CMakeLists.txt to the value that has been generated per default. You
+# should not use GUIDs that you did not generate yourself or which may
+# belong to other projects.
+#
+# A GUID shall have the following fixed length syntax::
+#
+# XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+#
# (each X represents an uppercase hexadecimal digit)
-##end
-##variable
-# CPACK_WIX_PRODUCT_GUID - Product GUID (Product/@Id)
#
-# Will be automatically generated unless explicitly provided.
+# .. variable:: CPACK_WIX_PRODUCT_GUID
+#
+# Product GUID (``Product/@Id``)
+#
+# Will be automatically generated unless explicitly provided.
+#
+# If explicitly provided this will set the Product Id of your installer.
+#
+# The installer will abort if it detects a pre-existing installation that
+# uses the same GUID.
+#
+# The GUID shall use the syntax described for CPACK_WIX_UPGRADE_GUID.
+#
+# .. variable:: CPACK_WIX_LICENSE_RTF
+#
+# RTF License File
+#
+# If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension it is used as-is.
+#
+# If CPACK_RESOURCE_FILE_LICENSE has an .txt extension it is implicitly
+# converted to RTF by the WiX Generator.
+# The expected encoding of the .txt file is UTF-8.
+#
+# With CPACK_WIX_LICENSE_RTF you can override the license file used by the
+# WiX Generator in case CPACK_RESOURCE_FILE_LICENSE is in an unsupported
+# format or the .txt -> .rtf conversion does not work as expected.
+#
+# .. variable:: CPACK_WIX_PRODUCT_ICON
+#
+# The Icon shown next to the program name in Add/Remove programs.
+#
+# If set, this icon is used in place of the default icon.
+#
+# .. variable:: CPACK_WIX_UI_REF
+#
+# This variable allows you to override the Id of the ``<UIRef>`` element
+# in the WiX template.
+#
+# The default is ``WixUI_InstallDir`` in case no CPack components have
+# been defined and ``WixUI_FeatureTree`` otherwise.
+#
+# .. variable:: CPACK_WIX_UI_BANNER
+#
+# The bitmap will appear at the top of all installer pages other than the
+# welcome and completion dialogs.
+#
+# If set, this image will replace the default banner image.
+#
+# This image must be 493 by 58 pixels.
+#
+# .. variable:: CPACK_WIX_UI_DIALOG
+#
+# Background bitmap used on the welcome and completion dialogs.
+#
+# If this variable is set, the installer will replace the default dialog
+# image.
+#
+# This image must be 493 by 312 pixels.
+#
+# .. variable:: CPACK_WIX_PROGRAM_MENU_FOLDER
+#
+# Start menu folder name for launcher.
+#
+# If this variable is not set, it will be initialized with CPACK_PACKAGE_NAME
+#
+# .. variable:: CPACK_WIX_CULTURES
+#
+# Language(s) of the installer
+#
+# Languages are compiled into the WixUI extension library. To use them,
+# simply provide the name of the culture. If you specify more than one
+# culture identifier in a comma or semicolon delimited list, the first one
+# that is found will be used. You can find a list of supported languages at:
+# http://wix.sourceforge.net/manual-wix3/WixUI_localization.htm
+#
+# .. variable:: CPACK_WIX_TEMPLATE
+#
+# Template file for WiX generation
+#
+# If this variable is set, the specified template will be used to generate
+# the WiX wxs file. This should be used if further customization of the
+# output is required.
+#
+# If this variable is not set, the default MSI template included with CMake
+# will be used.
+#
+# .. variable:: CPACK_WIX_PATCH_FILE
+#
+# Optional list of XML files with fragments to be inserted into
+# generated WiX sources
+#
+# This optional variable can be used to specify an XML file that the
+# WiX generator will use to inject fragments into its generated
+# source files.
+#
+# Patch files understood by the CPack WiX generator
+# roughly follow this RELAX NG compact schema:
+#
+# .. code-block:: none
+#
+# start = CPackWiXPatch
+#
+# CPackWiXPatch = element CPackWiXPatch { CPackWiXFragment* }
+#
+# CPackWiXFragment = element CPackWiXFragment
+# {
+# attribute Id { string },
+# fragmentContent*
+# }
+#
+# fragmentContent = element * - CPackWiXFragment
+# {
+# (attribute * { text } | text | fragmentContent)*
+# }
+#
+# Currently fragments can be injected into most
+# Component, File and Directory elements.
+#
+# The following additional special Ids can be used:
+#
+# * ``#PRODUCT`` for the ``<Product>`` element.
+# * ``#PRODUCTFEATURE`` for the root ``<Feature>`` element.
+#
+# The following example illustrates how this works.
+#
+# Given that the WiX generator creates the following XML element:
#
-# If explicitly provided this will set the Product Id of your installer.
+# .. code-block:: xml
#
-# The installer will abort if it detects a pre-existing installation that uses
-# the same GUID.
+# <Component Id="CM_CP_applications.bin.my_libapp.exe" Guid="*"/>
#
-# The GUID shall use the syntax described for CPACK_WIX_UPGRADE_GUID.
-##end
-##variable
-# CPACK_WIX_LICENSE_RTF - RTF License File
+# The following XML patch file may be used to inject an Environment element
+# into it:
#
-# If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension
-# it is used as-is.
+# .. code-block:: xml
#
-# If CPACK_RESOURCE_FILE_LICENSE has an .txt extension
-# it is implicitly converted to RTF by the WiX Generator.
+# <CPackWiXPatch>
+# <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe">
+# <Environment Id="MyEnvironment" Action="set"
+# Name="MyVariableName" Value="MyVariableValue"/>
+# </CPackWiXFragment>
+# </CPackWiXPatch>
#
-# With CPACK_WIX_LICENSE_RTF you can override the license file used
-# by the WiX Generator in case CPACK_RESOURCE_FILE_LICENSE
-# is in an unsupported format or the .txt -> .rtf
-# conversion does not work as expected.
+# .. variable:: CPACK_WIX_EXTRA_SOURCES
#
-##end
+# Extra WiX source files
#
-##variable
-# CPACK_WIX_PRODUCT_ICON - The Icon shown next to the program name in Add/Remove programs.
+# This variable provides an optional list of extra WiX source files (.wxs)
+# that should be compiled and linked. The full path to source files is
+# required.
#
-# If set, this icon is used in place of the default icon.
+# .. variable:: CPACK_WIX_EXTRA_OBJECTS
#
-##end
+# Extra WiX object files or libraries
#
-##variable
-# CPACK_WIX_UI_BANNER - The bitmap will appear at the top of all installer pages other than the welcome and completion dialogs.
+# This variable provides an optional list of extra WiX object (.wixobj)
+# and/or WiX library (.wixlib) files. The full path to objects and libraries
+# is required.
#
-# If set, this image will replace the default banner image.
+# .. variable:: CPACK_WIX_EXTENSIONS
#
-# This image must be 493 by 58 pixels.
+# This variable provides a list of additional extensions for the WiX
+# tools light and candle.
#
-##end
+# .. variable:: CPACK_WIX_<TOOL>_EXTENSIONS
#
-##variable
-# CPACK_WIX_UI_DIALOG - Background bitmap used on the welcome and completion dialogs.
+# This is the tool specific version of CPACK_WIX_EXTENSIONS.
+# ``<TOOL>`` can be either LIGHT or CANDLE.
#
-# If this variable is set, the installer will replace the default dialog image.
+# .. variable:: CPACK_WIX_<TOOL>_EXTRA_FLAGS
#
-# This image must be 493 by 312 pixels.
+# This list variable allows you to pass additional
+# flags to the WiX tool ``<TOOL>``.
#
-##end
+# Use it at your own risk.
+# Future versions of CPack may generate flags which may be in conflict
+# with your own flags.
#
-##variable
-# CPACK_WIX_PROGRAM_MENU_FOLDER - Start menu folder name for launcher.
+# ``<TOOL>`` can be either LIGHT or CANDLE.
#
-# If this variable is not set, it will be initialized with CPACK_PACKAGE_NAME
+# .. variable:: CPACK_WIX_CMAKE_PACKAGE_REGISTRY
#
-##end
-##variable
-# CPACK_WIX_CULTURES - Language(s) of the installer
+# If this variable is set the generated installer will create
+# an entry in the windows registry key
+# ``HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<package>``
+# The value for ``<package>`` is provided by this variable.
#
-# Languages are compiled into the WixUI extension library. To use them,
-# simply provide the name of the culture. If you specify more than one
-# culture identifier in a comma or semicolon delimited list, the first one
-# that is found will be used. You can find a list of supported languages at:
-# http://wix.sourceforge.net/manual-wix3/WixUI_localization.htm
+# Assuming you also install a CMake configuration file this will
+# allow other CMake projects to find your package with
+# the :command:`find_package` command.
#
-##end
-##variable
-# CPACK_WIX_TEMPLATE - Template file for WiX generation
+# .. variable:: CPACK_WIX_PROPERTY_<PROPERTY>
#
-# If this variable is set, the specified template will be used to generate the WiX wxs file.
-# This should be used if further customization of the output is required.
+# This variable can be used to provide a value for
+# the Windows Installer property ``<PROPERTY>``
#
-# If this variable is not set, the default MSI template included with CMake will be used.
+# The following list contains some example properties that can be used to
+# customize information under
+# "Programs and Features" (also known as "Add or Remove Programs")
#
-##end
+# * ARPCOMMENTS - Comments
+# * ARPHELPLINK - Help and support information URL
+# * ARPURLINFOABOUT - General information URL
+# * URLUPDATEINFO - Update information URL
+# * ARPHELPTELEPHONE - Help and support telephone number
+# * ARPSIZE - Size (in kilobytes) of the application
#=============================================================================
-# Copyright 2012 Kitware, Inc.
+# Copyright 2014-2015 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
index 5cd62f607..8278c5c4b 100644
--- a/Modules/CTest.cmake
+++ b/Modules/CTest.cmake
@@ -1,49 +1,52 @@
-# - Configure a project for testing with CTest/CDash
-# Include this module in the top CMakeLists.txt file of a project to
-# enable testing with CTest and dashboard submissions to CDash:
-# project(MyProject)
-# ...
-# include(CTest)
-# The module automatically creates a BUILD_TESTING option that selects
-# whether to enable testing support (ON by default). After including
-# the module, use code like
-# if(BUILD_TESTING)
-# # ... CMake code to create tests ...
-# endif()
-# 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)
-# (the CDash server can provide the file to a project administrator
-# who configures 'MyProject').
-# Settings in the config file are shared by both this CTest module and
-# the CTest command-line tool's dashboard script mode (ctest -S).
-#
-# While building a project for submission to CDash, CTest scans the
-# build output for errors and warnings and reports them with
-# surrounding context from the build log. This generic approach works
-# for all build tools, but does not give details about the command
-# invocation that produced a given problem. One may get more detailed
-# reports by adding
-# set(CTEST_USE_LAUNCHERS 1)
-# to the CTestConfig.cmake file. When this option is enabled, the
-# CTest module tells CMake's Makefile generators to invoke every
-# command in the generated build system through a CTest launcher
-# program. (Currently the CTEST_USE_LAUNCHERS option is ignored on
-# non-Makefile generators.) During a manual build each launcher
-# transparently runs the command it wraps. During a CTest-driven
-# build for submission to CDash each launcher reports detailed
-# information when its command fails or warns.
-# (Setting CTEST_USE_LAUNCHERS in CTestConfig.cmake is convenient, but
-# also adds the launcher overhead even for manual builds. One may
-# instead set it in a CTest dashboard script and add it to the CMake
-# cache for the build tree.)
+#[=======================================================================[.rst:
+CTest
+-----
+
+Configure a project for testing with CTest/CDash
+
+Include this module in the top CMakeLists.txt file of a project to
+enable testing with CTest and dashboard submissions to CDash::
+
+ project(MyProject)
+ ...
+ include(CTest)
+
+The module automatically creates a ``BUILD_TESTING`` option that selects
+whether to enable testing support (``ON`` by default). After including
+the module, use code like::
+
+ if(BUILD_TESTING)
+ # ... CMake code to create tests ...
+ endif()
+
+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)
+
+(the CDash server can provide the file to a project administrator who
+configures ``MyProject``). Settings in the config file are shared by
+both this ``CTest`` module and the :manual:`ctest(1)` command-line
+:ref:`Dashboard Client` mode (``ctest -S``).
+
+While building a project for submission to CDash, CTest scans the
+build output for errors and warnings and reports them with surrounding
+context from the build log. This generic approach works for all build
+tools, but does not give details about the command invocation that
+produced a given problem. One may get more detailed reports by setting
+the :variable:`CTEST_USE_LAUNCHERS` variable::
+
+ set(CTEST_USE_LAUNCHERS 1)
+
+in the ``CTestConfig.cmake`` file.
+#]=======================================================================]
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
@@ -130,6 +133,7 @@ if(BUILD_TESTING)
find_program(BZRCOMMAND bzr)
find_program(HGCOMMAND hg)
find_program(GITCOMMAND git)
+ find_program(P4COMMAND p4)
if(NOT UPDATE_TYPE)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS")
@@ -161,6 +165,9 @@ if(BUILD_TESTING)
elseif("${_update_type}" STREQUAL "git")
set(UPDATE_COMMAND "${GITCOMMAND}")
set(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}")
+ elseif("${_update_type}" STREQUAL "p4")
+ set(UPDATE_COMMAND "${P4COMMAND}")
+ set(UPDATE_OPTIONS "${P4_UPDATE_OPTIONS}")
endif()
set(DART_TESTING_TIMEOUT 1500 CACHE STRING
@@ -221,7 +228,7 @@ if(BUILD_TESTING)
"${CMAKE_CXX_COMPILER}" ${DART_NAME_COMPONENT})
else()
get_filename_component(DART_CXX_NAME
- "${CMAKE_BUILD_TOOL}" ${DART_NAME_COMPONENT})
+ "${CMAKE_MAKE_PROGRAM}" ${DART_NAME_COMPONENT})
endif()
if(DART_CXX_NAME MATCHES "msdev")
set(DART_CXX_NAME "vs60")
@@ -256,6 +263,7 @@ if(BUILD_TESTING)
CVS_UPDATE_OPTIONS
DART_TESTING_TIMEOUT
GITCOMMAND
+ P4COMMAND
HGCOMMAND
MAKECOMMAND
MEMORYCHECK_COMMAND
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
new file mode 100644
index 000000000..ef3aa7639
--- /dev/null
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -0,0 +1,204 @@
+#.rst:
+# CTestCoverageCollectGCOV
+# ------------------------
+#
+# This module provides the function ``ctest_coverage_collect_gcov``.
+# The function will run gcov on the .gcda files in a binary tree and then
+# package all of the .gcov files into a tar file with a data.json that
+# contains the source and build directories for CDash to use in parsing
+# the coverage data. In addtion the Labels.json files for targets that
+# have coverage information are also put in the tar file for CDash to
+# asign the correct labels. This file can be sent to a CDash server 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``.
+#
+# ``QUIET``
+# Suppress non-error messages that otherwise would have been
+# printed out by this function.
+
+#=============================================================================
+# Copyright 2014-2015 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+include(CMakeParseArguments)
+function(ctest_coverage_collect_gcov)
+ set(options QUIET)
+ set(oneValueArgs TARBALL SOURCE BUILD GCOV_COMMAND)
+ set(multiValueArgs GCOV_OPTIONS)
+ cmake_parse_arguments(GCOV "${options}" "${oneValueArgs}"
+ "${multiValueArgs}" "" ${ARGN} )
+ if(NOT DEFINED GCOV_TARBALL)
+ message(FATAL_ERROR
+ "TARBALL must be specified. for ctest_coverage_collect_gcov")
+ endif()
+ if(NOT DEFINED GCOV_SOURCE)
+ set(source_dir "${CTEST_SOURCE_DIRECTORY}")
+ else()
+ set(source_dir "${GCOV_SOURCE}")
+ endif()
+ if(NOT DEFINED GCOV_BUILD)
+ set(binary_dir "${CTEST_BINARY_DIRECTORY}")
+ else()
+ set(binary_dir "${GCOV_BUILD}")
+ endif()
+ if(NOT DEFINED GCOV_GCOV_COMMAND)
+ set(gcov_command "${CTEST_COVERAGE_COMMAND}")
+ else()
+ set(gcov_command "${GCOV_GCOV_COMMAND}")
+ endif()
+ # run gcov on each gcda file in the binary tree
+ set(gcda_files)
+ set(label_files)
+ # look for gcda files in the target directories
+ # could do a glob from the top of the binary tree but
+ # this will be faster and only look where the files will be
+ file(STRINGS "${binary_dir}/CMakeFiles/TargetDirectories.txt" target_dirs
+ ENCODING UTF-8)
+ foreach(target_dir ${target_dirs})
+ file(GLOB_RECURSE gfiles RELATIVE ${binary_dir} "${target_dir}/*.gcda")
+ list(LENGTH gfiles len)
+ # if we have gcda files then also grab the labels file for that target
+ if(${len} GREATER 0)
+ file(GLOB_RECURSE lfiles RELATIVE ${binary_dir}
+ "${target_dir}/Labels.json")
+ list(APPEND gcda_files ${gfiles})
+ list(APPEND label_files ${lfiles})
+ endif()
+ endforeach()
+ # return early if no coverage files were found
+ list(LENGTH gcda_files len)
+ if(len EQUAL 0)
+ if (NOT GCOV_QUIET)
+ message("ctest_coverage_collect_gcov: No .gcda files found, "
+ "ignoring coverage request.")
+ endif()
+ return()
+ endif()
+ # setup the dir for the coverage files
+ set(coverage_dir "${binary_dir}/Testing/CoverageInfo")
+ file(MAKE_DIRECTORY "${coverage_dir}")
+ # call gcov on each .gcda file
+ foreach (gcda_file ${gcda_files})
+ # get the directory of the gcda file
+ get_filename_component(gcda_file ${binary_dir}/${gcda_file} ABSOLUTE)
+ get_filename_component(gcov_dir ${gcda_file} DIRECTORY)
+ # run gcov, this will produce the .gcov file in the current
+ # working directory
+ if(NOT DEFINED GCOV_GCOV_OPTIONS)
+ set(GCOV_GCOV_OPTIONS -b)
+ endif()
+ execute_process(COMMAND
+ ${gcov_command} ${GCOV_GCOV_OPTIONS} -o ${gcov_dir} ${gcda_file}
+ OUTPUT_VARIABLE out
+ RESULT_VARIABLE res
+ WORKING_DIRECTORY ${coverage_dir})
+ endforeach()
+ if(NOT "${res}" EQUAL 0)
+ if (NOT GCOV_QUIET)
+ message(STATUS "Error running gcov: ${res} ${out}")
+ endif()
+ endif()
+ # create json file with project information
+ file(WRITE ${coverage_dir}/data.json
+ "{
+ \"Source\": \"${source_dir}\",
+ \"Binary\": \"${binary_dir}\"
+}")
+ # collect the gcov files
+ set(unfiltered_gcov_files)
+ file(GLOB_RECURSE unfiltered_gcov_files RELATIVE ${binary_dir} "${coverage_dir}/*.gcov")
+
+ set(gcov_files)
+ foreach(gcov_file ${unfiltered_gcov_files})
+ file(STRINGS ${binary_dir}/${gcov_file} first_line LIMIT_COUNT 1 ENCODING UTF-8)
+
+ set(is_excluded false)
+ if(first_line MATCHES "^ -: 0:Source:(.*)$")
+ set(source_file ${CMAKE_MATCH_1})
+ elseif(NOT GCOV_QUIET)
+ message(STATUS "Could not determine source file corresponding to: ${gcov_file}")
+ endif()
+
+ foreach(exclude_entry IN LISTS CTEST_CUSTOM_COVERAGE_EXCLUDE)
+ if(source_file MATCHES "${exclude_entry}")
+ set(is_excluded true)
+
+ if(NOT GCOV_QUIET)
+ message("Excluding coverage for: ${source_file} which matches ${exclude_entry}")
+ endif()
+
+ break()
+ endif()
+ endforeach()
+
+ if(NOT is_excluded)
+ list(APPEND gcov_files ${gcov_file})
+ endif()
+ endforeach()
+
+ # tar up the coverage info with the same date so that the md5
+ # sum will be the same for the tar file independent of file time
+ # stamps
+ string(REPLACE ";" "\n" gcov_files "${gcov_files}")
+ string(REPLACE ";" "\n" label_files "${label_files}")
+ file(WRITE "${coverage_dir}/coverage_file_list.txt"
+ "${gcov_files}
+${coverage_dir}/data.json
+${label_files}
+")
+
+ if (GCOV_QUIET)
+ set(tar_opts "cfj")
+ else()
+ set(tar_opts "cvfj")
+ endif()
+
+ execute_process(COMMAND
+ ${CMAKE_COMMAND} -E tar ${tar_opts} ${GCOV_TARBALL}
+ "--mtime=1970-01-01 0:0:0 UTC"
+ "--format=gnutar"
+ --files-from=${coverage_dir}/coverage_file_list.txt
+ WORKING_DIRECTORY ${binary_dir})
+endfunction()
diff --git a/Modules/CTestScriptMode.cmake b/Modules/CTestScriptMode.cmake
index 42d3764cb..b4347242d 100644
--- a/Modules/CTestScriptMode.cmake
+++ b/Modules/CTestScriptMode.cmake
@@ -1,3 +1,9 @@
+#.rst:
+# CTestScriptMode
+# ---------------
+#
+#
+#
# This file is read by ctest in script mode (-S)
#=============================================================================
diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake
index 5b6e062d0..115785017 100644
--- a/Modules/CTestTargets.cmake
+++ b/Modules/CTestTargets.cmake
@@ -67,6 +67,7 @@ if(NOT _CTEST_TARGETS_ADDED)
foreach(mode Experimental Nightly Continuous NightlyMemoryCheck)
add_custom_target(${mode}
${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}
+ USES_TERMINAL
)
set_property(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "")
set_property(TARGET ${mode} PROPERTY FOLDER "CTestDashboardTargets")
@@ -82,6 +83,7 @@ if(NOT _CTEST_TARGETS_ADDED)
)
add_custom_target(${mode}${testtype}
${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}
+ USES_TERMINAL
)
set_property(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "")
set_property(TARGET ${mode}${testtype} PROPERTY FOLDER "CTestDashboardTargets")
@@ -94,6 +96,7 @@ if(NOT _CTEST_TARGETS_ADDED)
if(CTEST_TEST_TARGET_ALIAS)
add_custom_target(${CTEST_TEST_TARGET_ALIAS}
${CMAKE_CTEST_COMMAND} ${__conf_types}
+ USES_TERMINAL
)
endif()
endif()
diff --git a/Modules/CTestUseLaunchers.cmake b/Modules/CTestUseLaunchers.cmake
index 24f5f2e16..c79119f95 100644
--- a/Modules/CTestUseLaunchers.cmake
+++ b/Modules/CTestUseLaunchers.cmake
@@ -1,21 +1,27 @@
-# - Set the RULE_LAUNCH_* global properties when CTEST_USE_LAUNCHERS is on.
+#.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.
+# 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.
+# 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.
+# 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.
#=============================================================================
# Copyright 2008-2012 Kitware, Inc.
@@ -40,9 +46,31 @@ if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
endif()
if(CTEST_USE_LAUNCHERS)
- set(CTEST_LAUNCH_COMPILE "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <OBJECT> --source <SOURCE> --language <LANGUAGE> --")
- set(CTEST_LAUNCH_LINK "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <TARGET> --target-type <TARGET_TYPE> --language <LANGUAGE> --")
- set(CTEST_LAUNCH_CUSTOM "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <OUTPUT> --")
+ set(__launch_common_options
+ "--target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR>")
+
+ set(__launch_compile_options
+ "${__launch_common_options} --output <OBJECT> --source <SOURCE> --language <LANGUAGE>")
+
+ set(__launch_link_options
+ "${__launch_common_options} --output <TARGET> --target-type <TARGET_TYPE> --language <LANGUAGE>")
+
+ set(__launch_custom_options
+ "${__launch_common_options} --output <OUTPUT>")
+
+ if("${CMAKE_GENERATOR}" MATCHES "Ninja")
+ set(__launch_compile_options "${__launch_compile_options} --filter-prefix <CMAKE_CL_SHOWINCLUDES_PREFIX>")
+ endif()
+
+ set(CTEST_LAUNCH_COMPILE
+ "\"${CMAKE_CTEST_COMMAND}\" --launch ${__launch_compile_options} --")
+
+ set(CTEST_LAUNCH_LINK
+ "\"${CMAKE_CTEST_COMMAND}\" --launch ${__launch_link_options} --")
+
+ set(CTEST_LAUNCH_CUSTOM
+ "\"${CMAKE_CTEST_COMMAND}\" --launch ${__launch_custom_options} --")
+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CTEST_LAUNCH_COMPILE}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CTEST_LAUNCH_LINK}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_CUSTOM "${CTEST_LAUNCH_CUSTOM}")
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index bc15e9a0b..53f345473 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -1,14 +1,23 @@
-# - Check whether the C compiler supports a given flag.
+#.rst:
+# CheckCCompilerFlag
+# ------------------
+#
+# Check whether the C compiler supports a given flag.
+#
# CHECK_C_COMPILER_FLAG(<flag> <var>)
-# <flag> - the compiler flag
-# <var> - variable to store the result
-# This internally calls the check_c_source_compiles macro and
-# sets CMAKE_REQUIRED_DEFINITIONS to <flag>.
-# See help for CheckCSourceCompiles for a listing of variables
-# that can otherwise modify the build.
-# The result only tells that the compiler does not give an error message when
-# it encounters the flag. If the flag has any effect or even a specific one is
-# beyond the scope of this module.
+#
+# ::
+#
+# <flag> - the compiler flag
+# <var> - variable to store the result
+# Will be created as an internal cache variable.
+#
+# This internally calls the check_c_source_compiles macro and sets
+# CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for
+# CheckCSourceCompiles for a listing of variables that can otherwise
+# modify the build. The result only tells that the compiler does not
+# give an error message when it encounters the flag. If the flag has
+# any effect or even a specific one is beyond the scope of this module.
#=============================================================================
# Copyright 2006-2011 Kitware, Inc.
@@ -26,36 +35,30 @@
# License text for the above reference.)
include(CheckCSourceCompiles)
+include(CMakeCheckCompilerFlagCommonPatterns)
macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+
# Normalize locale during test compilation.
set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
foreach(v ${_CheckCCompilerFlag_LOCALE_VARS})
set(_CheckCCompilerFlag_SAVED_${v} "$ENV{${v}}")
set(ENV{${v}} C)
endforeach()
+ CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCCompilerFlag_COMMON_PATTERNS)
CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT}
# Some compilers do not fail with a bad flag
FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU
- FAIL_REGEX "unrecognized .*option" # GNU
- FAIL_REGEX "unknown .*option" # Clang
- FAIL_REGEX "ignoring unknown option" # MSVC
- FAIL_REGEX "warning D9002" # MSVC, any lang
- FAIL_REGEX "option.*not supported" # Intel
- FAIL_REGEX "invalid argument .*option" # Intel
- FAIL_REGEX "ignoring option .*argument required" # Intel
- FAIL_REGEX "[Uu]nknown option" # HP
- FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
- FAIL_REGEX "command option .* is not recognized" # XL
- FAIL_REGEX "WARNING: unknown flag:" # Open64
+ ${_CheckCCompilerFlag_COMMON_PATTERNS}
)
foreach(v ${_CheckCCompilerFlag_LOCALE_VARS})
set(ENV{${v}} ${_CheckCCompilerFlag_SAVED_${v}})
unset(_CheckCCompilerFlag_SAVED_${v})
endforeach()
unset(_CheckCCompilerFlag_LOCALE_VARS)
+ unset(_CheckCCompilerFlag_COMMON_PATTERNS)
set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
endmacro ()
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index 86a4565ce..c2b172311 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -1,15 +1,28 @@
-# - Check if given C source compiles and links into an executable
+#.rst:
+# CheckCSourceCompiles
+# --------------------
+#
+# Check if given C source compiles and links into an executable
+#
# CHECK_C_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>])
-# <code> - source code to try to compile, must define 'main'
-# <var> - variable to store whether the source code compiled
-# <fail-regex> - fail if test output matches this regex
-# The following variables may be set before calling this macro to
-# modify the way the check is run:
#
-# CMAKE_REQUIRED_FLAGS = string of compile command line flags
-# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
-# CMAKE_REQUIRED_INCLUDES = list of include directories
-# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# ::
+#
+# <code> - source code to try to compile, must define 'main'
+# <var> - variable to store whether the source code compiled
+# Will be created as an internal cache variable.
+# <fail-regex> - fail if test output matches this regex
+#
+# The following variables may be set before calling this macro to modify
+# the way the check is run:
+#
+# ::
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
@@ -27,7 +40,7 @@
macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
- if("${VAR}" MATCHES "^${VAR}$")
+ if(NOT DEFINED "${VAR}")
set(_FAIL_REGEX)
set(_key)
foreach(arg ${ARGN})
@@ -56,7 +69,9 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
"${SOURCE}\n")
- message(STATUS "Performing Test ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR}")
+ endif()
try_compile(${VAR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
@@ -74,13 +89,17 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
if(${VAR})
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
- message(STATUS "Performing Test ${VAR} - Success")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Success")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
+ "Performing C SOURCE FILE Test ${VAR} succeeded with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
else()
- message(STATUS "Performing Test ${VAR} - Failed")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Failed")
+ endif()
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
index e3a091fb3..5afeab685 100644
--- a/Modules/CheckCSourceRuns.cmake
+++ b/Modules/CheckCSourceRuns.cmake
@@ -1,15 +1,28 @@
-# - Check if the given C source code compiles and runs.
+#.rst:
+# CheckCSourceRuns
+# ----------------
+#
+# Check if the given C source code compiles and runs.
+#
# CHECK_C_SOURCE_RUNS(<code> <var>)
-# <code> - source code to try to compile
-# <var> - variable to store the result
-# (1 for success, empty for failure)
-# 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
+# ::
+#
+# <code> - source code to try to compile
+# <var> - variable to store the result
+# (1 for success, empty for failure)
+# Will be created as an internal cache variable.
+#
+# The following variables may be set before calling this macro to modify
+# the way the check is run:
+#
+# ::
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -27,7 +40,7 @@
macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
- if("${VAR}" MATCHES "^${VAR}$")
+ if(NOT DEFINED "${VAR}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
@@ -45,7 +58,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
"${SOURCE}\n")
- message(STATUS "Performing Test ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR}")
+ endif()
try_run(${VAR}_EXITCODE ${VAR}_COMPILED
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
@@ -62,9 +77,11 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
# if the return value was 0 then it worked
if("${${VAR}_EXITCODE}" EQUAL 0)
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
- message(STATUS "Performing Test ${VAR} - Success")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Success")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
+ "Performing C SOURCE FILE Test ${VAR} succeeded with the following output:\n"
"${OUTPUT}\n"
"Return value: ${${VAR}}\n"
"Source file was:\n${SOURCE}\n")
@@ -75,7 +92,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
endif()
- message(STATUS "Performing Test ${VAR} - Failed")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Failed")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
index eee3a701e..fab3a053d 100644
--- a/Modules/CheckCXXCompilerFlag.cmake
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -1,14 +1,22 @@
-# - Check whether the CXX compiler supports a given flag.
+#.rst:
+# CheckCXXCompilerFlag
+# --------------------
+#
+# Check whether the CXX compiler supports a given flag.
+#
# CHECK_CXX_COMPILER_FLAG(<flag> <var>)
-# <flag> - the compiler flag
-# <var> - variable to store the result
-# This internally calls the check_cxx_source_compiles macro and
-# sets CMAKE_REQUIRED_DEFINITIONS to <flag>.
-# See help for CheckCXXSourceCompiles for a listing of variables
-# that can otherwise modify the build.
-# The result only tells that the compiler does not give an error message when
-# it encounters the flag. If the flag has any effect or even a specific one is
-# beyond the scope of this module.
+#
+# ::
+#
+# <flag> - the compiler flag
+# <var> - variable to store the result
+#
+# This internally calls the check_cxx_source_compiles macro and sets
+# CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for
+# CheckCXXSourceCompiles for a listing of variables that can otherwise
+# modify the build. The result only tells that the compiler does not
+# give an error message when it encounters the flag. If the flag has
+# any effect or even a specific one is beyond the scope of this module.
#=============================================================================
# Copyright 2006-2010 Kitware, Inc.
@@ -26,6 +34,7 @@
# License text for the above reference.)
include(CheckCXXSourceCompiles)
+include(CMakeCheckCompilerFlagCommonPatterns)
macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
@@ -37,28 +46,18 @@ macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
set(_CheckCXXCompilerFlag_SAVED_${v} "$ENV{${v}}")
set(ENV{${v}} C)
endforeach()
- CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}
+ CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCXXCompilerFlag_COMMON_PATTERNS)
+ CHECK_CXX_SOURCE_COMPILES("int main() { return 0; }" ${_RESULT}
# Some compilers do not fail with a bad flag
FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU
- FAIL_REGEX "unrecognized .*option" # GNU
- FAIL_REGEX "unknown .*option" # Clang
- FAIL_REGEX "ignoring unknown option" # MSVC
- FAIL_REGEX "warning D9002" # MSVC, any lang
- FAIL_REGEX "option.*not supported" # Intel
- FAIL_REGEX "invalid argument .*option" # Intel
- FAIL_REGEX "ignoring option .*argument required" # Intel
- FAIL_REGEX "[Uu]nknown option" # HP
- FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
- FAIL_REGEX "command option .* is not recognized" # XL
- FAIL_REGEX "not supported in this configuration; ignored" # AIX
- FAIL_REGEX "File with unknown suffix passed to linker" # PGI
- FAIL_REGEX "WARNING: unknown flag:" # Open64
+ ${_CheckCXXCompilerFlag_COMMON_PATTERNS}
)
foreach(v ${_CheckCXXCompilerFlag_LOCALE_VARS})
set(ENV{${v}} ${_CheckCXXCompilerFlag_SAVED_${v}})
unset(_CheckCXXCompilerFlag_SAVED_${v})
endforeach()
unset(_CheckCXXCompilerFlag_LOCALE_VARS)
+ unset(_CheckCXXCompilerFlag_COMMON_PATTERNS)
set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
endmacro ()
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
index 734c0839b..f8736e216 100644
--- a/Modules/CheckCXXSourceCompiles.cmake
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -1,15 +1,28 @@
-# - Check if given C++ source compiles and links into an executable
+#.rst:
+# CheckCXXSourceCompiles
+# ----------------------
+#
+# Check if given C++ source compiles and links into an executable
+#
# CHECK_CXX_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>])
-# <code> - source code to try to compile, must define 'main'
-# <var> - variable to store whether the source code compiled
-# <fail-regex> - fail if test output matches this regex
-# The following variables may be set before calling this macro to
-# modify the way the check is run:
#
-# CMAKE_REQUIRED_FLAGS = string of compile command line flags
-# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
-# CMAKE_REQUIRED_INCLUDES = list of include directories
-# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# ::
+#
+# <code> - source code to try to compile, must define 'main'
+# <var> - variable to store whether the source code compiled
+# Will be created as an internal cache variable.
+# <fail-regex> - fail if test output matches this regex
+#
+# The following variables may be set before calling this macro to modify
+# the way the check is run:
+#
+# ::
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
@@ -27,7 +40,7 @@
macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
- if("${VAR}" MATCHES "^${VAR}$")
+ if(NOT DEFINED "${VAR}")
set(_FAIL_REGEX)
set(_key)
foreach(arg ${ARGN})
@@ -57,7 +70,9 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
"${SOURCE}\n")
- message(STATUS "Performing Test ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR}")
+ endif()
try_compile(${VAR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
@@ -75,13 +90,17 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
if(${VAR})
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
- message(STATUS "Performing Test ${VAR} - Success")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Success")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
+ "Performing C++ SOURCE FILE Test ${VAR} succeeded with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
else()
- message(STATUS "Performing Test ${VAR} - Failed")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Failed")
+ endif()
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
index 9e401f18e..84b661d15 100644
--- a/Modules/CheckCXXSourceRuns.cmake
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -1,15 +1,28 @@
-# - Check if the given C++ source code compiles and runs.
+#.rst:
+# CheckCXXSourceRuns
+# ------------------
+#
+# Check if the given C++ source code compiles and runs.
+#
# CHECK_CXX_SOURCE_RUNS(<code> <var>)
-# <code> - source code to try to compile
-# <var> - variable to store the result
-# (1 for success, empty for failure)
-# 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
+# ::
+#
+# <code> - source code to try to compile
+# <var> - variable to store the result
+# (1 for success, empty for failure)
+# Will be created as an internal cache variable.
+#
+# The following variables may be set before calling this macro to modify
+# the way the check is run:
+#
+# ::
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -27,7 +40,7 @@
macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
- if("${VAR}" MATCHES "^${VAR}$")
+ if(NOT DEFINED "${VAR}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
if(CMAKE_REQUIRED_LIBRARIES)
@@ -45,7 +58,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
"${SOURCE}\n")
- message(STATUS "Performing Test ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR}")
+ endif()
try_run(${VAR}_EXITCODE ${VAR}_COMPILED
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
@@ -63,9 +78,11 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
# if the return value was 0 then it worked
if("${${VAR}_EXITCODE}" EQUAL 0)
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
- message(STATUS "Performing Test ${VAR} - Success")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Success")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
+ "Performing C++ SOURCE FILE Test ${VAR} succeeded with the following output:\n"
"${OUTPUT}\n"
"Return value: ${${VAR}}\n"
"Source file was:\n${SOURCE}\n")
@@ -76,7 +93,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
endif()
- message(STATUS "Performing Test ${VAR} - Failed")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Failed")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake
index 210097378..084fbb422 100644
--- a/Modules/CheckCXXSymbolExists.cmake
+++ b/Modules/CheckCXXSymbolExists.cmake
@@ -1,26 +1,33 @@
-# - Check if a symbol exists as a function, variable, or macro in C++
+#.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.
+# <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
+# 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
#=============================================================================
# Copyright 2003-2011 Kitware, Inc.
diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c
index 7250fbff6..344c81bee 100644
--- a/Modules/CheckForPthreads.c
+++ b/Modules/CheckForPthreads.c
@@ -16,8 +16,8 @@ int main(int ac, char*av[]){
pthread_create(&tid[0], 0, runner, (void*)1);
pthread_create(&tid[1], 0, runner, (void*)2);
-#if defined(__BEOS__) && !defined(__ZETA__) // (no usleep on BeOS 5.)
- usleep(1); // for strange behavior on single-processor sun
+#if defined(__BEOS__) && !defined(__ZETA__) /* (no usleep on BeOS 5.) */
+ usleep(1); /* for strange behavior on single-processor sun */
#endif
pthread_join(tid[0], 0);
@@ -31,7 +31,7 @@ void* runner(void* args)
int cc;
for ( cc = 0; cc < 10; cc ++ )
{
- printf("%d CC: %d\n", (int)args, cc);
+ printf("%p CC: %d\n", args, cc);
}
res ++;
return 0;
diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake
new file mode 100644
index 000000000..53fd8d64d
--- /dev/null
+++ b/Modules/CheckFortranCompilerFlag.cmake
@@ -0,0 +1,66 @@
+#.rst:
+# CheckFortranCompilerFlag
+# ------------------------
+#
+# Check whether the Fortran compiler supports a given flag.
+#
+# CHECK_Fortran_COMPILER_FLAG(<flag> <var>)
+#
+# ::
+#
+# <flag> - the compiler flag
+# <var> - variable to store the result
+# Will be created as an internal cache variable.
+#
+# This internally calls the check_fortran_source_compiles macro and
+# sets CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for
+# CheckFortranSourceCompiles for a listing of variables that can
+# otherwise modify the build. The result only tells that the compiler
+# does not give an error message when it encounters the flag. If the
+# flag has any effect or even a specific one is beyond the scope of
+# this module.
+
+#=============================================================================
+# Copyright 2015 Nicolas Bock <nicolasbock@gmail.com>
+# Copyright 2006-2011 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2011 Matthias Kretz <kretz@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+include(CheckFortranSourceCompiles)
+include(CMakeCheckCompilerFlagCommonPatterns)
+
+macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT)
+ set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
+ set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+
+ # Normalize locale during test compilation.
+ set(_CheckFortranCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
+ foreach(v ${_CheckFortranCompilerFlag_LOCALE_VARS})
+ set(_CheckFortranCompilerFlag_SAVED_${v} "$ENV{${v}}")
+ set(ENV{${v}} C)
+ endforeach()
+ CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckFortranCompilerFlag_COMMON_PATTERNS)
+ CHECK_Fortran_SOURCE_COMPILES(" program test\n stop\n end program" ${_RESULT}
+ # Some compilers do not fail with a bad flag
+ FAIL_REGEX "command line option .* is valid for .* but not for Fortran" # GNU
+ ${_CheckFortranCompilerFlag_COMMON_PATTERNS}
+ )
+ foreach(v ${_CheckFortranCompilerFlag_LOCALE_VARS})
+ set(ENV{${v}} ${_CheckFortranCompilerFlag_SAVED_${v}})
+ unset(_CheckFortranCompilerFlag_SAVED_${v})
+ endforeach()
+ unset(_CheckFortranCompilerFlag_LOCALE_VARS)
+ unset(_CheckFortranCompilerFlag_COMMON_PATTERNS)
+
+ set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+endmacro ()
diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake
index 45dd7bebe..bd52f61b6 100644
--- a/Modules/CheckFortranFunctionExists.cmake
+++ b/Modules/CheckFortranFunctionExists.cmake
@@ -1,13 +1,25 @@
-# - Check if the Fortran function exists.
+#.rst:
+# CheckFortranFunctionExists
+# --------------------------
+#
+# macro which checks if the Fortran function exists
+#
# CHECK_FORTRAN_FUNCTION_EXISTS(FUNCTION VARIABLE)
-# - macro which checks if the Fortran function exists
-# FUNCTION - the name of the Fortran function
-# VARIABLE - variable to store the result
#
-# The following variables may be set before calling this macro to
-# modify the way the check is run:
+# ::
+#
+# 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
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake
new file mode 100644
index 000000000..0bdcffa8c
--- /dev/null
+++ b/Modules/CheckFortranSourceCompiles.cmake
@@ -0,0 +1,111 @@
+#.rst:
+# CheckFortranSourceCompiles
+# --------------------------
+#
+# Check if given Fortran source compiles and links into an executable::
+#
+# CHECK_Fortran_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>])
+#
+# The arguments are:
+#
+# ``<code>``
+# Source code to try to compile. It must define a PROGRAM entry point.
+# ``<var>``
+# Variable to store whether the source code compiled.
+# Will be created as an internal cache variable.
+# ``<fail-regex>``
+# Fail if test output matches this regex.
+#
+# The following variables may be set before calling this macro to modify
+# the way the check is run::
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
+
+#=============================================================================
+# Copyright 2005-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+
+macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
+ if(NOT DEFINED "${VAR}")
+ set(_FAIL_REGEX)
+ set(_key)
+ foreach(arg ${ARGN})
+ if("${arg}" MATCHES "^(FAIL_REGEX)$")
+ set(_key "${arg}")
+ elseif(_key)
+ list(APPEND _${_key} "${arg}")
+ else()
+ message(FATAL_ERROR "Unknown argument:\n ${arg}\n")
+ endif()
+ endforeach()
+ set(MACRO_CHECK_FUNCTION_DEFINITIONS
+ "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ if(CMAKE_REQUIRED_LIBRARIES)
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+ else()
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES)
+ endif()
+ if(CMAKE_REQUIRED_INCLUDES)
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ else()
+ set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES)
+ endif()
+ file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F"
+ "${SOURCE}\n")
+
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR}")
+ endif()
+ try_compile(${VAR}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}"
+ OUTPUT_VARIABLE OUTPUT)
+
+ foreach(_regex ${_FAIL_REGEX})
+ if("${OUTPUT}" MATCHES "${_regex}")
+ set(${VAR} 0)
+ endif()
+ endforeach()
+
+ if(${VAR})
+ set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Success")
+ endif()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing Fortran SOURCE FILE Test ${VAR} succeeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Source file was:\n${SOURCE}\n")
+ else()
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Performing Test ${VAR} - Failed")
+ endif()
+ set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n"
+ "${OUTPUT}\n"
+ "Source file was:\n${SOURCE}\n")
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/CheckFunctionExists.c b/Modules/CheckFunctionExists.c
index 607b3e8c6..fd29618ce 100644
--- a/Modules/CheckFunctionExists.c
+++ b/Modules/CheckFunctionExists.c
@@ -1,5 +1,8 @@
#ifdef CHECK_FUNCTION_EXISTS
+#ifdef __cplusplus
+extern "C"
+#endif
char CHECK_FUNCTION_EXISTS();
#ifdef __CLASSIC_C__
int main(){
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index ead135441..5dd37517a 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -1,18 +1,27 @@
-# - Check if a C function can be linked
+#.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>. This does not verify that any
-# system header file declares the function, only that it can be found
-# at link time (consider using CheckSymbolExists).
+# system header file declares the function, only that it can be found at
+# link time (consider using CheckSymbolExists).
+# <variable> will be created as an internal cache variable.
+#
+# The following variables may be set before calling this macro to modify
+# the way the check is run:
#
-# 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_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2002-2011 Kitware, Inc.
@@ -30,10 +39,12 @@
macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
- message(STATUS "Looking for ${FUNCTION}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION}")
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -46,22 +57,38 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
else()
set(CHECK_FUNCTION_EXISTS_ADD_INCLUDES)
endif()
+
+ if(CMAKE_C_COMPILER_LOADED)
+ set(_cfe_source ${CMAKE_ROOT}/Modules/CheckFunctionExists.c)
+ elseif(CMAKE_CXX_COMPILER_LOADED)
+ set(_cfe_source ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckFunctionExists/CheckFunctionExists.cxx)
+ configure_file(${CMAKE_ROOT}/Modules/CheckFunctionExists.c "${_cfe_source}" COPYONLY)
+ else()
+ message(FATAL_ERROR "CHECK_FUNCTION_EXISTS needs either C or CXX language enabled")
+ endif()
+
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
- ${CMAKE_ROOT}/Modules/CheckFunctionExists.c
+ ${_cfe_source}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
"${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
+ unset(_cfe_source)
+
if(${VARIABLE})
set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}")
- message(STATUS "Looking for ${FUNCTION} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION} - found")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the function ${FUNCTION} exists passed with the following output:\n"
"${OUTPUT}\n\n")
else()
- message(STATUS "Looking for ${FUNCTION} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the function ${FUNCTION} exists failed with the following output:\n"
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
index 8067e65ce..ef1e39d69 100644
--- a/Modules/CheckIncludeFile.cmake
+++ b/Modules/CheckIncludeFile.cmake
@@ -1,19 +1,35 @@
-# - Check if the include file exists.
-# CHECK_INCLUDE_FILE(INCLUDE VARIABLE)
-# - macro which checks the include file exists.
-# INCLUDE - name of include file
-# VARIABLE - variable to return result
+#.rst:
+# CheckIncludeFile
+# ----------------
#
-# an optional third argument is the CFlags to add to the compile line
-# or you can use CMAKE_REQUIRED_FLAGS
+# Provides a macro to check if a header file can be included in ``C``.
#
-# The following variables may be set before calling this macro to
-# modify the way the check is run:
+# .. command:: CHECK_INCLUDE_FILE
#
-# 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
+# ::
#
+# 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_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.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -29,7 +45,7 @@
# License text for the above reference.)
macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}")
if(CMAKE_REQUIRED_INCLUDES)
set(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
else()
@@ -38,8 +54,10 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
set(MACRO_CHECK_INCLUDE_FILE_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c IMMEDIATE)
- message(STATUS "Looking for ${INCLUDE}")
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c)
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${INCLUDE}")
+ endif()
if(${ARGC} EQUAL 3)
set(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}")
@@ -59,14 +77,18 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
endif()
if(${VARIABLE})
- message(STATUS "Looking for ${INCLUDE} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${INCLUDE} - found")
+ endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the include file ${INCLUDE} "
"exists passed with the following output:\n"
"${OUTPUT}\n\n")
else()
- message(STATUS "Looking for ${INCLUDE} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${INCLUDE} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the include file ${INCLUDE} "
diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake
index 22c2d1ac7..9a6df3b74 100644
--- a/Modules/CheckIncludeFileCXX.cmake
+++ b/Modules/CheckIncludeFileCXX.cmake
@@ -1,19 +1,34 @@
-# - Check if the include file exists.
-# CHECK_INCLUDE_FILE_CXX(INCLUDE VARIABLE)
+#.rst:
+# CheckIncludeFileCXX
+# -------------------
#
-# INCLUDE - name of include file
-# VARIABLE - variable to return result
+# Provides a macro to check if a header file can be included in ``CXX``.
#
-# An optional third argument is the CFlags to add to the compile line
-# or you can use CMAKE_REQUIRED_FLAGS.
+# .. command:: CHECK_INCLUDE_FILE_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
+# 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_QUIET``
+# execute quietly without messages
+#
+# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles`
+# to check for one or more ``C`` headers.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -29,7 +44,7 @@
# License text for the above reference.)
macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
if(CMAKE_REQUIRED_INCLUDES)
set(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
else()
@@ -38,8 +53,10 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
set(MACRO_CHECK_INCLUDE_FILE_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx IMMEDIATE)
- message(STATUS "Looking for C++ include ${INCLUDE}")
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for C++ include ${INCLUDE}")
+ endif()
if(${ARGC} EQUAL 3)
set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}")
@@ -59,14 +76,18 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
endif()
if(${VARIABLE})
- message(STATUS "Looking for C++ include ${INCLUDE} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for C++ include ${INCLUDE} - found")
+ endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the include file ${INCLUDE} "
"exists passed with the following output:\n"
"${OUTPUT}\n\n")
else()
- message(STATUS "Looking for C++ include ${INCLUDE} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for C++ include ${INCLUDE} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the include file ${INCLUDE} "
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index daf2dd0ea..843cd35ef 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -1,16 +1,35 @@
-# - Check if the files can be included
+#.rst:
+# CheckIncludeFiles
+# -----------------
#
-# CHECK_INCLUDE_FILES(INCLUDE VARIABLE)
+# Provides a macro to check if a list of one or more header files can
+# be included together in ``C``.
#
-# INCLUDE - list of files to include
-# VARIABLE - variable to return result
+# .. command:: CHECK_INCLUDE_FILES
#
-# 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
+# CHECK_INCLUDE_FILES("<includes>" <variable>)
+#
+# Check if the given ``<includes>`` list may be included together
+# in a ``C`` 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.
+#
+# 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_QUIET``
+# execute quietly without messages
+#
+# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX`
+# to check for a single header file in ``C`` or ``CXX`` languages.
#=============================================================================
# Copyright 2003-2012 Kitware, Inc.
@@ -26,7 +45,7 @@
# License text for the above reference.)
macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
if(CMAKE_REQUIRED_INCLUDES)
set(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
@@ -40,9 +59,9 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
"${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
endforeach()
set(CMAKE_CONFIGURABLE_FILE_CONTENT
- "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(){return 0;}\n")
+ "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(void){return 0;}\n")
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
- "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY IMMEDIATE)
+ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY)
set(_INCLUDE ${INCLUDE}) # remove empty elements
if("${_INCLUDE}" MATCHES "^([^;]+);.+;([^;]+)$")
@@ -54,7 +73,9 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
set(_description "include file ${_INCLUDE}")
endif()
- message(STATUS "Looking for ${_description}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${_description}")
+ endif()
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c
@@ -64,14 +85,18 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
"${CHECK_INCLUDE_FILES_INCLUDE_DIRS}"
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
- message(STATUS "Looking for ${_description} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${_description} - found")
+ endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if files ${INCLUDE} "
"exist passed with the following output:\n"
"${OUTPUT}\n\n")
else()
- message(STATUS "Looking for ${_description} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${_description} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if files ${INCLUDE} "
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index 87a401813..99c809b7a 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -1,19 +1,32 @@
-# - Check if a language can be enabled
+#.rst:
+# CheckLanguage
+# -------------
+#
+# Check if a language can be enabled
+#
# Usage:
-# check_language(<lang>)
+#
+# ::
+#
+# 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.
+# 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()
+#
+# ::
+#
+# check_language(Fortran)
+# if(CMAKE_Fortran_COMPILER)
+# enable_language(Fortran)
+# else()
+# message(STATUS "No Fortran support")
+# endif()
#=============================================================================
# Copyright 2009-2012 Kitware, Inc.
@@ -34,7 +47,7 @@ macro(check_language lang)
message(STATUS ${_desc})
file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang})
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/CMakeLists.txt"
- "cmake_minimum_required(VERSION 2.8)
+ "cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(Check${lang} ${lang})
file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
\"set(CMAKE_${lang}_COMPILER \\\"\${CMAKE_${lang}_COMPILER}\\\")\\n\"
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index fb7d0ec01..6b538233e 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -1,17 +1,30 @@
-# - Check if the function exists.
+#.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
+# ::
+#
+# 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:
#
-# 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_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -29,34 +42,51 @@
macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}")
set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
- message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
+ endif()
set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY})
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_LIBRARY_EXISTS_LIBRARIES
${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES})
endif()
+
+ if(CMAKE_C_COMPILER_LOADED)
+ set(_cle_source ${CMAKE_ROOT}/Modules/CheckFunctionExists.c)
+ elseif(CMAKE_CXX_COMPILER_LOADED)
+ set(_cle_source ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckLibraryExists/CheckFunctionExists.cxx)
+ configure_file(${CMAKE_ROOT}/Modules/CheckFunctionExists.c "${_cle_source}" COPYONLY)
+ else()
+ message(FATAL_ERROR "CHECK_FUNCTION_EXISTS needs either C or CXX language enabled")
+ endif()
+
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
- ${CMAKE_ROOT}/Modules/CheckFunctionExists.c
+ ${_cle_source}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
LINK_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION}
-DLINK_DIRECTORIES:STRING=${LOCATION}
OUTPUT_VARIABLE OUTPUT)
+ unset(_cle_source)
if(${VARIABLE})
- message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found")
+ endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the function ${FUNCTION} exists in the ${LIBRARY} "
"passed with the following output:\n"
"${OUTPUT}\n\n")
else()
- message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the function ${FUNCTION} exists in the ${LIBRARY} "
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
index 2342b3c4f..e203d4c3f 100644
--- a/Modules/CheckPrototypeDefinition.cmake
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -1,23 +1,40 @@
-# - Check if the protoype we expect is correct.
+#.rst:
+# CheckPrototypeDefinition
+# ------------------------
+#
+# Check if the protoype 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.
+#
+# ::
+#
+# 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
+# ::
+#
+# 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
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
@@ -40,7 +57,7 @@ get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
- if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$")
+ if (NOT DEFINED ${_VARIABLE})
set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n")
set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS})
@@ -82,12 +99,16 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB
if (${_VARIABLE})
set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
- message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n"
"${OUTPUT}\n\n")
else ()
- message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
+ endif()
set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n"
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index ea2891c8b..6c1520592 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -1,19 +1,39 @@
-# - Check if the given struct or class has the specified member variable
-# CHECK_STRUCT_HAS_MEMBER (STRUCT MEMBER HEADER VARIABLE)
+#.rst:
+# CheckStructHasMember
+# --------------------
#
-# 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
+# Check if the given struct or class has the specified member 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
+# CHECK_STRUCT_HAS_MEMBER(<struct> <member> <header> <variable>
+# [LANGUAGE <language>])
#
-# Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC)
+# ::
+#
+# <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)
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -29,6 +49,7 @@
# License text for the above reference.)
include(CheckCSourceCompiles)
+include(CheckCXXSourceCompiles)
macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
set(_INCLUDE_FILES)
@@ -36,16 +57,28 @@ macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
set(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
endforeach ()
+ if("x${ARGN}" STREQUAL "x")
+ set(_lang C)
+ elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$")
+ set(_lang "${CMAKE_MATCH_1}")
+ else()
+ message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n")
+ endif()
+
set(_CHECK_STRUCT_MEMBER_SOURCE_CODE "
${_INCLUDE_FILES}
int main()
{
- ${_STRUCT}* tmp;
- tmp->${_MEMBER};
- return 0;
+ (void)sizeof(((${_STRUCT} *)0)->${_MEMBER});
+ return 0;
}
")
- CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+ if("${_lang}" STREQUAL "C")
+ CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+ elseif("${_lang}" STREQUAL "CXX")
+ CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+ else()
+ message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n")
+ endif()
endmacro ()
-
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index 0969bc562..c4dff3faa 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -1,26 +1,35 @@
-# - Check if a symbol exists as a function, variable, or macro
+#.rst:
+# CheckSymbolExists
+# -----------------
+#
+# Check if a symbol exists as a function, variable, or macro
+#
# CHECK_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.
+# <files> and store the result in a <variable>. Specify the list of
+# files in one argument as a semicolon-separated list.
+# <variable> will be created as an internal cache variable.
#
# If the header files define the symbol as a macro it is considered
-# available and assumed to work. If the header files declare the
-# symbol 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).
-# If the check needs to be done in C++, consider using CHECK_CXX_SYMBOL_EXISTS(),
-# which does the same as CHECK_SYMBOL_EXISTS(), but in C++.
+# 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). If
+# the check needs to be done in C++, consider using
+# CHECK_CXX_SYMBOL_EXISTS(), which does the same as
+# CHECK_SYMBOL_EXISTS(), but in C++.
#
-# The following variables may be set before calling this macro to
-# modify the way the check is run:
+# 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_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2003-2011 Kitware, Inc.
@@ -35,14 +44,18 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-
-
macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
- _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ if(CMAKE_C_COMPILER_LOADED)
+ _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ elseif(CMAKE_CXX_COMPILER_LOADED)
+ _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ else()
+ message(FATAL_ERROR "CHECK_SYMBOL_EXISTS needs either C or CXX language enabled")
+ endif()
endmacro()
macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS})
if(CMAKE_REQUIRED_LIBRARIES)
@@ -65,9 +78,11 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
"${CMAKE_CONFIGURABLE_FILE_CONTENT}\nint main(int argc, char** argv)\n{\n (void)argv;\n#ifndef ${SYMBOL}\n return ((int*)(&${SYMBOL}))[argc];\n#else\n (void)argc;\n return 0;\n#endif\n}\n")
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
- "${SOURCEFILE}" @ONLY IMMEDIATE)
+ "${SOURCEFILE}" @ONLY)
- message(STATUS "Looking for ${SYMBOL}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${SYMBOL}")
+ endif()
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
"${SOURCEFILE}"
@@ -78,7 +93,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
"${CMAKE_SYMBOL_EXISTS_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
- message(STATUS "Looking for ${SYMBOL} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${SYMBOL} - found")
+ endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the ${SYMBOL} "
@@ -86,7 +103,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
"${OUTPUT}\nFile ${SOURCEFILE}:\n"
"${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
else()
- message(STATUS "Looking for ${SYMBOL} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${SYMBOL} - not found")
+ endif()
set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the ${SYMBOL} "
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index 2d0eab51c..5938d6c9a 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -1,42 +1,69 @@
-# - Check sizeof a type
-# CHECK_TYPE_SIZE(TYPE VARIABLE [BUILTIN_TYPES_ONLY])
-# 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
-# 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}".
+#.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.
+# 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
+# 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:
+# ::
+#
+# 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_EXTRA_INCLUDE_FILES = list of extra headers to include
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
+# CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -52,16 +79,19 @@
# License text for the above reference.)
include(CheckIncludeFile)
+include(CheckIncludeFileCXX)
cmake_policy(PUSH)
-cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
+cmake_policy(SET CMP0054 NEW)
get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
#-----------------------------------------------------------------------------
# Helper function. DO NOT CALL DIRECTLY.
-function(__check_type_size_impl type var map builtin)
- message(STATUS "Check size of ${type}")
+function(__check_type_size_impl type var map builtin language)
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Check size of ${type}")
+ endif()
# Include header files.
set(headers)
@@ -82,8 +112,13 @@ function(__check_type_size_impl type var map builtin)
# Perform the check.
-
- set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.c)
+ if(language STREQUAL "C")
+ set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.c)
+ elseif(language STREQUAL "CXX")
+ set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.cpp)
+ else()
+ message(FATAL_ERROR "Unknown language:\n ${language}\nSupported languages: C, CXX.\n")
+ endif()
set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.bin)
configure_file(${__check_type_size_dir}/CheckTypeSize.c.in ${src} @ONLY)
try_compile(HAVE_${var} ${CMAKE_BINARY_DIR} ${src}
@@ -110,7 +145,7 @@ function(__check_type_size_impl type var map builtin)
foreach(info ${strings})
if("${info}" MATCHES "${regex_size}")
# Get the type size.
- string(REGEX REPLACE "${regex_size}" "\\1" size "${info}")
+ set(size "${CMAKE_MATCH_1}")
if(first)
set(${var} ${size})
elseif(NOT "${size}" STREQUAL "${${var}}")
@@ -140,13 +175,17 @@ function(__check_type_size_impl type var map builtin)
message(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !")
endif()
- message(STATUS "Check size of ${type} - done")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Check size of ${type} - done")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining size of ${type} passed with the following output:\n${output}\n\n")
set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})")
else()
# The check failed to compile.
- message(STATUS "Check size of ${type} - failed")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Check size of ${type} - failed")
+ endif()
file(READ ${src} content)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n")
@@ -157,21 +196,57 @@ endfunction()
#-----------------------------------------------------------------------------
macro(CHECK_TYPE_SIZE TYPE VARIABLE)
+ # parse arguments
+ unset(doing)
+ foreach(arg ${ARGN})
+ if("x${arg}" STREQUAL "xBUILTIN_TYPES_ONLY")
+ set(_CHECK_TYPE_SIZE_${arg} 1)
+ unset(doing)
+ elseif("x${arg}" STREQUAL "xLANGUAGE") # change to MATCHES for more keys
+ set(doing "${arg}")
+ set(_CHECK_TYPE_SIZE_${doing} "")
+ elseif("x${doing}" STREQUAL "xLANGUAGE")
+ set(_CHECK_TYPE_SIZE_${doing} "${arg}")
+ unset(doing)
+ else()
+ message(FATAL_ERROR "Unknown argument:\n ${arg}\n")
+ endif()
+ endforeach()
+ if("x${doing}" MATCHES "^x(LANGUAGE)$")
+ message(FATAL_ERROR "Missing argument:\n ${doing} arguments requires a value\n")
+ endif()
+ if(DEFINED _CHECK_TYPE_SIZE_LANGUAGE)
+ if(NOT "x${_CHECK_TYPE_SIZE_LANGUAGE}" MATCHES "^x(C|CXX)$")
+ message(FATAL_ERROR "Unknown language:\n ${_CHECK_TYPE_SIZE_LANGUAGE}.\nSupported languages: C, CXX.\n")
+ endif()
+ set(_language ${_CHECK_TYPE_SIZE_LANGUAGE})
+ else()
+ set(_language C)
+ endif()
+
# Optionally check for standard headers.
- if("${ARGV2}" STREQUAL "BUILTIN_TYPES_ONLY")
+ if(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
set(_builtin 0)
else()
set(_builtin 1)
- check_include_file(sys/types.h HAVE_SYS_TYPES_H)
- check_include_file(stdint.h HAVE_STDINT_H)
- check_include_file(stddef.h HAVE_STDDEF_H)
+ if(_language STREQUAL "C")
+ check_include_file(sys/types.h HAVE_SYS_TYPES_H)
+ check_include_file(stdint.h HAVE_STDINT_H)
+ check_include_file(stddef.h HAVE_STDDEF_H)
+ elseif(_language STREQUAL "CXX")
+ check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H)
+ check_include_file_cxx(stdint.h HAVE_STDINT_H)
+ check_include_file_cxx(stddef.h HAVE_STDDEF_H)
+ endif()
endif()
+ unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
+ unset(_CHECK_TYPE_SIZE_LANGUAGE)
# Compute or load the size or size map.
set(${VARIABLE}_KEYS)
set(_map_file ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${VARIABLE}.cmake)
if(NOT DEFINED HAVE_${VARIABLE})
- __check_type_size_impl(${TYPE} ${VARIABLE} ${_map_file} ${_builtin})
+ __check_type_size_impl(${TYPE} ${VARIABLE} ${_map_file} ${_builtin} ${_language})
endif()
include(${_map_file} OPTIONAL)
set(_map_file)
diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake
index a21e65f26..f3e05e41b 100644
--- a/Modules/CheckVariableExists.cmake
+++ b/Modules/CheckVariableExists.cmake
@@ -1,17 +1,33 @@
-# - Check if the variable exists.
-# CHECK_VARIABLE_EXISTS(VAR VARIABLE)
+#.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.
#
-# VAR - the name of the variable
-# VARIABLE - variable to store the result
#
# 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:
+# 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_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -29,10 +45,12 @@
macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
- if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ if(NOT DEFINED "${VARIABLE}")
set(MACRO_CHECK_VARIABLE_DEFINITIONS
"-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}")
- message(STATUS "Looking for ${VAR}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${VAR}")
+ endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -48,13 +66,17 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
set(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}")
- message(STATUS "Looking for ${VAR} - found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${VAR} - found")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the variable ${VAR} exists passed with the following output:\n"
"${OUTPUT}\n\n")
else()
set(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}")
- message(STATUS "Looking for ${VAR} - not found")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Looking for ${VAR} - not found")
+ endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the variable ${VAR} exists failed with the following output:\n"
"${OUTPUT}\n\n")
diff --git a/Modules/Compiler/ADSP-DetermineCompiler.cmake b/Modules/Compiler/ADSP-DetermineCompiler.cmake
new file mode 100644
index 000000000..0340f6904
--- /dev/null
+++ b/Modules/Compiler/ADSP-DetermineCompiler.cmake
@@ -0,0 +1,10 @@
+
+set(_compiler_id_pp_test "defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)")
+
+set(_compiler_id_version_compute "
+#if defined(__VISUALDSPVERSION__)
+ /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__VISUALDSPVERSION__>>24)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__VISUALDSPVERSION__>>16 & 0xFF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__VISUALDSPVERSION__>>8 & 0xFF)
+#endif")
diff --git a/Modules/Compiler/ARMCC-ASM.cmake b/Modules/Compiler/ARMCC-ASM.cmake
new file mode 100644
index 000000000..8e3cfc5c8
--- /dev/null
+++ b/Modules/Compiler/ARMCC-ASM.cmake
@@ -0,0 +1,7 @@
+include(Compiler/ARMCC)
+
+set(CMAKE_ASM_OUTPUT_EXTENSION ".o")
+set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1)
+
+set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>")
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa)
diff --git a/Modules/Compiler/ARMCC-C.cmake b/Modules/Compiler/ARMCC-C.cmake
new file mode 100644
index 000000000..dcdcaab4a
--- /dev/null
+++ b/Modules/Compiler/ARMCC-C.cmake
@@ -0,0 +1,2 @@
+include(Compiler/ARMCC)
+__compiler_armcc(C)
diff --git a/Modules/Compiler/ARMCC-CXX.cmake b/Modules/Compiler/ARMCC-CXX.cmake
new file mode 100644
index 000000000..811fc93bd
--- /dev/null
+++ b/Modules/Compiler/ARMCC-CXX.cmake
@@ -0,0 +1,2 @@
+include(Compiler/ARMCC)
+__compiler_armcc(CXX)
diff --git a/Modules/Compiler/ARMCC-DetermineCompiler.cmake b/Modules/Compiler/ARMCC-DetermineCompiler.cmake
new file mode 100644
index 000000000..a3667d7c2
--- /dev/null
+++ b/Modules/Compiler/ARMCC-DetermineCompiler.cmake
@@ -0,0 +1,16 @@
+# ARMCC Toolchain
+set(_compiler_id_pp_test "defined(__ARMCC_VERSION)")
+
+set(_compiler_id_version_compute "
+#if __ARMCC_VERSION >= 1000000
+ /* __ARMCC_VERSION = VRRPPPP */
+ # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ARMCC_VERSION/1000000)
+ # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ARMCC_VERSION/10000 % 100)
+ # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ARMCC_VERSION % 10000)
+#else
+ /* __ARMCC_VERSION = VRPPPP */
+ # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ARMCC_VERSION/100000)
+ # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ARMCC_VERSION/10000 % 10)
+ # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ARMCC_VERSION % 10000)
+#endif
+")
diff --git a/Modules/Compiler/ARMCC.cmake b/Modules/Compiler/ARMCC.cmake
new file mode 100644
index 000000000..3cf628c0d
--- /dev/null
+++ b/Modules/Compiler/ARMCC.cmake
@@ -0,0 +1,36 @@
+if(_ARMCC_CMAKE_LOADED)
+ return()
+endif()
+set(_ARMCC_CMAKE_LOADED TRUE)
+
+# See ARM Compiler documentation at:
+# http://infocenter.arm.com/help/topic/com.arm.doc.set.swdev/index.html
+
+get_filename_component(_CMAKE_C_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH)
+get_filename_component(_CMAKE_CXX_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH)
+
+set(CMAKE_EXECUTABLE_SUFFIX ".elf")
+
+find_program(CMAKE_ARMCC_LINKER armlink HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
+find_program(CMAKE_ARMCC_AR armar HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
+
+set(CMAKE_LINKER "${CMAKE_ARMCC_LINKER}" CACHE FILEPATH "The ARMCC linker" FORCE)
+mark_as_advanced(CMAKE_ARMCC_LINKER)
+set(CMAKE_AR "${CMAKE_ARMCC_AR}" CACHE FILEPATH "The ARMCC archiver" FORCE)
+mark_as_advanced(CMAKE_ARMCC_AR)
+
+macro(__compiler_armcc lang)
+ set(CMAKE_${lang}_FLAGS_INIT "")
+ set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")
+ set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Ospace -DNDEBUG")
+ set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-Otime -DNDEBUG")
+ set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+
+ set(CMAKE_${lang}_OUTPUT_EXTENSION ".o")
+ set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1)
+
+ set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> --list <TARGET_BASE>.map")
+ set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+
+ set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEPFILE> --depend_single_line --no_depend_system_headers")
+endmacro()
diff --git a/Modules/Compiler/AppleClang-ASM.cmake b/Modules/Compiler/AppleClang-ASM.cmake
new file mode 100644
index 000000000..f52bde05e
--- /dev/null
+++ b/Modules/Compiler/AppleClang-ASM.cmake
@@ -0,0 +1 @@
+include(Compiler/Clang-ASM)
diff --git a/Modules/Compiler/AppleClang-C-FeatureTests.cmake b/Modules/Compiler/AppleClang-C-FeatureTests.cmake
new file mode 100644
index 000000000..e80b526f1
--- /dev/null
+++ b/Modules/Compiler/AppleClang-C-FeatureTests.cmake
@@ -0,0 +1,11 @@
+
+set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 400")
+
+set(AppleClang_C11 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L")
+set(_cmake_feature_test_c_static_assert "${AppleClang_C11}")
+set(AppleClang_C99 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
+set(_cmake_feature_test_c_restrict "${AppleClang_C99}")
+set(_cmake_feature_test_c_variadic_macros "${AppleClang_C99}")
+
+set(AppleClang_C90 "${_cmake_oldestSupported}")
+set(_cmake_feature_test_c_function_prototypes "${AppleClang_C90}")
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
new file mode 100644
index 000000000..1cc72c0e5
--- /dev/null
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -0,0 +1,42 @@
+include(Compiler/Clang)
+__compiler_clang(C)
+
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
+
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+endif()
+
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
+ if (NOT CMAKE_C_COMPILER_FORCED)
+ if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
+ elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT)
+ # Compiler id was forced so just guess the default standard level.
+ set(CMAKE_C_STANDARD_DEFAULT 99)
+ endif()
+endif()
+
+macro(cmake_record_c_compile_features)
+ macro(_get_appleclang_features std_version list)
+ record_compiler_features(C "${std_version}" ${list})
+ endmacro()
+
+ set(_result 0)
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
+ _get_appleclang_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
+ if (_result EQUAL 0)
+ _get_appleclang_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
+ endif()
+ if (_result EQUAL 0)
+ _get_appleclang_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/Compiler/AppleClang-CXX-FeatureTests.cmake b/Modules/Compiler/AppleClang-CXX-FeatureTests.cmake
new file mode 100644
index 000000000..f67082c6a
--- /dev/null
+++ b/Modules/Compiler/AppleClang-CXX-FeatureTests.cmake
@@ -0,0 +1,52 @@
+
+# No known reference for AppleClang versions.
+# Generic reference: http://clang.llvm.org/cxx_status.html
+# http://clang.llvm.org/docs/LanguageExtensions.html
+
+# Note: CXX compiler in Xcode 4.3 does not set __apple_build_version__ and so is
+# not recognized as AppleClang.
+# Xcode_43 - Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
+# Xcode_44 - Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
+# Xcode_45 - Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
+# Xcode_46 - Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
+# Xcode_50 - Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
+# Xcode_51 - Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
+# Xcode_60 - Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
+# Xcode_61 - Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
+
+# There is some non-correspondance. __has_feature(cxx_user_literals) is
+# false for AppleClang 4.0 and 4.1, although it is reported as
+# supported in the reference link for Clang 3.1. The compiler does not pass
+# the CompileFeatures/cxx_user_literals.cpp test.
+# cxx_attributes is listed as not supported until Clang 3.3. It works without
+# warning with AppleClang 5.0, but issues a gcc-compat warning for
+# AppleClang 4.0-4.2.
+# cxx_alignof and cxx_alignas tests work for early AppleClang versions, though
+# they are listed as supported for Clang 3.3 and later.
+
+set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 400")
+
+include("${CMAKE_CURRENT_LIST_DIR}/Clang-CXX-TestableFeatures.cmake")
+
+set(AppleClang51_CXX14 "((__clang_major__ * 100) + __clang_minor__) >= 501 && __cplusplus > 201103L")
+# http://llvm.org/bugs/show_bug.cgi?id=19242
+set(_cmake_feature_test_cxx_attribute_deprecated "${AppleClang51_CXX14}")
+# http://llvm.org/bugs/show_bug.cgi?id=19698
+set(_cmake_feature_test_cxx_decltype_auto "${AppleClang51_CXX14}")
+set(_cmake_feature_test_cxx_digit_separators "${AppleClang51_CXX14}")
+# http://llvm.org/bugs/show_bug.cgi?id=19674
+set(_cmake_feature_test_cxx_generic_lambdas "${AppleClang51_CXX14}")
+
+set(AppleClang40_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_enum_forward_declarations "${AppleClang40_CXX11}")
+set(_cmake_feature_test_cxx_sizeof_member "${AppleClang40_CXX11}")
+set(_cmake_feature_test_cxx_extended_friend_declarations "${AppleClang40_CXX11}")
+set(_cmake_feature_test_cxx_extern_templates "${AppleClang40_CXX11}")
+set(_cmake_feature_test_cxx_func_identifier "${AppleClang40_CXX11}")
+set(_cmake_feature_test_cxx_inline_namespaces "${AppleClang40_CXX11}")
+set(_cmake_feature_test_cxx_long_long_type "${AppleClang40_CXX11}")
+set(_cmake_feature_test_cxx_right_angle_brackets "${AppleClang40_CXX11}")
+set(_cmake_feature_test_cxx_variadic_macros "${AppleClang40_CXX11}")
+
+set(AppleClang_CXX98 "${_cmake_oldestSupported} && __cplusplus >= 199711L")
+set(_cmake_feature_test_cxx_template_template_parameters "${AppleClang_CXX98}")
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
new file mode 100644
index 000000000..95bc79adc
--- /dev/null
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -0,0 +1,56 @@
+include(Compiler/Clang)
+__compiler_clang(CXX)
+
+if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
+ # AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
+ if (NOT CMAKE_CXX_COMPILER_FORCED)
+ if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
+ elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
+ # Compiler id was forced so just guess the default standard level.
+ set(CMAKE_CXX_STANDARD_DEFAULT 98)
+ endif()
+endif()
+
+
+macro(cmake_record_cxx_compile_features)
+ macro(_get_appleclang_features std_version list)
+ record_compiler_features(CXX "${std_version}" ${list})
+ endmacro()
+
+ set(_result 0)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
+ set(_result 0)
+ if(CMAKE_CXX14_STANDARD_COMPILE_OPTION)
+ _get_appleclang_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
+ endif()
+ if (_result EQUAL 0)
+ _get_appleclang_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
+ endif()
+ if (_result EQUAL 0)
+ _get_appleclang_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/Compiler/AppleClang-DetermineCompiler.cmake b/Modules/Compiler/AppleClang-DetermineCompiler.cmake
new file mode 100644
index 000000000..397f95cbe
--- /dev/null
+++ b/Modules/Compiler/AppleClang-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__clang__) && defined(__apple_build_version__)")
+
+include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake")
+
+set(_compiler_id_version_compute "${_compiler_id_version_compute}
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__apple_build_version__)")
diff --git a/Modules/Compiler/Borland-DetermineCompiler.cmake b/Modules/Compiler/Borland-DetermineCompiler.cmake
new file mode 100644
index 000000000..ef3083b4d
--- /dev/null
+++ b/Modules/Compiler/Borland-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__BORLANDC__)")
+
+set(_compiler_id_version_compute "
+ /* __BORLANDC__ = 0xVRR */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__BORLANDC__>>8)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__BORLANDC__ & 0xFF)")
diff --git a/Modules/Compiler/CCur-Fortran.cmake b/Modules/Compiler/CCur-Fortran.cmake
new file mode 100644
index 000000000..6ec06ae11
--- /dev/null
+++ b/Modules/Compiler/CCur-Fortran.cmake
@@ -0,0 +1 @@
+include(Compiler/GNU-Fortran)
diff --git a/Modules/Compiler/Clang-C-FeatureTests.cmake b/Modules/Compiler/Clang-C-FeatureTests.cmake
new file mode 100644
index 000000000..99c2252c8
--- /dev/null
+++ b/Modules/Compiler/Clang-C-FeatureTests.cmake
@@ -0,0 +1,11 @@
+
+set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 304")
+
+set(Clang_C11 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L")
+set(_cmake_feature_test_c_static_assert "${Clang_C11}")
+set(Clang_C99 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
+set(_cmake_feature_test_c_restrict "${Clang_C99}")
+set(_cmake_feature_test_c_variadic_macros "${Clang_C99}")
+
+set(Clang_C90 "${_cmake_oldestSupported}")
+set(_cmake_feature_test_c_function_prototypes "${Clang_C90}")
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index 98fcd0b3f..d8b77430a 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -1,2 +1,51 @@
include(Compiler/Clang)
__compiler_clang(C)
+
+cmake_policy(GET CMP0025 appleClangPolicy)
+if(WIN32 OR (APPLE AND NOT appleClangPolicy STREQUAL NEW))
+ return()
+endif()
+
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
+
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+endif()
+
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
+ if (NOT CMAKE_C_COMPILER_FORCED)
+ if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
+ elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT)
+ # Compiler id was forced so just guess the default standard level.
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6)
+ set(CMAKE_C_STANDARD_DEFAULT 11)
+ else()
+ set(CMAKE_C_STANDARD_DEFAULT 99)
+ endif()
+ endif()
+endif()
+
+macro(cmake_record_c_compile_features)
+ macro(_get_clang_features std_version list)
+ record_compiler_features(C "${std_version}" ${list})
+ endmacro()
+
+ set(_result 0)
+ if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
+ _get_clang_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
+ if (_result EQUAL 0)
+ _get_clang_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
+ endif()
+ if (_result EQUAL 0)
+ _get_clang_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/Compiler/Clang-CXX-FeatureTests.cmake b/Modules/Compiler/Clang-CXX-FeatureTests.cmake
new file mode 100644
index 000000000..df2e1a8e0
--- /dev/null
+++ b/Modules/Compiler/Clang-CXX-FeatureTests.cmake
@@ -0,0 +1,34 @@
+
+# Reference: http://clang.llvm.org/cxx_status.html
+# http://clang.llvm.org/docs/LanguageExtensions.html
+
+set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 304")
+
+include("${CMAKE_CURRENT_LIST_DIR}/Clang-CXX-TestableFeatures.cmake")
+
+set(Clang34_CXX14 "((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L")
+# http://llvm.org/bugs/show_bug.cgi?id=19242
+set(_cmake_feature_test_cxx_attribute_deprecated "${Clang34_CXX14}")
+# http://llvm.org/bugs/show_bug.cgi?id=19698
+set(_cmake_feature_test_cxx_decltype_auto "${Clang34_CXX14}")
+set(_cmake_feature_test_cxx_digit_separators "${Clang34_CXX14}")
+# http://llvm.org/bugs/show_bug.cgi?id=19674
+set(_cmake_feature_test_cxx_generic_lambdas "${Clang34_CXX14}")
+
+# TODO: Should be supported by Clang 3.1
+set(Clang31_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_enum_forward_declarations "${Clang31_CXX11}")
+set(_cmake_feature_test_cxx_sizeof_member "${Clang31_CXX11}")
+# TODO: Should be supported by Clang 2.9
+set(Clang29_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_extended_friend_declarations "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_extern_templates "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_func_identifier "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_inline_namespaces "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_long_long_type "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_right_angle_brackets "${Clang29_CXX11}")
+set(_cmake_feature_test_cxx_variadic_macros "${Clang29_CXX11}")
+
+# TODO: Should be supported forever?
+set(Clang_CXX98 "${_cmake_oldestSupported} && __cplusplus >= 199711L")
+set(_cmake_feature_test_cxx_template_template_parameters "${Clang_CXX98}")
diff --git a/Modules/Compiler/Clang-CXX-TestableFeatures.cmake b/Modules/Compiler/Clang-CXX-TestableFeatures.cmake
new file mode 100644
index 000000000..b39475ce4
--- /dev/null
+++ b/Modules/Compiler/Clang-CXX-TestableFeatures.cmake
@@ -0,0 +1,54 @@
+
+set(testable_features
+ cxx_alias_templates
+ cxx_alignas
+ cxx_attributes
+ cxx_auto_type
+ cxx_binary_literals
+ cxx_constexpr
+ cxx_contextual_conversions
+ cxx_decltype
+ cxx_decltype_incomplete_return_types
+ cxx_default_function_template_args
+ cxx_defaulted_functions
+ cxx_delegating_constructors
+ cxx_deleted_functions
+ cxx_explicit_conversions
+ cxx_generalized_initializers
+ cxx_inheriting_constructors
+ cxx_lambdas
+ cxx_local_type_template_args
+ cxx_noexcept
+ cxx_nonstatic_member_init
+ cxx_nullptr
+ cxx_range_for
+ cxx_raw_string_literals
+ cxx_reference_qualified_functions
+ cxx_relaxed_constexpr
+ cxx_return_type_deduction
+ cxx_rvalue_references
+ cxx_static_assert
+ cxx_strong_enums
+ cxx_thread_local
+ cxx_unicode_literals
+ cxx_unrestricted_unions
+ cxx_user_literals
+ cxx_variable_templates
+ cxx_variadic_templates
+)
+
+foreach(feature ${testable_features})
+ set(_cmake_feature_test_${feature} "${_cmake_oldestSupported} && __has_feature(${feature})")
+endforeach()
+
+unset(testable_features)
+
+set(_cmake_feature_test_cxx_aggregate_default_initializers "${_cmake_oldestSupported} && __has_feature(cxx_aggregate_nsdmi)")
+
+set(_cmake_feature_test_cxx_trailing_return_types "${_cmake_oldestSupported} && __has_feature(cxx_trailing_return)")
+set(_cmake_feature_test_cxx_alignof "${_cmake_oldestSupported} && __has_feature(cxx_alignas)")
+set(_cmake_feature_test_cxx_final "${_cmake_oldestSupported} && __has_feature(cxx_override_control)")
+set(_cmake_feature_test_cxx_override "${_cmake_oldestSupported} && __has_feature(cxx_override_control)")
+set(_cmake_feature_test_cxx_uniform_initialization "${_cmake_oldestSupported} && __has_feature(cxx_generalized_initializers)")
+set(_cmake_feature_test_cxx_defaulted_move_initializers "${_cmake_oldestSupported} && __has_feature(cxx_defaulted_functions)")
+set(_cmake_feature_test_cxx_lambda_init_captures "${_cmake_oldestSupported} && __has_feature(cxx_init_captures)")
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 972d889aa..dc6271198 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -1,4 +1,61 @@
include(Compiler/Clang)
__compiler_clang(CXX)
-set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+endif()
+
+cmake_policy(GET CMP0025 appleClangPolicy)
+if(APPLE AND NOT appleClangPolicy STREQUAL NEW)
+ return()
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.1)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.1)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+ if (NOT CMAKE_CXX_COMPILER_FORCED)
+ if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
+ elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
+ # Compiler id was forced so just guess the default standard level.
+ set(CMAKE_CXX_STANDARD_DEFAULT 98)
+ endif()
+endif()
+
+macro(cmake_record_cxx_compile_features)
+ macro(_get_clang_features std_version list)
+ record_compiler_features(CXX "${std_version}" ${list})
+ endmacro()
+
+ set(_result 0)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+ _get_clang_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
+ if (_result EQUAL 0)
+ _get_clang_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
+ endif()
+ if (_result EQUAL 0)
+ _get_clang_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/Compiler/Clang-DetermineCompiler.cmake b/Modules/Compiler/Clang-DetermineCompiler.cmake
new file mode 100644
index 000000000..89df1b6dc
--- /dev/null
+++ b/Modules/Compiler/Clang-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__clang__)")
+
+include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake")
diff --git a/Modules/Compiler/Clang-DetermineCompilerInternal.cmake b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake
new file mode 100644
index 000000000..08c12305d
--- /dev/null
+++ b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake
@@ -0,0 +1,15 @@
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__clang_major__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__clang_minor__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__clang_patchlevel__)
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+# endif")
+
+set(_compiler_id_simulate "
+# if defined(_MSC_VER)
+# define @PREFIX@SIMULATE_ID \"MSVC\"
+# endif")
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index ec4562a3d..701089cbf 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -18,11 +18,24 @@ if(__COMPILER_CLANG)
endif()
set(__COMPILER_CLANG 1)
-include(Compiler/GNU)
+if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ macro(__compiler_clang lang)
+ endmacro()
+else()
+ include(Compiler/GNU)
-macro(__compiler_clang lang)
- __compiler_gnu(${lang})
- set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
- set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
- set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
-endmacro()
+ macro(__compiler_clang lang)
+ __compiler_gnu(${lang})
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4.0)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-target ")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "-gcc-toolchain ")
+ else()
+ set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "--target=")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "--gcc-toolchain=")
+ endif()
+ endmacro()
+endif()
diff --git a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
new file mode 100644
index 000000000..2265e5ea8
--- /dev/null
+++ b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__COMO__)")
+
+set(_compiler_id_version_compute "
+ /* __COMO_VERSION__ = VRR */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__COMO_VERSION__ / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__COMO_VERSION__ % 100)")
diff --git a/Modules/Compiler/Compaq-C-DetermineCompiler.cmake b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake
new file mode 100644
index 000000000..02e99dca0
--- /dev/null
+++ b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__DECC)")
+
+set(_compiler_id_version_compute "
+ /* __DECC_VER = VVRRTPPPP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECC_VER/10000000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECC_VER/100000 % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECC_VER % 10000)")
diff --git a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
new file mode 100644
index 000000000..c7d0565ce
--- /dev/null
+++ b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__DECCXX)")
+
+set(_compiler_id_version_compute "
+ /* __DECCXX_VER = VVRRTPPPP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECCXX_VER/10000000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECCXX_VER/100000 % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECCXX_VER % 10000)")
diff --git a/Modules/Compiler/Cray-DetermineCompiler.cmake b/Modules/Compiler/Cray-DetermineCompiler.cmake
new file mode 100644
index 000000000..660229425
--- /dev/null
+++ b/Modules/Compiler/Cray-DetermineCompiler.cmake
@@ -0,0 +1,6 @@
+
+set(_compiler_id_pp_test "defined(_CRAYC)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE_MAJOR)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_RELEASE_MINOR)")
diff --git a/Modules/Compiler/CrayPrgEnv-C.cmake b/Modules/Compiler/CrayPrgEnv-C.cmake
new file mode 100644
index 000000000..6b461ce06
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-C.cmake
@@ -0,0 +1,11 @@
+if(__craylinux_crayprgenv_c)
+ return()
+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()
diff --git a/Modules/Compiler/CrayPrgEnv-CXX.cmake b/Modules/Compiler/CrayPrgEnv-CXX.cmake
new file mode 100644
index 000000000..aad85b67e
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-CXX.cmake
@@ -0,0 +1,11 @@
+if(__craylinux_crayprgenv_cxx)
+ return()
+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()
diff --git a/Modules/Compiler/CrayPrgEnv-Cray-C.cmake b/Modules/Compiler/CrayPrgEnv-Cray-C.cmake
new file mode 100644
index 000000000..547a4b4d5
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-Cray-C.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..df8452c15
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..9f46a04c8
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..9c4d2694a
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-Fortran.cmake
@@ -0,0 +1,11 @@
+if(__craylinux_crayprgenv_fortran)
+ return()
+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()
diff --git a/Modules/Compiler/CrayPrgEnv-GNU-C.cmake b/Modules/Compiler/CrayPrgEnv-GNU-C.cmake
new file mode 100644
index 000000000..248081b87
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-GNU-C.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..be4eb6d54
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..8bd23ff88
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..83c4e3801
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-Intel-C.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..3c3c3e63f
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..08a316d2c
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..f45767caf
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-PGI-C.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..a2a286f8c
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..f6ba7c0fa
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 000000000..fa39b009a
--- /dev/null
+++ b/Modules/Compiler/CrayPrgEnv.cmake
@@ -0,0 +1,91 @@
+# Guard against multiple inclusions
+if(__craylinux_crayprgenv)
+ return()
+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)
+ if(DEFINED ENV{CRAYPE_VERSION})
+ message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION} ${lang}")
+ elseif(DEFINED ENV{ASYNCPE_VERSION})
+ message(STATUS "Cray XT Programming Environment $ENV{ASYNCPE_VERSION} ${lang}")
+ endif()
+
+ # Flags for the Cray wrappers
+ set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic")
+
+ # If the link type is not explicitly specified in the environment then
+ # the Cray wrappers assume that the code will be built staticly so
+ # we check the following condition(s) are NOT met
+ # Compiler flags are explicitly dynamic
+ # Env var is dynamic and compiler flags are not explicitly static
+ if(NOT (((CMAKE_${lang}_FLAGS MATCHES "(^| )-dynamic($| )") OR
+ (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )"))
+ OR
+ (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND
+ NOT ((CMAKE_${lang}_FLAGS MATCHES "(^| )-static($| )") OR
+ (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )")))))
+ set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+ set(BUILD_SHARED_LIBS FALSE CACHE BOOL "")
+ 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/Embarcadero-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake
new file mode 100644
index 000000000..8375624e9
--- /dev/null
+++ b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__CODEGEARC_VERSION__>>24 & 0x00FF)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__CODEGEARC_VERSION__>>16 & 0x00FF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__CODEGEARC_VERSION__ & 0xFFFF)")
diff --git a/Modules/Compiler/Fujitsu-DetermineCompiler.cmake b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake
new file mode 100644
index 000000000..73ee38c87
--- /dev/null
+++ b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake
@@ -0,0 +1,2 @@
+
+set(_compiler_id_pp_test "defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)")
diff --git a/Modules/Compiler/GHS-C.cmake b/Modules/Compiler/GHS-C.cmake
new file mode 100644
index 000000000..e97d62c22
--- /dev/null
+++ b/Modules/Compiler/GHS-C.cmake
@@ -0,0 +1,27 @@
+set(CMAKE_C_VERBOSE_FLAG "-v")
+
+set(CMAKE_C_FLAGS_INIT "")
+set(CMAKE_C_FLAGS_DEBUG_INIT "-Odebug -g")
+set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Ospace")
+set(CMAKE_C_FLAGS_RELEASE_INIT "-O")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O -g")
+
+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
new file mode 100644
index 000000000..71a0dec78
--- /dev/null
+++ b/Modules/Compiler/GHS-CXX.cmake
@@ -0,0 +1,31 @@
+set(CMAKE_CXX_VERBOSE_FLAG "-v")
+
+set(CMAKE_CXX_FLAGS_INIT "")
+set(CMAKE_CXX_FLAGS_DEBUG_INIT "-Odebug -g")
+set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Ospace")
+set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O -g")
+
+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
new file mode 100644
index 000000000..56d24e266
--- /dev/null
+++ b/Modules/Compiler/GHS-DetermineCompiler.cmake
@@ -0,0 +1,6 @@
+set(_compiler_id_pp_test "defined(__INTEGRITY)")
+
+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)")
diff --git a/Modules/Compiler/GNU-C-FeatureTests.cmake b/Modules/Compiler/GNU-C-FeatureTests.cmake
new file mode 100644
index 000000000..b3fe33f14
--- /dev/null
+++ b/Modules/Compiler/GNU-C-FeatureTests.cmake
@@ -0,0 +1,17 @@
+
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404")
+
+# GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it
+# to 201000L. As the former is strictly greater than the latter, test only
+# for the latter. If in the future CMake learns about a C feature which was
+# introduced with GNU 4.7, that should test for the correct version, similar
+# to the distinction between __cplusplus and __GXX_EXPERIMENTAL_CXX0X__ tests.
+set(GNU46_C11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L")
+set(_cmake_feature_test_c_static_assert "${GNU46_C11}")
+# Since 4.4 at least:
+set(GNU44_C99 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
+set(_cmake_feature_test_c_restrict "${GNU44_C99}")
+set(_cmake_feature_test_c_variadic_macros "${GNU44_C99}")
+
+set(GNU_C90 "${_cmake_oldestSupported}")
+set(_cmake_feature_test_c_function_prototypes "${GNU_C90}")
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 9a5137a4b..2c478da21 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -1,2 +1,59 @@
include(Compiler/GNU)
__compiler_gnu(C)
+
+if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
+elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
+endif()
+
+if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+endif()
+
+if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
+endif()
+
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+ if (NOT CMAKE_C_COMPILER_FORCED)
+ if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
+ elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT)
+ # Compiler id was forced so just guess the default standard level.
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
+ set(CMAKE_C_STANDARD_DEFAULT 11)
+ else()
+ set(CMAKE_C_STANDARD_DEFAULT 90)
+ endif()
+ endif()
+endif()
+
+
+macro(cmake_record_c_compile_features)
+ macro(_get_gcc_features std_version list)
+ record_compiler_features(C "${std_version}" ${list})
+ endmacro()
+
+ set(_result 0)
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
+ _get_gcc_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
+ endif()
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+ if (_result EQUAL 0)
+ _get_gcc_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
+ endif()
+ if (_result EQUAL 0)
+ _get_gcc_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
new file mode 100644
index 000000000..d18adaff0
--- /dev/null
+++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
@@ -0,0 +1,109 @@
+
+# Reference: http://gcc.gnu.org/projects/cxx0x.html
+# http://gcc.gnu.org/projects/cxx1y.html
+
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404")
+
+set(GNU50_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L")
+set(_cmake_feature_test_cxx_variable_templates "${GNU50_CXX14}")
+set(_cmake_feature_test_cxx_relaxed_constexpr "${GNU50_CXX14}")
+set(_cmake_feature_test_cxx_aggregate_default_initializers "${GNU50_CXX14}")
+
+# GNU 4.9 in c++14 mode sets __cplusplus to 201300L, so don't test for the
+# correct value of it below.
+# https://patchwork.ozlabs.org/patch/382470/
+set(GNU49_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L")
+set(_cmake_feature_test_cxx_contextual_conversions "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_attribute_deprecated "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_decltype_auto "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_digit_separators "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_generic_lambdas "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_lambda_init_captures "${GNU49_CXX14}")
+# GNU 4.3 supports binary literals as an extension, but may warn about
+# use of extensions prior to GNU 4.9
+# http://stackoverflow.com/questions/16334024/difference-between-gcc-binary-literals-and-c14-ones
+set(_cmake_feature_test_cxx_binary_literals "${GNU49_CXX14}")
+# The feature below is documented as available in GNU 4.8 (by implementing an
+# earlier draft of the standard paper), but that version of the compiler
+# does not set __cplusplus to a value greater than 201103L until GNU 4.9:
+# http://gcc.gnu.org/onlinedocs/gcc-4.8.2/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros
+# http://gcc.gnu.org/onlinedocs/gcc-4.9.0/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros
+# So, CMake only reports availability for it with GNU 4.9 or later.
+set(_cmake_feature_test_cxx_return_type_deduction "${GNU49_CXX14}")
+
+# Introduced in GCC 4.8.1
+set(GNU481_CXX11 "((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${GNU481_CXX11}")
+set(_cmake_feature_test_cxx_reference_qualified_functions "${GNU481_CXX11}")
+set(GNU48_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_alignas "${GNU48_CXX11}")
+# The alignof feature works with GNU 4.7 and -std=c++11, but it is documented
+# as available with GNU 4.8, so treat that as true.
+set(_cmake_feature_test_cxx_alignof "${GNU48_CXX11}")
+set(_cmake_feature_test_cxx_attributes "${GNU48_CXX11}")
+set(_cmake_feature_test_cxx_inheriting_constructors "${GNU48_CXX11}")
+set(_cmake_feature_test_cxx_thread_local "${GNU48_CXX11}")
+set(GNU47_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_alias_templates "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_extended_friend_declarations "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_final "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_nonstatic_member_init "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_override "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}")
+# NOTE: C++11 was ratified in September 2011. GNU 4.7 is the first minor
+# release following that (March 2012), and the first minor release to
+# support -std=c++11. Prior to that, support for C++11 features is technically
+# experiemental and possibly incomplete (see for example the note below about
+# cxx_variadic_template_template_parameters)
+# GNU does not define __cplusplus correctly before version 4.7.
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773
+# __GXX_EXPERIMENTAL_CXX0X__ is defined in prior versions, but may not be
+# defined in the future.
+set(GNU_CXX0X_DEFINED "(__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))")
+set(GNU46_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_defaulted_move_initializers "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_enum_forward_declarations "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_noexcept "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_nullptr "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_range_for "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_unrestricted_unions "${GNU46_CXX11}")
+set(GNU45_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}")
+set(_cmake_feature_test_cxx_lambdas "${GNU45_CXX11}")
+set(_cmake_feature_test_cxx_local_type_template_args "${GNU45_CXX11}")
+set(_cmake_feature_test_cxx_raw_string_literals "${GNU45_CXX11}")
+set(GNU44_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_defaulted_functions "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_deleted_functions "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_generalized_initializers "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_inline_namespaces "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_sizeof_member "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_strong_enums "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_trailing_return_types "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_unicode_literals "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_uniform_initialization "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_variadic_templates "${GNU44_CXX11}")
+# TODO: If features are ever recorded for GNU 4.3, there should possibly
+# be a new feature added like cxx_variadic_template_template_parameters,
+# which is implemented by GNU 4.4, but not 4.3. cxx_variadic_templates is
+# actually implemented by GNU 4.3, but variadic template template parameters
+# 'completes' it, so that is the version we record as having the variadic
+# templates capability in CMake. See
+# http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf
+# TODO: Should be supported by GNU 4.3
+set(GNU43_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_decltype "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_default_function_template_args "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_long_long_type "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_right_angle_brackets "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_rvalue_references "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_static_assert "${GNU43_CXX11}")
+# TODO: Should be supported since GNU 3.4?
+set(_cmake_feature_test_cxx_extern_templates "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+# TODO: Should be supported forever?
+set(_cmake_feature_test_cxx_func_identifier "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_variadic_macros "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_template_template_parameters "${_cmake_oldestSupported} && __cplusplus")
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index 33d6093a1..e1c555b4b 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -10,3 +10,57 @@ else()
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
+ # Supported since 4.3
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+endif()
+
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
+ # 4.3 supports 0x variants
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
+endif()
+
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
+ if (NOT CMAKE_CXX_COMPILER_FORCED)
+ if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
+ elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
+ # Compiler id was forced so just guess the default standard level.
+ set(CMAKE_CXX_STANDARD_DEFAULT 98)
+ endif()
+endif()
+
+macro(cmake_record_cxx_compile_features)
+ macro(_get_gcc_features std_version list)
+ record_compiler_features(CXX "${std_version}" ${list})
+ endmacro()
+
+ set(_result 0)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
+ _get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
+ endif()
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
+ if (_result EQUAL 0)
+ _get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
+ endif()
+ if (_result EQUAL 0)
+ _get_gcc_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/Compiler/GNU-DetermineCompiler.cmake b/Modules/Compiler/GNU-DetermineCompiler.cmake
new file mode 100644
index 000000000..6ddc56698
--- /dev/null
+++ b/Modules/Compiler/GNU-DetermineCompiler.cmake
@@ -0,0 +1,11 @@
+
+set(_compiler_id_pp_test "defined(__GNUC__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GNUC__)
+# if defined(__GNUC_MINOR__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__)
+# endif
+# if defined(__GNUC_PATCHLEVEL__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__)
+# endif")
diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake
index 313ccbd02..e9c8a594a 100644
--- a/Modules/Compiler/GNU-Fortran.cmake
+++ b/Modules/Compiler/GNU-Fortran.cmake
@@ -8,10 +8,8 @@ set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os")
set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3")
-# We require updates to CMake C++ code to support preprocessing rules
-# for Fortran.
-set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE)
-set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE)
+# No -isystem for Fortran because it will not find .mod files.
+unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran)
# Fortran-specific feature flags.
set(CMAKE_Fortran_MODDIR_FLAG -J)
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 504704dad..764fbf990 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -30,6 +30,7 @@ macro(__compiler_gnu lang)
endif()
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "--sysroot=")
# Older versions of gcc (< 4.5) contain a bug causing them to report a missing
# header file as a warning if depfiles are enabled, causing check_header_file
@@ -49,8 +50,8 @@ macro(__compiler_gnu lang)
set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG")
- set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
- set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
if(NOT APPLE)
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
endif()
diff --git a/Modules/Compiler/HP-C-DetermineCompiler.cmake b/Modules/Compiler/HP-C-DetermineCompiler.cmake
new file mode 100644
index 000000000..426979990
--- /dev/null
+++ b/Modules/Compiler/HP-C-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__HP_cc)")
+
+set(_compiler_id_version_compute "
+ /* __HP_cc = VVRRPP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__HP_cc/10000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__HP_cc/100 % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__HP_cc % 100)")
diff --git a/Modules/Compiler/HP-C.cmake b/Modules/Compiler/HP-C.cmake
index 6dddcbae1..b42ba2be8 100644
--- a/Modules/Compiler/HP-C.cmake
+++ b/Modules/Compiler/HP-C.cmake
@@ -1,4 +1,4 @@
set(CMAKE_C_VERBOSE_FLAG "-v")
-set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
-set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
new file mode 100644
index 000000000..3d4d7e494
--- /dev/null
+++ b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__HP_aCC)")
+
+set(_compiler_id_version_compute "
+ /* __HP_aCC = VVRRPP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__HP_aCC/10000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__HP_aCC/100 % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__HP_aCC % 100)")
diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake
index 44470cae0..7548754d3 100644
--- a/Modules/Compiler/HP-CXX.cmake
+++ b/Modules/Compiler/HP-CXX.cmake
@@ -1,4 +1,13 @@
set(CMAKE_CXX_VERBOSE_FLAG "-v")
-set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
-set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+
+# HP aCC since version 3.80 supports the flag +hpxstd98 to get ANSI C++98
+# template support. It is known that version 6.25 doesn't need that flag.
+# Current assumption: the flag is needed for every version from 3.80 to 4
+# to get it working.
+if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4 AND
+ NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.80)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "+hpxstd98")
+endif()
diff --git a/Modules/Compiler/HP-Fortran.cmake b/Modules/Compiler/HP-Fortran.cmake
index cc56b4611..a6ca2c2b8 100644
--- a/Modules/Compiler/HP-Fortran.cmake
+++ b/Modules/Compiler/HP-Fortran.cmake
@@ -1,3 +1,6 @@
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "+source=fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "+source=free")
+
+set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake
index 66fb052df..844c30e50 100644
--- a/Modules/Compiler/IAR-ASM.cmake
+++ b/Modules/Compiler/IAR-ASM.cmake
@@ -2,7 +2,7 @@
include(Compiler/IAR)
-set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <SOURCE> <DEFINES> <FLAGS> -o <OBJECT>")
+set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM")
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa)
diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake
index da29447c4..d2c7df9ed 100644
--- a/Modules/Compiler/IAR-C.cmake
+++ b/Modules/Compiler/IAR-C.cmake
@@ -3,9 +3,9 @@
include(Compiler/IAR)
-set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <FLAGS> -o <OBJECT>")
-set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>")
-set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy")
+set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
+set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>")
+set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy")
# The toolchains for ARM and AVR are quite different:
if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM")
diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake
index eae9d1b77..03ecdf1d8 100644
--- a/Modules/Compiler/IAR-CXX.cmake
+++ b/Modules/Compiler/IAR-CXX.cmake
@@ -2,10 +2,10 @@
include(Compiler/IAR)
-set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <FLAGS> -o <OBJECT>")
+set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
-set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>")
-set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy")
+set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> --preprocess=cnl <PREPROCESSED_SOURCE>")
+set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy")
diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake
new file mode 100644
index 000000000..c39810a24
--- /dev/null
+++ b/Modules/Compiler/IAR-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+# IAR Systems compiler for embedded systems.
+# http://www.iar.com
+set(_compiler_id_pp_test "defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)")
diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake
index 00e47133c..8c6c3f600 100644
--- a/Modules/Compiler/IAR.cmake
+++ b/Modules/Compiler/IAR.cmake
@@ -1,6 +1,6 @@
# This file is processed when the IAR compiler is used for a C or C++ file
# Documentation can be downloaded here: http://www.iar.com/website1/1.0.1.0/675/1/
-# The initial feature request is here: http://www.cmake.org/Bug/view.php?id=10176
+# The initial feature request is here: https://cmake.org/Bug/view.php?id=10176
# It also contains additional links and information.
if(_IAR_CMAKE_LOADED)
@@ -39,7 +39,7 @@ endif()
if(NOT IAR_TARGET_ARCHITECTURE)
message(FATAL_ERROR "The IAR compiler for this architecture is not yet supported "
- " by CMake. Please go to http://www.cmake.org/Bug and enter a feature request there.")
+ " by CMake. Please go to https://cmake.org/Bug and enter a feature request there.")
endif()
set(CMAKE_LINKER "${CMAKE_IAR_LINKER}" CACHE FILEPATH "The IAR linker" FORCE)
diff --git a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
new file mode 100644
index 000000000..899e284ad
--- /dev/null
+++ b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
@@ -0,0 +1,6 @@
+
+set(_compiler_id_version_compute "
+ /* __IBMC__ = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMC__/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMC__/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMC__ % 10)")
diff --git a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
new file mode 100644
index 000000000..73aa2b4f9
--- /dev/null
+++ b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
@@ -0,0 +1,6 @@
+
+set(_compiler_id_version_compute "
+ /* __IBMCPP__ = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMCPP__/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMCPP__/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMCPP__ % 10)")
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index 5b43db9f4..dfba4b2ce 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -6,9 +6,7 @@ set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG")
-if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0)
- set(CMAKE_C_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
-endif()
+set(CMAKE_DEPFILE_FLAGS_C "-MMD -MT <OBJECT> -MF <DEPFILE>")
-set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
-set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+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> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 35bb3ec04..794769527 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -6,9 +6,7 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG")
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0)
- set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
-endif()
+set(CMAKE_DEPFILE_FLAGS_CXX "-MMD -MT <OBJECT> -MF <DEPFILE>")
-set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
-set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/Intel-DetermineCompiler.cmake b/Modules/Compiler/Intel-DetermineCompiler.cmake
new file mode 100644
index 000000000..d7e453211
--- /dev/null
+++ b/Modules/Compiler/Intel-DetermineCompiler.cmake
@@ -0,0 +1,26 @@
+
+set(_compiler_id_pp_test "defined(__INTEL_COMPILER) || defined(__ICC)")
+
+set(_compiler_id_version_compute "
+ /* __INTEL_COMPILER = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEL_COMPILER/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEL_COMPILER/10 % 10)
+# if defined(__INTEL_COMPILER_UPDATE)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER_UPDATE)
+# else
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER % 10)
+# endif
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+ /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__INTEL_COMPILER_BUILD_DATE)
+# endif
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+# endif")
+
+set(_compiler_id_simulate "
+# if defined(_MSC_VER)
+# define @PREFIX@SIMULATE_ID \"MSVC\"
+# endif")
diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake
index 84f6182a7..671d284dd 100644
--- a/Modules/Compiler/Intel-Fortran.cmake
+++ b/Modules/Compiler/Intel-Fortran.cmake
@@ -7,3 +7,6 @@ set(CMAKE_Fortran_MODDIR_FLAG "-module ")
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
+
+set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake
new file mode 100644
index 000000000..9e485532b
--- /dev/null
+++ b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake
@@ -0,0 +1,15 @@
+
+set(_compiler_id_pp_test "defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)")
+
+set(_compiler_id_version_compute "
+# if defined(_SGI_COMPILER_VERSION)
+ /* _SGI_COMPILER_VERSION = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_SGI_COMPILER_VERSION/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_SGI_COMPILER_VERSION/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_SGI_COMPILER_VERSION % 10)
+# else
+ /* _COMPILER_VERSION = VRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_COMPILER_VERSION/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_COMPILER_VERSION/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_COMPILER_VERSION % 10)
+# endif")
diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
new file mode 100644
index 000000000..ad1d14bd0
--- /dev/null
+++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake
@@ -0,0 +1,111 @@
+
+# Reference: http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx
+# http://blogs.msdn.com/b/vcblog/archive/2013/06/28/c-11-14-stl-features-fixes-and-breaking-changes-in-vs-2013.aspx
+# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
+# http://www.visualstudio.com/en-us/news/vs2015-preview-vs.aspx
+# http://blogs.msdn.com/b/vcblog/archive/2015/04/29/c-11-14-17-features-in-vs-2015-rc.aspx
+# http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
+
+
+set(_cmake_oldestSupported "_MSC_VER >= 1600")
+
+set(MSVC_2015 "_MSC_VER >= 1900")
+set(_cmake_feature_test_cxx_alignas "${MSVC_2015}")
+set(_cmake_feature_test_cxx_alignof "${MSVC_2015}")
+set(_cmake_feature_test_cxx_attributes "${MSVC_2015}")
+set(_cmake_feature_test_cxx_attribute_deprecated "${MSVC_2015}")
+set(_cmake_feature_test_cxx_binary_literals "${MSVC_2015}")
+set(_cmake_feature_test_cxx_constexpr "${MSVC_2015}")
+set(_cmake_feature_test_cxx_decltype_auto "${MSVC_2015}")
+set(_cmake_feature_test_cxx_digit_separators "${MSVC_2015}")
+set(_cmake_feature_test_cxx_func_identifier "${MSVC_2015}")
+set(_cmake_feature_test_cxx_nonstatic_member_init "${MSVC_2015}")
+# Microsoft calls this 'rvalue references v3'
+set(_cmake_feature_test_cxx_defaulted_move_initializers "${MSVC_2015}")
+set(_cmake_feature_test_cxx_generic_lambdas "${MSVC_2015}")
+set(_cmake_feature_test_cxx_inheriting_constructors "${MSVC_2015}")
+set(_cmake_feature_test_cxx_inline_namespaces "${MSVC_2015}")
+set(_cmake_feature_test_cxx_lambda_init_captures "${MSVC_2015}")
+set(_cmake_feature_test_cxx_noexcept "${MSVC_2015}")
+set(_cmake_feature_test_cxx_return_type_deduction "${MSVC_2015}")
+set(_cmake_feature_test_cxx_sizeof_member "${MSVC_2015}")
+set(_cmake_feature_test_cxx_thread_local "${MSVC_2015}")
+set(_cmake_feature_test_cxx_unicode_literals "${MSVC_2015}")
+set(_cmake_feature_test_cxx_unrestricted_unions "${MSVC_2015}")
+set(_cmake_feature_test_cxx_user_literals "${MSVC_2015}")
+set(_cmake_feature_test_cxx_reference_qualified_functions "${MSVC_2015}")
+# "The copies and moves don't interact precisely like the Standard says they
+# should. For example, deletion of moves is specified to also suppress
+# copies, but Visual C++ in Visual Studio 2013 does not."
+# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
+# lists this as 'partial' in 2013
+set(_cmake_feature_test_cxx_deleted_functions "${MSVC_2015}")
+
+set(MSVC_2013_v30723 "_MSC_FULL_VER >= 180030723")
+# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
+# Note 1. While previous version of VisualStudio said they supported these
+# they silently produced bad code, and are now marked as having partial
+# support in previous versions. The footnote says the support will be complete
+# in MSVC 2015, so support the feature for that version, assuming that is true.
+# The blog post also says that VS 2013 Update 3 generates an error in cases
+# that previously produced bad code.
+set(_cmake_feature_test_cxx_generalized_initializers "${MSVC_2013_v30723}")
+
+set(MSVC_2013 "_MSC_VER >= 1800")
+set(_cmake_feature_test_cxx_alias_templates "${MSVC_2013}")
+# Microsoft now states they support contextual conversions in 2013 and above.
+# See footnote 6 at:
+# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx
+set(_cmake_feature_test_cxx_contextual_conversions "${MSVC_2013}")
+set(_cmake_feature_test_cxx_default_function_template_args "${MSVC_2013}")
+set(_cmake_feature_test_cxx_defaulted_functions "${MSVC_2013}")
+set(_cmake_feature_test_cxx_delegating_constructors "${MSVC_2013}")
+set(_cmake_feature_test_cxx_explicit_conversions "${MSVC_2013}")
+set(_cmake_feature_test_cxx_raw_string_literals "${MSVC_2013}")
+set(_cmake_feature_test_cxx_uniform_initialization "${MSVC_2013}")
+# Support is documented, but possibly partly broken:
+# https://msdn.microsoft.com/en-us/library/hh567368.aspx
+# http://thread.gmane.org/gmane.comp.lib.boost.devel/244986/focus=245333
+set(_cmake_feature_test_cxx_variadic_templates "${MSVC_2013}")
+
+set(MSVC_2012 "_MSC_VER >= 1700")
+set(_cmake_feature_test_cxx_enum_forward_declarations "${MSVC_2012}")
+set(_cmake_feature_test_cxx_final "${MSVC_2012}")
+set(_cmake_feature_test_cxx_range_for "${MSVC_2012}")
+set(_cmake_feature_test_cxx_strong_enums "${MSVC_2012}")
+
+set(MSVC_2010 "_MSC_VER >= 1600")
+set(_cmake_feature_test_cxx_auto_type "${MSVC_2010}")
+set(_cmake_feature_test_cxx_decltype "${MSVC_2010}")
+set(_cmake_feature_test_cxx_extended_friend_declarations "${MSVC_2010}")
+set(_cmake_feature_test_cxx_extern_templates "${MSVC_2010}")
+set(_cmake_feature_test_cxx_lambdas "${MSVC_2010}")
+set(_cmake_feature_test_cxx_local_type_template_args "${MSVC_2010}")
+set(_cmake_feature_test_cxx_long_long_type "${MSVC_2010}")
+set(_cmake_feature_test_cxx_nullptr "${MSVC_2010}")
+set(_cmake_feature_test_cxx_override "${MSVC_2010}")
+set(_cmake_feature_test_cxx_right_angle_brackets "${MSVC_2010}")
+set(_cmake_feature_test_cxx_rvalue_references "${MSVC_2010}")
+set(_cmake_feature_test_cxx_static_assert "${MSVC_2010}")
+set(_cmake_feature_test_cxx_template_template_parameters "${MSVC_2010}")
+set(_cmake_feature_test_cxx_trailing_return_types "${MSVC_2010}")
+set(_cmake_feature_test_cxx_variadic_macros "${MSVC_2010}")
+
+# Currently unsupported:
+# set(_cmake_feature_test_cxx_relaxed_constexpr )
+# 'NSDMIs for aggregates'
+# set(_cmake_feature_test_cxx_aggregate_default_initializers )
+# set(_cmake_feature_test_cxx_variable_templates )
+
+# In theory decltype incomplete return types was added in 2012
+# but without support for decltype_auto and return type deduction this
+# feature is unusable. This remains so as of VS 2015 Preview.
+# set(_cmake_feature_test_cxx_decltype_incomplete_return_types )
+
+# Unset all the variables that we don't need exposed.
+# _cmake_oldestSupported is required by WriteCompilerDetectionHeader
+set(MSVC_2015)
+set(MSVC_2013_v30723)
+set(MSVC_2013)
+set(MSVC_2012)
+set(MSVC_2010)
diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
new file mode 100644
index 000000000..82ce06989
--- /dev/null
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -0,0 +1,9 @@
+
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
+ # MSVC has no specific language level or flags to change it.
+ set(CMAKE_CXX_STANDARD_DEFAULT "")
+endif()
+
+macro(cmake_record_cxx_compile_features)
+ record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
+endmacro()
diff --git a/Modules/Compiler/MSVC-DetermineCompiler.cmake b/Modules/Compiler/MSVC-DetermineCompiler.cmake
new file mode 100644
index 000000000..313de89fa
--- /dev/null
+++ b/Modules/Compiler/MSVC-DetermineCompiler.cmake
@@ -0,0 +1,19 @@
+
+set(_compiler_id_pp_test "defined(_MSC_VER)")
+
+set(_compiler_id_version_compute "
+ /* _MSC_VER = VVRR */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+# if defined(_MSC_FULL_VER)
+# if _MSC_VER >= 1400
+ /* _MSC_FULL_VER = VVRRPPPPP */
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_MSC_FULL_VER % 100000)
+# else
+ /* _MSC_FULL_VER = VVRRPPPP */
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_MSC_FULL_VER % 10000)
+# endif
+# endif
+# if defined(_MSC_BUILD)
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(_MSC_BUILD)
+# endif")
diff --git a/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake
new file mode 100644
index 000000000..2ed116c09
--- /dev/null
+++ b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake
@@ -0,0 +1,10 @@
+
+set(_compiler_id_pp_test "defined(__WATCOMC__)")
+
+set(_compiler_id_version_compute "
+ /* __WATCOMC__ = VVRP + 1100 */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__WATCOMC__ - 1100) / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__WATCOMC__ % 10)
+# endif")
diff --git a/Modules/Compiler/PGI-DetermineCompiler.cmake b/Modules/Compiler/PGI-DetermineCompiler.cmake
new file mode 100644
index 000000000..8d3dc9ca6
--- /dev/null
+++ b/Modules/Compiler/PGI-DetermineCompiler.cmake
@@ -0,0 +1,9 @@
+
+set(_compiler_id_pp_test "defined(__PGI)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__PGIC__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__PGIC_MINOR__)
+# if defined(__PGIC_PATCHLEVEL__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__PGIC_PATCHLEVEL__)
+# endif")
diff --git a/Modules/Compiler/PGI-Fortran.cmake b/Modules/Compiler/PGI-Fortran.cmake
index 264c23e74..2866254fe 100644
--- a/Modules/Compiler/PGI-Fortran.cmake
+++ b/Modules/Compiler/PGI-Fortran.cmake
@@ -7,9 +7,4 @@ set(CMAKE_Fortran_FORMAT_FREE_FLAG "-Mfreeform")
set(CMAKE_Fortran_FLAGS_INIT "${CMAKE_Fortran_FLAGS_INIT} -Mpreprocess -Kieee")
set(CMAKE_Fortran_FLAGS_DEBUG_INIT "${CMAKE_Fortran_FLAGS_DEBUG_INIT} -Mbounds")
-# We require updates to CMake C++ code to support preprocessing rules
-# for Fortran.
-set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE)
-set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE)
-
set(CMAKE_Fortran_MODDIR_FLAG "-module ")
diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake
index 162e3c9b8..797945f9a 100644
--- a/Modules/Compiler/PGI.cmake
+++ b/Modules/Compiler/PGI.cmake
@@ -30,6 +30,6 @@ macro(__compiler_pgi lang)
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -gopt")
# Preprocessing and assembly rules.
- set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
- set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
endmacro()
diff --git a/Modules/Compiler/PathScale-DetermineCompiler.cmake b/Modules/Compiler/PathScale-DetermineCompiler.cmake
new file mode 100644
index 000000000..4eb81dec7
--- /dev/null
+++ b/Modules/Compiler/PathScale-DetermineCompiler.cmake
@@ -0,0 +1,9 @@
+
+set(_compiler_id_pp_test "defined(__PATHCC__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__PATHCC__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__PATHCC_MINOR__)
+# if defined(__PATHCC_PATCHLEVEL__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__PATHCC_PATCHLEVEL__)
+# endif")
diff --git a/Modules/Compiler/QCC-C.cmake b/Modules/Compiler/QCC-C.cmake
new file mode 100644
index 000000000..ae4a2f491
--- /dev/null
+++ b/Modules/Compiler/QCC-C.cmake
@@ -0,0 +1,2 @@
+include(Compiler/QCC)
+__compiler_qcc(C)
diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake
new file mode 100644
index 000000000..e86d1fa47
--- /dev/null
+++ b/Modules/Compiler/QCC-CXX.cmake
@@ -0,0 +1,12 @@
+include(Compiler/QCC)
+__compiler_qcc(CXX)
+
+# If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the
+# default for the driver is not c++.
+set(CMAKE_CXX_COMPILE_OBJECT
+ "<CMAKE_CXX_COMPILER> -lang-c++ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+
+set(CMAKE_CXX_LINK_EXECUTABLE
+ "<CMAKE_CXX_COMPILER> -lang-c++ <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+
+set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
diff --git a/Modules/CMakeVS6FindMake.cmake b/Modules/Compiler/QCC.cmake
index 40bf5b172..76477e4bb 100644
--- a/Modules/CMakeVS6FindMake.cmake
+++ b/Modules/Compiler/QCC.cmake
@@ -1,6 +1,6 @@
#=============================================================================
-# Copyright 2002-2009 Kitware, Inc.
+# Copyright 2002-2014 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -11,15 +11,14 @@
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+include(Compiler/GNU)
-find_program(CMAKE_MAKE_PROGRAM
- NAMES msdev
- PATHS
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup;VsCommonDir]/MSDev98/Bin
- "c:/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin"
- "c:/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin"
- "/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin"
- )
-mark_as_advanced(CMAKE_MAKE_PROGRAM)
-set(MSVC60 1)
-set(MSVC_VERSION 1200)
+macro(__compiler_qcc lang)
+ __compiler_gnu(${lang})
+
+ # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples
+ set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V")
+
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,<DEPFILE>,-MT,<OBJECT>,-MF,<DEPFILE>")
+endmacro()
diff --git a/Modules/Compiler/SCO-DetermineCompiler.cmake b/Modules/Compiler/SCO-DetermineCompiler.cmake
new file mode 100644
index 000000000..a44b22b71
--- /dev/null
+++ b/Modules/Compiler/SCO-DetermineCompiler.cmake
@@ -0,0 +1,2 @@
+
+set(_compiler_id_pp_test "defined(__SCO_VERSION__)")
diff --git a/Modules/Compiler/SDCC-C-DetermineCompiler.cmake b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake
new file mode 100644
index 000000000..1d7dd78d8
--- /dev/null
+++ b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake
@@ -0,0 +1,10 @@
+
+# sdcc, the small devices C compiler for embedded systems,
+# http://sdcc.sourceforge.net */
+set(_compiler_id_pp_test "defined(SDCC)")
+
+set(_compiler_id_version_compute "
+ /* SDCC = VRP */
+# define COMPILER_VERSION_MAJOR @MACRO_DEC@(SDCC/100)
+# define COMPILER_VERSION_MINOR @MACRO_DEC@(SDCC/10 % 10)
+# define COMPILER_VERSION_PATCH @MACRO_DEC@(SDCC % 10)")
diff --git a/Modules/Compiler/SunPro-C-DetermineCompiler.cmake b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake
new file mode 100644
index 000000000..e9d7457e7
--- /dev/null
+++ b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake
@@ -0,0 +1,15 @@
+
+set(_compiler_id_pp_test "defined(__SUNPRO_C)")
+
+set(_compiler_id_version_compute "
+# if __SUNPRO_C >= 0x5100
+ /* __SUNPRO_C = 0xVRRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_C>>12)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_C>>4 & 0xFF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_C & 0xF)
+# else
+ /* __SUNPRO_CC = 0xVRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_C>>8)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_C>>4 & 0xF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_C & 0xF)
+# endif")
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index c5b5203fd..c4529833d 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -1,7 +1,6 @@
set(CMAKE_C_VERBOSE_FLAG "-#")
set(CMAKE_C_COMPILE_OPTIONS_PIC -KPIC)
-set(CMAKE_C_COMPILE_OPTIONS_PIE -KPIE)
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R")
@@ -23,5 +22,5 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic")
endforeach()
-set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
-set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+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> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
new file mode 100644
index 000000000..5c23a957e
--- /dev/null
+++ b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
@@ -0,0 +1,15 @@
+
+set(_compiler_id_pp_test "defined(__SUNPRO_CC)")
+
+set(_compiler_id_version_compute "
+# if __SUNPRO_CC >= 0x5100
+ /* __SUNPRO_CC = 0xVRRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_CC>>12)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_CC>>4 & 0xFF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_CC & 0xF)
+# else
+ /* __SUNPRO_CC = 0xVRP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_CC>>8)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_CC>>4 & 0xF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_CC & 0xF)
+# endif")
diff --git a/Modules/Compiler/SunPro-CXX-FeatureTests.cmake b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake
new file mode 100644
index 000000000..8e97e1d05
--- /dev/null
+++ b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake
@@ -0,0 +1,52 @@
+
+# Based on GNU 4.8.2
+# http://docs.oracle.com/cd/E37069_01/html/E37071/gncix.html
+# Reference: http://gcc.gnu.org/projects/cxx0x.html
+
+set(_cmake_oldestSupported "__SUNPRO_CC >= 0x5130")
+
+set(SolarisStudio124_CXX11 "(__SUNPRO_CC >= 0x5130) && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_alignas "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_alignof "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_attributes "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_inheriting_constructors "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_thread_local "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_alias_templates "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_delegating_constructors "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_extended_friend_declarations "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_final "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_noexcept "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_nonstatic_member_init "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_override "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_constexpr "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_defaulted_move_initializers "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_enum_forward_declarations "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_nullptr "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_range_for "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_unrestricted_unions "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_explicit_conversions "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_lambdas "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_local_type_template_args "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_raw_string_literals "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_auto_type "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_defaulted_functions "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_deleted_functions "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_generalized_initializers "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_inline_namespaces "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_sizeof_member "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_strong_enums "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_trailing_return_types "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_unicode_literals "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_uniform_initialization "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_variadic_templates "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_decltype "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_default_function_template_args "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_long_long_type "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_right_angle_brackets "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_rvalue_references "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_static_assert "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_extern_templates "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_func_identifier "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_variadic_macros "${SolarisStudio124_CXX11}")
+
+set(_cmake_feature_test_cxx_template_template_parameters "${_cmake_oldestSupported} && __cplusplus")
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index 59687129a..b4a5591b4 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -1,7 +1,6 @@
set(CMAKE_CXX_VERBOSE_FLAG "-v")
set(CMAKE_CXX_COMPILE_OPTIONS_PIC -KPIC)
-set(CMAKE_CXX_COMPILE_OPTIONS_PIE -KPIE)
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G")
set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R")
@@ -23,11 +22,42 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic")
endforeach()
-set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
-set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+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> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
# Create archives with "CC -xar" in case user adds "-instances=extern"
# so that template instantiations are available to archive members.
set(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_CXX_COMPILER> -xar -o <TARGET> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET> ")
+
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
+ if (NOT CMAKE_CXX_COMPILER_FORCED)
+ if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
+ elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
+ # Compiler id was forced so just guess the default standard level.
+ set(CMAKE_CXX_STANDARD_DEFAULT 98)
+ endif()
+endif()
+
+macro(cmake_record_cxx_compile_features)
+ macro(_get_solaris_studio_features std_version list)
+ record_compiler_features(CXX "${std_version}" ${list})
+ endmacro()
+
+ set(_result 0)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
+ _get_solaris_studio_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
+ if (_result EQUAL 0)
+ _get_solaris_studio_features("" CMAKE_CXX98_COMPILE_FEATURES)
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake
index 18e75b9e3..610e19176 100644
--- a/Modules/Compiler/SunPro-Fortran.cmake
+++ b/Modules/Compiler/SunPro-Fortran.cmake
@@ -2,6 +2,7 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-KPIC")
set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G")
set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R")
@@ -16,3 +17,6 @@ set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG")
set(CMAKE_Fortran_MODDIR_FLAG "-moddir=")
set(CMAKE_Fortran_MODPATH_FLAG "-M")
+
+set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F <SOURCE> -o <PREPROCESSED_SOURCE>")
+set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/TI-ASM.cmake b/Modules/Compiler/TI-ASM.cmake
index e097626b6..a566d70e1 100644
--- a/Modules/Compiler/TI-ASM.cmake
+++ b/Modules/Compiler/TI-ASM.cmake
@@ -2,7 +2,7 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
set(CMAKE_LINK_LIBRARY_FLAG "--library=")
set(CMAKE_INCLUDE_FLAG_ASM "--include_path=")
-set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --compile_only --asm_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<OBJECT>")
+set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --compile_only --asm_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<OBJECT>")
set(CMAKE_ASM_LINK_EXECUTABLE "<CMAKE_ASM_COMPILER> <OBJECTS> --run_linker --output_file=<TARGET> <CMAKE_ASM_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>")
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm;s;abs)
diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake
index b5809942e..479666c72 100644
--- a/Modules/Compiler/TI-C.cmake
+++ b/Modules/Compiler/TI-C.cmake
@@ -2,9 +2,9 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
set(CMAKE_LINK_LIBRARY_FLAG "--library=")
set(CMAKE_INCLUDE_FLAG_C "--include_path=")
-set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> --compile_only --skip_assembler --c_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
-set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> --preproc_only --c_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
+set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> --compile_only --skip_assembler --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
+set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> --preproc_only --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
-set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> --compile_only --c_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<OBJECT>")
+set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> --compile_only --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<OBJECT>")
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -r <TARGET> <OBJECTS>")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_C_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>")
diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake
index 8cf5ac37e..4104c3b18 100644
--- a/Modules/Compiler/TI-CXX.cmake
+++ b/Modules/Compiler/TI-CXX.cmake
@@ -2,9 +2,9 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
set(CMAKE_LINK_LIBRARY_FLAG "--library=")
set(CMAKE_INCLUDE_FLAG_CXX "--include_path=")
-set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> --compile_only --skip_assembler --cpp_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
-set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> --preproc_only --cpp_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
+set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> --compile_only --skip_assembler --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
+set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> --preproc_only --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
-set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> --compile_only --cpp_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<OBJECT>")
+set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> --compile_only --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<OBJECT>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> -r <TARGET> <OBJECTS>")
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_CXX_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>")
diff --git a/Modules/Compiler/TI-DetermineCompiler.cmake b/Modules/Compiler/TI-DetermineCompiler.cmake
new file mode 100644
index 000000000..19aa9e3d4
--- /dev/null
+++ b/Modules/Compiler/TI-DetermineCompiler.cmake
@@ -0,0 +1,8 @@
+
+set(_compiler_id_pp_test "defined(__TI_COMPILER_VERSION__)")
+
+set(_compiler_id_version_compute "
+ /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__TI_COMPILER_VERSION__/1000000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__TI_COMPILER_VERSION__/1000 % 1000)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__TI_COMPILER_VERSION__ % 1000)")
diff --git a/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake b/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake
new file mode 100644
index 000000000..8d6de7e44
--- /dev/null
+++ b/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake
@@ -0,0 +1,2 @@
+
+set(_compiler_id_pp_test "defined(__TINYC__)")
diff --git a/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake b/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake
new file mode 100644
index 000000000..97c226313
--- /dev/null
+++ b/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake b/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake
new file mode 100644
index 000000000..cd5349968
--- /dev/null
+++ b/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/Watcom-DetermineCompiler.cmake b/Modules/Compiler/Watcom-DetermineCompiler.cmake
new file mode 100644
index 000000000..153e350db
--- /dev/null
+++ b/Modules/Compiler/Watcom-DetermineCompiler.cmake
@@ -0,0 +1,10 @@
+
+set(_compiler_id_pp_test "defined(__WATCOMC__) && __WATCOMC__ < 1200")
+
+set(_compiler_id_version_compute "
+ /* __WATCOMC__ = VVRR */
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__WATCOMC__ / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__WATCOMC__ % 10)
+# endif")
diff --git a/Modules/Compiler/XL-ASM.cmake b/Modules/Compiler/XL-ASM.cmake
index 07507f9be..212179e34 100644
--- a/Modules/Compiler/XL-ASM.cmake
+++ b/Modules/Compiler/XL-ASM.cmake
@@ -1,9 +1,8 @@
set(CMAKE_ASM_VERBOSE_FLAG "-V")
# -qthreaded = Ensures that all optimizations will be thread-safe
-# -qalias=noansi = Turns off type-based aliasing completely (safer optimizer)
# -qhalt=e = Halt on error messages (rather than just severe errors)
-set(CMAKE_ASM_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e -qsourcetype=assembler")
+set(CMAKE_ASM_FLAGS_INIT "-qthreaded -qhalt=e -qsourcetype=assembler")
set(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
set(CMAKE_ASM_FLAGS_RELEASE_INIT "-O -DNDEBUG")
diff --git a/Modules/Compiler/XL-C-DetermineCompiler.cmake b/Modules/Compiler/XL-C-DetermineCompiler.cmake
new file mode 100644
index 000000000..3f4e05c55
--- /dev/null
+++ b/Modules/Compiler/XL-C-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake
index 09a55291e..97dd01789 100644
--- a/Modules/Compiler/XL-C.cmake
+++ b/Modules/Compiler/XL-C.cmake
@@ -4,6 +4,5 @@ set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG")
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
# -qthreaded = Ensures that all optimizations will be thread-safe
-# -qalias=noansi = Turns off type-based aliasing completely (safer optimizer)
# -qhalt=e = Halt on error messages (rather than just severe errors)
-set(CMAKE_C_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e")
+set(CMAKE_C_FLAGS_INIT "-qthreaded -qhalt=e")
diff --git a/Modules/Compiler/XL-CXX-DetermineCompiler.cmake b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake
new file mode 100644
index 000000000..dffa4bc21
--- /dev/null
+++ b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake
index 6c842cd77..41372c15b 100644
--- a/Modules/Compiler/XL-CXX.cmake
+++ b/Modules/Compiler/XL-CXX.cmake
@@ -8,4 +8,4 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG
set(CMAKE_CXX_FLAGS_INIT "-qthreaded -qhalt=e")
set(CMAKE_CXX_COMPILE_OBJECT
- "<CMAKE_CXX_COMPILER> -+ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+ "<CMAKE_CXX_COMPILER> -+ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake
index f1c9158b2..ae9df4e4b 100644
--- a/Modules/Compiler/XL-Fortran.cmake
+++ b/Modules/Compiler/XL-Fortran.cmake
@@ -12,6 +12,6 @@ set(CMAKE_Fortran_DEFINE_FLAG "-WF,-D")
# -qhalt=e = Halt on error messages (rather than just severe errors)
set(CMAKE_Fortran_FLAGS_INIT "-qthreaded -qhalt=e")
-# We require updates to CMake C++ code to support preprocessing rules for Fortran.
+# xlf: 1501-214 (W) command option E reserved for future use - ignored
set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE)
set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE)
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake
index 7bf5020ac..bf4f5541c 100644
--- a/Modules/Compiler/XL.cmake
+++ b/Modules/Compiler/XL.cmake
@@ -33,8 +33,8 @@ macro(__compiler_xl lang)
set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O")
set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O")
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-g")
- set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
- set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
# CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones.
# If we found the tool, we'll use it to create exports, otherwise stick with the regular
diff --git a/Modules/Compiler/zOS-C-DetermineCompiler.cmake b/Modules/Compiler/zOS-C-DetermineCompiler.cmake
new file mode 100644
index 000000000..daa378198
--- /dev/null
+++ b/Modules/Compiler/zOS-C-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMC__) && defined(__COMPILER_VER__)")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake")
diff --git a/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake b/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake
new file mode 100644
index 000000000..a08ff5713
--- /dev/null
+++ b/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake
@@ -0,0 +1,4 @@
+
+set(_compiler_id_pp_test "defined(__IBMCPP__) && defined(__COMPILER_VER__)")
+
+include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
index 1a7a53942..2870a11ca 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -10,6 +10,10 @@
<ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
<RootNamespace>CompilerId@id_lang@</RootNamespace>
<Keyword>Win32Proj</Keyword>
+ @id_system@
+ @id_system_version@
+ @id_WindowsTargetPlatformVersion@
+ @id_WindowsSDKDesktopARMSupport@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
diff --git a/Modules/CompilerId/VS-Intel.vfproj.in b/Modules/CompilerId/VS-Intel.vfproj.in
new file mode 100644
index 000000000..044dd202d
--- /dev/null
+++ b/Modules/CompilerId/VS-Intel.vfproj.in
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VisualStudioProject
+ ProjectCreator="Intel Fortran"
+ Keyword="Console Application"
+ Version="@CMAKE_VS_INTEL_Fortran_PROJECT_VERSION@"
+ ProjectIdGuid="{AB67BAB7-D7AE-4E97-B492-FE5420447509}"
+ >
+ <Platforms>
+ <Platform Name="@id_platform@"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|@id_platform@"
+ OutputDirectory="."
+ IntermediateDirectory="$(ConfigurationName)"
+ >
+ <Tool
+ Name="VFFortranCompilerTool"
+ DebugInformationFormat="debugEnabled"
+ Optimization="optimizeDisabled"
+ Preprocess="preprocessYes"
+ RuntimeLibrary="rtMultiThreadedDebugDLL"
+ />
+ <Tool
+ Name="VFLinkerTool"
+ LinkIncremental="linkIncrementalNo"
+ GenerateDebugInformation="true"
+ SubSystem="subSystemConsole"
+ />
+ <Tool
+ Name="VFPostBuildEventTool"
+ CommandLine="for %%i in (@id_cl@) do @echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i"
+ />
+ </Configuration>
+ </Configurations>
+ <Files>
+ <Filter Name="Source Files" Filter="F">
+ <File RelativePath="@id_src@"/>
+ </Filter>
+ </Files>
+ <Globals/>
+</VisualStudioProject>
diff --git a/Modules/CompilerId/VS-NsightTegra.vcxproj.in b/Modules/CompilerId/VS-NsightTegra.vcxproj.in
new file mode 100644
index 000000000..b7389ebab
--- /dev/null
+++ b/Modules/CompilerId/VS-NsightTegra.vcxproj.in
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Label="NsightTegraProject">
+ <NsightTegraProjectRevisionNumber>6</NsightTegraProjectRevisionNumber>
+ </PropertyGroup>
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|@id_platform@">
+ <Configuration>Debug</Configuration>
+ <Platform>@id_platform@</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
+ <RootNamespace>CompilerId@id_lang@</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ @id_toolset@
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">.\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">
+ <ClCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ </Link>
+ <PostBuildEvent>
+ <Command>
+if "$(ToolchainName)"=="gcc" (
+ for %%i in ($(ToolchainPrebuiltRoot)\bin\*@id_gcc@.exe) do (
+ @echo CMAKE_@id_lang@_COMPILER=%%i
+ goto :done
+ )
+)
+if "$(ToolchainName)"=="clang" (
+ for %%i in ($(ToolchainPrebuiltRoot)\bin\*@id_clang@.exe) do (
+ @echo CMAKE_@id_lang@_COMPILER=%%i
+ goto :done
+ )
+)
+:done
+</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="@id_src@" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+</Project>
diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in
index 6f861ebf4..20f3da312 100644
--- a/Modules/CompilerId/Xcode-3.pbxproj.in
+++ b/Modules/CompilerId/Xcode-3.pbxproj.in
@@ -29,7 +29,7 @@
);
name = CompilerId@id_lang@;
productName = CompilerId@id_lang@;
- productType = "com.apple.product-type.tool";
+ productType = "@id_product_type@";
};
08FB7793FE84155DC02AAC07 = {
isa = PBXProject;
@@ -79,11 +79,13 @@
1DEB928A08733DD80010E9CD = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
ONLY_ACTIVE_ARCH = YES;
+ CODE_SIGNING_REQUIRED = NO;
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
SYMROOT = .;
@id_toolset@
+ @id_deployment_target@
+ @id_sdkroot@
};
name = Debug;
};
diff --git a/Modules/CompilerId/main.swift.in b/Modules/CompilerId/main.swift.in
new file mode 100644
index 000000000..13f0ba037
--- /dev/null
+++ b/Modules/CompilerId/main.swift.in
@@ -0,0 +1 @@
+print("CMakeSwiftCompilerId")
diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake
index bd744b003..db487d8f5 100644
--- a/Modules/Dart.cmake
+++ b/Modules/Dart.cmake
@@ -1,12 +1,22 @@
-# - Configure a project for testing with CTest or old Dart Tcl Client
+#.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()
+# 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.
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index 9e49ac776..2da835427 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -37,6 +37,9 @@ ConfigureCommand: "@CMAKE_COMMAND@" "@PROJECT_SOURCE_DIR@"
MakeCommand: @MAKECOMMAND@
DefaultCTestConfigurationType: @DEFAULT_CTEST_CONFIGURATION_TYPE@
+# version control
+UpdateVersionOnly: @CTEST_UPDATE_VERSION_ONLY@
+
# CVS options
# Default is "-d -P -A"
CVSCommand: @CVSCOMMAND@
@@ -52,6 +55,13 @@ GITCommand: @GITCOMMAND@
GITUpdateOptions: @GIT_UPDATE_OPTIONS@
GITUpdateCustom: @CTEST_GIT_UPDATE_CUSTOM@
+# Perforce options
+P4Command: @P4COMMAND@
+P4Client: @CTEST_P4_CLIENT@
+P4Options: @CTEST_P4_OPTIONS@
+P4UpdateOptions: @CTEST_P4_UPDATE_OPTIONS@
+P4UpdateCustom: @CTEST_P4_UPDATE_CUSTOM@
+
# Generic update command
UpdateCommand: @UPDATE_COMMAND@
UpdateOptions: @UPDATE_OPTIONS@
@@ -59,11 +69,14 @@ UpdateType: @UPDATE_TYPE@
# Compiler info
Compiler: @CMAKE_CXX_COMPILER@
+CompilerVersion: @CMAKE_CXX_COMPILER_VERSION@
# Dynamic analysis (MemCheck)
PurifyCommand: @PURIFYCOMMAND@
ValgrindCommand: @VALGRIND_COMMAND@
ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@
+MemoryCheckType: @MEMORYCHECK_TYPE@
+MemoryCheckSanitizerOptions: @MEMORYCHECK_SANITIZER_OPTIONS@
MemoryCheckCommand: @MEMORYCHECK_COMMAND@
MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@
MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@
@@ -83,6 +96,10 @@ SlurmRunCommand: @SLURM_SRUN_COMMAND@
# Currently set to 25 minutes
TimeOut: @DART_TESTING_TIMEOUT@
+# During parallel testing CTest will not start a new test if doing
+# so would cause the system load to exceed this value.
+TestLoad: @CTEST_TEST_LOAD@
+
UseLaunchers: @CTEST_USE_LAUNCHERS@
CurlOptions: @CTEST_CURL_OPTIONS@
# warning, if you add new options here that have to do with submit,
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
index 5f8a9fbf3..de475e45f 100644
--- a/Modules/DeployQt4.cmake
+++ b/Modules/DeployQt4.cmake
@@ -1,68 +1,103 @@
-# - Functions to help assemble a standalone Qt4 executable.
-# A collection of CMake utility functions useful for deploying
-# Qt4 executables.
+#.rst:
+# DeployQt4
+# ---------
+#
+# Functions to help assemble a standalone Qt4 executable.
+#
+# A collection of CMake utility functions useful for deploying Qt4
+# executables.
#
# The following functions are provided by this module:
-# write_qt4_conf
-# resolve_qt4_paths
-# fixup_qt4_executable
-# install_qt4_plugin_path
-# install_qt4_plugin
-# install_qt4_executable
+#
+# ::
+#
+# write_qt4_conf
+# resolve_qt4_paths
+# fixup_qt4_executable
+# install_qt4_plugin_path
+# install_qt4_plugin
+# install_qt4_executable
+#
# Requires CMake 2.6 or greater because it uses function and
-# PARENT_SCOPE. Also depends on BundleUtilities.cmake.
+# 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 CMAKE_INSTALL_PREFIX.
+# relative to the <executable_path> (if supplied) or the
+# CMAKE_INSTALL_PREFIX.
+#
+# ::
#
-# FIXUP_QT4_EXECUTABLE(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>])
-# Copies Qt plugins, writes a Qt configuration file (if needed) and fixes up a
-# Qt4 executable using BundleUtilities so it is standalone and can be
-# drag-and-drop copied to another machine as long as all of the system
-# libraries are compatible.
+# FIXUP_QT4_EXECUTABLE(<executable>
+# [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>])
+#
+# Copies Qt plugins, writes a Qt configuration file (if needed) and
+# fixes up a Qt4 executable using BundleUtilities so it is standalone
+# and can be drag-and-drop copied to another machine as long as all of
+# the system libraries are compatible.
#
# <executable> should point to the executable to be fixed-up.
#
-# <qtplugins> should contain a list of the names or paths of any Qt plugins
-# to be installed.
+# <qtplugins> should contain a list of the names or paths of any Qt
+# plugins to be installed.
#
-# <libs> will be passed to BundleUtilities and should be a list of any already
-# installed plugins, libraries or executables to also be fixed-up.
+# <libs> will be passed to BundleUtilities and should be a list of any
+# already installed plugins, libraries or executables to also be
+# fixed-up.
#
-# <dirs> will be passed to BundleUtilities and should contain and directories
-# to be searched to find library dependencies.
+# <dirs> will be passed to BundleUtilities and should contain and
+# directories to be searched to find library dependencies.
#
# <plugins_dir> allows an custom plugins directory to be used.
#
-# <request_qt_conf> will force a qt.conf file to be written even if not needed.
+# <request_qt_conf> will force a qt.conf file to be written even if not
+# needed.
+#
+# ::
+#
+# INSTALL_QT4_PLUGIN_PATH(plugin executable copy installed_plugin_path_var
+# <plugins_dir> <component> <configurations>)
#
-# 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
# (or <plugins_dir>) relative to <executable> and store the result in
# <installed_plugin_path_var>.
#
# If <copy> is set to TRUE then the plugins will be copied rather than
-# installed. This is to allow this module to be used at CMake time rather than
-# install time.
+# installed. This is to allow this module to be used at CMake time
+# rather than install time.
#
# If <component> is set then anything installed will use this COMPONENT.
#
-# INSTALL_QT4_PLUGIN(plugin executable copy installed_plugin_path_var <plugins_dir> <component>)
-# Install (or copy) an unresolved <plugin> to the default plugins directory
-# (or <plugins_dir>) relative to <executable> and store the result in
-# <installed_plugin_path_var>. See documentation of INSTALL_QT4_PLUGIN_PATH.
-#
-# INSTALL_QT4_EXECUTABLE(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf> <component>])
-# Installs Qt plugins, writes a Qt configuration file (if needed) and fixes up
-# a Qt4 executable using BundleUtilities so it is standalone and can be
-# drag-and-drop copied to another machine as long as all of the system
-# libraries are compatible. The executable will be fixed-up at install time.
-# <component> is the COMPONENT used for bundle fixup and plugin installation.
-# See documentation of FIXUP_QT4_BUNDLE.
+# ::
+#
+# INSTALL_QT4_PLUGIN(plugin executable copy installed_plugin_path_var
+# <plugins_dir> <component>)
+#
+# Install (or copy) an unresolved <plugin> to the default plugins
+# directory (or <plugins_dir>) relative to <executable> and store the
+# result in <installed_plugin_path_var>. See documentation of
+# INSTALL_QT4_PLUGIN_PATH.
+#
+# ::
+#
+# INSTALL_QT4_EXECUTABLE(<executable>
+# [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf> <component>])
+#
+# Installs Qt plugins, writes a Qt configuration file (if needed) and
+# fixes up a Qt4 executable using BundleUtilities so it is standalone
+# and can be drag-and-drop copied to another machine as long as all of
+# the system libraries are compatible. The executable will be fixed-up
+# at install time. <component> is the COMPONENT used for bundle fixup
+# and plugin installation. See documentation of FIXUP_QT4_BUNDLE.
#=============================================================================
# Copyright 2011 Mike McQuaid <mike@mikemcquaid.com>
@@ -91,7 +126,10 @@ function(write_qt4_conf qt_conf_dir qt_conf_contents)
endfunction()
function(resolve_qt4_paths paths_var)
- set(executable_path ${ARGV1})
+ unset(executable_path)
+ if(ARGC GREATER 1)
+ set(executable_path ${ARGV1})
+ endif()
set(paths_resolved)
foreach(path ${${paths_var}})
@@ -109,11 +147,26 @@ function(resolve_qt4_paths paths_var)
endfunction()
function(fixup_qt4_executable executable)
- set(qtplugins ${ARGV1})
- set(libs ${ARGV2})
- set(dirs ${ARGV3})
- set(plugins_dir ${ARGV4})
- set(request_qt_conf ${ARGV5})
+ unset(qtplugins)
+ if(ARGC GREATER 1)
+ set(qtplugins ${ARGV1})
+ endif()
+ unset(libs)
+ if(ARGC GREATER 2)
+ set(libs ${ARGV2})
+ endif()
+ unset(dirs)
+ if(ARGC GREATER 3)
+ set(dirs ${ARGV3})
+ endif()
+ unset(plugins_dir)
+ if(ARGC GREATER 4)
+ set(plugins_dir ${ARGV4})
+ endif()
+ unset(request_qt_conf)
+ if(ARGC GREATER 5)
+ set(request_qt_conf ${ARGV5})
+ endif()
message(STATUS "fixup_qt4_executable")
message(STATUS " executable='${executable}'")
@@ -134,7 +187,7 @@ function(fixup_qt4_executable executable)
set(qt_conf_dir "${executable}/Contents/Resources")
set(executable_path "${executable}")
set(write_qt_conf TRUE)
- if(NOT plugins_dir)
+ if(NOT DEFINED plugins_dir)
set(plugins_dir "${DeployQt4_apple_plugins_dir}")
endif()
else()
@@ -169,9 +222,19 @@ function(fixup_qt4_executable executable)
endfunction()
function(install_qt4_plugin_path plugin executable copy installed_plugin_path_var)
- set(plugins_dir ${ARGV4})
- set(component ${ARGV5})
- set(configurations ${ARGV6})
+ unset(plugins_dir)
+ if(ARGC GREATER 4)
+ set(plugins_dir ${ARGV4})
+ endif()
+ unset(component)
+ if(ARGC GREATER 5)
+ set(component ${ARGV5})
+ endif()
+ unset(configurations)
+ if(ARGC GREATER 6)
+ set(configurations ${ARGV6})
+ endif()
+
if(EXISTS "${plugin}")
if(APPLE)
if(NOT plugins_dir)
@@ -218,8 +281,15 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va
endfunction()
function(install_qt4_plugin plugin executable copy installed_plugin_path_var)
- set(plugins_dir ${ARGV4})
- set(component ${ARGV5})
+ unset(plugins_dir)
+ if(ARGC GREATER 4)
+ set(plugins_dir ${ARGV4})
+ endif()
+ unset(component)
+ if(ARGC GREATER 5)
+ set(component ${ARGV5})
+ endif()
+
if(EXISTS "${plugin}")
install_qt4_plugin_path("${plugin}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}")
else()
@@ -252,12 +322,31 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var)
endfunction()
function(install_qt4_executable executable)
- set(qtplugins ${ARGV1})
- set(libs ${ARGV2})
- set(dirs ${ARGV3})
- set(plugins_dir ${ARGV4})
- set(request_qt_conf ${ARGV5})
- set(component ${ARGV6})
+ unset(qtplugins)
+ if(ARGC GREATER 1)
+ set(qtplugins ${ARGV1})
+ endif()
+ unset(libs)
+ if(ARGC GREATER 2)
+ set(libs ${ARGV2})
+ endif()
+ unset(dirs)
+ if(ARGC GREATER 3)
+ set(dirs ${ARGV3})
+ endif()
+ unset(plugins_dir)
+ if(ARGC GREATER 4)
+ set(plugins_dir ${ARGV4})
+ endif()
+ unset(request_qt_conf)
+ if(ARGC GREATER 5)
+ set(request_qt_conf ${ARGV5})
+ endif()
+ unset(component)
+ if(ARGC GREATER 6)
+ set(component ${ARGV6})
+ endif()
+
if(QT_LIBRARY_DIR)
list(APPEND dirs "${QT_LIBRARY_DIR}")
endif()
diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake
index d1c3afe47..be6aaea69 100644
--- a/Modules/Documentation.cmake
+++ b/Modules/Documentation.cmake
@@ -1,6 +1,11 @@
-# - DocumentationVTK.cmake
-# This file provides support for the VTK documentation framework.
-# It relies on several tools (Doxygen, Perl, etc).
+#.rst:
+# Documentation
+# -------------
+#
+# DocumentationVTK.cmake
+#
+# This file provides support for the VTK documentation framework. It
+# relies on several tools (Doxygen, Perl, etc).
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index 50669bd29..a3f460d0a 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -1,149 +1,319 @@
-# - Manage data files stored outside source tree
-# Use this module to unambiguously reference data files stored outside the
-# source tree and fetch them at build time from arbitrary local and remote
-# content-addressed locations. Functions provided by this module recognize
-# arguments with the syntax "DATA{<name>}" as references to external data,
-# replace them with full paths to local copies of those data, and create build
-# rules to fetch and update the local copies.
-#
-# The DATA{} syntax is literal and the <name> is a full or relative path
-# within the source tree. The source tree must contain either a real data
-# file at <name> or a "content link" at <name><ext> containing a hash of the
-# real file using a hash algorithm corresponding to <ext>. For example, the
-# argument "DATA{img.png}" may be satisfied by either a real "img.png" file in
-# the current source directory or a "img.png.md5" file containing its MD5 sum.
-#
-# The 'ExternalData_Expand_Arguments' function evaluates DATA{} references
-# in its arguments and constructs a new list of arguments:
-# ExternalData_Expand_Arguments(
-# <target> # Name of data management target
-# <outVar> # Output variable
-# [args...] # Input arguments, DATA{} allowed
-# )
-# It replaces each DATA{} reference in an argument with the full path of a
-# real data file on disk that will exist after the <target> builds.
-#
-# The 'ExternalData_Add_Test' function wraps around the CMake add_test()
-# command but supports DATA{} references in its arguments:
-# ExternalData_Add_Test(
-# <target> # Name of data management target
-# ... # Arguments of add_test(), DATA{} allowed
-# )
-# It passes its arguments through ExternalData_Expand_Arguments and then
-# invokes add_test() using the results.
-#
-# The 'ExternalData_Add_Target' function creates a custom target to manage
-# local instances of data files stored externally:
-# ExternalData_Add_Target(
-# <target> # Name of data management target
-# )
-# It creates custom commands in the target as necessary to make data files
-# available for each DATA{} reference previously evaluated by other functions
-# provided by this module. A list of URL templates must be provided in the
-# variable ExternalData_URL_TEMPLATES using the placeholders "%(algo)" and
-# "%(hash)" in each template. Data fetch rules try each URL template in order
-# by substituting the hash algorithm name for "%(algo)" and the hash value for
-# "%(hash)".
-#
-# The following hash algorithms are supported:
-# %(algo) <ext> Description
-# ------- ----- -----------
-# MD5 .md5 Message-Digest Algorithm 5, RFC 1321
-# SHA1 .sha1 US Secure Hash Algorithm 1, RFC 3174
-# SHA224 .sha224 US Secure Hash Algorithms, RFC 4634
-# SHA256 .sha256 US Secure Hash Algorithms, RFC 4634
-# SHA384 .sha384 US Secure Hash Algorithms, RFC 4634
-# SHA512 .sha512 US Secure Hash Algorithms, RFC 4634
-# Note that the hashes are used only for unique data identification and
-# download verification. This is not security software.
-#
-# Example usage:
-# include(ExternalData)
-# set(ExternalData_URL_TEMPLATES "file:///local/%(algo)/%(hash)"
-# "http://data.org/%(algo)/%(hash)")
-# ExternalData_Add_Test(MyData
-# NAME MyTest
-# COMMAND MyExe DATA{MyInput.png}
-# )
-# ExternalData_Add_Target(MyData)
-# When test "MyTest" runs the "DATA{MyInput.png}" argument will be replaced by
-# the full path to a real instance of the data file "MyInput.png" on disk. If
-# the source tree contains a content link such as "MyInput.png.md5" then the
-# "MyData" target creates a real "MyInput.png" in the build tree.
-#
-# The DATA{} syntax can be told to fetch a file series using the form
-# "DATA{<name>,:}", where the ":" is literal. If the source tree contains a
-# group of files or content links named like a series then a reference to one
-# member adds rules to fetch all of them. Although all members of a series
-# are fetched, only the file originally named by the DATA{} argument is
-# substituted for it. The default configuration recognizes file series names
-# ending with "#.ext", "_#.ext", ".#.ext", or "-#.ext" where "#" is a sequence
-# of decimal digits and ".ext" is any single extension. Configure it with a
-# regex that parses <number> and <suffix> parts from the end of <name>:
-# ExternalData_SERIES_PARSE = regex of the form (<number>)(<suffix>)$
-# For more complicated cases set:
-# ExternalData_SERIES_PARSE = regex with at least two () groups
-# ExternalData_SERIES_PARSE_PREFIX = <prefix> regex group number, if any
-# ExternalData_SERIES_PARSE_NUMBER = <number> regex group number
-# ExternalData_SERIES_PARSE_SUFFIX = <suffix> regex group number
-# Configure series number matching with a regex that matches the
-# <number> part of series members named <prefix><number><suffix>:
-# ExternalData_SERIES_MATCH = regex matching <number> in all series members
-# Note that the <suffix> of a series does not include a hash-algorithm
-# extension.
-#
-# The DATA{} syntax can alternatively match files associated with the named
-# file and contained in the same directory. Associated files may be specified
-# by options using the syntax DATA{<name>,<opt1>,<opt2>,...}. Each option may
-# specify one file by name or specify a regular expression to match file names
-# using the syntax REGEX:<regex>. For example, the arguments
-# DATA{MyData/MyInput.mhd,MyInput.img} # File pair
-# DATA{MyData/MyFrames00.png,REGEX:MyFrames[0-9]+\\.png} # Series
-# will pass MyInput.mha and MyFrames00.png on the command line but ensure
-# that the associated files are present next to them.
-#
-# The DATA{} syntax may reference a directory using a trailing slash and a
-# list of associated files. The form DATA{<name>/,<opt1>,<opt2>,...} adds
-# rules to fetch any files in the directory that match one of the associated
-# file options. For example, the argument DATA{MyDataDir/,REGEX:.*} will pass
-# the full path to a MyDataDir directory on the command line and ensure that
-# the directory contains files corresponding to every file or content link in
-# the MyDataDir source directory.
-#
-# The variable ExternalData_LINK_CONTENT may be set to the name of a supported
-# hash algorithm to enable automatic conversion of real data files referenced
-# by the DATA{} syntax into content links. For each such <file> a content
-# link named "<file><ext>" is created. The original file is renamed to the
-# form ".ExternalData_<algo>_<hash>" to stage it for future transmission to
-# one of the locations in the list of URL templates (by means outside the
-# scope of this module). The data fetch rule created for the content link
-# will use the staged object if it cannot be found using any URL template.
-#
-# The variable ExternalData_OBJECT_STORES may be set to a list of local
-# directories that store objects using the layout <dir>/%(algo)/%(hash).
-# These directories will be searched first for a needed object. If the object
-# is not available in any store then it will be fetched remotely using the URL
-# templates and added to the first local store listed. If no stores are
-# specified the default is a location inside the build tree.
-#
-# The variable ExternalData_SOURCE_ROOT may be set to the highest source
-# directory containing any path named by a DATA{} reference. The default is
-# CMAKE_SOURCE_DIR. ExternalData_SOURCE_ROOT and CMAKE_SOURCE_DIR must refer
-# to directories within a single source distribution (e.g. they come together
-# in one tarball).
-#
-# The variable ExternalData_BINARY_ROOT may be set to the directory to hold
-# the real data files named by expanded DATA{} references. The default is
-# CMAKE_BINARY_DIR. The directory layout will mirror that of content links
-# under ExternalData_SOURCE_ROOT.
-#
-# Variables ExternalData_TIMEOUT_INACTIVITY and ExternalData_TIMEOUT_ABSOLUTE
-# set the download inactivity and absolute timeouts, in seconds. The defaults
-# are 60 seconds and 300 seconds, respectively. Set either timeout to 0
-# seconds to disable enforcement.
+#[=======================================================================[.rst:
+ExternalData
+------------
+
+.. only:: html
+
+ .. contents::
+
+Manage data files stored outside source tree
+
+Introduction
+^^^^^^^^^^^^
+
+Use this module to unambiguously reference data files stored outside
+the source tree and fetch them at build time from arbitrary local and
+remote content-addressed locations. Functions provided by this module
+recognize arguments with the syntax ``DATA{<name>}`` as references to
+external data, replace them with full paths to local copies of those
+data, and create build rules to fetch and update the local copies.
+
+For example:
+
+.. code-block:: cmake
+
+ include(ExternalData)
+ set(ExternalData_URL_TEMPLATES "file:///local/%(algo)/%(hash)"
+ "file:////host/share/%(algo)/%(hash)"
+ "http://data.org/%(algo)/%(hash)")
+ ExternalData_Add_Test(MyData
+ NAME MyTest
+ COMMAND MyExe DATA{MyInput.png}
+ )
+ ExternalData_Add_Target(MyData)
+
+When test ``MyTest`` runs the ``DATA{MyInput.png}`` argument will be
+replaced by the full path to a real instance of the data file
+``MyInput.png`` on disk. If the source tree contains a content link
+such as ``MyInput.png.md5`` then the ``MyData`` target creates a real
+``MyInput.png`` in the build tree.
+
+Module Functions
+^^^^^^^^^^^^^^^^
+
+.. command:: ExternalData_Expand_Arguments
+
+ The ``ExternalData_Expand_Arguments`` function evaluates ``DATA{}``
+ references in its arguments and constructs a new list of arguments::
+
+ ExternalData_Expand_Arguments(
+ <target> # Name of data management target
+ <outVar> # Output variable
+ [args...] # Input arguments, DATA{} allowed
+ )
+
+ It replaces each ``DATA{}`` reference in an argument with the full path of
+ a real data file on disk that will exist after the ``<target>`` builds.
+
+.. command:: ExternalData_Add_Test
+
+ The ``ExternalData_Add_Test`` function wraps around the CMake
+ :command:`add_test` command but supports ``DATA{}`` references in
+ its arguments::
+
+ ExternalData_Add_Test(
+ <target> # Name of data management target
+ ... # Arguments of add_test(), DATA{} allowed
+ )
+
+ It passes its arguments through ``ExternalData_Expand_Arguments`` and then
+ invokes the :command:`add_test` command using the results.
+
+.. command:: ExternalData_Add_Target
+
+ The ``ExternalData_Add_Target`` function creates a custom target to
+ manage local instances of data files stored externally::
+
+ ExternalData_Add_Target(
+ <target> # Name of data management target
+ )
+
+ It creates custom commands in the target as necessary to make data
+ files available for each ``DATA{}`` reference previously evaluated by
+ other functions provided by this module.
+ Data files may be fetched from one of the URL templates specified in
+ the ``ExternalData_URL_TEMPLATES`` variable, or may be found locally
+ in one of the paths specified in the ``ExternalData_OBJECT_STORES``
+ variable.
+
+Module Variables
+^^^^^^^^^^^^^^^^
+
+The following variables configure behavior. They should be set before
+calling any of the functions provided by this module.
+
+.. variable:: ExternalData_BINARY_ROOT
+
+ The ``ExternalData_BINARY_ROOT`` variable may be set to the directory to
+ hold the real data files named by expanded ``DATA{}`` references. The
+ default is ``CMAKE_BINARY_DIR``. The directory layout will mirror that of
+ content links under ``ExternalData_SOURCE_ROOT``.
+
+.. variable:: ExternalData_CUSTOM_SCRIPT_<key>
+
+ Specify a full path to a ``.cmake`` custom fetch script identified by
+ ``<key>`` in entries of the ``ExternalData_URL_TEMPLATES`` list.
+ See `Custom Fetch Scripts`_.
+
+.. variable:: ExternalData_LINK_CONTENT
+
+ The ``ExternalData_LINK_CONTENT`` variable may be set to the name of a
+ supported hash algorithm to enable automatic conversion of real data
+ files referenced by the ``DATA{}`` syntax into content links. For each
+ such ``<file>`` a content link named ``<file><ext>`` is created. The
+ original file is renamed to the form ``.ExternalData_<algo>_<hash>`` to
+ stage it for future transmission to one of the locations in the list
+ of URL templates (by means outside the scope of this module). The
+ data fetch rule created for the content link will use the staged
+ object if it cannot be found using any URL template.
+
+.. variable:: ExternalData_NO_SYMLINKS
+
+ The real data files named by expanded ``DATA{}`` references may be made
+ available under ``ExternalData_BINARY_ROOT`` using symbolic links on
+ some platforms. The ``ExternalData_NO_SYMLINKS`` variable may be set
+ to disable use of symbolic links and enable use of copies instead.
+
+.. variable:: ExternalData_OBJECT_STORES
+
+ The ``ExternalData_OBJECT_STORES`` variable may be set to a list of local
+ directories that store objects using the layout ``<dir>/%(algo)/%(hash)``.
+ These directories will be searched first for a needed object. If the
+ object is not available in any store then it will be fetched remotely
+ using the URL templates and added to the first local store listed. If
+ no stores are specified the default is a location inside the build
+ tree.
+
+.. variable:: ExternalData_SERIES_PARSE
+ ExternalData_SERIES_PARSE_PREFIX
+ ExternalData_SERIES_PARSE_NUMBER
+ ExternalData_SERIES_PARSE_SUFFIX
+ ExternalData_SERIES_MATCH
+
+ See `Referencing File Series`_.
+
+.. variable:: ExternalData_SOURCE_ROOT
+
+ The ``ExternalData_SOURCE_ROOT`` variable may be set to the highest source
+ directory containing any path named by a ``DATA{}`` reference. The
+ default is ``CMAKE_SOURCE_DIR``. ``ExternalData_SOURCE_ROOT`` and
+ ``CMAKE_SOURCE_DIR`` must refer to directories within a single source
+ distribution (e.g. they come together in one tarball).
+
+.. variable:: ExternalData_TIMEOUT_ABSOLUTE
+
+ The ``ExternalData_TIMEOUT_ABSOLUTE`` variable sets the download
+ absolute timeout, in seconds, with a default of ``300`` seconds.
+ Set to ``0`` to disable enforcement.
+
+.. variable:: ExternalData_TIMEOUT_INACTIVITY
+
+ The ``ExternalData_TIMEOUT_INACTIVITY`` variable sets the download
+ inactivity timeout, in seconds, with a default of ``60`` seconds.
+ Set to ``0`` to disable enforcement.
+
+.. variable:: ExternalData_URL_ALGO_<algo>_<key>
+
+ Specify a custom URL component to be substituted for URL template
+ placeholders of the form ``%(algo:<key>)``, where ``<key>`` is a
+ valid C identifier, when fetching an object referenced via hash
+ algorithm ``<algo>``. If not defined, the default URL component
+ is just ``<algo>`` for any ``<key>``.
+
+.. variable:: ExternalData_URL_TEMPLATES
+
+ The ``ExternalData_URL_TEMPLATES`` may be set to provide a list of
+ of URL templates using the placeholders ``%(algo)`` and ``%(hash)``
+ in each template. Data fetch rules try each URL template in order
+ by substituting the hash algorithm name for ``%(algo)`` and the hash
+ value for ``%(hash)``. Alternatively one may use ``%(algo:<key>)``
+ with ``ExternalData_URL_ALGO_<algo>_<key>`` variables to gain more
+ flexibility in remote URLs.
+
+Referencing Files
+^^^^^^^^^^^^^^^^^
+
+Referencing Single Files
+""""""""""""""""""""""""
+
+The ``DATA{}`` syntax is literal and the ``<name>`` is a full or relative path
+within the source tree. The source tree must contain either a real
+data file at ``<name>`` or a "content link" at ``<name><ext>`` containing a
+hash of the real file using a hash algorithm corresponding to ``<ext>``.
+For example, the argument ``DATA{img.png}`` may be satisfied by either a
+real ``img.png`` file in the current source directory or a ``img.png.md5``
+file containing its MD5 sum.
+
+Referencing File Series
+"""""""""""""""""""""""
+
+The ``DATA{}`` syntax can be told to fetch a file series using the form
+``DATA{<name>,:}``, where the ``:`` is literal. If the source tree
+contains a group of files or content links named like a series then a
+reference to one member adds rules to fetch all of them. Although all
+members of a series are fetched, only the file originally named by the
+``DATA{}`` argument is substituted for it. The default configuration
+recognizes file series names ending with ``#.ext``, ``_#.ext``, ``.#.ext``,
+or ``-#.ext`` where ``#`` is a sequence of decimal digits and ``.ext`` is
+any single extension. Configure it with a regex that parses ``<number>``
+and ``<suffix>`` parts from the end of ``<name>``::
+
+ ExternalData_SERIES_PARSE = regex of the form (<number>)(<suffix>)$
+
+For more complicated cases set::
+
+ ExternalData_SERIES_PARSE = regex with at least two () groups
+ ExternalData_SERIES_PARSE_PREFIX = <prefix> regex group number, if any
+ ExternalData_SERIES_PARSE_NUMBER = <number> regex group number
+ ExternalData_SERIES_PARSE_SUFFIX = <suffix> regex group number
+
+Configure series number matching with a regex that matches the
+``<number>`` part of series members named ``<prefix><number><suffix>``::
+
+ ExternalData_SERIES_MATCH = regex matching <number> in all series members
+
+Note that the ``<suffix>`` of a series does not include a hash-algorithm
+extension.
+
+Referencing Associated Files
+""""""""""""""""""""""""""""
+
+The ``DATA{}`` syntax can alternatively match files associated with the
+named file and contained in the same directory. Associated files may
+be specified by options using the syntax
+``DATA{<name>,<opt1>,<opt2>,...}``. Each option may specify one file by
+name or specify a regular expression to match file names using the
+syntax ``REGEX:<regex>``. For example, the arguments::
+
+ DATA{MyData/MyInput.mhd,MyInput.img} # File pair
+ DATA{MyData/MyFrames00.png,REGEX:MyFrames[0-9]+\\.png} # Series
+
+will pass ``MyInput.mha`` and ``MyFrames00.png`` on the command line but
+ensure that the associated files are present next to them.
+
+Referencing Directories
+"""""""""""""""""""""""
+
+The ``DATA{}`` syntax may reference a directory using a trailing slash and
+a list of associated files. The form ``DATA{<name>/,<opt1>,<opt2>,...}``
+adds rules to fetch any files in the directory that match one of the
+associated file options. For example, the argument
+``DATA{MyDataDir/,REGEX:.*}`` will pass the full path to a ``MyDataDir``
+directory on the command line and ensure that the directory contains
+files corresponding to every file or content link in the ``MyDataDir``
+source directory. In order to match associated files in subdirectories,
+specify a ``RECURSE:`` option, e.g. ``DATA{MyDataDir/,RECURSE:,REGEX:.*}``.
+
+Hash Algorithms
+^^^^^^^^^^^^^^^
+
+The following hash algorithms are supported::
+
+ %(algo) <ext> Description
+ ------- ----- -----------
+ MD5 .md5 Message-Digest Algorithm 5, RFC 1321
+ SHA1 .sha1 US Secure Hash Algorithm 1, RFC 3174
+ SHA224 .sha224 US Secure Hash Algorithms, RFC 4634
+ SHA256 .sha256 US Secure Hash Algorithms, RFC 4634
+ SHA384 .sha384 US Secure Hash Algorithms, RFC 4634
+ SHA512 .sha512 US Secure Hash Algorithms, RFC 4634
+
+Note that the hashes are used only for unique data identification and
+download verification.
+
+.. _`ExternalData Custom Fetch Scripts`:
+
+Custom Fetch Scripts
+^^^^^^^^^^^^^^^^^^^^
+
+When a data file must be fetched from one of the URL templates
+specified in the ``ExternalData_URL_TEMPLATES`` variable, it is
+normally downloaded using the :command:`file(DOWNLOAD)` command.
+One may specify usage of a custom fetch script by using a URL
+template of the form ``ExternalDataCustomScript://<key>/<loc>``.
+The ``<key>`` must be a C identifier, and the ``<loc>`` must
+contain the ``%(algo)`` and ``%(hash)`` placeholders.
+A variable corresponding to the key, ``ExternalData_CUSTOM_SCRIPT_<key>``,
+must be set to the full path to a ``.cmake`` script file. The script
+will be included to perform the actual fetch, and provided with
+the following variables:
+
+.. variable:: ExternalData_CUSTOM_LOCATION
+
+ When a custom fetch script is loaded, this variable is set to the
+ location part of the URL, which will contain the substituted hash
+ algorithm name and content hash value.
+
+.. variable:: ExternalData_CUSTOM_FILE
+
+ When a custom fetch script is loaded, this variable is set to the
+ full path to a file in which the script must store the fetched
+ content. The name of the file is unspecified and should not be
+ interpreted in any way.
+
+The custom fetch script is expected to store fetched content in the
+file or set a variable:
+
+.. variable:: ExternalData_CUSTOM_ERROR
+
+ When a custom fetch script fails to fetch the requested content,
+ it must set this variable to a short one-line message describing
+ the reason for failure.
+
+#]=======================================================================]
#=============================================================================
-# Copyright 2010-2013 Kitware, Inc.
+# Copyright 2010-2015 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -162,12 +332,63 @@ function(ExternalData_add_test target)
endfunction()
function(ExternalData_add_target target)
- if(NOT ExternalData_URL_TEMPLATES)
- message(FATAL_ERROR "ExternalData_URL_TEMPLATES is not set!")
+ if(NOT ExternalData_URL_TEMPLATES AND NOT ExternalData_OBJECT_STORES)
+ message(FATAL_ERROR
+ "Neither ExternalData_URL_TEMPLATES nor ExternalData_OBJECT_STORES is set!")
endif()
if(NOT ExternalData_OBJECT_STORES)
set(ExternalData_OBJECT_STORES ${CMAKE_BINARY_DIR}/ExternalData/Objects)
endif()
+ set(_ExternalData_CONFIG_CODE "")
+
+ # Store custom script configuration.
+ foreach(url_template IN LISTS ExternalData_URL_TEMPLATES)
+ if("${url_template}" MATCHES "^ExternalDataCustomScript://([^/]*)/(.*)$")
+ set(key "${CMAKE_MATCH_1}")
+ if(key MATCHES "^[A-Za-z_][A-Za-z0-9_]*$")
+ if(ExternalData_CUSTOM_SCRIPT_${key})
+ if(IS_ABSOLUTE "${ExternalData_CUSTOM_SCRIPT_${key}}")
+ string(CONCAT _ExternalData_CONFIG_CODE "${_ExternalData_CONFIG_CODE}\n"
+ "set(ExternalData_CUSTOM_SCRIPT_${key} \"${ExternalData_CUSTOM_SCRIPT_${key}}\")")
+ else()
+ message(FATAL_ERROR
+ "No ExternalData_CUSTOM_SCRIPT_${key} is not set to a full path:\n"
+ " ${ExternalData_CUSTOM_SCRIPT_${key}}")
+ endif()
+ else()
+ message(FATAL_ERROR
+ "No ExternalData_CUSTOM_SCRIPT_${key} is set for URL template:\n"
+ " ${url_template}")
+ endif()
+ else()
+ message(FATAL_ERROR
+ "Bad ExternalDataCustomScript key '${key}' in URL template:\n"
+ " ${url_template}\n"
+ "The key must be a valid C identifier.")
+ endif()
+ endif()
+
+ # Store custom algorithm name to URL component maps.
+ if("${url_template}" MATCHES "%\\(algo:([^)]*)\\)")
+ set(key "${CMAKE_MATCH_1}")
+ if(key MATCHES "^[A-Za-z_][A-Za-z0-9_]*$")
+ string(REPLACE "|" ";" _algos "${_ExternalData_REGEX_ALGO}")
+ foreach(algo ${_algos})
+ if(DEFINED ExternalData_URL_ALGO_${algo}_${key})
+ string(CONCAT _ExternalData_CONFIG_CODE "${_ExternalData_CONFIG_CODE}\n"
+ "set(ExternalData_URL_ALGO_${algo}_${key} \"${ExternalData_URL_ALGO_${algo}_${key}}\")")
+ endif()
+ endforeach()
+ else()
+ message(FATAL_ERROR
+ "Bad %(algo:${key}) in URL template:\n"
+ " ${url_template}\n"
+ "The transform name must be a valid C identifier.")
+ endif()
+ endif()
+ endforeach()
+
+ # Store configuration for use by build-time script.
set(config ${CMAKE_CURRENT_BINARY_DIR}/${target}_config.cmake)
configure_file(${_ExternalData_SELF_DIR}/ExternalData_config.cmake.in ${config} @ONLY)
@@ -251,8 +472,7 @@ function(ExternalData_expand_arguments target outArgsVar)
foreach(piece IN LISTS pieces)
if("x${piece}" MATCHES "^x${data_regex}$")
# Replace this DATA{}-piece with a file path.
- string(REGEX REPLACE "${data_regex}" "\\1" data "${piece}")
- _ExternalData_arg("${target}" "${piece}" "${data}" file)
+ _ExternalData_arg("${target}" "${piece}" "${CMAKE_MATCH_1}" file)
set(outArg "${outArg}${file}")
else()
# No replacement needed for this piece.
@@ -381,19 +601,23 @@ function(_ExternalData_arg target arg options var_file)
set(external "") # Entries external to the source tree.
set(internal "") # Entries internal to the source tree.
set(have_original ${data_is_directory})
+ set(have_original_as_dir 0)
# Process options.
set(series_option "")
+ set(recurse_option "")
set(associated_files "")
set(associated_regex "")
foreach(opt ${options})
- if("x${opt}" MATCHES "^xREGEX:[^:/]+$")
- # Regular expression to match associated files.
- string(REGEX REPLACE "^REGEX:" "" regex "${opt}")
- list(APPEND associated_regex "${regex}")
+ # Regular expression to match associated files.
+ if("x${opt}" MATCHES "^xREGEX:([^:/]+)$")
+ list(APPEND associated_regex "${CMAKE_MATCH_1}")
elseif(opt STREQUAL ":")
# Activate series matching.
set(series_option "${opt}")
+ elseif(opt STREQUAL "RECURSE:")
+ # Activate recursive matching in directories.
+ set(recurse_option "${opt}")
elseif("x${opt}" MATCHES "^[^][:/*?]+$")
# Specific associated file.
list(APPEND associated_files "${opt}")
@@ -410,6 +634,9 @@ function(_ExternalData_arg target arg options var_file)
if(associated_files OR associated_regex)
message(FATAL_ERROR "Series option \"${series_option}\" not allowed with associated files.")
endif()
+ if(recurse_option)
+ message(FATAL_ERROR "Recurse option \"${recurse_option}\" allowed only with directories.")
+ endif()
# Load a whole file series.
_ExternalData_arg_series()
elseif(data_is_directory)
@@ -422,6 +649,9 @@ function(_ExternalData_arg target arg options var_file)
"must list associated files.")
endif()
else()
+ if(recurse_option)
+ message(FATAL_ERROR "Recurse option \"${recurse_option}\" allowed only with directories.")
+ endif()
# Load the named data file.
_ExternalData_arg_single()
if(associated_files OR associated_regex)
@@ -431,11 +661,18 @@ function(_ExternalData_arg target arg options var_file)
endif()
if(NOT have_original)
- message(FATAL_ERROR "Data file referenced by argument\n"
+ if(have_original_as_dir)
+ set(msg_kind FATAL_ERROR)
+ set(msg "that is directory instead of a file!")
+ else()
+ set(msg_kind AUTHOR_WARNING)
+ set(msg "that does not exist as a file (with or without an extension)!")
+ endif()
+ message(${msg_kind} "Data file referenced by argument\n"
" ${arg}\n"
"corresponds to source tree path\n"
" ${reldata}\n"
- "that does not exist as a file (with or without an extension)!")
+ "${msg}")
endif()
if(external)
@@ -462,11 +699,18 @@ macro(_ExternalData_arg_associated)
set(reldir "${reldir}/")
endif()
_ExternalData_exact_regex(reldir_regex "${reldir}")
+ if(recurse_option)
+ set(glob GLOB_RECURSE)
+ set(reldir_regex "${reldir_regex}(.+/)?")
+ else()
+ set(glob GLOB)
+ endif()
# Find files named explicitly.
foreach(file ${associated_files})
_ExternalData_exact_regex(file_regex "${file}")
- _ExternalData_arg_find_files("${reldir}${file}" "${reldir_regex}${file_regex}")
+ _ExternalData_arg_find_files(${glob} "${reldir}${file}"
+ "${reldir_regex}${file_regex}")
endforeach()
# Find files matching the given regular expressions.
@@ -476,13 +720,13 @@ macro(_ExternalData_arg_associated)
set(all "${all}${sep}${reldir_regex}${regex}")
set(sep "|")
endforeach()
- _ExternalData_arg_find_files("${reldir}" "${all}")
+ _ExternalData_arg_find_files(${glob} "${reldir}" "${all}")
endmacro()
macro(_ExternalData_arg_single)
# Match only the named data by itself.
_ExternalData_exact_regex(data_regex "${reldata}")
- _ExternalData_arg_find_files("${reldata}" "${data_regex}")
+ _ExternalData_arg_find_files(GLOB "${reldata}" "${data_regex}")
endmacro()
macro(_ExternalData_arg_series)
@@ -537,12 +781,15 @@ macro(_ExternalData_arg_series)
# Then match base, number, and extension.
_ExternalData_exact_regex(series_base "${relbase}")
_ExternalData_exact_regex(series_ext "${ext}")
- _ExternalData_arg_find_files("${relbase}*${ext}"
+ _ExternalData_arg_find_files(GLOB "${relbase}*${ext}"
"${series_base}${series_match}${series_ext}")
endmacro()
-function(_ExternalData_arg_find_files pattern regex)
- file(GLOB globbed RELATIVE "${top_src}" "${top_src}/${pattern}*")
+function(_ExternalData_arg_find_files glob pattern regex)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0009 NEW)
+ file(${glob} globbed RELATIVE "${top_src}" "${top_src}/${pattern}*")
+ cmake_policy(POP)
foreach(entry IN LISTS globbed)
if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$")
set(relname "${CMAKE_MATCH_1}")
@@ -552,27 +799,33 @@ function(_ExternalData_arg_find_files pattern regex)
set(alg "")
endif()
if("x${relname}" MATCHES "^x${regex}$" # matches
- AND NOT IS_DIRECTORY "${top_src}/${entry}" # not a directory
AND NOT "x${relname}" MATCHES "(^x|/)\\.ExternalData_" # not staged obj
)
- set(name "${top_src}/${relname}")
- set(file "${top_bin}/${relname}")
- if(alg)
- list(APPEND external "${file}|${name}|${alg}")
- elseif(ExternalData_LINK_CONTENT)
- _ExternalData_link_content("${name}" alg)
- list(APPEND external "${file}|${name}|${alg}")
- elseif(NOT top_same)
- list(APPEND internal "${file}|${name}")
- endif()
- if("${relname}" STREQUAL "${reldata}")
- set(have_original 1)
+ if(IS_DIRECTORY "${top_src}/${entry}")
+ if("${relname}" STREQUAL "${reldata}")
+ set(have_original_as_dir 1)
+ endif()
+ else()
+ set(name "${top_src}/${relname}")
+ set(file "${top_bin}/${relname}")
+ if(alg)
+ list(APPEND external "${file}|${name}|${alg}")
+ elseif(ExternalData_LINK_CONTENT)
+ _ExternalData_link_content("${name}" alg)
+ list(APPEND external "${file}|${name}|${alg}")
+ elseif(NOT top_same)
+ list(APPEND internal "${file}|${name}")
+ endif()
+ if("${relname}" STREQUAL "${reldata}")
+ set(have_original 1)
+ endif()
endif()
endif()
endforeach()
set(external "${external}" PARENT_SCOPE)
set(internal "${internal}" PARENT_SCOPE)
set(have_original "${have_original}" PARENT_SCOPE)
+ set(have_original_as_dir "${have_original_as_dir}" PARENT_SCOPE)
endfunction()
#-----------------------------------------------------------------------------
@@ -585,8 +838,9 @@ endif()
if(ExternalData_CONFIG)
include(${ExternalData_CONFIG})
endif()
-if(NOT ExternalData_URL_TEMPLATES)
- message(FATAL_ERROR "No ExternalData_URL_TEMPLATES set!")
+if(NOT ExternalData_URL_TEMPLATES AND NOT ExternalData_OBJECT_STORES)
+ message(FATAL_ERROR
+ "Neither ExternalData_URL_TEMPLATES nor ExternalData_OBJECT_STORES is set!")
endif()
function(_ExternalData_link_or_copy src dst)
@@ -595,7 +849,7 @@ function(_ExternalData_link_or_copy src dst)
file(MAKE_DIRECTORY "${dst_dir}")
_ExternalData_random(random)
set(tmp "${dst}.tmp${random}")
- if(UNIX)
+ if(UNIX AND NOT ExternalData_NO_SYMLINKS)
# Create a symbolic link.
set(tgt "${src}")
if(relative_top)
@@ -661,6 +915,30 @@ function(_ExternalData_download_file url file err_var msg_var)
set("${msg_var}" "${msg}" PARENT_SCOPE)
endfunction()
+function(_ExternalData_custom_fetch key loc file err_var msg_var)
+ if(NOT ExternalData_CUSTOM_SCRIPT_${key})
+ set(err 1)
+ set(msg "No ExternalData_CUSTOM_SCRIPT_${key} set!")
+ elseif(NOT EXISTS "${ExternalData_CUSTOM_SCRIPT_${key}}")
+ set(err 1)
+ set(msg "No '${ExternalData_CUSTOM_SCRIPT_${key}}' exists!")
+ else()
+ set(ExternalData_CUSTOM_LOCATION "${loc}")
+ set(ExternalData_CUSTOM_FILE "${file}")
+ unset(ExternalData_CUSTOM_ERROR)
+ include("${ExternalData_CUSTOM_SCRIPT_${key}}")
+ if(DEFINED ExternalData_CUSTOM_ERROR)
+ set(err 1)
+ set(msg "${ExternalData_CUSTOM_ERROR}")
+ else()
+ set(err 0)
+ set(msg "no error")
+ endif()
+ endif()
+ set("${err_var}" "${err}" PARENT_SCOPE)
+ set("${msg_var}" "${msg}" PARENT_SCOPE)
+endfunction()
+
function(_ExternalData_download_object name hash algo var_obj)
# Search all object stores for an existing object.
foreach(dir ${ExternalData_OBJECT_STORES})
@@ -683,8 +961,22 @@ function(_ExternalData_download_object name hash algo var_obj)
foreach(url_template IN LISTS ExternalData_URL_TEMPLATES)
string(REPLACE "%(hash)" "${hash}" url_tmp "${url_template}")
string(REPLACE "%(algo)" "${algo}" url "${url_tmp}")
+ if(url MATCHES "^(.*)%\\(algo:([A-Za-z_][A-Za-z0-9_]*)\\)(.*)$")
+ set(lhs "${CMAKE_MATCH_1}")
+ set(key "${CMAKE_MATCH_2}")
+ set(rhs "${CMAKE_MATCH_3}")
+ if(DEFINED ExternalData_URL_ALGO_${algo}_${key})
+ set(url "${lhs}${ExternalData_URL_ALGO_${algo}_${key}}${rhs}")
+ else()
+ set(url "${lhs}${algo}${rhs}")
+ endif()
+ endif()
message(STATUS "Fetching \"${url}\"")
- _ExternalData_download_file("${url}" "${tmp}" err errMsg)
+ if(url MATCHES "^ExternalDataCustomScript://([A-Za-z_][A-Za-z0-9_]*)/(.*)$")
+ _ExternalData_custom_fetch("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}" "${tmp}" err errMsg)
+ else()
+ _ExternalData_download_file("${url}" "${tmp}" err errMsg)
+ endif()
set(tried "${tried}\n ${url}")
if(err)
set(tried "${tried} (${errMsg})")
@@ -714,6 +1006,9 @@ function(_ExternalData_download_object name hash algo var_obj)
set(obj "${staged}")
message(STATUS "Staged object: \"${obj}\"")
else()
+ if(NOT tried)
+ set(tried "\n (No ExternalData_URL_TEMPLATES given)")
+ endif()
message(FATAL_ERROR "Object ${algo}=${hash} not found at:${tried}")
endif()
diff --git a/Modules/ExternalData_config.cmake.in b/Modules/ExternalData_config.cmake.in
index 0858f5368..18be6b31a 100644
--- a/Modules/ExternalData_config.cmake.in
+++ b/Modules/ExternalData_config.cmake.in
@@ -2,3 +2,5 @@ set(ExternalData_OBJECT_STORES "@ExternalData_OBJECT_STORES@")
set(ExternalData_URL_TEMPLATES "@ExternalData_URL_TEMPLATES@")
set(ExternalData_TIMEOUT_INACTIVITY "@ExternalData_TIMEOUT_INACTIVITY@")
set(ExternalData_TIMEOUT_ABSOLUTE "@ExternalData_TIMEOUT_ABSOLUTE@")
+set(ExternalData_NO_SYMLINKS "@ExternalData_NO_SYMLINKS@")
+@_ExternalData_CONFIG_CODE@
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 0781ea146..249658d62 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1,166 +1,375 @@
-# - Create custom targets to build projects in external trees
-# The 'ExternalProject_Add' function creates a custom target to drive
-# download, update/patch, configure, build, install and test steps of an
-# external project:
-# ExternalProject_Add(<name> # Name for custom target
-# [DEPENDS projects...] # Targets on which the project depends
-# [PREFIX dir] # Root dir for entire project
-# [LIST_SEPARATOR sep] # Sep to be replaced by ; in cmd lines
-# [TMP_DIR dir] # Directory to store temporary files
-# [STAMP_DIR dir] # Directory to store step timestamps
-# #--Download step--------------
-# [DOWNLOAD_NAME fname] # File name to store (if not end of URL)
-# [DOWNLOAD_DIR dir] # Directory to store downloaded files
-# [DOWNLOAD_COMMAND cmd...] # Command to download source tree
-# [CVS_REPOSITORY cvsroot] # CVSROOT of CVS repository
-# [CVS_MODULE mod] # Module to checkout from CVS repo
-# [CVS_TAG tag] # Tag to checkout from CVS repo
-# [SVN_REPOSITORY url] # URL of Subversion repo
-# [SVN_REVISION rev] # Revision to checkout from Subversion repo
-# [SVN_USERNAME john ] # Username for Subversion checkout and update
-# [SVN_PASSWORD doe ] # Password for Subversion checkout and update
-# [SVN_TRUST_CERT 1 ] # Trust the Subversion server site certificate
-# [GIT_REPOSITORY url] # URL of git repo
-# [GIT_TAG tag] # Git branch name, commit id or tag
-# [HG_REPOSITORY url] # URL of mercurial repo
-# [HG_TAG tag] # Mercurial branch name, commit id or tag
-# [URL /.../src.tgz] # Full path or URL of source
-# [URL_HASH ALGO=value] # Hash of file at URL
-# [URL_MD5 md5] # Equivalent to URL_HASH MD5=md5
-# [TLS_VERIFY bool] # Should certificate for https be checked
-# [TLS_CAINFO file] # Path to a certificate authority file
-# [TIMEOUT seconds] # Time allowed for file download operations
-# #--Update/Patch step----------
-# [UPDATE_COMMAND cmd...] # Source work-tree update command
-# [PATCH_COMMAND cmd...] # Command to patch downloaded source
-# #--Configure step-------------
-# [SOURCE_DIR dir] # Source dir to be used for build
-# [CONFIGURE_COMMAND cmd...] # Build tree configuration command
-# [CMAKE_COMMAND /.../cmake] # Specify alternative cmake executable
-# [CMAKE_GENERATOR gen] # Specify generator for native build
-# [CMAKE_GENERATOR_TOOLSET t] # Generator-specific toolset name
-# [CMAKE_ARGS args...] # Arguments to CMake command line
-# [CMAKE_CACHE_ARGS args...] # Initial cache arguments, of the form -Dvar:string=on
-# #--Build step-----------------
-# [BINARY_DIR dir] # Specify build dir location
-# [BUILD_COMMAND cmd...] # Command to drive the native build
-# [BUILD_IN_SOURCE 1] # Use source dir for build dir
-# #--Install step---------------
-# [INSTALL_DIR dir] # Installation prefix
-# [INSTALL_COMMAND cmd...] # Command to drive install after build
-# #--Test step------------------
-# [TEST_BEFORE_INSTALL 1] # Add test step executed before install step
-# [TEST_AFTER_INSTALL 1] # Add test step executed after install step
-# [TEST_COMMAND cmd...] # Command to drive test
-# #--Output logging-------------
-# [LOG_DOWNLOAD 1] # Wrap download in script to log output
-# [LOG_UPDATE 1] # Wrap update in script to log output
-# [LOG_CONFIGURE 1] # Wrap configure in script to log output
-# [LOG_BUILD 1] # Wrap build in script to log output
-# [LOG_TEST 1] # Wrap test in script to log output
-# [LOG_INSTALL 1] # Wrap install in script to log output
-# #--Custom targets-------------
-# [STEP_TARGETS st1 st2 ...] # Generate custom targets for these steps
-# )
-# The *_DIR options specify directories for the project, with default
-# directories computed as follows.
-# If the PREFIX option is given to ExternalProject_Add() or the EP_PREFIX
-# directory property is set, then an external project is built and installed
-# under the specified prefix:
-# TMP_DIR = <prefix>/tmp
-# STAMP_DIR = <prefix>/src/<name>-stamp
-# DOWNLOAD_DIR = <prefix>/src
-# SOURCE_DIR = <prefix>/src/<name>
-# BINARY_DIR = <prefix>/src/<name>-build
-# INSTALL_DIR = <prefix>
-# Otherwise, if the EP_BASE directory property is set then components
-# of an external project are stored under the specified base:
-# TMP_DIR = <base>/tmp/<name>
-# STAMP_DIR = <base>/Stamp/<name>
-# DOWNLOAD_DIR = <base>/Download/<name>
-# SOURCE_DIR = <base>/Source/<name>
-# BINARY_DIR = <base>/Build/<name>
-# INSTALL_DIR = <base>/Install/<name>
-# If no PREFIX, EP_PREFIX, or EP_BASE is specified then the default
-# is to set PREFIX to "<name>-prefix".
-# Relative paths are interpreted with respect to the build directory
-# corresponding to the source directory in which ExternalProject_Add is
-# invoked.
-#
-# If SOURCE_DIR is explicitly set to an existing directory the project
-# will be built from it.
-# Otherwise a download step must be specified using one of the
-# DOWNLOAD_COMMAND, CVS_*, SVN_*, or URL options.
-# The URL option may refer locally to a directory or source tarball,
-# or refer to a remote tarball (e.g. http://.../src.tgz).
-#
-# The 'ExternalProject_Add_Step' function adds a custom step to an external
-# project:
-# ExternalProject_Add_Step(<name> <step> # Names of project and custom step
-# [COMMAND cmd...] # Command line invoked by this step
-# [COMMENT "text..."] # Text printed when step executes
-# [DEPENDEES steps...] # Steps on which this step depends
-# [DEPENDERS steps...] # Steps that depend on this step
-# [DEPENDS files...] # Files on which this step depends
-# [ALWAYS 1] # No stamp file, step always runs
-# [WORKING_DIRECTORY dir] # Working directory for command
-# [LOG 1] # Wrap step in script to log output
-# )
-# The command line, comment, and working directory of every standard
-# and custom step is processed to replace tokens
-# <SOURCE_DIR>,
-# <BINARY_DIR>,
-# <INSTALL_DIR>,
-# and <TMP_DIR>
-# with corresponding property values.
-#
-# Any builtin step that specifies a "<step>_COMMAND cmd..." or custom
-# step that specifies a "COMMAND cmd..." may specify additional command
-# lines using the form "COMMAND cmd...". At build time the commands will
-# be executed in order and aborted if any one fails. For example:
-# ... BUILD_COMMAND make COMMAND echo done ...
-# specifies to run "make" and then "echo done" during the build step.
-# Whether the current working directory is preserved between commands
-# is not defined. Behavior of shell operators like "&&" is not defined.
-#
-# The 'ExternalProject_Get_Property' function retrieves external project
-# target properties:
-# ExternalProject_Get_Property(<name> [prop1 [prop2 [...]]])
-# It stores property values in variables of the same name.
-# Property names correspond to the keyword argument names of
-# 'ExternalProject_Add'.
-#
-# The 'ExternalProject_Add_StepTargets' function generates custom targets for
-# the steps listed:
-# ExternalProject_Add_StepTargets(<name> [step1 [step2 [...]]])
-#
-# If STEP_TARGETS is set then ExternalProject_Add_StepTargets is automatically
-# called at the end of matching calls to ExternalProject_Add_Step. Pass
-# STEP_TARGETS explicitly to individual ExternalProject_Add calls, or
-# implicitly to all ExternalProject_Add calls by setting the directory property
-# EP_STEP_TARGETS.
-#
-# If STEP_TARGETS is not set, clients may still manually call
-# ExternalProject_Add_StepTargets after calling ExternalProject_Add or
-# ExternalProject_Add_Step.
-#
-# This functionality is provided to make it easy to drive the steps
-# independently of each other by specifying targets on build command lines.
-# For example, you may be submitting to a sub-project based dashboard, where
-# you want to drive the configure portion of the build, then submit to the
-# dashboard, followed by the build portion, followed by tests. If you invoke
-# a custom target that depends on a step halfway through the step dependency
-# chain, then all the previous steps will also run to ensure everything is
-# up to date.
-#
-# For example, to drive configure, build and test steps independently for each
-# ExternalProject_Add call in your project, write the following line prior to
-# any ExternalProject_Add calls in your CMakeLists file:
-#
-# set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test)
+#[=======================================================================[.rst:
+ExternalProject
+---------------
+
+Create custom targets to build projects in external trees
+
+.. command:: ExternalProject_Add
+
+ The ``ExternalProject_Add`` function creates a custom target to drive
+ download, update/patch, configure, build, install and test steps of an
+ external project::
+
+ ExternalProject_Add(<name> [<option>...])
+
+ General options are:
+
+ ``DEPENDS <projects>...``
+ Targets on which the project depends
+ ``PREFIX <dir>``
+ Root dir for entire project
+ ``LIST_SEPARATOR <sep>``
+ Sep to be replaced by ; in cmd lines
+ ``TMP_DIR <dir>``
+ Directory to store temporary files
+ ``STAMP_DIR <dir>``
+ Directory to store step timestamps
+ ``EXCLUDE_FROM_ALL 1``
+ The "all" target does not depend on this
+
+ Download step options are:
+
+ ``DOWNLOAD_NAME <fname>``
+ File name to store (if not end of URL)
+ ``DOWNLOAD_DIR <dir>``
+ Directory to store downloaded files
+ ``DOWNLOAD_COMMAND <cmd>...``
+ Command to download source tree
+ ``DOWNLOAD_NO_PROGRESS 1``
+ Disable download progress reports
+ ``CVS_REPOSITORY <cvsroot>``
+ CVSROOT of CVS repository
+ ``CVS_MODULE <mod>``
+ Module to checkout from CVS repo
+ ``CVS_TAG <tag>``
+ Tag to checkout from CVS repo
+ ``SVN_REPOSITORY <url>``
+ URL of Subversion repo
+ ``SVN_REVISION -r<rev>``
+ Revision to checkout from Subversion repo
+ ``SVN_USERNAME <username>``
+ Username for Subversion checkout and update
+ ``SVN_PASSWORD <password>``
+ Password for Subversion checkout and update
+ ``SVN_TRUST_CERT 1``
+ Trust the Subversion server site certificate
+ ``GIT_REPOSITORY <url>``
+ URL of git repo
+ ``GIT_TAG <tag>``
+ Git branch name, commit id or tag
+ ``GIT_REMOTE_NAME <name>``
+ The optional name of the remote, default to ``origin``
+ ``GIT_SUBMODULES <module>...``
+ Git submodules that shall be updated, all if empty
+ ``HG_REPOSITORY <url>``
+ URL of mercurial repo
+ ``HG_TAG <tag>``
+ Mercurial branch name, commit id or tag
+ ``URL /.../src.tgz``
+ Full path or URL of source
+ ``URL_HASH ALGO=value``
+ Hash of file at URL
+ ``URL_MD5 md5``
+ Equivalent to URL_HASH MD5=md5
+ ``TLS_VERIFY <bool>``
+ Should certificate for https be checked
+ ``TLS_CAINFO <file>``
+ Path to a certificate authority file
+ ``TIMEOUT <seconds>``
+ Time allowed for file download operations
+
+ Update/Patch step options are:
+
+ ``UPDATE_COMMAND <cmd>...``
+ Source work-tree update command
+ ``UPDATE_DISCONNECTED 1``
+ Never update automatically from the remote repository
+ ``PATCH_COMMAND <cmd>...``
+ Command to patch downloaded source
+
+ Configure step options are:
+
+ ``SOURCE_DIR <dir>``
+ Source dir to be used for build
+ ``CONFIGURE_COMMAND <cmd>...``
+ Build tree configuration command
+ ``CMAKE_COMMAND /.../cmake``
+ Specify alternative cmake executable
+ ``CMAKE_GENERATOR <gen>``
+ Specify generator for native build
+ ``CMAKE_GENERATOR_PLATFORM <platform>``
+ Generator-specific platform name
+ ``CMAKE_GENERATOR_TOOLSET <toolset>``
+ Generator-specific toolset name
+ ``CMAKE_ARGS <arg>...``
+ Arguments to CMake command line.
+ These arguments are passed to CMake command line, and can contain
+ arguments other than cache values, see also
+ :manual:`CMake Options <cmake(1)>`. Arguments in the form
+ ``-Dvar:string=on`` are always passed to the command line, and
+ therefore cannot be changed by the user.
+ Arguments may use
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
+ ``CMAKE_CACHE_ARGS <arg>...``
+ Initial cache arguments, of the form ``-Dvar:string=on``.
+ These arguments are written in a pre-load a script that populates
+ CMake cache, see also :manual:`cmake -C <cmake(1)>`. This allows to
+ overcome command line length limits.
+ These arguments are :command:`set` using the ``FORCE`` argument,
+ and therefore cannot be changed by the user.
+ Arguments may use
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
+ ``CMAKE_CACHE_DEFAULT_ARGS <arg>...``
+ Initial default cache arguments, of the form ``-Dvar:string=on``.
+ These arguments are written in a pre-load a script that populates
+ CMake cache, see also :manual:`cmake -C <cmake(1)>`. This allows to
+ overcome command line length limits.
+ These arguments can be used as default value that will be set if no
+ previous value is found in the cache, and that the user can change
+ later.
+ Arguments may use
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+ Build step options are:
+
+ ``BINARY_DIR <dir>``
+ Specify build dir location
+ ``BUILD_COMMAND <cmd>...``
+ Command to drive the native build
+ ``BUILD_IN_SOURCE 1``
+ Use source dir for build dir
+ ``BUILD_ALWAYS 1``
+ No stamp file, build step always runs
+ ``BUILD_BYPRODUCTS <file>...``
+ Files that will be generated by the build command but may or may
+ not have their modification time updated by subsequent builds.
+
+ Install step options are:
+
+ ``INSTALL_DIR <dir>``
+ Installation prefix
+ ``INSTALL_COMMAND <cmd>...``
+ Command to drive install after build
+
+ Test step options are:
+
+ ``TEST_BEFORE_INSTALL 1``
+ Add test step executed before install step
+ ``TEST_AFTER_INSTALL 1``
+ Add test step executed after install step
+ ``TEST_EXCLUDE_FROM_MAIN 1``
+ Main target does not depend on the test step
+ ``TEST_COMMAND <cmd>...``
+ Command to drive test
+
+ Output logging options are:
+
+ ``LOG_DOWNLOAD 1``
+ Wrap download in script to log output
+ ``LOG_UPDATE 1``
+ Wrap update in script to log output
+ ``LOG_CONFIGURE 1``
+ Wrap configure in script to log output
+ ``LOG_BUILD 1``
+ Wrap build in script to log output
+ ``LOG_TEST 1``
+ Wrap test in script to log output
+ ``LOG_INSTALL 1``
+ Wrap install in script to log output
+
+ Steps can be given direct access to the terminal if possible. With
+ the :generator:`Ninja` generator, this places the steps in the
+ ``console`` :prop_gbl:`pool <JOB_POOLS>`. Options are:
+
+ ``USES_TERMINAL_DOWNLOAD 1``
+ Give download terminal access.
+ ``USES_TERMINAL_UPDATE 1``
+ Give update terminal access.
+ ``USES_TERMINAL_CONFIGURE 1``
+ Give configure terminal access.
+ ``USES_TERMINAL_BUILD 1``
+ Give build terminal access.
+ ``USES_TERMINAL_TEST 1``
+ Give test terminal access.
+ ``USES_TERMINAL_INSTALL 1``
+ Give install terminal access.
+
+ Other options are:
+
+ ``STEP_TARGETS <step-target>...``
+ Generate custom targets for these steps
+ ``INDEPENDENT_STEP_TARGETS <step-target>...``
+ Generate custom targets for these steps that do not depend on other
+ external projects even if a dependency is set
+
+ The ``*_DIR`` options specify directories for the project, with default
+ directories computed as follows. If the ``PREFIX`` option is given to
+ ``ExternalProject_Add()`` or the ``EP_PREFIX`` directory property is set,
+ then an external project is built and installed under the specified prefix::
+
+ TMP_DIR = <prefix>/tmp
+ STAMP_DIR = <prefix>/src/<name>-stamp
+ DOWNLOAD_DIR = <prefix>/src
+ SOURCE_DIR = <prefix>/src/<name>
+ BINARY_DIR = <prefix>/src/<name>-build
+ INSTALL_DIR = <prefix>
+
+ Otherwise, if the ``EP_BASE`` directory property is set then components
+ of an external project are stored under the specified base::
+
+ TMP_DIR = <base>/tmp/<name>
+ STAMP_DIR = <base>/Stamp/<name>
+ DOWNLOAD_DIR = <base>/Download/<name>
+ SOURCE_DIR = <base>/Source/<name>
+ BINARY_DIR = <base>/Build/<name>
+ INSTALL_DIR = <base>/Install/<name>
+
+ If no ``PREFIX``, ``EP_PREFIX``, or ``EP_BASE`` is specified then the
+ default is to set ``PREFIX`` to ``<name>-prefix``. Relative paths are
+ interpreted with respect to the build directory corresponding to the
+ source directory in which ``ExternalProject_Add`` is invoked.
+
+ If ``SOURCE_DIR`` is explicitly set to an existing directory the project
+ will be built from it. Otherwise a download step must be specified
+ using one of the ``DOWNLOAD_COMMAND``, ``CVS_*``, ``SVN_*``, or ``URL``
+ options. The ``URL`` option may refer locally to a directory or source
+ tarball, or refer to a remote tarball (e.g. ``http://.../src.tgz``).
+
+ If ``UPDATE_DISCONNECTED`` is set, the update step is not executed
+ automatically when building the main target. The update step can still
+ be added as a step target and called manually. This is useful if you
+ want to allow to build the project when you are disconnected from the
+ network (you might still need the network for the download step).
+ This is disabled by default.
+ The directory property ``EP_UPDATE_DISCONNECTED`` can be used to change
+ the default value for all the external projects in the current
+ directory and its subdirectories.
+
+.. command:: ExternalProject_Add_Step
+
+ The ``ExternalProject_Add_Step`` function adds a custom step to an
+ external project::
+
+ ExternalProject_Add_Step(<name> <step> [<option>...])
+
+ Options are:
+
+ ``COMMAND <cmd>...``
+ Command line invoked by this step
+ ``COMMENT "<text>..."``
+ Text printed when step executes
+ ``DEPENDEES <step>...``
+ Steps on which this step depends
+ ``DEPENDERS <step>...``
+ Steps that depend on this step
+ ``DEPENDS <file>...``
+ Files on which this step depends
+ ``BYPRODUCTS <file>...``
+ Files that will be generated by this step but may or may not
+ have their modification time updated by subsequent builds.
+ ``ALWAYS 1``
+ No stamp file, step always runs
+ ``EXCLUDE_FROM_MAIN 1``
+ Main target does not depend on this step
+ ``WORKING_DIRECTORY <dir>``
+ Working directory for command
+ ``LOG 1``
+ Wrap step in script to log output
+ ``USES_TERMINAL 1``
+ Give the step direct access to the terminal if possible.
+
+ The command line, comment, working directory, and byproducts of every
+ standard and custom step are processed to replace tokens ``<SOURCE_DIR>``,
+ ``<BINARY_DIR>``, ``<INSTALL_DIR>``, and ``<TMP_DIR>`` with
+ corresponding property values.
+
+Any builtin step that specifies a ``<step>_COMMAND cmd...`` or custom
+step that specifies a ``COMMAND cmd...`` may specify additional command
+lines using the form ``COMMAND cmd...``. At build time the commands
+will be executed in order and aborted if any one fails. For example::
+
+ ... BUILD_COMMAND make COMMAND echo done ...
+
+specifies to run ``make`` and then ``echo done`` during the build step.
+Whether the current working directory is preserved between commands is
+not defined. Behavior of shell operators like ``&&`` is not defined.
+
+Arguments to ``<step>_COMMAND`` or ``COMMAND`` options may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+.. command:: ExternalProject_Get_Property
+
+ The ``ExternalProject_Get_Property`` function retrieves external project
+ target properties::
+
+ ExternalProject_Get_Property(<name> [prop1 [prop2 [...]]])
+
+ It stores property values in variables of the same name. Property
+ names correspond to the keyword argument names of
+ ``ExternalProject_Add``.
+
+.. command:: ExternalProject_Add_StepTargets
+
+ The ``ExternalProject_Add_StepTargets`` function generates custom
+ targets for the steps listed::
+
+ ExternalProject_Add_StepTargets(<name> [NO_DEPENDS] [step1 [step2 [...]]])
+
+If ``NO_DEPENDS`` is set, the target will not depend on the
+dependencies of the complete project. This is usually safe to use for
+the download, update, and patch steps that do not require that all the
+dependencies are updated and built. Using ``NO_DEPENDS`` for other
+of the default steps might break parallel builds, so you should avoid,
+it. For custom steps, you should consider whether or not the custom
+commands requires that the dependencies are configured, built and
+installed.
+
+If ``STEP_TARGETS`` or ``INDEPENDENT_STEP_TARGETS`` is set then
+``ExternalProject_Add_StepTargets`` is automatically called at the end
+of matching calls to ``ExternalProject_Add_Step``. Pass
+``STEP_TARGETS`` or ``INDEPENDENT_STEP_TARGETS`` explicitly to
+individual ``ExternalProject_Add`` calls, or implicitly to all
+``ExternalProject_Add`` calls by setting the directory properties
+``EP_STEP_TARGETS`` and ``EP_INDEPENDENT_STEP_TARGETS``. The
+``INDEPENDENT`` version of the argument and of the property will call
+``ExternalProject_Add_StepTargets`` with the ``NO_DEPENDS`` argument.
+
+If ``STEP_TARGETS`` and ``INDEPENDENT_STEP_TARGETS`` are not set,
+clients may still manually call ``ExternalProject_Add_StepTargets``
+after calling ``ExternalProject_Add`` or ``ExternalProject_Add_Step``.
+
+This functionality is provided to make it easy to drive the steps
+independently of each other by specifying targets on build command
+lines. For example, you may be submitting to a sub-project based
+dashboard, where you want to drive the configure portion of the build,
+then submit to the dashboard, followed by the build portion, followed
+by tests. If you invoke a custom target that depends on a step
+halfway through the step dependency chain, then all the previous steps
+will also run to ensure everything is up to date.
+
+For example, to drive configure, build and test steps independently
+for each ``ExternalProject_Add`` call in your project, write the following
+line prior to any ``ExternalProject_Add`` calls in your ``CMakeLists.txt``
+file::
+
+ set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test)
+
+.. command:: ExternalProject_Add_StepDependencies
+
+ The ``ExternalProject_Add_StepDependencies`` function add some
+ dependencies for some external project step::
+
+ ExternalProject_Add_StepDependencies(<name> <step> [target1 [target2 [...]]])
+
+ This function takes care to set both target and file level
+ dependencies, and will ensure that parallel builds will not break.
+ It should be used instead of :command:`add_dependencies()` when adding
+ a dependency for some of the step targets generated by
+ ``ExternalProject``.
+#]=======================================================================]
#=============================================================================
-# Copyright 2008-2012 Kitware, Inc.
+# Copyright 2008-2013 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -176,18 +385,18 @@
math(EXPR _ep_documentation_line_count "${CMAKE_CURRENT_LIST_LINE} - 16")
file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines
LIMIT_COUNT ${_ep_documentation_line_count}
- REGEX "^# ( \\[[A-Z0-9_]+ [^]]*\\] +#.*$|[A-Za-z0-9_]+\\()")
+ REGEX "^\\.\\. command:: [A-Za-z0-9_]+|^ ``[A-Z0-9_]+ .*``$")
foreach(line IN LISTS lines)
- if("${line}" MATCHES "^# [A-Za-z0-9_]+\\(")
+ if("${line}" MATCHES "^\\.\\. command:: ([A-Za-z0-9_]+)")
if(_ep_func)
set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$")
endif()
- string(REGEX REPLACE "^# ([A-Za-z0-9_]+)\\(.*" "\\1" _ep_func "${line}")
+ set(_ep_func "${CMAKE_MATCH_1}")
#message("function [${_ep_func}]")
set(_ep_keywords_${_ep_func} "^(")
set(_ep_keyword_sep)
- else()
- string(REGEX REPLACE "^# \\[([A-Z0-9_]+) .*" "\\1" _ep_key "${line}")
+ elseif("${line}" MATCHES "^ ``([A-Z0-9_]+) .*``$")
+ set(_ep_key "${CMAKE_MATCH_1}")
#message(" keyword [${_ep_key}]")
set(_ep_keywords_${_ep_func}
"${_ep_keywords_${_ep_func}}${_ep_keyword_sep}${_ep_key}")
@@ -216,7 +425,7 @@ function(_ep_parse_arguments f name ns args)
set(is_value 1)
if(arg MATCHES "^[A-Z][A-Z0-9_][A-Z0-9_]+$" AND
- NOT ((arg STREQUAL "${key}") AND (key STREQUAL "COMMAND")) AND
+ NOT (("x${arg}x" STREQUAL "x${key}x") AND ("x${key}x" STREQUAL "xCOMMANDx")) AND
NOT arg MATCHES "^(TRUE|FALSE)$")
if(_ep_keywords_${f} AND arg MATCHES "${_ep_keywords_${f}}")
set(is_value 0)
@@ -266,12 +475,28 @@ define_property(DIRECTORY PROPERTY "EP_STEP_TARGETS" INHERITED
BRIEF_DOCS
"List of ExternalProject steps that automatically get corresponding targets"
FULL_DOCS
+ "These targets will be dependent on the main target dependencies"
+ "See documentation of the ExternalProject_Add_StepTargets() function in the "
+ "ExternalProject module."
+ )
+
+define_property(DIRECTORY PROPERTY "EP_INDEPENDENT_STEP_TARGETS" INHERITED
+ BRIEF_DOCS
+ "List of ExternalProject steps that automatically get corresponding targets"
+ FULL_DOCS
+ "These targets will not be dependent on the main target dependencies"
"See documentation of the ExternalProject_Add_StepTargets() function in the "
"ExternalProject module."
)
+define_property(DIRECTORY PROPERTY "EP_UPDATE_DISCONNECTED" INHERITED
+ BRIEF_DOCS "Never update automatically from the remote repo."
+ FULL_DOCS
+ "See documentation of the ExternalProject_Add() function in the "
+ "ExternalProject module."
+ )
-function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag src_name work_dir gitclone_infofile gitclone_stampfile)
+function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name git_submodules src_name work_dir gitclone_infofile gitclone_stampfile)
file(WRITE ${script_filename}
"if(\"${git_tag}\" STREQUAL \"\")
message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
@@ -301,7 +526,7 @@ set(error_code 1)
set(number_of_tries 0)
while(error_code AND number_of_tries LESS 3)
execute_process(
- COMMAND \"${git_EXECUTABLE}\" clone \"${git_repository}\" \"${src_name}\"
+ COMMAND \"${git_EXECUTABLE}\" clone --origin \"${git_remote_name}\" \"${git_repository}\" \"${src_name}\"
WORKING_DIRECTORY \"${work_dir}\"
RESULT_VARIABLE error_code
)
@@ -325,7 +550,7 @@ if(error_code)
endif()
execute_process(
- COMMAND \"${git_EXECUTABLE}\" submodule init
+ COMMAND \"${git_EXECUTABLE}\" submodule init ${git_submodules}
WORKING_DIRECTORY \"${work_dir}/${src_name}\"
RESULT_VARIABLE error_code
)
@@ -334,7 +559,7 @@ if(error_code)
endif()
execute_process(
- COMMAND \"${git_EXECUTABLE}\" submodule update --recursive
+ COMMAND \"${git_EXECUTABLE}\" submodule update --recursive ${git_submodules}
WORKING_DIRECTORY \"${work_dir}/${src_name}\"
RESULT_VARIABLE error_code
)
@@ -386,7 +611,7 @@ if(error_code)
endif()
execute_process(
- COMMAND \"${hg_EXECUTABLE}\" clone \"${hg_repository}\" \"${src_name}\"
+ COMMAND \"${hg_EXECUTABLE}\" clone -U \"${hg_repository}\" \"${src_name}\"
WORKING_DIRECTORY \"${work_dir}\"
RESULT_VARIABLE error_code
)
@@ -422,7 +647,12 @@ endif()
endfunction()
-function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_repository work_dir)
+function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_remote_name git_submodules git_repository work_dir)
+ if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.6)
+ set(git_stash_save_options --all --quiet)
+ else()
+ set(git_stash_save_options --quiet)
+ endif()
file(WRITE ${script_filename}
"if(\"${git_tag}\" STREQUAL \"\")
message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
@@ -433,6 +663,7 @@ execute_process(
WORKING_DIRECTORY \"${work_dir}\"
RESULT_VARIABLE error_code
OUTPUT_VARIABLE head_sha
+ OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(error_code)
message(FATAL_ERROR \"Failed to get the hash for HEAD\")
@@ -451,6 +682,17 @@ else()
set(is_remote_ref 0)
endif()
+# Tag is in the form <remote>/<tag> (i.e. origin/master) we must strip
+# the remote from the tag.
+if(\"\${show_ref_output}\" MATCHES \"refs/remotes/${git_tag}\")
+ string(REGEX MATCH \"^([^/]+)/(.+)$\" _unused \"${git_tag}\")
+ set(git_remote \"\${CMAKE_MATCH_1}\")
+ set(git_tag \"\${CMAKE_MATCH_2}\")
+else()
+ set(git_remote \"${git_remote_name}\")
+ set(git_tag \"${git_tag}\")
+endif()
+
# This will fail if the tag does not exist (it probably has not been fetched
# yet).
execute_process(
@@ -458,6 +700,7 @@ execute_process(
WORKING_DIRECTORY \"${work_dir}\"
RESULT_VARIABLE error_code
OUTPUT_VARIABLE tag_sha
+ OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Is the hash checkout out that we want?
@@ -471,17 +714,98 @@ if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\"
message(FATAL_ERROR \"Failed to fetch repository '${git_repository}'\")
endif()
- execute_process(
- COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag}
- WORKING_DIRECTORY \"${work_dir}\"
- RESULT_VARIABLE error_code
- )
- if(error_code)
- message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
+ if(is_remote_ref)
+ # Check if stash is needed
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" status --porcelain
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ OUTPUT_VARIABLE repo_status
+ )
+ if(error_code)
+ message(FATAL_ERROR \"Failed to get the status\")
+ endif()
+ string(LENGTH \"\${repo_status}\" need_stash)
+
+ # If not in clean state, stash changes in order to be able to be able to
+ # perform git pull --rebase
+ if(need_stash)
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" stash save ${git_stash_save_options}
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ message(FATAL_ERROR \"Failed to stash changes\")
+ endif()
+ endif()
+
+ # Pull changes from the remote branch
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" rebase \${git_remote}/\${git_tag}
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ # Rebase failed: Restore previous state.
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" rebase --abort
+ WORKING_DIRECTORY \"${work_dir}\"
+ )
+ if(need_stash)
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet
+ WORKING_DIRECTORY \"${work_dir}\"
+ )
+ endif()
+ message(FATAL_ERROR \"\\nFailed to rebase in: '${work_dir}/${src_name}'.\\nYou will have to resolve the conflicts manually\")
+ endif()
+
+ if(need_stash)
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ # Stash pop --index failed: Try again dropping the index
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" reset --hard --quiet
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" stash pop --quiet
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ # Stash pop failed: Restore previous state.
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" reset --hard --quiet \${head_sha}
+ WORKING_DIRECTORY \"${work_dir}\"
+ )
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet
+ WORKING_DIRECTORY \"${work_dir}\"
+ )
+ message(FATAL_ERROR \"\\nFailed to unstash changes in: '${work_dir}/${src_name}'.\\nYou will have to resolve the conflicts manually\")
+ endif()
+ endif()
+ endif()
+ else()
+ execute_process(
+ COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag}
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+ if(error_code)
+ message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
+ endif()
endif()
execute_process(
- COMMAND \"${git_EXECUTABLE}\" submodule update --recursive
+ COMMAND \"${git_EXECUTABLE}\" submodule update --recursive ${git_submodules}
WORKING_DIRECTORY \"${work_dir}/${src_name}\"
RESULT_VARIABLE error_code
)
@@ -495,7 +819,7 @@ endif()
endfunction(_ep_write_gitupdate_script)
-function(_ep_write_downloadfile_script script_filename remote local timeout hash tls_verify tls_cainfo)
+function(_ep_write_downloadfile_script script_filename remote local timeout no_progress hash tls_verify tls_cainfo)
if(timeout)
set(timeout_args TIMEOUT ${timeout})
set(timeout_msg "${timeout} seconds")
@@ -504,11 +828,25 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash
set(timeout_msg "none")
endif()
+ if(no_progress)
+ set(show_progress "")
+ else()
+ set(show_progress "SHOW_PROGRESS")
+ endif()
+
if("${hash}" MATCHES "${_ep_hash_regex}")
- set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2})
+ string(CONCAT hash_check
+ "if(EXISTS \"${local}\")\n"
+ " file(\"${CMAKE_MATCH_1}\" \"${local}\" hash_value)\n"
+ " if(\"x\${hash_value}\" STREQUAL \"x${CMAKE_MATCH_2}\")\n"
+ " return()\n"
+ " endif()\n"
+ "endif()\n"
+ )
else()
- set(hash_args "# no EXPECTED_HASH")
+ set(hash_check "")
endif()
+
# check for curl globals in the project
if(DEFINED CMAKE_TLS_VERIFY)
set(tls_verify "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})")
@@ -532,7 +870,7 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash
endif()
file(WRITE ${script_filename}
-"message(STATUS \"downloading...
+"${hash_check}message(STATUS \"downloading...
src='${remote}'
dst='${local}'
timeout='${timeout_msg}'\")
@@ -543,8 +881,7 @@ ${tls_cainfo}
file(DOWNLOAD
\"${remote}\"
\"${local}\"
- SHOW_PROGRESS
- ${hash_args}
+ ${show_progress}
${timeout_args}
STATUS status
LOG log)
@@ -567,13 +904,31 @@ message(STATUS \"downloading... done\")
endfunction()
-function(_ep_write_verifyfile_script script_filename local hash)
+function(_ep_write_verifyfile_script script_filename local hash retries download_script)
if("${hash}" MATCHES "${_ep_hash_regex}")
set(algo "${CMAKE_MATCH_1}")
string(TOLOWER "${CMAKE_MATCH_2}" expect_value)
set(script_content "set(expect_value \"${expect_value}\")
-file(${algo} \"\${file}\" actual_value)
-if(\"\${actual_value}\" STREQUAL \"\${expect_value}\")
+set(attempt 0)
+set(succeeded 0)
+while(\${attempt} LESS ${retries} OR \${attempt} EQUAL ${retries} AND NOT \${succeeded})
+ file(${algo} \"\${file}\" actual_value)
+ if(\"\${actual_value}\" STREQUAL \"\${expect_value}\")
+ set(succeeded 1)
+ elseif(\${attempt} LESS ${retries})
+ message(STATUS \"${algo} hash of \${file}
+does not match expected value
+ expected: \${expect_value}
+ actual: \${actual_value}
+Retrying download.
+\")
+ file(REMOVE \"\${file}\")
+ execute_process(COMMAND \${CMAKE_COMMAND} -P \"${download_script}\")
+ endif()
+ math(EXPR attempt \"\${attempt} + 1\")
+endwhile()
+
+if(\${succeeded})
message(STATUS \"verifying file... done\")
else()
message(FATAL_ERROR \"error: ${algo} hash of
@@ -597,7 +952,7 @@ endfunction()
function(_ep_write_extractfile_script script_filename name filename directory)
set(args "")
- if(filename MATCHES "(\\.|=)(bz2|tar\\.gz|tgz|zip)$")
+ if(filename MATCHES "(\\.|=)(7z|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
set(args xfz)
endif()
@@ -606,7 +961,7 @@ function(_ep_write_extractfile_script script_filename name filename directory)
endif()
if(args STREQUAL "")
- message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .bz2, .tar, .tar.gz, .tgz and .zip")
+ message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .7z, .tar, .tar.bz2, .tar.gz, .tar.xz, .tbz2, .tgz, .txz and .zip")
return()
endif()
@@ -761,23 +1116,25 @@ macro(_ep_replace_location_tags target_name)
endmacro()
-function(_ep_write_initial_cache target_name script_filename args)
- # Write out values into an initial cache, that will be passed to CMake with -C
+function(_ep_command_line_to_initial_cache var args force)
set(script_initial_cache "")
set(regex "^([^:]+):([^=]+)=(.*)$")
set(setArg "")
+ set(forceArg "")
+ if(force)
+ set(forceArg "FORCE")
+ endif()
foreach(line ${args})
- if("${line}" MATCHES "^-D")
+ if("${line}" MATCHES "^-D(.*)")
+ set(line "${CMAKE_MATCH_1}")
if(setArg)
# This is required to build up lists in variables, or complete an entry
- set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)")
+ set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})")
set(script_initial_cache "${script_initial_cache}\n${setArg}")
set(accumulator "")
set(setArg "")
endif()
- string(REGEX REPLACE "^-D" "" line ${line})
if("${line}" MATCHES "${regex}")
- string(REGEX MATCH "${regex}" match "${line}")
set(name "${CMAKE_MATCH_1}")
set(type "${CMAKE_MATCH_2}")
set(value "${CMAKE_MATCH_3}")
@@ -792,16 +1149,19 @@ function(_ep_write_initial_cache target_name script_filename args)
endforeach()
# Catch the final line of the args
if(setArg)
- set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)")
+ set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})")
set(script_initial_cache "${script_initial_cache}\n${setArg}")
endif()
+ set(${var} ${script_initial_cache} PARENT_SCOPE)
+endfunction()
+
+
+function(_ep_write_initial_cache target_name script_filename script_initial_cache)
+ # Write out values into an initial cache, that will be passed to CMake with -C
# Replace location tags.
_ep_replace_location_tags(${target_name} script_initial_cache)
# Write out the initial cache file to the location specified.
- if(NOT EXISTS "${script_filename}.in")
- file(WRITE "${script_filename}.in" "\@script_initial_cache\@\n")
- endif()
- configure_file("${script_filename}.in" "${script_filename}")
+ file(GENERATE OUTPUT "${script_filename}" CONTENT "${script_initial_cache}")
endfunction()
@@ -858,7 +1218,7 @@ function(_ep_get_build_command name step cmd_var)
if(step STREQUAL "INSTALL")
set(args install)
endif()
- if(step STREQUAL "TEST")
+ if("x${step}x" STREQUAL "xTESTx")
set(args test)
endif()
else()
@@ -869,14 +1229,35 @@ function(_ep_get_build_command name step cmd_var)
else()
set(cmd "${CMAKE_COMMAND}")
endif()
- set(args --build ${binary_dir} --config ${CMAKE_CFG_INTDIR})
+ set(args --build ".")
+ if(CMAKE_CONFIGURATION_TYPES)
+ if (CMAKE_CFG_INTDIR AND
+ NOT CMAKE_CFG_INTDIR STREQUAL "." AND
+ NOT CMAKE_CFG_INTDIR MATCHES "\\$")
+ # CMake 3.4 and below used the CMAKE_CFG_INTDIR placeholder value
+ # provided by multi-configuration generators. Some projects were
+ # taking advantage of that undocumented implementation detail to
+ # specify a specific configuration here. They should use
+ # BUILD_COMMAND to change the default command instead, but for
+ # compatibility honor the value.
+ set(config ${CMAKE_CFG_INTDIR})
+ message(AUTHOR_WARNING "CMAKE_CFG_INTDIR should not be set by project code.\n"
+ "To get a non-default build command, use the BUILD_COMMAND option.")
+ else()
+ set(config $<CONFIG>)
+ endif()
+ list(APPEND args --config ${config})
+ endif()
if(step STREQUAL "INSTALL")
list(APPEND args --target install)
endif()
# But for "TEST" drive the project with corresponding "ctest".
- if(step STREQUAL "TEST")
+ if("x${step}x" STREQUAL "xTESTx")
string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}")
set(args "")
+ if(CMAKE_CONFIGURATION_TYPES)
+ list(APPEND args -C ${config})
+ endif()
endif()
endif()
else()
@@ -890,7 +1271,7 @@ function(_ep_get_build_command name step cmd_var)
if(step STREQUAL "INSTALL")
set(args install)
endif()
- if(step STREQUAL "TEST")
+ if("x${step}x" STREQUAL "xTESTx")
set(args test)
endif()
endif()
@@ -913,7 +1294,7 @@ function(_ep_write_log_script name step cmd_var)
set(make "")
set(code_cygpath_make "")
- if("${command}" MATCHES "^\\$\\(MAKE\\)")
+ if(command MATCHES "^\\$\\(MAKE\\)")
# GNU make recognizes the string "$(MAKE)" as recursive make, so
# ensure that it appears directly in the makefile.
string(REGEX REPLACE "^\\$\\(MAKE\\)" "\${make}" command "${command}")
@@ -945,7 +1326,7 @@ endif()
# Wrap multiple 'COMMAND' lines up into a second-level wrapper
# script so all output can be sent to one log file.
- if("${command}" MATCHES ";COMMAND;")
+ if(command MATCHES "(^|;)COMMAND;")
set(code_execute_process "
${code_cygpath_make}
execute_process(COMMAND \${command} RESULT_VARIABLE result)
@@ -962,7 +1343,9 @@ endif()
set(sep "")
foreach(arg IN LISTS command)
if("x${arg}" STREQUAL "xCOMMAND")
- set(code "${code}set(command \"${cmd}\")${code_execute_process}")
+ if(NOT "x${cmd}" STREQUAL "x")
+ set(code "${code}set(command \"${cmd}\")${code_execute_process}")
+ endif()
set(cmd "")
set(sep "")
else()
@@ -971,14 +1354,14 @@ endif()
endif()
endforeach()
set(code "${code}set(command \"${cmd}\")${code_execute_process}")
- file(WRITE ${stamp_dir}/${name}-${step}-impl.cmake "${code}")
- set(command ${CMAKE_COMMAND} "-Dmake=\${make}" "-Dconfig=\${config}" -P ${stamp_dir}/${name}-${step}-impl.cmake)
+ file(GENERATE OUTPUT "${stamp_dir}/${name}-${step}-$<CONFIG>-impl.cmake" CONTENT "${code}")
+ set(command ${CMAKE_COMMAND} "-Dmake=\${make}" "-Dconfig=\${config}" -P ${stamp_dir}/${name}-${step}-$<CONFIG>-impl.cmake)
endif()
# Wrap the command in a script to log output to files.
- set(script ${stamp_dir}/${name}-${step}.cmake)
+ set(script ${stamp_dir}/${name}-${step}-$<CONFIG>.cmake)
set(logbase ${stamp_dir}/${name}-${step})
- file(WRITE ${script} "
+ set(code "
${code_cygpath_make}
set(command \"${command}\")
execute_process(
@@ -992,13 +1375,14 @@ if(result)
foreach(arg IN LISTS command)
set(msg \"\${msg} '\${arg}'\")
endforeach()
- set(msg \"\${msg}\\nSee also\\n ${logbase}-*.log\\n\")
+ set(msg \"\${msg}\\nSee also\\n ${logbase}-*.log\")
message(FATAL_ERROR \"\${msg}\")
else()
- set(msg \"${name} ${step} command succeeded. See also ${logbase}-*.log\\n\")
+ set(msg \"${name} ${step} command succeeded. See also ${logbase}-*.log\")
message(STATUS \"\${msg}\")
endif()
")
+ file(GENERATE OUTPUT "${script}" CONTENT "${code}")
set(command ${CMAKE_COMMAND} ${make} ${config} -P ${script})
set(${cmd_var} "${command}" PARENT_SCOPE)
endfunction()
@@ -1032,17 +1416,28 @@ endfunction()
function(ExternalProject_Add_StepTargets name)
set(steps ${ARGN})
-
+ if(ARGC GREATER 1 AND "${ARGV1}" STREQUAL "NO_DEPENDS")
+ set(no_deps 1)
+ list(REMOVE_AT steps 0)
+ endif()
foreach(step ${steps})
+ if(no_deps AND "${step}" MATCHES "^(configure|build|install|test)$")
+ message(AUTHOR_WARNING "Using NO_DEPENDS for \"${step}\" step might break parallel builds")
+ endif()
_ep_get_step_stampfile(${name} ${step} stamp_file)
add_custom_target(${name}-${step}
DEPENDS ${stamp_file})
+ set_property(TARGET ${name}-${step} PROPERTY _EP_IS_EXTERNAL_PROJECT_STEP 1)
+ set_property(TARGET ${name}-${step} PROPERTY LABELS ${name})
+ set_property(TARGET ${name}-${step} PROPERTY FOLDER "ExternalProjectTargets/${name}")
# Depend on other external projects (target-level).
- get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
- foreach(arg IN LISTS deps)
- add_dependencies(${name}-${step} ${arg})
- endforeach()
+ if(NOT no_deps)
+ get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
+ foreach(arg IN LISTS deps)
+ add_dependencies(${name}-${step} ${arg})
+ endforeach()
+ endif()
endforeach()
endfunction()
@@ -1054,14 +1449,17 @@ function(ExternalProject_Add_Step name step)
set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete")
_ep_get_step_stampfile(${name} ${step} stamp_file)
- add_custom_command(APPEND
- OUTPUT ${complete_stamp_file}
- DEPENDS ${stamp_file}
- )
-
_ep_parse_arguments(ExternalProject_Add_Step
${name} _EP_${step}_ "${ARGN}")
+ get_property(exclude_from_main TARGET ${name} PROPERTY _EP_${step}_EXCLUDE_FROM_MAIN)
+ if(NOT exclude_from_main)
+ add_custom_command(APPEND
+ OUTPUT ${complete_stamp_file}
+ DEPENDS ${stamp_file}
+ )
+ endif()
+
# Steps depending on this step.
get_property(dependers TARGET ${name} PROPERTY _EP_${step}_DEPENDERS)
foreach(depender IN LISTS dependers)
@@ -1075,6 +1473,9 @@ function(ExternalProject_Add_Step name step)
# Dependencies on files.
get_property(depends TARGET ${name} PROPERTY _EP_${step}_DEPENDS)
+ # Byproducts of the step.
+ get_property(byproducts TARGET ${name} PROPERTY _EP_${step}_BYPRODUCTS)
+
# Dependencies on steps.
get_property(dependees TARGET ${name} PROPERTY _EP_${step}_DEPENDEES)
foreach(dependee IN LISTS dependees)
@@ -1098,7 +1499,7 @@ function(ExternalProject_Add_Step name step)
endif()
# Replace location tags.
- _ep_replace_location_tags(${name} comment command work_dir)
+ _ep_replace_location_tags(${name} comment command work_dir byproducts)
# Custom comment?
get_property(comment_set TARGET ${name} PROPERTY _EP_${step}_COMMENT SET)
@@ -1106,11 +1507,28 @@ function(ExternalProject_Add_Step name step)
get_property(comment TARGET ${name} PROPERTY _EP_${step}_COMMENT)
endif()
+ # Uses terminal?
+ get_property(uses_terminal TARGET ${name} PROPERTY _EP_${step}_USES_TERMINAL)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL)
+ else()
+ set(uses_terminal "")
+ endif()
+
# Run every time?
get_property(always TARGET ${name} PROPERTY _EP_${step}_ALWAYS)
if(always)
set_property(SOURCE ${stamp_file} PROPERTY SYMBOLIC 1)
set(touch)
+ # Remove any existing stamp in case the option changed in an existing tree.
+ if(CMAKE_CONFIGURATION_TYPES)
+ foreach(cfg ${CMAKE_CONFIGURATION_TYPES})
+ string(REPLACE "/${CMAKE_CFG_INTDIR}" "/${cfg}" stamp_file_config "${stamp_file}")
+ file(REMOVE ${stamp_file_config})
+ endforeach()
+ else()
+ file(REMOVE ${stamp_file})
+ endif()
else()
set(touch ${CMAKE_COMMAND} -E touch ${stamp_file})
endif()
@@ -1121,15 +1539,27 @@ function(ExternalProject_Add_Step name step)
_ep_write_log_script(${name} ${step} command)
endif()
+ if("${command}" STREQUAL "")
+ # Some generators (i.e. Xcode) will not generate a file level target
+ # if no command is set, and therefore the dependencies on this
+ # target will be broken.
+ # The empty command is replaced by an echo command here in order to
+ # avoid this issue.
+ set(command ${CMAKE_COMMAND} -E echo_append)
+ endif()
+
add_custom_command(
OUTPUT ${stamp_file}
+ BYPRODUCTS ${byproducts}
COMMENT ${comment}
COMMAND ${command}
COMMAND ${touch}
DEPENDS ${depends}
WORKING_DIRECTORY ${work_dir}
VERBATIM
+ ${uses_terminal}
)
+ set_property(TARGET ${name} APPEND PROPERTY _EP_STEPS ${step})
# Add custom "step target"?
get_property(step_targets TARGET ${name} PROPERTY _EP_STEP_TARGETS)
@@ -1142,6 +1572,69 @@ function(ExternalProject_Add_Step name step)
break()
endif()
endforeach()
+
+ get_property(independent_step_targets TARGET ${name} PROPERTY _EP_INDEPENDENT_STEP_TARGETS)
+ if(NOT independent_step_targets)
+ get_property(independent_step_targets DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS)
+ endif()
+ foreach(st ${independent_step_targets})
+ if("${st}" STREQUAL "${step}")
+ ExternalProject_Add_StepTargets(${name} NO_DEPENDS ${step})
+ break()
+ endif()
+ endforeach()
+endfunction()
+
+
+function(ExternalProject_Add_StepDependencies name step)
+ set(dependencies ${ARGN})
+
+ # Sanity checks on "name" and "step".
+ if(NOT TARGET ${name})
+ message(FATAL_ERROR "Cannot find target \"${name}\". Perhaps it has not yet been created using ExternalProject_Add.")
+ endif()
+
+ get_property(type TARGET ${name} PROPERTY TYPE)
+ if(NOT type STREQUAL "UTILITY")
+ message(FATAL_ERROR "Target \"${name}\" was not generated by ExternalProject_Add.")
+ endif()
+
+ get_property(is_ep TARGET ${name} PROPERTY _EP_IS_EXTERNAL_PROJECT)
+ if(NOT is_ep)
+ message(FATAL_ERROR "Target \"${name}\" was not generated by ExternalProject_Add.")
+ endif()
+
+ get_property(steps TARGET ${name} PROPERTY _EP_STEPS)
+ list(FIND steps ${step} is_step)
+ if(NOT is_step)
+ message(FATAL_ERROR "External project \"${name}\" does not have a step \"${step}\".")
+ endif()
+
+ if(TARGET ${name}-${step})
+ get_property(type TARGET ${name}-${step} PROPERTY TYPE)
+ if(NOT type STREQUAL "UTILITY")
+ message(FATAL_ERROR "Target \"${name}-${step}\" was not generated by ExternalProject_Add_StepTargets.")
+ endif()
+ get_property(is_ep_step TARGET ${name}-${step} PROPERTY _EP_IS_EXTERNAL_PROJECT_STEP)
+ if(NOT is_ep_step)
+ message(FATAL_ERROR "Target \"${name}-${step}\" was not generated by ExternalProject_Add_StepTargets.")
+ endif()
+ endif()
+
+ # Always add file-level dependency, but add target-level dependency
+ # only if the target exists for that step.
+ _ep_get_step_stampfile(${name} ${step} stamp_file)
+ foreach(dep ${dependencies})
+ add_custom_command(APPEND
+ OUTPUT ${stamp_file}
+ DEPENDS ${dep})
+ if(TARGET ${name}-${step})
+ foreach(dep ${dependencies})
+ add_dependencies(${name}-${step} ${dep})
+ endforeach()
+ endif()
+ endforeach()
+
endfunction()
@@ -1163,20 +1656,6 @@ function(_ep_add_mkdir_command name)
endfunction()
-function(_ep_get_git_version git_EXECUTABLE git_version_var)
- if(git_EXECUTABLE)
- execute_process(
- COMMAND "${git_EXECUTABLE}" --version
- OUTPUT_VARIABLE ov
- ERROR_VARIABLE ev
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- string(REGEX REPLACE "^git version (.+)$" "\\1" version "${ov}")
- set(${git_version_var} "${version}" PARENT_SCOPE)
- endif()
-endfunction()
-
-
function(_ep_is_dir_empty dir empty_var)
file(GLOB gr "${dir}/*")
if("${gr}" STREQUAL "")
@@ -1209,7 +1688,7 @@ function(_ep_add_download_command name)
if(cmd_set)
set(work_dir ${download_dir})
elseif(cvs_repository)
- find_package(CVS)
+ find_package(CVS QUIET)
if(NOT CVS_EXECUTABLE)
message(FATAL_ERROR "error: could not find cvs for checkout of ${name}")
endif()
@@ -1236,7 +1715,7 @@ function(_ep_add_download_command name)
set(cmd ${CVS_EXECUTABLE} -d ${cvs_repository} -q co ${cvs_tag} -d ${src_name} ${cvs_module})
list(APPEND depends ${stamp_dir}/${name}-cvsinfo.txt)
elseif(svn_repository)
- find_package(Subversion)
+ find_package(Subversion QUIET)
if(NOT Subversion_SVN_EXECUTABLE)
message(FATAL_ERROR "error: could not find svn for checkout of ${name}")
endif()
@@ -1272,22 +1751,28 @@ function(_ep_add_download_command name)
--non-interactive ${svn_trust_cert_args} ${svn_user_pw_args} ${src_name})
list(APPEND depends ${stamp_dir}/${name}-svninfo.txt)
elseif(git_repository)
- find_package(Git)
+ unset(CMAKE_MODULE_PATH) # Use CMake builtin find module
+ find_package(Git QUIET)
if(NOT GIT_EXECUTABLE)
message(FATAL_ERROR "error: could not find git for clone of ${name}")
endif()
# The git submodule update '--recursive' flag requires git >= v1.6.5
#
- _ep_get_git_version("${GIT_EXECUTABLE}" git_version)
- if(git_version VERSION_LESS 1.6.5)
- message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': git_version='${git_version}'")
+ if(GIT_VERSION_STRING VERSION_LESS 1.6.5)
+ message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': GIT_VERSION_STRING='${GIT_VERSION_STRING}'")
endif()
get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG)
if(NOT git_tag)
set(git_tag "master")
endif()
+ get_property(git_submodules TARGET ${name} PROPERTY _EP_GIT_SUBMODULES)
+
+ get_property(git_remote_name TARGET ${name} PROPERTY _EP_GIT_REMOTE_NAME)
+ if(NOT git_remote_name)
+ set(git_remote_name "origin")
+ endif()
# For the download step, and the git clone operation, only the repository
# should be recorded in a configured RepositoryInfo file. If the repo
@@ -1312,14 +1797,14 @@ function(_ep_add_download_command name)
# The script will delete the source directory and then call git clone.
#
_ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir}
- ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${src_name} ${work_dir}
+ ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} "${git_submodules}" ${src_name} ${work_dir}
${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt
)
set(comment "Performing download step (git clone) for '${name}'")
set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitclone.cmake)
list(APPEND depends ${stamp_dir}/${name}-gitinfo.txt)
elseif(hg_repository)
- find_package(Hg)
+ find_package(Hg QUIET)
if(NOT HG_EXECUTABLE)
message(FATAL_ERROR "error: could not find hg for clone of ${name}")
endif()
@@ -1376,6 +1861,8 @@ function(_ep_add_download_command name)
set(repository "external project URL")
set(module "${url}")
set(tag "${hash}")
+ set(retries 0)
+ set(download_script "")
configure_file(
"${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
"${stamp_dir}/${name}-urlinfo.txt"
@@ -1393,28 +1880,30 @@ function(_ep_add_download_command name)
if("x${fname}" STREQUAL "x")
string(REGEX MATCH "[^/\\?]*$" fname "${url}")
endif()
- if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$")
- string(REGEX MATCH "([^/\\?]+(\\.|=)(bz2|tar|tgz|tar\\.gz|zip))/.*$" match_result "${url}")
+ if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
+ string(REGEX MATCH "([^/\\?]+(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip))/.*$" match_result "${url}")
set(fname "${CMAKE_MATCH_1}")
endif()
- if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$")
+ if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}")
endif()
string(REPLACE ";" "-" fname "${fname}")
set(file ${download_dir}/${fname})
get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT)
+ get_property(no_progress TARGET ${name} PROPERTY _EP_DOWNLOAD_NO_PROGRESS)
get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO)
- _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake"
- "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}")
- set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake
+ set(download_script "${stamp_dir}/download-${name}.cmake")
+ _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}")
+ set(cmd ${CMAKE_COMMAND} -P "${download_script}"
COMMAND)
+ set(retries 3)
set(comment "Performing download step (download, verify and extract) for '${name}'")
else()
set(file "${url}")
set(comment "Performing download step (verify and extract) for '${name}'")
endif()
- _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}")
+ _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}" "${retries}" "${download_script}")
list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake
COMMAND)
_ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${name}" "${file}" "${source_dir}")
@@ -1423,7 +1912,18 @@ function(_ep_add_download_command name)
else()
_ep_is_dir_empty("${source_dir}" empty)
if(${empty})
- message(SEND_ERROR "error: no download info for '${name}' -- please specify existing/non-empty SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY, GIT_REPOSITORY, HG_REPOSITORY or DOWNLOAD_COMMAND")
+ message(SEND_ERROR
+ "No download info given for '${name}' and its source directory:\n"
+ " ${source_dir}\n"
+ "is not an existing non-empty directory. Please specify one of:\n"
+ " * SOURCE_DIR with an existing non-empty directory\n"
+ " * URL\n"
+ " * GIT_REPOSITORY\n"
+ " * HG_REPOSITORY\n"
+ " * CVS_REPOSITORY and CVS_MODULE\n"
+ " * SVN_REVISION\n"
+ " * DOWNLOAD_COMMAND"
+ )
endif()
endif()
@@ -1434,6 +1934,14 @@ function(_ep_add_download_command name)
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_DOWNLOAD)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
ExternalProject_Add_Step(${name} download
COMMENT ${comment}
COMMAND ${cmd}
@@ -1441,6 +1949,7 @@ function(_ep_add_download_command name)
DEPENDS ${depends}
DEPENDEES mkdir
${log}
+ ${uses_terminal}
)
endfunction()
@@ -1454,6 +1963,12 @@ function(_ep_add_update_command name)
get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY)
get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY)
get_property(hg_repository TARGET ${name} PROPERTY _EP_HG_REPOSITORY )
+ get_property(update_disconnected_set TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED SET)
+ if(update_disconnected_set)
+ get_property(update_disconnected TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED)
+ else()
+ get_property(update_disconnected DIRECTORY PROPERTY EP_UPDATE_DISCONNECTED)
+ endif()
set(work_dir)
set(comment)
@@ -1503,8 +2018,13 @@ function(_ep_add_update_command name)
if(NOT git_tag)
set(git_tag "master")
endif()
+ get_property(git_remote_name TARGET ${name} PROPERTY _EP_GIT_REMOTE_NAME)
+ if(NOT git_remote_name)
+ set(git_remote_name "origin")
+ endif()
+ get_property(git_submodules TARGET ${name} PROPERTY _EP_GIT_SUBMODULES)
_ep_write_gitupdate_script(${tmp_dir}/${name}-gitupdate.cmake
- ${GIT_EXECUTABLE} ${git_tag} ${git_repository} ${work_dir}
+ ${GIT_EXECUTABLE} ${git_tag} ${git_remote_name} "${git_submodules}" ${git_repository} ${work_dir}
)
set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake)
set(always 1)
@@ -1538,14 +2058,40 @@ Update to Mercurial >= 2.1.1.
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_UPDATE)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
ExternalProject_Add_Step(${name} update
COMMENT ${comment}
COMMAND ${cmd}
ALWAYS ${always}
+ EXCLUDE_FROM_MAIN ${update_disconnected}
WORKING_DIRECTORY ${work_dir}
DEPENDEES download
${log}
+ ${uses_terminal}
+ )
+
+ if(always AND update_disconnected)
+ _ep_get_step_stampfile(${name} skip-update skip-update_stamp_file)
+ string(REPLACE "Performing" "Skipping" comment "${comment}")
+ ExternalProject_Add_Step(${name} skip-update
+ COMMENT ${comment}
+ ALWAYS 1
+ EXCLUDE_FROM_MAIN 1
+ WORKING_DIRECTORY ${work_dir}
+ DEPENDEES download
+ ${log}
+ ${uses_terminal}
)
+ set_property(SOURCE ${skip-update_stamp_file} PROPERTY SYMBOLIC 1)
+ endif()
+
endfunction()
@@ -1577,10 +2123,13 @@ function(_ep_add_configure_command name)
set(file_deps)
get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
foreach(dep IN LISTS deps)
- get_property(is_ep TARGET ${dep} PROPERTY _EP_IS_EXTERNAL_PROJECT)
- if(is_ep)
- _ep_get_step_stampfile(${dep} "done" done_stamp_file)
- list(APPEND file_deps ${done_stamp_file})
+ get_property(dep_type TARGET ${dep} PROPERTY TYPE)
+ if(dep_type STREQUAL "UTILITY")
+ get_property(is_ep TARGET ${dep} PROPERTY _EP_IS_EXTERNAL_PROJECT)
+ if(is_ep)
+ _ep_get_step_stampfile(${dep} "done" done_stamp_file)
+ list(APPEND file_deps ${done_stamp_file})
+ endif()
endif()
endforeach()
@@ -1598,18 +2147,31 @@ function(_ep_add_configure_command name)
get_property(cmake_args TARGET ${name} PROPERTY _EP_CMAKE_ARGS)
list(APPEND cmd ${cmake_args})
- # If there are any CMAKE_CACHE_ARGS, write an initial cache and use it
+ # If there are any CMAKE_CACHE_ARGS or CMAKE_CACHE_DEFAULT_ARGS,
+ # write an initial cache and use it
get_property(cmake_cache_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_ARGS)
- if(cmake_cache_args)
- set(_ep_cache_args_script "${tmp_dir}/${name}-cache.cmake")
- _ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${cmake_cache_args}")
+ get_property(cmake_cache_default_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_DEFAULT_ARGS)
+
+ if(cmake_cache_args OR cmake_cache_default_args)
+ set(_ep_cache_args_script "${tmp_dir}/${name}-cache-$<CONFIG>.cmake")
+ if(cmake_cache_args)
+ _ep_command_line_to_initial_cache(script_initial_cache_force "${cmake_cache_args}" 1)
+ endif()
+ if(cmake_cache_default_args)
+ _ep_command_line_to_initial_cache(script_initial_cache_default "${cmake_cache_default_args}" 0)
+ endif()
+ _ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${script_initial_cache_force}${script_initial_cache_default}")
list(APPEND cmd "-C${_ep_cache_args_script}")
endif()
get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
+ get_target_property(cmake_generator_platform ${name} _EP_CMAKE_GENERATOR_PLATFORM)
get_target_property(cmake_generator_toolset ${name} _EP_CMAKE_GENERATOR_TOOLSET)
if(cmake_generator)
list(APPEND cmd "-G${cmake_generator}")
+ if(cmake_generator_platform)
+ list(APPEND cmd "-A${cmake_generator_platform}")
+ endif()
if(cmake_generator_toolset)
list(APPEND cmd "-T${cmake_generator_toolset}")
endif()
@@ -1619,6 +2181,12 @@ function(_ep_add_configure_command name)
else()
list(APPEND cmd "-G${CMAKE_GENERATOR}")
endif()
+ if(cmake_generator_platform)
+ message(FATAL_ERROR "Option CMAKE_GENERATOR_PLATFORM not allowed without CMAKE_GENERATOR.")
+ endif()
+ if(CMAKE_GENERATOR_PLATFORM)
+ list(APPEND cmd "-A${CMAKE_GENERATOR_PLATFORM}")
+ endif()
if(cmake_generator_toolset)
message(FATAL_ERROR "Option CMAKE_GENERATOR_TOOLSET not allowed without CMAKE_GENERATOR.")
endif()
@@ -1648,12 +2216,33 @@ function(_ep_add_configure_command name)
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_CONFIGURE)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
+ get_property(update_disconnected_set TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED SET)
+ if(update_disconnected_set)
+ get_property(update_disconnected TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED)
+ else()
+ get_property(update_disconnected DIRECTORY PROPERTY EP_UPDATE_DISCONNECTED)
+ endif()
+ if(update_disconnected)
+ set(update_dep skip-update)
+ else()
+ set(update_dep update)
+ endif()
+
ExternalProject_Add_Step(${name} configure
COMMAND ${cmd}
WORKING_DIRECTORY ${binary_dir}
- DEPENDEES update patch
+ DEPENDEES ${update_dep} patch
DEPENDS ${file_deps}
${log}
+ ${uses_terminal}
)
endfunction()
@@ -1675,11 +2264,31 @@ function(_ep_add_build_command name)
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_BUILD)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
+ get_property(build_always TARGET ${name} PROPERTY _EP_BUILD_ALWAYS)
+ if(build_always)
+ set(always 1)
+ else()
+ set(always 0)
+ endif()
+
+ get_property(build_byproducts TARGET ${name} PROPERTY _EP_BUILD_BYPRODUCTS)
+
ExternalProject_Add_Step(${name} build
COMMAND ${cmd}
+ BYPRODUCTS ${build_byproducts}
WORKING_DIRECTORY ${binary_dir}
DEPENDEES configure
+ ALWAYS ${always}
${log}
+ ${uses_terminal}
)
endfunction()
@@ -1701,11 +2310,20 @@ function(_ep_add_install_command name)
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_INSTALL)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
ExternalProject_Add_Step(${name} install
COMMAND ${cmd}
WORKING_DIRECTORY ${binary_dir}
DEPENDEES build
${log}
+ ${uses_terminal}
)
endfunction()
@@ -1715,12 +2333,13 @@ function(_ep_add_test_command name)
get_property(before TARGET ${name} PROPERTY _EP_TEST_BEFORE_INSTALL)
get_property(after TARGET ${name} PROPERTY _EP_TEST_AFTER_INSTALL)
+ get_property(exclude TARGET ${name} PROPERTY _EP_TEST_EXCLUDE_FROM_MAIN)
get_property(cmd_set TARGET ${name} PROPERTY _EP_TEST_COMMAND SET)
# Only actually add the test step if one of the test related properties is
# explicitly set. (i.e. the test step is omitted unless requested...)
#
- if(cmd_set OR before OR after)
+ if(cmd_set OR before OR after OR exclude)
if(cmd_set)
get_property(cmd TARGET ${name} PROPERTY _EP_TEST_COMMAND)
else()
@@ -1728,9 +2347,21 @@ function(_ep_add_test_command name)
endif()
if(before)
- set(dep_args DEPENDEES build DEPENDERS install)
+ set(dependees_args DEPENDEES build)
else()
- set(dep_args DEPENDEES install)
+ set(dependees_args DEPENDEES install)
+ endif()
+
+ if(exclude)
+ set(dependers_args "")
+ set(exclude_args EXCLUDE_FROM_MAIN 1)
+ else()
+ if(before)
+ set(dependers_args DEPENDERS install)
+ else()
+ set(dependers_args "")
+ endif()
+ set(exclude_args "")
endif()
get_property(log TARGET ${name} PROPERTY _EP_LOG_TEST)
@@ -1740,11 +2371,22 @@ function(_ep_add_test_command name)
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_TEST)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
ExternalProject_Add_Step(${name} test
COMMAND ${cmd}
WORKING_DIRECTORY ${binary_dir}
- ${dep_args}
+ ${dependees_args}
+ ${dependers_args}
+ ${exclude_args}
${log}
+ ${uses_terminal}
)
endif()
endfunction()
@@ -1757,13 +2399,25 @@ function(ExternalProject_Add name)
set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete")
+ # The "ALL" option to add_custom_target just tells it to not set the
+ # EXCLUDE_FROM_ALL target property. Later, if the EXCLUDE_FROM_ALL
+ # argument was passed, we explicitly set it for the target.
add_custom_target(${name} ALL DEPENDS ${complete_stamp_file})
set_property(TARGET ${name} PROPERTY _EP_IS_EXTERNAL_PROJECT 1)
+ set_property(TARGET ${name} PROPERTY LABELS ${name})
+ set_property(TARGET ${name} PROPERTY FOLDER "ExternalProjectTargets/${name}")
+
_ep_parse_arguments(ExternalProject_Add ${name} _EP_ "${ARGN}")
_ep_set_directories(${name})
_ep_get_step_stampfile(${name} "done" done_stamp_file)
_ep_get_step_stampfile(${name} "install" install_stamp_file)
+ # Set the EXCLUDE_FROM_ALL target property if required.
+ get_property(exclude_from_all TARGET ${name} PROPERTY _EP_EXCLUDE_FROM_ALL)
+ if(exclude_from_all)
+ set_property(TARGET ${name} PROPERTY EXCLUDE_FROM_ALL TRUE)
+ endif()
+
# The 'complete' step depends on all other steps and creates a
# 'done' mark. A dependent external project's 'configure' step
# depends on the 'done' mark so that it rebuilds when this project
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index 5d98ac3cf..dc3108623 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -1,171 +1,271 @@
-# - Macros for generating a summary of enabled/disabled features
+#.rst:
+# FeatureSummary
+# --------------
#
-# This module provides the macros feature_summary(), set_package_properties() and
-# add_feature_info().
-# For compatibility it also still provides set_package_info(), set_feature_info(),
+# Macros for generating a summary of enabled/disabled features
+#
+#
+#
+# This module provides the macros feature_summary(),
+# set_package_properties() and add_feature_info(). For compatibility it
+# also still provides set_package_info(), set_feature_info(),
# print_enabled_features() and print_disabled_features().
#
# These macros can be used to generate a summary of enabled and disabled
# packages and/or feature for a build tree:
#
-# -- The following OPTIONAL packages have been found:
-# LibXml2 (required version >= 2.4) , XML processing library. , <http://xmlsoft.org>
-# * Enables HTML-import in MyWordProcessor
-# * Enables odt-export in MyWordProcessor
-# PNG , A PNG image library. , <http://www.libpng.org/pub/png/>
-# * Enables saving screenshots
-# -- The following OPTIONAL packages have not been found:
-# Lua51 , The Lua scripting language. , <http://www.lua.org>
-# * Enables macros in MyWordProcessor
-# Foo , Foo provides cool stuff.
-#
-#
-# FEATURE_SUMMARY( [FILENAME <file>]
-# [APPEND]
-# [VAR <variable_name>]
-# [INCLUDE_QUIET_PACKAGES]
-# [FATAL_ON_MISSING_REQUIRED_PACKAGES]
-# [DESCRIPTION "Found packages:"]
-# WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND
-# | ENABLED_FEATURES | DISABLED_FEATURES]
-# )
-#
-# The FEATURE_SUMMARY() macro can be used to print information about enabled
-# or disabled packages or features of a project.
-# By default, only the names of the features/packages will be printed and their
-# required version when one was specified. Use SET_PACKAGE_PROPERTIES() to add more
-# useful information, like e.g. a download URL for the respective package or their
-# purpose in the project.
-#
-# The WHAT option is the only mandatory option. Here you specify what information
-# will be printed:
-# ALL: print everything
-# ENABLED_FEATURES: the list of all features which are enabled
-# DISABLED_FEATURES: the list of all features which are disabled
-# PACKAGES_FOUND: the list of all packages which have been found
-# PACKAGES_NOT_FOUND: the list of all packages which have not been found
-# OPTIONAL_PACKAGES_FOUND: only those packages which have been found which have the type OPTIONAL
-# OPTIONAL_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type OPTIONAL
-# RECOMMENDED_PACKAGES_FOUND: only those packages which have been found which have the type RECOMMENDED
-# RECOMMENDED_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type RECOMMENDED
-# REQUIRED_PACKAGES_FOUND: only those packages which have been found which have the type REQUIRED
-# REQUIRED_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type REQUIRED
-# RUNTIME_PACKAGES_FOUND: only those packages which have been found which have the type RUNTIME
-# RUNTIME_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type RUNTIME
-#
-# If a FILENAME is given, the information is printed into this file. If APPEND
-# is used, it is appended to this file, otherwise the file is overwritten if
-# it already existed.
-# If the VAR option is used, the information is "printed" into the specified
-# variable.
-# If FILENAME is not used, the information is printed to the terminal.
-# Using the DESCRIPTION option a description or headline can be set which will
-# be printed above the actual content.
-# If INCLUDE_QUIET_PACKAGES is given, packages which have been searched with find_package(... QUIET) will
-# also be listed. By default they are skipped.
-# If FATAL_ON_MISSING_REQUIRED_PACKAGES is given, CMake will abort if a package which is marked as REQUIRED
-# has not been found.
+# ::
+#
+# -- The following OPTIONAL packages have been found:
+# LibXml2 (required version >= 2.4), XML processing lib, <http://xmlsoft.org>
+# * Enables HTML-import in MyWordProcessor
+# * Enables odt-export in MyWordProcessor
+# PNG , A PNG image library. , <http://www.libpng.org/pub/png/>
+# * Enables saving screenshots
+# -- The following OPTIONAL packages have not been found:
+# Lua51 , The Lua scripting language. , <http://www.lua.org>
+# * Enables macros in MyWordProcessor
+# Foo , Foo provides cool stuff.
+#
+#
+#
+#
+#
+# ::
+#
+# FEATURE_SUMMARY( [FILENAME <file>]
+# [APPEND]
+# [VAR <variable_name>]
+# [INCLUDE_QUIET_PACKAGES]
+# [FATAL_ON_MISSING_REQUIRED_PACKAGES]
+# [DESCRIPTION "Found packages:"]
+# WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND
+# | ENABLED_FEATURES | DISABLED_FEATURES)
+# )
+#
+#
+#
+# The FEATURE_SUMMARY() macro can be used to print information about
+# enabled or disabled packages or features of a project. By default,
+# only the names of the features/packages will be printed and their
+# required version when one was specified. Use SET_PACKAGE_PROPERTIES()
+# to add more useful information, like e.g. a download URL for the
+# respective package or their purpose in the project.
+#
+# The WHAT option is the only mandatory option. Here you specify what
+# information will be printed:
+#
+# ``ALL``
+# print everything
+# ``ENABLED_FEATURES``
+# the list of all features which are enabled
+# ``DISABLED_FEATURES``
+# the list of all features which are disabled
+# ``PACKAGES_FOUND``
+# the list of all packages which have been found
+# ``PACKAGES_NOT_FOUND``
+# the list of all packages which have not been found
+# ``OPTIONAL_PACKAGES_FOUND``
+# only those packages which have been found which have the type OPTIONAL
+# ``OPTIONAL_PACKAGES_NOT_FOUND``
+# only those packages which have not been found which have the type OPTIONAL
+# ``RECOMMENDED_PACKAGES_FOUND``
+# only those packages which have been found which have the type RECOMMENDED
+# ``RECOMMENDED_PACKAGES_NOT_FOUND``
+# only those packages which have not been found which have the type RECOMMENDED
+# ``REQUIRED_PACKAGES_FOUND``
+# only those packages which have been found which have the type REQUIRED
+# ``REQUIRED_PACKAGES_NOT_FOUND``
+# only those packages which have not been found which have the type REQUIRED
+# ``RUNTIME_PACKAGES_FOUND``
+# only those packages which have been found which have the type RUNTIME
+# ``RUNTIME_PACKAGES_NOT_FOUND``
+# only those packages which have not been found which have the type RUNTIME
+#
+# With the exception of the ``ALL`` value, these values can be combined
+# in order to customize the output. For example:
+#
+# ::
+#
+# feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
+#
+#
+#
+# If a FILENAME is given, the information is printed into this file. If
+# APPEND is used, it is appended to this file, otherwise the file is
+# overwritten if it already existed. If the VAR option is used, the
+# information is "printed" into the specified variable. If FILENAME is
+# not used, the information is printed to the terminal. Using the
+# DESCRIPTION option a description or headline can be set which will be
+# printed above the actual content. If INCLUDE_QUIET_PACKAGES is given,
+# packages which have been searched with find_package(... QUIET) will
+# also be listed. By default they are skipped. If
+# FATAL_ON_MISSING_REQUIRED_PACKAGES is given, CMake will abort if a
+# package which is marked as REQUIRED has not been found.
#
# Example 1, append everything to a file:
-# feature_summary(WHAT ALL
-# FILENAME ${CMAKE_BINARY_DIR}/all.log APPEND)
-#
-# Example 2, print the enabled features into the variable enabledFeaturesText, including QUIET packages:
-# feature_summary(WHAT ENABLED_FEATURES
-# INCLUDE_QUIET_PACKAGES
-# DESCRIPTION "Enabled Features:"
-# VAR enabledFeaturesText)
-# message(STATUS "${enabledFeaturesText}")
-#
-#
-# SET_PACKAGE_PROPERTIES(<name> PROPERTIES [ URL <url> ]
-# [ DESCRIPTION <description> ]
-# [ TYPE (RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED) ]
-# [ PURPOSE <purpose> ]
-# )
-#
-# Use this macro to set up information about the named package, which can
-# then be displayed via FEATURE_SUMMARY().
-# This can be done either directly in the Find-module or in the project
-# which uses the module after the find_package() call.
-# The features for which information can be set are added automatically by the
-# find_package() command.
-#
-# URL: this should be the homepage of the package, or something similar. Ideally this is set
-# already directly in the Find-module.
-#
-# DESCRIPTION: A short description what that package is, at most one sentence.
+#
+# ::
+#
+# feature_summary(WHAT ALL
+# FILENAME ${CMAKE_BINARY_DIR}/all.log APPEND)
+#
+#
+#
+# Example 2, print the enabled features into the variable
+# enabledFeaturesText, including QUIET packages:
+#
+# ::
+#
+# feature_summary(WHAT ENABLED_FEATURES
+# INCLUDE_QUIET_PACKAGES
+# DESCRIPTION "Enabled Features:"
+# VAR enabledFeaturesText)
+# message(STATUS "${enabledFeaturesText}")
+#
+#
+#
+#
+#
+# ::
+#
+# SET_PACKAGE_PROPERTIES(<name> PROPERTIES
+# [ URL <url> ]
+# [ DESCRIPTION <description> ]
+# [ TYPE (RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED) ]
+# [ PURPOSE <purpose> ]
+# )
+#
+#
+#
+# Use this macro to set up information about the named package, which
+# can then be displayed via FEATURE_SUMMARY(). This can be done either
+# directly in the Find-module or in the project which uses the module
+# after the find_package() call. The features for which information can
+# be set are added automatically by the find_package() command.
+#
+# URL: this should be the homepage of the package, or something similar.
# Ideally this is set already directly in the Find-module.
#
-# TYPE: What type of dependency has the using project on that package. Default is OPTIONAL.
-# In this case it is a package which can be used by the project when available at buildtime,
-# but it also work without. RECOMMENDED is similar to OPTIONAL, i.e. the project will build
-# if the package is not present, but the functionality of the resulting binaries will be severly
-# limited. If a REQUIRED package is not available at buildtime, the project may not even build. This
-# can be combined with the FATAL_ON_MISSING_REQUIRED_PACKAGES argument for feature_summary().
-# Last, a RUNTIME package is a package which is actually not used at all during the build, but
-# which is required for actually running the resulting binaries. So if such a package is missing,
-# the project can still be built, but it may not work later on. If set_package_properties() is called
-# multiple times for the same package with different TYPEs, the TYPE is only changed to higher
-# TYPEs ( RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED ), lower TYPEs are ignored.
-# The TYPE property is project-specific, so it cannot be set by the Find-module, but must be set in the project.
-#
-# PURPOSE: This describes which features this package enables in the project, i.e. it tells the user
-# what functionality he gets in the resulting binaries.
-# If set_package_properties() is called multiple times for a package, all PURPOSE properties are appended
-# to a list of purposes of the package in the project.
-# As the TYPE property, also the PURPOSE property
-# is project-specific, so it cannot be set by the Find-module, but must be set in the project.
+# DESCRIPTION: A short description what that package is, at most one
+# sentence. Ideally this is set already directly in the Find-module.
+#
+# TYPE: What type of dependency has the using project on that package.
+# Default is OPTIONAL. In this case it is a package which can be used
+# by the project when available at buildtime, but it also work without.
+# RECOMMENDED is similar to OPTIONAL, i.e. the project will build if
+# the package is not present, but the functionality of the resulting
+# binaries will be severly limited. If a REQUIRED package is not
+# available at buildtime, the project may not even build. This can be
+# combined with the FATAL_ON_MISSING_REQUIRED_PACKAGES argument for
+# feature_summary(). Last, a RUNTIME package is a package which is
+# actually not used at all during the build, but which is required for
+# actually running the resulting binaries. So if such a package is
+# missing, the project can still be built, but it may not work later on.
+# If set_package_properties() is called multiple times for the same
+# package with different TYPEs, the TYPE is only changed to higher TYPEs
+# ( RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED ), lower TYPEs are
+# ignored. The TYPE property is project-specific, so it cannot be set
+# by the Find-module, but must be set in the project.
+#
+# PURPOSE: This describes which features this package enables in the
+# project, i.e. it tells the user what functionality he gets in the
+# resulting binaries. If set_package_properties() is called multiple
+# times for a package, all PURPOSE properties are appended to a list of
+# purposes of the package in the project. As the TYPE property, also
+# the PURPOSE property is project-specific, so it cannot be set by the
+# Find-module, but must be set in the project.
+#
#
#
# Example for setting the info for a package:
-# find_package(LibXml2)
-# set_package_properties(LibXml2 PROPERTIES DESCRIPTION "A XML processing library."
-# URL "http://xmlsoft.org/")
-#
-# set_package_properties(LibXml2 PROPERTIES TYPE RECOMMENDED
-# PURPOSE "Enables HTML-import in MyWordProcessor")
-# ...
-# set_package_properties(LibXml2 PROPERTIES TYPE OPTIONAL
-# PURPOSE "Enables odt-export in MyWordProcessor")
-#
-# find_package(DBUS)
-# set_package_properties(DBUS PROPERTIES TYPE RUNTIME
-# PURPOSE "Necessary to disable the screensaver during a presentation" )
-#
-# ADD_FEATURE_INFO(<name> <enabled> <description>)
-# Use this macro to add information about a feature with the given <name>.
-# <enabled> contains whether this feature is enabled or not, <description>
-# is a text describing the feature.
-# The information can be displayed using feature_summary() for ENABLED_FEATURES
-# and DISABLED_FEATURES respectively.
+#
+# ::
+#
+# find_package(LibXml2)
+# set_package_properties(LibXml2 PROPERTIES
+# DESCRIPTION "A XML processing library."
+# URL "http://xmlsoft.org/")
+#
+#
+#
+# ::
+#
+# set_package_properties(LibXml2 PROPERTIES
+# TYPE RECOMMENDED
+# PURPOSE "Enables HTML-import in MyWordProcessor")
+# ...
+# set_package_properties(LibXml2 PROPERTIES
+# TYPE OPTIONAL
+# PURPOSE "Enables odt-export in MyWordProcessor")
+#
+#
+#
+# ::
+#
+# find_package(DBUS)
+# set_package_properties(DBUS PROPERTIES
+# TYPE RUNTIME
+# PURPOSE "Necessary to disable the screensaver during a presentation" )
+#
+#
+#
+# ::
+#
+# ADD_FEATURE_INFO(<name> <enabled> <description>)
+#
+# Use this macro to add information about a feature with the given
+# <name>. <enabled> contains whether this feature is enabled or not,
+# <description> is a text describing the feature. The information can
+# be displayed using feature_summary() for ENABLED_FEATURES and
+# DISABLED_FEATURES respectively.
#
# Example for setting the info for a feature:
-# option(WITH_FOO "Help for foo" ON)
-# add_feature_info(Foo WITH_FOO "The Foo feature provides very cool stuff.")
#
+# ::
+#
+# option(WITH_FOO "Help for foo" ON)
+# add_feature_info(Foo WITH_FOO "The Foo feature provides very cool stuff.")
+#
+#
+#
+#
+#
+# The following macros are provided for compatibility with previous
+# CMake versions:
+#
+# ::
+#
+# SET_PACKAGE_INFO(<name> <description> [<url> [<purpose>] ] )
+#
+# Use this macro to set up information about the named package, which
+# can then be displayed via FEATURE_SUMMARY(). This can be done either
+# directly in the Find-module or in the project which uses the module
+# after the find_package() call. The features for which information can
+# be set are added automatically by the find_package() command.
+#
+# ::
#
-# The following macros are provided for compatibility with previous CMake versions:
+# PRINT_ENABLED_FEATURES()
#
-# SET_PACKAGE_INFO(<name> <description> [<url> [<purpose>] ] )
-# Use this macro to set up information about the named package, which can
-# then be displayed via FEATURE_SUMMARY().
-# This can be done either directly in the Find-module or in the project
-# which uses the module after the find_package() call.
-# The features for which information can be set are added automatically by the
-# find_package() command.
+# Does the same as FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION
+# "Enabled features:")
#
-# PRINT_ENABLED_FEATURES()
-# Does the same as FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
+# ::
#
-# PRINT_DISABLED_FEATURES()
-# Does the same as FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
+# PRINT_DISABLED_FEATURES()
+#
+# Does the same as FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION
+# "Disabled features:")
+#
+# ::
+#
+# SET_FEATURE_INFO(<name> <description> [<url>] )
#
-# SET_FEATURE_INFO(<name> <description> [<url>] )
# Does the same as SET_PACKAGE_INFO(<name> <description> <url> )
#=============================================================================
-# Copyright 2007-2009 Kitware, Inc.
+# Copyright 2007-2015 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -279,6 +379,9 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
set(_currentFeatureText "")
get_property(_EnabledFeatures GLOBAL PROPERTY ${_property})
+ if(_EnabledFeatures)
+ list(REMOVE_DUPLICATES _EnabledFeatures)
+ endif(_EnabledFeatures)
foreach(_currentFeature ${_EnabledFeatures})
@@ -299,6 +402,12 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
set(includeThisOne FALSE)
endif()
endif()
+ get_property(_isTransitiveDepend
+ GLOBAL PROPERTY _CMAKE_${_currentFeature}_TRANSITIVE_DEPENDENCY
+ )
+ if(_isTransitiveDepend)
+ set(includeThisOne FALSE)
+ endif()
if(includeThisOne)
@@ -334,8 +443,8 @@ endfunction()
function(FEATURE_SUMMARY)
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
- set(oneValueArgs FILENAME VAR DESCRIPTION WHAT)
- set(multiValueArgs ) # none
+ set(oneValueArgs FILENAME VAR DESCRIPTION)
+ set(multiValueArgs WHAT)
CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
@@ -368,23 +477,42 @@ function(FEATURE_SUMMARY)
set(requiredPackagesNotFound TRUE)
endif()
- elseif("${_FS_WHAT}" STREQUAL "ALL")
+ else()
+ if("${_FS_WHAT}" STREQUAL "ALL")
- set(allWhatParts "ENABLED_FEATURES"
- "RUNTIME_PACKAGES_FOUND"
- "OPTIONAL_PACKAGES_FOUND"
- "RECOMMENDED_PACKAGES_FOUND"
- "REQUIRED_PACKAGES_FOUND"
+ set(allWhatParts "ENABLED_FEATURES"
+ "RUNTIME_PACKAGES_FOUND"
+ "OPTIONAL_PACKAGES_FOUND"
+ "RECOMMENDED_PACKAGES_FOUND"
+ "REQUIRED_PACKAGES_FOUND"
- "DISABLED_FEATURES"
- "RUNTIME_PACKAGES_NOT_FOUND"
- "OPTIONAL_PACKAGES_NOT_FOUND"
- "RECOMMENDED_PACKAGES_NOT_FOUND"
- "REQUIRED_PACKAGES_NOT_FOUND"
- )
+ "DISABLED_FEATURES"
+ "RUNTIME_PACKAGES_NOT_FOUND"
+ "OPTIONAL_PACKAGES_NOT_FOUND"
+ "RECOMMENDED_PACKAGES_NOT_FOUND"
+ "REQUIRED_PACKAGES_NOT_FOUND"
+ )
+
+ else()
+ set(allWhatParts)
+ foreach(part ${_FS_WHAT})
+ list(FIND validWhatParts "${part}" indexInList)
+ if(NOT "${indexInList}" STREQUAL "-1")
+ list(APPEND allWhatParts "${part}")
+ else()
+ if("${part}" STREQUAL "ALL")
+ message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() contains ALL, which cannot be combined with other values.")
+ else()
+ message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() contains ${part}, which is not a valid value.")
+ endif()
+ endif()
+ endforeach()
+ endif()
set(title_ENABLED_FEATURES "The following features have been enabled:")
set(title_DISABLED_FEATURES "The following features have been disabled:")
+ set(title_PACKAGES_FOUND "The following packages have been found:")
+ set(title_PACKAGES_NOT_FOUND "The following packages have not been found:")
set(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:")
set(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:")
set(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:")
@@ -405,8 +533,6 @@ function(FEATURE_SUMMARY)
endif()
endif()
endforeach()
- else()
- message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() is set to ${_FS_WHAT}, which is not a valid value.")
endif()
if(_FS_FILENAME)
@@ -436,13 +562,19 @@ endfunction()
# The stuff below is only kept for compatibility
function(SET_PACKAGE_INFO _name _desc)
- set(_url "${ARGV2}")
- set(_purpose "${ARGV3}")
+ unset(_url)
+ unset(_purpose)
+ if(ARGC GREATER 2)
+ set(_url "${ARGV2}")
+ endif()
+ if(ARGC GREATER 3)
+ set(_purpose "${ARGV3}")
+ endif()
set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
- if(_url MATCHES ".+")
+ if(NOT _url STREQUAL "")
set_property(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_url}" )
endif()
- if(_purpose MATCHES ".+")
+ if(NOT _purpose STREQUAL "")
set_property(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_purpose}" )
endif()
endfunction()
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake
index 60b0f56e6..5c30eb923 100644
--- a/Modules/FindALSA.cmake
+++ b/Modules/FindALSA.cmake
@@ -1,15 +1,25 @@
-# - Find alsa
+#.rst:
+# FindALSA
+# --------
+#
+# Find alsa
+#
# Find the alsa libraries (asound)
#
-# This module defines the following variables:
-# ALSA_FOUND - True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found
-# ALSA_LIBRARIES - Set when ALSA_LIBRARY is found
-# ALSA_INCLUDE_DIRS - Set when ALSA_INCLUDE_DIR is found
+# ::
+#
+# This module defines the following variables:
+# ALSA_FOUND - True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found
+# ALSA_LIBRARIES - Set when ALSA_LIBRARY is found
+# ALSA_INCLUDE_DIRS - Set when ALSA_INCLUDE_DIR is found
+#
+#
#
-# ALSA_INCLUDE_DIR - where to find asoundlib.h, etc.
-# ALSA_LIBRARY - the asound library
-# ALSA_VERSION_STRING - the version of alsa found (since CMake 2.8.8)
+# ::
#
+# ALSA_INCLUDE_DIR - where to find asoundlib.h, etc.
+# ALSA_LIBRARY - the asound library
+# ALSA_VERSION_STRING - the version of alsa found (since CMake 2.8.8)
#=============================================================================
# Copyright 2009-2011 Kitware, Inc.
diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake
index 5b383c4d3..2a3f228fd 100644
--- a/Modules/FindASPELL.cmake
+++ b/Modules/FindASPELL.cmake
@@ -1,11 +1,18 @@
-# - Try to find 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
+# ::
+#
+# 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
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake
index 93fa40004..566107585 100644
--- a/Modules/FindAVIFile.cmake
+++ b/Modules/FindAVIFile.cmake
@@ -1,13 +1,20 @@
-# - Locate AVIFILE library and include paths
+#.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
+# 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
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake
index 4758534d7..454977197 100644
--- a/Modules/FindArmadillo.cmake
+++ b/Modules/FindArmadillo.cmake
@@ -1,20 +1,32 @@
-# - Find Armadillo
+#.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})
+#
+# ::
+#
+# 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")
+#
+# ::
+#
+# 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")
#=============================================================================
# Copyright 2011 Clement Creusot <creusot@cs.york.ac.uk>
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index 4a3e68c68..7d81276c8 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -1,37 +1,76 @@
-# - Find bison executable and provides macros to generate custom build rules
+#.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 macros:
-# BISON_TARGET(<Name> <YaccInput> <CodeOutput> [VERBOSE <file>]
-# [COMPILE_FLAGS <string>])
-# 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. If COMPILE_FLAGS option is specified, the next
-# parameter is added in the bison command line. if VERBOSE option is
-# specified, <file> is created and contains verbose descriptions of the
-# grammar and parser. The macro defines a set of 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 - The sources files generated by bison
-# BISON_${Name}_COMPILE_FLAGS - Options used in the bison command line
-#
-# ====================================================================
-# Example:
+# ``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>]
+# )
+#
+# 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 verbose descriptions of the grammar and
+# parser to the given ``<file>``.
+#
+# 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``
+# The sources files generated by bison
+#
+# ``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)
+# 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})
-# ====================================================================
#=============================================================================
# Copyright 2009 Kitware, Inc.
@@ -50,6 +89,8 @@
find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable")
mark_as_advanced(BISON_EXECUTABLE)
+include(CMakeParseArguments)
+
if(BISON_EXECUTABLE)
# the bison commands should be executed with the C locale, otherwise
# the message (which are parsed) may be translated
@@ -68,16 +109,13 @@ if(BISON_EXECUTABLE)
message(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
else()
# Bison++
- if("${BISON_version_output}" MATCHES "^bison\\+\\+")
- string(REGEX REPLACE "^bison\\+\\+ Version ([^,]+).*" "\\1"
- BISON_VERSION "${BISON_version_output}")
+ if("${BISON_version_output}" MATCHES "^bison\\+\\+ Version ([^,]+)")
+ set(BISON_VERSION "${CMAKE_MATCH_1}")
# GNU Bison
- elseif("${BISON_version_output}" MATCHES "^bison[^+]")
- string(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
- BISON_VERSION "${BISON_version_output}")
- elseif("${BISON_version_output}" MATCHES "^GNU Bison ")
- string(REGEX REPLACE "^GNU Bison (version )?([^\n]+).*" "\\2"
- BISON_VERSION "${BISON_version_output}")
+ elseif("${BISON_version_output}" MATCHES "^bison \\(GNU Bison\\) ([^\n]+)\n")
+ set(BISON_VERSION "${CMAKE_MATCH_1}")
+ elseif("${BISON_version_output}" MATCHES "^GNU Bison (version )?([^\n]+)")
+ set(BISON_VERSION "${CMAKE_MATCH_2}")
endif()
endif()
@@ -107,6 +145,12 @@ if(BISON_EXECUTABLE)
list(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts})
endmacro()
+ # internal macro
+ macro(BISON_TARGET_option_defines Header)
+ set(BISON_TARGET_output_header "${Header}")
+ list(APPEND BISON_TARGET_cmdopt --defines=${BISON_TARGET_output_header})
+ endmacro()
+
#============================================================
# BISON_TARGET (public macro)
#============================================================
@@ -115,51 +159,61 @@ if(BISON_EXECUTABLE)
set(BISON_TARGET_output_header "")
set(BISON_TARGET_cmdopt "")
set(BISON_TARGET_outputs "${BisonOutput}")
- if(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
+
+ # Parsing parameters
+ set(BISON_TARGET_PARAM_OPTIONS)
+ set(BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS
+ VERBOSE
+ COMPILE_FLAGS
+ DEFINES_FILE
+ )
+ set(BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS)
+ cmake_parse_arguments(
+ BISON_TARGET_ARG
+ "${BISON_TARGET_PARAM_OPTIONS}"
+ "${BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS}"
+ "${BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS}"
+ ${ARGN}
+ )
+
+ if(NOT "${BISON_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
message(SEND_ERROR "Usage")
else()
- # Parsing parameters
- if(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5)
- if("${ARGV3}" STREQUAL "VERBOSE")
- BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV4}")
- endif()
- if("${ARGV3}" STREQUAL "COMPILE_FLAGS")
- BISON_TARGET_option_extraopts("${ARGV4}")
- endif()
+ if(NOT "${BISON_TARGET_ARG_VERBOSE}" STREQUAL "")
+ BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${BISON_TARGET_ARG_VERBOSE}")
endif()
-
- if(${ARGC} EQUAL 7)
- if("${ARGV5}" STREQUAL "VERBOSE")
- BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}")
- endif()
-
- if("${ARGV5}" STREQUAL "COMPILE_FLAGS")
- BISON_TARGET_option_extraopts("${ARGV6}")
- endif()
+ if(NOT "${BISON_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "")
+ BISON_TARGET_option_extraopts("${BISON_TARGET_ARG_COMPILE_FLAGS}")
+ endif()
+ if(NOT "${BISON_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
+ BISON_TARGET_option_defines("${BISON_TARGET_ARG_DEFINES_FILE}")
endif()
- # Header's name generated by bison (see option -d)
- list(APPEND BISON_TARGET_cmdopt "-d")
- string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}")
- string(REPLACE "c" "h" _fileext ${_fileext})
- string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
- BISON_${Name}_OUTPUT_HEADER "${ARGV2}")
- list(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}")
+ if("${BISON_TARGET_output_header}" STREQUAL "")
+ # Header's name generated by bison (see option -d)
+ list(APPEND BISON_TARGET_cmdopt "-d")
+ string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${BisonOutput}")
+ string(REPLACE "c" "h" _fileext ${_fileext})
+ string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
+ BISON_TARGET_output_header "${BisonOutput}")
+ endif()
+ list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}")
add_custom_command(OUTPUT ${BISON_TARGET_outputs}
${BISON_TARGET_extraoutputs}
COMMAND ${BISON_EXECUTABLE}
- ARGS ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1}
- DEPENDS ${ARGV1}
+ ARGS ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput}
+ DEPENDS ${BisonInput}
COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
# define target variables
set(BISON_${Name}_DEFINED TRUE)
- set(BISON_${Name}_INPUT ${ARGV1})
+ set(BISON_${Name}_INPUT ${BisonInput})
set(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs})
set(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt})
set(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}")
+ set(BISON_${Name}_OUTPUT_HEADER "${BISON_TARGET_output_header}")
endif()
endmacro()
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index f8a284d71..416b666b9 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -1,31 +1,41 @@
-# - 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
+#.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
-# 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
-# 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
-## Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model),
-## Intel10_64lp_seq (intel mkl v10 64 bit,sequential code, lp64 model),
-## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic
-# C/CXX should be enabled to use Intel mkl
+#
+# ::
+#
+# 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
+# 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
+# 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 #
+# Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32
+# (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread
+# model, lp64 model), # Intel10_64lp_seq (intel mkl v10 64
+# bit,sequential code, lp64 model), # Intel( older versions of mkl 32
+# and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic C/CXX should be
+# enabled to use Intel mkl
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -42,6 +52,9 @@
include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+cmake_push_check_state()
+set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
@@ -137,7 +150,7 @@ endmacro()
set(BLAS_LINKER_FLAGS)
set(BLAS_LIBRARIES)
set(BLAS95_LIBRARIES)
-if ($ENV{BLA_VENDOR} MATCHES ".+")
+if (NOT $ENV{BLA_VENDOR} STREQUAL "")
set(BLA_VENDOR $ENV{BLA_VENDOR})
else ()
if(NOT BLA_VENDOR)
@@ -275,7 +288,7 @@ if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
endif ()
#BLAS in acml library?
-if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
+if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR
((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
@@ -452,7 +465,7 @@ if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
endif ()
#BLAS in intel mkl 10 library? (em64t 64bit)
-if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
if (NOT WIN32)
set(LM "-lm")
endif ()
@@ -469,8 +482,45 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
set(BLAS_mkl_SEARCH_SYMBOL SGEMM)
set(_LIBRARIES BLAS95_LIBRARIES)
if (WIN32)
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_blas95 mkl_intel_c mkl_intel_thread mkl_core libguide40")
+ 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")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
+ endif ()
+
+ # Add threading/sequential libs
+ set(BLAS_SEARCH_LIBS_WIN_THREAD "")
+ if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ # mkl >= 10.3
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+
+ # Cartesian product of the above
+ foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
+ foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
+ list(APPEND BLAS_SEARCH_LIBS
+ "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
+ endforeach()
+ endforeach()
else ()
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
@@ -482,7 +532,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
"mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
# mkl >= 10.3
- if (CMAKE_C_COMPILER MATCHES ".+gcc.*")
+ if (CMAKE_C_COMPILER MATCHES ".+gcc")
list(APPEND BLAS_SEARCH_LIBS
"mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
else ()
@@ -490,17 +540,54 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
"mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
endif ()
endif ()
- endif ()
- if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_blas95_lp64 mkl_intel_lp64 mkl_sequential mkl_core")
+ if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_sequential mkl_core")
+ endif ()
endif ()
else ()
set(BLAS_mkl_SEARCH_SYMBOL sgemm)
set(_LIBRARIES BLAS_LIBRARIES)
if (WIN32)
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_c_dll mkl_intel_thread_dll mkl_core_dll libguide40")
+ 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")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
+ endif ()
+
+ # Add threading/sequential libs
+ set(BLAS_SEARCH_LIBS_WIN_THREAD "")
+ if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ # mkl >= 10.3
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+
+ # Cartesian product of the above
+ foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
+ foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
+ list(APPEND BLAS_SEARCH_LIBS
+ "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
+ endforeach()
+ endforeach()
else ()
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
@@ -513,7 +600,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
"mkl_intel_lp64 mkl_intel_thread mkl_core guide")
# mkl >= 10.3
- if (CMAKE_C_COMPILER MATCHES ".+gcc.*")
+ if (CMAKE_C_COMPILER MATCHES ".+gcc")
list(APPEND BLAS_SEARCH_LIBS
"mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
else ()
@@ -521,6 +608,10 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
"mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
endif ()
endif ()
+ if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_sequential mkl_core")
+ endif ()
#older vesions of intel mkl libs
if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
@@ -532,10 +623,6 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
"mkl_em64t")
endif ()
endif ()
- if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel_lp64 mkl_sequential mkl_core")
- endif ()
endif ()
foreach (IT ${BLAS_SEARCH_LIBS})
@@ -603,4 +690,5 @@ else()
endif()
endif()
+cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 9fb29d0f4..6af42ddb5 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -1,11 +1,18 @@
-# - Try to find BZip2
+#.rst:
+# FindBZip2
+# ---------
+#
+# Try to find BZip2
+#
# Once done this will define
#
-# BZIP2_FOUND - system has BZip2
-# BZIP2_INCLUDE_DIR - the BZip2 include directory
-# 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 (since CMake 2.8.8)
+# ::
+#
+# BZIP2_FOUND - system has BZip2
+# BZIP2_INCLUDE_DIR - the BZip2 include directory
+# 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 (since CMake 2.8.8)
#=============================================================================
# Copyright 2006-2012 Kitware, Inc.
@@ -49,8 +56,14 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2
VERSION_VAR BZIP2_VERSION_STRING)
if (BZIP2_FOUND)
- include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
- CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+ cmake_push_check_state()
+ set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY})
+ set(CMAKE_REQUIRED_INCLUDES ${BZIP2_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES})
+ CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX)
+ cmake_pop_check_state()
endif ()
mark_as_advanced(BZIP2_INCLUDE_DIR)
diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake
new file mode 100644
index 000000000..cb4f60a57
--- /dev/null
+++ b/Modules/FindBacktrace.cmake
@@ -0,0 +1,101 @@
+#.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.
+
+#=============================================================================
+# Copyright 2013 Vadim Zhukov
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+include(CMakePushCheckState)
+include(CheckSymbolExists)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+# List of variables to be provided to find_package_handle_standard_args()
+set(_Backtrace_STD_ARGS Backtrace_INCLUDE_DIR)
+
+if(Backtrace_HEADER)
+ set(_Backtrace_HEADER_TRY "${Backtrace_HEADER}")
+else(Backtrace_HEADER)
+ set(_Backtrace_HEADER_TRY "execinfo.h")
+endif(Backtrace_HEADER)
+
+find_path(Backtrace_INCLUDE_DIR "${_Backtrace_HEADER_TRY}")
+set(Backtrace_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR})
+
+if (NOT DEFINED Backtrace_LIBRARY)
+ # First, check if we already have backtrace(), e.g., in libc
+ cmake_push_check_state(RESET)
+ set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS})
+ set(CMAKE_REQUIRED_QUIET ${Backtrace_FIND_QUIETLY})
+ check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND)
+ cmake_pop_check_state()
+endif()
+
+if(_Backtrace_SYM_FOUND)
+ # Avoid repeating the message() call below each time CMake is run.
+ if(NOT Backtrace_FIND_QUIETLY AND NOT DEFINED Backtrace_LIBRARY)
+ message(STATUS "backtrace facility detected in default set of libraries")
+ endif()
+ set(Backtrace_LIBRARY "" CACHE FILEPATH "Library providing backtrace(3), empty for default set of libraries")
+else()
+ # Check for external library, for non-glibc systems
+ if(Backtrace_INCLUDE_DIR)
+ # OpenBSD has libbacktrace renamed to libexecinfo
+ find_library(Backtrace_LIBRARY "execinfo")
+ elseif() # respect user wishes
+ set(_Backtrace_HEADER_TRY "backtrace.h")
+ find_path(Backtrace_INCLUDE_DIR ${_Backtrace_HEADER_TRY})
+ find_library(Backtrace_LIBRARY "backtrace")
+ endif()
+
+ # Prepend list with library path as it's more common practice
+ set(_Backtrace_STD_ARGS Backtrace_LIBRARY ${_Backtrace_STD_ARGS})
+endif()
+
+set(Backtrace_LIBRARIES ${Backtrace_LIBRARY})
+set(Backtrace_HEADER "${_Backtrace_HEADER_TRY}" CACHE STRING "Header providing backtrace(3) facility")
+
+find_package_handle_standard_args(Backtrace FOUND_VAR Backtrace_FOUND REQUIRED_VARS ${_Backtrace_STD_ARGS})
+mark_as_advanced(Backtrace_HEADER Backtrace_INCLUDE_DIR Backtrace_LIBRARY)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 914a0a5b5..728dcdfdf 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1,136 +1,204 @@
-# - 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.36.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"
+#.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.36.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"
+#
# 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
+# 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
+#
+# 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 Thread::Thread 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_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.
+# 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.
#
-# 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 - Directory containing Boost libraries
-# Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant
-# Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant
-# 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.
+# Other variables one may set to control this module are::
#
-# 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 directory in Boost_LIBRARY_DIR 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_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.42.0" instead of
+# "/usr/lib/libboost_system.so". This does not
+# affect linking and should not be enabled unless
+# the user needs this information.
+# Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and
+# Boost_LIBRARY_DIR_DEBUG.
#
-# Boost 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_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_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.
-# Boost_THREADAPI - Suffix for "thread" component library name,
-# such as "pthread" or "win32". Names with
-# and without this suffix will both be tried.
-# 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.42.0" instead of
-# "/usr/lib/libboost_system.so". This does not
-# affect linking and should not be enabled unless
-# the user needs this information.
# 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})
+# 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 headers and some libraries:
-# set(Boost_USE_STATIC_LIBS ON)
-# set(Boost_USE_MULTITHREADED ON)
-# set(Boost_USE_STATIC_RUNTIME OFF)
-# find_package(Boost 1.36.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()
+# 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)
#
-# Boost CMake ----------------------------------------------------------
+# Example to find Boost headers and some *static* libraries::
+#
+# set(Boost_USE_STATIC_LIBS ON) # only find static libs
+# set(Boost_USE_MULTITHREADED ON)
+# set(Boost_USE_STATIC_RUNTIME OFF)
+# find_package(Boost 1.36.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.
+# 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.
@@ -254,6 +322,14 @@ macro(_Boost_ADJUST_LIB_VARS basename)
)
endmacro()
+# Detect changes in used variables.
+# Compares the current variable value with the last one.
+# In short form:
+# v != v_LAST -> CHANGED = 1
+# v is defined, v_LAST not -> CHANGED = 1
+# v is not defined, but v_LAST is -> CHANGED = 1
+# otherwise -> CHANGED = 0
+# CHANGED is returned in variable named ${changed_var}
macro(_Boost_CHANGE_DETECT changed_var)
set(${changed_var} 0)
foreach(v ${ARGN})
@@ -276,18 +352,33 @@ macro(_Boost_CHANGE_DETECT changed_var)
endforeach()
endmacro()
-macro(_Boost_FIND_LIBRARY var)
+#
+# Find the given library (var).
+# Use 'build_type' to support different lib paths for RELEASE or DEBUG builds
+#
+macro(_Boost_FIND_LIBRARY var build_type)
+
find_library(${var} ${ARGN})
- # If we found the first library save Boost_LIBRARY_DIR.
- if(${var} AND NOT Boost_LIBRARY_DIR)
- get_filename_component(_dir "${${var}}" PATH)
- set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE)
+ if(${var})
+ # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
+ if(NOT Boost_LIBRARY_DIR_${build_type})
+ get_filename_component(_dir "${${var}}" PATH)
+ set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE)
+ endif()
+ elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
+ # Try component-specific hints but do not save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
+ find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN})
endif()
- # If Boost_LIBRARY_DIR is known then search only there.
- if(Boost_LIBRARY_DIR)
- set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH)
+ # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there.
+ if(Boost_LIBRARY_DIR_${build_type})
+ set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ " Boost_LIBRARY_DIR_${build_type} = ${Boost_LIBRARY_DIR_${build_type}}"
+ " _boost_LIBRARY_SEARCH_DIRS_${build_type} = ${_boost_LIBRARY_SEARCH_DIRS_${build_type}}")
+ endif()
endif()
endmacro()
@@ -341,14 +432,18 @@ endfunction()
# Guesses Boost's compiler prefix used in built library names
# Returns the guess by setting the variable pointed to by _ret
function(_Boost_GUESS_COMPILER_PREFIX _ret)
- if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"
- OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
- OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel"
+ OR CMAKE_CXX_COMPILER MATCHES "icl"
+ OR CMAKE_CXX_COMPILER MATCHES "icpc")
if(WIN32)
set (_boost_COMPILER "-iw")
else()
set (_boost_COMPILER "-il")
endif()
+ elseif (GHSMULTI)
+ set(_boost_COMPILER "-ghs")
+ elseif (MSVC14)
+ set(_boost_COMPILER "-vc140")
elseif (MSVC12)
set(_boost_COMPILER "-vc120")
elseif (MSVC11)
@@ -367,7 +462,7 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
set(_boost_COMPILER "-vc6") # yes, this is correct
elseif (BORLAND)
set(_boost_COMPILER "-bcb")
- elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
set(_boost_COMPILER "-sw")
elseif (MINGW)
if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
@@ -412,6 +507,282 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
endfunction()
#
+# Get component dependencies. Requires the dependencies to have been
+# defined for the Boost release version.
+#
+# component - the component to check
+# _ret - list of library dependencies
+#
+function(_Boost_COMPONENT_DEPENDENCIES component _ret)
+ # Note: to add a new Boost release, run
+ #
+ # % cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake
+ #
+ # The output may be added in a new block below. If it's the same as
+ # the previous release, simply update the version range of the block
+ # for the previous release.
+ #
+ # This information was originally generated by running
+ # BoostScanDeps.cmake against every boost release to date supported
+ # by FindBoost:
+ #
+ # % for version in /path/to/boost/sources/*
+ # do
+ # cmake -DBOOST_DIR=$version -P Utilities/Scripts/BoostScanDeps.cmake
+ # done
+ #
+ # The output was then updated by search and replace with these regexes:
+ #
+ # - Strip message(STATUS) prefix dashes
+ # s;^-- ;;
+ # - Indent
+ # s;^set(; set(;;
+ # - Add conditionals
+ # s;Scanning /path/to/boost/sources/boost_\(.*\)_\(.*\)_\(.*); elseif(NOT Boost_VERSION VERSION_LESS \10\20\3 AND Boost_VERSION VERSION_LESS xxxx);
+ #
+ # This results in the logic seen below, but will require the xxxx
+ # replacing with the following Boost release version (or the next
+ # minor version to be released, e.g. 1.59 was the latest at the time
+ # of writing, making 1.60 the next, so 106000 is the needed version
+ # number). Identical consecutive releases were then merged together
+ # by updating the end range of the first block and removing the
+ # following redundant blocks.
+ #
+ # Running the script against all historical releases should be
+ # required only if the BoostScanDeps.cmake script logic is changed.
+ # The addition of a new release should only require it to be run
+ # against the new release.
+ set(_Boost_IMPORTED_TARGETS TRUE)
+ if(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex thread)
+ set(_Boost_REGEX_DEPENDENCIES thread)
+ set(_Boost_WAVE_DEPENDENCIES filesystem thread)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 103500 AND Boost_VERSION VERSION_LESS 103600)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system thread)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 103600 AND Boost_VERSION VERSION_LESS 103800)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system thread)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 103800 AND Boost_VERSION VERSION_LESS 104300)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_THREAD_DEPENDENCIES date_time)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 104300 AND Boost_VERSION VERSION_LESS 104400)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_THREAD_DEPENDENCIES date_time)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 104400 AND Boost_VERSION VERSION_LESS 104500)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_THREAD_DEPENDENCIES date_time)
+ set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 104500 AND Boost_VERSION VERSION_LESS 104700)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_THREAD_DEPENDENCIES date_time)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 104700 AND Boost_VERSION VERSION_LESS 104800)
+ set(_Boost_CHRONO_DEPENDENCIES system)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_THREAD_DEPENDENCIES date_time)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 104800 AND Boost_VERSION VERSION_LESS 105000)
+ set(_Boost_CHRONO_DEPENDENCIES system)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_THREAD_DEPENDENCIES date_time)
+ set(_Boost_TIMER_DEPENDENCIES chrono system)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 105000 AND Boost_VERSION VERSION_LESS 105300)
+ set(_Boost_CHRONO_DEPENDENCIES system)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_THREAD_DEPENDENCIES chrono system date_time)
+ set(_Boost_TIMER_DEPENDENCIES chrono system)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 105300 AND Boost_VERSION VERSION_LESS 105400)
+ set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time)
+ set(_Boost_CHRONO_DEPENDENCIES system)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
+ set(_Boost_TIMER_DEPENDENCIES chrono system)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 105400 AND Boost_VERSION VERSION_LESS 105500)
+ set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time)
+ set(_Boost_CHRONO_DEPENDENCIES system)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
+ set(_Boost_TIMER_DEPENDENCIES chrono system)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 105500 AND Boost_VERSION VERSION_LESS 105600)
+ set(_Boost_CHRONO_DEPENDENCIES system)
+ set(_Boost_COROUTINE_DEPENDENCIES context system)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
+ set(_Boost_TIMER_DEPENDENCIES chrono system)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 105600 AND Boost_VERSION VERSION_LESS 105900)
+ set(_Boost_CHRONO_DEPENDENCIES system)
+ set(_Boost_COROUTINE_DEPENDENCIES context system)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
+ 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 mpi serialization)
+ set(_Boost_RANDOM_DEPENDENCIES system)
+ set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
+ set(_Boost_TIMER_DEPENDENCIES chrono system)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 105900 AND Boost_VERSION VERSION_LESS 106000)
+ set(_Boost_CHRONO_DEPENDENCIES system)
+ set(_Boost_COROUTINE_DEPENDENCIES context system)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_RANDOM_DEPENDENCIES system)
+ set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
+ set(_Boost_TIMER_DEPENDENCIES chrono system)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106200)
+ set(_Boost_CHRONO_DEPENDENCIES system)
+ set(_Boost_COROUTINE_DEPENDENCIES context system)
+ set(_Boost_FILESYSTEM_DEPENDENCIES system)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+ set(_Boost_RANDOM_DEPENDENCIES system)
+ set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
+ set(_Boost_TIMER_DEPENDENCIES chrono system)
+ set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ else()
+ message(WARNING "Imported targets not available for Boost version ${Boost_VERSION}")
+ set(_Boost_IMPORTED_TARGETS FALSE)
+ endif()
+
+ string(TOUPPER ${component} uppercomponent)
+ set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
+ set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
+
+ string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${uppercomponent}_DEPENDENCIES}")
+ if (NOT _boost_DEPS_STRING)
+ set(_boost_DEPS_STRING "(none)")
+ endif()
+ # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}")
+endfunction()
+
+#
+# Determine if any missing dependencies require adding to the component list.
+#
+# Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component,
+# plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be
+# defined; FALSE if dependency information is unavailable).
+#
+# componentvar - the component list variable name
+# extravar - the indirect dependency list variable name
+#
+#
+function(_Boost_MISSING_DEPENDENCIES componentvar extravar)
+ # _boost_unprocessed_components - list of components requiring processing
+ # _boost_processed_components - components already processed (or currently being processed)
+ # _boost_new_components - new components discovered for future processing
+ #
+ list(APPEND _boost_unprocessed_components ${${componentvar}})
+
+ while(_boost_unprocessed_components)
+ list(APPEND _boost_processed_components ${_boost_unprocessed_components})
+ foreach(component ${_boost_unprocessed_components})
+ string(TOUPPER ${component} uppercomponent)
+ set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
+ _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES)
+ set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
+ set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
+ foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES})
+ list(FIND _boost_processed_components "${componentdep}" _boost_component_found)
+ list(FIND _boost_new_components "${componentdep}" _boost_component_new)
+ if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1)
+ list(APPEND _boost_new_components ${componentdep})
+ endif()
+ endforeach()
+ endforeach()
+ set(_boost_unprocessed_components ${_boost_new_components})
+ unset(_boost_new_components)
+ endwhile()
+ set(_boost_extra_components ${_boost_processed_components})
+ if(_boost_extra_components AND ${componentvar})
+ list(REMOVE_ITEM _boost_extra_components ${${componentvar}})
+ endif()
+ set(${componentvar} ${_boost_processed_components} PARENT_SCOPE)
+ set(${extravar} ${_boost_extra_components} PARENT_SCOPE)
+endfunction()
+
+#
# End functions/macros
#
#-------------------------------------------------------------------------------
@@ -420,9 +791,22 @@ endfunction()
# main.
#-------------------------------------------------------------------------------
+
+# If the user sets Boost_LIBRARY_DIR, use it as the default for both
+# configurations.
+if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR)
+ set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}")
+endif()
+if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR)
+ set(Boost_LIBRARY_DIR_DEBUG "${Boost_LIBRARY_DIR}")
+endif()
+
if(NOT DEFINED Boost_USE_MULTITHREADED)
set(Boost_USE_MULTITHREADED TRUE)
endif()
+if(NOT DEFINED Boost_USE_DEBUG_RUNTIME)
+ set(Boost_USE_DEBUG_RUNTIME TRUE)
+endif()
# Check the version of Boost against the requested version.
if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
@@ -438,14 +822,20 @@ if(Boost_FIND_VERSION_EXACT)
else()
# The user has not requested an exact version. Among known
# versions, find those that are acceptable to the user request.
+ #
+ # Note: When adding a new Boost release, also update the dependency
+ # information in _Boost_COMPONENT_DEPENDENCIES. See the
+ # instructions at the top of _Boost_COMPONENT_DEPENDENCIES.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54"
- "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51"
+ "1.61.0" "1.61" "1.60.0" "1.60"
+ "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55"
+ "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51"
"1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1"
"1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42"
"1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37"
"1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
"1.34" "1.33.1" "1.33.0" "1.33")
+
set(_boost_TEST_VERSIONS)
if(Boost_FIND_VERSION)
set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
@@ -487,6 +877,16 @@ if(Boost_DEBUG)
"Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
endif()
+# Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It
+# will only contain any interface definitions on WIN32, but is created
+# on all platforms to keep end user code free from platform dependent
+# code. Also provide convenience targets to disable autolinking and
+# enable dynamic linking.
+if(NOT TARGET Boost::diagnostic_definitions)
+ add_library(Boost::diagnostic_definitions INTERFACE IMPORTED)
+ add_library(Boost::disable_autolinking INTERFACE IMPORTED)
+ add_library(Boost::dynamic_linking INTERFACE IMPORTED)
+endif()
if(WIN32)
# In windows, automatic linking is performed, so you do not have
# to specify the libraries. If you are linking to a dynamic
@@ -506,6 +906,12 @@ if(WIN32)
# code to emit a #pragma message each time a library is selected
# for linking.
set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC")
+ set_target_properties(Boost::diagnostic_definitions PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC")
+ set_target_properties(Boost::disable_autolinking PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB")
+ set_target_properties(Boost::dynamic_linking PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK")
endif()
_Boost_CHECK_SPELLING(Boost_ROOT)
@@ -594,12 +1000,12 @@ if(NOT Boost_INCLUDE_DIR)
set(_boost_BOOSTIFIED_VERSION)
# Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
- if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
- string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
- _boost_BOOSTIFIED_VERSION ${_boost_VER})
- elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
- string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
- _boost_BOOSTIFIED_VERSION ${_boost_VER})
+ if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
+ set(_boost_BOOSTIFIED_VERSION
+ "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}")
+ elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)")
+ set(_boost_BOOSTIFIED_VERSION
+ "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
endif()
list(APPEND _boost_PATH_SUFFIXES
@@ -647,7 +1053,7 @@ if(Boost_INCLUDE_DIR)
set(_Boost_VERSION_REGEX "([0-9]+)")
set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"")
foreach(v VERSION LIB_VERSION)
- if("${_boost_VERSION_HPP_CONTENTS}" MATCHES ".*#define BOOST_${v} ${_Boost_${v}_REGEX}.*")
+ if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}")
set(Boost_${v} "${CMAKE_MATCH_1}")
endif()
endforeach()
@@ -702,10 +1108,25 @@ else()
endif()
# ------------------------------------------------------------------------
+# Prefix initialization
+# ------------------------------------------------------------------------
+
+set(Boost_LIB_PREFIX "")
+if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR
+ (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) )
+ set(Boost_LIB_PREFIX "lib")
+endif()
+
+if ( NOT Boost_NAMESPACE )
+ set(Boost_NAMESPACE "boost")
+endif()
+
+# ------------------------------------------------------------------------
# Suffix initialization and compiler suffix detection.
# ------------------------------------------------------------------------
set(_Boost_VARS_NAME
+ Boost_NAMESPACE
Boost_COMPILER
Boost_THREADAPI
Boost_USE_DEBUG_PYTHON
@@ -718,11 +1139,6 @@ set(_Boost_VARS_NAME
_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME})
# Setting some more suffixes for the library
-set(Boost_LIB_PREFIX "")
-if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN)
- set(Boost_LIB_PREFIX "lib")
-endif()
-
if (Boost_COMPILER)
set(_boost_COMPILER ${Boost_COMPILER})
if(Boost_DEBUG)
@@ -764,7 +1180,7 @@ if(Boost_USE_STATIC_RUNTIME)
endif()
# g using debug versions of the standard and runtime
# support libraries
-if(WIN32)
+if(WIN32 AND Boost_USE_DEBUG_RUNTIME)
if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
@@ -798,49 +1214,56 @@ endif()
# ------------------------------------------------------------------------
# Begin finding boost libraries
# ------------------------------------------------------------------------
-set(_Boost_VARS_LIB BOOST_LIBRARYDIR Boost_LIBRARY_DIR)
-_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR ${_Boost_VARS_DIR} ${_Boost_VARS_LIB} Boost_INCLUDE_DIR)
-# Clear Boost_LIBRARY_DIR if it did not change but other input affecting the
-# location did. We will find a new one based on the new inputs.
-if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED)
- unset(Boost_LIBRARY_DIR CACHE)
-endif()
-if(Boost_LIBRARY_DIR)
- set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH)
-else()
- set(_boost_LIBRARY_SEARCH_DIRS "")
- if(BOOST_LIBRARYDIR)
- list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_LIBRARYDIR})
- elseif(_ENV_BOOST_LIBRARYDIR)
- list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_LIBRARYDIR})
+set(_Boost_VARS_LIB "")
+foreach(c DEBUG RELEASE)
+ set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c})
+ list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}})
+ _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR)
+ # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the
+ # location did. We will find a new one based on the new inputs.
+ if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED)
+ unset(Boost_LIBRARY_DIR_${c} CACHE)
endif()
- if(BOOST_ROOT)
- list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
- elseif(_ENV_BOOST_ROOT)
- list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
- endif()
-
- list(APPEND _boost_LIBRARY_SEARCH_DIRS
- ${Boost_INCLUDE_DIR}/lib
- ${Boost_INCLUDE_DIR}/../lib
- ${Boost_INCLUDE_DIR}/stage/lib
- )
- if( Boost_NO_SYSTEM_PATHS )
- list(APPEND _boost_LIBRARY_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH)
+ # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value.
+ if(Boost_LIBRARY_DIR_${c})
+ set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
else()
- list(APPEND _boost_LIBRARY_SEARCH_DIRS PATHS
- C:/boost/lib
- C:/boost
- /sw/local/lib
+ set(_boost_LIBRARY_SEARCH_DIRS_${c} "")
+ if(BOOST_LIBRARYDIR)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR})
+ elseif(_ENV_BOOST_LIBRARYDIR)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR})
+ endif()
+
+ if(BOOST_ROOT)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
+ elseif(_ENV_BOOST_ROOT)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
+ endif()
+
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c}
+ ${Boost_INCLUDE_DIR}/lib
+ ${Boost_INCLUDE_DIR}/../lib
+ ${Boost_INCLUDE_DIR}/stage/lib
)
+ if( Boost_NO_SYSTEM_PATHS )
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH)
+ else()
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS
+ C:/boost/lib
+ C:/boost
+ /sw/local/lib
+ )
+ endif()
endif()
-endif()
+endforeach()
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
+ "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}"
+ "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
endif()
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
@@ -887,6 +1310,17 @@ if(Boost_VERSION AND Boost_FIND_COMPONENTS)
endif()
endif()
+# Additional components may be required via component dependencies.
+# Add any missing components to the list.
+_Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS)
+
+# If thread is required, get the thread libs as a dependency
+list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS)
+if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1)
+ include(CMakeFindDependencyMacro)
+ find_dependency(Threads)
+endif()
+
# If the user changed any of our control inputs flush previous results.
if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME)
foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED})
@@ -906,22 +1340,45 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)")
+ # Compute component-specific hints.
+ set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
+ if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR
+ ${COMPONENT} STREQUAL "graph_parallel")
+ foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
+ if(IS_ABSOLUTE "${lib}")
+ get_filename_component(libdir "${lib}" PATH)
+ string(REPLACE "\\" "/" libdir "${libdir}")
+ list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir})
+ endif()
+ endforeach()
+ endif()
+
+ # Consolidate and report component-specific hints.
+ if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
+ list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Component-specific library search paths for ${COMPONENT}: "
+ "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}")
+ endif()
+ endif()
+
#
# Find RELEASE libraries
#
set(_boost_RELEASE_NAMES
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT} )
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
if(_boost_STATIC_RUNTIME_WORKAROUND)
set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
list(APPEND _boost_RELEASE_NAMES
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
endif()
if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
_Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
@@ -931,10 +1388,16 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
"Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
endif()
+ # if Boost_LIBRARY_DIR_RELEASE is not defined,
+ # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs
+ if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG)
+ list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG})
+ endif()
+
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}")
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
- _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
+ _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE
NAMES ${_boost_RELEASE_NAMES}
HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
NAMES_PER_DIR
@@ -945,19 +1408,19 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
# Find DEBUG libraries
#
set(_boost_DEBUG_NAMES
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
- ${Boost_LIB_PREFIX}boost_${COMPONENT} )
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
if(_boost_STATIC_RUNTIME_WORKAROUND)
set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
list(APPEND _boost_DEBUG_NAMES
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
endif()
if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
_Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
@@ -967,10 +1430,16 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
"Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
endif()
+ # if Boost_LIBRARY_DIR_DEBUG is not defined,
+ # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs
+ if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE)
+ list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE})
+ endif()
+
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}")
+ string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
- _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
+ _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG
NAMES ${_boost_DEBUG_NAMES}
HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
NAMES_PER_DIR
@@ -996,7 +1465,16 @@ endif()
# ------------------------------------------------------------------------
set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
-set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR})
+set(Boost_LIBRARY_DIRS)
+if(Boost_LIBRARY_DIR_RELEASE)
+ list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE})
+endif()
+if(Boost_LIBRARY_DIR_DEBUG)
+ list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG})
+endif()
+if(Boost_LIBRARY_DIRS)
+ list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
+endif()
# The above setting of Boost_FOUND was based only on the header files.
# Update it for the requested component libraries.
@@ -1012,6 +1490,10 @@ if(Boost_FOUND)
list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
endif()
endforeach()
+ if(_Boost_MISSING_COMPONENTS AND _Boost_EXTRA_FIND_COMPONENTS)
+ # Optional indirect dependencies are not counted as missing.
+ list(REMOVE_ITEM _Boost_MISSING_COMPONENTS ${_Boost_EXTRA_FIND_COMPONENTS})
+ endif()
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
@@ -1030,7 +1512,7 @@ if(Boost_FOUND)
"${Boost_ERROR_REASON} Boost libraries:\n")
foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON} boost_${COMPONENT}\n")
+ "${Boost_ERROR_REASON} ${Boost_NAMESPACE}_${COMPONENT}\n")
endforeach()
list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
@@ -1086,6 +1568,70 @@ else()
endif()
# ------------------------------------------------------------------------
+# Add imported targets
+# ------------------------------------------------------------------------
+
+if(Boost_FOUND AND _Boost_IMPORTED_TARGETS)
+ # For header-only libraries
+ if(NOT TARGET Boost::boost)
+ add_library(Boost::boost INTERFACE IMPORTED)
+ if(Boost_INCLUDE_DIRS)
+ set_target_properties(Boost::boost PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}")
+ endif()
+ endif()
+
+ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ if(NOT TARGET Boost::${COMPONENT})
+ string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+ if(Boost_${UPPERCOMPONENT}_FOUND)
+ if(Boost_USE_STATIC_LIBS)
+ add_library(Boost::${COMPONENT} STATIC IMPORTED)
+ else()
+ # Even if Boost_USE_STATIC_LIBS is OFF, we might have static
+ # libraries as a result.
+ add_library(Boost::${COMPONENT} UNKNOWN IMPORTED)
+ endif()
+ if(Boost_INCLUDE_DIRS)
+ set_target_properties(Boost::${COMPONENT} PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}")
+ endif()
+ if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}")
+ set_target_properties(Boost::${COMPONENT} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}")
+ endif()
+ if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
+ set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(Boost::${COMPONENT} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
+ endif()
+ if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
+ set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(Boost::${COMPONENT} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
+ IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
+ endif()
+ if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES)
+ unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES)
+ foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES})
+ list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep})
+ endforeach()
+ if(COMPONENT STREQUAL "thread")
+ list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads)
+ endif()
+ set_target_properties(Boost::${COMPONENT} PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}")
+ endif()
+ endif()
+ endif()
+ endforeach()
+endif()
+
+# ------------------------------------------------------------------------
# Notification to end user about what was found
# ------------------------------------------------------------------------
diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake
index 1a27fc32b..fc848fae0 100644
--- a/Modules/FindBullet.cmake
+++ b/Modules/FindBullet.cmake
@@ -1,17 +1,36 @@
-# - Try to find the Bullet physics engine
+#.rst:
+# FindBullet
+# ----------
#
-# This module defines the following variables
+# Try to find the Bullet physics engine
#
-# 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
+# ::
#
+# 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
#=============================================================================
# Copyright 2009 Kitware, Inc.
diff --git a/Modules/FindCABLE.cmake b/Modules/FindCABLE.cmake
index 3e2d5d3bb..5cea109ad 100644
--- a/Modules/FindCABLE.cmake
+++ b/Modules/FindCABLE.cmake
@@ -1,14 +1,24 @@
-# - Find CABLE
+#.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:
+# 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
+#
#
-# 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.
+# ${CABLE_TCL_LIBRARY}. You should also add ${CABLE_INCLUDE_DIR} as an
+# include directory.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 2705d3271..fe8b18ee3 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1,292 +1,325 @@
-# - Tools for building CUDA C files: libraries and build dependencies.
-# This script locates the NVIDIA CUDA C tools. It should work on linux, windows,
-# and mac and should be reasonably up to date with CUDA C releases.
+#.rst:
+# FindCUDA
+# --------
#
-# This script makes use of the standard find_package arguments of <VERSION>,
-# REQUIRED and QUIET. CUDA_FOUND will report if an acceptable version of CUDA
-# was found.
+# Tools for building CUDA C files: libraries and build dependencies.
#
-# The script will prompt the user to specify CUDA_TOOLKIT_ROOT_DIR if the prefix
-# cannot be determined by the location of nvcc in the system path and REQUIRED
-# is specified to find_package(). To use a different installed version of the
-# toolkit set the environment variable CUDA_BIN_PATH before running cmake
-# (e.g. CUDA_BIN_PATH=/usr/local/cuda1.0 instead of the default /usr/local/cuda)
-# or set CUDA_TOOLKIT_ROOT_DIR after configuring. If you change the value of
-# CUDA_TOOLKIT_ROOT_DIR, various components that depend on the path will be
-# relocated.
+# This script locates the NVIDIA CUDA C tools. It should work on linux,
+# windows, and mac and should be reasonably up to date with CUDA C
+# releases.
+#
+# This script makes use of the standard 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 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.
+# platforms, or to use a cuda runtime not installed in the default
+# location. In newer versions of the toolkit the cuda library is
+# included with the graphics driver- be sure that the driver version
+# matches what is needed by the cuda runtime version.
+#
+# The following variables affect the behavior of the macros in the
+# script (in alphebetical order). Note that any of these flags can be
+# changed multiple times in the same directory before calling
+# CUDA_ADD_EXECUTABLE, CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX,
+# CUDA_COMPILE_FATBIN, CUDA_COMPILE_CUBIN or CUDA_WRAP_SRCS::
+#
+# CUDA_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.
#
-# The following variables affect the behavior of the macros in the script (in
-# alphebetical order). Note that any of these flags can be changed multiple
-# times in the same directory before calling CUDA_ADD_EXECUTABLE,
-# CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX or CUDA_WRAP_SRCS.
+# CUDA_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_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_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_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.
+# CUDA_HOST_COMPILATION_CPP (Default ON)
+# -- Set to OFF for C compilation of host code.
#
-# 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_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS)
+# -- Set the host compiler to be used by nvcc. Ignored if -ccbin or
+# --compiler-bindir is already present in the CUDA_NVCC_FLAGS or
+# CUDA_NVCC_FLAGS_<CONFIG> variables. For Visual Studio targets
+# $(VCInstallDir)/bin is a special value that expands out to the path when
+# the command is run from withing VS.
#
-# 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_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_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_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_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_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_HOST_COMPILATION_CPP (Default ON)
-# -- Set to OFF for C compilation of host code.
+# 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_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS)
-# -- Set the host compiler to be used by nvcc. Ignored if -ccbin or
-# --compiler-bindir is already present in the CUDA_NVCC_FLAGS or
-# CUDA_NVCC_FLAGS_<CONFIG> variables. For Visual Studio targets
-# $(VCInstallDir)/bin is a special value that expands out to the path when
-# the command is run from withing VS.
+# 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_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_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.
#
-# 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.
+# The script creates the following macros (in alphebetical order)::
#
-# 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_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_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.
+# 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.
#
-# The script creates the following macros (in alphebetical order):
+# 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_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_LIBRARY( cuda_target file0 file1 ...
+# [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
+# -- Same as CUDA_ADD_EXECUTABLE except that a library is created.
#
-# 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_BUILD_CLEAN_TARGET()
+# -- Creates a convience target that deletes all the dependency files
+# generated. You should make clean after running this target to ensure the
+# dependency files get regenerated.
#
-# 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_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_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_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] )
+# -- Returns a list of PTX files generated from the input source files.
#
-# CUDA_BUILD_CLEAN_TARGET()
-# -- Creates a convience 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_FATBIN( generated_files file0 file1 ... [OPTIONS ...] )
+# -- Returns a list of FATBIN files generated from the input source files.
#
-# 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_CUBIN( generated_files file0 file1 ... [OPTIONS ...] )
+# -- Returns a list of CUBIN files generated from the input source files.
#
-# CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] )
-# -- Returns a list of PTX 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_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_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)
+# 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.
+# -- 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_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.
+# 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.
+# 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 preceed configuration specific options. Not all
-# configurations need to be specified, only the ones provided will be used.
+# 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 preceed 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
+# 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.
+# 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.
+# 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.
+# 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.
+# 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.
+# 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.
+# 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.
+# 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_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 (alterative to:
-# CUDA_ADD_CUBLAS_TO_TARGET macro).
-# 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_cusparse_LIBRARY -- CUDA Sparse Matrix library.
-# Only available for CUDA version 3.2+.
-# CUDA_npp_LIBRARY -- NVIDIA Performance Primitives library.
-# Only available for CUDA version 4.0+.
-# CUDA_nppc_LIBRARY -- NVIDIA Performance Primitives library (core).
-# Only available for CUDA version 5.5+.
-# CUDA_nppi_LIBRARY -- NVIDIA Performance Primitives library (image processing).
-# Only available for CUDA version 5.5+.
-# CUDA_npps_LIBRARY -- NVIDIA Performance Primitives library (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.
+# 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
#
-# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
-# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
+# 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 (alterative to:
+# CUDA_ADD_CUBLAS_TO_TARGET macro).
+# CUDA_cudart_static_LIBRARY -- Statically linkable cuda runtime library.
+# Only available for CUDA version 5.5+
+# 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+.
+# 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.
#
-# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
+
+# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
+# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
+#
+# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
#
-# Copyright (c) 2007-2009
-# Scientific Computing and Imaging Institute, University of Utah
+# Copyright (c) 2007-2009
+# Scientific Computing and Imaging Institute, University of Utah
#
-# This code is licensed under the MIT License. See the FindCUDA.cmake script
-# for the text of the license.
+# This code is licensed under the MIT License. See the FindCUDA.cmake script
+# for the text of the license.
# The MIT License
#
@@ -313,11 +346,6 @@
# FindCUDA.cmake
-# We need to have at least this version to support the VERSION_LESS argument to 'if' (2.6.2) and unset (2.6.3)
-cmake_policy(PUSH)
-cmake_minimum_required(VERSION 2.6.3)
-cmake_policy(POP)
-
# This macro helps us find the location of helper files we will need the full path to
macro(CUDA_FIND_HELPER_FILE _name _extension)
set(_full_name "${_name}.${_extension}")
@@ -440,7 +468,31 @@ set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
if(CMAKE_GENERATOR MATCHES "Visual Studio")
set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC")
else()
- set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC")
+ if(APPLE
+ AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang"
+ AND "${CMAKE_C_COMPILER}" MATCHES "/cc$")
+ # Using cc which is symlink to clang may let NVCC think it is GCC and issue
+ # unhandled -dumpspecs option to clang. Also in case neither
+ # CMAKE_C_COMPILER is defined (project does not use C language) nor
+ # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let
+ # nvcc use its own default C compiler.
+ # Only care about this on APPLE with clang to avoid
+ # following symlinks to things like ccache
+ if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER)
+ get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH)
+ # if the real path does not end up being clang then
+ # go back to using CMAKE_C_COMPILER
+ if(NOT "${c_compiler_realpath}" MATCHES "/clang$")
+ set(c_compiler_realpath "${CMAKE_C_COMPILER}")
+ endif()
+ else()
+ set(c_compiler_realpath "")
+ endif()
+ set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC")
+ else()
+ set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}"
+ CACHE FILEPATH "Host side compiler used by NVCC")
+ endif()
endif()
# Propagate the host flags to the host compiler via -Xcompiler
@@ -459,6 +511,10 @@ mark_as_advanced(
CUDA_HOST_COMPILATION_CPP
CUDA_NVCC_FLAGS
CUDA_PROPAGATE_HOST_FLAGS
+ CUDA_BUILD_CUBIN
+ CUDA_BUILD_EMULATION
+ CUDA_VERBOSE_BUILD
+ CUDA_SEPARABLE_COMPILATION
)
# Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we
@@ -481,25 +537,23 @@ endforeach()
###############################################################################
###############################################################################
-# Check to see if the CUDA_TOOLKIT_ROOT_DIR and CUDA_SDK_ROOT_DIR have changed,
-# if they have then clear the cache variables, so that will be detected again.
-if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}")
- unset(CUDA_NVCC_EXECUTABLE CACHE)
+macro(cuda_unset_include_and_libraries)
unset(CUDA_TOOLKIT_INCLUDE CACHE)
unset(CUDA_CUDART_LIBRARY CACHE)
+ unset(CUDA_CUDA_LIBRARY CACHE)
# Make sure you run this before you unset CUDA_VERSION.
if(CUDA_VERSION VERSION_EQUAL "3.0")
# This only existed in the 3.0 version of the CUDA toolkit
unset(CUDA_CUDARTEMU_LIBRARY CACHE)
endif()
- unset(CUDA_VERSION CACHE)
- unset(CUDA_CUDA_LIBRARY CACHE)
- unset(CUDA_cupti_LIBRARY CACHE)
+ unset(CUDA_cudart_static_LIBRARY CACHE)
unset(CUDA_cublas_LIBRARY CACHE)
unset(CUDA_cublasemu_LIBRARY CACHE)
unset(CUDA_cufft_LIBRARY CACHE)
unset(CUDA_cufftemu_LIBRARY CACHE)
+ unset(CUDA_cupti_LIBRARY CACHE)
unset(CUDA_curand_LIBRARY CACHE)
+ unset(CUDA_cusolver_LIBRARY CACHE)
unset(CUDA_cusparse_LIBRARY CACHE)
unset(CUDA_npp_LIBRARY CACHE)
unset(CUDA_nppc_LIBRARY CACHE)
@@ -507,6 +561,21 @@ if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}")
unset(CUDA_npps_LIBRARY CACHE)
unset(CUDA_nvcuvenc_LIBRARY CACHE)
unset(CUDA_nvcuvid_LIBRARY CACHE)
+
+ unset(CUDA_USE_STATIC_CUDA_RUNTIME CACHE)
+endmacro()
+
+# Check to see if the CUDA_TOOLKIT_ROOT_DIR and CUDA_SDK_ROOT_DIR have changed,
+# if they have then clear the cache variables, so that will be detected again.
+if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}")
+ unset(CUDA_TOOLKIT_TARGET_DIR CACHE)
+ unset(CUDA_NVCC_EXECUTABLE CACHE)
+ cuda_unset_include_and_libraries()
+ unset(CUDA_VERSION CACHE)
+endif()
+
+if(NOT "${CUDA_TOOLKIT_TARGET_DIR}" STREQUAL "${CUDA_TOOLKIT_TARGET_DIR_INTERNAL}")
+ cuda_unset_include_and_libraries()
endif()
if(NOT "${CUDA_SDK_ROOT_DIR}" STREQUAL "${CUDA_SDK_ROOT_DIR_INTERNAL}")
@@ -581,10 +650,30 @@ endif()
# Always set this convenience variable
set(CUDA_VERSION_STRING "${CUDA_VERSION}")
+# Support for arm cross compilation with CUDA 5.5
+if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf")
+ set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf" CACHE PATH "Toolkit target location.")
+# Support for aarch64 cross compilation with CUDA 7.0
+elseif(CUDA_VERSION VERSION_GREATER "6.5" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux")
+ set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux" CACHE PATH "Toolkit target location.")
+else()
+ set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}" CACHE PATH "Toolkit target location.")
+endif()
+mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR)
+
+# Target CPU architecture
+if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
+ set(_cuda_target_cpu_arch_initial "ARM")
+else()
+ set(_cuda_target_cpu_arch_initial "")
+endif()
+set(CUDA_TARGET_CPU_ARCH ${_cuda_target_cpu_arch_initial} CACHE STRING "Specify the name of the class of CPU architecture for which the input files must be compiled.")
+mark_as_advanced(CUDA_TARGET_CPU_ARCH)
+
# CUDA_TOOLKIT_INCLUDE
find_path(CUDA_TOOLKIT_INCLUDE
device_functions.h # Header included in toolkit
- PATHS "${CUDA_TOOLKIT_ROOT_DIR}"
+ PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}"
ENV CUDA_PATH
ENV CUDA_INC_PATH
PATH_SUFFIXES include
@@ -608,7 +697,7 @@ macro(cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext )
# (lib/Win32) and the old path (lib).
find_library(${_var}
NAMES ${_names}
- PATHS "${CUDA_TOOLKIT_ROOT_DIR}"
+ PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}"
ENV CUDA_PATH
ENV CUDA_LIB_PATH
PATH_SUFFIXES ${_cuda_64bit_lib_dir} "${_path_ext}lib/Win32" "${_path_ext}lib" "${_path_ext}libWin32"
@@ -641,6 +730,49 @@ if(CUDA_VERSION VERSION_EQUAL "3.0")
CUDA_CUDARTEMU_LIBRARY
)
endif()
+if(NOT CUDA_VERSION VERSION_LESS "5.5")
+ cuda_find_library_local_first(CUDA_cudart_static_LIBRARY cudart_static "static CUDA runtime library")
+ mark_as_advanced(CUDA_cudart_static_LIBRARY)
+endif()
+if(CUDA_cudart_static_LIBRARY)
+ # Set whether to use the static cuda runtime.
+ option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" ON)
+else()
+ option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" OFF)
+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)
+
+ # 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
+ # -Werror causes the try_compile to fail. We will just temporarily disable other flags
+ # when doing the find_package command here.
+ set(_cuda_cmake_c_flags ${CMAKE_C_FLAGS})
+ set(CMAKE_C_FLAGS "-fPIC")
+ 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)
+ # Here is librt that has things such as, clock_gettime, shm_open, and shm_unlink.
+ find_library(CUDA_rt_LIBRARY rt)
+ if (NOT CUDA_rt_LIBRARY)
+ message(WARNING "Expecting to find librt for libcudart_static, but didn't find it.")
+ endif()
+ endif()
+ endif()
+endif()
# CUPTI library showed up in cuda toolkit 4.0
if(NOT CUDA_VERSION VERSION_LESS "4.0")
@@ -648,24 +780,29 @@ if(NOT CUDA_VERSION VERSION_LESS "4.0")
mark_as_advanced(CUDA_cupti_LIBRARY)
endif()
+# Set the CUDA_LIBRARIES variable. This is the set of stuff to link against if you are
+# using the CUDA runtime. For the dynamic version of the runtime, most of the
+# dependencies are brough in, but for the static version there are additional libraries
+# and linker commands needed.
+# Initialize to empty
+set(CUDA_LIBRARIES)
+
# If we are using emulation mode and we found the cudartemu library then use
# that one instead of cudart.
if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY)
- set(CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY})
-else()
- set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY})
-endif()
-if(APPLE)
- # We need to add the path to cudart to the linker using rpath, since the
- # library name for the cuda libraries is prepended with @rpath.
- if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY)
- get_filename_component(_cuda_path_to_cudart "${CUDA_CUDARTEMU_LIBRARY}" PATH)
- else()
- get_filename_component(_cuda_path_to_cudart "${CUDA_CUDART_LIBRARY}" PATH)
+ list(APPEND CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY})
+elseif(CUDA_USE_STATIC_CUDA_RUNTIME AND CUDA_cudart_static_LIBRARY)
+ list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
+ if (CUDA_rt_LIBRARY)
+ list(APPEND CUDA_LIBRARIES ${CUDA_rt_LIBRARY})
endif()
- if(_cuda_path_to_cudart)
- list(APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}")
+ if(APPLE)
+ # We need to add the default path to the driver (libcuda.dylib) as an rpath, so that
+ # the static cuda runtime can find it at runtime.
+ list(APPEND CUDA_LIBRARIES -Wl,-rpath,/usr/local/cuda/lib)
endif()
+else()
+ list(APPEND CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY})
endif()
# 1.1 toolkit on linux doesn't appear to have a separate library on
@@ -718,6 +855,10 @@ if(CUDA_VERSION VERSION_GREATER "5.0")
elseif(NOT CUDA_VERSION VERSION_LESS "4.0")
find_cuda_helper_libs(npp)
endif()
+if(NOT CUDA_VERSION VERSION_LESS "7.0")
+ # cusolver showed up in version 7.0
+ find_cuda_helper_libs(cusolver)
+endif()
if (CUDA_BUILD_EMULATION)
set(CUDA_CUFFT_LIBRARIES ${CUDA_cufftemu_LIBRARY})
@@ -799,6 +940,8 @@ set(CUDA_FOUND TRUE)
set(CUDA_TOOLKIT_ROOT_DIR_INTERNAL "${CUDA_TOOLKIT_ROOT_DIR}" CACHE INTERNAL
"This is the value of the last time CUDA_TOOLKIT_ROOT_DIR was set successfully." FORCE)
+set(CUDA_TOOLKIT_TARGET_DIR_INTERNAL "${CUDA_TOOLKIT_TARGET_DIR}" CACHE INTERNAL
+ "This is the value of the last time CUDA_TOOLKIT_TARGET_DIR was set successfully." FORCE)
set(CUDA_SDK_ROOT_DIR_INTERNAL "${CUDA_SDK_ROOT_DIR}" CACHE INTERNAL
"This is the value of the last time CUDA_SDK_ROOT_DIR was set successfully." FORCE)
@@ -844,15 +987,15 @@ macro(CUDA_GET_SOURCES_AND_OPTIONS _sources _cmake_options _options)
set( ${_options} )
set( _found_options FALSE )
foreach(arg ${ARGN})
- if(arg STREQUAL "OPTIONS")
+ if("x${arg}" STREQUAL "xOPTIONS")
set( _found_options TRUE )
elseif(
- arg STREQUAL "WIN32" OR
- arg STREQUAL "MACOSX_BUNDLE" OR
- arg STREQUAL "EXCLUDE_FROM_ALL" OR
- arg STREQUAL "STATIC" OR
- arg STREQUAL "SHARED" OR
- arg STREQUAL "MODULE"
+ "x${arg}" STREQUAL "xWIN32" OR
+ "x${arg}" STREQUAL "xMACOSX_BUNDLE" OR
+ "x${arg}" STREQUAL "xEXCLUDE_FROM_ALL" OR
+ "x${arg}" STREQUAL "xSTATIC" OR
+ "x${arg}" STREQUAL "xSHARED" OR
+ "x${arg}" STREQUAL "xMODULE"
)
list(APPEND ${_cmake_options} ${arg})
else()
@@ -948,7 +1091,7 @@ function(CUDA_COMPUTE_BUILD_PATH path build_path)
endif()
endif()
- # This recipie is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the
+ # This recipe is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the
# CMake source.
# Remove leading /
@@ -977,7 +1120,7 @@ endfunction()
# a .cpp or .ptx file.
# INPUT:
# cuda_target - Target name
-# format - PTX or OBJ
+# format - PTX, CUBIN, FATBIN or OBJ
# FILE1 .. FILEN - The remaining arguments are the sources to be wrapped.
# OPTIONS - Extra options to NVCC
# OUTPUT:
@@ -1023,6 +1166,10 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(nvcc_flags ${nvcc_flags} -m32)
endif()
+ if(CUDA_TARGET_CPU_ARCH)
+ set(nvcc_flags ${nvcc_flags} "--target-cpu-architecture=${CUDA_TARGET_CPU_ARCH}")
+ endif()
+
# This needs to be passed in at this stage, because VS needs to fill out the
# value of VCInstallDir from within VS. Note that CCBIN is only used if
# -ccbin or --compiler-bindir isn't used and CUDA_HOST_COMPILER matches
@@ -1131,6 +1278,19 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(_cuda_nvcc_flags_config "${_cuda_nvcc_flags_config}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})")
endforeach()
+ # Process the C++11 flag. If the host sets the flag, we need to add it to nvcc and
+ # remove it from the host. This is because -Xcompile -std=c++ will choke nvcc (it uses
+ # the C preprocessor). In order to get this to work correctly, we need to use nvcc's
+ # specific c++11 flag.
+ if( "${_cuda_host_flags}" MATCHES "-std=c\\+\\+11")
+ # Add the c++11 flag to nvcc if it isn't already present. Note that we only look at
+ # the main flag instead of the configuration specific flags.
+ if( NOT "${CUDA_NVCC_FLAGS}" MATCHES "-std;c\\+\\+11" )
+ list(APPEND nvcc_flags --std c++11)
+ endif()
+ string(REGEX REPLACE "[-]+std=c\\+\\+11" "" _cuda_host_flags "${_cuda_host_flags}")
+ endif()
+
# Get the list of definitions from the directory property
get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS)
if(CUDA_NVCC_DEFINITIONS)
@@ -1151,24 +1311,36 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
foreach(file ${ARGN})
# Ignore any file marked as a HEADER_FILE_ONLY
get_source_file_property(_is_header ${file} HEADER_FILE_ONLY)
- if(${file} MATCHES ".*\\.cu$" AND NOT _is_header)
+ # Allow per source file overrides of the format. Also allows compiling non-.cu files.
+ get_source_file_property(_cuda_source_format ${file} CUDA_SOURCE_PROPERTY_FORMAT)
+ if((${file} MATCHES "\\.cu$" OR _cuda_source_format) AND NOT _is_header)
- # Allow per source file overrides of the format.
- get_source_file_property(_cuda_source_format ${file} CUDA_SOURCE_PROPERTY_FORMAT)
if(NOT _cuda_source_format)
set(_cuda_source_format ${format})
endif()
-
- if( ${_cuda_source_format} MATCHES "PTX" )
- set( compile_to_ptx ON )
- elseif( ${_cuda_source_format} MATCHES "OBJ")
- set( compile_to_ptx OFF )
+ # If file isn't a .cu file, we need to tell nvcc to treat it as such.
+ if(NOT ${file} MATCHES "\\.cu$")
+ set(cuda_language_flag -x=cu)
else()
- message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS for file '${file}': '${_cuda_source_format}'. Use OBJ or PTX.")
+ set(cuda_language_flag)
endif()
+ if( ${_cuda_source_format} MATCHES "OBJ")
+ set( cuda_compile_to_external_module OFF )
+ else()
+ set( cuda_compile_to_external_module ON )
+ if( ${_cuda_source_format} MATCHES "PTX" )
+ set( cuda_compile_to_external_module_type "ptx" )
+ elseif( ${_cuda_source_format} MATCHES "CUBIN")
+ set( cuda_compile_to_external_module_type "cubin" )
+ elseif( ${_cuda_source_format} MATCHES "FATBIN")
+ set( cuda_compile_to_external_module_type "fatbin" )
+ else()
+ message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS or set with CUDA_SOURCE_PROPERTY_FORMAT file property for file '${file}': '${_cuda_source_format}'. Use OBJ, PTX, CUBIN or FATBIN.")
+ endif()
+ endif()
- if(compile_to_ptx)
+ if(cuda_compile_to_external_module)
# Don't use any of the host compilation flags for PTX targets.
set(CUDA_HOST_FLAGS)
set(CUDA_NVCC_FLAGS_CONFIG)
@@ -1183,7 +1355,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
if(CUDA_GENERATED_OUTPUT_DIR)
set(cuda_compile_output_dir "${CUDA_GENERATED_OUTPUT_DIR}")
else()
- if ( compile_to_ptx )
+ if ( cuda_compile_to_external_module )
set(cuda_compile_output_dir "${CMAKE_CURRENT_BINARY_DIR}")
else()
set(cuda_compile_output_dir "${cuda_compile_intermediate_directory}")
@@ -1193,10 +1365,10 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# Add a custom target to generate a c or ptx file. ######################
get_filename_component( basename ${file} NAME )
- if( compile_to_ptx )
+ if( cuda_compile_to_external_module )
set(generated_file_path "${cuda_compile_output_dir}")
- set(generated_file_basename "${cuda_target}_generated_${basename}.ptx")
- set(format_flag "-ptx")
+ set(generated_file_basename "${cuda_target}_generated_${basename}.${cuda_compile_to_external_module_type}")
+ set(format_flag "-${cuda_compile_to_external_module_type}")
file(MAKE_DIRECTORY "${cuda_compile_output_dir}")
else()
set(generated_file_path "${cuda_compile_output_dir}/${CMAKE_CFG_INTDIR}")
@@ -1219,7 +1391,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(custom_target_script "${cuda_compile_intermediate_directory}/${generated_file_basename}.cmake")
# Setup properties for obj files:
- if( NOT compile_to_ptx )
+ if( NOT cuda_compile_to_external_module )
set_source_files_properties("${generated_file}"
PROPERTIES
EXTERNAL_OBJECT true # This is an object file not to be compiled, but only be linked.
@@ -1234,7 +1406,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
endif()
- if( NOT compile_to_ptx AND CUDA_SEPARABLE_COMPILATION)
+ if( NOT cuda_compile_to_external_module AND CUDA_SEPARABLE_COMPILATION)
list(APPEND ${cuda_target}_SEPARABLE_COMPILATION_OBJECTS "${generated_file}")
endif()
@@ -1251,7 +1423,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# Build the NVCC made dependency file ###################################
set(build_cubin OFF)
if ( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN )
- if ( NOT compile_to_ptx )
+ if ( NOT cuda_compile_to_external_module )
set ( build_cubin ON )
endif()
endif()
@@ -1278,12 +1450,17 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# Create up the comment string
file(RELATIVE_PATH generated_file_relative_path "${CMAKE_BINARY_DIR}" "${generated_file}")
- if(compile_to_ptx)
- set(cuda_build_comment_string "Building NVCC ptx file ${generated_file_relative_path}")
+ if(cuda_compile_to_external_module)
+ set(cuda_build_comment_string "Building NVCC ${cuda_compile_to_external_module_type} file ${generated_file_relative_path}")
else()
set(cuda_build_comment_string "Building NVCC (${cuda_build_type}) object ${generated_file_relative_path}")
endif()
+ set(_verbatim VERBATIM)
+ if(ccbin_flags MATCHES "\\$\\(VCInstallDir\\)")
+ set(_verbatim "")
+ endif()
+
# Build the generated file and dependency file ##########################
add_custom_command(
OUTPUT ${generated_file}
@@ -1302,6 +1479,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
-P "${custom_target_script}"
WORKING_DIRECTORY "${cuda_compile_intermediate_directory}"
COMMENT "${cuda_build_comment_string}"
+ ${_verbatim}
)
# Make sure the build system knows the file is generated.
@@ -1323,10 +1501,10 @@ endmacro()
function(_cuda_get_important_host_flags important_flags flag_string)
if(CMAKE_GENERATOR MATCHES "Visual Studio")
- string(REGEX MATCHALL "/M[DT][d]?" flags ${flag_string})
+ string(REGEX MATCHALL "/M[DT][d]?" flags "${flag_string}")
list(APPEND ${important_flags} ${flags})
else()
- string(REGEX MATCHALL "-fPIC" flags ${flag_string})
+ string(REGEX MATCHALL "-fPIC" flags "${flag_string}")
list(APPEND ${important_flags} ${flags})
endif()
set(${important_flags} ${${important_flags}} PARENT_SCOPE)
@@ -1372,18 +1550,40 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
# If -ccbin, --compiler-bindir has been specified, don't do anything. Otherwise add it here.
list( FIND nvcc_flags "-ccbin" ccbin_found0 )
list( FIND nvcc_flags "--compiler-bindir" ccbin_found1 )
- if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 )
- list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
+ if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
+ # Match VERBATIM check below.
+ if(CUDA_HOST_COMPILER MATCHES "\\$\\(VCInstallDir\\)")
+ list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
+ else()
+ list(APPEND nvcc_flags -ccbin "${CUDA_HOST_COMPILER}")
+ endif()
endif()
+
+ # Create a list of flags specified by CUDA_NVCC_FLAGS_${CONFIG} and CMAKE_${CUDA_C_OR_CXX}_FLAGS*
+ set(config_specific_flags)
set(flags)
foreach(config ${CUDA_configuration_types})
string(TOUPPER ${config} config_upper)
+ # Add config specific flags
+ foreach(f ${CUDA_NVCC_FLAGS_${config_upper}})
+ list(APPEND config_specific_flags $<$<CONFIG:${config}>:${f}>)
+ endforeach()
set(important_host_flags)
- _cuda_get_important_host_flags(important_host_flags ${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}})
+ _cuda_get_important_host_flags(important_host_flags "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")
foreach(f ${important_host_flags})
list(APPEND flags $<$<CONFIG:${config}>:-Xcompiler> $<$<CONFIG:${config}>:${f}>)
endforeach()
endforeach()
+ # Add CMAKE_${CUDA_C_OR_CXX}_FLAGS
+ set(important_host_flags)
+ _cuda_get_important_host_flags(important_host_flags "${CMAKE_${CUDA_C_OR_CXX}_FLAGS}")
+ foreach(f ${important_host_flags})
+ list(APPEND flags -Xcompiler ${f})
+ endforeach()
+
+ # Add our general CUDA_NVCC_FLAGS with the configuration specifig flags
+ set(nvcc_flags ${CUDA_NVCC_FLAGS} ${config_specific_flags} ${nvcc_flags})
+
file(RELATIVE_PATH output_file_relative_path "${CMAKE_BINARY_DIR}" "${output_file}")
# Some generators don't handle the multiple levels of custom command
@@ -1391,12 +1591,16 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
# we work around that issue by compiling the intermediate link object as a
# pre-link custom command in that situation.
set(do_obj_build_rule TRUE)
- if (MSVC_VERSION GREATER 1599)
- # VS 2010 and 2012 have this problem. If future versions fix this issue,
- # it should still work, it just won't be as nice as the other method.
+ if (MSVC_VERSION GREATER 1599 AND MSVC_VERSION LESS 1800)
+ # VS 2010 and 2012 have this problem.
set(do_obj_build_rule FALSE)
endif()
+ set(_verbatim VERBATIM)
+ if(nvcc_flags MATCHES "\\$\\(VCInstallDir\\)")
+ set(_verbatim "")
+ endif()
+
if (do_obj_build_rule)
add_custom_command(
OUTPUT ${output_file}
@@ -1404,13 +1608,17 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} -o ${output_file}
${flags}
COMMENT "Building NVCC intermediate link file ${output_file_relative_path}"
+ ${_verbatim}
)
else()
+ get_filename_component(output_file_dir "${output_file}" DIRECTORY)
add_custom_command(
TARGET ${cuda_target}
PRE_LINK
COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${output_file_dir}"
COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}"
+ ${_verbatim}
)
endif()
endif()
@@ -1509,21 +1717,29 @@ endmacro()
###############################################################################
###############################################################################
-# CUDA COMPILE
+# (Internal) helper for manually added cuda source files with specific targets
###############################################################################
###############################################################################
-macro(CUDA_COMPILE generated_files)
+macro(cuda_compile_base cuda_target format generated_files)
# Separate the sources from the options
CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
# Create custom commands and targets for each file.
- CUDA_WRAP_SRCS( cuda_compile OBJ _generated_files ${_sources} ${_cmake_options}
+ CUDA_WRAP_SRCS( ${cuda_target} ${format} _generated_files ${_sources} ${_cmake_options}
OPTIONS ${_options} )
set( ${generated_files} ${_generated_files})
endmacro()
+###############################################################################
+###############################################################################
+# CUDA COMPILE
+###############################################################################
+###############################################################################
+macro(CUDA_COMPILE generated_files)
+ cuda_compile_base(cuda_compile OBJ ${generated_files} ${ARGN})
+endmacro()
###############################################################################
###############################################################################
@@ -1531,17 +1747,28 @@ endmacro()
###############################################################################
###############################################################################
macro(CUDA_COMPILE_PTX generated_files)
+ cuda_compile_base(cuda_compile_ptx PTX ${generated_files} ${ARGN})
+endmacro()
- # Separate the sources from the options
- CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
- # Create custom commands and targets for each file.
- CUDA_WRAP_SRCS( cuda_compile_ptx PTX _generated_files ${_sources} ${_cmake_options}
- OPTIONS ${_options} )
-
- set( ${generated_files} ${_generated_files})
+###############################################################################
+###############################################################################
+# CUDA COMPILE FATBIN
+###############################################################################
+###############################################################################
+macro(CUDA_COMPILE_FATBIN generated_files)
+ cuda_compile_base(cuda_compile_fatbin FATBIN ${generated_files} ${ARGN})
+endmacro()
+###############################################################################
+###############################################################################
+# CUDA COMPILE CUBIN
+###############################################################################
+###############################################################################
+macro(CUDA_COMPILE_CUBIN generated_files)
+ cuda_compile_base(cuda_compile_cubin CUBIN ${generated_files} ${ARGN})
endmacro()
+
###############################################################################
###############################################################################
# CUDA ADD CUFFT TO TARGET
diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake
index 1b53d177d..c433fa8ed 100644
--- a/Modules/FindCUDA/make2cmake.cmake
+++ b/Modules/FindCUDA/make2cmake.cmake
@@ -37,12 +37,11 @@
file(READ ${input_file} depend_text)
-if (${depend_text} MATCHES ".+")
+if (NOT "${depend_text}" STREQUAL "")
# message("FOUND DEPENDS")
- # Remember, four backslashes is escaped to one backslash in the string.
- string(REGEX REPLACE "\\\\ " " " depend_text ${depend_text})
+ string(REPLACE "\\ " " " depend_text ${depend_text})
# This works for the nvcc -M generated dependency files.
string(REGEX REPLACE "^.* : " "" depend_text ${depend_text})
diff --git a/Modules/FindCUDA/parse_cubin.cmake b/Modules/FindCUDA/parse_cubin.cmake
index 94be7e2cb..626c8a2e4 100644
--- a/Modules/FindCUDA/parse_cubin.cmake
+++ b/Modules/FindCUDA/parse_cubin.cmake
@@ -37,11 +37,10 @@
file(READ ${input_file} file_text)
-if (${file_text} MATCHES ".+")
+if (NOT "${file_text}" STREQUAL "")
- # Remember, four backslashes is escaped to one backslash in the string.
- string(REGEX REPLACE ";" "\\\\;" file_text ${file_text})
- string(REGEX REPLACE "\ncode" ";code" file_text ${file_text})
+ string(REPLACE ";" "\\;" file_text ${file_text})
+ string(REPLACE "\ncode" ";code" file_text ${file_text})
list(LENGTH file_text len)
@@ -57,7 +56,7 @@ if (${file_text} MATCHES ".+")
# Extract kernel names.
if (${entry} MATCHES "[^g]name = ([^ ]+)")
- string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
+ set(entry "${CMAKE_MATCH_1}")
# Check to see if the kernel name starts with "_"
set(skip FALSE)
@@ -76,19 +75,19 @@ if (${file_text} MATCHES ".+")
# Registers
if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
- string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ set(entry "${CMAKE_MATCH_3}")
message("Registers: ${entry}")
endif()
# Local memory
if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
- string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ set(entry "${CMAKE_MATCH_3}")
message("Local: ${entry}")
endif()
# Shared memory
if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
- string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ set(entry "${CMAKE_MATCH_3}")
message("Shared: ${entry}")
endif()
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index f0aac8487..80323091d 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -62,7 +62,7 @@ set(cmake_dependency_file "@cmake_dependency_file@") # path
set(CUDA_make2cmake "@CUDA_make2cmake@") # path
set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path
set(build_cubin @build_cubin@) # bool
-set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # bool
+set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # path
# We won't actually use these variables for now, but we need to set this, in
# order to force this file to be run again if it changes.
set(generated_file_path "@generated_file_path@") # path
@@ -75,6 +75,7 @@ set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list
set(nvcc_flags @nvcc_flags@) # list
set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@") # list (needs to be in quotes to handle spaces properly).
set(format_flag "@format_flag@") # string
+set(cuda_language_flag @cuda_language_flag@) # list
if(build_cubin AND NOT generated_cubin_file)
message(FATAL_ERROR "You must specify generated_cubin_file on the command line")
@@ -106,7 +107,7 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
-if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 )
+if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN)
set(CCBIN -ccbin "${CCBIN}")
else()
@@ -126,7 +127,7 @@ endif()
# and other return variables are present after executing the process.
macro(cuda_execute_process status command)
set(_command ${command})
- if(NOT _command STREQUAL "COMMAND")
+ if(NOT "x${_command}" STREQUAL "xCOMMAND")
message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})")
endif()
if(verbose)
@@ -238,6 +239,7 @@ cuda_execute_process(
"Generating ${generated_file}"
COMMAND "${CUDA_NVCC_EXECUTABLE}"
"${source_file}"
+ ${cuda_language_flag}
${format_flag} -o "${generated_file}"
${CCBIN}
${nvcc_flags}
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index 0fb8f45d4..209fd877d 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -1,10 +1,17 @@
-# - Find curl
+#.rst:
+# FindCURL
+# --------
+#
+# Find curl
+#
# Find the native CURL headers and libraries.
#
-# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
-# CURL_LIBRARIES - List of libraries when using curl.
-# CURL_FOUND - True if curl found.
-# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8)
+# ::
+#
+# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
+# CURL_LIBRARIES - List of libraries when using curl.
+# CURL_FOUND - True if curl found.
+# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/FindCVS.cmake b/Modules/FindCVS.cmake
index 07079bb5a..6f545dfd5 100644
--- a/Modules/FindCVS.cmake
+++ b/Modules/FindCVS.cmake
@@ -1,11 +1,24 @@
+#.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
+#
+# ::
+#
+# 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()
+#
+# ::
+#
+# find_package(CVS)
+# if(CVS_FOUND)
+# message("CVS found: ${CVS_EXECUTABLE}")
+# endif()
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
diff --git a/Modules/FindCoin3D.cmake b/Modules/FindCoin3D.cmake
index bbda87b3a..f90860c81 100644
--- a/Modules/FindCoin3D.cmake
+++ b/Modules/FindCoin3D.cmake
@@ -1,13 +1,19 @@
-# - Find Coin3D (Open Inventor)
-# Coin3D is an implementation of the Open Inventor API.
-# It provides data structures and algorithms for 3D visualization
-# http://www.coin3d.org/
+#.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
#
+# ::
+#
+# 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
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
index 53ab031cf..51eb7c58e 100644
--- a/Modules/FindCups.cmake
+++ b/Modules/FindCups.cmake
@@ -1,12 +1,19 @@
-# - Try to find the Cups printing system
+#.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)
+# ::
+#
+# 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)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -29,9 +36,13 @@ find_library(CUPS_LIBRARIES NAMES cups )
if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+ cmake_push_check_state()
+ set(CMAKE_REQUIRED_QUIET ${Cups_FIND_QUIETLY})
# ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
+ cmake_pop_check_state()
endif ()
if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
@@ -41,9 +52,8 @@ if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
unset(CUPS_VERSION_STRING)
foreach(VPART MAJOR MINOR PATCH)
foreach(VLINE ${cups_version_str})
- if(VLINE MATCHES "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}")
- string(REGEX REPLACE "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}[\t ]+([0-9]+)$" "\\1"
- CUPS_VERSION_PART "${VLINE}")
+ if(VLINE MATCHES "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}[\t ]+([0-9]+)$")
+ set(CUPS_VERSION_PART "${CMAKE_MATCH_1}")
if(CUPS_VERSION_STRING)
set(CUPS_VERSION_STRING "${CUPS_VERSION_STRING}.${CUPS_VERSION_PART}")
else()
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index 09d1ba401..e236c2445 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -1,19 +1,44 @@
-# - Find the curses include file and library
+#.rst:
+# FindCurses
+# ----------
#
-# CURSES_FOUND - system has Curses
-# CURSES_INCLUDE_DIR - the Curses include directory
-# CURSES_LIBRARIES - The libraries needed to use Curses
-# CURSES_HAVE_CURSES_H - true if curses.h is available
-# CURSES_HAVE_NCURSES_H - true if ncurses.h is available
-# CURSES_HAVE_NCURSES_NCURSES_H - true if ncurses/ncurses.h is available
-# CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available
-# CURSES_LIBRARY - set for backwards compatibility with 2.4 CMake
+# Find the curses or ncurses include file and library.
#
-# Set CURSES_NEED_NCURSES to TRUE before the find_package() command if NCurses
-# functionality is required.
+# 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.
+#
+# 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.
#=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
+# Copyright 2001-2014 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -25,12 +50,14 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+
find_library(CURSES_CURSES_LIBRARY NAMES curses )
find_library(CURSES_NCURSES_LIBRARY NAMES ncurses )
set(CURSES_USE_NCURSES FALSE)
-if(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY)
+if(CURSES_NCURSES_LIBRARY AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES))
set(CURSES_USE_NCURSES TRUE)
endif()
# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html
@@ -56,7 +83,9 @@ endif()
# prefix as the library was found, if still not found, try curses.h with the
# default search paths.
if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
- include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+ cmake_push_check_state()
+ set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY})
CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
@@ -67,77 +96,94 @@ if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
set(CURSES_USE_NCURSES TRUE)
endif()
endif()
+ cmake_pop_check_state()
endif()
-
-if(NOT CURSES_USE_NCURSES)
- find_file(CURSES_HAVE_CURSES_H curses.h )
- find_path(CURSES_CURSES_H_PATH curses.h )
- get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
+if(CURSES_USE_NCURSES)
+ get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
- # for compatibility with older FindCurses.cmake this has to be in the cache
- # FORCE must not be used since this would break builds which preload a cache wqith these variables set
- set(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}"
- CACHE FILEPATH "The curses include path")
- set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}"
- CACHE FILEPATH "The curses library")
+ # Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility.
+ if(CURSES_NCURSES_INCLUDE_PATH)
+ find_path(CURSES_INCLUDE_PATH
+ NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h
+ PATHS ${CURSES_NCURSES_INCLUDE_PATH}
+ NO_DEFAULT_PATH
+ )
+ endif()
+
+ find_path(CURSES_INCLUDE_PATH
+ NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h
+ HINTS "${_cursesParentDir}/include"
+ )
+
+ # Previous versions of FindCurses provided these values.
+ if(NOT DEFINED CURSES_LIBRARY)
+ set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}")
+ endif()
+
+ CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
+ cbreak "" CURSES_NCURSES_HAS_CBREAK)
+ if(NOT CURSES_NCURSES_HAS_CBREAK)
+ find_library(CURSES_EXTRA_LIBRARY tinfo HINTS "${_cursesLibDir}")
+ find_library(CURSES_EXTRA_LIBRARY tinfo )
+ endif()
else()
-# we need to find ncurses
- get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
+ get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
- find_file(CURSES_HAVE_NCURSES_H ncurses.h)
- find_file(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h)
- find_file(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h)
- find_file(CURSES_HAVE_CURSES_H curses.h
- HINTS "${_cursesParentDir}/include")
-
- find_path(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h
- ncurses/curses.h)
- find_path(CURSES_NCURSES_INCLUDE_PATH curses.h
- HINTS "${_cursesParentDir}/include")
-
- # for compatibility with older FindCurses.cmake this has to be in the cache
- # FORCE must not be used since this would break builds which preload
- # however if the value of the variable has NOTFOUND in it, then
- # it is OK to force, and we need to force in order to have it work.
- # a cache wqith these variables set
- # only put ncurses include and library into
- # variables if they are found
- if(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H)
- get_filename_component(CURSES_NCURSES_INCLUDE_PATH
- "${CURSES_HAVE_NCURSES_NCURSES_H}" PATH)
+ find_path(CURSES_INCLUDE_PATH
+ NAMES curses.h
+ HINTS "${_cursesParentDir}/include"
+ )
+
+ # Previous versions of FindCurses provided these values.
+ if(NOT DEFINED CURSES_CURSES_H_PATH)
+ set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}")
endif()
- if(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY)
- set( FORCE_IT )
- if(CURSES_INCLUDE_PATH MATCHES NOTFOUND)
- set(FORCE_IT FORCE)
- endif()
- set(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}"
- CACHE FILEPATH "The curses include path" ${FORCE_IT})
- set( FORCE_IT)
- if(CURSES_LIBRARY MATCHES NOTFOUND)
- set(FORCE_IT FORCE)
- endif()
- set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}"
- CACHE FILEPATH "The curses library" ${FORCE_IT})
+ if(NOT DEFINED CURSES_LIBRARY)
+ set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}")
endif()
-
endif()
-find_library(CURSES_EXTRA_LIBRARY cur_colr HINTS "${_cursesLibDir}")
-find_library(CURSES_EXTRA_LIBRARY cur_colr )
+# Report whether each possible header name exists in the include directory.
+if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H)
+ if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
+ set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
+ else()
+ set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND")
+ endif()
+endif()
+if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H)
+ if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
+ set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
+ else()
+ set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND")
+ endif()
+endif()
+if(NOT DEFINED CURSES_HAVE_NCURSES_H)
+ if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h")
+ set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h")
+ else()
+ set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND")
+ endif()
+endif()
+if(NOT DEFINED CURSES_HAVE_CURSES_H)
+ if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h")
+ set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h")
+ else()
+ set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND")
+ endif()
+endif()
find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}")
find_library(CURSES_FORM_LIBRARY form )
-# for compatibility with older FindCurses.cmake this has to be in the cache
-# FORCE must not be used since this would break builds which preload a cache
-# qith these variables set
-set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}"
- CACHE FILEPATH "The curses form library")
+# Previous versions of FindCurses provided these values.
+if(NOT DEFINED FORM_LIBRARY)
+ set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}")
+endif()
# Need to provide the *_LIBRARIES
set(CURSES_LIBRARIES ${CURSES_LIBRARY})
@@ -150,8 +196,9 @@ if(CURSES_FORM_LIBRARY)
set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY})
endif()
-# Proper name is *_INCLUDE_DIR
-set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
+# Provide the *_INCLUDE_DIRS result.
+set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH})
+set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility
# handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if
# all listed variables are TRUE
@@ -161,16 +208,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG
mark_as_advanced(
CURSES_INCLUDE_PATH
- CURSES_LIBRARY
- CURSES_CURSES_INCLUDE_PATH
CURSES_CURSES_LIBRARY
- CURSES_NCURSES_INCLUDE_PATH
CURSES_NCURSES_LIBRARY
CURSES_EXTRA_LIBRARY
- FORM_LIBRARY
- CURSES_LIBRARIES
- CURSES_INCLUDE_DIR
- CURSES_CURSES_HAS_WSYNCUP
- CURSES_NCURSES_HAS_WSYNCUP
)
-
diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake
index 48de64afd..bc0dfbcca 100644
--- a/Modules/FindCxxTest.cmake
+++ b/Modules/FindCxxTest.cmake
@@ -1,88 +1,138 @@
-# - 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
+#.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.
+# ::
+#
+# 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.
#
-# 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
+# ::
+#
+# 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
+#
+#
#
# 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 );
-# }
-# };
+# ::
+#
+# 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 );
+# }
+# };
#=============================================================================
# Copyright 2008-2010 Kitware, Inc.
diff --git a/Modules/FindCygwin.cmake b/Modules/FindCygwin.cmake
index d7ab7cc80..5cb533b0b 100644
--- a/Modules/FindCygwin.cmake
+++ b/Modules/FindCygwin.cmake
@@ -1,5 +1,8 @@
-# - this module looks for Cygwin
+#.rst:
+# FindCygwin
+# ----------
#
+# this module looks for Cygwin
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake
index 361d09e8b..63d253d90 100644
--- a/Modules/FindDCMTK.cmake
+++ b/Modules/FindDCMTK.cmake
@@ -1,15 +1,79 @@
-# - find DCMTK libraries and applications
+#.rst:
+# FindDCMTK
+# ---------
#
-
-# DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK
+# 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
#
-# DCMTK_DIR can be used to make it simpler to find the various include
-# directories and compiled libraries if you've just compiled it in the
-# source tree. Just set it to the root of the tree where you extracted
-# the source (default to /usr/include/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.
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
@@ -32,50 +96,142 @@
# Modified for EasyViz by Thomas Sondergaard.
#
-if(NOT DCMTK_FOUND AND NOT DCMTK_DIR)
- set(DCMTK_DIR
- "/usr/include/dcmtk/"
- CACHE
- PATH
- "Root of DCMTK source tree (optional).")
- mark_as_advanced(DCMTK_DIR)
+set(_dcmtk_dir_description "The directory of DCMTK build or install tree.")
+
+# Ensure that DCMTK_DIR is set to a reasonable default value
+# so that DCMTK libraries can be found on a standard Unix distribution.
+# It also overwrite the value of DCMTK_DIR after this one has been
+# set by a successful discovery of DCMTK by the unpatched FindDCMTK.cmake module
+# distributed with CMake (as of 0167cea)
+if(NOT DCMTK_DIR OR DCMTK_DIR STREQUAL "/usr/include/dcmtk")
+ set(DCMTK_DIR "/usr" CACHE PATH ${_dcmtk_dir_description} FORCE)
+endif()
+
+set(_SAVED_DCMTK_DIR ${DCMTK_DIR})
+
+#
+# Step1: Attempt to find a version of DCMTK providing a DCMTKConfig.cmake file.
+#
+if(NOT DCMTK_FIND_QUIETLY)
+ message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake")
endif()
+find_package(DCMTK QUIET NO_MODULE)
+if(DCMTK_FOUND
+ AND NOT "x" STREQUAL "x${DCMTK_LIBRARIES}"
+ AND NOT "x" STREQUAL "x${DCMTK_INCLUDE_DIRS}")
+ if(NOT DCMTK_FIND_QUIETLY)
+ message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - ok")
+ endif()
+ return()
+else()
+ if(NOT DCMTK_FIND_QUIETLY)
+ message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - failed")
+ endif()
+endif()
+
+if(NOT DCMTK_FIND_QUIETLY)
+ message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake")
+endif()
+# Restore the value reset by the previous call to 'find_package(DCMTK QUIET NO_MODULE)'
+set(DCMTK_DIR ${_SAVED_DCMTK_DIR} CACHE PATH ${_dcmtk_dir_description} FORCE)
+
+
+#
+# Step2: Attempt to find a version of DCMTK that does NOT provide a DCMTKConfig.cmake file.
+#
+
+# prefer DCMTK_DIR over default system paths like /usr/lib
+if(DCMTK_DIR)
+ set(CMAKE_PREFIX_PATH ${DCMTK_DIR}/lib ${CMAKE_PREFIX_PATH}) # this is given to FIND_LIBRARY or FIND_PATH
+endif()
+
+# Find all libraries, store debug and release separately
foreach(lib
- dcmdata
- dcmimage
- dcmimgle
- dcmjpeg
- dcmnet
dcmpstat
- dcmqrdb
- dcmsign
dcmsr
+ dcmsign
dcmtls
+ dcmqrdb
+ dcmnet
+ dcmjpeg
+ dcmimage
+ dcmimgle
+ dcmdata
+ oflog
+ ofstd
ijg12
ijg16
ijg8
- ofstd)
+ )
- find_library(DCMTK_${lib}_LIBRARY
+ # Find Release libraries
+ find_library(DCMTK_${lib}_LIBRARY_RELEASE
${lib}
PATHS
${DCMTK_DIR}/${lib}/libsrc
${DCMTK_DIR}/${lib}/libsrc/Release
- ${DCMTK_DIR}/${lib}/libsrc/Debug
${DCMTK_DIR}/${lib}/Release
+ ${DCMTK_DIR}/lib
+ ${DCMTK_DIR}/lib/Release
+ ${DCMTK_DIR}/dcmjpeg/lib${lib}/Release
+ NO_DEFAULT_PATH
+ )
+
+ # Find Debug libraries
+ find_library(DCMTK_${lib}_LIBRARY_DEBUG
+ ${lib}${DCMTK_CMAKE_DEBUG_POSTFIX}
+ PATHS
+ ${DCMTK_DIR}/${lib}/libsrc
+ ${DCMTK_DIR}/${lib}/libsrc/Debug
${DCMTK_DIR}/${lib}/Debug
- ${DCMTK_DIR}/lib)
+ ${DCMTK_DIR}/lib
+ ${DCMTK_DIR}/lib/Debug
+ ${DCMTK_DIR}/dcmjpeg/lib${lib}/Debug
+ NO_DEFAULT_PATH
+ )
- mark_as_advanced(DCMTK_${lib}_LIBRARY)
+ mark_as_advanced(DCMTK_${lib}_LIBRARY_RELEASE)
+ mark_as_advanced(DCMTK_${lib}_LIBRARY_DEBUG)
+
+ # Add libraries to variable according to build type
+ if(DCMTK_${lib}_LIBRARY_RELEASE)
+ list(APPEND DCMTK_LIBRARIES optimized ${DCMTK_${lib}_LIBRARY_RELEASE})
+ endif()
- if(DCMTK_${lib}_LIBRARY)
- list(APPEND DCMTK_LIBRARIES ${DCMTK_${lib}_LIBRARY})
+ if(DCMTK_${lib}_LIBRARY_DEBUG)
+ list(APPEND DCMTK_LIBRARIES debug ${DCMTK_${lib}_LIBRARY_DEBUG})
endif()
endforeach()
+set(CMAKE_THREAD_LIBS_INIT)
+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()
+
+if(CMAKE_THREAD_LIBS_INIT)
+ list(APPEND DCMTK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
+endif()
+
+#
+# SPECIFIC CASE FOR DCMTK BUILD DIR as DCMTK_DIR
+# (as opposed to a DCMTK install dir)
+# Have to find the source directory.
+if(EXISTS ${DCMTK_DIR}/CMakeCache.txt)
+ load_cache(${DCMTK_DIR} READ_WITH_PREFIX "EXT"
+ DCMTK_SOURCE_DIR)
+ if(NOT EXISTS ${EXTDCMTK_SOURCE_DIR})
+ message(FATAL_ERROR
+ "DCMTK build directory references
+nonexistant DCMTK source directory ${EXTDCMTK_SOURCE_DIR}")
+ endif()
+endif()
set(DCMTK_config_TEST_HEADER osconfig.h)
set(DCMTK_dcmdata_TEST_HEADER dctypes.h)
@@ -89,6 +245,10 @@ set(DCMTK_dcmsign_TEST_HEADER sicert.h)
set(DCMTK_dcmsr_TEST_HEADER dsrtree.h)
set(DCMTK_dcmtls_TEST_HEADER tlslayer.h)
set(DCMTK_ofstd_TEST_HEADER ofstdinc.h)
+set(DCMTK_oflog_TEST_HEADER oflog.h)
+set(DCMTK_dcmjpls_TEST_HEADER djlsutil.h)
+
+set(DCMTK_INCLUDE_DIR_NAMES)
foreach(dir
config
@@ -96,31 +256,47 @@ foreach(dir
dcmimage
dcmimgle
dcmjpeg
+ dcmjpls
dcmnet
dcmpstat
dcmqrdb
dcmsign
dcmsr
dcmtls
- ofstd)
+ ofstd
+ oflog)
+ if(EXTDCMTK_SOURCE_DIR)
+ set(SOURCE_DIR_PATH
+ ${EXTDCMTK_SOURCE_DIR}/${dir}/include/dcmtk/${dir})
+ endif()
find_path(DCMTK_${dir}_INCLUDE_DIR
${DCMTK_${dir}_TEST_HEADER}
PATHS
${DCMTK_DIR}/${dir}/include
${DCMTK_DIR}/${dir}
- ${DCMTK_DIR}/include/${dir}
${DCMTK_DIR}/include/dcmtk/${dir}
${DCMTK_DIR}/${dir}/include/dcmtk/${dir}
+ ${DCMTK_DIR}/include/${dir}
+ ${SOURCE_DIR_PATH}
)
mark_as_advanced(DCMTK_${dir}_INCLUDE_DIR)
+ list(APPEND DCMTK_INCLUDE_DIR_NAMES DCMTK_${dir}_INCLUDE_DIR)
if(DCMTK_${dir}_INCLUDE_DIR)
+ # add the 'include' path so eg
+ #include "dcmtk/dcmimgle/dcmimage.h"
+ # works
+ get_filename_component(_include ${DCMTK_${dir}_INCLUDE_DIR} PATH)
+ get_filename_component(_include ${_include} PATH)
list(APPEND
DCMTK_INCLUDE_DIRS
- ${DCMTK_${dir}_INCLUDE_DIR})
+ ${DCMTK_${dir}_INCLUDE_DIR}
+ ${_include})
endif()
endforeach()
+list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_DIR}/include)
+
if(WIN32)
list(APPEND DCMTK_LIBRARIES netapi32 wsock32)
endif()
@@ -134,21 +310,31 @@ if(DCMTK_ofstd_INCLUDE_DIR)
mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-find_package_handle_standard_args(DCMTK DEFAULT_MSG
- DCMTK_config_INCLUDE_DIR
- DCMTK_ofstd_INCLUDE_DIR
- DCMTK_ofstd_LIBRARY
- DCMTK_dcmdata_INCLUDE_DIR
- DCMTK_dcmdata_LIBRARY
- DCMTK_dcmimgle_INCLUDE_DIR
- DCMTK_dcmimgle_LIBRARY)
-
# Compatibility: This variable is deprecated
set(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS})
-foreach(executable dcmdump dcmdjpeg dcmdrle)
- string(TOUPPER ${executable} EXECUTABLE)
- find_program(DCMTK_${EXECUTABLE}_EXECUTABLE ${executable} ${DCMTK_DIR}/bin)
- mark_as_advanced(DCMTK_${EXECUTABLE}_EXECUTABLE)
-endforeach()
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(DCMTK
+ REQUIRED_VARS ${DCMTK_INCLUDE_DIR_NAMES} DCMTK_LIBRARIES
+ FAIL_MESSAGE "Please set DCMTK_DIR and re-run configure")
+
+# Workaround bug in packaging of DCMTK 3.6.0 on Debian.
+# See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637687
+if(DCMTK_FOUND AND UNIX AND NOT APPLE)
+ include(CheckCXXSourceCompiles)
+ set(CMAKE_REQUIRED_FLAGS )
+ set(CMAKE_REQUIRED_DEFINITIONS )
+ set(CMAKE_REQUIRED_INCLUDES ${DCMTK_INCLUDE_DIRS})
+ set(CMAKE_REQUIRED_LIBRARIES ${DCMTK_LIBRARIES})
+ set(CMAKE_REQUIRED_QUIET ${DCMTK_FIND_QUIETLY})
+ check_cxx_source_compiles("#include <dcmtk/config/osconfig.h>\n#include <dcmtk/ofstd/ofstream.h>\nint main(int,char*[]){return 0;}"
+ DCMTK_HAVE_CONFIG_H_OPTIONAL
+ )
+ if(NOT DCMTK_HAVE_CONFIG_H_OPTIONAL)
+ set(DCMTK_DEFINITIONS "HAVE_CONFIG_H")
+ endif()
+endif()
+
+if(NOT DCMTK_FIND_QUIETLY)
+ message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake - ok")
+endif()
diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake
index a2b2926a7..ea01fc223 100644
--- a/Modules/FindDart.cmake
+++ b/Modules/FindDart.cmake
@@ -1,7 +1,11 @@
-# - 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.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake
index dacc60422..865d061c5 100644
--- a/Modules/FindDevIL.cmake
+++ b/Modules/FindDevIL.cmake
@@ -1,23 +1,32 @@
+#.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.
-# IL_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.
+#
+# ::
+#
+# 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.
+# IL_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.
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
@@ -40,7 +49,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_path(IL_INCLUDE_DIR il.h
PATH_SUFFIXES include IL
- DOC "The path the the directory that contains il.h"
+ DOC "The path to the directory that contains il.h"
)
#message("IL_INCLUDE_DIR is ${IL_INCLUDE_DIR}")
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index d2ede6ab9..d34941aa2 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -1,23 +1,45 @@
-# - This module looks for Doxygen and the path to Graphviz's dot
+#.rst:
+# FindDoxygen
+# -----------
+#
+# This module looks for Doxygen and the path to Graphviz's dot
+#
# Doxygen is a documentation generation tool. Please see
# http://www.doxygen.org
#
# This module accepts the following optional variables:
#
-# DOXYGEN_SKIP_DOT = If true this module will skip trying to find Dot
-# (an optional component often used by Doxygen)
+# ::
+#
+# DOXYGEN_SKIP_DOT = If true this module will skip trying to find Dot
+# (an optional component often used by Doxygen)
+#
+#
#
# This modules defines the following variables:
#
-# DOXYGEN_EXECUTABLE = The path to the doxygen command.
-# DOXYGEN_FOUND = Was Doxygen found or not?
-# DOXYGEN_VERSION = The version reported by doxygen --version
+# ::
#
-# DOXYGEN_DOT_EXECUTABLE = The path to the dot program used by doxygen.
-# DOXYGEN_DOT_FOUND = Was Dot found or not?
-# DOXYGEN_DOT_PATH = The path to dot not including the executable
+# DOXYGEN_EXECUTABLE = The path to the doxygen command.
+# DOXYGEN_FOUND = Was Doxygen found or not?
+# DOXYGEN_VERSION = The version reported by doxygen --version
#
#
+#
+# ::
+#
+# DOXYGEN_DOT_EXECUTABLE = The path to the dot program used by doxygen.
+# DOXYGEN_DOT_FOUND = Was Dot found or not?
+#
+# For compatibility with older versions of CMake, the now-deprecated
+# variable ``DOXYGEN_DOT_PATH`` is set to the path to the directory
+# containing ``dot`` as reported in ``DOXYGEN_DOT_EXECUTABLE``.
+# The path may have forward slashes even on Windows and is not
+# suitable for direct substitution into a ``Doxyfile.in`` template.
+# If you need this value, use :command:`get_filename_component`
+# to compute it from ``DOXYGEN_DOT_EXECUTABLE`` directly, and
+# perhaps the :command:`file(TO_NATIVE_PATH)` command to prepare
+# the path for a Doxygen configuration file.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -88,12 +110,18 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Doxygen REQUIRED_VARS DOXYGEN_EXECUTABLE VERSI
# Find Dot...
#
+set(_x86 "(x86)")
+file(GLOB _Doxygen_GRAPHVIZ_BIN_DIRS
+ "$ENV{ProgramFiles}/Graphviz*/bin"
+ "$ENV{ProgramFiles${_x86}}/Graphviz*/bin"
+ )
+unset(_x86)
+
if(NOT DOXYGEN_SKIP_DOT)
find_program(DOXYGEN_DOT_EXECUTABLE
NAMES dot
PATHS
- "$ENV{ProgramFiles}/Graphviz 2.21/bin"
- "C:/Program Files/Graphviz 2.21/bin"
+ ${_Doxygen_GRAPHVIZ_BIN_DIRS}
"$ENV{ProgramFiles}/ATT/Graphviz/bin"
"C:/Program Files/ATT/Graphviz/bin"
[HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin
@@ -106,7 +134,7 @@ if(NOT DOXYGEN_SKIP_DOT)
if(DOXYGEN_DOT_EXECUTABLE)
set(DOXYGEN_DOT_FOUND TRUE)
# The Doxyfile wants the path to Dot, not the entire path and executable
- get_filename_component(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH CACHE)
+ get_filename_component(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH)
endif()
endif()
@@ -140,5 +168,4 @@ set (DOT ${DOXYGEN_DOT_EXECUTABLE} )
mark_as_advanced(
DOXYGEN_EXECUTABLE
DOXYGEN_DOT_EXECUTABLE
- DOXYGEN_DOT_PATH
)
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index c681a0dfd..653094cd3 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -1,9 +1,16 @@
-# - Find expat
+#.rst:
+# FindEXPAT
+# ---------
+#
+# Find expat
+#
# Find the native EXPAT headers and libraries.
#
-# EXPAT_INCLUDE_DIRS - where to find expat.h, etc.
-# EXPAT_LIBRARIES - List of libraries when using expat.
-# EXPAT_FOUND - True if expat found.
+# ::
+#
+# EXPAT_INCLUDE_DIRS - where to find expat.h, etc.
+# EXPAT_LIBRARIES - List of libraries when using expat.
+# EXPAT_FOUND - True if expat found.
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -31,9 +38,8 @@ if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
unset(EXPAT_VERSION_STRING)
foreach(VPART MAJOR MINOR MICRO)
foreach(VLINE ${expat_version_str})
- if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION")
- string(REGEX REPLACE "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$" "\\1"
- EXPAT_VERSION_PART "${VLINE}")
+ if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$")
+ set(EXPAT_VERSION_PART "${CMAKE_MATCH_1}")
if(EXPAT_VERSION_STRING)
set(EXPAT_VERSION_STRING "${EXPAT_VERSION_STRING}.${EXPAT_VERSION_PART}")
else()
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index 79a3a1e6c..ca6649359 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -1,53 +1,97 @@
-# - Find flex executable and provides a macro to generate custom build rules
+#.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
+#
+# ::
+#
+# 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)
+# 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>])
-# 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. 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 scanners oftenly use tokens defined by Bison: the code generated
-# by Flex depends of the header generated by Bison. This module also
+#
+# ::
+#
+# 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 oftenly 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
+#
+# ::
+#
+# 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:
+# ::
+#
+# ====================================================================
+# Example:
+#
+#
+#
+# ::
+#
+# find_package(BISON)
+# find_package(FLEX)
+#
+#
+#
+# ::
#
-# 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)
#
-# 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}
-# )
-# ====================================================================
+#
+# ::
+#
+# include_directories(${CMAKE_CURRENT_BINARY_DIR})
+# add_executable(Foo
+# Foo.cc
+# ${BISON_MyParser_OUTPUTS}
+# ${FLEX_MyScanner_OUTPUTS}
+# )
+# ====================================================================
#=============================================================================
# Copyright 2009 Kitware, Inc.
@@ -74,6 +118,8 @@ find_path(FLEX_INCLUDE_DIR FlexLexer.h
mark_as_advanced(FL_LIBRARY FLEX_INCLUDE_DIR)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
+
set(FLEX_INCLUDE_DIRS ${FLEX_INCLUDE_DIR})
set(FLEX_LIBRARIES ${FL_LIBRARY})
@@ -106,31 +152,55 @@ if(FLEX_EXECUTABLE)
#============================================================
#
macro(FLEX_TARGET Name Input Output)
- set(FLEX_TARGET_usage "FLEX_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]")
- if(${ARGC} GREATER 3)
- if(${ARGC} EQUAL 5)
- if("${ARGV3}" STREQUAL "COMPILE_FLAGS")
- set(FLEX_EXECUTABLE_opts "${ARGV4}")
- separate_arguments(FLEX_EXECUTABLE_opts)
- else()
- message(SEND_ERROR ${FLEX_TARGET_usage})
- endif()
+ set(FLEX_TARGET_outputs "${Output}")
+ set(FLEX_EXECUTABLE_opts "")
+
+ set(FLEX_TARGET_PARAM_OPTIONS)
+ set(FLEX_TARGET_PARAM_ONE_VALUE_KEYWORDS
+ COMPILE_FLAGS
+ DEFINES_FILE
+ )
+ set(FLEX_TARGET_PARAM_MULTI_VALUE_KEYWORDS)
+
+ cmake_parse_arguments(
+ FLEX_TARGET_ARG
+ "${FLEX_TARGET_PARAM_OPTIONS}"
+ "${FLEX_TARGET_PARAM_ONE_VALUE_KEYWORDS}"
+ "${FLEX_TARGET_MULTI_VALUE_KEYWORDS}"
+ ${ARGN}
+ )
+
+ set(FLEX_TARGET_usage "FLEX_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>] [DEFINES_FILE <string>]")
+
+ if(NOT "${FLEX_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
+ message(SEND_ERROR ${FLEX_TARGET_usage})
+ else()
+ if(NOT "${FLEX_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "")
+ set(FLEX_EXECUTABLE_opts "${FLEX_TARGET_ARG_COMPILE_FLAGS}")
+ separate_arguments(FLEX_EXECUTABLE_opts)
+ endif()
+ if(NOT "${FLEX_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
+ list(APPEND FLEX_TARGET_outputs "${FLEX_TARGET_ARG_DEFINES_FILE}")
+ list(APPEND FLEX_EXECUTABLE_opts --header-file=${FLEX_TARGET_ARG_DEFINES_FILE})
+ endif()
+
+ add_custom_command(OUTPUT ${FLEX_TARGET_outputs}
+ COMMAND ${FLEX_EXECUTABLE}
+ ARGS ${FLEX_EXECUTABLE_opts} -o${Output} ${Input}
+ DEPENDS ${Input}
+ COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ set(FLEX_${Name}_DEFINED TRUE)
+ set(FLEX_${Name}_OUTPUTS ${Output})
+ set(FLEX_${Name}_INPUT ${Input})
+ set(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts})
+ if("${FLEX_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
+ set(FLEX_${Name}_OUTPUT_HEADER "")
else()
- message(SEND_ERROR ${FLEX_TARGET_usage})
+ set(FLEX_${Name}_OUTPUT_HEADER ${FLEX_TARGET_ARG_DEFINES_FILE})
endif()
endif()
-
- add_custom_command(OUTPUT ${Output}
- COMMAND ${FLEX_EXECUTABLE}
- ARGS ${FLEX_EXECUTABLE_opts} -o${Output} ${Input}
- DEPENDS ${Input}
- COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-
- set(FLEX_${Name}_DEFINED TRUE)
- set(FLEX_${Name}_OUTPUTS ${Output})
- set(FLEX_${Name}_INPUT ${Input})
- set(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts})
endmacro()
#============================================================
@@ -142,11 +212,11 @@ if(FLEX_EXECUTABLE)
macro(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget)
if(NOT FLEX_${FlexTarget}_OUTPUTS)
- message(SEND_ERROR "Flex target `${FlexTarget}' does not exists.")
+ message(SEND_ERROR "Flex target `${FlexTarget}' does not exist.")
endif()
if(NOT BISON_${BisonTarget}_OUTPUT_HEADER)
- message(SEND_ERROR "Bison target `${BisonTarget}' does not exists.")
+ message(SEND_ERROR "Bison target `${BisonTarget}' does not exist.")
endif()
set_source_files_properties(${FLEX_${FlexTarget}_OUTPUTS}
diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake
index 92c14daed..ad0bf9889 100644
--- a/Modules/FindFLTK.cmake
+++ b/Modules/FindFLTK.cmake
@@ -1,33 +1,58 @@
-# - Find the native FLTK includes and library
+#.rst:
+# FindFLTK
+# --------
#
-# By default FindFLTK.cmake will search for all of the FLTK components and
-# add them to the FLTK_LIBRARIES variable.
+# Find the native FLTK includes and library
#
-# 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 opengl and
-# the FLTK GL library
-# FLTK_SKIP_FORMS, set to true to disable searching for fltk_forms
-# FLTK_SKIP_IMAGES, set to true to disable searching for fltk_images
#
-# FLTK_SKIP_FLUID, set to true if the fluid binary need not be present
-# at build time
+# By default FindFLTK.cmake 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 opengl and
+# the FLTK GL library
+# FLTK_SKIP_FORMS, set to true to disable searching for fltk_forms
+# FLTK_SKIP_IMAGES, set to true to disable searching for fltk_images
+#
+#
+#
+# ::
+#
+# FLTK_SKIP_FLUID, set to true if the fluid binary need not be present
+# at build time
+#
+#
#
# The following variables will be defined:
-# FLTK_FOUND, True if all components not skipped were found
-# FLTK_INCLUDE_DIR, where to find include files
-# FLTK_LIBRARIES, list of fltk libraries you should link against
-# FLTK_FLUID_EXECUTABLE, where to find the Fluid tool
-# FLTK_WRAP_UI, This enables the FLTK_WRAP_UI command
+#
+# ::
+#
+# FLTK_FOUND, True if all components not skipped were found
+# FLTK_INCLUDE_DIR, where to find include files
+# FLTK_LIBRARIES, list of fltk libraries you should link against
+# FLTK_FLUID_EXECUTABLE, where to find the Fluid tool
+# FLTK_WRAP_UI, This enables the FLTK_WRAP_UI command
+#
+#
#
# The following cache variables are assigned but should not be used.
# See the FLTK_LIBRARIES variable instead.
#
-# FLTK_BASE_LIBRARY = the full path to fltk.lib
-# FLTK_GL_LIBRARY = the full path to fltk_gl.lib
-# FLTK_FORMS_LIBRARY = the full path to fltk_forms.lib
-# FLTK_IMAGES_LIBRARY = the full path to fltk_images.lib
+# ::
+#
+# FLTK_BASE_LIBRARY = the full path to fltk.lib
+# FLTK_GL_LIBRARY = the full path to fltk_gl.lib
+# FLTK_FORMS_LIBRARY = the full path to fltk_forms.lib
+# FLTK_IMAGES_LIBRARY = the full path to fltk_images.lib
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -106,21 +131,6 @@ if(NOT FLTK_DIR)
/usr/local/fltk
/usr/X11R6/include
- # Read from the CMakeSetup registry entries. It is likely that
- # FLTK will have been recently built.
- # TODO: Is this really a good idea? I can already hear the user screaming, "But
- # it worked when I configured the build LAST week!"
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
-
# Help the user find it if we cannot.
DOC "The ${FLTK_DIR_STRING}"
)
@@ -260,9 +270,7 @@ endif()
OUTPUT_VARIABLE FLTK_IMAGES_LDFLAGS)
set(FLTK_LIBS_EXTRACT_REGEX ".*-lfltk_images (.*) -lfltk.*")
if("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}")
- string(REGEX REPLACE "${FLTK_LIBS_EXTRACT_REGEX}" "\\1"
- FLTK_IMAGES_LIBS "${FLTK_IMAGES_LDFLAGS}")
- string(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}")
+ string(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${CMAKE_MATCH_1}")
# The EXEC_PROGRAM will not be inherited into subdirectories from
# the file that originally included this module. Save the answer.
set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL
diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake
index 09f6925cc..154729f05 100644
--- a/Modules/FindFLTK2.cmake
+++ b/Modules/FindFLTK2.cmake
@@ -1,14 +1,26 @@
-# - Find the native FLTK2 includes and library
+#.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.
+#
+# ::
+#
+# 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
+#
+# ::
+#
+# 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
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -84,19 +96,6 @@ if(NOT FLTK2_DIR)
/usr/local/fltk2
/usr/X11R6/include
- # Read from the CMakeSetup registry entries. It is likely that
- # FLTK2 will have been recently built.
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
-
# Help the user find it if we cannot.
DOC "The ${FLTK2_DIR_STRING}"
)
@@ -214,9 +213,7 @@ if(FLTK2_DIR)
OUTPUT_VARIABLE FLTK2_IMAGES_LDFLAGS)
set(FLTK2_LIBS_EXTRACT_REGEX ".*-lfltk2_images (.*) -lfltk2.*")
if("${FLTK2_IMAGES_LDFLAGS}" MATCHES "${FLTK2_LIBS_EXTRACT_REGEX}")
- string(REGEX REPLACE "${FLTK2_LIBS_EXTRACT_REGEX}" "\\1"
- FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LDFLAGS}")
- string(REGEX REPLACE " +" ";" FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}")
+ string(REGEX REPLACE " +" ";" FLTK2_IMAGES_LIBS "${CMAKE_MATCH_1}")
# The EXEC_PROGRAM will not be inherited into subdirectories from
# the file that originally included this module. Save the answer.
set(FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}" CACHE INTERNAL
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index ccea99165..7d46d1563 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -1,16 +1,25 @@
-# - Locate FreeType library
+#.rst:
+# FindFreetype
+# ------------
+#
+# Locate FreeType library
+#
# This module defines
-# FREETYPE_LIBRARIES, the library to link against
-# FREETYPE_FOUND, if false, do not try to link to FREETYPE
-# FREETYPE_INCLUDE_DIRS, where to find headers.
-# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8)
-# This is the concatenation of the paths:
-# FREETYPE_INCLUDE_DIR_ft2build
-# FREETYPE_INCLUDE_DIR_freetype2
#
-# $FREETYPE_DIR is an environment variable that would
-# correspond to the ./configure --prefix=$FREETYPE_DIR
-# used in building FREETYPE.
+# ::
+#
+# FREETYPE_LIBRARIES, the library to link against
+# FREETYPE_FOUND, if false, do not try to link to FREETYPE
+# FREETYPE_INCLUDE_DIRS, where to find headers.
+# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8)
+# This is the concatenation of the paths:
+# FREETYPE_INCLUDE_DIR_ft2build
+# FREETYPE_INCLUDE_DIR_freetype2
+#
+#
+#
+# $FREETYPE_DIR is an environment variable that would correspond to the
+# ./configure --prefix=$FREETYPE_DIR used in building FREETYPE.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -42,7 +51,9 @@
# wants explicit full paths and this trickery doesn't work too well.
# I'm going to attempt to cut out the middleman and hope
# everything still works.
-find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
+find_path(
+ FREETYPE_INCLUDE_DIR_ft2build
+ ft2build.h
HINTS
ENV FREETYPE_DIR
PATHS
@@ -53,10 +64,17 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
- PATH_SUFFIXES include/freetype2 include
+ PATH_SUFFIXES
+ include/freetype2
+ include
+ freetype2
)
-find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
+find_path(
+ FREETYPE_INCLUDE_DIR_freetype2
+ NAMES
+ freetype/config/ftheader.h
+ config/ftheader.h
HINTS
ENV FREETYPE_DIR
PATHS
@@ -67,14 +85,19 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
- PATH_SUFFIXES include/freetype2 include
+ PATH_SUFFIXES
+ include/freetype2
+ include
+ freetype2
)
find_library(FREETYPE_LIBRARY
- NAMES freetype libfreetype freetype219
+ NAMES
+ freetype
+ libfreetype
+ freetype219
HINTS
ENV FREETYPE_DIR
- PATH_SUFFIXES lib
PATHS
/usr/X11R6
/usr/local/X11R6
@@ -83,41 +106,59 @@ find_library(FREETYPE_LIBRARY
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
+ PATH_SUFFIXES
+ lib
)
# set the user variables
if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
+ list(REMOVE_DUPLICATES FREETYPE_INCLUDE_DIRS)
endif()
set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
-if(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
- file(STRINGS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h" freetype_version_str
- REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
+if(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
+ set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
+elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
+ set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
+endif()
+
+if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
+ file(STRINGS "${FREETYPE_H}" freetype_version_str
+ REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
- unset(FREETYPE_VERSION_STRING)
- foreach(VPART MAJOR MINOR PATCH)
- foreach(VLINE ${freetype_version_str})
- if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}")
- string(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1"
- FREETYPE_VERSION_PART "${VLINE}")
- if(FREETYPE_VERSION_STRING)
- set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
- else()
- set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
- endif()
- unset(FREETYPE_VERSION_PART)
- endif()
- endforeach()
+ unset(FREETYPE_VERSION_STRING)
+ foreach(VPART MAJOR MINOR PATCH)
+ foreach(VLINE ${freetype_version_str})
+ if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$")
+ set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}")
+ if(FREETYPE_VERSION_STRING)
+ set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
+ else()
+ set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
+ endif()
+ unset(FREETYPE_VERSION_PART)
+ endif()
endforeach()
+ endforeach()
endif()
# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype
- REQUIRED_VARS FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS
- VERSION_VAR FREETYPE_VERSION_STRING)
-mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build)
+find_package_handle_standard_args(
+ Freetype
+ REQUIRED_VARS
+ FREETYPE_LIBRARY
+ FREETYPE_INCLUDE_DIRS
+ VERSION_VAR
+ FREETYPE_VERSION_STRING
+)
+
+mark_as_advanced(
+ FREETYPE_LIBRARY
+ FREETYPE_INCLUDE_DIR_freetype2
+ FREETYPE_INCLUDE_DIR_ft2build
+)
diff --git a/Modules/FindGCCXML.cmake b/Modules/FindGCCXML.cmake
index 05f08a639..48618e289 100644
--- a/Modules/FindGCCXML.cmake
+++ b/Modules/FindGCCXML.cmake
@@ -1,7 +1,16 @@
-# - Find 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.
+#
+# ::
+#
+# GCCXML - the GCC-XML front-end executable.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake
index 6e898474b..bf374f930 100644
--- a/Modules/FindGDAL.cmake
+++ b/Modules/FindGDAL.cmake
@@ -1,14 +1,26 @@
+#.rst:
+# FindGDAL
+# --------
+#
+#
+#
# Locate gdal
#
# This module accepts the following environment variables:
#
-# GDAL_DIR or GDAL_ROOT - Specify the location of GDAL
+# ::
+#
+# 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
+# ::
+#
+# GDAL_FOUND - True if libgdal is found
+# GDAL_LIBRARY - A variable pointing to the GDAL library
+# GDAL_INCLUDE_DIR - Where to find the headers
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -78,9 +90,9 @@ if(UNIX)
exec_program(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS)
if(GDAL_CONFIG_LIBS)
string(REGEX MATCHALL "-l[^ ]+" _gdal_dashl ${GDAL_CONFIG_LIBS})
- string(REGEX REPLACE "-l" "" _gdal_lib "${_gdal_dashl}")
+ string(REPLACE "-l" "" _gdal_lib "${_gdal_dashl}")
string(REGEX MATCHALL "-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_LIBS})
- string(REGEX REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}")
+ string(REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}")
endif()
endif()
endif()
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index 90ff7377f..7bbb8cfcd 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -1,14 +1,19 @@
-# This module searches giflib and defines
-# GIF_LIBRARIES - libraries to link to in order to use GIF
-# GIF_FOUND, if false, do not try to link
-# GIF_INCLUDE_DIR, where to find the headers
-# GIF_VERSION, reports either version 4 or 3 (for everything before version 4)
+#.rst:
+# FindGIF
+# -------
+#
+#
+#
+# This module searches giflib and defines GIF_LIBRARIES - libraries to
+# link to in order to use GIF GIF_FOUND, if false, do not try to link
+# GIF_INCLUDE_DIR, where to find the headers GIF_VERSION, reports either
+# version 4 or 3 (for everything before version 4)
#
# The minimum required version of giflib can be specified using the
-# standard syntax, e.g. find_package(GIF 4)
+# standard syntax, e.g. find_package(GIF 4)
#
-# $GIF_DIR is an environment variable that would
-# correspond to the ./configure --prefix=$GIF_DIR
+# $GIF_DIR is an environment variable that would correspond to the
+# ./configure --prefix=$GIF_DIR
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -61,6 +66,7 @@ if(GIF_INCLUDE_DIR)
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake)
CMAKE_PUSH_CHECK_STATE()
+ set(CMAKE_REQUIRED_QUIET ${GIF_FIND_QUIETLY})
set(GIF_VERSION 3)
set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}")
CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData )
diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index 37dff0324..f42182fca 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -1,8 +1,25 @@
-# - Find the OpenGL Extension Wrangler Library (GLEW)
+#.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
+#
+# ::
+#
+# 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
#=============================================================================
# Copyright 2012 Benjamin Eikel
@@ -27,4 +44,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(GLEW
REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY)
+if(GLEW_FOUND AND NOT TARGET GLEW::GLEW)
+ add_library(GLEW::GLEW UNKNOWN IMPORTED)
+ set_target_properties(GLEW::GLEW PROPERTIES
+ IMPORTED_LOCATION "${GLEW_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
+endif()
+
mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index 843d1389f..c9f7597f4 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -1,11 +1,35 @@
-# - try to find glut library and include files
-# 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.
+#.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.
+#
+# ::
+#
+# 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.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -31,13 +55,21 @@ if (WIN32)
else ()
if (APPLE)
- # These values for Apple could probably do with improvement.
- find_path( GLUT_INCLUDE_DIR glut.h
- /System/Library/Frameworks/GLUT.framework/Versions/A/Headers
- ${OPENGL_LIBRARY_DIR}
- )
- set(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX")
- set(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
+ find_path(GLUT_INCLUDE_DIR glut.h ${OPENGL_LIBRARY_DIR})
+ find_library(GLUT_glut_LIBRARY GLUT DOC "GLUT library for OSX")
+ find_library(GLUT_cocoa_LIBRARY Cocoa DOC "Cocoa framework for OSX")
+
+ if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa)
+ add_library(GLUT::Cocoa UNKNOWN IMPORTED)
+ # Cocoa should always be a Framework, but we check to make sure.
+ if(GLUT_cocoa_LIBRARY MATCHES "/([^/]+)\\.framework$")
+ set_target_properties(GLUT::Cocoa PROPERTIES
+ IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}/${CMAKE_MATCH_1}")
+ else()
+ set_target_properties(GLUT::Cocoa PROPERTIES
+ IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}")
+ endif()
+ endif()
else ()
if (BEOS)
@@ -55,6 +87,18 @@ else ()
/usr/openwin/lib
)
+ if(GLUT_Xi_LIBRARY AND NOT TARGET GLUT::Xi)
+ add_library(GLUT::Xi UNKNOWN IMPORTED)
+ set_target_properties(GLUT::Xi PROPERTIES
+ IMPORTED_LOCATION "${GLUT_Xi_LIBRARY}")
+ endif()
+
+ if(GLUT_Xmu_LIBRARY AND NOT TARGET GLUT::Xmu)
+ add_library(GLUT::Xmu UNKNOWN IMPORTED)
+ set_target_properties(GLUT::Xmu PROPERTIES
+ IMPORTED_LOCATION "${GLUT_Xmu_LIBRARY}")
+ endif()
+
endif ()
find_path( GLUT_INCLUDE_DIR GL/glut.h
@@ -91,6 +135,34 @@ if (GLUT_FOUND)
${GLUT_cocoa_LIBRARY}
)
+ if(NOT TARGET GLUT::GLUT)
+ add_library(GLUT::GLUT UNKNOWN IMPORTED)
+ set_target_properties(GLUT::GLUT PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${GLUT_INCLUDE_DIR}")
+ if(GLUT_glut_LIBRARY MATCHES "/([^/]+)\\.framework$")
+ set_target_properties(GLUT::GLUT PROPERTIES
+ IMPORTED_LOCATION "${GLUT_glut_LIBRARY}/${CMAKE_MATCH_1}")
+ else()
+ set_target_properties(GLUT::GLUT PROPERTIES
+ IMPORTED_LOCATION "${GLUT_glut_LIBRARY}")
+ endif()
+
+ if(TARGET GLUT::Xmu)
+ set_property(TARGET GLUT::GLUT APPEND
+ PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xmu)
+ endif()
+
+ if(TARGET GLUT::Xi)
+ set_property(TARGET GLUT::GLUT APPEND
+ PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xi)
+ endif()
+
+ if(TARGET GLUT::Cocoa)
+ set_property(TARGET GLUT::GLUT APPEND
+ PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Cocoa)
+ endif()
+ endif()
+
#The following deprecated settings are for backwards compatibility with CMake1.4
set (GLUT_LIBRARY ${GLUT_LIBRARIES})
set (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake
new file mode 100644
index 000000000..ef125c061
--- /dev/null
+++ b/Modules/FindGSL.cmake
@@ -0,0 +1,238 @@
+#.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. For Unix-like systems, this
+# script will use ``$GSL_ROOT_DIR/bin/gsl-config`` (if found) to aid in the
+# discovery 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_CLBAS_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).
+#
+
+#=============================================================================
+# Copyright 2014 Kelly Thompson <kgt@lanl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Include these modules to handle the QUIETLY and REQUIRED arguments.
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+#=============================================================================
+# If the user has provided ``GSL_ROOT_DIR``, use it! Choose items found
+# at this location over system locations.
+if( EXISTS "$ENV{GSL_ROOT_DIR}" )
+ file( TO_CMAKE_PATH "$ENV{GSL_ROOT_DIR}" GSL_ROOT_DIR )
+ set( GSL_ROOT_DIR "${GSL_ROOT_DIR}" CACHE PATH "Prefix for GSL installation." )
+endif()
+if( NOT EXISTS "${GSL_ROOT_DIR}" )
+ set( GSL_USE_PKGCONFIG ON )
+endif()
+
+#=============================================================================
+# As a first try, use the PkgConfig module. This will work on many
+# *NIX systems. See :module:`findpkgconfig`
+# This will return ``GSL_INCLUDEDIR`` and ``GSL_LIBDIR`` used below.
+if( GSL_USE_PKGCONFIG )
+ find_package(PkgConfig)
+ pkg_check_modules( GSL QUIET gsl )
+
+ if( EXISTS "${GSL_INCLUDEDIR}" )
+ get_filename_component( GSL_ROOT_DIR "${GSL_INCLUDEDIR}" DIRECTORY CACHE)
+ endif()
+endif()
+
+#=============================================================================
+# Set GSL_INCLUDE_DIRS and GSL_LIBRARIES. If we skipped the PkgConfig step, try
+# to find the libraries at $GSL_ROOT_DIR (if provided) or in standard system
+# locations. These find_library and find_path calls will prefer custom
+# locations over standard locations (HINTS). If the requested file is not found
+# at the HINTS location, standard system locations will be still be searched
+# (/usr/lib64 (Redhat), lib/i386-linux-gnu (Debian)).
+
+find_path( GSL_INCLUDE_DIR
+ NAMES gsl/gsl_sf.h
+ HINTS ${GSL_ROOT_DIR}/include ${GSL_INCLUDEDIR}
+)
+find_library( GSL_LIBRARY
+ NAMES gsl
+ HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
+ PATH_SUFFIXES Release Debug
+)
+find_library( GSL_CBLAS_LIBRARY
+ NAMES gslcblas cblas
+ HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
+ PATH_SUFFIXES Release Debug
+)
+# Do we also have debug versions?
+find_library( GSL_LIBRARY_DEBUG
+ NAMES gsl
+ HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
+ PATH_SUFFIXES Debug
+)
+find_library( GSL_CBLAS_LIBRARY_DEBUG
+ NAMES gslcblas cblas
+ HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
+ PATH_SUFFIXES Debug
+)
+set( GSL_INCLUDE_DIRS ${GSL_INCLUDE_DIR} )
+set( GSL_LIBRARIES ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} )
+
+# If we didn't use PkgConfig, try to find the version via gsl-config or by
+# reading gsl_version.h.
+if( NOT GSL_VERSION )
+ # 1. If gsl-config exists, query for the version.
+ find_program( GSL_CONFIG_EXECUTABLE
+ NAMES gsl-config
+ HINTS "${GSL_ROOT_DIR}/bin"
+ )
+ if( EXISTS "${GSL_CONFIG_EXECUTABLE}" )
+ execute_process(
+ COMMAND "${GSL_CONFIG_EXECUTABLE}" --version
+ OUTPUT_VARIABLE GSL_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+ endif()
+
+ # 2. If gsl-config is not available, try looking in gsl/gsl_version.h
+ if( NOT GSL_VERSION AND EXISTS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" )
+ file( STRINGS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" gsl_version_h_contents REGEX "define GSL_VERSION" )
+ string( REGEX REPLACE ".*([0-9].[0-9][0-9]).*" "\\1" GSL_VERSION ${gsl_version_h_contents} )
+ endif()
+
+ # might also try scraping the directory name for a regex match "gsl-X.X"
+endif()
+
+#=============================================================================
+# handle the QUIETLY and REQUIRED arguments and set GSL_FOUND to TRUE if all
+# listed variables are TRUE
+find_package_handle_standard_args( GSL
+ FOUND_VAR
+ GSL_FOUND
+ REQUIRED_VARS
+ GSL_INCLUDE_DIR
+ GSL_LIBRARY
+ GSL_CBLAS_LIBRARY
+ VERSION_VAR
+ GSL_VERSION
+ )
+
+mark_as_advanced( GSL_ROOT_DIR GSL_VERSION GSL_LIBRARY GSL_INCLUDE_DIR
+ GSL_CBLAS_LIBRARY GSL_LIBRARY_DEBUG GSL_CBLAS_LIBRARY_DEBUG
+ GSL_USE_PKGCONFIG GSL_CONFIG )
+
+#=============================================================================
+# Register imported libraries:
+# 1. If we can find a Windows .dll file (or if we can find both Debug and
+# Release libraries), we will set appropriate target properties for these.
+# 2. However, for most systems, we will only register the import location and
+# include directory.
+
+# Look for dlls, or Release and Debug libraries.
+if(WIN32)
+ string( REPLACE ".lib" ".dll" GSL_LIBRARY_DLL "${GSL_LIBRARY}" )
+ string( REPLACE ".lib" ".dll" GSL_CBLAS_LIBRARY_DLL "${GSL_CBLAS_LIBRARY}" )
+ string( REPLACE ".lib" ".dll" GSL_LIBRARY_DEBUG_DLL "${GSL_LIBRARY_DEBUG}" )
+ string( REPLACE ".lib" ".dll" GSL_CBLAS_LIBRARY_DEBUG_DLL "${GSL_CBLAS_LIBRARY_DEBUG}" )
+endif()
+
+if( GSL_FOUND AND NOT TARGET GSL::gsl )
+ if( EXISTS "${GSL_LIBRARY_DLL}" AND EXISTS "${GSL_CBLAS_LIBRARY_DLL}")
+
+ # Windows systems with dll libraries.
+ add_library( GSL::gsl SHARED IMPORTED )
+ add_library( GSL::gslcblas SHARED IMPORTED )
+
+ # Windows with dlls, but only Release libraries.
+ set_target_properties( GSL::gslcblas PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${GSL_CBLAS_LIBRARY_DLL}"
+ IMPORTED_IMPLIB "${GSL_CBLAS_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
+ set_target_properties( GSL::gsl PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${GSL_LIBRARY_DLL}"
+ IMPORTED_IMPLIB "${GSL_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
+ IMPORTED_CONFIGURATIONS Release
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ INTERFACE_LINK_LIBRARIES GSL::gslcblas )
+
+ # If we have both Debug and Release libraries
+ if( EXISTS "${GSL_LIBRARY_DEBUG_DLL}" AND EXISTS "${GSL_CBLAS_LIBRARY_DEBUG_DLL}")
+ set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( GSL::gslcblas PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG_DLL}"
+ IMPORTED_IMPLIB_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG}" )
+ set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
+ set_target_properties( GSL::gsl PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${GSL_LIBRARY_DEBUG_DLL}"
+ IMPORTED_IMPLIB_DEBUG "${GSL_LIBRARY_DEBUG}" )
+ endif()
+
+ else()
+
+ # For all other environments (ones without dll libraries), create
+ # the imported library targets.
+ add_library( GSL::gsl UNKNOWN IMPORTED )
+ add_library( GSL::gslcblas UNKNOWN IMPORTED )
+ set_target_properties( GSL::gslcblas PROPERTIES
+ IMPORTED_LOCATION "${GSL_CBLAS_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
+ set_target_properties( GSL::gsl PROPERTIES
+ IMPORTED_LOCATION "${GSL_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ INTERFACE_LINK_LIBRARIES GSL::gslcblas )
+ endif()
+endif()
diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake
index 8a44ade41..01bca76c4 100644
--- a/Modules/FindGTK.cmake
+++ b/Modules/FindGTK.cmake
@@ -1,8 +1,15 @@
-# - 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
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 77aac6dae..6e4a7f2f9 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -1,56 +1,99 @@
-# - FindGTK2.cmake
-# This module can find the GTK2 widget libraries and several of its other
-# optional components like gtkmm, glade, and glademm.
+#.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.
+# ::
+#
+# required.
+#
+#
+#
+# Specify one or more of the following components as you call this find
+# module. See example below.
+#
+# ::
+#
+# gtk
+# gtkmm
+# glade
+# glademm
+#
#
-# 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_DEFINITIONS - Additional compiler flags
+# ::
+#
+# 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
+#
#
-# 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
+# ::
+#
+# 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:
+#
#
-#=================
-# 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.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()
+# ::
#
+# 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()
#=============================================================================
# Copyright 2009 Kitware, Inc.
@@ -66,7 +109,10 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-# Version 1.5 (UNRELEASED) (CMake 2.8.12)
+# Version 1.6 (CMake 3.0)
+# * Create targets for each library
+# * Do not link libfreetype
+# Version 1.5 (CMake 2.8.12)
# * 14236: Detect gthread library
# Detect pangocairo on windows
# Detect pangocairo with gtk module instead of with gtkmm
@@ -130,6 +176,7 @@
#=============================================================
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr)
file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+")
@@ -156,6 +203,43 @@ function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr)
endif()
endfunction()
+
+#=============================================================
+# _GTK2_SIGCXX_GET_VERSION
+# Internal function to parse the version number in
+# sigc++config.h
+# _OUT_major = Major version number
+# _OUT_minor = Minor version number
+# _OUT_micro = Micro version number
+# _sigcxxversion_hdr = Header file to parse
+#=============================================================
+
+function(_GTK2_SIGCXX_GET_VERSION _OUT_major _OUT_minor _OUT_micro _sigcxxversion_hdr)
+ file(STRINGS ${_sigcxxversion_hdr} _contents REGEX "#define SIGCXX_M[A-Z]+_VERSION[ \t]+")
+ if(_contents)
+ string(REGEX REPLACE ".*#define SIGCXX_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_major} "${_contents}")
+ string(REGEX REPLACE ".*#define SIGCXX_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_minor} "${_contents}")
+ string(REGEX REPLACE ".*#define SIGCXX_MICRO_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_micro} "${_contents}")
+
+ if(NOT ${_OUT_major} MATCHES "[0-9]+")
+ message(FATAL_ERROR "Version parsing failed for SIGCXX_MAJOR_VERSION!")
+ endif()
+ if(NOT ${_OUT_minor} MATCHES "[0-9]+")
+ message(FATAL_ERROR "Version parsing failed for SIGCXX_MINOR_VERSION!")
+ endif()
+ if(NOT ${_OUT_micro} MATCHES "[0-9]+")
+ message(FATAL_ERROR "Version parsing failed for SIGCXX_MICRO_VERSION!")
+ endif()
+
+ set(${_OUT_major} ${${_OUT_major}} PARENT_SCOPE)
+ set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE)
+ set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE)
+ else()
+ message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist")
+ endif()
+endfunction()
+
+
#=============================================================
# _GTK2_FIND_INCLUDE_DIR
# Internal function to find the GTK include directories
@@ -214,13 +298,15 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
message(STATUS "Adding ${_gtk2_arch_dir} to search path for multiarch support")
endif()
endif()
- find_path(${_var}_INCLUDE_DIR ${_hdr}
+ find_path(GTK2_${_var}_INCLUDE_DIR ${_hdr}
PATHS
${_gtk2_arch_dir}
/usr/local/lib64
/usr/local/lib
/usr/lib64
/usr/lib
+ /usr/X11R6/include
+ /usr/X11R6/lib
/opt/gnome/include
/opt/gnome/lib
/opt/openwin/include
@@ -240,9 +326,10 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
PATH_SUFFIXES
${_suffixes}
)
+ mark_as_advanced(GTK2_${_var}_INCLUDE_DIR)
- if(${_var}_INCLUDE_DIR)
- set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${${_var}_INCLUDE_DIR} PARENT_SCOPE)
+ if(GTK2_${_var}_INCLUDE_DIR)
+ set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${GTK2_${_var}_INCLUDE_DIR} PARENT_SCOPE)
endif()
endfunction()
@@ -332,10 +419,10 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version)
if(GTK2_DEBUG)
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
- "While searching for ${_var}_LIBRARY, our proposed library list is ${_lib_list}")
+ "While searching for GTK2_${_var}_LIBRARY, our proposed library list is ${_lib_list}")
endif()
- find_library(${_var}_LIBRARY_RELEASE
+ find_library(GTK2_${_var}_LIBRARY_RELEASE
NAMES ${_lib_list}
PATHS
/opt/gnome/lib
@@ -349,10 +436,10 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version)
if(_expand_vc AND MSVC)
if(GTK2_DEBUG)
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
- "While searching for ${_var}_LIBRARY_DEBUG our proposed library list is ${_libd_list}")
+ "While searching for GTK2_${_var}_LIBRARY_DEBUG our proposed library list is ${_libd_list}")
endif()
- find_library(${_var}_LIBRARY_DEBUG
+ find_library(GTK2_${_var}_LIBRARY_DEBUG
NAMES ${_libd_list}
PATHS
$ENV{GTKMM_BASEPATH}/lib
@@ -361,24 +448,155 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version)
)
endif()
- select_library_configurations(${_var})
+ select_library_configurations(GTK2_${_var})
- set(${_var}_LIBRARY ${${_var}_LIBRARY} PARENT_SCOPE)
+ set(GTK2_${_var}_LIBRARY ${GTK2_${_var}_LIBRARY} PARENT_SCOPE)
+ set(GTK2_${_var}_FOUND ${GTK2_${_var}_FOUND} PARENT_SCOPE)
- set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${${_var}_LIBRARY})
- set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE)
+ if(GTK2_${_var}_FOUND)
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${GTK2_${_var}_LIBRARY})
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE)
+ endif()
if(GTK2_DEBUG)
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
- "${_var}_LIBRARY_RELEASE = \"${${_var}_LIBRARY_RELEASE}\"")
+ "GTK2_${_var}_LIBRARY_RELEASE = \"${GTK2_${_var}_LIBRARY_RELEASE}\"")
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "GTK2_${_var}_LIBRARY_DEBUG = \"${GTK2_${_var}_LIBRARY_DEBUG}\"")
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
- "${_var}_LIBRARY_DEBUG = \"${${_var}_LIBRARY_DEBUG}\"")
+ "GTK2_${_var}_LIBRARY = \"${GTK2_${_var}_LIBRARY}\"")
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
- "${_var}_LIBRARY = \"${${_var}_LIBRARY}\"")
+ "GTK2_${_var}_FOUND = \"${GTK2_${_var}_FOUND}\"")
+ endif()
+
+endfunction()
+
+
+function(_GTK2_ADD_TARGET_DEPENDS_INTERNAL _var _property)
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_ADD_TARGET_DEPENDS_INTERNAL( ${_var} ${_property} )")
+ endif()
+
+ string(TOLOWER "${_var}" _basename)
+
+ if (TARGET GTK2::${_basename})
+ foreach(_depend ${ARGN})
+ set(_valid_depends)
+ if (TARGET GTK2::${_depend})
+ list(APPEND _valid_depends GTK2::${_depend})
+ endif()
+ if (_valid_depends)
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY ${_property} "${_valid_depends}")
+ endif()
+ set(_valid_depends)
+ endforeach()
+ endif()
+endfunction()
+
+function(_GTK2_ADD_TARGET_DEPENDS _var)
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_ADD_TARGET_DEPENDS( ${_var} )")
+ endif()
+
+ string(TOLOWER "${_var}" _basename)
+
+ if(TARGET GTK2::${_basename})
+ get_target_property(_configs GTK2::${_basename} IMPORTED_CONFIGURATIONS)
+ _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} INTERFACE_LINK_LIBRARIES ${ARGN})
+ foreach(_config ${_configs})
+ _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN})
+ endforeach()
+ endif()
+endfunction()
+
+function(_GTK2_ADD_TARGET_INCLUDE_DIRS _var)
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_ADD_TARGET_INCLUDE_DIRS( ${_var} )")
+ endif()
+
+ string(TOLOWER "${_var}" _basename)
+
+ if(TARGET GTK2::${_basename})
+ foreach(_include ${ARGN})
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}")
+ endforeach()
endif()
+endfunction()
+
+#=============================================================
+# _GTK2_ADD_TARGET
+# Internal function to create targets for GTK2
+# _var = target to create
+#=============================================================
+function(_GTK2_ADD_TARGET _var)
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_ADD_TARGET( ${_var} )")
+ endif()
+
+ string(TOLOWER "${_var}" _basename)
+
+ cmake_parse_arguments(_${_var} "" "" "GTK2_DEPENDS;GTK2_OPTIONAL_DEPENDS;OPTIONAL_INCLUDES" ${ARGN})
+
+ if(GTK2_${_var}_FOUND AND NOT TARGET GTK2::${_basename})
+ # Do not create the target if dependencies are missing
+ foreach(_dep ${_${_var}_GTK2_DEPENDS})
+ if(NOT TARGET GTK2::${_dep})
+ return()
+ endif()
+ endforeach()
+
+ add_library(GTK2::${_basename} UNKNOWN IMPORTED)
+
+ set(GTK2_TARGETS ${GTK2_TARGETS} GTK2::${_basename})
+ set(GTK2_TARGETS ${GTK2_TARGETS} PARENT_SCOPE)
+
+ if(GTK2_${_var}_LIBRARY_RELEASE)
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" )
+ endif()
+
+ if(GTK2_${_var}_LIBRARY_DEBUG)
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" )
+ endif()
+
+ if(GTK2_${_var}_INCLUDE_DIR)
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}")
+ endif()
+
+ if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK2_${_var}_INCLUDE_DIR}")
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}")
+ endif()
+ if(GTK2_DEFINITIONS)
+ set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}")
+ endif()
+
+ if(_${_var}_GTK2_DEPENDS)
+ _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS} ${_${_var}_GTK2_OPTIONAL_DEPENDS})
+ endif()
+
+ if(_${_var}_OPTIONAL_INCLUDES)
+ foreach(_D ${_${_var}_OPTIONAL_INCLUDES})
+ if(_D)
+ _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D})
+ endif()
+ endforeach()
+ endif()
+
+ if(GTK2_USE_IMPORTED_TARGETS)
+ set(GTK2_${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE)
+ endif()
+
+ endif()
endfunction()
+
+
#=============================================================
#
@@ -388,6 +606,7 @@ endfunction()
set(GTK2_FOUND)
set(GTK2_INCLUDE_DIRS)
set(GTK2_LIBRARIES)
+set(GTK2_TARGETS)
set(GTK2_DEFINITIONS)
if(NOT GTK2_FIND_COMPONENTS)
@@ -399,13 +618,12 @@ endif()
# If specified, enforce version number
#
if(GTK2_FIND_VERSION)
- cmake_minimum_required(VERSION 2.6.2)
set(GTK2_FAILED_VERSION_CHECK true)
if(GTK2_DEBUG)
message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"Searching for version ${GTK2_FIND_VERSION}")
endif()
- _GTK2_FIND_INCLUDE_DIR(GTK2_GTK gtk/gtk.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK gtk/gtk.h)
if(GTK2_GTK_INCLUDE_DIR)
_GTK2_GET_VERSION(GTK2_MAJOR_VERSION
GTK2_MINOR_VERSION
@@ -446,104 +664,209 @@ if(GTK2_FIND_VERSION)
endif()
#
+# On MSVC, according to https://wiki.gnome.org/gtkmm/MSWindows, the /vd2 flag needs to be
+# passed to the compiler in order to use gtkmm
+#
+if(MSVC)
+ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
+ if(_GTK2_component STREQUAL "gtkmm")
+ set(GTK2_DEFINITIONS "/vd2")
+ elseif(_GTK2_component STREQUAL "glademm")
+ set(GTK2_DEFINITIONS "/vd2")
+ endif()
+ endforeach()
+endif()
+
+#
# Find all components
#
-find_package(Freetype)
-list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
-list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES})
+find_package(Freetype QUIET)
+if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
+ list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
+endif()
foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
if(_GTK2_component STREQUAL "gtk")
- _GTK2_FIND_INCLUDE_DIR(GTK2_GTK gtk/gtk.h)
+ # Left for compatibility with previous versions.
+ _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h)
+ _GTK2_FIND_INCLUDE_DIR(X11 X11/Xlib.h)
- if(UNIX)
- _GTK2_FIND_LIBRARY (GTK2_GTK gtk-x11 false true)
- _GTK2_FIND_LIBRARY (GTK2_GDK gdk-x11 false true)
- else()
- _GTK2_FIND_LIBRARY (GTK2_GTK gtk-win32 false true)
- _GTK2_FIND_LIBRARY (GTK2_GDK gdk-win32 false true)
- endif()
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_GDK gdk/gdk.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG gdkconfig.h)
+ _GTK2_FIND_INCLUDE_DIR(GLIB glib.h)
+ _GTK2_FIND_INCLUDE_DIR(GLIBCONFIG glibconfig.h)
+ _GTK2_FIND_LIBRARY (GLIB glib false true)
+ _GTK2_ADD_TARGET (GLIB)
- _GTK2_FIND_INCLUDE_DIR(GTK2_CAIRO cairo.h)
- _GTK2_FIND_LIBRARY (GTK2_CAIRO cairo false false)
+ _GTK2_FIND_INCLUDE_DIR(GOBJECT glib-object.h)
+ _GTK2_FIND_LIBRARY (GOBJECT gobject false true)
+ _GTK2_ADD_TARGET (GOBJECT GTK2_DEPENDS glib)
- _GTK2_FIND_INCLUDE_DIR(GTK2_FONTCONFIG fontconfig/fontconfig.h)
+ _GTK2_FIND_INCLUDE_DIR(ATK atk/atk.h)
+ _GTK2_FIND_LIBRARY (ATK atk false true)
+ _GTK2_ADD_TARGET (ATK GTK2_DEPENDS gobject glib)
- _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO pango/pango.h)
- _GTK2_FIND_LIBRARY (GTK2_PANGO pango false true)
+ _GTK2_FIND_LIBRARY (GIO gio false true)
+ _GTK2_ADD_TARGET (GIO GTK2_DEPENDS gobject glib)
- _GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO pangocairo false true)
+ _GTK2_FIND_LIBRARY (GTHREAD gthread false true)
+ _GTK2_ADD_TARGET (GTHREAD GTK2_DEPENDS glib)
- _GTK2_FIND_LIBRARY (GTK2_PANGOFT2 pangoft2 false true)
+ _GTK2_FIND_LIBRARY (GMODULE gmodule false true)
+ _GTK2_ADD_TARGET (GMODULE GTK2_DEPENDS glib)
- _GTK2_FIND_LIBRARY (GTK2_PANGOXFT pangoxft false true)
+ _GTK2_FIND_INCLUDE_DIR(GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h)
+ _GTK2_FIND_LIBRARY (GDK_PIXBUF gdk_pixbuf false true)
+ _GTK2_ADD_TARGET (GDK_PIXBUF GTK2_DEPENDS gobject glib)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h)
- _GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF gdk_pixbuf false true)
+ _GTK2_FIND_INCLUDE_DIR(CAIRO cairo.h)
+ _GTK2_FIND_LIBRARY (CAIRO cairo false false)
+ _GTK2_ADD_TARGET (CAIRO)
- _GTK2_FIND_LIBRARY (GTK2_GTHREAD gthread false true)
+ _GTK2_FIND_INCLUDE_DIR(PANGO pango/pango.h)
+ _GTK2_FIND_LIBRARY (PANGO pango false true)
+ _GTK2_ADD_TARGET (PANGO GTK2_DEPENDS gobject glib)
- _GTK2_FIND_LIBRARY (GTK2_GMODULE gmodule false true)
+ _GTK2_FIND_LIBRARY (PANGOCAIRO pangocairo false true)
+ _GTK2_ADD_TARGET (PANGOCAIRO GTK2_DEPENDS pango cairo gobject glib)
- _GTK2_FIND_LIBRARY (GTK2_GIO gio false true)
+ _GTK2_FIND_LIBRARY (PANGOFT2 pangoft2 false true)
+ _GTK2_ADD_TARGET (PANGOFT2 GTK2_DEPENDS pango gobject glib
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
- _GTK2_FIND_INCLUDE_DIR(GTK2_ATK atk/atk.h)
- _GTK2_FIND_LIBRARY (GTK2_ATK atk false true)
+ _GTK2_FIND_LIBRARY (PANGOXFT pangoxft false true)
+ _GTK2_ADD_TARGET (PANGOXFT GTK2_DEPENDS pangoft2 pango gobject glib
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
- _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT gobject/gobject.h)
- _GTK2_FIND_LIBRARY (GTK2_GOBJECT gobject false true)
+ _GTK2_FIND_INCLUDE_DIR(GDK gdk/gdk.h)
+ _GTK2_FIND_INCLUDE_DIR(GDKCONFIG gdkconfig.h)
+ if(UNIX)
+ if(APPLE)
+ _GTK2_FIND_LIBRARY (GDK gdk-quartz false true)
+ endif()
+ if(NOT GTK2_GDK_FOUND)
+ _GTK2_FIND_LIBRARY (GDK gdk-x11 false true)
+ endif()
+ else()
+ _GTK2_FIND_LIBRARY (GDK gdk-win32 false true)
+ endif()
+ _GTK2_ADD_TARGET (GDK GTK2_DEPENDS pango gdk_pixbuf gobject glib
+ GTK2_OPTIONAL_DEPENDS pangocairo cairo)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB glib.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG glibconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GLIB glib false true)
+ _GTK2_FIND_INCLUDE_DIR(GTK gtk/gtk.h)
+ if(UNIX)
+ if(APPLE)
+ _GTK2_FIND_LIBRARY (GTK gtk-quartz false true)
+ endif()
+ if(NOT GTK2_GTK_FOUND)
+ _GTK2_FIND_LIBRARY (GTK gtk-x11 false true)
+ endif()
+ else()
+ _GTK2_FIND_LIBRARY (GTK gtk-win32 false true)
+ endif()
+ _GTK2_ADD_TARGET (GTK GTK2_DEPENDS gdk atk pangoft2 pango gdk_pixbuf gthread gobject glib
+ GTK2_OPTIONAL_DEPENDS gio pangocairo cairo)
elseif(_GTK2_component STREQUAL "gtkmm")
- _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMM gtkmm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMMCONFIG gtkmmconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GTKMM gtkmm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMM gdkmm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMMCONFIG gdkmmconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GDKMM gdkmm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM pangomm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMMCONFIG pangommconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_PANGOMM pangomm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM cairomm/cairomm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMMCONFIG cairommconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_CAIROMM cairomm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMM giomm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMMCONFIG giommconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GIOMM giomm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_ATKMM atkmm.h)
- _GTK2_FIND_LIBRARY (GTK2_ATKMM atkmm true true)
-
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMM glibmm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMMCONFIG glibmmconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GLIBMM glibmm true true)
+ _GTK2_FIND_INCLUDE_DIR(SIGC++ sigc++/sigc++.h)
+ _GTK2_FIND_INCLUDE_DIR(SIGC++CONFIG sigc++config.h)
+ _GTK2_FIND_LIBRARY (SIGC++ sigc true true)
+ _GTK2_ADD_TARGET (SIGC++)
+ # Since sigc++ 2.5.1 c++11 support is required
+ if(GTK2_SIGC++CONFIG_INCLUDE_DIR)
+ _GTK2_SIGCXX_GET_VERSION(GTK2_SIGC++_VERSION_MAJOR
+ GTK2_SIGC++_VERSION_MINOR
+ GTK2_SIGC++_VERSION_MICRO
+ ${GTK2_SIGC++CONFIG_INCLUDE_DIR}/sigc++config.h)
+ if(NOT ${GTK2_SIGC++_VERSION_MAJOR}.${GTK2_SIGC++_VERSION_MINOR}.${GTK2_SIGC++_VERSION_MICRO} VERSION_LESS 2.5.1)
+ # These are the features needed by clients in order to include the
+ # project headers:
+ set_property(TARGET GTK2::sigc++
+ PROPERTY INTERFACE_COMPILE_FEATURES cxx_alias_templates
+ cxx_auto_type
+ cxx_decltype
+ cxx_deleted_functions
+ cxx_noexcept
+ cxx_nullptr
+ cxx_right_angle_brackets
+ cxx_rvalue_references
+ cxx_variadic_templates)
+ endif()
+ endif()
- _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++ sigc++/sigc++.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++CONFIG sigc++config.h)
- _GTK2_FIND_LIBRARY (GTK2_SIGC++ sigc true true)
+ _GTK2_FIND_INCLUDE_DIR(GLIBMM glibmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GLIBMMCONFIG glibmmconfig.h)
+ _GTK2_FIND_LIBRARY (GLIBMM glibmm true true)
+ _GTK2_ADD_TARGET (GLIBMM GTK2_DEPENDS gobject sigc++ glib)
+
+ _GTK2_FIND_INCLUDE_DIR(GIOMM giomm.h)
+ _GTK2_FIND_INCLUDE_DIR(GIOMMCONFIG giommconfig.h)
+ _GTK2_FIND_LIBRARY (GIOMM giomm true true)
+ _GTK2_ADD_TARGET (GIOMM GTK2_DEPENDS gio glibmm gobject sigc++ glib)
+
+ _GTK2_FIND_INCLUDE_DIR(ATKMM atkmm.h)
+ _GTK2_FIND_LIBRARY (ATKMM atkmm true true)
+ _GTK2_ADD_TARGET (ATKMM GTK2_DEPENDS atk glibmm gobject sigc++ glib)
+
+ _GTK2_FIND_INCLUDE_DIR(CAIROMM cairomm/cairomm.h)
+ _GTK2_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h)
+ _GTK2_FIND_LIBRARY (CAIROMM cairomm true true)
+ _GTK2_ADD_TARGET (CAIROMM GTK2_DEPENDS cairo sigc++
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
+
+ _GTK2_FIND_INCLUDE_DIR(PANGOMM pangomm.h)
+ _GTK2_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h)
+ _GTK2_FIND_LIBRARY (PANGOMM pangomm true true)
+ _GTK2_ADD_TARGET (PANGOMM GTK2_DEPENDS glibmm sigc++ pango gobject glib
+ GTK2_OPTIONAL_DEPENDS cairomm pangocairo cairo
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
+
+ _GTK2_FIND_INCLUDE_DIR(GDKMM gdkmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h)
+ _GTK2_FIND_LIBRARY (GDKMM gdkmm true true)
+ _GTK2_ADD_TARGET (GDKMM GTK2_DEPENDS pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gobject glib
+ GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
+
+ _GTK2_FIND_INCLUDE_DIR(GTKMM gtkmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h)
+ _GTK2_FIND_LIBRARY (GTKMM gtkmm true true)
+ _GTK2_ADD_TARGET (GTKMM GTK2_DEPENDS atkmm gdkmm pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib
+ GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
elseif(_GTK2_component STREQUAL "glade")
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLADE glade/glade.h)
- _GTK2_FIND_LIBRARY (GTK2_GLADE glade false true)
+ _GTK2_FIND_INCLUDE_DIR(GLADE glade/glade.h)
+ _GTK2_FIND_LIBRARY (GLADE glade false true)
+ _GTK2_ADD_TARGET (GLADE GTK2_DEPENDS gtk gdk atk gio pangoft2 gdk_pixbuf pango gobject glib
+ GTK2_OPTIONAL_DEPENDS pangocairo cairo
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
elseif(_GTK2_component STREQUAL "glademm")
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMM libglademm.h)
- _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMMCONFIG libglademmconfig.h)
- _GTK2_FIND_LIBRARY (GTK2_GLADEMM glademm true true)
+ _GTK2_FIND_INCLUDE_DIR(GLADEMM libglademm.h)
+ _GTK2_FIND_INCLUDE_DIR(GLADEMMCONFIG libglademmconfig.h)
+ _GTK2_FIND_LIBRARY (GLADEMM glademm true true)
+ _GTK2_ADD_TARGET (GLADEMM GTK2_DEPENDS gtkmm glade atkmm gdkmm giomm pangomm glibmm sigc++ gtk gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib
+ GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo
+ OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
+ ${GTK2_FONTCONFIG_INCLUDE_DIR}
+ ${GTK2_X11_INCLUDE_DIR})
else()
message(FATAL_ERROR "Unknown GTK2 component ${_component}")
@@ -562,20 +885,6 @@ if(NOT GTK2_FIND_VERSION AND GTK2_GTK_INCLUDE_DIR)
endif()
#
-# On MSVC, according to https://wiki.gnome.org/gtkmm/MSWindows, the /vd2 flag needs to be
-# passed to the compiler in order to use gtkmm
-#
-if(MSVC)
- foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
- if(_GTK2_component STREQUAL "gtkmm")
- set(GTK2_DEFINITIONS "/vd2")
- elseif(_GTK2_component STREQUAL "glademm")
- set(GTK2_DEFINITIONS "/vd2")
- endif()
- endforeach()
-endif()
-
-#
# Try to enforce components
#
@@ -586,6 +895,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
string(TOUPPER ${_GTK2_component} _COMPONENT_UPPER)
+ set(GTK2_${_COMPONENT_UPPER}_FIND_QUIETLY ${GTK2_FIND_QUIETLY})
+
if(_GTK2_component STREQUAL "gtk")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found."
GTK2_GTK_LIBRARY
@@ -613,6 +924,8 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
GTK2_GLIBMMCONFIG_INCLUDE_DIR
GTK2_GLIBMM_LIBRARY
+ FREETYPE_INCLUDE_DIR_ft2build
+ FREETYPE_INCLUDE_DIR_freetype2
)
elseif(_GTK2_component STREQUAL "glade")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glade library was not found."
@@ -632,6 +945,11 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
endif()
endforeach()
+if(GTK2_USE_IMPORTED_TARGETS)
+ set(GTK2_LIBRARIES ${GTK2_TARGETS})
+endif()
+
+
if(_GTK2_did_we_find_everything AND NOT GTK2_VERSION_CHECK_FAILED)
set(GTK2_FOUND true)
else()
@@ -643,6 +961,7 @@ else()
set(GTK2_VERSION_PATCH)
set(GTK2_INCLUDE_DIRS)
set(GTK2_LIBRARIES)
+ set(GTK2_TARGETS)
set(GTK2_DEFINITIONS)
endif()
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index d531dd12d..ca49e4aca 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -1,58 +1,95 @@
+#.rst:
+# FindGTest
+# ---------
+#
# Locate the Google C++ Testing Framework.
#
-# Defines the following variables:
+# 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``
#
-# GTEST_FOUND - Found the Google Testing framework
-# GTEST_INCLUDE_DIRS - Include directories
+# Cache variables
+# ^^^^^^^^^^^^^^^
#
-# Also defines the library variables below as normal
-# variables. These contain debug/optimized keywords when
-# a debugging library is found.
+# The following cache variables may also be set:
#
-# GTEST_BOTH_LIBRARIES - Both libgtest & libgtest-main
-# GTEST_LIBRARIES - libgtest
-# GTEST_MAIN_LIBRARIES - libgtest-main
+# ``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 ``MD`` or
+# ``MT`` (the default) to enable searching a GTest build tree
#
-# Accepts the following variables as input:
#
-# GTEST_ROOT - (as a CMake or environment variable)
-# The root directory of the gtest install prefix
+# Example usage
+# ^^^^^^^^^^^^^
#
-# GTEST_MSVC_SEARCH - If compiling with MSVC, this variable can be set to
-# "MD" or "MT" to enable searching a GTest build tree
-# (defaults: "MD")
+# ::
#
-#-----------------------
-# Example Usage:
+# enable_testing()
+# find_package(GTest REQUIRED)
#
-# enable_testing()
-# find_package(GTest REQUIRED)
-# include_directories(${GTEST_INCLUDE_DIRS})
+# add_executable(foo foo.cc)
+# target_link_libraries(foo GTest::GTest GTest::Main)
#
-# add_executable(foo foo.cc)
-# target_link_libraries(foo ${GTEST_BOTH_LIBRARIES})
+# add_test(AllTestsInFoo foo)
#
-# add_test(AllTestsInFoo foo)
#
-#-----------------------
+# Deeper integration with CTest
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
-# If you would like each Google test to show up in CTest as
-# a test you may use the following macro.
-# NOTE: It will slow down your tests by running an executable
-# for each test and test fixture. You will also have to rerun
-# CMake after adding or removing tests or test fixtures.
+# If you would like each Google test to show up in CTest as a test you
+# may use the following macro::
#
-# GTEST_ADD_TESTS(executable extra_args ARGN)
-# executable = The path to the test executable
-# extra_args = Pass a list of extra arguments to be passed to
-# executable enclosed in quotes (or "" for none)
-# ARGN = A list of source files to search for tests & test
-# fixtures.
+# GTEST_ADD_TESTS(executable extra_args files...)
#
-# Example:
-# set(FooTestArgs --foo 1 --bar 2)
-# add_executable(FooTest FooUnitTest.cc)
-# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" FooUnitTest.cc)
+# ``executable``
+# the path to the test executable
+# ``extra_args``
+# a list of extra arguments to be passed to executable enclosed in
+# quotes (or ``""`` for none)
+# ``files...``
+# a list of source files to search for tests and test fixtures. Or
+# ``AUTO`` to find them from executable target
+#
+# However, note that this macro will slow down your tests by running
+# an executable for each test and test fixture. You will also have to
+# re-run CMake after adding or removing tests or test fixtures.
+#
+# Example usage::
+#
+# set(FooTestArgs --foo 1 --bar 2)
+# add_executable(FooTest FooUnitTest.cc)
+# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" AUTO)
#=============================================================================
# Copyright 2009 Kitware, Inc.
@@ -75,12 +112,30 @@ function(GTEST_ADD_TESTS executable extra_args)
if(NOT ARGN)
message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
endif()
+ if(ARGN STREQUAL "AUTO")
+ # obtain sources used for building that executable
+ get_property(ARGN TARGET ${executable} PROPERTY SOURCES)
+ endif()
+ set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+) *, *([A-Za-z_0-9]+) *\\).*")
+ set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)")
foreach(source ${ARGN})
file(READ "${source}" contents)
- string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
+ string(REGEX MATCHALL "${gtest_test_type_regex} *\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
foreach(hit ${found_tests})
- string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit})
- add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args})
+ string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit})
+
+ # Parameterized tests have a different signature for the filter
+ if("x${test_type}" STREQUAL "xTEST_P")
+ string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit})
+ elseif("x${test_type}" STREQUAL "xTEST_F" OR "x${test_type}" STREQUAL "xTEST")
+ string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit})
+ elseif("x${test_type}" STREQUAL "xTYPED_TEST")
+ string(REGEX REPLACE ${gtest_case_name_regex} "\\1/*.\\2" test_name ${hit})
+ else()
+ message(WARNING "Could not parse GTest ${hit} for adding to CTest.")
+ continue()
+ endif()
+ add_test(NAME ${test_name} COMMAND ${executable} --gtest_filter=${test_name} ${extra_args})
endforeach()
endforeach()
endfunction()
@@ -154,5 +209,60 @@ if(GTEST_FOUND)
_gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY)
_gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY)
set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
-endif()
+ include(CMakeFindDependencyMacro)
+ find_dependency(Threads)
+
+ if(NOT TARGET GTest::GTest)
+ add_library(GTest::GTest UNKNOWN IMPORTED)
+ set_target_properties(GTest::GTest PROPERTIES
+ INTERFACE_LINK_LIBRARIES "Threads::Threads")
+ if(GTEST_INCLUDE_DIRS)
+ set_target_properties(GTest::GTest PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")
+ endif()
+ if(EXISTS "${GTEST_LIBRARY}")
+ set_target_properties(GTest::GTest PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ IMPORTED_LOCATION "${GTEST_LIBRARY}")
+ endif()
+ if(EXISTS "${GTEST_LIBRARY_DEBUG}")
+ set_property(TARGET GTest::GTest APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(GTest::GTest PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${GTEST_LIBRARY_DEBUG}")
+ endif()
+ if(EXISTS "${GTEST_LIBRARY_RELEASE}")
+ set_property(TARGET GTest::GTest APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(GTest::GTest PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
+ IMPORTED_LOCATION_RELEASE "${GTEST_LIBRARY_RELEASE}")
+ endif()
+ endif()
+ if(NOT TARGET GTest::Main)
+ add_library(GTest::Main UNKNOWN IMPORTED)
+ set_target_properties(GTest::Main PROPERTIES
+ INTERFACE_LINK_LIBRARIES "GTest::GTest")
+ if(EXISTS "${GTEST_MAIN_LIBRARY}")
+ set_target_properties(GTest::Main PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ IMPORTED_LOCATION "${GTEST_MAIN_LIBRARY}")
+ endif()
+ if(EXISTS "${GTEST_MAIN_LIBRARY_DEBUG}")
+ set_property(TARGET GTest::Main APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(GTest::Main PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${GTEST_MAIN_LIBRARY_DEBUG}")
+ endif()
+ if(EXISTS "${GTEST_MAIN_LIBRARY_RELEASE}")
+ set_property(TARGET GTest::Main APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(GTest::Main PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
+ IMPORTED_LOCATION_RELEASE "${GTEST_MAIN_LIBRARY_RELEASE}")
+ endif()
+ endif()
+endif()
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake
index 1a6bd39dd..ac53c3fe3 100644
--- a/Modules/FindGettext.cmake
+++ b/Modules/FindGettext.cmake
@@ -1,29 +1,58 @@
-# - Find GNU gettext tools
-# This module looks for the GNU gettext tools. This module defines the
+#.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)
+#
+# ::
+#
+# 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( <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".
+#
+# 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`.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -48,8 +77,8 @@ if(GETTEXT_MSGMERGE_EXECUTABLE)
OUTPUT_VARIABLE gettext_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (gettext_version MATCHES "^msgmerge \\(.*\\) [0-9]")
- string(REGEX REPLACE "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" GETTEXT_VERSION_STRING "${gettext_version}")
+ if (gettext_version MATCHES "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
+ set(GETTEXT_VERSION_STRING "${CMAKE_MATCH_1}")
endif()
unset(gettext_version)
endif()
diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
index 41d2a7a8c..d18f965ee 100644
--- a/Modules/FindGit.cmake
+++ b/Modules/FindGit.cmake
@@ -1,15 +1,27 @@
+#.rst:
+# FindGit
+# -------
+#
# The module defines the following variables:
-# GIT_EXECUTABLE - path to git command line client
-# GIT_FOUND - true if the command line client was found
-# GIT_VERSION_STRING - the version of git found (since CMake 2.8.8)
+#
+# ``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:
-# find_package(Git)
-# if(GIT_FOUND)
-# message("git found: ${GIT_EXECUTABLE}")
-# endif()
+#
+# .. code-block:: cmake
+#
+# find_package(Git)
+# if(Git_FOUND)
+# message("Git found: ${GIT_EXECUTABLE}")
+# endif()
#=============================================================================
-# Copyright 2010 Kitware, Inc.
+# Copyright 2010-2016 Kitware, Inc.
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
@@ -32,16 +44,25 @@ set(git_names git eg)
if(WIN32)
if(NOT CMAKE_GENERATOR MATCHES "MSYS")
set(git_names git.cmd git eg.cmd eg)
+ # GitHub search path for Windows
+ set(github_path "$ENV{LOCALAPPDATA}/Github/PortableGit*/bin")
+ file(GLOB github_path "${github_path}")
+ # SourceTree search path for Windows
+ set(_git_sourcetree_path "$ENV{LOCALAPPDATA}/Atlassian/SourceTree/git_local/bin")
endif()
endif()
find_program(GIT_EXECUTABLE
NAMES ${git_names}
+ PATHS ${github_path} ${_git_sourcetree_path}
PATH_SUFFIXES Git/cmd Git/bin
- DOC "git command line client"
+ DOC "Git command line client"
)
mark_as_advanced(GIT_EXECUTABLE)
+unset(git_names)
+unset(_git_sourcetree_path)
+
if(GIT_EXECUTABLE)
execute_process(COMMAND ${GIT_EXECUTABLE} --version
OUTPUT_VARIABLE git_version
@@ -53,7 +74,7 @@ if(GIT_EXECUTABLE)
unset(git_version)
endif()
-# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
+# Handle the QUIETLY and REQUIRED arguments and set Git_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake
index 7315f1dd4..4d94ffc5d 100644
--- a/Modules/FindGnuTLS.cmake
+++ b/Modules/FindGnuTLS.cmake
@@ -1,11 +1,19 @@
-# - Try to find the GNU Transport Layer Security library (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
+# ::
+#
+# 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
#=============================================================================
# Copyright 2009 Kitware, Inc.
diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake
index f2f9dd059..067604fc1 100644
--- a/Modules/FindGnuplot.cmake
+++ b/Modules/FindGnuplot.cmake
@@ -1,10 +1,20 @@
-# - this module looks for gnuplot
+#.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_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.
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 0c246a1df..9f6e666a0 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -1,51 +1,72 @@
-# - Find HDF5, a library for reading and writing self describing array data.
+#.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.
+# 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.
+# 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.
#
-# On UNIX systems, 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.
+# On UNIX systems, 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.
+# 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.
#
-# 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.
+# 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_INCLUDE_DIRS - Location of the hdf5 includes
-# HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated)
-# HDF5_DEFINITIONS - Required compiler definitions for HDF5
-# 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_HL_LIBRARIES - Required libraries for the HDF5 high level API
-# HDF5_Fortran_HL_LIBRARIES - Required libraries for the high level Fortran
-# bindings.
-# HDF5_LIBRARIES - Required libraries for all requested bindings
-# HDF5_FOUND - true if HDF5 was found on the system
-# HDF5_LIBRARY_DIRS - the full set of library directories
-# 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_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool
+#
+# ::
+#
+# 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_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_HL_LIBRARIES - Required libraries for the HDF5 high level API
+# HDF5_Fortran_HL_LIBRARIES - Required libraries for the high level Fortran
+# bindings.
+# HDF5_LIBRARIES - Required libraries for all requested bindings
+# HDF5_FOUND - true if HDF5 was found on the system
+# HDF5_VERSION - HDF5 version in format Major.Minor.Release
+# HDF5_LIBRARY_DIRS - the full set of library directories
+# 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_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool
#=============================================================================
+# Copyright 2015 Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf
# Copyright 2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
@@ -88,28 +109,43 @@ else()
endforeach()
endif()
+# Determine whether to search for serial or parallel executable first
+if(HDF5_PREFER_PARALLEL)
+ set(HDF5_C_COMPILER_NAMES h5pcc h5cc)
+ set(HDF5_CXX_COMPILER_NAMES h5pc++ h5c++)
+ set(HDF5_Fortran_COMPILER_NAMES h5pfc h5fc)
+else()
+ set(HDF5_C_COMPILER_NAMES h5cc h5pcc)
+ set(HDF5_CXX_COMPILER_NAMES h5c++ h5pc++)
+ set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc)
+endif()
+
# try to find the HDF5 wrapper compilers
find_program( HDF5_C_COMPILER_EXECUTABLE
- NAMES h5cc h5pcc
+ NAMES ${HDF5_C_COMPILER_NAMES} NAMES_PER_DIR
HINTS ENV HDF5_ROOT
PATH_SUFFIXES bin Bin
DOC "HDF5 Wrapper compiler. Used only to detect HDF5 compile flags." )
mark_as_advanced( HDF5_C_COMPILER_EXECUTABLE )
find_program( HDF5_CXX_COMPILER_EXECUTABLE
- NAMES h5c++ h5pc++
+ NAMES ${HDF5_CXX_COMPILER_NAMES} NAMES_PER_DIR
HINTS ENV HDF5_ROOT
PATH_SUFFIXES bin Bin
DOC "HDF5 C++ Wrapper compiler. Used only to detect HDF5 compile flags." )
mark_as_advanced( HDF5_CXX_COMPILER_EXECUTABLE )
find_program( HDF5_Fortran_COMPILER_EXECUTABLE
- NAMES h5fc h5pfc
+ NAMES ${HDF5_Fortran_COMPILER_NAMES} NAMES_PER_DIR
HINTS ENV HDF5_ROOT
PATH_SUFFIXES bin Bin
DOC "HDF5 Fortran Wrapper compiler. Used only to detect HDF5 compile flags." )
mark_as_advanced( HDF5_Fortran_COMPILER_EXECUTABLE )
+unset(HDF5_C_COMPILER_NAMES)
+unset(HDF5_CXX_COMPILER_NAMES)
+unset(HDF5_Fortran_COMPILER_NAMES)
+
find_program( HDF5_DIFF_EXECUTABLE
NAMES h5diff
HINTS ENV HDF5_ROOT
@@ -149,7 +185,7 @@ macro( _HDF5_parse_compile_line
)
foreach( IPATH ${include_path_flags} )
string( REGEX REPLACE "^-I" "" IPATH ${IPATH} )
- string( REGEX REPLACE "//" "/" IPATH ${IPATH} )
+ string( REPLACE "//" "/" IPATH ${IPATH} )
list( APPEND ${include_paths} ${IPATH} )
endforeach()
@@ -166,7 +202,7 @@ macro( _HDF5_parse_compile_line
foreach( LPATH ${library_path_flags} )
string( REGEX REPLACE "^-L" "" LPATH ${LPATH} )
- string( REGEX REPLACE "//" "/" LPATH ${LPATH} )
+ string( REPLACE "//" "/" LPATH ${LPATH} )
list( APPEND ${library_paths} ${LPATH} )
endforeach()
@@ -210,6 +246,8 @@ if( NOT HDF5_FOUND )
_HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE )
_HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE )
_HDF5_invoke_compiler( Fortran HDF5_Fortran_COMPILE_LINE HDF5_Fortran_RETURN_VALUE )
+ set(HDF5_HL_COMPILE_LINE ${HDF5_C_COMPILE_LINE})
+ set(HDF5_Fortran_HL_COMPILE_LINE ${HDF5_Fortran_COMPILE_LINE})
# seed the initial lists of libraries to find with items we know we need
set( HDF5_C_LIBRARY_NAMES_INIT hdf5 )
@@ -217,7 +255,7 @@ if( NOT HDF5_FOUND )
set( HDF5_CXX_LIBRARY_NAMES_INIT hdf5_cpp ${HDF5_C_LIBRARY_NAMES_INIT} )
set( HDF5_Fortran_LIBRARY_NAMES_INIT hdf5_fortran
${HDF5_C_LIBRARY_NAMES_INIT} )
- set( HDF5_Fortran_HL_LIBRARY_NAMES_INIT hdf5hl_fortran
+ set( HDF5_Fortran_HL_LIBRARY_NAMES_INIT hdf5hl_fortran hdf5_hl
${HDF5_Fortran_LIBRARY_NAMES_INIT} )
foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} )
@@ -240,7 +278,7 @@ if( NOT HDF5_FOUND )
list( APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS} )
# find the HDF5 include directories
- if(${LANGUAGE} MATCHES "Fortran.*")
+ if(${LANGUAGE} MATCHES "Fortran")
set(HDF5_INCLUDE_FILENAME hdf5.mod)
else()
set(HDF5_INCLUDE_FILENAME hdf5.h)
@@ -269,7 +307,7 @@ if( NOT HDF5_FOUND )
if( UNIX AND HDF5_USE_STATIC_LIBRARIES )
# According to bug 1643 on the CMake bug tracker, this is the
# preferred method for searching for a static library.
- # See http://www.cmake.org/Bug/view.php?id=1643. We search
+ # See https://cmake.org/Bug/view.php?id=1643. We search
# first for the full static library name, but fall back to a
# generic search on the name if the static search fails.
set( THIS_LIBRARY_SEARCH_DEBUG lib${LIB}d.a ${LIB}d )
@@ -322,15 +360,28 @@ if( NOT HDF5_FOUND )
# If the HDF5 include directory was found, open H5pubconf.h to determine if
# HDF5 was compiled with parallel IO support
set( HDF5_IS_PARALLEL FALSE )
+ set( HDF5_VERSION "" )
foreach( _dir IN LISTS HDF5_INCLUDE_DIRS )
- if( EXISTS "${_dir}/H5pubconf.h" )
- file( STRINGS "${_dir}/H5pubconf.h"
+ foreach(_hdr "${_dir}/H5pubconf.h" "${_dir}/H5pubconf-64.h" "${_dir}/H5pubconf-32.h")
+ if( EXISTS "${_hdr}" )
+ file( STRINGS "${_hdr}"
HDF5_HAVE_PARALLEL_DEFINE
REGEX "HAVE_PARALLEL 1" )
if( HDF5_HAVE_PARALLEL_DEFINE )
set( HDF5_IS_PARALLEL TRUE )
endif()
+ unset(HDF5_HAVE_PARALLEL_DEFINE)
+
+ file( STRINGS "${_hdr}"
+ HDF5_VERSION_DEFINE
+ REGEX "^[ \t]*#[ \t]*define[ \t]+H5_VERSION[ \t]+" )
+ if( "${HDF5_VERSION_DEFINE}" MATCHES
+ "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+).*\"" )
+ set( HDF5_VERSION "${CMAKE_MATCH_1}" )
+ endif()
+ unset(HDF5_VERSION_DEFINE)
endif()
+ endforeach()
endforeach()
set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL
"HDF5 library compiled with parallel IO support" )
@@ -344,8 +395,7 @@ if( NOT HDF5_FOUND )
endif()
-find_package_handle_standard_args( HDF5 DEFAULT_MSG
- HDF5_LIBRARIES
- HDF5_INCLUDE_DIRS
+find_package_handle_standard_args( HDF5
+ REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS
+ VERSION_VAR HDF5_VERSION
)
-
diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake
index 71e55dad4..231653353 100644
--- a/Modules/FindHSPELL.cmake
+++ b/Modules/FindHSPELL.cmake
@@ -1,14 +1,25 @@
-# - Try to find 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_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
+# 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
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/FindHTMLHelp.cmake b/Modules/FindHTMLHelp.cmake
index c69e9e948..4e39a34ef 100644
--- a/Modules/FindHTMLHelp.cmake
+++ b/Modules/FindHTMLHelp.cmake
@@ -1,9 +1,16 @@
-# - This module looks for Microsoft HTML Help Compiler
+#.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)
#
+# ::
+#
+# 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)
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake
index a6a4aef24..bdbb79b19 100644
--- a/Modules/FindHg.cmake
+++ b/Modules/FindHg.cmake
@@ -1,16 +1,47 @@
+#.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
+#
+# ::
+#
+# 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}")
-# endif()
+#
+# ::
+#
+# find_package(Hg)
+# if(HG_FOUND)
+# message("hg found: ${HG_EXECUTABLE}")
+# HG_WC_INFO(${PROJECT_SOURCE_DIR} Project)
+# message("Current revision is ${Project_WC_REVISION}")
+# message("Current changeset is ${Project_WC_CHANGESET}")
+# endif()
#=============================================================================
# Copyright 2010-2012 Kitware, Inc.
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
+# Copyright 2014 Matthaeus G. Chajdas
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -24,20 +55,51 @@
find_program(HG_EXECUTABLE
NAMES hg
+ PATHS
+ [HKEY_LOCAL_MACHINE\\Software\\TortoiseHG]
PATH_SUFFIXES Mercurial
DOC "hg command line client"
)
mark_as_advanced(HG_EXECUTABLE)
if(HG_EXECUTABLE)
+ set(_saved_lc_all "$ENV{LC_ALL}")
+ set(ENV{LC_ALL} "C")
+
+ set(_saved_language "$ENV{LANGUAGE}")
+ set(ENV{LANGUAGE})
+
execute_process(COMMAND ${HG_EXECUTABLE} --version
OUTPUT_VARIABLE hg_version
ERROR_QUIET
+ RESULT_VARIABLE hg_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ set(ENV{LC_ALL} ${_saved_lc_all})
+ set(ENV{LANGUAGE} ${_saved_language})
+
+ if(hg_result MATCHES "is not a valid Win32 application")
+ set_property(CACHE HG_EXECUTABLE PROPERTY VALUE "HG_EXECUTABLE-NOTFOUND")
+ endif()
if(hg_version MATCHES "^Mercurial Distributed SCM \\(version ([0-9][^)]*)\\)")
set(HG_VERSION_STRING "${CMAKE_MATCH_1}")
endif()
unset(hg_version)
+
+ macro(HG_WC_INFO dir prefix)
+ execute_process(COMMAND ${HG_EXECUTABLE} id -i -n
+ WORKING_DIRECTORY ${dir}
+ RESULT_VARIABLE hg_id_result
+ ERROR_VARIABLE hg_id_error
+ OUTPUT_VARIABLE ${prefix}_WC_DATA
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT ${hg_id_result} EQUAL 0)
+ message(SEND_ERROR "Command \"${HG_EXECUTBALE} id -n\" in directory ${dir} failed with output:\n${hg_id_error}")
+ endif()
+
+ string(REGEX REPLACE "([0-9a-f]+)\\+? [0-9]+\\+?" "\\1" ${prefix}_WC_CHANGESET ${${prefix}_WC_DATA})
+ string(REGEX REPLACE "[0-9a-f]+\\+? ([0-9]+)\\+?" "\\1" ${prefix}_WC_REVISION ${${prefix}_WC_DATA})
+ endmacro(HG_WC_INFO)
endif()
# Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if
diff --git a/Modules/FindITK.cmake b/Modules/FindITK.cmake
deleted file mode 100644
index 2929a764c..000000000
--- a/Modules/FindITK.cmake
+++ /dev/null
@@ -1,57 +0,0 @@
-# - Find an ITK installation or build tree.
-
-# When ITK is found, the ITKConfig.cmake file is sourced to setup the
-# location and configuration of ITK. Please read this file, or
-# ITKConfig.cmake.in from the ITK source tree for the full list of
-# definitions. Of particular interest is ITK_USE_FILE, a CMake source file
-# that can be included to set the include directories, library directories,
-# and preprocessor macros. In addition to the variables read from
-# ITKConfig.cmake, this find module also defines
-# ITK_DIR - The directory containing ITKConfig.cmake.
-# This is either the root of the build tree,
-# or the lib/InsightToolkit directory.
-# This is the only cache entry.
-#
-# ITK_FOUND - Whether ITK was found. If this is true,
-# ITK_DIR is okay.
-#
-# USE_ITK_FILE - The full path to the UseITK.cmake file.
-# This is provided for backward
-# compatibility. Use ITK_USE_FILE
-# instead.
-
-#=============================================================================
-# Copyright 2001-2010 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# Use the Config mode of the find_package() command to find ITKConfig.
-# If this succeeds (possibly because ITK_DIR is already set), the
-# command will have already loaded ITKConfig.cmake and set ITK_FOUND.
-if(NOT ITK_FOUND)
- set(_ITK_REQUIRED "")
- if(ITK_FIND_REQUIRED)
- set(_ITK_REQUIRED REQUIRED)
- endif()
- set(_ITK_QUIET "")
- if(ITK_FIND_QUIETLY)
- set(_ITK_QUIET QUIET)
- endif()
- find_package(ITK ${_ITK_REQUIRED} ${_ITK_QUIET} NO_MODULE
- NAMES ITK InsightToolkit
- CONFIGS ITKConfig.cmake
- )
-endif()
-
-if(ITK_FOUND)
- # Set USE_ITK_FILE for backward-compatibility.
- set(USE_ITK_FILE ${ITK_USE_FILE})
-endif()
diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake
new file mode 100644
index 000000000..3fa6cab4d
--- /dev/null
+++ b/Modules/FindIce.cmake
@@ -0,0 +1,521 @@
+#.rst:
+# FindIce
+# -------
+#
+# Find the ZeroC Internet Communication Engine (ICE) programs,
+# libraries and datafiles.
+#
+# This module supports multiple components.
+# Components can include any of: ``Freeze``, ``Glacier2``, ``Ice``,
+# ``IceBox``, ``IceDB``, ``IceGrid``, ``IcePatch``, ``IceSSL``,
+# ``IceStorm``, ``IceUtil``, ``IceXML``, or ``Slice``.
+#
+# This module reports information about the Ice installation in
+# several variables. General variables::
+#
+# Ice_VERSION - Ice release version
+# Ice_FOUND - true if the main programs and libraries were found
+# Ice_LIBRARIES - component libraries to be linked
+# Ice_INCLUDE_DIRS - the directories containing the Ice headers
+# Ice_SLICE_DIRS - the directories containing the Ice slice interface
+# definitions
+#
+# Imported targets::
+#
+# Ice::<C>
+#
+# Where ``<C>`` is the name of an Ice component, for example
+# ``Ice::Glacier2``.
+#
+# 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_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_ICEBOXADMIN_EXECUTABLE - path to iceboxadmin executable
+# Ice_ICEBOXD_EXECUTABLE - path to iceboxd executable
+# Ice_ICEBOXNET_EXECUTABLE - path to iceboxnet executable
+# Ice_ICEGRIDADMIN_EXECUTABLE - path to icegridadmin 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_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.
+#
+# The following cache variables may also be set::
+#
+# Ice_<P>_EXECUTABLE - the path to executable <P>
+# Ice_INCLUDE_DIR - the directory containing the Ice headers
+# Ice_SLICE_DIR - the directory containing the Ice slice interface
+# definitions
+# Ice_<C>_LIBRARY - the library for component <C>
+#
+# .. note::
+#
+# In most cases none of the above variables will require setting,
+# unless multiple Ice versions are available and a specific version
+# is required. On Windows, the most recent version of Ice will be
+# found through the registry. On Unix, the programs, headers and
+# libraries will usually be in standard locations, but Ice_SLICE_DIRS
+# might not be automatically detected (commonly known locations are
+# searched). All the other variables are defaulted using Ice_HOME,
+# if set. It's possible to set Ice_HOME and selectively specify
+# alternative locations for the other components; this might be
+# required for e.g. newer versions of Visual Studio if the
+# heuristics are not sufficient to identify the correct programs and
+# libraries for the specific Visual Studio version.
+#
+# Other variables one may set to control this module are::
+#
+# Ice_DEBUG - Set to ON to enable debug output from FindIce.
+
+# Written by Roger Leigh <rleigh@codelibre.net>
+
+#=============================================================================
+# Copyright 2014-2015 University of Dundee
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# The Ice checks are contained in a function due to the large number
+# of temporary variables needed.
+function(_Ice_FIND)
+ # Released versions of Ice, including generic short forms
+ set(ice_versions
+ 3
+ 3.6
+ 3.6.0
+ 3.5
+ 3.5.1
+ 3.5.0
+ 3.4
+ 3.4.2
+ 3.4.1
+ 3.4.0
+ 3.3
+ 3.3.1
+ 3.3.0)
+
+ # Set up search paths, taking compiler into account. Search Ice_HOME,
+ # with ICE_HOME in the environment as a fallback if unset.
+ if(Ice_HOME)
+ list(APPEND ice_roots "${Ice_HOME}")
+ else()
+ if(NOT "$ENV{ICE_HOME}" STREQUAL "")
+ file(TO_CMAKE_PATH "$ENV{ICE_HOME}" NATIVE_PATH)
+ list(APPEND ice_roots "${NATIVE_PATH}")
+ set(Ice_HOME "${NATIVE_PATH}"
+ CACHE PATH "Location of the Ice installation" FORCE)
+ endif()
+ endif()
+
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ # 64-bit path suffix
+ set(_x64 "/x64")
+ # 64-bit library directory
+ set(_lib64 "lib64")
+ endif()
+
+ if(MSVC_VERSION)
+ # VS 8.0
+ if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500)
+ set(vcver "vc80")
+ set(vcyear "2005")
+ # VS 9.0
+ elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600)
+ set(vcver "vc90")
+ set(vcyear "2008")
+ # VS 10.0
+ elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700)
+ set(vcver "vc100")
+ # VS 11.0
+ elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800)
+ set(vcver "vc110")
+ # VS 12.0
+ elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900)
+ set(vcver "vc120")
+ # VS 14.0
+ elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 2000)
+ set(vcver "vc140")
+ endif()
+ endif()
+
+ # For compatibility with ZeroC Windows builds.
+ if(vcver)
+ # Earlier Ice (3.3) builds don't use vcnnn subdirectories, but are harmless to check.
+ list(APPEND ice_binary_suffixes "bin/${vcver}${_x64}" "bin/${vcver}")
+ list(APPEND ice_library_suffixes "lib/${vcver}${_x64}" "lib/${vcver}")
+ endif()
+ # Generic 64-bit and 32-bit directories
+ list(APPEND ice_binary_suffixes "bin${_x64}" "bin")
+ list(APPEND ice_library_suffixes "${_lib64}" "lib${_x64}" "lib")
+ list(APPEND ice_include_suffixes "include")
+ list(APPEND ice_slice_suffixes "slice")
+
+ # On Windows, look in the registry for install locations. Different
+ # versions of Ice install support different compiler versions.
+ if(vcver)
+ foreach(ice_version ${ice_versions})
+ # Ice 3.3 releases use a Visual Studio year suffix and value is
+ # enclosed in double quotes, though only the leading quote is
+ # returned by get_filename_component.
+ unset(ice_location)
+ if(vcyear)
+ get_filename_component(ice_location
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version} for Visual Studio ${vcyear};InstallDir]"
+ PATH)
+ if(ice_location AND NOT ("${ice_location}" STREQUAL "/registry" OR "${ice_location}" STREQUAL "/"))
+ string(REGEX REPLACE "^\"(.*)\"?$" "\\1" ice_location "${ice_location}")
+ get_filename_component(ice_location "${ice_location}" ABSOLUTE)
+ else()
+ unset(ice_location)
+ endif()
+ endif()
+ # Ice 3.4+ releases don't use a suffix
+ if(NOT ice_location OR "${ice_location}" STREQUAL "/registry")
+ get_filename_component(ice_location
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version};InstallDir]"
+ ABSOLUTE)
+ endif()
+
+ if(ice_location AND NOT "${ice_location}" STREQUAL "/registry")
+ list(APPEND ice_roots "${ice_location}")
+ endif()
+ endforeach()
+ else()
+ foreach(ice_version ${ice_versions})
+ # Prefer 64-bit variants if present (and using a 64-bit compiler)
+ list(APPEND ice_roots "/opt/Ice-${ice_version}")
+ endforeach()
+ endif()
+
+ set(db_programs
+ db_archive
+ db_checkpoint
+ db_deadlock
+ db_dump
+ db_hotbackup
+ db_load
+ db_log_verify
+ db_printlog
+ db_recover
+ db_stat
+ db_tuner
+ db_upgrade
+ db_verify
+ dumpdb
+ transformdb)
+
+ set(ice_programs
+ glacier2router
+ icebox
+ iceboxadmin
+ iceboxd
+ iceboxnet
+ icegridadmin
+ icegridnode
+ icegridnoded
+ icegridregistry
+ icegridregistryd
+ icepatch2calc
+ icepatch2client
+ icepatch2server
+ iceserviceinstall
+ icestormadmin
+ icestormmigrate)
+
+ set(slice_programs
+ slice2cpp
+ slice2cs
+ slice2freezej
+ slice2freeze
+ slice2html
+ slice2java
+ slice2js
+ slice2php
+ slice2py
+ slice2rb)
+
+ # Find all Ice programs
+ foreach(program ${db_programs} ${ice_programs} ${slice_programs})
+ string(TOUPPER "${program}" program_upcase)
+ set(cache_var "Ice_${program_upcase}_EXECUTABLE")
+ set(program_var "Ice_${program_upcase}_EXECUTABLE")
+ find_program("${cache_var}" "${program}"
+ HINTS ${ice_roots}
+ PATH_SUFFIXES ${ice_binary_suffixes}
+ DOC "Ice ${program} executable")
+ mark_as_advanced(cache_var)
+ set("${program_var}" "${${cache_var}}" PARENT_SCOPE)
+ endforeach()
+
+ # Get version.
+ if(Ice_SLICE2CPP_EXECUTABLE)
+ # Execute in C locale for safety
+ set(_Ice_SAVED_LC_ALL "$ENV{LC_ALL}")
+ set(ENV{LC_ALL} C)
+
+ execute_process(COMMAND ${Ice_SLICE2CPP_EXECUTABLE} --version
+ ERROR_VARIABLE Ice_VERSION_SLICE2CPP_FULL
+ ERROR_STRIP_TRAILING_WHITESPACE)
+
+ # restore the previous LC_ALL
+ set(ENV{LC_ALL} ${_Ice_SAVED_LC_ALL})
+
+ # Make short version
+ string(REGEX REPLACE "^(.*)\\.[^.]*$" "\\1" Ice_VERSION_SLICE2CPP_SHORT "${Ice_VERSION_SLICE2CPP_FULL}")
+ set(Ice_VERSION "${Ice_VERSION_SLICE2CPP_FULL}" PARENT_SCOPE)
+ endif()
+
+ if(NOT Ice_FIND_QUIETLY)
+ message(STATUS "Ice version: ${Ice_VERSION_SLICE2CPP_FULL}")
+ endif()
+
+ # Find include directory
+ find_path(Ice_INCLUDE_DIR
+ NAMES "Ice/Ice.h"
+ HINTS ${ice_roots}
+ PATH_SUFFIXES ${ice_include_suffixes}
+ DOC "Ice include directory")
+ set(Ice_INCLUDE_DIR "${Ice_INCLUDE_DIR}" PARENT_SCOPE)
+
+ # In common use on Linux, MacOS X (homebrew) and FreeBSD; prefer
+ # version-specific dir
+ list(APPEND ice_slice_paths
+ /usr/local/share /usr/share)
+ list(APPEND ice_slice_suffixes
+ "Ice-${Ice_VERSION_SLICE2CPP_FULL}/slice"
+ "Ice-${Ice_VERSION_SLICE2CPP_SHORT}/slice"
+ Ice)
+
+ # Find slice directory
+ find_path(Ice_SLICE_DIR
+ NAMES "Ice/Connection.ice"
+ HINTS ${ice_roots}
+ ${ice_slice_paths}
+ PATH_SUFFIXES ${ice_slice_suffixes}
+ NO_DEFAULT_PATH
+ DOC "Ice slice directory")
+ set(Ice_SLICE_DIR "${Ice_SLICE_DIR}" PARENT_SCOPE)
+
+ # Find all Ice libraries
+ set(Ice_REQUIRED_LIBS_FOUND ON)
+ foreach(component ${Ice_FIND_COMPONENTS})
+ string(TOUPPER "${component}" component_upcase)
+ set(component_cache "Ice_${component_upcase}_LIBRARY")
+ set(component_found "${component_upcase}_FOUND")
+ find_library("${component_cache}" "${component}"
+ HINTS ${ice_roots}
+ PATH_SUFFIXES ${ice_library_suffixes}
+ DOC "Ice ${component} library")
+ mark_as_advanced("${component_cache}")
+ if(${component_cache})
+ set("${component_found}" ON)
+ list(APPEND Ice_LIBRARY "${${component_cache}}")
+ endif()
+ mark_as_advanced("${component_found}")
+ set("${component_cache}" "${${component_cache}}" PARENT_SCOPE)
+ set("${component_found}" "${${component_found}}" PARENT_SCOPE)
+ if(${component_found})
+ if (Ice_FIND_REQUIRED_${component})
+ list(APPEND Ice_LIBS_FOUND "${component} (required)")
+ else()
+ list(APPEND Ice_LIBS_FOUND "${component} (optional)")
+ endif()
+ else()
+ if (Ice_FIND_REQUIRED_${component})
+ set(Ice_REQUIRED_LIBS_FOUND OFF)
+ list(APPEND Ice_LIBS_NOTFOUND "${component} (required)")
+ else()
+ list(APPEND Ice_LIBS_NOTFOUND "${component} (optional)")
+ endif()
+ endif()
+ endforeach()
+ set(_Ice_REQUIRED_LIBS_FOUND "${Ice_REQUIRED_LIBS_FOUND}" PARENT_SCOPE)
+ set(Ice_LIBRARY "${Ice_LIBRARY}" PARENT_SCOPE)
+
+ if(NOT Ice_FIND_QUIETLY)
+ if(Ice_LIBS_FOUND)
+ message(STATUS "Found the following Ice libraries:")
+ foreach(found ${Ice_LIBS_FOUND})
+ message(STATUS " ${found}")
+ endforeach()
+ endif()
+ if(Ice_LIBS_NOTFOUND)
+ message(STATUS "The following Ice libraries were not found:")
+ foreach(notfound ${Ice_LIBS_NOTFOUND})
+ message(STATUS " ${notfound}")
+ endforeach()
+ endif()
+ endif()
+
+ if(Ice_DEBUG)
+ message(STATUS "--------FindIce.cmake search debug--------")
+ message(STATUS "ICE binary path search order: ${ice_roots}")
+ message(STATUS "ICE include path search order: ${ice_roots}")
+ message(STATUS "ICE slice path search order: ${ice_roots} ${ice_slice_paths}")
+ message(STATUS "ICE library path search order: ${ice_roots}")
+ message(STATUS "----------------")
+ endif()
+endfunction()
+
+_Ice_FIND()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ice
+ FOUND_VAR Ice_FOUND
+ REQUIRED_VARS Ice_SLICE2CPP_EXECUTABLE
+ Ice_INCLUDE_DIR
+ Ice_SLICE_DIR
+ Ice_LIBRARY
+ _Ice_REQUIRED_LIBS_FOUND
+ VERSION_VAR Ice_VERSION
+ FAIL_MESSAGE "Failed to find all Ice components")
+
+unset(_Ice_REQUIRED_LIBS_FOUND)
+
+if(Ice_FOUND)
+ set(Ice_INCLUDE_DIRS "${Ice_INCLUDE_DIR}")
+ set(Ice_SLICE_DIRS "${Ice_SLICE_DIR}")
+ set(Ice_LIBRARIES "${Ice_LIBRARY}")
+ foreach(_Ice_component ${Ice_FIND_COMPONENTS})
+ string(TOUPPER "${_Ice_component}" _Ice_component_upcase)
+ set(_Ice_component_cache "Ice_${_Ice_component_upcase}_LIBRARY")
+ set(_Ice_component_lib "Ice_${_Ice_component_upcase}_LIBRARIES")
+ set(_Ice_component_found "${_Ice_component_upcase}_FOUND")
+ set(_Ice_imported_target "Ice::${_Ice_component}")
+ if(${_Ice_component_found})
+ set("${_Ice_component_lib}" "${${_Ice_component_cache}}")
+ if(NOT TARGET ${_Ice_imported_target})
+ add_library(${_Ice_imported_target} UNKNOWN IMPORTED)
+ set_target_properties(${_Ice_imported_target} PROPERTIES
+ IMPORTED_LOCATION "${${_Ice_component_cache}}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Ice_INCLUDE_DIR}")
+ endif()
+ endif()
+ unset(_Ice_component_upcase)
+ unset(_Ice_component_cache)
+ unset(_Ice_component_lib)
+ unset(_Ice_component_found)
+ unset(_Ice_imported_target)
+ endforeach()
+endif()
+
+if(Ice_DEBUG)
+ message(STATUS "--------FindIce.cmake results debug--------")
+ message(STATUS "Ice_VERSION number: ${Ice_VERSION}")
+ message(STATUS "Ice_HOME directory: ${Ice_HOME}")
+ message(STATUS "Ice_INCLUDE_DIR directory: ${Ice_INCLUDE_DIR}")
+ message(STATUS "Ice_SLICE_DIR directory: ${Ice_SLICE_DIR}")
+ message(STATUS "Ice_LIBRARIES: ${Ice_LIBRARIES}")
+
+ message(STATUS "slice2cpp executable: ${Ice_SLICE2CPP_EXECUTABLE}")
+ message(STATUS "slice2cs executable: ${Ice_SLICE2CS_EXECUTABLE}")
+ message(STATUS "slice2freezej executable: ${Ice_SLICE2FREEZEJ_EXECUTABLE}")
+ message(STATUS "slice2freeze executable: ${Ice_SLICE2FREEZE_EXECUTABLE}")
+ message(STATUS "slice2html executable: ${Ice_SLICE2HTML_EXECUTABLE}")
+ message(STATUS "slice2java executable: ${Ice_SLICE2JAVA_EXECUTABLE}")
+ message(STATUS "slice2js executable: ${Ice_SLICE2JS_EXECUTABLE}")
+ message(STATUS "slice2php executable: ${Ice_SLICE2PHP_EXECUTABLE}")
+ message(STATUS "slice2py executable: ${Ice_SLICE2PY_EXECUTABLE}")
+ message(STATUS "slice2rb executable: ${Ice_SLICE2RB_EXECUTABLE}")
+ message(STATUS "glacier2router executable: ${Ice_GLACIER2ROUTER_EXECUTABLE}")
+
+ message(STATUS "icebox executable: ${Ice_ICEBOX_EXECUTABLE}")
+ message(STATUS "iceboxadmin executable: ${Ice_ICEBOXADMIN_EXECUTABLE}")
+ message(STATUS "iceboxd executable: ${Ice_ICEBOXD_EXECUTABLE}")
+ message(STATUS "iceboxnet executable: ${Ice_ICEBOXNET_EXECUTABLE}")
+ message(STATUS "icegridadmin executable: ${Ice_ICEGRIDADMIN_EXECUTABLE}")
+ message(STATUS "icegridnode executable: ${Ice_ICEGRIDNODE_EXECUTABLE}")
+ message(STATUS "icegridnoded executable: ${Ice_ICEGRIDNODED_EXECUTABLE}")
+ message(STATUS "icegridregistry executable: ${Ice_ICEGRIDREGISTRY_EXECUTABLE}")
+ message(STATUS "icegridregistryd executable: ${Ice_ICEGRIDREGISTRYD_EXECUTABLE}")
+ message(STATUS "icepatch2calc executable: ${Ice_ICEPATCH2CALC_EXECUTABLE}")
+ message(STATUS "icepatch2client executable: ${Ice_ICEPATCH2CLIENT_EXECUTABLE}")
+ message(STATUS "icepatch2server executable: ${Ice_ICEPATCH2SERVER_EXECUTABLE}")
+ message(STATUS "iceserviceinstall executable: ${Ice_ICESERVICEINSTALL_EXECUTABLE}")
+ message(STATUS "icestormadmin executable: ${Ice_ICESTORMADMIN_EXECUTABLE}")
+ message(STATUS "icestormmigrate executable: ${Ice_ICESTORMMIGRATE_EXECUTABLE}")
+
+ message(STATUS "db_archive executable: ${Ice_DB_ARCHIVE_EXECUTABLE}")
+ message(STATUS "db_checkpoint executable: ${Ice_DB_CHECKPOINT_EXECUTABLE}")
+ message(STATUS "db_deadlock executable: ${Ice_DB_DEADLOCK_EXECUTABLE}")
+ message(STATUS "db_dump executable: ${Ice_DB_DUMP_EXECUTABLE}")
+ message(STATUS "db_hotbackup executable: ${Ice_DB_HOTBACKUP_EXECUTABLE}")
+ message(STATUS "db_load executable: ${Ice_DB_LOAD_EXECUTABLE}")
+ message(STATUS "db_log_verify executable: ${Ice_DB_LOG_VERIFY_EXECUTABLE}")
+ message(STATUS "db_printlog executable: ${Ice_DB_PRINTLOG_EXECUTABLE}")
+ message(STATUS "db_recover executable: ${Ice_DB_RECOVER_EXECUTABLE}")
+ message(STATUS "db_stat executable: ${Ice_DB_STAT_EXECUTABLE}")
+ message(STATUS "db_tuner executable: ${Ice_DB_TUNER_EXECUTABLE}")
+ message(STATUS "db_upgrade executable: ${Ice_DB_UPGRADE_EXECUTABLE}")
+ message(STATUS "db_verify executable: ${Ice_DB_VERIFY_EXECUTABLE}")
+ message(STATUS "dumpdb executable: ${Ice_DUMPDB_EXECUTABLE}")
+ message(STATUS "transformdb executable: ${Ice_TRANSFORMDB_EXECUTABLE}")
+
+ foreach(component ${Ice_FIND_COMPONENTS})
+ string(TOUPPER "${component}" component_upcase)
+ set(component_lib "Ice_${component_upcase}_LIBRARIES")
+ set(component_found "${component_upcase}_FOUND")
+ message(STATUS "${component} library found: ${${component_found}}")
+ message(STATUS "${component} library: ${${component_lib}}")
+ endforeach()
+ message(STATUS "----------------")
+endif()
diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake
index 8c101778d..a7c5a64ec 100644
--- a/Modules/FindIcotool.cmake
+++ b/Modules/FindIcotool.cmake
@@ -1,10 +1,17 @@
-# - 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.
#=============================================================================
# Copyright 2012 Aleksey Avdeev <solo@altlinux.ru>
@@ -30,7 +37,7 @@ if(ICOTOOL_EXECUTABLE)
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
- if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*")
+ if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
set( ICOTOOL_VERSION_STRING
"${CMAKE_MATCH_1}"
)
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 7c6cce786..65458b7cf 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -1,58 +1,84 @@
-# - 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
+#.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
+# ::
+#
+# 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
+# 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_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
+# ::
+#
+# 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.
+# ::
+#
+# 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(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.).
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -69,34 +95,68 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+find_package(PkgConfig QUIET)
+
#---------------------------------------------------------------------
# Helper functions
#---------------------------------------------------------------------
function(FIND_IMAGEMAGICK_API component header)
set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE)
+ pkg_check_modules(PC_${component} QUIET ${component})
+
find_path(ImageMagick_${component}_INCLUDE_DIR
NAMES ${header}
+ HINTS
+ ${PC_${component}_INCLUDEDIR}
+ ${PC_${component}_INCLUDE_DIRS}
+ PATHS
+ ${ImageMagick_INCLUDE_DIRS}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include"
+ PATH_SUFFIXES
+ ImageMagick ImageMagick-6
+ DOC "Path to the ImageMagick arch-independent include dir."
+ )
+ find_path(ImageMagick_${component}_ARCH_INCLUDE_DIR
+ NAMES magick/magick-baseconfig.h
+ HINTS
+ ${PC_${component}_INCLUDEDIR}
+ ${PC_${component}_INCLUDE_DIRS}
PATHS
${ImageMagick_INCLUDE_DIRS}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include"
PATH_SUFFIXES
ImageMagick ImageMagick-6
- DOC "Path to the ImageMagick include dir."
+ DOC "Path to the ImageMagick arch-specific include dir."
)
find_library(ImageMagick_${component}_LIBRARY
NAMES ${ARGN}
+ HINTS
+ ${PC_${component}_LIBDIR}
+ ${PC_${component}_LIB_DIRS}
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib"
DOC "Path to the ImageMagick Magick++ library."
)
+ # old version have only indep dir
if(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY)
set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE)
- list(APPEND ImageMagick_INCLUDE_DIRS
+ # Construct per-component include directories.
+ set(ImageMagick_${component}_INCLUDE_DIRS
${ImageMagick_${component}_INCLUDE_DIR}
)
+ if(ImageMagick_${component}_ARCH_INCLUDE_DIR)
+ list(APPEND ImageMagick_${component}_INCLUDE_DIRS
+ ${ImageMagick_${component}_ARCH_INCLUDE_DIR})
+ endif()
+ list(REMOVE_DUPLICATES ImageMagick_${component}_INCLUDE_DIRS)
+ set(ImageMagick_${component}_INCLUDE_DIRS
+ ${ImageMagick_${component}_INCLUDE_DIRS} PARENT_SCOPE)
+
+ # Add the per-component include directories to the full include dirs.
+ list(APPEND ImageMagick_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIRS})
list(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS)
set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE)
@@ -195,8 +255,8 @@ if(ImageMagick_mogrify_EXECUTABLE)
OUTPUT_VARIABLE imagemagick_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(imagemagick_version MATCHES "^Version: ImageMagick [0-9]")
- string(REGEX REPLACE "^Version: ImageMagick ([-0-9\\.]+).*" "\\1" ImageMagick_VERSION_STRING "${imagemagick_version}")
+ if(imagemagick_version MATCHES "^Version: ImageMagick ([-0-9\\.]+)")
+ set(ImageMagick_VERSION_STRING "${CMAKE_MATCH_1}")
endif()
unset(imagemagick_version)
endif()
diff --git a/Modules/FindIntl.cmake b/Modules/FindIntl.cmake
new file mode 100644
index 000000000..cd2ec63ad
--- /dev/null
+++ b/Modules/FindIntl.cmake
@@ -0,0 +1,69 @@
+#.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>
+
+#=============================================================================
+# Copyright 2014 Roger Leigh <rleigh@codelibre.net>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Find include directory
+find_path(Intl_INCLUDE_DIR
+ NAMES "libintl.h"
+ DOC "libintl include directory")
+mark_as_advanced(Intl_INCLUDE_DIR)
+
+# Find all Intl libraries
+find_library(Intl_LIBRARY "intl"
+ DOC "libintl libraries (if not in the C library)")
+mark_as_advanced(Intl_LIBRARY)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
+ FOUND_VAR Intl_FOUND
+ REQUIRED_VARS Intl_INCLUDE_DIR
+ FAIL_MESSAGE "Failed to find Gettext libintl")
+
+if(Intl_FOUND)
+ set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
+ if(Intl_LIBRARY)
+ set(Intl_LIBRARIES "${Intl_LIBRARY}")
+ else()
+ unset(Intl_LIBRARIES)
+ endif()
+endif()
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 9d708ca15..135038c5b 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -1,17 +1,26 @@
-# - Find JNI java libraries.
+#.rst:
+# FindJNI
+# -------
+#
+# Find JNI java libraries.
+#
# This module finds if Java 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:
+# include files and libraries are. It also determines what the name of
+# the library is. The caller may set variable JAVA_HOME to specify a
+# Java installation prefix explicitly.
+#
+# This module sets the following result variables:
#
-# JNI_INCLUDE_DIRS = the include dirs to use
-# JNI_LIBRARIES = the libraries to use
-# JNI_FOUND = TRUE if JNI headers and libraries were found.
-# JAVA_AWT_LIBRARY = the path to the jawt library
-# JAVA_JVM_LIBRARY = the path to the jvm library
-# JAVA_INCLUDE_PATH = the include path to jni.h
-# JAVA_INCLUDE_PATH2 = the include path to jni_md.h
-# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h
+# ::
#
+# JNI_INCLUDE_DIRS = the include dirs to use
+# JNI_LIBRARIES = the libraries to use
+# JNI_FOUND = TRUE if JNI headers and libraries were found.
+# JAVA_AWT_LIBRARY = the path to the jawt library
+# JAVA_JVM_LIBRARY = the path to the jvm library
+# JAVA_INCLUDE_PATH = the include path to jni.h
+# JAVA_INCLUDE_PATH2 = the include path to jni_md.h
+# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -33,7 +42,11 @@ macro(java_append_library_directories _var)
# 1.6.0_18 + icedtea patches. However, it would be much better to base the
# guess on the first part of the GNU config.guess platform triplet.
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
- set(_java_libarch "amd64")
+ if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "x86_64-linux-gnux32")
+ set(_java_libarch "x32" "amd64" "i386")
+ else()
+ set(_java_libarch "amd64" "i386")
+ endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
set(_java_libarch "i386")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
@@ -44,11 +57,13 @@ macro(java_append_library_directories _var)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
# mips* machines are bi-endian mostly so processor does not tell
# endianess of the underlying system.
- set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb")
+ set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
+ set(_java_libarch "ppc64" "ppc64le")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
- set(_java_libarch "ppc64")
+ set(_java_libarch "ppc64" "ppc")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
- set(_java_libarch "ppc")
+ set(_java_libarch "ppc" "ppc64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
# Both flavours can run on the same processor
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9")
@@ -85,22 +100,38 @@ macro(java_append_library_directories _var)
endforeach()
endmacro()
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
+
+# Save CMAKE_FIND_FRAMEWORK
+if(DEFINED CMAKE_FIND_FRAMEWORK)
+ set(_JNI_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
+else()
+ unset(_JNI_CMAKE_FIND_FRAMEWORK)
+endif()
+
+if(_JAVA_HOME_EXPLICIT)
+ set(CMAKE_FIND_FRAMEWORK NEVER)
+endif()
+
+set(JAVA_AWT_LIBRARY_DIRECTORIES)
+if(_JAVA_HOME)
+ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
+ ${_JAVA_HOME}/jre/lib/{libarch}
+ ${_JAVA_HOME}/jre/lib
+ ${_JAVA_HOME}/lib/{libarch}
+ ${_JAVA_HOME}/lib
+ ${_JAVA_HOME}
+ )
+endif()
get_filename_component(java_install_version
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME)
-set(JAVA_AWT_LIBRARY_DIRECTORIES
+list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib"
)
-
-file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _JAVA_HOME)
-
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
- ${_JAVA_HOME}/jre/lib/{libarch}
- ${_JAVA_HOME}/jre/lib
- ${_JAVA_HOME}/lib
- ${_JAVA_HOME}
/usr/lib
/usr/local/lib
/usr/lib/jvm/java/lib
@@ -125,24 +156,31 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
/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}
+ # SuSE specific paths for default JVM
+ /usr/lib64/jvm/java/jre/lib/{libarch}
+ /usr/lib64/jvm/jre/lib/{libarch}
)
set(JAVA_JVM_LIBRARY_DIRECTORIES)
foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES})
- set(JAVA_JVM_LIBRARY_DIRECTORIES
- ${JAVA_JVM_LIBRARY_DIRECTORIES}
+ list(APPEND JAVA_JVM_LIBRARY_DIRECTORIES
"${dir}"
"${dir}/client"
"${dir}/server"
+ # IBM SDK, Java Technology Edition, specific paths
+ "${dir}/j9vm"
+ "${dir}/default"
)
endforeach()
-
-set(JAVA_AWT_INCLUDE_DIRECTORIES
+set(JAVA_AWT_INCLUDE_DIRECTORIES)
+if(_JAVA_HOME)
+ list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ${_JAVA_HOME}/include)
+endif()
+list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include"
- ${_JAVA_HOME}/include
/usr/include
/usr/local/include
/usr/lib/java/include
@@ -161,13 +199,15 @@ set(JAVA_AWT_INCLUDE_DIRECTORIES
# 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
)
foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
get_filename_component(jpath "${JAVA_PROG}" PATH)
foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include)
if(EXISTS ${jpath}/${JAVA_INC_PATH})
- set(JAVA_AWT_INCLUDE_DIRECTORIES ${JAVA_AWT_INCLUDE_DIRECTORIES} "${jpath}/${JAVA_INC_PATH}")
+ list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${jpath}/${JAVA_INC_PATH}")
endif()
endforeach()
foreach(JAVA_LIB_PATH
@@ -175,54 +215,55 @@ foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
../java/lib ../java/jre/lib ../java/jre/lib/i386
../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386)
if(EXISTS ${jpath}/${JAVA_LIB_PATH})
- set(JAVA_AWT_LIBRARY_DIRECTORIES ${JAVA_AWT_LIBRARY_DIRECTORIES} "${jpath}/${JAVA_LIB_PATH}")
+ list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "${jpath}/${JAVA_LIB_PATH}")
endif()
endforeach()
endforeach()
if(APPLE)
- if(EXISTS ~/Library/Frameworks/JavaVM.framework)
- set(JAVA_HAVE_FRAMEWORK 1)
- endif()
- if(EXISTS /Library/Frameworks/JavaVM.framework)
- set(JAVA_HAVE_FRAMEWORK 1)
+ if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY")
+ set(_JNI_SEARCHES FRAMEWORK)
+ elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER")
+ set(_JNI_SEARCHES NORMAL)
+ elseif(CMAKE_FIND_FRAMEWORK STREQUAL "LAST")
+ set(_JNI_SEARCHES NORMAL FRAMEWORK)
+ else()
+ set(_JNI_SEARCHES FRAMEWORK NORMAL)
endif()
- if(EXISTS /System/Library/Frameworks/JavaVM.framework)
- set(JAVA_HAVE_FRAMEWORK 1)
- endif()
-
- if(JAVA_HAVE_FRAMEWORK)
- if(NOT JAVA_AWT_LIBRARY)
- set (JAVA_AWT_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE)
- endif()
+ set(_JNI_FRAMEWORK_JVM NAMES JavaVM)
+ set(_JNI_FRAMEWORK_JAWT "${_JNI_FRAMEWORK_JVM}")
+else()
+ set(_JNI_SEARCHES NORMAL)
+endif()
- if(NOT JAVA_JVM_LIBRARY)
- set (JAVA_JVM_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE)
- endif()
+set(_JNI_NORMAL_JVM
+ NAMES jvm
+ PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES}
+ )
- if(NOT JAVA_AWT_INCLUDE_PATH)
- if(EXISTS /System/Library/Frameworks/JavaVM.framework/Headers/jawt.h)
- set (JAVA_AWT_INCLUDE_PATH "/System/Library/Frameworks/JavaVM.framework/Headers" CACHE FILEPATH "jawt.h location" FORCE)
- endif()
- endif()
+set(_JNI_NORMAL_JAWT
+ NAMES jawt
+ PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
+ )
- # If using "-framework JavaVM", prefer its headers *before* the others in
- # JAVA_AWT_INCLUDE_DIRECTORIES... (*prepend* to the list here)
- #
- set(JAVA_AWT_INCLUDE_DIRECTORIES
- ~/Library/Frameworks/JavaVM.framework/Headers
- /Library/Frameworks/JavaVM.framework/Headers
- /System/Library/Frameworks/JavaVM.framework/Headers
- ${JAVA_AWT_INCLUDE_DIRECTORIES}
- )
+foreach(search ${_JNI_SEARCHES})
+ find_library(JAVA_JVM_LIBRARY ${_JNI_${search}_JVM})
+ find_library(JAVA_AWT_LIBRARY ${_JNI_${search}_JAWT})
+ if(JAVA_JVM_LIBRARY)
+ break()
endif()
+endforeach()
+unset(_JNI_SEARCHES)
+unset(_JNI_FRAMEWORK_JVM)
+unset(_JNI_FRAMEWORK_JAWT)
+unset(_JNI_NORMAL_JVM)
+unset(_JNI_NORMAL_JAWT)
+
+# Find headers matching the library.
+if("${JAVA_JVM_LIBRARY};${JAVA_AWT_LIBRARY};" MATCHES "(/JavaVM.framework|-framework JavaVM);")
+ set(CMAKE_FIND_FRAMEWORK ONLY)
else()
- find_library(JAVA_AWT_LIBRARY jawt
- PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
- )
- find_library(JAVA_JVM_LIBRARY NAMES jvm JavaVM
- PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES}
- )
+ set(CMAKE_FIND_FRAMEWORK NEVER)
endif()
# add in the include path
@@ -230,8 +271,10 @@ find_path(JAVA_INCLUDE_PATH jni.h
${JAVA_AWT_INCLUDE_DIRECTORIES}
)
-find_path(JAVA_INCLUDE_PATH2 jni_md.h
+find_path(JAVA_INCLUDE_PATH2 NAMES jni_md.h jniport.h
+ PATHS
${JAVA_INCLUDE_PATH}
+ ${JAVA_INCLUDE_PATH}/darwin
${JAVA_INCLUDE_PATH}/win32
${JAVA_INCLUDE_PATH}/linux
${JAVA_INCLUDE_PATH}/freebsd
@@ -239,12 +282,21 @@ find_path(JAVA_INCLUDE_PATH2 jni_md.h
${JAVA_INCLUDE_PATH}/solaris
${JAVA_INCLUDE_PATH}/hp-ux
${JAVA_INCLUDE_PATH}/alpha
+ ${JAVA_INCLUDE_PATH}/aix
)
find_path(JAVA_AWT_INCLUDE_PATH jawt.h
${JAVA_INCLUDE_PATH}
)
+# Restore CMAKE_FIND_FRAMEWORK
+if(DEFINED _JNI_CMAKE_FIND_FRAMEWORK)
+ set(CMAKE_FIND_FRAMEWORK ${_JNI_CMAKE_FIND_FRAMEWORK})
+ unset(_JNI_CMAKE_FIND_FRAMEWORK)
+else()
+ unset(CMAKE_FIND_FRAMEWORK)
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index 7c1f0fd94..86bb6e505 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -1,11 +1,22 @@
-# - Find JPEG
-# Find the native JPEG includes and library
-# This module defines
-# JPEG_INCLUDE_DIR, where to find jpeglib.h, etc.
-# JPEG_LIBRARIES, the libraries needed to use JPEG.
-# JPEG_FOUND, If false, do not try to use JPEG.
+#.rst:
+# FindJPEG
+# --------
+#
+# Find JPEG
+#
+# Find the native JPEG includes and library This module defines
+#
+# ::
+#
+# JPEG_INCLUDE_DIR, where to find jpeglib.h, etc.
+# JPEG_LIBRARIES, the libraries needed to use JPEG.
+# JPEG_FOUND, If false, do not try to use JPEG.
+#
# also defined, but not for general use are
-# JPEG_LIBRARY, where to find the JPEG library.
+#
+# ::
+#
+# JPEG_LIBRARY, where to find the JPEG library.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -22,7 +33,7 @@
find_path(JPEG_INCLUDE_DIR jpeglib.h)
-set(JPEG_NAMES ${JPEG_NAMES} jpeg)
+set(JPEG_NAMES ${JPEG_NAMES} jpeg libjpeg)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake
index 136056b84..0f325f039 100644
--- a/Modules/FindJasper.cmake
+++ b/Modules/FindJasper.cmake
@@ -1,10 +1,17 @@
-# - Try to find the Jasper JPEG2000 library
+#.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)
+# ::
+#
+# 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)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index 2f02b7a4b..cc67df662 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -1,46 +1,72 @@
-# - Find Java
+#.rst:
+# FindJava
+# --------
+#
+# Find Java
+#
# This module finds if Java is installed and determines where the
-# include files and libraries are. This code sets the following
-# 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 documention generator
-# Java_JAR_EXECUTABLE = the full path to the Java archiver
-# Java_VERSION_STRING = Version of the package found (java version), 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)
+# include files and libraries are. The caller may set variable JAVA_HOME
+# to specify a Java installation prefix explicitly.
+#
+#
+# Specify one or more of the following components as you call this find module. See example below.
+#
+# ::
+#
+# Runtime = User just want to execute some Java byte-compiled
+# Development = Development tools (java, javac, javah and javadoc), includes Runtime component
+# IdlJ = idl compiler for Java
+# JarSigner = signer tool for jar
+#
+#
+# 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 documention 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
-# standard CMake syntax, e.g. find_package(Java 1.5)
+# standard CMake syntax, e.g. find_package(Java 1.5)
#
-# NOTE: ${Java_VERSION} and ${Java_VERSION_STRING} are not guaranteed to be
-# identical. For example some java version may return:
-# Java_VERSION_STRING = 1.5.0_17
-# and
-# Java_VERSION = 1.5.0.17
+# NOTE: ${Java_VERSION} and ${Java_VERSION_STRING} are not guaranteed to
+# be identical. For example some java version may return:
+# Java_VERSION_STRING = 1.5.0_17 and Java_VERSION = 1.5.0.17
#
-# another example is the Java OEM, with:
-# Java_VERSION_STRING = 1.6.0-oem
-# and
-# Java_VERSION = 1.6.0
+# another example is the Java OEM, with: Java_VERSION_STRING = 1.6.0-oem
+# and Java_VERSION = 1.6.0
#
# For these components the following variables are set:
#
-# Java_FOUND - TRUE if all components are found.
-# Java_INCLUDE_DIRS - Full paths to all include dirs.
-# Java_LIBRARIES - Full paths to all libraries.
-# Java_<component>_FOUND - TRUE if <component> is found.
+# ::
+#
+# Java_FOUND - TRUE if all components are found.
+# Java_INCLUDE_DIRS - Full paths to all include dirs.
+# Java_LIBRARIES - Full paths to all libraries.
+# Java_<component>_FOUND - TRUE if <component> is found.
+#
+#
#
# Example Usages:
-# find_package(Java)
-# find_package(Java COMPONENTS Runtime)
-# find_package(Java COMPONENTS Development)
#
+# ::
+#
+# find_package(Java)
+# find_package(Java COMPONENTS Runtime)
+# find_package(Java COMPONENTS Development)
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -56,8 +82,14 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
+
# The HINTS option should only be used for values computed from the system.
-set(_JAVA_HINTS
+set(_JAVA_HINTS)
+if(_JAVA_HOME)
+ list(APPEND _JAVA_HINTS ${_JAVA_HOME}/bin)
+endif()
+list(APPEND _JAVA_HINTS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin"
@@ -66,7 +98,6 @@ set(_JAVA_HINTS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
- $ENV{JAVA_HOME}/bin
)
# Hard-coded guesses should still go in PATHS. This ensures that the user
# environment can always override hard guesses.
@@ -97,10 +128,13 @@ if(Java_JAVA_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if( res )
- if(${Java_FIND_REQUIRED})
+ if(var MATCHES "No Java runtime present, requesting install")
+ set_property(CACHE Java_JAVA_EXECUTABLE
+ PROPERTY VALUE "Java_JAVA_EXECUTABLE-NOTFOUND")
+ elseif(${Java_FIND_REQUIRED})
message( FATAL_ERROR "Error executing java -version" )
else()
- message( STATUS "Warning, could not run java --version")
+ message( STATUS "Warning, could not run java -version")
endif()
else()
# extract major/minor version and patch level from "java -version" output
@@ -110,18 +144,15 @@ if(Java_JAVA_EXECUTABLE)
# 3. GCJ 1.5
# 4. Kaffe 1.4.2
# 5. OpenJDK 1.7.x on OpenBSD
- if(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*")
+ if(var MATCHES "java version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\"")
# This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
- string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*"
- "\\1" Java_VERSION_STRING "${var}" )
- elseif(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*")
+ set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
+ elseif(var MATCHES "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+)\"")
# Kaffe style
- string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*"
- "\\1" Java_VERSION_STRING "${var}" )
- elseif(var MATCHES "openjdk version \"[0-9]+\\.[0-9]+\\.[0-9_]+\".*")
+ set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
+ elseif(var MATCHES "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+.*)\"")
# OpenJDK ver 1.7.x on OpenBSD
- string( REGEX REPLACE "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+).*"
- "\\1" Java_VERSION_STRING "${var}" )
+ set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
else()
if(NOT Java_FIND_QUIETLY)
message(WARNING "regex not supported: ${var}. Please report")
@@ -166,28 +197,61 @@ find_program(Java_JAVADOC_EXECUTABLE
PATHS ${_JAVA_PATHS}
)
+find_program(Java_IDLJ_EXECUTABLE
+ NAMES idlj
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+find_program(Java_JARSIGNER_EXECUTABLE
+ NAMES jarsigner
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
if(Java_FIND_COMPONENTS)
+ set(_JAVA_REQUIRED_VARS)
foreach(component ${Java_FIND_COMPONENTS})
# User just want to execute some Java byte-compiled
- if(component STREQUAL "Runtime")
- find_package_handle_standard_args(Java
- REQUIRED_VARS Java_JAVA_EXECUTABLE
- VERSION_VAR Java_VERSION
- )
+ If(component STREQUAL "Runtime")
+ list(APPEND _JAVA_REQUIRED_VARS Java_JAVA_EXECUTABLE)
+ if(Java_JAVA_EXECUTABLE)
+ set(Java_Runtime_FOUND TRUE)
+ endif()
elseif(component STREQUAL "Development")
- find_package_handle_standard_args(Java
- REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
- Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE
- VERSION_VAR Java_VERSION
- )
+ list(APPEND _JAVA_REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAVAC_EXECUTABLE
+ Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE)
+ if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE
+ AND Java_JAVAH_EXECUTABLE AND Java_JAVADOC_EXECUTABLE)
+ set(Java_Development_FOUND TRUE)
+ endif()
+ elseif(component STREQUAL "IdlJ")
+ list(APPEND _JAVA_REQUIRED_VARS Java_IDLJ_EXECUTABLE)
+ if(Java_IDLJ_EXECUTABLE)
+ set(Java_IdlJ_FOUND TRUE)
+ endif()
+ elseif(component STREQUAL "JarSigner")
+ list(APPEND _JAVA_REQUIRED_VARS Java_JARSIGNER_EXECUTABLE)
+ if(Java_JARSIGNER_EXECUTABLE)
+ set(Java_JarSigner_FOUND TRUE)
+ endif()
else()
message(FATAL_ERROR "Comp: ${component} is not handled")
endif()
- set(Java_${component}_FOUND TRUE)
endforeach()
+ list (REMOVE_DUPLICATES _JAVA_REQUIRED_VARS)
+ find_package_handle_standard_args(Java
+ REQUIRED_VARS ${_JAVA_REQUIRED_VARS} HANDLE_COMPONENTS
+ VERSION_VAR Java_VERSION
+ )
+ if(Java_FOUND)
+ foreach(component ${Java_FIND_COMPONENTS})
+ set(Java_${component}_FOUND TRUE)
+ endforeach()
+ endif()
else()
- # Check for everything
+ # Check for Development
find_package_handle_standard_args(Java
REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE
@@ -202,6 +266,8 @@ mark_as_advanced(
Java_JAVAC_EXECUTABLE
Java_JAVAH_EXECUTABLE
Java_JAVADOC_EXECUTABLE
+ Java_IDLJ_EXECUTABLE
+ Java_JARSIGNER_EXECUTABLE
)
# LEGACY
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake
index 70eccef60..dda453050 100644
--- a/Modules/FindKDE3.cmake
+++ b/Modules/FindKDE3.cmake
@@ -1,64 +1,135 @@
-# - Find the KDE3 include and library dirs, KDE preprocessors and define a some macros
+#.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
+#
+# ``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
+# ``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.
#
-# 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_UI_FILES(SRCS_VAR file1.ui ... fileN.ui )
#
-# 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.
+# 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_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.
+# ::
+#
+# 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.
+#
#
-# 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.
#
-# The option KDE3_ENABLE_FINAL to enable all-in-one compilation is
-# no longer supported.
#
#
# Author: Alexander Neundorf <neundorf@kde.org>
@@ -124,7 +195,7 @@ if(KDECONFIG_EXECUTABLE)
if ("${kde_version}" MATCHES "KDE: 3\\.")
execute_process(COMMAND ${KDECONFIG_EXECUTABLE} --prefix
OUTPUT_VARIABLE kdedir )
- string(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}")
+ string(REPLACE "\n" "" KDE3PREFIX "${kdedir}")
endif ()
endif()
diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake
index c653a04cd..55301667b 100644
--- a/Modules/FindKDE4.cmake
+++ b/Modules/FindKDE4.cmake
@@ -1,11 +1,24 @@
-# 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
+#.rst:
+# FindKDE4
+# --------
#
-# 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/.
+#
+#
+# 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>
@@ -92,7 +105,7 @@ if (KDE4_DATA_DIR)
endif ()
# use FindKDE4Internal.cmake to do the rest
- find_package(KDE4Internal ${_req} ${_quiet})
+ find_package(KDE4Internal ${_req} ${_quiet} NO_POLICY_SCOPE)
else ()
if (KDE4_FIND_REQUIRED)
message(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}")
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 3167850db..b11edc334 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -1,27 +1,37 @@
-# - Find LAPACK library
-# This module finds an installed fortran library that implements the LAPACK
-# linear-algebra interface (see http://www.netlib.org/lapack/).
+#.rst:
+# FindLAPACK
+# ----------
#
-# 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).
+# 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), ACML,Apple, NAS, Generic
+#
+# ::
+#
+# 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),
+# ACML,Apple, NAS, Generic
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -44,6 +54,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
else ()
include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
endif ()
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+
+cmake_push_check_state()
+set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY})
set(LAPACK_FOUND FALSE)
set(LAPACK95_FOUND FALSE)
@@ -145,7 +159,7 @@ endif()
if(BLAS_FOUND)
set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
- if ($ENV{BLA_VENDOR} MATCHES ".+")
+ if (NOT $ENV{BLA_VENDOR} STREQUAL "")
set(BLA_VENDOR $ENV{BLA_VENDOR})
else ()
if(NOT BLA_VENDOR)
@@ -169,7 +183,7 @@ endif ()
#acml lapack
- if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
+ if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
if (BLAS_LIBRARIES MATCHES ".+acml.+")
set (LAPACK_LIBRARIES ${BLAS_LIBRARIES})
endif ()
@@ -219,7 +233,7 @@ if (BLA_VENDOR STREQUAL "Generic" OR
endif ()
endif ()
#intel lapack
-if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
if (NOT WIN32)
set(LM "-lm")
endif ()
@@ -229,57 +243,61 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
else()
find_package(Threads REQUIRED)
endif()
+
+ set(LAPACK_SEARCH_LIBS "")
+
if (BLA_F95)
- if(NOT LAPACK95_LIBRARIES)
- # old
- check_lapack_libraries(
- LAPACK95_LIBRARIES
- LAPACK
- cheev
- ""
- "mkl_lapack95"
- "${BLAS95_LIBRARIES}"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif()
- if(NOT LAPACK95_LIBRARIES)
- # new >= 10.3
- check_lapack_libraries(
- LAPACK95_LIBRARIES
- LAPACK
- CHEEV
- ""
- "mkl_intel_lp64"
- "${BLAS95_LIBRARIES}"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif()
+ set(LAPACK_mkl_SEARCH_SYMBOL "CHEEV")
+ 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_intel_lp64")
else()
- if(NOT LAPACK_LIBRARIES)
- # old
- check_lapack_libraries(
- LAPACK_LIBRARIES
- LAPACK
- cheev
- ""
- "mkl_lapack"
- "${BLAS_LIBRARIES}"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif()
- if(NOT LAPACK_LIBRARIES)
- # new >= 10.3
+ 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_lp64")
+ endif()
+
+ # First try empty lapack libs
+ if (NOT ${_LIBRARIES})
+ check_lapack_libraries(
+ ${_LIBRARIES}
+ BLAS
+ ${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(
- LAPACK_LIBRARIES
- LAPACK
- cheev
+ ${_LIBRARIES}
+ BLAS
+ ${LAPACK_mkl_SEARCH_SYMBOL}
""
- "mkl_gf_lp64"
- "${BLAS_LIBRARIES}"
+ "${IT}"
+ "${_BLAS_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
- endif()
- endif()
+ endif ()
+ endforeach ()
endif ()
endif()
else()
@@ -333,4 +351,5 @@ else()
endif()
endif()
+cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake
index bc752a95a..ae83733c2 100644
--- a/Modules/FindLATEX.cmake
+++ b/Modules/FindLATEX.cmake
@@ -1,18 +1,57 @@
-# - Find Latex
-# This module finds if Latex is installed and determines where the
-# executables are. This code sets the following variables:
+#.rst:
+# FindLATEX
+# ---------
#
-# LATEX_COMPILER: path to the LaTeX compiler
-# PDFLATEX_COMPILER: path to the PdfLaTeX compiler
-# BIBTEX_COMPILER: path to the BibTeX compiler
-# MAKEINDEX_COMPILER: path to the MakeIndex compiler
-# DVIPS_CONVERTER: path to the DVIPS converter
-# PS2PDF_CONVERTER: path to the PS2PDF converter
-# LATEX2HTML_CONVERTER: path to the LaTeX2Html converter
+# 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)
#=============================================================================
-# Copyright 2002-2009 Kitware, Inc.
+# Copyright 2002-2015 Kitware, Inc.
+# Copyright 2014-2015 Christoph Grüninger <foss@grueninger.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -25,9 +64,7 @@
# License text for the above reference.)
if (WIN32)
-
# Try to find the MikTex binary path (look for its package manager).
-
find_path(MIKTEX_BINARY_PATH mpm.exe
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin"
DOC
@@ -36,7 +73,6 @@ if (WIN32)
mark_as_advanced(MIKTEX_BINARY_PATH)
# Try to find the GhostScript binary path (look for gswin32).
-
get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\8.00;GS_DLL]" PATH
)
@@ -57,70 +93,198 @@ if (WIN32)
DOC "Path to the GhostScript library directory."
)
mark_as_advanced(GHOSTSCRIPT_LIBRARY_PATH)
-
endif ()
+# try to find Latex and the related programs
find_program(LATEX_COMPILER
NAMES latex
PATHS ${MIKTEX_BINARY_PATH}
/usr/bin
)
+# find pdflatex
find_program(PDFLATEX_COMPILER
NAMES pdflatex
PATHS ${MIKTEX_BINARY_PATH}
/usr/bin
)
+if (PDFLATEX_COMPILER)
+ set(LATEX_PDFLATEX_FOUND TRUE)
+else()
+ set(LATEX_PDFLATEX_FOUND FALSE)
+endif()
+
+# find xelatex
+find_program(XELATEX_COMPILER
+ NAMES xelatex
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+if (XELATEX_COMPILER)
+ set(LATEX_XELATEX_FOUND TRUE)
+else()
+ set(LATEX_XELATEX_FOUND FALSE)
+endif()
+
+# find lualatex
+find_program(LUALATEX_COMPILER
+ NAMES lualatex
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+if (LUALATEX_COMPILER)
+ set(LATEX_LUALATEX_FOUND TRUE)
+else()
+ set(LATEX_LUALATEX_FOUND FALSE)
+endif()
+# find bibtex
find_program(BIBTEX_COMPILER
NAMES bibtex
PATHS ${MIKTEX_BINARY_PATH}
/usr/bin
)
+if (BIBTEX_COMPILER)
+ set(LATEX_BIBTEX_FOUND TRUE)
+else()
+ set(LATEX_BIBTEX_FOUND FALSE)
+endif()
+# find biber
+find_program(BIBER_COMPILER
+ NAMES biber
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+if (BIBER_COMPILER)
+ set(LATEX_BIBER_FOUND TRUE)
+else()
+ set(LATEX_BIBER_FOUND FALSE)
+endif()
+
+# find makeindex
find_program(MAKEINDEX_COMPILER
NAMES makeindex
PATHS ${MIKTEX_BINARY_PATH}
/usr/bin
)
+if (MAKEINDEX_COMPILER)
+ set(LATEX_MAKEINDEX_FOUND TRUE)
+else()
+ set(LATEX_MAKEINDEX_FOUND FALSE)
+endif()
+# find xindy
+find_program(XINDY_COMPILER
+ NAMES xindy
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+if (XINDY_COMPILER)
+ set(LATEX_XINDY_FOUND TRUE)
+else()
+ set(LATEX_XINDY_FOUND FALSE)
+endif()
+
+# find dvips
find_program(DVIPS_CONVERTER
NAMES dvips
PATHS ${MIKTEX_BINARY_PATH}
/usr/bin
)
+if (DVIPS_CONVERTER)
+ set(LATEX_DVIPS_FOUND TRUE)
+else()
+ set(LATEX_DVIPS_FOUND FALSE)
+endif()
+# find dvipdf
find_program(DVIPDF_CONVERTER
NAMES dvipdfm dvipdft dvipdf
PATHS ${MIKTEX_BINARY_PATH}
/usr/bin
)
+if (DVIPDF_CONVERTER)
+ set(LATEX_DVIPDF_FOUND TRUE)
+else()
+ set(LATEX_DVIPDF_FOUND FALSE)
+endif()
+# find ps2pdf
if (WIN32)
find_program(PS2PDF_CONVERTER
- NAMES ps2pdf14.bat
+ NAMES ps2pdf14.bat ps2pdf14 ps2pdf
PATHS ${GHOSTSCRIPT_LIBRARY_PATH}
+ ${MIKTEX_BINARY_PATH}
)
else ()
find_program(PS2PDF_CONVERTER
NAMES ps2pdf14 ps2pdf
)
endif ()
+if (PS2PDF_CONVERTER)
+ set(LATEX_PS2PDF_FOUND TRUE)
+else()
+ set(LATEX_PS2PDF_FOUND FALSE)
+endif()
+
+# find pdftops
+find_program(PDFTOPS_CONVERTER
+ NAMES pdftops
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+if (PDFTOPS_CONVERTER)
+ set(LATEX_PDFTOPS_FOUND TRUE)
+else()
+ set(LATEX_PDFTOPS_FOUND FALSE)
+endif()
+# find latex2html
find_program(LATEX2HTML_CONVERTER
NAMES latex2html
PATHS ${MIKTEX_BINARY_PATH}
/usr/bin
)
+if (LATEX2HTML_CONVERTER)
+ set(LATEX_LATEX2HTML_FOUND TRUE)
+else()
+ set(LATEX_LATEX2HTML_FOUND FALSE)
+endif()
+
+# find htlatex
+find_program(HTLATEX_COMPILER
+ NAMES htlatex
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+if (HTLATEX_COMPILER)
+ set(LATEX_HTLATEX_FOUND TRUE)
+else()
+ set(LATEX_HTLATEX_FOUND FALSE)
+endif()
mark_as_advanced(
LATEX_COMPILER
PDFLATEX_COMPILER
+ XELATEX_COMPILER
+ LUALATEX_COMPILER
BIBTEX_COMPILER
+ BIBER_COMPILER
MAKEINDEX_COMPILER
+ XINDY_COMPILER
DVIPS_CONVERTER
DVIPDF_CONVERTER
PS2PDF_CONVERTER
+ PDFTOPS_CONVERTER
LATEX2HTML_CONVERTER
+ HTLATEX_COMPILER
+)
+
+# handle variables for found Latex and its components
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(LATEX
+ REQUIRED_VARS LATEX_COMPILER
+ HANDLE_COMPONENTS
)
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake
index be931c525..471a4f188 100644
--- a/Modules/FindLibArchive.cmake
+++ b/Modules/FindLibArchive.cmake
@@ -1,10 +1,17 @@
-# - Find libarchive library and headers
+#.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
+# ::
+#
+# 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
#=============================================================================
# Copyright 2010 Kitware, Inc.
diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake
index 837e63324..742b851cd 100644
--- a/Modules/FindLibLZMA.cmake
+++ b/Modules/FindLibLZMA.cmake
@@ -1,16 +1,23 @@
-# - Find LibLZMA
+#.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")
+# ::
+#
+# 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")
#=============================================================================
# Copyright 2008 Per Øyvind Karlsen <peroyvind@mandriva.org>
@@ -48,9 +55,12 @@ endif()
# Avoid using old codebase
if (LIBLZMA_LIBRARY)
include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+ set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+ set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY})
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER)
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER)
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET)
+ set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
endif ()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index 858496e09..73224286d 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -1,12 +1,19 @@
-# - Try to find the LibXml2 xml processing library
+#.rst:
+# FindLibXml2
+# -----------
+#
+# Try to find the LibXml2 xml processing library
+#
# Once done this will define
#
-# LIBXML2_FOUND - System has LibXml2
-# LIBXML2_INCLUDE_DIR - The LibXml2 include directory
-# LIBXML2_LIBRARIES - The libraries needed to use LibXml2
-# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
-# LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2
-# LIBXML2_VERSION_STRING - the version of LibXml2 found (since CMake 2.8.8)
+# ::
+#
+# LIBXML2_FOUND - System has LibXml2
+# LIBXML2_INCLUDE_DIR - The LibXml2 include directory
+# LIBXML2_LIBRARIES - The libraries needed to use LibXml2
+# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
+# LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2
+# LIBXML2_VERSION_STRING - the version of LibXml2 found (since CMake 2.8.8)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake
index 7d142f430..2416341fb 100644
--- a/Modules/FindLibXslt.cmake
+++ b/Modules/FindLibXslt.cmake
@@ -1,14 +1,26 @@
-# - Try to find the LibXslt library
+#.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
+# ::
+#
+# 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.
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
new file mode 100644
index 000000000..731f5f222
--- /dev/null
+++ b/Modules/FindLua.cmake
@@ -0,0 +1,171 @@
+#.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/
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+# Copyright 2013 Rolf Eike Beer <eike@sf-mail.de>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+unset(_lua_include_subdirs)
+unset(_lua_library_names)
+
+# this is a function only to have all the variables inside go away automatically
+function(set_lua_version_vars)
+ set(LUA_VERSIONS5 5.3 5.2 5.1 5.0)
+
+ if (Lua_FIND_VERSION_EXACT)
+ if (Lua_FIND_VERSION_COUNT GREATER 1)
+ set(lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR})
+ endif ()
+ elseif (Lua_FIND_VERSION)
+ # once there is a different major version supported this should become a loop
+ if (NOT Lua_FIND_VERSION_MAJOR GREATER 5)
+ if (Lua_FIND_VERSION_COUNT EQUAL 1)
+ set(lua_append_versions ${LUA_VERSIONS5})
+ else ()
+ foreach (subver IN LISTS LUA_VERSIONS5)
+ if (NOT subver VERSION_LESS ${Lua_FIND_VERSION})
+ list(APPEND lua_append_versions ${subver})
+ endif ()
+ endforeach ()
+ endif ()
+ endif ()
+ else ()
+ # once there is a different major version supported this should become a loop
+ set(lua_append_versions ${LUA_VERSIONS5})
+ endif ()
+
+ foreach (ver IN LISTS lua_append_versions)
+ string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}")
+ list(APPEND _lua_include_subdirs
+ include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
+ include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+ include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+ )
+ list(APPEND _lua_library_names
+ lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
+ lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+ lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+ )
+ endforeach ()
+
+ set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
+ set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE)
+endfunction(set_lua_version_vars)
+
+set_lua_version_vars()
+
+find_path(LUA_INCLUDE_DIR lua.h
+ HINTS
+ ENV LUA_DIR
+ PATH_SUFFIXES ${_lua_include_subdirs} include/lua include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+)
+unset(_lua_include_subdirs)
+
+find_library(LUA_LIBRARY
+ NAMES ${_lua_library_names} lua
+ HINTS
+ ENV LUA_DIR
+ PATH_SUFFIXES lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+unset(_lua_library_names)
+
+if (LUA_LIBRARY)
+ # include the math library for Unix
+ if (UNIX AND NOT APPLE AND NOT BEOS)
+ find_library(LUA_MATH_LIBRARY m)
+ set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}")
+ # For Windows and Mac, don't need to explicitly include the math library
+ else ()
+ set(LUA_LIBRARIES "${LUA_LIBRARY}")
+ endif ()
+endif ()
+
+if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
+ # At least 5.[012] have different ways to express the version
+ # so all of them need to be tested. Lua 5.2 defines LUA_VERSION
+ # and LUA_RELEASE as joined by the C preprocessor, so avoid those.
+ file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_strings
+ REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*")
+
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};")
+ if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};")
+ set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
+ else ()
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+ if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+ endif ()
+ string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}")
+ string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}")
+ string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}")
+ endif ()
+
+ unset(lua_version_strings)
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
+# all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua
+ REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
+ VERSION_VAR LUA_VERSION_STRING)
+
+mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY)
diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake
index 0276a98f4..666d90960 100644
--- a/Modules/FindLua50.cmake
+++ b/Modules/FindLua50.cmake
@@ -1,15 +1,33 @@
-# 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)
+#.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"
+#
+# ::
+#
+# #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/
+#
+# ::
+#
+# #include <lua/lua.h>
+#
+# This is because, the lua location is not standardized and may exist in
+# locations other than lua/
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
index a2bf0c0ef..5b9ff91a7 100644
--- a/Modules/FindLua51.cmake
+++ b/Modules/FindLua51.cmake
@@ -1,16 +1,34 @@
-# 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)
+#.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"
+#
+# ::
+#
+# #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/
+#
+# ::
+#
+# #include <lua/lua.h>
+#
+# This is because, the lua location is not standardized and may exist in
+# locations other than lua/
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -54,7 +72,7 @@ find_library(LUA_LIBRARY
if(LUA_LIBRARY)
# include the math library for Unix
- if(UNIX AND NOT APPLE AND NOT BEOS)
+ if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake
index 4ff7586dc..35476289f 100644
--- a/Modules/FindMFC.cmake
+++ b/Modules/FindMFC.cmake
@@ -1,7 +1,16 @@
-# - 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
+#.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.
#=============================================================================
@@ -27,7 +36,7 @@ if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW)
endif()
if(MFC_ATTEMPT_TRY_COMPILE)
- if("MFC_HAVE_MFC" MATCHES "^MFC_HAVE_MFC$")
+ if(NOT DEFINED MFC_HAVE_MFC)
set(CHECK_INCLUDE_FILE_VAR "afxwin.h")
configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake
index f99f87b87..26ee8dd43 100644
--- a/Modules/FindMPEG.cmake
+++ b/Modules/FindMPEG.cmake
@@ -1,11 +1,23 @@
-# - Find the native MPEG includes and 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.
+#
+# ::
+#
+# 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.
+#
+# ::
+#
+# MPEG_mpeg2_LIBRARY, where to find the MPEG library.
+# MPEG_vo_LIBRARY, where to find the vo library.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake
index fc01c4c1d..f2f207610 100644
--- a/Modules/FindMPEG2.cmake
+++ b/Modules/FindMPEG2.cmake
@@ -1,11 +1,23 @@
-# - Find the native MPEG2 includes and 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.
+#
+# ::
+#
+# 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.
+#
+# ::
+#
+# MPEG2_mpeg2_LIBRARY, where to find the MPEG2 library.
+# MPEG2_vo_LIBRARY, where to find the vo library.
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 0eb86a80a..48adf3c1e 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1,64 +1,88 @@
-# - Find a Message Passing Interface (MPI) implementation
+#.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. All of them have somewhat different include paths,
-# libraries to link against, etc., and this module tries to smooth
-# out those differences.
+# 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. All
+# of them have somewhat different include paths, libraries to link
+# against, etc., and this module tries to smooth out those differences.
#
# === Variables ===
#
-# This module will set the following variables per language in your project,
-# where <lang> is one of C, CXX, or Fortran:
-# MPI_<lang>_FOUND TRUE if FindMPI found MPI flags for <lang>
-# MPI_<lang>_COMPILER MPI Compiler wrapper for <lang>
-# MPI_<lang>_COMPILE_FLAGS Compilation flags for MPI programs
-# MPI_<lang>_INCLUDE_PATH Include path(s) for MPI header
-# MPI_<lang>_LINK_FLAGS Linking flags for MPI programs
-# MPI_<lang>_LIBRARIES All libraries to link MPI programs against
+# This module will set the following variables per language in your
+# project, where <lang> is one of C, CXX, or Fortran:
+#
+# ::
+#
+# MPI_<lang>_FOUND TRUE if FindMPI found MPI flags for <lang>
+# MPI_<lang>_COMPILER MPI Compiler wrapper for <lang>
+# MPI_<lang>_COMPILE_FLAGS Compilation flags for MPI programs
+# MPI_<lang>_INCLUDE_PATH Include path(s) for MPI header
+# MPI_<lang>_LINK_FLAGS Linking flags for MPI programs
+# MPI_<lang>_LIBRARIES All libraries to link MPI programs against
+#
# Additionally, FindMPI sets the following variables for running MPI
# programs from the command line:
-# MPIEXEC Executable for running MPI programs
-# MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC before giving
-# it the number of processors to run on
-# MPIEXEC_PREFLAGS Flags to pass to MPIEXEC directly
-# before the executable to run.
-# MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after other flags
+#
+# ::
+#
+# MPIEXEC Executable for running MPI programs
+# MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC before giving
+# it the number of processors to run on
+# MPIEXEC_PREFLAGS Flags to pass to MPIEXEC directly
+# before the executable to run.
+# MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after other flags
+#
# === Usage ===
#
# To use this module, simply call FindMPI from a CMakeLists.txt file, or
-# run find_package(MPI), then run CMake. If you are happy with the auto-
-# detected configuration for your language, then you're done. If not, you
-# have two options:
-# 1. Set MPI_<lang>_COMPILER to the MPI wrapper (mpicc, etc.) of your
-# choice and reconfigure. FindMPI will attempt to determine all the
-# necessary variables using THAT compiler's compile and link flags.
-# 2. If this fails, or if your MPI implementation does not come with
-# a compiler wrapper, then set both MPI_<lang>_LIBRARIES and
-# MPI_<lang>_INCLUDE_PATH. You may also set any other variables
-# listed above, but these two are required. This will circumvent
-# autodetection entirely.
-# When configuration is successful, MPI_<lang>_COMPILER will be set to the
-# compiler wrapper for <lang>, if it was found. MPI_<lang>_FOUND and other
-# variables above will be set if any MPI implementation was found for <lang>,
-# regardless of whether a compiler was found.
-#
-# When using MPIEXEC to execute MPI applications, you should typically use
-# all of the MPIEXEC flags as follows:
-# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS
-# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS
-# where PROCS is the number of processors on which to execute the program,
-# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the
-# MPI program.
+# run find_package(MPI), then run CMake. If you are happy with the
+# auto- detected configuration for your language, then you're done. If
+# not, you have two options:
+#
+# ::
+#
+# 1. Set MPI_<lang>_COMPILER to the MPI wrapper (mpicc, etc.) of your
+# choice and reconfigure. FindMPI will attempt to determine all the
+# necessary variables using THAT compiler's compile and link flags.
+# 2. If this fails, or if your MPI implementation does not come with
+# a compiler wrapper, then set both MPI_<lang>_LIBRARIES and
+# MPI_<lang>_INCLUDE_PATH. You may also set any other variables
+# listed above, but these two are required. This will circumvent
+# autodetection entirely.
+#
+# When configuration is successful, MPI_<lang>_COMPILER will be set to
+# the compiler wrapper for <lang>, if it was found. MPI_<lang>_FOUND
+# and other variables above will be set if any MPI implementation was
+# found for <lang>, regardless of whether a compiler was found.
+#
+# When using MPIEXEC to execute MPI applications, you should typically
+# use all of the MPIEXEC flags as follows:
+#
+# ::
+#
+# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS
+# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS
+#
+# where PROCS is the number of processors on which to execute the
+# program, EXECUTABLE is the MPI program, and ARGS are the arguments to
+# pass to the MPI program.
#
# === Backward Compatibility ===
#
# For backward compatibility with older versions of FindMPI, these
# variables are set, but deprecated:
-# MPI_FOUND MPI_COMPILER MPI_LIBRARY
-# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_EXTRA_LIBRARY
-# MPI_LINK_FLAGS MPI_LIBRARIES
+#
+# ::
+#
+# MPI_FOUND MPI_COMPILER MPI_LIBRARY
+# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_EXTRA_LIBRARY
+# MPI_LINK_FLAGS MPI_LIBRARIES
+#
# In new projects, please use the MPI_<lang>_XXX equivalents.
#=============================================================================
@@ -78,7 +102,6 @@
# include this to handle the QUIETLY and REQUIRED arguments
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-include(${CMAKE_CURRENT_LIST_DIR}/GetPrerequisites.cmake)
#
# This part detects MPI compilers, attempting to wade through the mess of compiler names in
@@ -136,7 +159,7 @@ set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95
# or if we know it matches the regular compiler.
foreach (lang C CXX Fortran)
foreach (id GNU Intel PGI XL)
- if (NOT CMAKE_${lang}_COMPILER_ID OR "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "${id}")
+ if (NOT CMAKE_${lang}_COMPILER_ID OR CMAKE_${lang}_COMPILER_ID STREQUAL id)
list(APPEND _MPI_${lang}_COMPILER_NAMES ${_MPI_${id}_${lang}_COMPILER_NAMES})
endif()
unset(_MPI_${id}_${lang}_COMPILER_NAMES) # clean up the namespace here
@@ -150,6 +173,13 @@ set(_MPI_EXEC_NAMES mpiexec mpirun lamexec srun)
# Grab the path to MPI from the registry if we're on windows.
set(_MPI_PREFIX_PATH)
if(WIN32)
+ # MSMPI
+ file(TO_CMAKE_PATH "$ENV{MSMPI_BIN}" msmpi_bin_path) # The default path ends with a '\' and doesn't mix with ';' when appending.
+ list(APPEND _MPI_PREFIX_PATH "${msmpi_bin_path}")
+ unset(msmpi_bin_path)
+ list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]/Bin")
+ list(APPEND _MPI_PREFIX_PATH "$ENV{MSMPI_INC}/..") # The SDK is installed separately from the runtime
+ # MPICH
list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..")
list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]")
list(APPEND _MPI_PREFIX_PATH "$ENV{ProgramW6432}/MPICH2/")
@@ -164,6 +194,21 @@ foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH})
endforeach()
endforeach()
+function (_mpi_check_compiler compiler options cmdvar resvar)
+ execute_process(
+ COMMAND "${compiler}" ${options}
+ OUTPUT_VARIABLE cmdline OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE cmdline ERROR_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE success)
+ # Intel MPI 5.0.1 will return a zero return code even when the
+ # argument to the MPI compiler wrapper is unknown. Attempt to
+ # catch this case.
+ if(cmdline MATCHES "undefined reference" OR cmdline MATCHES "unrecognized")
+ set(success 255 )
+ endif()
+ set(${cmdvar} "${cmdline}" PARENT_SCOPE)
+ set(${resvar} "${success}" PARENT_SCOPE)
+endfunction()
#
# interrogate_mpi_compiler(lang try_libs)
@@ -196,12 +241,7 @@ function (interrogate_mpi_compiler lang try_libs)
if (MPI_${lang}_COMPILER)
# Check whether the -showme:compile option works. This indicates that we have either OpenMPI
# or a newer version of LAM-MPI, and implies that -showme:link will also work.
- execute_process(
- COMMAND ${MPI_${lang}_COMPILER} -showme:compile
- OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
- RESULT_VARIABLE MPI_COMPILER_RETURN)
-
+ _mpi_check_compiler("${MPI_${lang}_COMPILER}" "-showme:compile" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
if (MPI_COMPILER_RETURN EQUAL 0)
# If we appear to have -showme:compile, then we should
# also have -showme:link. Try it.
@@ -233,20 +273,12 @@ function (interrogate_mpi_compiler lang try_libs)
# Older versions of LAM-MPI have "-showme". Try to find that.
if (NOT MPI_COMPILER_RETURN EQUAL 0)
- execute_process(
- COMMAND ${MPI_${lang}_COMPILER} -showme
- OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
- RESULT_VARIABLE MPI_COMPILER_RETURN)
+ _mpi_check_compiler("${MPI_${lang}_COMPILER}" "-showme" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
endif()
# MVAPICH uses -compile-info and -link-info. Try them.
if (NOT MPI_COMPILER_RETURN EQUAL 0)
- execute_process(
- COMMAND ${MPI_${lang}_COMPILER} -compile-info
- OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
- RESULT_VARIABLE MPI_COMPILER_RETURN)
+ _mpi_check_compiler("${MPI_${lang}_COMPILER}" "-compile-info" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
# If we have compile-info, also have link-info.
if (MPI_COMPILER_RETURN EQUAL 0)
@@ -266,11 +298,7 @@ function (interrogate_mpi_compiler lang try_libs)
# MPICH just uses "-show". Try it.
if (NOT MPI_COMPILER_RETURN EQUAL 0)
- execute_process(
- COMMAND ${MPI_${lang}_COMPILER} -show
- OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
- RESULT_VARIABLE MPI_COMPILER_RETURN)
+ _mpi_check_compiler("${MPI_${lang}_COMPILER}" "-show" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
endif()
if (MPI_COMPILER_RETURN EQUAL 0)
@@ -306,7 +334,7 @@ function (interrogate_mpi_compiler lang try_libs)
string(REGEX MATCHALL "(^| )-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH})
- string(REGEX REPLACE "//" "/" IPATH ${IPATH})
+ string(REPLACE "//" "/" IPATH ${IPATH})
list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
endforeach()
@@ -330,7 +358,7 @@ function (interrogate_mpi_compiler lang try_libs)
set(MPI_LINK_PATH)
foreach(LPATH ${MPI_ALL_LINK_PATHS})
string(REGEX REPLACE "^(| |-Wl,)-L" "" LPATH ${LPATH})
- string(REGEX REPLACE "//" "/" LPATH ${LPATH})
+ string(REPLACE "//" "/" LPATH ${LPATH})
list(APPEND MPI_LINK_PATH ${LPATH})
endforeach()
@@ -341,7 +369,7 @@ function (interrogate_mpi_compiler lang try_libs)
endif()
# Extract linker flags from the link command line
- string(REGEX MATCHALL "(^| )-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+ string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
set(MPI_LINK_FLAGS_WORK)
foreach(FLAG ${MPI_ALL_LINK_FLAGS})
if (MPI_LINK_FLAGS_WORK)
@@ -354,19 +382,14 @@ function (interrogate_mpi_compiler lang try_libs)
# Extract the set of libraries to link against from the link command
# line
string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+
# add the compiler implicit directories because some compilers
# such as the intel compiler have libraries that show up
# in the showme list that can only be found in the implicit
- # link directories of the compiler. Do this for C++ and C
- # compilers if the implicit link directories are defined.
- if (DEFINED CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES)
- set(MPI_LINK_PATH
- "${MPI_LINK_PATH};${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}")
- endif ()
-
- if (DEFINED CMAKE_C_IMPLICIT_LINK_DIRECTORIES)
+ # link directories of the compiler.
+ if (DEFINED CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES)
set(MPI_LINK_PATH
- "${MPI_LINK_PATH};${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+ "${MPI_LINK_PATH};${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}")
endif ()
# Determine full path names for all of the libraries that one needs
@@ -404,16 +427,18 @@ function (interrogate_mpi_compiler lang try_libs)
# Decide between 32-bit and 64-bit libraries for Microsoft's MPI
if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
- set(MS_MPI_ARCH_DIR amd64)
+ set(MS_MPI_ARCH_DIR x64)
+ set(MS_MPI_ARCH_DIR2 amd64)
else()
- set(MS_MPI_ARCH_DIR i386)
+ set(MS_MPI_ARCH_DIR x86)
+ set(MS_MPI_ARCH_DIR2 i386)
endif()
set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
find_library(MPI_LIB
NAMES mpi mpich mpich2 msmpi
HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR})
+ PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR} Lib/${MS_MPI_ARCH_DIR2})
set(MPI_LIBRARIES_WORK ${MPI_LIB})
# Right now, we only know about the extra libs for C++.
@@ -503,6 +528,7 @@ endfunction()
# Most mpi distros have some form of mpiexec which gives us something we can reliably look for.
find_program(MPIEXEC
NAMES ${_MPI_EXEC_NAMES}
+ HINTS ${MPI_HOME} $ENV{MPI_HOME}
PATHS ${_MPI_PREFIX_PATH}
PATH_SUFFIXES bin
DOC "Executable for running MPI programs.")
@@ -551,21 +577,22 @@ foreach (lang C CXX Fortran)
if (CMAKE_${lang}_COMPILER_WORKS)
# If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler.
if (MPI_${lang}_COMPILER)
- is_file_executable(MPI_${lang}_COMPILER MPI_COMPILER_IS_EXECUTABLE)
- if (NOT MPI_COMPILER_IS_EXECUTABLE)
+ if (NOT IS_ABSOLUTE "${MPI_${lang}_COMPILER}")
# Get rid of our default list of names and just search for the name the user wants.
set(_MPI_${lang}_COMPILER_NAMES ${MPI_${lang}_COMPILER})
set(MPI_${lang}_COMPILER "MPI_${lang}_COMPILER-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
- # If the user specifies a compiler, we don't want to try to search libraries either.
- set(try_libs FALSE)
endif()
+ # If the user specifies a compiler, we don't want to try to search libraries either.
+ set(try_libs FALSE)
else()
set(try_libs TRUE)
endif()
find_program(MPI_${lang}_COMPILER
NAMES ${_MPI_${lang}_COMPILER_NAMES}
- PATHS "${MPI_HOME}/bin" "$ENV{MPI_HOME}/bin" ${_MPI_PREFIX_PATH})
+ HINTS ${_MPI_BASE_DIR}/bin
+ PATHS ${_MPI_PREFIX_PATH}
+ )
interrogate_mpi_compiler(${lang} ${try_libs})
mark_as_advanced(MPI_${lang}_COMPILER)
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 803848806..7a36719fb 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -1,13 +1,210 @@
-# - this module looks for Matlab
-# Defines:
-# MATLAB_INCLUDE_DIR: include path for mex.h, engine.h
-# MATLAB_LIBRARIES: required libraries: libmex, etc
-# MATLAB_MEX_LIBRARY: path to libmex.lib
-# MATLAB_MX_LIBRARY: path to libmx.lib
-# MATLAB_ENG_LIBRARY: path to libeng.lib
+#.rst:
+# FindMatlab
+# ----------
+#
+# Finds Matlab installations and provides Matlab tools and libraries to cmake.
+#
+# This package first intention is to find the libraries associated with Matlab
+# in order to be able to build Matlab extensions (mex files). It can also be
+# used:
+#
+# * run specific commands in Matlab
+# * declare Matlab unit test
+# * retrieve various information from Matlab (mex extensions, versions and
+# release queries, ...)
+#
+# The module supports the following components:
+#
+# * ``MX_LIBRARY`` and ``ENG_LIBRARY`` respectively the MX and ENG libraries of
+# Matlab
+# * ``MAIN_PROGRAM`` the Matlab binary program.
+#
+# .. 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` allow a mapping
+# from the release name to 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 are retrieved from the
+# Windows registry
+# * OS X: The installed versions of Matlab are given by the MATLAB
+# 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.
+#
+# Additional information is provided when :variable:`MATLAB_FIND_DEBUG` is set.
+# When a Matlab binary is found automatically and the ``MATLAB_VERSION``
+# is not given, the version is queried from Matlab directly.
+# On Windows, it can make a window running Matlab appear.
+#
+# 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_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 asked
+#
+# 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 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 dependant)
+# :command:`matlab_get_version_from_matlab_run`
+# returns the version of Matlab, given the full directory of the Matlab
+# program.
+#
+#
+# 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.
#=============================================================================
-# Copyright 2005-2009 Kitware, Inc.
+# Copyright 2014-2015 Raffi Enficiaud, Max Planck Society
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -19,102 +216,1250 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-set(MATLAB_FOUND 0)
-if(WIN32)
- if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
- set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc60")
+set(_FindMatlab_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}")
+
+include(FindPackageHandleStandardArgs)
+include(CheckCXXCompilerFlag)
+
+
+# The currently supported versions. Other version can be added by the user by
+# providing MATLAB_ADDITIONAL_VERSIONS
+if(NOT MATLAB_ADDITIONAL_VERSIONS)
+ set(MATLAB_ADDITIONAL_VERSIONS)
+endif()
+
+set(MATLAB_VERSIONS_MAPPING
+ "R2015b=8.6"
+ "R2015a=8.5"
+ "R2014b=8.4"
+ "R2014a=8.3"
+ "R2013b=8.2"
+ "R2013a=8.1"
+ "R2012b=8.0"
+ "R2012a=7.14"
+
+ "R2011b=7.13"
+ "R2011a=7.12"
+ "R2010b=7.11"
+
+ ${MATLAB_ADDITIONAL_VERSIONS}
+ )
+
+
+# temporary folder for all Matlab runs
+set(_matlab_temporary_folder ${CMAKE_BINARY_DIR}/Matlab)
+
+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)
+macro (matlab_get_version_from_release_name release_name version_name)
+
+ string(REGEX MATCHALL "${release_name}=([0-9]+\\.?[0-9]*)" _matched ${MATLAB_VERSIONS_MAPPING})
+
+ set(${version_name} "")
+ if(NOT _matched STREQUAL "")
+ set(${version_name} ${CMAKE_MATCH_1})
else()
- if(${CMAKE_GENERATOR} MATCHES "Visual Studio 7")
- # Assume people are generally using 7.1,
- # if using 7.0 need to link to: ../extern/lib/win32/microsoft/msvc70
- set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc71")
- else()
- if(${CMAKE_GENERATOR} MATCHES "Borland")
- # Same here, there are also: bcc50 and bcc51 directories
- set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/bcc54")
- else()
- if(MATLAB_FIND_REQUIRED)
- message(FATAL_ERROR "Generator not compatible: ${CMAKE_GENERATOR}")
- endif()
+ message(WARNING "The release name ${release_name} is not registered")
+ endif()
+ unset(_matched)
+
+endmacro()
+
+
+
+
+
+#.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} "")
+ foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING)
+ string(REGEX MATCHALL "(.+)=${version}" _matched ${_var})
+ if(NOT _matched STREQUAL "")
+ set(${release_name} ${CMAKE_MATCH_1})
+ break()
+ endif()
+ endforeach(_var)
+
+ unset(_var)
+ unset(_matched)
+ if(${release_name} STREQUAL "")
+ message(WARNING "The version ${version} is not registered")
+ endif()
+
+endmacro()
+
+
+
+
+
+# extracts all the supported release names (R2017k...) of Matlab
+# internal use
+macro(matlab_get_supported_releases list_releases)
+ set(${list_releases})
+ foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING)
+ string(REGEX MATCHALL "(.+)=([0-9]+\\.?[0-9]*)" _matched ${_var})
+ if(NOT _matched STREQUAL "")
+ list(APPEND ${list_releases} ${CMAKE_MATCH_1})
+ endif()
+ unset(_matched)
+ unset(CMAKE_MATCH_1)
+ endforeach(_var)
+ unset(_var)
+endmacro()
+
+
+
+# extracts all the supported versions of Matlab
+# internal use
+macro(matlab_get_supported_versions list_versions)
+ set(${list_versions})
+ foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING)
+ string(REGEX MATCHALL "(.+)=([0-9]+\\.?[0-9]*)" _matched ${_var})
+ if(NOT _matched STREQUAL "")
+ list(APPEND ${list_versions} ${CMAKE_MATCH_2})
+ endif()
+ unset(_matched)
+ unset(CMAKE_MATCH_1)
+ endforeach(_var)
+ unset(_var)
+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`` 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)
+ message(FATAL_ERROR "This macro can only be called by a windows host (call to reg.exe")
+ endif()
+
+
+ if(${win64} AND ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "64")
+ set(APPEND_REG "/reg:64")
+ else()
+ set(APPEND_REG "/reg:32")
+ endif()
+
+ # /reg:64 should be added on 64 bits capable OSs in order to enable the
+ # redirection of 64 bits applications
+ execute_process(
+ COMMAND reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Mathworks\\MATLAB /f * /k ${APPEND_REG}
+ RESULT_VARIABLE resultMatlab
+ OUTPUT_VARIABLE varMatlab
+ ERROR_VARIABLE errMatlab
+ INPUT_FILE NUL
+ )
+
+
+ set(matlabs_from_registry)
+ if(${resultMatlab} EQUAL 0)
+
+ string(
+ REGEX MATCHALL "MATLAB\\\\([0-9]+(\\.[0-9]+)?)"
+ matlab_versions_regex ${varMatlab})
+
+ foreach(match IN LISTS matlab_versions_regex)
+ string(
+ REGEX MATCH "MATLAB\\\\(([0-9]+)(\\.([0-9]+))?)"
+ current_match ${match})
+
+ set(_matlab_current_version ${CMAKE_MATCH_1})
+ set(current_matlab_version_major ${CMAKE_MATCH_2})
+ set(current_matlab_version_minor ${CMAKE_MATCH_4})
+ if(NOT current_matlab_version_minor)
+ set(current_matlab_version_minor "0")
endif()
+
+ list(APPEND matlabs_from_registry ${_matlab_current_version})
+ unset(_matlab_current_version)
+ endforeach(match)
+
+ endif()
+
+ if(matlabs_from_registry)
+ list(REMOVE_DUPLICATES matlabs_from_registry)
+ list(SORT matlabs_from_registry)
+ list(REVERSE matlabs_from_registry)
+ endif()
+
+ set(${matlab_versions} ${matlabs_from_registry} PARENT_SCOPE)
+
+endfunction()
+
+
+
+# (internal)
+macro(extract_matlab_versions_from_registry_brute_force matlab_versions)
+ # get the supported versions
+ set(matlab_supported_versions)
+ matlab_get_supported_versions(matlab_supported_versions)
+
+
+ # this is a manual population of the versions we want to look for
+ # this can be done as is, but preferably with the call to
+ # matlab_get_supported_versions and variable
+
+ # populating the versions we want to look for
+ # set(matlab_supported_versions)
+
+ # # Matlab 7
+ # set(matlab_major 7)
+ # foreach(current_matlab_minor RANGE 4 20)
+ # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}")
+ # endforeach(current_matlab_minor)
+
+ # # Matlab 8
+ # set(matlab_major 8)
+ # foreach(current_matlab_minor RANGE 0 5)
+ # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}")
+ # endforeach(current_matlab_minor)
+
+ # # taking into account the possible additional versions provided by the user
+ # if(DEFINED MATLAB_ADDITIONAL_VERSIONS)
+ # list(APPEND matlab_supported_versions MATLAB_ADDITIONAL_VERSIONS)
+ # endif()
+
+
+ # we order from more recent to older
+ if(matlab_supported_versions)
+ list(REMOVE_DUPLICATES matlab_supported_versions)
+ list(SORT matlab_supported_versions)
+ list(REVERSE matlab_supported_versions)
+ endif()
+
+
+ set(${matlab_versions} ${matlab_supported_versions})
+
+
+endmacro()
+
+
+
+
+#.rst:
+# .. command:: matlab_get_all_valid_matlab_roots_from_registry
+#
+# Populates the Matlab root with valid versions of Matlab.
+# The returned matlab_roots is organized in pairs
+# ``(version_number,matlab_root_path)``.
+#
+# ::
+#
+# matlab_get_all_valid_matlab_roots_from_registry(
+# matlab_versions
+# matlab_roots)
+#
+# ``matlab_versions``
+# the versions of each of the Matlab installations
+# ``matlab_roots``
+# the location of each of the Matlab installations
+function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_roots)
+
+ # The matlab_versions comes either from
+ # extract_matlab_versions_from_registry_brute_force or
+ # matlab_extract_all_installed_versions_from_registry.
+
+
+ set(_matlab_roots_list )
+ foreach(_matlab_current_version ${matlab_versions})
+ get_filename_component(
+ current_MATLAB_ROOT
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\${_matlab_current_version};MATLABROOT]"
+ ABSOLUTE)
+
+ if(EXISTS ${current_MATLAB_ROOT})
+ list(APPEND _matlab_roots_list ${_matlab_current_version} ${current_MATLAB_ROOT})
+ endif()
+
+ endforeach(_matlab_current_version)
+ unset(_matlab_current_version)
+ set(${matlab_roots} ${_matlab_roots_list} PARENT_SCOPE)
+ unset(_matlab_roots_list)
+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 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
+ # sufficient for all win32 distributions.
+ # there is also CMAKE_EXECUTABLE_SUFFIX that could be tweaked
+ set(mexext_suffix "")
+ if(WIN32)
+ list(APPEND mexext_suffix ".bat")
+ endif()
+
+ # we first try without suffix, since cmake does not understand a list with
+ # one empty string element
+ find_program(
+ Matlab_MEXEXTENSIONS_PROG
+ NAMES mexext
+ PATHS ${matlab_root}/bin
+ DOC "Matlab MEX extension provider"
+ NO_DEFAULT_PATH
+ )
+
+ foreach(current_mexext_suffix IN LISTS mexext_suffix)
+ if(NOT DEFINED Matlab_MEXEXTENSIONS_PROG OR NOT Matlab_MEXEXTENSIONS_PROG)
+ # this call should populate the cache automatically
+ find_program(
+ Matlab_MEXEXTENSIONS_PROG
+ "mexext${current_mexext_suffix}"
+ PATHS ${matlab_root}/bin
+ DOC "Matlab MEX extension provider"
+ NO_DEFAULT_PATH
+ )
+ endif()
+ endforeach(current_mexext_suffix)
+
+
+ # the program has been found?
+ if((NOT Matlab_MEXEXTENSIONS_PROG) OR (NOT EXISTS ${Matlab_MEXEXTENSIONS_PROG}))
+ if(MATLAB_FIND_DEBUG)
+ message(WARNING "[MATLAB] Cannot found mexext program. Matlab root is ${matlab_root}")
+ endif()
+ unset(Matlab_MEXEXTENSIONS_PROG CACHE)
+ return()
+ endif()
+
+ set(_matlab_mex_extension)
+
+ set(devnull)
+ if(UNIX)
+ set(devnull INPUT_FILE /dev/null)
+ elseif(WIN32)
+ set(devnull INPUT_FILE NUL)
+ endif()
+
+ execute_process(
+ COMMAND ${Matlab_MEXEXTENSIONS_PROG}
+ OUTPUT_VARIABLE _matlab_mex_extension
+ ERROR_VARIABLE _matlab_mex_extension_error
+ ${devnull})
+ string(STRIP ${_matlab_mex_extension} _matlab_mex_extension)
+
+ unset(Matlab_MEXEXTENSIONS_PROG CACHE)
+ set(${mex_suffix} ${_matlab_mex_extension} PARENT_SCOPE)
+endfunction()
+
+
+
+
+#.rst:
+# .. command:: matlab_get_version_from_matlab_run
+#
+# This function runs Matlab program specified on arguments and extracts its
+# version.
+#
+# ::
+#
+# 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)
+
+
+ if(MATLAB_FIND_DEBUG)
+ message(STATUS "[MATLAB] Determining the version of Matlab from ${matlab_binary_program}")
+ endif()
+
+ if(EXISTS "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp")
+ if(MATLAB_FIND_DEBUG)
+ message(STATUS "[MATLAB] Removing previous ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp file")
endif()
+ file(REMOVE "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp")
+ endif()
+
+
+ # the log file is needed since on windows the command executes in a new
+ # window and it is not possible to get back the answer of Matlab
+ # the -wait command is needed on windows, otherwise the call returns
+ # immediately after the program launches itself.
+ if(WIN32)
+ set(_matlab_additional_commands "-wait")
endif()
- find_library(MATLAB_MEX_LIBRARY
- libmex
- ${MATLAB_ROOT}
+
+ set(devnull)
+ if(UNIX)
+ set(devnull INPUT_FILE /dev/null)
+ elseif(WIN32)
+ set(devnull INPUT_FILE NUL)
+ endif()
+
+ # timeout set to 30 seconds, in case it does not start
+ # note as said before OUTPUT_VARIABLE cannot be used in a platform
+ # independent manner however, not setting it would flush the output of Matlab
+ # in the current console (unix variant)
+ execute_process(
+ COMMAND "${matlab_binary_program}" -nosplash -nojvm ${_matlab_additional_commands} -logfile "matlabVersionLog.cmaketmp" -nodesktop -nodisplay -r "version, exit"
+ OUTPUT_VARIABLE _matlab_version_from_cmd_dummy
+ RESULT_VARIABLE _matlab_result_version_call
+ ERROR_VARIABLE _matlab_result_version_call_error
+ TIMEOUT 30
+ WORKING_DIRECTORY "${_matlab_temporary_folder}"
+ ${devnull}
)
- find_library(MATLAB_MX_LIBRARY
- libmx
- ${MATLAB_ROOT}
+
+
+ if(${_matlab_result_version_call})
+ if(MATLAB_FIND_DEBUG)
+ message(WARNING "[MATLAB] Unable to determine the version of Matlab. Matlab call returned with error ${_matlab_result_version_call}.")
+ endif()
+ return()
+ elseif(NOT EXISTS "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp")
+ if(MATLAB_FIND_DEBUG)
+ message(WARNING "[MATLAB] Unable to determine the version of Matlab. The log file does not exist.")
+ endif()
+ return()
+ endif()
+
+ # if successful, read back the log
+ file(READ "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp" _matlab_version_from_cmd)
+ file(REMOVE "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp")
+
+ set(index -1)
+ string(FIND ${_matlab_version_from_cmd} "ans" index)
+ if(index EQUAL -1)
+
+ if(MATLAB_FIND_DEBUG)
+ message(WARNING "[MATLAB] Cannot find the version of Matlab returned by the run.")
+ endif()
+
+ else()
+ set(matlab_list_of_all_versions_tmp)
+
+ 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
+ ${substring_ans})
+ foreach(match IN LISTS matlab_versions_regex)
+ string(
+ REGEX MATCH "ans[\r\n\t ]*=[\r\n\t ]*(([0-9]+)(\\.([0-9]+))?)"
+ current_match ${match})
+
+ list(APPEND matlab_list_of_all_versions_tmp ${CMAKE_MATCH_1})
+ endforeach()
+ if(matlab_list_of_all_versions_tmp)
+ list(REMOVE_DUPLICATES matlab_list_of_all_versions_tmp)
+ endif()
+ set(${matlab_list_versions} ${matlab_list_of_all_versions_tmp} PARENT_SCOPE)
+
+ endif()
+
+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``.
+# 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
+# [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.
+# ``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.
+# ``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).
+#
+function(matlab_add_unit_test)
+
+ if(NOT Matlab_MAIN_PROGRAM)
+ message(FATAL_ERROR "[MATLAB] This functionality needs the MAIN_PROGRAM component (not default)")
+ endif()
+
+ set(options NO_UNITTEST_FRAMEWORK)
+ set(oneValueArgs NAME UNITTEST_PRECOMMAND UNITTEST_FILE TIMEOUT)
+ set(multiValueArgs ADDITIONAL_PATH MATLAB_ADDITIONAL_STARTUP_OPTIONS TEST_ARGS)
+
+ set(prefix _matlab_unittest_prefix)
+ cmake_parse_arguments(${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+
+ if(NOT ${prefix}_NAME)
+ message(FATAL_ERROR "[MATLAB] The Matlab test name cannot be empty")
+ endif()
+
+ add_test(NAME ${${prefix}_NAME}
+ COMMAND ${CMAKE_COMMAND}
+ -Dtest_name=${${prefix}_NAME}
+ -Dadditional_paths=${${prefix}_ADDITIONAL_PATH}
+ -Dtest_timeout=${${prefix}_TIMEOUT}
+ -Doutput_directory=${_matlab_temporary_folder}
+ -DMatlab_PROGRAM=${Matlab_MAIN_PROGRAM}
+ -Dno_unittest_framework=${${prefix}_NO_UNITTEST_FRAMEWORK}
+ -DMatlab_ADDITIONNAL_STARTUP_OPTIONS=${${prefix}_MATLAB_ADDITIONAL_STARTUP_OPTIONS}
+ -Dunittest_file_to_run=${${prefix}_UNITTEST_FILE}
+ -Dcmd_to_run_before_test=${${prefix}_UNITTEST_PRECOMMAND}
+ -P ${_FindMatlab_SELF_DIR}/MatlabTestsRedirect.cmake
+ ${${prefix}_TEST_ARGS}
+ ${${prefix}_UNPARSED_ARGUMENTS}
+ )
+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` command.
+#
+# ::
+#
+# matlab_add_mex(
+# NAME <name>
+# SRC src1 [src2 ...]
+# [OUTPUT_NAME output_name]
+# [DOCUMENTATION file.txt]
+# [LINK_TO target1 target2 ...]
+# [...]
+# )
+#
+# ``NAME``
+# name of the target.
+# ``SRC``
+# list of tje 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.
+#
+# 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)
+ # we do not need all this on Windows
+ # pthread options
+ check_cxx_compiler_flag(-pthread HAS_MINUS_PTHREAD)
+ # we should use try_compile instead, the link flags are discarded from
+ # this compiler_flag function.
+ #check_cxx_compiler_flag(-Wl,--exclude-libs,ALL HAS_SYMBOL_HIDING_CAPABILITY)
+
+ endif()
+
+ set(oneValueArgs NAME DOCUMENTATION OUTPUT_NAME)
+ set(multiValueArgs LINK_TO SRC)
+
+ set(prefix _matlab_addmex_prefix)
+ cmake_parse_arguments(${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+
+ if(NOT ${prefix}_NAME)
+ message(FATAL_ERROR "[MATLAB] The MEX target name cannot be empty")
+ endif()
+
+ if(NOT ${prefix}_OUTPUT_NAME)
+ set(${prefix}_OUTPUT_NAME ${${prefix}_NAME})
+ endif()
+
+ add_library(${${prefix}_NAME}
+ SHARED
+ ${${prefix}_SRC}
+ ${${prefix}_DOCUMENTATION}
+ ${${prefix}_UNPARSED_ARGUMENTS})
+ target_include_directories(${${prefix}_NAME} PRIVATE ${Matlab_INCLUDE_DIRS})
+
+ if(DEFINED Matlab_MX_LIBRARY)
+ target_link_libraries(${${prefix}_NAME} ${Matlab_MX_LIBRARY})
+ endif()
+
+ target_link_libraries(${${prefix}_NAME} ${Matlab_MEX_LIBRARY} ${${prefix}_LINK_TO})
+ set_target_properties(${${prefix}_NAME}
+ PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME ${${prefix}_OUTPUT_NAME}
+ SUFFIX ".${Matlab_MEX_EXTENSION}")
+
+
+ # documentation
+ if(NOT ${${prefix}_DOCUMENTATION} STREQUAL "")
+ get_target_property(output_name ${${prefix}_NAME} OUTPUT_NAME)
+ add_custom_command(
+ TARGET ${${prefix}_NAME}
+ PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${${prefix}_DOCUMENTATION} $<TARGET_FILE_DIR:${${prefix}_NAME}>/${output_name}.m
+ COMMENT "Copy ${${prefix}_NAME} documentation file into the output folder"
)
- find_library(MATLAB_ENG_LIBRARY
- libeng
- ${MATLAB_ROOT}
+ endif() # documentation
+
+ # entry point in the mex file + taking care of visibility and symbol clashes.
+ 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")
+ 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.
+
+ set_target_properties(${${prefix}_NAME}
+ PROPERTIES
+ CXX_VISIBILITY_PRESET "hidden"
+ C_VISIBILITY_PRESET "hidden"
+ VISIBILITY_INLINES_HIDDEN ON
)
- find_path(MATLAB_INCLUDE_DIR
- "mex.h"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/include"
+ # 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_target_properties(${${prefix}_NAME}
+ PROPERTIES
+ DEFINE_SYMBOL "DLL_EXPORT_SYM=__attribute__ ((visibility (\"default\")))"
)
-else()
- if(CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Regular x86
- set(MATLAB_ROOT
- /usr/local/matlab-7sp1/bin/glnx86/
- /opt/matlab-7sp1/bin/glnx86/
- $ENV{HOME}/matlab-7sp1/bin/glnx86/
- $ENV{HOME}/redhat-matlab/bin/glnx86/
+
+
+ endif()
+
+endfunction()
+
+
+# (internal)
+# Used to get the version of matlab, using caching. This basically transforms the
+# output of the root list, with possible unknown version, to a version
+#
+function(_Matlab_get_version_from_root matlab_root matlab_known_version matlab_final_version)
+
+ # if the version is not trivial, we query matlab for that
+ # we keep track of the location of matlab that induced this version
+ #if(NOT DEFINED Matlab_PROG_VERSION_STRING_AUTO_DETECT)
+ # set(Matlab_PROG_VERSION_STRING_AUTO_DETECT "" CACHE INTERNAL "internal matlab location for the discovered version")
+ #endif()
+
+ if(NOT ${matlab_known_version} STREQUAL "NOTFOUND")
+ # the version is known, we just return it
+ set(${matlab_final_version} ${matlab_known_version} PARENT_SCOPE)
+ set(Matlab_VERSION_STRING_INTERNAL ${matlab_known_version} CACHE INTERNAL "Matlab version (automatically determined)" FORCE)
+ return()
+ endif()
+
+ #
+ set(_matlab_current_program ${Matlab_MAIN_PROGRAM})
+
+ # do we already have a matlab program?
+ if(NOT _matlab_current_program)
+
+ set(_find_matlab_options)
+ if(matlab_root AND EXISTS ${matlab_root})
+ set(_find_matlab_options PATHS ${matlab_root} ${matlab_root}/bin NO_DEFAULT_PATH)
+ endif()
+
+ find_program(
+ _matlab_current_program
+ matlab
+ ${_find_matlab_options}
+ DOC "Matlab main program"
)
+ endif()
+
+ if(NOT _matlab_current_program OR NOT EXISTS ${_matlab_current_program})
+ # if not found, clear the dependent variables
+ if(MATLAB_FIND_DEBUG)
+ message(WARNING "[MATLAB] Cannot find the main matlab program under ${matlab_root}")
+ endif()
+ set(Matlab_PROG_VERSION_STRING_AUTO_DETECT "" CACHE INTERNAL "internal matlab location for the discovered version" FORCE)
+ set(Matlab_VERSION_STRING_INTERNAL "" CACHE INTERNAL "internal matlab location for the discovered version" FORCE)
+ unset(_matlab_current_program)
+ unset(_matlab_current_program CACHE)
+ return()
+ endif()
+
+ # full real path for path comparison
+ get_filename_component(_matlab_main_real_path_tmp "${_matlab_current_program}" REALPATH)
+ unset(_matlab_current_program)
+ unset(_matlab_current_program CACHE)
+
+ # is it the same as the previous one?
+ if(_matlab_main_real_path_tmp STREQUAL Matlab_PROG_VERSION_STRING_AUTO_DETECT)
+ set(${matlab_final_version} ${Matlab_VERSION_STRING_INTERNAL} PARENT_SCOPE)
+ return()
+ endif()
+
+ # update the location of the program
+ set(Matlab_PROG_VERSION_STRING_AUTO_DETECT ${_matlab_main_real_path_tmp} CACHE INTERNAL "internal matlab location for the discovered version" FORCE)
+
+ set(matlab_list_of_all_versions)
+ matlab_get_version_from_matlab_run("${Matlab_PROG_VERSION_STRING_AUTO_DETECT}" matlab_list_of_all_versions)
+
+ list(GET matlab_list_of_all_versions 0 _matlab_version_tmp)
+
+ # set the version into the cache
+ set(Matlab_VERSION_STRING_INTERNAL ${_matlab_version_tmp} CACHE INTERNAL "Matlab version (automatically determined)" FORCE)
+
+ # warning, just in case several versions found (should not happen)
+ list(LENGTH matlab_list_of_all_versions list_of_all_versions_length)
+ if((${list_of_all_versions_length} GREATER 1) AND MATLAB_FIND_DEBUG)
+ message(WARNING "[MATLAB] Found several versions, taking the first one (versions found ${matlab_list_of_all_versions})")
+ endif()
+
+ # return the updated value
+ set(${matlab_final_version} ${Matlab_VERSION_STRING_INTERNAL} PARENT_SCOPE)
+
+endfunction()
+
+
+
+
+
+
+
+# ###################################
+# Exploring the possible Matlab_ROOTS
+
+# this variable will get all Matlab installations found in the current system.
+set(_matlab_possible_roots)
+
+
+
+if(Matlab_ROOT_DIR)
+ # if the user specifies a possible root, we keep this one
+
+ if(NOT EXISTS ${Matlab_ROOT_DIR})
+ # if Matlab_ROOT_DIR specified but erroneous
+ if(MATLAB_FIND_DEBUG)
+ message(WARNING "[MATLAB] the specified path for Matlab_ROOT_DIR does not exist (${Matlab_ROOT_DIR})")
+ endif()
else()
- # AMD64:
- set(MATLAB_ROOT
- /usr/local/matlab-7sp1/bin/glnxa64/
- /opt/matlab-7sp1/bin/glnxa64/
- $ENV{HOME}/matlab7_64/bin/glnxa64/
- $ENV{HOME}/matlab-7sp1/bin/glnxa64/
- $ENV{HOME}/redhat-matlab/bin/glnxa64/
- )
+ # NOTFOUND indicates the code below to search for the version automatically
+ if("${Matlab_VERSION_STRING_INTERNAL}" STREQUAL "")
+ list(APPEND _matlab_possible_roots "NOTFOUND" ${Matlab_ROOT_DIR}) # empty version
+ else()
+ list(APPEND _matlab_possible_roots ${Matlab_VERSION_STRING_INTERNAL} ${Matlab_ROOT_DIR}) # cached version
+ endif()
+ endif()
+
+
+else()
+
+ # if the user does not specify the possible installation root, we look for
+ # one installation using the appropriate heuristics
+
+ if(WIN32)
+
+ # On WIN32, we look for Matlab installation in the registry
+ # if unsuccessful, we look for all known revision and filter the existing
+ # ones.
+
+ # testing if we are able to extract the needed information from the registry
+ set(_matlab_versions_from_registry)
+ matlab_extract_all_installed_versions_from_registry(CMAKE_CL_64 _matlab_versions_from_registry)
+
+ # the returned list is empty, doing the search on all known versions
+ if(NOT _matlab_versions_from_registry)
+
+ if(MATLAB_FIND_DEBUG)
+ message(STATUS "[MATLAB] Search for Matlab from the registry unsuccessful, testing all supported versions")
+ endif()
+
+ extract_matlab_versions_from_registry_brute_force(_matlab_versions_from_registry)
+ endif()
+
+ # filtering the results with the registry keys
+ matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots)
+ unset(_matlab_versions_from_registry)
+
+ elseif(APPLE)
+
+ # on mac, we look for the /Application paths
+ # this corresponds to the behaviour on Windows. On Linux, we do not have
+ # any other guess.
+ matlab_get_supported_releases(_matlab_releases)
+ if(MATLAB_FIND_DEBUG)
+ message(STATUS "[MATLAB] Matlab supported versions ${_matlab_releases}. If more version should be supported "
+ "the variable MATLAB_ADDITIONAL_VERSIONS can be set according to the documentation")
+ endif()
+
+ foreach(_matlab_current_release IN LISTS _matlab_releases)
+ set(_matlab_full_string "/Applications/MATLAB_${_matlab_current_release}.app")
+ if(EXISTS ${_matlab_full_string})
+ set(_matlab_current_version)
+ matlab_get_version_from_release_name("${_matlab_current_release}" _matlab_current_version)
+ if(MATLAB_FIND_DEBUG)
+ message(STATUS "[MATLAB] Found version ${_matlab_current_release} (${_matlab_current_version}) in ${_matlab_full_string}")
+ endif()
+ list(APPEND _matlab_possible_roots ${_matlab_current_version} ${_matlab_full_string})
+ unset(_matlab_current_version)
+ endif()
+
+ unset(_matlab_full_string)
+ endforeach(_matlab_current_release)
+
+ unset(_matlab_current_release)
+ unset(_matlab_releases)
+
endif()
- find_library(MATLAB_MEX_LIBRARY
- mex
- ${MATLAB_ROOT}
- )
- find_library(MATLAB_MX_LIBRARY
- mx
- ${MATLAB_ROOT}
- )
- find_library(MATLAB_ENG_LIBRARY
- eng
- ${MATLAB_ROOT}
- )
- find_path(MATLAB_INCLUDE_DIR
- "mex.h"
- "/usr/local/matlab-7sp1/extern/include/"
- "/opt/matlab-7sp1/extern/include/"
- "$ENV{HOME}/matlab-7sp1/extern/include/"
- "$ENV{HOME}/redhat-matlab/extern/include/"
- )
endif()
-# This is common to UNIX and Win32:
-set(MATLAB_LIBRARIES
- ${MATLAB_MEX_LIBRARY}
- ${MATLAB_MX_LIBRARY}
- ${MATLAB_ENG_LIBRARY}
+
+
+list(LENGTH _matlab_possible_roots _numbers_of_matlab_roots)
+if(_numbers_of_matlab_roots EQUAL 0)
+ # if we have not found anything, we fall back on the PATH
+
+
+ # At this point, we have no other choice than trying to find it from PATH.
+ # If set by the user, this wont change
+ find_program(
+ _matlab_main_tmp
+ NAMES matlab)
+
+
+ if(_matlab_main_tmp)
+ # we then populate the list of roots, with empty version
+ if(MATLAB_FIND_DEBUG)
+ message(STATUS "[MATLAB] matlab found from PATH: ${_matlab_main_tmp}")
+ endif()
+
+ # resolve symlinks
+ get_filename_component(_matlab_current_location "${_matlab_main_tmp}" REALPATH)
+
+ # get the directory (the command below has to be run twice)
+ # this will be the matlab root
+ get_filename_component(_matlab_current_location "${_matlab_current_location}" DIRECTORY)
+ get_filename_component(_matlab_current_location "${_matlab_current_location}" DIRECTORY) # Matlab should be in bin
+
+ list(APPEND _matlab_possible_roots "NOTFOUND" ${_matlab_current_location})
+
+ unset(_matlab_current_location)
+
+ endif()
+ unset(_matlab_main_tmp CACHE)
+
+endif()
+
+
+
+
+
+if(MATLAB_FIND_DEBUG)
+ message(STATUS "[MATLAB] Matlab root folders are ${_matlab_possible_roots}")
+endif()
+
+
+
+
+
+# take the first possible Matlab root
+list(LENGTH _matlab_possible_roots _numbers_of_matlab_roots)
+set(Matlab_VERSION_STRING "NOTFOUND")
+if(_numbers_of_matlab_roots GREATER 0)
+ list(GET _matlab_possible_roots 0 Matlab_VERSION_STRING)
+ list(GET _matlab_possible_roots 1 Matlab_ROOT_DIR)
+
+ # adding a warning in case of ambiguity
+ if(_numbers_of_matlab_roots GREATER 2 AND MATLAB_FIND_DEBUG)
+ message(WARNING "[MATLAB] Found several distributions of Matlab. Setting the current version to ${Matlab_VERSION_STRING} (located ${Matlab_ROOT_DIR})."
+ " If this is not the desired behaviour, provide the -DMatlab_ROOT_DIR=... on the command line")
+ endif()
+endif()
+
+
+# check if the root changed against the previous defined one, if so
+# clear all the cached variables
+if(DEFINED Matlab_ROOT_DIR_LAST_CACHED)
+
+ if(NOT Matlab_ROOT_DIR_LAST_CACHED STREQUAL Matlab_ROOT_DIR)
+ set(_Matlab_cached_vars
+ Matlab_INCLUDE_DIRS
+ Matlab_MEX_LIBRARY
+ Matlab_MEX_COMPILER
+ Matlab_MAIN_PROGRAM
+ Matlab_MX_LIBRARY
+ Matlab_ENG_LIBRARY
+ Matlab_MEX_EXTENSION
+
+ # internal
+ Matlab_MEXEXTENSIONS_PROG
+ Matlab_ROOT_DIR_LAST_CACHED
+ #Matlab_PROG_VERSION_STRING_AUTO_DETECT
+ Matlab_VERSION_STRING_INTERNAL
+ )
+ foreach(_var IN LISTS _Matlab_cached_vars)
+ if(DEFINED ${_var})
+ unset(${_var} CACHE)
+ endif()
+ endforeach()
+ endif()
+endif()
+
+set(Matlab_ROOT_DIR_LAST_CACHED ${Matlab_ROOT_DIR} CACHE INTERNAL "last Matlab root dir location")
+set(Matlab_ROOT_DIR ${Matlab_ROOT_DIR} CACHE PATH "Matlab installation root path" FORCE)
+
+# Fix the version, in case this one is NOTFOUND
+_Matlab_get_version_from_root(
+ "${Matlab_ROOT_DIR}"
+ ${Matlab_VERSION_STRING}
+ Matlab_VERSION_STRING
)
-if(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES)
- set(MATLAB_FOUND 1)
+
+
+
+if(MATLAB_FIND_DEBUG)
+ message(STATUS "[MATLAB] Current version is ${Matlab_VERSION_STRING} located ${Matlab_ROOT_DIR}")
+endif()
+
+
+
+if(Matlab_ROOT_DIR)
+ file(TO_CMAKE_PATH ${Matlab_ROOT_DIR} Matlab_ROOT_DIR)
+endif()
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(_matlab_64Build FALSE)
+else()
+ set(_matlab_64Build TRUE)
+endif()
+
+if(APPLE)
+ set(_matlab_bin_prefix "mac") # i should be for intel
+ set(_matlab_bin_suffix_32bits "i")
+ set(_matlab_bin_suffix_64bits "i64")
+elseif(UNIX)
+ set(_matlab_bin_prefix "gln")
+ set(_matlab_bin_suffix_32bits "x86")
+ set(_matlab_bin_suffix_64bits "xa64")
+else()
+ set(_matlab_bin_prefix "win")
+ set(_matlab_bin_suffix_32bits "32")
+ set(_matlab_bin_suffix_64bits "64")
+endif()
+
+
+
+set(MATLAB_INCLUDE_DIR_TO_LOOK ${Matlab_ROOT_DIR}/extern/include)
+if(_matlab_64Build)
+ set(_matlab_current_suffix ${_matlab_bin_suffix_64bits})
+else()
+ set(_matlab_current_suffix ${_matlab_bin_suffix_32bits})
+endif()
+
+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})
+
+if(WIN32)
+ set(_matlab_lib_dir_for_search ${Matlab_EXTERN_LIBRARY_DIR}/microsoft)
+ set(_matlab_lib_prefix_for_search "lib")
+else()
+ set(_matlab_lib_dir_for_search ${Matlab_BINARIES_DIR})
+ set(_matlab_lib_prefix_for_search "lib")
+endif()
+
+unset(_matlab_64Build)
+
+
+if(NOT DEFINED Matlab_MEX_EXTENSION)
+ set(_matlab_mex_extension "")
+ matlab_get_mex_suffix("${Matlab_ROOT_DIR}" _matlab_mex_extension)
+
+ # This variable goes to the cache.
+ set(Matlab_MEX_EXTENSION ${_matlab_mex_extension} CACHE STRING "Extensions for the mex targets (automatically given by Matlab)")
+ unset(_matlab_mex_extension)
+endif()
+
+
+if(MATLAB_FIND_DEBUG)
+ message(STATUS "[MATLAB] [DEBUG]_matlab_lib_prefix_for_search = ${_matlab_lib_prefix_for_search} | _matlab_lib_dir_for_search = ${_matlab_lib_dir_for_search}")
endif()
-mark_as_advanced(
- MATLAB_LIBRARIES
- MATLAB_MEX_LIBRARY
- MATLAB_MX_LIBRARY
- MATLAB_ENG_LIBRARY
- MATLAB_INCLUDE_DIR
- MATLAB_FOUND
- MATLAB_ROOT
+
+
+# internal
+# This small stub around find_library is to prevent any pollution of CMAKE_FIND_LIBRARY_PREFIXES in the global scope.
+# This is the function to be used below instead of the find_library directives.
+function(_Matlab_find_library _matlab_library_prefix)
+ set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} ${_matlab_library_prefix})
+ find_library(${ARGN})
+endfunction()
+
+
+set(_matlab_required_variables)
+
+
+# the MEX library/header are required
+find_path(
+ Matlab_INCLUDE_DIRS
+ mex.h
+ PATHS ${MATLAB_INCLUDE_DIR_TO_LOOK}
+ NO_DEFAULT_PATH
+ )
+list(APPEND _matlab_required_variables Matlab_INCLUDE_DIRS)
+
+_Matlab_find_library(
+ ${_matlab_lib_prefix_for_search}
+ Matlab_MEX_LIBRARY
+ mex
+ PATHS ${_matlab_lib_dir_for_search}
+ NO_DEFAULT_PATH
)
+
+list(APPEND _matlab_required_variables Matlab_MEX_LIBRARY)
+
+# the MEX extension is required
+list(APPEND _matlab_required_variables Matlab_MEX_EXTENSION)
+
+# the matlab root is required
+list(APPEND _matlab_required_variables Matlab_ROOT_DIR)
+
+
+# component Mex Compiler
+list(FIND Matlab_FIND_COMPONENTS MEX_COMPILER _matlab_find_mex_compiler)
+if(_matlab_find_mex_compiler GREATER -1)
+ find_program(
+ Matlab_MEX_COMPILER
+ "mex"
+ PATHS ${Matlab_BINARIES_DIR}
+ DOC "Matlab MEX compiler"
+ NO_DEFAULT_PATH
+ )
+
+ if(Matlab_MEX_COMPILER)
+ set(Matlab_MEX_COMPILER_FOUND TRUE)
+ endif()
+endif()
+unset(_matlab_find_mex_compiler)
+
+# component Matlab program
+list(FIND Matlab_FIND_COMPONENTS MAIN_PROGRAM _matlab_find_matlab_program)
+if(_matlab_find_matlab_program GREATER -1)
+
+ find_program(
+ Matlab_MAIN_PROGRAM
+ matlab
+ PATHS ${Matlab_ROOT_DIR} ${Matlab_ROOT_DIR}/bin
+ DOC "Matlab main program"
+ NO_DEFAULT_PATH
+ )
+
+ if(Matlab_MAIN_PROGRAM)
+ set(Matlab_MAIN_PROGRAM_FOUND TRUE)
+ endif()
+
+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()
+endif()
+unset(_matlab_find_mx)
+
+
+# Component ENG library
+list(FIND Matlab_FIND_COMPONENTS ENG_LIBRARY _matlab_find_eng)
+if(_matlab_find_eng GREATER -1)
+ _Matlab_find_library(
+ ${_matlab_lib_prefix_for_search}
+ Matlab_ENG_LIBRARY
+ eng
+ PATHS ${_matlab_lib_dir_for_search}
+ NO_DEFAULT_PATH
+ )
+ if(Matlab_ENG_LIBRARY)
+ set(Matlab_ENG_LIBRARY_FOUND TRUE)
+ endif()
+endif()
+unset(_matlab_find_eng)
+
+
+
+
+
+unset(_matlab_lib_dir_for_search)
+
+
+set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY})
+
+
+find_package_handle_standard_args(
+ Matlab
+ FOUND_VAR Matlab_FOUND
+ REQUIRED_VARS ${_matlab_required_variables}
+ VERSION_VAR Matlab_VERSION_STRING
+ HANDLE_COMPONENTS)
+
+unset(_matlab_required_variables)
+unset(_matlab_bin_prefix)
+unset(_matlab_bin_suffix_32bits)
+unset(_matlab_bin_suffix_64bits)
+unset(_matlab_current_suffix)
+unset(_matlab_lib_dir_for_search)
+unset(_matlab_lib_prefix_for_search)
+
+if(Matlab_INCLUDE_DIRS AND Matlab_LIBRARIES)
+ mark_as_advanced(
+ #Matlab_LIBRARIES
+ Matlab_MEX_LIBRARY
+ Matlab_MX_LIBRARY
+ Matlab_ENG_LIBRARY
+ Matlab_INCLUDE_DIRS
+ Matlab_FOUND
+ #Matlab_ROOT_DIR
+ #Matlab_VERSION_STRING
+ Matlab_MAIN_PROGRAM
+ #Matlab_MEX_EXTENSION
+ Matlab_MEXEXTENSIONS_PROG
+ Matlab_MEX_EXTENSION
+ #Matlab_BINARIES_DIR
+ )
+endif()
diff --git a/Modules/FindMotif.cmake b/Modules/FindMotif.cmake
index 5065e3a2d..a08ece444 100644
--- a/Modules/FindMotif.cmake
+++ b/Modules/FindMotif.cmake
@@ -1,8 +1,16 @@
-# - Try to find Motif (or lesstif)
+#.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
+#
+# ::
+#
+# MOTIF_FOUND - system has MOTIF
+# MOTIF_INCLUDE_DIR - include paths to use Motif
+# MOTIF_LIBRARIES - Link these to use Motif
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake
index 78fd632a5..eb63cef5a 100644
--- a/Modules/FindOpenAL.cmake
+++ b/Modules/FindOpenAL.cmake
@@ -1,14 +1,18 @@
-# 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
+#.rst:
+# FindOpenAL
+# ----------
#
-# $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.
+#
+# 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.
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
@@ -75,11 +79,17 @@ find_path(OPENAL_INCLUDE_DIR al.h
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
)
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_OpenAL_ARCH_DIR libs/Win64)
+else()
+ set(_OpenAL_ARCH_DIR libs/Win32)
+endif()
+
find_library(OPENAL_LIBRARY
NAMES OpenAL al openal OpenAL32
HINTS
ENV OPENALDIR
- PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
+ PATH_SUFFIXES lib64 lib libs64 libs ${_OpenAL_ARCH_DIR}
PATHS
~/Library/Frameworks
/Library/Frameworks
@@ -90,6 +100,7 @@ find_library(OPENAL_LIBRARY
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
)
+unset(_OpenAL_ARCH_DIR)
# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
# all listed variables are TRUE
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
new file mode 100644
index 000000000..4d3ed842c
--- /dev/null
+++ b/Modules/FindOpenCL.cmake
@@ -0,0 +1,136 @@
+#.rst:
+# FindOpenCL
+# ----------
+#
+# Try to find OpenCL
+#
+# Once done this will define::
+#
+# OpenCL_FOUND - True if OpenCL was found
+# OpenCL_INCLUDE_DIRS - include directories for OpenCL
+# OpenCL_LIBRARIES - link against this library to use OpenCL
+# OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
+# OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation
+# OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation
+#
+# The module will also define two cache variables::
+#
+# OpenCL_INCLUDE_DIR - the OpenCL include directory
+# OpenCL_LIBRARY - the path to the OpenCL library
+#
+
+#=============================================================================
+# Copyright 2014 Matthaeus G. Chajdas
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+function(_FIND_OPENCL_VERSION)
+ include(CheckSymbolExists)
+ include(CMakePushCheckState)
+ set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY})
+
+ CMAKE_PUSH_CHECK_STATE()
+ foreach(VERSION "2_0" "1_2" "1_1" "1_0")
+ set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}")
+
+ if(APPLE)
+ CHECK_SYMBOL_EXISTS(
+ CL_VERSION_${VERSION}
+ "${OpenCL_INCLUDE_DIR}/OpenCL/cl.h"
+ OPENCL_VERSION_${VERSION})
+ else()
+ CHECK_SYMBOL_EXISTS(
+ CL_VERSION_${VERSION}
+ "${OpenCL_INCLUDE_DIR}/CL/cl.h"
+ OPENCL_VERSION_${VERSION})
+ endif()
+
+ if(OPENCL_VERSION_${VERSION})
+ string(REPLACE "_" "." VERSION "${VERSION}")
+ set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE)
+ string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}")
+ list(GET version_components 0 major_version)
+ list(GET version_components 1 minor_version)
+ set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE)
+ set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE)
+ break()
+ endif()
+ endforeach()
+ CMAKE_POP_CHECK_STATE()
+endfunction()
+
+find_path(OpenCL_INCLUDE_DIR
+ NAMES
+ CL/cl.h OpenCL/cl.h
+ PATHS
+ ENV "PROGRAMFILES(X86)"
+ ENV AMDAPPSDKROOT
+ ENV INTELOCLSDKROOT
+ ENV NVSDKCOMPUTE_ROOT
+ ENV CUDA_PATH
+ ENV ATISTREAMSDKROOT
+ PATH_SUFFIXES
+ include
+ OpenCL/common/inc
+ "AMD APP/include")
+
+_FIND_OPENCL_VERSION()
+
+if(WIN32)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ find_library(OpenCL_LIBRARY
+ NAMES OpenCL
+ PATHS
+ ENV "PROGRAMFILES(X86)"
+ ENV AMDAPPSDKROOT
+ ENV INTELOCLSDKROOT
+ ENV CUDA_PATH
+ ENV NVSDKCOMPUTE_ROOT
+ ENV ATISTREAMSDKROOT
+ PATH_SUFFIXES
+ "AMD APP/lib/x86"
+ lib/x86
+ lib/Win32
+ OpenCL/common/lib/Win32)
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ find_library(OpenCL_LIBRARY
+ NAMES OpenCL
+ PATHS
+ ENV "PROGRAMFILES(X86)"
+ ENV AMDAPPSDKROOT
+ ENV INTELOCLSDKROOT
+ ENV CUDA_PATH
+ ENV NVSDKCOMPUTE_ROOT
+ ENV ATISTREAMSDKROOT
+ PATH_SUFFIXES
+ "AMD APP/lib/x86_64"
+ lib/x86_64
+ lib/x64
+ OpenCL/common/lib/x64)
+ endif()
+else()
+ find_library(OpenCL_LIBRARY
+ NAMES OpenCL)
+endif()
+
+set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
+set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR})
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(
+ OpenCL
+ FOUND_VAR OpenCL_FOUND
+ REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR
+ VERSION_VAR OpenCL_VERSION_STRING)
+
+mark_as_advanced(
+ OpenCL_INCLUDE_DIR
+ OpenCL_LIBRARY)
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 83fcc3dc7..93e488bf9 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -1,19 +1,39 @@
-# - Try to find OpenGL
-# Once done this will define
+#.rst:
+# FindOpenGL
+# ----------
#
-# OPENGL_FOUND - system has OpenGL
-# OPENGL_XMESA_FOUND - system has XMESA
-# OPENGL_GLU_FOUND - system has GLU
-# OPENGL_INCLUDE_DIR - the GL include directory
-# OPENGL_LIBRARIES - Link these to use OpenGL and GLU
+# FindModule for OpenGL and GLU.
#
-# If you want to use just GL you can use these values
-# OPENGL_gl_LIBRARY - Path to OpenGL Library
-# OPENGL_glu_LIBRARY - Path to GLU Library
+# Result Variables
+# ^^^^^^^^^^^^^^^^
#
-# On OSX default to using the framework version of opengl
-# People will have to change the cache values of OPENGL_glu_LIBRARY
-# and OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX
+# This module sets the following variables:
+#
+# ``OPENGL_FOUND``
+# True, if the system has OpenGL.
+# ``OPENGL_XMESA_FOUND``
+# True, if the system has XMESA.
+# ``OPENGL_GLU_FOUND``
+# True, if the system has GLU.
+# ``OPENGL_INCLUDE_DIR``
+# Path to the OpenGL include directory.
+# ``OPENGL_LIBRARIES``
+# Paths to the OpenGL and GLU libraries.
+#
+# If you want to use just GL you can use these values:
+#
+# ``OPENGL_gl_LIBRARY``
+# Path to the OpenGL library.
+# ``OPENGL_glu_LIBRARY``
+# Path to the GLU library.
+#
+# OSX Specific
+# ^^^^^^^^^^^^
+#
+# On OSX default to using the framework version of OpenGL. People will
+# have to change the cache values of OPENGL_glu_LIBRARY and
+# OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX.
+
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -51,9 +71,11 @@ elseif (WIN32)
elseif (APPLE)
- find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX")
- find_library(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX")
- find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX")
+ # The OpenGL.framework provides both gl and glu
+ find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X")
+ find_library(OPENGL_glu_LIBRARY OpenGL DOC
+ "GLU library for OS X (usually same as OpenGL library)")
+ find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OS X")
list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR)
else()
@@ -108,19 +130,6 @@ else()
unset(_OPENGL_INCLUDE_PATH)
unset(_OPENGL_LIB_PATH)
- # On Unix OpenGL most certainly always requires X11.
- # Feel free to tighten up these conditions if you don't
- # think this is always true.
-
- if (OPENGL_gl_LIBRARY)
- if(NOT X11_FOUND)
- include(${CMAKE_CURRENT_LIST_DIR}/FindX11.cmake)
- endif()
- if (X11_FOUND)
- set (OPENGL_LIBRARIES ${X11_LIBRARIES})
- endif ()
- endif ()
-
find_library(OPENGL_glu_LIBRARY
NAMES GLU MesaGLU
PATHS ${OPENGL_gl_LIBRARY}
@@ -142,7 +151,9 @@ if(OPENGL_gl_LIBRARY)
set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
if(OPENGL_glu_LIBRARY)
set( OPENGL_GLU_FOUND "YES" )
- set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
+ if(NOT "${OPENGL_glu_LIBRARY}" STREQUAL "${OPENGL_gl_LIBRARY}")
+ set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
+ endif()
else()
set( OPENGL_GLU_FOUND "NO" )
endif()
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 8afad6822..ee4bdd6c8 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -1,21 +1,34 @@
-# - 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
+#.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.
#
# The following variables are set:
-# OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support
-# OpenMP_CXX_FLAGS - flags to add to the CXX compiler for OpenMP support
-# OPENMP_FOUND - true if openmp is detected
#
-# Supported compilers can be found at http://openmp.org/wp/openmp-compilers/
+# ::
+#
+# OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support
+# OpenMP_CXX_FLAGS - flags to add to the CXX compiler for OpenMP support
+# OpenMP_Fortran_FLAGS - flags to add to the Fortran compiler for OpenMP support
+# OPENMP_FOUND - true if openmp is detected
+#
+#
+#
+# Supported compilers can be found at
+# http://openmp.org/wp/openmp-compilers/
#=============================================================================
# Copyright 2009 Kitware, Inc.
# Copyright 2008-2009 André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no>
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
+# Copyright 2014 Nicolas Bock <nicolasbock@gmail.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -28,6 +41,8 @@
# License text for the above reference.)
set(_OPENMP_REQUIRED_VARS)
+set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+set(CMAKE_REQUIRED_QUIET ${OpenMP_FIND_QUIETLY})
function(_OPENMP_FLAG_CANDIDATES LANG)
set(OpenMP_FLAG_CANDIDATES
@@ -35,6 +50,8 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
" "
#GNU
"-fopenmp"
+ #Clang
+ "-fopenmp=libomp"
#Microsoft Visual Studio
"/openmp"
#Intel windows
@@ -52,11 +69,15 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
)
set(OMP_FLAG_GNU "-fopenmp")
+ set(OMP_FLAG_Clang "-fopenmp=libomp")
set(OMP_FLAG_HP "+Oopenmp")
if(WIN32)
set(OMP_FLAG_Intel "-Qopenmp")
- else()
+ elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "Intel" AND
+ "${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528")
set(OMP_FLAG_Intel "-openmp")
+ else()
+ set(OMP_FLAG_Intel "-qopenmp")
endif()
set(OMP_FLAG_MIPSpro "-mp")
set(OMP_FLAG_MSVC "/openmp")
@@ -90,6 +111,17 @@ int main() {
}
")
+# same in Fortran
+set(OpenMP_Fortran_TEST_SOURCE
+ "
+ program test
+ use omp_lib
+ integer :: n
+ n = omp_get_num_threads()
+ end program test
+ "
+ )
+
# check c compiler
if(CMAKE_C_COMPILER_LOADED)
# if these are set then do not try to find them again,
@@ -105,7 +137,9 @@ if(CMAKE_C_COMPILER_LOADED)
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
unset(OpenMP_FLAG_DETECTED CACHE)
- message(STATUS "Try OpenMP C flag = [${FLAG}]")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Try OpenMP C flag = [${FLAG}]")
+ endif()
check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
if(OpenMP_FLAG_DETECTED)
@@ -139,7 +173,9 @@ if(CMAKE_CXX_COMPILER_LOADED)
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
unset(OpenMP_FLAG_DETECTED CACHE)
- message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
+ endif()
check_cxx_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
if(OpenMP_FLAG_DETECTED)
@@ -156,6 +192,42 @@ if(CMAKE_CXX_COMPILER_LOADED)
unset(OpenMP_CXX_TEST_SOURCE)
endif()
+# check Fortran compiler
+if(CMAKE_Fortran_COMPILER_LOADED)
+ # if these are set then do not try to find them again,
+ # by avoiding any try_compiles for the flags
+ if(OpenMP_Fortran_FLAGS)
+ unset(OpenMP_Fortran_FLAG_CANDIDATES)
+ else()
+ _OPENMP_FLAG_CANDIDATES("Fortran")
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranSourceCompiles.cmake)
+ endif()
+
+ foreach(FLAG IN LISTS OpenMP_Fortran_FLAG_CANDIDATES)
+ set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+ set(CMAKE_REQUIRED_FLAGS "${FLAG}")
+ unset(OpenMP_FLAG_DETECTED CACHE)
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Try OpenMP Fortran flag = [${FLAG}]")
+ endif()
+ check_fortran_source_compiles("${OpenMP_Fortran_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
+ set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+ if(OpenMP_FLAG_DETECTED)
+ set(OpenMP_Fortran_FLAGS_INTERNAL "${FLAG}")
+ break()
+ endif()
+ endforeach()
+
+ set(OpenMP_Fortran_FLAGS "${OpenMP_Fortran_FLAGS_INTERNAL}"
+ CACHE STRING "Fortran compiler flags for OpenMP parallization")
+
+ list(APPEND _OPENMP_REQUIRED_VARS OpenMP_Fortran_FLAGS)
+ unset(OpenMP_Fortran_FLAG_CANDIDATES)
+ unset(OpenMP_Fortran_TEST_SOURCE)
+endif()
+
+set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
+
if(_OPENMP_REQUIRED_VARS)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 9851f67ad..8b4b9883a 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -1,13 +1,43 @@
-# - Try to find the OpenSSL encryption library
-# Once done this will define
+#.rst:
+# FindOpenSSL
+# -----------
#
-# OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL
+# Find the OpenSSL encryption library.
#
-# Read-Only variables:
-# OPENSSL_FOUND - system has the OpenSSL library
-# OPENSSL_INCLUDE_DIR - the OpenSSL include directory
-# OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
-# OPENSSL_VERSION - This is set to $major.$minor.$revision$path (eg. 0.9.8s)
+# 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.
+# ``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.
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -29,6 +59,16 @@ if (UNIX)
pkg_check_modules(_OPENSSL QUIET openssl)
endif ()
+# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
+if(OPENSSL_USE_STATIC_LIBS)
+ set(_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ if(WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ else()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
+ endif()
+endif()
+
if (WIN32)
# http://www.slproweb.com/products/Win32OpenSSL.html
set(_OPENSSL_ROOT_HINTS
@@ -47,10 +87,6 @@ if (WIN32)
"C:/OpenSSL-Win64/"
)
unset(_programfiles)
- set(_OPENSSL_ROOT_HINTS_AND_PATHS
- HINTS ${_OPENSSL_ROOT_HINTS}
- PATHS ${_OPENSSL_ROOT_PATHS}
- )
else ()
set(_OPENSSL_ROOT_HINTS
${OPENSSL_ROOT_DIR}
@@ -58,12 +94,17 @@ else ()
)
endif ()
+set(_OPENSSL_ROOT_HINTS_AND_PATHS
+ HINTS ${_OPENSSL_ROOT_HINTS}
+ PATHS ${_OPENSSL_ROOT_PATHS}
+ )
+
find_path(OPENSSL_INCLUDE_DIR
NAMES
openssl/ssl.h
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS
${_OPENSSL_INCLUDEDIR}
- ${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
include
)
@@ -73,7 +114,7 @@ if(WIN32 AND NOT CYGWIN)
# /MD and /MDd are the standard values - if someone wants to use
# others, the libnames have to change here too
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
- # TODO: handle /MT and static lib
+ # enable OPENSSL_MSVC_STATIC_RT to get the libs build /MT (Multithreaded no-DLL)
# In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
# * MD for dynamic-release
# * MDd for dynamic-debug
@@ -84,49 +125,63 @@ if(WIN32 AND NOT CYGWIN)
# We are using the libraries located in the VC subdir instead of the parent directory eventhough :
# libeay32MD.lib is identical to ../libeay32.lib, and
# ssleay32MD.lib is identical to ../ssleay32.lib
+ # enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static
+
+ if (OPENSSL_MSVC_STATIC_RT)
+ set(_OPENSSL_MSVC_RT_MODE "MT")
+ else ()
+ set(_OPENSSL_MSVC_RT_MODE "MD")
+ endif ()
+
+ if(OPENSSL_USE_STATIC_LIBS)
+ set(_OPENSSL_PATH_SUFFIXES
+ "lib"
+ "VC/static"
+ "lib/VC/static"
+ )
+ else()
+ set(_OPENSSL_PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+ endif ()
+
find_library(LIB_EAY_DEBUG
NAMES
- libeay32MDd
+ libeay32${_OPENSSL_MSVC_RT_MODE}d
libeay32d
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
- "lib"
- "VC"
- "lib/VC"
+ ${_OPENSSL_PATH_SUFFIXES}
)
find_library(LIB_EAY_RELEASE
NAMES
- libeay32MD
+ libeay32${_OPENSSL_MSVC_RT_MODE}
libeay32
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
- "lib"
- "VC"
- "lib/VC"
+ ${_OPENSSL_PATH_SUFFIXES}
)
find_library(SSL_EAY_DEBUG
NAMES
- ssleay32MDd
+ ssleay32${_OPENSSL_MSVC_RT_MODE}d
ssleay32d
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
- "lib"
- "VC"
- "lib/VC"
+ ${_OPENSSL_PATH_SUFFIXES}
)
find_library(SSL_EAY_RELEASE
NAMES
- ssleay32MD
+ ssleay32${_OPENSSL_MSVC_RT_MODE}
ssleay32
ssl
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
- "lib"
- "VC"
- "lib/VC"
+ ${_OPENSSL_PATH_SUFFIXES}
)
set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}")
@@ -138,15 +193,15 @@ if(WIN32 AND NOT CYGWIN)
select_library_configurations(LIB_EAY)
select_library_configurations(SSL_EAY)
- set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} )
+ mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE
+ SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE)
+ set(OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} )
+ set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} )
+ set(OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} )
elseif(MINGW)
# same player, for MinGW
- set(LIB_EAY_NAMES libeay32)
- set(SSL_EAY_NAMES ssleay32)
- if(CMAKE_CROSSCOMPILING)
- list(APPEND LIB_EAY_NAMES crypto)
- list(APPEND SSL_EAY_NAMES ssl)
- endif()
+ set(LIB_EAY_NAMES crypto libeay32)
+ set(SSL_EAY_NAMES ssl ssleay32)
find_library(LIB_EAY
NAMES
${LIB_EAY_NAMES}
@@ -166,7 +221,9 @@ if(WIN32 AND NOT CYGWIN)
)
mark_as_advanced(SSL_EAY LIB_EAY)
- set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
+ set(OPENSSL_SSL_LIBRARY ${SSL_EAY} )
+ set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} )
+ set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
unset(LIB_EAY_NAMES)
unset(SSL_EAY_NAMES)
else()
@@ -174,9 +231,9 @@ if(WIN32 AND NOT CYGWIN)
find_library(LIB_EAY
NAMES
libeay32
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS
${_OPENSSL_LIBDIR}
- ${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
lib
)
@@ -184,15 +241,17 @@ if(WIN32 AND NOT CYGWIN)
find_library(SSL_EAY
NAMES
ssleay32
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS
${_OPENSSL_LIBDIR}
- ${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
lib
)
mark_as_advanced(SSL_EAY LIB_EAY)
- set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
+ set(OPENSSL_SSL_LIBRARY ${SSL_EAY} )
+ set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} )
+ set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
endif()
else()
@@ -201,9 +260,9 @@ else()
ssl
ssleay32
ssleay32MD
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS
${_OPENSSL_LIBDIR}
- ${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
lib
)
@@ -211,9 +270,9 @@ else()
find_library(OPENSSL_CRYPTO_LIBRARY
NAMES
crypto
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS
${_OPENSSL_LIBDIR}
- ${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
lib
)
@@ -260,11 +319,9 @@ function(from_hex HEX DEC)
endfunction()
if (OPENSSL_INCLUDE_DIR)
- if (_OPENSSL_VERSION)
- set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
- elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
+ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
- REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
+ REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
# The status gives if this is a developer or prerelease and is ignored here.
@@ -317,3 +374,71 @@ else ()
endif ()
mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
+
+if(OPENSSL_FOUND)
+ if(NOT TARGET OpenSSL::Crypto AND
+ (EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR
+ EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR
+ EXISTS "${LIB_EAY_LIBRARY_RELEASE}")
+ )
+ add_library(OpenSSL::Crypto UNKNOWN IMPORTED)
+ set_target_properties(OpenSSL::Crypto PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")
+ if(EXISTS "${OPENSSL_CRYPTO_LIBRARY}")
+ set_target_properties(OpenSSL::Crypto PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARY}")
+ endif()
+ if(EXISTS "${LIB_EAY_LIBRARY_DEBUG}")
+ set_property(TARGET OpenSSL::Crypto APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(OpenSSL::Crypto PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${LIB_EAY_LIBRARY_DEBUG}")
+ endif()
+ if(EXISTS "${LIB_EAY_LIBRARY_RELEASE}")
+ set_property(TARGET OpenSSL::Crypto APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(OpenSSL::Crypto PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
+ IMPORTED_LOCATION_RELEASE "${LIB_EAY_LIBRARY_RELEASE}")
+ endif()
+ endif()
+ if(NOT TARGET OpenSSL::SSL AND
+ (EXISTS "${OPENSSL_SSL_LIBRARY}" OR
+ EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR
+ EXISTS "${SSL_EAY_LIBRARY_RELEASE}")
+ )
+ add_library(OpenSSL::SSL UNKNOWN IMPORTED)
+ set_target_properties(OpenSSL::SSL PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")
+ if(EXISTS "${OPENSSL_SSL_LIBRARY}")
+ set_target_properties(OpenSSL::SSL PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${OPENSSL_SSL_LIBRARY}")
+ endif()
+ if(EXISTS "${SSL_EAY_LIBRARY_DEBUG}")
+ set_property(TARGET OpenSSL::SSL APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(OpenSSL::SSL PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${SSL_EAY_LIBRARY_DEBUG}")
+ endif()
+ if(EXISTS "${SSL_EAY_LIBRARY_RELEASE}")
+ set_property(TARGET OpenSSL::SSL APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(OpenSSL::SSL PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
+ IMPORTED_LOCATION_RELEASE "${SSL_EAY_LIBRARY_RELEASE}")
+ endif()
+ if(TARGET OpenSSL::Crypto)
+ set_target_properties(OpenSSL::SSL PROPERTIES
+ INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
+ endif()
+ endif()
+endif()
+
+# Restore the original find library ordering
+if(OPENSSL_USE_STATIC_LIBS)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+endif()
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 7affca8a2..5a800e476 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -1,55 +1,99 @@
-# - 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
+#.rst:
+# FindOpenSceneGraph
+# ------------------
#
-# 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.
+# 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_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
+# OpenSceneGraph_MARK_AS_ADVANCED - Mark cache variables as advanced
+# automatically
#
-# [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.
+#
+#
+# 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_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
+# OPENSCENEGRAPH_VERSION - The version of the OSG which was found
#
-#==================================
-# 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})
+# ::
#
+# 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})
#=============================================================================
# Copyright 2009 Kitware, Inc.
@@ -160,8 +204,11 @@ foreach(_osg_module ${_osg_modules_to_process})
find_package(${_osg_module} ${_osg_quiet})
string(TOUPPER ${_osg_module} _osg_module_UC)
- list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR})
- list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES})
+ # append to list if module was found OR is required
+ if( ${_osg_module_UC}_FOUND OR OpenSceneGraph_FIND_REQUIRED )
+ list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR})
+ list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES})
+ endif()
if(OpenSceneGraph_MARK_AS_ADVANCED)
OSG_MARK_AS_ADVANCED(${_osg_module})
diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake
index e0599604a..69bab3dd0 100644
--- a/Modules/FindOpenThreads.cmake
+++ b/Modules/FindOpenThreads.cmake
@@ -1,23 +1,25 @@
-# OpenThreads is a C++ based threading library. Its largest userbase
+#.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.
+# 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
+# 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.
+# $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.
+# [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.
diff --git a/Modules/FindPHP4.cmake b/Modules/FindPHP4.cmake
index 4267ac155..25fff8c73 100644
--- a/Modules/FindPHP4.cmake
+++ b/Modules/FindPHP4.cmake
@@ -1,11 +1,17 @@
-# - 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:
+#.rst:
+# FindPHP4
+# --------
#
-# PHP4_INCLUDE_PATH = path to where php.h can be found
-# PHP4_EXECUTABLE = full path to the php4 binary
+# 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
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
@@ -40,7 +46,7 @@ if(PHP4_FOUND_INCLUDE_PATH)
foreach(php4_path Zend main TSRM)
set(php4_paths ${php4_paths} "${PHP4_FOUND_INCLUDE_PATH}/${php4_path}")
endforeach()
- set(PHP4_INCLUDE_PATH "${php4_paths}" INTERNAL "PHP4 include paths")
+ set(PHP4_INCLUDE_PATH "${php4_paths}")
endif()
find_program(PHP4_EXECUTABLE NAMES php4 php )
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index a2577d26b..cae41acd9 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -1,22 +1,50 @@
-# - Find the native PNG includes and library
+#.rst:
+# FindPNG
+# -------
#
-# This module searches libpng, the library for working with PNG images.
+# Find libpng, the official reference library for the PNG image format.
#
-# It defines the following variables
-# PNG_INCLUDE_DIRS, where to find png.h, etc.
-# PNG_LIBRARIES, the libraries to link against to use PNG.
-# PNG_DEFINITIONS - You should add_definitons(${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)
-# Also defined, but not for general use are
-# PNG_LIBRARY, where to find the PNG library.
-# For backward compatiblity the variable PNG_INCLUDE_DIR is also set. It has the same value as PNG_INCLUDE_DIRS.
+# Imported targets
+# ^^^^^^^^^^^^^^^^
#
-# Since PNG depends on the ZLib compression library, none of the above will be
-# defined unless ZLib can be found.
+# 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_definitons(${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.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
+# Copyright 2016 Raumfeld
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -41,10 +69,8 @@ if(ZLIB_FOUND)
list(APPEND PNG_NAMES png libpng)
unset(PNG_NAMES_DEBUG)
set(_PNG_VERSION_SUFFIXES 17 16 15 14 12)
- if (PNG_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\..*)?$")
- string(REGEX REPLACE
- "^([0-9]+)\\.([0-9]+).*" "\\1\\2"
- _PNG_VERSION_SUFFIX_MIN "${PNG_FIND_VERSION}")
+ if (PNG_FIND_VERSION MATCHES "^([0-9]+)\\.([0-9]+)(\\..*)?$")
+ set(_PNG_VERSION_SUFFIX_MIN "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
if (PNG_FIND_VERSION_EXACT)
set(_PNG_VERSION_SUFFIXES ${_PNG_VERSION_SUFFIX_MIN})
else ()
@@ -89,6 +115,32 @@ if(ZLIB_FOUND)
endif()
endif ()
+ if(NOT TARGET PNG::PNG)
+ add_library(PNG::PNG UNKNOWN IMPORTED)
+ set_target_properties(PNG::PNG PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS "${PNG_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PNG_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
+ if(EXISTS "${PNG_LIBRARY}")
+ set_target_properties(PNG::PNG PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${PNG_LIBRARY}")
+ endif()
+ if(EXISTS "${PNG_LIBRARY_DEBUG}")
+ set_property(TARGET PNG::PNG APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(PNG::PNG PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${PNG_LIBRARY_DEBUG}")
+ endif()
+ if(EXISTS "${PNG_LIBRARY_RELEASE}")
+ set_property(TARGET PNG::PNG APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(PNG::PNG PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
+ IMPORTED_LOCATION_RELEASE "${PNG_LIBRARY_RELEASE}")
+ endif()
+ endif()
endif ()
if (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h")
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index 70423a7e4..fe2dbeaa6 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -1,90 +1,130 @@
-# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> ... )
-#
-# This function is intended to be used in FindXXX.cmake modules files.
-# It handles the REQUIRED, QUIET and version-related arguments to find_package().
-# It also sets the <packagename>_FOUND variable.
-# The package is considered found if all variables <var1>... listed contain
-# valid results, e.g. valid filepaths.
-#
-# There are two modes of this function. The first argument in both modes is
-# the name of the Find-module where it is called (in original casing).
-#
-# The first simple mode looks like this:
-# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> (DEFAULT_MSG|"Custom failure message") <var1>...<varN> )
-# If the variables <var1> to <varN> are all valid, then <UPPERCASED_NAME>_FOUND
-# will be set to TRUE.
-# If DEFAULT_MSG is given as second argument, then the function will generate
-# itself useful success and error messages. You can also supply a custom error message
-# for the failure case. This is not recommended.
-#
-# The second mode is more powerful and also supports version checking:
-# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [FOUND_VAR <resultVar>]
-# [REQUIRED_VARS <var1>...<varN>]
-# [VERSION_VAR <versionvar>]
-# [HANDLE_COMPONENTS]
-# [CONFIG_MODE]
-# [FAIL_MESSAGE "Custom failure message"] )
-#
-# In this mode, the name of the result-variable can be set either to either
-# <UPPERCASED_NAME>_FOUND or <OriginalCase_Name>_FOUND using the FOUND_VAR option.
-# Other names for the result-variable are not allowed.
-# So for a Find-module named FindFooBar.cmake, the two possible names are
-# FooBar_FOUND and FOOBAR_FOUND. It is recommended to use the original case version.
-# If the FOUND_VAR option is not used, the default is <UPPERCASED_NAME>_FOUND.
-#
-# As in the simple mode, if <var1> through <varN> are all valid,
-# <packagename>_FOUND will be set to TRUE.
-# After REQUIRED_VARS the variables which are required for this package are listed.
-# Following VERSION_VAR the name of the variable can be specified which holds
-# the version of the package which has been found. If this is done, this version
-# will be checked against the (potentially) specified required version used
-# in the find_package() call. The EXACT keyword is also handled. The default
-# messages include information about the required version and the version
-# which has been actually found, both if the version is ok or not.
-# If the package supports components, use the HANDLE_COMPONENTS option to enable
-# handling them. In this case, find_package_handle_standard_args() will report
-# which components have been found and which are missing, and the <packagename>_FOUND
-# variable will be set to FALSE if any of the required components (i.e. not the
-# ones listed after OPTIONAL_COMPONENTS) are missing.
-# Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for
-# a find_package(... NO_MODULE) call. In this case VERSION_VAR will be set
-# to <NAME>_VERSION and the macro will automatically check whether the
-# Config module was found.
-# Via FAIL_MESSAGE a custom failure message can be specified, if this is not
-# used, the default message will be displayed.
-#
-# Example for mode 1:
-#
-# find_package_handle_standard_args(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
-#
-# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and
-# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
-# If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
-# independent whether QUIET was used or not.
-# If it is found, success will be reported, including the content of <var1>.
-# On repeated Cmake runs, the same message won't be printed again.
-#
-# Example for mode 2:
-#
-# find_package_handle_standard_args(LibXslt FOUND_VAR LibXslt_FOUND
-# REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS
-# VERSION_VAR LibXslt_VERSION_STRING)
-# In this case, LibXslt is considered to be found if the variable(s) listed
-# after REQUIRED_VAR are all valid, i.e. LibXslt_LIBRARIES and LibXslt_INCLUDE_DIRS
-# in this case. The result will then be stored in LibXslt_FOUND .
-# Also the version of LibXslt will be checked by using the version contained
-# in LibXslt_VERSION_STRING.
-# Since no FAIL_MESSAGE is given, the default messages will be printed.
-#
-# Another example for mode 2:
-#
-# find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
-# find_package_handle_standard_args(Automoc4 CONFIG_MODE)
-# In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4 NO_MODULE)
-# and adds an additional search directory for automoc4.
-# Here the result will be stored in AUTOMOC4_FOUND.
-# The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper
-# success/error message.
+#[=======================================================================[.rst:
+FindPackageHandleStandardArgs
+-----------------------------
+
+This module provides a function intended to be used in :ref:`Find Modules`
+implementing :command:`find_package(<PackageName>)` calls. It handles the
+``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``.
+It also sets the ``<PackageName>_FOUND`` variable. The package is
+considered found if all variables listed contain valid results, e.g.
+valid filepaths.
+
+.. command:: find_package_handle_standard_args
+
+ There are two signatures::
+
+ find_package_handle_standard_args(<PackageName>
+ (DEFAULT_MSG|<custom-failure-message>)
+ <required-var>...
+ )
+
+ find_package_handle_standard_args(<PackageName>
+ [FOUND_VAR <result-var>]
+ [REQUIRED_VARS <required-var>...]
+ [VERSION_VAR <version-var>]
+ [HANDLE_COMPONENTS]
+ [CONFIG_MODE]
+ [FAIL_MESSAGE <custom-failure-message>]
+ )
+
+ The ``<PackageName>_FOUND`` variable will be set to ``TRUE`` if all
+ the variables ``<required-var>...`` are valid and any optional
+ constraints are satisfied, and ``FALSE`` otherwise. A success or
+ failure message may be displayed based on the results and on
+ whether the ``REQUIRED`` and/or ``QUIET`` option was given to
+ the :command:`find_package` call.
+
+ The options are:
+
+ ``(DEFAULT_MSG|<custom-failure-message>)``
+ In the simple signature this specifies the failure message.
+ Use ``DEFAULT_MSG`` to ask for a default message to be computed
+ (recommended). Not valid in the full signature.
+
+ ``FOUND_VAR <result-var>``
+ Obsolete. Specifies either ``<PackageName>_FOUND`` or
+ ``<PACKAGENAME>_FOUND`` as the result variable. This exists only
+ for compatibility with older versions of CMake and is now ignored.
+ Result variables of both names are always set for compatibility.
+
+ ``REQUIRED_VARS <required-var>...``
+ Specify the variables which are required for this package.
+ These may be named in the generated failure message asking the
+ user to set the missing variable values. Therefore these should
+ typically be cache entries such as ``FOO_LIBRARY`` and not output
+ variables like ``FOO_LIBRARIES``.
+
+ ``VERSION_VAR <version-var>``
+ Specify the name of a variable that holds the version of the package
+ that has been found. This version will be checked against the
+ (potentially) specified required version given to the
+ :command:`find_package` call, including its ``EXACT`` option.
+ The default messages include information about the required
+ version and the version which has been actually found, both
+ if the version is ok or not.
+
+ ``HANDLE_COMPONENTS``
+ Enable handling of package components. In this case, the command
+ will report which components have been found and which are missing,
+ and the ``<PackageName>_FOUND`` variable will be set to ``FALSE``
+ if any of the required components (i.e. not the ones listed after
+ the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are
+ missing.
+
+ ``CONFIG_MODE``
+ Specify that the calling find module is a wrapper around a
+ call to ``find_package(<PackageName> NO_MODULE)``. This implies
+ a ``VERSION_VAR`` value of ``<PackageName>_VERSION``. The command
+ will automatically check whether the package configuration file
+ was found.
+
+ ``FAIL_MESSAGE <custom-failure-message>``
+ Specify a custom failure message instead of using the default
+ generated message. Not recommended.
+
+Example for the simple signature:
+
+.. code-block:: cmake
+
+ find_package_handle_standard_args(LibXml2 DEFAULT_MSG
+ LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
+
+The ``LibXml2`` package is considered to be found if both
+``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid.
+Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found
+and ``REQUIRED`` was used, it fails with a
+:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was
+used or not. If it is found, success will be reported, including
+the content of the first ``<required-var>``. On repeated CMake runs,
+the same message will not be printed again.
+
+Example for the full signature:
+
+.. code-block:: cmake
+
+ find_package_handle_standard_args(LibArchive
+ REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
+ VERSION_VAR LibArchive_VERSION)
+
+In this case, the ``LibArchive`` package is considered to be found if
+both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid.
+Also the version of ``LibArchive`` will be checked by using the version
+contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given,
+the default messages will be printed.
+
+Another example for the full signature:
+
+.. code-block:: cmake
+
+ find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
+ find_package_handle_standard_args(Automoc4 CONFIG_MODE)
+
+In this case, a ``FindAutmoc4.cmake`` module wraps a call to
+``find_package(Automoc4 NO_MODULE)`` and adds an additional search
+directory for ``automoc4``. Then the call to
+``find_package_handle_standard_args`` produces a proper success/failure
+message.
+#]=======================================================================]
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -173,7 +213,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# now that we collected all arguments, process them
- if("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
+ if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG")
set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
endif()
@@ -209,17 +249,21 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
set(MISSING_VARS "")
set(DETAILS "")
# check if all passed variables are valid
- unset(${_FOUND_VAR})
+ set(FPHSA_FOUND_${_NAME} TRUE)
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
if(NOT ${_CURRENT_VAR})
- set(${_FOUND_VAR} FALSE)
+ set(FPHSA_FOUND_${_NAME} FALSE)
set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
else()
set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
endif()
endforeach()
- if(NOT "${${_FOUND_VAR}}" STREQUAL "FALSE")
- set(${_FOUND_VAR} TRUE)
+ if(FPHSA_FOUND_${_NAME})
+ set(${_NAME}_FOUND TRUE)
+ set(${_NAME_UPPER}_FOUND TRUE)
+ else()
+ set(${_NAME}_FOUND FALSE)
+ set(${_NAME_UPPER}_FOUND FALSE)
endif()
# component handling
@@ -243,7 +287,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}")
if(${_NAME}_FIND_REQUIRED_${comp})
- set(${_FOUND_VAR} FALSE)
+ set(${_NAME}_FOUND FALSE)
set(MISSING_VARS "${MISSING_VARS} ${comp}")
endif()
@@ -256,21 +300,50 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# version handling:
set(VERSION_MSG "")
set(VERSION_OK TRUE)
- set(VERSION ${${FPHSA_VERSION_VAR}} )
- if (${_NAME}_FIND_VERSION)
+ set(VERSION ${${FPHSA_VERSION_VAR}})
- if(VERSION)
+ # check with DEFINED here as the requested or found version may be "0"
+ if (DEFINED ${_NAME}_FIND_VERSION)
+ if(DEFINED ${FPHSA_VERSION_VAR})
if(${_NAME}_FIND_VERSION_EXACT) # exact version required
- if (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
- set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
- set(VERSION_OK FALSE)
+ # count the dots in the version string
+ string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${VERSION}")
+ # add one dot because there is one dot more than there are components
+ string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS)
+ if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT)
+ # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT
+ # is at most 4 here. Therefore a simple lookup table is used.
+ if (${_NAME}_FIND_VERSION_COUNT EQUAL 1)
+ set(_VERSION_REGEX "[^.]*")
+ elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2)
+ set(_VERSION_REGEX "[^.]*\\.[^.]*")
+ elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3)
+ set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*")
+ else ()
+ set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*")
+ endif ()
+ string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${VERSION}")
+ unset(_VERSION_REGEX)
+ if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD)
+ set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
+ set(VERSION_OK FALSE)
+ else ()
+ set(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
+ endif ()
+ unset(_VERSION_HEAD)
else ()
- set(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
+ if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL VERSION)
+ set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
+ set(VERSION_OK FALSE)
+ else ()
+ set(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
+ endif ()
endif ()
+ unset(_VERSION_DOTS)
else() # minimum version specified:
- if ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
+ if (${_NAME}_FIND_VERSION VERSION_GREATER VERSION)
set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
set(VERSION_OK FALSE)
else ()
@@ -297,12 +370,12 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
if(VERSION_OK)
set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
else()
- set(${_FOUND_VAR} FALSE)
+ set(${_NAME}_FOUND FALSE)
endif()
# print the result:
- if (${_FOUND_VAR})
+ if (${_NAME}_FOUND)
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
else ()
@@ -318,6 +391,6 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
endif ()
- set(${_FOUND_VAR} ${${_FOUND_VAR}} PARENT_SCOPE)
-
+ set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
+ set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
endfunction()
diff --git a/Modules/FindPackageMessage.cmake b/Modules/FindPackageMessage.cmake
index 5cea43e35..a0349d3db 100644
--- a/Modules/FindPackageMessage.cmake
+++ b/Modules/FindPackageMessage.cmake
@@ -1,22 +1,30 @@
+#.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.
+# 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()
+# ::
+#
+# if(X11_FOUND)
+# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
+# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
+# else()
+# ...
+# endif()
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
@@ -34,7 +42,7 @@
function(FIND_PACKAGE_MESSAGE pkg msg details)
# Avoid printing a message repeatedly for the same find result.
if(NOT ${pkg}_FIND_QUIETLY)
- string(REGEX REPLACE "[\n]" "" details "${details}")
+ string(REPLACE "\n" "" details "${details}")
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
# The message has not yet been printed.
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake
index 5eaf20768..70284b6f7 100644
--- a/Modules/FindPerl.cmake
+++ b/Modules/FindPerl.cmake
@@ -1,9 +1,16 @@
-# - Find perl
+#.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)
+# ::
+#
+# 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)
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -63,9 +70,9 @@ if(PERL_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]")
- string(REGEX REPLACE ".*This is perl.*[ \\(]v([0-9\\._]+)[ \\)].*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE})
+ set(PERL_VERSION_STRING "${CMAKE_MATCH_1}")
elseif(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +")
- string(REGEX REPLACE ".*This is perl, version ([0-9\\._]+) +.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE})
+ set(PERL_VERSION_STRING "${CMAKE_MATCH_1}")
endif()
endif()
endif()
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake
index 492f04770..54ccd249f 100644
--- a/Modules/FindPerlLibs.cmake
+++ b/Modules/FindPerlLibs.cmake
@@ -1,27 +1,41 @@
-# - 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:
+#.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
+#
#
-# 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)
+# standard syntax, e.g. find_package(PerlLibs 6.0)
+#
+# ::
+#
+# The following variables are also available if needed
+# (introduced after CMake 2.6.4)
+#
#
-# The following variables are also available if needed
-# (introduced after CMake 2.6.4)
#
-# PERL_SITESEARCH = path to the sitesearch install dir
-# PERL_SITELIB = path to the sitelib install directory
-# PERL_VENDORARCH = path to the vendor arch install directory
-# PERL_VENDORLIB = path to the vendor lib install directory
-# PERL_ARCHLIB = path to the arch lib install directory
-# PERL_PRIVLIB = path to the priv lib install directory
-# PERL_EXTRA_C_FLAGS = Compilation flags used to build perl
+# ::
#
+# PERL_SITESEARCH = path to the sitesearch install dir
+# PERL_SITELIB = path to the sitelib install directory
+# PERL_VENDORARCH = path to the vendor arch install directory
+# PERL_VENDORLIB = path to the vendor lib install directory
+# PERL_ARCHLIB = path to the arch lib install directory
+# PERL_PRIVLIB = path to the priv lib install directory
+# PERL_EXTRA_C_FLAGS = Compilation flags used to build perl
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake
index a2d6abf9b..ff584c7ff 100644
--- a/Modules/FindPhysFS.cmake
+++ b/Modules/FindPhysFS.cmake
@@ -1,12 +1,15 @@
-# 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
+#.rst:
+# FindPhysFS
+# ----------
#
-# $PHYSFSDIR is an environment variable that would
-# correspond to the ./configure --prefix=$PHYSFSDIR
-# used in building PHYSFS.
+#
+#
+# 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.
diff --git a/Modules/FindPike.cmake b/Modules/FindPike.cmake
index 5b48ab4e7..2d6a03d45 100644
--- a/Modules/FindPike.cmake
+++ b/Modules/FindPike.cmake
@@ -1,11 +1,17 @@
-# - 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:
+#.rst:
+# FindPike
+# --------
#
-# PIKE_INCLUDE_PATH = path to where program.h is found
-# PIKE_EXECUTABLE = full path to the pike binary
+# 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
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 2766f9780..447c52622 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -1,79 +1,21 @@
-# - a pkg-config module for CMake
+#.rst:
+# FindPkgConfig
+# -------------
#
-# Usage:
-# pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
-# checks for all the given modules
-#
-# pkg_search_module(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
-# checks for given modules and uses the first working one
-#
-# When the 'REQUIRED' argument was set, macros will fail with an error
-# when module(s) could not be found
-#
-# When the 'QUIET' argument is set, no status messages will be printed.
-#
-# It sets the following variables:
-# PKG_CONFIG_FOUND ... if pkg-config executable was found
-# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
-# PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
-# (since CMake 2.8.8)
-#
-# For the following variables two sets of values exist; first one is the
-# common one and has the given PREFIX. The second set contains flags
-# which are given out when pkgconfig was called with the '--static'
-# option.
-# <XPREFIX>_FOUND ... set to 1 if module(s) exist
-# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
-# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
-# <XPREFIX>_LDFLAGS ... all required linker flags
-# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
-# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
-# <XPREFIX>_CFLAGS ... all required cflags
-# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
-#
-# <XPREFIX> = <PREFIX> for common case
-# <XPREFIX> = <PREFIX>_STATIC for static linking
-#
-# There are some special variables whose prefix depends on the count
-# of given modules. When there is only one module, <PREFIX> stays
-# unchanged. When there are multiple modules, the prefix will be
-# changed to <PREFIX>_<MODNAME>:
-# <XPREFIX>_VERSION ... version of the module
-# <XPREFIX>_PREFIX ... prefix-directory of the module
-# <XPREFIX>_INCLUDEDIR ... include-dir of the module
-# <XPREFIX>_LIBDIR ... lib-dir of the module
-#
-# <XPREFIX> = <PREFIX> when |MODULES| == 1, else
-# <XPREFIX> = <PREFIX>_<MODNAME>
-#
-# A <MODULE> parameter can have the following formats:
-# {MODNAME} ... matches any version
-# {MODNAME}>={VERSION} ... at least version <VERSION> is required
-# {MODNAME}={VERSION} ... exactly version <VERSION> is required
-# {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
-#
-# Examples
-# pkg_check_modules (GLIB2 glib-2.0)
-#
-# pkg_check_modules (GLIB2 glib-2.0>=2.10)
-# requires at least version 2.10 of glib2 and defines e.g.
-# GLIB2_VERSION=2.10.3
-#
-# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
-# requires both glib2 and gtk2, and defines e.g.
-# FOO_glib-2.0_VERSION=2.10.3
-# FOO_gtk+-2.0_VERSION=2.8.20
+# A `pkg-config` module for CMake.
#
-# pkg_check_modules (XRENDER REQUIRED xrender)
-# defines e.g.:
-# XRENDER_LIBRARIES=Xrender;X11
-# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
+# Finds the ``pkg-config`` executable and add the
+# :command:`pkg_check_modules` and :command:`pkg_search_module`
+# commands.
#
-# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
+# In order to find the ``pkg-config`` executable, it uses the
+# :variable:`PKG_CONFIG_EXECUTABLE` variable or the ``PKG_CONFIG``
+# environment variable first.
#=============================================================================
-# Copyright 2006-2009 Kitware, Inc.
-# Copyright 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+# Copyright 2006-2014 Kitware, Inc.
+# Copyright 2014 Christoph Grüninger <foss@grueninger.de>
+# Copyright 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -88,6 +30,10 @@
### Common stuff ####
set(PKG_CONFIG_VERSION 1)
+# find pkg-config, use PKG_CONFIG if set
+if((NOT PKG_CONFIG_EXECUTABLE) AND (NOT "$ENV{PKG_CONFIG}" STREQUAL ""))
+ set(PKG_CONFIG_EXECUTABLE "$ENV{PKG_CONFIG}" CACHE FILEPATH "pkg-config executable")
+endif()
find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
mark_as_advanced(PKG_CONFIG_EXECUTABLE)
@@ -124,14 +70,14 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist}
OUTPUT_VARIABLE _pkgconfig_invoke_result
- RESULT_VARIABLE _pkgconfig_failed)
+ RESULT_VARIABLE _pkgconfig_failed
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
if (_pkgconfig_failed)
set(_pkgconfig_${_varname} "")
_pkgconfig_unset(${_prefix}_${_varname})
else()
string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
- string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
if (NOT ${_regexp} STREQUAL "")
string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
@@ -145,6 +91,26 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
endif()
endmacro()
+#[========================================[.rst:
+.. command:: pkg_get_variable
+
+ Retrieves the value of a variable from a package::
+
+ pkg_get_variable(<RESULT> <MODULE> <VARIABLE>)
+
+ For example:
+
+ .. code-block:: cmake
+
+ pkg_get_variable(GI_GIRDIR gobject-introspection-1.0 girdir)
+#]========================================]
+function (pkg_get_variable result pkg variable)
+ _pkgconfig_invoke("${pkg}" "prefix" "result" "" "--variable=${variable}")
+ set("${result}"
+ "${prefix_result}"
+ PARENT_SCOPE)
+endfunction ()
+
# Invokes pkgconfig two times; once without '--static' and once with
# '--static'
macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
@@ -153,9 +119,20 @@ macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
endmacro()
# Splits given arguments into options and a package list
-macro(_pkgconfig_parse_options _result _is_req _is_silent)
+macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cmake_environment_path)
set(${_is_req} 0)
set(${_is_silent} 0)
+ set(${_no_cmake_path} 0)
+ set(${_no_cmake_environment_path} 0)
+ if(DEFINED PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
+ if(NOT PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
+ set(${_no_cmake_path} 1)
+ set(${_no_cmake_environment_path} 1)
+ endif()
+ elseif(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1)
+ set(${_no_cmake_path} 1)
+ set(${_no_cmake_environment_path} 1)
+ endif()
foreach(_pkg ${ARGN})
if (_pkg STREQUAL "REQUIRED")
@@ -164,15 +141,48 @@ macro(_pkgconfig_parse_options _result _is_req _is_silent)
if (_pkg STREQUAL "QUIET")
set(${_is_silent} 1)
endif ()
+ if (_pkg STREQUAL "NO_CMAKE_PATH")
+ set(${_no_cmake_path} 1)
+ endif()
+ if (_pkg STREQUAL "NO_CMAKE_ENVIRONMENT_PATH")
+ set(${_no_cmake_environment_path} 1)
+ endif()
endforeach()
set(${_result} ${ARGN})
list(REMOVE_ITEM ${_result} "REQUIRED")
list(REMOVE_ITEM ${_result} "QUIET")
+ list(REMOVE_ITEM ${_result} "NO_CMAKE_PATH")
+ list(REMOVE_ITEM ${_result} "NO_CMAKE_ENVIRONMENT_PATH")
endmacro()
+# Add the content of a variable or an environment variable to a list of
+# paths
+# Usage:
+# - _pkgconfig_add_extra_path(_extra_paths VAR)
+# - _pkgconfig_add_extra_path(_extra_paths ENV VAR)
+function(_pkgconfig_add_extra_path _extra_paths_var _var)
+ set(_is_env 0)
+ if(ARGC GREATER 2 AND _var STREQUAL "ENV")
+ set(_var ${ARGV2})
+ set(_is_env 1)
+ endif()
+ if(NOT _is_env)
+ if(NOT "${${_var}}" STREQUAL "")
+ list(APPEND ${_extra_paths_var} ${${_var}})
+ endif()
+ else()
+ if(NOT "$ENV{${_var}}" STREQUAL "")
+ file(TO_CMAKE_PATH "$ENV{${_var}}" _path)
+ list(APPEND ${_extra_paths_var} ${_path})
+ unset(_path)
+ endif()
+ endif()
+ set(${_extra_paths_var} ${${_extra_paths_var}} PARENT_SCOPE)
+endfunction()
+
###
-macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
+macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _prefix)
_pkgconfig_unset(${_prefix}_FOUND)
_pkgconfig_unset(${_prefix}_VERSION)
_pkgconfig_unset(${_prefix}_PREFIX)
@@ -202,24 +212,96 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
# give out status message telling checked module
if (NOT ${_is_silent})
if (_pkg_check_modules_cnt EQUAL 1)
- message(STATUS "checking for module '${_pkg_check_modules_list}'")
+ message(STATUS "Checking for module '${_pkg_check_modules_list}'")
else()
- message(STATUS "checking for modules '${_pkg_check_modules_list}'")
+ message(STATUS "Checking for modules '${_pkg_check_modules_list}'")
endif()
endif()
set(_pkg_check_modules_packages)
set(_pkg_check_modules_failed)
+ set(_extra_paths)
+
+ if(NOT _no_cmake_path)
+ _pkgconfig_add_extra_path(_extra_paths CMAKE_PREFIX_PATH)
+ _pkgconfig_add_extra_path(_extra_paths CMAKE_FRAMEWORK_PATH)
+ _pkgconfig_add_extra_path(_extra_paths CMAKE_APPBUNDLE_PATH)
+ endif()
+
+ if(NOT _no_cmake_environment_path)
+ _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_PREFIX_PATH)
+ _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_FRAMEWORK_PATH)
+ _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_APPBUNDLE_PATH)
+ endif()
+
+ if(NOT "${_extra_paths}" STREQUAL "")
+ # Save the PKG_CONFIG_PATH environment variable, and add paths
+ # from the CMAKE_PREFIX_PATH variables
+ set(_pkgconfig_path_old "$ENV{PKG_CONFIG_PATH}")
+ set(_pkgconfig_path "${_pkgconfig_path_old}")
+ if(NOT "${_pkgconfig_path}" STREQUAL "")
+ file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+ endif()
+
+ # Create a list of the possible pkgconfig subfolder (depending on
+ # the system
+ set(_lib_dirs)
+ if(NOT DEFINED CMAKE_SYSTEM_NAME
+ OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
+ AND NOT CMAKE_CROSSCOMPILING))
+ if(EXISTS "/etc/debian_version") # is this a debian system ?
+ if(CMAKE_LIBRARY_ARCHITECTURE)
+ list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
+ endif()
+ else()
+ # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property
+ get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+ if(uselib64)
+ list(APPEND _lib_dirs "lib64/pkgconfig")
+ endif()
+ endif()
+ endif()
+ list(APPEND _lib_dirs "lib/pkgconfig")
+ list(APPEND _lib_dirs "share/pkgconfig")
+
+ # Check if directories exist and eventually append them to the
+ # pkgconfig path list
+ foreach(_prefix_dir ${_extra_paths})
+ foreach(_lib_dir ${_lib_dirs})
+ if(EXISTS "${_prefix_dir}/${_lib_dir}")
+ list(APPEND _pkgconfig_path "${_prefix_dir}/${_lib_dir}")
+ list(REMOVE_DUPLICATES _pkgconfig_path)
+ endif()
+ endforeach()
+ endforeach()
+
+ # Prepare and set the environment variable
+ if(NOT "${_pkgconfig_path}" STREQUAL "")
+ # remove empty values from the list
+ list(REMOVE_ITEM _pkgconfig_path "")
+ file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+ if(UNIX)
+ string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}")
+ string(REPLACE "\\ " " " _pkgconfig_path "${_pkgconfig_path}")
+ endif()
+ set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path}")
+ endif()
+
+ # Unset variables
+ unset(_lib_dirs)
+ unset(_pkgconfig_path)
+ endif()
+
# iterate through module list and check whether they exist and match the required version
foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
set(_pkg_check_modules_exist_query)
# check whether version is given
- if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
- string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
- string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}")
- string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}")
+ if (_pkg_check_modules_pkg MATCHES "(.*[^><])(>=|=|<=)(.*)")
+ set(_pkg_check_modules_pkg_name "${CMAKE_MATCH_1}")
+ set(_pkg_check_modules_pkg_op "${CMAKE_MATCH_2}")
+ set(_pkg_check_modules_pkg_ver "${CMAKE_MATCH_3}")
else()
set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
set(_pkg_check_modules_pkg_op)
@@ -247,7 +329,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
if (_pkg_check_modules_pkg_op)
list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
else()
- list(APPEND _pkg_check_modules_exist_query --exists)
+ list(APPEND _pkg_check_modules_exist_query --exists --print-errors --short-errors)
endif()
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
@@ -261,12 +343,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
# execute the query
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query}
- RESULT_VARIABLE _pkgconfig_retval)
+ RESULT_VARIABLE _pkgconfig_retval
+ ERROR_VARIABLE _pkgconfig_error
+ ERROR_STRIP_TRAILING_WHITESPACE)
# evaluate result and tell failures
if (_pkgconfig_retval)
if(NOT ${_is_silent})
- message(STATUS " package '${_pkg_check_modules_pkg}' not found")
+ message(STATUS " ${_pkgconfig_error}")
endif()
set(_pkg_check_modules_failed 1)
@@ -276,7 +360,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
if(_pkg_check_modules_failed)
# fail when requested
if (${_is_required})
- message(SEND_ERROR "A required package was not found")
+ message(FATAL_ERROR "A required package was not found")
endif ()
else()
# when we are here, we checked whether requested modules
@@ -295,12 +379,15 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
endif()
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion )
- _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix )
- _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir )
- _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir )
+ pkg_get_variable("${_pkg_check_prefix}_PREFIX" ${_pkg_check_modules_pkg} "prefix")
+ pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir")
+ pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir")
+ foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR)
+ _pkgconfig_set("${_pkg_check_prefix}_${variable}" "${${_pkg_check_prefix}_${variable}}")
+ endforeach ()
if (NOT ${_is_silent})
- message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
+ message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
endif ()
endforeach()
@@ -314,6 +401,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
endif()
+
+ if(NOT "${_extra_paths}" STREQUAL "")
+ # Restore the environment variable
+ set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path_old}")
+ endif()
+
+ unset(_extra_paths)
+ unset(_pkgconfig_path_old)
else()
if (${_is_required})
message(SEND_ERROR "pkg-config tool not found")
@@ -325,32 +420,148 @@ endmacro()
### User visible macros start here
###
-###
+#[========================================[.rst:
+.. command:: pkg_check_modules
+
+ Checks for all the given modules. ::
+
+ pkg_check_modules(<PREFIX> [REQUIRED] [QUIET]
+ [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
+ <MODULE> [<MODULE>]*)
+
+
+ When the ``REQUIRED`` argument was set, macros will fail with an error
+ when module(s) could not be found.
+
+ When the ``QUIET`` argument is set, no status messages will be printed.
+
+ By default, if :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or
+ later, or if :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` is set, the
+ :variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_FRAMEWORK_PATH`, and
+ :variable:`CMAKE_APPBUNDLE_PATH` cache and environment variables will
+ be added to ``pkg-config`` search path.
+ The ``NO_CMAKE_PATH`` and ``NO_CMAKE_ENVIRONMENT_PATH`` arguments
+ disable this behavior for the cache variables and the environment
+ variables, respectively.
+
+ It sets the following variables: ::
+
+ PKG_CONFIG_FOUND ... if pkg-config executable was found
+ PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
+ PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
+ (since CMake 2.8.8)
+
+ For the following variables two sets of values exist; first one is the
+ common one and has the given PREFIX. The second set contains flags
+ which are given out when ``pkg-config`` was called with the ``--static``
+ option. ::
+
+ <XPREFIX>_FOUND ... set to 1 if module(s) exist
+ <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
+ <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
+ <XPREFIX>_LDFLAGS ... all required linker flags
+ <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
+ <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
+ <XPREFIX>_CFLAGS ... all required cflags
+ <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
+
+ ::
+
+ <XPREFIX> = <PREFIX> for common case
+ <XPREFIX> = <PREFIX>_STATIC for static linking
+
+ There are some special variables whose prefix depends on the count of
+ given modules. When there is only one module, <PREFIX> stays
+ unchanged. When there are multiple modules, the prefix will be
+ changed to <PREFIX>_<MODNAME>: ::
+
+ <XPREFIX>_VERSION ... version of the module
+ <XPREFIX>_PREFIX ... prefix-directory of the module
+ <XPREFIX>_INCLUDEDIR ... include-dir of the module
+ <XPREFIX>_LIBDIR ... lib-dir of the module
+
+ ::
+
+ <XPREFIX> = <PREFIX> when |MODULES| == 1, else
+ <XPREFIX> = <PREFIX>_<MODNAME>
+
+ A <MODULE> parameter can have the following formats: ::
+
+ {MODNAME} ... matches any version
+ {MODNAME}>={VERSION} ... at least version <VERSION> is required
+ {MODNAME}={VERSION} ... exactly version <VERSION> is required
+ {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
+
+ Examples
+
+ .. code-block:: cmake
+
+ pkg_check_modules (GLIB2 glib-2.0)
+
+ .. code-block:: cmake
+
+ pkg_check_modules (GLIB2 glib-2.0>=2.10)
+
+ Requires at least version 2.10 of glib2 and defines e.g.
+ ``GLIB2_VERSION=2.10.3``
+
+ .. code-block:: cmake
+
+ pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
+
+ Requires both glib2 and gtk2, and defines e.g.
+ ``FOO_glib-2.0_VERSION=2.10.3`` and ``FOO_gtk+-2.0_VERSION=2.8.20``
+
+ .. code-block:: cmake
+
+ pkg_check_modules (XRENDER REQUIRED xrender)
+
+ Defines for example::
+
+ XRENDER_LIBRARIES=Xrender;X11``
+ XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
+#]========================================]
macro(pkg_check_modules _prefix _module0)
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
- _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
- _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" "${_prefix}" ${_pkg_modules})
+ _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
+ _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
endif()
endmacro()
-###
+
+#[========================================[.rst:
+.. command:: pkg_search_module
+
+ Same as :command:`pkg_check_modules`, but instead it checks for given
+ modules and uses the first working one. ::
+
+ pkg_search_module(<PREFIX> [REQUIRED] [QUIET]
+ [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
+ <MODULE> [<MODULE>]*)
+
+ Examples
+
+ .. code-block:: cmake
+
+ pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
+#]========================================]
macro(pkg_search_module _prefix _module0)
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
set(_pkg_modules_found 0)
- _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
+ _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
if (NOT ${_pkg_is_silent})
- message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
+ message(STATUS "Checking for one of the modules '${_pkg_modules_alt}'")
endif ()
# iterate through all modules and stop at the first working one.
foreach(_pkg_alt ${_pkg_modules_alt})
if(NOT _pkg_modules_found)
- _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}")
+ _pkg_check_modules_internal(0 1 ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" "${_pkg_alt}")
endif()
if (${_prefix}_FOUND)
@@ -368,6 +579,26 @@ macro(pkg_search_module _prefix _module0)
endif()
endmacro()
+
+#[========================================[.rst:
+.. variable:: PKG_CONFIG_EXECUTABLE
+
+ Path to the pkg-config executable.
+
+
+.. variable:: PKG_CONFIG_USE_CMAKE_PREFIX_PATH
+
+ Whether :command:`pkg_check_modules` and :command:`pkg_search_module`
+ should add the paths in :variable:`CMAKE_PREFIX_PATH`,
+ :variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH`
+ cache and environment variables to ``pkg-config`` search path.
+
+ If this variable is not set, this behavior is enabled by default if
+ :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or later, disabled
+ otherwise.
+#]========================================]
+
+
### Local Variables:
### mode: cmake
### End:
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index e3c898b98..d05d3da7c 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -1,11 +1,17 @@
-# - Find the PostgreSQL installation.
-# In Windows, we make the assumption that, if the PostgreSQL files are installed, the default directory
-# will be C:\Program Files\PostgreSQL.
+#.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_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8)
+#
+# ::
+#
+# 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)
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
@@ -31,7 +37,7 @@
# In Windows the default installation of PostgreSQL uses that as part of the path.
# E.g C:\Program Files\PostgreSQL\8.4.
# Currently, the following version numbers are known to this module:
-# "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0"
+# "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0"
#
# To use this variable just do something like this:
# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4")
@@ -75,19 +81,27 @@ set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to wher
set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
- "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
+ "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
# Define additional search paths for root directories.
-if ( WIN32 )
- foreach (suffix ${PostgreSQL_KNOWN_VERSIONS} )
- set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/PostgreSQL/${suffix}" )
- endforeach()
-endif()
set( PostgreSQL_ROOT_DIRECTORIES
ENV PostgreSQL_ROOT
${PostgreSQL_ROOT}
- ${PostgreSQL_ADDITIONAL_SEARCH_PATHS}
)
+foreach(suffix ${PostgreSQL_KNOWN_VERSIONS})
+ if(WIN32)
+ list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES
+ "PostgreSQL/${suffix}/lib")
+ list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES
+ "PostgreSQL/${suffix}/include")
+ list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES
+ "PostgreSQL/${suffix}/include/server")
+ endif()
+ if(UNIX)
+ list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES
+ "postgresql/${suffix}/server")
+ endif()
+endforeach()
#
# Look for an installation.
@@ -101,6 +115,7 @@ find_path(PostgreSQL_INCLUDE_DIR
pgsql
postgresql
include
+ ${PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES}
# Help the user find it if we cannot.
DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
)
@@ -115,6 +130,7 @@ find_path(PostgreSQL_TYPE_INCLUDE_DIR
pgsql/server
postgresql/server
include/server
+ ${PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES}
# Help the user find it if we cannot.
DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
)
@@ -125,24 +141,37 @@ set (PostgreSQL_LIBRARY_TO_FIND pq)
set (PostgreSQL_LIB_PREFIX "")
if ( WIN32 )
set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib")
- set ( PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND})
+ set (PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND})
endif()
-find_library( PostgreSQL_LIBRARY
+find_library(PostgreSQL_LIBRARY
NAMES ${PostgreSQL_LIBRARY_TO_FIND}
PATHS
${PostgreSQL_ROOT_DIRECTORIES}
PATH_SUFFIXES
lib
+ ${PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES}
+ # Help the user find it if we cannot.
+ DOC "The ${PostgreSQL_LIBRARY_DIR_MESSAGE}"
)
get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH)
-if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h")
- file(STRINGS "${PostgreSQL_INCLUDE_DIR}/pg_config.h" pgsql_version_str
- REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
-
- string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
- PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+if (PostgreSQL_INCLUDE_DIR)
+ # Some platforms include multiple pg_config.hs for multi-lib configurations
+ # This is a temporary workaround. A better solution would be to compile
+ # a dummy c file and extract the value of the symbol.
+ file(GLOB _PG_CONFIG_HEADERS "${PostgreSQL_INCLUDE_DIR}/pg_config*.h")
+ foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS})
+ if(EXISTS "${_PG_CONFIG_HEADER}")
+ file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str
+ REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
+ if(pgsql_version_str)
+ string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*"
+ "\\1" PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+ break()
+ endif()
+ endif()
+ endforeach()
unset(pgsql_version_str)
endif()
@@ -151,18 +180,13 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(PostgreSQL
REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR
VERSION_VAR PostgreSQL_VERSION_STRING)
-set( PostgreSQL_FOUND ${POSTGRESQL_FOUND})
+set(PostgreSQL_FOUND ${POSTGRESQL_FOUND})
# Now try to get the include and library path.
if(PostgreSQL_FOUND)
-
set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} )
set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} )
set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND})
-
- #message("Final PostgreSQL include dir: ${PostgreSQL_INCLUDE_DIRS}")
- #message("Final PostgreSQL library dir: ${PostgreSQL_LIBRARY_DIRS}")
- #message("Final PostgreSQL libraries: ${PostgreSQL_LIBRARIES}")
endif()
mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY )
diff --git a/Modules/FindProducer.cmake b/Modules/FindProducer.cmake
index 30990629b..aef84eac7 100644
--- a/Modules/FindProducer.cmake
+++ b/Modules/FindProducer.cmake
@@ -1,27 +1,30 @@
-# 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
+#.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).
+# 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.
+# 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
+# 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.
+# $PRODUCER_DIR is an environment variable that would correspond to the
+# ./configure --prefix=$PRODUCER_DIR used in building osg.
#
# Created by Eric Wing.
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 2972198b3..2f13b09a8 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -1,63 +1,94 @@
+#.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 & vsprojects/Release) will be searched
-# for libraries and binaries.
-#
-# PROTOBUF_IMPORT_DIRS - List of additional directories to be searched for
-# imported .proto files. (New in CMake 2.8.8)
+# ``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.
#
# Defines the following variables:
#
-# PROTOBUF_FOUND - Found the Google Protocol Buffers library (libprotobuf & header files)
-# PROTOBUF_INCLUDE_DIRS - Include directories for Google Protocol Buffers
-# PROTOBUF_LIBRARIES - The protobuf libraries
-# [New in CMake 2.8.5]
-# PROTOBUF_PROTOC_LIBRARIES - The protoc libraries
-# PROTOBUF_LITE_LIBRARIES - The protobuf-lite libraries
+# ``PROTOBUF_FOUND``
+# Found the Google Protocol Buffers library
+# (libprotobuf & header files)
+# ``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 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
-# [New in CMake 2.8.5]
-# 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:
+#
+# ``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 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: You may need to link against pthreads, depending
-# on the platform.
+# .. 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.
#
-# NOTE: The PROTOBUF_GENERATE_CPP macro & add_executable() or 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 (public function)
-# SRCS = Variable to define with autogenerated
-# source files
-# HDRS = Variable to define with autogenerated
-# header files
-# ARGN = proto files
+# protobuf_generate_cpp (<SRCS> <HDRS> [<ARGN>...])
#
-# ====================================================================
-
+# ``SRCS``
+# Variable to define with autogenerated source files
+# ``HDRS``
+# Variable to define with autogenerated header files
+# ``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
#=============================================================================
# Copyright 2009 Kitware, Inc.
@@ -118,7 +149,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
"${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
- DEPENDS ${ABS_FIL}
+ DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE}
COMMENT "Running C++ protocol buffer compiler on ${FIL}"
VERBATIM )
endforeach()
@@ -128,18 +159,69 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
set(${HDRS} ${${HDRS}} PARENT_SCOPE)
endfunction()
+function(PROTOBUF_GENERATE_PYTHON SRCS)
+ if(NOT ARGN)
+ message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files")
+ return()
+ endif()
+
+ if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
+ # Create an include path for each file specified
+ foreach(FIL ${ARGN})
+ get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
+ get_filename_component(ABS_PATH ${ABS_FIL} PATH)
+ list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
+ if(${_contains_already} EQUAL -1)
+ list(APPEND _protobuf_include_path -I ${ABS_PATH})
+ endif()
+ endforeach()
+ else()
+ set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
+ endif()
+
+ if(DEFINED PROTOBUF_IMPORT_DIRS)
+ foreach(DIR ${PROTOBUF_IMPORT_DIRS})
+ get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
+ list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
+ if(${_contains_already} EQUAL -1)
+ list(APPEND _protobuf_include_path -I ${ABS_PATH})
+ endif()
+ endforeach()
+ endif()
+
+ set(${SRCS})
+ foreach(FIL ${ARGN})
+ get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
+ get_filename_component(FIL_WE ${FIL} NAME_WE)
+
+ list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py")
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py"
+ COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
+ DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE}
+ COMMENT "Running Python protocol buffer compiler on ${FIL}"
+ VERBATIM )
+ endforeach()
+
+ set(${SRCS} ${${SRCS}} PARENT_SCOPE)
+endfunction()
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_PROTOBUF_ARCH_DIR x64/)
+endif()
+
# Internal function: search for normal library as well as a debug one
# if the debug one is specified also include debug/optimized keywords
# in *_LIBRARIES variable
function(_protobuf_find_libraries name filename)
find_library(${name}_LIBRARY
NAMES ${filename}
- PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release)
+ PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release)
mark_as_advanced(${name}_LIBRARY)
find_library(${name}_LIBRARY_DEBUG
NAMES ${filename}
- PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug)
+ PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug)
mark_as_advanced(${name}_LIBRARY_DEBUG)
if(NOT ${name}_LIBRARY_DEBUG)
@@ -216,14 +298,14 @@ find_program(PROTOBUF_PROTOC_EXECUTABLE
NAMES protoc
DOC "The Google Protocol Buffers Compiler"
PATHS
- ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release
- ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug
+ ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release
+ ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug
)
mark_as_advanced(PROTOBUF_PROTOC_EXECUTABLE)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROTOBUF DEFAULT_MSG
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Protobuf DEFAULT_MSG
PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR)
if(PROTOBUF_FOUND)
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 7fb65b869..e194185f2 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -1,18 +1,37 @@
-# - Find python interpreter
-# This module finds if Python interpreter is installed and determines where the
-# executables are. This code sets the following variables:
+#.rst:
+# FindPythonInterp
+# ----------------
#
-# PYTHONINTERP_FOUND - Was the Python executable found
-# PYTHON_EXECUTABLE - path to the Python interpreter
+# Find 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
+# This module finds if Python interpreter is installed and determines
+# where the executables are. This code sets the following variables:
#
-# 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).
+# ::
+#
+# 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.
#=============================================================================
# Copyright 2005-2010 Kitware, Inc.
@@ -33,42 +52,47 @@ unset(_Python_NAMES)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
-set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0)
+set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonInterp_FIND_VERSION)
- if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
- string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}")
- string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
- list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ})
+ if(PythonInterp_FIND_VERSION_COUNT GREATER 1)
+ set(_PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION_MAJOR}.${PythonInterp_FIND_VERSION_MINOR}")
+ list(APPEND _Python_NAMES
+ python${_PYTHON_FIND_MAJ_MIN}
+ python${PythonInterp_FIND_VERSION_MAJOR})
unset(_PYTHON_FIND_OTHER_VERSIONS)
if(NOT PythonInterp_FIND_VERSION_EXACT)
- foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
+ foreach(_PYTHON_V ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS})
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
endif()
endforeach()
endif()
unset(_PYTHON_FIND_MAJ_MIN)
- unset(_PYTHON_FIND_MAJ)
else()
- list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION})
- set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS})
+ list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION_MAJOR})
+ set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS})
endif()
else()
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
endif()
-
-list(APPEND _Python_NAMES python)
-
-# Search for the current active python version first
find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
# Set up the versions we know about, in the order we will search. Always add
# the user supplied additional versions to the front.
-set(_Python_VERSIONS
- ${Python_ADDITIONAL_VERSIONS}
- ${_PYTHON_FIND_OTHER_VERSIONS}
- )
+set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
+# If FindPythonInterp has already found the major and minor version,
+# insert that version next to get consistent versions of the interpreter and
+# library.
+if(DEFINED PYTHONLIBS_VERSION_STRING)
+ string(REPLACE "." ";" _PYTHONLIBS_VERSION "${PYTHONLIBS_VERSION_STRING}")
+ list(GET _PYTHONLIBS_VERSION 0 _PYTHONLIBS_VERSION_MAJOR)
+ list(GET _PYTHONLIBS_VERSION 1 _PYTHONLIBS_VERSION_MINOR)
+ list(APPEND _Python_VERSIONS ${_PYTHONLIBS_VERSION_MAJOR}.${_PYTHONLIBS_VERSION_MINOR})
+endif()
+# Search for the current active python version first
+list(APPEND _Python_VERSIONS ";")
+list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
unset(_PYTHON_FIND_OTHER_VERSIONS)
unset(_PYTHON1_VERSIONS)
@@ -77,7 +101,7 @@ unset(_PYTHON3_VERSIONS)
# Search for newest python version if python executable isn't found
if(NOT PYTHON_EXECUTABLE)
- foreach(_CURRENT_VERSION ${_Python_VERSIONS})
+ foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS)
set(_Python_NAMES python${_CURRENT_VERSION})
if(WIN32)
list(APPEND _Python_NAMES python)
@@ -115,8 +139,8 @@ if(PYTHON_EXECUTABLE)
string(REGEX REPLACE " .*" "" PYTHON_VERSION_STRING "${_VERSION}")
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}")
- if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*")
- string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}")
+ if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.([0-9]+)")
+ set(PYTHON_VERSION_PATCH "${CMAKE_MATCH_1}")
else()
set(PYTHON_VERSION_PATCH "0")
endif()
@@ -125,8 +149,8 @@ if(PYTHON_EXECUTABLE)
# this is older.
set(PYTHON_VERSION_STRING "1.4")
set(PYTHON_VERSION_MAJOR "1")
- set(PYTHON_VERSION_MAJOR "4")
- set(PYTHON_VERSION_MAJOR "0")
+ set(PYTHON_VERSION_MINOR "4")
+ set(PYTHON_VERSION_PATCH "0")
endif()
endif()
unset(_PYTHON_VERSION_RESULT)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index bffa9fb4f..ab92f8683 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -1,23 +1,41 @@
-# - Find python libraries
+#.rst:
+# FindPythonLibs
+# --------------
+#
+# 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:
+# 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)
+#
+#
#
-# 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).
#
-# 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:
#
-# 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
+# ::
+#
+# 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.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -32,18 +50,45 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+# Use the executable's path as a hint
+set(_Python_LIBRARY_PATH_HINT)
+if(PYTHON_EXECUTABLE)
+ if(WIN32)
+ get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH)
+ if(_Python_PREFIX)
+ set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/libs)
+ endif()
+ unset(_Python_PREFIX)
+ else()
+ get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH)
+ get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH)
+ if(_Python_PREFIX)
+ set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/lib)
+ endif()
+ unset(_Python_PREFIX)
+ endif()
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake)
# Search for the python framework on Apple.
CMAKE_FIND_FRAMEWORKS(Python)
+# Save CMAKE_FIND_FRAMEWORK
+if(DEFINED CMAKE_FIND_FRAMEWORK)
+ set(_PythonLibs_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
+else()
+ unset(_PythonLibs_CMAKE_FIND_FRAMEWORK)
+endif()
+# To avoid picking up the system Python.h pre-maturely.
+set(CMAKE_FIND_FRAMEWORK LAST)
+
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
-set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0)
+set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonLibs_FIND_VERSION)
- if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
- string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}")
- string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
+ if(PythonLibs_FIND_VERSION_COUNT GREATER 1)
+ set(_PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION_MAJOR}.${PythonLibs_FIND_VERSION_MINOR}")
unset(_PYTHON_FIND_OTHER_VERSIONS)
if(PythonLibs_FIND_VERSION_EXACT)
if(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
@@ -52,16 +97,15 @@ if(PythonLibs_FIND_VERSION)
set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}")
endif()
else()
- foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
+ foreach(_PYTHON_V ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS})
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
endif()
endforeach()
endif()
unset(_PYTHON_FIND_MAJ_MIN)
- unset(_PYTHON_FIND_MAJ)
else()
- set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS})
+ set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS})
endif()
else()
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
@@ -69,10 +113,14 @@ endif()
# Set up the versions we know about, in the order we will search. Always add
# the user supplied additional versions to the front.
-set(_Python_VERSIONS
- ${Python_ADDITIONAL_VERSIONS}
- ${_PYTHON_FIND_OTHER_VERSIONS}
- )
+# If FindPythonInterp has already found the major and minor version,
+# insert that version between the user supplied versions and the stock
+# version list.
+set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
+if(DEFINED PYTHON_VERSION_MAJOR AND DEFINED PYTHON_VERSION_MINOR)
+ list(APPEND _Python_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
+endif()
+list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
unset(_PYTHON_FIND_OTHER_VERSIONS)
unset(_PYTHON1_VERSIONS)
@@ -84,6 +132,7 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
if(WIN32)
find_library(PYTHON_DEBUG_LIBRARY
NAMES python${_CURRENT_VERSION_NO_DOTS}_d python
+ HINTS ${_Python_LIBRARY_PATH_HINT}
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
@@ -92,14 +141,24 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
)
endif()
+ set(PYTHON_FRAMEWORK_LIBRARIES)
+ if(Python_FRAMEWORKS AND NOT PYTHON_LIBRARY)
+ foreach(dir ${Python_FRAMEWORKS})
+ list(APPEND PYTHON_FRAMEWORK_LIBRARIES
+ ${dir}/Versions/${_CURRENT_VERSION}/lib)
+ endforeach()
+ endif()
find_library(PYTHON_LIBRARY
NAMES
- python${_CURRENT_VERSION_NO_DOTS}
- python${_CURRENT_VERSION}mu
- python${_CURRENT_VERSION}m
- python${_CURRENT_VERSION}u
- python${_CURRENT_VERSION}
+ python${_CURRENT_VERSION_NO_DOTS}
+ python${_CURRENT_VERSION}mu
+ python${_CURRENT_VERSION}m
+ python${_CURRENT_VERSION}u
+ python${_CURRENT_VERSION}
+ HINTS
+ ${_Python_LIBRARY_PATH_HINT}
PATHS
+ ${PYTHON_FRAMEWORK_LIBRARIES}
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
# Avoid finding the .dll in the PATH. We want the .lib.
@@ -114,33 +173,42 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
PATH_SUFFIXES python${_CURRENT_VERSION}/config
)
- # For backward compatibility, honour value of PYTHON_INCLUDE_PATH, if
- # PYTHON_INCLUDE_DIR is not set.
- if(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR)
- set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH
- "Path to where Python.h is found" FORCE)
- endif()
+ # Don't search for include dir until library location is known
+ if(PYTHON_LIBRARY)
- set(PYTHON_FRAMEWORK_INCLUDES)
- if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR)
- foreach(dir ${Python_FRAMEWORKS})
- set(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES}
- ${dir}/Versions/${_CURRENT_VERSION}/include/python${_CURRENT_VERSION})
- endforeach()
- endif()
+ # Use the library's install prefix as a hint
+ set(_Python_INCLUDE_PATH_HINT)
+ get_filename_component(_Python_PREFIX ${PYTHON_LIBRARY} PATH)
+ get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH)
+ if(_Python_PREFIX)
+ set(_Python_INCLUDE_PATH_HINT ${_Python_PREFIX}/include)
+ endif()
+ unset(_Python_PREFIX)
+
+ # Add framework directories to the search paths
+ set(PYTHON_FRAMEWORK_INCLUDES)
+ if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR)
+ foreach(dir ${Python_FRAMEWORKS})
+ list(APPEND PYTHON_FRAMEWORK_INCLUDES
+ ${dir}/Versions/${_CURRENT_VERSION}/include)
+ endforeach()
+ endif()
- find_path(PYTHON_INCLUDE_DIR
- NAMES Python.h
- PATHS
- ${PYTHON_FRAMEWORK_INCLUDES}
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
- PATH_SUFFIXES
- python${_CURRENT_VERSION}mu
- python${_CURRENT_VERSION}m
- python${_CURRENT_VERSION}u
- python${_CURRENT_VERSION}
- )
+ find_path(PYTHON_INCLUDE_DIR
+ NAMES Python.h
+ HINTS
+ ${_Python_INCLUDE_PATH_HINT}
+ PATHS
+ ${PYTHON_FRAMEWORK_INCLUDES}
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
+ PATH_SUFFIXES
+ python${_CURRENT_VERSION}mu
+ python${_CURRENT_VERSION}m
+ python${_CURRENT_VERSION}u
+ python${_CURRENT_VERSION}
+ )
+ endif()
# For backward compatibility, set PYTHON_INCLUDE_PATH.
set(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}")
@@ -158,6 +226,9 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
endif()
endforeach()
+unset(_Python_INCLUDE_PATH_HINT)
+unset(_Python_LIBRARY_PATH_HINT)
+
mark_as_advanced(
PYTHON_DEBUG_LIBRARY
PYTHON_LIBRARY
@@ -182,6 +253,14 @@ SELECT_LIBRARY_CONFIGURATIONS(PYTHON)
# for historical reasons.
unset(PYTHON_FOUND)
+# Restore CMAKE_FIND_FRAMEWORK
+if(DEFINED _PythonLibs_CMAKE_FIND_FRAMEWORK)
+ set(CMAKE_FIND_FRAMEWORK ${_PythonLibs_CMAKE_FIND_FRAMEWORK})
+ unset(_PythonLibs_CMAKE_FIND_FRAMEWORK)
+else()
+ unset(CMAKE_FIND_FRAMEWORK)
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs
REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake
index 54b7c6f97..41b727158 100644
--- a/Modules/FindQt.cmake
+++ b/Modules/FindQt.cmake
@@ -1,21 +1,34 @@
-# - Searches for all installed versions of Qt.
+#.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.
+# 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.
+#
+#
#
-# 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.
+# 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.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -69,7 +82,11 @@ endif()
set(GLOB_TEMP_VAR)
if (Qt_FIND_VERSION)
- set(DESIRED_QT_VERSION "${Qt_FIND_VERSION}")
+ if (Qt_FIND_VERSION MATCHES "^([34])(\\.[0-9]+.*)?$")
+ set(DESIRED_QT_VERSION ${CMAKE_MATCH_1})
+ else ()
+ message(FATAL_ERROR "FindQt was called with invalid version '${Qt_FIND_VERSION}'. Only Qt major versions 3 or 4 are supported. If you do not need to support both Qt3 and Qt4 in your source consider calling find_package(Qt3) or find_package(Qt4) instead of find_package(Qt) instead.")
+ endif ()
endif ()
# now find qmake
@@ -77,7 +94,7 @@ find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin
if(QT_QMAKE_EXECUTABLE_FINDQT)
exec_program(${QT_QMAKE_EXECUTABLE_FINDQT} ARGS "-query QT_VERSION"
OUTPUT_VARIABLE QTVERSION)
- if(QTVERSION MATCHES "4.*")
+ if(QTVERSION MATCHES "4")
set(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "Qt4 qmake program.")
set(QT4_INSTALLED TRUE)
endif()
@@ -144,12 +161,12 @@ else()
endif()
endif()
-if(DESIRED_QT_VERSION MATCHES 3)
+if(DESIRED_QT_VERSION EQUAL 3)
set(Qt3_FIND_REQUIRED ${Qt_FIND_REQUIRED})
set(Qt3_FIND_QUIETLY ${Qt_FIND_QUIETLY})
include(${CMAKE_CURRENT_LIST_DIR}/FindQt3.cmake)
endif()
-if(DESIRED_QT_VERSION MATCHES 4)
+if(DESIRED_QT_VERSION EQUAL 4)
set(Qt4_FIND_REQUIRED ${Qt_FIND_REQUIRED})
set(Qt4_FIND_QUIETLY ${Qt_FIND_QUIETLY})
include(${CMAKE_CURRENT_LIST_DIR}/FindQt4.cmake)
@@ -169,9 +186,9 @@ else()
endif()
if(NOT QT_FOUND AND DESIRED_QT_VERSION)
if(QT_REQUIRED)
- message(FATAL_ERROR "CMake was unable to find Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.")
+ message(FATAL_ERROR "CMake was unable to find Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_H_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.")
else()
- message( "CMake was unable to find desired Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE.")
+ message( "CMake was unable to find desired Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_H_FILE.")
endif()
endif()
endif()
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index 4fc8e406c..86997ba30 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -1,20 +1,34 @@
-# - Locate Qt include paths and libraries
+#.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
+# ::
+#
+# 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.
+#
+# ::
+#
+# 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
@@ -147,7 +161,7 @@ find_library(QT_QASSISTANTCLIENT_LIBRARY
# Qt 3 should prefer QTDIR over the PATH
find_program(QT_MOC_EXECUTABLE
- NAMES moc-qt3 moc moc3 moc3-mt
+ NAMES moc-qt3 moc3 moc3-mt moc
HINTS
ENV QTDIR
PATHS
@@ -172,7 +186,7 @@ endif()
# Qt 3 should prefer QTDIR over the PATH
find_program(QT_UIC_EXECUTABLE
- NAMES uic-qt3 uic uic3 uic3-mt
+ NAMES uic-qt3 uic3 uic3-mt uic
HINTS
ENV QTDIR
PATHS
@@ -281,12 +295,12 @@ if(QT_UIC_EXECUTABLE)
endif()
set(_QT_UIC_VERSION_3 FALSE)
-if("${QTVERSION_UIC}" MATCHES ".* 3..*")
+if("${QTVERSION_UIC}" MATCHES " 3.")
set(_QT_UIC_VERSION_3 TRUE)
endif()
set(_QT_MOC_VERSION_3 FALSE)
-if("${QTVERSION_MOC}" MATCHES ".* 3..*")
+if("${QTVERSION_MOC}" MATCHES " 3.")
set(_QT_MOC_VERSION_3 TRUE)
endif()
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 1d17ba3ae..11091b537 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -1,349 +1,299 @@
-# - Find Qt 4
-# 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 key variables and macros.
-# The variable QT_USE_FILE is set which is the path to a CMake file that can be included
-# to compile Qt 4 applications and libraries. It sets up the compilation
-# environment for include directories, preprocessor defines and populates a
-# QT_LIBRARIES variable.
+#.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:
-# find_package(Qt4 4.4.3 REQUIRED QtCore QtGui QtXml)
-# include(${QT_USE_FILE})
-# add_executable(myexe main.cpp)
-# target_link_libraries(myexe ${QT_LIBRARIES})
-#
-# The minimum required version can be specified using the standard find_package()-syntax
-# (see example above).
-# For compatibility with older versions of FindQt4.cmake it is also possible to
-# set the variable QT_MIN_VERSION to the minimum required version of Qt4 before the
-# find_package(Qt4) command.
-# If both are used, the version used in the find_package() command overrides the
-# one from QT_MIN_VERSION.
-#
-# When using the components argument, QT_USE_QT* variables are automatically set
-# for the QT_USE_FILE to pick up. If one wishes to manually set them, the
-# available ones to set include:
-# QT_DONT_USE_QTCORE
-# QT_DONT_USE_QTGUI
-# QT_USE_QT3SUPPORT
-# QT_USE_QTASSISTANT
-# QT_USE_QAXCONTAINER
-# QT_USE_QAXSERVER
-# QT_USE_QTDESIGNER
-# QT_USE_QTMOTIF
-# QT_USE_QTMAIN
-# QT_USE_QTMULTIMEDIA
-# QT_USE_QTNETWORK
-# QT_USE_QTNSPLUGIN
-# QT_USE_QTOPENGL
-# QT_USE_QTSQL
-# QT_USE_QTXML
-# QT_USE_QTSVG
-# QT_USE_QTTEST
-# QT_USE_QTUITOOLS
-# QT_USE_QTDBUS
-# QT_USE_QTSCRIPT
-# QT_USE_QTASSISTANTCLIENT
-# QT_USE_QTHELP
-# QT_USE_QTWEBKIT
-# QT_USE_QTXMLPATTERNS
-# QT_USE_PHONON
-# QT_USE_QTSCRIPTTOOLS
-# QT_USE_QTDECLARATIVE
-#
-# QT_USE_IMPORTED_TARGETS
-# If this variable is set to TRUE, FindQt4.cmake will create imported
-# library targets for the various Qt libraries and set the
-# library variables like QT_QTCORE_LIBRARY to point at these imported
-# targets instead of the library file on disk. This provides much better
-# handling of the release and debug versions of the Qt libraries and is
-# also always backwards compatible, except for the case that dependencies
-# of libraries are exported, these will then also list the names of the
-# imported targets as dependency and not the file location on disk. This
-# is much more flexible, but requires that FindQt4.cmake is executed before
-# such an exported dependency file is processed.
-#
-# Note that if using IMPORTED targets, the qtmain.lib static library is
-# automatically linked on Windows. 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_INCLUDE_DIRS_NO_SYSTEM
-# If this variable is set to TRUE, the Qt include directories
-# in the QT_USE_FILE will NOT have the SYSTEM keyword set.
-#
-# There are also some files that need processing by some Qt tools such as moc
-# and uic. Listed below are macros that may be used to process those files.
-#
-# macro QT4_WRAP_CPP(outfiles inputfile ... OPTIONS ...)
-# create moc code from a list of files containing Qt class with
-# the Q_OBJECT declaration. Per-directory preprocessor definitions
-# are also added. 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 )
-# 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.
-#
-# macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... )
-# 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 the
-# 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.
-#
-# You should have a look on the AUTOMOC property for targets to achieve the same results.
-#
-# 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.
-#
-# 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.
-#
-#
-# Below is a detailed list of variables that FindQt4.cmake sets.
-# QT_FOUND If false, don't try to use Qt.
-# Qt4_FOUND If false, don't try to use Qt 4.
-# 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.
-#
-# QT_EDITION Set to the edition of Qt (i.e. DesktopLight)
-# QT_EDITION_DESKTOPLIGHT True if QT_EDITION == DesktopLight
-# QT_QTCORE_FOUND True if QtCore was found.
-# QT_QTGUI_FOUND True if QtGui was found.
-# QT_QT3SUPPORT_FOUND True if Qt3Support was found.
-# QT_QTASSISTANT_FOUND True if QtAssistant was found.
-# QT_QTASSISTANTCLIENT_FOUND True if QtAssistantClient was found.
-# QT_QAXCONTAINER_FOUND True if QAxContainer was found (Windows only).
-# QT_QAXSERVER_FOUND True if QAxServer was found (Windows only).
-# QT_QTDBUS_FOUND True if QtDBus was found.
-# QT_QTDESIGNER_FOUND True if QtDesigner was found.
-# QT_QTDESIGNERCOMPONENTS True if QtDesignerComponents was found.
-# QT_QTHELP_FOUND True if QtHelp was found.
-# QT_QTMOTIF_FOUND True if QtMotif was found.
-# QT_QTMULTIMEDIA_FOUND True if QtMultimedia was found (since Qt 4.6.0).
-# QT_QTNETWORK_FOUND True if QtNetwork was found.
-# QT_QTNSPLUGIN_FOUND True if QtNsPlugin was found.
-# QT_QTOPENGL_FOUND True if QtOpenGL was found.
-# QT_QTSQL_FOUND True if QtSql was found.
-# QT_QTSVG_FOUND True if QtSvg was found.
-# QT_QTSCRIPT_FOUND True if QtScript was found.
-# QT_QTSCRIPTTOOLS_FOUND True if QtScriptTools was found.
-# QT_QTTEST_FOUND True if QtTest was found.
-# QT_QTUITOOLS_FOUND True if QtUiTools was found.
-# QT_QTWEBKIT_FOUND True if QtWebKit was found.
-# QT_QTXML_FOUND True if QtXml was found.
-# QT_QTXMLPATTERNS_FOUND True if QtXmlPatterns was found.
-# QT_PHONON_FOUND True if phonon was found.
-# QT_QTDECLARATIVE_FOUND True if QtDeclarative was found.
-#
-# QT_MAC_USE_COCOA For Mac OS X, its whether Cocoa or Carbon is used.
-# In general, this should not be used, but its useful
-# when having platform specific code.
-#
-# QT_DEFINITIONS Definitions to use when compiling code that uses Qt.
-# You do not need to use this if you include QT_USE_FILE.
-# The QT_USE_FILE will also define QT_DEBUG and QT_NO_DEBUG
-# to fit your current build type. Those are not contained
-# in QT_DEFINITIONS.
-#
-# QT_INCLUDES List of paths to all include directories of
-# Qt4 QT_INCLUDE_DIR and QT_QTCORE_INCLUDE_DIR are
-# always in this variable even if NOTFOUND,
-# all other INCLUDE_DIRS are
-# only added if they are found.
-# You do not need to use this if you include QT_USE_FILE.
-#
-#
-# Include directories for the Qt modules are listed here.
-# You do not need to use these variables if you include QT_USE_FILE.
-#
-# QT_INCLUDE_DIR Path to "include" of Qt4
-# QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support"
-# QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant"
-# QT_QTASSISTANTCLIENT_INCLUDE_DIR Path to "include/QtAssistant"
-# QT_QAXCONTAINER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only)
-# QT_QAXSERVER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only)
-# QT_QTCORE_INCLUDE_DIR Path to "include/QtCore"
-# QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus"
-# QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner"
-# QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR Path to "include/QtDesigner"
-# QT_QTGUI_INCLUDE_DIR Path to "include/QtGui"
-# QT_QTHELP_INCLUDE_DIR Path to "include/QtHelp"
-# QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif"
-# QT_QTMULTIMEDIA_INCLUDE_DIR Path to "include/QtMultimedia"
-# QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork"
-# QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin"
-# QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL"
-# QT_QTSCRIPT_INCLUDE_DIR Path to "include/QtScript"
-# QT_QTSQL_INCLUDE_DIR Path to "include/QtSql"
-# QT_QTSVG_INCLUDE_DIR Path to "include/QtSvg"
-# QT_QTTEST_INCLUDE_DIR Path to "include/QtTest"
-# QT_QTWEBKIT_INCLUDE_DIR Path to "include/QtWebKit"
-# QT_QTXML_INCLUDE_DIR Path to "include/QtXml"
-# QT_QTXMLPATTERNS_INCLUDE_DIR Path to "include/QtXmlPatterns"
-# QT_PHONON_INCLUDE_DIR Path to "include/phonon"
-# QT_QTSCRIPTTOOLS_INCLUDE_DIR Path to "include/QtScriptTools"
-# QT_QTDECLARATIVE_INCLUDE_DIR Path to "include/QtDeclarative"
-#
-# QT_BINARY_DIR Path to "bin" of Qt4
-# QT_LIBRARY_DIR Path to "lib" of Qt4
-# QT_PLUGINS_DIR Path to "plugins" for Qt4
-# QT_TRANSLATIONS_DIR Path to "translations" of Qt4
-# QT_IMPORTS_DIR Path to "imports" of Qt4
-# QT_DOC_DIR Path to "doc" of Qt4
-# QT_MKSPECS_DIR Path to "mkspecs" of Qt4
#
+# .. 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.
-# In that case, the following library variables will contain both.
-# You do not need to use these variables if you include QT_USE_FILE,
-# and use QT_LIBRARIES.
-#
-# QT_QT3SUPPORT_LIBRARY The Qt3Support library
-# QT_QTASSISTANT_LIBRARY The QtAssistant library
-# QT_QTASSISTANTCLIENT_LIBRARY The QtAssistantClient library
-# QT_QAXCONTAINER_LIBRARY The QAxContainer library (Windows only)
-# QT_QAXSERVER_LIBRARY The QAxServer library (Windows only)
-# QT_QTCORE_LIBRARY The QtCore library
-# QT_QTDBUS_LIBRARY The QtDBus library
-# QT_QTDESIGNER_LIBRARY The QtDesigner library
-# QT_QTDESIGNERCOMPONENTS_LIBRARY The QtDesignerComponents library
-# QT_QTGUI_LIBRARY The QtGui library
-# QT_QTHELP_LIBRARY The QtHelp library
-# QT_QTMOTIF_LIBRARY The QtMotif library
-# QT_QTMULTIMEDIA_LIBRARY The QtMultimedia library
-# QT_QTNETWORK_LIBRARY The QtNetwork library
-# QT_QTNSPLUGIN_LIBRARY The QtNsPLugin library
-# QT_QTOPENGL_LIBRARY The QtOpenGL library
-# QT_QTSCRIPT_LIBRARY The QtScript library
-# QT_QTSQL_LIBRARY The QtSql library
-# QT_QTSVG_LIBRARY The QtSvg library
-# QT_QTTEST_LIBRARY The QtTest library
-# QT_QTUITOOLS_LIBRARY The QtUiTools library
-# QT_QTWEBKIT_LIBRARY The QtWebKit library
-# QT_QTXML_LIBRARY The QtXml library
-# QT_QTXMLPATTERNS_LIBRARY The QtXmlPatterns library
-# QT_QTMAIN_LIBRARY The qtmain library for Windows
-# QT_PHONON_LIBRARY The phonon library
-# QT_QTSCRIPTTOOLS_LIBRARY The QtScriptTools library
-#
-# The QtDeclarative library: QT_QTDECLARATIVE_LIBRARY
-#
-# 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_UIC3_EXECUTABLE Where to find the uic3 tool.
-# QT_RCC_EXECUTABLE Where to find the rcc tool
-# QT_DBUSCPP2XML_EXECUTABLE Where to find the qdbuscpp2xml tool.
-# QT_DBUSXML2CPP_EXECUTABLE Where to find the qdbusxml2cpp tool.
-# QT_LUPDATE_EXECUTABLE Where to find the lupdate tool.
-# QT_LRELEASE_EXECUTABLE Where to find the lrelease tool.
-# QT_QCOLLECTIONGENERATOR_EXECUTABLE Where to find the qcollectiongenerator tool.
-# QT_DESIGNER_EXECUTABLE Where to find the Qt designer tool.
-# QT_LINGUIST_EXECUTABLE Where to find the Qt linguist tool.
-#
-#
-# These are around for backwards compatibility
-# they will be set
-# QT_WRAP_CPP Set true if QT_MOC_EXECUTABLE is found
-# QT_WRAP_UI Set true if QT_UIC_EXECUTABLE is found
-#
-# These variables do _NOT_ have any effect anymore (compared to FindQt.cmake)
-# QT_MT_REQUIRED Qt4 is now always multithreaded
-#
-# These variables are set to "" Because Qt structure changed
-# (They make no sense in Qt4)
-# QT_QT_LIBRARY Qt-Library is now split
+# :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::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.
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
@@ -392,6 +342,7 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSymbolExists.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/MacroAddFileDependencies.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
set(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
@@ -574,7 +525,21 @@ set(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
set(_QT4_QMAKE_NAMES qmake qmake4 qmake-qt4 qmake-mac)
_qt4_find_qmake("${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION)
-if (QT_QMAKE_EXECUTABLE AND QTVERSION)
+if (QT_QMAKE_EXECUTABLE AND
+ QTVERSION VERSION_GREATER 3 AND QTVERSION VERSION_LESS 5)
+
+ if (Qt5Core_FOUND)
+ # Qt5CoreConfig sets QT_MOC_EXECUTABLE as a non-cache variable to the Qt 5
+ # path to moc. Unset that variable when Qt 4 and 5 are used together, so
+ # that when find_program looks for moc, it is not set to the Qt 5 version.
+ # If FindQt4 has already put the Qt 4 path in the cache, the unset()
+ # command 'unhides' the (correct) cache variable.
+ unset(QT_MOC_EXECUTABLE)
+ endif()
+ if (QT_QMAKE_EXECUTABLE_LAST)
+ string(COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED)
+ endif()
+ set(QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE)
_qt4_get_version_components("${QTVERSION}" QT_VERSION_MAJOR QT_VERSION_MINOR QT_VERSION_PATCH)
@@ -594,7 +559,8 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
set(QT_MKSPECS_DIR NOTFOUND)
find_path(QT_MKSPECS_DIR NAMES qconfig.pri
HINTS ${qt_cross_paths} ${qt_mkspecs_dirs}
- DOC "The location of the Qt mkspecs containing qconfig.pri")
+ DOC "The location of the Qt mkspecs containing qconfig.pri"
+ NO_CMAKE_FIND_ROOT_PATH)
endif()
if(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
@@ -656,9 +622,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE)
set(QT_QTCORE_FOUND 1)
else()
- message(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" "
- "but QtCore could not be found there. "
- "Qt is NOT installed correctly for the target build environment.")
+ if(NOT Qt4_FIND_QUIETLY)
+ message(WARNING
+ "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as "
+ "\"${QT_LIBRARY_DIR_TMP}\" "
+ "but QtCore could not be found there. "
+ "Qt is NOT installed correctly for the target build environment.")
+ endif()
set(Qt4_FOUND FALSE)
if(Qt4_FIND_REQUIRED)
message( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.")
@@ -750,7 +720,8 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
endforeach()
find_path(QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer
HINTS ${qt_cross_paths} ${qt_plugins_dir}
- DOC "The location of the Qt plugins")
+ DOC "The location of the Qt plugins"
+ NO_CMAKE_FIND_ROOT_PATH)
endif ()
# ask qmake for the translations directory
@@ -770,6 +741,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
find_path(QT_IMPORTS_DIR NAMES Qt
HINTS ${qt_cross_paths} ${qt_imports_dir}
DOC "The location of the Qt imports"
+ NO_CMAKE_FIND_ROOT_PATH
NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
mark_as_advanced(QT_IMPORTS_DIR)
@@ -788,11 +760,10 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
# Find out what window system we're using
#
#############################################
- # Save required variable
- set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
- set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
+ cmake_push_check_state()
# Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}")
+ set(CMAKE_REQUIRED_QUIET ${Qt4_FIND_QUIETLY})
# Check for Window system symbols (note: only one should end up being set)
CHECK_CXX_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11)
CHECK_CXX_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN)
@@ -812,9 +783,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
endif ()
endif ()
- # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
- set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
- set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
+ cmake_pop_check_state()
#
#############################################
@@ -1011,20 +980,24 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
endmacro()
macro(_qt4_add_target_depends _QT_MODULE)
- get_target_property(_configs Qt4::${_QT_MODULE} IMPORTED_CONFIGURATIONS)
- _qt4_add_target_depends_internal(${_QT_MODULE} INTERFACE_LINK_LIBRARIES ${ARGN})
- foreach(_config ${_configs})
- _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN})
- endforeach()
- set(_configs)
+ if (TARGET Qt4::${_QT_MODULE})
+ get_target_property(_configs Qt4::${_QT_MODULE} IMPORTED_CONFIGURATIONS)
+ _qt4_add_target_depends_internal(${_QT_MODULE} INTERFACE_LINK_LIBRARIES ${ARGN})
+ foreach(_config ${_configs})
+ _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN})
+ endforeach()
+ set(_configs)
+ endif()
endmacro()
macro(_qt4_add_target_private_depends _QT_MODULE)
- get_target_property(_configs ${_QT_MODULE} IMPORTED_CONFIGURATIONS)
- foreach(_config ${_configs})
- _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_DEPENDENT_LIBRARIES_${_config} ${ARGN})
- endforeach()
- set(_configs)
+ if (TARGET Qt4::${_QT_MODULE})
+ get_target_property(_configs Qt4::${_QT_MODULE} IMPORTED_CONFIGURATIONS)
+ foreach(_config ${_configs})
+ _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_DEPENDENT_LIBRARIES_${_config} ${ARGN})
+ endforeach()
+ set(_configs)
+ endif()
endmacro()
@@ -1036,6 +1009,10 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
"${QT_MKSPECS_DIR}/default"
${QT_INCLUDE_DIR}
)
+ set_property(TARGET Qt4::QtCore APPEND PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS
+ $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>
+ )
set_property(TARGET Qt4::QtCore PROPERTY
INTERFACE_QT_MAJOR_VERSION 4
)
@@ -1156,71 +1133,34 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
set(QT_LINGUIST_EXECUTABLE NOTFOUND)
endif()
- find_program(QT_MOC_EXECUTABLE
- NAMES moc-qt4 moc moc4
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
- )
-
- find_program(QT_UIC_EXECUTABLE
- NAMES uic-qt4 uic uic4
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
- )
-
- find_program(QT_UIC3_EXECUTABLE
- NAMES uic3
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
- )
-
- find_program(QT_RCC_EXECUTABLE
- NAMES rcc
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
- )
-
- find_program(QT_DBUSCPP2XML_EXECUTABLE
- NAMES qdbuscpp2xml
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
- )
-
- find_program(QT_DBUSXML2CPP_EXECUTABLE
- NAMES qdbusxml2cpp
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
- )
-
- find_program(QT_LUPDATE_EXECUTABLE
- NAMES lupdate-qt4 lupdate lupdate4
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
- )
-
- find_program(QT_LRELEASE_EXECUTABLE
- NAMES lrelease-qt4 lrelease lrelease4
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
- )
-
- find_program(QT_QCOLLECTIONGENERATOR_EXECUTABLE
- NAMES qcollectiongenerator-qt4 qcollectiongenerator
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
- )
-
- find_program(QT_DESIGNER_EXECUTABLE
- NAMES designer-qt4 designer designer4
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
- )
+ macro(_find_qt4_program VAR NAME)
+ find_program(${VAR}
+ NAMES ${ARGN}
+ PATHS ${QT_BINARY_DIR}
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+ if (${VAR} AND NOT TARGET ${NAME})
+ add_executable(${NAME} IMPORTED)
+ set_property(TARGET ${NAME} PROPERTY IMPORTED_LOCATION ${${VAR}})
+ endif()
+ endmacro()
- find_program(QT_LINGUIST_EXECUTABLE
- NAMES linguist-qt4 linguist linguist4
- PATHS ${QT_BINARY_DIR}
- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
- )
+ _find_qt4_program(QT_MOC_EXECUTABLE Qt4::moc moc-qt4 moc4 moc)
+ _find_qt4_program(QT_UIC_EXECUTABLE Qt4::uic uic-qt4 uic4 uic)
+ _find_qt4_program(QT_UIC3_EXECUTABLE Qt4::uic3 uic3)
+ _find_qt4_program(QT_RCC_EXECUTABLE Qt4::rcc rcc)
+ _find_qt4_program(QT_DBUSCPP2XML_EXECUTABLE Qt4::qdbuscpp2xml qdbuscpp2xml)
+ _find_qt4_program(QT_DBUSXML2CPP_EXECUTABLE Qt4::qdbusxml2cpp qdbusxml2cpp)
+ _find_qt4_program(QT_LUPDATE_EXECUTABLE Qt4::lupdate lupdate-qt4 lupdate4 lupdate)
+ _find_qt4_program(QT_LRELEASE_EXECUTABLE Qt4::lrelease lrelease-qt4 lrelease4 lrelease)
+ _find_qt4_program(QT_QCOLLECTIONGENERATOR_EXECUTABLE Qt4::qcollectiongenerator qcollectiongenerator-qt4 qcollectiongenerator)
+ _find_qt4_program(QT_DESIGNER_EXECUTABLE Qt4::designer designer-qt4 designer4 designer)
+ _find_qt4_program(QT_LINGUIST_EXECUTABLE Qt4::linguist linguist-qt4 linguist4 linguist)
+
+ if (NOT TARGET Qt4::qmake)
+ add_executable(Qt4::qmake IMPORTED)
+ set_property(TARGET Qt4::qmake PROPERTY IMPORTED_LOCATION ${QT_QMAKE_EXECUTABLE})
+ endif()
if (QT_MOC_EXECUTABLE)
set(QT_WRAP_CPP "YES")
@@ -1260,14 +1200,14 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
set( QT_PLUGIN_TYPES accessible bearer codecs decorations designer gfxdrivers graphicssystems iconengines imageformats inputmethods mousedrivers phonon_backend script sqldrivers )
set( QT_ACCESSIBLE_PLUGINS qtaccessiblecompatwidgets qtaccessiblewidgets )
- set( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer )
+ set( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer qnativewifibearer )
set( QT_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs )
set( QT_DECORATIONS_PLUGINS qdecorationdefault qdecorationwindows )
set( QT_DESIGNER_PLUGINS arthurplugin containerextension customwidgetplugin phononwidgets qdeclarativeview qt3supportwidgets qwebview taskmenuextension worldtimeclockplugin )
set( QT_GRAPHICSDRIVERS_PLUGINS qgfxtransformed qgfxvnc qscreenvfb )
set( QT_GRAPHICSSYSTEMS_PLUGINS qglgraphicssystem qtracegraphicssystem )
set( QT_ICONENGINES_PLUGINS qsvgicon )
- set( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff )
+ set( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff qtga )
set( QT_INPUTMETHODS_PLUGINS qimsw_multi )
set( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler )
if(APPLE)
@@ -1281,7 +1221,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
set( QT_PHONON_PLUGINS ${QT_PHONON_BACKEND_PLUGINS} )
set( QT_QT3SUPPORT_PLUGINS qtaccessiblecompatwidgets )
set( QT_QTCORE_PLUGINS ${QT_BEARER_PLUGINS} ${QT_CODECS_PLUGINS} )
- set( QT_QTGUI_PLUGINS qtaccessiblewidgets qgif qjpeg qmng qico qtiff ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} )
+ set( QT_QTGUI_PLUGINS qtaccessiblewidgets ${QT_IMAGEFORMATS_PLUGINS} ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} )
set( QT_QTSCRIPT_PLUGINS ${QT_SCRIPT_PLUGINS} )
set( QT_QTSQL_PLUGINS ${QT_SQLDRIVERS_PLUGINS} )
set( QT_QTSVG_PLUGINS qsvg qsvgicon )
@@ -1381,7 +1321,7 @@ endif()
if (NOT QT_VERSION_MAJOR EQUAL 4)
set(VERSION_MSG "Found unsuitable Qt version \"${QTVERSION}\" from ${QT_QMAKE_EXECUTABLE}")
- set(QT4_FOUND FALSE)
+ set(Qt4_FOUND FALSE)
if(Qt4_FIND_REQUIRED)
message( FATAL_ERROR "${VERSION_MSG}, this code requires Qt 4.x")
else()
diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake
index 42a0dce77..27792691b 100644
--- a/Modules/FindQuickTime.cmake
+++ b/Modules/FindQuickTime.cmake
@@ -1,11 +1,15 @@
-# Locate QuickTime
-# This module defines
-# QUICKTIME_LIBRARY
+#.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
+# $QUICKTIME_DIR is an environment variable that would correspond to the
+# ./configure --prefix=$QUICKTIME_DIR
#
# Created by Eric Wing.
diff --git a/Modules/FindRTI.cmake b/Modules/FindRTI.cmake
index 60990b767..1aad0a80a 100644
--- a/Modules/FindRTI.cmake
+++ b/Modules/FindRTI.cmake
@@ -1,17 +1,32 @@
-# - 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.
+#.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)
+#
#
-# 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
+#
+# ::
+#
+# 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>
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index c02158f13..e5ea210e1 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -1,20 +1,34 @@
-# - Find Ruby
-# This module finds if Ruby is installed and determines where the include files
-# and libraries are. Ruby 1.8 and 1.9 are supported.
+#.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)
+# 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:
+# 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
+# ``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
#
-# RUBY_INCLUDE_PATH = same as RUBY_INCLUDE_DIRS, only provided for compatibility reasons, don't use it
+# Also:
+#
+# ``RUBY_INCLUDE_PATH``
+# same as RUBY_INCLUDE_DIRS, only provided for compatibility reasons, don't use it
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
@@ -44,7 +58,7 @@
set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ruby)
# if 1.9 is required, don't look for ruby18 and ruby1.8, default to version 1.8
-if(Ruby_FIND_VERSION_MAJOR AND Ruby_FIND_VERSION_MINOR)
+if(DEFINED Ruby_FIND_VERSION_MAJOR AND DEFINED Ruby_FIND_VERSION_MINOR)
set(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${RUBY_FIND_VERSION_MINOR}")
# we can't construct that if only major version is given
set(_RUBY_POSSIBLE_EXECUTABLE_NAMES
@@ -56,6 +70,8 @@ else()
endif()
if(NOT Ruby_FIND_VERSION_EXACT)
+ list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.1 ruby21)
+ list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.0 ruby20)
list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby1.9 ruby19)
# if we want a version below 1.9, also look for ruby 1.8
@@ -68,14 +84,13 @@ endif()
find_program(RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES})
-
if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
function(_RUBY_CONFIG_VAR RBVAR OUTVAR)
execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['${RBVAR}']"
RESULT_VARIABLE _RUBY_SUCCESS
OUTPUT_VARIABLE _RUBY_OUTPUT
ERROR_QUIET)
- if(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT)
+ if(_RUBY_SUCCESS OR _RUBY_OUTPUT STREQUAL "")
execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']"
RESULT_VARIABLE _RUBY_SUCCESS
OUTPUT_VARIABLE _RUBY_OUTPUT
@@ -94,6 +109,7 @@ if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
_RUBY_CONFIG_VAR("archdir" RUBY_ARCH_DIR)
_RUBY_CONFIG_VAR("arch" RUBY_ARCH)
_RUBY_CONFIG_VAR("rubyhdrdir" RUBY_HDR_DIR)
+ _RUBY_CONFIG_VAR("rubyarchhdrdir" RUBY_ARCHHDR_DIR)
_RUBY_CONFIG_VAR("libdir" RUBY_POSSIBLE_LIB_DIR)
_RUBY_CONFIG_VAR("rubylibdir" RUBY_RUBY_LIB_DIR)
@@ -115,7 +131,8 @@ if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
set(RUBY_VERSION_MINOR ${RUBY_VERSION_MINOR} CACHE PATH "The Ruby minor version" FORCE)
set(RUBY_VERSION_PATCH ${RUBY_VERSION_PATCH} CACHE PATH "The Ruby patch version" FORCE)
set(RUBY_ARCH_DIR ${RUBY_ARCH_DIR} CACHE PATH "The Ruby arch dir" FORCE)
- set(RUBY_HDR_DIR ${RUBY_HDR_DIR} CACHE PATH "The Ruby header dir (1.9)" FORCE)
+ set(RUBY_HDR_DIR ${RUBY_HDR_DIR} CACHE PATH "The Ruby header dir (1.9+)" FORCE)
+ set(RUBY_ARCHHDR_DIR ${RUBY_ARCHHDR_DIR} CACHE PATH "The Ruby arch header dir (2.0+)" FORCE)
set(RUBY_POSSIBLE_LIB_DIR ${RUBY_POSSIBLE_LIB_DIR} CACHE PATH "The Ruby lib dir" FORCE)
set(RUBY_RUBY_LIB_DIR ${RUBY_RUBY_LIB_DIR} CACHE PATH "The Ruby ruby-lib dir" FORCE)
set(RUBY_SITEARCH_DIR ${RUBY_SITEARCH_DIR} CACHE PATH "The Ruby site arch dir" FORCE)
@@ -128,6 +145,7 @@ if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
RUBY_ARCH_DIR
RUBY_ARCH
RUBY_HDR_DIR
+ RUBY_ARCHHDR_DIR
RUBY_POSSIBLE_LIB_DIR
RUBY_RUBY_LIB_DIR
RUBY_SITEARCH_DIR
@@ -149,10 +167,20 @@ if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
set(RUBY_VERSION_MINOR 8)
set(RUBY_VERSION_PATCH 0)
# check whether we found 1.9.x
- if(${RUBY_EXECUTABLE} MATCHES "ruby1.?9" OR RUBY_HDR_DIR)
+ if(${RUBY_EXECUTABLE} MATCHES "ruby1.?9")
set(RUBY_VERSION_MAJOR 1)
set(RUBY_VERSION_MINOR 9)
endif()
+ # check whether we found 2.0.x
+ if(${RUBY_EXECUTABLE} MATCHES "ruby2.?0")
+ set(RUBY_VERSION_MAJOR 2)
+ set(RUBY_VERSION_MINOR 0)
+ endif()
+ # check whether we found 2.1.x
+ if(${RUBY_EXECUTABLE} MATCHES "ruby2.?1")
+ set(RUBY_VERSION_MAJOR 2)
+ set(RUBY_VERSION_MINOR 1)
+ endif()
endif()
if(RUBY_VERSION_MAJOR)
@@ -178,6 +206,7 @@ if( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NO
HINTS
${RUBY_HDR_DIR}/${RUBY_ARCH}
${RUBY_ARCH_DIR}
+ ${RUBY_ARCHHDR_DIR}
)
set(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIRS} ${RUBY_CONFIG_INCLUDE_DIR} )
@@ -205,11 +234,16 @@ if(WIN32)
set( _RUBY_MSVC_RUNTIME "90" )
endif()
+ set(_RUBY_ARCH_PREFIX "")
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_RUBY_ARCH_PREFIX "x64-")
+ endif()
+
list(APPEND _RUBY_POSSIBLE_LIB_NAMES
- "msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}"
- "msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}-static"
- "msvcrt-ruby${_RUBY_NODOT_VERSION}"
- "msvcrt-ruby${_RUBY_NODOT_VERSION}-static" )
+ "${_RUBY_ARCH_PREFIX}msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}"
+ "${_RUBY_ARCH_PREFIX}msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}-static"
+ "${_RUBY_ARCH_PREFIX}msvcrt-ruby${_RUBY_NODOT_VERSION}"
+ "${_RUBY_ARCH_PREFIX}msvcrt-ruby${_RUBY_NODOT_VERSION}-static" )
endif()
find_library(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR} )
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index fec142ed5..45ca1d449 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -1,57 +1,72 @@
-# - Locate SDL library
+#.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 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 the proper link flags
-# as part of the returned SDL_LIBRARY variable.
+#
+# ::
+#
+# 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
+# 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.
+#
+# 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.
+# $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
+# 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).
+# 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).
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
@@ -70,20 +85,28 @@
find_path(SDL_INCLUDE_DIR SDL.h
HINTS
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL SDL12 SDL11
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(VC_LIB_PATH_SUFFIX lib/x64)
+else()
+ set(VC_LIB_PATH_SUFFIX lib/x86)
+endif()
+
# SDL-1.1 is the name used by FreeBSD ports...
# don't confuse it for the version number.
find_library(SDL_LIBRARY_TEMP
NAMES SDL SDL-1.1
HINTS
ENV SDLDIR
- PATH_SUFFIXES lib
+ PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
if(NOT SDL_BUILDING_LIBRARY)
- if(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework")
+ if(NOT SDL_INCLUDE_DIR MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDLmain for compatibility even though they don't
@@ -92,7 +115,7 @@ if(NOT SDL_BUILDING_LIBRARY)
NAMES SDLmain SDLmain-1.1
HINTS
ENV SDLDIR
- PATH_SUFFIXES lib
+ PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
PATHS
/sw
/opt/local
diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake
index 30d74acfb..49b5e40c1 100644
--- a/Modules/FindSDL_image.cmake
+++ b/Modules/FindSDL_image.cmake
@@ -1,20 +1,35 @@
-# - Locate SDL_image library
+#.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
+#
+# ::
+#
+# 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 compatiblity 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
+# 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).
@@ -40,9 +55,17 @@ find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h
HINTS
ENV SDLIMAGEDIR
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(VC_LIB_PATH_SUFFIX lib/x64)
+else()
+ set(VC_LIB_PATH_SUFFIX lib/x86)
+endif()
+
if(NOT SDL_IMAGE_LIBRARY AND SDLIMAGE_LIBRARY)
set(SDL_IMAGE_LIBRARY ${SDLIMAGE_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
@@ -52,7 +75,7 @@ find_library(SDL_IMAGE_LIBRARY
HINTS
ENV SDLIMAGEDIR
ENV SDLDIR
- PATH_SUFFIXES lib
+ PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
if(SDL_IMAGE_INCLUDE_DIR AND EXISTS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h")
diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake
index 8ca7cc33c..9e11796f7 100644
--- a/Modules/FindSDL_mixer.cmake
+++ b/Modules/FindSDL_mixer.cmake
@@ -1,20 +1,35 @@
-# - Locate SDL_mixer library
+#.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
+#
+# ::
+#
+# 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 compatiblity 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
+# 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).
@@ -40,9 +55,17 @@ find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h
HINTS
ENV SDLMIXERDIR
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(VC_LIB_PATH_SUFFIX lib/x64)
+else()
+ set(VC_LIB_PATH_SUFFIX lib/x86)
+endif()
+
if(NOT SDL_MIXER_LIBRARY AND SDLMIXER_LIBRARY)
set(SDL_MIXER_LIBRARY ${SDLMIXER_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
@@ -52,7 +75,7 @@ find_library(SDL_MIXER_LIBRARY
HINTS
ENV SDLMIXERDIR
ENV SDLDIR
- PATH_SUFFIXES lib
+ PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
if(SDL_MIXER_INCLUDE_DIR AND EXISTS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h")
diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake
index ca707af8d..ef23573e8 100644
--- a/Modules/FindSDL_net.cmake
+++ b/Modules/FindSDL_net.cmake
@@ -1,20 +1,34 @@
-# - Locate SDL_net library
+#.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
+#
+# ::
+#
+# 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 compatiblity 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
+# 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).
@@ -40,9 +54,17 @@ find_path(SDL_NET_INCLUDE_DIR SDL_net.h
HINTS
ENV SDLNETDIR
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(VC_LIB_PATH_SUFFIX lib/x64)
+else()
+ set(VC_LIB_PATH_SUFFIX lib/x86)
+endif()
+
if(NOT SDL_NET_LIBRARY AND SDLNET_LIBRARY)
set(SDL_NET_LIBRARY ${SDLNET_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
@@ -52,7 +74,7 @@ find_library(SDL_NET_LIBRARY
HINTS
ENV SDLNETDIR
ENV SDLDIR
- PATH_SUFFIXES lib
+ PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
if(SDL_NET_INCLUDE_DIR AND EXISTS "${SDL_NET_INCLUDE_DIR}/SDL_net.h")
diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake
index efd26580b..494d358b3 100644
--- a/Modules/FindSDL_sound.cmake
+++ b/Modules/FindSDL_sound.cmake
@@ -1,59 +1,81 @@
-# - Locates the SDL_sound library
+#.rst:
+# FindSDL_sound
+# -------------
#
-# This module depends on SDL being found and
-# must be called AFTER FindSDL.cmake is called.
+# 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. This is a read-only variable and is marked INTERNAL.
-# 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
+#
+# ::
+#
+# 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. This is a read-only variable and is marked INTERNAL.
+# 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.
+#
+# ::
+#
+# 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.
+# ::
+#
+# 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.
+# 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.
+# 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.
+# 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.
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
@@ -77,7 +99,9 @@ find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h
HINTS
ENV SDLSOUNDDIR
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
find_library(SDL_SOUND_LIBRARY
@@ -85,7 +109,7 @@ find_library(SDL_SOUND_LIBRARY
HINTS
ENV SDLSOUNDDIR
ENV SDLDIR
- PATH_SUFFIXES lib
+ PATH_SUFFIXES lib VisualC/win32lib
)
if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
@@ -160,7 +184,7 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
# in the SDL_LIBRARY string after the "-framework".
# But if I quote the stuff in INCLUDE_DIRECTORIES, it doesn't work.
file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/CMakeLists.txt
- "cmake_minimum_required(VERSION 2.8)
+ "cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(DetermineSoundLibs)
include_directories(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
add_executable(DetermineSoundLibs DetermineSoundLibs.c)
diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake
index bb0ca9147..4b527fabe 100644
--- a/Modules/FindSDL_ttf.cmake
+++ b/Modules/FindSDL_ttf.cmake
@@ -1,20 +1,34 @@
-# - Locate SDL_ttf library
+#.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
+#
+# ::
+#
+# 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 compatiblity 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
+# 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).
@@ -40,9 +54,17 @@ find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h
HINTS
ENV SDLTTFDIR
ENV SDLDIR
- PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+ PATH_SUFFIXES SDL
+ # path suffixes to search inside ENV{SDLDIR}
+ include/SDL include/SDL12 include/SDL11 include
)
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(VC_LIB_PATH_SUFFIX lib/x64)
+else()
+ set(VC_LIB_PATH_SUFFIX lib/x86)
+endif()
+
if(NOT SDL_TTF_LIBRARY AND SDLTTF_LIBRARY)
set(SDL_TTF_LIBRARY ${SDLTTF_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
@@ -52,7 +74,7 @@ find_library(SDL_TTF_LIBRARY
HINTS
ENV SDLTTFDIR
ENV SDLDIR
- PATH_SUFFIXES lib
+ PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
if(SDL_TTF_INCLUDE_DIR AND EXISTS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h")
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake
index db60b888c..818d1f213 100644
--- a/Modules/FindSWIG.cmake
+++ b/Modules/FindSWIG.cmake
@@ -1,21 +1,31 @@
-# - Find SWIG
+#.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)
+# ::
+#
+# 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
#
-# 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
#
+#
+# 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
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
# Copyright 2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
+# Copyright 2014 Sylvain Joubert <joubert.sy@gmail.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -27,7 +37,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-find_program(SWIG_EXECUTABLE NAMES swig2.0 swig)
+find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig)
if(SWIG_EXECUTABLE)
execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib
@@ -43,11 +53,9 @@ if(SWIG_EXECUTABLE)
endif()
else()
string(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output})
- # force the path to be computed each time in case SWIG_EXECUTABLE has changed.
- set(SWIG_DIR SWIG_DIR-NOTFOUND)
- find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output})
+ find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output} NO_CMAKE_FIND_ROOT_PATH)
if(SWIG_DIR)
- set(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake)
+ set(SWIG_USE_FILE ${CMAKE_CURRENT_LIST_DIR}/UseSWIG.cmake)
execute_process(COMMAND ${SWIG_EXECUTABLE} -version
OUTPUT_VARIABLE SWIG_version_output
ERROR_VARIABLE SWIG_version_output
@@ -66,3 +74,5 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR
VERSION_VAR SWIG_VERSION )
+
+mark_as_advanced(SWIG_DIR SWIG_VERSION)
diff --git a/Modules/FindSelfPackers.cmake b/Modules/FindSelfPackers.cmake
index fd2864251..238be89a0 100644
--- a/Modules/FindSelfPackers.cmake
+++ b/Modules/FindSelfPackers.cmake
@@ -1,9 +1,16 @@
-# - Find upx
-# This module looks for some executable packers (i.e. software that
+#.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
+# executables or shared libs. Examples:
+#
+# ::
+#
+# UPX: http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index b79780577..51e279d23 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -1,63 +1,120 @@
+#.rst:
+# FindSquish
+# ----------
#
-# ---- Find Squish
-# This module can be used to find Squish. Currently Squish versions 3 and 4 are supported.
+# -- Typical Use
#
-# ---- Variables and Macros
-# 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?
+# 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] )
#
-# 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.
-#
-# ---- Typical Use
+#
+# ``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 4.0)
+# find_package(Squish)
# if (SQUISH_FOUND)
-# squish_v4_add_test(myTestName AUT myApp SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite TEST someSquishTest SETTINGSGROUP myGroup )
+# squish_v3_add_test(myTestName myApplication testCase envVars testWrapper)
# 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.
#
-# ---- Typical Use
-# 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)
+#
+# ::
#
-# 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.
+# This is deprecated. Use SQUISH_V3_ADD_TEST() if you are using Squish 3.x instead.
#=============================================================================
@@ -139,7 +196,7 @@ if(SQUISH_CLIENT_EXECUTABLE)
execute_process(COMMAND "${SQUISH_CLIENT_EXECUTABLE}" --version
OUTPUT_VARIABLE _squishVersionOutput
ERROR_QUIET )
- if("${_squishVersionOutput}" MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+).*$")
+ if("${_squishVersionOutput}" MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
set(SQUISH_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(SQUISH_VERSION_MINOR "${CMAKE_MATCH_2}")
set(SQUISH_VERSION_PATCH "${CMAKE_MATCH_3}")
@@ -156,7 +213,7 @@ else()
endif()
# record if Squish was found
-include(FindPackageHandleStandardArgs)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(Squish REQUIRED_VARS SQUISH_INSTALL_DIR SQUISH_CLIENT_EXECUTABLE SQUISH_SERVER_EXECUTABLE
VERSION_VAR SQUISH_VERSION )
diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake
index f1bfc75bc..0d13318bd 100644
--- a/Modules/FindSubversion.cmake
+++ b/Modules/FindSubversion.cmake
@@ -1,37 +1,62 @@
-# - Extract information from a subversion working copy
+#.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 compatiblity reasons
+#
+# ::
+#
+# 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 compatiblity reasons
+#
+#
#
# The minimum required version of Subversion can be specified using the
-# standard syntax, e.g. find_package(Subversion 1.4)
+# 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>)
-# 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:
-# <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_INFO(<dir> <var-prefix>)
+# 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:
+#
+# ::
+#
+# <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
+# subversion working copy at a given location. This macro defines the
# variable:
-# <var-prefix>_LAST_CHANGED_LOG - last log of base revision
+#
+# ::
+#
+# <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_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()
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -48,6 +73,8 @@
# License text for the above reference.)
find_program(Subversion_SVN_EXECUTABLE svn
+ PATHS
+ [HKEY_LOCAL_MACHINE\\Software\\TortoiseSVN;Directory]/bin
DOC "subversion command line client")
mark_as_advanced(Subversion_SVN_EXECUTABLE)
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index 37e43d05a..a83e277b0 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -1,35 +1,45 @@
-# - Find Tcl includes and libraries.
-# 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
+#.rst:
+# FindTCL
+# -------
#
-# In an effort to remove some clutter and clear up some issues for people
-# who are not necessarily Tcl/Tk gurus/developpers, some variables were
-# moved or removed. Changes compared to CMake 2.4 are:
-# - The stub libraries are now found in FindTclStub.cmake
-# => they were only useful for people writing Tcl/Tk extensions.
-# - TCL_LIBRARY_DEBUG and TK_LIBRARY_DEBUG were removed.
-# => 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.
-# - TK_INTERNAL_PATH was removed.
-# => 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.
+# 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/developpers, 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.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
index b48fb0e1d..e60049848 100644
--- a/Modules/FindTIFF.cmake
+++ b/Modules/FindTIFF.cmake
@@ -1,14 +1,44 @@
-# - Find TIFF library
-# Find the native TIFF includes and library
-# This module defines
-# TIFF_INCLUDE_DIR, where to find tiff.h, etc.
-# TIFF_LIBRARIES, libraries to link against to use TIFF.
-# TIFF_FOUND, If false, do not try to use TIFF.
-# also defined, but not for general use are
-# TIFF_LIBRARY, where to find 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
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
+# Copyright 2015 University of Dundee
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -23,7 +53,19 @@
find_path(TIFF_INCLUDE_DIR tiff.h)
set(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3)
-find_library(TIFF_LIBRARY NAMES ${TIFF_NAMES} )
+foreach(name ${TIFF_NAMES})
+ list(APPEND TIFF_NAMES_DEBUG "${name}d")
+endforeach()
+
+if(NOT TIFF_LIBRARY)
+ find_library(TIFF_LIBRARY_RELEASE NAMES ${TIFF_NAMES})
+ find_library(TIFF_LIBRARY_DEBUG NAMES ${TIFF_NAMES_DEBUG})
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(TIFF)
+ mark_as_advanced(TIFF_LIBRARY_RELEASE TIFF_LIBRARY_DEBUG)
+endif()
+unset(TIFF_NAMES)
+unset(TIFF_NAMES_DEBUG)
if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h")
file(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str
@@ -42,7 +84,35 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF
VERSION_VAR TIFF_VERSION_STRING)
if(TIFF_FOUND)
- set( TIFF_LIBRARIES ${TIFF_LIBRARY} )
+ set(TIFF_LIBRARIES ${TIFF_LIBRARY})
+ set(TIFF_INCLUDE_DIRS "${TIFF_INCLUDE_DIR}")
+
+ if(NOT TARGET TIFF::TIFF)
+ add_library(TIFF::TIFF UNKNOWN IMPORTED)
+ if(TIFF_INCLUDE_DIRS)
+ set_target_properties(TIFF::TIFF PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${TIFF_INCLUDE_DIRS}")
+ endif()
+ if(EXISTS "${TIFF_LIBRARY}")
+ set_target_properties(TIFF::TIFF PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${TIFF_LIBRARY}")
+ endif()
+ if(EXISTS "${TIFF_LIBRARY_DEBUG}")
+ set_property(TARGET TIFF::TIFF APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(TIFF::TIFF PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${TIFF_LIBRARY_DEBUG}")
+ endif()
+ if(EXISTS "${TIFF_LIBRARY_RELEASE}")
+ set_property(TARGET TIFF::TIFF APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(TIFF::TIFF PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
+ IMPORTED_LOCATION_RELEASE "${TIFF_LIBRARY_RELEASE}")
+ endif()
+ endif()
endif()
mark_as_advanced(TIFF_INCLUDE_DIR TIFF_LIBRARY)
diff --git a/Modules/FindTclStub.cmake b/Modules/FindTclStub.cmake
index 8dda94a79..3c24f9721 100644
--- a/Modules/FindTclStub.cmake
+++ b/Modules/FindTclStub.cmake
@@ -1,25 +1,45 @@
-# - Find Tcl stub libraries.
-# 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
+#.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
+#
+# ::
+#
+# 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/developpers, some variables were
-# moved or removed. Changes compared to CMake 2.4 are:
-# - TCL_STUB_LIBRARY_DEBUG and TK_STUB_LIBRARY_DEBUG were removed.
-# => 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.
+#
+# ::
+#
+# 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/developpers, 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.
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake
index 0f091e60d..2fd5332aa 100644
--- a/Modules/FindTclsh.cmake
+++ b/Modules/FindTclsh.cmake
@@ -1,11 +1,20 @@
-# - 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.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index f03908ea0..c6079231f 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -1,15 +1,45 @@
-# - This module determines the thread library of the system.
+#.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
+#
+# ::
+#
+# 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
+#
+# ::
+#
+# CMAKE_THREAD_PREFER_PTHREAD
+#
+# If the use of the -pthread compiler and linker flag is prefered 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.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
+# Copyright 2011-2015 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -21,22 +51,95 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include (CheckIncludeFiles)
include (CheckLibraryExists)
include (CheckSymbolExists)
set(Threads_FOUND FALSE)
+set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+set(CMAKE_REQUIRED_QUIET ${Threads_FIND_QUIETLY})
+
+if(CMAKE_C_COMPILER_LOADED)
+ include (CheckIncludeFile)
+elseif(CMAKE_CXX_COMPILER_LOADED)
+ include (CheckIncludeFileCXX)
+else()
+ message(FATAL_ERROR "FindThreads only works if either C or CXX language is enabled")
+endif()
# Do we have sproc?
-if(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
+if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
+ 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)
+ if(NOT Threads_FOUND)
+ CHECK_LIBRARY_EXISTS(${LIBNAME} ${FUNCNAME} "" ${VARNAME})
+ if(${VARNAME})
+ set(CMAKE_THREAD_LIBS_INIT "-l${LIBNAME}")
+ set(CMAKE_HAVE_THREADS_LIBRARY 1)
+ set(Threads_FOUND TRUE)
+ endif()
+ endif ()
+endmacro()
+
+# Internal helper macro.
+# Do NOT even think about using it outside of this file!
+macro(_check_pthreads_flag)
+ if(NOT Threads_FOUND)
+ # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
+ if(NOT DEFINED THREADS_HAVE_PTHREAD_ARG)
+ message(STATUS "Check if compiler accepts -pthread")
+ if(CMAKE_C_COMPILER_LOADED)
+ set(_threads_src ${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c)
+ elseif(CMAKE_CXX_COMPILER_LOADED)
+ set(_threads_src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindThreads/CheckForPthreads.cxx)
+ configure_file(${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c "${_threads_src}" COPYONLY)
+ endif()
+ try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
+ ${CMAKE_BINARY_DIR}
+ ${_threads_src}
+ CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread
+ COMPILE_OUTPUT_VARIABLE OUTPUT)
+ unset(_threads_src)
+
+ if(THREADS_HAVE_PTHREAD_ARG)
+ if(THREADS_PTHREAD_ARG STREQUAL "2")
+ set(Threads_FOUND TRUE)
+ message(STATUS "Check if compiler accepts -pthread - yes")
+ else()
+ message(STATUS "Check if compiler accepts -pthread - no")
+ file(APPEND
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n")
+ endif()
+ else()
+ message(STATUS "Check if compiler accepts -pthread - no")
+ file(APPEND
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n")
+ endif()
+
+ endif()
+
+ if(THREADS_HAVE_PTHREAD_ARG)
+ set(Threads_FOUND TRUE)
+ set(CMAKE_THREAD_LIBS_INIT "-pthread")
+ endif()
+ endif()
+endmacro()
+
if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD)
# We have sproc
set(CMAKE_USE_SPROC_INIT 1)
else()
# Do we have pthreads?
- CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H)
+ 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)
#
@@ -51,72 +154,25 @@ else()
set(CMAKE_THREAD_LIBS_INIT "")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE)
- endif()
-
- if(NOT CMAKE_HAVE_THREADS_LIBRARY)
- # Do we have -lpthreads
- CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE)
- if(CMAKE_HAVE_PTHREADS_CREATE)
- set(CMAKE_THREAD_LIBS_INIT "-lpthreads")
- set(CMAKE_HAVE_THREADS_LIBRARY 1)
- set(Threads_FOUND TRUE)
- endif()
-
- # Ok, how about -lpthread
- CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
- if(CMAKE_HAVE_PTHREAD_CREATE)
- set(CMAKE_THREAD_LIBS_INIT "-lpthread")
- set(CMAKE_HAVE_THREADS_LIBRARY 1)
- set(Threads_FOUND TRUE)
- endif()
-
- if(CMAKE_SYSTEM MATCHES "SunOS.*")
- # On sun also check for -lthread
- CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
- if(CMAKE_HAVE_THR_CREATE)
- set(CMAKE_THREAD_LIBS_INIT "-lthread")
- set(CMAKE_HAVE_THREADS_LIBRARY 1)
- set(Threads_FOUND TRUE)
- endif()
+ 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()
endif()
- if(NOT CMAKE_HAVE_THREADS_LIBRARY)
- # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
- if("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
- message(STATUS "Check if compiler accepts -pthread")
- try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
- ${CMAKE_BINARY_DIR}
- ${CMAKE_ROOT}/Modules/CheckForPthreads.c
- CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread
- COMPILE_OUTPUT_VARIABLE OUTPUT)
-
- if(THREADS_HAVE_PTHREAD_ARG)
- if(THREADS_PTHREAD_ARG STREQUAL "2")
- set(Threads_FOUND TRUE)
- message(STATUS "Check if compiler accepts -pthread - yes")
- else()
- message(STATUS "Check if compiler accepts -pthread - no")
- file(APPEND
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n")
- endif()
- else()
- message(STATUS "Check if compiler accepts -pthread - no")
- file(APPEND
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n")
- endif()
-
- endif()
-
- if(THREADS_HAVE_PTHREAD_ARG)
- set(Threads_FOUND TRUE)
- set(CMAKE_THREAD_LIBS_INIT "-pthread")
- endif()
-
- endif()
+ _check_pthreads_flag()
endif()
endif()
@@ -125,13 +181,13 @@ if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE)
set(Threads_FOUND TRUE)
endif()
-if(CMAKE_SYSTEM MATCHES "Windows")
+if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_USE_WIN32_THREADS_INIT 1)
set(Threads_FOUND TRUE)
endif()
if(CMAKE_USE_PTHREADS_INIT)
- if(CMAKE_SYSTEM MATCHES "HP-UX-*")
+ if(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
# Use libcma if it exists and can be used. It provides more
# symbols than the plain pthread library. CMA threads
# have actually been deprecated:
@@ -149,12 +205,12 @@ if(CMAKE_USE_PTHREADS_INIT)
set(CMAKE_USE_PTHREADS_INIT 1)
endif()
- if(CMAKE_SYSTEM MATCHES "OSF1-V*")
+ if(CMAKE_SYSTEM MATCHES "OSF1-V")
set(CMAKE_USE_PTHREADS_INIT 0)
set(CMAKE_THREAD_LIBS_INIT )
endif()
- if(CMAKE_SYSTEM MATCHES "CYGWIN_NT*")
+ if(CMAKE_SYSTEM MATCHES "CYGWIN_NT")
set(CMAKE_USE_PTHREADS_INIT 1)
set(Threads_FOUND TRUE)
set(CMAKE_THREAD_LIBS_INIT )
@@ -162,5 +218,18 @@ if(CMAKE_USE_PTHREADS_INIT)
endif()
endif()
+set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND)
+
+if(THREADS_FOUND AND NOT TARGET Threads::Threads)
+ add_library(Threads::Threads INTERFACE IMPORTED)
+
+ if(THREADS_HAVE_PTHREAD_ARG)
+ set_property(TARGET Threads::Threads PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread")
+ endif()
+
+ if(CMAKE_THREAD_LIBS_INIT)
+ set_property(TARGET Threads::Threads PROPERTY INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
+ endif()
+endif()
diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake
index 87caadc09..869ba38d9 100644
--- a/Modules/FindUnixCommands.cmake
+++ b/Modules/FindUnixCommands.cmake
@@ -1,9 +1,14 @@
-# - Find unix commands from cygwin
-# This module looks for some usual Unix commands.
+#.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.
#=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
+# Copyright 2001-2014 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -91,3 +96,8 @@ find_program(TAR
mark_as_advanced(
TAR
)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(UnixCommands
+ REQUIRED_VARS BASH CP GZIP MV RM TAR
+)
diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake
deleted file mode 100644
index 085d60d04..000000000
--- a/Modules/FindVTK.cmake
+++ /dev/null
@@ -1,141 +0,0 @@
-# - Find a VTK installation or build tree.
-# The following variables are set if VTK is found. If VTK is not
-# found, VTK_FOUND is set to false.
-# VTK_FOUND - Set to true when VTK is found.
-# VTK_USE_FILE - CMake file to use VTK.
-# VTK_MAJOR_VERSION - The VTK major version number.
-# VTK_MINOR_VERSION - The VTK minor version number
-# (odd non-release).
-# VTK_BUILD_VERSION - The VTK patch level
-# (meaningless for odd minor).
-# VTK_INCLUDE_DIRS - Include directories for VTK
-# VTK_LIBRARY_DIRS - Link directories for VTK libraries
-# VTK_KITS - List of VTK kits, in CAPS
-# (COMMON,IO,) etc.
-# VTK_LANGUAGES - List of wrapped languages, in CAPS
-# (TCL, PYHTON,) etc.
-# The following cache entries must be set by the user to locate VTK:
-# VTK_DIR - The directory containing VTKConfig.cmake.
-# This is either the root of the build tree,
-# or the lib/vtk directory. This is the
-# only cache entry.
-# The following variables are set for backward compatibility and
-# should not be used in new code:
-# USE_VTK_FILE - The full path to the UseVTK.cmake file.
-# This is provided for backward
-# compatibility. Use VTK_USE_FILE
-# instead.
-#
-
-#=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# Assume not found.
-set(VTK_FOUND 0)
-
-# VTK 4.0 did not provide VTKConfig.cmake.
-if("${VTK_FIND_VERSION}" VERSION_LESS 4.1)
- set(_VTK_40_ALLOW 1)
- if(VTK_FIND_VERSION)
- set(_VTK_40_ONLY 1)
- endif()
-endif()
-
-# Construct consistent error messages for use below.
-set(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.")
-if(_VTK_40_ALLOW)
- set(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.")
-endif()
-set(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}")
-
-# Check whether VTK 4.0 has already been found.
-if(_VTK_40_ALLOW AND VTK_DIR)
- if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
- set(VTK_FOUND 1)
- include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings.
- endif()
-endif()
-
-# Use the Config mode of the find_package() command to find VTKConfig.
-# If this succeeds (possibly because VTK_DIR is already set), the
-# command will have already loaded VTKConfig.cmake and set VTK_FOUND.
-if(NOT _VTK_40_ONLY AND NOT VTK_FOUND)
- find_package(VTK QUIET NO_MODULE)
-endif()
-
-# Special search for VTK 4.0.
-if(_VTK_40_ALLOW AND NOT VTK_DIR)
- # Old scripts may set these directories in the CMakeCache.txt file.
- # They can tell us where to find VTKConfig.cmake.
- set(VTK_DIR_SEARCH_LEGACY "")
- if(VTK_BINARY_PATH AND USE_BUILT_VTK)
- set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH})
- endif()
- if(VTK_INSTALL_PATH AND USE_INSTALLED_VTK)
- set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY}
- ${VTK_INSTALL_PATH}/lib/vtk)
- endif()
-
- # Look for UseVTK.cmake in build trees or under <prefix>/include/vtk.
- find_path(VTK_DIR
- NAMES UseVTK.cmake
- PATH_SUFFIXES vtk-4.0 vtk
- HINTS ENV VTK_DIR
-
- PATHS
-
- # Support legacy cache files.
- ${VTK_DIR_SEARCH_LEGACY}
-
- # Read from the CMakeSetup registry entries. It is likely that
- # VTK will have been recently built.
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
-
- # Help the user find it if we cannot.
- DOC "The ${VTK_DIR_DESCRIPTION}"
- )
-
- if(VTK_DIR)
- if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
- set(VTK_FOUND 1)
- include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings.
- else()
- # We found the wrong version. Pretend we did not find it.
- set(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE)
- endif()
- endif()
-endif()
-
-#-----------------------------------------------------------------------------
-if(VTK_FOUND)
- # Set USE_VTK_FILE for backward-compatibility.
- set(USE_VTK_FILE ${VTK_USE_FILE})
-else()
- # VTK not found, explain to the user how to specify its location.
- if(VTK_FIND_REQUIRED)
- message(FATAL_ERROR ${VTK_DIR_MESSAGE})
- else()
- if(NOT VTK_FIND_QUIETLY)
- message(STATUS ${VTK_DIR_MESSAGE})
- endif()
- endif()
-endif()
diff --git a/Modules/FindWget.cmake b/Modules/FindWget.cmake
index 4da98b149..b303b407d 100644
--- a/Modules/FindWget.cmake
+++ b/Modules/FindWget.cmake
@@ -1,8 +1,15 @@
-# - 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.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
diff --git a/Modules/FindWish.cmake b/Modules/FindWish.cmake
index 11b29f249..df301b412 100644
--- a/Modules/FindWish.cmake
+++ b/Modules/FindWish.cmake
@@ -1,9 +1,18 @@
-# - 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:
+#.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
+#
#
-# TK_WISH = the path to the wish executable
#
# if UNIX is defined, then it will look for the cygwin version first
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index 131d97994..90c1499c3 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -1,45 +1,55 @@
-# - Find X11 installation
+#.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
+#
+# ::
+#
+# 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:
-# Include paths: 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
-
+#
+# ::
+#
+# X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND
+# X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND
+# X11_X11_INCLUDE_PATH, X11_X11_LIB
+# X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND
+# X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND
+# X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND
+# X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND
+# X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND
+# X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND
+# X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND
+# X11_Xext_LIB, X11_Xext_FOUND
+# X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND
+# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND
+# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND
+# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND
+# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND
+# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND
+# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND
+# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND
+# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND
+# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND
+# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND
+# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND
+# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND
+# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND
+# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND
+# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND
+# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND
+# X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND
+# X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND
+# X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND
+# X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND
+# X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND
+# X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -60,6 +70,8 @@ if (UNIX)
# found in tcl on the mac
set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK})
set(CMAKE_FIND_FRAMEWORK NEVER)
+ set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+ set(CMAKE_REQUIRED_QUIET ${X11_FIND_QUIETLY})
set(X11_INC_SEARCH_PATH
/usr/pkg/xorg/include
/usr/X11R6/include
@@ -494,6 +506,7 @@ if (UNIX)
X11_XSync_INCLUDE_PATH
)
set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE})
+ set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
endif ()
# X11_FIND_REQUIRED_<component> could be checked too
diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake
new file mode 100644
index 000000000..3cd9c22bc
--- /dev/null
+++ b/Modules/FindXCTest.cmake
@@ -0,0 +1,196 @@
+#[=======================================================================[.rst:
+FindXCTest
+----------
+
+Functions to help creating and executing XCTest bundles.
+
+An XCTest bundle is a CFBundle with a special product-type
+and bundle extension. The Mac Developer Library provides more
+information in the `Testing with Xcode`_ document.
+
+.. _Testing with Xcode: http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/
+
+Module Functions
+^^^^^^^^^^^^^^^^
+
+.. command:: xctest_add_bundle
+
+ The ``xctest_add_bundle`` function creates a XCTest bundle named
+ <target> which will test the target <testee>. Supported target types
+ for testee are Frameworks and App Bundles::
+
+ xctest_add_bundle(
+ <target> # Name of the XCTest bundle
+ <testee> # Target name of the testee
+ )
+
+.. command:: xctest_add_test
+
+ The ``xctest_add_test`` function adds an XCTest bundle to the
+ project to be run by :manual:`ctest(1)`. The test will be named
+ <name> and tests <bundle>::
+
+ xctest_add_test(
+ <name> # Test name
+ <bundle> # Target name of XCTest bundle
+ )
+
+Module Variables
+^^^^^^^^^^^^^^^^
+
+The following variables are set by including this module:
+
+.. variable:: XCTest_FOUND
+
+ True if the XCTest Framework and executable were found.
+
+.. variable:: XCTest_EXECUTABLE
+
+ The path to the xctest command line tool used to execute XCTest bundles.
+
+.. variable:: XCTest_INCLUDE_DIRS
+
+ The directory containing the XCTest Framework headers.
+
+.. variable:: XCTest_LIBRARIES
+
+ The location of the XCTest Framework.
+
+#]=======================================================================]
+
+#=============================================================================
+# Copyright 2015 Gregor Jasny
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+find_path(XCTest_INCLUDE_DIR
+ NAMES "XCTest/XCTest.h"
+ DOC "XCTest include directory")
+mark_as_advanced(XCTest_INCLUDE_DIR)
+
+find_library(XCTest_LIBRARY
+ NAMES XCTest
+ DOC "XCTest Framework library")
+mark_as_advanced(XCTest_LIBRARY)
+
+execute_process(
+ COMMAND xcrun --find xctest
+ OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _xcrun_err)
+if(_xcrun_out)
+ set(XCTest_EXECUTABLE "${_xcrun_out}" CACHE FILEPATH "XCTest executable")
+ mark_as_advanced(XCTest_EXECUTABLE)
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(XCTest
+ FOUND_VAR XCTest_FOUND
+ REQUIRED_VARS XCTest_LIBRARY XCTest_INCLUDE_DIR XCTest_EXECUTABLE)
+
+if(XCTest_FOUND)
+ set(XCTest_INCLUDE_DIRS "${XCTest_INCLUDE_DIR}")
+ set(XCTest_LIBRARIES "${XCTest_LIBRARY}")
+endif(XCTest_FOUND)
+
+
+function(xctest_add_bundle target testee)
+ if(NOT XCTest_FOUND)
+ message(FATAL_ERROR "XCTest is required to create a XCTest Bundle.")
+ endif(NOT XCTest_FOUND)
+
+ if(NOT CMAKE_OSX_SYSROOT)
+ message(FATAL_ERROR "Adding XCTest bundles requires CMAKE_OSX_SYSROOT to be set.")
+ endif()
+
+ add_library(${target} MODULE ${ARGN})
+
+ set_target_properties(${target} PROPERTIES
+ BUNDLE TRUE
+ XCTEST TRUE
+ XCTEST_TESTEE ${testee})
+
+ target_link_libraries(${target} PRIVATE "-framework Foundation")
+ target_link_libraries(${target} PRIVATE ${XCTest_LIBRARIES})
+ target_include_directories(${target} PRIVATE ${XCTest_INCLUDE_DIRS})
+
+ # retrieve testee target type
+ if(NOT TARGET ${testee})
+ message(FATAL_ERROR "${testee} is not a target.")
+ endif()
+ get_property(_testee_type TARGET ${testee} PROPERTY TYPE)
+ get_property(_testee_framework TARGET ${testee} PROPERTY FRAMEWORK)
+ get_property(_testee_macosx_bundle TARGET ${testee} PROPERTY MACOSX_BUNDLE)
+
+ if(_testee_type STREQUAL "SHARED_LIBRARY" AND _testee_framework)
+ # testee is a Framework
+ target_link_libraries(${target} PRIVATE ${testee})
+
+ elseif(_testee_type STREQUAL "EXECUTABLE" AND _testee_macosx_bundle)
+ # testee is an App Bundle
+ add_dependencies(${target} ${testee})
+ if(XCODE)
+ set_target_properties(${target} PROPERTIES
+ XCODE_ATTRIBUTE_BUNDLE_LOADER "$(TEST_HOST)"
+ XCODE_ATTRIBUTE_TEST_HOST "$<TARGET_FILE:${testee}>")
+ else(XCODE)
+ target_link_libraries(${target}
+ PRIVATE -bundle_loader $<TARGET_FILE:${testee}>)
+ endif(XCODE)
+
+ else()
+ message(FATAL_ERROR "Testee ${testee} is of unsupported type.")
+ endif()
+endfunction(xctest_add_bundle)
+
+
+function(xctest_add_test name bundle)
+ if(NOT XCTest_EXECUTABLE)
+ message(FATAL_ERROR "XCTest executable is required to register a test.")
+ endif()
+
+ # check that bundle is a XCTest Bundle
+
+ if(NOT TARGET ${bundle})
+ message(FATAL_ERROR "${bundle} is not a target.")
+ endif(NOT TARGET ${bundle})
+
+ get_property(_test_type TARGET ${bundle} PROPERTY TYPE)
+ get_property(_test_bundle TARGET ${bundle} PROPERTY BUNDLE)
+ get_property(_test_xctest TARGET ${bundle} PROPERTY XCTEST)
+
+ if(NOT _test_type STREQUAL "MODULE_LIBRARY"
+ OR NOT _test_xctest OR NOT _test_bundle)
+ message(FATAL_ERROR "Test ${bundle} is not an XCTest Bundle")
+ endif()
+
+ # get and check testee properties
+
+ get_property(_testee TARGET ${bundle} PROPERTY XCTEST_TESTEE)
+ if(NOT TARGET ${_testee})
+ message(FATAL_ERROR "${_testee} is not a target.")
+ endif()
+
+ get_property(_testee_type TARGET ${_testee} PROPERTY TYPE)
+ get_property(_testee_framework TARGET ${_testee} PROPERTY FRAMEWORK)
+
+ # register test
+
+ add_test(
+ NAME ${name}
+ COMMAND ${XCTest_EXECUTABLE} $<TARGET_LINKER_FILE_DIR:${bundle}>/../..)
+
+ # point loader to testee in case rpath is disabled
+
+ if(_testee_type STREQUAL "SHARED_LIBRARY" AND _testee_framework)
+ set_property(TEST ${name} APPEND PROPERTY
+ ENVIRONMENT DYLD_FRAMEWORK_PATH=$<TARGET_LINKER_FILE_DIR:${_testee}>/..)
+ endif()
+endfunction(xctest_add_test)
diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake
index c80249b56..14917547d 100644
--- a/Modules/FindXMLRPC.cmake
+++ b/Modules/FindXMLRPC.cmake
@@ -1,16 +1,32 @@
-# - Find xmlrpc
+#.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_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
+#
+# ::
+#
+# 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)
+#
+# ::
+#
+# find_package(XMLRPC REQUIRED libwww-client)
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -61,10 +77,9 @@ if(XMLRPC_FOUND)
# Look for -I options.
set(XMLRPC_INCLUDE_DIRS)
foreach(flag ${XMLRPC_C_CONFIG_CFLAGS})
- if("${flag}" MATCHES "^-I")
- string(REGEX REPLACE "^-I" "" DIR "${flag}")
- file(TO_CMAKE_PATH "${DIR}" DIR)
- set(XMLRPC_INCLUDE_DIRS ${XMLRPC_INCLUDE_DIRS} "${DIR}")
+ if("${flag}" MATCHES "^-I(.+)")
+ file(TO_CMAKE_PATH "${CMAKE_MATCH_1}" DIR)
+ list(APPEND XMLRPC_INCLUDE_DIRS "${DIR}")
endif()
endforeach()
else()
@@ -99,13 +114,11 @@ if(XMLRPC_FOUND)
set(XMLRPC_LIBRARY_DIRS)
set(XMLRPC_LIBRARY_NAMES)
foreach(flag ${XMLRPC_C_CONFIG_LIBS})
- if("${flag}" MATCHES "^-L")
- string(REGEX REPLACE "^-L" "" DIR "${flag}")
- file(TO_CMAKE_PATH "${DIR}" DIR)
- set(XMLRPC_LIBRARY_DIRS ${XMLRPC_LIBRARY_DIRS} "${DIR}")
- elseif("${flag}" MATCHES "^-l")
- string(REGEX REPLACE "^-l" "" NAME "${flag}")
- set(XMLRPC_LIBRARY_NAMES ${XMLRPC_LIBRARY_NAMES} "${NAME}")
+ if("${flag}" MATCHES "^-L(.+)")
+ file(TO_CMAKE_PATH "${CMAKE_MATCH_1}" DIR)
+ list(APPEND XMLRPC_LIBRARY_DIRS "${DIR}")
+ elseif("${flag}" MATCHES "^-l(.+)")
+ list(APPEND XMLRPC_LIBRARY_NAMES "${CMAKE_MATCH_1}")
endif()
endforeach()
diff --git a/Modules/FindXalanC.cmake b/Modules/FindXalanC.cmake
new file mode 100644
index 000000000..016b7aabd
--- /dev/null
+++ b/Modules/FindXalanC.cmake
@@ -0,0 +1,162 @@
+#.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>
+
+#=============================================================================
+# Copyright 2016 University of Dundee
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+function(_XalanC_GET_VERSION version_hdr)
+ file(STRINGS ${version_hdr} _contents REGEX "^[ \t]*#define XALAN_VERSION_.*")
+ if(_contents)
+ string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" XalanC_MAJOR "${_contents}")
+ string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" XalanC_MINOR "${_contents}")
+ string(REGEX REPLACE "[^*]*#define XALAN_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" XalanC_PATCH "${_contents}")
+
+ if(NOT XalanC_MAJOR MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "Version parsing failed for XALAN_VERSION_MAJOR!")
+ endif()
+ if(NOT XalanC_MINOR MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "Version parsing failed for XALAN_VERSION_MINOR!")
+ endif()
+ if(NOT XalanC_PATCH MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "Version parsing failed for XALAN_VERSION_REVISION!")
+ endif()
+
+ set(XalanC_VERSION "${XalanC_MAJOR}.${XalanC_MINOR}.${XalanC_PATCH}" PARENT_SCOPE)
+ set(XalanC_VERSION_MAJOR "${XalanC_MAJOR}" PARENT_SCOPE)
+ set(XalanC_VERSION_MINOR "${XalanC_MINOR}" PARENT_SCOPE)
+ set(XalanC_VERSION_PATCH "${XalanC_PATCH}" PARENT_SCOPE)
+ else()
+ message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information")
+ endif()
+endfunction()
+
+# Find include directory
+find_path(XalanC_INCLUDE_DIR
+ NAMES "xalanc/XalanTransformer/XalanTransformer.hpp"
+ DOC "Xalan-C++ include directory")
+mark_as_advanced(XalanC_INCLUDE_DIR)
+
+if(XalanC_INCLUDE_DIR)
+ _XalanC_GET_VERSION("${XalanC_INCLUDE_DIR}/xalanc/Include/XalanVersion.hpp")
+endif()
+
+if(NOT XalanC_LIBRARY)
+ # Find all XalanC libraries
+ find_library(XalanC_LIBRARY_RELEASE
+ NAMES "Xalan-C" "xalan-c"
+ "Xalan-C_${XalanC_VERSION_MAJOR}"
+ "Xalan-C_${XalanC_VERSION_MAJOR}_${XalanC_VERSION_MINOR}"
+ DOC "Xalan-C++ libraries (release)")
+ find_library(XalanC_LIBRARY_DEBUG
+ NAMES "Xalan-CD" "xalan-cd"
+ "Xalan-C_${XalanC_VERSION_MAJOR}D"
+ "Xalan-C_${XalanC_VERSION_MAJOR}_${XalanC_VERSION_MINOR}D"
+ DOC "Xalan-C++ libraries (debug)")
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(XalanC)
+ mark_as_advanced(XalanC_LIBRARY_RELEASE XalanC_LIBRARY_DEBUG)
+endif()
+
+unset(XalanC_VERSION_MAJOR)
+unset(XalanC_VERSION_MINOR)
+unset(XalanC_VERSION_PATCH)
+
+unset(XalanC_XERCESC_REQUIRED)
+if(XalanC_FIND_REQUIRED)
+ set(XalanC_XERCESC_REQUIRED REQUIRED)
+endif()
+find_package(XercesC ${XalanC_XERCESC_REQUIRED})
+unset(XalanC_XERCESC_REQUIRED)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(XalanC
+ FOUND_VAR XalanC_FOUND
+ REQUIRED_VARS XalanC_LIBRARY
+ XalanC_INCLUDE_DIR
+ XalanC_VERSION
+ XercesC_FOUND
+ VERSION_VAR XalanC_VERSION
+ FAIL_MESSAGE "Failed to find XalanC")
+
+if(XalanC_FOUND)
+ set(XalanC_INCLUDE_DIRS "${XalanC_INCLUDE_DIR}" ${XercesC_INCLUDE_DIRS})
+ set(XalanC_LIBRARIES "${XalanC_LIBRARY}" ${XercesC_LIBRARIES})
+
+ # For header-only libraries
+ if(NOT TARGET XalanC::XalanC)
+ add_library(XalanC::XalanC UNKNOWN IMPORTED)
+ if(XalanC_INCLUDE_DIRS)
+ set_target_properties(XalanC::XalanC PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${XalanC_INCLUDE_DIRS}")
+ endif()
+ if(EXISTS "${XalanC_LIBRARY}")
+ set_target_properties(XalanC::XalanC PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ IMPORTED_LOCATION "${XalanC_LIBRARY}")
+ endif()
+ if(EXISTS "${XalanC_LIBRARY_DEBUG}")
+ set_property(TARGET XalanC::XalanC APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(XalanC::XalanC PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${XalanC_LIBRARY_DEBUG}")
+ endif()
+ if(EXISTS "${XalanC_LIBRARY_RELEASE}")
+ set_property(TARGET XalanC::XalanC APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(XalanC::XalanC PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
+ IMPORTED_LOCATION_RELEASE "${XalanC_LIBRARY_RELEASE}")
+ endif()
+ set_target_properties(XalanC::XalanC PROPERTIES INTERFACE_LINK_LIBRARIES XercesC::XercesC)
+ endif()
+endif()
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake
new file mode 100644
index 000000000..a4b80e512
--- /dev/null
+++ b/Modules/FindXercesC.cmake
@@ -0,0 +1,140 @@
+#.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>
+
+#=============================================================================
+# Copyright 2014-2015 University of Dundee
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+function(_XercesC_GET_VERSION version_hdr)
+ file(STRINGS ${version_hdr} _contents REGEX "^[ \t]*#define XERCES_VERSION_.*")
+ if(_contents)
+ string(REGEX REPLACE ".*#define XERCES_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" XercesC_MAJOR "${_contents}")
+ string(REGEX REPLACE ".*#define XERCES_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" XercesC_MINOR "${_contents}")
+ string(REGEX REPLACE ".*#define XERCES_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" XercesC_PATCH "${_contents}")
+
+ if(NOT XercesC_MAJOR MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MAJOR!")
+ endif()
+ if(NOT XercesC_MINOR MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MINOR!")
+ endif()
+ if(NOT XercesC_PATCH MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_REVISION!")
+ endif()
+
+ set(XercesC_VERSION "${XercesC_MAJOR}.${XercesC_MINOR}.${XercesC_PATCH}" PARENT_SCOPE)
+ else()
+ message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information")
+ endif()
+endfunction()
+
+# Find include directory
+find_path(XercesC_INCLUDE_DIR
+ NAMES "xercesc/util/PlatformUtils.hpp"
+ DOC "Xerces-C++ include directory")
+mark_as_advanced(XercesC_INCLUDE_DIR)
+
+if(NOT XercesC_LIBRARY)
+ # Find all XercesC libraries
+ find_library(XercesC_LIBRARY_RELEASE
+ NAMES "xerces-c" "xerces-c_3"
+ DOC "Xerces-C++ libraries (release)")
+ find_library(XercesC_LIBRARY_DEBUG
+ NAMES "xerces-cd" "xerces-c_3D" "xerces-c_3_1D"
+ DOC "Xerces-C++ libraries (debug)")
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(XercesC)
+ mark_as_advanced(XercesC_LIBRARY_RELEASE XercesC_LIBRARY_DEBUG)
+endif()
+
+if(XercesC_INCLUDE_DIR)
+ _XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp")
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(XercesC
+ FOUND_VAR XercesC_FOUND
+ REQUIRED_VARS XercesC_LIBRARY
+ XercesC_INCLUDE_DIR
+ XercesC_VERSION
+ VERSION_VAR XercesC_VERSION
+ FAIL_MESSAGE "Failed to find XercesC")
+
+if(XercesC_FOUND)
+ set(XercesC_INCLUDE_DIRS "${XercesC_INCLUDE_DIR}")
+ set(XercesC_LIBRARIES "${XercesC_LIBRARY}")
+
+ # For header-only libraries
+ if(NOT TARGET XercesC::XercesC)
+ add_library(XercesC::XercesC UNKNOWN IMPORTED)
+ if(XercesC_INCLUDE_DIRS)
+ set_target_properties(XercesC::XercesC PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${XercesC_INCLUDE_DIRS}")
+ endif()
+ if(EXISTS "${XercesC_LIBRARY}")
+ set_target_properties(XercesC::XercesC PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ IMPORTED_LOCATION "${XercesC_LIBRARY}")
+ endif()
+ if(EXISTS "${XercesC_LIBRARY_DEBUG}")
+ set_property(TARGET XercesC::XercesC APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(XercesC::XercesC PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${XercesC_LIBRARY_DEBUG}")
+ endif()
+ if(EXISTS "${XercesC_LIBRARY_RELEASE}")
+ set_property(TARGET XercesC::XercesC APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(XercesC::XercesC PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
+ IMPORTED_LOCATION_RELEASE "${XercesC_LIBRARY_RELEASE}")
+ endif()
+ endif()
+endif()
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 00b9c64da..a57f45008 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -1,25 +1,50 @@
-# - Find zlib
+#.rst:
+# FindZLIB
+# --------
+#
# Find the native ZLIB includes and library.
-# Once done this will define
#
-# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
-# ZLIB_LIBRARIES - List of libraries when using zlib.
-# ZLIB_FOUND - True if zlib found.
+# 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
+# ::
+#
+# 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
+# ::
+#
+# ZLIB_MAJOR_VERSION - The major version of zlib
+# ZLIB_MINOR_VERSION - The minor version of zlib
+# ZLIB_PATCH_VERSION - The patch version of zlib
#
-# An includer may set ZLIB_ROOT to a zlib installation root to tell
-# this module where to look.
+# Hints
+# ^^^^^
+#
+# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this
+# module where to look.
#=============================================================================
# Copyright 2001-2011 Kitware, Inc.
@@ -49,14 +74,28 @@ set(_ZLIB_SEARCH_NORMAL
)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
-set(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1)
+set(ZLIB_NAMES z zlib zdll zlib1)
+set(ZLIB_NAMES_DEBUG zlibd zlibd1)
# Try each search configuration.
foreach(search ${_ZLIB_SEARCHES})
- find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
- find_library(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib)
+ find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
endforeach()
+# Allow ZLIB_LIBRARY to be set manually, as the location of the zlib library
+if(NOT ZLIB_LIBRARY)
+ foreach(search ${_ZLIB_SEARCHES})
+ find_library(ZLIB_LIBRARY_RELEASE NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib)
+ find_library(ZLIB_LIBRARY_DEBUG NAMES ${ZLIB_NAMES_DEBUG} ${${search}} PATH_SUFFIXES lib)
+ endforeach()
+
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(ZLIB)
+endif()
+
+unset(ZLIB_NAMES)
+unset(ZLIB_NAMES_DEBUG)
+
mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
@@ -69,7 +108,7 @@ if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
# only append a TWEAK version if it exists:
set(ZLIB_VERSION_TWEAK "")
- if( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$")
+ if( "${ZLIB_H}" MATCHES "ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)")
set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}")
set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}")
endif()
@@ -87,6 +126,33 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D
if(ZLIB_FOUND)
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
- set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
-endif()
+ if(NOT ZLIB_LIBRARIES)
+ set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
+ endif()
+
+ if(NOT TARGET ZLIB::ZLIB)
+ add_library(ZLIB::ZLIB UNKNOWN IMPORTED)
+ set_target_properties(ZLIB::ZLIB PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}")
+
+ if(ZLIB_LIBRARY_RELEASE)
+ set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(ZLIB::ZLIB PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${ZLIB_LIBRARY_RELEASE}")
+ endif()
+
+ if(ZLIB_LIBRARY_DEBUG)
+ set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(ZLIB::ZLIB PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${ZLIB_LIBRARY_DEBUG}")
+ endif()
+
+ if(NOT ZLIB_LIBRARY_RELEASE AND NOT ZLIB_LIBRARY_DEBUG)
+ set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
+ IMPORTED_LOCATION "${ZLIB_LIBRARY}")
+ endif()
+ endif()
+endif()
diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake
index bc1e48a6e..5ab2846fc 100644
--- a/Modules/Findosg.cmake
+++ b/Modules/Findosg.cmake
@@ -1,31 +1,37 @@
+#.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.
+#
+#
+#
+#
+# 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.
diff --git a/Modules/FindosgAnimation.cmake b/Modules/FindosgAnimation.cmake
index 121aefcec..403e68e76 100644
--- a/Modules/FindosgAnimation.cmake
+++ b/Modules/FindosgAnimation.cmake
@@ -1,27 +1,31 @@
-# 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.
+#.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.
diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake
index 1ed94a108..0e5bdef82 100644
--- a/Modules/FindosgDB.cmake
+++ b/Modules/FindosgDB.cmake
@@ -1,27 +1,31 @@
-# 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.
+#.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.
diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake
index 1f1d59f46..7b2cb76c1 100644
--- a/Modules/FindosgFX.cmake
+++ b/Modules/FindosgFX.cmake
@@ -1,27 +1,31 @@
-# 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.
+#.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.
diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake
index e60f7f5a7..2e80ff2fa 100644
--- a/Modules/FindosgGA.cmake
+++ b/Modules/FindosgGA.cmake
@@ -1,27 +1,31 @@
-# 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.
+#.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.
diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake
index a430ad6e9..1b52a6a24 100644
--- a/Modules/FindosgIntrospection.cmake
+++ b/Modules/FindosgIntrospection.cmake
@@ -1,27 +1,32 @@
-# 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
+#.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_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.
+# $OSGDIR is an environment variable that would correspond to the
+# ./configure --prefix=$OSGDIR used in building osg.
#
# Created by Eric Wing.
diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake
index 32d6def7b..6f5408241 100644
--- a/Modules/FindosgManipulator.cmake
+++ b/Modules/FindosgManipulator.cmake
@@ -1,27 +1,32 @@
-# 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
+#.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_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.
+# $OSGDIR is an environment variable that would correspond to the
+# ./configure --prefix=$OSGDIR used in building osg.
#
# Created by Eric Wing.
diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake
index 1a6ae0b93..82e9a1364 100644
--- a/Modules/FindosgParticle.cmake
+++ b/Modules/FindosgParticle.cmake
@@ -1,27 +1,31 @@
-# 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)
+#.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.
+# $OSGDIR is an environment variable that would correspond to the
+# ./configure --prefix=$OSGDIR used in building osg.
#
# Created by Eric Wing.
diff --git a/Modules/FindosgPresentation.cmake b/Modules/FindosgPresentation.cmake
index 412502a8c..1cd57b301 100644
--- a/Modules/FindosgPresentation.cmake
+++ b/Modules/FindosgPresentation.cmake
@@ -1,30 +1,35 @@
-# 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
+#.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_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.
+# $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.
+# Created by Eric Wing. Modified to work with osgPresentation by Robert
+# Osfield, January 2012.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake
index ea561a036..ad4902b86 100644
--- a/Modules/FindosgProducer.cmake
+++ b/Modules/FindosgProducer.cmake
@@ -1,27 +1,31 @@
-# 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)
+#.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.
+# $OSGDIR is an environment variable that would correspond to the
+# ./configure --prefix=$OSGDIR used in building osg.
#
# Created by Eric Wing.
diff --git a/Modules/FindosgQt.cmake b/Modules/FindosgQt.cmake
index c7e8fee64..b5c1718c8 100644
--- a/Modules/FindosgQt.cmake
+++ b/Modules/FindosgQt.cmake
@@ -1,30 +1,33 @@
-# 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.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake
index f3be0bfdf..b0d22e7af 100644
--- a/Modules/FindosgShadow.cmake
+++ b/Modules/FindosgShadow.cmake
@@ -1,27 +1,31 @@
-# 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.
+#.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.
diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake
index 19cd17582..ce088dc6d 100644
--- a/Modules/FindosgSim.cmake
+++ b/Modules/FindosgSim.cmake
@@ -1,27 +1,31 @@
-# 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.
+#.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.
diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake
index 4b7249e62..bfde773ef 100644
--- a/Modules/FindosgTerrain.cmake
+++ b/Modules/FindosgTerrain.cmake
@@ -1,27 +1,31 @@
-# 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.
+#.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.
diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake
index 41683c728..32cd115c1 100644
--- a/Modules/FindosgText.cmake
+++ b/Modules/FindosgText.cmake
@@ -1,27 +1,31 @@
-# 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.
+#.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.
diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake
index 85c117723..97974255c 100644
--- a/Modules/FindosgUtil.cmake
+++ b/Modules/FindosgUtil.cmake
@@ -1,27 +1,31 @@
-# 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.
+#.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.
diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake
index d2252f4df..b3555302d 100644
--- a/Modules/FindosgViewer.cmake
+++ b/Modules/FindosgViewer.cmake
@@ -1,27 +1,31 @@
-# 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.
+#.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.
diff --git a/Modules/FindosgVolume.cmake b/Modules/FindosgVolume.cmake
index ae2d95c39..8d3ad6c5d 100644
--- a/Modules/FindosgVolume.cmake
+++ b/Modules/FindosgVolume.cmake
@@ -1,27 +1,31 @@
-# 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.
+#.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.
diff --git a/Modules/FindosgWidget.cmake b/Modules/FindosgWidget.cmake
index cb2e12fca..ec3c3bca9 100644
--- a/Modules/FindosgWidget.cmake
+++ b/Modules/FindosgWidget.cmake
@@ -1,29 +1,34 @@
-# 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.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake
index 2e908379f..d10fae92f 100644
--- a/Modules/Findosg_functions.cmake
+++ b/Modules/Findosg_functions.cmake
@@ -1,8 +1,14 @@
+#.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.
-#
#=============================================================================
# Copyright 2009 Kitware, Inc.
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 37a894c4d..49ce57e49 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -1,79 +1,108 @@
-# - Find a wxWidgets (a.k.a., wxWindows) installation.
+#.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:
+# 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):
+# 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).
+#
#
-# 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
+# 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
+# ::
+#
+# 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:
+# 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)
+# 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.
#
-# 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()
+#
+# ::
+#
+# # 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})
+#
+# ::
+#
+# 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})
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
@@ -159,18 +188,6 @@ set(wxWidgets_LIBRARIES "")
set(wxWidgets_LIBRARY_DIRS "")
set(wxWidgets_CXX_FLAGS "")
-# Using SYSTEM with INCLUDE_DIRECTORIES in conjunction with wxWidgets on
-# the Mac produces compiler errors. Set wxWidgets_INCLUDE_DIRS_NO_SYSTEM
-# to prevent UsewxWidgets.cmake from using SYSTEM.
-#
-# See cmake mailing list discussions for more info:
-# http://www.cmake.org/pipermail/cmake/2008-April/021115.html
-# http://www.cmake.org/pipermail/cmake/2008-April/021146.html
-#
-if(APPLE OR CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
- set(wxWidgets_INCLUDE_DIRS_NO_SYSTEM 1)
-endif()
-
# DEPRECATED: This is a patch to support the DEPRECATED use of
# wxWidgets_USE_LIBS.
#
@@ -200,13 +217,12 @@ else()
endif()
#=====================================================================
+# Determine whether unix or win32 paths should be used
#=====================================================================
-if(WIN32 AND NOT CYGWIN AND NOT MSYS)
+if(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_CROSSCOMPILING)
set(wxWidgets_FIND_STYLE "win32")
else()
- if(UNIX OR MSYS)
- set(wxWidgets_FIND_STYLE "unix")
- endif()
+ set(wxWidgets_FIND_STYLE "unix")
endif()
#=====================================================================
@@ -274,6 +290,8 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Find wxWidgets multilib base libraries.
find_library(WX_base${_DBG}
NAMES
+ wxbase31${_UCD}${_DBG}
+ wxbase30${_UCD}${_DBG}
wxbase29${_UCD}${_DBG}
wxbase28${_UCD}${_DBG}
wxbase27${_UCD}${_DBG}
@@ -286,6 +304,8 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
foreach(LIB net odbc xml)
find_library(WX_${LIB}${_DBG}
NAMES
+ wxbase31${_UCD}${_DBG}_${LIB}
+ wxbase30${_UCD}${_DBG}_${LIB}
wxbase29${_UCD}${_DBG}_${LIB}
wxbase28${_UCD}${_DBG}_${LIB}
wxbase27${_UCD}${_DBG}_${LIB}
@@ -300,6 +320,8 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Find wxWidgets monolithic library.
find_library(WX_mono${_DBG}
NAMES
+ wxmsw${_UNV}31${_UCD}${_DBG}
+ wxmsw${_UNV}30${_UCD}${_DBG}
wxmsw${_UNV}29${_UCD}${_DBG}
wxmsw${_UNV}28${_UCD}${_DBG}
wxmsw${_UNV}27${_UCD}${_DBG}
@@ -315,6 +337,8 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
stc ribbon propgrid webview)
find_library(WX_${LIB}${_DBG}
NAMES
+ wxmsw${_UNV}31${_UCD}${_DBG}_${LIB}
+ wxmsw${_UNV}30${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}29${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}28${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}27${_UCD}${_DBG}_${LIB}
@@ -354,7 +378,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Clear wxWidgets multilib libraries.
foreach(LIB core adv aui html media xrc dbgrid gl qa richtext
- stc ribbon propgrid)
+ webview stc ribbon propgrid)
WX_CLEAR_LIB(WX_${LIB}${_DBG})
endforeach()
endmacro()
@@ -428,6 +452,10 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
D:/
ENV ProgramFiles
PATH_SUFFIXES
+ wxWidgets-3.0.2
+ wxWidgets-3.0.1
+ wxWidgets-3.0.0
+ wxWidgets-2.9.5
wxWidgets-2.9.4
wxWidgets-2.9.3
wxWidgets-2.9.2
@@ -475,6 +503,8 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# settings.
if(MINGW)
set(WX_LIB_DIR_PREFIX gcc)
+ elseif(CMAKE_CL_64)
+ set(WX_LIB_DIR_PREFIX vc_x64)
else()
set(WX_LIB_DIR_PREFIX vc)
endif()
@@ -523,7 +553,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
if(WX_LIB_DIR)
# If building shared libs, define WXUSINGDLL to use dllimport.
- if(WX_LIB_DIR MATCHES ".*[dD][lL][lL].*")
+ if(WX_LIB_DIR MATCHES "[dD][lL][lL]")
set(wxWidgets_DEFINITIONS WXUSINGDLL)
DBG_MSG_V("detected SHARED/DLL tree WX_LIB_DIR=${WX_LIB_DIR}")
endif()
@@ -631,7 +661,7 @@ else()
if(_wx_result EQUAL 0)
foreach(_opt_name debug static unicode universal)
string(TOUPPER ${_opt_name} _upper_opt_name)
- if(_wx_selected_config MATCHES ".*${_opt_name}.*")
+ if(_wx_selected_config MATCHES "${_opt_name}")
set(wxWidgets_DEFAULT_${_upper_opt_name} ON)
else()
set(wxWidgets_DEFAULT_${_upper_opt_name} OFF)
@@ -702,7 +732,8 @@ else()
# UNIX: Start actual work.
#-----------------------------------------------------------------
# Support cross-compiling, only search in the target platform.
- find_program(wxWidgets_CONFIG_EXECUTABLE wx-config
+ find_program(wxWidgets_CONFIG_EXECUTABLE
+ NAMES wx-config wx-config-3.1 wx-config-3.0 wx-config-2.9 wx-config-2.8
DOC "Location of wxWidgets library configuration provider binary (wx-config)."
ONLY_CMAKE_FIND_ROOT_PATH
)
@@ -818,6 +849,28 @@ else()
endif()
endif()
+# Check if a specfic version was requested by find_package().
+if(wxWidgets_FOUND)
+ find_file(_filename wx/version.h PATHS ${wxWidgets_INCLUDE_DIRS} NO_DEFAULT_PATH)
+ dbg_msg("_filename: ${_filename}")
+
+ if(NOT _filename)
+ message(FATAL_ERROR "wxWidgets wx/version.h file not found in ${wxWidgets_INCLUDE_DIRS}.")
+ endif()
+
+ file(READ ${_filename} _wx_version_h)
+
+ string(REGEX REPLACE "^(.*\n)?#define +wxMAJOR_VERSION +([0-9]+).*"
+ "\\2" wxWidgets_VERSION_MAJOR "${_wx_version_h}" )
+ string(REGEX REPLACE "^(.*\n)?#define +wxMINOR_VERSION +([0-9]+).*"
+ "\\2" wxWidgets_VERSION_MINOR "${_wx_version_h}" )
+ string(REGEX REPLACE "^(.*\n)?#define +wxRELEASE_NUMBER +([0-9]+).*"
+ "\\2" wxWidgets_VERSION_PATCH "${_wx_version_h}" )
+ set(wxWidgets_VERSION_STRING
+ "${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}" )
+ dbg_msg("wxWidgets_VERSION_STRING: ${wxWidgets_VERSION_STRING}")
+endif()
+
# Debug output:
DBG_MSG("wxWidgets_FOUND : ${wxWidgets_FOUND}")
DBG_MSG("wxWidgets_INCLUDE_DIRS : ${wxWidgets_INCLUDE_DIRS}")
@@ -828,10 +881,13 @@ DBG_MSG("wxWidgets_USE_FILE : ${wxWidgets_USE_FILE}")
#=====================================================================
#=====================================================================
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(wxWidgets DEFAULT_MSG wxWidgets_FOUND)
-# Maintain consistency with all other variables.
-set(wxWidgets_FOUND ${WXWIDGETS_FOUND})
+
+find_package_handle_standard_args(wxWidgets
+ REQUIRED_VARS wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS
+ VERSION_VAR wxWidgets_VERSION_STRING
+ )
#=====================================================================
# Macros for use in wxWidgets apps.
diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake
index 868d20c73..6e441c3a4 100644
--- a/Modules/FindwxWindows.cmake
+++ b/Modules/FindwxWindows.cmake
@@ -1,51 +1,81 @@
-# - 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)
+#.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++
+# ::
+#
+# 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).
+# 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
+# ::
+#
+# 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
+# ::
+#
+# 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)
+# AUTHOR Jan Woetzel <http://www.mip.informatik.uni-kiel.de/~jw>
+# (07/2003-01/2006)
#=============================================================================
# Copyright 2000-2009 Kitware, Inc.
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index c59e1f839..70c3fd7c0 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -1,85 +1,129 @@
-# - Fortran/C Interface Detection
+#.rst:
+# FortranCInterface
+# -----------------
+#
+# Fortran/C Interface Detection
+#
# This module automatically detects the API by which C and Fortran
# languages interact. Variables indicate if the mangling is found:
-# FortranCInterface_GLOBAL_FOUND = Global subroutines and functions
-# FortranCInterface_MODULE_FOUND = Module subroutines and functions
-# (declared by "MODULE PROCEDURE")
+#
+# ::
+#
+# FortranCInterface_GLOBAL_FOUND = Global subroutines and functions
+# FortranCInterface_MODULE_FOUND = Module subroutines and functions
+# (declared by "MODULE PROCEDURE")
+#
# A function is provided to generate a C header file containing macros
# to mangle symbol names:
-# FortranCInterface_HEADER(<file>
-# [MACRO_NAMESPACE <macro-ns>]
-# [SYMBOL_NAMESPACE <ns>]
-# [SYMBOLS [<module>:]<function> ...])
+#
+# ::
+#
+# FortranCInterface_HEADER(<file>
+# [MACRO_NAMESPACE <macro-ns>]
+# [SYMBOL_NAMESPACE <ns>]
+# [SYMBOLS [<module>:]<function> ...])
+#
# It generates in <file> definitions of the following macros:
-# #define FortranCInterface_GLOBAL (name,NAME) ...
-# #define FortranCInterface_GLOBAL_(name,NAME) ...
-# #define FortranCInterface_MODULE (mod,name, MOD,NAME) ...
-# #define FortranCInterface_MODULE_(mod,name, MOD,NAME) ...
-# These macros mangle four categories of Fortran symbols,
-# respectively:
-# - Global symbols without '_': call mysub()
-# - Global symbols with '_' : call my_sub()
-# - Module symbols without '_': use mymod; call mysub()
-# - Module symbols with '_' : use mymod; call my_sub()
+#
+# ::
+#
+# #define FortranCInterface_GLOBAL (name,NAME) ...
+# #define FortranCInterface_GLOBAL_(name,NAME) ...
+# #define FortranCInterface_MODULE (mod,name, MOD,NAME) ...
+# #define FortranCInterface_MODULE_(mod,name, MOD,NAME) ...
+#
+# These macros mangle four categories of Fortran symbols, respectively:
+#
+# ::
+#
+# - Global symbols without '_': call mysub()
+# - Global symbols with '_' : call my_sub()
+# - Module symbols without '_': use mymod; call mysub()
+# - Module symbols with '_' : use mymod; call my_sub()
+#
# If mangling for a category is not known, its macro is left undefined.
-# All macros require raw names in both lower case and upper case.
-# The MACRO_NAMESPACE option replaces the default "FortranCInterface_"
+# All macros require raw names in both lower case and upper case. The
+# MACRO_NAMESPACE option replaces the default "FortranCInterface_"
# prefix with a given namespace "<macro-ns>".
#
# The SYMBOLS option lists symbols to mangle automatically with C
# preprocessor definitions:
-# <function> ==> #define <ns><function> ...
-# <module>:<function> ==> #define <ns><module>_<function> ...
+#
+# ::
+#
+# <function> ==> #define <ns><function> ...
+# <module>:<function> ==> #define <ns><module>_<function> ...
+#
# If the mangling for some symbol is not known then no preprocessor
-# definition is created, and a warning is displayed.
-# The SYMBOL_NAMESPACE option prefixes all preprocessor definitions
+# definition is created, and a warning is displayed. The
+# SYMBOL_NAMESPACE option prefixes all preprocessor definitions
# generated by the SYMBOLS option with a given namespace "<ns>".
#
# Example usage:
-# include(FortranCInterface)
-# FortranCInterface_HEADER(FC.h MACRO_NAMESPACE "FC_")
-# This creates a "FC.h" header that defines mangling macros
-# FC_GLOBAL(), FC_GLOBAL_(), FC_MODULE(), and FC_MODULE_().
+#
+# ::
+#
+# include(FortranCInterface)
+# FortranCInterface_HEADER(FC.h MACRO_NAMESPACE "FC_")
+#
+# This creates a "FC.h" header that defines mangling macros FC_GLOBAL(),
+# FC_GLOBAL_(), FC_MODULE(), and FC_MODULE_().
#
# Example usage:
-# include(FortranCInterface)
-# FortranCInterface_HEADER(FCMangle.h
-# MACRO_NAMESPACE "FC_"
-# SYMBOL_NAMESPACE "FC_"
-# SYMBOLS mysub mymod:my_sub)
+#
+# ::
+#
+# include(FortranCInterface)
+# FortranCInterface_HEADER(FCMangle.h
+# MACRO_NAMESPACE "FC_"
+# SYMBOL_NAMESPACE "FC_"
+# SYMBOLS mysub mymod:my_sub)
+#
# This creates a "FCMangle.h" header that defines the same FC_*()
# mangling macros as the previous example plus preprocessor symbols
# FC_mysub and FC_mymod_my_sub.
#
# Another function is provided to verify that the Fortran and C/C++
# compilers work together:
-# FortranCInterface_VERIFY([CXX] [QUIET])
-# It tests whether a simple test executable using Fortran and C (and
-# C++ when the CXX option is given) compiles and links successfully.
-# The result is stored in the cache entry FortranCInterface_VERIFIED_C
-# (or FortranCInterface_VERIFIED_CXX if CXX is given) as a boolean.
-# If the check fails and QUIET is not given the function terminates
-# with a FATAL_ERROR message describing the problem. The purpose of
-# this check is to stop a build early for incompatible compiler
-# combinations. The test is built in the Release configuration.
-#
-# FortranCInterface is aware of possible GLOBAL and MODULE manglings
-# for many Fortran compilers, but it also provides an interface to
-# specify new possible manglings. Set the variables
-# FortranCInterface_GLOBAL_SYMBOLS
-# FortranCInterface_MODULE_SYMBOLS
-# before including FortranCInterface to specify manglings of the
-# symbols "MySub", "My_Sub", "MyModule:MySub", and "My_Module:My_Sub".
-# For example, the code:
-# set(FortranCInterface_GLOBAL_SYMBOLS mysub_ my_sub__ MYSUB_)
-# # ^^^^^ ^^^^^^ ^^^^^
-# set(FortranCInterface_MODULE_SYMBOLS
-# __mymodule_MOD_mysub __my_module_MOD_my_sub)
-# # ^^^^^^^^ ^^^^^ ^^^^^^^^^ ^^^^^^
-# include(FortranCInterface)
+#
+# ::
+#
+# FortranCInterface_VERIFY([CXX] [QUIET])
+#
+# It tests whether a simple test executable using Fortran and C (and C++
+# when the CXX option is given) compiles and links successfully. The
+# result is stored in the cache entry FortranCInterface_VERIFIED_C (or
+# FortranCInterface_VERIFIED_CXX if CXX is given) as a boolean. If the
+# check fails and QUIET is not given the function terminates with a
+# FATAL_ERROR message describing the problem. The purpose of this check
+# is to stop a build early for incompatible compiler combinations. The
+# test is built in the Release configuration.
+#
+# FortranCInterface is aware of possible GLOBAL and MODULE manglings for
+# many Fortran compilers, but it also provides an interface to specify
+# new possible manglings. Set the variables
+#
+# ::
+#
+# FortranCInterface_GLOBAL_SYMBOLS
+# FortranCInterface_MODULE_SYMBOLS
+#
+# before including FortranCInterface to specify manglings of the symbols
+# "MySub", "My_Sub", "MyModule:MySub", and "My_Module:My_Sub". For
+# example, the code:
+#
+# ::
+#
+# set(FortranCInterface_GLOBAL_SYMBOLS mysub_ my_sub__ MYSUB_)
+# # ^^^^^ ^^^^^^ ^^^^^
+# set(FortranCInterface_MODULE_SYMBOLS
+# __mymodule_MOD_mysub __my_module_MOD_my_sub)
+# # ^^^^^^^^ ^^^^^ ^^^^^^^^^ ^^^^^^
+# include(FortranCInterface)
+#
# tells FortranCInterface to try given GLOBAL and MODULE manglings.
-# (The carets point at raw symbol names for clarity in this example
-# but are not needed.)
+# (The carets point at raw symbol names for clarity in this example but
+# are not needed.)
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
@@ -100,9 +144,8 @@ if(FortranCInterface_SOURCE_DIR)
return()
endif()
-# Use CMake 2.8.0 behavior for this module regardless of including context.
cmake_policy(PUSH)
-cmake_policy(VERSION 2.8.0)
+cmake_policy(SET CMP0007 NEW)
#-----------------------------------------------------------------------------
# Verify that C and Fortran are available.
@@ -284,7 +327,7 @@ function(FortranCInterface_VERIFY)
# Error if compilers are incompatible.
if(NOT FortranCInterface_VERIFIED_${lang} AND NOT quiet)
file(READ "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" _output)
- string(REGEX REPLACE "\n" "\n " _output "${_output}")
+ string(REPLACE "\n" "\n " _output "${_output}")
message(FATAL_ERROR
"The Fortran compiler:\n ${CMAKE_Fortran_COMPILER}\n"
"and the ${lang} compiler:\n ${CMAKE_${lang}_COMPILER}\n"
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index d35a72ce8..721a262ee 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -9,7 +9,7 @@
# See the License for more information.
#=============================================================================
-cmake_minimum_required(VERSION 2.6.3)
+cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(FortranCInterface C Fortran)
include(${FortranCInterface_BINARY_DIR}/Input.cmake OPTIONAL)
@@ -71,7 +71,7 @@ endif()
# Generate C symbol sources.
set(symbol_sources)
-if(NOT "${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(PathScale|Cray)$")
+if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(PathScale|Cray)$")
# Provide mymodule_ and my_module_ init symbols because:
# - PGI Fortran uses module init symbols
# but not for:
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index 798c44caa..bee7dae35 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -49,7 +49,7 @@ unset(FortranCInterface_COMPILED CACHE)
# Locate the sample project executable.
if(FortranCInterface_COMPILED)
find_program(FortranCInterface_EXE
- NAMES FortranCInterface
+ NAMES FortranCInterface${CMAKE_EXECUTABLE_SUFFIX}
PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Debug
NO_DEFAULT_PATH
)
@@ -67,11 +67,10 @@ endif()
set(FortranCInterface_SYMBOLS)
if(FortranCInterface_EXE)
file(STRINGS "${FortranCInterface_EXE}" _info_strings
- LIMIT_COUNT 8 REGEX "INFO:[^[]*\\[")
+ LIMIT_COUNT 8 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
foreach(info ${_info_strings})
- if("${info}" MATCHES ".*INFO:symbol\\[([^]]*)\\].*")
- string(REGEX REPLACE ".*INFO:symbol\\[([^]]*)\\].*" "\\1" symbol "${info}")
- list(APPEND FortranCInterface_SYMBOLS ${symbol})
+ if("${info}" MATCHES "INFO:symbol\\[([^]]*)\\]")
+ list(APPEND FortranCInterface_SYMBOLS ${CMAKE_MATCH_1})
endif()
endforeach()
elseif(NOT _result)
diff --git a/Modules/FortranCInterface/Verify/CMakeLists.txt b/Modules/FortranCInterface/Verify/CMakeLists.txt
index e969f2408..cde3c5312 100644
--- a/Modules/FortranCInterface/Verify/CMakeLists.txt
+++ b/Modules/FortranCInterface/Verify/CMakeLists.txt
@@ -9,7 +9,7 @@
# See the License for more information.
#=============================================================================
-cmake_minimum_required(VERSION 2.7)
+cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(VerifyFortranC C Fortran)
option(VERIFY_CXX "Whether to verify C++ and Fortran" OFF)
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index 0302e4bef..b42084eda 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -1,34 +1,107 @@
-# - Define GNU standard installation directories
-# Provides install directory variables as defined for GNU software:
-# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
+#.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
-# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
-# 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)
-# 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)
-# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of
-# install() commands for the corresponding file type. 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.
-# Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
-# from the corresponding destination by prepending (if necessary) the value
-# of CMAKE_INSTALL_PREFIX.
+#
+# ``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``)
+# ``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`` and ``LOCALSTATEDIR``,
+# 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`` or ``LOCALSTATEDIR``, 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`` or ``LOCALSTATEDIR``, 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
#=============================================================================
+# Copyright 2015 Alex Turbov <i.zaufi@gmail.com>
# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
# Copyright 2011 Kitware, Inc.
#
@@ -68,7 +141,31 @@ if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
endif()
-if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+# We check if the variable was manually set and not cached, in order to
+# allow projects to set the values as normal variables before including
+# GNUInstallDirs to avoid having the entries cached or user-editable. It
+# replaces the "if(NOT DEFINED CMAKE_INSTALL_XXX)" checks in all the
+# other cases.
+# If CMAKE_INSTALL_LIBDIR is defined, if _libdir_set is false, then the
+# variable is a normal one, otherwise it is a cache one.
+get_property(_libdir_set CACHE CMAKE_INSTALL_LIBDIR PROPERTY TYPE SET)
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set
+ AND DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX
+ AND NOT "${_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX}" STREQUAL "${CMAKE_INSTALL_PREFIX}"))
+ # If CMAKE_INSTALL_LIBDIR is not defined, it is always executed.
+ # Otherwise:
+ # * if _libdir_set is false it is not executed (meaning that it is
+ # not a cache variable)
+ # * if _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX is not defined it is
+ # not executed
+ # * if _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX and
+ # CMAKE_INSTALL_PREFIX are the same string it is not executed.
+ # _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX is updated after the
+ # execution, of this part of code, therefore at the next inclusion
+ # of the file, CMAKE_INSTALL_LIBDIR is defined, and the 2 strings
+ # are equal, meaning that the if is not executed the code the
+ # second time.
+
set(_LIBDIR_DEFAULT "lib")
# Override this default 'lib' with 'lib64' iff:
# - we are on Linux system but NOT cross-compiling
@@ -77,13 +174,30 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
+ # and CMAKE_INSTALL_PREFIX is "/usr"
# See http://wiki.debian.org/Multiarch
- if(CMAKE_SYSTEM_NAME MATCHES "Linux"
+ if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX)
+ set(__LAST_LIBDIR_DEFAULT "lib")
+ # __LAST_LIBDIR_DEFAULT is the default value that we compute from
+ # _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX, not a cache entry for
+ # the value that was last used as the default.
+ # This value is used to figure out whether the user changed the
+ # CMAKE_INSTALL_LIBDIR value manually, or if the value was the
+ # default one. When CMAKE_INSTALL_PREFIX changes, the value is
+ # updated to the new default, unless the user explicitly changed it.
+ endif()
+ if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
AND NOT CMAKE_CROSSCOMPILING)
if (EXISTS "/etc/debian_version") # is this a debian system ?
- if(CMAKE_LIBRARY_ARCHITECTURE)
- set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
- endif()
+ if(CMAKE_LIBRARY_ARCHITECTURE)
+ if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
+ set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+ endif()
+ if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX
+ AND "${_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
+ set(__LAST_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+ endif()
+ endif()
else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
message(AUTHOR_WARNING
@@ -92,12 +206,25 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
else()
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(_LIBDIR_DEFAULT "lib64")
+ if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX)
+ set(__LAST_LIBDIR_DEFAULT "lib64")
+ endif()
endif()
endif()
endif()
endif()
- set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
+ if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+ set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
+ elseif(DEFINED __LAST_LIBDIR_DEFAULT
+ AND "${__LAST_LIBDIR_DEFAULT}" STREQUAL "${CMAKE_INSTALL_LIBDIR}")
+ set_property(CACHE CMAKE_INSTALL_LIBDIR PROPERTY VALUE "${_LIBDIR_DEFAULT}")
+ endif()
endif()
+# Save for next run
+set(_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "CMAKE_INSTALL_PREFIX during last run")
+unset(_libdir_set)
+unset(__LAST_LIBDIR_DEFAULT)
+
if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
@@ -121,9 +248,26 @@ if(NOT CMAKE_INSTALL_DATADIR)
set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
endif()
-if(NOT CMAKE_INSTALL_INFODIR)
- set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
- set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
+if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+ if(NOT CMAKE_INSTALL_INFODIR)
+ set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (info)")
+ set(CMAKE_INSTALL_INFODIR "info")
+ endif()
+
+ if(NOT CMAKE_INSTALL_MANDIR)
+ set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (man)")
+ set(CMAKE_INSTALL_MANDIR "man")
+ endif()
+else()
+ if(NOT CMAKE_INSTALL_INFODIR)
+ set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
+ set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
+ endif()
+
+ if(NOT CMAKE_INSTALL_MANDIR)
+ set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
+ set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
+ endif()
endif()
if(NOT CMAKE_INSTALL_LOCALEDIR)
@@ -131,11 +275,6 @@ if(NOT CMAKE_INSTALL_LOCALEDIR)
set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
endif()
-if(NOT CMAKE_INSTALL_MANDIR)
- set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
- set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
-endif()
-
if(NOT CMAKE_INSTALL_DOCDIR)
set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
@@ -180,8 +319,35 @@ foreach(dir
MANDIR
DOCDIR
)
- if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_${dir}}")
+ # Handle special cases:
+ # - CMAKE_INSTALL_PREFIX == /
+ # - CMAKE_INSTALL_PREFIX == /usr
+ # - CMAKE_INSTALL_PREFIX == /opt/...
+ if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/")
+ if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
+ set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
+ else()
+ if (NOT "${CMAKE_INSTALL_${dir}}" MATCHES "^usr/")
+ set(CMAKE_INSTALL_${dir} "usr/${CMAKE_INSTALL_${dir}}")
+ endif()
+ set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
+ endif()
+ elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
+ if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
+ set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
+ else()
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ endif()
+ elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*")
+ if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
+ set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}${CMAKE_INSTALL_PREFIX}")
+ else()
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ endif()
+ else()
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ endif()
else()
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
endif()
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index 4ef14ac28..4f4efbcf3 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -1,133 +1,182 @@
-# - Function for generation of export macros for libraries
-# This module provides the function GENERATE_EXPORT_HEADER() and the
-# accompanying ADD_COMPILER_EXPORT_FLAGS() function.
-#
-# 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>]
-# [STATIC_DEFINE <static_define>]
-# [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>]
-# [DEFINE_NO_DEPRECATED]
-# [PREFIX_NAME <prefix_name>]
-# )
-#
-# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] )
-#
-# By default GENERATE_EXPORT_HEADER() generates macro names in a file name
-# determined by the name of the library. The ADD_COMPILER_EXPORT_FLAGS function
-# adds -fvisibility=hidden to CMAKE_CXX_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 required CXX_FLAGS required to enable visibility support
-# for the compiler/architecture in use.
-#
-# This means that in the simplest case, users of these functions will be
-# equivalent to:
-#
-# add_compiler_export_flags()
-# 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}
-# )
+#.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>]
+# [STATIC_DEFINE <static_define>]
+# [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>]
+# [DEFINE_NO_DEPRECATED]
+# [PREFIX_NAME <prefix_name>]
+# )
+#
+#
+# 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:
#
-# #include "somelib_export.h"
-# class SOMELIB_EXPORT SomeClass {
-# ...
-# };
+# .. code-block:: c++
#
-# The CMake fragment will generate a file in the ${CMAKE_CURRENT_BINARY_DIR}
-# called somelib_export.h containing the macros SOMELIB_EXPORT, SOMELIB_NO_EXPORT,
-# SOMELIB_DEPRECATED, SOMELIB_DEPRECATED_EXPORT and SOMELIB_DEPRECATED_NO_EXPORT.
-# The resulting file should be installed with other headers in the library.
+# #include "somelib_export.h"
+# class SOMELIB_EXPORT SomeClass {
+# ...
+# };
#
-# The BASE_NAME argument can be used to override the file name and the names
-# used for the macros
#
-# add_library(somelib someclass.cpp)
-# generate_export_header(somelib
-# BASE_NAME other_name
-# )
+# The CMake fragment will generate a file in the
+# ``${CMAKE_CURRENT_BINARY_DIR}`` called ``somelib_export.h`` containing the
+# macros ``SOMELIB_EXPORT``, ``SOMELIB_NO_EXPORT``, ``SOMELIB_DEPRECATED``,
+# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``. The
+# resulting file should be installed with other headers in the library.
#
-# 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`` argument can be used to override the file name and the
+# names used for the macros:
#
-# The BASE_NAME may be overridden by specifiying other options in the function.
-# For example:
+# .. 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 specifiying 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
-# EXPORT_MACRO_NAME OTHER_NAME_EXPORT
-# )
+# add_library(somelib someclass.cpp)
+# generate_export_header(somelib
+# DEPRECATED_MACRO_NAME KDE_DEPRECATED
+# )
#
-# creates the macro OTHER_NAME_EXPORT instead of SOMELIB_EXPORT, but other macros
-# and the generated file name is as default.
#
-# add_library(somelib someclass.cpp)
-# generate_export_header(somelib
-# DEPRECATED_MACRO_NAME KDE_DEPRECATED
-# )
+# creates the macro ``KDE_DEPRECATED`` instead of ``SOMELIB_DEPRECATED``.
#
-# creates the macro KDE_DEPRECATED instead of SOMELIB_DEPRECATED.
+# If ``LIBRARY_TARGET`` is a static library, macros are defined without
+# values.
#
-# 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:
#
-# 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)
+# 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.
+# 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.
+# 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})
#
-# 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:
#
-# class SOMELIB_EXPORT SomeClass
-# {
-# public:
-# #ifndef SOMELIB_NO_DEPRECATED
-# SOMELIB_DEPRECATED void oldMethod();
-# #endif
-# };
+# .. code-block:: c++
+#
+# class SOMELIB_EXPORT SomeClass
+# {
+# public:
+# #ifndef SOMELIB_NO_DEPRECATED
+# SOMELIB_DEPRECATED void oldMethod();
+# #endif
+# };
#
-# #ifndef SOMELIB_NO_DEPRECATED
-# void SomeClass::oldMethod() { }
-# #endif
+# .. code-block:: c++
#
-# If PREFIX_NAME is specified, the argument will be used as a prefix to all
-# generated macros.
+# #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:
#
-# generate_export_header(somelib PREFIX_NAME VTK_)
+# .. code-block:: cmake
+#
+# generate_export_header(somelib PREFIX_NAME VTK_)
#
-# Generates the macros VTK_SOMELIB_EXPORT etc.
+# 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.
#=============================================================================
# Copyright 2011 Stephen Kelly <steveire@gmail.com>
@@ -164,14 +213,13 @@ macro(_test_compiler_hidden_visibility)
# Exclude XL here because it misinterprets -fvisibility=hidden even though
# the check_cxx_compiler_flag passes
- # http://www.cdash.org/CDash/testDetails.php?test=109109951&build=1419259
if(NOT GCC_TOO_OLD
AND NOT _INTEL_TOO_OLD
AND NOT WIN32
AND NOT CYGWIN
- AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES XL
- AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES PGI
- AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
+ AND NOT CMAKE_CXX_COMPILER_ID MATCHES XL
+ AND NOT CMAKE_CXX_COMPILER_ID MATCHES PGI
+ AND NOT CMAKE_CXX_COMPILER_ID MATCHES Watcom)
check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
check_cxx_compiler_flag(-fvisibility-inlines-hidden
COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
@@ -182,11 +230,15 @@ macro(_test_compiler_hidden_visibility)
endmacro()
macro(_test_compiler_has_deprecated)
- if("${CMAKE_CXX_COMPILER_ID}" MATCHES Borland
- OR "${CMAKE_CXX_COMPILER_ID}" MATCHES HP
+ # NOTE: Some Embarcadero compilers silently compile __declspec(deprecated)
+ # without error, but this is not a documented feature and the attribute does
+ # not actually generate any warnings.
+ if(CMAKE_CXX_COMPILER_ID MATCHES Borland
+ OR CMAKE_CXX_COMPILER_ID MATCHES Embarcadero
+ OR CMAKE_CXX_COMPILER_ID MATCHES HP
OR GCC_TOO_OLD
- OR "${CMAKE_CXX_COMPILER_ID}" MATCHES PGI
- OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
+ OR CMAKE_CXX_COMPILER_ID MATCHES PGI
+ OR CMAKE_CXX_COMPILER_ID MATCHES Watcom)
set(COMPILER_HAS_DEPRECATED "" CACHE INTERNAL
"Compiler support for a deprecated attribute")
else()
@@ -220,7 +272,7 @@ macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY)
get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
if(NOT ${type} STREQUAL "STATIC_LIBRARY")
- if(WIN32)
+ if(WIN32 OR CYGWIN)
set(DEFINE_EXPORT "__declspec(dllexport)")
set(DEFINE_IMPORT "__declspec(dllimport)")
elseif(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY)
@@ -315,6 +367,7 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY)
get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
if(NOT ${type} STREQUAL "STATIC_LIBRARY"
AND NOT ${type} STREQUAL "SHARED_LIBRARY"
+ AND NOT ${type} STREQUAL "OBJECT_LIBRARY"
AND NOT ${type} STREQUAL "MODULE_LIBRARY")
message(WARNING "This macro can only be used with libraries")
return()
@@ -326,6 +379,9 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY)
endfunction()
function(add_compiler_export_flags)
+ if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
+ message(DEPRECATION "The add_compiler_export_flags function is obsolete. Use the CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties instead.")
+ endif()
_test_compiler_hidden_visibility()
_test_compiler_has_deprecated()
@@ -343,7 +399,7 @@ function(add_compiler_export_flags)
# Either return the extra flags needed in the supplied argument, or to the
# CMAKE_CXX_FLAGS if no argument is supplied.
- if(ARGV0)
+ if(ARGC GREATER 0)
set(${ARGV0} "${EXTRA_FLAGS}" PARENT_SCOPE)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}" PARENT_SCOPE)
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 9e89788fe..391e7f8fa 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -1,111 +1,166 @@
-# - 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
+#.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)
+# 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>)
-# 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
+# ::
+#
+# 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. <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.
+# 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.
+# ::
+#
+# 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>)
#
-# IS_FILE_EXECUTABLE(<file> <result_var>)
-# Return 1 in <result_var> if <file> is a binary executable, 0 otherwise.
+# Return 1 in <result_var> if <file> is a binary executable, 0
+# otherwise.
+#
+# ::
+#
+# GP_ITEM_DEFAULT_EMBEDDED_PATH(<item> <default_embedded_path_var>)
#
-# 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>)
+# ::
+#
+# 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>)
-# Return the type of <file> with respect to <original_file>. String
-# describing type of prerequisite is returned in variable named <type_var>.
+# ::
+#
+# 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
+#
+# ::
+#
+# 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>.
+# ::
+#
+# 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
+#
+# ::
+#
+# system
+# local
+# embedded
+# other
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
@@ -124,7 +179,7 @@ function(gp_append_unique list_var value)
set(contains 0)
foreach(item ${${list_var}})
- if("${item}" STREQUAL "${value}")
+ if(item STREQUAL "${value}")
set(contains 1)
break()
endif()
@@ -174,9 +229,14 @@ function(is_file_executable file result_var)
if(file_cmd)
execute_process(COMMAND "${file_cmd}" "${file_full}"
+ RESULT_VARIABLE file_rv
OUTPUT_VARIABLE file_ov
+ ERROR_VARIABLE file_ev
OUTPUT_STRIP_TRAILING_WHITESPACE
)
+ if(NOT file_rv STREQUAL "0")
+ message(FATAL_ERROR "${file_cmd} failed: ${file_rv}\n${file_ev}")
+ endif()
# Replace the name of the file in the output with a placeholder token
# (the string " _file_full_ ") so that just in case the path name of
@@ -205,6 +265,13 @@ function(is_file_executable file result_var)
return()
endif()
+ # "file" version 5.22 does not print "(used shared libraries)"
+ # but uses "interpreter"
+ if("${file_ov}" MATCHES "shared object.*interpreter")
+ set(${result_var} 1 PARENT_SCOPE)
+ return()
+ endif()
+
else()
message(STATUS "warning: No 'file' command, skipping execute_process...")
endif()
@@ -268,6 +335,11 @@ endfunction()
function(gp_resolve_item context item exepath dirs resolved_item_var)
set(resolved 0)
set(resolved_item "${item}")
+ if(ARGC GREATER 5)
+ set(rpaths "${ARGV5}")
+ else()
+ set(rpaths "")
+ endif()
# Is it already resolved?
#
@@ -276,7 +348,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
endif()
if(NOT resolved)
- if(item MATCHES "@executable_path")
+ if(item MATCHES "^@executable_path")
#
# @executable_path references are assumed relative to exepath
#
@@ -294,7 +366,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
endif()
if(NOT resolved)
- if(item MATCHES "@loader_path")
+ if(item MATCHES "^@loader_path")
#
# @loader_path references are assumed relative to the
# PATH of the given "context" (presumably another library)
@@ -314,7 +386,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
endif()
if(NOT resolved)
- if(item MATCHES "@rpath")
+ if(item MATCHES "^@rpath")
#
# @rpath references are relative to the paths built into the binaries with -rpath
# We handle this case like we do for other Unixes
@@ -322,9 +394,9 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
string(REPLACE "@rpath/" "" norpath_item "${item}")
set(ri "ri-NOTFOUND")
- find_file(ri "${norpath_item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
+ find_file(ri "${norpath_item}" ${exepath} ${dirs} ${rpaths} NO_DEFAULT_PATH)
if(ri)
- #message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
+ #message(STATUS "info: 'find_file' in exepath/dirs/rpaths (${ri})")
set(resolved 1)
set(resolved_item "${ri}")
set(ri "ri-NOTFOUND")
@@ -418,6 +490,11 @@ endfunction()
function(gp_resolved_file_type original_file file exepath dirs type_var)
+ if(ARGC GREATER 5)
+ set(rpaths "${ARGV5}")
+ else()
+ set(rpaths "")
+ endif()
#message(STATUS "**")
if(NOT IS_ABSOLUTE "${original_file}")
@@ -436,7 +513,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
if(NOT is_embedded)
if(NOT IS_ABSOLUTE "${file}")
- gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file)
+ gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file "${rpaths}")
endif()
string(TOLOWER "${original_file}" original_lower)
@@ -456,12 +533,12 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
if(WIN32)
string(TOLOWER "$ENV{SystemRoot}" sysroot)
- string(REGEX REPLACE "\\\\" "/" sysroot "${sysroot}")
+ file(TO_CMAKE_PATH "${sysroot}" sysroot)
string(TOLOWER "$ENV{windir}" windir)
- string(REGEX REPLACE "\\\\" "/" windir "${windir}")
+ file(TO_CMAKE_PATH "${windir}" windir)
- if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
+ if(lower MATCHES "^(api-ms-win-|${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
set(is_system 1)
endif()
@@ -471,15 +548,25 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
if(CYGPATH_EXECUTABLE)
execute_process(COMMAND ${CYGPATH_EXECUTABLE} -W
+ RESULT_VARIABLE env_rv
OUTPUT_VARIABLE env_windir
+ ERROR_VARIABLE env_ev
OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT env_rv STREQUAL "0")
+ message(FATAL_ERROR "${CYGPATH_EXECUTABLE} -W failed: ${env_rv}\n${env_ev}")
+ endif()
execute_process(COMMAND ${CYGPATH_EXECUTABLE} -S
+ RESULT_VARIABLE env_rv
OUTPUT_VARIABLE env_sysdir
+ ERROR_VARIABLE env_ev
OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT env_rv STREQUAL "0")
+ message(FATAL_ERROR "${CYGPATH_EXECUTABLE} -S failed: ${env_rv}\n${env_ev}")
+ endif()
string(TOLOWER "${env_windir}" windir)
string(TOLOWER "${env_sysdir}" sysroot)
- if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
+ if(lower MATCHES "^(api-ms-win-|${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
set(is_system 1)
endif()
endif()
@@ -489,14 +576,14 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
if(NOT is_system)
get_filename_component(original_path "${original_lower}" PATH)
get_filename_component(path "${lower}" PATH)
- if("${original_path}" STREQUAL "${path}")
+ if(original_path STREQUAL path)
set(is_local 1)
else()
string(LENGTH "${original_path}/" original_length)
string(LENGTH "${lower}" path_length)
if(${path_length} GREATER ${original_length})
string(SUBSTRING "${lower}" 0 ${original_length} path)
- if("${original_path}/" STREQUAL "${path}")
+ if("${original_path}/" STREQUAL path)
set(is_embedded 1)
endif()
endif()
@@ -559,6 +646,11 @@ endfunction()
function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
set(verbose 0)
set(eol_char "E")
+ if(ARGC GREATER 6)
+ set(rpaths "${ARGV6}")
+ else()
+ set(rpaths "")
+ endif()
if(NOT IS_ABSOLUTE "${target}")
message("warning: target '${target}' is not absolute...")
@@ -584,7 +676,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# Try to choose the right tool by default. Caller can set gp_tool prior to
# calling this function to force using a different tool.
#
- if("${gp_tool}" STREQUAL "")
+ if(NOT gp_tool)
set(gp_tool "ldd")
if(APPLE)
@@ -608,45 +700,38 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
return()
endif()
- set(gp_tool_known 0)
+ set(gp_cmd_maybe_filter) # optional command to pre-filter gp_tool results
- if("${gp_tool}" STREQUAL "ldd")
+ if(gp_tool STREQUAL "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)
- set(gp_tool_known 1)
- endif()
-
- if("${gp_tool}" STREQUAL "otool")
+ elseif(gp_tool STREQUAL "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)
- set(gp_tool_known 1)
- endif()
-
- if("${gp_tool}" STREQUAL "dumpbin")
+ elseif(gp_tool STREQUAL "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)
- set(gp_tool_known 1)
- endif()
-
- if("${gp_tool}" STREQUAL "objdump")
+ elseif(gp_tool STREQUAL "objdump")
set(gp_cmd_args "-p")
set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$")
set(gp_regex_error "")
set(gp_regex_fallback "")
set(gp_regex_cmp_count 1)
- set(gp_tool_known 1)
- endif()
-
- if(NOT gp_tool_known)
+ # objdump generaates copious output so we create a grep filter to pre-filter results
+ find_program(gp_grep_cmd grep)
+ if(gp_grep_cmd)
+ set(gp_cmd_maybe_filter COMMAND ${gp_grep_cmd} "^[[:blank:]]*DLL Name: ")
+ endif()
+ else()
message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...")
message(STATUS "CMake function get_prerequisites needs more code to handle '${gp_tool}'")
message(STATUS "Valid gp_tool values are dumpbin, ldd, objdump and otool.")
@@ -654,7 +739,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
endif()
- if("${gp_tool}" STREQUAL "dumpbin")
+ if(gp_tool STREQUAL "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
@@ -669,7 +754,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(gp_found_cmd_dlls_dir 0)
file(TO_CMAKE_PATH "$ENV{PATH}" env_path)
foreach(gp_env_path_element ${env_path})
- if("${gp_env_path_element}" STREQUAL "${gp_cmd_dlls_dir}")
+ if(gp_env_path_element STREQUAL gp_cmd_dlls_dir)
set(gp_found_cmd_dlls_dir 1)
endif()
endforeach()
@@ -683,11 +768,13 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
#
# </setup-gp_tool-vars>
- if("${gp_tool}" STREQUAL "ldd")
+ if(gp_tool STREQUAL "ldd")
set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
- foreach(dir ${exepath} ${dirs})
- set(ENV{LD_LIBRARY_PATH} "${dir}:$ENV{LD_LIBRARY_PATH}")
+ set(new_ld_env "${exepath}")
+ foreach(dir ${dirs})
+ set(new_ld_env "${new_ld_env}:${dir}")
endforeach()
+ set(ENV{LD_LIBRARY_PATH} "${new_ld_env}:$ENV{LD_LIBRARY_PATH}")
endif()
@@ -700,10 +787,21 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
#
execute_process(
COMMAND ${gp_cmd} ${gp_cmd_args} ${target}
+ ${gp_cmd_maybe_filter}
+ RESULT_VARIABLE gp_rv
OUTPUT_VARIABLE gp_cmd_ov
+ ERROR_VARIABLE gp_ev
)
+ if(NOT gp_rv STREQUAL "0")
+ if(gp_tool STREQUAL "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()
+ message(FATAL_ERROR "${gp_cmd} failed: ${gp_rv}\n${gp_ev}")
+ endif()
+ endif()
- if("${gp_tool}" STREQUAL "ldd")
+ if(gp_tool STREQUAL "ldd")
set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
endif()
@@ -717,17 +815,22 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# Convert to a list of lines:
#
- string(REGEX REPLACE ";" "\\\\;" candidates "${gp_cmd_ov}")
- string(REGEX REPLACE "\n" "${eol_char};" candidates "${candidates}")
+ string(REPLACE ";" "\\;" candidates "${gp_cmd_ov}")
+ string(REPLACE "\n" "${eol_char};" candidates "${candidates}")
# check for install id and remove it from list, since otool -L can include a
# reference to itself
set(gp_install_id)
- if("${gp_tool}" STREQUAL "otool")
+ if(gp_tool STREQUAL "otool")
execute_process(
COMMAND otool -D ${target}
+ RESULT_VARIABLE otool_rv
OUTPUT_VARIABLE gp_install_id_ov
+ ERROR_VARIABLE otool_ev
)
+ if(NOT otool_rv STREQUAL "0")
+ message(FATAL_ERROR "otool -D failed: ${otool_rv}\n${otool_ev}")
+ endif()
# second line is install name
string(REGEX REPLACE ".*:\n" "" gp_install_id "${gp_install_id_ov}")
if(gp_install_id)
@@ -773,15 +876,15 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
#
set(add_item 1)
- if("${item}" STREQUAL "${gp_install_id}")
+ if(item STREQUAL gp_install_id)
set(add_item 0)
endif()
if(add_item AND ${exclude_system})
set(type "")
- gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type)
+ gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type "${rpaths}")
- if("${type}" STREQUAL "system")
+ if(type STREQUAL "system")
set(add_item 0)
endif()
endif()
@@ -800,7 +903,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# that the analysis tools can simply accept it as input.
#
if(NOT list_length_before_append EQUAL list_length_after_append)
- gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item)
+ gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item "${rpaths}")
set(unseen_prereqs ${unseen_prereqs} "${resolved_item}")
endif()
endif()
@@ -819,7 +922,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if(${recurse})
set(more_inputs ${unseen_prereqs})
foreach(input ${more_inputs})
- get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}")
+ get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}" "${rpaths}")
endforeach()
endif()
@@ -828,22 +931,22 @@ endfunction()
function(list_prerequisites target)
- if("${ARGV1}" STREQUAL "")
- set(all 1)
- else()
+ if(ARGC GREATER 1 AND NOT "${ARGV1}" STREQUAL "")
set(all "${ARGV1}")
+ else()
+ set(all 1)
endif()
- if("${ARGV2}" STREQUAL "")
- set(exclude_system 0)
- else()
+ if(ARGC GREATER 2 AND NOT "${ARGV2}" STREQUAL "")
set(exclude_system "${ARGV2}")
+ else()
+ set(exclude_system 0)
endif()
- if("${ARGV3}" STREQUAL "")
- set(verbose 0)
- else()
+ if(ARGC GREATER 3 AND NOT "${ARGV3}" STREQUAL "")
set(verbose "${ARGV3}")
+ else()
+ set(verbose 0)
endif()
set(count 0)
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 2479d68b5..2ff9aed4b 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -1,30 +1,50 @@
-# By including this file, all library files listed in the variable
-# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS will be installed with
-# install(PROGRAMS ...) into bin for WIN32 and lib
-# for non-WIN32. If CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP is set to TRUE
-# before including this file, then the INSTALL command is not called.
-# The user can use the variable CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS to use a
-# custom install command and install them however they want.
-# If it is the MSVC compiler, then the microsoft run
-# time libraries will be found and automatically added to the
-# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS, and installed.
-# If CMAKE_INSTALL_DEBUG_LIBRARIES is set and it is the MSVC
-# compiler, then the debug libraries are installed when available.
-# If CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY is set then only the debug
-# libraries are installed when both debug and release are available.
-# If CMAKE_INSTALL_MFC_LIBRARIES is set then the MFC run time
-# libraries are installed as well as the CRT run time libraries.
-# If CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION is set then the libraries are
-# installed to that directory rather than the default.
-# If CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS is NOT set, then this file
-# warns about required files that do not exist. You can set this variable to
-# ON before including this file to avoid the warning. For example, the Visual
-# Studio Express editions do not include the redistributable files, so if you
-# include this file on a machine with only VS Express installed, you'll get
-# the warning.
+#.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_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.
#=============================================================================
-# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006-2015 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -89,6 +109,8 @@ if(MSVC)
"${MSVC80_CRT_DIR}/msvcp80.dll"
"${MSVC80_CRT_DIR}/msvcr80.dll"
)
+ else()
+ set(__install__libs)
endif()
if(CMAKE_INSTALL_DEBUG_LIBRARIES)
@@ -127,6 +149,8 @@ if(MSVC)
"${MSVC90_CRT_DIR}/msvcp90.dll"
"${MSVC90_CRT_DIR}/msvcr90.dll"
)
+ else()
+ set(__install__libs)
endif()
if(CMAKE_INSTALL_DEBUG_LIBRARIES)
@@ -152,7 +176,8 @@ if(MSVC)
"${msvc_install_dir}/../../VC/redist"
"${base_dir}/VC/redist"
"$ENV{ProgramFiles}/Microsoft Visual Studio ${v}.0/VC/redist"
- "$ENV{ProgramFiles(x86)}/Microsoft Visual Studio ${v}.0/VC/redist"
+ set(programfilesx86 "ProgramFiles(x86)")
+ "$ENV{${programfilesx86}}/Microsoft Visual Studio ${v}.0/VC/redist"
)
mark_as_advanced(MSVC${v}_REDIST_DIR)
set(MSVC${v}_CRT_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT")
@@ -160,8 +185,14 @@ if(MSVC)
if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
set(__install__libs
"${MSVC${v}_CRT_DIR}/msvcp${v}0.dll"
- "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll"
)
+ if(NOT v VERSION_LESS 14)
+ list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/vcruntime${v}0.dll")
+ else()
+ list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll")
+ endif()
+ else()
+ set(__install__libs)
endif()
if(CMAKE_INSTALL_DEBUG_LIBRARIES)
@@ -169,8 +200,12 @@ if(MSVC)
"${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugCRT")
set(__install__libs ${__install__libs}
"${MSVC${v}_CRT_DIR}/msvcp${v}0d.dll"
- "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll"
)
+ if(NOT v VERSION_LESS 14)
+ list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/vcruntime${v}0d.dll")
+ else()
+ list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll")
+ endif()
endif()
endmacro()
@@ -186,6 +221,10 @@ if(MSVC)
MSVCRT_FILES_FOR_VERSION(12)
endif()
+ if(MSVC14)
+ MSVCRT_FILES_FOR_VERSION(14)
+ endif()
+
if(CMAKE_INSTALL_MFC_LIBRARIES)
if(MSVC70)
set(__install__libs ${__install__libs}
@@ -290,25 +329,37 @@ if(MSVC)
macro(MFC_FILES_FOR_VERSION version)
set(v "${version}")
+ # Multi-Byte Character Set versions of MFC are available as optional
+ # addon since Visual Studio 12. So for version 12 or higher, check
+ # whether they are available and exclude them if they are not.
+
if(CMAKE_INSTALL_DEBUG_LIBRARIES)
set(MSVC${v}_MFC_DIR
"${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugMFC")
set(__install__libs ${__install__libs}
- "${MSVC${v}_MFC_DIR}/mfc${v}0d.dll"
"${MSVC${v}_MFC_DIR}/mfc${v}0ud.dll"
- "${MSVC${v}_MFC_DIR}/mfcm${v}0d.dll"
"${MSVC${v}_MFC_DIR}/mfcm${v}0ud.dll"
)
+ if("${v}" LESS 12 OR EXISTS "${MSVC${v}_MFC_DIR}/mfc${v}0d.dll")
+ set(__install__libs ${__install__libs}
+ "${MSVC${v}_MFC_DIR}/mfc${v}0d.dll"
+ "${MSVC${v}_MFC_DIR}/mfcm${v}0d.dll"
+ )
+ endif()
endif()
set(MSVC${v}_MFC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFC")
if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
set(__install__libs ${__install__libs}
- "${MSVC${v}_MFC_DIR}/mfc${v}0.dll"
"${MSVC${v}_MFC_DIR}/mfc${v}0u.dll"
- "${MSVC${v}_MFC_DIR}/mfcm${v}0.dll"
"${MSVC${v}_MFC_DIR}/mfcm${v}0u.dll"
)
+ if("${v}" LESS 12 OR EXISTS "${MSVC${v}_MFC_DIR}/mfc${v}0.dll")
+ set(__install__libs ${__install__libs}
+ "${MSVC${v}_MFC_DIR}/mfc${v}0.dll"
+ "${MSVC${v}_MFC_DIR}/mfcm${v}0.dll"
+ )
+ endif()
endif()
# include the language dll's as well as the actuall dll's
@@ -338,6 +389,44 @@ if(MSVC)
if(MSVC12)
MFC_FILES_FOR_VERSION(12)
endif()
+
+ if(MSVC14)
+ MFC_FILES_FOR_VERSION(14)
+ endif()
+ endif()
+
+ # MSVC 8 was the first version with OpenMP
+ # Furthermore, there is no debug version of this
+ if(CMAKE_INSTALL_OPENMP_LIBRARIES)
+ macro(OPENMP_FILES_FOR_VERSION version_a version_b)
+ set(va "${version_a}")
+ set(vb "${version_b}")
+ set(MSVC${va}_OPENMP_DIR "${MSVC${va}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${vb}.OPENMP")
+
+ if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+ set(__install__libs ${__install__libs}
+ "${MSVC${va}_OPENMP_DIR}/vcomp${vb}.dll")
+ endif()
+ endmacro()
+
+ if(MSVC80)
+ OPENMP_FILES_FOR_VERSION(80 80)
+ endif()
+ if(MSVC90)
+ OPENMP_FILES_FOR_VERSION(90 90)
+ endif()
+ if(MSVC10)
+ OPENMP_FILES_FOR_VERSION(10 100)
+ endif()
+ if(MSVC11)
+ OPENMP_FILES_FOR_VERSION(11 110)
+ endif()
+ if(MSVC12)
+ OPENMP_FILES_FOR_VERSION(12 120)
+ endif()
+ if(MSVC14)
+ OPENMP_FILES_FOR_VERSION(14 140)
+ endif()
endif()
foreach(lib
@@ -361,18 +450,18 @@ endif()
if(WATCOM)
get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH )
- if(WATCOM17)
- set( __install__libs ${CompilerPath}/clbr17.dll
- ${CompilerPath}/mt7r17.dll ${CompilerPath}/plbr17.dll )
- endif()
- if(WATCOM18)
- set( __install__libs ${CompilerPath}/clbr18.dll
- ${CompilerPath}/mt7r18.dll ${CompilerPath}/plbr18.dll )
- endif()
- if(WATCOM19)
- set( __install__libs ${CompilerPath}/clbr19.dll
- ${CompilerPath}/mt7r19.dll ${CompilerPath}/plbr19.dll )
+ if(CMAKE_C_COMPILER_VERSION)
+ set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ else()
+ set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
endif()
+ string(REGEX MATCHALL "[0-9]+" _watcom_version_list "${_compiler_version}")
+ list(GET _watcom_version_list 0 _watcom_major)
+ list(GET _watcom_version_list 1 _watcom_minor)
+ set( __install__libs
+ ${CompilerPath}/clbr${_watcom_major}${_watcom_minor}.dll
+ ${CompilerPath}/mt7r${_watcom_major}${_watcom_minor}.dll
+ ${CompilerPath}/plbr${_watcom_major}${_watcom_minor}.dll )
foreach(lib
${__install__libs}
)
@@ -404,7 +493,13 @@ if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib)
endif()
endif()
+ if(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT)
+ set(_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT
+ COMPONENT ${CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT})
+ endif()
install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
- DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION})
+ DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}
+ ${_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT}
+ )
endif()
endif()
diff --git a/Modules/IntelVSImplicitPath/CMakeLists.txt b/Modules/IntelVSImplicitPath/CMakeLists.txt
index 96dc4e612..d11570447 100644
--- a/Modules/IntelVSImplicitPath/CMakeLists.txt
+++ b/Modules/IntelVSImplicitPath/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(IntelFortranImplicit Fortran)
add_custom_command(
OUTPUT output.cmake
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
new file mode 100644
index 000000000..86b89b25c
--- /dev/null
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -0,0 +1,60 @@
+
+macro(record_compiler_features lang compile_flags feature_list)
+ include("${CMAKE_ROOT}/Modules/Compiler/${CMAKE_${lang}_COMPILER_ID}-${lang}-FeatureTests.cmake" OPTIONAL)
+
+ string(TOLOWER ${lang} lang_lc)
+ file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin")
+ file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" "
+ const char features[] = {\"\\n\"\n")
+
+ get_property(known_features GLOBAL PROPERTY CMAKE_${lang}_KNOWN_FEATURES)
+
+ foreach(feature ${known_features})
+ if (_cmake_feature_test_${feature})
+ if (${_cmake_feature_test_${feature}} STREQUAL 1)
+ set(_feature_condition "\"1\" ")
+ else()
+ set(_feature_condition "#if ${_cmake_feature_test_${feature}}\n\"1\"\n#else\n\"0\"\n#endif\n")
+ endif()
+ file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" "\"${lang}_FEATURE:\"\n${_feature_condition}\"${feature}\\n\"\n")
+ endif()
+ endforeach()
+ file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
+ "\n};\n\nint main(int argc, char** argv) { (void)argv; return features[argc]; }\n")
+
+ try_compile(CMAKE_${lang}_FEATURE_TEST
+ ${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
+ COMPILE_DEFINITIONS "${compile_flags}"
+ OUTPUT_VARIABLE _output
+ COPY_FILE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin"
+ COPY_FILE_ERROR _copy_error
+ )
+ if(CMAKE_${lang}_FEATURE_TEST AND NOT _copy_error)
+ set(_result 0)
+ else()
+ set(_result 255)
+ endif()
+ unset(CMAKE_${lang}_FEATURE_TEST CACHE)
+
+ if (_result EQUAL 0)
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "\n\nDetecting ${lang} [${compile_flags}] compiler features compiled with the following output:\n${_output}\n\n")
+ if(EXISTS "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin")
+ file(STRINGS "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin"
+ features REGEX "${lang}_FEATURE:.*")
+ foreach(info ${features})
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ " Feature record: ${info}\n")
+ string(REPLACE "${lang}_FEATURE:" "" info ${info})
+ string(SUBSTRING ${info} 0 1 has_feature)
+ if(has_feature)
+ string(REGEX REPLACE "^1" "" feature ${info})
+ list(APPEND ${feature_list} ${feature})
+ endif()
+ endforeach()
+ endif()
+ else()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Detecting ${lang} [${compile_flags}] compiler features failed to compile with the following output:\n${_output}\n${_copy_error}\n\n")
+ endif()
+endmacro()
diff --git a/Modules/MacroAddFileDependencies.cmake b/Modules/MacroAddFileDependencies.cmake
index d0605a114..38df1d3a9 100644
--- a/Modules/MacroAddFileDependencies.cmake
+++ b/Modules/MacroAddFileDependencies.cmake
@@ -1,10 +1,16 @@
-# - 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.
+#.rst:
+# MacroAddFileDependencies
+# ------------------------
#
-# 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_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.
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake
new file mode 100644
index 000000000..77b7afe69
--- /dev/null
+++ b/Modules/MatlabTestsRedirect.cmake
@@ -0,0 +1,91 @@
+# This is an undocumented internal helper for the FindMatlab
+# module ``matlab_add_unit_test`` command.
+
+#=============================================================================
+# Copyright 2014-2015 Raffi Enficiaud, Max Planck Society
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+# Usage: cmake
+# -Dtest_timeout=180
+# -Doutput_directory=
+# -Dadditional_paths=""
+# -Dno_unittest_framework=""
+# -DMatlab_PROGRAM=matlab_exe_location
+# -DMatlab_ADDITIONNAL_STARTUP_OPTIONS=""
+# -Dtest_name=name_of_the_test
+# -Dcmd_to_run_before_test=""
+# -Dunittest_file_to_run
+# -P FindMatlab_TestsRedirect.cmake
+
+set(Matlab_UNIT_TESTS_CMD -nosplash -nojvm -nodesktop -nodisplay ${Matlab_ADDITIONNAL_STARTUP_OPTIONS})
+if(WIN32)
+ set(Matlab_UNIT_TESTS_CMD ${Matlab_UNIT_TESTS_CMD} -wait)
+endif()
+
+if(NOT test_timeout)
+ set(test_timeout 180)
+endif()
+
+if(NOT cmd_to_run_before_test)
+ set(cmd_to_run_before_test)
+endif()
+
+get_filename_component(unittest_file_directory "${unittest_file_to_run}" DIRECTORY)
+get_filename_component(unittest_file_to_run_name "${unittest_file_to_run}" NAME_WE)
+
+set(concat_string '${unittest_file_directory}')
+foreach(s IN LISTS additional_paths)
+ if(NOT "${s}" STREQUAL "")
+ set(concat_string "${concat_string}, '${s}'")
+ endif()
+endforeach()
+
+set(unittest_to_run "runtests('${unittest_file_to_run_name}'), exit(max([ans(1,:).Failed]))")
+if(no_unittest_framework)
+ set(unittest_to_run "try, ${unittest_file_to_run_name}, catch err, disp('An exception has been thrown during the execution'), disp(err), disp(err.stack), exit(1), end, exit(0)")
+endif()
+
+set(Matlab_SCRIPT_TO_RUN
+ "addpath(${concat_string}), path, ${cmd_to_run_before_test}, ${unittest_to_run}"
+ )
+
+set(Matlab_LOG_FILE "${output_directory}/${test_name}.log")
+
+set(devnull)
+if(UNIX)
+ set(devnull INPUT_FILE /dev/null)
+elseif(WIN32)
+ set(devnull INPUT_FILE NUL)
+endif()
+
+execute_process(
+ COMMAND "${Matlab_PROGRAM}" ${Matlab_UNIT_TESTS_CMD} -logfile "${test_name}.log" -r "${Matlab_SCRIPT_TO_RUN}"
+ RESULT_VARIABLE res
+ TIMEOUT ${test_timeout}
+ OUTPUT_QUIET # we do not want the output twice
+ WORKING_DIRECTORY "${output_directory}"
+ ${devnull}
+ )
+
+if(NOT EXISTS ${Matlab_LOG_FILE})
+ message( FATAL_ERROR "[MATLAB] ERROR: cannot find the log file ${Matlab_LOG_FILE}")
+endif()
+
+# print the output in any case.
+file(READ ${Matlab_LOG_FILE} matlab_log_content)
+message("Matlab test ${name_of_the_test} output:\n${matlab_log_content}") # if we put FATAL_ERROR here, the file is indented.
+
+
+if(NOT (res EQUAL 0))
+ message( FATAL_ERROR "[MATLAB] TEST FAILED" )
+endif()
diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in
index 76310af31..1ef3d28c7 100644
--- a/Modules/NSIS.template.in
+++ b/Modules/NSIS.template.in
@@ -542,6 +542,8 @@ FunctionEnd
; Define some macro setting for the gui
@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
@CPACK_NSIS_INSTALLER_ICON_CODE@
+@CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE@
+@CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE@
@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake
index e5d9434b5..d6f5331dd 100644
--- a/Modules/Platform/AIX-GNU.cmake
+++ b/Modules/Platform/AIX-GNU.cmake
@@ -18,10 +18,20 @@ if(__AIX_COMPILER_GNU)
endif()
set(__AIX_COMPILER_GNU 1)
+#
+# By default, runtime linking is enabled. All shared objects specified on the command line
+# will be listed, even if there are no symbols referenced, in the output file.
+set (CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-brtl")
+set (CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,-brtl")
+set (CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-brtl")
+
+
macro(__aix_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G,-bnoipath")
- set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall")
set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1)
+
+ set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
endmacro()
diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake
index abf385569..5470441f9 100644
--- a/Modules/Platform/AIX-XL.cmake
+++ b/Modules/Platform/AIX-XL.cmake
@@ -18,11 +18,21 @@ if(__AIX_COMPILER_XL)
endif()
set(__AIX_COMPILER_XL 1)
+#
+# By default, runtime linking is enabled. All shared objects specified on the command line
+# will be listed, even if there are no symbols referenced, in the output file.
+set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-brtl")
+set(CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,-brtl")
+set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-brtl")
+
+
macro(__aix_compiler_xl lang)
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-bnoipath") # -shared
- set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ")
set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ")
+
+ set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
endmacro()
diff --git a/Modules/Platform/ARTOS-GNU-C.cmake b/Modules/Platform/ARTOS-GNU-C.cmake
new file mode 100644
index 000000000..967d0e7c0
--- /dev/null
+++ b/Modules/Platform/ARTOS-GNU-C.cmake
@@ -0,0 +1,9 @@
+# Define ARTOS to select proper behaviour and tell preprocessor to accept C++ style comments.
+set(CMAKE_C_FLAGS_INIT "-DARTOS -Xp -+")
+# ac doesn't support -g properly and doesn't support the normal gcc optimization options. Just use the defaults set by ac.
+set(CMAKE_C_FLAGS_DEBUG_INIT "")
+set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG")
+set(CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-DNDEBUG")
+# Most projects expect the stdio functions to be available.
+set(CMAKE_C_STANDARD_LIBRARIES_INIT "stdio.a")
diff --git a/Modules/Platform/ARTOS.cmake b/Modules/Platform/ARTOS.cmake
new file mode 100644
index 000000000..f9365d6ce
--- /dev/null
+++ b/Modules/Platform/ARTOS.cmake
@@ -0,0 +1,17 @@
+# Support for ARTOS RTOS (locamation.com)
+set(CMAKE_LINK_LIBRARY_SUFFIX "")
+set(CMAKE_STATIC_LIBRARY_PREFIX "")
+set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
+set(CMAKE_SHARED_LIBRARY_PREFIX "")
+set(CMAKE_SHARED_LIBRARY_SUFFIX ".a")
+set(CMAKE_EXECUTABLE_SUFFIX ".x")
+set(CMAKE_DL_LIBS "")
+
+set(CMAKE_FIND_LIBRARY_PREFIXES "")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+
+# ARTOS does not support shared libs
+set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+
+set(CMAKE_C_LINK_SHARED_LIBRARY )
+set(CMAKE_C_LINK_MODULE_LIBRARY )
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
new file mode 100644
index 000000000..1bdad0403
--- /dev/null
+++ b/Modules/Platform/Android.cmake
@@ -0,0 +1,15 @@
+include(Platform/Linux)
+
+# Android has soname, but binary names must end in ".so" so we cannot append
+# a version number. Also we cannot portably represent symlinks on the host.
+set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1)
+
+# Android reportedly ignores RPATH, and we cannot predict the install
+# location anyway.
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
+
+# Nsight Tegra Visual Studio Edition takes care of
+# prefixing library names with '-l'.
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+ set(CMAKE_LINK_LIBRARY_FLAG "")
+endif()
diff --git a/Modules/Platform/BlueGeneQ-base.cmake b/Modules/Platform/BlueGeneQ-base.cmake
new file mode 100644
index 000000000..9372166e8
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-base.cmake
@@ -0,0 +1,177 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+#
+# Blue Gene/Q base platform file.
+#
+# NOTE: Do not set your platform to "BlueGeneQ-base". This file is
+# included by the real platform files. Use one of these two platforms
+# instead:
+#
+# BlueGeneQ-dynamic For dynamically linked executables
+# BlueGeneQ-static For statically linked executables
+#
+# The platform you choose doesn't affect whether or not you can build
+# shared or static libraries -- it ONLY changs whether exeuatbles are linked
+# statically or dynamically.
+#
+# This platform file tries its best to adhere to the behavior of the MPI
+# compiler wrappers included with the latest BG/P drivers.
+#
+
+#
+# This adds directories that find commands should specifically ignore
+# for cross compiles. Most of these directories are the includeand
+# lib directories for the frontend on BG/P systems. Not ignoring
+# these can cause things like FindX11 to find a frontend PPC version
+# mistakenly. We use this on BG instead of re-rooting because backend
+# libraries are typically strewn about the filesystem, and we can't
+# re-root ALL backend libraries to a single place.
+#
+set(CMAKE_SYSTEM_IGNORE_PATH
+ /lib /lib64 /include
+ /usr/lib /usr/lib64 /usr/include
+ /usr/local/lib /usr/local/lib64 /usr/local/include
+ /usr/X11/lib /usr/X11/lib64 /usr/X11/include
+ /usr/lib/X11 /usr/lib64/X11 /usr/include/X11
+ /usr/X11R6/lib /usr/X11R6/lib64 /usr/X11R6/include
+ /usr/X11R7/lib /usr/X11R7/lib64 /usr/X11R7/include
+)
+
+#
+# Indicate that this is a unix-like system
+#
+set(UNIX 1)
+
+#
+# Library prefixes, suffixes, extra libs.
+#
+set(CMAKE_LINK_LIBRARY_SUFFIX "")
+set(CMAKE_STATIC_LIBRARY_PREFIX "lib") # lib
+set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") # .a
+
+set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
+set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so
+set(CMAKE_EXECUTABLE_SUFFIX "") # .exe
+
+set(CMAKE_DL_LIBS "dl")
+
+#
+# BG/Q supports dynamic libraries regardless of whether we're building
+# static or dynamic *executables*.
+#
+set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
+set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+
+#
+# For BGQ builds, we're cross compiling, but we don't want to re-root things
+# (e.g. with CMAKE_FIND_ROOT_PATH) because users may have libraries anywhere on
+# the shared filesystems, and this may lie outside the root. Instead, we set the
+# system directories so that the various system BG CNK library locations are
+# searched first. This is not the clearest thing in the world, given IBM's driver
+# layout, but this should cover all the standard ones.
+#
+macro(__BlueGeneQ_common_setup compiler_id lang)
+ # Need to use the version of the comm lib compiled with the right compiler.
+ set(__BlueGeneQ_commlib_dir gcc)
+ if (${compiler_id} STREQUAL XL)
+ set(__BlueGeneQ_commlib_dir xl)
+ endif()
+
+ set(CMAKE_SYSTEM_LIBRARY_PATH
+ /bgsys/drivers/ppcfloor/comm/default/lib # default comm layer (used by mpi compiler wrappers)
+ /bgsys/drivers/ppcfloor/comm/${__BlueGeneQ_commlib_dir}/lib # PAMI, other lower-level comm libraries
+ /bgsys/drivers/ppcfloor/gnu-linux/lib # CNK python installation directory
+ /bgsys/drivers/ppcfloor/gnu-linux/powerpc64-bgq-linux/lib # CNK Linux image -- standard runtime libs, pthread, etc.
+ )
+
+ # Add all the system include paths.
+ set(CMAKE_SYSTEM_INCLUDE_PATH
+ /bgsys/drivers/ppcfloor/comm/sys/include
+ /bgsys/drivers/ppcfloor/
+ /bgsys/drivers/ppcfloor/spi/include
+ /bgsys/drivers/ppcfloor/spi/include/kernel/cnk
+ /bgsys/drivers/ppcfloor/comm/${__BlueGeneQ_commlib_dir}/include
+ )
+
+ # Ensure that the system directories are included with the regular compilers, as users will expect this
+ # to do the same thing as the MPI compilers, which add these flags.
+ set(BGQ_SYSTEM_INCLUDES "")
+ foreach(dir ${CMAKE_SYSTEM_INCLUDE_PATH})
+ set(BGQ_SYSTEM_INCLUDES "${BGQ_SYSTEM_INCLUDES} -I${dir}")
+ endforeach()
+ set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${BGQ_SYSTEM_INCLUDES} <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+ set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${BGQ_SYSTEM_INCLUDES} <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+
+ #
+ # Code below does setup for shared libraries. That this is done
+ # regardless of whether the platform is static or dynamic -- you can make
+ # shared libraries even if you intend to make static executables, you just
+ # can't make a dynamic executable if you use the static platform file.
+ #
+ if (${compiler_id} STREQUAL XL)
+ # Flags for XL compilers if we explicitly detected XL
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-qpic")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-qmkshrobj -qnostaticlink")
+ else()
+ # Assume flags for GNU compilers (if the ID is GNU *or* anything else).
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+ endif()
+
+ # Both toolchains use the GNU linker on BG/P, so these options are shared.
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,")
+ set(CMAKE_SHARED_LIBRARY_RPATH_LINK_${lang}_FLAG "-Wl,-rpath-link,")
+ set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-soname,")
+ set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-dynamic")
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "") # +s, flag for exe link to use shared lib
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") # : or empty
+
+endmacro()
+
+#
+# This macro needs to be called for dynamic library support. Unfortunately on BG,
+# We can't support both static and dynamic links in the same platform file. The
+# dynamic link platform file needs to call this explicitly to set up dynamic linking.
+#
+macro(__BlueGeneQ_setup_dynamic compiler_id lang)
+ __BlueGeneQ_common_setup(${compiler_id} ${lang})
+
+ if (${compiler_id} STREQUAL XL)
+ set(BGQ_${lang}_DYNAMIC_EXE_FLAGS "-qnostaticlink -qnostaticlink=libgcc")
+ else()
+ set(BGQ_${lang}_DYNAMIC_EXE_FLAGS "-dynamic")
+ endif()
+
+ # For dynamic executables, need to provide special BG/Q arguments.
+ set(BGQ_${lang}_DEFAULT_EXE_FLAGS
+ "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+ set(CMAKE_${lang}_LINK_EXECUTABLE
+ "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGQ_${lang}_DYNAMIC_EXE_FLAGS} ${BGQ_${lang}_DEFAULT_EXE_FLAGS}")
+endmacro()
+
+#
+# This macro needs to be called for static builds. Right now it just adds -Wl,-relax
+# to the link line.
+#
+macro(__BlueGeneQ_setup_static compiler_id lang)
+ __BlueGeneQ_common_setup(${compiler_id} ${lang})
+
+ # For static executables, use default link settings.
+ set(BGQ_${lang}_DEFAULT_EXE_FLAGS
+ "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+ set(CMAKE_${lang}_LINK_EXECUTABLE
+ "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGQ_${lang}_DEFAULT_EXE_FLAGS}")
+endmacro()
diff --git a/Modules/CMakeVS71FindMake.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake
index 945c3faf8..102ac80ee 100644
--- a/Modules/CMakeVS71FindMake.cmake
+++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake
@@ -1,6 +1,7 @@
#=============================================================================
-# Copyright 2003-2009 Kitware, Inc.
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -12,15 +13,4 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-find_program(CMAKE_MAKE_PROGRAM
- NAMES devenv
- PATHS
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VS;EnvironmentDirectory]
- "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE"
- "c:/Program Files/Microsoft Visual Studio .NET/Common7/IDE"
- "c:/Program Files/Microsoft Visual Studio.NET/Common7/IDE"
- "/Program Files/Microsoft Visual Studio .NET/Common7/IDE/"
- )
-mark_as_advanced(CMAKE_MAKE_PROGRAM)
-set(MSVC71 1)
-set(MSVC_VERSION 1310)
+__BlueGeneQ_setup_dynamic(GNU C)
diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake
new file mode 100644
index 000000000..cd8ab246f
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+__BlueGeneQ_setup_dynamic(GNU CXX)
diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake
new file mode 100644
index 000000000..c029f0fb2
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+__BlueGeneQ_setup_dynamic(GNU Fortran)
diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake
new file mode 100644
index 000000000..0077313d4
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+__BlueGeneQ_setup_dynamic(XL C)
diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake
new file mode 100644
index 000000000..0f43cb256
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+__BlueGeneQ_setup_dynamic(XL CXX)
diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake
new file mode 100644
index 000000000..12e446e11
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+__BlueGeneQ_setup_dynamic(XL Fortran)
diff --git a/Modules/Platform/BlueGeneQ-dynamic.cmake b/Modules/Platform/BlueGeneQ-dynamic.cmake
new file mode 100644
index 000000000..02839003f
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-dynamic.cmake
@@ -0,0 +1,17 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+include(Platform/BlueGeneQ-base)
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
diff --git a/Modules/Platform/BlueGeneQ-static-GNU-C.cmake b/Modules/Platform/BlueGeneQ-static-GNU-C.cmake
new file mode 100644
index 000000000..70c84bace
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-static-GNU-C.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+__BlueGeneQ_setup_static(GNU C)
diff --git a/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake b/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake
new file mode 100644
index 000000000..8f991de11
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+__BlueGeneQ_setup_static(GNU CXX)
diff --git a/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake b/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake
new file mode 100644
index 000000000..24dd9e755
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+__BlueGeneQ_setup_static(GNU Fortran)
diff --git a/Modules/Platform/BlueGeneQ-static-XL-C.cmake b/Modules/Platform/BlueGeneQ-static-XL-C.cmake
new file mode 100644
index 000000000..5555a6875
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-static-XL-C.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+__BlueGeneQ_setup_static(XL C)
diff --git a/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake
new file mode 100644
index 000000000..07c3c3d11
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+__BlueGeneQ_setup_static(XL CXX)
diff --git a/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake b/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake
new file mode 100644
index 000000000..6f99933cb
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+__BlueGeneQ_setup_static(XL Fortran)
diff --git a/Modules/Platform/BlueGeneQ-static.cmake b/Modules/Platform/BlueGeneQ-static.cmake
new file mode 100644
index 000000000..30b530d89
--- /dev/null
+++ b/Modules/Platform/BlueGeneQ-static.cmake
@@ -0,0 +1,17 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+include(Platform/BlueGeneQ-base)
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake
index fe25ab214..1a46c1031 100644
--- a/Modules/Platform/CYGWIN-GNU.cmake
+++ b/Modules/Platform/CYGWIN-GNU.cmake
@@ -25,7 +25,6 @@ set(CMAKE_CREATE_WIN32_EXE "-mwindows")
set(CMAKE_GNULD_IMAGE_VERSION
"-Wl,--major-image-version,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>")
set(CMAKE_GENERATOR_RC windres)
-enable_language(RC)
macro(__cygwin_compiler_gnu lang)
# Binary link rules.
set(CMAKE_${lang}_CREATE_SHARED_MODULE
@@ -53,4 +52,10 @@ macro(__cygwin_compiler_gnu lang)
# TODO: Is -Wl,--enable-auto-import now always default?
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import")
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}")
+
+ if(NOT CMAKE_RC_COMPILER_INIT)
+ set(CMAKE_RC_COMPILER_INIT windres)
+ endif()
+
+ enable_language(RC)
endmacro()
diff --git a/Modules/Platform/CYGWIN-windres.cmake b/Modules/Platform/CYGWIN-windres.cmake
index 01d6be3df..7d787dddf 100644
--- a/Modules/Platform/CYGWIN-windres.cmake
+++ b/Modules/Platform/CYGWIN-windres.cmake
@@ -1 +1 @@
-set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <FLAGS> <DEFINES> <SOURCE> <OBJECT>")
+set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <DEFINES> <INCLUDES> <FLAGS> <SOURCE> <OBJECT>")
diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake
new file mode 100644
index 000000000..97771a268
--- /dev/null
+++ b/Modules/Platform/CrayLinuxEnvironment.cmake
@@ -0,0 +1,143 @@
+# Compute Node Linux doesn't quite work the same as native Linux so all of this
+# needs to be custom. We use the variables defined through Cray's environment
+# modules to set up the right paths for things.
+
+set(UNIX 1)
+
+if(DEFINED ENV{CRAYOS_VERSION})
+ set(CMAKE_SYSTEM_VERSION "$ENV{CRAYOS_VERSION}")
+elseif(DEFINED ENV{XTOS_VERSION})
+ set(CMAKE_SYSTEM_VERSION "$ENV{XTOS_VERSION}")
+else()
+ message(FATAL_ERROR "Neither the CRAYOS_VERSION or XTOS_VERSION environment variables are defined. This platform file should be used inside the Cray Linux Environment for targeting compute nodes (NIDs)")
+endif()
+
+# Guard against multiple messages
+if(NOT __CrayLinuxEnvironment_message)
+ set(__CrayLinuxEnvironment_message 1)
+ message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}")
+endif()
+
+# All cray systems are x86 CPUs and have been for quite some time
+# Note: this may need to change in the future with 64-bit ARM
+set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+
+set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
+set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
+set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
+
+set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+
+# Don't override shared lib support if it's already been set and possibly
+# overridden elsewhere by the CrayPrgEnv module
+if(NOT CMAKE_FIND_LIBRARY_SUFFIXES)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
+ set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
+endif()
+
+set(CMAKE_DL_LIBS dl)
+
+# Note: Much of this is pulled from UnixPaths.cmake but adjusted to the Cray
+# environment accordingly
+
+# Get the install directory of the running cmake to the search directories
+# CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up
+get_filename_component(__cmake_install_dir "${CMAKE_ROOT}" PATH)
+get_filename_component(__cmake_install_dir "${__cmake_install_dir}" PATH)
+
+# Note: Some Cray's have the SYSROOT_DIR variable defined, pointing to a copy
+# of the NIDs userland. If so, then we'll use it. Otherwise, just assume
+# the userland from the login node is ok
+
+# List common installation prefixes. These will be used for all
+# search types.
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ # Standard
+ $ENV{SYSROOT_DIR}/usr/local $ENV{SYSROOT_DIR}/usr $ENV{SYSROOT_DIR}/
+
+ # CMake install location
+ "${__cmake_install_dir}"
+ )
+if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ # Project install destination.
+ "${CMAKE_INSTALL_PREFIX}"
+ )
+ if(CMAKE_STAGING_PREFIX)
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ # User-supplied staging prefix.
+ "${CMAKE_STAGING_PREFIX}"
+ )
+ endif()
+endif()
+
+list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
+ $ENV{SYSROOT_DIR}/usr/include
+ $ENV{SYSROOT_DIR}/usr/include/X11
+)
+list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+ $ENV{SYSROOT_DIR}/usr/local/lib64
+ $ENV{SYSROOT_DIR}/usr/lib64
+ $ENV{SYSROOT_DIR}/lib64
+)
+list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+ $ENV{SYSROOT_DIR}/usr/local/lib64
+ $ENV{SYSROOT_DIR}/usr/lib64
+ $ENV{SYSROOT_DIR}/lib64
+)
+
+# Compute the intersection of several lists
+function(__cray_list_intersect OUTPUT INPUT0)
+ if(ARGC EQUAL 2)
+ list(APPEND ${OUTPUT} ${${INPUT0}})
+ else()
+ foreach(I IN LISTS ${INPUT0})
+ set(__is_common 1)
+ foreach(L IN LISTS ARGN)
+ list(FIND ${L} "${I}" __idx)
+ if(__idx EQUAL -1)
+ set(__is_common 0)
+ break()
+ endif()
+ endforeach()
+ if(__is_common)
+ list(APPEND ${OUTPUT} "${I}")
+ endif()
+ endforeach()
+ endif()
+ set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE)
+endfunction()
+
+macro(__list_clean_dupes var)
+ if(${var})
+ list(REMOVE_DUPLICATES ${var})
+ endif()
+endmacro()
+
+get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES)
+set(__cray_inc_path_vars)
+set(__cray_lib_path_vars)
+foreach(__lang IN LISTS __langs)
+ list(APPEND __cray_inc_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES)
+ list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES)
+endforeach()
+if(__cray_inc_path_vars)
+ __cray_list_intersect(__cray_implicit_include_dirs ${__cray_inc_path_vars})
+ if(__cray_implicit_include_dirs)
+ list(INSERT CMAKE_SYSTEM_INCLUDE_PATH 0 ${__cray_implicit_include_dirs})
+ endif()
+endif()
+if(__cray_lib_path_vars)
+ __cray_list_intersect(__cray_implicit_library_dirs ${__cray_lib_path_vars})
+ if(__cray_implicit_library_dirs)
+ list(INSERT CMAKE_SYSTEM_LIBRARY_PATH 0 ${__cray_implicit_library_dirs})
+ endif()
+endif()
+__list_clean_dupes(CMAKE_SYSTEM_PREFIX_PATH)
+__list_clean_dupes(CMAKE_SYSTEM_INCLUDE_PATH)
+__list_clean_dupes(CMAKE_SYSTEM_LIBRARY_PATH)
+__list_clean_dupes(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES)
+
+# Enable use of lib64 search path variants by default.
+set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
diff --git a/Modules/Platform/Darwin-AppleClang-C.cmake b/Modules/Platform/Darwin-AppleClang-C.cmake
new file mode 100644
index 000000000..3216b2909
--- /dev/null
+++ b/Modules/Platform/Darwin-AppleClang-C.cmake
@@ -0,0 +1,6 @@
+include(Platform/Darwin-Clang-C)
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.2)
+ set(CMAKE_C_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
+else()
+ unset(CMAKE_C_SYSTEM_FRAMEWORK_SEARCH_FLAG)
+endif()
diff --git a/Modules/Platform/Darwin-AppleClang-CXX.cmake b/Modules/Platform/Darwin-AppleClang-CXX.cmake
new file mode 100644
index 000000000..3fedf8c07
--- /dev/null
+++ b/Modules/Platform/Darwin-AppleClang-CXX.cmake
@@ -0,0 +1,6 @@
+include(Platform/Darwin-Clang-CXX)
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.2)
+ set(CMAKE_CXX_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
+else()
+ unset(CMAKE_CXX_SYSTEM_FRAMEWORK_SEARCH_FLAG)
+endif()
diff --git a/Modules/Platform/Darwin-Clang.cmake b/Modules/Platform/Darwin-Clang.cmake
index 528873cfd..4cded47a1 100644
--- a/Modules/Platform/Darwin-Clang.cmake
+++ b/Modules/Platform/Darwin-Clang.cmake
@@ -24,4 +24,7 @@ macro(__darwin_compiler_clang lang)
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=")
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.1)
+ set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
+ endif()
endmacro()
diff --git a/Modules/Platform/Darwin-GNU-Fortran.cmake b/Modules/Platform/Darwin-GNU-Fortran.cmake
index f4b509a13..6724f9bc1 100644
--- a/Modules/Platform/Darwin-GNU-Fortran.cmake
+++ b/Modules/Platform/Darwin-GNU-Fortran.cmake
@@ -14,6 +14,8 @@
include(Platform/Darwin-GNU)
__darwin_compiler_gnu(Fortran)
+cmake_gnu_set_sysroot_flag(Fortran)
+cmake_gnu_set_osx_deployment_target_flag(Fortran)
set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-current_version ")
diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake
index 5fee7e3ae..87d1d2394 100644
--- a/Modules/Platform/Darwin-GNU.cmake
+++ b/Modules/Platform/Darwin-GNU.cmake
@@ -23,6 +23,10 @@ macro(__darwin_compiler_gnu lang)
# GNU does not have -shared on OS X
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
+
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.3)
+ set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
+ endif()
endmacro()
macro(cmake_gnu_set_sysroot_flag lang)
diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake
new file mode 100644
index 000000000..a08411bcc
--- /dev/null
+++ b/Modules/Platform/Darwin-Initialize.cmake
@@ -0,0 +1,155 @@
+# Ask xcode-select where to find /Developer or fall back to ancient location.
+execute_process(COMMAND xcode-select -print-path
+ OUTPUT_VARIABLE _stdout
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _stderr
+ RESULT_VARIABLE _failed)
+if(NOT _failed AND IS_DIRECTORY ${_stdout})
+ set(OSX_DEVELOPER_ROOT ${_stdout})
+elseif(IS_DIRECTORY "/Developer")
+ set(OSX_DEVELOPER_ROOT "/Developer")
+else()
+ set(OSX_DEVELOPER_ROOT "")
+endif()
+
+execute_process(COMMAND sw_vers -productVersion
+ OUTPUT_VARIABLE CURRENT_OSX_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+# Save CMAKE_OSX_ARCHITECTURES from the environment.
+set(CMAKE_OSX_ARCHITECTURES "$ENV{CMAKE_OSX_ARCHITECTURES}" CACHE STRING
+ "Build architectures for OSX")
+
+#----------------------------------------------------------------------------
+# _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ...
+#
+string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1"
+ _CURRENT_OSX_VERSION "${CURRENT_OSX_VERSION}")
+
+#----------------------------------------------------------------------------
+# CMAKE_OSX_DEPLOYMENT_TARGET
+
+# Set cache variable - end user may change this during ccmake or cmake-gui configure.
+if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3)
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING
+ "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.")
+endif()
+
+#----------------------------------------------------------------------------
+# CMAKE_OSX_SYSROOT
+
+if(CMAKE_OSX_SYSROOT)
+ # Use the existing value without further computation to choose a default.
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "${CMAKE_OSX_SYSROOT}")
+elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND
+ (NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}"))
+ # Use the value of SDKROOT from the environment.
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}")
+elseif("${CMAKE_GENERATOR}" MATCHES Xcode
+ OR CMAKE_OSX_DEPLOYMENT_TARGET
+ OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]"
+ OR NOT EXISTS "/usr/include/sys/types.h")
+ # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory.
+ set(_CMAKE_OSX_SDKS_DIR "")
+ if(OSX_DEVELOPER_ROOT)
+ foreach(d Platforms/MacOSX.platform/Developer/SDKs SDKs)
+ file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${d}/*)
+ if(_CMAKE_OSX_SDKS)
+ set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${d})
+ break()
+ endif()
+ endforeach()
+ endif()
+
+ if(_CMAKE_OSX_SDKS_DIR)
+ # Select SDK for current OSX version accounting for the known
+ # specially named SDKs.
+ set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u")
+ set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.3 ".9")
+
+ # find the latest SDK
+ set(_CMAKE_OSX_LATEST_SDK_VERSION "0.0")
+ file(GLOB _CMAKE_OSX_SDKS RELATIVE "${_CMAKE_OSX_SDKS_DIR}" "${_CMAKE_OSX_SDKS_DIR}/MacOSX*.sdk")
+ foreach(_SDK ${_CMAKE_OSX_SDKS})
+ if(_SDK MATCHES "MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk" AND CMAKE_MATCH_1 VERSION_GREATER ${_CMAKE_OSX_LATEST_SDK_VERSION})
+ set(_CMAKE_OSX_LATEST_SDK_VERSION "${CMAKE_MATCH_1}")
+ endif()
+ endforeach()
+
+ # pick an SDK that works
+ set(_CMAKE_OSX_SYSROOT_DEFAULT)
+ foreach(ver ${CMAKE_OSX_DEPLOYMENT_TARGET}
+ ${_CURRENT_OSX_VERSION}
+ ${_CMAKE_OSX_LATEST_SDK_VERSION})
+ set(_CMAKE_OSX_DEPLOYMENT_TARGET ${ver})
+ set(_CMAKE_OSX_SDKS_VER ${_CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CMAKE_OSX_DEPLOYMENT_TARGET}})
+ set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
+ if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_CHECK}")
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SYSROOT_CHECK}")
+ break()
+ endif()
+ endforeach()
+
+ if(CMAKE_OSX_DEPLOYMENT_TARGET AND
+ NOT CMAKE_OSX_DEPLOYMENT_TARGET VERSION_EQUAL ${_CMAKE_OSX_DEPLOYMENT_TARGET})
+ set(_CMAKE_OSX_SDKS_VER ${CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${CMAKE_OSX_DEPLOYMENT_TARGET}})
+ set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
+ message(WARNING
+ "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
+ "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n"
+ "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"."
+ )
+ endif()
+ if(NOT CMAKE_OSX_DEPLOYMENT_TARGET AND _CURRENT_OSX_VERSION VERSION_LESS _CMAKE_OSX_DEPLOYMENT_TARGET)
+ set(CMAKE_OSX_DEPLOYMENT_TARGET ${_CURRENT_OSX_VERSION} CACHE STRING
+ "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value." FORCE)
+ endif()
+ else()
+ # Assume developer files are in root (such as Xcode 4.5 command-line tools).
+ set(_CMAKE_OSX_SYSROOT_DEFAULT "")
+ endif()
+endif()
+
+# Set cache variable - end user may change this during ccmake or cmake-gui configure.
+# Choose the type based on the current value.
+set(_CMAKE_OSX_SYSROOT_TYPE STRING)
+foreach(v CMAKE_OSX_SYSROOT _CMAKE_OSX_SYSROOT_DEFAULT)
+ if("x${${v}}" MATCHES "/")
+ set(_CMAKE_OSX_SYSROOT_TYPE PATH)
+ break()
+ endif()
+endforeach()
+set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_DEFAULT}" CACHE ${_CMAKE_OSX_SYSROOT_TYPE}
+ "The product will be built against the headers and libraries located inside the indicated SDK.")
+
+# Transform the cached value to something we can use.
+set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}")
+set(_CMAKE_OSX_SYSROOT_PATH "")
+if(CMAKE_OSX_SYSROOT)
+ if("x${CMAKE_OSX_SYSROOT}" MATCHES "/")
+ # This is a path to the SDK. Make sure it exists.
+ if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}")
+ message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n"
+ "because the directory does not exist.")
+ set(CMAKE_OSX_SYSROOT "")
+ set(_CMAKE_OSX_SYSROOT_ORIG "")
+ endif()
+ set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}")
+ else()
+ # Transform the sdk name into a path.
+ execute_process(
+ COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path
+ OUTPUT_VARIABLE _stdout
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _stderr
+ RESULT_VARIABLE _failed
+ )
+ if(NOT _failed AND IS_DIRECTORY "${_stdout}")
+ set(_CMAKE_OSX_SYSROOT_PATH "${_stdout}")
+ # For non-Xcode generators use the path.
+ if(NOT "${CMAKE_GENERATOR}" MATCHES "Xcode")
+ set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}")
+ endif()
+ endif()
+ endif()
+endif()
diff --git a/Modules/Platform/Darwin-Intel-C.cmake b/Modules/Platform/Darwin-Intel-C.cmake
new file mode 100644
index 000000000..81c630f4a
--- /dev/null
+++ b/Modules/Platform/Darwin-Intel-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Darwin-Intel)
+__darwin_compiler_intel(C)
diff --git a/Modules/Platform/Darwin-Intel-CXX.cmake b/Modules/Platform/Darwin-Intel-CXX.cmake
new file mode 100644
index 000000000..90ae53be3
--- /dev/null
+++ b/Modules/Platform/Darwin-Intel-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Darwin-Intel)
+__darwin_compiler_intel(CXX)
diff --git a/Modules/Platform/Darwin-Intel-Fortran.cmake b/Modules/Platform/Darwin-Intel-Fortran.cmake
index 6bd45f15c..a604bb69f 100644
--- a/Modules/Platform/Darwin-Intel-Fortran.cmake
+++ b/Modules/Platform/Darwin-Intel-Fortran.cmake
@@ -11,5 +11,8 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+include(Platform/Darwin-Intel)
+__darwin_compiler_intel(Fortran)
+
set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-current_version ")
diff --git a/Modules/Platform/Darwin-Intel.cmake b/Modules/Platform/Darwin-Intel.cmake
new file mode 100644
index 000000000..42f115412
--- /dev/null
+++ b/Modules/Platform/Darwin-Intel.cmake
@@ -0,0 +1,29 @@
+
+#=============================================================================
+# Copyright 2002-2014 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__DARWIN_COMPILER_INTEL)
+ return()
+endif()
+set(__DARWIN_COMPILER_INTEL 1)
+
+macro(__darwin_compiler_intel lang)
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+ set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
+
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+ endif()
+endmacro()
diff --git a/Modules/Platform/Darwin-NAG-Fortran.cmake b/Modules/Platform/Darwin-NAG-Fortran.cmake
index 4c28e625c..e3ac9b51f 100644
--- a/Modules/Platform/Darwin-NAG-Fortran.cmake
+++ b/Modules/Platform/Darwin-NAG-Fortran.cmake
@@ -16,7 +16,7 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood.
# Need -fpp explicitly on case-insensitive filesystem.
set(CMAKE_Fortran_COMPILE_OBJECT
- "<CMAKE_Fortran_COMPILER> -fpp -o <OBJECT> <DEFINES> <FLAGS> -c <SOURCE>")
+ "<CMAKE_Fortran_COMPILER> -fpp -o <OBJECT> <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE>")
set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-Wl,-compatibility_version -Wl,")
set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-Wl,-current_version -Wl,")
diff --git a/Modules/Platform/Darwin-icc.cmake b/Modules/Platform/Darwin-icc.cmake
deleted file mode 100644
index 6a46f8e02..000000000
--- a/Modules/Platform/Darwin-icc.cmake
+++ /dev/null
@@ -1,131 +0,0 @@
-set(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "" )
-set(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "")
-
-# Setup for Leopard Compatibility
-exec_program(sw_vers ARGS -productVersion OUTPUT_VARIABLE _OSX_VERSION)
-# message (STATUS "_OSX_VERSION: ${_OSX_VERSION}")
-if ( _OSX_VERSION MATCHES "^10.4" )
- #if(CMAKE_COMPILER_IS_GNUCC)
- set (CMAKE_C_FLAGS_INIT "")
- set (CMAKE_C_FLAGS_DEBUG_INIT "-gdwarf-2")
- set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
- set (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
- set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2")
- 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> -o <ASSEMBLY_SOURCE>")
- # endif()
-
-# if(CMAKE_COMPILER_IS_GNUCXX)
- set (CMAKE_CXX_FLAGS_INIT "")
- set (CMAKE_CXX_FLAGS_DEBUG_INIT "-gdwarf-2")
- set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
- set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
- set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2")
- 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> -o <ASSEMBLY_SOURCE>")
-# endif()
-endif ()
-
-
-set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
-set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
-set(CMAKE_SHARED_MODULE_PREFIX "lib")
-set(CMAKE_SHARED_MODULE_SUFFIX ".so")
-set(CMAKE_MODULE_EXISTS 1)
-set(CMAKE_DL_LIBS "")
-set(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names")
-set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names")
-set(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
-set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
-set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names")
-set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
-
-
-# setup for universal binaries if sysroot exists
-if(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
- # set the sysroot to be used if CMAKE_OSX_ARCHITECTURES
- # has more than one value
- set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk CACHE STRING
- "isysroot used for universal binary support")
- # set _CMAKE_OSX_MACHINE to umame -m
- exec_program(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE)
-
- # check for environment variable CMAKE_OSX_ARCHITECTURES
- # if it is set.
- if(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
- set(_CMAKE_OSX_MACHINE "$ENV{CMAKE_OSX_ARCHITECTURES}")
- endif()
- # now put _CMAKE_OSX_MACHINE into the cache
- set(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE}
- CACHE STRING "Build architectures for OSX")
-endif()
-
-
-if("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$")
- set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
- "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress")
-endif()
-
-if(NOT XCODE)
- # Enable shared library versioning. This flag is not actually referenced
- # but the fact that the setting exists will cause the generators to support
- # soname computation.
- set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name")
- set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name")
- set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-install_name")
-endif()
-
-# Xcode does not support -isystem yet.
-if(XCODE)
- set(CMAKE_INCLUDE_SYSTEM_FLAG_C)
- set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
-endif()
-
-set(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>")
-
-set(CMAKE_C_CREATE_SHARED_LIBRARY
- "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
-set(CMAKE_CXX_CREATE_SHARED_LIBRARY
- "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
-set(CMAKE_Fortran_CREATE_SHARED_LIBRARY
- "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
-
-set(CMAKE_CXX_CREATE_SHARED_MODULE
- "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
-
-set(CMAKE_C_CREATE_SHARED_MODULE
- "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
-
-set(CMAKE_Fortran_CREATE_SHARED_MODULE
- "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
-
-
-# We can use $ENV{INTEL_LICENSE_FILE} to try and get at the installation location for ICC.
-# We also need to consider to use cce (which is the 64bit compiler) and not JUST the 32bit compiler.
-# I have no idea what the best way to do that would be.
-
-
-# default to searching for frameworks first
-if(NOT DEFINED CMAKE_FIND_FRAMEWORK)
- set(CMAKE_FIND_FRAMEWORK FIRST)
-endif()
-# set up the default search directories for frameworks
-set(CMAKE_SYSTEM_FRAMEWORK_PATH
- ~/Library/Frameworks
- /Library/Frameworks
- /Network/Library/Frameworks
- /System/Library/Frameworks)
-
-# default to searching for application bundles first
-if(NOT DEFINED CMAKE_FIND_APPBUNDLE)
- set(CMAKE_FIND_APPBUNDLE FIRST)
-endif()
-# set up the default search directories for application bundles
-set(CMAKE_SYSTEM_APPBUNDLE_PATH
- ~/Applications
- /Applications
- /Developer/Applications)
-
-include(Platform/UnixPaths)
-set(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} /sw/include)
-set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} /sw/lib)
diff --git a/Modules/Platform/Darwin-icpc.cmake b/Modules/Platform/Darwin-icpc.cmake
deleted file mode 100644
index 549feb7f5..000000000
--- a/Modules/Platform/Darwin-icpc.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-get_filename_component(CURRENT_SOURCE_PARENT ${CMAKE_CURRENT_LIST_FILE} PATH)
-#message (STATUS "CURRENT_SOURCE_PARENT: ${CURRENT_SOURCE_PARENT}")
-include ( ${CURRENT_SOURCE_PARENT}/Darwin-icc.cmake)
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 72844b531..bb085ac7c 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -53,7 +53,7 @@ set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_
set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
-set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a")
# hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree
# (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache
@@ -64,149 +64,14 @@ if(NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
mark_as_advanced(CMAKE_INSTALL_NAME_TOOL)
endif()
-# Ask xcode-select where to find /Developer or fall back to ancient location.
-execute_process(COMMAND xcode-select -print-path
- OUTPUT_VARIABLE _stdout
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE _stderr
- RESULT_VARIABLE _failed)
-if(NOT _failed AND IS_DIRECTORY ${_stdout})
- set(OSX_DEVELOPER_ROOT ${_stdout})
-elseif(IS_DIRECTORY "/Developer")
- set(OSX_DEVELOPER_ROOT "/Developer")
-else()
- set(OSX_DEVELOPER_ROOT "")
-endif()
-
-execute_process(COMMAND sw_vers -productVersion
- OUTPUT_VARIABLE CURRENT_OSX_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-# Save CMAKE_OSX_ARCHITECTURES from the environment.
-set(CMAKE_OSX_ARCHITECTURES "$ENV{CMAKE_OSX_ARCHITECTURES}" CACHE STRING
- "Build architectures for OSX")
-
-#----------------------------------------------------------------------------
-# _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ...
-#
-string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1"
- _CURRENT_OSX_VERSION "${CURRENT_OSX_VERSION}")
-
-#----------------------------------------------------------------------------
-# CMAKE_OSX_DEPLOYMENT_TARGET
-
-# Set cache variable - end user may change this during ccmake or cmake-gui configure.
-if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3)
- set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING
- "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.")
-endif()
-
-#----------------------------------------------------------------------------
-# CMAKE_OSX_SYSROOT
-
-if(CMAKE_OSX_SYSROOT)
- # Use the existing value without further computation to choose a default.
- set(_CMAKE_OSX_SYSROOT_DEFAULT "${CMAKE_OSX_SYSROOT}")
-elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND
- (NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}"))
- # Use the value of SDKROOT from the environment.
- set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}")
-elseif("${CMAKE_GENERATOR}" MATCHES Xcode
- OR CMAKE_OSX_DEPLOYMENT_TARGET
- OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]"
- OR NOT EXISTS "/usr/include/sys/types.h")
- # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory.
- set(_CMAKE_OSX_SDKS_DIR "")
- if(OSX_DEVELOPER_ROOT)
- foreach(d Platforms/MacOSX.platform/Developer/SDKs SDKs)
- file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${d}/*)
- if(_CMAKE_OSX_SDKS)
- set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${d})
- break()
- endif()
- endforeach()
- endif()
-
- if(_CMAKE_OSX_SDKS_DIR)
- # Select SDK for current OSX version accounting for the known
- # specially named SDKs.
- set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u")
- set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.3 ".9")
- if(CMAKE_OSX_DEPLOYMENT_TARGET)
- set(_CMAKE_OSX_SDKS_VER ${CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${CMAKE_OSX_DEPLOYMENT_TARGET}})
- set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
- if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_CHECK}")
- set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SYSROOT_CHECK}")
- else()
- set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}})
- set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
- message(WARNING
- "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
- "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n"
- "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"\n"
- "matching the host OS X version."
- )
- endif()
- else()
- set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}})
- set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
- endif()
- else()
- # Assume developer files are in root (such as Xcode 4.5 command-line tools).
- set(_CMAKE_OSX_SYSROOT_DEFAULT "")
- endif()
-endif()
-
-# Set cache variable - end user may change this during ccmake or cmake-gui configure.
-# Choose the type based on the current value.
-set(_CMAKE_OSX_SYSROOT_TYPE STRING)
-foreach(v CMAKE_OSX_SYSROOT _CMAKE_OSX_SYSROOT_DEFAULT)
- if("x${${v}}" MATCHES "/")
- set(_CMAKE_OSX_SYSROOT_TYPE PATH)
- break()
- endif()
-endforeach()
-set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_DEFAULT}" CACHE ${_CMAKE_OSX_SYSROOT_TYPE}
- "The product will be built against the headers and libraries located inside the indicated SDK.")
-
-# Transform the cached value to something we can use.
-set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}")
-set(_CMAKE_OSX_SYSROOT_PATH "")
-if(CMAKE_OSX_SYSROOT)
- if("x${CMAKE_OSX_SYSROOT}" MATCHES "/")
- # This is a path to the SDK. Make sure it exists.
- if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}")
- message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n"
- "because the directory does not exist.")
- set(CMAKE_OSX_SYSROOT "")
- set(_CMAKE_OSX_SYSROOT_ORIG "")
- endif()
- set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}")
- else()
- # Transform the sdk name into a path.
- execute_process(
- COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path
- OUTPUT_VARIABLE _stdout
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE _stderr
- RESULT_VARIABLE _failed
- )
- if(NOT _failed AND IS_DIRECTORY "${_stdout}")
- set(_CMAKE_OSX_SYSROOT_PATH "${_stdout}")
- # For non-Xcode generators use the path.
- if(NOT "${CMAKE_GENERATOR}" MATCHES "Xcode")
- set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}")
- endif()
- endif()
- endif()
-endif()
-
# Make sure the combination of SDK and Deployment Target are allowed
if(CMAKE_OSX_DEPLOYMENT_TARGET)
- if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "^.*/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk")
+ if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk")
set(_sdk_ver "${CMAKE_MATCH_1}")
elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$")
set(_sdk_ver "${CMAKE_MATCH_1}")
+ elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/")
+ set(_sdk_ver "${_CURRENT_OSX_VERSION}")
else()
message(FATAL_ERROR
"CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
@@ -223,11 +88,6 @@ if(CMAKE_OSX_DEPLOYMENT_TARGET)
endif()
endif()
-if("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$")
- set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
- "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress")
-endif()
-
# Enable shared library versioning.
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name")
@@ -268,6 +128,11 @@ set(CMAKE_C_CREATE_MACOSX_FRAMEWORK
set(CMAKE_CXX_CREATE_MACOSX_FRAMEWORK
"<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
+# Set default framework search path flag for languages known to use a
+# preprocessor that may find headers in frameworks.
+set(CMAKE_C_FRAMEWORK_SEARCH_FLAG -F)
+set(CMAKE_CXX_FRAMEWORK_SEARCH_FLAG -F)
+set(CMAKE_Fortran_FRAMEWORK_SEARCH_FLAG -F)
# default to searching for frameworks first
if(NOT DEFINED CMAKE_FIND_FRAMEWORK)
@@ -301,6 +166,21 @@ if(_CMAKE_OSX_SYSROOT_PATH)
${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks
${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks
)
+ # add platform developer framework path if exists
+ foreach(_path
+ # Xcode 6
+ ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks
+ # Xcode 5 iOS
+ ${_CMAKE_OSX_SYSROOT_PATH}/Developer/Library/Frameworks
+ # Xcode 5 OSX
+ ${_CMAKE_OSX_SYSROOT_PATH}/../../../../../Library/Frameworks
+ )
+ get_filename_component(_abolute_path "${_path}" ABSOLUTE)
+ if(EXISTS "${_abolute_path}")
+ list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH "${_abolute_path}")
+ break()
+ endif()
+ endforeach()
endif()
list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH
/Library/Frameworks
@@ -341,7 +221,9 @@ foreach(_path
list(APPEND _apps_paths "${_apps}")
endif()
endforeach()
-list(REMOVE_DUPLICATES _apps_paths)
+if(_apps_paths)
+ list(REMOVE_DUPLICATES _apps_paths)
+endif()
set(CMAKE_SYSTEM_APPBUNDLE_PATH
${_apps_paths})
unset(_apps_paths)
diff --git a/Modules/Platform/Euros.cmake b/Modules/Platform/Euros.cmake
new file mode 100644
index 000000000..4c7b18277
--- /dev/null
+++ b/Modules/Platform/Euros.cmake
@@ -0,0 +1,19 @@
+# Support for EUROS RTOS (euros-embedded.com)
+set(CMAKE_LINK_LIBRARY_SUFFIX "")
+set(CMAKE_STATIC_LIBRARY_PREFIX "")
+set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
+set(CMAKE_SHARED_LIBRARY_PREFIX "")
+set(CMAKE_SHARED_LIBRARY_SUFFIX ".lib")
+set(CMAKE_EXECUTABLE_SUFFIX ".elf")
+set(CMAKE_DL_LIBS "")
+
+set(CMAKE_FIND_LIBRARY_PREFIXES "")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
+
+# EUROS RTOS does not support shared libs
+set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+
+set(CMAKE_CXX_LINK_SHARED_LIBRARY )
+set(CMAKE_CXX_LINK_MODULE_LIBRARY )
+set(CMAKE_C_LINK_SHARED_LIBRARY )
+set(CMAKE_C_LINK_MODULE_LIBRARY )
diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake
new file mode 100644
index 000000000..9eb7a8abe
--- /dev/null
+++ b/Modules/Platform/GHS-MULTI-Initialize.cmake
@@ -0,0 +1,51 @@
+
+#=============================================================================
+# Copyright 2015 Geoffrey Viola <geoffrey.viola@asirobots.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+#Setup Greenhills MULTI specific compilation information
+
+if (NOT GHS_INT_DIRECTORY)
+ #Assume the C:/ghs/int#### directory that is latest is prefered
+ set(GHS_EXPECTED_ROOT "C:/ghs")
+ if (EXISTS ${GHS_EXPECTED_ROOT})
+ FILE(GLOB GHS_CANDIDATE_INT_DIRS RELATIVE
+ ${GHS_EXPECTED_ROOT} ${GHS_EXPECTED_ROOT}/*)
+ string(REGEX MATCHALL "int[0-9][0-9][0-9][0-9]" GHS_CANDIDATE_INT_DIRS
+ ${GHS_CANDIDATE_INT_DIRS})
+ if (GHS_CANDIDATE_INT_DIRS)
+ list(SORT GHS_CANDIDATE_INT_DIRS)
+ list(GET GHS_CANDIDATE_INT_DIRS -1 GHS_INT_DIRECTORY)
+ string(CONCAT GHS_INT_DIRECTORY ${GHS_EXPECTED_ROOT} "/"
+ ${GHS_INT_DIRECTORY})
+ endif ()
+ endif ()
+
+ #Try to look for known registry values
+ if (NOT GHS_INT_DIRECTORY)
+ find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104
+ )
+ endif ()
+
+ set(GHS_INT_DIRECTORY ${GHS_INT_DIRECTORY} CACHE PATH
+ "Path to integrity directory")
+endif ()
+
+set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory")
+set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation")
+set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name")
+set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization")
+mark_as_advanced(GHS_CUSTOMIZATION)
+set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons")
+mark_as_advanced(GHS_GPJ_MACROS)
diff --git a/Modules/CMakeVS12FindMake.cmake b/Modules/Platform/GHS-MULTI.cmake
index 338d9a236..211cf3eb2 100644
--- a/Modules/CMakeVS12FindMake.cmake
+++ b/Modules/Platform/GHS-MULTI.cmake
@@ -1,6 +1,6 @@
#=============================================================================
-# Copyright 2007-2013 Kitware, Inc.
+# Copyright 2015 Geoffrey Viola <geoffrey.viola@asirobots.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -12,16 +12,16 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-# Always use MSBuild because:
-# - devenv treats command-line builds as recently-loaded projects in the IDE
-# - devenv does not appear to support non-standard platform toolsets
-# If we need devenv for Intel Fortran in the future we should add
-# a special case when Fortran is enabled.
-find_program(CMAKE_MAKE_PROGRAM
- NAMES MSBuild
- HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\12.0;MSBuildToolsPath]"
- )
+# This module is shared by multiple languages; use include blocker.
-mark_as_advanced(CMAKE_MAKE_PROGRAM)
-set(MSVC12 1)
-set(MSVC_VERSION 1800)
+if(__GHSMULTI)
+ return()
+endif()
+set(__GHSMULTI 1)
+
+set(GHSMULTI 1)
+
+set(CMAKE_FIND_LIBRARY_PREFIXES "")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+
+include(Platform/WindowsPaths)
diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake
index 588bf32d9..a1ca81243 100644
--- a/Modules/Platform/Generic-SDCC-C.cmake
+++ b/Modules/Platform/Generic-SDCC-C.cmake
@@ -38,7 +38,7 @@ if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT)
endif()
# compile a C file into an object file
-set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
# link object files to an executable
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <OBJECTS> --out-fmt-ihx -o <TARGET> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>")
diff --git a/Modules/Platform/HP-UX-GNU-ASM.cmake b/Modules/Platform/HP-UX-GNU-ASM.cmake
new file mode 100644
index 000000000..613b8596e
--- /dev/null
+++ b/Modules/Platform/HP-UX-GNU-ASM.cmake
@@ -0,0 +1,2 @@
+include(Platform/HP-UX-GNU)
+__hpux_compiler_gnu(ASM)
diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake
index eb909fe99..6c717842a 100644
--- a/Modules/Platform/HP-UX-GNU.cmake
+++ b/Modules/Platform/HP-UX-GNU.cmake
@@ -20,8 +20,10 @@ set(__HPUX_COMPILER_GNU 1)
macro(__hpux_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-E,-b,+nodefaultrpath")
- set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath")
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-E")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h")
+
+ set(CMAKE_${lang}_LINK_FLAGS "-Wl,+s,+nodefaultrpath")
endmacro()
diff --git a/Modules/Platform/HP-UX-HP-C.cmake b/Modules/Platform/HP-UX-HP-C.cmake
index 100093590..7610383d3 100644
--- a/Modules/Platform/HP-UX-HP-C.cmake
+++ b/Modules/Platform/HP-UX-HP-C.cmake
@@ -1,6 +1,6 @@
include(Platform/HP-UX-HP)
__hpux_compiler_hp(C)
-set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
-set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
-set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> -Aa -Ae <FLAGS> -o <OBJECT> -c <SOURCE>")
+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> -o <ASSEMBLY_SOURCE>")
+set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> -Aa -Ae <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/Platform/HP-UX-HP-CXX.cmake b/Modules/Platform/HP-UX-HP-CXX.cmake
index dfa1e4e45..6d90191cb 100644
--- a/Modules/Platform/HP-UX-HP-CXX.cmake
+++ b/Modules/Platform/HP-UX-HP-CXX.cmake
@@ -1,9 +1,9 @@
include(Platform/HP-UX-HP)
__hpux_compiler_hp(CXX)
-set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+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> <FLAGS> -S <SOURCE>"
+ "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE>"
"mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
"rm -f `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.o"
)
diff --git a/Modules/Platform/HP-UX-HP-Fortran.cmake b/Modules/Platform/HP-UX-HP-Fortran.cmake
index 30acab807..12007e422 100644
--- a/Modules/Platform/HP-UX-HP-Fortran.cmake
+++ b/Modules/Platform/HP-UX-HP-Fortran.cmake
@@ -1,2 +1,5 @@
include(Platform/HP-UX-HP)
__hpux_compiler_hp(Fortran)
+
+set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake
index 871ea1323..3935c31c1 100644
--- a/Modules/Platform/HP-UX-HP.cmake
+++ b/Modules/Platform/HP-UX-HP.cmake
@@ -22,10 +22,12 @@ macro(__hpux_compiler_hp lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "+Z")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "+Z")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-Wl,-E,+nodefaultrpath -b -L/usr/lib")
- set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath")
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-E")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h")
set(CMAKE_${lang}_FLAGS_INIT "")
+
+ set(CMAKE_${lang}_LINK_FLAGS "-Wl,+s,+nodefaultrpath")
endmacro()
diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake
index 65cc7310d..88932ad67 100644
--- a/Modules/Platform/HP-UX.cmake
+++ b/Modules/Platform/HP-UX.cmake
@@ -1,9 +1,11 @@
set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib)
-set(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so
+if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "ia64")
+ set(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a")
+ set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so")
+endif()
set(CMAKE_DL_LIBS "dld")
-set(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a")
-set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so")
# The HP linker needs to find transitive shared library dependencies
# in the -L path. Therefore the runtime path must be added to the
@@ -33,18 +35,11 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
# Initialize C and CXX 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. Note that C modules and shared
-# libs are built using ld directly so we leave off the "-Wl," portion.
-foreach(type SHARED_LIBRARY SHARED_MODULE)
- set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive")
- set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default")
-endforeach()
-foreach(type EXE)
- set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive")
- set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default")
-endforeach()
+# shared versions of the libraries.
foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
- set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive")
- set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default")
+ foreach(lang C CXX)
+ set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-a,archive")
+ set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-a,default")
+ endforeach()
endforeach()
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
index 8987783ff..dfc2664d3 100644
--- a/Modules/Platform/Haiku.cmake
+++ b/Modules/Platform/Haiku.cmake
@@ -1,24 +1,130 @@
-set(BEOS 1)
+# process only once
+if(HAIKU)
+ return()
+endif()
+
+set(HAIKU 1)
+set(UNIX 1)
-set(CMAKE_DL_LIBS root be)
-set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
-set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+set(CMAKE_DL_LIBS "")
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
-set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart")
+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_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+
+# Determine, if the C or C++ compiler is configured for a secondary
+# architecture. If so, that will change the search paths we set below. We check
+# whether the compiler's library search paths contain a
+# "/boot/system/develop/lib/<subdir>/", which we assume to be the secondary
+# architecture specific subdirectory and extract the name of the architecture
+# accordingly.
+
+# First of all, find a C or C++ compiler we can run. The "arg1" is necessary
+# here for compilers such as "distcc gcc-x86" or "ccache gcc-x86"
+# TODO See CMakeDetermineCompilerId.cmake for some more things we may want to do.
+if(CMAKE_C_COMPILER)
+ set(__HAIKU_COMPILER ${CMAKE_C_COMPILER})
+ string (STRIP "${CMAKE_C_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS)
+else()
+ set(__HAIKU_COMPILER ${CMAKE_CXX_COMPILER})
+ string (STRIP "${CMAKE_CXX_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS)
+endif()
+
+
+execute_process(
+ COMMAND ${__HAIKU_COMPILER} ${__HAIKU_COMPILER_FLAGS} -print-search-dirs
+ OUTPUT_VARIABLE _HAIKU_SEARCH_DIRS
+ RESULT_VARIABLE _HAIKU_SEARCH_DIRS_FOUND
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+string(REGEX MATCH "libraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/?(:?\n+)" _dummy "${_HAIKU_SEARCH_DIRS}\n")
+set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}")
+
+if(NOT CMAKE_HAIKU_SECONDARY_ARCH)
+ set(CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR "")
+ unset(CMAKE_HAIKU_SECONDARY_ARCH)
+else()
+ set(CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR "/${CMAKE_HAIKU_SECONDARY_ARCH}")
+
+ # Override CMAKE_*LIBRARY_ARCHITECTURE. This will cause FIND_LIBRARY to search
+ # the libraries in the correct subdirectory first. It still isn't completely
+ # correct, since the parent directories shouldn't be searched at all. The
+ # primary architecture library might still be found, if there isn't one
+ # installed for the secondary architecture or it is installed in a less
+ # specific location.
+ set(CMAKE_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH})
+ set(CMAKE_C_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH})
+ set(CMAKE_CXX_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH})
+endif()
+
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ /boot/system/non-packaged
+ /boot/system
+ )
+
+LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
+ /boot/system/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ /boot/system/develop/headers/os
+ /boot/system/develop/headers/os/app
+ /boot/system/develop/headers/os/device
+ /boot/system/develop/headers/os/drivers
+ /boot/system/develop/headers/os/game
+ /boot/system/develop/headers/os/interface
+ /boot/system/develop/headers/os/kernel
+ /boot/system/develop/headers/os/locale
+ /boot/system/develop/headers/os/mail
+ /boot/system/develop/headers/os/media
+ /boot/system/develop/headers/os/midi
+ /boot/system/develop/headers/os/midi2
+ /boot/system/develop/headers/os/net
+ /boot/system/develop/headers/os/opengl
+ /boot/system/develop/headers/os/storage
+ /boot/system/develop/headers/os/support
+ /boot/system/develop/headers/os/translation
+ /boot/system/develop/headers/os/add-ons/graphics
+ /boot/system/develop/headers/os/add-ons/input_server
+ /boot/system/develop/headers/os/add-ons/screen_saver
+ /boot/system/develop/headers/os/add-ons/tracker
+ /boot/system/develop/headers/os/be_apps/Deskbar
+ /boot/system/develop/headers/os/be_apps/NetPositive
+ /boot/system/develop/headers/os/be_apps/Tracker
+ /boot/system/develop/headers/3rdparty
+ /boot/system/develop/headers/bsd
+ /boot/system/develop/headers/glibc
+ /boot/system/develop/headers/gnu
+ /boot/system/develop/headers/posix
+ /boot/system/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ )
+IF (CMAKE_HAIKU_SECONDARY_ARCH)
+ LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
+ /boot/system/develop/headers
+ )
+ENDIF (CMAKE_HAIKU_SECONDARY_ARCH)
+
+LIST(APPEND CMAKE_HAIKU_C_INCLUDE_DIRECTORIES
+ ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES}
+ )
+
+LIST(APPEND CMAKE_HAIKU_CXX_INCLUDE_DIRECTORIES
+ ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES})
+
+LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_HAIKU_C_INCLUDE_DIRECTORIES})
+
+LIST(APPEND CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES
+ /boot/system/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ /boot/system/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
+ )
+
+LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+ ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES}
+ )
-include(Platform/UnixPaths)
-list(APPEND CMAKE_SYSTEM_PREFIX_PATH /boot/common)
-list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/common/include)
-list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/common/lib)
-list(APPEND CMAKE_SYSTEM_PROGRAM_PATH /boot/common/bin)
-list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /boot/common/lib)
-list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/develop/headers/3rdparty)
-list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/develop/lib/x86)
+LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES})
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- set(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH
+ set(CMAKE_INSTALL_PREFIX "/boot/system" CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
endif()
diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake
index 03e98ccfd..12b0f3774 100644
--- a/Modules/Platform/IRIX.cmake
+++ b/Modules/Platform/IRIX.cmake
@@ -31,6 +31,14 @@ if(NOT CMAKE_COMPILER_IS_GNUCXX)
)
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
diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake
index 5acbd81fa..ee9b96e89 100644
--- a/Modules/Platform/IRIX64.cmake
+++ b/Modules/Platform/IRIX64.cmake
@@ -44,17 +44,17 @@ endif()
include(Platform/UnixPaths)
if(NOT CMAKE_COMPILER_IS_GNUCC)
- set (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ 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> <FLAGS> -S <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> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ 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> <FLAGS> -S <SOURCE>"
+ "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE>"
"mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
)
endif()
diff --git a/Modules/Platform/Linux-CCur-Fortran.cmake b/Modules/Platform/Linux-CCur-Fortran.cmake
new file mode 100644
index 000000000..ceecc2f69
--- /dev/null
+++ b/Modules/Platform/Linux-CCur-Fortran.cmake
@@ -0,0 +1 @@
+include(Platform/Linux-GNU-Fortran)
diff --git a/Modules/Platform/Linux-GNU-Fortran.cmake b/Modules/Platform/Linux-GNU-Fortran.cmake
index 68e95404b..85e12265a 100644
--- a/Modules/Platform/Linux-GNU-Fortran.cmake
+++ b/Modules/Platform/Linux-GNU-Fortran.cmake
@@ -1,2 +1,3 @@
include(Platform/Linux-GNU)
__linux_compiler_gnu(Fortran)
+set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "")
diff --git a/Modules/Platform/Linux-Intel-C.cmake b/Modules/Platform/Linux-Intel-C.cmake
index d1694d64a..449493a78 100644
--- a/Modules/Platform/Linux-Intel-C.cmake
+++ b/Modules/Platform/Linux-Intel-C.cmake
@@ -1,2 +1,3 @@
include(Platform/Linux-Intel)
__linux_compiler_intel(C)
+set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
diff --git a/Modules/Platform/Linux-Intel-CXX.cmake b/Modules/Platform/Linux-Intel-CXX.cmake
index 66df3ac2a..142b6cf5c 100644
--- a/Modules/Platform/Linux-Intel-CXX.cmake
+++ b/Modules/Platform/Linux-Intel-CXX.cmake
@@ -1,2 +1,3 @@
include(Platform/Linux-Intel)
__linux_compiler_intel(CXX)
+set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake
index bb671eeb2..0c9523c8c 100644
--- a/Modules/Platform/Linux-Intel-Fortran.cmake
+++ b/Modules/Platform/Linux-Intel-Fortran.cmake
@@ -1,4 +1,4 @@
include(Platform/Linux-Intel)
__linux_compiler_intel(Fortran)
-set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -i_dynamic -nofor_main")
-set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic")
+set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -nofor_main")
+set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "")
diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake
index 2394f1050..20fddb422 100644
--- a/Modules/Platform/Linux-Intel.cmake
+++ b/Modules/Platform/Linux-Intel.cmake
@@ -47,4 +47,8 @@ macro(__linux_compiler_intel lang)
"${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> "
"${XIAR} -s <TARGET> ")
endif()
+
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+ endif()
endmacro()
diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake
index 3cbb35c72..baa2248a5 100644
--- a/Modules/Platform/Linux-PGI.cmake
+++ b/Modules/Platform/Linux-PGI.cmake
@@ -21,7 +21,7 @@ set(__LINUX_COMPILER_PGI 1)
macro(__linux_compiler_pgi lang)
# Shared library compile and link flags.
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
- set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
endmacro()
diff --git a/Modules/Platform/Linux-XL-C.cmake b/Modules/Platform/Linux-XL-C.cmake
index f1c584ce5..d595e44f7 100644
--- a/Modules/Platform/Linux-XL-C.cmake
+++ b/Modules/Platform/Linux-XL-C.cmake
@@ -1 +1,2 @@
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj")
+set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-export-dynamic")
diff --git a/Modules/Platform/Linux-XL-CXX.cmake b/Modules/Platform/Linux-XL-CXX.cmake
index abd3fa497..5ceb25591 100644
--- a/Modules/Platform/Linux-XL-CXX.cmake
+++ b/Modules/Platform/Linux-XL-CXX.cmake
@@ -1 +1,2 @@
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj")
+set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,-export-dynamic")
diff --git a/Modules/Platform/Linux-XL-Fortran.cmake b/Modules/Platform/Linux-XL-Fortran.cmake
index cdd1f702b..a87899131 100644
--- a/Modules/Platform/Linux-XL-Fortran.cmake
+++ b/Modules/Platform/Linux-XL-Fortran.cmake
@@ -1 +1,2 @@
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-qmkshrobj")
+set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-export-dynamic")
diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
index fe8e0039f..e40a74fab 100644
--- a/Modules/Platform/Linux.cmake
+++ b/Modules/Platform/Linux.cmake
@@ -52,6 +52,6 @@ include(Platform/UnixPaths)
# Debian has lib64 paths only for compatibility so they should not be
# searched.
-if(EXISTS "/etc/debian_version")
+if(NOT CMAKE_CROSSCOMPILING AND EXISTS "/etc/debian_version")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
endif()
diff --git a/Modules/Platform/MirBSD.cmake b/Modules/Platform/MirBSD.cmake
new file mode 100644
index 000000000..7637f9bc7
--- /dev/null
+++ b/Modules/Platform/MirBSD.cmake
@@ -0,0 +1 @@
+include(Platform/OpenBSD)
diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake
index 9c3255e36..f2ad6129c 100644
--- a/Modules/Platform/OSF1.cmake
+++ b/Modules/Platform/OSF1.cmake
@@ -2,7 +2,7 @@ set(CMAKE_DL_LIBS "")
if(CMAKE_SYSTEM MATCHES "OSF1-1.[012]")
endif()
-if(CMAKE_SYSTEM MATCHES "OSF1-1.*")
+if(CMAKE_SYSTEM MATCHES "OSF1-1")
# OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fpic")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fpie")
@@ -12,7 +12,7 @@ endif()
-if(CMAKE_SYSTEM MATCHES "OSF1-V.*")
+if(CMAKE_SYSTEM MATCHES "OSF1-V")
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-rpath,")
diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake
index 53cabedde..7ac6c7e84 100644
--- a/Modules/Platform/OpenBSD.cmake
+++ b/Modules/Platform/OpenBSD.cmake
@@ -10,13 +10,29 @@ if(NOT CMAKE_PLATFORM_RUNTIME_PATH)
ERROR_QUIET)
string(REGEX REPLACE ".*search\\ directories:\\ ([^\n]*).*" "\\1"
LDCONFIG_HINTS "${LDCONFIG_HINTS}")
- string(REGEX REPLACE ":" ";"
+ string(REPLACE ":" ";"
CMAKE_PLATFORM_RUNTIME_PATH
"${LDCONFIG_HINTS}")
endif()
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1)
+# OpenBSD has no multilib
+set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
+
# OpenBSD policy requires that shared libraries be installed without
# executable permission.
set(CMAKE_INSTALL_SO_NO_EXE 1)
+
+if($ENV{LOCALBASE})
+ set(OPENBSD_LOCALBASE $ENV{LOCALBASE})
+else()
+ set(OPENBSD_LOCALBASE /usr/local)
+endif()
+if($ENV{X11BASE})
+ set(OPENBSD_X11BASE $ENV{X11BASE})
+else()
+ set(OPENBSD_X11BASE /usr/X11R6)
+endif()
+
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${OPENBSD_LOCALBASE})
diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake
index 2598411cd..ebc4609a3 100644
--- a/Modules/Platform/QNX.cmake
+++ b/Modules/Platform/QNX.cmake
@@ -1,18 +1,9 @@
set(QNXNTO 1)
-# The QNX GCC does not seem to have -isystem so remove the flag.
-set(CMAKE_INCLUDE_SYSTEM_FLAG_C)
-set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+include(Platform/GNU)
+unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
set(CMAKE_DL_LIBS "")
-set(CMAKE_SHARED_LIBRARY_C_FLAGS "")
-set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
-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_LINK_C_FLAG "-Wl,-rpath-link,")
-set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
-set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
# Shared libraries with no builtin soname may not be linked safely by
# specifying the file path.
@@ -26,8 +17,3 @@ 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()
-# force the language to be c++ since qnx only has gcc and not g++ and c++?
-set(CMAKE_CXX_COMPILE_OBJECT
- "<CMAKE_CXX_COMPILER> -x c++ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
-
-include(Platform/UnixPaths)
diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake
index da20f97a1..58398c06f 100644
--- a/Modules/Platform/SunOS.cmake
+++ b/Modules/Platform/SunOS.cmake
@@ -1,4 +1,4 @@
-if(CMAKE_SYSTEM MATCHES "SunOS-4.*")
+if(CMAKE_SYSTEM MATCHES "SunOS-4")
set(CMAKE_C_COMPILE_OPTIONS_PIC "-PIC")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-PIE")
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC")
@@ -7,22 +7,8 @@ if(CMAKE_SYSTEM MATCHES "SunOS-4.*")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
endif()
-if(CMAKE_COMPILER_IS_GNUCXX)
- if(CMAKE_COMPILER_IS_GNUCC)
- set(CMAKE_CXX_CREATE_SHARED_LIBRARY
- "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
- else()
- # Take default rule from CMakeDefaultMakeRuleVariables.cmake.
- endif()
-endif()
include(Platform/UnixPaths)
-# Add the compiler's implicit link directories.
-if("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro)
- list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
- /opt/SUNWspro/lib /opt/SUNWspro/prod/lib /usr/ccs/lib)
-endif()
-
# The Sun linker needs to find transitive shared library dependencies
# in the -L path.
set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
index ccb266330..20ee1d111 100644
--- a/Modules/Platform/UnixPaths.cmake
+++ b/Modules/Platform/UnixPaths.cmake
@@ -37,10 +37,19 @@ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
# CMake install location
"${_CMAKE_INSTALL_DIR}"
-
- # Project install destination.
- "${CMAKE_INSTALL_PREFIX}"
)
+if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ # Project install destination.
+ "${CMAKE_INSTALL_PREFIX}"
+ )
+ if(CMAKE_STAGING_PREFIX)
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ # User-supplied staging prefix.
+ "${CMAKE_STAGING_PREFIX}"
+ )
+ endif()
+endif()
# List common include file locations not under the common prefixes.
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
@@ -74,7 +83,7 @@ list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
)
list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
- /lib /usr/lib /usr/lib32 /usr/lib64
+ /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64
)
list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
diff --git a/Modules/Platform/Windows-Clang-C.cmake b/Modules/Platform/Windows-Clang-C.cmake
new file mode 100644
index 000000000..d00710579
--- /dev/null
+++ b/Modules/Platform/Windows-Clang-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-Clang)
+__windows_compiler_clang(C)
diff --git a/Modules/Platform/Windows-Clang-CXX.cmake b/Modules/Platform/Windows-Clang-CXX.cmake
new file mode 100644
index 000000000..2c3688a36
--- /dev/null
+++ b/Modules/Platform/Windows-Clang-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-Clang)
+__windows_compiler_clang(CXX)
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
new file mode 100644
index 000000000..da19a3d07
--- /dev/null
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -0,0 +1,32 @@
+
+#=============================================================================
+# Copyright 2001-2013 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__WINDOWS_CLANG)
+ return()
+endif()
+set(__WINDOWS_CLANG 1)
+
+if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ include(Platform/Windows-MSVC)
+ macro(__windows_compiler_clang lang)
+ __windows_compiler_msvc(${lang})
+ endmacro()
+else()
+ include(Platform/Windows-GNU)
+ macro(__windows_compiler_clang lang)
+ __windows_compiler_gnu(${lang})
+ endmacro()
+endif()
diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake
index 26b3c0cab..102e3a651 100644
--- a/Modules/Platform/Windows-Embarcadero.cmake
+++ b/Modules/Platform/Windows-Embarcadero.cmake
@@ -74,6 +74,16 @@ set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT})
+# The Borland link tool does not support multiple concurrent
+# invocations within a single working directory.
+if(NOT DEFINED CMAKE_JOB_POOL_LINK)
+ set(CMAKE_JOB_POOL_LINK BCC32LinkPool)
+ get_property(_bccjp GLOBAL PROPERTY JOB_POOLS)
+ if(NOT _bccjp MATCHES "BCC32LinkPool=")
+ set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1)
+ endif()
+ unset(_bccjp)
+endif()
macro(__embarcadero_language lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_DLL "${_tD}") # Note: This variable is a ';' separated list
@@ -84,7 +94,7 @@ macro(__embarcadero_language lang)
# place <DEFINES> outside the response file because Borland refuses
# to parse quotes from the response file.
set(CMAKE_${lang}_COMPILE_OBJECT
- "<CMAKE_${lang}_COMPILER> ${_tR} <DEFINES> -DWIN32 -o<OBJECT> <FLAGS> ${_COMPILE_${lang}} <SOURCE>"
+ "<CMAKE_${lang}_COMPILER> ${_tR} -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<OBJECT> ${_COMPILE_${lang}} <SOURCE>"
)
set(CMAKE_${lang}_LINK_EXECUTABLE
@@ -95,7 +105,7 @@ macro(__embarcadero_language lang)
# place <DEFINES> outside the response file because Borland refuses
# to parse quotes from the response file.
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
- "cpp32 <DEFINES> -DWIN32 <FLAGS> -o<PREPROCESSED_SOURCE> ${_COMPILE_${lang}} <SOURCE>"
+ "cpp32 -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<PREPROCESSED_SOURCE> ${_COMPILE_${lang}} <SOURCE>"
)
# Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 2bb7a2076..d8a423e55 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -61,14 +61,12 @@ if(NOT CMAKE_GENERATOR_RC AND CMAKE_GENERATOR MATCHES "Unix Makefiles")
set(CMAKE_GENERATOR_RC windres)
endif()
-enable_language(RC)
-
macro(__windows_compiler_gnu lang)
if(MSYS OR MINGW)
# Create archiving rules to support large object file lists for static libraries.
- set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
- set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
# Initialize C link type selection flags. These flags are used when
@@ -87,6 +85,7 @@ macro(__windows_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE})
+ set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES ${__WINDOWS_GNU_LD_RESPONSE})
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
# We prefer "@" for response files but it is not supported by gcc 3.
@@ -103,16 +102,18 @@ macro(__windows_compiler_gnu lang)
endif()
# The GNU 3.x compilers do not support response files (only linkers).
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 0)
- elseif(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS)
+ # Link libraries are generated only for the front-end.
+ set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
+ else()
# Use "@" to pass the response file to the front-end.
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
endif()
# Binary link rules.
set(CMAKE_${lang}_CREATE_SHARED_MODULE
- "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
+ "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
- "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
+ "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
set(CMAKE_${lang}_LINK_EXECUTABLE
"<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
@@ -136,6 +137,12 @@ macro(__windows_compiler_gnu lang)
)
endforeach()
endif()
+
+ if(NOT CMAKE_RC_COMPILER_INIT AND NOT CMAKE_GENERATOR_RC)
+ set(CMAKE_RC_COMPILER_INIT windres)
+ endif()
+
+ enable_language(RC)
endmacro()
macro(__windows_compiler_gnu_abi lang)
@@ -151,6 +158,7 @@ macro(__windows_compiler_gnu_abi lang)
find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars32.bat
DOC "Visual Studio vcvars32.bat"
PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin"
@@ -160,9 +168,10 @@ macro(__windows_compiler_gnu_abi lang)
)
set(CMAKE_GNUtoMS_ARCH x86)
elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
- find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvarsamd64.bat
+ find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars64.bat vcvarsamd64.bat
DOC "Visual Studio vcvarsamd64.bat"
PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin/amd64"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin/amd64"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin/amd64"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin/amd64"
diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake
index ec5f0aec6..84cd303ec 100644
--- a/Modules/Platform/Windows-Intel-CXX.cmake
+++ b/Modules/Platform/Windows-Intel-CXX.cmake
@@ -1,4 +1,3 @@
include(Platform/Windows-Intel)
set(_COMPILE_CXX " /TP")
-set(_FLAGS_CXX " /EHsc /GR")
__windows_compiler_intel(CXX)
diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake
index 40523ffe5..0f9a10a79 100644
--- a/Modules/Platform/Windows-Intel-Fortran.cmake
+++ b/Modules/Platform/Windows-Intel-Fortran.cmake
@@ -5,7 +5,7 @@ set(CMAKE_Fortran_MODDIR_FLAG "-module:")
set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib")
__windows_compiler_intel(Fortran)
set (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads")
-set (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs")
+set (CMAKE_Fortran_FLAGS_DEBUG_INIT "/Od /debug:full /dbglibs")
set (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O1 /D NDEBUG")
set (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O2 /D NDEBUG")
set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /debug:full /D NDEBUG")
diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake
index 69a7f2ff0..34e6b377b 100644
--- a/Modules/Platform/Windows-Intel.cmake
+++ b/Modules/Platform/Windows-Intel.cmake
@@ -18,92 +18,11 @@ if(__WINDOWS_INTEL)
endif()
set(__WINDOWS_INTEL 1)
-# make sure to enable languages after setting configuration types
-enable_language(RC)
-set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
-
-set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:")
-set(CMAKE_LINK_LIBRARY_FLAG "")
-set(WIN32 1)
-if(CMAKE_VERBOSE_MAKEFILE)
- set(CMAKE_CL_NOLOGO)
-else()
- set(CMAKE_CL_NOLOGO "/nologo")
-endif()
-set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
-set(CMAKE_CREATE_WIN32_EXE /subsystem:windows)
-set(CMAKE_CREATE_CONSOLE_EXE /subsystem:console)
-
-# default to Debug builds
-#set(CMAKE_BUILD_TYPE_INIT Debug)
-set(CMAKE_BUILD_TYPE_INIT Release)
-
-set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib")
-set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
-
-# executable linker flags
-set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
-if(MSVC_C_ARCHITECTURE_ID)
- set(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}")
-elseif(MSVC_CXX_ARCHITECTURE_ID)
- set(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}")
-elseif(MSVC_Fortran_ARCHITECTURE_ID)
- set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}")
-endif()
-set (CMAKE_EXE_LINKER_FLAGS_INIT "/INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}")
-set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
-set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug")
-
-set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
-set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
-set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
-set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
-
-include("${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake" OPTIONAL)
-
-if(NOT _INTEL_XILINK_TEST_RUN)
- execute_process(COMMAND xilink /?
- ERROR_VARIABLE _XILINK_ERR
- OUTPUT_VARIABLE _XILINK_HELP)
- if(_XILINK_HELP MATCHES MANIFEST)
- set(_INTEL_COMPILER_SUPPORTS_MANIFEST 1)
- endif()
- if(NOT EXISTS "${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake")
- file(WRITE ${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake
- "
-set(_INTEL_XILINK_TEST_RUN 1)
-set(_INTEL_COMPILER_SUPPORTS_MANIFEST ${_INTEL_COMPILER_SUPPORTS_MANIFEST})
-")
- endif()
-endif()
-
+include(Platform/Windows-MSVC)
macro(__windows_compiler_intel lang)
- set(CMAKE_${lang}_COMPILE_OBJECT
- "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo<OBJECT> /Fd<OBJECT_DIR>/ <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
- set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
- "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
- set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
- set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
- set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
- "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
- set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}")
- set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link")
- set(CMAKE_${lang}_LINK_EXECUTABLE
- "<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> <OBJECTS> /link /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
- set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}")
- set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /RTC1")
- set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1")
- set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/DNDEBUG /MD /O2")
- set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2")
-
- if(_INTEL_COMPILER_SUPPORTS_MANIFEST)
- set(CMAKE_${lang}_LINK_EXECUTABLE
- "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_${lang}_LINK_EXECUTABLE}")
- set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
- "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}")
- set(CMAKE_${lang}_CREATE_SHARED_MODULE
- "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_MODULE}")
- endif()
+ __windows_compiler_msvc(${lang})
+ string(REPLACE "<CMAKE_LINKER> /lib" "lib" CMAKE_${lang}_CREATE_STATIC_LIBRARY "${CMAKE_${lang}_CREATE_STATIC_LIBRARY}")
+ foreach(rule CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE)
+ string(REPLACE "<CMAKE_LINKER>" "xilink" CMAKE_${lang}_${rule} "${CMAKE_${lang}_${rule}}")
+ endforeach()
endmacro()
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 6e02e4aca..a61413a87 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -36,28 +36,25 @@ else()
set(CMAKE_CL_NOLOGO "/nologo")
endif()
-set(WIN32 1)
-
-if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
- set(CMAKE_CREATE_WIN32_EXE "/subsystem:windowsce /entry:WinMainCRTStartup")
- set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /entry:mainACRTStartup")
- set(WINCE 1)
+if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE")
+ set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup")
+ set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup")
+ set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce")
else()
set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
+ set(_PLATFORM_LINK_FLAGS "")
endif()
+set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 1)
if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
set (CMAKE_NO_BUILD_TYPE 1)
+ set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 0) # not implemented for VS6
endif()
if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")
set (CMAKE_NO_BUILD_TYPE 1)
endif()
-# make sure to enable languages after setting configuration types
-enable_language(RC)
-set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
-
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
set(MSVC_IDE 1)
else()
@@ -65,7 +62,13 @@ else()
endif()
if(NOT MSVC_VERSION)
- if(CMAKE_C_COMPILER_VERSION)
+ if(CMAKE_C_SIMULATE_VERSION)
+ set(_compiler_version ${CMAKE_C_SIMULATE_VERSION})
+ elseif(CMAKE_CXX_SIMULATE_VERSION)
+ set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION})
+ elseif(CMAKE_Fortran_SIMULATE_VERSION)
+ set(_compiler_version ${CMAKE_Fortran_SIMULATE_VERSION})
+ elseif(CMAKE_C_COMPILER_VERSION)
set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
else()
set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
@@ -79,6 +82,7 @@ if(NOT MSVC_VERSION)
set(MSVC10)
set(MSVC11)
set(MSVC12)
+ set(MSVC14)
set(MSVC60)
set(MSVC70)
set(MSVC71)
@@ -86,7 +90,9 @@ if(NOT MSVC_VERSION)
set(MSVC90)
set(CMAKE_COMPILER_2005)
set(CMAKE_COMPILER_SUPPORTS_PDBTYPE)
- if(NOT "${_compiler_version}" VERSION_LESS 18)
+ if(NOT "${_compiler_version}" VERSION_LESS 19)
+ set(MSVC14 1)
+ elseif(NOT "${_compiler_version}" VERSION_LESS 18)
set(MSVC12 1)
elseif(NOT "${_compiler_version}" VERSION_LESS 17)
set(MSVC11 1)
@@ -123,14 +129,18 @@ endif()
# default to Debug builds
set(CMAKE_BUILD_TYPE_INIT Debug)
+# Compute an architecture family from the architecture id.
+foreach(lang C CXX)
+ set(_MSVC_${lang}_ARCHITECTURE_FAMILY "${MSVC_${lang}_ARCHITECTURE_ID}")
+ if(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM")
+ set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM")
+ elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^SH")
+ set(_MSVC_${lang}_ARCHITECTURE_FAMILY "SHx")
+ endif()
+endforeach()
+
if(WINCE)
foreach(lang C CXX)
- set(_MSVC_${lang}_ARCHITECTURE_FAMILY "${MSVC_${lang}_ARCHITECTURE_ID}")
- if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "THUMB")
- set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM")
- elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^SH")
- set(_MSVC_${lang}_ARCHITECTURE_FAMILY "SHx")
- endif()
string(TOUPPER "${_MSVC_${lang}_ARCHITECTURE_FAMILY}" _MSVC_${lang}_ARCHITECTURE_FAMILY_UPPER)
endforeach()
@@ -142,22 +152,48 @@ if(WINCE)
message(FATAL_ERROR "Invalid Windows CE version: ${CMAKE_SYSTEM_VERSION}")
endif()
- set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE")
+ set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE /DWINCE")
set(_PLATFORM_DEFINES_C " /D${_MSVC_C_ARCHITECTURE_FAMILY} /D_${_MSVC_C_ARCHITECTURE_FAMILY_UPPER}_")
set(_PLATFORM_DEFINES_CXX " /D${_MSVC_CXX_ARCHITECTURE_FAMILY} /D_${_MSVC_CXX_ARCHITECTURE_FAMILY_UPPER}_")
set(_RTC1 "")
+ set(_FLAGS_C "")
set(_FLAGS_CXX " /GR /EHsc")
+
+ foreach(lang C CXX)
+ if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "ARM")
+ set(_PLATFORM_DEFINES_${lang} "${_PLATFORM_DEFINES_${lang}} /D${MSVC_${lang}_ARCHITECTURE_ID}")
+ if(MSVC_${lang}_ARCHITECTURE_ID MATCHES "^ARMV([45])I$")
+ set(_FLAGS_${lang} "${_FLAGS_${lang}} /QRarch${CMAKE_MATCH_1}T")
+ endif()
+ endif()
+ endforeach()
+
set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib")
set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib")
if (MSVC_VERSION LESS 1600)
set(CMAKE_C_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT} corelibc.lib")
endif ()
+elseif(WINDOWS_PHONE OR WINDOWS_STORE)
+ set(_PLATFORM_DEFINES "/DWIN32")
+ set(_FLAGS_C " /DUNICODE /D_UNICODE")
+ set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc")
+ if(WINDOWS_STORE AND MSVC_VERSION GREATER 1899)
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsApp.lib")
+ elseif(WINDOWS_PHONE)
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib")
+ elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM")
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib")
+ else()
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
+ endif()
else()
set(_PLATFORM_DEFINES "/DWIN32")
- if(MSVC_VERSION GREATER 1310)
+ if(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM")
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib")
+ elseif(MSVC_VERSION GREATER 1310)
set(_RTC1 "/RTC1")
set(_FLAGS_CXX " /GR /EHsc")
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
@@ -178,20 +214,38 @@ set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
# executable linker flags
set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
# set the machine type
-set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID})
-if(NOT _MACHINE_ARCH_FLAG)
- set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID})
+if(MSVC_C_ARCHITECTURE_ID)
+ if(MSVC_C_ARCHITECTURE_ID MATCHES "^ARMV.I")
+ set(_MACHINE_ARCH_FLAG "/machine:THUMB")
+ elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM")
+ set(_MACHINE_ARCH_FLAG "/machine:ARM")
+ else()
+ set(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}")
+ endif()
+elseif(MSVC_CXX_ARCHITECTURE_ID)
+ if(MSVC_CXX_ARCHITECTURE_ID MATCHES "^ARMV.I")
+ set(_MACHINE_ARCH_FLAG "/machine:THUMB")
+ elseif(_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM")
+ set(_MACHINE_ARCH_FLAG "/machine:ARM")
+ else()
+ set(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}")
+ endif()
+elseif(MSVC_Fortran_ARCHITECTURE_ID)
+ set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}")
endif()
-set (CMAKE_EXE_LINKER_FLAGS_INIT
- "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${_MACHINE_ARCH_FLAG}")
+set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}")
+set(CMAKE_STATIC_LINKER_FLAGS_INIT "${CMAKE_STATIC_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}")
+unset(_MACHINE_ARCH_FLAG)
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
# on versions that support it
set( MSVC_INCREMENTAL_YES_FLAG "")
-if(NOT MSVC_INCREMENTAL_DEFAULT)
- set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
-else()
- set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" )
+if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE)
+ if(NOT MSVC_INCREMENTAL_DEFAULT)
+ set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
+ else()
+ set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" )
+ endif()
endif()
if (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
@@ -209,7 +263,7 @@ set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO")
# shared linker flags
set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
+set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
# module linker flags
@@ -220,31 +274,43 @@ set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INI
set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
macro(__windows_compiler_msvc lang)
- if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" VERSION_LESS 14)
+ 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 ")
- set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ")
+ 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> -- ")
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> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+ "${_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}")
set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY})
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
set(CMAKE_${lang}_COMPILE_OBJECT
- "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<OBJECT_DIR>/${_FS_${lang}} -c <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <INCLUDES> <FLAGS> /Fo<OBJECT> /Fd<TARGET_COMPILE_PDB>${_FS_${lang}} -c <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
- "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
- "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /FoNUL /FAs /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <INCLUDES> <FLAGS> /FoNUL /FAs /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
set(CMAKE_${lang}_LINK_EXECUTABLE
- "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+ "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}")
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
+ set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON)
+ set(CMAKE_NINJA_DEPTYPE_${lang} msvc)
+
+ if(NOT CMAKE_RC_COMPILER_INIT)
+ set(CMAKE_RC_COMPILER_INIT rc)
+ endif()
+ if(NOT CMAKE_RC_FLAGS_INIT)
+ set(CMAKE_RC_FLAGS_INIT "${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}")
+ endif()
+
+ enable_language(RC)
+ set(CMAKE_NINJA_CMCLDEPS_RC 1)
endmacro()
diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake
index 8dfb61057..0beba732d 100644
--- a/Modules/Platform/Windows-df.cmake
+++ b/Modules/Platform/Windows-df.cmake
@@ -24,9 +24,6 @@ set(CMAKE_Fortran_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /o
set(CMAKE_Fortran_COMPILE_OBJECT
"<CMAKE_Fortran_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /object:<OBJECT> <FLAGS> /compile_only <SOURCE>${CMAKE_END_TEMP_FILE}")
-set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
-
-set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link")
set(CMAKE_Fortran_LINK_EXECUTABLE
"<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /exe:<TARGET> <OBJECTS> /link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
@@ -63,7 +60,7 @@ endif ()
set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
-set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
+set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake
index 8a03b2972..3bc54449e 100644
--- a/Modules/Platform/Windows-wcl386.cmake
+++ b/Modules/Platform/Windows-wcl386.cmake
@@ -12,13 +12,15 @@ else()
set(CMAKE_LIB_QUIET "-q")
endif()
+set(CMAKE_EXE_LINKER_FLAGS_INIT)
set(CMAKE_CREATE_WIN32_EXE "system nt_win" )
set(CMAKE_CREATE_CONSOLE_EXE "system nt" )
-
-set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "debug all" )
-set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "debug all" )
-set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" )
-set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" )
+set(CMAKE_SHARED_LINKER_FLAGS_INIT "system nt_dll")
+set(CMAKE_MODULE_LINKER_FLAGS_INIT "system nt_dll")
+foreach(type SHARED MODULE EXE)
+ set(CMAKE_${type}_LINKER_FLAGS_DEBUG_INIT "debug all opt map")
+ set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all opt map")
+endforeach()
set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated string.
@@ -26,50 +28,54 @@ set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated st
set(CMAKE_RC_COMPILER "rc" )
set(CMAKE_BUILD_TYPE_INIT Debug)
-set (CMAKE_CXX_FLAGS_INIT "-w=3 -xs")
-set (CMAKE_CXX_FLAGS_DEBUG_INIT "-br -bm -d2")
-set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG")
-set (CMAKE_CXX_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG")
-set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG")
-set (CMAKE_C_FLAGS_INIT "-w=3 ")
-set (CMAKE_C_FLAGS_DEBUG_INIT "-br -bm -d2 -od")
-set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG")
-set (CMAKE_C_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG")
-set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG")
-set (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib")
-set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
+
+# single/multi-threaded /-bm
+# static/DLL run-time libraries /-br
+# default is setup for multi-threaded + DLL run-time libraries
+set (CMAKE_C_FLAGS_INIT "-bt=nt -w3 -dWIN32 -br -bm")
+set (CMAKE_CXX_FLAGS_INIT "-bt=nt -xs -w3 -dWIN32 -br -bm")
+foreach(lang C CXX)
+ set (CMAKE_${lang}_FLAGS_DEBUG_INIT "-d2")
+ set (CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-s -os -d0 -dNDEBUG")
+ set (CMAKE_${lang}_FLAGS_RELEASE_INIT "-s -ot -d0 -dNDEBUG")
+ set (CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-s -ot -d1 -dNDEBUG")
+endforeach()
+
+foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE)
+ set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1)
+ set(CMAKE_CXX_${type}_USE_WATCOM_QUOTE 1)
+endforeach()
set(CMAKE_C_CREATE_IMPORT_LIBRARY
- "wlib -c -q -n -b <TARGET_IMPLIB> +'<TARGET_UNQUOTED>'")
+ "wlib -c -q -n -b <TARGET_IMPLIB> +<TARGET_QUOTED>")
set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY})
set(CMAKE_C_LINK_EXECUTABLE
- "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+ "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE})
# compile a C++ file into an object file
set(CMAKE_CXX_COMPILE_OBJECT
- "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
# compile a C file into an object file
set(CMAKE_C_COMPILE_OBJECT
- "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}")
# preprocess a C source file
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE
- "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>${CMAKE_END_TEMP_FILE}")
# preprocess a C++ source file
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE
- "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
-set(CMAKE_CXX_CREATE_SHARED_MODULE
- "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
- ${CMAKE_CXX_CREATE_SHARED_MODULE}
- ${CMAKE_CXX_CREATE_IMPORT_LIBRARY})
+ "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> option implib=<TARGET_IMPLIB> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+string(REPLACE " option implib=<TARGET_IMPLIB>" ""
+ CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
# create a C shared library
set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
@@ -78,7 +84,7 @@ set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE})
# create a C++ static library
-set(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b '<TARGET_UNQUOTED>' <LINK_FLAGS> <OBJECTS> ")
+set(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b <TARGET_QUOTED> <LINK_FLAGS> <OBJECTS> ")
# create a C static library
set(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY})
@@ -87,23 +93,27 @@ if(NOT _CMAKE_WATCOM_VERSION)
set(_CMAKE_WATCOM_VERSION 1)
if(CMAKE_C_COMPILER_VERSION)
set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ set(_compiler_id ${CMAKE_C_COMPILER_ID})
else()
set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
+ set(_compiler_id ${CMAKE_CXX_COMPILER_ID})
endif()
set(WATCOM16)
set(WATCOM17)
set(WATCOM18)
set(WATCOM19)
- if("${_compiler_version}" LESS 12.70)
- set(WATCOM16 1)
- endif()
- if("${_compiler_version}" EQUAL 12.70)
- set(WATCOM17 1)
- endif()
- if("${_compiler_version}" EQUAL 12.80)
- set(WATCOM18 1)
- endif()
- if("${_compiler_version}" EQUAL 12.90)
- set(WATCOM19 1)
+ if("${_compiler_id}" STREQUAL "OpenWatcom")
+ if("${_compiler_version}" VERSION_LESS 1.7)
+ set(WATCOM16 1)
+ endif()
+ if("${_compiler_version}" VERSION_EQUAL 1.7)
+ set(WATCOM17 1)
+ endif()
+ if("${_compiler_version}" VERSION_EQUAL 1.8)
+ set(WATCOM18 1)
+ endif()
+ if("${_compiler_version}" VERSION_EQUAL 1.9)
+ set(WATCOM19 1)
+ endif()
endif()
endif()
diff --git a/Modules/Platform/Windows-windres.cmake b/Modules/Platform/Windows-windres.cmake
index 01d6be3df..7d787dddf 100644
--- a/Modules/Platform/Windows-windres.cmake
+++ b/Modules/Platform/Windows-windres.cmake
@@ -1 +1 @@
-set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <FLAGS> <DEFINES> <SOURCE> <OBJECT>")
+set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <DEFINES> <INCLUDES> <FLAGS> <SOURCE> <OBJECT>")
diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake
index b158a9dfb..9a937a7e8 100644
--- a/Modules/Platform/Windows.cmake
+++ b/Modules/Platform/Windows.cmake
@@ -1,5 +1,13 @@
set(WIN32 1)
+if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE")
+ set(WINCE 1)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
+ set(WINDOWS_PHONE 1)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set(WINDOWS_STORE 1)
+endif()
+
set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib
diff --git a/Modules/Platform/WindowsCE-MSVC.cmake b/Modules/Platform/WindowsCE-MSVC.cmake
deleted file mode 100644
index d28b4aba0..000000000
--- a/Modules/Platform/WindowsCE-MSVC.cmake
+++ /dev/null
@@ -1 +0,0 @@
-include(Platform/Windows-MSVC)
diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake
index fc921d793..eafa8fa1d 100644
--- a/Modules/Platform/WindowsPaths.cmake
+++ b/Modules/Platform/WindowsPaths.cmake
@@ -28,56 +28,51 @@ set(__WINDOWS_PATHS_INCLUDED 1)
# Windows 64-bit Binary:
# ENV{ProgramFiles(x86)} = [C:\Program Files (x86)]
# ENV{ProgramFiles} = [C:\Program Files]
-# ENV{ProgramW6432} = <not set>
-# (executed from cygwin):
-# ENV{ProgramFiles(x86)} = <not set>
-# ENV{ProgramFiles} = [C:\Program Files]
-# ENV{ProgramW6432} = <not set>
+# ENV{ProgramW6432} = [C:\Program Files] or <not set>
#
-# Windows 32-bit Binary:
+# Windows 32-bit Binary on 64-bit Windows:
# ENV{ProgramFiles(x86)} = [C:\Program Files (x86)]
# ENV{ProgramFiles} = [C:\Program Files (x86)]
# ENV{ProgramW6432} = [C:\Program Files]
-# (executed from cygwin):
-# ENV{ProgramFiles(x86)} = <not set>
-# ENV{ProgramFiles} = [C:\Program Files (x86)]
-# ENV{ProgramW6432} = [C:\Program Files]
-if(DEFINED "ENV{ProgramW6432}")
- # 32-bit binary on 64-bit windows.
- # The 64-bit program files are in ProgramW6432.
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramW6432}")
-
- # The 32-bit program files are in ProgramFiles.
- if(DEFINED "ENV{ProgramFiles}")
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}")
+set(_programfiles "")
+foreach(v "ProgramW6432" "ProgramFiles" "ProgramFiles(x86)")
+ if(DEFINED "ENV{${v}}")
+ file(TO_CMAKE_PATH "$ENV{${v}}" _env_programfiles)
+ list(APPEND _programfiles "${_env_programfiles}")
+ unset(_env_programfiles)
endif()
-else()
- # 64-bit binary, or 32-bit binary on 32-bit windows.
- if(DEFINED "ENV{ProgramFiles}")
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}")
- endif()
- if(DEFINED "ENV{ProgramFiles(x86)}")
- # 64-bit binary. 32-bit program files are in ProgramFiles(x86).
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles(x86)}")
- elseif(DEFINED "ENV{SystemDrive}")
- # Guess the 32-bit program files location.
- if(EXISTS "$ENV{SystemDrive}/Program Files (x86)")
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH
- "$ENV{SystemDrive}/Program Files (x86)")
+endforeach()
+if(DEFINED "ENV{SystemDrive}")
+ foreach(d "Program Files" "Program Files (x86)")
+ if(EXISTS "$ENV{SystemDrive}/${d}")
+ list(APPEND _programfiles "$ENV{SystemDrive}/${d}")
endif()
- endif()
+ endforeach()
+endif()
+if(_programfiles)
+ list(REMOVE_DUPLICATES _programfiles)
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_programfiles})
endif()
+unset(_programfiles)
# Add the CMake install location.
get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH)
get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}")
-# Add other locations.
-list(APPEND CMAKE_SYSTEM_PREFIX_PATH
- # Project install destination.
- "${CMAKE_INSTALL_PREFIX}"
- )
+if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
+ # Add other locations.
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ # Project install destination.
+ "${CMAKE_INSTALL_PREFIX}"
+ )
+ if (CMAKE_STAGING_PREFIX)
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ # User-supplied staging prefix.
+ "${CMAKE_STAGING_PREFIX}"
+ )
+ endif()
+endif()
if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
# MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set)
@@ -88,8 +83,17 @@ list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
)
# mingw can also link against dlls which can also be in /bin, so list this too
+if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
+ list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+ "${CMAKE_INSTALL_PREFIX}/bin"
+ )
+ if (CMAKE_STAGING_PREFIX)
+ list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+ "${CMAKE_STAGING_PREFIX}/bin"
+ )
+ endif()
+endif()
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
- "${CMAKE_INSTALL_PREFIX}/bin"
"${_CMAKE_INSTALL_DIR}/bin"
/bin
)
diff --git a/Modules/Platform/WindowsPhone-MSVC-C.cmake b/Modules/Platform/WindowsPhone-MSVC-C.cmake
new file mode 100644
index 000000000..ce8060bed
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-MSVC-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-C)
diff --git a/Modules/Platform/WindowsPhone-MSVC-CXX.cmake b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake
new file mode 100644
index 000000000..281eadc10
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-CXX)
diff --git a/Modules/Platform/WindowsPhone.cmake b/Modules/Platform/WindowsPhone.cmake
new file mode 100644
index 000000000..65b2eaed4
--- /dev/null
+++ b/Modules/Platform/WindowsPhone.cmake
@@ -0,0 +1 @@
+include(Platform/Windows)
diff --git a/Modules/Platform/WindowsStore-MSVC-C.cmake b/Modules/Platform/WindowsStore-MSVC-C.cmake
new file mode 100644
index 000000000..ce8060bed
--- /dev/null
+++ b/Modules/Platform/WindowsStore-MSVC-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-C)
diff --git a/Modules/Platform/WindowsStore-MSVC-CXX.cmake b/Modules/Platform/WindowsStore-MSVC-CXX.cmake
new file mode 100644
index 000000000..281eadc10
--- /dev/null
+++ b/Modules/Platform/WindowsStore-MSVC-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-CXX)
diff --git a/Modules/Platform/WindowsStore.cmake b/Modules/Platform/WindowsStore.cmake
new file mode 100644
index 000000000..65b2eaed4
--- /dev/null
+++ b/Modules/Platform/WindowsStore.cmake
@@ -0,0 +1 @@
+include(Platform/Windows)
diff --git a/Modules/Platform/eCos.cmake b/Modules/Platform/eCos.cmake
index a20382692..e1279ef22 100644
--- a/Modules/Platform/eCos.cmake
+++ b/Modules/Platform/eCos.cmake
@@ -28,7 +28,7 @@ include(Platform/UnixPaths)
# eCos can be built only with gcc
get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
-if(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC)
+if(CMAKE_C_COMPILER AND NOT CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT _IN_TC)
message(FATAL_ERROR "GNU gcc is required for eCos")
endif()
if(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC)
diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index 0d1dfda16..2c5d5aeb1 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -1,30 +1,41 @@
-# - ProcessorCount(var)
+#.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, Mac OS X, QNX, Sun and Windows.
+# 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, Mac OS X, 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.
+# 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()
+# ::
+#
+# 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.
+#
+#
+# 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
@@ -92,7 +103,23 @@ function(ProcessorCount var)
OUTPUT_VARIABLE machinfo_output)
string(REGEX MATCHALL "Number of CPUs = ([0-9]+)" procs "${machinfo_output}")
set(count "${CMAKE_MATCH_1}")
+ if(NOT count)
+ string(REGEX MATCHALL "([0-9]+) logical processors" procs "${machinfo_output}")
+ set(count "${CMAKE_MATCH_1}")
+ endif()
#message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'")
+ else()
+ find_program(ProcessorCount_cmd_mpsched mpsched)
+ mark_as_advanced(ProcessorCount_cmd_mpsched)
+ if(ProcessorCount_cmd_mpsched)
+ execute_process(COMMAND ${ProcessorCount_cmd_mpsched} -s
+ OUTPUT_QUIET
+ ERROR_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE mpsched_output)
+ string(REGEX MATCHALL "Processor Count *: *([0-9]+)" procs "${mpsched_output}")
+ set(count "${CMAKE_MATCH_1}")
+ #message("ProcessorCount: trying mpsched -s '${ProcessorCount_cmd_mpsched}'")
+ endif()
endif()
endif()
@@ -144,17 +171,30 @@ function(ProcessorCount var)
endif()
if(NOT count)
- # Sun (systems where uname -X emits "NumCPU" in its output):
- find_program(ProcessorCount_cmd_uname uname)
- mark_as_advanced(ProcessorCount_cmd_uname)
- if(ProcessorCount_cmd_uname)
- execute_process(COMMAND ${ProcessorCount_cmd_uname} -X
+ # Sun (systems where psrinfo tool is available)
+ find_program(ProcessorCount_cmd_psrinfo psrinfo PATHS /usr/sbin /sbin)
+ mark_as_advanced(ProcessorCount_cmd_psrinfo)
+ if (ProcessorCount_cmd_psrinfo)
+ execute_process(COMMAND ${ProcessorCount_cmd_psrinfo} -p -v
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
- OUTPUT_VARIABLE uname_X_output)
- string(REGEX MATCHALL "NumCPU = ([0-9]+)" procs "${uname_X_output}")
+ OUTPUT_VARIABLE psrinfo_output)
+ string(REGEX MATCH "([0-9]+) virtual processor" procs "${psrinfo_output}")
set(count "${CMAKE_MATCH_1}")
- #message("ProcessorCount: trying uname -X '${ProcessorCount_cmd_uname}'")
+ #message("ProcessorCount: trying psrinfo -p -v '${ProcessorCount_cmd_prvinfo}'")
+ else()
+ # Sun (systems where uname -X emits "NumCPU" in its output):
+ find_program(ProcessorCount_cmd_uname uname)
+ mark_as_advanced(ProcessorCount_cmd_uname)
+ if(ProcessorCount_cmd_uname)
+ execute_process(COMMAND ${ProcessorCount_cmd_uname} -X
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE uname_X_output)
+ string(REGEX MATCHALL "NumCPU = ([0-9]+)" procs "${uname_X_output}")
+ set(count "${CMAKE_MATCH_1}")
+ #message("ProcessorCount: trying uname -X '${ProcessorCount_cmd_uname}'")
+ endif()
endif()
endif()
@@ -171,6 +211,20 @@ function(ProcessorCount var)
endif()
endif()
+ if(NOT count)
+ # Haiku
+ find_program(ProcessorCount_cmd_sysinfo sysinfo)
+ if(ProcessorCount_cmd_sysinfo)
+ execute_process(COMMAND ${ProcessorCount_cmd_sysinfo}
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE sysinfo_X_output)
+ string(REGEX MATCHALL "\nCPU #[0-9]+:" procs "\n${sysinfo_X_output}")
+ list(LENGTH procs count)
+ #message("ProcessorCount: trying sysinfo '${ProcessorCount_cmd_sysinfo}'")
+ endif()
+ endif()
+
# Since cygwin builds of CMake do not define WIN32 anymore, but they still
# run on Windows, and will still have this env var defined:
#
diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake
index 88dc8ec5d..03fb8449a 100644
--- a/Modules/Qt4ConfigDependentSettings.cmake
+++ b/Modules/Qt4ConfigDependentSettings.cmake
@@ -1,3 +1,9 @@
+#.rst:
+# Qt4ConfigDependentSettings
+# --------------------------
+#
+#
+#
# This file is included by FindQt4.cmake, don't include it directly.
#=============================================================================
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index f1aedd743..3b0a6cc26 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -1,3 +1,9 @@
+#.rst:
+# Qt4Macros
+# ---------
+#
+#
+#
# This file is included by FindQt4.cmake, don't include it directly.
#=============================================================================
@@ -59,8 +65,8 @@ macro (QT4_MAKE_OUTPUT_FILE infile prefix ext outfile )
else()
file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
endif()
- if(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path
- string(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}")
+ if(WIN32 AND rel MATCHES "^([a-zA-Z]):(.*)$") # absolute path
+ set(rel "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
endif()
set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
string(REPLACE ".." "__" _outfile ${_outfile})
@@ -97,7 +103,7 @@ endmacro()
# helper macro to set up a moc rule
-macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target)
+function (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target)
# For Windows, create a parameters file to work around command line length limit
# Pass the parameters in a file. Set the working directory to
# be that containing the parameters file and reference it by
@@ -114,6 +120,7 @@ macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target)
string (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
if(moc_target)
+ set (_moc_parameters_file ${_moc_parameters_file}$<$<BOOL:$<CONFIGURATION>>:_$<CONFIGURATION>>)
set(targetincludes "$<TARGET_PROPERTY:${moc_target},INCLUDE_DIRECTORIES>")
set(targetdefines "$<TARGET_PROPERTY:${moc_target},COMPILE_DEFINITIONS>")
@@ -128,16 +135,18 @@ macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target)
set(targetincludes)
set(targetdefines)
else()
- file(WRITE ${_moc_parameters_file} "${_moc_parameters}\n")
+ set(CMAKE_CONFIGURABLE_FILE_CONTENT "${_moc_parameters}")
+ configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
+ "${_moc_parameters_file}" @ONLY)
endif()
set(_moc_extra_parameters_file @${_moc_parameters_file})
add_custom_command(OUTPUT ${outfile}
- COMMAND ${QT_MOC_EXECUTABLE} ${_moc_extra_parameters_file}
- DEPENDS ${infile}
+ COMMAND Qt4::moc ${_moc_extra_parameters_file}
+ DEPENDS ${infile} ${_moc_parameters_file}
${_moc_working_dir}
VERBATIM)
-endmacro ()
+endfunction ()
macro (QT4_GENERATE_MOC infile outfile )
@@ -149,7 +158,7 @@ macro (QT4_GENERATE_MOC infile outfile )
set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
endif()
- if ("x${ARGV2}" STREQUAL "xTARGET")
+ if (${ARGC} GREATER 3 AND "x${ARGV2}" STREQUAL "xTARGET")
set(moc_target ${ARGV3})
endif()
QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}")
@@ -184,7 +193,7 @@ macro (QT4_WRAP_UI outfiles )
get_filename_component(infile ${it} ABSOLUTE)
set(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
add_custom_command(OUTPUT ${outfile}
- COMMAND ${QT_UIC_EXECUTABLE}
+ COMMAND Qt4::uic
ARGS ${ui_options} -o ${outfile} ${infile}
MAIN_DEPENDENCY ${infile} VERBATIM)
set(${outfiles} ${${outfiles}} ${outfile})
@@ -223,7 +232,7 @@ macro (QT4_ADD_RESOURCES outfiles )
# let's make a configured file and add it as a dependency so cmake is run
# again when dependencies need to be recomputed.
QT4_MAKE_OUTPUT_FILE("${infile}" "" "qrc.depends" out_depends)
- configure_file("${infile}" "${out_depends}" COPY_ONLY)
+ configure_file("${infile}" "${out_depends}" COPYONLY)
else()
# The .qrc file does not exist (yet). Let's add a dependency and hope
# that it will be generated later
@@ -231,7 +240,7 @@ macro (QT4_ADD_RESOURCES outfiles )
endif()
add_custom_command(OUTPUT ${outfile}
- COMMAND ${QT_RCC_EXECUTABLE}
+ COMMAND Qt4::rcc
ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
MAIN_DEPENDENCY ${infile}
DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM)
@@ -265,7 +274,7 @@ macro(QT4_ADD_DBUS_INTERFACE _sources _interface _basename)
endif()
add_custom_command(OUTPUT "${_impl}" "${_header}"
- COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile}
+ COMMAND Qt4::qdbusxml2cpp ${_params} -p ${_basename} ${_infile}
DEPENDS ${_infile} VERBATIM)
set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE)
@@ -311,7 +320,7 @@ macro(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options
endif ()
add_custom_command(OUTPUT ${_target}
- COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_qt4_dbus_options} ${_in_file} -o ${_target}
+ COMMAND Qt4::qdbuscpp2xml ${_qt4_dbus_options} ${_in_file} -o ${_target}
DEPENDS ${_in_file} VERBATIM
)
endmacro()
@@ -320,7 +329,10 @@ endmacro()
macro(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName)
get_filename_component(_infile ${_xml_file} ABSOLUTE)
- set(_optionalBasename "${ARGV4}")
+ unset(_optionalBasename)
+ if(${ARGC} GREATER 4)
+ set(_optionalBasename "${ARGV4}")
+ endif()
if (_optionalBasename)
set(_basename ${_optionalBasename} )
else ()
@@ -328,19 +340,22 @@ macro(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optional
string(TOLOWER ${_basename} _basename)
endif ()
- set(_optionalClassName "${ARGV5}")
+ unset(_optionalClassName)
+ if(${ARGC} GREATER 5)
+ set(_optionalClassName "${ARGV5}")
+ endif()
set(_header "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h")
set(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp")
set(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc")
if(_optionalClassName)
add_custom_command(OUTPUT "${_impl}" "${_header}"
- COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile}
+ COMMAND Qt4::qdbusxml2cpp -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile}
DEPENDS ${_infile} VERBATIM
)
else()
add_custom_command(OUTPUT "${_impl}" "${_header}"
- COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile}
+ COMMAND Qt4::qdbusxml2cpp -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile}
DEPENDS ${_infile} VERBATIM
)
endif()
@@ -355,15 +370,7 @@ endmacro()
macro(QT4_AUTOMOC)
if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11)
- if(CMAKE_WARN_DEPRECATED)
- set(messageType WARNING)
- endif()
- if(CMAKE_ERROR_DEPRECATED)
- set(messageType FATAL_ERROR)
- endif()
- if(messageType)
- message(${messageType} "The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.")
- endif()
+ message(DEPRECATION "The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.")
endif()
QT4_GET_MOC_FLAGS(_moc_INCS)
@@ -434,18 +441,19 @@ macro(QT4_CREATE_TRANSLATION _qm_files)
set(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro)
set(_pro_srcs)
foreach(_pro_src ${_my_sources})
- set(_pro_srcs "${_pro_srcs} \"${_pro_src}\"")
+ set(_pro_srcs "${_pro_srcs} \\\n \"${_pro_src}\"")
endforeach()
set(_pro_includes)
get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES)
+ list(REMOVE_DUPLICATES _inc_DIRS)
foreach(_pro_include ${_inc_DIRS})
get_filename_component(_abs_include "${_pro_include}" ABSOLUTE)
- set(_pro_includes "${_pro_includes} \"${_abs_include}\"")
+ set(_pro_includes "${_pro_includes} \\\n \"${_abs_include}\"")
endforeach()
- file(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}\nINCLUDEPATH = ${_pro_includes}\n")
+ file(WRITE ${_ts_pro} "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n")
endif()
add_custom_command(OUTPUT ${_ts_file}
- COMMAND ${QT_LUPDATE_EXECUTABLE}
+ COMMAND Qt4::lupdate
ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file}
DEPENDS ${_my_sources} ${_ts_pro} VERBATIM)
endforeach()
@@ -466,7 +474,7 @@ macro(QT4_ADD_TRANSLATION _qm_files)
endif()
add_custom_command(OUTPUT ${qm}
- COMMAND ${QT_LRELEASE_EXECUTABLE}
+ COMMAND Qt4::lrelease
ARGS ${_abs_FILE} -qm ${qm}
DEPENDS ${_abs_FILE} VERBATIM
)
@@ -476,15 +484,7 @@ endmacro()
function(qt4_use_modules _target _link_type)
if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11)
- if(CMAKE_WARN_DEPRECATED)
- set(messageType WARNING)
- endif()
- if(CMAKE_ERROR_DEPRECATED)
- set(messageType FATAL_ERROR)
- endif()
- if(messageType)
- message(${messageType} "The qt4_use_modules function is obsolete. Use target_link_libraries with IMPORTED targets instead.")
- endif()
+ message(DEPRECATION "The qt4_use_modules function is obsolete. Use target_link_libraries with IMPORTED targets instead.")
endif()
if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE")
set(modules ${ARGN})
diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake
index 297e1d3bd..d7108562b 100644
--- a/Modules/SelectLibraryConfigurations.cmake
+++ b/Modules/SelectLibraryConfigurations.cmake
@@ -1,20 +1,28 @@
+#.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.
+# 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.
+# 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.
#=============================================================================
# Copyright 2009 Will Dicharry <wdicharry@stellarscience.com>
diff --git a/Modules/Squish4RunTestCase.sh b/Modules/Squish4RunTestCase.sh
index abd5debd2..39a390733 100755
--- a/Modules/Squish4RunTestCase.sh
+++ b/Modules/Squish4RunTestCase.sh
@@ -11,11 +11,11 @@ SETTINGSGROUP=$7
$SQUISHSERVER --stop > /dev/null 2>&1
echo "Adding AUT... $SQUISHSERVER --settingsGroup $SETTINGSGROUP --config addAUT $AUT $AUTDIR"
-$SQUISHSERVER --settingsGroup "$SETTINGSGROUP" --config addAUT "$AUT" "$AUTDIR" || exit -1
+$SQUISHSERVER --settingsGroup "$SETTINGSGROUP" --config addAUT "$AUT" "$AUTDIR" || exit 255
# sleep 1
echo "Starting the squish server... $SQUISHSERVER --daemon"
-$SQUISHSERVER --daemon || exit -1
+$SQUISHSERVER --daemon || exit 255
# sleep 2
echo "Running the test case...$SQUISHRUNNER --settingsGroup $SETTINGSGROUP --testsuite $TESTSUITE --testcase $TESTCASE"
diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake
index f794b3eee..d6487499e 100644
--- a/Modules/SquishTestScript.cmake
+++ b/Modules/SquishTestScript.cmake
@@ -1,13 +1,18 @@
+#.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.
#
+#
+#
+# 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.
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake
index 193df8fda..fcb41abe1 100644
--- a/Modules/TestBigEndian.cmake
+++ b/Modules/TestBigEndian.cmake
@@ -1,8 +1,15 @@
-# - Define macro to determine endian type
+#.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
#
+# ::
+#
+# TEST_BIG_ENDIAN(VARIABLE)
+# VARIABLE - variable to store the result to
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -18,7 +25,7 @@
# License text for the above reference.)
macro(TEST_BIG_ENDIAN VARIABLE)
- if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+ if(NOT DEFINED HAVE_${VARIABLE})
message(STATUS "Check if the system is big endian")
message(STATUS "Searching 16 bit integer")
@@ -51,7 +58,7 @@ macro(TEST_BIG_ENDIAN VARIABLE)
configure_file("${CMAKE_ROOT}/Modules/TestEndianess.c.in"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c"
- IMMEDIATE @ONLY)
+ @ONLY)
file(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c"
TEST_ENDIANESS_FILE_CONTENT)
diff --git a/Modules/TestCXXAcceptsFlag.cmake b/Modules/TestCXXAcceptsFlag.cmake
index 2694737ef..c814187d5 100644
--- a/Modules/TestCXXAcceptsFlag.cmake
+++ b/Modules/TestCXXAcceptsFlag.cmake
@@ -1,11 +1,19 @@
-# - Test CXX compiler for a flag
-# Check if the CXX compiler accepts a flag
+#.rst:
+# TestCXXAcceptsFlag
+# ------------------
#
-# Macro CHECK_CXX_ACCEPTS_FLAG(FLAGS VARIABLE) -
-# checks if the function exists
-# FLAGS - the flags to try
-# VARIABLE - variable to store the result
+# 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
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
diff --git a/Modules/TestForANSIForScope.cmake b/Modules/TestForANSIForScope.cmake
index 9b4d51cda..78fff9f74 100644
--- a/Modules/TestForANSIForScope.cmake
+++ b/Modules/TestForANSIForScope.cmake
@@ -1,7 +1,15 @@
-# - 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
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -16,7 +24,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-if("CMAKE_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$")
+if(NOT DEFINED CMAKE_ANSI_FOR_SCOPE)
message(STATUS "Check for ANSI scope")
try_compile(CMAKE_ANSI_FOR_SCOPE ${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx
diff --git a/Modules/TestForANSIStreamHeaders.cmake b/Modules/TestForANSIStreamHeaders.cmake
index 060b3a43a..c13000b70 100644
--- a/Modules/TestForANSIStreamHeaders.cmake
+++ b/Modules/TestForANSIStreamHeaders.cmake
@@ -1,7 +1,15 @@
-# - 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
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
diff --git a/Modules/TestForSSTREAM.cmake b/Modules/TestForSSTREAM.cmake
index db39c1e70..fe18ea2a7 100644
--- a/Modules/TestForSSTREAM.cmake
+++ b/Modules/TestForSSTREAM.cmake
@@ -1,7 +1,14 @@
-# - Test for compiler support of ANSI sstream header
+#.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
#
+# ::
+#
+# CMAKE_NO_ANSI_STRING_STREAM - defined by the results
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -16,7 +23,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-if("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$")
+if(NOT DEFINED CMAKE_HAS_ANSI_STRING_STREAM)
message(STATUS "Check for sstream")
try_compile(CMAKE_HAS_ANSI_STRING_STREAM ${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/TestForSSTREAM.cxx
diff --git a/Modules/TestForSTDNamespace.cmake b/Modules/TestForSTDNamespace.cmake
index 6a7564445..0d907744a 100644
--- a/Modules/TestForSTDNamespace.cmake
+++ b/Modules/TestForSTDNamespace.cmake
@@ -1,7 +1,14 @@
-# - Test for std:: namespace support
+#.rst:
+# TestForSTDNamespace
+# -------------------
+#
+# Test for std:: namespace support
+#
# check if the compiler supports std:: on stl classes
-# CMAKE_NO_STD_NAMESPACE - defined by the results
#
+# ::
+#
+# CMAKE_NO_STD_NAMESPACE - defined by the results
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -16,7 +23,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-if("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$")
+if(NOT DEFINED CMAKE_STD_NAMESPACE)
message(STATUS "Check for STD namespace")
try_compile(CMAKE_STD_NAMESPACE ${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx
diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake
index 0c4fee4e1..3bd92ca23 100644
--- a/Modules/UseEcos.cmake
+++ b/Modules/UseEcos.cmake
@@ -1,20 +1,29 @@
-# - This module defines variables and macros required to build eCos application.
+#.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
+# 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:
#
-# 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
+# ECOS_ADD_TARGET_LIB
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index c0fd07cbd..475ad5ee0 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -1,193 +1,373 @@
-# - 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]
-# )
-#
-# 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. 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).
+#.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]
+# )
+#
+# 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.
#
# 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 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 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:
+# To define a custom manifest for the jar, you can set it with the manifest
+# named argument:
#
-# 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 MANIFEST /path/to/manifest)
#
-# add_jar(example ENTRY_POINT com/examples/MyProject/Main)
#
-# 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:
+# 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.
#
-# 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)
+# ::
+#
+# 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)
+#
#
-# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar)
-# add_jar(bar bar.java)
#
# Target Properties:
-# The add_jar() functions 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.
-# CLASS_DIR 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)
+#
+# ::
+#
+# The add_jar() functions 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.
#
-# install_jni_symlink(TARGET_NAME DESTINATION)
+# ::
+#
+# 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.
-#
-# 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]
-# )
+# DESTINATION. It should be called in the same scope as add_jar() or it
+# will fail.
+#
+# ::
+#
+# 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
+# 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.exmaple.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
-# )
+# 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.exmaple.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]
-# )
+# ::
+#
+# 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.
+#
+# ::
+#
+# 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>
+# ::
+#
+# ${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.
+#
+# There are two main signatures for create_javah. The first signature
+# returns generated files throught 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.
#=============================================================================
# Copyright 2013 OpenGamma Ltd. <graham@opengamma.com>
@@ -222,6 +402,13 @@ set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake)
function(add_jar _TARGET_NAME)
+ cmake_parse_arguments(_add_jar
+ ""
+ "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST"
+ "SOURCES;INCLUDE_JARS"
+ ${ARGN}
+ )
+
# In CMake < 2.8.12, add_jar used variables which were set prior to calling
# add_jar for customizing the behavior of add_jar. In order to be backwards
# compatible, check if any of those variables are set, and use them to
@@ -229,28 +416,21 @@ function(add_jar _TARGET_NAME)
# argument will override the value set here.)
#
# New features should use named arguments only.
- if(DEFINED CMAKE_JAVA_TARGET_VERSION)
+ if(NOT DEFINED _add_jar_VERSION AND DEFINED CMAKE_JAVA_TARGET_VERSION)
set(_add_jar_VERSION "${CMAKE_JAVA_TARGET_VERSION}")
endif()
- if(DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR)
+ if(NOT DEFINED _add_jar_OUTPUT_DIR AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR)
set(_add_jar_OUTPUT_DIR "${CMAKE_JAVA_TARGET_OUTPUT_DIR}")
endif()
- if(DEFINED CMAKE_JAVA_TARGET_OUTPUT_NAME)
+ if(NOT DEFINED _add_jar_OUTPUT_NAME AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_NAME)
set(_add_jar_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}")
# reset
set(CMAKE_JAVA_TARGET_OUTPUT_NAME)
endif()
- if(DEFINED CMAKE_JAVA_JAR_ENTRY_POINT)
+ if(NOT DEFINED _add_jar_ENTRY_POINT AND DEFINED CMAKE_JAVA_JAR_ENTRY_POINT)
set(_add_jar_ENTRY_POINT "${CMAKE_JAVA_JAR_ENTRY_POINT}")
endif()
- cmake_parse_arguments(_add_jar
- ""
- "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT"
- "SOURCES;INCLUDE_JARS"
- ${ARGN}
- )
-
set(_JAVA_SOURCE_FILES ${_add_jar_SOURCES} ${_add_jar_UNPARSED_ARGUMENTS})
if (NOT DEFINED _add_jar_OUTPUT_DIR)
@@ -262,6 +442,11 @@ function(add_jar _TARGET_NAME)
set(_ENTRY_POINT_VALUE ${_add_jar_ENTRY_POINT})
endif ()
+ if (_add_jar_MANIFEST)
+ set(_MANIFEST_OPTION m)
+ get_filename_component (_MANIFEST_VALUE "${_add_jar_MANIFEST}" ABSOLUTE)
+ endif ()
+
if (LIBRARY_OUTPUT_PATH)
set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
else ()
@@ -275,7 +460,7 @@ function(add_jar _TARGET_NAME)
${CMAKE_JAVA_LIBRARY_OUTPUT_PATH}
)
- if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+ if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
else ()
set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
@@ -300,16 +485,22 @@ function(add_jar _TARGET_NAME)
set(_JAVA_CLASS_FILES)
set(_JAVA_COMPILE_FILES)
+ set(_JAVA_COMPILE_FILELISTS)
set(_JAVA_DEPENDS)
set(_JAVA_COMPILE_DEPENDS)
set(_JAVA_RESOURCE_FILES)
+ set(_JAVA_RESOURCE_FILES_RELATIVE)
foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES})
get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT)
get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE)
get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH)
get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE)
- if (_JAVA_EXT MATCHES ".java")
+ if (_JAVA_SOURCE_FILE MATCHES "^@(.+)$")
+ get_filename_component(_JAVA_FULL ${CMAKE_MATCH_1} ABSOLUTE)
+ list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL})
+
+ elseif (_JAVA_EXT MATCHES ".java")
file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL})
file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
@@ -339,7 +530,8 @@ function(add_jar _TARGET_NAME)
__java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE}
${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE}
"Copying ${_JAVA_SOURCE_FILE} to the build directory")
- list(APPEND _JAVA_RESOURCE_FILES ${_JAVA_SOURCE_FILE})
+ list(APPEND _JAVA_RESOURCE_FILES ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE})
+ list(APPEND _JAVA_RESOURCE_FILES_RELATIVE ${_JAVA_SOURCE_FILE})
endif ()
endforeach()
@@ -367,11 +559,21 @@ function(add_jar _TARGET_NAME)
file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "")
endif()
- if (_JAVA_COMPILE_FILES)
- # Create the list of files to compile.
- set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources)
- string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"")
- file(WRITE ${_JAVA_SOURCES_FILE} ${_JAVA_COMPILE_STRING})
+ if (_JAVA_COMPILE_FILES OR _JAVA_COMPILE_FILELISTS)
+ set (_JAVA_SOURCES_FILELISTS)
+
+ if (_JAVA_COMPILE_FILES)
+ # Create the list of files to compile.
+ set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources)
+ string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"")
+ file(WRITE ${_JAVA_SOURCES_FILE} ${_JAVA_COMPILE_STRING})
+ list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_SOURCES_FILE}")
+ endif()
+ if (_JAVA_COMPILE_FILELISTS)
+ foreach (_JAVA_FILELIST IN LISTS _JAVA_COMPILE_FILELISTS)
+ list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_FILELIST}")
+ endforeach()
+ endif()
# Compile the java files and create a list of class files
add_custom_command(
@@ -381,9 +583,9 @@ function(add_jar _TARGET_NAME)
${CMAKE_JAVA_COMPILE_FLAGS}
-classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}"
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
- @${_JAVA_SOURCES_FILE}
+ ${_JAVA_SOURCES_FILELISTS}
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
- DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_DEPENDS}
+ DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILELISTS} ${_JAVA_COMPILE_DEPENDS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Building Java objects for ${_TARGET_NAME}.jar"
)
@@ -405,8 +607,8 @@ function(add_jar _TARGET_NAME)
add_custom_command(
OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE}
- -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE}
- ${_JAVA_RESOURCE_FILES} @java_class_filelist
+ -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE}
+ ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist
COMMAND ${CMAKE_COMMAND}
-D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR}
-D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}
@@ -425,8 +627,8 @@ function(add_jar _TARGET_NAME)
add_custom_command(
OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE}
- -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE}
- ${_JAVA_RESOURCE_FILES} @java_class_filelist
+ -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE}
+ ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist
COMMAND ${CMAKE_COMMAND}
-D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR}
-D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}
@@ -488,7 +690,26 @@ function(add_jar _TARGET_NAME)
endfunction()
-function(INSTALL_JAR _TARGET_NAME _DESTINATION)
+function(INSTALL_JAR _TARGET_NAME)
+ if (ARGC EQUAL 2)
+ set (_DESTINATION ${ARGV1})
+ else()
+ cmake_parse_arguments(_install_jar
+ ""
+ "DESTINATION;COMPONENT"
+ ""
+ ${ARGN})
+ if (_install_jar_DESTINATION)
+ set (_DESTINATION ${_install_jar_DESTINATION})
+ else()
+ message(SEND_ERROR "install_jar: ${_TARGET_NAME}: DESTINATION must be specified.")
+ endif()
+
+ if (_install_jar_COMPONENT)
+ set (_COMPONENT COMPONENT ${_install_jar_COMPONENT})
+ endif()
+ endif()
+
get_property(__FILES
TARGET
${_TARGET_NAME}
@@ -502,13 +723,33 @@ function(INSTALL_JAR _TARGET_NAME _DESTINATION)
${__FILES}
DESTINATION
${_DESTINATION}
+ ${_COMPONENT}
)
else ()
- message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.")
+ message(SEND_ERROR "install_jar: The target ${_TARGET_NAME} is not known in this scope.")
endif ()
endfunction()
-function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION)
+function(INSTALL_JNI_SYMLINK _TARGET_NAME)
+ if (ARGC EQUAL 2)
+ set (_DESTINATION ${ARGV1})
+ else()
+ cmake_parse_arguments(_install_jni_symlink
+ ""
+ "DESTINATION;COMPONENT"
+ ""
+ ${ARGN})
+ if (_install_jni_symlink_DESTINATION)
+ set (_DESTINATION ${_install_jni_symlink_DESTINATION})
+ else()
+ message(SEND_ERROR "install_jni_symlink: ${_TARGET_NAME}: DESTINATION must be specified.")
+ endif()
+
+ if (_install_jni_symlink_COMPONENT)
+ set (_COMPONENT COMPONENT ${_install_jni_symlink_COMPONENT})
+ endif()
+ endif()
+
get_property(__SYMLINK
TARGET
${_TARGET_NAME}
@@ -522,9 +763,10 @@ function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION)
${__SYMLINK}
DESTINATION
${_DESTINATION}
+ ${_COMPONENT}
)
else ()
- message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.")
+ message(SEND_ERROR "install_jni_symlink: The target ${_TARGET_NAME} is not known in this scope.")
endif ()
endfunction()
@@ -948,3 +1190,101 @@ function(create_javadoc _target)
DESTINATION ${_javadoc_installpath}
)
endfunction()
+
+function (create_javah)
+ cmake_parse_arguments(_create_javah
+ ""
+ "TARGET;GENERATED_FILES;OUTPUT_NAME;OUTPUT_DIR"
+ "CLASSES;CLASSPATH;DEPENDS"
+ ${ARGN})
+
+ # ckeck parameters
+ if (NOT _create_javah_TARGET AND NOT _create_javah_GENERATED_FILES)
+ message (FATAL_ERROR "create_javah: TARGET or GENERATED_FILES must be specified.")
+ endif()
+ if (_create_javah_OUTPUT_NAME AND _create_javah_OUTPUT_DIR)
+ message (FATAL_ERROR "create_javah: OUTPUT_NAME and OUTPUT_DIR are mutually exclusive.")
+ endif()
+
+ if (NOT _create_javah_CLASSES)
+ message (FATAL_ERROR "create_javah: CLASSES is a required parameter.")
+ endif()
+
+ set (_output_files)
+ if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+ set(_classpath_sep "$<SEMICOLON>")
+ else ()
+ set(_classpath_sep ":")
+ endif()
+
+ # handle javah options
+ set (_javah_options)
+
+ if (_create_javah_CLASSPATH)
+ # CLASSPATH can specify directories, jar files or targets created with add_jar command
+ set (_classpath)
+ foreach (_path IN LISTS _create_javah_CLASSPATH)
+ if (TARGET ${_path})
+ get_target_property (_jar_path ${_path} JAR_FILE)
+ if (_jar_path)
+ list (APPEND _classpath "${_jar_path}")
+ list (APPEND _create_javah_DEPENDS "${_path}")
+ else()
+ message(SEND_ERROR "create_javah: CLASSPATH target ${_path} is not a jar.")
+ endif()
+ elseif (EXISTS "${_path}")
+ list (APPEND _classpath "${_path}")
+ if (NOT IS_DIRECTORY "${_path}")
+ list (APPEND _create_javah_DEPENDS "${_path}")
+ endif()
+ else()
+ message(SEND_ERROR "create_javah: CLASSPATH entry ${_path} does not exist.")
+ endif()
+ endforeach()
+ string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}")
+ list (APPEND _javah_options -classpath "${_classpath}")
+ endif()
+
+ if (_create_javah_OUTPUT_DIR)
+ list (APPEND _javah_options -d "${_create_javah_OUTPUT_DIR}")
+ endif()
+
+ if (_create_javah_OUTPUT_NAME)
+ list (APPEND _javah_options -o "${_create_javah_OUTPUT_NAME}")
+ set (_output_files "${_create_javah_OUTPUT_NAME}")
+
+ get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_NAME}" DIRECTORY)
+ get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_DIR}" ABSOLUTE)
+ endif()
+
+ if (NOT _create_javah_OUTPUT_DIR)
+ set (_create_javah_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+ endif()
+
+ if (NOT _create_javah_OUTPUT_NAME)
+ # compute output names
+ foreach (_class IN LISTS _create_javah_CLASSES)
+ string (REPLACE "." "_" _c_header "${_class}")
+ set (_c_header "${_create_javah_OUTPUT_DIR}/${_c_header}.h")
+ list (APPEND _output_files "${_c_header}")
+ endforeach()
+ endif()
+
+ # finalize custom command arguments
+ if (_create_javah_DEPENDS)
+ list (INSERT _create_javah_DEPENDS 0 DEPENDS)
+ endif()
+
+ add_custom_command (OUTPUT ${_output_files}
+ COMMAND "${Java_JAVAH_EXECUTABLE}" ${_javah_options} -jni ${_create_javah_CLASSES}
+ ${_create_javah_DEPENDS}
+ WORKING_DIRECTORY ${_create_javah_OUTPUT_DIR}
+ COMMENT "Building C header files from classes...")
+
+ if (_create_javah_TARGET)
+ add_custom_target (${_create_javah_TARGET} ALL DEPENDS ${_output_files})
+ endif()
+ if (_create_javah_GENERATED_FILES)
+ set (${_create_javah_GENERATED_FILES} ${_output_files} PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Modules/UseJavaClassFilelist.cmake b/Modules/UseJavaClassFilelist.cmake
index 6f3a4e7a9..e8e6f014c 100644
--- a/Modules/UseJavaClassFilelist.cmake
+++ b/Modules/UseJavaClassFilelist.cmake
@@ -1,8 +1,14 @@
+#.rst:
+# UseJavaClassFilelist
+# --------------------
#
-# This script create a list of compiled Java class files to be added to a
-# jar file. This avoids including cmake files which get created in the
-# binary directory.
#
+#
+#
+#
+# This script 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.
#=============================================================================
# Copyright 2010-2011 Andreas schneider <asn@redhat.com>
diff --git a/Modules/UseJavaSymlinks.cmake b/Modules/UseJavaSymlinks.cmake
index 88dd7689c..90ffdd535 100644
--- a/Modules/UseJavaSymlinks.cmake
+++ b/Modules/UseJavaSymlinks.cmake
@@ -1,6 +1,12 @@
+#.rst:
+# UseJavaSymlinks
+# ---------------
+#
+#
#
-# Helper script for UseJava.cmake
#
+#
+# Helper script for UseJava.cmake
#=============================================================================
# Copyright 2010-2011 Andreas schneider <asn@redhat.com>
diff --git a/Modules/UsePkgConfig.cmake b/Modules/UsePkgConfig.cmake
index b1569f9da..6a38502ca 100644
--- a/Modules/UsePkgConfig.cmake
+++ b/Modules/UsePkgConfig.cmake
@@ -1,15 +1,21 @@
-# - Obsolete pkg-config module for CMake, use FindPkgConfig instead.
+#.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
+# 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
-#
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake
index f05a3d5f3..cba22af8c 100644
--- a/Modules/UseQt4.cmake
+++ b/Modules/UseQt4.cmake
@@ -1,7 +1,12 @@
-# - 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.
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
@@ -17,13 +22,7 @@
# License text for the above reference.)
add_definitions(${QT_DEFINITIONS})
-set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QT_DEBUG)
-set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
-set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG)
-set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG)
-if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
- set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG)
-endif()
+set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
if(QT_INCLUDE_DIRS_NO_SYSTEM)
include_directories(${QT_INCLUDE_DIR})
@@ -58,7 +57,7 @@ endif ()
# list dependent modules, so dependent libraries are added
set(QT_QT3SUPPORT_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE)
-set(QT_QTSVG_MODULE_DEPENDS QTGUI QTXML QTCORE)
+set(QT_QTSVG_MODULE_DEPENDS QTGUI QTCORE)
set(QT_QTUITOOLS_MODULE_DEPENDS QTGUI QTXML QTCORE)
set(QT_QTHELP_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE)
if(QT_QTDBUS_FOUND)
@@ -99,7 +98,9 @@ foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
include_directories(SYSTEM ${QT_${module}_INCLUDE_DIR})
endif(QT_INCLUDE_DIRS_NO_SYSTEM)
endif()
- set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
+ if(QT_USE_${module} OR QT_IS_STATIC)
+ set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
+ endif()
set(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS})
if(QT_IS_STATIC)
set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES})
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 2a095854c..d757f65f7 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -1,23 +1,48 @@
-# - SWIG module for CMake
-# Defines the following macros:
-# SWIG_ADD_MODULE(name language [ files ])
-# - Define swig module with given name and specified language
-# SWIG_LINK_LIBRARIES(name [ libraries ])
-# - Link libraries to swig module
-# All other macros are for internal use only.
-# To get the actual name of the swig module,
-# use: ${SWIG_MODULE_${name}_REAL_NAME}.
-# Set Source files properties such as CPLUSPLUS and SWIG_FLAGS to specify
-# special behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add
-# special flags to all swig calls.
+#.rst:
+# UseSWIG
+# -------
+#
+# Defines the following macros for use with SWIG:
+#
+# ::
+#
+# SWIG_ADD_MODULE(name language [ files ])
+# - Define swig module with given name and specified language
+# SWIG_LINK_LIBRARIES(name [ libraries ])
+# - Link libraries to swig module
+#
+# Source files properties on module files can be set before the invocation
+# of the SWIG_ADD_MODULE macro to specify special behavior of SWIG.
+#
+# The source file property CPLUSPLUS calls SWIG in c++ mode, e.g.::
+#
+# set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON)
+# swig_add_module(mymod python mymod.i)
+#
+# The source file property SWIG_FLAGS adds custom flags to the SWIG executable.
+#
+# The source-file property SWIG_MODULE_NAME have to be provided to specify the actual
+# import name of the module in the target language if it cannot be scanned automatically
+# from source or different from the module file basename.::
+#
+# set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname)
+#
+# To get the name of the swig module target library, use: ${SWIG_MODULE_${name}_REAL_NAME}.
+#
+# Also some variables can be set to specify special behavior of SWIG.
+#
+# CMAKE_SWIG_FLAGS can be used to add special flags to all swig calls.
+#
# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify
# where to write all the swig generated module (swig -outdir option)
-# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used
-# to specify extra dependencies for the generated modules.
-# If the source file generated by swig need some special flag you can use
-# set_source_files_properties( ${swig_generated_file_fullname}
-# PROPERTIES COMPILE_FLAGS "-bla")
-
+#
+# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used to specify extra
+# dependencies for the generated modules.
+#
+# If the source file generated by swig need some special flag you can use::
+#
+# set_source_files_properties( ${swig_generated_file_fullname}
+# PROPERTIES COMPILE_FLAGS "-bla")
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
@@ -48,15 +73,22 @@ macro(SWIG_MODULE_INITIALIZE name language)
set(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}")
set(SWIG_MODULE_${name}_REAL_NAME "${name}")
- if("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN")
+ if (";${CMAKE_SWIG_FLAGS};" MATCHES ";-noproxy;")
+ set (SWIG_MODULE_${name}_NOPROXY TRUE)
+ endif ()
+ if("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xUNKNOWN")
message(FATAL_ERROR "SWIG Error: Language \"${language}\" not found")
- elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PYTHON")
- # when swig is used without the -interface it will produce in the module.py
- # a 'import _modulename' statement, which implies having a corresponding
- # _modulename.so (*NIX), _modulename.pyd (Win32).
+ elseif("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xPYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY)
+ # swig will produce a module.py containing an 'import _modulename' statement,
+ # which implies having a corresponding _modulename.so (*NIX), _modulename.pyd (Win32),
+ # unless the -noproxy flag is used
set(SWIG_MODULE_${name}_REAL_NAME "_${name}")
- elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL")
+ elseif("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xPERL")
set(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow")
+ elseif("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xCSHARP")
+ # This makes sure that the name used in the generated DllImport
+ # matches the library name created by CMake
+ set(SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport;${name}")
endif()
endmacro()
@@ -70,7 +102,30 @@ macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
get_source_file_property(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename
${infile} SWIG_MODULE_NAME)
if(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND")
- get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE)
+
+ # try to get module name from "%module foo" syntax
+ if ( EXISTS ${infile} )
+ file ( STRINGS ${infile} _MODULE_NAME REGEX "[ ]*%module[ ]*[a-zA-Z0-9_]+.*" )
+ endif ()
+ if ( _MODULE_NAME )
+ string ( REGEX REPLACE "[ ]*%module[ ]*([a-zA-Z0-9_]+).*" "\\1" _MODULE_NAME "${_MODULE_NAME}" )
+ set(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${_MODULE_NAME}")
+
+ else ()
+ # try to get module name from "%module (options=...) foo" syntax
+ if ( EXISTS ${infile} )
+ file ( STRINGS ${infile} _MODULE_NAME REGEX "[ ]*%module[ ]*\\(.*\\)[ ]*[a-zA-Z0-9_]+.*" )
+ endif ()
+ if ( _MODULE_NAME )
+ string ( REGEX REPLACE "[ ]*%module[ ]*\\(.*\\)[ ]*([a-zA-Z0-9_]+).*" "\\1" _MODULE_NAME "${_MODULE_NAME}" )
+ set(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${_MODULE_NAME}")
+
+ else ()
+ # fallback to file basename
+ get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename ${infile} NAME_WE)
+ endif ()
+ endif ()
+
endif()
foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION})
set(${outfiles} ${${outfiles}}
@@ -83,7 +138,6 @@ endmacro()
#
macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
set(swig_full_infile ${infile})
- get_filename_component(swig_source_file_path "${infile}" PATH)
get_filename_component(swig_source_file_name_we "${infile}" NAME_WE)
get_source_file_property(swig_source_file_generated ${infile} GENERATED)
get_source_file_property(swig_source_file_cplusplus ${infile} CPLUSPLUS)
@@ -91,47 +145,22 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
if("${swig_source_file_flags}" STREQUAL "NOTFOUND")
set(swig_source_file_flags "")
endif()
- set(swig_source_file_fullname "${infile}")
- if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}")
- string(REGEX REPLACE
- "^${CMAKE_CURRENT_SOURCE_DIR}" ""
- swig_source_file_relative_path
- "${swig_source_file_path}")
- else()
- if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}")
- string(REGEX REPLACE
- "^${CMAKE_CURRENT_BINARY_DIR}" ""
- swig_source_file_relative_path
- "${swig_source_file_path}")
- set(swig_source_file_generated 1)
- else()
- set(swig_source_file_relative_path "${swig_source_file_path}")
- if(swig_source_file_generated)
- set(swig_source_file_fullname "${CMAKE_CURRENT_BINARY_DIR}/${infile}")
- else()
- set(swig_source_file_fullname "${CMAKE_CURRENT_SOURCE_DIR}/${infile}")
- endif()
- endif()
- endif()
+ get_filename_component(swig_source_file_fullname "${infile}" ABSOLUTE)
- set(swig_generated_file_fullname
- "${CMAKE_CURRENT_BINARY_DIR}")
- if(swig_source_file_relative_path)
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}/${swig_source_file_relative_path}")
- endif()
# If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
if(CMAKE_SWIG_OUTDIR)
set(swig_outdir ${CMAKE_SWIG_OUTDIR})
else()
set(swig_outdir ${CMAKE_CURRENT_BINARY_DIR})
endif()
- SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
- swig_extra_generated_files
- "${swig_outdir}"
- "${infile}")
+ if (NOT SWIG_MODULE_${name}_NOPROXY)
+ SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
+ swig_extra_generated_files
+ "${swig_outdir}"
+ "${swig_source_file_fullname}")
+ endif()
set(swig_generated_file_fullname
- "${swig_generated_file_fullname}/${swig_source_file_name_we}")
+ "${swig_outdir}/${swig_source_file_name_we}")
# add the language into the name of the file (i.e. TCL_wrap)
# this allows for the same .i file to be wrapped into different languages
set(swig_generated_file_fullname
@@ -148,6 +177,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
#message("Full path to source file: ${swig_source_file_fullname}")
#message("Full path to the output file: ${swig_generated_file_fullname}")
get_directory_property(cmake_include_directories INCLUDE_DIRECTORIES)
+ list(REMOVE_DUPLICATES cmake_include_directories)
set(swig_include_dirs)
foreach(it ${cmake_include_directories})
set(swig_include_dirs ${swig_include_dirs} "-I${it}")
@@ -192,7 +222,7 @@ macro(SWIG_ADD_MODULE name language)
set(swig_dot_i_sources)
set(swig_other_sources)
foreach(it ${ARGN})
- if(${it} MATCHES ".*\\.i$")
+ if(${it} MATCHES "\\.i$")
set(swig_dot_i_sources ${swig_dot_i_sources} "${it}")
else()
set(swig_other_sources ${swig_other_sources} "${it}")
@@ -211,8 +241,14 @@ macro(SWIG_ADD_MODULE name language)
MODULE
${swig_generated_sources}
${swig_other_sources})
+ set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES NO_SONAME ON)
string(TOLOWER "${language}" swig_lowercase_language)
- if ("${swig_lowercase_language}" STREQUAL "java")
+ if ("${swig_lowercase_language}" STREQUAL "octave")
+ set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
+ set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".oct")
+ elseif ("${swig_lowercase_language}" STREQUAL "go")
+ set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
+ elseif ("${swig_lowercase_language}" STREQUAL "java")
if (APPLE)
# In java you want:
# System.loadLibrary("LIBRARY");
@@ -222,8 +258,9 @@ macro(SWIG_ADD_MODULE name language)
# Linux : libLIBRARY.so
set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib")
endif ()
- endif ()
- if ("${swig_lowercase_language}" STREQUAL "python")
+ elseif ("${swig_lowercase_language}" STREQUAL "lua")
+ set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
+ elseif ("${swig_lowercase_language}" STREQUAL "python")
# this is only needed for the python case where a _modulename.so is generated
set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
# Python extension modules on Windows must have the extension ".pyd"
@@ -237,6 +274,19 @@ macro(SWIG_ADD_MODULE name language)
if(WIN32 AND NOT CYGWIN)
set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd")
endif()
+ elseif ("${swig_lowercase_language}" STREQUAL "r")
+ set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
+ elseif ("${swig_lowercase_language}" STREQUAL "ruby")
+ # In ruby you want:
+ # require 'LIBRARY'
+ # then ruby will look for a library whose name is platform dependent, namely
+ # MacOS : LIBRARY.bundle
+ # Windows: LIBRARY.dll
+ # Linux : LIBRARY.so
+ set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
+ if (APPLE)
+ set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".bundle")
+ endif ()
endif ()
endmacro()
diff --git a/Modules/UseVTK40.cmake b/Modules/UseVTK40.cmake
deleted file mode 100644
index d6bdaaa52..000000000
--- a/Modules/UseVTK40.cmake
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-
-#=============================================================================
-# Copyright 2002-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# This is an implementation detail for using VTK 4.0 with the
-# FindVTK.cmake module. Do not include directly by name. This should
-# be included only when FindVTK.cmake sets the VTK_USE_FILE variable
-# to point here.
-
-# Add compiler flags needed to use VTK.
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VTK_REQUIRED_C_FLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VTK_REQUIRED_CXX_FLAGS}")
-
-# Add include directories needed to use VTK.
-include_directories(${VTK_INCLUDE_DIRS})
-
-# Add link directories needed to use VTK.
-link_directories(${VTK_LIBRARY_DIRS})
diff --git a/Modules/UseVTKBuildSettings40.cmake b/Modules/UseVTKBuildSettings40.cmake
deleted file mode 100644
index 474f67c9c..000000000
--- a/Modules/UseVTKBuildSettings40.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-
-#=============================================================================
-# Copyright 2002-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# Implementation detail for FindVTK.cmake to let it provide a
-# VTK_BUILD_SETTINGS_FILE for VTK 4.0.
-
-set(CMAKE_BUILD_SETTING_CMAKE_MAJOR_VERSION "${VTK40_CMAKE_MAJOR_VERSION}")
-set(CMAKE_BUILD_SETTING_CMAKE_MINOR_VERSION "${VTK40_CMAKE_MINOR_VERSION}")
-set(CMAKE_BUILD_SETTING_PROJECT_NAME "VTK")
-
-set(CMAKE_BUILD_SETTING_C_COMPILER "${VTK40_CMAKE_C_COMPILER}")
-set(CMAKE_BUILD_SETTING_C_FLAGS "${VTK40_CMAKE_C_FLAGS}")
-set(CMAKE_BUILD_SETTING_C_FLAGS_DEBUG "${VTK40_CMAKE_C_FLAGS_DEBUG}")
-set(CMAKE_BUILD_SETTING_C_FLAGS_RELEASE "${VTK40_CMAKE_C_FLAGS_RELEASE}")
-set(CMAKE_BUILD_SETTING_C_FLAGS_MINSIZEREL "${VTK40_CMAKE_C_FLAGS_MINSIZEREL}")
-set(CMAKE_BUILD_SETTING_C_FLAGS_RELWITHDEBINFO "${VTK40_CMAKE_C_FLAGS_RELWITHDEBINFO}")
-
-set(CMAKE_BUILD_SETTING_CXX_COMPILER "${VTK40_CMAKE_CXX_COMPILER}")
-set(CMAKE_BUILD_SETTING_CXX_FLAGS "${VTK40_CMAKE_CXX_FLAGS}")
-set(CMAKE_BUILD_SETTING_CXX_FLAGS_DEBUG "${VTK40_CMAKE_CXX_FLAGS_DEBUG}")
-set(CMAKE_BUILD_SETTING_CXX_FLAGS_RELEASE "${VTK40_CMAKE_CXX_FLAGS_RELEASE}")
-set(CMAKE_BUILD_SETTING_CXX_FLAGS_MINSIZEREL "${VTK40_CMAKE_CXX_FLAGS_MINSIZEREL}")
-set(CMAKE_BUILD_SETTING_CXX_FLAGS_RELWITHDEBINFO "${VTK40_CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
-
-set(CMAKE_BUILD_SETTING_BUILD_TYPE "${VTK40_CMAKE_BUILD_TYPE}")
-set(CMAKE_BUILD_SETTING_BUILD_TOOL "${VTK40_CMAKE_BUILD_TOOL}")
diff --git a/Modules/UseVTKConfig40.cmake b/Modules/UseVTKConfig40.cmake
deleted file mode 100644
index 554b8c447..000000000
--- a/Modules/UseVTKConfig40.cmake
+++ /dev/null
@@ -1,409 +0,0 @@
-#
-
-#=============================================================================
-# Copyright 2002-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# This is an implementation detail for using VTK 4.0 with the
-# FindVTK.cmake module. Do not include directly.
-
-# Hard-code the version number since it isn't provided by VTK 4.0.
-set(VTK_MAJOR_VERSION 4)
-set(VTK_MINOR_VERSION 0)
-set(VTK_BUILD_VERSION 2)
-
-# Provide a new UseVTK file that doesn't do a full LOAD_CACHE.
-set(VTK_USE_FILE ${CMAKE_ROOT}/Modules/UseVTK40.cmake)
-
-# Provide a build settings file.
-set(VTK_BUILD_SETTINGS_FILE ${CMAKE_ROOT}/Modules/UseVTKBuildSettings40.cmake)
-
-# There are no CMake extensions for VTK 4.0.
-set(VTK_CMAKE_EXTENSIONS_DIR "")
-
-# grep "VTK40_" UseVTKConfig40.cmake |sed 's/.*VTK40_\([A-Za-z0-9_]*\).*/ \1/'
-load_cache(${VTK_DIR} READ_WITH_PREFIX VTK40_
- BUILD_SHARED_LIBS
- CMAKE_BUILD_TOOL
- CMAKE_BUILD_TYPE
- CMAKE_CACHE_MAJOR_VERSION
- CMAKE_CACHE_MINOR_VERSION
- CMAKE_CXX_COMPILER
- CMAKE_CXX_FLAGS
- CMAKE_CXX_FLAGS_DEBUG
- CMAKE_CXX_FLAGS_MINSIZEREL
- CMAKE_CXX_FLAGS_RELEASE
- CMAKE_CXX_FLAGS_RELWITHDEBINFO
- CMAKE_C_COMPILER
- CMAKE_C_FLAGS
- CMAKE_C_FLAGS_DEBUG
- CMAKE_C_FLAGS_MINSIZEREL
- CMAKE_C_FLAGS_RELEASE
- CMAKE_C_FLAGS_RELWITHDEBINFO
- CMAKE_INSTALL_PREFIX
- CMAKE_Xutil_INCLUDE_PATH
- EXECUTABLE_OUTPUT_PATH
- JAVA_INCLUDE_PATH2
- LIBRARY_OUTPUT_PATH
- MPIRUN
- MPI_INCLUDE_PATH
- MPI_POSTFLAGS
- MPI_PREFLAGS
- OPENGL_INCLUDE_DIR
- OSMESA_INCLUDE_PATH
- PYTHON_INCLUDE_PATH
- TCL_INCLUDE_PATH
- VLI_INCLUDE_PATH_FOR_VG500
- VLI_INCLUDE_PATH_FOR_VP1000
- VTK_BINARY_DIR
- VTK_DEBUG_LEAKS
- VTK_HAVE_VG500
- VTK_HAVE_VP1000
- VTK_MANGLE_MESA
- VTK_OPENGL_HAS_OSMESA
- VTK_PARSE_JAVA_EXE
- VTK_SOURCE_DIR
- VTK_USE_64BIT_IDS
- VTK_USE_ANSI_STDLIB
- VTK_USE_HYBRID
- VTK_USE_MATROX_IMAGING
- VTK_USE_MPI
- VTK_USE_PARALLEL
- VTK_USE_PATENTED
- VTK_USE_RENDERING
- VTK_USE_VIDEO_FOR_WINDOWS
- VTK_USE_VOLUMEPRO
- VTK_USE_X
- VTK_WRAP_JAVA
- VTK_WRAP_JAVA_EXE
- VTK_WRAP_PYTHON
- VTK_WRAP_PYTHON_EXE
- VTK_WRAP_TCL
- VTK_WRAP_TCL_EXE
- vtkCommonJava_LIB_DEPENDS
- vtkCommonPython_LIB_DEPENDS
- vtkCommonTCL_LIB_DEPENDS
- vtkCommon_LIB_DEPENDS
- vtkFilteringJava_LIB_DEPENDS
- vtkFilteringPython_LIB_DEPENDS
- vtkFilteringTCL_LIB_DEPENDS
- vtkFiltering_LIB_DEPENDS
- vtkGraphicsJava_LIB_DEPENDS
- vtkGraphicsPython_LIB_DEPENDS
- vtkGraphicsTCL_LIB_DEPENDS
- vtkGraphics_LIB_DEPENDS
- vtkHybridJava_LIB_DEPENDS
- vtkHybridPython_LIB_DEPENDS
- vtkHybridTCL_LIB_DEPENDS
- vtkHybrid_LIB_DEPENDS
- vtkIOJava_LIB_DEPENDS
- vtkIOPython_LIB_DEPENDS
- vtkIOTCL_LIB_DEPENDS
- vtkIO_LIB_DEPENDS
- vtkImagingJava_LIB_DEPENDS
- vtkImagingPython_LIB_DEPENDS
- vtkImagingTCL_LIB_DEPENDS
- vtkImaging_LIB_DEPENDS
- vtkParallelJava_LIB_DEPENDS
- vtkParallelPython_LIB_DEPENDS
- vtkParallelTCL_LIB_DEPENDS
- vtkParallel_LIB_DEPENDS
- vtkPatentedJava_LIB_DEPENDS
- vtkPatentedPython_LIB_DEPENDS
- vtkPatentedTCL_LIB_DEPENDS
- vtkPatented_LIB_DEPENDS
- vtkRenderingJava_LIB_DEPENDS
- vtkRenderingPythonTkWidgets_LIB_DEPENDS
- vtkRenderingPython_LIB_DEPENDS
- vtkRenderingTCL_LIB_DEPENDS
- vtkRendering_LIB_DEPENDS
- vtkjpeg_LIB_DEPENDS
- vtkpng_LIB_DEPENDS
- vtkzlib_LIB_DEPENDS
-)
-
-# Copy needed settings from the VTK 4.0 cache.
-set(VTK_BUILD_SHARED ${VTK40_BUILD_SHARED_LIBS})
-set(VTK_DEBUG_LEAKS ${VTK40_VTK_DEBUG_LEAKS})
-set(VTK_HAVE_VG500 ${VTK40_VTK_HAVE_VG500})
-set(VTK_HAVE_VP1000 ${VTK40_VTK_HAVE_VP1000})
-set(VTK_USE_MANGLED_MESA ${VTK40_VTK_MANGLE_MESA})
-set(VTK_MPIRUN_EXE ${VTK40_MPIRUN})
-set(VTK_MPI_POSTFLAGS ${VTK40_MPI_POSTFLAGS})
-set(VTK_MPI_PREFLAGS ${VTK40_MPI_PREFLAGS})
-set(VTK_OPENGL_HAS_OSMESA ${VTK40_VTK_OPENGL_HAS_OSMESA})
-set(VTK_USE_64BIT_IDS ${VTK40_VTK_USE_64BIT_IDS})
-set(VTK_USE_ANSI_STDLIB ${VTK40_VTK_USE_ANSI_STDLIB})
-set(VTK_USE_HYBRID ${VTK40_VTK_USE_HYBRID})
-set(VTK_USE_MATROX_IMAGING ${VTK40_VTK_USE_MATROX_IMAGING})
-set(VTK_USE_MPI ${VTK40_VTK_USE_MPI})
-set(VTK_USE_PARALLEL ${VTK40_VTK_USE_PARALLEL})
-set(VTK_USE_PATENTED ${VTK40_VTK_USE_PATENTED})
-set(VTK_USE_RENDERING ${VTK40_VTK_USE_RENDERING})
-set(VTK_USE_VIDEO_FOR_WINDOWS ${VTK40_VTK_USE_VIDEO_FOR_WINDOWS})
-set(VTK_USE_VOLUMEPRO ${VTK40_VTK_USE_VOLUMEPRO})
-set(VTK_USE_X ${VTK40_VTK_USE_X})
-set(VTK_WRAP_JAVA ${VTK40_VTK_WRAP_JAVA})
-set(VTK_WRAP_PYTHON ${VTK40_VTK_WRAP_PYTHON})
-set(VTK_WRAP_TCL ${VTK40_VTK_WRAP_TCL})
-
-# Create the list of available kits.
-set(VTK_KITS COMMON FILTERING GRAPHICS IMAGING IO)
-if(VTK_USE_RENDERING)
- set(VTK_KITS ${VTK_KITS} RENDERING)
-endif()
-if(VTK_USE_HYBRID)
- set(VTK_KITS ${VTK_KITS} HYBRID)
-endif()
-if(VTK_USE_PARALLEL)
- set(VTK_KITS ${VTK_KITS} PARALLEL)
-endif()
-if(VTK_USE_PATENTED)
- set(VTK_KITS ${VTK_KITS} PATENTED)
-endif()
-
-# Create the list of available languages.
-set(VTK_LANGUAGES "")
-if(VTK_WRAP_TCL)
- set(VTK_LANGUAGES ${VTK_LANGUAGES} TCL)
-endif()
-if(VTK_WRAP_PYTHON)
- set(VTK_LANGUAGES ${VTK_LANGUAGES} PYTHON)
-endif()
-if(VTK_WRAP_JAVA)
- set(VTK_LANGUAGES ${VTK_LANGUAGES} JAVA)
-endif()
-
-# Include directories for other projects installed on the system and
-# used by VTK.
-set(VTK_INCLUDE_DIRS_SYS "")
-if(VTK_USE_RENDERING)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_OPENGL_INCLUDE_PATH} ${VTK40_OPENGL_INCLUDE_DIR})
- if(VTK_USE_X)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_CMAKE_Xlib_INCLUDE_PATH} ${VTK40_CMAKE_Xutil_INCLUDE_PATH})
- endif()
-endif()
-
-if(VTK_OPENGL_HAS_OSMESA)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_OSMESA_INCLUDE_PATH})
-endif()
-
-if(VTK_USE_MPI)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_MPI_INCLUDE_PATH})
-endif()
-
-if(VTK_WRAP_TCL)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_TCL_INCLUDE_PATH})
-endif()
-
-if(VTK_WRAP_PYTHON)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_PYTHON_INCLUDE_PATH})
-endif()
-
-if(VTK_WRAP_JAVA)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_JAVA_INCLUDE_PATH} ${VTK40_JAVA_INCLUDE_PATH2})
-endif()
-
-if(VTK_HAVE_VG500)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_VLI_INCLUDE_PATH_FOR_VG500})
-endif()
-
-if(VTK_HAVE_VP1000)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_VLI_INCLUDE_PATH_FOR_VP1000})
-endif()
-
-# See if this is a build tree or install tree.
-if(EXISTS ${VTK_DIR}/Common)
- # This is a VTK 4.0 build tree.
-
- set(VTK_LIBRARY_DIRS ${VTK40_LIBRARY_OUTPUT_PATH})
-
- # Determine the include directories needed.
- set(VTK_INCLUDE_DIRS ${VTK40_VTK_BINARY_DIR})
- if(VTK_USE_PARALLEL)
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Parallel)
- endif()
- if(VTK_USE_HYBRID)
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Hybrid)
- endif()
- if(VTK_USE_PATENTED)
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Patented)
- endif()
- if(VTK_USE_RENDERING)
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Rendering)
- endif()
-
- # These directories are always needed.
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS}
- ${VTK40_VTK_SOURCE_DIR}/IO
- ${VTK40_VTK_SOURCE_DIR}/Imaging
- ${VTK40_VTK_SOURCE_DIR}/Graphics
- ${VTK40_VTK_SOURCE_DIR}/Filtering
- ${VTK40_VTK_SOURCE_DIR}/Common)
-
- # Give access to a few utilities.
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS}
- ${VTK40_VTK_BINARY_DIR}/Utilities/png
- ${VTK40_VTK_SOURCE_DIR}/Utilities/png
- ${VTK40_VTK_BINARY_DIR}/Utilities/zlib
- ${VTK40_VTK_SOURCE_DIR}/Utilities/zlib)
-
- # Executable locations.
- if(VTK_WRAP_TCL)
- set(VTK_TCL_EXE ${VTK40_EXECUTABLE_OUTPUT_PATH}/vtk)
- set(VTK_WRAP_TCL_EXE ${VTK40_VTK_WRAP_TCL_EXE})
- set(VTK_TCL_HOME ${VTK40_VTK_SOURCE_DIR}/Wrapping/Tcl)
- endif()
- if(VTK_WRAP_PYTHON)
- set(VTK_WRAP_PYTHON_EXE ${VTK40_VTK_WRAP_PYTHON_EXE})
- endif()
- if(VTK_WRAP_JAVA)
- set(VTK_PARSE_JAVA_EXE ${VTK40_VTK_PARSE_JAVA_EXE})
- set(VTK_WRAP_JAVA_EXE ${VTK40_VTK_WRAP_JAVA_EXE})
- endif()
-
-else()
- # This is a VTK 4.0 install tree.
-
- set(VTK_INCLUDE_DIRS ${VTK_DIR})
- set(VTK_LIBRARY_DIRS ${VTK40_CMAKE_INSTALL_PREFIX}/lib/vtk)
-
- # Executable locations.
- if(VTK_WRAP_TCL)
- set(VTK_TCL_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtk)
- set(VTK_WRAP_TCL_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapTcl)
- set(VTK_TCL_HOME ${VTK40_CMAKE_INSTALL_PREFIX}/lib/vtk/tcl)
- endif()
- if(VTK_WRAP_PYTHON)
- set(VTK_WRAP_PYTHON_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapPython)
- endif()
- if(VTK_WRAP_JAVA)
- set(VTK_PARSE_JAVA_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkParseJava)
- set(VTK_WRAP_JAVA_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapJava)
- endif()
-endif()
-
-# Add the system include directories last.
-set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK_INCLUDE_DIRS_SYS})
-
-# Find the required C and C++ compiler flags.
-if(CMAKE_COMPILER_IS_GNUCXX)
- if(WIN32)
- # The platform is gcc on cygwin.
- set(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mwin32")
- set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mwin32")
- endif()
-else()
- if(CMAKE_ANSI_CFLAGS)
- set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
- endif()
- if(CMAKE_SYSTEM MATCHES "OSF1-V.*")
- set(VTK_REQUIRED_CXX_FLAGS
- "${VTK_REQUIRED_CXX_FLAGS} -timplicit_local -no_implicit_include")
- endif()
-endif()
-
-if(VTK_USE_X)
- if(CMAKE_X_CFLAGS)
- set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_X_CFLAGS}")
- set(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} ${CMAKE_X_CFLAGS}")
- endif()
-endif()
-
-# Copy library dependencies.
-set(vtkCommonJava_LIB_DEPENDS "${VTK40_vtkCommonJava_LIB_DEPENDS}")
-set(vtkCommonPython_LIB_DEPENDS "${VTK40_vtkCommonPython_LIB_DEPENDS}")
-set(vtkCommonTCL_LIB_DEPENDS "${VTK40_vtkCommonTCL_LIB_DEPENDS}")
-set(vtkCommon_LIB_DEPENDS "${VTK40_vtkCommon_LIB_DEPENDS}")
-set(vtkFilteringJava_LIB_DEPENDS "${VTK40_vtkFilteringJava_LIB_DEPENDS}")
-set(vtkFilteringPython_LIB_DEPENDS "${VTK40_vtkFilteringPython_LIB_DEPENDS}")
-set(vtkFilteringTCL_LIB_DEPENDS "${VTK40_vtkFilteringTCL_LIB_DEPENDS}")
-set(vtkFiltering_LIB_DEPENDS "${VTK40_vtkFiltering_LIB_DEPENDS}")
-set(vtkGraphicsJava_LIB_DEPENDS "${VTK40_vtkGraphicsJava_LIB_DEPENDS}")
-set(vtkGraphicsPython_LIB_DEPENDS "${VTK40_vtkGraphicsPython_LIB_DEPENDS}")
-set(vtkGraphicsTCL_LIB_DEPENDS "${VTK40_vtkGraphicsTCL_LIB_DEPENDS}")
-set(vtkGraphics_LIB_DEPENDS "${VTK40_vtkGraphics_LIB_DEPENDS}")
-set(vtkHybridJava_LIB_DEPENDS "${VTK40_vtkHybridJava_LIB_DEPENDS}")
-set(vtkHybridPython_LIB_DEPENDS "${VTK40_vtkHybridPython_LIB_DEPENDS}")
-set(vtkHybridTCL_LIB_DEPENDS "${VTK40_vtkHybridTCL_LIB_DEPENDS}")
-set(vtkHybrid_LIB_DEPENDS "${VTK40_vtkHybrid_LIB_DEPENDS}")
-set(vtkIOJava_LIB_DEPENDS "${VTK40_vtkIOJava_LIB_DEPENDS}")
-set(vtkIOPython_LIB_DEPENDS "${VTK40_vtkIOPython_LIB_DEPENDS}")
-set(vtkIOTCL_LIB_DEPENDS "${VTK40_vtkIOTCL_LIB_DEPENDS}")
-set(vtkIO_LIB_DEPENDS "${VTK40_vtkIO_LIB_DEPENDS}")
-set(vtkImagingJava_LIB_DEPENDS "${VTK40_vtkImagingJava_LIB_DEPENDS}")
-set(vtkImagingPython_LIB_DEPENDS "${VTK40_vtkImagingPython_LIB_DEPENDS}")
-set(vtkImagingTCL_LIB_DEPENDS "${VTK40_vtkImagingTCL_LIB_DEPENDS}")
-set(vtkImaging_LIB_DEPENDS "${VTK40_vtkImaging_LIB_DEPENDS}")
-set(vtkParallelJava_LIB_DEPENDS "${VTK40_vtkParallelJava_LIB_DEPENDS}")
-set(vtkParallelPython_LIB_DEPENDS "${VTK40_vtkParallelPython_LIB_DEPENDS}")
-set(vtkParallelTCL_LIB_DEPENDS "${VTK40_vtkParallelTCL_LIB_DEPENDS}")
-set(vtkParallel_LIB_DEPENDS "${VTK40_vtkParallel_LIB_DEPENDS}")
-set(vtkPatentedJava_LIB_DEPENDS "${VTK40_vtkPatentedJava_LIB_DEPENDS}")
-set(vtkPatentedPython_LIB_DEPENDS "${VTK40_vtkPatentedPython_LIB_DEPENDS}")
-set(vtkPatentedTCL_LIB_DEPENDS "${VTK40_vtkPatentedTCL_LIB_DEPENDS}")
-set(vtkPatented_LIB_DEPENDS "${VTK40_vtkPatented_LIB_DEPENDS}")
-set(vtkRenderingJava_LIB_DEPENDS "${VTK40_vtkRenderingJava_LIB_DEPENDS}")
-set(vtkRenderingPythonTkWidgets_LIB_DEPENDS "${VTK40_vtkRenderingPythonTkWidgets_LIB_DEPENDS}")
-set(vtkRenderingPython_LIB_DEPENDS "${VTK40_vtkRenderingPython_LIB_DEPENDS}")
-set(vtkRenderingTCL_LIB_DEPENDS "${VTK40_vtkRenderingTCL_LIB_DEPENDS}")
-set(vtkRendering_LIB_DEPENDS "${VTK40_vtkRendering_LIB_DEPENDS}")
-set(vtkjpeg_LIB_DEPENDS "${VTK40_vtkjpeg_LIB_DEPENDS}")
-set(vtkpng_LIB_DEPENDS "${VTK40_vtkpng_LIB_DEPENDS}")
-set(vtkzlib_LIB_DEPENDS "${VTK40_vtkzlib_LIB_DEPENDS}")
-
-# List of VTK configuration variables set above.
-# grep "^[ ]*set(VTK" UseVTKConfig40.cmake |sed 's/[ ]*set(\([^ ]*\) .*/ \1/'
-set(VTK_SETTINGS
- VTK_BUILD_SHARED
- VTK_BUILD_VERSION
- VTK_DEBUG_LEAKS
- VTK_HAVE_VG500
- VTK_HAVE_VP1000
- VTK_INCLUDE_DIRS
- VTK_KITS
- VTK_LANGUAGES
- VTK_LIBRARY_DIRS
- VTK_MAJOR_VERSION
- VTK_MANGLE_MESA
- VTK_MINOR_VERSION
- VTK_MPIRUN_EXE
- VTK_MPI_POSTFLAGS
- VTK_MPI_PREFLAGS
- VTK_OPENGL_HAS_OSMESA
- VTK_PARSE_JAVA_EXE
- VTK_TCL_EXE
- VTK_TCL_HOME
- VTK_USE_64BIT_IDS
- VTK_USE_ANSI_STDLIB
- VTK_USE_HYBRID
- VTK_USE_MATROX_IMAGING
- VTK_USE_MPI
- VTK_USE_PARALLEL
- VTK_USE_PATENTED
- VTK_USE_RENDERING
- VTK_USE_VIDEO_FOR_WINDOWS
- VTK_USE_VOLUMEPRO
- VTK_USE_X
- VTK_WRAP_JAVA
- VTK_WRAP_JAVA_EXE
- VTK_WRAP_PYTHON
- VTK_WRAP_PYTHON_EXE
- VTK_WRAP_TCL
- VTK_WRAP_TCL_EXE
-)
diff --git a/Modules/Use_wxWindows.cmake b/Modules/Use_wxWindows.cmake
index 6c95681e2..d3025ac12 100644
--- a/Modules/Use_wxWindows.cmake
+++ b/Modules/Use_wxWindows.cmake
@@ -1,17 +1,32 @@
+#.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)
#
-# 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
+#
+# ::
+#
+# 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
+#
+# ::
+#
+# if you are sure you need GL then
+#
# set(WXWINDOWS_USE_GL 1)
-# *before* you include this file.
+#
+# ::
+#
+# *before* you include this file.
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake
index bb8c29b3e..b3633a6c2 100644
--- a/Modules/UsewxWidgets.cmake
+++ b/Modules/UsewxWidgets.cmake
@@ -1,19 +1,38 @@
-# - 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.
+#.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})
+#
+# ::
+#
+# # 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.
+#
+# ::
+#
+# LINK_LIBRARIES is not called in favor of adding dependencies per target.
+#
+#
#
# AUTHOR
-# Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
+#
+# ::
+#
+# Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
#=============================================================================
# Copyright 2004-2009 Kitware, Inc.
@@ -69,8 +88,11 @@ if (wxWidgets_FOUND)
endif()
if (wxWidgets_CXX_FLAGS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
- MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
+ # Flags are expected to be a string here, not a list.
+ string(REPLACE ";" " " wxWidgets_CXX_FLAGS_str "${wxWidgets_CXX_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS_str}")
+ MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS_str}")
+ unset(wxWidgets_CXX_FLAGS_str)
endif()
# DEPRECATED JW
diff --git a/Modules/WIX.template.in b/Modules/WIX.template.in
index 0bc7e10ce..c4fc83afa 100644
--- a/Modules/WIX.template.in
+++ b/Modules/WIX.template.in
@@ -39,6 +39,9 @@
<FeatureRef Id="ProductFeature"/>
- <UIRef Id="WixUI_InstallDir" />
+ <UIRef Id="$(var.CPACK_WIX_UI_REF)" />
+
+ <?include "properties.wxi"?>
+ <?include "product_fragment.wxi"?>
</Product>
</Wix>
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 4466cd797..bf55eb964 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -1,4 +1,17 @@
-# WRITE_BASIC_CONFIG_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
+#.rst:
+# WriteBasicConfigVersionFile
+# ---------------------------
+#
+#
+#
+# ::
+#
+# WRITE_BASIC_CONFIG_VERSION_FILE( filename
+# [VERSION major.minor.patch]
+# COMPATIBILITY (AnyNewerVersion|SameMajorVersion)
+# )
+#
+#
#
# Deprecated, see WRITE_BASIC_PACKAGE_VERSION_FILE(), it is identical.
@@ -36,7 +49,11 @@ function(WRITE_BASIC_CONFIG_VERSION_FILE _filename)
endif()
if("${CVF_VERSION}" STREQUAL "")
- message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
+ if ("${PROJECT_VERSION}" STREQUAL "")
+ message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
+ else()
+ set(CVF_VERSION "${PROJECT_VERSION}")
+ endif()
endif()
configure_file("${versionTemplateFile}" "${_filename}" @ONLY)
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
new file mode 100644
index 000000000..a3b73bb89
--- /dev/null
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -0,0 +1,664 @@
+#.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> [...]
+# [VERSION <version>]
+# [PROLOG <prolog>]
+# [EPILOG <epilog>]
+# )
+#
+# 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
+# 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.
+#
+# See the :manual:`cmake-compile-features(7)` manual for information on
+# compile features.
+#
+# Feature Test Macros
+# ===================
+#
+# For each compiler, a preprocessor macro is generated matching
+# ``<PREFIX>_COMPILER_IS_<compiler>`` which has the content either ``0``
+# or ``1``, depending on the compiler in use. Preprocessor macros for
+# compiler version components are generated matching
+# ``<PREFIX>_COMPILER_VERSION_MAJOR`` ``<PREFIX>_COMPILER_VERSION_MINOR``
+# and ``<PREFIX>_COMPILER_VERSION_PATCH`` containing decimal values
+# for the corresponding compiler version components, if defined.
+#
+# A preprocessor test is generated based on the compiler version
+# denoting whether each feature is enabled. A preprocessor macro
+# matching ``<PREFIX>_COMPILER_<FEATURE>``, where ``<FEATURE>`` is the
+# upper-case ``<feature>`` name, is generated to contain the value
+# ``0`` or ``1`` depending on whether the compiler in use supports the
+# feature:
+#
+# .. code-block:: cmake
+#
+# write_compiler_detection_header(
+# FILE climbingstats_compiler_detection.h
+# PREFIX ClimbingStats
+# COMPILERS GNU Clang AppleClang MSVC
+# FEATURES cxx_variadic_templates
+# )
+#
+# .. code-block:: c++
+#
+# #if ClimbingStats_COMPILER_CXX_VARIADIC_TEMPLATES
+# template<typename... T>
+# void someInterface(T t...) { /* ... */ }
+# #else
+# // Compatibility versions
+# template<typename T1>
+# void someInterface(T1 t1) { /* ... */ }
+# template<typename T1, typename T2>
+# void someInterface(T1 t1, T2 t2) { /* ... */ }
+# template<typename T1, typename T2, typename T3>
+# void someInterface(T1 t1, T2 t2, T3 t3) { /* ... */ }
+# #endif
+#
+# Symbol Macros
+# =============
+#
+# Some additional symbol-defines are created for particular features for
+# use as symbols which may be conditionally defined empty:
+#
+# .. code-block:: c++
+#
+# class MyClass ClimbingStats_FINAL
+# {
+# ClimbingStats_CONSTEXPR int someInterface() { return 42; }
+# };
+#
+# The ``ClimbingStats_FINAL`` macro will expand to ``final`` if the
+# compiler (and its flags) support the ``cxx_final`` feature, and the
+# ``ClimbingStats_CONSTEXPR`` macro will expand to ``constexpr``
+# if ``cxx_constexpr`` is supported.
+#
+# The following features generate corresponding symbol defines:
+#
+# ========================== =================================== =================
+# Feature Define Symbol
+# ========================== =================================== =================
+# ``c_restrict`` ``<PREFIX>_RESTRICT`` ``restrict``
+# ``cxx_constexpr`` ``<PREFIX>_CONSTEXPR`` ``constexpr``
+# ``cxx_deleted_functions`` ``<PREFIX>_DELETED_FUNCTION`` ``= delete``
+# ``cxx_extern_templates`` ``<PREFIX>_EXTERN_TEMPLATE`` ``extern``
+# ``cxx_final`` ``<PREFIX>_FINAL`` ``final``
+# ``cxx_noexcept`` ``<PREFIX>_NOEXCEPT`` ``noexcept``
+# ``cxx_noexcept`` ``<PREFIX>_NOEXCEPT_EXPR(X)`` ``noexcept(X)``
+# ``cxx_override`` ``<PREFIX>_OVERRIDE`` ``override``
+# ========================== =================================== =================
+#
+# Compatibility Implementation Macros
+# ===================================
+#
+# Some features are suitable for wrapping in a macro with a backward
+# compatibility implementation if the compiler does not support the feature.
+#
+# When the ``cxx_static_assert`` feature is not provided by the compiler,
+# a compatibility implementation is available via the
+# ``<PREFIX>_STATIC_ASSERT(COND)`` and
+# ``<PREFIX>_STATIC_ASSERT_MSG(COND, MSG)`` function-like macros. The macros
+# expand to ``static_assert`` where that compiler feature is available, and
+# to a compatibility implementation otherwise. In the first form, the
+# condition is stringified in the message field of ``static_assert``. In
+# the second form, the message ``MSG`` is passed to the message field of
+# ``static_assert``, or ignored if using the backward compatibility
+# implementation.
+#
+# The ``cxx_attribute_deprecated`` feature provides a macro definition
+# ``<PREFIX>_DEPRECATED``, which expands to either the standard
+# ``[[deprecated]]`` attribute or a compiler-specific decorator such
+# as ``__attribute__((__deprecated__))`` used by GNU compilers.
+#
+# The ``cxx_alignas`` feature provides a macro definition
+# ``<PREFIX>_ALIGNAS`` which expands to either the standard ``alignas``
+# decorator or a compiler-specific decorator such as
+# ``__attribute__ ((__aligned__))`` used by GNU compilers.
+#
+# The ``cxx_alignof`` feature provides a macro definition
+# ``<PREFIX>_ALIGNOF`` which expands to either the standard ``alignof``
+# decorator or a compiler-specific decorator such as ``__alignof__``
+# used by GNU compilers.
+#
+# ============================= ================================ =====================
+# Feature Define Symbol
+# ============================= ================================ =====================
+# ``cxx_alignas`` ``<PREFIX>_ALIGNAS`` ``alignas``
+# ``cxx_alignof`` ``<PREFIX>_ALIGNOF`` ``alignof``
+# ``cxx_nullptr`` ``<PREFIX>_NULLPTR`` ``nullptr``
+# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT`` ``static_assert``
+# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT_MSG`` ``static_assert``
+# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED`` ``[[deprecated]]``
+# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED_MSG`` ``[[deprecated]]``
+# ``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=
+# )
+
+#=============================================================================
+# Copyright 2014 Stephen Kelly <steveire@gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerIdDetection.cmake)
+
+function(_load_compiler_variables CompilerId lang)
+ include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-${lang}-FeatureTests.cmake" OPTIONAL)
+ set(_cmake_oldestSupported_${CompilerId} ${_cmake_oldestSupported} PARENT_SCOPE)
+ foreach(feature ${ARGN})
+ set(_cmake_feature_test_${CompilerId}_${feature} ${_cmake_feature_test_${feature}} PARENT_SCOPE)
+ endforeach()
+ include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-${lang}-DetermineCompiler.cmake" OPTIONAL
+ RESULT_VARIABLE determinedCompiler)
+ if (NOT determinedCompiler)
+ include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-DetermineCompiler.cmake" OPTIONAL)
+ endif()
+ set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
+endfunction()
+
+function(write_compiler_detection_header
+ file_keyword file_arg
+ prefix_keyword prefix_arg
+ )
+ if (NOT "x${file_keyword}" STREQUAL "xFILE")
+ message(FATAL_ERROR "write_compiler_detection_header: FILE parameter missing.")
+ endif()
+ if (NOT "x${prefix_keyword}" STREQUAL "xPREFIX")
+ message(FATAL_ERROR "write_compiler_detection_header: PREFIX parameter missing.")
+ endif()
+ set(options)
+ set(oneValueArgs VERSION EPILOG PROLOG OUTPUT_FILES_VAR OUTPUT_DIR)
+ set(multiValueArgs COMPILERS FEATURES)
+ cmake_parse_arguments(_WCD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if (NOT _WCD_COMPILERS)
+ message(FATAL_ERROR "Invalid arguments. write_compiler_detection_header requires at least one compiler.")
+ endif()
+ if (NOT _WCD_FEATURES)
+ message(FATAL_ERROR "Invalid arguments. write_compiler_detection_header requires at least one feature.")
+ endif()
+
+ if(_WCD_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unparsed arguments: ${_WCD_UNPARSED_ARGUMENTS}")
+ endif()
+
+ if (prefix_arg STREQUAL "")
+ message(FATAL_ERROR "A prefix must be specified")
+ endif()
+ string(MAKE_C_IDENTIFIER ${prefix_arg} cleaned_prefix)
+ if (NOT prefix_arg STREQUAL cleaned_prefix)
+ message(FATAL_ERROR "The prefix must be a valid C identifier.")
+ endif()
+
+ if(NOT _WCD_VERSION)
+ set(_WCD_VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
+ endif()
+ set(_min_version 3.1.0) # Version which introduced this function
+ if (_WCD_VERSION VERSION_LESS _min_version)
+ set(err "VERSION compatibility for write_compiler_detection_header is set to ${_WCD_VERSION}, which is too low.")
+ set(err "${err} It must be set to at least ${_min_version}. ")
+ set(err "${err} Either set the VERSION parameter to the write_compiler_detection_header function, or update")
+ set(err "${err} your minimum required CMake version with the cmake_minimum_required command.")
+ message(FATAL_ERROR "${err}")
+ endif()
+
+ if(_WCD_OUTPUT_FILES_VAR)
+ if(NOT _WCD_OUTPUT_DIR)
+ message(FATAL_ERROR "If OUTPUT_FILES_VAR is specified, then OUTPUT_DIR must also be specified.")
+ endif()
+ endif()
+ if(_WCD_OUTPUT_DIR)
+ if(NOT _WCD_OUTPUT_FILES_VAR)
+ message(FATAL_ERROR "If OUTPUT_DIR is specified, then OUTPUT_FILES_VAR must also be specified.")
+ endif()
+ get_filename_component(main_file_dir ${file_arg} DIRECTORY)
+ if (NOT IS_ABSOLUTE ${main_file_dir})
+ set(main_file_dir "${CMAKE_CURRENT_BINARY_DIR}/${main_file_dir}")
+ endif()
+ if (NOT IS_ABSOLUTE ${_WCD_OUTPUT_DIR})
+ set(_WCD_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_WCD_OUTPUT_DIR}")
+ endif()
+ get_filename_component(out_file_dir ${_WCD_OUTPUT_DIR} ABSOLUTE)
+ string(FIND ${out_file_dir} ${main_file_dir} idx)
+ if (NOT idx EQUAL 0)
+ message(FATAL_ERROR "The compiler-specific output directory must be within the same directory as the main file.")
+ endif()
+
+ if (main_file_dir STREQUAL out_file_dir)
+ unset(_WCD_OUTPUT_DIR)
+ else()
+ string(REPLACE "${main_file_dir}/" "" _WCD_OUTPUT_DIR "${out_file_dir}/")
+ endif()
+ endif()
+
+ set(compilers
+ GNU
+ Clang
+ AppleClang
+ MSVC
+ SunPro
+ )
+
+ set(_hex_compilers ADSP Borland Embarcadero SunPro)
+
+ foreach(_comp ${_WCD_COMPILERS})
+ list(FIND compilers ${_comp} idx)
+ if (idx EQUAL -1)
+ message(FATAL_ERROR "Unsupported compiler ${_comp}.")
+ endif()
+ if (NOT _need_hex_conversion)
+ list(FIND _hex_compilers ${_comp} idx)
+ if (NOT idx EQUAL -1)
+ set(_need_hex_conversion TRUE)
+ endif()
+ endif()
+ endforeach()
+
+ set(file_content "
+// This is a generated file. Do not edit!
+
+#ifndef ${prefix_arg}_COMPILER_DETECTION_H
+#define ${prefix_arg}_COMPILER_DETECTION_H
+")
+
+ if (_WCD_PROLOG)
+ set(file_content "${file_content}\n${_WCD_PROLOG}\n")
+ endif()
+
+ if (_need_hex_conversion)
+ set(file_content "${file_content}
+#define ${prefix_arg}_DEC(X) (X)
+#define ${prefix_arg}_HEX(X) ( \\
+ ((X)>>28 & 0xF) * 10000000 + \\
+ ((X)>>24 & 0xF) * 1000000 + \\
+ ((X)>>20 & 0xF) * 100000 + \\
+ ((X)>>16 & 0xF) * 10000 + \\
+ ((X)>>12 & 0xF) * 1000 + \\
+ ((X)>>8 & 0xF) * 100 + \\
+ ((X)>>4 & 0xF) * 10 + \\
+ ((X) & 0xF) \\
+ )\n")
+ endif()
+
+ foreach(feature ${_WCD_FEATURES})
+ if (feature MATCHES "^cxx_")
+ list(APPEND _langs CXX)
+ list(APPEND CXX_features ${feature})
+ elseif (feature MATCHES "^c_")
+ list(APPEND _langs C)
+ list(APPEND C_features ${feature})
+ else()
+ message(FATAL_ERROR "Unsupported feature ${feature}.")
+ endif()
+ endforeach()
+ list(REMOVE_DUPLICATES _langs)
+
+ if(_WCD_OUTPUT_FILES_VAR)
+ get_filename_component(main_file_name ${file_arg} NAME)
+ set(compiler_file_content_
+"#ifndef ${prefix_arg}_COMPILER_DETECTION_H
+# error This file may only be included from ${main_file_name}
+#endif\n")
+ endif()
+
+ foreach(_lang ${_langs})
+ set(target_compilers)
+ foreach(compiler ${_WCD_COMPILERS})
+ _load_compiler_variables(${compiler} ${_lang} ${${_lang}_features})
+ if(_cmake_oldestSupported_${compiler})
+ list(APPEND target_compilers ${compiler})
+ endif()
+ endforeach()
+
+ get_property(known_features GLOBAL PROPERTY CMAKE_${_lang}_KNOWN_FEATURES)
+ foreach(feature ${${_lang}_features})
+ list(FIND known_features ${feature} idx)
+ if (idx EQUAL -1)
+ message(FATAL_ERROR "Unsupported feature ${feature}.")
+ endif()
+ endforeach()
+
+ if(_lang STREQUAL CXX)
+ set(file_content "${file_content}\n#ifdef __cplusplus\n")
+ else()
+ set(file_content "${file_content}\n#ifndef __cplusplus\n")
+ endif()
+
+ compiler_id_detection(ID_CONTENT ${_lang} PREFIX ${prefix_arg}_
+ ID_DEFINE
+ )
+
+ set(file_content "${file_content}${ID_CONTENT}\n")
+
+ set(pp_if "if")
+ foreach(compiler ${target_compilers})
+ set(file_content "${file_content}\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n")
+
+ if(_WCD_OUTPUT_FILES_VAR)
+ set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h")
+ set(file_content "${file_content}\n# include \"${compile_file_name}\"\n")
+ endif()
+
+ if(_WCD_OUTPUT_FILES_VAR)
+ set(compiler_file_content compiler_file_content_${compiler}_${_lang})
+ else()
+ set(compiler_file_content file_content)
+ endif()
+
+ set(${compiler_file_content} "${${compiler_file_content}}
+# if !(${_cmake_oldestSupported_${compiler}})
+# error Unsupported compiler version
+# endif\n")
+
+ set(PREFIX ${prefix_arg}_)
+ if (_need_hex_conversion)
+ set(MACRO_DEC ${prefix_arg}_DEC)
+ set(MACRO_HEX ${prefix_arg}_HEX)
+ else()
+ set(MACRO_DEC)
+ set(MACRO_HEX)
+ endif()
+ string(CONFIGURE "${_compiler_id_version_compute_${compiler}}" VERSION_BLOCK @ONLY)
+ set(${compiler_file_content} "${${compiler_file_content}}${VERSION_BLOCK}\n")
+ set(PREFIX)
+ set(MACRO_DEC)
+ set(MACRO_HEX)
+
+ set(pp_if "elif")
+ foreach(feature ${${_lang}_features})
+ string(TOUPPER ${feature} feature_upper)
+ set(feature_PP "COMPILER_${feature_upper}")
+ set(_define_item "\n# define ${prefix_arg}_${feature_PP} 0\n")
+ if (_cmake_feature_test_${compiler}_${feature} STREQUAL "1")
+ set(_define_item "\n# define ${prefix_arg}_${feature_PP} 1\n")
+ elseif (_cmake_feature_test_${compiler}_${feature})
+ set(_define_item "\n# define ${prefix_arg}_${feature_PP} 0\n")
+ set(_define_item "\n# if ${_cmake_feature_test_${compiler}_${feature}}\n# define ${prefix_arg}_${feature_PP} 1\n# else${_define_item}# endif\n")
+ endif()
+ set(${compiler_file_content} "${${compiler_file_content}}${_define_item}")
+ endforeach()
+ endforeach()
+ if(pp_if STREQUAL "elif")
+ set(file_content "${file_content}
+# else
+# error Unsupported compiler
+# endif\n")
+ endif()
+ foreach(feature ${${_lang}_features})
+ string(TOUPPER ${feature} feature_upper)
+ set(feature_PP "COMPILER_${feature_upper}")
+ set(def_name ${prefix_arg}_${feature_PP})
+ if (feature STREQUAL c_restrict)
+ set(def_value "${prefix_arg}_RESTRICT")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} restrict
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_constexpr)
+ set(def_value "${prefix_arg}_CONSTEXPR")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} constexpr
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_final)
+ set(def_value "${prefix_arg}_FINAL")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} final
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_override)
+ set(def_value "${prefix_arg}_OVERRIDE")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} override
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_static_assert)
+ set(def_value "${prefix_arg}_STATIC_ASSERT(X)")
+ set(def_value_msg "${prefix_arg}_STATIC_ASSERT_MSG(X, MSG)")
+ set(static_assert_struct "template<bool> struct ${prefix_arg}StaticAssert;\ntemplate<> struct ${prefix_arg}StaticAssert<true>{};\n")
+ set(def_standard "# define ${def_value} static_assert(X, #X)\n# define ${def_value_msg} static_assert(X, MSG)")
+ set(def_alternative "${static_assert_struct}# define ${def_value} sizeof(${prefix_arg}StaticAssert<X>)\n# define ${def_value_msg} sizeof(${prefix_arg}StaticAssert<X>)")
+ set(file_content "${file_content}# if ${def_name}\n${def_standard}\n# else\n${def_alternative}\n# endif\n\n")
+ endif()
+ if (feature STREQUAL cxx_alignas)
+ set(def_value "${prefix_arg}_ALIGNAS(X)")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} alignas(X)
+# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang
+# define ${def_value} __attribute__ ((__aligned__(X)))
+# elif ${prefix_arg}_COMPILER_IS_MSVC
+# define ${def_value} __declspec(align(X))
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_alignof)
+ set(def_value "${prefix_arg}_ALIGNOF(X)")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} alignof(X)
+# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang
+# define ${def_value} __alignof__(X)
+# elif ${prefix_arg}_COMPILER_IS_MSVC
+# define ${def_value} __alignof(X)
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_deleted_functions)
+ set(def_value "${prefix_arg}_DELETED_FUNCTION")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} = delete
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_extern_templates)
+ set(def_value "${prefix_arg}_EXTERN_TEMPLATE")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} extern
+# else
+# define ${def_value}
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_noexcept)
+ set(def_value "${prefix_arg}_NOEXCEPT")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} noexcept
+# define ${def_value}_EXPR(X) noexcept(X)
+# else
+# define ${def_value}
+# define ${def_value}_EXPR(X)
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_nullptr)
+ set(def_value "${prefix_arg}_NULLPTR")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} nullptr
+# else
+# define ${def_value} 0
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_thread_local)
+ set(def_value "${prefix_arg}_THREAD_LOCAL")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} thread_local
+# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang
+# define ${def_value} __thread
+# elif ${prefix_arg}_COMPILER_IS_MSVC
+# define ${def_value} __declspec(thread)
+# else
+// ${def_value} not defined for this configuration.
+# endif
+\n")
+ endif()
+ if (feature STREQUAL cxx_attribute_deprecated)
+ set(def_name ${prefix_arg}_${feature_PP})
+ set(def_value "${prefix_arg}_DEPRECATED")
+ set(file_content "${file_content}
+# ifndef ${def_value}
+# if ${def_name}
+# define ${def_value} [[deprecated]]
+# define ${def_value}_MSG(MSG) [[deprecated(MSG)]]
+# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang
+# define ${def_value} __attribute__((__deprecated__))
+# define ${def_value}_MSG(MSG) __attribute__((__deprecated__(MSG)))
+# elif ${prefix_arg}_COMPILER_IS_MSVC
+# define ${def_value} __declspec(deprecated)
+# define ${def_value}_MSG(MSG) __declspec(deprecated(MSG))
+# else
+# define ${def_value}
+# define ${def_value}_MSG(MSG)
+# endif
+# endif
+\n")
+ endif()
+ endforeach()
+
+ set(file_content "${file_content}#endif\n")
+
+ endforeach()
+
+ if(_WCD_OUTPUT_FILES_VAR)
+ foreach(compiler ${_WCD_COMPILERS})
+ foreach(_lang ${_langs})
+ if(compiler_file_content_${compiler}_${_lang})
+ set(CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_}")
+ set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${compiler_file_content_${compiler}_${_lang}}")
+
+ set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h")
+ set(full_path "${main_file_dir}/${compile_file_name}")
+ list(APPEND ${_WCD_OUTPUT_FILES_VAR} ${full_path})
+ configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
+ "${full_path}"
+ @ONLY
+ )
+ endif()
+ endforeach()
+ endforeach()
+ set(${_WCD_OUTPUT_FILES_VAR} ${${_WCD_OUTPUT_FILES_VAR}} PARENT_SCOPE)
+ endif()
+
+ if (_WCD_EPILOG)
+ set(file_content "${file_content}\n${_WCD_EPILOG}\n")
+ endif()
+ set(file_content "${file_content}\n#endif")
+
+ set(CMAKE_CONFIGURABLE_FILE_CONTENT ${file_content})
+ configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
+ "${file_arg}"
+ @ONLY
+ )
+endfunction()
diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in
index 80a879d7e..118de16d6 100644
--- a/Modules/exportheader.cmake.in
+++ b/Modules/exportheader.cmake.in
@@ -23,8 +23,14 @@
#ifndef @DEPRECATED_MACRO_NAME@
# define @DEPRECATED_MACRO_NAME@ @DEFINE_DEPRECATED@
-# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEFINE_DEPRECATED@
-# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEFINE_DEPRECATED@
+#endif
+
+#ifndef @DEPRECATED_MACRO_NAME@_EXPORT
+# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@
+#endif
+
+#ifndef @DEPRECATED_MACRO_NAME@_NO_EXPORT
+# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@
#endif
#cmakedefine01 DEFINE_NO_DEPRECATED
diff --git a/Modules/readme.txt b/Modules/readme.txt
index 2f119947e..1e0c13b6a 100644
--- a/Modules/readme.txt
+++ b/Modules/readme.txt
@@ -1,172 +1,4 @@
-For more information about how to contribute modules to CMake, see this page:
-http://www.itk.org/Wiki/CMake:Module_Maintainers
-
-Note to authors of FindXxx.cmake files
-
-We would like all FindXxx.cmake files to produce consistent variable names.
-
-Please use the following consistent variable names for general use.
-
-Xxx_INCLUDE_DIRS The final set of include directories listed in one variable for use by client code.
- This should not be a cache entry.
-Xxx_LIBRARIES The libraries to link against to use Xxx. These should include full paths.
- This should not be a cache entry.
-Xxx_DEFINITIONS Definitions to use when compiling code that uses Xxx. This really shouldn't include options such
- as (-DHAS_JPEG)that a client source-code file uses to decide whether to #include <jpeg.h>
-Xxx_EXECUTABLE Where to find the Xxx tool.
-Xxx_Yyy_EXECUTABLE Where to find the Yyy tool that comes with Xxx.
-Xxx_LIBRARY_DIRS Optionally, the final set of library directories listed in one variable for use by client code.
- This should not be a cache entry.
-Xxx_ROOT_DIR Where to find the base directory of Xxx.
-Xxx_VERSION_Yy Expect Version Yy if true. Make sure at most one of these is ever true.
-Xxx_WRAP_Yy If False, do not try to use the relevant CMake wrapping command.
-Xxx_Yy_FOUND If False, optional Yy part of Xxx sytem is not available.
-Xxx_FOUND Set to false, or undefined, if we haven't found, or don't want to use Xxx.
-Xxx_NOT_FOUND_MESSAGE Should be set by config-files in the case that it has set Xxx_FOUND to FALSE.
- The contained message will be printed by the find_package() command and by
- find_package_handle_standard_args() to inform the user about the problem.
-Xxx_RUNTIME_LIBRARY_DIRS Optionally, the runtime library search path for use when running an executable linked to
- shared libraries.
- The list should be used by user code to create the PATH on windows or LD_LIBRARY_PATH on unix.
- This should not be a cache entry.
-Xxx_VERSION_STRING A human-readable string containing the version of the package found, if any.
-Xxx_VERSION_MAJOR The major version of the package found, if any.
-Xxx_VERSION_MINOR The minor version of the package found, if any.
-Xxx_VERSION_PATCH The patch version of the package found, if any.
-
-You do not have to provide all of the above variables. You should provide Xxx_FOUND under most circumstances.
-If Xxx is a library, then Xxx_LIBRARIES, should also be defined, and Xxx_INCLUDE_DIRS should usually be
-defined (I guess libm.a might be an exception)
-
-The following names should not usually be used in CMakeLists.txt files, but they may be usefully modified in
-users' CMake Caches to control stuff.
-
-Xxx_LIBRARY Name of Xxx Library. A User may set this and Xxx_INCLUDE_DIR to ignore to force non-use of Xxx.
-Xxx_Yy_LIBRARY Name of Yy library that is part of the Xxx system. It may or may not be required to use Xxx.
-Xxx_INCLUDE_DIR Where to find xxx.h, etc. (Xxx_INCLUDE_PATH was considered bad because a path includes an
- actual filename.)
-Xxx_Yy_INCLUDE_DIR Where to find xxx_yy.h, etc.
-
-For tidiness's sake, try to keep as many options as possible out of the cache, leaving at least one option which can be
-used to disable use of the module, or locate a not-found library (e.g. Xxx_ROOT_DIR).
-For the same reason, mark most cache options as advanced.
-
-If you need other commands to do special things then it should still begin with Xxx_. This gives a sort of namespace
-effect and keeps things tidy for the user. You should put comments describing all the exported settings, plus
-descriptions of any the users can use to control stuff.
-
-You really should also provide backwards compatibility any old settings that were actually in use.
-Make sure you comment them as deprecated, so that no-one starts using them.
-
-To correctly document a module, create a comment block at the top with # comments.
-There are three types of comments that can be in the block:
-
-1. The brief description of the module, this is done by:
-# - a small description
-
-2. A paragraph of text. This is done with all text that has a single
-space between the # and the text. To create a new paragraph, just
-put a # with no text on the line.
-
-3. A verbatim line. This is done with two spaces between the # and the text.
-
-For example:
+See the "Find Modules" section of the cmake-developer(7) manual page.
-# - This is a cool module
-# This module does really cool stuff.
-# It can do even more than you think.
-#
-# It even needs to paragraphs to tell you about it.
-# And it defines the following variables:
-# VAR_COOL - this is great isn't it?
-# VAR_REALLY_COOL - cool right?
-#
-
-Test the documentation formatting by running "cmake --help-module FindXxx".
-Edit the comments until the output of this command looks satisfactory.
-
-To have a .cmake file in this directory NOT show up in the
-modules documentation, you should start the file with a blank
-line.
-
-After the documentation, leave a *BLANK* line, and then add a
-copyright and licence notice block like this one:
-
-#=============================================================================
-# Copyright 2009-2011 Your Name
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-The layout of the notice block is strictly enforced by the ModuleNotices test.
-Only the year range and name may be changed freely.
-
-A FindXxx.cmake module will typically be loaded by the command
-
- FIND_PACKAGE(Xxx [major[.minor[.patch[.tweak]]]] [EXACT]
- [QUIET] [[REQUIRED|COMPONENTS] [components...]])
-
-If any version numbers are given to the command it will set the
-following variables before loading the module:
-
- Xxx_FIND_VERSION = full requested version string
- Xxx_FIND_VERSION_MAJOR = major version if requested, else 0
- Xxx_FIND_VERSION_MINOR = minor version if requested, else 0
- Xxx_FIND_VERSION_PATCH = patch version if requested, else 0
- Xxx_FIND_VERSION_TWEAK = tweak version if requested, else 0
- Xxx_FIND_VERSION_COUNT = number of version components, 0 to 4
- Xxx_FIND_VERSION_EXACT = true if EXACT option was given
-
-If the find module supports versioning it should locate a version of
-the package that is compatible with the version requested. If a
-compatible version of the package cannot be found the module should
-not report success. The version of the package found should be stored
-in "Xxx_VERSION..." version variables documented by the module.
-
-If the QUIET option is given to the command it will set the variable
-Xxx_FIND_QUIETLY to true before loading the FindXxx.cmake module. If
-this variable is set the module should not complain about not being
-able to find the package. If the
-REQUIRED option is given to the command it will set the variable
-Xxx_FIND_REQUIRED to true before loading the FindXxx.cmake module. If
-this variable is set the module should issue a FATAL_ERROR if the
-package cannot be found.
-If neither the QUIET nor REQUIRED options are given then the
-FindXxx.cmake module should look for the package and complain without
-error if the module is not found.
-
-FIND_PACKAGE() will set the variable CMAKE_FIND_PACKAGE_NAME to
-contain the actual name of the package.
-
-A package can provide sub-components.
-Those components can be listed after the COMPONENTS (or REQUIRED)
-or OPTIONAL_COMPONENTS keywords. The set of all listed components will be
-specified in a Xxx_FIND_COMPONENTS variable.
-For each package-specific component, say Yyy, a variable Xxx_FIND_REQUIRED_Yyy
-will be set to true if it listed after COMPONENTS and it will be set to false
-if it was listed after OPTIONAL_COMPONENTS.
-Using those variables a FindXxx.cmake module and also a XxxConfig.cmake package
-configuration file can determine whether and which components have been requested,
-and whether they were requested as required or as optional.
-For each of the requested components a Xxx_Yyy_FOUND variable should be set
-accordingly.
-The per-package Xxx_FOUND variable should be only set to true if all requested
-required components have been found. A missing optional component should not
-keep the Xxx_FOUND variable from being set to true.
-If the package provides Xxx_INCLUDE_DIRS and Xxx_LIBRARIES variables, the include
-dirs and libraries for all components which were requested and which have been
-found should be added to those two variables.
-
-To get this behaviour you can use the FIND_PACKAGE_HANDLE_STANDARD_ARGS()
-macro, as an example see FindJPEG.cmake.
-
-For internal implementation, it's a generally accepted convention that variables starting with
-underscore are for temporary use only. (variable starting with an underscore
-are not intended as a reserved prefix).
+For more information about how to contribute modules to CMake, see this page:
+https://cmake.org/Wiki/CMake:Module_Maintainers