summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/AddFileDependencies.cmake29
-rw-r--r--Modules/AutomocInfo.cmake.in16
-rw-r--r--Modules/BasicConfigVersion-AnyNewerVersion.cmake.in31
-rw-r--r--Modules/BasicConfigVersion-ExactVersion.cmake.in47
-rw-r--r--Modules/BasicConfigVersion-SameMajorVersion.cmake.in46
-rw-r--r--Modules/BundleUtilities.cmake786
-rw-r--r--Modules/CMake.cmake17
-rw-r--r--Modules/CMakeASM-ATTInformation.cmake25
-rw-r--r--Modules/CMakeASMCompiler.cmake.in12
-rw-r--r--Modules/CMakeASMInformation.cmake130
-rw-r--r--Modules/CMakeASM_MASMInformation.cmake24
-rw-r--r--Modules/CMakeASM_NASMInformation.cmake46
-rw-r--r--Modules/CMakeAddFortranSubdirectory.cmake206
-rw-r--r--Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in2
-rw-r--r--Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in9
-rw-r--r--Modules/CMakeAddNewLanguage.txt17
-rw-r--r--Modules/CMakeBackwardCompatibilityC.cmake100
-rw-r--r--Modules/CMakeBackwardCompatibilityCXX.cmake54
-rw-r--r--Modules/CMakeBorlandFindMake.cmake17
-rw-r--r--Modules/CMakeBuildSettings.cmake.in13
-rw-r--r--Modules/CMakeCCompiler.cmake.in53
-rw-r--r--Modules/CMakeCCompilerABI.c28
-rw-r--r--Modules/CMakeCCompilerId.c.in204
-rw-r--r--Modules/CMakeCInformation.cmake219
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in54
-rw-r--r--Modules/CMakeCXXCompilerABI.cpp20
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in187
-rw-r--r--Modules/CMakeCXXInformation.cmake299
-rw-r--r--Modules/CMakeClDeps.cmake37
-rw-r--r--Modules/CMakeCommonLanguageInclude.cmake107
-rw-r--r--Modules/CMakeCompilerABI.h36
-rw-r--r--Modules/CMakeConfigurableFile.in2
-rw-r--r--Modules/CMakeDependentOption.cmake51
-rw-r--r--Modules/CMakeDetermineASM-ATTCompiler.cmake20
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake182
-rw-r--r--Modules/CMakeDetermineASM_MASMCompiler.cmake27
-rw-r--r--Modules/CMakeDetermineASM_NASMCompiler.cmake27
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake179
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake188
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake131
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake323
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake228
-rw-r--r--Modules/CMakeDetermineJavaCompiler.cmake102
-rw-r--r--Modules/CMakeDetermineRCCompiler.cmake67
-rw-r--r--Modules/CMakeDetermineSystem.cmake176
-rw-r--r--Modules/CMakeDetermineVSServicePack.cmake187
-rw-r--r--Modules/CMakeExpandImportedTargets.cmake129
-rw-r--r--Modules/CMakeExportBuildSettings.cmake36
-rw-r--r--Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake109
-rw-r--r--Modules/CMakeFindBinUtils.cmake75
-rw-r--r--Modules/CMakeFindCodeBlocks.cmake25
-rw-r--r--Modules/CMakeFindEclipseCDT4.cmake79
-rw-r--r--Modules/CMakeFindFrameworks.cmake32
-rw-r--r--Modules/CMakeFindKDevelop3.cmake23
-rw-r--r--Modules/CMakeFindPackageMode.cmake188
-rw-r--r--Modules/CMakeFindWMake.cmake17
-rw-r--r--Modules/CMakeFindXCode.cmake20
-rw-r--r--Modules/CMakeForceCompiler.cmake82
-rw-r--r--Modules/CMakeFortranCompiler.cmake.in52
-rw-r--r--Modules/CMakeFortranCompilerABI.F38
-rw-r--r--Modules/CMakeFortranCompilerId.F.in123
-rw-r--r--Modules/CMakeFortranInformation.cmake245
-rw-r--r--Modules/CMakeGenericSystem.cmake187
-rw-r--r--Modules/CMakeImportBuildSettings.cmake24
-rw-r--r--Modules/CMakeJOMFindMake.cmake18
-rw-r--r--Modules/CMakeJavaCompiler.cmake.in13
-rw-r--r--Modules/CMakeJavaInformation.cmake59
-rw-r--r--Modules/CMakeMSYSFindMake.cmake20
-rw-r--r--Modules/CMakeMinGWFindMake.cmake24
-rw-r--r--Modules/CMakeNMakeFindMake.cmake18
-rw-r--r--Modules/CMakeNinjaFindMake.cmake17
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake227
-rw-r--r--Modules/CMakeParseArguments.cmake138
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake128
-rw-r--r--Modules/CMakePlatformId.h.in157
-rw-r--r--Modules/CMakePrintSystemInformation.cmake46
-rw-r--r--Modules/CMakePushCheckState.cmake61
-rw-r--r--Modules/CMakeRCCompiler.cmake.in6
-rw-r--r--Modules/CMakeRCInformation.cmake53
-rw-r--r--Modules/CMakeSystem.cmake.in15
-rw-r--r--Modules/CMakeSystemSpecificInformation.cmake69
-rw-r--r--Modules/CMakeTestASM-ATTCompiler.cmake23
-rw-r--r--Modules/CMakeTestASMCompiler.cmake35
-rw-r--r--Modules/CMakeTestASM_MASMCompiler.cmake23
-rw-r--r--Modules/CMakeTestASM_NASMCompiler.cmake23
-rw-r--r--Modules/CMakeTestCCompiler.cmake87
-rw-r--r--Modules/CMakeTestCXXCompiler.cmake80
-rw-r--r--Modules/CMakeTestCompilerCommon.cmake21
-rw-r--r--Modules/CMakeTestForFreeVC.cxx3
-rw-r--r--Modules/CMakeTestFortranCompiler.cmake101
-rw-r--r--Modules/CMakeTestGNU.c9
-rw-r--r--Modules/CMakeTestJavaCompiler.cmake20
-rw-r--r--Modules/CMakeTestNMakeCLVersion.c2
-rw-r--r--Modules/CMakeTestRCCompiler.cmake23
-rw-r--r--Modules/CMakeTestWatcomVersion.c1
-rw-r--r--Modules/CMakeUnixFindMake.cmake16
-rw-r--r--Modules/CMakeVS10FindMake.cmake54
-rw-r--r--Modules/CMakeVS11FindMake.cmake54
-rw-r--r--Modules/CMakeVS6BackwardCompatibility.cmake26
-rw-r--r--Modules/CMakeVS6FindMake.cmake25
-rw-r--r--Modules/CMakeVS71FindMake.cmake26
-rw-r--r--Modules/CMakeVS7BackwardCompatibility.cmake26
-rw-r--r--Modules/CMakeVS7FindMake.cmake25
-rw-r--r--Modules/CMakeVS8FindMake.cmake34
-rw-r--r--Modules/CMakeVS9FindMake.cmake39
-rw-r--r--Modules/CMakeVerifyManifest.cmake115
-rw-r--r--Modules/CPack.DS_Store.inbin0 -> 12292 bytes
-rw-r--r--Modules/CPack.Description.plist.in12
-rw-r--r--Modules/CPack.Info.plist.in37
-rwxr-xr-xModules/CPack.OSXScriptLauncher.inbin0 -> 29592 bytes
-rw-r--r--Modules/CPack.OSXScriptLauncher.rsrc.inbin0 -> 362 bytes
-rw-r--r--Modules/CPack.OSXX11.Info.plist.in49
-rw-r--r--Modules/CPack.OSXX11.main.scpt.inbin0 -> 1870 bytes
-rwxr-xr-xModules/CPack.RuntimeScript.in87
-rwxr-xr-xModules/CPack.STGZ_Header.sh.in141
-rw-r--r--Modules/CPack.VolumeIcon.icns.inbin0 -> 45739 bytes
-rw-r--r--Modules/CPack.background.png.inbin0 -> 47076 bytes
-rw-r--r--Modules/CPack.cmake579
-rw-r--r--Modules/CPack.distribution.dist.in9
-rw-r--r--Modules/CPackBundle.cmake48
-rw-r--r--Modules/CPackComponent.cmake513
-rw-r--r--Modules/CPackCygwin.cmake33
-rw-r--r--Modules/CPackDMG.cmake70
-rw-r--r--Modules/CPackDeb.cmake421
-rw-r--r--Modules/CPackNSIS.cmake147
-rw-r--r--Modules/CPackPackageMaker.cmake35
-rw-r--r--Modules/CPackRPM.cmake925
-rw-r--r--Modules/CPackZIP.cmake41
-rw-r--r--Modules/CTest.cmake286
-rw-r--r--Modules/CTestScriptMode.cmake24
-rw-r--r--Modules/CTestTargets.cmake95
-rw-r--r--Modules/CheckCCompilerFlag.cmake45
-rw-r--r--Modules/CheckCSourceCompiles.cmake95
-rw-r--r--Modules/CheckCSourceRuns.cmake91
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake48
-rw-r--r--Modules/CheckCXXSourceCompiles.cmake96
-rw-r--r--Modules/CheckCXXSourceRuns.cmake91
-rw-r--r--Modules/CheckCXXSymbolExists.cmake42
-rw-r--r--Modules/CheckForPthreads.c38
-rw-r--r--Modules/CheckFortranFunctionExists.cmake69
-rw-r--r--Modules/CheckFunctionExists.c23
-rw-r--r--Modules/CheckFunctionExists.cmake74
-rw-r--r--Modules/CheckIncludeFile.c.in13
-rw-r--r--Modules/CheckIncludeFile.cmake77
-rw-r--r--Modules/CheckIncludeFile.cxx.in6
-rw-r--r--Modules/CheckIncludeFileCXX.cmake77
-rw-r--r--Modules/CheckIncludeFiles.cmake82
-rw-r--r--Modules/CheckLanguage.cmake65
-rw-r--r--Modules/CheckLibraryExists.cmake70
-rw-r--r--Modules/CheckLibraryExists.lists.in8
-rw-r--r--Modules/CheckPrototypeDefinition.c.in29
-rw-r--r--Modules/CheckPrototypeDefinition.cmake101
-rw-r--r--Modules/CheckSizeOf.cmake18
-rw-r--r--Modules/CheckStructHasMember.cmake51
-rw-r--r--Modules/CheckSymbolExists.cmake101
-rw-r--r--Modules/CheckTypeSize.c.in37
-rw-r--r--Modules/CheckTypeSize.cmake196
-rw-r--r--Modules/CheckTypeSizeMap.cmake.in1
-rw-r--r--Modules/CheckVariableExists.c20
-rw-r--r--Modules/CheckVariableExists.cmake66
-rw-r--r--Modules/Compiler/Absoft-Fortran.cmake10
-rw-r--r--Modules/Compiler/Clang-C.cmake1
-rw-r--r--Modules/Compiler/Clang-CXX.cmake1
-rw-r--r--Modules/Compiler/Cray-C.cmake1
-rw-r--r--Modules/Compiler/Cray-CXX.cmake1
-rw-r--r--Modules/Compiler/Cray-Fortran.cmake6
-rw-r--r--Modules/Compiler/G95-Fortran.cmake9
-rw-r--r--Modules/Compiler/GNU-ASM.cmake6
-rw-r--r--Modules/Compiler/GNU-C.cmake2
-rw-r--r--Modules/Compiler/GNU-CXX.cmake2
-rw-r--r--Modules/Compiler/GNU-Fortran.cmake17
-rw-r--r--Modules/Compiler/GNU.cmake54
-rw-r--r--Modules/Compiler/HP-ASM.cmake3
-rw-r--r--Modules/Compiler/HP-C.cmake4
-rw-r--r--Modules/Compiler/HP-CXX.cmake4
-rw-r--r--Modules/Compiler/HP-Fortran.cmake3
-rw-r--r--Modules/Compiler/Intel-ASM.cmake13
-rw-r--r--Modules/Compiler/Intel-C.cmake10
-rw-r--r--Modules/Compiler/Intel-CXX.cmake10
-rw-r--r--Modules/Compiler/Intel-Fortran.cmake9
-rw-r--r--Modules/Compiler/MIPSpro-C.cmake1
-rw-r--r--Modules/Compiler/MIPSpro-CXX.cmake1
-rw-r--r--Modules/Compiler/MIPSpro-Fortran.cmake3
-rw-r--r--Modules/Compiler/NAG-Fortran.cmake34
-rw-r--r--Modules/Compiler/PGI-C.cmake4
-rw-r--r--Modules/Compiler/PGI-CXX.cmake4
-rw-r--r--Modules/Compiler/PGI-Fortran.cmake15
-rw-r--r--Modules/Compiler/PGI.cmake35
-rw-r--r--Modules/Compiler/PathScale-C.cmake4
-rw-r--r--Modules/Compiler/PathScale-CXX.cmake4
-rw-r--r--Modules/Compiler/PathScale-Fortran.cmake6
-rw-r--r--Modules/Compiler/PathScale.cmake31
-rw-r--r--Modules/Compiler/SCO-C.cmake2
-rw-r--r--Modules/Compiler/SCO-CXX.cmake2
-rw-r--r--Modules/Compiler/SCO.cmake28
-rw-r--r--Modules/Compiler/SunPro-ASM.cmake24
-rw-r--r--Modules/Compiler/SunPro-C.cmake27
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake33
-rw-r--r--Modules/Compiler/SunPro-Fortran.cmake18
-rw-r--r--Modules/Compiler/TinyCC-C.cmake8
-rw-r--r--Modules/Compiler/VisualAge-C.cmake1
-rw-r--r--Modules/Compiler/VisualAge-CXX.cmake1
-rw-r--r--Modules/Compiler/VisualAge-Fortran.cmake1
-rw-r--r--Modules/Compiler/XL-ASM.cmake13
-rw-r--r--Modules/Compiler/XL-C.cmake9
-rw-r--r--Modules/Compiler/XL-CXX.cmake11
-rw-r--r--Modules/Compiler/XL-Fortran.cmake17
-rw-r--r--Modules/Compiler/XL.cmake53
-rw-r--r--Modules/Dart.cmake124
-rw-r--r--Modules/DartConfiguration.tcl.in93
-rw-r--r--Modules/DeployQt4.cmake301
-rw-r--r--Modules/Documentation.cmake52
-rw-r--r--Modules/DummyCXXFile.cxx4
-rw-r--r--Modules/ExternalProject.cmake1553
-rw-r--r--Modules/FLTKCompatibility.cmake15
-rw-r--r--Modules/FeatureSummary.cmake466
-rw-r--r--Modules/FindALSA.cmake55
-rw-r--r--Modules/FindASPELL.cmake37
-rw-r--r--Modules/FindAVIFile.cmake48
-rw-r--r--Modules/FindArmadillo.cmake95
-rw-r--r--Modules/FindBISON.cmake175
-rw-r--r--Modules/FindBLAS.cmake606
-rw-r--r--Modules/FindBZip2.cmake56
-rw-r--r--Modules/FindBoost.cmake1211
-rw-r--r--Modules/FindBullet.cmake84
-rw-r--r--Modules/FindCABLE.cmake81
-rw-r--r--Modules/FindCUDA.cmake1367
-rw-r--r--Modules/FindCUDA/make2cmake.cmake93
-rw-r--r--Modules/FindCUDA/parse_cubin.cmake112
-rw-r--r--Modules/FindCUDA/run_nvcc.cmake280
-rw-r--r--Modules/FindCURL.cmake59
-rw-r--r--Modules/FindCVS.cmake69
-rw-r--r--Modules/FindCoin3D.cmake84
-rw-r--r--Modules/FindCups.cmake69
-rw-r--r--Modules/FindCurses.cmake176
-rw-r--r--Modules/FindCxxTest.cmake200
-rw-r--r--Modules/FindCygwin.cmake28
-rw-r--r--Modules/FindDCMTK.cmake154
-rw-r--r--Modules/FindDart.cmake36
-rw-r--r--Modules/FindDevIL.cmake74
-rw-r--r--Modules/FindDoxygen.cmake144
-rw-r--r--Modules/FindEXPAT.cmake60
-rw-r--r--Modules/FindFLEX.cmake161
-rw-r--r--Modules/FindFLTK.cmake309
-rw-r--r--Modules/FindFLTK2.cmake267
-rw-r--r--Modules/FindFreetype.cmake110
-rw-r--r--Modules/FindGCCXML.cmake27
-rw-r--r--Modules/FindGDAL.cmake107
-rw-r--r--Modules/FindGIF.cmake80
-rw-r--r--Modules/FindGLU.cmake28
-rw-r--r--Modules/FindGLUT.cmake90
-rw-r--r--Modules/FindGTK.cmake165
-rw-r--r--Modules/FindGTK2.cmake590
-rw-r--r--Modules/FindGTest.cmake158
-rw-r--r--Modules/FindGettext.cmake220
-rw-r--r--Modules/FindGit.cmake62
-rw-r--r--Modules/FindGnuTLS.cmake69
-rw-r--r--Modules/FindGnuplot.cmake57
-rw-r--r--Modules/FindHDF5.cmake385
-rw-r--r--Modules/FindHSPELL.cmake46
-rw-r--r--Modules/FindHTMLHelp.cmake54
-rw-r--r--Modules/FindITK.cmake57
-rw-r--r--Modules/FindImageMagick.cmake237
-rw-r--r--Modules/FindJNI.cmake261
-rw-r--r--Modules/FindJPEG.cmake43
-rw-r--r--Modules/FindJasper.cmake53
-rw-r--r--Modules/FindJava.cmake204
-rw-r--r--Modules/FindKDE3.cmake299
-rw-r--r--Modules/FindKDE4.cmake100
-rw-r--r--Modules/FindLAPACK.cmake336
-rw-r--r--Modules/FindLATEX.cmake126
-rw-r--r--Modules/FindLibArchive.cmake67
-rw-r--r--Modules/FindLibLZMA.cmake69
-rw-r--r--Modules/FindLibXml2.cmake66
-rw-r--r--Modules/FindLibXslt.cmake74
-rw-r--r--Modules/FindLua50.cmake90
-rw-r--r--Modules/FindLua51.cmake81
-rw-r--r--Modules/FindMFC.cmake60
-rw-r--r--Modules/FindMPEG.cmake44
-rw-r--r--Modules/FindMPEG2.cmake54
-rw-r--r--Modules/FindMPI.cmake631
-rw-r--r--Modules/FindMatlab.cmake120
-rw-r--r--Modules/FindMotif.cmake44
-rw-r--r--Modules/FindOpenAL.cmake99
-rw-r--r--Modules/FindOpenGL.cmake160
-rw-r--r--Modules/FindOpenMP.cmake167
-rw-r--r--Modules/FindOpenSSL.cmake304
-rw-r--r--Modules/FindOpenSceneGraph.cmake246
-rw-r--r--Modules/FindOpenThreads.cmake123
-rw-r--r--Modules/FindPHP4.cmake85
-rw-r--r--Modules/FindPNG.cmake75
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake296
-rw-r--r--Modules/FindPackageMessage.cmake49
-rw-r--r--Modules/FindPerl.cmake83
-rw-r--r--Modules/FindPerlLibs.cmake255
-rw-r--r--Modules/FindPhysFS.cmake57
-rw-r--r--Modules/FindPike.cmake37
-rw-r--r--Modules/FindPkgConfig.cmake373
-rw-r--r--Modules/FindPostgreSQL.cmake172
-rw-r--r--Modules/FindProducer.cmake78
-rw-r--r--Modules/FindProtobuf.cmake218
-rw-r--r--Modules/FindPythonInterp.cmake141
-rw-r--r--Modules/FindPythonLibs.cmake275
-rw-r--r--Modules/FindQt.cmake160
-rw-r--r--Modules/FindQt3.cmake302
-rw-r--r--Modules/FindQt4.cmake1216
-rw-r--r--Modules/FindQuickTime.cmake47
-rw-r--r--Modules/FindRTI.cmake102
-rw-r--r--Modules/FindRuby.cmake243
-rw-r--r--Modules/FindSDL.cmake173
-rw-r--r--Modules/FindSDL_image.cmake70
-rw-r--r--Modules/FindSDL_mixer.cmake70
-rw-r--r--Modules/FindSDL_net.cmake69
-rw-r--r--Modules/FindSDL_sound.cmake401
-rw-r--r--Modules/FindSDL_ttf.cmake70
-rw-r--r--Modules/FindSWIG.cmake68
-rw-r--r--Modules/FindSelfPackers.cmake68
-rw-r--r--Modules/FindSquish.cmake125
-rw-r--r--Modules/FindSubversion.cmake131
-rw-r--r--Modules/FindTCL.cmake215
-rw-r--r--Modules/FindTIFF.cmake48
-rw-r--r--Modules/FindTclStub.cmake130
-rw-r--r--Modules/FindTclsh.cmake100
-rw-r--r--Modules/FindThreads.cmake166
-rw-r--r--Modules/FindUnixCommands.cmake93
-rw-r--r--Modules/FindVTK.cmake141
-rw-r--r--Modules/FindWget.cmake36
-rw-r--r--Modules/FindWish.cmake85
-rw-r--r--Modules/FindX11.cmake492
-rw-r--r--Modules/FindXMLRPC.cmake146
-rw-r--r--Modules/FindZLIB.cmake92
-rw-r--r--Modules/Findosg.cmake54
-rw-r--r--Modules/FindosgAnimation.cmake51
-rw-r--r--Modules/FindosgDB.cmake51
-rw-r--r--Modules/FindosgFX.cmake51
-rw-r--r--Modules/FindosgGA.cmake51
-rw-r--r--Modules/FindosgIntrospection.cmake51
-rw-r--r--Modules/FindosgManipulator.cmake51
-rw-r--r--Modules/FindosgParticle.cmake51
-rw-r--r--Modules/FindosgPresentation.cmake52
-rw-r--r--Modules/FindosgProducer.cmake51
-rw-r--r--Modules/FindosgQt.cmake52
-rw-r--r--Modules/FindosgShadow.cmake51
-rw-r--r--Modules/FindosgSim.cmake51
-rw-r--r--Modules/FindosgTerrain.cmake51
-rw-r--r--Modules/FindosgText.cmake51
-rw-r--r--Modules/FindosgUtil.cmake51
-rw-r--r--Modules/FindosgViewer.cmake51
-rw-r--r--Modules/FindosgVolume.cmake51
-rw-r--r--Modules/FindosgWidget.cmake51
-rw-r--r--Modules/Findosg_functions.cmake105
-rw-r--r--Modules/FindwxWidgets.cmake1044
-rw-r--r--Modules/FindwxWindows.cmake706
-rw-r--r--Modules/FortranCInterface.cmake293
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt108
-rw-r--r--Modules/FortranCInterface/Detect.cmake183
-rw-r--r--Modules/FortranCInterface/Input.cmake.in3
-rw-r--r--Modules/FortranCInterface/Macro.h.in4
-rw-r--r--Modules/FortranCInterface/Output.cmake.in33
-rw-r--r--Modules/FortranCInterface/Verify/CMakeLists.txt34
-rw-r--r--Modules/FortranCInterface/Verify/VerifyC.c5
-rw-r--r--Modules/FortranCInterface/Verify/VerifyCXX.cxx4
-rw-r--r--Modules/FortranCInterface/Verify/VerifyFortran.f3
-rw-r--r--Modules/FortranCInterface/Verify/main.c16
-rw-r--r--Modules/FortranCInterface/call_mod.f906
-rw-r--r--Modules/FortranCInterface/call_sub.f4
-rw-r--r--Modules/FortranCInterface/main.F6
-rw-r--r--Modules/FortranCInterface/my_module.f908
-rw-r--r--Modules/FortranCInterface/my_module_.c1
-rw-r--r--Modules/FortranCInterface/my_sub.f2
-rw-r--r--Modules/FortranCInterface/mymodule.f908
-rw-r--r--Modules/FortranCInterface/mymodule_.c1
-rw-r--r--Modules/FortranCInterface/mysub.f2
-rw-r--r--Modules/FortranCInterface/symbol.c.in4
-rw-r--r--Modules/GNUInstallDirs.cmake188
-rw-r--r--Modules/GenerateExportHeader.cmake351
-rw-r--r--Modules/GetPrerequisites.cmake877
-rw-r--r--Modules/ITKCompatibility.cmake17
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake401
-rw-r--r--Modules/IntelVSImplicitPath/CMakeLists.txt7
-rw-r--r--Modules/IntelVSImplicitPath/detect.cmake9
-rw-r--r--Modules/IntelVSImplicitPath/hello.f0
-rw-r--r--Modules/KDE3Macros.cmake411
-rw-r--r--Modules/MacOSXBundleInfo.plist.in36
-rw-r--r--Modules/MacOSXFrameworkInfo.plist.in26
-rw-r--r--Modules/MacroAddFileDependencies.cmake33
-rw-r--r--Modules/NSIS.InstallOptions.ini.in46
-rw-r--r--Modules/NSIS.template.in972
-rw-r--r--Modules/Platform/AIX-GNU-ASM.cmake2
-rw-r--r--Modules/Platform/AIX-GNU-C.cmake2
-rw-r--r--Modules/Platform/AIX-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/AIX-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/AIX-GNU.cmake26
-rw-r--r--Modules/Platform/AIX-VisualAge-C.cmake1
-rw-r--r--Modules/Platform/AIX-VisualAge-CXX.cmake1
-rw-r--r--Modules/Platform/AIX-VisualAge-Fortran.cmake1
-rw-r--r--Modules/Platform/AIX-XL-ASM.cmake2
-rw-r--r--Modules/Platform/AIX-XL-C.cmake2
-rw-r--r--Modules/Platform/AIX-XL-CXX.cmake2
-rw-r--r--Modules/Platform/AIX-XL-Fortran.cmake2
-rw-r--r--Modules/Platform/AIX-XL.cmake28
-rw-r--r--Modules/Platform/AIX.cmake29
-rw-r--r--Modules/Platform/BSDOS.cmake2
-rw-r--r--Modules/Platform/BeOS.cmake12
-rw-r--r--Modules/Platform/BlueGeneL.cmake40
-rw-r--r--Modules/Platform/BlueGeneP-base.cmake125
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-XL-C.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-dynamic.cmake19
-rw-r--r--Modules/Platform/BlueGeneP-static-GNU-C.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-static-GNU-CXX.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-static-XL-C.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-static-XL-CXX.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-static-XL-Fortran.cmake16
-rw-r--r--Modules/Platform/BlueGeneP-static.cmake19
-rw-r--r--Modules/Platform/CYGWIN-GNU-C.cmake2
-rw-r--r--Modules/Platform/CYGWIN-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/CYGWIN-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/CYGWIN-GNU.cmake56
-rw-r--r--Modules/Platform/CYGWIN-windres.cmake1
-rw-r--r--Modules/Platform/CYGWIN.cmake64
-rw-r--r--Modules/Platform/Catamount.cmake26
-rw-r--r--Modules/Platform/Darwin-Absoft-Fortran.cmake1
-rw-r--r--Modules/Platform/Darwin-GNU-C.cmake4
-rw-r--r--Modules/Platform/Darwin-GNU-CXX.cmake4
-rw-r--r--Modules/Platform/Darwin-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Darwin-GNU.cmake64
-rw-r--r--Modules/Platform/Darwin-NAG-Fortran.cmake5
-rw-r--r--Modules/Platform/Darwin-VisualAge-C.cmake1
-rw-r--r--Modules/Platform/Darwin-VisualAge-CXX.cmake1
-rw-r--r--Modules/Platform/Darwin-XL-C.cmake5
-rw-r--r--Modules/Platform/Darwin-XL-CXX.cmake5
-rw-r--r--Modules/Platform/Darwin-icc.cmake131
-rw-r--r--Modules/Platform/Darwin-icpc.cmake3
-rw-r--r--Modules/Platform/Darwin.cmake268
-rw-r--r--Modules/Platform/DragonFly.cmake5
-rw-r--r--Modules/Platform/FreeBSD.cmake28
-rw-r--r--Modules/Platform/GNU.cmake13
-rw-r--r--Modules/Platform/GNUtoMS_lib.bat.in3
-rw-r--r--Modules/Platform/GNUtoMS_lib.cmake10
-rw-r--r--Modules/Platform/Generic-ADSP-ASM.cmake7
-rw-r--r--Modules/Platform/Generic-ADSP-C.cmake20
-rw-r--r--Modules/Platform/Generic-ADSP-CXX.cmake18
-rw-r--r--Modules/Platform/Generic-ADSP-Common.cmake120
-rw-r--r--Modules/Platform/Generic-SDCC-C.cmake54
-rw-r--r--Modules/Platform/Generic.cmake17
-rw-r--r--Modules/Platform/HP-UX-GNU-C.cmake2
-rw-r--r--Modules/Platform/HP-UX-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/HP-UX-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/HP-UX-GNU.cmake27
-rw-r--r--Modules/Platform/HP-UX-HP-ASM.cmake2
-rw-r--r--Modules/Platform/HP-UX-HP-C.cmake6
-rw-r--r--Modules/Platform/HP-UX-HP-CXX.cmake14
-rw-r--r--Modules/Platform/HP-UX-HP-Fortran.cmake2
-rw-r--r--Modules/Platform/HP-UX-HP.cmake31
-rw-r--r--Modules/Platform/HP-UX.cmake50
-rw-r--r--Modules/Platform/Haiku.cmake24
-rw-r--r--Modules/Platform/IRIX.cmake45
-rw-r--r--Modules/Platform/IRIX64.cmake73
-rw-r--r--Modules/Platform/Linux-Absoft-Fortran.cmake1
-rw-r--r--Modules/Platform/Linux-Clang-C.cmake1
-rw-r--r--Modules/Platform/Linux-Clang-CXX.cmake1
-rw-r--r--Modules/Platform/Linux-GNU-C.cmake2
-rw-r--r--Modules/Platform/Linux-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Linux-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/Linux-GNU.cmake25
-rw-r--r--Modules/Platform/Linux-Intel-C.cmake2
-rw-r--r--Modules/Platform/Linux-Intel-CXX.cmake2
-rw-r--r--Modules/Platform/Linux-Intel-Fortran.cmake4
-rw-r--r--Modules/Platform/Linux-Intel.cmake50
-rw-r--r--Modules/Platform/Linux-NAG-Fortran.cmake10
-rw-r--r--Modules/Platform/Linux-PGI-C.cmake2
-rw-r--r--Modules/Platform/Linux-PGI-CXX.cmake2
-rw-r--r--Modules/Platform/Linux-PGI-Fortran.cmake2
-rw-r--r--Modules/Platform/Linux-PGI.cmake27
-rw-r--r--Modules/Platform/Linux-PathScale-C.cmake2
-rw-r--r--Modules/Platform/Linux-PathScale-CXX.cmake2
-rw-r--r--Modules/Platform/Linux-PathScale-Fortran.cmake2
-rw-r--r--Modules/Platform/Linux-PathScale.cmake27
-rw-r--r--Modules/Platform/Linux-SunPro-CXX.cmake9
-rw-r--r--Modules/Platform/Linux-TinyCC-C.cmake4
-rw-r--r--Modules/Platform/Linux-VisualAge-C.cmake1
-rw-r--r--Modules/Platform/Linux-VisualAge-CXX.cmake1
-rw-r--r--Modules/Platform/Linux-VisualAge-Fortran.cmake1
-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-como.cmake17
-rw-r--r--Modules/Platform/Linux.cmake57
-rw-r--r--Modules/Platform/MP-RAS.cmake14
-rw-r--r--Modules/Platform/NetBSD.cmake15
-rw-r--r--Modules/Platform/OSF1.cmake47
-rw-r--r--Modules/Platform/OpenBSD.cmake18
-rw-r--r--Modules/Platform/OpenVMS.cmake8
-rw-r--r--Modules/Platform/QNX.cmake33
-rw-r--r--Modules/Platform/RISCos.cmake6
-rw-r--r--Modules/Platform/SCO_SV.cmake2
-rw-r--r--Modules/Platform/SINIX.cmake4
-rw-r--r--Modules/Platform/SunOS-GNU-C.cmake2
-rw-r--r--Modules/Platform/SunOS-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/SunOS-GNU-Fortran.cmake2
-rw-r--r--Modules/Platform/SunOS-GNU.cmake34
-rw-r--r--Modules/Platform/SunOS.cmake32
-rw-r--r--Modules/Platform/Tru64.cmake2
-rw-r--r--Modules/Platform/ULTRIX.cmake5
-rw-r--r--Modules/Platform/UNIX_SV.cmake5
-rw-r--r--Modules/Platform/UnixPaths.cmake88
-rw-r--r--Modules/Platform/UnixWare.cmake5
-rw-r--r--Modules/Platform/Windows-Borland-C.cmake1
-rw-r--r--Modules/Platform/Windows-Borland-CXX.cmake1
-rw-r--r--Modules/Platform/Windows-Embarcadero-C.cmake3
-rw-r--r--Modules/Platform/Windows-Embarcadero-CXX.cmake3
-rw-r--r--Modules/Platform/Windows-Embarcadero.cmake130
-rw-r--r--Modules/Platform/Windows-G95-Fortran.cmake1
-rw-r--r--Modules/Platform/Windows-GNU-C-ABI.cmake1
-rw-r--r--Modules/Platform/Windows-GNU-C.cmake2
-rw-r--r--Modules/Platform/Windows-GNU-CXX-ABI.cmake1
-rw-r--r--Modules/Platform/Windows-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Windows-GNU-Fortran-ABI.cmake1
-rw-r--r--Modules/Platform/Windows-GNU-Fortran.cmake5
-rw-r--r--Modules/Platform/Windows-GNU.cmake187
-rw-r--r--Modules/Platform/Windows-Intel-ASM.cmake2
-rw-r--r--Modules/Platform/Windows-Intel-C.cmake2
-rw-r--r--Modules/Platform/Windows-Intel-CXX.cmake4
-rw-r--r--Modules/Platform/Windows-Intel-Fortran.cmake11
-rw-r--r--Modules/Platform/Windows-Intel.cmake108
-rw-r--r--Modules/Platform/Windows-NMcl.cmake4
-rw-r--r--Modules/Platform/Windows-cl.cmake253
-rw-r--r--Modules/Platform/Windows-cl.cmake.in14
-rw-r--r--Modules/Platform/Windows-df.cmake70
-rw-r--r--Modules/Platform/Windows-wcl386.cmake122
-rw-r--r--Modules/Platform/Windows-windres.cmake1
-rw-r--r--Modules/Platform/Windows.cmake36
-rw-r--r--Modules/Platform/WindowsPaths.cmake96
-rw-r--r--Modules/Platform/Xenix.cmake2
-rw-r--r--Modules/Platform/cl.cmake62
-rw-r--r--Modules/Platform/eCos.cmake65
-rw-r--r--Modules/Platform/gas.cmake19
-rw-r--r--Modules/Platform/kFreeBSD.cmake4
-rw-r--r--Modules/Platform/syllable.cmake33
-rw-r--r--Modules/ProcessorCount.cmake183
-rw-r--r--Modules/Qt4ConfigDependentSettings.cmake295
-rw-r--r--Modules/Qt4Macros.cmake441
-rw-r--r--Modules/RepositoryInfo.txt.in3
-rw-r--r--Modules/SelectLibraryConfigurations.cmake81
-rwxr-xr-xModules/SquishRunTestCase.bat11
-rwxr-xr-xModules/SquishRunTestCase.sh13
-rw-r--r--Modules/SquishTestScript.cmake72
-rw-r--r--Modules/SystemInformation.cmake103
-rw-r--r--Modules/SystemInformation.in88
-rw-r--r--Modules/TestBigEndian.cmake112
-rw-r--r--Modules/TestCXXAcceptsFlag.cmake43
-rw-r--r--Modules/TestEndianess.c.in23
-rw-r--r--Modules/TestForANSIForScope.cmake44
-rw-r--r--Modules/TestForANSIStreamHeaders.cmake34
-rw-r--r--Modules/TestForANSIStreamHeaders.cxx6
-rw-r--r--Modules/TestForAnsiForScope.cxx7
-rw-r--r--Modules/TestForSSTREAM.cmake43
-rw-r--r--Modules/TestForSSTREAM.cxx11
-rw-r--r--Modules/TestForSTDNamespace.cmake43
-rw-r--r--Modules/TestForSTDNamespace.cxx6
-rw-r--r--Modules/UseEcos.cmake236
-rw-r--r--Modules/UseJava.cmake881
-rw-r--r--Modules/UseJavaClassFilelist.cmake52
-rw-r--r--Modules/UseJavaSymlinks.cmake32
-rw-r--r--Modules/UsePkgConfig.cmake78
-rw-r--r--Modules/UseQt4.cmake108
-rw-r--r--Modules/UseSWIG.cmake253
-rw-r--r--Modules/UseVTK40.cmake29
-rw-r--r--Modules/UseVTKBuildSettings40.cmake38
-rw-r--r--Modules/UseVTKConfig40.cmake409
-rw-r--r--Modules/Use_wxWindows.cmake64
-rw-r--r--Modules/UsewxWidgets.cmake89
-rw-r--r--Modules/VTKCompatibility.cmake52
-rw-r--r--Modules/WriteBasicConfigVersionFile.cmake44
-rw-r--r--Modules/ecos_clean.cmake26
-rw-r--r--Modules/exportheader.cmake.in35
-rw-r--r--Modules/kde3init_dummy.cpp.in6
-rw-r--r--Modules/kde3uic.cmake33
-rw-r--r--Modules/readme.txt151
585 files changed, 51330 insertions, 0 deletions
diff --git a/Modules/AddFileDependencies.cmake b/Modules/AddFileDependencies.cmake
new file mode 100644
index 000000000..f971e37f5
--- /dev/null
+++ b/Modules/AddFileDependencies.cmake
@@ -0,0 +1,29 @@
+# - ADD_FILE_DEPENDENCIES(source_file depend_files...)
+# Adds the given files as dependencies to source_file
+#
+
+#=============================================================================
+# Copyright 2006-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(ADD_FILE_DEPENDENCIES _file)
+
+ GET_SOURCE_FILE_PROPERTY(_deps ${_file} OBJECT_DEPENDS)
+ IF (_deps)
+ SET(_deps ${_deps} ${ARGN})
+ ELSE (_deps)
+ SET(_deps ${ARGN})
+ ENDIF (_deps)
+
+ SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}")
+
+ENDMACRO(ADD_FILE_DEPENDENCIES)
diff --git a/Modules/AutomocInfo.cmake.in b/Modules/AutomocInfo.cmake.in
new file mode 100644
index 000000000..13f21617b
--- /dev/null
+++ b/Modules/AutomocInfo.cmake.in
@@ -0,0 +1,16 @@
+set(AM_SOURCES @_moc_files@ )
+set(AM_HEADERS @_moc_headers@ )
+set(AM_MOC_COMPILE_DEFINITIONS @_moc_compile_defs@)
+set(AM_MOC_DEFINITIONS @_moc_defs@)
+set(AM_MOC_INCLUDES @_moc_incs@)
+set(AM_MOC_OPTIONS @_moc_options@)
+set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
+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_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
+set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
+set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" )
+set(AM_Qt5Core_VERSION_MAJOR "@Qt5Core_VERSION_MAJOR@" )
+set(AM_TARGET_NAME @_moc_target_name@)
+set(AM_RELAXED_MODE "@_moc_relaxed_mode@")
diff --git a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in
new file mode 100644
index 000000000..9f7f03e27
--- /dev/null
+++ b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in
@@ -0,0 +1,31 @@
+# This is a basic version file for the Config-mode of find_package().
+# It is used by WriteBasicConfigVersionFile.cmake as input file for configure_file()
+# to create a version-file which can be installed along a config.cmake file.
+#
+# The created file sets PACKAGE_VERSION_EXACT if the current version string and
+# the requested version string are exactly the same and it sets
+# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
+# The variable CVF_VERSION must be set before calling configure_file().
+
+set(PACKAGE_VERSION "@CVF_VERSION@")
+
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+endif()
+
+# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+ return()
+endif()
+
+# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
+if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+ math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
+ set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
+ set(PACKAGE_VERSION_UNSUITABLE TRUE)
+endif()
diff --git a/Modules/BasicConfigVersion-ExactVersion.cmake.in b/Modules/BasicConfigVersion-ExactVersion.cmake.in
new file mode 100644
index 000000000..63f3f0339
--- /dev/null
+++ b/Modules/BasicConfigVersion-ExactVersion.cmake.in
@@ -0,0 +1,47 @@
+# This is a basic version file for the Config-mode of find_package().
+# It is used by write_basic_package_version_file() as input file for configure_file()
+# to create a version-file which can be installed along a config.cmake file.
+#
+# The created file sets PACKAGE_VERSION_EXACT if the current version string and
+# the requested version string are exactly the same and it sets
+# PACKAGE_VERSION_COMPATIBLE if the current version is equal to the requested version.
+# The tweak version component is ignored.
+# The variable CVF_VERSION must be set before calling configure_file().
+
+
+set(PACKAGE_VERSION "@CVF_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
+ 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}")
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+else()
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+endif()
+
+if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+ set(PACKAGE_VERSION_EXACT TRUE)
+endif()
+
+
+# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+ return()
+endif()
+
+# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
+if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+ math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
+ set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
+ set(PACKAGE_VERSION_UNSUITABLE TRUE)
+endif()
diff --git a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in
new file mode 100644
index 000000000..7bcea88a5
--- /dev/null
+++ b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in
@@ -0,0 +1,46 @@
+# This is a basic version file for the Config-mode of find_package().
+# It is used by WriteBasicConfigVersionFile.cmake as input file for configure_file()
+# to create a version-file which can be installed along a config.cmake file.
+#
+# The created file sets PACKAGE_VERSION_EXACT if the current version string and
+# the requested version string are exactly the same and it sets
+# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
+# but only if the requested major version is the same as the current one.
+# The variable CVF_VERSION must be set before calling configure_file().
+
+
+set(PACKAGE_VERSION "@CVF_VERSION@")
+
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+
+ if("@CVF_VERSION@" MATCHES "^([0-9]+)\\.")
+ set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
+ else()
+ set(CVF_VERSION_MAJOR "@CVF_VERSION@")
+ endif()
+
+ 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}")
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+endif()
+
+
+# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+ return()
+endif()
+
+# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
+if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+ math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
+ set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
+ set(PACKAGE_VERSION_UNSUITABLE TRUE)
+endif()
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
new file mode 100644
index 000000000..0143d593d
--- /dev/null
+++ b/Modules/BundleUtilities.cmake
@@ -0,0 +1,786 @@
+# - 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
+# Requires CMake 2.6 or greater because it uses function, break and
+# PARENT_SCOPE. Also depends on GetPrerequisites.cmake.
+#
+# 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.
+#
+# 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>)
+# Makes a copy of the bundle <src> at location <dst> and then fixes up the
+# new copied bundle in-place at <dst>...
+#
+# 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_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>)
+# 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_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>)
+# 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.
+#
+# 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,
+# 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.
+#
+# 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.
+#
+# 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_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.
+#
+# 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 functions defined in this file depend on the get_prerequisites function
+# (and possibly others) found in:
+#
+get_filename_component(BundleUtilities_cmake_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
+include("${BundleUtilities_cmake_dir}/GetPrerequisites.cmake")
+
+
+function(get_bundle_main_executable bundle result_var)
+ set(result "error: '${bundle}/Contents/Info.plist' file does not exist")
+
+ if(EXISTS "${bundle}/Contents/Info.plist")
+ set(result "error: no CFBundleExecutable in '${bundle}/Contents/Info.plist' file")
+ set(line_is_main_executable 0)
+ set(bundle_executable "")
+
+ # Read Info.plist as a list of lines:
+ #
+ 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}")
+
+ # Scan the lines for "<key>CFBundleExecutable</key>" - the line after that
+ # is the name of the main executable.
+ #
+ foreach(line ${info_plist})
+ if(line_is_main_executable)
+ string(REGEX REPLACE "^.*<string>(.*)</string>.*$" "\\1" bundle_executable "${line}")
+ break()
+ endif(line_is_main_executable)
+
+ if(line MATCHES "^.*<key>CFBundleExecutable</key>.*$")
+ set(line_is_main_executable 1)
+ endif(line MATCHES "^.*<key>CFBundleExecutable</key>.*$")
+ endforeach(line)
+
+ if(NOT "${bundle_executable}" STREQUAL "")
+ if(EXISTS "${bundle}/Contents/MacOS/${bundle_executable}")
+ set(result "${bundle}/Contents/MacOS/${bundle_executable}")
+ else(EXISTS "${bundle}/Contents/MacOS/${bundle_executable}")
+
+ # Ultimate goal:
+ # If not in "Contents/MacOS" then scan the bundle for matching files. If
+ # there is only one executable file that matches, then use it, otherwise
+ # it's an error...
+ #
+ #file(GLOB_RECURSE file_list "${bundle}/${bundle_executable}")
+
+ # But for now, pragmatically, it's an error. Expect the main executable
+ # for the bundle to be in Contents/MacOS, it's an error if it's not:
+ #
+ set(result "error: '${bundle}/Contents/MacOS/${bundle_executable}' does not exist")
+ endif(EXISTS "${bundle}/Contents/MacOS/${bundle_executable}")
+ endif(NOT "${bundle_executable}" STREQUAL "")
+ else(EXISTS "${bundle}/Contents/Info.plist")
+ #
+ # More inclusive technique... (This one would work on Windows and Linux
+ # too, if a developer followed the typical Mac bundle naming convention...)
+ #
+ # If there is no Info.plist file, try to find an executable with the same
+ # base name as the .app directory:
+ #
+ endif(EXISTS "${bundle}/Contents/Info.plist")
+
+ set(${result_var} "${result}" PARENT_SCOPE)
+endfunction(get_bundle_main_executable)
+
+
+function(get_dotapp_dir exe dotapp_dir_var)
+ set(s "${exe}")
+
+ if(s MATCHES "^.*/.*\\.app/.*$")
+ # If there is a ".app" parent directory,
+ # ascend until we hit it:
+ # (typical of a Mac bundle executable)
+ #
+ set(done 0)
+ while(NOT ${done})
+ get_filename_component(snamewe "${s}" NAME_WE)
+ get_filename_component(sname "${s}" NAME)
+ get_filename_component(sdir "${s}" PATH)
+ set(s "${sdir}")
+ if(sname MATCHES "\\.app$")
+ set(done 1)
+ set(dotapp_dir "${sdir}/${sname}")
+ endif(sname MATCHES "\\.app$")
+ endwhile(NOT ${done})
+ else(s MATCHES "^.*/.*\\.app/.*$")
+ # Otherwise use a directory containing the exe
+ # (typical of a non-bundle executable on Mac, Windows or Linux)
+ #
+ is_file_executable("${s}" is_executable)
+ if(is_executable)
+ get_filename_component(sdir "${s}" PATH)
+ set(dotapp_dir "${sdir}")
+ else(is_executable)
+ set(dotapp_dir "${s}")
+ endif(is_executable)
+ endif(s MATCHES "^.*/.*\\.app/.*$")
+
+
+ set(${dotapp_dir_var} "${dotapp_dir}" PARENT_SCOPE)
+endfunction(get_dotapp_dir)
+
+
+function(get_bundle_and_executable app bundle_var executable_var valid_var)
+ set(valid 0)
+
+ if(EXISTS "${app}")
+ # Is it a directory ending in .app?
+ if(IS_DIRECTORY "${app}")
+ if(app MATCHES "\\.app$")
+ get_bundle_main_executable("${app}" executable)
+ if(EXISTS "${app}" AND EXISTS "${executable}")
+ set(${bundle_var} "${app}" PARENT_SCOPE)
+ set(${executable_var} "${executable}" PARENT_SCOPE)
+ set(valid 1)
+ #message(STATUS "info: handled .app directory case...")
+ else(EXISTS "${app}" AND EXISTS "${executable}")
+ message(STATUS "warning: *NOT* handled - .app directory case...")
+ endif(EXISTS "${app}" AND EXISTS "${executable}")
+ else(app MATCHES "\\.app$")
+ message(STATUS "warning: *NOT* handled - directory but not .app case...")
+ endif(app MATCHES "\\.app$")
+ else(IS_DIRECTORY "${app}")
+ # Is it an executable file?
+ is_file_executable("${app}" is_executable)
+ if(is_executable)
+ get_dotapp_dir("${app}" dotapp_dir)
+ if(EXISTS "${dotapp_dir}")
+ set(${bundle_var} "${dotapp_dir}" PARENT_SCOPE)
+ set(${executable_var} "${app}" PARENT_SCOPE)
+ set(valid 1)
+ #message(STATUS "info: handled executable file in .app dir case...")
+ else()
+ get_filename_component(app_dir "${app}" PATH)
+ set(${bundle_var} "${app_dir}" PARENT_SCOPE)
+ set(${executable_var} "${app}" PARENT_SCOPE)
+ set(valid 1)
+ #message(STATUS "info: handled executable file in any dir case...")
+ endif()
+ else(is_executable)
+ message(STATUS "warning: *NOT* handled - not .app dir, not executable file...")
+ endif(is_executable)
+ endif(IS_DIRECTORY "${app}")
+ else(EXISTS "${app}")
+ message(STATUS "warning: *NOT* handled - directory/file does not exist...")
+ endif(EXISTS "${app}")
+
+ if(NOT valid)
+ set(${bundle_var} "error: not a bundle" PARENT_SCOPE)
+ set(${executable_var} "error: not a bundle" PARENT_SCOPE)
+ endif(NOT valid)
+
+ set(${valid_var} ${valid} PARENT_SCOPE)
+endfunction(get_bundle_and_executable)
+
+
+function(get_bundle_all_executables bundle exes_var)
+ set(exes "")
+
+ file(GLOB_RECURSE file_list "${bundle}/*")
+ foreach(f ${file_list})
+ is_file_executable("${f}" is_executable)
+ if(is_executable)
+ set(exes ${exes} "${f}")
+ endif(is_executable)
+ endforeach(f)
+
+ set(${exes_var} "${exes}" PARENT_SCOPE)
+endfunction(get_bundle_all_executables)
+
+
+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}")
+ set(${key_var} ${${key_var}} PARENT_SCOPE)
+endfunction(get_item_key)
+
+
+function(clear_bundle_keys keys_var)
+ foreach(key ${${keys_var}})
+ set(${key}_ITEM PARENT_SCOPE)
+ set(${key}_RESOLVED_ITEM PARENT_SCOPE)
+ set(${key}_DEFAULT_EMBEDDED_PATH PARENT_SCOPE)
+ set(${key}_EMBEDDED_ITEM PARENT_SCOPE)
+ set(${key}_RESOLVED_EMBEDDED_ITEM PARENT_SCOPE)
+ set(${key}_COPYFLAG PARENT_SCOPE)
+ endforeach(key)
+ set(${keys_var} PARENT_SCOPE)
+endfunction(clear_bundle_keys)
+
+
+function(set_bundle_key_values keys_var context item exepath dirs copyflag)
+ get_filename_component(item_name "${item}" NAME)
+
+ get_item_key("${item}" key)
+
+ list(LENGTH ${keys_var} length_before)
+ gp_append_unique(${keys_var} "${key}")
+ list(LENGTH ${keys_var} length_after)
+
+ if(NOT length_before EQUAL length_after)
+ gp_resolve_item("${context}" "${item}" "${exepath}" "${dirs}" resolved_item)
+
+ gp_item_default_embedded_path("${item}" default_embedded_path)
+
+ if(item MATCHES "[^/]+\\.framework/")
+ # For frameworks, construct the name under the embedded path from the
+ # opening "${item_name}.framework/" to the closing "/${item_name}":
+ #
+ string(REGEX REPLACE "^.*(${item_name}.framework/.*/${item_name}).*$" "${default_embedded_path}/\\1" embedded_item "${item}")
+ else(item MATCHES "[^/]+\\.framework/")
+ # For other items, just use the same name as the original, but in the
+ # embedded path:
+ #
+ set(embedded_item "${default_embedded_path}/${item_name}")
+ endif(item MATCHES "[^/]+\\.framework/")
+
+ # Replace @executable_path and resolve ".." references:
+ #
+ string(REPLACE "@executable_path" "${exepath}" resolved_embedded_item "${embedded_item}")
+ get_filename_component(resolved_embedded_item "${resolved_embedded_item}" ABSOLUTE)
+
+ # *But* -- if we are not copying, then force resolved_embedded_item to be
+ # the same as resolved_item. In the case of multiple executables in the
+ # original bundle, using the default_embedded_path results in looking for
+ # the resolved executable next to the main bundle executable. This is here
+ # so that exes in the other sibling directories (like "bin") get fixed up
+ # properly...
+ #
+ if(NOT copyflag)
+ set(resolved_embedded_item "${resolved_item}")
+ endif(NOT copyflag)
+
+ set(${keys_var} ${${keys_var}} PARENT_SCOPE)
+ set(${key}_ITEM "${item}" PARENT_SCOPE)
+ set(${key}_RESOLVED_ITEM "${resolved_item}" PARENT_SCOPE)
+ set(${key}_DEFAULT_EMBEDDED_PATH "${default_embedded_path}" PARENT_SCOPE)
+ set(${key}_EMBEDDED_ITEM "${embedded_item}" PARENT_SCOPE)
+ set(${key}_RESOLVED_EMBEDDED_ITEM "${resolved_embedded_item}" PARENT_SCOPE)
+ set(${key}_COPYFLAG "${copyflag}" PARENT_SCOPE)
+ else(NOT length_before EQUAL length_after)
+ #message("warning: item key '${key}' already in the list, subsequent references assumed identical to first")
+ endif(NOT length_before EQUAL length_after)
+endfunction(set_bundle_key_values)
+
+
+function(get_bundle_keys app libs dirs keys_var)
+ set(${keys_var} PARENT_SCOPE)
+
+ get_bundle_and_executable("${app}" bundle executable valid)
+ if(valid)
+ # Always use the exepath of the main bundle executable for @executable_path
+ # replacements:
+ #
+ get_filename_component(exepath "${executable}" PATH)
+
+ # But do fixups on all executables in the bundle:
+ #
+ get_bundle_all_executables("${bundle}" exes)
+
+ # 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(prereqs "")
+ get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}")
+ foreach(pr ${prereqs})
+ set_bundle_key_values(${keys_var} "${lib}" "${pr}" "${exepath}" "${dirs}" 1)
+ endforeach(pr)
+ endforeach(lib)
+
+ # For each executable found in the bundle, accumulate keys as we go.
+ # The list of keys should be complete when all prerequisites of all
+ # binaries in the bundle have been analyzed.
+ #
+ foreach(exe ${exes})
+ # Add the exe itself to the keys:
+ #
+ set_bundle_key_values(${keys_var} "${exe}" "${exe}" "${exepath}" "${dirs}" 0)
+
+ # Add each prerequisite to the keys:
+ #
+ set(prereqs "")
+ get_prerequisites("${exe}" prereqs 1 1 "${exepath}" "${dirs}")
+ foreach(pr ${prereqs})
+ set_bundle_key_values(${keys_var} "${exe}" "${pr}" "${exepath}" "${dirs}" 1)
+ endforeach(pr)
+ endforeach(exe)
+
+ # Propagate values to caller's scope:
+ #
+ set(${keys_var} ${${keys_var}} PARENT_SCOPE)
+ foreach(key ${${keys_var}})
+ set(${key}_ITEM "${${key}_ITEM}" PARENT_SCOPE)
+ set(${key}_RESOLVED_ITEM "${${key}_RESOLVED_ITEM}" PARENT_SCOPE)
+ set(${key}_DEFAULT_EMBEDDED_PATH "${${key}_DEFAULT_EMBEDDED_PATH}" PARENT_SCOPE)
+ 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)
+ endforeach(key)
+ endif(valid)
+endfunction(get_bundle_keys)
+
+
+function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item)
+ if(WIN32)
+ # ignore case on Windows
+ string(TOLOWER "${resolved_item}" resolved_item_compare)
+ string(TOLOWER "${resolved_embedded_item}" resolved_embedded_item_compare)
+ else()
+ set(resolved_item_compare "${resolved_item}")
+ set(resolved_embedded_item_compare "${resolved_embedded_item}")
+ endif()
+
+ if("${resolved_item_compare}" STREQUAL "${resolved_embedded_item_compare}")
+ message(STATUS "warning: resolved_item == resolved_embedded_item - not copying...")
+ else()
+ #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy ${resolved_item} ${resolved_embedded_item}")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_item}" "${resolved_embedded_item}")
+ if(UNIX AND NOT APPLE)
+ file(RPATH_REMOVE FILE "${resolved_embedded_item}")
+ endif(UNIX AND NOT APPLE)
+ endif()
+
+endfunction(copy_resolved_item_into_bundle)
+
+
+function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_item)
+ if(WIN32)
+ # ignore case on Windows
+ string(TOLOWER "${resolved_item}" resolved_item_compare)
+ string(TOLOWER "${resolved_embedded_item}" resolved_embedded_item_compare)
+ else()
+ set(resolved_item_compare "${resolved_item}")
+ set(resolved_embedded_item_compare "${resolved_embedded_item}")
+ endif()
+
+ if("${resolved_item_compare}" STREQUAL "${resolved_embedded_item_compare}")
+ message(STATUS "warning: resolved_item == resolved_embedded_item - not copying...")
+ else()
+ if(BU_COPY_FULL_FRAMEWORK_CONTENTS)
+ # Full Framework (everything):
+ get_filename_component(resolved_dir "${resolved_item}" PATH)
+ get_filename_component(resolved_dir "${resolved_dir}/../.." ABSOLUTE)
+ get_filename_component(resolved_embedded_dir "${resolved_embedded_item}" PATH)
+ get_filename_component(resolved_embedded_dir "${resolved_embedded_dir}/../.." ABSOLUTE)
+ #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_dir}' '${resolved_embedded_dir}'")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${resolved_dir}" "${resolved_embedded_dir}")
+ else()
+ # Framework lib itself:
+ #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy ${resolved_item} ${resolved_embedded_item}")
+ 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}")
+ 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()
+ endif()
+ if(UNIX AND NOT APPLE)
+ file(RPATH_REMOVE FILE "${resolved_embedded_item}")
+ endif(UNIX AND NOT APPLE)
+ endif()
+
+endfunction(copy_resolved_framework_into_bundle)
+
+
+function(fixup_bundle_item resolved_embedded_item exepath dirs)
+ # This item's key is "ikey":
+ #
+ get_item_key("${resolved_embedded_item}" ikey)
+
+ # Ensure the item is "inside the .app bundle" -- it should not be fixed up if
+ # it is not in the .app bundle... Otherwise, we'll modify files in the build
+ # tree, or in other varied locations around the file system, with our call to
+ # install_name_tool. Make sure that doesn't happen here:
+ #
+ get_dotapp_dir("${exepath}" exe_dotapp_dir)
+ string(LENGTH "${exe_dotapp_dir}/" exe_dotapp_dir_length)
+ string(LENGTH "${resolved_embedded_item}" resolved_embedded_item_length)
+ set(path_too_short 0)
+ set(is_embedded 0)
+ if(${resolved_embedded_item_length} LESS ${exe_dotapp_dir_length})
+ set(path_too_short 1)
+ endif()
+ if(NOT path_too_short)
+ string(SUBSTRING "${resolved_embedded_item}" 0 ${exe_dotapp_dir_length} item_substring)
+ if("${exe_dotapp_dir}/" STREQUAL "${item_substring}")
+ set(is_embedded 1)
+ endif()
+ endif()
+ if(NOT is_embedded)
+ message(" exe_dotapp_dir/='${exe_dotapp_dir}/'")
+ message(" item_substring='${item_substring}'")
+ message(" resolved_embedded_item='${resolved_embedded_item}'")
+ message("")
+ message("Install or copy the item into the bundle before calling fixup_bundle.")
+ message("Or maybe there's a typo or incorrect path in one of the args to fixup_bundle?")
+ message("")
+ message(FATAL_ERROR "cannot fixup an item that is not in the bundle...")
+ endif()
+
+ set(prereqs "")
+ get_prerequisites("${resolved_embedded_item}" prereqs 1 0 "${exepath}" "${dirs}")
+
+ set(changes "")
+
+ foreach(pr ${prereqs})
+ # Each referenced item's key is "rkey" in the loop:
+ #
+ get_item_key("${pr}" rkey)
+
+ if(NOT "${${rkey}_EMBEDDED_ITEM}" STREQUAL "")
+ set(changes ${changes} "-change" "${pr}" "${${rkey}_EMBEDDED_ITEM}")
+ else(NOT "${${rkey}_EMBEDDED_ITEM}" STREQUAL "")
+ message("warning: unexpected reference to '${pr}'")
+ endif(NOT "${${rkey}_EMBEDDED_ITEM}" STREQUAL "")
+ endforeach(pr)
+
+ if(BU_CHMOD_BUNDLE_ITEMS)
+ execute_process(COMMAND chmod u+w "${resolved_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}"
+ )
+endfunction(fixup_bundle_item)
+
+
+function(fixup_bundle app libs dirs)
+ message(STATUS "fixup_bundle")
+ message(STATUS " app='${app}'")
+ message(STATUS " libs='${libs}'")
+ message(STATUS " dirs='${dirs}'")
+
+ get_bundle_and_executable("${app}" bundle executable valid)
+ if(valid)
+ get_filename_component(exepath "${executable}" PATH)
+
+ message(STATUS "fixup_bundle: preparing...")
+ get_bundle_keys("${app}" "${libs}" "${dirs}" keys)
+
+ message(STATUS "fixup_bundle: copying...")
+ list(LENGTH keys n)
+ math(EXPR n ${n}*2)
+
+ set(i 0)
+ foreach(key ${keys})
+ math(EXPR i ${i}+1)
+ if(${${key}_COPYFLAG})
+ message(STATUS "${i}/${n}: copying '${${key}_RESOLVED_ITEM}'")
+ else(${${key}_COPYFLAG})
+ message(STATUS "${i}/${n}: *NOT* copying '${${key}_RESOLVED_ITEM}'")
+ endif(${${key}_COPYFLAG})
+
+ set(show_status 0)
+ if(show_status)
+ message(STATUS "key='${key}'")
+ message(STATUS "item='${${key}_ITEM}'")
+ message(STATUS "resolved_item='${${key}_RESOLVED_ITEM}'")
+ message(STATUS "default_embedded_path='${${key}_DEFAULT_EMBEDDED_PATH}'")
+ message(STATUS "embedded_item='${${key}_EMBEDDED_ITEM}'")
+ message(STATUS "resolved_embedded_item='${${key}_RESOLVED_EMBEDDED_ITEM}'")
+ message(STATUS "copyflag='${${key}_COPYFLAG}'")
+ message(STATUS "")
+ endif(show_status)
+
+ if(${${key}_COPYFLAG})
+ set(item "${${key}_ITEM}")
+ if(item MATCHES "[^/]+\\.framework/")
+ copy_resolved_framework_into_bundle("${${key}_RESOLVED_ITEM}"
+ "${${key}_RESOLVED_EMBEDDED_ITEM}")
+ else()
+ copy_resolved_item_into_bundle("${${key}_RESOLVED_ITEM}"
+ "${${key}_RESOLVED_EMBEDDED_ITEM}")
+ endif()
+ endif(${${key}_COPYFLAG})
+ endforeach(key)
+
+ message(STATUS "fixup_bundle: fixing...")
+ foreach(key ${keys})
+ math(EXPR i ${i}+1)
+ if(APPLE)
+ message(STATUS "${i}/${n}: fixing up '${${key}_RESOLVED_EMBEDDED_ITEM}'")
+ fixup_bundle_item("${${key}_RESOLVED_EMBEDDED_ITEM}" "${exepath}" "${dirs}")
+ else(APPLE)
+ message(STATUS "${i}/${n}: fix-up not required on this platform '${${key}_RESOLVED_EMBEDDED_ITEM}'")
+ endif(APPLE)
+ endforeach(key)
+
+ message(STATUS "fixup_bundle: cleaning up...")
+ clear_bundle_keys(keys)
+
+ message(STATUS "fixup_bundle: verifying...")
+ verify_app("${app}")
+ else(valid)
+ message(SEND_ERROR "error: fixup_bundle: not a valid bundle")
+ endif(valid)
+
+ message(STATUS "fixup_bundle: done")
+endfunction(fixup_bundle)
+
+
+function(copy_and_fixup_bundle src dst libs dirs)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${src}" "${dst}")
+ fixup_bundle("${dst}" "${libs}" "${dirs}")
+endfunction(copy_and_fixup_bundle)
+
+
+function(verify_bundle_prerequisites bundle result_var info_var)
+ set(result 1)
+ set(info "")
+ set(count 0)
+
+ get_bundle_main_executable("${bundle}" main_bundle_exe)
+
+ file(GLOB_RECURSE file_list "${bundle}/*")
+ foreach(f ${file_list})
+ is_file_executable("${f}" is_executable)
+ if(is_executable)
+ get_filename_component(exepath "${f}" PATH)
+ math(EXPR count "${count} + 1")
+
+ message(STATUS "executable file ${count}: ${f}")
+
+ set(prereqs "")
+ get_prerequisites("${f}" prereqs 1 1 "${exepath}" "")
+
+ # On the Mac,
+ # "embedded" and "system" prerequisites are fine... anything else means
+ # the bundle's prerequisites are not verified (i.e., the bundle is not
+ # really "standalone")
+ #
+ # On Windows (and others? Linux/Unix/...?)
+ # "local" and "system" prereqs are fine...
+ #
+ set(external_prereqs "")
+
+ foreach(p ${prereqs})
+ set(p_type "")
+ gp_file_type("${f}" "${p}" p_type)
+
+ if(APPLE)
+ if(NOT "${p_type}" STREQUAL "embedded" AND NOT "${p_type}" STREQUAL "system")
+ set(external_prereqs ${external_prereqs} "${p}")
+ endif()
+ else()
+ if(NOT "${p_type}" STREQUAL "local" AND NOT "${p_type}" STREQUAL "system")
+ set(external_prereqs ${external_prereqs} "${p}")
+ endif()
+ endif()
+ endforeach(p)
+
+ if(external_prereqs)
+ # Found non-system/somehow-unacceptable prerequisites:
+ set(result 0)
+ set(info ${info} "external prerequisites found:\nf='${f}'\nexternal_prereqs='${external_prereqs}'\n")
+ endif(external_prereqs)
+ endif(is_executable)
+ endforeach(f)
+
+ if(result)
+ set(info "Verified ${count} executable files in '${bundle}'")
+ endif(result)
+
+ set(${result_var} "${result}" PARENT_SCOPE)
+ set(${info_var} "${info}" PARENT_SCOPE)
+endfunction(verify_bundle_prerequisites)
+
+
+function(verify_bundle_symlinks bundle result_var info_var)
+ set(result 1)
+ set(info "")
+ set(count 0)
+
+ # TODO: implement this function for real...
+ # Right now, it is just a stub that verifies unconditionally...
+
+ set(${result_var} "${result}" PARENT_SCOPE)
+ set(${info_var} "${info}" PARENT_SCOPE)
+endfunction(verify_bundle_symlinks)
+
+
+function(verify_app app)
+ set(verified 0)
+ set(info "")
+
+ get_bundle_and_executable("${app}" bundle executable valid)
+
+ message(STATUS "===========================================================================")
+ message(STATUS "Analyzing app='${app}'")
+ message(STATUS "bundle='${bundle}'")
+ message(STATUS "executable='${executable}'")
+ message(STATUS "valid='${valid}'")
+
+ # Verify that the bundle does not have any "external" prerequisites:
+ #
+ verify_bundle_prerequisites("${bundle}" verified info)
+ message(STATUS "verified='${verified}'")
+ message(STATUS "info='${info}'")
+ message(STATUS "")
+
+ if(verified)
+ # Verify that the bundle does not have any symlinks to external files:
+ #
+ verify_bundle_symlinks("${bundle}" verified info)
+ message(STATUS "verified='${verified}'")
+ message(STATUS "info='${info}'")
+ message(STATUS "")
+ endif(verified)
+
+ if(NOT verified)
+ message(FATAL_ERROR "error: verify_app failed")
+ endif(NOT verified)
+endfunction(verify_app)
diff --git a/Modules/CMake.cmake b/Modules/CMake.cmake
new file mode 100644
index 000000000..53a0ddf99
--- /dev/null
+++ b/Modules/CMake.cmake
@@ -0,0 +1,17 @@
+
+#=============================================================================
+# 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.)
+
+# This file is used by cmake.cxx to compute the CMAKE_ROOT location.
+# Do not remove this file from cvs without updating cmake.cxx to look
+# for a different file.
diff --git a/Modules/CMakeASM-ATTInformation.cmake b/Modules/CMakeASM-ATTInformation.cmake
new file mode 100644
index 000000000..cb1f5d69c
--- /dev/null
+++ b/Modules/CMakeASM-ATTInformation.cmake
@@ -0,0 +1,25 @@
+
+#=============================================================================
+# 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.)
+
+# support for AT&T syntax assemblers, e.g. GNU as
+
+SET(ASM_DIALECT "-ATT")
+# *.S files are supposed to be preprocessed, so they should not be passed to
+# assembler but should be processed by gcc
+SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;asm)
+
+SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>")
+
+INCLUDE(CMakeASMInformation)
+SET(ASM_DIALECT)
diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in
new file mode 100644
index 000000000..2dc24b06d
--- /dev/null
+++ b/Modules/CMakeASMCompiler.cmake.in
@@ -0,0 +1,12 @@
+SET(CMAKE_ASM@ASM_DIALECT@_COMPILER "@_CMAKE_ASM_COMPILER@")
+SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ARG1 "@_CMAKE_ASM_COMPILER_ARG1@")
+SET(CMAKE_AR "@CMAKE_AR@")
+SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
+SET(CMAKE_LINKER "@CMAKE_LINKER@")
+SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
+SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@")
+SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@")
+
+SET(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
+SET(CMAKE_ASM@ASM_DIALECT@_LINKER_PREFERENCE 0)
+
diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake
new file mode 100644
index 000000000..b5f242033
--- /dev/null
+++ b/Modules/CMakeASMInformation.cmake
@@ -0,0 +1,130 @@
+
+#=============================================================================
+# 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.)
+
+IF(UNIX)
+ SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o)
+ELSE(UNIX)
+ SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj)
+ENDIF(UNIX)
+
+SET(CMAKE_INCLUDE_FLAG_ASM${ASM_DIALECT} "-I") # -I
+SET(CMAKE_BASE_NAME)
+GET_FILENAME_COMPONENT(CMAKE_BASE_NAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME_WE)
+
+IF("${CMAKE_BASE_NAME}" STREQUAL "as")
+ SET(CMAKE_BASE_NAME gas)
+ENDIF("${CMAKE_BASE_NAME}" STREQUAL "as")
+
+# Load compiler-specific information.
+SET(_INCLUDED_FILE "")
+IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
+ INCLUDE(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
+ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
+IF(NOT _INCLUDED_FILE)
+ IF("ASM${ASM_DIALECT}" STREQUAL "ASM")
+ MESSAGE(STATUS "Warning: Did not find file Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}")
+ ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM")
+ INCLUDE(Platform/${CMAKE_BASE_NAME} OPTIONAL)
+ENDIF(NOT _INCLUDED_FILE)
+
+IF(CMAKE_SYSTEM_PROCESSOR)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
+ IF(NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
+ ENDIF(NOT _INCLUDED_FILE)
+ENDIF(CMAKE_SYSTEM_PROCESSOR)
+
+INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
+IF(NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
+ENDIF(NOT _INCLUDED_FILE)
+
+# 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)
+ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS)
+
+
+# Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends:
+SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}")
+# avoid just having a space as the initial value for the cache
+IF(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ")
+ SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT)
+ENDIF(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ")
+SET (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING
+ "Flags used by the assembler during all build types.")
+
+IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+# default build type is none
+ IF(NOT CMAKE_NO_BUILD_TYPE)
+ SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
+ "Choose the type of build, options are: None, Debug Release RelWithDebInfo MinSizeRel.")
+ ENDIF(NOT CMAKE_NO_BUILD_TYPE)
+ SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG "${CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG_INIT}" CACHE STRING
+ "Flags used by the assembler during debug builds.")
+ SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL "${CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL_INIT}" CACHE STRING
+ "Flags used by the assembler during release minsize builds.")
+ SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE_INIT}" CACHE STRING
+ "Flags used by the assembler during release builds.")
+ SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
+ "Flags used by the assembler during Release with Debug Info builds.")
+ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+
+MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_FLAGS
+ CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG
+ CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL
+ CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE
+ CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO
+ )
+
+
+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>")
+ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
+
+IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
+ SET(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY
+ "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
+ "<CMAKE_RANLIB> <TARGET> ")
+ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
+
+IF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
+ SET(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
+ "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
+
+IF(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG)
+ SET(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG})
+ENDIF()
+
+IF(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP)
+ SET(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP})
+ENDIF()
+
+IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG)
+ SET(CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ASM${ASM_DIALECT}_FLAG})
+ENDIF()
+
+# to be done
+IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
+ SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
+ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
+
+IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
+ SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
+ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
+
+
+SET(CMAKE_ASM${ASM_DIALECT}_INFOMATION_LOADED 1)
+
diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake
new file mode 100644
index 000000000..4e1386fab
--- /dev/null
+++ b/Modules/CMakeASM_MASMInformation.cmake
@@ -0,0 +1,24 @@
+
+#=============================================================================
+# Copyright 2008-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.)
+
+# support for the MS assembler, masm and masm64
+
+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>")
+
+INCLUDE(CMakeASMInformation)
+SET(ASM_DIALECT)
diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake
new file mode 100644
index 000000000..9da7d306c
--- /dev/null
+++ b/Modules/CMakeASM_NASMInformation.cmake
@@ -0,0 +1,46 @@
+
+#=============================================================================
+# Copyright 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.)
+
+# support for the nasm assembler
+
+set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm asm)
+
+if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
+ if(WIN32)
+ if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT win64)
+ else()
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT win32)
+ endif()
+ elseif(APPLE)
+ if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
+ else()
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho)
+ endif()
+ else()
+ if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
+ else()
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf)
+ endif()
+ endif()
+endif()
+
+set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
+
+# Load the generic ASMInformation file:
+set(ASM_DIALECT "_NASM")
+include(CMakeASMInformation)
+set(ASM_DIALECT)
diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
new file mode 100644
index 000000000..abd910055
--- /dev/null
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -0,0 +1,206 @@
+# - Use MinGW gfortran from VS if a fortran compiler is not found.
+# The 'add_fortran_subdirectory' function adds a subdirectory
+# to a project that contains a fortran only sub-project. The module
+# will check the current compiler and see if it can support fortran.
+# If no fortran compiler is found and the compiler is MSVC, then
+# this module will find the MinGW gfortran. It will then use
+# an external project to build with the MinGW tools. It will also
+# create imported targets for the libraries created. This will only
+# work if the fortran code is built into a dll, so BUILD_SHARED_LIBS
+# is turned on in the project. In addition the CMAKE_GNUtoMS option
+# is set to on, so that the MS .lib files are created.
+# Usage is as follows:
+# cmake_add_fortran_subdirectory(
+# <subdir> # name of subdirectory
+# PROJECT <project_name> # project name in subdir top CMakeLists.txt
+# ARCHIVE_DIR <dir> # dir where project places .lib files
+# RUNTIME_DIR <dir> # dir where project places .dll files
+# LIBRARIES <lib>... # names of library targets to import
+# LINK_LIBRARIES # link interface libraries for LIBRARIES
+# [LINK_LIBS <lib> <dep>...]...
+# CMAKE_COMMAND_LINE ... # extra command line flags to pass to cmake
+# NO_EXTERNAL_INSTALL # skip installation of external project
+# )
+# Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with respect
+# to the build directory corresponding to the source directory in which the
+# function is invoked.
+#
+# Limitations:
+#
+# NO_EXTERNAL_INSTALL is required for forward compatibility with a
+# future version that supports installation of the external project
+# binaries during "make install".
+
+#=============================================================================
+# Copyright 2011-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.)
+
+
+set(_MS_MINGW_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
+include(CheckLanguage)
+include(ExternalProject)
+include(CMakeParseArguments)
+
+function(_setup_mingw_config_and_build source_dir build_dir)
+ # Look for a MinGW gfortran.
+ find_program(MINGW_GFORTRAN
+ NAMES gfortran
+ PATHS
+ c:/MinGW/bin
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin"
+ )
+ if(NOT MINGW_GFORTRAN)
+ message(FATAL_ERROR
+ "gfortran not found, please install MinGW with the gfortran option."
+ "Or set the cache variable MINGW_GFORTRAN to the full path. "
+ " This is required to build")
+ endif()
+
+ # Validate the MinGW gfortran we found.
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_mingw_target "Target:.*64.*mingw")
+ else()
+ set(_mingw_target "Target:.*mingw32")
+ endif()
+ execute_process(COMMAND "${MINGW_GFORTRAN}" -v
+ ERROR_VARIABLE out ERROR_STRIP_TRAILING_WHITESPACE)
+ if(NOT "${out}" MATCHES "${_mingw_target}")
+ string(REPLACE "\n" "\n " out " ${out}")
+ message(FATAL_ERROR
+ "MINGW_GFORTRAN is set to\n"
+ " ${MINGW_GFORTRAN}\n"
+ "which is not a MinGW gfortran for this architecture. "
+ "The output from -v does not match \"${_mingw_target}\":\n"
+ "${out}\n"
+ "Set MINGW_GFORTRAN to a proper MinGW gfortran for this architecture."
+ )
+ endif()
+
+ # Configure scripts to run MinGW tools with the proper PATH.
+ get_filename_component(MINGW_PATH ${MINGW_GFORTRAN} PATH)
+ file(TO_NATIVE_PATH "${MINGW_PATH}" MINGW_PATH)
+ string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}")
+ configure_file(
+ ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in
+ ${build_dir}/config_mingw.cmake
+ @ONLY)
+ configure_file(
+ ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in
+ ${build_dir}/build_mingw.cmake
+ @ONLY)
+endfunction()
+
+function(_add_fortran_library_link_interface library depend_library)
+ set_target_properties(${library} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG "${depend_library}")
+endfunction()
+
+
+function(cmake_add_fortran_subdirectory subdir)
+ # Parse arguments to function
+ set(options NO_EXTERNAL_INSTALL)
+ set(oneValueArgs PROJECT ARCHIVE_DIR RUNTIME_DIR)
+ set(multiValueArgs LIBRARIES LINK_LIBRARIES CMAKE_COMMAND_LINE)
+ cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ if(NOT ARGS_NO_EXTERNAL_INSTALL)
+ message(FATAL_ERROR
+ "Option NO_EXTERNAL_INSTALL is required (for forward compatibility) "
+ "but was not given."
+ )
+ endif()
+
+ # if we are not using MSVC without fortran support
+ # then just use the usual add_subdirectory to build
+ # the fortran library
+ check_language(Fortran)
+ if(NOT (MSVC AND (NOT CMAKE_Fortran_COMPILER)))
+ add_subdirectory(${subdir})
+ return()
+ endif()
+
+ # if we have MSVC without Intel fortran then setup
+ # external projects to build with mingw fortran
+
+ set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}")
+ set(project_name "${ARGS_PROJECT}")
+ set(library_dir "${ARGS_ARCHIVE_DIR}")
+ set(binary_dir "${ARGS_RUNTIME_DIR}")
+ set(libraries ${ARGS_LIBRARIES})
+ # use the same directory that add_subdirectory would have used
+ set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
+ foreach(dir_var library_dir binary_dir)
+ if(NOT IS_ABSOLUTE "${${dir_var}}")
+ get_filename_component(${dir_var}
+ "${CMAKE_CURRENT_BINARY_DIR}/${${dir_var}}" ABSOLUTE)
+ endif()
+ endforeach()
+ # create build and configure wrapper scripts
+ _setup_mingw_config_and_build("${source_dir}" "${build_dir}")
+ # create the external project
+ externalproject_add(${project_name}_build
+ SOURCE_DIR ${source_dir}
+ BINARY_DIR ${build_dir}
+ CONFIGURE_COMMAND ${CMAKE_COMMAND}
+ -P ${build_dir}/config_mingw.cmake
+ BUILD_COMMAND ${CMAKE_COMMAND}
+ -P ${build_dir}/build_mingw.cmake
+ INSTALL_COMMAND ""
+ )
+ # make the external project always run make with each build
+ externalproject_add_step(${project_name}_build forcebuild
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${CMAKE_CURRENT_BUILD_DIR}/${project_name}-prefix/src/${project_name}-stamp/${project_name}-build
+ DEPENDEES configure
+ DEPENDERS build
+ ALWAYS 1
+ )
+ # create imported targets for all libraries
+ foreach(lib ${libraries})
+ add_library(${lib} SHARED IMPORTED GLOBAL)
+ set_property(TARGET ${lib} APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
+ set_target_properties(${lib} PROPERTIES
+ IMPORTED_IMPLIB_NOCONFIG "${library_dir}/lib${lib}.lib"
+ IMPORTED_LOCATION_NOCONFIG "${binary_dir}/lib${lib}.dll"
+ )
+ add_dependencies(${lib} ${project_name}_build)
+ endforeach()
+
+ # now setup link libraries for targets
+ set(start FALSE)
+ set(target)
+ foreach(lib ${ARGS_LINK_LIBRARIES})
+ if("${lib}" STREQUAL "LINK_LIBS")
+ set(start TRUE)
+ else()
+ if(start)
+ if(DEFINED target)
+ # process current target and target_libs
+ _add_fortran_library_link_interface(${target} "${target_libs}")
+ # zero out target and target_libs
+ set(target)
+ set(target_libs)
+ endif()
+ # save the current target and set start to FALSE
+ set(target ${lib})
+ set(start FALSE)
+ else()
+ # append the lib to target_libs
+ list(APPEND target_libs "${lib}")
+ endif()
+ endif()
+ endforeach()
+ # process anything that is left in target and target_libs
+ if(DEFINED target)
+ _add_fortran_library_link_interface(${target} "${target_libs}")
+ endif()
+endfunction()
diff --git a/Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in b/Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in
new file mode 100644
index 000000000..55b271a2d
--- /dev/null
+++ b/Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in
@@ -0,0 +1,2 @@
+set(ENV{PATH} "@MINGW_PATH@\;$ENV{PATH}")
+execute_process(COMMAND "@CMAKE_COMMAND@" --build . )
diff --git a/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in b/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in
new file mode 100644
index 000000000..97f67693a
--- /dev/null
+++ b/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in
@@ -0,0 +1,9 @@
+set(ENV{PATH} "@MINGW_PATH@\;$ENV{PATH}")
+set(CMAKE_COMMAND_LINE "@ARGS_CMAKE_COMMAND_LINE@")
+execute_process(
+ COMMAND "@CMAKE_COMMAND@" "-GMinGW Makefiles"
+ -DCMAKE_Fortran_COMPILER:PATH=@MINGW_GFORTRAN@
+ -DBUILD_SHARED_LIBS=ON
+ -DCMAKE_GNUtoMS=ON
+ ${CMAKE_COMMAND_LINE}
+ "@source_dir@")
diff --git a/Modules/CMakeAddNewLanguage.txt b/Modules/CMakeAddNewLanguage.txt
new file mode 100644
index 000000000..203c39dfe
--- /dev/null
+++ b/Modules/CMakeAddNewLanguage.txt
@@ -0,0 +1,17 @@
+CMakeDetermine(LANG)Compiler.cmake -> this should find the compiler for LANG and configure CMake(LANG)Compiler.cmake.in
+
+CMake(LANG)Compiler.cmake.in -> used by CMakeDetermine(LANG)Compiler.cmake
+ This file is used to store compiler information and is copied down into try
+ compile directories so that try compiles do not need to re-determine and test the LANG
+
+CMakeTest(LANG)Compiler.cmake -> test the compiler and set:
+ SET(CMAKE_(LANG)_COMPILER_WORKS 1 CACHE INTERNAL "")
+
+CMake(LANG)Information.cmake -> set up rule variables for LANG :
+ CMAKE_(LANG)_CREATE_SHARED_LIBRARY
+ CMAKE_(LANG)_CREATE_SHARED_MODULE
+ CMAKE_(LANG)_CREATE_STATIC_LIBRARY
+ CMAKE_(LANG)_COMPILE_OBJECT
+ CMAKE_(LANG)_LINK_EXECUTABLE
+
+
diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake
new file mode 100644
index 000000000..00e568830
--- /dev/null
+++ b/Modules/CMakeBackwardCompatibilityC.cmake
@@ -0,0 +1,100 @@
+
+#=============================================================================
+# 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.)
+
+# Nothing here yet
+IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
+ INCLUDE(CMakeVS7BackwardCompatibility)
+ SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
+IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
+ INCLUDE(CMakeVS6BackwardCompatibility)
+ SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
+
+IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
+ # Old CMake versions did not support OS X universal binaries anyway,
+ # so just get through this with at least some size for the types.
+ LIST(LENGTH CMAKE_OSX_ARCHITECTURES NUM_ARCHS)
+ IF(${NUM_ARCHS} GREATER 1)
+ IF(NOT DEFINED CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
+ MESSAGE(WARNING "This module does not work with OS X universal binaries.")
+ SET(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES 1)
+ LIST(GET CMAKE_OSX_ARCHITECTURES 0 CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
+ ENDIF()
+ ENDIF()
+
+ INCLUDE (CheckTypeSize)
+ CHECK_TYPE_SIZE(int CMAKE_SIZEOF_INT)
+ CHECK_TYPE_SIZE(long CMAKE_SIZEOF_LONG)
+ CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
+ CHECK_TYPE_SIZE(char CMAKE_SIZEOF_CHAR)
+ CHECK_TYPE_SIZE(short CMAKE_SIZEOF_SHORT)
+ CHECK_TYPE_SIZE(float CMAKE_SIZEOF_FLOAT)
+ CHECK_TYPE_SIZE(double CMAKE_SIZEOF_DOUBLE)
+
+ INCLUDE (CheckIncludeFile)
+ CHECK_INCLUDE_FILE("limits.h" CMAKE_HAVE_LIMITS_H)
+ CHECK_INCLUDE_FILE("unistd.h" CMAKE_HAVE_UNISTD_H)
+ CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H)
+
+ INCLUDE (CheckIncludeFiles)
+ CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SYS_PRCTL_H)
+
+ INCLUDE (TestBigEndian)
+ TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
+ INCLUDE (FindX11)
+
+ IF("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
+ SET (CMAKE_X_CFLAGS "" CACHE STRING "X11 extra flags.")
+ ELSE("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
+ SET (CMAKE_X_CFLAGS "-I${X11_X11_INCLUDE_PATH}" CACHE STRING
+ "X11 extra flags.")
+ ENDIF("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
+ SET (CMAKE_X_LIBS "${X11_LIBRARIES}" CACHE STRING
+ "Libraries and options used in X11 programs.")
+ SET (CMAKE_HAS_X "${X11_FOUND}" CACHE INTERNAL "Is X11 around.")
+
+ INCLUDE (FindThreads)
+
+ SET (CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING
+ "Thread library used.")
+
+ SET (CMAKE_USE_PTHREADS "${CMAKE_USE_PTHREADS_INIT}" CACHE BOOL
+ "Use the pthreads library.")
+
+ SET (CMAKE_USE_WIN32_THREADS "${CMAKE_USE_WIN32_THREADS_INIT}" CACHE BOOL
+ "Use the win32 thread library.")
+
+ SET (CMAKE_HP_PTHREADS ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL
+ "Use HP pthreads.")
+
+ SET (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL
+ "Use sproc libs.")
+
+ IF(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
+ SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
+ SET(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
+ ENDIF()
+ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
+
+MARK_AS_ADVANCED(
+CMAKE_HP_PTHREADS
+CMAKE_THREAD_LIBS
+CMAKE_USE_PTHREADS
+CMAKE_USE_SPROC
+CMAKE_USE_WIN32_THREADS
+CMAKE_X_CFLAGS
+CMAKE_X_LIBS
+)
+
diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake
new file mode 100644
index 000000000..707bbde50
--- /dev/null
+++ b/Modules/CMakeBackwardCompatibilityCXX.cmake
@@ -0,0 +1,54 @@
+# - 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.
+#
+# 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(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
+ # check for some ANSI flags in the CXX compiler if it is not gnu
+ IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ INCLUDE(TestCXXAcceptsFlag)
+ SET(CMAKE_TRY_ANSI_CXX_FLAGS "")
+ IF(CMAKE_SYSTEM MATCHES "IRIX.*")
+ SET(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std")
+ ENDIF(CMAKE_SYSTEM MATCHES "IRIX.*")
+ IF(CMAKE_SYSTEM MATCHES "OSF.*")
+ SET(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname")
+ ENDIF(CMAKE_SYSTEM MATCHES "OSF.*")
+ # if CMAKE_TRY_ANSI_CXX_FLAGS has something in it, see
+ # if the compiler accepts it
+ IF( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+")
+ 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
+ IF(CMAKE_CXX_ACCEPTS_FLAGS)
+ SET(CMAKE_ANSI_CXXFLAGS ${CMAKE_TRY_ANSI_CXX_FLAGS} CACHE INTERNAL
+ "What flags are required by the c++ compiler to make it ansi." )
+ ENDIF(CMAKE_CXX_ACCEPTS_FLAGS)
+ ENDIF( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+")
+ ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ SET(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
+ INCLUDE(TestForANSIStreamHeaders)
+ INCLUDE(CheckIncludeFileCXX)
+ INCLUDE(TestForSTDNamespace)
+ INCLUDE(TestForANSIForScope)
+ INCLUDE(TestForSSTREAM)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}")
+ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
+
diff --git a/Modules/CMakeBorlandFindMake.cmake b/Modules/CMakeBorlandFindMake.cmake
new file mode 100644
index 000000000..1ef28df83
--- /dev/null
+++ b/Modules/CMakeBorlandFindMake.cmake
@@ -0,0 +1,17 @@
+
+#=============================================================================
+# 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.)
+
+SET (CMAKE_MAKE_PROGRAM "make" CACHE STRING
+ "Program used to build from makefiles.")
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
diff --git a/Modules/CMakeBuildSettings.cmake.in b/Modules/CMakeBuildSettings.cmake.in
new file mode 100644
index 000000000..7c4aa148a
--- /dev/null
+++ b/Modules/CMakeBuildSettings.cmake.in
@@ -0,0 +1,13 @@
+
+# The command CMAKE_EXPORT_BUILD_SETTINGS(...) was used by
+# @PROJECT_NAME@ to generate this file. As of CMake 2.8 the
+# functionality of this command has been dropped as it was deemed
+# harmful (confusing users by changing their compiler).
+
+# CMake 2.6 and below do not support loading their equivalent of this
+# file if it was produced by a newer version of CMake. CMake 2.8 and
+# above simply do not load this file. Therefore we simply error out.
+message(FATAL_ERROR
+ "This @PROJECT_NAME@ was built by CMake @CMAKE_VERSION@, but this is CMake "
+ "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}. "
+ "Please upgrade CMake to a more recent version.")
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
new file mode 100644
index 000000000..ded8cf6ab
--- /dev/null
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -0,0 +1,53 @@
+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_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
+@SET_MSVC_C_ARCHITECTURE_ID@
+SET(CMAKE_AR "@CMAKE_AR@")
+SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
+SET(CMAKE_LINKER "@CMAKE_LINKER@")
+SET(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@)
+SET(CMAKE_C_COMPILER_LOADED 1)
+SET(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
+SET(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
+IF(CMAKE_COMPILER_IS_CYGWIN)
+ SET(CYGWIN 1)
+ SET(UNIX 1)
+ENDIF(CMAKE_COMPILER_IS_CYGWIN)
+
+SET(CMAKE_C_COMPILER_ENV_VAR "CC")
+
+IF(CMAKE_COMPILER_IS_MINGW)
+ SET(MINGW 1)
+ENDIF(CMAKE_COMPILER_IS_MINGW)
+SET(CMAKE_C_COMPILER_ID_RUN 1)
+SET(CMAKE_C_SOURCE_FILE_EXTENSIONS c)
+SET(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
+SET(CMAKE_C_LINKER_PREFERENCE 10)
+
+# Save compiler ABI information.
+SET(CMAKE_C_SIZEOF_DATA_PTR "@CMAKE_C_SIZEOF_DATA_PTR@")
+SET(CMAKE_C_COMPILER_ABI "@CMAKE_C_COMPILER_ABI@")
+SET(CMAKE_C_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@")
+
+IF(CMAKE_C_SIZEOF_DATA_PTR)
+ SET(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
+ENDIF(CMAKE_C_SIZEOF_DATA_PTR)
+
+IF(CMAKE_C_COMPILER_ABI)
+ SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
+ENDIF(CMAKE_C_COMPILER_ABI)
+
+IF(CMAKE_C_LIBRARY_ARCHITECTURE)
+ SET(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@")
+ENDIF()
+
+SET(CMAKE_C_HAS_ISYSROOT "@CMAKE_C_HAS_ISYSROOT@")
+@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_CMCLDEPS_EXECUTABLE@
+@SET_CMAKE_CL_SHOWINCLUDE_PREFIX@
diff --git a/Modules/CMakeCCompilerABI.c b/Modules/CMakeCCompilerABI.c
new file mode 100644
index 000000000..e6a07f4c4
--- /dev/null
+++ b/Modules/CMakeCCompilerABI.c
@@ -0,0 +1,28 @@
+#ifdef __cplusplus
+# error "A C++ compiler has been selected for C."
+#endif
+
+#ifdef __CLASSIC_C__
+# define const
+#endif
+
+/*--------------------------------------------------------------------------*/
+
+#include "CMakeCompilerABI.h"
+
+/*--------------------------------------------------------------------------*/
+
+#ifdef __CLASSIC_C__
+int main(argc, argv) int argc; char *argv[];
+#else
+int main(int argc, char *argv[])
+#endif
+{
+ int require = 0;
+ require += info_sizeof_dptr[argc];
+#if defined(ABI_ID)
+ require += info_abi[argc];
+#endif
+ (void)argv;
+ return require;
+}
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
new file mode 100644
index 000000000..06aa9bf06
--- /dev/null
+++ b/Modules/CMakeCCompilerId.c.in
@@ -0,0 +1,204 @@
+#ifdef __cplusplus
+# 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(__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"
+
+#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(__PATHSCALE__)
+# define COMPILER_ID "PathScale"
+
+#elif defined(_CRAYC)
+# define COMPILER_ID "Cray"
+
+#elif defined(__TI_COMPILER_VERSION__)
+# define COMPILER_ID "TI_DSP"
+
+#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
+
+#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
+/* Analog Devices C++ compiler for Blackfin, TigerSHARC and
+ SHARC (21000) DSPs */
+# define COMPILER_ID "ADSP"
+
+/* IAR Systems compiler for embedded systems.
+ http://www.iar.com
+ Not supported yet by CMake
+#elif 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"
+
+#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
+
+/* 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 "]";
+
+@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
+
+/*--------------------------------------------------------------------------*/
+
+#ifdef ID_VOID_MAIN
+void main() {}
+#else
+int main(int argc, char* argv[])
+{
+ int require = 0;
+ require += info_compiler[argc];
+ require += info_platform[argc];
+ require += info_arch[argc];
+#ifdef COMPILER_VERSION_MAJOR
+ require += info_version[argc];
+#endif
+ (void)argv;
+ return require;
+}
+#endif
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
new file mode 100644
index 000000000..afac7a452
--- /dev/null
+++ b/Modules/CMakeCInformation.cmake
@@ -0,0 +1,219 @@
+
+#=============================================================================
+# Copyright 2004-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.)
+
+# This file sets the basic flags for the C language in CMake.
+# It also loads the available platform file for the system-compiler
+# if it exists.
+# It also loads a system - compiler - processor (or target hardware)
+# specific file, which is mainly useful for crosscompiling and embedded systems.
+
+# 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)
+ SET(CMAKE_C_OUTPUT_EXTENSION .o)
+ELSE(UNIX)
+ SET(CMAKE_C_OUTPUT_EXTENSION .obj)
+ENDIF(UNIX)
+
+SET(_INCLUDED_FILE 0)
+
+# Load compiler-specific information.
+IF(CMAKE_C_COMPILER_ID)
+ INCLUDE(Compiler/${CMAKE_C_COMPILER_ID}-C OPTIONAL)
+ENDIF(CMAKE_C_COMPILER_ID)
+
+SET(CMAKE_BASE_NAME)
+GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_C_COMPILER} NAME_WE)
+IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_BASE_NAME gcc)
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
+
+# load a hardware specific file, mostly useful for embedded compilers
+IF(CMAKE_SYSTEM_PROCESSOR)
+ IF(CMAKE_C_COMPILER_ID)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
+ ENDIF(CMAKE_C_COMPILER_ID)
+ IF (NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
+ ENDIF (NOT _INCLUDED_FILE)
+ENDIF(CMAKE_SYSTEM_PROCESSOR)
+
+
+# load the system- and compiler specific files
+IF(CMAKE_C_COMPILER_ID)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C
+ OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
+ENDIF(CMAKE_C_COMPILER_ID)
+IF (NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}
+ OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
+ENDIF (NOT _INCLUDED_FILE)
+# 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.
+# Remove this when all compiler info is removed from system files.
+IF (NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
+ENDIF (NOT _INCLUDED_FILE)
+
+IF(CMAKE_C_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_C_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_C_ABI_FILES)
+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_C)
+ # Save the full path of the file so try_compile can use it.
+ INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_C} RESULT_VARIABLE _override)
+ SET(CMAKE_USER_MAKE_RULES_OVERRIDE_C "${_override}")
+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_C_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
+ SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
+ENDIF(NOT CMAKE_MODULE_EXISTS)
+
+SET(CMAKE_C_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}")
+# avoid just having a space as the initial value for the cache
+IF(CMAKE_C_FLAGS_INIT STREQUAL " ")
+ SET(CMAKE_C_FLAGS_INIT)
+ENDIF(CMAKE_C_FLAGS_INIT STREQUAL " ")
+SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_INIT}" CACHE STRING
+ "Flags used by the compiler during all build types.")
+
+IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+# default build type is none
+ IF(NOT CMAKE_NO_BUILD_TYPE)
+ SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
+ "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
+ ENDIF(NOT CMAKE_NO_BUILD_TYPE)
+ 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.")
+ 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).")
+ SET (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
+ "Flags used by the compiler during Release with Debug Info builds.")
+ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+
+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.")
+ MARK_AS_ADVANCED(CMAKE_C_STANDARD_LIBRARIES)
+ENDIF(CMAKE_C_STANDARD_LIBRARIES_INIT)
+
+INCLUDE(CMakeCommonLanguageInclude)
+
+# now define the following rule variables
+
+# CMAKE_C_CREATE_SHARED_LIBRARY
+# CMAKE_C_CREATE_SHARED_MODULE
+# CMAKE_C_COMPILE_OBJECT
+# CMAKE_C_LINK_EXECUTABLE
+
+# variables supplied by the generator at use time
+# <TARGET>
+# <TARGET_BASE> the target without the suffix
+# <OBJECTS>
+# <OBJECT>
+# <LINK_LIBRARIES>
+# <FLAGS>
+# <LINK_FLAGS>
+
+# C compiler information
+# <CMAKE_C_COMPILER>
+# <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS>
+# <CMAKE_SHARED_MODULE_CREATE_C_FLAGS>
+# <CMAKE_C_LINK_FLAGS>
+
+# Static library tools
+# <CMAKE_AR>
+# <CMAKE_RANLIB>
+
+
+# create a C shared library
+IF(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
+ SET(CMAKE_C_CREATE_SHARED_LIBRARY
+ "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
+ENDIF(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
+
+# create a C shared module just copy the shared library rule
+IF(NOT CMAKE_C_CREATE_SHARED_MODULE)
+ SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY})
+ENDIF(NOT CMAKE_C_CREATE_SHARED_MODULE)
+
+# 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>")
+ENDIF()
+IF(NOT DEFINED CMAKE_C_ARCHIVE_APPEND)
+ SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ENDIF()
+IF(NOT DEFINED CMAKE_C_ARCHIVE_FINISH)
+ SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
+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>")
+ENDIF(NOT CMAKE_C_COMPILE_OBJECT)
+
+IF(NOT CMAKE_C_LINK_EXECUTABLE)
+ SET(CMAKE_C_LINK_EXECUTABLE
+ "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+ENDIF(NOT CMAKE_C_LINK_EXECUTABLE)
+
+IF(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG)
+ SET(CMAKE_EXECUTABLE_RUNTIME_C_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
+ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG)
+
+IF(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG_SEP)
+ SET(CMAKE_EXECUTABLE_RUNTIME_C_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
+ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG_SEP)
+
+IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG)
+ SET(CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
+ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG)
+
+MARK_AS_ADVANCED(
+CMAKE_C_FLAGS
+CMAKE_C_FLAGS_DEBUG
+CMAKE_C_FLAGS_MINSIZEREL
+CMAKE_C_FLAGS_RELEASE
+CMAKE_C_FLAGS_RELWITHDEBINFO
+)
+SET(CMAKE_C_INFORMATION_LOADED 1)
+
+
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
new file mode 100644
index 000000000..5b6376a32
--- /dev/null
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -0,0 +1,54 @@
+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_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
+@SET_MSVC_CXX_ARCHITECTURE_ID@
+SET(CMAKE_AR "@CMAKE_AR@")
+SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
+SET(CMAKE_LINKER "@CMAKE_LINKER@")
+SET(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
+SET(CMAKE_CXX_COMPILER_LOADED 1)
+SET(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
+SET(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
+IF(CMAKE_COMPILER_IS_CYGWIN)
+ SET(CYGWIN 1)
+ SET(UNIX 1)
+ENDIF(CMAKE_COMPILER_IS_CYGWIN)
+
+SET(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
+
+IF(CMAKE_COMPILER_IS_MINGW)
+ SET(MINGW 1)
+ENDIF(CMAKE_COMPILER_IS_MINGW)
+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_LINKER_PREFERENCE 30)
+SET(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
+
+# Save compiler ABI information.
+SET(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@")
+SET(CMAKE_CXX_COMPILER_ABI "@CMAKE_CXX_COMPILER_ABI@")
+SET(CMAKE_CXX_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
+
+IF(CMAKE_CXX_SIZEOF_DATA_PTR)
+ SET(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
+ENDIF(CMAKE_CXX_SIZEOF_DATA_PTR)
+
+IF(CMAKE_CXX_COMPILER_ABI)
+ SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
+ENDIF(CMAKE_CXX_COMPILER_ABI)
+
+IF(CMAKE_CXX_LIBRARY_ARCHITECTURE)
+ SET(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
+ENDIF()
+
+SET(CMAKE_CXX_HAS_ISYSROOT "@CMAKE_CXX_HAS_ISYSROOT@")
+@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_CMCLDEPS_EXECUTABLE@
+@SET_CMAKE_CL_SHOWINCLUDE_PREFIX@
diff --git a/Modules/CMakeCXXCompilerABI.cpp b/Modules/CMakeCXXCompilerABI.cpp
new file mode 100644
index 000000000..c9b0440b8
--- /dev/null
+++ b/Modules/CMakeCXXCompilerABI.cpp
@@ -0,0 +1,20 @@
+#ifndef __cplusplus
+# error "A C compiler has been selected for C++."
+#endif
+
+/*--------------------------------------------------------------------------*/
+
+#include "CMakeCompilerABI.h"
+
+/*--------------------------------------------------------------------------*/
+
+int main(int argc, char* argv[])
+{
+ int require = 0;
+ require += info_sizeof_dptr[argc];
+#if defined(ABI_ID)
+ require += info_abi[argc];
+#endif
+ (void)argv;
+ return require;
+}
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
new file mode 100644
index 000000000..95fc852d6
--- /dev/null
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -0,0 +1,187 @@
+/* This source file must have a .cpp extension so that all C++ compilers
+ recognize the extension without flags. Borland does not know .cxx for
+ example. */
+#ifndef __cplusplus
+# 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"
+
+#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(__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"
+
+#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(__PATHSCALE__)
+# define COMPILER_ID "PathScale"
+
+#elif defined(_CRAYC)
+# define COMPILER_ID "Cray"
+
+#elif defined(__TI_COMPILER_VERSION__)
+# define COMPILER_ID "TI_DSP"
+
+#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
+
+#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
+/* Analog Devices C++ compiler for Blackfin, TigerSHARC and
+ SHARC (21000) DSPs */
+# define COMPILER_ID "ADSP"
+
+#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
+
+/* 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 "]";
+
+@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
+
+/*--------------------------------------------------------------------------*/
+
+int main(int argc, char* argv[])
+{
+ int require = 0;
+ require += info_compiler[argc];
+ require += info_platform[argc];
+#ifdef COMPILER_VERSION_MAJOR
+ require += info_version[argc];
+#endif
+ (void)argv;
+ return require;
+}
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
new file mode 100644
index 000000000..9dc9cbd30
--- /dev/null
+++ b/Modules/CMakeCXXInformation.cmake
@@ -0,0 +1,299 @@
+
+#=============================================================================
+# Copyright 2004-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.)
+
+# This file sets the basic flags for the C++ language in CMake.
+# It also loads the available platform file for the system-compiler
+# if it exists.
+# It also loads a system - compiler - processor (or target hardware)
+# specific file, which is mainly useful for crosscompiling and embedded systems.
+
+# 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)
+ SET(CMAKE_CXX_OUTPUT_EXTENSION .o)
+ELSE(UNIX)
+ SET(CMAKE_CXX_OUTPUT_EXTENSION .obj)
+ENDIF(UNIX)
+
+SET(_INCLUDED_FILE 0)
+
+# Load compiler-specific information.
+IF(CMAKE_CXX_COMPILER_ID)
+ INCLUDE(Compiler/${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL)
+ENDIF(CMAKE_CXX_COMPILER_ID)
+
+SET(CMAKE_BASE_NAME)
+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++)
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+
+
+# load a hardware specific file, mostly useful for embedded compilers
+IF(CMAKE_SYSTEM_PROCESSOR)
+ IF(CMAKE_CXX_COMPILER_ID)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
+ ENDIF(CMAKE_CXX_COMPILER_ID)
+ IF (NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
+ ENDIF (NOT _INCLUDED_FILE)
+ENDIF(CMAKE_SYSTEM_PROCESSOR)
+
+# load the system- and compiler specific files
+IF(CMAKE_CXX_COMPILER_ID)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
+ENDIF(CMAKE_CXX_COMPILER_ID)
+IF (NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL
+ RESULT_VARIABLE _INCLUDED_FILE)
+ENDIF (NOT _INCLUDED_FILE)
+# 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.
+# Remove this when all compiler info is removed from system files.
+IF (NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
+ENDIF (NOT _INCLUDED_FILE)
+
+IF(CMAKE_CXX_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_CXX_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_CXX_ABI_FILES)
+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_CXX)
+ # Save the full path of the file so try_compile can use it.
+ INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} RESULT_VARIABLE _override)
+ SET(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX "${_override}")
+ENDIF()
+
+
+# Create a set of shared library variable specific to C++
+# For 90% of the systems, these are the same flags as the C versions
+# so if these are not set just copy the flags from the c version
+IF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS)
+ SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
+ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS)
+
+IF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIC)
+ SET(CMAKE_CXX_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC})
+ENDIF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIC)
+
+IF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIE)
+ SET(CMAKE_CXX_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE})
+ENDIF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIE)
+
+IF(NOT CMAKE_CXX_COMPILE_OPTIONS_DLL)
+ SET(CMAKE_CXX_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL})
+ENDIF(NOT CMAKE_CXX_COMPILE_OPTIONS_DLL)
+
+IF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS)
+ SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
+ENDIF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS)
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
+ SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS})
+ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
+
+IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG)
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
+ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG)
+
+IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP)
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
+ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP)
+
+IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG)
+ SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
+ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG)
+
+IF(NOT DEFINED CMAKE_EXE_EXPORTS_CXX_FLAG)
+ SET(CMAKE_EXE_EXPORTS_CXX_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG)
+ SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
+ENDIF()
+
+IF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG)
+ SET(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG})
+ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG)
+
+IF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP)
+ SET(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP})
+ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP)
+
+IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG)
+ SET(CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG})
+ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG)
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH)
+ SET(CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH})
+ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH)
+
+IF(NOT CMAKE_INCLUDE_FLAG_CXX)
+ SET(CMAKE_INCLUDE_FLAG_CXX ${CMAKE_INCLUDE_FLAG_C})
+ENDIF(NOT CMAKE_INCLUDE_FLAG_CXX)
+
+IF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX)
+ SET(CMAKE_INCLUDE_FLAG_SEP_CXX ${CMAKE_INCLUDE_FLAG_SEP_C})
+ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX)
+
+# 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_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
+ SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS})
+ENDIF(NOT CMAKE_MODULE_EXISTS)
+
+# repeat for modules
+IF(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS)
+ SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
+ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS)
+
+IF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS)
+ SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS})
+ENDIF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS)
+
+# Initialize CXX link type selection flags from C versions.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ IF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS)
+ SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS
+ ${CMAKE_${type}_LINK_STATIC_C_FLAGS})
+ ENDIF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS)
+ IF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS)
+ SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS
+ ${CMAKE_${type}_LINK_DYNAMIC_C_FLAGS})
+ ENDIF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS)
+ENDFOREACH(type)
+
+# add the flags to the cache based
+# on the initial values computed in the platform/*.cmake files
+# use _INIT variables so that this only happens the first time
+# and you can set these flags in the cmake cache
+SET(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}")
+# avoid just having a space as the initial value for the cache
+IF(CMAKE_CXX_FLAGS_INIT STREQUAL " ")
+ SET(CMAKE_CXX_FLAGS_INIT)
+ENDIF(CMAKE_CXX_FLAGS_INIT STREQUAL " ")
+SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}" CACHE STRING
+ "Flags used by the compiler during all build types.")
+
+IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+ SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT}" CACHE STRING
+ "Flags used by the compiler during debug builds.")
+ SET (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT}" CACHE STRING
+ "Flags used by the compiler during release minsize builds.")
+ 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).")
+ SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
+ "Flags used by the compiler during Release with Debug Info builds.")
+
+ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+
+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.")
+ MARK_AS_ADVANCED(CMAKE_CXX_STANDARD_LIBRARIES)
+ENDIF(CMAKE_CXX_STANDARD_LIBRARIES_INIT)
+
+INCLUDE(CMakeCommonLanguageInclude)
+
+# now define the following rules:
+# CMAKE_CXX_CREATE_SHARED_LIBRARY
+# CMAKE_CXX_CREATE_SHARED_MODULE
+# CMAKE_CXX_COMPILE_OBJECT
+# CMAKE_CXX_LINK_EXECUTABLE
+
+# variables supplied by the generator at use time
+# <TARGET>
+# <TARGET_BASE> the target without the suffix
+# <OBJECTS>
+# <OBJECT>
+# <LINK_LIBRARIES>
+# <FLAGS>
+# <LINK_FLAGS>
+
+# CXX compiler information
+# <CMAKE_CXX_COMPILER>
+# <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS>
+# <CMAKE_CXX_SHARED_MODULE_CREATE_FLAGS>
+# <CMAKE_CXX_LINK_FLAGS>
+
+# Static library tools
+# <CMAKE_AR>
+# <CMAKE_RANLIB>
+
+
+# create a shared C++ library
+IF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
+ SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
+ "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
+ENDIF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
+
+# create a c++ shared module copy the shared library rule by default
+IF(NOT CMAKE_CXX_CREATE_SHARED_MODULE)
+ SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
+ENDIF(NOT CMAKE_CXX_CREATE_SHARED_MODULE)
+
+
+# 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>")
+ENDIF()
+IF(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND)
+ SET(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ENDIF()
+IF(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH)
+ SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
+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>")
+ENDIF(NOT CMAKE_CXX_COMPILE_OBJECT)
+
+IF(NOT CMAKE_CXX_LINK_EXECUTABLE)
+ SET(CMAKE_CXX_LINK_EXECUTABLE
+ "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+ENDIF(NOT CMAKE_CXX_LINK_EXECUTABLE)
+
+MARK_AS_ADVANCED(
+CMAKE_BUILD_TOOL
+CMAKE_VERBOSE_MAKEFILE
+CMAKE_CXX_FLAGS
+CMAKE_CXX_FLAGS_RELEASE
+CMAKE_CXX_FLAGS_RELWITHDEBINFO
+CMAKE_CXX_FLAGS_MINSIZEREL
+CMAKE_CXX_FLAGS_DEBUG)
+
+SET(CMAKE_CXX_INFORMATION_LOADED 1)
+
diff --git a/Modules/CMakeClDeps.cmake b/Modules/CMakeClDeps.cmake
new file mode 100644
index 000000000..6815e2b75
--- /dev/null
+++ b/Modules/CMakeClDeps.cmake
@@ -0,0 +1,37 @@
+
+#=============================================================================
+# 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 showOut)
+ STRING(REPLACE main.c "" showOut1 ${showOut})
+ STRING(REPLACE "/" "\\" header1 ${showdir}/foo.h)
+ STRING(TOLOWER ${header1} header2)
+ STRING(REPLACE ${header2} "" showOut2 ${showOut1})
+ STRING(REPLACE "\n" "" showOut3 ${showOut2})
+ SET(SET_CMAKE_CMCLDEPS_EXECUTABLE "SET(CMAKE_CMCLDEPS_EXECUTABLE \"${CMAKE_CMCLDEPS_EXECUTABLE}\")")
+ SET(SET_CMAKE_CL_SHOWINCLUDE_PREFIX "SET(CMAKE_CL_SHOWINCLUDE_PREFIX \"${showOut3}\")")
+ENDIF()
diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake
new file mode 100644
index 000000000..a2929f1ea
--- /dev/null
+++ b/Modules/CMakeCommonLanguageInclude.cmake
@@ -0,0 +1,107 @@
+
+#=============================================================================
+# 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.)
+
+# this file has flags that are shared across languages and sets
+# 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 CMAKE_NOT_USING_CONFIG_FLAGS)
+# default build type is none
+ IF(NOT CMAKE_NO_BUILD_TYPE)
+ SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
+ "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
+ ENDIF(NOT CMAKE_NO_BUILD_TYPE)
+
+ SET (CMAKE_EXE_LINKER_FLAGS_DEBUG ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
+ "Flags used by the linker during debug builds.")
+
+ SET (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT} CACHE STRING
+ "Flags used by the linker during release minsize builds.")
+
+ SET (CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
+ "Flags used by the linker during release builds.")
+
+ SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
+ ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
+ "Flags used by the linker during Release with Debug Info builds.")
+
+ SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
+ "Flags used by the linker during debug builds.")
+
+ SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL ${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT}
+ CACHE STRING
+ "Flags used by the linker during release minsize builds.")
+
+ SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
+ "Flags used by the linker during release builds.")
+
+ SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
+ ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
+ "Flags used by the linker during Release with Debug Info builds.")
+
+ SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG ${CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
+ "Flags used by the linker during debug builds.")
+
+ SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL ${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT}
+ CACHE STRING
+ "Flags used by the linker during release minsize builds.")
+
+ SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
+ "Flags used by the linker during release builds.")
+
+ SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
+ ${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
+ "Flags used by the linker during Release with Debug Info builds.")
+
+ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+# shared linker flags
+SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
+ 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}"
+ CACHE STRING "Flags used by the linker during the creation of modules.")
+
+SET(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL
+ "What is the target build tool cmake is generating for.")
+
+
+MARK_AS_ADVANCED(
+CMAKE_BUILD_TOOL
+CMAKE_VERBOSE_MAKEFILE
+
+CMAKE_EXE_LINKER_FLAGS
+CMAKE_EXE_LINKER_FLAGS_DEBUG
+CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
+CMAKE_EXE_LINKER_FLAGS_RELEASE
+CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
+
+CMAKE_SHARED_LINKER_FLAGS
+CMAKE_SHARED_LINKER_FLAGS_DEBUG
+CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
+CMAKE_SHARED_LINKER_FLAGS_RELEASE
+CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
+
+CMAKE_MODULE_LINKER_FLAGS
+CMAKE_MODULE_LINKER_FLAGS_DEBUG
+CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
+CMAKE_MODULE_LINKER_FLAGS_RELEASE
+CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
+
+)
+
diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h
new file mode 100644
index 000000000..26ae4db6a
--- /dev/null
+++ b/Modules/CMakeCompilerABI.h
@@ -0,0 +1,36 @@
+/*--------------------------------------------------------------------------*/
+
+/* Size of a pointer-to-data in bytes. */
+#define SIZEOF_DPTR (sizeof(void*))
+const char info_sizeof_dptr[] = {
+ 'I', 'N', 'F', 'O', ':', 's', 'i', 'z', 'e', 'o', 'f', '_', 'd', 'p', 't', 'r', '[',
+ ('0' + ((SIZEOF_DPTR / 10)%10)),
+ ('0' + (SIZEOF_DPTR % 10)),
+ ']','\0'};
+
+/*--------------------------------------------------------------------------*/
+
+/* Application Binary Interface. */
+#if defined(__sgi) && defined(_ABIO32)
+# define ABI_ID "ELF O32"
+#elif defined(__sgi) && defined(_ABIN32)
+# define ABI_ID "ELF N32"
+#elif defined(__sgi) && defined(_ABI64)
+# define ABI_ID "ELF 64"
+
+/* Check for (some) ARM ABIs.
+ * See e.g. http://wiki.debian.org/ArmEabiPort for some information on this. */
+#elif defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__)
+# define ABI_ID "ELF ARMEABI"
+#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEB__)
+# define ABI_ID "ELF ARM"
+#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEL__)
+# define ABI_ID "ELF ARM"
+
+#elif defined(__ELF__)
+# define ABI_ID "ELF"
+#endif
+
+#if defined(ABI_ID)
+static char const info_abi[] = "INFO:abi[" ABI_ID "]";
+#endif
diff --git a/Modules/CMakeConfigurableFile.in b/Modules/CMakeConfigurableFile.in
new file mode 100644
index 000000000..4cf74a12b
--- /dev/null
+++ b/Modules/CMakeConfigurableFile.in
@@ -0,0 +1,2 @@
+@CMAKE_CONFIGURABLE_FILE_CONTENT@
+
diff --git a/Modules/CMakeDependentOption.cmake b/Modules/CMakeDependentOption.cmake
new file mode 100644
index 000000000..8b8dc07fb
--- /dev/null
+++ b/Modules/CMakeDependentOption.cmake
@@ -0,0 +1,51 @@
+# - Macro to provide an option dependent on other options.
+# This macro presents an option to the user only if a set of other
+# conditions are true. When the option is not presented a default
+# value is used, but any value set by the user is preserved for when
+# the option is presented again.
+# Example invocation:
+# CMAKE_DEPENDENT_OPTION(USE_FOO "Use Foo" ON
+# "USE_BAR;NOT USE_ZOT" OFF)
+# If USE_BAR is true and USE_ZOT is false, this provides an option called
+# USE_FOO that defaults to ON. Otherwise, it sets USE_FOO to OFF. If
+# the status of USE_BAR or USE_ZOT ever changes, any value for the
+# USE_FOO option is saved so that when the option is re-enabled it
+# retains its old value.
+
+#=============================================================================
+# Copyright 2006-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(CMAKE_DEPENDENT_OPTION option doc default depends force)
+ IF(${option}_ISSET MATCHES "^${option}_ISSET$")
+ SET(${option}_AVAILABLE 1)
+ FOREACH(d ${depends})
+ STRING(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${d}")
+ IF(${CMAKE_DEPENDENT_OPTION_DEP})
+ ELSE(${CMAKE_DEPENDENT_OPTION_DEP})
+ SET(${option}_AVAILABLE 0)
+ ENDIF(${CMAKE_DEPENDENT_OPTION_DEP})
+ ENDFOREACH(d)
+ IF(${option}_AVAILABLE)
+ OPTION(${option} "${doc}" "${default}")
+ SET(${option} "${${option}}" CACHE BOOL "${doc}" FORCE)
+ ELSE(${option}_AVAILABLE)
+ IF(${option} MATCHES "^${option}$")
+ ELSE(${option} MATCHES "^${option}$")
+ SET(${option} "${${option}}" CACHE INTERNAL "${doc}")
+ ENDIF(${option} MATCHES "^${option}$")
+ SET(${option} ${force})
+ ENDIF(${option}_AVAILABLE)
+ ELSE(${option}_ISSET MATCHES "^${option}_ISSET$")
+ SET(${option} "${${option}_ISSET}")
+ ENDIF(${option}_ISSET MATCHES "^${option}_ISSET$")
+ENDMACRO(CMAKE_DEPENDENT_OPTION)
diff --git a/Modules/CMakeDetermineASM-ATTCompiler.cmake b/Modules/CMakeDetermineASM-ATTCompiler.cmake
new file mode 100644
index 000000000..9dd2f11de
--- /dev/null
+++ b/Modules/CMakeDetermineASM-ATTCompiler.cmake
@@ -0,0 +1,20 @@
+
+#=============================================================================
+# 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.)
+
+# determine the compiler to use for ASM using AT&T syntax, e.g. GNU as
+
+SET(ASM_DIALECT "-ATT")
+SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}gas ${_CMAKE_TOOLCHAIN_PREFIX}as)
+INCLUDE(CMakeDetermineASMCompiler)
+SET(ASM_DIALECT)
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
new file mode 100644
index 000000000..0a70d0a82
--- /dev/null
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -0,0 +1,182 @@
+
+#=============================================================================
+# 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.)
+
+# determine the compiler to use for ASM programs
+
+IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
+ # prefer the environment variable ASM
+ IF($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}")
+ ENDIF($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
+
+ # finally list compilers to try
+ IF("ASM${ASM_DIALECT}" STREQUAL "ASM") # the generic assembler support
+
+ IF(CMAKE_ASM_COMPILER_INIT)
+ SET(CMAKE_ASM_COMPILER_LIST ${CMAKE_ASM_COMPILER_INIT})
+ ELSE(CMAKE_ASM_COMPILER_INIT)
+
+ IF(CMAKE_C_COMPILER)
+ SET(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "The ASM compiler")
+ SET(CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}")
+ ELSEIF(CMAKE_CXX_COMPILER)
+ SET(CMAKE_ASM_COMPILER "${CMAKE_CXX_COMPILER}" CACHE FILEPATH "The ASM compiler")
+ SET(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}")
+ ELSE(CMAKE_CXX_COMPILER)
+ # List all default C and CXX compilers
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc
+ ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC)
+ ENDIF(CMAKE_C_COMPILER)
+
+ ENDIF(CMAKE_ASM_COMPILER_INIT)
+
+
+ ELSE("ASM${ASM_DIALECT}" STREQUAL "ASM") # some specific assembler "dialect"
+
+ IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT})
+ ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
+ MESSAGE(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !")
+ ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
+
+ ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM")
+
+
+ # Find the compiler.
+ IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
+ FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_USER_C_COMPILER_PATH} ${_CMAKE_USER_CXX_COMPILER_PATH} DOC "Assembler" NO_DEFAULT_PATH)
+ ENDIF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
+ FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_TOOLCHAIN_LOCATION} DOC "Assembler")
+
+ELSE(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
+
+ # 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(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
+ ENDIF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH)
+ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
+MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_COMPILER)
+
+IF (NOT _CMAKE_TOOLCHAIN_LOCATION)
+ GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
+ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
+
+
+IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
+
+ # Table of per-vendor compiler id flags with expected output.
+ LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU )
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)")
+
+ LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS HP )
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_HP "-V")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_HP "HP C")
+
+ LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Intel )
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Intel "--version")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Intel "(ICC)")
+
+ LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS SunPro )
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_SunPro "-V")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_SunPro "Sun C")
+
+ LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS XL )
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_XL "-qversion")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C")
+
+ LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS MSVC )
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "/?")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_MSVC "Microsoft")
+
+ LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP )
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments")
+
+ INCLUDE(CMakeDetermineCompilerId)
+ CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
+
+ENDIF()
+
+IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
+ MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
+ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
+ MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown")
+ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
+
+
+
+# If we have a gas/as cross compiler, they have usually some prefix, like
+# 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
+# "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)
+ GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME)
+ IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
+
+# Now try the C compiler regexp:
+IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
+ IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
+
+# Finally try the CXX compiler regexp:
+IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
+ IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
+
+
+INCLUDE(CMakeFindBinUtils)
+
+SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR "ASM${ASM_DIALECT}")
+
+IF(CMAKE_ASM${ASM_DIALECT}_COMPILER)
+ MESSAGE(STATUS "Found assembler: ${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
+ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER)
+ MESSAGE(STATUS "Didn't find assembler")
+ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER)
+
+
+SET(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
+SET(_CMAKE_ASM_COMPILER_ID "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
+SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}")
+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_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY)
+
+SET(_CMAKE_ASM_COMPILER)
+SET(_CMAKE_ASM_COMPILER_ARG1)
+SET(_CMAKE_ASM_COMPILER_ENV_VAR)
diff --git a/Modules/CMakeDetermineASM_MASMCompiler.cmake b/Modules/CMakeDetermineASM_MASMCompiler.cmake
new file mode 100644
index 000000000..e23f7db4c
--- /dev/null
+++ b/Modules/CMakeDetermineASM_MASMCompiler.cmake
@@ -0,0 +1,27 @@
+
+#=============================================================================
+# Copyright 2008-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.)
+
+# Find the MS assembler (masm or masm64)
+
+SET(ASM_DIALECT "_MASM")
+
+# if we are using the 64bit cl compiler, assume we also want the 64bit assembler
+IF(CMAKE_CL_64)
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64)
+ELSE(CMAKE_CL_64)
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml)
+ENDIF(CMAKE_CL_64)
+
+INCLUDE(CMakeDetermineASMCompiler)
+SET(ASM_DIALECT)
diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake
new file mode 100644
index 000000000..d184c0a81
--- /dev/null
+++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake
@@ -0,0 +1,27 @@
+
+#=============================================================================
+# Copyright 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.)
+
+# Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible
+
+SET(CMAKE_ASM_NASM_COMPILER_INIT nasm yasm)
+
+IF(NOT CMAKE_ASM_NASM_COMPILER)
+ FIND_PROGRAM(CMAKE_ASM_NASM_COMPILER nasm
+ "$ENV{ProgramFiles}/NASM")
+ENDIF(NOT CMAKE_ASM_NASM_COMPILER)
+
+# Load the generic DetermineASM compiler file with the DIALECT set properly:
+SET(ASM_DIALECT "_NASM")
+INCLUDE(CMakeDetermineASMCompiler)
+SET(ASM_DIALECT)
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
new file mode 100644
index 000000000..9028e8e06
--- /dev/null
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -0,0 +1,179 @@
+
+#=============================================================================
+# 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.)
+
+# determine the compiler to use for C programs
+# NOTE, a generator may set CMAKE_C_COMPILER before
+# loading this file to force a compiler.
+# use environment variable CC first if defined by user, next use
+# the cmake variable CMAKE_GENERATOR_CC which can be defined by a generator
+# as a default compiler
+# If the internal cmake variable _CMAKE_TOOLCHAIN_PREFIX is set, this is used
+# as prefix for the tools (e.g. arm-elf-gcc, arm-elf-ar etc.). This works
+# currently with the GNU crosscompilers.
+#
+# Sets the following variables:
+# CMAKE_C_COMPILER
+# CMAKE_AR
+# CMAKE_RANLIB
+# CMAKE_COMPILER_IS_GNUCC
+#
+# If not already set before, it also sets
+# _CMAKE_TOOLCHAIN_PREFIX
+
+IF(NOT CMAKE_C_COMPILER)
+ SET(CMAKE_C_COMPILER_INIT NOTFOUND)
+
+ # prefer the environment variable CC
+ IF($ENV{CC} MATCHES ".+")
+ 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")
+ ENDIF(CMAKE_C_FLAGS_ENV_INIT)
+ IF(NOT EXISTS ${CMAKE_C_COMPILER_INIT})
+ MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.")
+ ENDIF(NOT EXISTS ${CMAKE_C_COMPILER_INIT})
+ ENDIF($ENV{CC} MATCHES ".+")
+
+ # next try prefer the compiler specified by the generator
+ IF(CMAKE_GENERATOR_CC)
+ IF(NOT CMAKE_C_COMPILER_INIT)
+ SET(CMAKE_C_COMPILER_INIT ${CMAKE_GENERATOR_CC})
+ ENDIF(NOT CMAKE_C_COMPILER_INIT)
+ ENDIF(CMAKE_GENERATOR_CC)
+
+ # finally list compilers to try
+ IF(CMAKE_C_COMPILER_INIT)
+ SET(CMAKE_C_COMPILER_LIST ${CMAKE_C_COMPILER_INIT})
+ ELSE(CMAKE_C_COMPILER_INIT)
+ SET(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc)
+ ENDIF(CMAKE_C_COMPILER_INIT)
+
+ # Find the compiler.
+ IF (_CMAKE_USER_CXX_COMPILER_PATH)
+ FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} PATHS ${_CMAKE_USER_CXX_COMPILER_PATH} DOC "C compiler" NO_DEFAULT_PATH)
+ ENDIF (_CMAKE_USER_CXX_COMPILER_PATH)
+ FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} DOC "C compiler")
+
+ IF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)
+ SET(CMAKE_C_COMPILER "${CMAKE_C_COMPILER_INIT}" CACHE FILEPATH "C compiler" FORCE)
+ ENDIF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)
+ELSE(NOT CMAKE_C_COMPILER)
+
+ # 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("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2)
+
+ # 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(CMAKE_C_COMPILER_WITH_PATH)
+ ENDIF(NOT _CMAKE_USER_C_COMPILER_PATH)
+ENDIF(NOT CMAKE_C_COMPILER)
+MARK_AS_ADVANCED(CMAKE_C_COMPILER)
+
+IF (NOT _CMAKE_TOOLCHAIN_LOCATION)
+ GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH)
+ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
+
+# Build a small source file to identify the compiler.
+IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+ SET(CMAKE_C_COMPILER_ID_RUN 1)
+ SET(CMAKE_C_PLATFORM_ID "Windows")
+ SET(CMAKE_C_COMPILER_ID "MSVC")
+ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+
+IF(NOT CMAKE_C_COMPILER_ID_RUN)
+ SET(CMAKE_C_COMPILER_ID_RUN 1)
+
+ # 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
+ # Try compiling to an object file only.
+ "-c"
+
+ # Try enabling ANSI mode on HP.
+ "-Aa"
+ )
+
+ # Try to identify the compiler.
+ SET(CMAKE_C_COMPILER_ID)
+ FILE(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
+ CMAKE_C_COMPILER_ID_PLATFORM_CONTENT)
+ 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")
+ SET(CMAKE_COMPILER_IS_GNUCC 1)
+ ENDIF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+ IF("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")
+ SET(CMAKE_COMPILER_IS_MINGW 1)
+ ELSEIF("${CMAKE_C_PLATFORM_ID}" MATCHES "Cygwin")
+ SET(CMAKE_COMPILER_IS_CYGWIN 1)
+ ENDIF("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")
+ENDIF(NOT CMAKE_C_COMPILER_ID_RUN)
+
+# If we have a gcc cross compiler, they have usually some prefix, like
+# 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
+# "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 "${CMAKE_C_COMPILER_ID}" MATCHES "GNU"
+ AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+ GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
+ IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+
+ # if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
+ # but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
+ IF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
+ SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ ENDIF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
+
+ENDIF (CMAKE_CROSSCOMPILING
+ AND "${CMAKE_C_COMPILER_ID}" MATCHES "GNU"
+ AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+
+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(MSVC_C_ARCHITECTURE_ID)
+# configure variables set in this file for fast reload later on
+CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
+ "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCCompiler.cmake"
+ @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ )
+SET(CMAKE_C_COMPILER_ENV_VAR "CC")
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
new file mode 100644
index 000000000..7f8f3ec8b
--- /dev/null
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -0,0 +1,188 @@
+
+#=============================================================================
+# 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.)
+
+# determine the compiler to use for C++ programs
+# NOTE, a generator may set CMAKE_CXX_COMPILER before
+# loading this file to force a compiler.
+# use environment variable CXX first if defined by user, next use
+# the cmake variable CMAKE_GENERATOR_CXX which can be defined by a generator
+# as a default compiler
+# If the internal cmake variable _CMAKE_TOOLCHAIN_PREFIX is set, this is used
+# as prefix for the tools (e.g. arm-elf-g++, arm-elf-ar etc.)
+#
+# Sets the following variables:
+# CMAKE_CXX_COMPILER
+# CMAKE_COMPILER_IS_GNUCXX
+# CMAKE_AR
+# CMAKE_RANLIB
+#
+# If not already set before, it also sets
+# _CMAKE_TOOLCHAIN_PREFIX
+
+IF(NOT CMAKE_CXX_COMPILER)
+ SET(CMAKE_CXX_COMPILER_INIT NOTFOUND)
+
+ # prefer the environment variable CXX
+ IF($ENV{CXX} MATCHES ".+")
+ 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")
+ ENDIF(CMAKE_CXX_FLAGS_ENV_INIT)
+ IF(NOT EXISTS ${CMAKE_CXX_COMPILER_INIT})
+ MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}")
+ ENDIF(NOT EXISTS ${CMAKE_CXX_COMPILER_INIT})
+ ENDIF($ENV{CXX} MATCHES ".+")
+
+ # next prefer the generator specified compiler
+ IF(CMAKE_GENERATOR_CXX)
+ IF(NOT CMAKE_CXX_COMPILER_INIT)
+ SET(CMAKE_CXX_COMPILER_INIT ${CMAKE_GENERATOR_CXX})
+ ENDIF(NOT CMAKE_CXX_COMPILER_INIT)
+ ENDIF(CMAKE_GENERATOR_CXX)
+
+ # finally list compilers to try
+ IF(CMAKE_CXX_COMPILER_INIT)
+ SET(CMAKE_CXX_COMPILER_LIST ${CMAKE_CXX_COMPILER_INIT})
+ ELSE(CMAKE_CXX_COMPILER_INIT)
+ SET(CMAKE_CXX_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC)
+ ENDIF(CMAKE_CXX_COMPILER_INIT)
+
+ # Find the compiler.
+ IF (_CMAKE_USER_C_COMPILER_PATH)
+ FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES ${CMAKE_CXX_COMPILER_LIST} PATHS ${_CMAKE_USER_C_COMPILER_PATH} DOC "C++ compiler" NO_DEFAULT_PATH)
+ ENDIF (_CMAKE_USER_C_COMPILER_PATH)
+ FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES ${CMAKE_CXX_COMPILER_LIST} DOC "C++ compiler")
+
+ IF(CMAKE_CXX_COMPILER_INIT AND NOT CMAKE_CXX_COMPILER)
+ SET(CMAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER_INIT}" CACHE FILEPATH "C++ compiler" FORCE)
+ ENDIF(CMAKE_CXX_COMPILER_INIT AND NOT CMAKE_CXX_COMPILER)
+ELSE(NOT CMAKE_CXX_COMPILER)
+
+# 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("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2)
+
+# 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(CMAKE_CXX_COMPILER_WITH_PATH)
+ ENDIF(NOT _CMAKE_USER_CXX_COMPILER_PATH)
+ENDIF(NOT CMAKE_CXX_COMPILER)
+MARK_AS_ADVANCED(CMAKE_CXX_COMPILER)
+
+IF (NOT _CMAKE_TOOLCHAIN_LOCATION)
+ GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH)
+ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
+
+# This block was used before the compiler was identified by building a
+# source file. Unless g++ crashes when building a small C++
+# executable this should no longer be needed.
+#
+# The g++ that comes with BeOS 5 segfaults if you run "g++ -E"
+# ("gcc -E" is fine), which throws up a system dialog box that hangs cmake
+# until the user clicks "OK"...so for now, we just assume it's g++.
+# IF(BEOS)
+# SET(CMAKE_COMPILER_IS_GNUCXX 1)
+# SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
+# ENDIF(BEOS)
+
+# Build a small source file to identify the compiler.
+IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+ SET(CMAKE_CXX_COMPILER_ID_RUN 1)
+ SET(CMAKE_CXX_PLATFORM_ID "Windows")
+ SET(CMAKE_CXX_COMPILER_ID "MSVC")
+ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+IF(NOT CMAKE_CXX_COMPILER_ID_RUN)
+ SET(CMAKE_CXX_COMPILER_ID_RUN 1)
+
+ # 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
+ # Try compiling to an object file only.
+ "-c"
+ )
+
+ # Try to identify the compiler.
+ SET(CMAKE_CXX_COMPILER_ID)
+ FILE(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
+ CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT)
+ 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")
+ SET(CMAKE_COMPILER_IS_GNUCXX 1)
+ ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ IF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")
+ SET(CMAKE_COMPILER_IS_MINGW 1)
+ ELSEIF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "Cygwin")
+ SET(CMAKE_COMPILER_IS_CYGWIN 1)
+ ENDIF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")
+ENDIF(NOT CMAKE_CXX_COMPILER_ID_RUN)
+
+# if we have a g++ cross compiler, they have usually some prefix, like
+# 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
+# "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 "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"
+ AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+ GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
+ IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+
+ # if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
+ # but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
+ IF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
+ SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ ENDIF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
+
+ENDIF (CMAKE_CROSSCOMPILING
+ AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"
+ AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+
+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(MSVC_CXX_ARCHITECTURE_ID)
+# configure all variables set in this file
+CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake
+ @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ )
+
+SET(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
new file mode 100644
index 000000000..1c9899e64
--- /dev/null
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -0,0 +1,131 @@
+
+#=============================================================================
+# Copyright 2008-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.)
+
+# Function to compile a source file to identify the compiler ABI.
+# This is used internally by CMake and should not be included by user
+# code.
+
+INCLUDE(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
+
+FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
+ IF(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+ MESSAGE(STATUS "Detecting ${lang} compiler ABI info")
+
+ # Compile the ABI identification source.
+ SET(BIN "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDetermineCompilerABI_${lang}.bin")
+ SET(CMAKE_FLAGS )
+ IF(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
+ SET(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
+ ENDIF()
+ TRY_COMPILE(CMAKE_DETERMINE_${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.
+ "--no-warn-unused-cli"
+ OUTPUT_VARIABLE OUTPUT
+ COPY_FILE "${BIN}"
+ )
+
+ # Load the resulting information strings.
+ IF(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+ 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:[^[]*\\[")
+ FOREACH(info ${ABI_STRINGS})
+ IF("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
+ STRING(REGEX REPLACE ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*" "\\1" ABI_SIZEOF_DPTR "${info}")
+ ENDIF("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
+ IF("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
+ STRING(REGEX REPLACE ".*INFO:abi\\[([^]]*)\\].*" "\\1" ABI_NAME "${info}")
+ ENDIF("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
+ ENDFOREACH(info)
+
+ IF(ABI_SIZEOF_DPTR)
+ SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE)
+ ELSEIF(CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT)
+ SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE)
+ ENDIF(ABI_SIZEOF_DPTR)
+
+ IF(ABI_NAME)
+ SET(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE)
+ ENDIF(ABI_NAME)
+
+ # Parse implicit linker information for this language, if available.
+ SET(implicit_dirs "")
+ SET(implicit_libs "")
+ SET(MULTI_ARCH FALSE)
+ IF(DEFINED CMAKE_OSX_ARCHITECTURES)
+ IF( "${CMAKE_OSX_ARCHITECTURES}" MATCHES ";" )
+ SET(MULTI_ARCH TRUE)
+ ENDIF()
+ ENDIF()
+ IF(CMAKE_${lang}_VERBOSE_FLAG
+ # Implicit link information cannot be used explicitly for
+ # multiple OS X architectures, so we skip it.
+ AND NOT MULTI_ARCH
+ # Skip this with Xcode for now.
+ AND NOT "${CMAKE_GENERATOR}" MATCHES Xcode)
+ CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log
+ "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Parsed ${lang} implicit link information from above output:\n${log}\n\n")
+ ENDIF()
+ # for VS IDE Intel Fortran we have to figure out the
+ # implicit link path for the fortran run time using
+ # a try-compile
+ IF("${lang}" MATCHES "Fortran"
+ AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
+ SET(_desc "Determine Intel Fortran Compiler Implicit Link Path")
+ MESSAGE(STATUS "${_desc}")
+ # Build a sample project which reports symbols.
+ TRY_COMPILE(IFORT_LIB_PATH_COMPILED
+ ${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath
+ ${CMAKE_ROOT}/Modules/IntelVSImplicitPath
+ IntelFortranImplicit
+ CMAKE_FLAGS
+ "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
+ OUTPUT_VARIABLE _output)
+ FILE(WRITE
+ "${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt"
+ "${_output}")
+ INCLUDE(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL)
+ SET(_desc "Determine Intel Fortran Compiler Implicit Link Path -- done")
+ MESSAGE(STATUS "${_desc}")
+ ENDIF()
+
+ SET(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
+ SET(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
+
+ # Detect library architecture directory name.
+ IF(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
+ FOREACH(dir ${implicit_dirs})
+ IF("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
+ GET_FILENAME_COMPONENT(arch "${dir}" NAME)
+ SET(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${arch}" PARENT_SCOPE)
+ BREAK()
+ ENDIF()
+ ENDFOREACH()
+ ENDIF()
+
+ ELSE(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+ MESSAGE(STATUS "Detecting ${lang} compiler ABI info - failed")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Detecting ${lang} compiler ABI info failed to compile with the following output:\n${OUTPUT}\n\n")
+ ENDIF(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+ ENDIF(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ABI)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
new file mode 100644
index 000000000..67f5a5906
--- /dev/null
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -0,0 +1,323 @@
+
+#=============================================================================
+# 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.)
+
+# Function to compile a source file to identify the compiler. This is
+# used internally by CMake and should not be included by user code.
+# If successful, sets CMAKE_<lang>_COMPILER_ID and CMAKE_<lang>_PLATFORM_ID
+
+FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
+ # Make sure the compiler arguments are clean.
+ STRING(STRIP "${CMAKE_${lang}_COMPILER_ARG1}" CMAKE_${lang}_COMPILER_ID_ARG1)
+ STRING(REGEX REPLACE " +" ";" CMAKE_${lang}_COMPILER_ID_ARG1 "${CMAKE_${lang}_COMPILER_ID_ARG1}")
+
+ # Make sure user-specified compiler flags are used.
+ IF(CMAKE_${lang}_FLAGS)
+ SET(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS})
+ ELSE(CMAKE_${lang}_FLAGS)
+ SET(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}})
+ ENDIF(CMAKE_${lang}_FLAGS)
+ STRING(REGEX 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_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/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(file)
+ ENDIF(NOT CMAKE_${lang}_COMPILER_ID)
+ ENDFOREACH(flags)
+
+ # If the compiler is still unknown, try to query its vendor.
+ IF(NOT CMAKE_${lang}_COMPILER_ID)
+ CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang})
+ 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(NOT CMAKE_EXECUTABLE_FORMAT)
+
+ # Display the final identification result.
+ IF(CMAKE_${lang}_COMPILER_ID)
+ IF(CMAKE_${lang}_COMPILER_VERSION)
+ SET(_version " ${CMAKE_${lang}_COMPILER_VERSION}")
+ ELSE()
+ SET(_version "")
+ ENDIF()
+ MESSAGE(STATUS "The ${lang} compiler identification is "
+ "${CMAKE_${lang}_COMPILER_ID}${_version}")
+ ELSE(CMAKE_${lang}_COMPILER_ID)
+ MESSAGE(STATUS "The ${lang} compiler identification is unknown")
+ ENDIF(CMAKE_${lang}_COMPILER_ID)
+
+ 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}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
+ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID)
+
+#-----------------------------------------------------------------------------
+# 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)
+ STRING(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY)
+ FILE(WRITE ${CMAKE_${lang}_COMPILER_ID_DIR}/${src} "${ID_CONTENT_OUT}")
+ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_WRITE)
+
+#-----------------------------------------------------------------------------
+# Function to build the compiler id source file and look for output
+# files.
+FUNCTION(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src)
+ # Create a clean working directory.
+ FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
+ FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
+ CMAKE_DETERMINE_COMPILER_ID_WRITE("${lang}" "${src}")
+
+ # Construct a description of this test case.
+ SET(COMPILER_DESCRIPTION
+ "Compiler: ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_ARG1}
+Build flags: ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
+Id flags: ${testflags}
+")
+
+ # Compile the compiler identification source.
+ 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(COMMAND EXECUTE_PROCESS)
+ 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(COMMAND EXECUTE_PROCESS)
+
+ # Check the result of compilation.
+ IF(CMAKE_${lang}_COMPILER_ID_RESULT)
+ # Compilation failed.
+ SET(MSG
+ "Compiling the ${lang} compiler identification source file \"${src}\" failed.
+${COMPILER_DESCRIPTION}
+The output was:
+${CMAKE_${lang}_COMPILER_ID_RESULT}
+${CMAKE_${lang}_COMPILER_ID_OUTPUT}
+
+")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}")
+ #IF(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL)
+ # MESSAGE(FATAL_ERROR "${MSG}")
+ #ENDIF(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL)
+
+ # No output files should be inspected.
+ SET(COMPILER_${lang}_PRODUCED_FILES)
+ ELSE(CMAKE_${lang}_COMPILER_ID_RESULT)
+ # Compilation succeeded.
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Compiling the ${lang} compiler identification source file \"${src}\" succeeded.
+${COMPILER_DESCRIPTION}
+The output was:
+${CMAKE_${lang}_COMPILER_ID_RESULT}
+${CMAKE_${lang}_COMPILER_ID_OUTPUT}
+
+")
+
+ # Find the executable produced by the compiler, try all files in the
+ # binary dir.
+ FILE(GLOB COMPILER_${lang}_PRODUCED_FILES
+ RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR}
+ ${CMAKE_${lang}_COMPILER_ID_DIR}/*)
+ LIST(REMOVE_ITEM COMPILER_${lang}_PRODUCED_FILES "${src}")
+ FOREACH(file ${COMPILER_${lang}_PRODUCED_FILES})
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Compilation of the ${lang} compiler identification source \""
+ "${src}\" produced \"${file}\"\n\n")
+ ENDFOREACH(file)
+
+ IF(NOT COMPILER_${lang}_PRODUCED_FILES)
+ # No executable was found.
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Compilation of the ${lang} compiler identification source \""
+ "${src}\" did not produce an executable in \""
+ "${CMAKE_${lang}_COMPILER_ID_DIR}\".\n\n")
+ ENDIF(NOT COMPILER_${lang}_PRODUCED_FILES)
+ ENDIF(CMAKE_${lang}_COMPILER_ID_RESULT)
+
+ # Return the files produced by the compilation.
+ SET(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE)
+ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src)
+
+#-----------------------------------------------------------------------------
+# Function to extract the compiler id from an executable.
+FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
+ # Look for a compiler id if not yet known.
+ IF(NOT CMAKE_${lang}_COMPILER_ID)
+ # Read the compiler identification string from the executable file.
+ SET(COMPILER_ID)
+ SET(COMPILER_VERSION)
+ SET(PLATFORM_ID)
+ FILE(STRINGS ${file}
+ CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 4 REGEX "INFO:")
+ SET(HAVE_COMPILER_TWICE 0)
+ FOREACH(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
+ IF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*")
+ IF(COMPILER_ID)
+ SET(COMPILER_ID_TWICE 1)
+ ENDIF(COMPILER_ID)
+ STRING(REGEX REPLACE ".*INFO:compiler\\[([^]]*)\\].*" "\\1"
+ COMPILER_ID "${info}")
+ ENDIF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*")
+ IF("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*")
+ STRING(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1"
+ PLATFORM_ID "${info}")
+ ENDIF("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*")
+ IF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*")
+ STRING(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1"
+ ARCHITECTURE_ID "${info}")
+ ENDIF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*")
+ 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}")
+ STRING(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
+ ENDIF("${info}" MATCHES ".*INFO:compiler_version\\[([^]\"]*)\\].*")
+ ENDFOREACH(info)
+
+ # Check if a valid compiler and platform were found.
+ IF(COMPILER_ID AND NOT COMPILER_ID_TWICE)
+ SET(CMAKE_${lang}_COMPILER_ID "${COMPILER_ID}")
+ SET(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}")
+ SET(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}")
+ SET(CMAKE_${lang}_COMPILER_VERSION "${COMPILER_VERSION}")
+ ENDIF(COMPILER_ID AND NOT COMPILER_ID_TWICE)
+
+ # Check the compiler identification string.
+ IF(CMAKE_${lang}_COMPILER_ID)
+ # The compiler identification was found.
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "The ${lang} compiler identification is ${CMAKE_${lang}_COMPILER_ID}, found in \""
+ "${file}\"\n\n")
+ ELSE(CMAKE_${lang}_COMPILER_ID)
+ # The compiler identification could not be found.
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "The ${lang} compiler identification could not be found in \""
+ "${file}\"\n\n")
+ ENDIF(CMAKE_${lang}_COMPILER_ID)
+ ENDIF(NOT CMAKE_${lang}_COMPILER_ID)
+
+ # try to figure out the executable format: ELF, COFF, Mach-O
+ IF(NOT CMAKE_EXECUTABLE_FORMAT)
+ FILE(READ ${file} CMAKE_EXECUTABLE_MAGIC LIMIT 4 HEX)
+
+ # ELF files start with 0x7f"ELF"
+ IF("${CMAKE_EXECUTABLE_MAGIC}" STREQUAL "7f454c46")
+ SET(CMAKE_EXECUTABLE_FORMAT "ELF" CACHE INTERNAL "Executable file format")
+ ENDIF("${CMAKE_EXECUTABLE_MAGIC}" STREQUAL "7f454c46")
+
+# # COFF (.exe) files start with "MZ"
+# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....")
+# SET(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE STRING "Executable file format")
+# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....")
+#
+# # Mach-O files start with CAFEBABE or FEEDFACE, according to http://radio.weblogs.com/0100490/2003/01/28.html
+# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe")
+# SET(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format")
+# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe")
+# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface")
+# SET(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format")
+# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface")
+
+ ENDIF(NOT CMAKE_EXECUTABLE_FORMAT)
+ IF(NOT DEFINED CMAKE_EXECUTABLE_FORMAT)
+ SET(CMAKE_EXECUTABLE_FORMAT)
+ ENDIF()
+ # Return the information extracted.
+ 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}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
+ SET(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE)
+ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang)
+
+#-----------------------------------------------------------------------------
+# Function to query the compiler vendor.
+# This uses a table with entries of the form
+# list(APPEND CMAKE_${lang}_COMPILER_ID_VENDORS ${vendor})
+# set(CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor} -some-vendor-flag)
+# set(CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor} "Some Vendor Output")
+# We try running the compiler with the flag for each vendor and
+# matching its regular expression in the output.
+FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
+
+ IF(NOT CMAKE_${lang}_COMPILER_ID_DIR)
+ # We get here when this function is called not from within CMAKE_DETERMINE_COMPILER_ID()
+ # This is done e.g. for detecting the compiler ID for assemblers.
+ # Compute the directory in which to run the test and Create a clean working directory.
+ SET(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang})
+ FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
+ FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
+ ENDIF(NOT CMAKE_${lang}_COMPILER_ID_DIR)
+
+
+ FOREACH(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS})
+ SET(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}})
+ SET(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}})
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_${lang}_COMPILER}
+ ${CMAKE_${lang}_COMPILER_ID_ARG1}
+ ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
+ ${flags}
+ WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
+ OUTPUT_VARIABLE output ERROR_VARIABLE output
+ RESULT_VARIABLE result
+ TIMEOUT 10
+ )
+
+ IF("${output}" MATCHES "${regex}")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
+ "matched \"${regex}\":\n${output}")
+ SET(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE)
+ BREAK()
+ ELSE()
+ IF("${result}" MATCHES "timeout")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
+ "terminated after 10 s due to timeout.")
+ ELSE()
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
+ "did not match \"${regex}\":\n${output}")
+ ENDIF()
+ ENDIF()
+ ENDFOREACH()
+ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR)
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
new file mode 100644
index 000000000..ade6d586c
--- /dev/null
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -0,0 +1,228 @@
+
+#=============================================================================
+# 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.)
+
+# determine the compiler to use for Fortran programs
+# NOTE, a generator may set CMAKE_Fortran_COMPILER before
+# loading this file to force a compiler.
+# use environment variable FC first if defined by user, next use
+# the cmake variable CMAKE_GENERATOR_FC which can be defined by a generator
+# as a default compiler
+
+IF(NOT CMAKE_Fortran_COMPILER)
+ # prefer the environment variable CC
+ IF($ENV{FC} MATCHES ".+")
+ 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")
+ ENDIF(CMAKE_Fortran_FLAGS_ENV_INIT)
+ IF(EXISTS ${CMAKE_Fortran_COMPILER_INIT})
+ ELSE(EXISTS ${CMAKE_Fortran_COMPILER_INIT})
+ MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable FC:\n$ENV{FC}.")
+ ENDIF(EXISTS ${CMAKE_Fortran_COMPILER_INIT})
+ ENDIF($ENV{FC} MATCHES ".+")
+
+ # next try prefer the compiler specified by the generator
+ IF(CMAKE_GENERATOR_FC)
+ IF(NOT CMAKE_Fortran_COMPILER_INIT)
+ SET(CMAKE_Fortran_COMPILER_INIT ${CMAKE_GENERATOR_FC})
+ ENDIF(NOT CMAKE_Fortran_COMPILER_INIT)
+ ENDIF(CMAKE_GENERATOR_FC)
+
+ # finally list compilers to try
+ IF(CMAKE_Fortran_COMPILER_INIT)
+ SET(CMAKE_Fortran_COMPILER_LIST ${CMAKE_Fortran_COMPILER_INIT})
+ ELSE(CMAKE_Fortran_COMPILER_INIT)
+ # Known compilers:
+ # f77/f90/f95: generic compiler names
+ # g77: GNU Fortran 77 compiler
+ # gfortran: putative GNU Fortran 95+ compiler (in progress)
+ # fort77: native F77 compiler under HP-UX (and some older Crays)
+ # frt: Fujitsu F77 compiler
+ # pathf90/pathf95/pathf2003: PathScale Fortran compiler
+ # pgf77/pgf90/pgf95/pgfortran: Portland Group F77/F90/F95 compilers
+ # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers
+ # lf95: Lahey-Fujitsu F95 compiler
+ # fl32: Microsoft Fortran 77 "PowerStation" compiler
+ # af77: Apogee F77 compiler for Intergraph hardware running CLIX
+ # epcf90: "Edinburgh Portable Compiler" F90
+ # fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha
+ # ifc: Intel Fortran 95 compiler for Linux/x86
+ # efc: Intel Fortran 95 compiler for IA64
+ #
+ # The order is 95 or newer compilers first, then 90,
+ # 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
+ 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
+ )
+
+ # Vendor-specific compiler names.
+ SET(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77)
+ SET(_Fortran_COMPILER_NAMES_Intel ifort ifc efc)
+ SET(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77)
+ SET(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77)
+ SET(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90)
+ SET(_Fortran_COMPILER_NAMES_XL xlf)
+ SET(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf)
+
+ # Prefer vendors matching the C and C++ compilers.
+ SET(CMAKE_Fortran_COMPILER_LIST
+ ${_Fortran_COMPILER_NAMES_${CMAKE_C_COMPILER_ID}}
+ ${_Fortran_COMPILER_NAMES_${CMAKE_CXX_COMPILER_ID}}
+ ${CMAKE_Fortran_COMPILER_LIST})
+ LIST(REMOVE_DUPLICATES CMAKE_Fortran_COMPILER_LIST)
+ ENDIF(CMAKE_Fortran_COMPILER_INIT)
+
+ # Look for directories containing the C and C++ compilers.
+ SET(_Fortran_COMPILER_HINTS)
+ FOREACH(lang C CXX)
+ IF(CMAKE_${lang}_COMPILER AND IS_ABSOLUTE "${CMAKE_${lang}_COMPILER}")
+ GET_FILENAME_COMPONENT(_hint "${CMAKE_${lang}_COMPILER}" PATH)
+ IF(IS_DIRECTORY "${_hint}")
+ LIST(APPEND _Fortran_COMPILER_HINTS "${_hint}")
+ ENDIF()
+ SET(_hint)
+ ENDIF()
+ ENDFOREACH()
+
+ # Find the compiler.
+ IF(_Fortran_COMPILER_HINTS)
+ # Prefer directories containing C and C++ compilers.
+ LIST(REMOVE_DUPLICATES _Fortran_COMPILER_HINTS)
+ FIND_PROGRAM(CMAKE_Fortran_COMPILER
+ NAMES ${CMAKE_Fortran_COMPILER_LIST}
+ PATHS ${_Fortran_COMPILER_HINTS}
+ NO_DEFAULT_PATH
+ DOC "Fortran compiler")
+ ENDIF()
+ FIND_PROGRAM(CMAKE_Fortran_COMPILER NAMES ${CMAKE_Fortran_COMPILER_LIST} DOC "Fortran compiler")
+ IF(CMAKE_Fortran_COMPILER_INIT AND NOT CMAKE_Fortran_COMPILER)
+ SET(CMAKE_Fortran_COMPILER "${CMAKE_Fortran_COMPILER_INIT}" CACHE FILEPATH "Fortran compiler" FORCE)
+ ENDIF(CMAKE_Fortran_COMPILER_INIT AND NOT CMAKE_Fortran_COMPILER)
+ELSE(NOT CMAKE_Fortran_COMPILER)
+ # 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("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2)
+
+ # 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(CMAKE_Fortran_COMPILER_WITH_PATH)
+ ENDIF(NOT _CMAKE_USER_Fortran_COMPILER_PATH)
+ENDIF(NOT CMAKE_Fortran_COMPILER)
+
+MARK_AS_ADVANCED(CMAKE_Fortran_COMPILER)
+
+# Build a small source file to identify the compiler.
+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")
+ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+
+IF(NOT CMAKE_Fortran_COMPILER_ID_RUN)
+ SET(CMAKE_Fortran_COMPILER_ID_RUN 1)
+
+ # 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
+ # Try compiling to an object file only.
+ "-c"
+
+ # Intel on windows does not preprocess by default.
+ "-fpp"
+ )
+
+ # 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")
+ SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_Compaq "Compaq Visual Fortran")
+ LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS NAG) # Numerical Algorithms Group
+ SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V")
+ SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler")
+
+ # Try to identify the compiler.
+ SET(CMAKE_Fortran_COMPILER_ID)
+ INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
+ CMAKE_DETERMINE_COMPILER_ID(Fortran FFLAGS CMakeFortranCompilerId.F)
+
+ # Fall back to old is-GNU test.
+ IF(NOT CMAKE_Fortran_COMPILER_ID)
+ EXEC_PROGRAM(${CMAKE_Fortran_COMPILER}
+ 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.*" )
+ 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 "
+ "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
+ ELSE("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the Fortran compiler is GNU failed with "
+ "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
+ ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
+ IF(NOT CMAKE_Fortran_PLATFORM_ID)
+ IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" )
+ SET(CMAKE_Fortran_PLATFORM_ID "MinGW")
+ ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" )
+ IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
+ SET(CMAKE_Fortran_PLATFORM_ID "Cygwin")
+ ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
+ ENDIF(NOT CMAKE_Fortran_PLATFORM_ID)
+ ENDIF(NOT CMAKE_COMPILER_RETURN)
+ ENDIF(NOT CMAKE_Fortran_COMPILER_ID)
+
+ # Set old compiler and platform id variables.
+ IF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+ SET(CMAKE_COMPILER_IS_GNUG77 1)
+ ENDIF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+ IF("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "MinGW")
+ SET(CMAKE_COMPILER_IS_MINGW 1)
+ ELSEIF("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "Cygwin")
+ SET(CMAKE_COMPILER_IS_CYGWIN 1)
+ ENDIF("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "MinGW")
+ENDIF(NOT CMAKE_Fortran_COMPILER_ID_RUN)
+
+INCLUDE(CMakeFindBinUtils)
+
+IF(MSVC_Fortran_ARCHITECTURE_ID)
+ SET(SET_MSVC_Fortran_ARCHITECTURE_ID
+ "SET(MSVC_Fortran_ARCHITECTURE_ID ${MSVC_Fortran_ARCHITECTURE_ID})")
+ENDIF()
+# configure variables set in this file for fast reload later on
+CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake
+ @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ )
+SET(CMAKE_Fortran_COMPILER_ENV_VAR "FC")
diff --git a/Modules/CMakeDetermineJavaCompiler.cmake b/Modules/CMakeDetermineJavaCompiler.cmake
new file mode 100644
index 000000000..aefcaba36
--- /dev/null
+++ b/Modules/CMakeDetermineJavaCompiler.cmake
@@ -0,0 +1,102 @@
+
+#=============================================================================
+# 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.)
+
+# determine the compiler to use for Java programs
+# NOTE, a generator may set CMAKE_Java_COMPILER before
+# loading this file to force a compiler.
+
+IF(NOT CMAKE_Java_COMPILER)
+ # prefer the environment variable CC
+ IF($ENV{JAVA_COMPILER} MATCHES ".+")
+ 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")
+ ENDIF(CMAKE_Java_FLAGS_ENV_INIT)
+ IF(NOT EXISTS ${CMAKE_Java_COMPILER_INIT})
+ MESSAGE(SEND_ERROR "Could not find compiler set in environment variable JAVA_COMPILER:\n$ENV{JAVA_COMPILER}.")
+ ENDIF(NOT EXISTS ${CMAKE_Java_COMPILER_INIT})
+ ENDIF($ENV{JAVA_COMPILER} MATCHES ".+")
+
+ IF($ENV{JAVA_RUNTIME} MATCHES ".+")
+ 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(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT})
+ ENDIF($ENV{JAVA_RUNTIME} MATCHES ".+")
+
+ IF($ENV{JAVA_ARCHIVE} MATCHES ".+")
+ 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}.")
+ ENDIF(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT})
+ ENDIF($ENV{JAVA_ARCHIVE} MATCHES ".+")
+
+ SET(Java_BIN_PATH
+ "[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"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/bin"
+ "[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
+ /usr/bin
+ /usr/lib/java/bin
+ /usr/share/java/bin
+ /usr/local/bin
+ /usr/local/java/bin
+ /usr/local/java/share/bin
+ /usr/java/j2sdk1.4.2_04
+ /usr/lib/j2sdk1.4-sun/bin
+ /usr/java/j2sdk1.4.2_09/bin
+ /usr/lib/j2sdk1.5-sun/bin
+ /opt/sun-jdk-1.5.0.04/bin
+ )
+ # if no compiler has been specified yet, then look for one
+ IF(CMAKE_Java_COMPILER_INIT)
+ SET(CMAKE_Java_COMPILER ${CMAKE_Java_COMPILER_INIT} CACHE PATH "Java Compiler")
+ ELSE(CMAKE_Java_COMPILER_INIT)
+ FIND_PROGRAM(CMAKE_Java_COMPILER
+ NAMES javac
+ PATHS ${Java_BIN_PATH}
+ )
+ ENDIF(CMAKE_Java_COMPILER_INIT)
+
+ # if no runtime has been specified yet, then look for one
+ IF(CMAKE_Java_RUNTIME_INIT)
+ SET(CMAKE_Java_RUNTIME ${CMAKE_Java_RUNTIME_INIT} CACHE PATH "Java Compiler")
+ ELSE(CMAKE_Java_RUNTIME_INIT)
+ FIND_PROGRAM(CMAKE_Java_RUNTIME
+ NAMES java
+ PATHS ${Java_BIN_PATH}
+ )
+ ENDIF(CMAKE_Java_RUNTIME_INIT)
+
+ # if no archive has been specified yet, then look for one
+ IF(CMAKE_Java_ARCHIVE_INIT)
+ SET(CMAKE_Java_ARCHIVE ${CMAKE_Java_ARCHIVE_INIT} CACHE PATH "Java Compiler")
+ ELSE(CMAKE_Java_ARCHIVE_INIT)
+ FIND_PROGRAM(CMAKE_Java_ARCHIVE
+ NAMES jar
+ PATHS ${Java_BIN_PATH}
+ )
+ ENDIF(CMAKE_Java_ARCHIVE_INIT)
+ENDIF(NOT CMAKE_Java_COMPILER)
+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_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeJavaCompiler.cmake IMMEDIATE @ONLY)
+SET(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER")
diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake
new file mode 100644
index 000000000..8e085af7a
--- /dev/null
+++ b/Modules/CMakeDetermineRCCompiler.cmake
@@ -0,0 +1,67 @@
+
+#=============================================================================
+# 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.)
+
+# determine the compiler to use for C programs
+# NOTE, a generator may set CMAKE_C_COMPILER before
+# loading this file to force a compiler.
+# use environment variable CCC first if defined by user, next use
+# the cmake variable CMAKE_GENERATOR_CC which can be defined by a generator
+# as a default compiler
+IF(NOT CMAKE_RC_COMPILER)
+ # prefer the environment variable CC
+ IF($ENV{RC} MATCHES ".+")
+ 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")
+ ENDIF(CMAKE_RC_FLAGS_ENV_INIT)
+ IF(EXISTS ${CMAKE_RC_COMPILER_INIT})
+ ELSE(EXISTS ${CMAKE_RC_COMPILER_INIT})
+ MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable RC:\n$ENV{RC}.")
+ ENDIF(EXISTS ${CMAKE_RC_COMPILER_INIT})
+ ENDIF($ENV{RC} MATCHES ".+")
+
+ # next try prefer the compiler specified by the generator
+ IF(CMAKE_GENERATOR_RC)
+ IF(NOT CMAKE_RC_COMPILER_INIT)
+ SET(CMAKE_RC_COMPILER_INIT ${CMAKE_GENERATOR_RC})
+ ENDIF(NOT CMAKE_RC_COMPILER_INIT)
+ ENDIF(CMAKE_GENERATOR_RC)
+
+ # finally list compilers to try
+ IF(CMAKE_RC_COMPILER_INIT)
+ SET(CMAKE_RC_COMPILER_LIST ${CMAKE_RC_COMPILER_INIT})
+ ELSE(CMAKE_RC_COMPILER_INIT)
+ SET(CMAKE_RC_COMPILER_LIST rc)
+ ENDIF(CMAKE_RC_COMPILER_INIT)
+
+ # Find the compiler.
+ FIND_PROGRAM(CMAKE_RC_COMPILER NAMES ${CMAKE_RC_COMPILER_LIST} DOC "RC compiler")
+ IF(CMAKE_RC_COMPILER_INIT AND NOT CMAKE_RC_COMPILER)
+ SET(CMAKE_RC_COMPILER "${CMAKE_RC_COMPILER_INIT}" CACHE FILEPATH "RC compiler" FORCE)
+ ENDIF(CMAKE_RC_COMPILER_INIT AND NOT CMAKE_RC_COMPILER)
+ENDIF(NOT CMAKE_RC_COMPILER)
+
+MARK_AS_ADVANCED(CMAKE_RC_COMPILER)
+
+GET_FILENAME_COMPONENT(_CMAKE_RC_COMPILER_NAME_WE ${CMAKE_RC_COMPILER} NAME_WE)
+IF(_CMAKE_RC_COMPILER_NAME_WE STREQUAL "windres")
+ SET(CMAKE_RC_OUTPUT_EXTENSION .obj)
+ELSE()
+ SET(CMAKE_RC_OUTPUT_EXTENSION .res)
+ENDIF()
+
+# configure variables set in this file for fast reload later on
+CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeRCCompiler.cmake.in
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeRCCompiler.cmake IMMEDIATE)
+SET(CMAKE_RC_COMPILER_ENV_VAR "RC")
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
new file mode 100644
index 000000000..7ae377517
--- /dev/null
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -0,0 +1,176 @@
+
+#=============================================================================
+# 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 module is used by the Makefile generator to determin the following variables:
+# CMAKE_SYSTEM_NAME - on unix this is uname -s, for windows it is Windows
+# CMAKE_SYSTEM_VERSION - on unix this is uname -r, for windows it is empty
+# CMAKE_SYSTEM - ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_VERSION}, for windows: ${CMAKE_SYSTEM}
+#
+# Expected uname -s output:
+#
+# AIX AIX
+# BSD/OS BSD/OS
+# FreeBSD FreeBSD
+# HP-UX HP-UX
+# IRIX IRIX
+# Linux Linux
+# GNU/kFreeBSD GNU/kFreeBSD
+# NetBSD NetBSD
+# OpenBSD OpenBSD
+# OFS/1 (Digital Unix) OSF1
+# SCO OpenServer 5 SCO_SV
+# SCO UnixWare 7 UnixWare
+# SCO UnixWare (pre release 7) UNIX_SV
+# SCO XENIX Xenix
+# Solaris SunOS
+# SunOS SunOS
+# Tru64 Tru64
+# Ultrix ULTRIX
+# cygwin CYGWIN_NT-5.1
+# MacOSX Darwin
+
+
+# find out on which system cmake runs
+IF(CMAKE_HOST_UNIX)
+ FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
+ 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.*")
+ EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
+ RETURN_VALUE val)
+ ELSEIF(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD")
+ EXEC_PROGRAM(arch ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
+ RETURN_VALUE val)
+ ELSE()
+ EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
+ RETURN_VALUE val)
+ IF("${val}" GREATER 0)
+ EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
+ RETURN_VALUE val)
+ ENDIF("${val}" GREATER 0)
+ ENDIF()
+ # check the return of the last uname -m or -p
+ IF("${val}" GREATER 0)
+ SET(CMAKE_HOST_SYSTEM_PROCESSOR "unknown")
+ ENDIF("${val}" GREATER 0)
+ 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}")
+ ENDIF(CMAKE_UNAME)
+ELSE(CMAKE_HOST_UNIX)
+ IF(CMAKE_HOST_WIN32)
+ SET (CMAKE_HOST_SYSTEM_NAME "Windows")
+ SET (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}")
+ ENDIF(CMAKE_HOST_WIN32)
+ENDIF(CMAKE_HOST_UNIX)
+
+# if a toolchain file is used, the user wants to cross compile.
+# in this case read the toolchain file and keep the CMAKE_HOST_SYSTEM_*
+# variables around so they can be used in CMakeLists.txt.
+# In all other cases, the host and target platform are the same.
+IF(CMAKE_TOOLCHAIN_FILE)
+ # at first try to load it as path relative to the directory from which cmake has been run
+ INCLUDE("${CMAKE_BINARY_DIR}/${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE)
+ IF(NOT _INCLUDED_TOOLCHAIN_FILE)
+ # if the file isn't found there, check the default locations
+ INCLUDE("${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE)
+ ENDIF(NOT _INCLUDED_TOOLCHAIN_FILE)
+
+ IF(_INCLUDED_TOOLCHAIN_FILE)
+ SET(CMAKE_TOOLCHAIN_FILE "${_INCLUDED_TOOLCHAIN_FILE}" CACHE FILEPATH "The CMake toolchain file" FORCE)
+ ELSE(_INCLUDED_TOOLCHAIN_FILE)
+ MESSAGE(FATAL_ERROR "Could not find toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
+ SET(CMAKE_TOOLCHAIN_FILE "NOTFOUND" CACHE FILEPATH "The CMake toolchain file" FORCE)
+ ENDIF(_INCLUDED_TOOLCHAIN_FILE)
+ENDIF(CMAKE_TOOLCHAIN_FILE)
+
+
+# if CMAKE_SYSTEM_NAME is here already set, either it comes from a toolchain file
+# or it was set via -DCMAKE_SYSTEM_NAME=...
+# if that's the case, assume we are crosscompiling
+IF(CMAKE_SYSTEM_NAME)
+ IF(NOT DEFINED CMAKE_CROSSCOMPILING)
+ SET(CMAKE_CROSSCOMPILING TRUE)
+ ENDIF(NOT DEFINED CMAKE_CROSSCOMPILING)
+ SET(PRESET_CMAKE_SYSTEM_NAME TRUE)
+ELSE(CMAKE_SYSTEM_NAME)
+ SET(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
+ SET(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
+ SET(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
+ SET(CMAKE_CROSSCOMPILING FALSE)
+ SET(PRESET_CMAKE_SYSTEM_NAME FALSE)
+ENDIF(CMAKE_SYSTEM_NAME)
+
+
+MACRO(ADJUST_CMAKE_SYSTEM_VARIABLES _PREFIX)
+ IF(NOT ${_PREFIX}_NAME)
+ SET(${_PREFIX}_NAME "UnknownOS")
+ ENDIF(NOT ${_PREFIX}_NAME)
+
+ # fix for BSD/OS , remove the /
+ IF(${_PREFIX}_NAME MATCHES BSD.OS)
+ SET(${_PREFIX}_NAME BSDOS)
+ ENDIF(${_PREFIX}_NAME MATCHES BSD.OS)
+
+ # fix for GNU/kFreeBSD, remove the GNU/
+ IF(${_PREFIX}_NAME MATCHES kFreeBSD)
+ SET(${_PREFIX}_NAME kFreeBSD)
+ ENDIF(${_PREFIX}_NAME MATCHES kFreeBSD)
+
+ # fix for CYGWIN which has windows version in it
+ IF(${_PREFIX}_NAME MATCHES CYGWIN)
+ SET(${_PREFIX}_NAME CYGWIN)
+ ENDIF(${_PREFIX}_NAME MATCHES CYGWIN)
+
+ # set CMAKE_SYSTEM to the CMAKE_SYSTEM_NAME
+ SET(${_PREFIX} ${${_PREFIX}_NAME})
+ # if there is a CMAKE_SYSTEM_VERSION then add a -${CMAKE_SYSTEM_VERSION}
+ IF(${_PREFIX}_VERSION)
+ SET(${_PREFIX} ${${_PREFIX}}-${${_PREFIX}_VERSION})
+ ENDIF(${_PREFIX}_VERSION)
+
+ENDMACRO(ADJUST_CMAKE_SYSTEM_VARIABLES _PREFIX)
+
+ADJUST_CMAKE_SYSTEM_VARIABLES(CMAKE_SYSTEM)
+ADJUST_CMAKE_SYSTEM_VARIABLES(CMAKE_HOST_SYSTEM)
+
+# this file is also executed from cpack, then we don't need to generate these files
+# in this case there is no CMAKE_BINARY_DIR
+IF(CMAKE_BINARY_DIR)
+ # write entry to the log file
+ IF(PRESET_CMAKE_SYSTEM_NAME)
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "The target system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "The host system is: ${CMAKE_HOST_SYSTEM_NAME} - ${CMAKE_HOST_SYSTEM_VERSION} - ${CMAKE_HOST_SYSTEM_PROCESSOR}\n")
+ ELSE(PRESET_CMAKE_SYSTEM_NAME)
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "The system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n")
+ ENDIF(PRESET_CMAKE_SYSTEM_NAME)
+
+ # 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)
+ SET(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED "INCLUDE(\"${CMAKE_TOOLCHAIN_FILE}\")")
+ ENDIF(DEFINED CMAKE_TOOLCHAIN_FILE)
+
+ # 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_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake
+ IMMEDIATE @ONLY)
+
+ENDIF(CMAKE_BINARY_DIR)
diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake
new file mode 100644
index 000000000..33f01415e
--- /dev/null
+++ b/Modules/CMakeDetermineVSServicePack.cmake
@@ -0,0 +1,187 @@
+# - Includes a public function for assisting users in trying to determine the
+# Visual Studio service pack in use.
+#
+# Sets the passed in variable to one of the following values or an empty
+# string if unknown.
+# vc80
+# vc80sp1
+# vc90
+# vc90sp1
+# vc100
+# vc100sp1
+#
+# Usage:
+# ===========================
+#
+# if(MSVC)
+# include(CMakeDetermineVSServicePack)
+# DetermineVSServicePack( my_service_pack )
+#
+# if( my_service_pack )
+# message(STATUS "Detected: ${my_service_pack}")
+# endif()
+# endif()
+#
+# ===========================
+
+#=============================================================================
+# Copyright 2009-2011 Kitware, Inc.
+# Copyright 2009-2010 Philip Lowman <philip@yhbt.com>
+# Copyright 2010-2011 Aaron C. meadows <cmake@shadowguarddev.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.)
+
+# [INTERNAL]
+# Please do not call this function directly
+function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version)
+ if (${_cl_version} VERSION_EQUAL "14.00.50727.42")
+ set(_version "vc80")
+ elseif(${_cl_version} VERSION_EQUAL "14.00.50727.762")
+ set(_version "vc80sp1")
+ elseif(${_cl_version} VERSION_EQUAL "15.00.21022.08")
+ set(_version "vc90")
+ elseif(${_cl_version} VERSION_EQUAL "15.00.30729.01")
+ set(_version "vc90sp1")
+ elseif(${_cl_version} VERSION_EQUAL "16.00.30319.01")
+ set(_version "vc100")
+ elseif(${_cl_version} VERSION_EQUAL "16.00.40219.01")
+ set(_version "vc100sp1")
+ else()
+ set(_version "")
+ endif()
+ set(${_OUT_VAR} ${_version} PARENT_SCOPE)
+endfunction()
+
+
+############################################################
+# [INTERNAL]
+# Please do not call this function directly
+function(_DetermineVSServicePack_FastCheckVersionWithCompiler _SUCCESS_VAR _VERSION_VAR)
+ if(EXISTS ${CMAKE_CXX_COMPILER})
+ execute_process(
+ COMMAND ${CMAKE_CXX_COMPILER} /?
+ ERROR_VARIABLE _output
+ 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("${_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()
+endfunction()
+
+############################################################
+# [INTERNAL]
+# Please do not call this function directly
+function(_DetermineVSServicePack_CheckVersionWithTryCompile _SUCCESS_VAR _VERSION_VAR)
+ file(WRITE "${CMAKE_BINARY_DIR}/return0.cc"
+ "int main() { return 0; }\n")
+
+ try_compile(
+ _CompileResult
+ "${CMAKE_BINARY_DIR}"
+ "${CMAKE_BINARY_DIR}/return0.cc"
+ OUTPUT_VARIABLE _output
+ COPY_FILE "${CMAKE_BINARY_DIR}/return0.cc")
+
+ 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)
+
+ set(${_SUCCESS_VAR} true PARENT_SCOPE)
+ set(${_VERSION_VAR} ${_major}.${_minor}.${_patch}.${_tweak} PARENT_SCOPE)
+ endif()
+endfunction()
+
+############################################################
+# [INTERNAL]
+# Please do not call this function directly
+function(_DetermineVSServicePack_CheckVersionWithTryRun _SUCCESS_VAR _VERSION_VAR)
+ file(WRITE "${CMAKE_BINARY_DIR}/return0.cc"
+ "#include <stdio.h>\n\nconst unsigned int CompilerVersion=_MSC_FULL_VER;\n\nint main(int argc, char* argv[])\n{\n int M( CompilerVersion/10000000);\n int m((CompilerVersion%10000000)/100000);\n int b(CompilerVersion%100000);\n\n printf(\"%d.%02d.%05d.01\",M,m,b);\n return 0;\n}\n")
+
+ try_run(
+ _RunResult
+ _CompileResult
+ "${CMAKE_BINARY_DIR}"
+ "${CMAKE_BINARY_DIR}/return0.cc"
+ RUN_OUTPUT_VARIABLE _runoutput
+ )
+
+ file(REMOVE "${CMAKE_BINARY_DIR}/return0.cc")
+
+ string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+.[0-9]+"
+ _cl_version "${_runoutput}")
+
+ if(_cl_version)
+ set(${_SUCCESS_VAR} true PARENT_SCOPE)
+ set(${_VERSION_VAR} ${_cl_version} PARENT_SCOPE)
+ endif()
+endfunction()
+
+
+#
+# A function to call to determine the Visual Studio service pack
+# in use. See documentation above.
+function(DetermineVSServicePack _pack)
+ if(NOT DETERMINED_VS_SERVICE_PACK OR NOT ${_pack})
+
+ _DetermineVSServicePack_FastCheckVersionWithCompiler(DETERMINED_VS_SERVICE_PACK _cl_version)
+ if(NOT DETERMINED_VS_SERVICE_PACK)
+ _DetermineVSServicePack_CheckVersionWithTryCompile(DETERMINED_VS_SERVICE_PACK _cl_version)
+ if(NOT DETERMINED_VS_SERVICE_PACK)
+ _DetermineVSServicePack_CheckVersionWithTryRun(DETERMINED_VS_SERVICE_PACK _cl_version)
+ endif()
+ endif()
+
+ if(DETERMINED_VS_SERVICE_PACK)
+
+ if(_cl_version)
+ # Call helper function to determine VS version
+ _DetermineVSServicePackFromCompiler(_sp "${_cl_version}")
+ if(_sp)
+ set(${_pack} ${_sp} CACHE INTERNAL
+ "The Visual Studio Release with Service Pack")
+ endif()
+ endif()
+ endif()
+ endif()
+endfunction()
+
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
new file mode 100644
index 000000000..fba071a06
--- /dev/null
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -0,0 +1,129 @@
+# 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}" )
+
+
+#=============================================================================
+# Copyright 2012 Kitware, Inc.
+# Copyright 2009-2012 Alexander Neundorf <neundorf@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(CMakeParseArguments)
+
+function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
+
+ set(options )
+ set(oneValueArgs CONFIGURATION )
+ set(multiValueArgs LIBRARIES )
+
+ cmake_parse_arguments(CEIT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if(CEIT_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown keywords given to CMAKE_EXPAND_IMPORTED_TARGETS(): \"${CEIT_UNPARSED_ARGUMENTS}\"")
+ endif()
+
+ if(NOT CEIT_CONFIGURATION)
+ if(CMAKE_CONFIGURATION_TYPES)
+ list(GET CMAKE_CONFIGURATION_TYPES 0 CEIT_CONFIGURATION)
+ else()
+ set(CEIT_CONFIGURATION ${CMAKE_BUILD_TYPE})
+ endif()
+ endif()
+
+ # handle imported library targets
+
+ set(_CCSR_REQ_LIBS ${CEIT_LIBRARIES})
+
+ set(_CHECK_FOR_IMPORTED_TARGETS TRUE)
+ set(_CCSR_LOOP_COUNTER 0)
+ while(_CHECK_FOR_IMPORTED_TARGETS)
+ math(EXPR _CCSR_LOOP_COUNTER "${_CCSR_LOOP_COUNTER} + 1 ")
+ 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 (_importedConfigs)
+# message(STATUS "Detected imported target ${_CURRENT_LIB}")
+ # Ok, so this is an imported target.
+ # First we get the imported configurations.
+ # Then we get the location of the actual library on disk of the first configuration.
+ # then we'll get its link interface libraries property,
+ # iterate through it and replace all imported targets we find there
+ # with there actual location.
+
+ # guard against infinite loop: abort after 100 iterations ( 100 is arbitrary chosen)
+ if ("${_CCSR_LOOP_COUNTER}" LESS 100)
+ set(_CHECK_FOR_IMPORTED_TARGETS TRUE)
+# else ("${_CCSR_LOOP_COUNTER}" LESS 1)
+# message(STATUS "********* aborting loop, counter : ${_CCSR_LOOP_COUNTER}")
+ endif ("${_CCSR_LOOP_COUNTER}" LESS 100)
+
+ # if one of the imported configurations equals ${CMAKE_TRY_COMPILE_CONFIGURATION},
+ # use it, otherwise simply use the first one:
+ list(FIND _importedConfigs "${CEIT_CONFIGURATION}" _configIndexToUse)
+ if("${_configIndexToUse}" EQUAL -1)
+ set(_configIndexToUse 0)
+ endif("${_configIndexToUse}" EQUAL -1)
+ list(GET _importedConfigs ${_configIndexToUse} _importedConfigToUse)
+
+ get_target_property(_importedLocation "${_CURRENT_LIB}" IMPORTED_LOCATION_${_importedConfigToUse})
+ get_target_property(_linkInterfaceLibs "${_CURRENT_LIB}" IMPORTED_LINK_INTERFACE_LIBRARIES_${_importedConfigToUse} )
+
+ list(APPEND _CCSR_NEW_REQ_LIBS "${_importedLocation}")
+# message(STATUS "Appending lib ${_CURRENT_LIB} as ${_importedLocation}")
+ if(_linkInterfaceLibs)
+ foreach(_currentLinkInterfaceLib ${_linkInterfaceLibs})
+# message(STATUS "Appending link interface lib ${_currentLinkInterfaceLib}")
+ if(_currentLinkInterfaceLib)
+ list(APPEND _CCSR_NEW_REQ_LIBS "${_currentLinkInterfaceLib}" )
+ endif(_currentLinkInterfaceLib)
+ endforeach(_currentLinkInterfaceLib "${_linkInterfaceLibs}")
+ endif(_linkInterfaceLibs)
+ else(_importedConfigs)
+ # "Normal" libraries are just used as they are.
+ list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" )
+# message(STATUS "Appending lib directly: ${_CURRENT_LIB}")
+ endif(_importedConfigs)
+ endforeach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
+
+ set(_CCSR_REQ_LIBS ${_CCSR_NEW_REQ_LIBS} )
+ endwhile(_CHECK_FOR_IMPORTED_TARGETS)
+
+ # Finally we iterate once more over all libraries. This loop only removes
+ # 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 (NOT _importedConfigs)
+ list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" )
+# message(STATUS "final: appending ${_CURRENT_LIB}")
+ else (NOT _importedConfigs)
+# message(STATUS "final: skipping ${_CURRENT_LIB}")
+ endif (NOT _importedConfigs)
+ endforeach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
+# message(STATUS "setting -${_RESULT}- to -${_CCSR_NEW_REQ_LIBS}-")
+ set(${_RESULT} "${_CCSR_NEW_REQ_LIBS}" PARENT_SCOPE)
+
+endfunction()
diff --git a/Modules/CMakeExportBuildSettings.cmake b/Modules/CMakeExportBuildSettings.cmake
new file mode 100644
index 000000000..8d316b941
--- /dev/null
+++ b/Modules/CMakeExportBuildSettings.cmake
@@ -0,0 +1,36 @@
+
+#=============================================================================
+# 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 module is purposely no longer documented. It does nothing useful.
+IF(NOT "${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS 2.7)
+ MESSAGE(FATAL_ERROR
+ "The functionality of this module has been dropped as of CMake 2.8. "
+ "It was deemed harmful (confusing users by changing their compiler). "
+ "Please remove calls to the CMAKE_EXPORT_BUILD_SETTINGS macro and "
+ "stop including this module. "
+ "If this project generates any files for use by external projects, "
+ "remove any use of the CMakeImportBuildSettings module from them.")
+ENDIF()
+
+# This macro used to store build settings of a project in a file to be
+# 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 ".+")
+ CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeBuildSettings.cmake.in
+ ${SETTINGS_FILE} @ONLY IMMEDIATE)
+ ELSE(${SETTINGS_FILE} MATCHES ".+")
+ MESSAGE(SEND_ERROR "CMAKE_EXPORT_BUILD_SETTINGS called with no argument.")
+ ENDIF(${SETTINGS_FILE} MATCHES ".+")
+ENDMACRO(CMAKE_EXPORT_BUILD_SETTINGS)
diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
new file mode 100644
index 000000000..455f95fe3
--- /dev/null
+++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
@@ -0,0 +1,109 @@
+
+#=============================================================================
+# 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 by CMakeFindEclipseCDT4.cmake and CMakeFindCodeBlocks.cmake
+
+# The Eclipse and the CodeBlocks generators need to know the standard include path
+# so that they can find the headers at runtime and parsing etc. works better
+# This is done here by actually running gcc with the options so it prints its
+# system include directories, which are parsed then and stored in the cache.
+MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines)
+ SET(${_resultIncludeDirs})
+ SET(_gccOutput)
+ FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n" )
+
+ IF (${_lang} STREQUAL "c++")
+ SET(_compilerExecutable "${CMAKE_CXX_COMPILER}")
+ SET(_arg1 "${CMAKE_CXX_COMPILER_ARG1}")
+ ELSE ()
+ SET(_compilerExecutable "${CMAKE_C_COMPILER}")
+ SET(_arg1 "${CMAKE_C_COMPILER_ARG1}")
+ ENDIF ()
+ EXECUTE_PROCESS(COMMAND ${_compilerExecutable} ${_arg1} -v -E -x ${_lang} -dD dummy
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles
+ ERROR_VARIABLE _gccOutput
+ OUTPUT_VARIABLE _gccStdout )
+ FILE(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy")
+
+ # First find the system include dirs:
+ IF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+ *\n) *End of (search) list" )
+
+ # split the output into lines and then remove leading and trailing spaces from each of them:
+ STRING(REGEX MATCHALL "[^\n]+\n" _includeLines "${CMAKE_MATCH_1}")
+ FOREACH(nextLine ${_includeLines})
+ STRING(STRIP "${nextLine}" _includePath)
+ LIST(APPEND ${_resultIncludeDirs} "${_includePath}")
+ ENDFOREACH(nextLine)
+
+ ENDIF()
+
+
+ # now find the builtin macros:
+ STRING(REGEX MATCHALL "#define[^\n]+\n" _defineLines "${_gccStdout}")
+# A few example lines which the regexp below has to match properly:
+# #define MAX(a,b) ((a) > (b) ? (a) : (b))
+# #define __fastcall __attribute__((__fastcall__))
+# #define FOO (23)
+# #define __UINTMAX_TYPE__ long long unsigned int
+# #define __UINTMAX_TYPE__ long long unsigned int
+# #define __i386__ 1
+
+ FOREACH(nextLine ${_defineLines})
+ STRING(REGEX MATCH "^#define +([A-Za-z_][A-Za-z0-9_]*)(\\([^\\)]+\\))? +(.+) *$" _dummy "${nextLine}")
+ SET(_name "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
+ STRING(STRIP "${CMAKE_MATCH_3}" _value)
+ #MESSAGE(STATUS "m1: -${CMAKE_MATCH_1}- m2: -${CMAKE_MATCH_2}- m3: -${CMAKE_MATCH_3}-")
+
+ LIST(APPEND ${_resultDefines} "${_name}")
+ IF(_value)
+ LIST(APPEND ${_resultDefines} "${_value}")
+ ELSE()
+ LIST(APPEND ${_resultDefines} " ")
+ ENDIF()
+ ENDFOREACH(nextLine)
+
+ENDMACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang)
+
+# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables and set them
+# to "C" that way GCC's "search starts here" text is in English and we can grok it.
+SET(_orig_lc_all $ENV{LC_ALL})
+SET(_orig_lc_messages $ENV{LC_MESSAGES})
+SET(_orig_lang $ENV{LANG})
+
+SET(ENV{LC_ALL} C)
+SET(ENV{LC_MESSAGES} C)
+SET(ENV{LANG} C)
+
+# 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)
+ _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")
+ ENDIF ()
+ENDIF ()
+
+# And now the same for C++
+IF (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS)
+ IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Intel)
+ _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")
+ ENDIF ()
+ENDIF ()
+
+# Restore original LC_ALL, LC_MESSAGES, and LANG
+SET(ENV{LC_ALL} ${_orig_lc_all})
+SET(ENV{LC_MESSAGES} ${_orig_lc_messages})
+SET(ENV{LANG} ${_orig_lang})
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
new file mode 100644
index 000000000..64ec403ad
--- /dev/null
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -0,0 +1,75 @@
+
+# search for additional tools required for C/C++ (and other languages ?)
+#
+# If the internal cmake variable _CMAKE_TOOLCHAIN_PREFIX is set, this is used
+# as prefix for the tools (e.g. arm-elf-gcc etc.)
+# If the cmake variable _CMAKE_TOOLCHAIN_LOCATION is set, the compiler is
+# searched only there. The other tools are at first searched there, then
+# also in the default locations.
+#
+# Sets the following variables:
+# CMAKE_AR
+# CMAKE_RANLIB
+# CMAKE_LINKER
+# CMAKE_STRIP
+# CMAKE_INSTALL_NAME_TOOL
+
+# on UNIX, cygwin and mingw
+
+#=============================================================================
+# 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.)
+
+# 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")
+
+ FIND_PROGRAM(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+
+ MARK_AS_ADVANCED(CMAKE_LINKER)
+
+# in all other cases search for ar, ranlib, etc.
+ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
+ OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
+ OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
+
+ FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+
+ FIND_PROGRAM(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+ IF(NOT CMAKE_RANLIB)
+ SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
+ ENDIF(NOT CMAKE_RANLIB)
+
+ FIND_PROGRAM(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+ FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+ FIND_PROGRAM(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+ FIND_PROGRAM(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+ FIND_PROGRAM(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+
+ MARK_AS_ADVANCED(CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER CMAKE_NM CMAKE_OBJDUMP CMAKE_OBJCOPY)
+
+ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
+ OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
+ OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
+
+
+# on Apple there really should be install_name_tool
+IF(APPLE)
+ FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+
+ IF(NOT CMAKE_INSTALL_NAME_TOOL)
+ MESSAGE(FATAL_ERROR "Could not find install_name_tool, please check your installation.")
+ ENDIF(NOT CMAKE_INSTALL_NAME_TOOL)
+
+ MARK_AS_ADVANCED(CMAKE_INSTALL_NAME_TOOL)
+ENDIF(APPLE)
diff --git a/Modules/CMakeFindCodeBlocks.cmake b/Modules/CMakeFindCodeBlocks.cmake
new file mode 100644
index 000000000..23f2c821d
--- /dev/null
+++ b/Modules/CMakeFindCodeBlocks.cmake
@@ -0,0 +1,25 @@
+
+#=============================================================================
+# 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 CodeBlocks extra generator has been selected.
+
+FIND_PROGRAM(CMAKE_CODEBLOCKS_EXECUTABLE NAMES codeblocks DOC "The CodeBlocks executable")
+
+IF(CMAKE_CODEBLOCKS_EXECUTABLE)
+ SET(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_CODEBLOCKS_EXECUTABLE} <PROJECT_FILE>" )
+ENDIF(CMAKE_CODEBLOCKS_EXECUTABLE)
+
+# Determine builtin macros and include dirs:
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake)
diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake
new file mode 100644
index 000000000..a4264e78e
--- /dev/null
+++ b/Modules/CMakeFindEclipseCDT4.cmake
@@ -0,0 +1,79 @@
+
+#=============================================================================
+# 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.
+
+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("${_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" )
+ SET(_ECLIPSE_VERSION_NAME_3.2 "Callisto" )
+ SET(_ECLIPSE_VERSION_NAME_3.3 "Europa" )
+ SET(_ECLIPSE_VERSION_NAME_3.4 "Ganymede" )
+ SET(_ECLIPSE_VERSION_NAME_3.5 "Galileo" )
+ SET(_ECLIPSE_VERSION_NAME_3.6 "Helios" )
+ SET(_ECLIPSE_VERSION_NAME_3.7 "Indigo" )
+
+ 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()
+
+ 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})"
+ "3.5 (${_ECLIPSE_VERSION_NAME_3.5})"
+ "3.6 (${_ECLIPSE_VERSION_NAME_3.6})"
+ "3.7 (${_ECLIPSE_VERSION_NAME_3.7})")
+ENDFUNCTION()
+
+_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)
+
+# 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)
+ SET(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "-j${_CMAKE_ECLIPSE_PROCESSOR_COUNT}")
+ENDIF()
+
+# This variable is used by the Eclipse generator and appended to the make invocation commands.
+SET(CMAKE_ECLIPSE_MAKE_ARGUMENTS "${_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j<some_number> to get parallel builds")
+
+# This variable is used by the Eclipse generator in out-of-source builds only.
+SET(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR")
+MARK_AS_ADVANCED(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT)
+
+# Determine builtin macros and include dirs:
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake)
diff --git a/Modules/CMakeFindFrameworks.cmake b/Modules/CMakeFindFrameworks.cmake
new file mode 100644
index 000000000..001da20f3
--- /dev/null
+++ b/Modules/CMakeFindFrameworks.cmake
@@ -0,0 +1,32 @@
+# - helper module to find OSX frameworks
+
+#=============================================================================
+# Copyright 2003-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.)
+
+IF(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED)
+ SET(CMAKE_FIND_FRAMEWORKS_INCLUDED 1)
+ MACRO(CMAKE_FIND_FRAMEWORKS fwk)
+ SET(${fwk}_FRAMEWORKS)
+ IF(APPLE)
+ FOREACH(dir
+ ~/Library/Frameworks/${fwk}.framework
+ /Library/Frameworks/${fwk}.framework
+ /System/Library/Frameworks/${fwk}.framework
+ /Network/Library/Frameworks/${fwk}.framework)
+ IF(EXISTS ${dir})
+ SET(${fwk}_FRAMEWORKS ${${fwk}_FRAMEWORKS} ${dir})
+ ENDIF(EXISTS ${dir})
+ ENDFOREACH(dir)
+ ENDIF(APPLE)
+ ENDMACRO(CMAKE_FIND_FRAMEWORKS)
+ENDIF(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED)
diff --git a/Modules/CMakeFindKDevelop3.cmake b/Modules/CMakeFindKDevelop3.cmake
new file mode 100644
index 000000000..331dc6ef9
--- /dev/null
+++ b/Modules/CMakeFindKDevelop3.cmake
@@ -0,0 +1,23 @@
+
+#=============================================================================
+# 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 KDevelop3 extra generator has been selected.
+
+FIND_PROGRAM(CMAKE_KDEVELOP3_EXECUTABLE NAMES kdevelop DOC "The KDevelop3 executable")
+
+IF(CMAKE_KDEVELOP3_EXECUTABLE)
+ SET(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_KDEVELOP3_EXECUTABLE} <PROJECT_FILE>" )
+ENDIF(CMAKE_KDEVELOP3_EXECUTABLE)
+
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
new file mode 100644
index 000000000..59c7ba5ee
--- /dev/null
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -0,0 +1,188 @@
+# 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 existance 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>
+#
+# 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(NOT NAME)
+ message(FATAL_ERROR "Name of the package to be searched not specified. Set the CMake variable NAME, e.g. -DNAME=JPEG .")
+endif()
+
+if(NOT COMPILER_ID)
+ message(FATAL_ERROR "COMPILER_ID argument not specified. In doubt, use GNU.")
+endif()
+
+if(NOT LANGUAGE)
+ message(FATAL_ERROR "LANGUAGE argument not specified. Use C, CXX or Fortran.")
+endif()
+
+if(NOT MODE)
+ message(FATAL_ERROR "MODE argument not specified. Use either EXIST, COMPILE or LINK.")
+endif()
+
+# require the current version. If we don't do this, Platforms/CYGWIN.cmake complains because
+# it doesn't know whether it should set WIN32 or not:
+cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} )
+
+macro(ENABLE_LANGUAGE)
+ # disable the enable_language() command, otherwise --find-package breaks on Windows.
+ # On Windows, enable_language(RC) is called in the platform files unconditionally.
+ # But in --find-package mode, we don't want (and can't) enable any language.
+endmacro()
+
+include(CMakeDetermineSystem)
+
+# short-cut some tests on Darwin, see Darwin-GNU.cmake:
+if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin AND "${COMPILER_ID}" MATCHES GNU)
+ set(${CMAKE_${LANGUAGE}_HAS_ISYSROOT} 0 )
+ set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "")
+endif()
+
+# Also load the system specific file, which sets up e.g. the search paths.
+# This makes the FIND_XXX() calls work much better
+include(CMakeSystemSpecificInformation)
+
+if(UNIX)
+
+ # try to guess whether we have a 64bit system, if it has not been set
+ # from the outside
+ if(NOT CMAKE_SIZEOF_VOID_P)
+ set(CMAKE_SIZEOF_VOID_P 4)
+ if(EXISTS /usr/lib64)
+ set(CMAKE_SIZEOF_VOID_P 8)
+ else()
+ # use the file utility to check whether itself is 64 bit:
+ find_program(FILE_EXECUTABLE file)
+ if(FILE_EXECUTABLE)
+ get_filename_component(FILE_ABSPATH "${FILE_EXECUTABLE}" ABSOLUTE)
+ execute_process(COMMAND "${FILE_ABSPATH}" "${FILE_ABSPATH}" OUTPUT_VARIABLE fileOutput ERROR_QUIET)
+ if("${fileOutput}" MATCHES "64-bit")
+ set(CMAKE_SIZEOF_VOID_P 8)
+ endif()
+ endif()
+ endif()
+ endif()
+
+ # guess Debian multiarch if it has not been set:
+ if(EXISTS /etc/debian_version)
+ if(NOT CMAKE_${LANGUAGE}_LANGUAGE_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})
+ break()
+ endif()
+ endforeach()
+ endif()
+ endif()
+
+endif()
+
+set(CMAKE_${LANGUAGE}_COMPILER "dummy")
+set(CMAKE_${LANGUAGE}_COMPILER_ID "${COMPILER_ID}")
+include(CMake${LANGUAGE}Information)
+
+
+function(set_compile_flags_var _packageName)
+ string(TOUPPER "${_packageName}" PACKAGE_NAME)
+ # Check the following variables:
+ # FOO_INCLUDE_DIRS
+ # Foo_INCLUDE_DIRS
+ # FOO_INCLUDES
+ # Foo_INCLUDES
+ # FOO_INCLUDE_DIR
+ # Foo_INCLUDE_DIR
+ set(includes)
+ if(DEFINED ${_packageName}_INCLUDE_DIRS)
+ set(includes ${_packageName}_INCLUDE_DIRS)
+ elseif(DEFINED ${PACKAGE_NAME}_INCLUDE_DIRS)
+ set(includes ${PACKAGE_NAME}_INCLUDE_DIRS)
+ elseif(DEFINED ${_packageName}_INCLUDES)
+ set(includes ${_packageName}_INCLUDES)
+ elseif(DEFINED ${PACKAGE_NAME}_INCLUDES)
+ set(includes ${PACKAGE_NAME}_INCLUDES)
+ elseif(DEFINED ${_packageName}_INCLUDE_DIR)
+ set(includes ${_packageName}_INCLUDE_DIR)
+ elseif(DEFINED ${PACKAGE_NAME}_INCLUDE_DIR)
+ set(includes ${PACKAGE_NAME}_INCLUDE_DIR)
+ endif()
+
+ set(PACKAGE_INCLUDE_DIRS "${${includes}}" PARENT_SCOPE)
+
+ # Check the following variables:
+ # FOO_DEFINITIONS
+ # Foo_DEFINITIONS
+ set(definitions)
+ if(DEFINED ${_packageName}_DEFINITIONS)
+ set(definitions ${_packageName}_DEFINITIONS)
+ elseif(DEFINED ${PACKAGE_NAME}_DEFINITIONS)
+ set(definitions ${PACKAGE_NAME}_DEFINITIONS)
+ endif()
+
+ set(PACKAGE_DEFINITIONS "${${definitions}}" )
+
+endfunction()
+
+
+function(set_link_flags_var _packageName)
+ string(TOUPPER "${_packageName}" PACKAGE_NAME)
+ # Check the following variables:
+ # FOO_LIBRARIES
+ # Foo_LIBRARIES
+ # FOO_LIBS
+ # Foo_LIBS
+ set(libs)
+ if(DEFINED ${_packageName}_LIBRARIES)
+ set(libs ${_packageName}_LIBRARIES)
+ elseif(DEFINED ${PACKAGE_NAME}_LIBRARIES)
+ set(libs ${PACKAGE_NAME}_LIBRARIES)
+ elseif(DEFINED ${_packageName}_LIBS)
+ set(libs ${_packageName}_LIBS)
+ elseif(DEFINED ${PACKAGE_NAME}_LIBS)
+ set(libs ${PACKAGE_NAME}_LIBS)
+ endif()
+
+ set(PACKAGE_LIBRARIES "${${libs}}" PARENT_SCOPE )
+
+endfunction()
+
+
+find_package("${NAME}" QUIET)
+
+set(PACKAGE_FOUND FALSE)
+
+string(TOUPPER "${NAME}" UPPERCASE_NAME)
+
+if(${NAME}_FOUND OR ${UPPERCASE_NAME}_FOUND)
+ set(PACKAGE_FOUND TRUE)
+
+ if("${MODE}" STREQUAL "EXIST")
+ # do nothing
+ elseif("${MODE}" STREQUAL "COMPILE")
+ set_compile_flags_var(${NAME})
+ elseif("${MODE}" STREQUAL "LINK")
+ set_link_flags_var(${NAME})
+ else("${MODE}" STREQUAL "LINK")
+ message(FATAL_ERROR "Invalid mode argument ${MODE} given.")
+ endif()
+
+endif()
+
+set(PACKAGE_QUIET ${SILENT} )
diff --git a/Modules/CMakeFindWMake.cmake b/Modules/CMakeFindWMake.cmake
new file mode 100644
index 000000000..6972c4c40
--- /dev/null
+++ b/Modules/CMakeFindWMake.cmake
@@ -0,0 +1,17 @@
+
+#=============================================================================
+# Copyright 2006-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.)
+
+SET (CMAKE_MAKE_PROGRAM "wmake" CACHE STRING
+ "Program used to build from makefiles.")
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
diff --git a/Modules/CMakeFindXCode.cmake b/Modules/CMakeFindXCode.cmake
new file mode 100644
index 000000000..53967b52a
--- /dev/null
+++ b/Modules/CMakeFindXCode.cmake
@@ -0,0 +1,20 @@
+
+#=============================================================================
+# 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.)
+
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM
+ NAMES xcodebuild
+ PATHS
+ /usr/bin
+ )
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake
new file mode 100644
index 000000000..2a839fd93
--- /dev/null
+++ b/Modules/CMakeForceCompiler.cmake
@@ -0,0 +1,82 @@
+# This module defines macros intended for use by cross-compiling
+# toolchain files when CMake is not able to automatically detect the
+# compiler identification.
+#
+# Macro CMAKE_FORCE_C_COMPILER has the following signature:
+# CMAKE_FORCE_C_COMPILER(<compiler> <compiler-id>)
+# It sets CMAKE_C_COMPILER to the given compiler and the cmake
+# internal variable CMAKE_C_COMPILER_ID to the given compiler-id.
+# It also bypasses the check for working compiler and basic compiler
+# information tests.
+#
+# Macro CMAKE_FORCE_CXX_COMPILER has the following signature:
+# CMAKE_FORCE_CXX_COMPILER(<compiler> <compiler-id>)
+# It sets CMAKE_CXX_COMPILER to the given compiler and the cmake
+# internal variable CMAKE_CXX_COMPILER_ID to the given compiler-id.
+# It also bypasses the check for working compiler and basic compiler
+# information tests.
+#
+# Macro CMAKE_FORCE_Fortran_COMPILER has the following signature:
+# CMAKE_FORCE_Fortran_COMPILER(<compiler> <compiler-id>)
+# It sets CMAKE_Fortran_COMPILER to the given compiler and the cmake
+# internal variable CMAKE_Fortran_COMPILER_ID to the given compiler-id.
+# It also bypasses the check for working compiler and basic compiler
+# information tests.
+#
+# So a simple toolchain file could look like this:
+# INCLUDE (CMakeForceCompiler)
+# SET(CMAKE_SYSTEM_NAME Generic)
+# CMAKE_FORCE_C_COMPILER (chc12 MetrowerksHicross)
+# CMAKE_FORCE_CXX_COMPILER (chc12 MetrowerksHicross)
+
+#=============================================================================
+# 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.)
+
+MACRO(CMAKE_FORCE_C_COMPILER compiler id)
+ SET(CMAKE_C_COMPILER "${compiler}")
+ SET(CMAKE_C_COMPILER_ID_RUN TRUE)
+ SET(CMAKE_C_COMPILER_ID ${id})
+ SET(CMAKE_C_COMPILER_WORKS TRUE)
+ SET(CMAKE_C_COMPILER_FORCED TRUE)
+
+ # Set old compiler id variables.
+ IF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+ SET(CMAKE_COMPILER_IS_GNUCC 1)
+ ENDIF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+ENDMACRO(CMAKE_FORCE_C_COMPILER)
+
+MACRO(CMAKE_FORCE_CXX_COMPILER compiler id)
+ SET(CMAKE_CXX_COMPILER "${compiler}")
+ SET(CMAKE_CXX_COMPILER_ID_RUN TRUE)
+ SET(CMAKE_CXX_COMPILER_ID ${id})
+ SET(CMAKE_CXX_COMPILER_WORKS TRUE)
+ SET(CMAKE_CXX_COMPILER_FORCED TRUE)
+
+ # Set old compiler id variables.
+ IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ SET(CMAKE_COMPILER_IS_GNUCXX 1)
+ ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ENDMACRO(CMAKE_FORCE_CXX_COMPILER)
+
+MACRO(CMAKE_FORCE_Fortran_COMPILER compiler id)
+ SET(CMAKE_Fortran_COMPILER "${compiler}")
+ SET(CMAKE_Fortran_COMPILER_ID_RUN TRUE)
+ SET(CMAKE_Fortran_COMPILER_ID ${id})
+ SET(CMAKE_Fortran_COMPILER_WORKS TRUE)
+ SET(CMAKE_Fortran_COMPILER_FORCED TRUE)
+
+ # Set old compiler id variables.
+ IF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+ SET(CMAKE_COMPILER_IS_GNUG77 1)
+ ENDIF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+ENDMACRO(CMAKE_FORCE_Fortran_COMPILER)
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in
new file mode 100644
index 000000000..53d95525f
--- /dev/null
+++ b/Modules/CMakeFortranCompiler.cmake.in
@@ -0,0 +1,52 @@
+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_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@")
+@SET_MSVC_Fortran_ARCHITECTURE_ID@
+SET(CMAKE_AR "@CMAKE_AR@")
+SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
+SET(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@)
+SET(CMAKE_Fortran_COMPILER_LOADED 1)
+SET(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
+SET(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
+IF(CMAKE_COMPILER_IS_CYGWIN)
+ SET(CYGWIN 1)
+ SET(UNIX 1)
+ENDIF(CMAKE_COMPILER_IS_CYGWIN)
+
+SET(CMAKE_Fortran_COMPILER_ENV_VAR "FC")
+
+SET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 @CMAKE_Fortran_COMPILER_SUPPORTS_F90@)
+
+IF(CMAKE_COMPILER_IS_MINGW)
+ SET(MINGW 1)
+ENDIF(CMAKE_COMPILER_IS_MINGW)
+SET(CMAKE_Fortran_COMPILER_ID_RUN 1)
+SET(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS f;F;f77;F77;f90;F90;for;For;FOR;f95;F95)
+SET(CMAKE_Fortran_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
+SET(CMAKE_Fortran_LINKER_PREFERENCE 20)
+IF(UNIX)
+ SET(CMAKE_Fortran_OUTPUT_EXTENSION .o)
+ELSE(UNIX)
+ SET(CMAKE_Fortran_OUTPUT_EXTENSION .obj)
+ENDIF(UNIX)
+
+# Save compiler ABI information.
+SET(CMAKE_Fortran_SIZEOF_DATA_PTR "@CMAKE_Fortran_SIZEOF_DATA_PTR@")
+SET(CMAKE_Fortran_COMPILER_ABI "@CMAKE_Fortran_COMPILER_ABI@")
+SET(CMAKE_Fortran_LIBRARY_ARCHITECTURE "@CMAKE_Fortran_LIBRARY_ARCHITECTURE@")
+
+IF(CMAKE_Fortran_SIZEOF_DATA_PTR AND NOT CMAKE_SIZEOF_VOID_P)
+ SET(CMAKE_SIZEOF_VOID_P "${CMAKE_Fortran_SIZEOF_DATA_PTR}")
+ENDIF()
+
+IF(CMAKE_Fortran_COMPILER_ABI)
+ SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_Fortran_COMPILER_ABI}")
+ENDIF(CMAKE_Fortran_COMPILER_ABI)
+
+IF(CMAKE_Fortran_LIBRARY_ARCHITECTURE)
+ SET(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_Fortran_LIBRARY_ARCHITECTURE@")
+ENDIF()
+
+SET(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@")
+SET(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@")
diff --git a/Modules/CMakeFortranCompilerABI.F b/Modules/CMakeFortranCompilerABI.F
new file mode 100644
index 000000000..7e24553fb
--- /dev/null
+++ b/Modules/CMakeFortranCompilerABI.F
@@ -0,0 +1,38 @@
+ PROGRAM CMakeFortranCompilerABI
+#if 0
+! Address Size
+#endif
+#if defined(_LP64)
+ PRINT *, 'INFO:sizeof_dptr[8]'
+#elif defined(_M_IA64)
+ PRINT *, 'INFO:sizeof_dptr[8]'
+#elif defined(_M_X64)
+ PRINT *, 'INFO:sizeof_dptr[8]'
+#elif defined(_M_AMD64)
+ PRINT *, 'INFO:sizeof_dptr[8]'
+
+#elif defined(_ILP32)
+ PRINT *, 'INFO:sizeof_dptr[4]'
+#elif defined(_M_IX86)
+ 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]'
+#endif
+
+#if 0
+! Application Binary Interface
+#endif
+#if defined(__sgi) && defined(_ABIO32)
+ PRINT *, 'INFO:abi[ELF O32]'
+#elif defined(__sgi) && defined(_ABIN32)
+ PRINT *, 'INFO:abi[ELF N32]'
+#elif defined(__sgi) && defined(_ABI64)
+ PRINT *, 'INFO:abi[ELF 64]'
+#elif defined(__ELF__)
+ PRINT *, 'INFO:abi[ELF]'
+#endif
+ PRINT *, 'ABI Detection'
+ END
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
new file mode 100644
index 000000000..4d25de0ba
--- /dev/null
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -0,0 +1,123 @@
+ PROGRAM CMakeFortranCompilerId
+#if 0
+! Identify the compiler
+#endif
+#if defined(__INTEL_COMPILER) || defined(__ICC)
+ PRINT *, 'INFO:compiler[Intel]'
+#elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95)
+ PRINT *, 'INFO:compiler[SunPro]'
+#elif defined(_CRAYFTN)
+ PRINT *, 'INFO:compiler[Cray]'
+#elif defined(__G95__)
+ PRINT *, 'INFO:compiler[G95]'
+#elif defined(__PATHSCALE__)
+ PRINT *, 'INFO:compiler[PathScale]'
+#elif defined(__ABSOFT__)
+ PRINT *, 'INFO:compiler[Absoft]'
+#elif defined(__GNUC__)
+ PRINT *, 'INFO:compiler[GNU]'
+#elif defined(__IBMC__)
+# if defined(__COMPILER_VER__)
+ PRINT *, 'INFO:compiler[zOS]'
+# elif __IBMC__ >= 800
+ PRINT *, 'INFO:compiler[XL]'
+# else
+ PRINT *, 'INFO:compiler[VisualAge]'
+# endif
+#elif defined(__PGI)
+ PRINT *, 'INFO:compiler[PGI]'
+#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
+ PRINT *, 'INFO:compiler[MIPSpro]'
+# if 0
+! 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.
+# endif
+#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
+ PRINT *, 'INFO:compiler[VisualAge]'
+#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
+ PRINT *, 'INFO:compiler[MIPSpro]'
+#elif defined(__hpux) || defined(__hpux__)
+ PRINT *, 'INFO:compiler[HP]'
+#elif 1
+# if 0
+! The above 'elif 1' instead of 'else' is to work around a bug in the
+! SGI preprocessor which produces both the __sgi and else blocks.
+# endif
+ PRINT *, 'INFO:compiler[]'
+#endif
+
+#if 0
+! Identify the platform
+#endif
+#if defined(__linux) || defined(__linux__) || defined(linux)
+ PRINT *, 'INFO:platform[Linux]'
+#elif defined(__CYGWIN__)
+ PRINT *, 'INFO:platform[Cygwin]'
+#elif defined(__MINGW32__)
+ PRINT *, 'INFO:platform[MinGW]'
+#elif defined(__APPLE__)
+ PRINT *, 'INFO:platform[Darwin]'
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ PRINT *, 'INFO:platform[Windows]'
+#elif defined(__FreeBSD__) || defined(__FreeBSD)
+ PRINT *, 'INFO:platform[FreeBSD]'
+#elif defined(__NetBSD__) || defined(__NetBSD)
+ PRINT *, 'INFO:platform[NetBSD]'
+#elif defined(__OpenBSD__) || defined(__OPENBSD)
+ PRINT *, 'INFO:platform[OpenBSD]'
+#elif defined(__sun) || defined(sun)
+ PRINT *, 'INFO:platform[SunOS]'
+#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
+ PRINT *, 'INFO:platform[AIX]'
+#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
+ PRINT *, 'INFO:platform[IRIX]'
+#elif defined(__hpux) || defined(__hpux__)
+ PRINT *, 'INFO:platform[HP-UX]'
+#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU)
+ PRINT *, 'INFO:platform[Haiku]'
+# if 0
+! Haiku also defines __BEOS__ so we must
+! put it prior to the check for __BEOS__
+# endif
+#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
+ PRINT *, 'INFO:platform[BeOS]'
+#elif defined(__QNX__) || defined(__QNXNTO__)
+ PRINT *, 'INFO:platform[QNX]'
+#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
+ PRINT *, 'INFO:platform[Tru64]'
+#elif defined(__riscos) || defined(__riscos__)
+ PRINT *, 'INFO:platform[RISCos]'
+#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
+ PRINT *, 'INFO:platform[SINIX]'
+#elif defined(__UNIX_SV__)
+ PRINT *, 'INFO:platform[UNIX_SV]'
+#elif defined(__bsdos__)
+ PRINT *, 'INFO:platform[BSDOS]'
+#elif defined(_MPRAS) || defined(MPRAS)
+ PRINT *, 'INFO:platform[MP-RAS]'
+#elif defined(__osf) || defined(__osf__)
+ PRINT *, 'INFO:platform[OSF1]'
+#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
+ PRINT *, 'INFO:platform[SCO_SV]'
+#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
+ PRINT *, 'INFO:platform[ULTRIX]'
+#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
+ PRINT *, 'INFO:platform[Xenix]'
+#elif 1
+# if 0
+! The above 'elif 1' instead of 'else' is to work around a bug in the
+! SGI preprocessor which produces both the __sgi and else blocks.
+# endif
+ PRINT *, 'INFO:platform[]'
+#endif
+#if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC))
+# if defined(_M_IA64)
+ PRINT *, 'INFO:arch[IA64]'
+# elif defined(_M_X64) || defined(_M_AMD64)
+ PRINT *, 'INFO:arch[x64]'
+# elif defined(_M_IX86)
+ PRINT *, 'INFO:arch[X86]'
+# endif
+#endif
+ END
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
new file mode 100644
index 000000000..d962f4cb5
--- /dev/null
+++ b/Modules/CMakeFortranInformation.cmake
@@ -0,0 +1,245 @@
+
+#=============================================================================
+# Copyright 2004-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.)
+
+# 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.
+
+SET(_INCLUDED_FILE 0)
+
+# Load compiler-specific information.
+IF(CMAKE_Fortran_COMPILER_ID)
+ INCLUDE(Compiler/${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL)
+ENDIF(CMAKE_Fortran_COMPILER_ID)
+
+SET(CMAKE_BASE_NAME)
+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)
+ENDIF(CMAKE_COMPILER_IS_GNUG77)
+IF(CMAKE_Fortran_COMPILER_ID)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
+ENDIF(CMAKE_Fortran_COMPILER_ID)
+IF (NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL
+ RESULT_VARIABLE _INCLUDED_FILE)
+ENDIF (NOT _INCLUDED_FILE)
+# 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.
+# Remove this when all compiler info is removed from system files.
+IF (NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
+ENDIF (NOT _INCLUDED_FILE)
+
+IF(CMAKE_Fortran_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_Fortran_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_Fortran_ABI_FILES)
+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_Fortran)
+ # Save the full path of the file so try_compile can use it.
+ INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran} RESULT_VARIABLE _override)
+ SET(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran "${_override}")
+ENDIF()
+
+
+# Fortran needs cmake to do a requires step during its build process to
+# catch any modules
+SET(CMAKE_NEEDS_REQUIRES_STEP_Fortran_FLAG 1)
+
+IF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIC)
+ SET(CMAKE_Fortran_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC})
+ENDIF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIC)
+
+IF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIE)
+ SET(CMAKE_Fortran_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE})
+ENDIF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIE)
+
+IF(NOT CMAKE_Fortran_COMPILE_OPTIONS_DLL)
+ SET(CMAKE_Fortran_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL})
+ENDIF(NOT CMAKE_Fortran_COMPILE_OPTIONS_DLL)
+
+# Create a set of shared library variable specific to Fortran
+# For 90% of the systems, these are the same flags as the C versions
+# so if these are not set just copy the flags from the c version
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS)
+ SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_Fortran_FLAGS)
+ SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS)
+ SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG)
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP)
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG)
+ SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_EXE_EXPORTS_Fortran_FLAG)
+ SET(CMAKE_EXE_EXPORTS_Fortran_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG)
+ SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
+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_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_Fortran_FLAGS})
+ SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS})
+ENDIF(NOT CMAKE_MODULE_EXISTS)
+
+# repeat for modules
+IF(NOT DEFINED CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS)
+ SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_SHARED_MODULE_Fortran_FLAGS)
+ SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG)
+ SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP)
+ SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG)
+ SET(CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG})
+ENDIF()
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH)
+ SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH})
+ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH)
+
+IF(NOT CMAKE_INCLUDE_FLAG_Fortran)
+ SET(CMAKE_INCLUDE_FLAG_Fortran ${CMAKE_INCLUDE_FLAG_C})
+ENDIF(NOT CMAKE_INCLUDE_FLAG_Fortran)
+
+IF(NOT CMAKE_INCLUDE_FLAG_SEP_Fortran)
+ SET(CMAKE_INCLUDE_FLAG_SEP_Fortran ${CMAKE_INCLUDE_FLAG_SEP_C})
+ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_Fortran)
+
+SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
+
+SET(CMAKE_Fortran_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Fortran_FLAGS_INIT}")
+# avoid just having a space as the initial value for the cache
+IF(CMAKE_Fortran_FLAGS_INIT STREQUAL " ")
+ SET(CMAKE_Fortran_FLAGS_INIT)
+ENDIF(CMAKE_Fortran_FLAGS_INIT STREQUAL " ")
+SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_INIT}" CACHE STRING
+ "Flags for Fortran compiler.")
+
+INCLUDE(CMakeCommonLanguageInclude)
+
+# now define the following rule variables
+# CMAKE_Fortran_CREATE_SHARED_LIBRARY
+# CMAKE_Fortran_CREATE_SHARED_MODULE
+# CMAKE_Fortran_COMPILE_OBJECT
+# CMAKE_Fortran_LINK_EXECUTABLE
+
+# create a Fortran shared library
+IF(NOT CMAKE_Fortran_CREATE_SHARED_LIBRARY)
+ SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY
+ "<CMAKE_Fortran_COMPILER> <CMAKE_SHARED_LIBRARY_Fortran_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
+ENDIF(NOT CMAKE_Fortran_CREATE_SHARED_LIBRARY)
+
+# create a Fortran shared module just copy the shared library rule
+IF(NOT CMAKE_Fortran_CREATE_SHARED_MODULE)
+ SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY})
+ENDIF(NOT CMAKE_Fortran_CREATE_SHARED_MODULE)
+
+# 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>")
+ENDIF()
+IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND)
+ SET(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+ENDIF()
+IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH)
+ SET(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
+ENDIF()
+
+# compile a Fortran file into an object file
+# (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>")
+ENDIF(NOT CMAKE_Fortran_COMPILE_OBJECT)
+
+# link a fortran program
+IF(NOT CMAKE_Fortran_LINK_EXECUTABLE)
+ SET(CMAKE_Fortran_LINK_EXECUTABLE
+ "<CMAKE_Fortran_COMPILER> <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+ENDIF(NOT CMAKE_Fortran_LINK_EXECUTABLE)
+
+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.")
+ MARK_AS_ADVANCED(CMAKE_Fortran_STANDARD_LIBRARIES)
+ENDIF(CMAKE_Fortran_STANDARD_LIBRARIES_INIT)
+
+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.")
+ 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).")
+ SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
+ "Flags used by the compiler during Release with Debug Info builds.")
+
+ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+
+MARK_AS_ADVANCED(
+CMAKE_Fortran_FLAGS
+CMAKE_Fortran_FLAGS_DEBUG
+CMAKE_Fortran_FLAGS_MINSIZEREL
+CMAKE_Fortran_FLAGS_RELEASE
+CMAKE_Fortran_FLAGS_RELWITHDEBINFO)
+
+# set this variable so we can avoid loading this more than once.
+SET(CMAKE_Fortran_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
new file mode 100644
index 000000000..0ccbfac56
--- /dev/null
+++ b/Modules/CMakeGenericSystem.cmake
@@ -0,0 +1,187 @@
+
+#=============================================================================
+# 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.)
+
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
+SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
+SET(CMAKE_INCLUDE_FLAG_C "-I") # -I
+SET(CMAKE_INCLUDE_FLAG_C_SEP "") # , or empty
+SET(CMAKE_LIBRARY_PATH_FLAG "-L")
+SET(CMAKE_LIBRARY_PATH_TERMINATOR "") # for the Digital Mars D compiler the link paths have to be terminated with a "/"
+SET(CMAKE_LINK_LIBRARY_FLAG "-l")
+
+SET(CMAKE_LINK_LIBRARY_SUFFIX "")
+SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+SET(CMAKE_STATIC_LIBRARY_SUFFIX ".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")
+
+SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
+
+# basically all general purpose OSs support shared libs
+SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
+
+SET (CMAKE_SKIP_RPATH "NO" CACHE BOOL
+ "If set, runtime paths are not added when using shared libraries.")
+SET (CMAKE_SKIP_INSTALL_RPATH "NO" CACHE BOOL
+ "If set, runtime paths are not added when installing shared libraries, but are added when building.")
+
+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")
+ SET(CMAKE_COLOR_MAKEFILE ON CACHE BOOL
+ "Enable/Disable color output during build."
+ )
+ MARK_AS_ADVANCED(CMAKE_COLOR_MAKEFILE)
+ IF(DEFINED CMAKE_RULE_MESSAGES)
+ SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES})
+ ENDIF(DEFINED CMAKE_RULE_MESSAGES)
+ IF(CMAKE_GENERATOR MATCHES "Unix Makefiles")
+ SET(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL
+ "Enable/Disable output of compile commands during generation."
+ )
+ MARK_AS_ADVANCED(CMAKE_EXPORT_COMPILE_COMMANDS)
+ ENDIF(CMAKE_GENERATOR MATCHES "Unix Makefiles")
+ENDIF(CMAKE_GENERATOR MATCHES "Makefiles")
+
+IF(CMAKE_GENERATOR MATCHES "Ninja")
+ SET(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL
+ "Enable/Disable output of compile commands during generation."
+ )
+ MARK_AS_ADVANCED(CMAKE_EXPORT_COMPILE_COMMANDS)
+ENDIF(CMAKE_GENERATOR MATCHES "Ninja")
+
+# GetDefaultWindowsPrefixBase
+#
+# Compute the base directory for CMAKE_INSTALL_PREFIX based on:
+# - is this 32-bit or 64-bit Windows
+# - is this 32-bit or 64-bit CMake running
+# - what architecture targets will be built
+#
+function(GetDefaultWindowsPrefixBase var)
+
+ # Try to guess what architecture targets will end up being built as,
+ # even if CMAKE_SIZEOF_VOID_P is not computed yet... We need to know
+ # the architecture of the targets being built to choose the right
+ # default value for CMAKE_INSTALL_PREFIX.
+ #
+ if("${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)")
+ set(arch_hint "x64")
+ elseif("${CMAKE_GENERATOR}" MATCHES "ARM")
+ set(arch_hint "ARM")
+ elseif("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
+ set(arch_hint "x64")
+ elseif("$ENV{LIB}" MATCHES "(amd64|ia64)")
+ set(arch_hint "x64")
+ endif()
+
+ if(NOT arch_hint)
+ set(arch_hint "x86")
+ endif()
+
+ # default env in a 64-bit app on Win64:
+ # ProgramFiles=C:\Program Files
+ # ProgramFiles(x86)=C:\Program Files (x86)
+ # ProgramW6432=C:\Program Files
+ #
+ # default env in a 32-bit app on Win64:
+ # ProgramFiles=C:\Program Files (x86)
+ # ProgramFiles(x86)=C:\Program Files (x86)
+ # ProgramW6432=C:\Program Files
+ #
+ # default env in a 32-bit app on Win32:
+ # ProgramFiles=C:\Program Files
+ # ProgramFiles(x86) NOT DEFINED
+ # ProgramW6432 NOT DEFINED
+
+ # By default, use the ProgramFiles env var as the base value of
+ # CMAKE_INSTALL_PREFIX:
+ #
+ set(_PREFIX_ENV_VAR "ProgramFiles")
+
+ if ("$ENV{ProgramW6432}" STREQUAL "")
+ # running on 32-bit Windows
+ # must be a 32-bit CMake, too...
+ #message("guess: this is a 32-bit CMake running on 32-bit Windows")
+ else()
+ # running on 64-bit Windows
+ if ("$ENV{ProgramW6432}" STREQUAL "$ENV{ProgramFiles}")
+ # 64-bit CMake
+ #message("guess: this is a 64-bit CMake running on 64-bit Windows")
+ if(NOT "${arch_hint}" STREQUAL "x64")
+ # building 32-bit targets
+ set(_PREFIX_ENV_VAR "ProgramFiles(x86)")
+ endif()
+ else()
+ # 32-bit CMake
+ #message("guess: this is a 32-bit CMake running on 64-bit Windows")
+ if("${arch_hint}" STREQUAL "x64")
+ # building 64-bit targets
+ set(_PREFIX_ENV_VAR "ProgramW6432")
+ endif()
+ endif()
+ endif()
+
+ #if("${arch_hint}" STREQUAL "x64")
+ # message("guess: you are building a 64-bit app")
+ #else()
+ # message("guess: you are building a 32-bit app")
+ #endif()
+
+ if(NOT "$ENV{${_PREFIX_ENV_VAR}}" STREQUAL "")
+ file(TO_CMAKE_PATH "$ENV{${_PREFIX_ENV_VAR}}" _base)
+ elseif(NOT "$ENV{SystemDrive}" STREQUAL "")
+ set(_base "$ENV{SystemDrive}/Program Files")
+ else()
+ set(_base "C:/Program Files")
+ endif()
+
+ set(${var} "${_base}" PARENT_SCOPE)
+endfunction()
+
+
+# Set a variable to indicate whether the value of CMAKE_INSTALL_PREFIX
+# was initialized by the block below. This is useful for user
+# projects to change the default prefix while still allowing the
+# command line to override it.
+IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
+ SET(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 1)
+ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
+
+# Choose a default install prefix for this platform.
+IF(CMAKE_HOST_UNIX)
+ SET(CMAKE_INSTALL_PREFIX "/usr/local"
+ CACHE PATH "Install path prefix, prepended onto install directories.")
+ELSE(CMAKE_HOST_UNIX)
+ GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
+ SET(CMAKE_INSTALL_PREFIX
+ "${CMAKE_GENERIC_PROGRAM_FILES}/${PROJECT_NAME}"
+ CACHE PATH "Install path prefix, prepended onto install directories.")
+ SET(CMAKE_GENERIC_PROGRAM_FILES)
+ENDIF(CMAKE_HOST_UNIX)
+
+# Set a variable which will be used as component name in install() commands
+# where no COMPONENT has been given:
+SET(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "Unspecified")
+
+MARK_AS_ADVANCED(
+ CMAKE_SKIP_RPATH
+ CMAKE_SKIP_INSTALL_RPATH
+ CMAKE_VERBOSE_MAKEFILE
+)
diff --git a/Modules/CMakeImportBuildSettings.cmake b/Modules/CMakeImportBuildSettings.cmake
new file mode 100644
index 000000000..848d89445
--- /dev/null
+++ b/Modules/CMakeImportBuildSettings.cmake
@@ -0,0 +1,24 @@
+
+#=============================================================================
+# 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 module is purposely no longer documented. It does nothing useful.
+
+# 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(${SETTINGS_FILE} MATCHES ".+")
+ MESSAGE(SEND_ERROR "CMAKE_IMPORT_BUILD_SETTINGS called with no argument.")
+ ENDIF(${SETTINGS_FILE} MATCHES ".+")
+ENDMACRO(CMAKE_IMPORT_BUILD_SETTINGS)
diff --git a/Modules/CMakeJOMFindMake.cmake b/Modules/CMakeJOMFindMake.cmake
new file mode 100644
index 000000000..617f3bb90
--- /dev/null
+++ b/Modules/CMakeJOMFindMake.cmake
@@ -0,0 +1,18 @@
+
+#=============================================================================
+# 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.)
+
+
+SET (CMAKE_MAKE_PROGRAM "jom" CACHE STRING
+ "Program used to build from makefiles.")
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
diff --git a/Modules/CMakeJavaCompiler.cmake.in b/Modules/CMakeJavaCompiler.cmake.in
new file mode 100644
index 000000000..79c9288bc
--- /dev/null
+++ b/Modules/CMakeJavaCompiler.cmake.in
@@ -0,0 +1,13 @@
+SET(CMAKE_Java_COMPILER "@CMAKE_Java_COMPILER@")
+SET(CMAKE_Java_COMPILER_ARG1 "@CMAKE_Java_COMPILER_ARG1@")
+SET(CMAKE_Java_RUNTIME "@CMAKE_Java_RUNTIME@")
+SET(CMAKE_Java_ARCHIVE "@CMAKE_Java_ARCHIVE@")
+SET(CMAKE_Java_COMPILER_LOADED 1)
+
+SET(CMAKE_Java_SOURCE_FILE_EXTENSIONS java)
+SET(CMAKE_Java_LINKER_PREFERENCE 40)
+SET(CMAKE_Java_OUTPUT_EXTENSION .class)
+SET(CMAKE_Java_OUTPUT_EXTENSION_REPLACE 1)
+SET(CMAKE_STATIC_LIBRARY_PREFIX_Java "")
+SET(CMAKE_STATIC_LIBRARY_SUFFIX_Java ".jar")
+SET(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER")
diff --git a/Modules/CMakeJavaInformation.cmake b/Modules/CMakeJavaInformation.cmake
new file mode 100644
index 000000000..e192db100
--- /dev/null
+++ b/Modules/CMakeJavaInformation.cmake
@@ -0,0 +1,59 @@
+
+#=============================================================================
+# Copyright 2004-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.)
+
+# 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_Java)
+ # Save the full path of the file so try_compile can use it.
+ INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_Java} RESULT_VARIABLE _override)
+ SET(CMAKE_USER_MAKE_RULES_OVERRIDE_Java "${_override}")
+ENDIF()
+
+# this is a place holder if java needed flags for javac they would go here.
+IF(NOT CMAKE_Java_CREATE_STATIC_LIBRARY)
+# IF(WIN32)
+# SET(class_files_mask "*.class")
+# ELSE(WIN32)
+ SET(class_files_mask ".")
+# ENDIF(WIN32)
+
+ SET(CMAKE_Java_CREATE_STATIC_LIBRARY
+ "<CMAKE_Java_ARCHIVE> -cf <TARGET> -C <OBJECT_DIR> ${class_files_mask}")
+ # "${class_files_mask}" should really be "<OBJECTS>" but compling a *.java
+ # file can create more than one *.class file...
+ENDIF(NOT CMAKE_Java_CREATE_STATIC_LIBRARY)
+
+# compile a Java file into an object file
+IF(NOT CMAKE_Java_COMPILE_OBJECT)
+ SET(CMAKE_Java_COMPILE_OBJECT
+ "<CMAKE_Java_COMPILER> <FLAGS> <SOURCE> -d <OBJECT_DIR>")
+ENDIF(NOT CMAKE_Java_COMPILE_OBJECT)
+
+# set java include flag option and the separator for multiple include paths
+SET(CMAKE_INCLUDE_FLAG_Java "-classpath ")
+IF(WIN32 AND NOT CYGWIN)
+ SET(CMAKE_INCLUDE_FLAG_SEP_Java ";")
+ELSE(WIN32 AND NOT CYGWIN)
+ SET(CMAKE_INCLUDE_FLAG_SEP_Java ":")
+ENDIF(WIN32 AND NOT CYGWIN)
diff --git a/Modules/CMakeMSYSFindMake.cmake b/Modules/CMakeMSYSFindMake.cmake
new file mode 100644
index 000000000..95492a0b0
--- /dev/null
+++ b/Modules/CMakeMSYSFindMake.cmake
@@ -0,0 +1,20 @@
+
+#=============================================================================
+# 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.)
+
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM make
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MSYS-1.0_is1;Inno Setup: App Path]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin"
+ c:/msys/1.0/bin /msys/1.0/bin)
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
diff --git a/Modules/CMakeMinGWFindMake.cmake b/Modules/CMakeMinGWFindMake.cmake
new file mode 100644
index 000000000..f760d74d4
--- /dev/null
+++ b/Modules/CMakeMinGWFindMake.cmake
@@ -0,0 +1,24 @@
+
+#=============================================================================
+# 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.)
+
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM mingw32-make.exe PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin"
+ c:/MinGW/bin /MinGW/bin)
+FIND_PROGRAM(CMAKE_SH sh.exe )
+IF(CMAKE_SH)
+ MESSAGE(FATAL_ERROR "sh.exe was found in your PATH, here:\n${CMAKE_SH}\nFor MinGW make to work correctly sh.exe must NOT be in your path.\nRun cmake from a shell that does not have sh.exe in your PATH.\nIf you want to use a UNIX shell, then use MSYS Makefiles.\n")
+ SET(CMAKE_MAKE_PROGRAM NOTFOUND)
+ENDIF(CMAKE_SH)
+
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM CMAKE_SH)
diff --git a/Modules/CMakeNMakeFindMake.cmake b/Modules/CMakeNMakeFindMake.cmake
new file mode 100644
index 000000000..f6472170c
--- /dev/null
+++ b/Modules/CMakeNMakeFindMake.cmake
@@ -0,0 +1,18 @@
+
+#=============================================================================
+# 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.)
+
+
+SET (CMAKE_MAKE_PROGRAM "nmake" CACHE STRING
+ "Program used to build from makefiles.")
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
diff --git a/Modules/CMakeNinjaFindMake.cmake b/Modules/CMakeNinjaFindMake.cmake
new file mode 100644
index 000000000..f15c3e0d4
--- /dev/null
+++ b/Modules/CMakeNinjaFindMake.cmake
@@ -0,0 +1,17 @@
+
+#=============================================================================
+# Copyright 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.)
+
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM 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
new file mode 100644
index 000000000..48039e522
--- /dev/null
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -0,0 +1,227 @@
+# - 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)
+
+
+#=============================================================================
+# Copyright 2012 Alexander Neundorf <neundorf@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(CMakeParseArguments)
+
+include(WriteBasicConfigVersionFile)
+
+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(multiValueArgs PATH_VARS )
+
+ cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if(CCF_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"")
+ endif()
+
+ if(NOT CCF_INSTALL_DESTINATION)
+ message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()")
+ endif()
+
+ if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}")
+ set(absInstallDir "${CCF_INSTALL_DESTINATION}")
+ else()
+ set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
+ endif()
+ file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" )
+
+ 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}"
+ PACKAGE_${var} "${${var}}")
+ else()
+ set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
+ endif()
+ endif()
+ endforeach()
+
+ set(PACKAGE_INIT "
+####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
+get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE)
+")
+
+ if(NOT CCF_NO_SET_AND_CHECK_MACRO)
+ set(PACKAGE_INIT "${PACKAGE_INIT}
+macro(set_and_check _var _file)
+ set(\${_var} \"\${_file}\")
+ if(NOT EXISTS \"\${_file}\")
+ message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\")
+ endif()
+endmacro()
+")
+ endif()
+
+
+ if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO)
+ set(PACKAGE_INIT "${PACKAGE_INIT}
+macro(check_required_components _NAME)
+ foreach(comp \${\${_NAME}_FIND_COMPONENTS})
+ if(NOT \${_NAME}_\${comp}_FOUND)
+ if(\${_NAME}_FIND_REQUIRED_\${comp})
+ set(\${_NAME}_FOUND FALSE)
+ endif()
+ endif()
+ endforeach(comp)
+endmacro()
+")
+ endif()
+
+ set(PACKAGE_INIT "${PACKAGE_INIT}
+####################################################################################")
+
+ configure_file("${_inputFile}" "${_outputFile}" @ONLY)
+
+endfunction()
diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake
new file mode 100644
index 000000000..7ce4c49ae
--- /dev/null
+++ b/Modules/CMakeParseArguments.cmake
@@ -0,0 +1,138 @@
+# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
+#
+# 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 the 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.
+
+#=============================================================================
+# Copyright 2010 Alexander Neundorf <neundorf@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.)
+
+
+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(arg_name)
+
+ foreach(option ${_optionNames})
+ set(${prefix}_${option} FALSE)
+ endforeach(option)
+
+ 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(insideValues)
+ list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
+ endif(insideValues)
+ 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(currentArg)
+
+ # propagate the result variables to the caller:
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
+ set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
+ endforeach(arg_name)
+ set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
+
+endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
new file mode 100644
index 000000000..ecb20dc6b
--- /dev/null
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -0,0 +1,128 @@
+
+#=============================================================================
+# 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.)
+
+# Function parse implicit linker options.
+# This is used internally by CMake and should not be included by user
+# code.
+
+function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex)
+ set(implicit_libs_tmp "")
+ set(implicit_dirs_tmp)
+ set(log "")
+
+ # Parse implicit linker arguments.
+ set(linker "CMAKE_LINKER-NOTFOUND")
+ if(CMAKE_LINKER)
+ get_filename_component(linker ${CMAKE_LINKER} NAME)
+ endif()
+ # 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(log "${log} link line regex: [${linker_regex}]\n")
+ string(REGEX REPLACE "\r?\n" ";" output_lines "${text}")
+ foreach(line IN LISTS output_lines)
+ set(cmd)
+ if("${line}" MATCHES "${linker_regex}" AND
+ NOT "${line}" MATCHES "${linker_exclude_regex}")
+ if(UNIX)
+ separate_arguments(args UNIX_COMMAND "${line}")
+ else()
+ separate_arguments(args WINDOWS_COMMAND "${line}")
+ endif()
+ list(GET args 0 cmd)
+ endif()
+ if("${cmd}" MATCHES "${linker_regex}")
+ set(log "${log} link line: [${line}]\n")
+ string(REGEX REPLACE ";-([LYz]);" ";-\\1" args "${args}")
+ foreach(arg IN LISTS args)
+ if("${arg}" MATCHES "^-L(.:)?[/\\]")
+ # Unix search path.
+ string(REGEX REPLACE "^-L" "" dir "${arg}")
+ list(APPEND implicit_dirs_tmp ${dir})
+ set(log "${log} arg [${arg}] ==> dir [${dir}]\n")
+ elseif("${arg}" MATCHES "^-l[^:]")
+ # Unix library.
+ string(REGEX REPLACE "^-l" "" lib "${arg}")
+ list(APPEND implicit_libs_tmp ${lib})
+ set(log "${log} arg [${arg}] ==> lib [${lib}]\n")
+ elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$")
+ # Unix library full path.
+ list(APPEND implicit_libs_tmp ${arg})
+ set(log "${log} arg [${arg}] ==> lib [${arg}]\n")
+ elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$"
+ AND obj_regex AND "${arg}" MATCHES "${obj_regex}")
+ # Object file full path.
+ list(APPEND implicit_libs_tmp ${arg})
+ set(log "${log} arg [${arg}] ==> obj [${arg}]\n")
+ elseif("${arg}" MATCHES "^-Y(P,)?[^0-9]")
+ # Sun search path ([^0-9] avoids conflict with Mac -Y<num>).
+ string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}")
+ string(REPLACE ":" ";" dirs "${dirs}")
+ list(APPEND implicit_dirs_tmp ${dirs})
+ set(log "${log} arg [${arg}] ==> dirs [${dirs}]\n")
+ elseif("${arg}" MATCHES "^-l:")
+ # HP named library.
+ list(APPEND implicit_libs_tmp ${arg})
+ set(log "${log} arg [${arg}] ==> lib [${arg}]\n")
+ elseif("${arg}" MATCHES "^-z(all|default|weak)extract")
+ # Link editor option.
+ list(APPEND implicit_libs_tmp ${arg})
+ set(log "${log} arg [${arg}] ==> opt [${arg}]\n")
+ else()
+ set(log "${log} arg [${arg}] ==> ignore\n")
+ endif()
+ endforeach()
+ break()
+ 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}")
+ list(APPEND implicit_dirs_tmp ${paths})
+ set(log "${log} dirs [${paths}]\n")
+ else()
+ set(log "${log} ignore line: [${line}]\n")
+ endif()
+ endforeach()
+
+ # Cleanup list of libraries and flags.
+ # 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.*)$")
+ set(log "${log} remove lib [${lib}]\n")
+ else()
+ list(APPEND implicit_libs "${lib}")
+ endif()
+ endforeach()
+
+ # Cleanup list of directories.
+ set(implicit_dirs "")
+ foreach(d IN LISTS implicit_dirs_tmp)
+ get_filename_component(dir "${d}" ABSOLUTE)
+ list(APPEND implicit_dirs "${dir}")
+ set(log "${log} collapse dir [${d}] ==> [${dir}]\n")
+ endforeach()
+ list(REMOVE_DUPLICATES implicit_dirs)
+
+ # Log results.
+ set(log "${log} implicit libs: [${implicit_libs}]\n")
+ set(log "${log} implicit dirs: [${implicit_dirs}]\n")
+
+ # Return results.
+ set(${lib_var} "${implicit_libs}" PARENT_SCOPE)
+ set(${dir_var} "${implicit_dirs}" PARENT_SCOPE)
+ set(${log_var} "${log}" PARENT_SCOPE)
+endfunction()
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
new file mode 100644
index 000000000..6341dca9a
--- /dev/null
+++ b/Modules/CMakePlatformId.h.in
@@ -0,0 +1,157 @@
+/* Identify known platforms by name. */
+#if defined(__linux) || defined(__linux__) || defined(linux)
+# define PLATFORM_ID "Linux"
+
+#elif defined(__CYGWIN__)
+# define PLATFORM_ID "Cygwin"
+
+#elif defined(__MINGW32__)
+# define PLATFORM_ID "MinGW"
+
+#elif defined(__APPLE__)
+# define PLATFORM_ID "Darwin"
+
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+# define PLATFORM_ID "Windows"
+
+#elif defined(__FreeBSD__) || defined(__FreeBSD)
+# define PLATFORM_ID "FreeBSD"
+
+#elif defined(__NetBSD__) || defined(__NetBSD)
+# define PLATFORM_ID "NetBSD"
+
+#elif defined(__OpenBSD__) || defined(__OPENBSD)
+# define PLATFORM_ID "OpenBSD"
+
+#elif defined(__sun) || defined(sun)
+# define PLATFORM_ID "SunOS"
+
+#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
+# define PLATFORM_ID "AIX"
+
+#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
+# define PLATFORM_ID "IRIX"
+
+#elif defined(__hpux) || defined(__hpux__)
+# define PLATFORM_ID "HP-UX"
+
+#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU)
+# define PLATFORM_ID "Haiku"
+/* Haiku also defines __BEOS__ so we must
+ put it prior to the check for __BEOS__
+*/
+
+#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
+# define PLATFORM_ID "BeOS"
+
+#elif defined(__QNX__) || defined(__QNXNTO__)
+# define PLATFORM_ID "QNX"
+
+#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
+# define PLATFORM_ID "Tru64"
+
+#elif defined(__riscos) || defined(__riscos__)
+# define PLATFORM_ID "RISCos"
+
+#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
+# define PLATFORM_ID "SINIX"
+
+#elif defined(__UNIX_SV__)
+# define PLATFORM_ID "UNIX_SV"
+
+#elif defined(__bsdos__)
+# define PLATFORM_ID "BSDOS"
+
+#elif defined(_MPRAS) || defined(MPRAS)
+# define PLATFORM_ID "MP-RAS"
+
+#elif defined(__osf) || defined(__osf__)
+# define PLATFORM_ID "OSF1"
+
+#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
+# define PLATFORM_ID "SCO_SV"
+
+#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
+# define PLATFORM_ID "ULTRIX"
+
+#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
+# define PLATFORM_ID "Xenix"
+
+#else /* unknown platform */
+# define PLATFORM_ID ""
+
+#endif
+
+/* For windows compilers MSVC and Intel we can determine
+ the architecture of the compiler being used. This is because
+ the compilers do not have flags that can change the architecture,
+ but rather depend on which compiler is being used
+*/
+#if defined(_WIN32) && defined(_MSC_VER)
+# if defined(_M_IA64)
+# define ARCHITECTURE_ID "IA64"
+
+# elif defined(_M_X64) || defined(_M_AMD64)
+# define ARCHITECTURE_ID "x64"
+
+# elif defined(_M_IX86)
+# define ARCHITECTURE_ID "X86"
+
+# elif defined(_M_ARM)
+# define ARCHITECTURE_ID "ARM"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
+
+#else
+# define ARCHITECTURE_ID ""
+#endif
+
+/* Convert integer to decimal digit literals. */
+#define DEC(n) \
+ ('0' + (((n) / 10000000)%10)), \
+ ('0' + (((n) / 1000000)%10)), \
+ ('0' + (((n) / 100000)%10)), \
+ ('0' + (((n) / 10000)%10)), \
+ ('0' + (((n) / 1000)%10)), \
+ ('0' + (((n) / 100)%10)), \
+ ('0' + (((n) / 10)%10)), \
+ ('0' + ((n) % 10))
+
+/* Convert integer to hex digit literals. */
+#define HEX(n) \
+ ('0' + ((n)>>28 & 0xF)), \
+ ('0' + ((n)>>24 & 0xF)), \
+ ('0' + ((n)>>20 & 0xF)), \
+ ('0' + ((n)>>16 & 0xF)), \
+ ('0' + ((n)>>12 & 0xF)), \
+ ('0' + ((n)>>8 & 0xF)), \
+ ('0' + ((n)>>4 & 0xF)), \
+ ('0' + ((n) & 0xF))
+
+/* Construct a string literal encoding the version number components. */
+#ifdef COMPILER_VERSION_MAJOR
+char const info_version[] = {
+ 'I', 'N', 'F', 'O', ':',
+ 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
+ COMPILER_VERSION_MAJOR,
+# ifdef COMPILER_VERSION_MINOR
+ '.', COMPILER_VERSION_MINOR,
+# ifdef COMPILER_VERSION_PATCH
+ '.', COMPILER_VERSION_PATCH,
+# ifdef COMPILER_VERSION_TWEAK
+ '.', COMPILER_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
+ array rather than assigning a pointer to a static array. */
+char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
+char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
+
diff --git a/Modules/CMakePrintSystemInformation.cmake b/Modules/CMakePrintSystemInformation.cmake
new file mode 100644
index 000000000..2c5d0f2ae
--- /dev/null
+++ b/Modules/CMakePrintSystemInformation.cmake
@@ -0,0 +1,46 @@
+# - 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.
+#
+# 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.)
+
+MESSAGE("CMAKE_SYSTEM is ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}")
+MESSAGE("CMAKE_SYSTEM file is ${CMAKE_SYSTEM_INFO_FILE}")
+MESSAGE("CMAKE_C_COMPILER is ${CMAKE_C_COMPILER}")
+MESSAGE("CMAKE_CXX_COMPILER is ${CMAKE_CXX_COMPILER}")
+
+
+MESSAGE("CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}")
+MESSAGE("CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}")
+MESSAGE("CMAKE_DL_LIBS is ${CMAKE_DL_LIBS}")
+MESSAGE("CMAKE_SHARED_LIBRARY_PREFIX is ${CMAKE_SHARED_LIBRARY_PREFIX}")
+MESSAGE("CMAKE_SHARED_LIBRARY_SUFFIX is ${CMAKE_SHARED_LIBRARY_SUFFIX}")
+MESSAGE("CMAKE_COMPILER_IS_GNUCC = ${CMAKE_COMPILER_IS_GNUCC}")
+MESSAGE("CMAKE_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}")
+
+MESSAGE("CMAKE_CXX_CREATE_SHARED_LIBRARY is ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
+MESSAGE("CMAKE_CXX_CREATE_SHARED_MODULE is ${CMAKE_CXX_CREATE_SHARED_MODULE}")
+MESSAGE("CMAKE_CXX_CREATE_STATIC_LIBRARY is ${CMAKE_CXX_CREATE_STATIC_LIBRARY}")
+MESSAGE("CMAKE_CXX_COMPILE_OBJECT is ${CMAKE_CXX_COMPILE_OBJECT}")
+MESSAGE("CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_CXX_LINK_EXECUTABLE}")
+
+MESSAGE("CMAKE_C_CREATE_SHARED_LIBRARY is ${CMAKE_C_CREATE_SHARED_LIBRARY}")
+MESSAGE("CMAKE_C_CREATE_SHARED_MODULE is ${CMAKE_C_CREATE_SHARED_MODULE}")
+MESSAGE("CMAKE_C_CREATE_STATIC_LIBRARY is ${CMAKE_C_CREATE_STATIC_LIBRARY}")
+MESSAGE("CMAKE_C_COMPILE_OBJECT is ${CMAKE_C_COMPILE_OBJECT}")
+MESSAGE("CMAKE_C_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}")
+
+MESSAGE("CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE ${CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE}")
+MESSAGE("CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE ${CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE}")
diff --git a/Modules/CMakePushCheckState.cmake b/Modules/CMakePushCheckState.cmake
new file mode 100644
index 000000000..0a4212818
--- /dev/null
+++ b/Modules/CMakePushCheckState.cmake
@@ -0,0 +1,61 @@
+# This module defines two macros:
+# CMAKE_PUSH_CHECK_STATE()
+# and
+# CMAKE_POP_CHECK_STATE()
+# These two macros can be used to save and restore 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.
+#
+# Usage:
+# cmake_push_check_state()
+# set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
+# check_function_exists(...)
+# cmake_pop_check_state()
+
+#=============================================================================
+# Copyright 2006-2011 Alexander Neundorf, <neundorf@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.)
+
+
+MACRO(CMAKE_PUSH_CHECK_STATE)
+
+ IF(NOT DEFINED _CMAKE_PUSH_CHECK_STATE_COUNTER)
+ SET(_CMAKE_PUSH_CHECK_STATE_COUNTER 0)
+ ENDIF()
+
+ MATH(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}+1")
+
+ SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES})
+ SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
+ SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
+ SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS})
+ENDMACRO(CMAKE_PUSH_CHECK_STATE)
+
+MACRO(CMAKE_POP_CHECK_STATE)
+
+# don't pop more than we pushed
+ IF("${_CMAKE_PUSH_CHECK_STATE_COUNTER}" GREATER "0")
+
+ SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+ SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+
+ MATH(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1")
+ ENDIF()
+
+ENDMACRO(CMAKE_POP_CHECK_STATE)
diff --git a/Modules/CMakeRCCompiler.cmake.in b/Modules/CMakeRCCompiler.cmake.in
new file mode 100644
index 000000000..83428e2eb
--- /dev/null
+++ b/Modules/CMakeRCCompiler.cmake.in
@@ -0,0 +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_OUTPUT_EXTENSION @CMAKE_RC_OUTPUT_EXTENSION@)
+SET(CMAKE_RC_COMPILER_ENV_VAR "RC")
diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake
new file mode 100644
index 000000000..859fe1158
--- /dev/null
+++ b/Modules/CMakeRCInformation.cmake
@@ -0,0 +1,53 @@
+
+#=============================================================================
+# 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.)
+
+
+# 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.
+
+# 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")
+ENDIF()
+SET(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE
+ ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
+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.")
+
+# 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
+# to filter out any other flags
+SET(CMAKE_RC_FLAG_REGEX "^[-/](D|I)")
+
+# now define the following rule variables
+# CMAKE_RC_COMPILE_OBJECT
+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>")
+ENDIF(NOT CMAKE_RC_COMPILE_OBJECT)
+
+MARK_AS_ADVANCED(
+CMAKE_RC_FLAGS
+)
+# set this variable so we can avoid loading this more than once.
+SET(CMAKE_RC_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeSystem.cmake.in b/Modules/CMakeSystem.cmake.in
new file mode 100644
index 000000000..a9f3a552d
--- /dev/null
+++ b/Modules/CMakeSystem.cmake.in
@@ -0,0 +1,15 @@
+@INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED@
+
+SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@")
+SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
+SET(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@")
+SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@")
+
+SET(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@")
+SET(CMAKE_HOST_SYSTEM_NAME "@CMAKE_HOST_SYSTEM_NAME@")
+SET(CMAKE_HOST_SYSTEM_VERSION "@CMAKE_HOST_SYSTEM_VERSION@")
+SET(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@")
+
+SET(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@")
+
+SET(CMAKE_SYSTEM_LOADED 1)
diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake
new file mode 100644
index 000000000..faa9e3625
--- /dev/null
+++ b/Modules/CMakeSystemSpecificInformation.cmake
@@ -0,0 +1,69 @@
+
+#=============================================================================
+# 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 file is included by cmGlobalGenerator::EnableLanguage.
+# It is included after the compiler has been determined, so
+# we know things like the compiler name and if the compiler is gnu.
+
+# before cmake 2.6 these variables were set in cmMakefile.cxx. This is still
+# done to keep scripts and custom language and compiler modules working.
+# But they are reset here and set again in the platform files for the target
+# platform, so they can be used for testing the target platform instead
+# of testing the host platform.
+SET(APPLE )
+SET(UNIX )
+SET(CYGWIN )
+SET(WIN32 )
+
+
+# include Generic system information
+INCLUDE(CMakeGenericSystem)
+
+# 2. now include SystemName.cmake file to set the system specific information
+SET(CMAKE_SYSTEM_INFO_FILE Platform/${CMAKE_SYSTEM_NAME})
+
+INCLUDE(${CMAKE_SYSTEM_INFO_FILE} OPTIONAL RESULT_VARIABLE _INCLUDED_SYSTEM_INFO_FILE)
+
+IF(NOT _INCLUDED_SYSTEM_INFO_FILE)
+ MESSAGE("System is unknown to cmake, create:\n${CMAKE_SYSTEM_INFO_FILE}"
+ " to use this system, please send your config file to "
+ "cmake@www.cmake.org so it can be added to cmake")
+ IF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
+ CONFIGURE_FILE(${CMAKE_BINARY_DIR}/CMakeCache.txt
+ ${CMAKE_BINARY_DIR}/CopyOfCMakeCache.txt COPYONLY)
+ MESSAGE("Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. "
+ "Please send that file to cmake@www.cmake.org.")
+ ENDIF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
+ENDIF(NOT _INCLUDED_SYSTEM_INFO_FILE)
+
+
+# optionally include a file which can do extra-generator specific things, e.g.
+# CMakeFindEclipseCDT4.cmake asks gcc for the system include dirs for the Eclipse CDT4 generator
+IF(CMAKE_EXTRA_GENERATOR)
+ STRING(REPLACE " " "" _CMAKE_EXTRA_GENERATOR_NO_SPACES ${CMAKE_EXTRA_GENERATOR} )
+ INCLUDE("CMakeFind${_CMAKE_EXTRA_GENERATOR_NO_SPACES}" OPTIONAL)
+ENDIF(CMAKE_EXTRA_GENERATOR)
+
+
+# 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
+# this has to be done after the system information has been loaded
+IF(NOT CMAKE_MODULE_EXISTS)
+ SET(CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
+ SET(CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ENDIF(NOT CMAKE_MODULE_EXISTS)
+
+
+SET(CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeTestASM-ATTCompiler.cmake b/Modules/CMakeTestASM-ATTCompiler.cmake
new file mode 100644
index 000000000..581ad0c23
--- /dev/null
+++ b/Modules/CMakeTestASM-ATTCompiler.cmake
@@ -0,0 +1,23 @@
+
+#=============================================================================
+# 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.)
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that the selected ASM-ATT "compiler" works.
+# For assembler this can only check whether the compiler has been found,
+# because otherwise there would have to be a separate assembler source file
+# for each assembler on every architecture.
+
+SET(ASM_DIALECT "-ATT")
+INCLUDE(CMakeTestASMCompiler)
+SET(ASM_DIALECT)
diff --git a/Modules/CMakeTestASMCompiler.cmake b/Modules/CMakeTestASMCompiler.cmake
new file mode 100644
index 000000000..294511d89
--- /dev/null
+++ b/Modules/CMakeTestASMCompiler.cmake
@@ -0,0 +1,35 @@
+
+#=============================================================================
+# 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.)
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that the selected ASM compiler works.
+# For assembler this can only check whether the compiler has been found,
+# because otherwise there would have to be a separate assembler source file
+# for each assembler on every architecture.
+
+
+SET(_ASM_COMPILER_WORKS 0)
+
+IF(CMAKE_ASM${ASM_DIALECT}_COMPILER)
+ SET(_ASM_COMPILER_WORKS 1)
+ENDIF()
+
+# when using generic "ASM" support, we must have detected the compiler ID, fail otherwise:
+IF("ASM${ASM_DIALECT}" STREQUAL "ASM")
+ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
+ SET(_ASM_COMPILER_WORKS 0)
+ ENDIF()
+ENDIF()
+
+SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_WORKS ${_ASM_COMPILER_WORKS} CACHE INTERNAL "")
diff --git a/Modules/CMakeTestASM_MASMCompiler.cmake b/Modules/CMakeTestASM_MASMCompiler.cmake
new file mode 100644
index 000000000..8369b942c
--- /dev/null
+++ b/Modules/CMakeTestASM_MASMCompiler.cmake
@@ -0,0 +1,23 @@
+
+#=============================================================================
+# Copyright 2008-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 used by EnableLanguage in cmGlobalGenerator to
+# determine that the selected ASM_MASM "compiler" (should be masm or masm64)
+# works. For assembler this can only check whether the compiler has been found,
+# because otherwise there would have to be a separate assembler source file
+# for each assembler on every architecture.
+
+SET(ASM_DIALECT "_MASM")
+INCLUDE(CMakeTestASMCompiler)
+SET(ASM_DIALECT)
diff --git a/Modules/CMakeTestASM_NASMCompiler.cmake b/Modules/CMakeTestASM_NASMCompiler.cmake
new file mode 100644
index 000000000..a5e2bea0a
--- /dev/null
+++ b/Modules/CMakeTestASM_NASMCompiler.cmake
@@ -0,0 +1,23 @@
+
+#=============================================================================
+# Copyright 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.)
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that the selected ASM_NASM "compiler" works.
+# For assembler this can only check whether the compiler has been found,
+# because otherwise there would have to be a separate assembler source file
+# for each assembler on every architecture.
+
+SET(ASM_DIALECT "_NASM")
+INCLUDE(CMakeTestASMCompiler)
+SET(ASM_DIALECT)
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
new file mode 100644
index 000000000..779b2f007
--- /dev/null
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -0,0 +1,87 @@
+
+#=============================================================================
+# Copyright 2003-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.)
+
+INCLUDE(CMakeTestCompilerCommon)
+
+# 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_C_COMPILER_WORKS)
+ PrintTestCompilerStatus("C" "")
+ FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c
+ "#ifdef __cplusplus\n"
+ "# error \"The CMAKE_C_COMPILER is set to a C++ compiler\"\n"
+ "#endif\n"
+ "#if defined(__CLASSIC_C__)\n"
+ "int main(argc, argv)\n"
+ " int argc;\n"
+ " char* argv[];\n"
+ "#else\n"
+ "int main(int argc, char* argv[])\n"
+ "#endif\n"
+ "{ (void)argv; return argc-1;}\n")
+ TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c
+ OUTPUT_VARIABLE __CMAKE_C_COMPILER_OUTPUT)
+ SET(C_TEST_WAS_RUN 1)
+ENDIF(NOT CMAKE_C_COMPILER_WORKS)
+
+IF(NOT CMAKE_C_COMPILER_WORKS)
+ PrintTestCompilerStatus("C" " -- broken")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the C compiler works failed with "
+ "the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n")
+ # if the compiler is broken make sure to remove the platform file
+ # since Windows-cl configures both c/cxx files both need to be removed
+ # when c or c++ fails
+ FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake )
+ FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake )
+ MESSAGE(FATAL_ERROR "The C compiler \"${CMAKE_C_COMPILER}\" "
+ "is not able to compile a simple test program.\nIt fails "
+ "with the following output:\n ${__CMAKE_C_COMPILER_OUTPUT}\n\n"
+ "CMake will not be able to correctly generate this project.")
+ELSE(NOT CMAKE_C_COMPILER_WORKS)
+ IF(C_TEST_WAS_RUN)
+ PrintTestCompilerStatus("C" " -- works")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the C compiler works passed with "
+ "the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n")
+ ENDIF(C_TEST_WAS_RUN)
+ SET(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "")
+
+ IF(CMAKE_C_COMPILER_FORCED)
+ # The compiler configuration was forced by the user.
+ # Assume the user has configured all compiler information.
+ ELSE(CMAKE_C_COMPILER_FORCED)
+ # 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)
+ CONFIGURE_FILE(
+ ${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake
+ @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ )
+ INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake)
+ ENDIF(CMAKE_C_COMPILER_FORCED)
+ IF(CMAKE_C_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_C_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_C_ABI_FILES)
+ ENDIF()
+ENDIF(NOT CMAKE_C_COMPILER_WORKS)
+
+UNSET(__CMAKE_C_COMPILER_OUTPUT)
diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake
new file mode 100644
index 000000000..87022e9f9
--- /dev/null
+++ b/Modules/CMakeTestCXXCompiler.cmake
@@ -0,0 +1,80 @@
+
+#=============================================================================
+# Copyright 2003-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.)
+
+INCLUDE(CMakeTestCompilerCommon)
+
+# 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_CXX_COMPILER_WORKS)
+ PrintTestCompilerStatus("CXX" "")
+ FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
+ "#ifndef __cplusplus\n"
+ "# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n"
+ "#endif\n"
+ "int main(){return 0;}\n")
+ TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
+ OUTPUT_VARIABLE __CMAKE_CXX_COMPILER_OUTPUT)
+ SET(CXX_TEST_WAS_RUN 1)
+ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)
+
+IF(NOT CMAKE_CXX_COMPILER_WORKS)
+ PrintTestCompilerStatus("CXX" " -- broken")
+ # if the compiler is broken make sure to remove the platform file
+ # since Windows-cl configures both c/cxx files both need to be removed
+ # when c or c++ fails
+ FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake )
+ FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake )
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the CXX compiler works failed with "
+ "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n")
+ MESSAGE(FATAL_ERROR "The C++ compiler \"${CMAKE_CXX_COMPILER}\" "
+ "is not able to compile a simple test program.\nIt fails "
+ "with the following output:\n ${__CMAKE_CXX_COMPILER_OUTPUT}\n\n"
+ "CMake will not be able to correctly generate this project.")
+ELSE(NOT CMAKE_CXX_COMPILER_WORKS)
+ IF(CXX_TEST_WAS_RUN)
+ PrintTestCompilerStatus("CXX" " -- works")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the CXX compiler works passed with "
+ "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n")
+ ENDIF(CXX_TEST_WAS_RUN)
+ SET(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "")
+
+ IF(CMAKE_CXX_COMPILER_FORCED)
+ # The compiler configuration was forced by the user.
+ # Assume the user has configured all compiler information.
+ ELSE(CMAKE_CXX_COMPILER_FORCED)
+ # 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)
+ CONFIGURE_FILE(
+ ${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake
+ @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ )
+ INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake)
+ ENDIF(CMAKE_CXX_COMPILER_FORCED)
+ IF(CMAKE_CXX_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_CXX_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_CXX_ABI_FILES)
+ ENDIF()
+ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)
+
+UNSET(__CMAKE_CXX_COMPILER_OUTPUT)
diff --git a/Modules/CMakeTestCompilerCommon.cmake b/Modules/CMakeTestCompilerCommon.cmake
new file mode 100644
index 000000000..fd8a105b2
--- /dev/null
+++ b/Modules/CMakeTestCompilerCommon.cmake
@@ -0,0 +1,21 @@
+
+#=============================================================================
+# Copyright 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.)
+
+function(PrintTestCompilerStatus LANG MSG)
+ IF(CMAKE_GENERATOR MATCHES Make)
+ MESSAGE(STATUS "Check for working ${LANG} compiler: ${CMAKE_${LANG}_COMPILER}${MSG}")
+ ELSE()
+ MESSAGE(STATUS "Check for working ${LANG} compiler using: ${CMAKE_GENERATOR}${MSG}")
+ ENDIF()
+endfunction()
diff --git a/Modules/CMakeTestForFreeVC.cxx b/Modules/CMakeTestForFreeVC.cxx
new file mode 100644
index 000000000..e580c1f6b
--- /dev/null
+++ b/Modules/CMakeTestForFreeVC.cxx
@@ -0,0 +1,3 @@
+#include<iostream>
+
+int main(){return 0;}
diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake
new file mode 100644
index 000000000..b4dcea634
--- /dev/null
+++ b/Modules/CMakeTestFortranCompiler.cmake
@@ -0,0 +1,101 @@
+
+#=============================================================================
+# 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.)
+
+INCLUDE(CMakeTestCompilerCommon)
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that that selected Fortran 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_Fortran_COMPILER_WORKS)
+ PrintTestCompilerStatus("Fortran" "")
+ FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f "
+ PROGRAM TESTFortran
+ PRINT *, 'Hello'
+ END
+ ")
+ TRY_COMPILE(CMAKE_Fortran_COMPILER_WORKS ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+ OUTPUT_VARIABLE OUTPUT)
+ SET(FORTRAN_TEST_WAS_RUN 1)
+ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS)
+
+IF(NOT CMAKE_Fortran_COMPILER_WORKS)
+ PrintTestCompilerStatus("Fortran" " -- broken")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the Fortran compiler works failed with "
+ "the following output:\n${OUTPUT}\n\n")
+ MESSAGE(FATAL_ERROR "The Fortran compiler \"${CMAKE_Fortran_COMPILER}\" "
+ "is not able to compile a simple test program.\nIt fails "
+ "with the following output:\n ${OUTPUT}\n\n"
+ "CMake will not be able to correctly generate this project.")
+ELSE(NOT CMAKE_Fortran_COMPILER_WORKS)
+ IF(FORTRAN_TEST_WAS_RUN)
+ PrintTestCompilerStatus("Fortran" " -- works")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the Fortran compiler works passed with "
+ "the following output:\n${OUTPUT}\n\n")
+ ENDIF(FORTRAN_TEST_WAS_RUN)
+ SET(CMAKE_Fortran_COMPILER_WORKS 1 CACHE INTERNAL "")
+
+ IF(CMAKE_Fortran_COMPILER_FORCED)
+ # The compiler configuration was forced by the user.
+ # Assume the user has configured all compiler information.
+ ELSE(CMAKE_Fortran_COMPILER_FORCED)
+ # Try to identify the ABI and configure it into CMakeFortranCompiler.cmake
+ INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
+ CMAKE_DETERMINE_COMPILER_ABI(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F)
+
+ # Test for Fortran 90 support by using an f90-specific construct.
+ IF(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90")
+ FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 "
+ PROGRAM TESTFortran90
+ stop = 1 ; do while ( stop .eq. 0 ) ; end do
+ END PROGRAM TESTFortran90
+")
+ TRY_COMPILE(CMAKE_Fortran_COMPILER_SUPPORTS_F90 ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90
+ OUTPUT_VARIABLE OUTPUT)
+ IF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- yes")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the Fortran compiler supports Fortran 90 passed with "
+ "the following output:\n${OUTPUT}\n\n")
+ SET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1)
+ ELSE(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- no")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the Fortran compiler supports Fortran 90 failed with "
+ "the following output:\n${OUTPUT}\n\n")
+ SET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 0)
+ ENDIF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ UNSET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 CACHE)
+ ENDIF(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+
+ CONFIGURE_FILE(
+ ${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake
+ @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
+ )
+ INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake)
+ ENDIF(CMAKE_Fortran_COMPILER_FORCED)
+ IF(CMAKE_Fortran_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_Fortran_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_Fortran_ABI_FILES)
+ ENDIF()
+ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS)
diff --git a/Modules/CMakeTestGNU.c b/Modules/CMakeTestGNU.c
new file mode 100644
index 000000000..933e5a212
--- /dev/null
+++ b/Modules/CMakeTestGNU.c
@@ -0,0 +1,9 @@
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+void THIS_IS_GNU();
+#endif
+#ifdef __MINGW32__
+void THIS_IS_MINGW();
+#endif
+#ifdef __CYGWIN__
+void THIS_IS_CYGWIN();
+#endif
diff --git a/Modules/CMakeTestJavaCompiler.cmake b/Modules/CMakeTestJavaCompiler.cmake
new file mode 100644
index 000000000..cfd3e24b6
--- /dev/null
+++ b/Modules/CMakeTestJavaCompiler.cmake
@@ -0,0 +1,20 @@
+
+#=============================================================================
+# 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.)
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that that selected Fortran 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.
+SET(CMAKE_Java_COMPILER_WORKS 1 CACHE INTERNAL "")
diff --git a/Modules/CMakeTestNMakeCLVersion.c b/Modules/CMakeTestNMakeCLVersion.c
new file mode 100644
index 000000000..3cece2a63
--- /dev/null
+++ b/Modules/CMakeTestNMakeCLVersion.c
@@ -0,0 +1,2 @@
+VERSION=_MSC_VER
+
diff --git a/Modules/CMakeTestRCCompiler.cmake b/Modules/CMakeTestRCCompiler.cmake
new file mode 100644
index 000000000..a5c8d1149
--- /dev/null
+++ b/Modules/CMakeTestRCCompiler.cmake
@@ -0,0 +1,23 @@
+
+#=============================================================================
+# 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.)
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that that selected RC 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.
+
+# For now there is no way to do a try compile on just a .rc file
+# so just do nothing in here.
+SET(CMAKE_RC_COMPILER_WORKS 1 CACHE INTERNAL "")
diff --git a/Modules/CMakeTestWatcomVersion.c b/Modules/CMakeTestWatcomVersion.c
new file mode 100644
index 000000000..0343fb127
--- /dev/null
+++ b/Modules/CMakeTestWatcomVersion.c
@@ -0,0 +1 @@
+VERSION=__WATCOMC__
diff --git a/Modules/CMakeUnixFindMake.cmake b/Modules/CMakeUnixFindMake.cmake
new file mode 100644
index 000000000..39962c0d3
--- /dev/null
+++ b/Modules/CMakeUnixFindMake.cmake
@@ -0,0 +1,16 @@
+
+#=============================================================================
+# 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.)
+
+FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES gmake make smake)
+MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
diff --git a/Modules/CMakeVS10FindMake.cmake b/Modules/CMakeVS10FindMake.cmake
new file mode 100644
index 000000000..695e92f52
--- /dev/null
+++ b/Modules/CMakeVS10FindMake.cmake
@@ -0,0 +1,54 @@
+
+#=============================================================================
+# 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
new file mode 100644
index 000000000..302efaa59
--- /dev/null
+++ b/Modules/CMakeVS11FindMake.cmake
@@ -0,0 +1,54 @@
+
+#=============================================================================
+# 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. 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\\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/CMakeVS6BackwardCompatibility.cmake b/Modules/CMakeVS6BackwardCompatibility.cmake
new file mode 100644
index 000000000..438f64f6c
--- /dev/null
+++ b/Modules/CMakeVS6BackwardCompatibility.cmake
@@ -0,0 +1,26 @@
+
+#=============================================================================
+# 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.)
+
+# hard code these for fast backwards compatibility tests
+SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type")
+SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type")
+SET (CMAKE_SIZEOF_VOID_P 4 CACHE INTERNAL "Size of void* data type")
+SET (CMAKE_SIZEOF_CHAR 1 CACHE INTERNAL "Size of char data type")
+SET (CMAKE_SIZEOF_SHORT 2 CACHE INTERNAL "Size of short data type")
+SET (CMAKE_SIZEOF_FLOAT 4 CACHE INTERNAL "Size of float data type")
+SET (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type")
+SET (CMAKE_NO_ANSI_FOR_SCOPE 1 CACHE INTERNAL
+ "Does the compiler support ansi for scope.")
+SET (CMAKE_USE_WIN32_THREADS TRUE CACHE BOOL "Use the win32 thread library.")
+SET (CMAKE_WORDS_BIGENDIAN 0 CACHE INTERNAL "endianness of bytes")
diff --git a/Modules/CMakeVS6FindMake.cmake b/Modules/CMakeVS6FindMake.cmake
new file mode 100644
index 000000000..dccf8c462
--- /dev/null
+++ b/Modules/CMakeVS6FindMake.cmake
@@ -0,0 +1,25 @@
+
+#=============================================================================
+# 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.)
+
+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)
diff --git a/Modules/CMakeVS71FindMake.cmake b/Modules/CMakeVS71FindMake.cmake
new file mode 100644
index 000000000..2381adb55
--- /dev/null
+++ b/Modules/CMakeVS71FindMake.cmake
@@ -0,0 +1,26 @@
+
+#=============================================================================
+# Copyright 2003-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.)
+
+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)
diff --git a/Modules/CMakeVS7BackwardCompatibility.cmake b/Modules/CMakeVS7BackwardCompatibility.cmake
new file mode 100644
index 000000000..df0b3bb97
--- /dev/null
+++ b/Modules/CMakeVS7BackwardCompatibility.cmake
@@ -0,0 +1,26 @@
+
+#=============================================================================
+# 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.)
+
+# hard code these for fast backwards compatibility tests
+SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type")
+SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type")
+SET (CMAKE_SIZEOF_VOID_P 4 CACHE INTERNAL "Size of void* data type")
+SET (CMAKE_SIZEOF_CHAR 1 CACHE INTERNAL "Size of char data type")
+SET (CMAKE_SIZEOF_SHORT 2 CACHE INTERNAL "Size of short data type")
+SET (CMAKE_SIZEOF_FLOAT 4 CACHE INTERNAL "Size of float data type")
+SET (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type")
+SET (CMAKE_NO_ANSI_FOR_SCOPE 0 CACHE INTERNAL
+ "Does the compiler support ansi for scope.")
+SET (CMAKE_USE_WIN32_THREADS TRUE CACHE BOOL "Use the win32 thread library.")
+SET (CMAKE_WORDS_BIGENDIAN 0 CACHE INTERNAL "endianness of bytes")
diff --git a/Modules/CMakeVS7FindMake.cmake b/Modules/CMakeVS7FindMake.cmake
new file mode 100644
index 000000000..665158c88
--- /dev/null
+++ b/Modules/CMakeVS7FindMake.cmake
@@ -0,0 +1,25 @@
+
+#=============================================================================
+# 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.)
+
+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)
diff --git a/Modules/CMakeVS8FindMake.cmake b/Modules/CMakeVS8FindMake.cmake
new file mode 100644
index 000000000..bb0818014
--- /dev/null
+++ b/Modules/CMakeVS8FindMake.cmake
@@ -0,0 +1,34 @@
+
+#=============================================================================
+# 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(NOT CMAKE_CROSSCOMPILING)
+
+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
new file mode 100644
index 000000000..9e3c39ef3
--- /dev/null
+++ b/Modules/CMakeVS9FindMake.cmake
@@ -0,0 +1,39 @@
+
+#=============================================================================
+# 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(NOT CMAKE_CROSSCOMPILING)
+
+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
new file mode 100644
index 000000000..75783691f
--- /dev/null
+++ b/Modules/CMakeVerifyManifest.cmake
@@ -0,0 +1,115 @@
+# 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 first recursively globs *.manifest files from
+# the current directory. Then globs *.exe and *.dll. Each
+# .exe and .dll is scanned for embeded manifests and the versions
+# of CRT are compared to those found in the .manifest files
+# from the first glob.
+
+#=============================================================================
+# Copyright 2008-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.)
+
+
+# crt_version:
+# function to extract the CRT version from a file
+# this can be passed a .exe, .dll, or a .manifest file
+# it will put the list of versions found into the variable
+# specified by list_var
+function(crt_version file list_var)
+ file(STRINGS "${file}" strings REGEX "Microsoft.VC...CRT" NEWLINE_CONSUME)
+ foreach(s ${strings})
+ set(has_match 1)
+ string(REGEX
+ REPLACE ".*<assembly.*\"Microsoft.VC...CRT\".*version=\"([^\"]*)\".*</assembly>.*$" "\\1"
+ version "${s}")
+ if(NOT "${version}" STREQUAL "")
+ list(APPEND version_list ${version})
+ else()
+ message(FATAL_ERROR "Parse error could not find version in [${s}]")
+ endif()
+ endforeach(s)
+ if(NOT DEFINED has_match)
+ message("Information: no embeded manifest in: ${file}")
+ return()
+ endif()
+ list(APPEND version_list ${${list_var}})
+ list(REMOVE_DUPLICATES version_list)
+ if(version_list)
+ set(${list_var} ${version_list} PARENT_SCOPE)
+ endif()
+endfunction(crt_version)
+set(fatal_error FALSE)
+
+# check_version:
+#
+# test a file against the shipped manifest versions
+# for a directory
+function(check_version file manifest_versions)
+ set(manifest_versions ${manifest_versions} ${allow_versions})
+ # collect versions for a given file
+ crt_version(${file} file_versions)
+ # see if the versions
+ foreach(ver ${file_versions})
+ list(FIND manifest_versions "${ver}" found_version)
+ if("${found_version}" EQUAL -1)
+ message("ERROR: ${file} uses ${ver} not found in shipped manifests:[${manifest_versions}].")
+ set(fatal_error TRUE PARENT_SCOPE)
+ endif()
+ endforeach(ver)
+ list(LENGTH file_versions len)
+ if(${len} GREATER 1)
+ message("WARNING: found more than one version of MICROSOFT.VC80.CRT referenced in ${file}: [${file_versions}]")
+ endif()
+endfunction()
+
+# collect up the versions of CRT that are shipped
+# in .manifest files
+set(manifest_version_list )
+file(GLOB_RECURSE manifest_files "*.manifest")
+foreach(f ${manifest_files})
+ crt_version("${f}" manifest_version_list)
+endforeach(f)
+list(LENGTH manifest_version_list LEN)
+if(LEN EQUAL 0)
+ message(FATAL_ERROR "No .manifest files found, no version check can be done.")
+endif()
+message("Versions found in ${manifest_files}: ${manifest_version_list}")
+if(DEFINED allow_versions)
+ message("Extra versions allowed: ${allow_versions}")
+endif()
+
+# now find all .exe and .dll files
+# and call check_version on each of them
+file(GLOB_RECURSE exe_files "*.exe")
+file(GLOB_RECURSE dll_files "*.dll")
+set(exe_files ${exe_files} ${dll_files})
+foreach(f ${exe_files})
+ check_version(${f} "${manifest_version_list}")
+endforeach()
+
+# report a fatal error if there were any so that cmake will return
+# a non zero value
+if(fatal_error)
+ message(FATAL_ERROR "This distribution embeds dll "
+ " versions that it does not ship, and may not work on other machines.")
+endif()
diff --git a/Modules/CPack.DS_Store.in b/Modules/CPack.DS_Store.in
new file mode 100644
index 000000000..5be0eeb18
--- /dev/null
+++ b/Modules/CPack.DS_Store.in
Binary files differ
diff --git a/Modules/CPack.Description.plist.in b/Modules/CPack.Description.plist.in
new file mode 100644
index 000000000..3d1147686
--- /dev/null
+++ b/Modules/CPack.Description.plist.in
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.4">
+<dict>
+ <key>IFPkgDescriptionTitle</key>
+ <string>@CPACK_PACKAGE_NAME@</string>
+ <key>IFPkgDescriptionVersion</key>
+ <string>@CPACK_PACKAGE_VERSION@</string>
+ <key>IFPkgDescriptionDescription</key>
+ <string>@CPACK_PACKAGE_DESCRIPTION@</string>
+</dict>
+</plist>
diff --git a/Modules/CPack.Info.plist.in b/Modules/CPack.Info.plist.in
new file mode 100644
index 000000000..6e325001c
--- /dev/null
+++ b/Modules/CPack.Info.plist.in
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+
+<plist version="1.0">
+<dict>
+<key>IFMajorVersion</key>
+<integer>@CPACK_PACKAGE_VERSION_MAJOR@</integer>
+<key>IFMinorVersion</key>
+<integer>@CPACK_PACKAGE_VERSION_MINOR@</integer>
+<key>IFPkgFlagAllowBackRev</key>
+<false/>
+<key>IFPkgFlagAuthorizationAction</key>
+<string>AdminAuthorization</string>
+<key>IFPkgFlagDefaultLocation</key>
+<string>@CPACK_PACKAGE_DEFAULT_LOCATION@</string>
+<key>IFPkgFlagInstallFat</key>
+<false/>
+<key>IFPkgFlagIsRequired</key>
+<false/>
+<key>IFPkgFlagOverwritePermissions</key>
+<true/>
+<key>IFPkgFlagRelocatable</key>
+<@CPACK_PACKAGE_RELOCATABLE@/>
+<key>IFPkgFlagRestartAction</key>
+<string>NoRestart</string>
+<key>IFPkgFlagRootVolumeOnly</key>
+<false/>
+<key>IFPkgFlagUpdateInstalledLanguages</key>
+<false/>
+<key>IFPkgFlagUseUserMask</key>
+<false/>
+<key>IFPkgFormatVersion</key>
+<real>0.10000000149011612</real>
+<key>CFBundleIdentifier</key>
+<string>com.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@</string>
+</dict>
+</plist>
diff --git a/Modules/CPack.OSXScriptLauncher.in b/Modules/CPack.OSXScriptLauncher.in
new file mode 100755
index 000000000..c71586046
--- /dev/null
+++ b/Modules/CPack.OSXScriptLauncher.in
Binary files differ
diff --git a/Modules/CPack.OSXScriptLauncher.rsrc.in b/Modules/CPack.OSXScriptLauncher.rsrc.in
new file mode 100644
index 000000000..5f5f17a1c
--- /dev/null
+++ b/Modules/CPack.OSXScriptLauncher.rsrc.in
Binary files differ
diff --git a/Modules/CPack.OSXX11.Info.plist.in b/Modules/CPack.OSXX11.Info.plist.in
new file mode 100644
index 000000000..851b67ba8
--- /dev/null
+++ b/Modules/CPack.OSXX11.Info.plist.in
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>@CPACK_FILE_ASSOCIATION_EXTENSION@</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>@CPACK_FILE_ASSOCIATION_TYPE@</string>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>@CPACK_PACKAGE_FILE_NAME@</string>
+ <key>CFBundleGetInfoString</key>
+ <string>@CPACK_APPLE_GUI_INFO_STRING@</string>
+ <key>CFBundleIconFile</key>
+ <string>@CPACK_APPLE_GUI_ICON@</string>
+ <key>CFBundleIdentifier</key>
+ <string>@CPACK_APPLE_GUI_IDENTIFIER@</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleLongVersionString</key>
+ <string>@CPACK_APPLE_GUI_LONG_VERSION_STRING@</string>
+ <key>CFBundleName</key>
+ <string>@CPACK_APPLE_GUI_BUNDLE_NAME@</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>@CPACK_APPLE_GUI_SHORT_VERSION_STRING@</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>@CPACK_APPLE_GUI_BUNDLE_VERSION@</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+ <key>LSRequiresCarbon</key>
+ <true/>
+ <key>NSHumanReadableCopyright</key>
+ <string>@CPACK_APPLE_GUI_COPYRIGHT@</string>
+</dict>
+</plist>
diff --git a/Modules/CPack.OSXX11.main.scpt.in b/Modules/CPack.OSXX11.main.scpt.in
new file mode 100644
index 000000000..de30ea11b
--- /dev/null
+++ b/Modules/CPack.OSXX11.main.scpt.in
Binary files differ
diff --git a/Modules/CPack.RuntimeScript.in b/Modules/CPack.RuntimeScript.in
new file mode 100755
index 000000000..f27444fd9
--- /dev/null
+++ b/Modules/CPack.RuntimeScript.in
@@ -0,0 +1,87 @@
+#!/bin/sh
+#
+# Modified from: Aaron Voisine <aaron@voisine.org>
+
+CWD="`dirname \"$0\"`"
+TMP=/tmp/$(id -ru)/TemporaryItems
+
+version=`sw_vers -productVersion`
+if [ "$?" = "0" ]; then
+ major=${version%%\.*}
+ rest=${version#*\.}
+ minor=${rest%%\.*}
+ build=${rest#*\.}
+else
+ major=10
+ minor=4
+ build=0
+fi
+
+echo $version
+echo "Major = $major"
+echo "Minor = $minor"
+echo "Build = $build"
+
+
+# if 10.5 or greater, then all the open-x11 stuff need not occur
+if [ "$major" -lt 10 ] || ([ "$major" -eq 10 ] && [ "$minor" -lt 5 ]); then
+version=`sw_vers -productVersion`
+if [ "$?" = "0" ]; then
+ major=${version%%\.*}
+ rest=${version#*\.}
+ minor=${rest%%\.*}
+ build=${rest#*\.}
+else
+ major=10
+ minor=4
+ build=0
+fi
+
+echo $version
+echo "Major = $major"
+echo "Minor = $minor"
+echo "Build = $build"
+
+
+# if 10.5 or greater, then all the open-x11 stuff need not occur
+if [ "$major" -lt 10 ] || ([ "$major" -eq 10 ] && [ "$minor" -lt 5 ]); then
+ps -wx -ocommand | grep -e '[X]11.app' > /dev/null
+if [ "$?" != "0" -a ! -f ~/.xinitrc ]; then
+ echo "rm -f ~/.xinitrc" > ~/.xinitrc
+ sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> ~/.xinitrc
+fi
+
+mkdir -p $TMP
+cat << __END_OF_GETDISPLAY_SCRIPT__ > "$TMP/getdisplay.sh"
+#!/bin/sh
+mkdir -p "$TMP"
+
+if [ "\$DISPLAY"x = "x" ]; then
+ echo :0 > "$TMP/display"
+else
+ echo \$DISPLAY > "$TMP/display"
+fi
+__END_OF_GETDISPLAY_SCRIPT__
+fi
+chmod +x "$TMP/getdisplay.sh"
+rm -f $TMP/display
+open-x11 $TMP/getdisplay.sh || \
+open -a XDarwin $TMP/getdisplay.sh || \
+echo ":0" > $TMP/display
+
+while [ "$?" = "0" -a ! -f $TMP/display ];
+do
+ #echo "Waiting for display $TMP/display"
+ sleep 1;
+done
+export "DISPLAY=`cat $TMP/display`"
+
+ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
+
+cd ~/
+echo "$@" > /tmp/arguments.log
+if echo $1 | grep -- "^-psn_"; then
+ shift
+fi
+fi
+exec "$CWD/bin/@CPACK_EXECUTABLE_NAME@" "$@" > /tmp/slicer.output 2>&1
diff --git a/Modules/CPack.STGZ_Header.sh.in b/Modules/CPack.STGZ_Header.sh.in
new file mode 100755
index 000000000..dee576fb5
--- /dev/null
+++ b/Modules/CPack.STGZ_Header.sh.in
@@ -0,0 +1,141 @@
+#!/bin/sh
+
+# Display usage
+cpack_usage()
+{
+ cat <<EOF
+Usage: $0 [options]
+Options: [defaults in brackets after descriptions]
+ --help print this message
+ --prefix=dir directory in which to install
+ --include-subdir include the @CPACK_PACKAGE_FILE_NAME@ subdirectory
+ --exclude-subdir exclude the @CPACK_PACKAGE_FILE_NAME@ subdirectory
+EOF
+ exit 1
+}
+
+cpack_echo_exit()
+{
+ echo $1
+ exit 1
+}
+
+# Display version
+cpack_version()
+{
+ echo "@CPACK_PACKAGE_NAME@ Installer Version: @CPACK_PACKAGE_VERSION@, Copyright (c) @CPACK_PACKAGE_VENDOR@"
+}
+
+# Helper function to fix windows paths.
+cpack_fix_slashes ()
+{
+ echo "$1" | sed 's/\\/\//g'
+}
+
+interactive=TRUE
+cpack_skip_license=FALSE
+cpack_include_subdir=""
+for a in "$@CPACK_AT_SIGN@"; do
+ if echo $a | grep "^--prefix=" > /dev/null 2> /dev/null; then
+ cpack_prefix_dir=`echo $a | sed "s/^--prefix=//"`
+ cpack_prefix_dir=`cpack_fix_slashes "${cpack_prefix_dir}"`
+ fi
+ if echo $a | grep "^--help" > /dev/null 2> /dev/null; then
+ cpack_usage
+ fi
+ if echo $a | grep "^--version" > /dev/null 2> /dev/null; then
+ cpack_version
+ exit 2
+ fi
+ if echo $a | grep "^--include-subdir" > /dev/null 2> /dev/null; then
+ cpack_include_subdir=TRUE
+ fi
+ if echo $a | grep "^--exclude-subdir" > /dev/null 2> /dev/null; then
+ cpack_include_subdir=FALSE
+ fi
+ if echo $a | grep "^--skip-license" > /dev/null 2> /dev/null; then
+ cpack_skip_license=TRUE
+ fi
+done
+
+if [ "x${cpack_include_subdir}x" != "xx" -o "x${cpack_skip_license}x" = "xTRUEx" ]
+then
+ interactive=FALSE
+fi
+
+cpack_version
+echo "This is a self-extracting archive."
+toplevel="`pwd`"
+if [ "x${cpack_prefix_dir}x" != "xx" ]
+then
+ toplevel="${cpack_prefix_dir}"
+fi
+
+echo "The archive will be extracted to: ${toplevel}"
+
+if [ "x${interactive}x" = "xTRUEx" ]
+then
+ echo ""
+ echo "If you want to stop extracting, please press <ctrl-C>."
+
+ if [ "x${cpack_skip_license}x" != "xTRUEx" ]
+ then
+ more << '____cpack__here_doc____'
+@CPACK_RESOURCE_FILE_LICENSE_CONTENT@
+____cpack__here_doc____
+ echo
+ echo "Do you accept the license? [yN]: "
+ read line leftover
+ case ${line} in
+ y* | Y*)
+ cpack_license_accepted=TRUE;;
+ *)
+ echo "License not accepted. Exiting ..."
+ exit 1;;
+ esac
+ fi
+
+ if [ "x${cpack_include_subdir}x" = "xx" ]
+ then
+ echo "By default the @CPACK_PACKAGE_NAME@ will be installed in:"
+ echo " \"${toplevel}/@CPACK_PACKAGE_FILE_NAME@\""
+ echo "Do you want to include the subdirectory @CPACK_PACKAGE_FILE_NAME@?"
+ echo "Saying no will install in: \"${toplevel}\" [Yn]: "
+ read line leftover
+ cpack_include_subdir=TRUE
+ case ${line} in
+ n* | N*)
+ cpack_include_subdir=FALSE
+ esac
+ fi
+fi
+
+if [ "x${cpack_include_subdir}x" = "xTRUEx" ]
+then
+ toplevel="${toplevel}/@CPACK_PACKAGE_FILE_NAME@"
+ mkdir -p "${toplevel}"
+fi
+echo
+echo "Using target directory: ${toplevel}"
+echo "Extracting, please wait..."
+echo ""
+
+# take the archive portion of this file and pipe it to tar
+# the NUMERIC parameter in this command should be one more
+# than the number of lines in this header file
+# there are tails which don't understand the "-n" argument, e.g. on SunOS
+# OTOH there are tails which complain when not using the "-n" argument (e.g. GNU)
+# so at first try to tail some file to see if tail fails if used with "-n"
+# if so, don't use "-n"
+use_new_tail_syntax="-n"
+tail $use_new_tail_syntax +1 "$0" > /dev/null 2> /dev/null || use_new_tail_syntax=""
+
+tail $use_new_tail_syntax +###CPACK_HEADER_LENGTH### "$0" | gunzip | (cd "${toplevel}" && tar xf -) || cpack_echo_exit "Problem unpacking the @CPACK_PACKAGE_FILE_NAME@"
+
+echo "Unpacking finished successfully"
+
+exit 0
+#-----------------------------------------------------------
+# Start of TAR.GZ file
+#-----------------------------------------------------------;
+
diff --git a/Modules/CPack.VolumeIcon.icns.in b/Modules/CPack.VolumeIcon.icns.in
new file mode 100644
index 000000000..c59217eae
--- /dev/null
+++ b/Modules/CPack.VolumeIcon.icns.in
Binary files differ
diff --git a/Modules/CPack.background.png.in b/Modules/CPack.background.png.in
new file mode 100644
index 000000000..9339e7cad
--- /dev/null
+++ b/Modules/CPack.background.png.in
Binary files differ
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
new file mode 100644
index 000000000..657595731
--- /dev/null
+++ b/Modules/CPack.cmake
@@ -0,0 +1,579 @@
+##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
+# package_source, which build the binary and source installers,
+# 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.
+#
+# 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.
+#
+# 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.
+#
+# 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
+# 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
+# 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
+#
+# 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
+#
+# 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.
+##end
+##variable
+# CPACK_CREATE_DESKTOP_LINKS - List of desktop links to create.
+##end
+#
+
+#=============================================================================
+# Copyright 2006-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.)
+
+# Define this var in order to avoid (or warn) concerning multiple inclusion
+IF(CPack_CMake_INCLUDED)
+ MESSAGE(WARNING "CPack.cmake has already been included!!")
+ELSE(CPack_CMake_INCLUDED)
+ SET(CPack_CMake_INCLUDED 1)
+ENDIF(CPack_CMake_INCLUDED)
+
+# Pick a configuration file
+SET(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
+IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
+ SET(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
+ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
+SET(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
+IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
+ SET(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
+ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
+
+# Backward compatibility
+# Include CPackComponent macros if it has not already been included before.
+include(CPackComponent)
+
+# Macro for setting values if a user did not overwrite them
+MACRO(cpack_set_if_not_set name value)
+ IF(NOT DEFINED "${name}")
+ SET(${name} "${value}")
+ ENDIF(NOT DEFINED "${name}")
+ENDMACRO(cpack_set_if_not_set)
+
+# cpack_encode_variables - Macro 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_)
+ GET_CMAKE_PROPERTY(res VARIABLES)
+ FOREACH(var ${res})
+ IF("xxx${var}" MATCHES "xxxCPACK")
+ SET(_CPACK_OTHER_VARIABLES_
+ "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")")
+ ENDIF("xxx${var}" MATCHES "xxxCPACK")
+ ENDFOREACH(var ${res})
+ENDMACRO(cpack_encode_variables)
+
+# 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_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
+ "${CMAKE_PROJECT_NAME} built using CMake")
+
+cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_FILE
+ "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
+cpack_set_if_not_set(CPACK_RESOURCE_FILE_LICENSE
+ "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
+cpack_set_if_not_set(CPACK_RESOURCE_FILE_README
+ "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
+cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME
+ "${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt")
+
+cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
+
+IF(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL)
+ SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
+ENDIF(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL)
+
+IF(CPACK_NSIS_MODIFY_PATH)
+ SET(CPACK_NSIS_MODIFY_PATH ON)
+ENDIF(CPACK_NSIS_MODIFY_PATH)
+
+SET(__cpack_system_name ${CMAKE_SYSTEM_NAME})
+IF(${__cpack_system_name} MATCHES Windows)
+ IF(CMAKE_CL_64)
+ SET(__cpack_system_name win64)
+ ELSE(CMAKE_CL_64)
+ SET(__cpack_system_name win32)
+ ENDIF(CMAKE_CL_64)
+ENDIF(${__cpack_system_name} MATCHES Windows)
+cpack_set_if_not_set(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}")
+
+# <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
+cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME
+ "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
+cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY
+ "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
+cpack_set_if_not_set(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")
+
+# always force to exactly "true" or "false" for CPack.Info.plist.in:
+if(CPACK_PACKAGE_RELOCATABLE)
+ set(CPACK_PACKAGE_RELOCATABLE "true")
+else(CPACK_PACKAGE_RELOCATABLE)
+ set(CPACK_PACKAGE_RELOCATABLE "false")
+endif(CPACK_PACKAGE_RELOCATABLE)
+
+macro(cpack_check_file_exists file description)
+ if(NOT EXISTS "${file}")
+ message(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.")
+ endif(NOT EXISTS "${file}")
+endmacro(cpack_check_file_exists)
+
+cpack_check_file_exists("${CPACK_PACKAGE_DESCRIPTION_FILE}" "package description")
+cpack_check_file_exists("${CPACK_RESOURCE_FILE_LICENSE}" "license resource")
+cpack_check_file_exists("${CPACK_RESOURCE_FILE_README}" "readme resource")
+cpack_check_file_exists("${CPACK_RESOURCE_FILE_WELCOME}" "welcome resource")
+
+macro(cpack_optional_append _list _cond _item)
+ if(${_cond})
+ set(${_list} ${${_list}} ${_item})
+ endif(${_cond})
+endmacro(cpack_optional_append _list _cond _item)
+
+##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
+if(NOT CPACK_GENERATOR)
+ if(UNIX)
+ if(CYGWIN)
+ option(CPACK_BINARY_CYGWIN "Enable to build Cygwin binary packages" ON)
+ else(CYGWIN)
+ 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)
+ else(APPLE)
+ option(CPACK_BINARY_TZ "Enable to build TZ packages" ON)
+ endif(APPLE)
+ 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)
+ endif(CYGWIN)
+ else(UNIX)
+ option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
+ option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF)
+ endif(UNIX)
+
+ 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_NSIS NSIS)
+ 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_TZ TZ)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP)
+
+endif(NOT CPACK_GENERATOR)
+
+# Provide options to choose source generators
+if(NOT CPACK_SOURCE_GENERATOR)
+ if(UNIX)
+ if(CYGWIN)
+ option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON)
+ else(CYGWIN)
+ 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_TZ "Enable to build TZ source packages" ON)
+ option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF)
+ endif(CYGWIN)
+ else(UNIX)
+ option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON)
+ endif(UNIX)
+
+ 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_TZ TZ)
+ cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP)
+endif(NOT CPACK_SOURCE_GENERATOR)
+
+# 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_ZIP CPACK_BINARY_BUNDLE
+ CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
+ CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
+
+# Set some other variables
+cpack_set_if_not_set(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}")
+# if the user has set CPACK_NSIS_DISPLAY_NAME remember it
+if(DEFINED CPACK_NSIS_DISPLAY_NAME)
+ SET(CPACK_NSIS_DISPLAY_NAME_SET TRUE)
+endif()
+# if the user has set CPACK_NSIS_DISPLAY
+# 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}")
+
+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}")
+else()
+ cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+endif()
+
+cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE
+ "${CMAKE_BINARY_DIR}/CPackConfig.cmake")
+
+cpack_set_if_not_set(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_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
+cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
+
+IF(DEFINED CPACK_COMPONENTS_ALL)
+ IF(CPACK_MONOLITHIC_INSTALL)
+ MESSAGE("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.")
+ SET(CPACK_COMPONENTS_ALL)
+ ELSE(CPACK_MONOLITHIC_INSTALL)
+ # The user has provided the set of components to be installed as
+ # part of a component-based installation; trust her.
+ SET(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE)
+ ENDIF(CPACK_MONOLITHIC_INSTALL)
+ELSE(DEFINED CPACK_COMPONENTS_ALL)
+ # If the user has not specifically requested a monolithic installer
+ # but has specified components in various "install" commands, tell
+ # CPack about those components.
+ IF(NOT CPACK_MONOLITHIC_INSTALL)
+ GET_CMAKE_PROPERTY(CPACK_COMPONENTS_ALL COMPONENTS)
+ LIST(LENGTH CPACK_COMPONENTS_ALL CPACK_COMPONENTS_LEN)
+ IF(CPACK_COMPONENTS_LEN EQUAL 1)
+ # Only one component: this is not a component-based installation
+ # (at least, it isn't a component-based installation, but may
+ # become one later if the user uses the cpack_add_* commands).
+ SET(CPACK_COMPONENTS_ALL)
+ ENDIF(CPACK_COMPONENTS_LEN EQUAL 1)
+ SET(CPACK_COMPONENTS_LEN)
+ ENDIF(NOT CPACK_MONOLITHIC_INSTALL)
+ENDIF(DEFINED CPACK_COMPONENTS_ALL)
+
+# CMake always generates a component named "Unspecified", which is
+# used to install everything that doesn't have an explicitly-provided
+# component. Since these files should always be installed, we'll make
+# them hidden and required.
+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)
+
+# Generate source file
+cpack_set_if_not_set(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_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")
+cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES
+ "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#")
+SET(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")
+SET(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}")
+SET(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}")
+SET(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}")
+SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
+SET(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}")
+SET(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}")
+
+cpack_encode_variables()
+configure_file("${cpack_source_input_file}"
+ "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)
diff --git a/Modules/CPack.distribution.dist.in b/Modules/CPack.distribution.dist.in
new file mode 100644
index 000000000..f20e66c17
--- /dev/null
+++ b/Modules/CPack.distribution.dist.in
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<installer-gui-script minSpecVersion="1.0">
+ <title>@CPACK_PACKAGE_NAME@</title>
+ <welcome file="@CPACK_RESOURCE_FILE_WELCOME_NOPATH@"/>
+ <readme file="@CPACK_RESOURCE_FILE_README_NOPATH@"/>
+ <license file="@CPACK_RESOURCE_FILE_LICENSE_NOPATH@"/>
+ <options allow-external-scripts="no" customize="allow" rootVolumeOnly="false"></options>
+ @CPACK_PACKAGEMAKER_CHOICES@
+</installer-gui-script>
diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake
new file mode 100644
index 000000000..0da51e30b
--- /dev/null
+++ b/Modules/CPackBundle.cmake
@@ -0,0 +1,48 @@
+##section Variables specific to CPack Bundle generator
+##end
+##module
+# - CPack Bundle generator (Mac OS X) specific options
+#
+# 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
+
+#=============================================================================
+# Copyright 2006-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.)
+
+#Bundle Generator specific code should be put here
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake
new file mode 100644
index 000000000..15987030e
--- /dev/null
+++ b/Modules/CPackComponent.cmake
@@ -0,0 +1,513 @@
+##section Variables concerning CPack Components
+##end
+##module
+# - Build binary and source package installers
+#
+# 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.
+#
+# 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
+# inconsitent 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
+
+#=============================================================================
+# Copyright 2006-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.)
+
+# Define var in order to avoid multiple inclusion
+IF(NOT CPackComponent_CMake_INCLUDED)
+SET(CPackComponent_CMake_INCLUDED 1)
+
+# Argument-parsing macro from http://www.cmake.org/Wiki/CMakeMacroParseArguments
+MACRO(cpack_parse_arguments prefix arg_names option_names)
+ SET(${prefix}_DEFAULT_ARGS)
+ FOREACH(arg_name ${arg_names})
+ SET(${prefix}_${arg_name})
+ ENDFOREACH(arg_name)
+ FOREACH(option ${option_names})
+ SET(${prefix}_${option} FALSE)
+ ENDFOREACH(option)
+
+ SET(current_arg_name DEFAULT_ARGS)
+ SET(current_arg_list)
+ FOREACH(arg ${ARGN})
+ SET(larg_names ${arg_names})
+ LIST(FIND larg_names "${arg}" is_arg_name)
+ IF (is_arg_name GREATER -1)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ SET(current_arg_name ${arg})
+ SET(current_arg_list)
+ ELSE (is_arg_name GREATER -1)
+ SET(loption_names ${option_names})
+ LIST(FIND loption_names "${arg}" is_option)
+ IF (is_option GREATER -1)
+ SET(${prefix}_${arg} TRUE)
+ ELSE (is_option GREATER -1)
+ SET(current_arg_list ${current_arg_list} ${arg})
+ ENDIF (is_option GREATER -1)
+ ENDIF (is_arg_name GREATER -1)
+ ENDFOREACH(arg)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ENDMACRO(cpack_parse_arguments)
+
+# Macro that appends a SET command for the given variable name (var)
+# to the macro named strvar, but only if the variable named "var"
+# has been defined. The string will eventually be appended to a CPack
+# configuration file.
+MACRO(cpack_append_variable_set_command var strvar)
+ IF (DEFINED ${var})
+ SET(${strvar} "${${strvar}}SET(${var}")
+ FOREACH(APPENDVAL ${${var}})
+ SET(${strvar} "${${strvar}} ${APPENDVAL}")
+ ENDFOREACH(APPENDVAL)
+ SET(${strvar} "${${strvar}})\n")
+ ENDIF (DEFINED ${var})
+ENDMACRO(cpack_append_variable_set_command)
+
+# Macro that appends a SET command for the given variable name (var)
+# to the macro named strvar, but only if the variable named "var"
+# has been defined and is a string. The string will eventually be
+# appended to a CPack configuration file.
+MACRO(cpack_append_string_variable_set_command var strvar)
+ IF (DEFINED ${var})
+ LIST(LENGTH ${var} CPACK_APP_VALUE_LEN)
+ IF(${CPACK_APP_VALUE_LEN} EQUAL 1)
+ SET(${strvar} "${${strvar}}SET(${var} \"${${var}}\")\n")
+ ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1)
+ ENDIF (DEFINED ${var})
+ENDMACRO(cpack_append_string_variable_set_command)
+
+# Macro that appends a SET command for the given variable name (var)
+# to the macro named strvar, but only if the variable named "var"
+# has been set to true. The string will eventually be
+# appended to a CPack configuration file.
+MACRO(cpack_append_option_set_command var strvar)
+ IF (${var})
+ LIST(LENGTH ${var} CPACK_APP_VALUE_LEN)
+ IF(${CPACK_APP_VALUE_LEN} EQUAL 1)
+ SET(${strvar} "${${strvar}}SET(${var} TRUE)\n")
+ ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1)
+ ENDIF (${var})
+ENDMACRO(cpack_append_option_set_command)
+
+# 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}
+ "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")
+ else ()
+ SET(CPACK_ADDCOMP_STR "\n# Configuration for component \"${compname}\"\n")
+ endif ()
+
+ IF(NOT CPACK_MONOLITHIC_INSTALL)
+ # If the user didn't set CPACK_COMPONENTS_ALL explicitly, update the
+ # value of CPACK_COMPONENTS_ALL in the configuration file. This will
+ # 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}")
+ ENDFOREACH(COMP)
+ SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR})\n")
+ ENDIF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER)
+ ENDIF(NOT CPACK_MONOLITHIC_INSTALL)
+
+ cpack_append_string_variable_set_command(
+ 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_append_variable_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_GROUP
+ CPACK_ADDCOMP_STR)
+ cpack_append_variable_set_command(
+ 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_append_string_variable_set_command(
+ 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_append_option_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_REQUIRED
+ CPACK_ADDCOMP_STR)
+ cpack_append_option_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISABLED
+ CPACK_ADDCOMP_STR)
+ cpack_append_option_set_command(
+ 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}")
+ ENDIF(CPack_CMake_INCLUDED)
+ENDMACRO(cpack_add_component)
+
+# Macro that adds a component group to the CPack installer
+MACRO(cpack_add_component_group grpname)
+ STRING(TOUPPER ${grpname} CPACK_ADDGRP_UNAME)
+ cpack_parse_arguments(CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}
+ "DISPLAY_NAME;DESCRIPTION"
+ "EXPANDED;BOLD_TITLE"
+ ${ARGN}
+ )
+
+ SET(CPACK_ADDGRP_STR "\n# Configuration for component group \"${grpname}\"\n")
+ cpack_append_string_variable_set_command(
+ CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DISPLAY_NAME
+ CPACK_ADDGRP_STR)
+ cpack_append_string_variable_set_command(
+ CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION
+ CPACK_ADDGRP_STR)
+ cpack_append_option_set_command(
+ CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED
+ CPACK_ADDGRP_STR)
+ cpack_append_option_set_command(
+ CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_BOLD_TITLE
+ CPACK_ADDGRP_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_ADDGRP_STR}")
+ ENDIF(CPack_CMake_INCLUDED)
+ENDMACRO(cpack_add_component_group)
+
+# Macro that adds an installation type to the CPack installer
+MACRO(cpack_add_install_type insttype)
+ STRING(TOUPPER ${insttype} CPACK_INSTTYPE_UNAME)
+ cpack_parse_arguments(CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}
+ "DISPLAY_NAME"
+ ""
+ ${ARGN}
+ )
+
+ SET(CPACK_INSTTYPE_STR
+ "\n# Configuration for installation type \"${insttype}\"\n")
+ SET(CPACK_INSTTYPE_STR
+ "${CPACK_INSTTYPE_STR}LIST(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n")
+ cpack_append_string_variable_set_command(
+ CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}_DISPLAY_NAME
+ CPACK_INSTTYPE_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_INSTTYPE_STR}")
+ ENDIF(CPack_CMake_INCLUDED)
+ENDMACRO(cpack_add_install_type)
+
+MACRO(cpack_configure_downloads site)
+ cpack_parse_arguments(CPACK_DOWNLOAD
+ "UPLOAD_DIRECTORY"
+ "ALL;ADD_REMOVE;NO_ADD_REMOVE"
+ ${ARGN}
+ )
+
+ SET(CPACK_CONFIG_DL_STR
+ "\n# Downloaded components configuration\n")
+ SET(CPACK_UPLOAD_DIRECTORY ${CPACK_DOWNLOAD_UPLOAD_DIRECTORY})
+ SET(CPACK_DOWNLOAD_SITE ${site})
+ cpack_append_string_variable_set_command(
+ CPACK_DOWNLOAD_SITE
+ CPACK_CONFIG_DL_STR)
+ cpack_append_string_variable_set_command(
+ CPACK_UPLOAD_DIRECTORY
+ CPACK_CONFIG_DL_STR)
+ cpack_append_option_set_command(
+ CPACK_DOWNLOAD_ALL
+ CPACK_CONFIG_DL_STR)
+ IF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE})
+ SET(CPACK_DOWNLOAD_ADD_REMOVE ON)
+ ENDIF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE})
+ SET(CPACK_ADD_REMOVE ${CPACK_DOWNLOAD_ADD_REMOVE})
+ cpack_append_option_set_command(
+ CPACK_ADD_REMOVE
+ CPACK_CONFIG_DL_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_CONFIG_DL_STR}")
+ ENDIF(CPack_CMake_INCLUDED)
+ENDMACRO(cpack_configure_downloads)
+ENDIF(NOT CPackComponent_CMake_INCLUDED)
diff --git a/Modules/CPackCygwin.cmake b/Modules/CPackCygwin.cmake
new file mode 100644
index 000000000..7ed7f678b
--- /dev/null
+++ b/Modules/CPackCygwin.cmake
@@ -0,0 +1,33 @@
+##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
+
+#=============================================================================
+# Copyright 2006-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.)
diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake
new file mode 100644
index 000000000..e866bab80
--- /dev/null
+++ b/Modules/CPackDMG.cmake
@@ -0,0 +1,70 @@
+##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
+# automatically detected command (or specify its location if the
+# auto-detection fails to find it.)
+##end
+
+#=============================================================================
+# Copyright 2006-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.)
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
new file mode 100644
index 000000000..bd3b94d74
--- /dev/null
+++ b/Modules/CPackDeb.cmake
@@ -0,0 +1,421 @@
+##section Variables specific to CPack Debian (DEB) generator
+##end
+##module
+# - The builtin (binary) CPack Deb generator (Unix only)
+# 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
+# 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
+
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+# Copyright 2007-2009 Mathieu Malaterre <mathieu.malaterre@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.)
+
+# CPack script for creating Debian package
+# Author: Mathieu Malaterre
+#
+# http://wiki.debian.org/HowToPackageForDebian
+
+IF(CMAKE_BINARY_DIR)
+ MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.")
+ENDIF(CMAKE_BINARY_DIR)
+
+IF(NOT UNIX)
+ MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.")
+ENDIF(NOT UNIX)
+
+# 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(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
+
+FIND_PROGRAM(FAKEROOT_EXECUTABLE fakeroot)
+IF(FAKEROOT_EXECUTABLE)
+ SET(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE})
+ENDIF(FAKEROOT_EXECUTABLE)
+
+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}>")
+ ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG)
+
+ # 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})
+ 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(CPACK_DEBIAN_PACKAGE_DEBUG)
+ IF (NOT SHLIBDEPS_RESULT EQUAL 0)
+ MESSAGE (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: ${SHLIBDEPS_ERROR}")
+ ENDIF (NOT SHLIBDEPS_RESULT EQUAL 0)
+
+ #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}")
+ ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG)
+
+ # Remove blank control file
+ # Might not be safe if package actual contain file or directory named debian
+ FILE(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian")
+
+ # 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 (CPACK_DEBIAN_PACKAGE_DEPENDS)
+ SET (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}")
+ ENDIF (CPACK_DEBIAN_PACKAGE_DEPENDS)
+
+ ELSE (SHLIBDEPS_EXECUTABLE)
+ IF(CPACK_DEBIAN_PACKAGE_DEBUG)
+ MESSAGE( "CPackDeb Debug: Using only user-provided depends because dpkg-shlibdeps is not found.")
+ ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG)
+ ENDIF(SHLIBDEPS_EXECUTABLE)
+
+ELSE (CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
+ IF(CPACK_DEBIAN_PACKAGE_DEBUG)
+ MESSAGE( "CPackDeb Debug: Using only user-provided depends")
+ ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG)
+ENDIF(CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
+
+# Let's define the control file found in debian package:
+
+# Binary package:
+# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
+
+# 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(NOT CPACK_DEBIAN_PACKAGE_NAME)
+
+# Version: (mandatory)
+IF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
+ IF(NOT CPACK_PACKAGE_VERSION)
+ MESSAGE(FATAL_ERROR "CPackDeb: Debian package requires a package version")
+ ENDIF(NOT CPACK_PACKAGE_VERSION)
+ SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
+ENDIF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
+
+# 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(NOT DPKG_CMD)
+ EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
+ OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
+
+# 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(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
+
+# 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(NOT CPACK_PACKAGE_CONTACT)
+ SET(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
+ENDIF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
+
+# 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")
+ ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+ SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+ENDIF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
+
+# Section: (recommended)
+IF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
+ SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
+ENDIF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
+
+# Priority: (recommended)
+IF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
+ SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
+ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY )
+
+# 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}")
+ SET(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "/${CPACK_DEB_PACKAGE_COMPONENT}")
+ SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_DEB_PACKAGE_COMPONENT}")
+ STRING(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
+ELSE(CPACK_DEB_PACKAGE_COMPONENT)
+ SET(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "")
+ SET(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "")
+ SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
+ENDIF(CPACK_DEB_PACKAGE_COMPONENT)
+
+# 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(CPACK_DEBIAN_PACKAGE_DEBUG)
+
+# 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(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake
new file mode 100644
index 000000000..d14005369
--- /dev/null
+++ b/Modules/CPackNSIS.cmake
@@ -0,0 +1,147 @@
+##section Variables specific to CPack NSIS generator
+##end
+##module
+# - CPack NSIS generator specific options
+#
+# 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
+
+#=============================================================================
+# Copyright 2006-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.)
+
+#FIXME we should put NSIS specific code here
+#FIXME but I'm not doing it because I'm not able to test it...
diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake
new file mode 100644
index 000000000..45ba465cc
--- /dev/null
+++ b/Modules/CPackPackageMaker.cmake
@@ -0,0 +1,35 @@
+##section Variables specific to CPack PackageMaker generator
+##end
+##module
+# - PackageMaker CPack generator (Mac OS X).
+# The following variable is specific to installers build on Mac OS X
+# using PackageMaker:
+##end
+#
+##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
+
+#=============================================================================
+# Copyright 2006-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.)
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
new file mode 100644
index 000000000..ae9351273
--- /dev/null
+++ b/Modules/CPackRPM.cmake
@@ -0,0 +1,925 @@
+##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
+# 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
+# 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).
+##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
+
+#=============================================================================
+# 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.)
+
+# Author: Eric Noulard with the help of Alexander Neundorf.
+
+IF(CMAKE_BINARY_DIR)
+ MESSAGE(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.")
+ENDIF(CMAKE_BINARY_DIR)
+
+IF(NOT UNIX)
+ MESSAGE(FATAL_ERROR "CPackRPM.cmake may only be used under UNIX.")
+ENDIF(NOT UNIX)
+
+# 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(CPACK_RPM_PACKAGE_DEBUG)
+ENDIF(RPMBUILD_EXECUTABLE)
+
+IF(NOT RPMBUILD_EXECUTABLE)
+ MESSAGE(FATAL_ERROR "RPM package requires rpmbuild executable")
+ENDIF(NOT RPMBUILD_EXECUTABLE)
+
+# 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 (LSB_RELEASE_EXECUTABLE)
+ set(LSB_RELEASE_OUTPUT "lsb_release not installed/found!")
+ endif(LSB_RELEASE_EXECUTABLE)
+ MESSAGE("CPackRPM:Debug: LSB_RELEASE = ${LSB_RELEASE_OUTPUT}")
+ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+
+# 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(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*")
+
+# 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(ALIEN_EXECUTABLE)
+
+# Are we packaging components ?
+IF(CPACK_RPM_PACKAGE_COMPONENT)
+ SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
+ SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "/${CPACK_RPM_PACKAGE_COMPONENT}")
+ SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_RPM_PACKAGE_COMPONENT}")
+ELSE(CPACK_RPM_PACKAGE_COMPONENT)
+ SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "")
+ SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "")
+ SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
+ENDIF(CPACK_RPM_PACKAGE_COMPONENT)
+
+#
+# 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:
+#
+
+# 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)
+ ELSE(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+ SET(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+ ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+ENDIF(NOT CPACK_RPM_PACKAGE_SUMMARY)
+
+# CPACK_RPM_PACKAGE_NAME (mandatory)
+IF(NOT CPACK_RPM_PACKAGE_NAME)
+ STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME)
+ENDIF(NOT CPACK_RPM_PACKAGE_NAME)
+
+# 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(NOT CPACK_PACKAGE_VERSION)
+ SET(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
+ENDIF(NOT CPACK_RPM_PACKAGE_VERSION)
+# 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}")
+ ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+ELSE(CPACK_RPM_PACKAGE_ARCHITECTURE)
+ SET(TMP_RPM_BUILDARCH "")
+ENDIF(CPACK_RPM_PACKAGE_ARCHITECTURE)
+
+# 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(NOT CPACK_RPM_PACKAGE_RELEASE)
+
+# CPACK_RPM_PACKAGE_LICENSE
+IF(NOT CPACK_RPM_PACKAGE_LICENSE)
+ SET(CPACK_RPM_PACKAGE_LICENSE "unknown")
+ENDIF(NOT CPACK_RPM_PACKAGE_LICENSE)
+
+# CPACK_RPM_PACKAGE_GROUP
+IF(NOT CPACK_RPM_PACKAGE_GROUP)
+ SET(CPACK_RPM_PACKAGE_GROUP "unknown")
+ENDIF(NOT 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(CPACK_PACKAGE_VENDOR)
+ SET(CPACK_RPM_PACKAGE_VENDOR "unknown")
+ ENDIF(CPACK_PACKAGE_VENDOR)
+ENDIF(NOT CPACK_RPM_PACKAGE_VENDOR)
+
+# 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 (CPACK_PACKAGE_DESCRIPTION_FILE)
+ SET(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available")
+ ENDIF (CPACK_PACKAGE_DESCRIPTION_FILE)
+ENDIF (NOT CPACK_RPM_PACKAGE_DESCRIPTION)
+
+# 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(CPACK_RPM_PACKAGE_DEBUG)
+ IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")
+ SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio")
+ ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")
+ IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")
+ SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio")
+ ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")
+ IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")
+ SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio")
+ ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")
+ IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")
+ SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio")
+ ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")
+ELSE(CPACK_RPM_COMPRESSION_TYPE)
+ SET(CPACK_RPM_COMPRESSION_TYPE_TMP "")
+ENDIF(CPACK_RPM_COMPRESSION_TYPE)
+
+if(CPACK_PACKAGE_RELOCATABLE)
+ set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE)
+endif(CPACK_PACKAGE_RELOCATABLE)
+if(CPACK_RPM_PACKAGE_RELOCATABLE)
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: Trying to build a relocatable package")
+ endif(CPACK_RPM_PACKAGE_DEBUG)
+ 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.")
+ else(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON"))
+ set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX})
+ endif(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON"))
+endif(CPACK_RPM_PACKAGE_RELOCATABLE)
+
+# Check if additional fields for RPM spec header are given
+# There may be some COMPONENT specific variables as well
+FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV)
+ IF(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}")
+ ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+ if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(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(CPACK_RPM_PACKAGE_DEBUG)
+ set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}})
+ else()
+ 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(CPACK_RPM_PACKAGE_DEBUG)
+ set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}})
+ endif()
+ else()
+ IF(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}")
+ ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+ set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}})
+ endif()
+
+ IF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP)
+ 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}")
+ IF(CPACK_RPM_PACKAGE_DEBUG)
+ MESSAGE("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}")
+ ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+ SET(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}")
+ ELSE(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP)
+ # Do not forget to unset previously set header (from previous component)
+ UNSET(TMP_RPM_${_RPM_SPEC_HEADER})
+ ENDIF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP)
+ENDFOREACH(_RPM_SPEC_HEADER)
+
+# 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(CPACK_RPM_PACKAGE_DEBUG)
+ SET(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}")
+ENDIF(CPACK_RPM_SPEC_INSTALL_POST)
+
+# 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(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE)
+ set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE})
+ endif(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE)
+else(CPACK_RPM_PACKAGE_COMPONENT)
+ 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(CPACK_RPM_PACKAGE_COMPONENT)
+
+# 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(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE})
+ message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_READ_FILE}> does not exists - ignoring")
+ endif(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE})
+else(CPACK_RPM_POST_INSTALL_READ_FILE)
+ # reset SPEC var value if no post install file has been specified
+ # (either globally or component-wise)
+ set(CPACK_RPM_SPEC_POSTINSTALL "")
+endif(CPACK_RPM_POST_INSTALL_READ_FILE)
+
+# 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(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE})
+ message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_READ_FILE}> does not exists - ignoring")
+ endif(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE})
+else(CPACK_RPM_POST_UNINSTALL_READ_FILE)
+ # 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_POST_UNINSTALL_READ_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(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE)
+ set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE})
+ endif(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE)
+ 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(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE)
+ set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE})
+ endif(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE)
+else(CPACK_RPM_PACKAGE_COMPONENT)
+ 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(CPACK_RPM_PACKAGE_COMPONENT)
+
+# 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(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE})
+ message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_READ_FILE}> does not exists - ignoring")
+ endif(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE})
+else(CPACK_RPM_PRE_INSTALL_READ_FILE)
+ # reset SPEC var value if no pre-install file has been specified
+ # (either globally or component-wise)
+ set(CPACK_RPM_SPEC_PREINSTALL "")
+endif(CPACK_RPM_PRE_INSTALL_READ_FILE)
+
+# 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(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE})
+ message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_READ_FILE}> does not exists - ignoring")
+ endif(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE})
+else(CPACK_RPM_PRE_UNINSTALL_READ_FILE)
+ # 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_PRE_UNINSTALL_READ_FILE)
+
+# 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(EXISTS ${CPACK_RPM_CHANGELOG_FILE})
+ message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring")
+ endif(EXISTS ${CPACK_RPM_CHANGELOG_FILE})
+else(CPACK_RPM_CHANGELOG_FILE)
+ set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Erk <eric.noulard@gmail.com>\n Generated by CPack RPM (no Changelog file were provided)")
+endif(CPACK_RPM_CHANGELOG_FILE)
+
+# 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(CPACK_RPM_PACKAGE_DEBUG)
+ENDIF(CPACK_RPM_SPEC_MORE_DEFINE)
+
+# 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}")
+
+# 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 ".")
+ 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(CPACK_RPM_PACKAGE_DEBUG)
+ endif()
+else()
+ if(CPACK_ABSOLUTE_DESTINATION_FILES)
+ set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${CPACK_ABSOLUTE_DESTINATION_FILES}")
+ 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})
+ 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(CPACK_RPM_PACKAGE_DEBUG)
+ 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}>")
+ ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+
+ # 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-z\(\)]* " "" F_PATH ${F})
+ string(REGEX MATCH "%[A-Za-z\(\)]*" F_PREFIX ${F})
+
+ 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})
+ list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH})
+
+ 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(F)
+else()
+ set(CPACK_RPM_USER_INSTALL_FILES "")
+endif()
+
+if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
+ IF(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}")
+ ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+ # 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(F)
+ # 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(F)
+ 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(CPACK_RPM_PACKAGE_DEBUG)
+else()
+ # reset vars in order to avoid leakage of value(s) from one component to another
+ set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "")
+endif(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
+
+# 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(F)
+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(CPACK_RPM_PACKAGE_DEBUG)
+
+# USER generated spec file handling.
+# We should generate a 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\@
+Version: \@CPACK_RPM_PACKAGE_VERSION\@
+Release: \@CPACK_RPM_PACKAGE_RELEASE\@
+License: \@CPACK_RPM_PACKAGE_LICENSE\@
+Group: \@CPACK_RPM_PACKAGE_GROUP\@
+Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
+\@TMP_RPM_URL\@
+\@TMP_RPM_REQUIRES\@
+\@TMP_RPM_PROVIDES\@
+\@TMP_RPM_OBSOLETES\@
+\@TMP_RPM_CONFLICTS\@
+\@TMP_RPM_AUTOPROV\@
+\@TMP_RPM_AUTOREQ\@
+\@TMP_RPM_AUTOREQPROV\@
+\@TMP_RPM_BUILDARCH\@
+\@TMP_RPM_PREFIX\@
+
+%define _rpmdir \@CPACK_RPM_DIRECTORY\@
+%define _rpmfilename \@CPACK_RPM_FILE_NAME\@
+%define _unpackaged_files_terminate_build 0
+%define _topdir \@CPACK_RPM_DIRECTORY\@
+\@TMP_RPM_SPEC_INSTALL_POST\@
+\@CPACK_RPM_SPEC_MORE_DEFINE\@
+\@CPACK_RPM_COMPRESSION_TYPE_TMP\@
+
+%description
+\@CPACK_RPM_PACKAGE_DESCRIPTION\@
+
+# This is a shortcutted spec file generated by CMake RPM generator
+# we skip _install step because CPack does that for us.
+# We do only save CPack installed tree in _prepr
+# and then restore it in build.
+%prep
+mv $RPM_BUILD_ROOT \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\"
+
+#p build
+
+%install
+if [ -e $RPM_BUILD_ROOT ];
+then
+ rm -rf $RPM_BUILD_ROOT
+fi
+mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
+
+%clean
+
+%post
+\@CPACK_RPM_SPEC_POSTINSTALL\@
+
+%postun
+\@CPACK_RPM_SPEC_POSTUNINSTALL\@
+
+%pre
+\@CPACK_RPM_SPEC_PREINSTALL\@
+
+%preun
+\@CPACK_RPM_SPEC_PREUNINSTALL\@
+
+%files
+%defattr(-,root,root,-)
+${CPACK_RPM_INSTALL_FILES}
+${CPACK_RPM_ABSOLUTE_INSTALL_FILES}
+${CPACK_RPM_USER_INSTALL_FILES}
+
+%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")
+ ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
+ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
+
+# 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(CPACK_RPM_USER_BINARY_SPECFILE)
+ # 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(CPACK_RPM_USER_BINARY_SPECFILE)
+
+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(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT)
+ELSE(RPMBUILD_EXECUTABLE)
+ IF(ALIEN_EXECUTABLE)
+ MESSAGE(FATAL_ERROR "RPM packaging through alien not done (yet)")
+ ENDIF(ALIEN_EXECUTABLE)
+ENDIF(RPMBUILD_EXECUTABLE)
diff --git a/Modules/CPackZIP.cmake b/Modules/CPackZIP.cmake
new file mode 100644
index 000000000..99963cf91
--- /dev/null
+++ b/Modules/CPackZIP.cmake
@@ -0,0 +1,41 @@
+
+#=============================================================================
+# 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.)
+
+IF(CMAKE_BINARY_DIR)
+ MESSAGE(FATAL_ERROR "CPackZIP.cmake may only be used by CPack internally.")
+ENDIF(CMAKE_BINARY_DIR)
+
+FIND_PROGRAM(ZIP_EXECUTABLE wzzip PATHS "$ENV{ProgramFiles}/WinZip")
+IF(ZIP_EXECUTABLE)
+ SET(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -P \"<ARCHIVE>\" @<FILELIST>")
+ SET(CPACK_ZIP_NEED_QUOTES TRUE)
+ENDIF(ZIP_EXECUTABLE)
+
+IF(NOT ZIP_EXECUTABLE)
+ FIND_PROGRAM(ZIP_EXECUTABLE 7z PATHS "$ENV{ProgramFiles}/7-Zip")
+ IF(ZIP_EXECUTABLE)
+ SET(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" a -tzip \"<ARCHIVE>\" @<FILELIST>")
+ SET(CPACK_ZIP_NEED_QUOTES TRUE)
+ ENDIF(ZIP_EXECUTABLE)
+ENDIF(NOT ZIP_EXECUTABLE)
+
+IF(NOT ZIP_EXECUTABLE)
+ FIND_PACKAGE(Cygwin)
+ FIND_PROGRAM(ZIP_EXECUTABLE zip PATHS "${CYGWIN_INSTALL_PATH}/bin")
+ IF(ZIP_EXECUTABLE)
+ SET(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -r \"<ARCHIVE>\" . -i@<FILELIST>")
+ SET(CPACK_ZIP_NEED_QUOTES FALSE)
+ ENDIF(ZIP_EXECUTABLE)
+ENDIF(NOT ZIP_EXECUTABLE)
+
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
new file mode 100644
index 000000000..ec9dbeb79
--- /dev/null
+++ b/Modules/CTest.cmake
@@ -0,0 +1,286 @@
+# - 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.)
+
+#=============================================================================
+# 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.)
+
+OPTION(BUILD_TESTING "Build the testing tree." ON)
+
+# function to turn generator name into a version string
+# like vs7 vs71 vs8 vs9
+FUNCTION(GET_VS_VERSION_STRING generator var)
+ STRING(REGEX REPLACE "Visual Studio ([0-9][0-9]?)($|.*)" "\\1"
+ NUMBER "${generator}")
+ IF("${generator}" MATCHES "Visual Studio 7 .NET 2003")
+ SET(ver_string "vs71")
+ ELSE("${generator}" MATCHES "Visual Studio 7 .NET 2003")
+ SET(ver_string "vs${NUMBER}")
+ ENDIF("${generator}" MATCHES "Visual Studio 7 .NET 2003")
+ SET(${var} ${ver_string} PARENT_SCOPE)
+ENDFUNCTION(GET_VS_VERSION_STRING)
+
+IF(BUILD_TESTING)
+ # Setup some auxilary macros
+ MACRO(SET_IF_NOT_SET var val)
+ IF(NOT DEFINED "${var}")
+ SET("${var}" "${val}")
+ ENDIF(NOT DEFINED "${var}")
+ ENDMACRO(SET_IF_NOT_SET)
+
+ MACRO(SET_IF_SET var val)
+ IF(NOT "${val}" MATCHES "^$")
+ SET("${var}" "${val}")
+ ENDIF(NOT "${val}" MATCHES "^$")
+ ENDMACRO(SET_IF_SET)
+
+ MACRO(SET_IF_SET_AND_NOT_SET var val)
+ IF(NOT "${val}" MATCHES "^$")
+ SET_IF_NOT_SET("${var}" "${val}")
+ ENDIF(NOT "${val}" MATCHES "^$")
+ ENDMACRO(SET_IF_SET_AND_NOT_SET)
+
+ # Make sure testing is enabled
+ ENABLE_TESTING()
+
+ IF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
+ INCLUDE("${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
+ SET_IF_SET_AND_NOT_SET(NIGHTLY_START_TIME "${CTEST_NIGHTLY_START_TIME}")
+ SET_IF_SET_AND_NOT_SET(DROP_METHOD "${CTEST_DROP_METHOD}")
+ SET_IF_SET_AND_NOT_SET(DROP_SITE "${CTEST_DROP_SITE}")
+ SET_IF_SET_AND_NOT_SET(DROP_SITE_USER "${CTEST_DROP_SITE_USER}")
+ SET_IF_SET_AND_NOT_SET(DROP_SITE_PASSWORD "${CTEST_DROP_SITE_PASWORD}")
+ SET_IF_SET_AND_NOT_SET(DROP_SITE_MODE "${CTEST_DROP_SITE_MODE}")
+ SET_IF_SET_AND_NOT_SET(DROP_LOCATION "${CTEST_DROP_LOCATION}")
+ SET_IF_SET_AND_NOT_SET(TRIGGER_SITE "${CTEST_TRIGGER_SITE}")
+ SET_IF_SET_AND_NOT_SET(UPDATE_TYPE "${CTEST_UPDATE_TYPE}")
+ ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
+
+ # the project can have a DartConfig.cmake file
+ IF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake")
+ INCLUDE("${PROJECT_SOURCE_DIR}/DartConfig.cmake")
+ ELSE(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake")
+ # Dashboard is opened for submissions for a 24 hour period starting at
+ # the specified NIGHTLY_START_TIME. Time is specified in 24 hour format.
+ SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT")
+ SET_IF_NOT_SET(DROP_METHOD "http")
+ SET_IF_NOT_SET (COMPRESS_SUBMISSION ON)
+ ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake")
+ SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT")
+
+ FIND_PROGRAM(CVSCOMMAND cvs )
+ SET(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING
+ "Options passed to the cvs update command.")
+ FIND_PROGRAM(SVNCOMMAND svn)
+ FIND_PROGRAM(BZRCOMMAND bzr)
+ FIND_PROGRAM(HGCOMMAND hg)
+ FIND_PROGRAM(GITCOMMAND git)
+
+ IF(NOT UPDATE_TYPE)
+ IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS")
+ SET(UPDATE_TYPE cvs)
+ ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn")
+ SET(UPDATE_TYPE svn)
+ ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr")
+ SET(UPDATE_TYPE bzr)
+ ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg")
+ SET(UPDATE_TYPE hg)
+ ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
+ SET(UPDATE_TYPE git)
+ ENDIF()
+ ENDIF(NOT UPDATE_TYPE)
+
+ STRING(TOLOWER "${UPDATE_TYPE}" _update_type)
+ IF("${_update_type}" STREQUAL "cvs")
+ SET(UPDATE_COMMAND "${CVSCOMMAND}")
+ SET(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}")
+ ELSEIF("${_update_type}" STREQUAL "svn")
+ SET(UPDATE_COMMAND "${SVNCOMMAND}")
+ SET(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}")
+ ELSEIF("${_update_type}" STREQUAL "bzr")
+ SET(UPDATE_COMMAND "${BZRCOMMAND}")
+ SET(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}")
+ ELSEIF("${_update_type}" STREQUAL "hg")
+ SET(UPDATE_COMMAND "${HGCOMMAND}")
+ SET(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}")
+ ELSEIF("${_update_type}" STREQUAL "git")
+ SET(UPDATE_COMMAND "${GITCOMMAND}")
+ SET(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}")
+ ENDIF()
+
+ SET(DART_TESTING_TIMEOUT 1500 CACHE STRING
+ "Maximum time allowed before CTest will kill the test.")
+
+ SET(CTEST_SUBMIT_RETRY_DELAY 5 CACHE STRING
+ "How long to wait between timed-out CTest submissions.")
+ SET(CTEST_SUBMIT_RETRY_COUNT 3 CACHE STRING
+ "How many times to retry timed-out CTest submissions.")
+
+ FIND_PROGRAM(MEMORYCHECK_COMMAND
+ NAMES purify valgrind boundscheck
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
+ DOC "Path to the memory checking command, used for memory error detection."
+ )
+ FIND_PROGRAM(SLURM_SBATCH_COMMAND sbatch DOC
+ "Path to the SLURM sbatch executable"
+ )
+ FIND_PROGRAM(SLURM_SRUN_COMMAND srun DOC
+ "Path to the SLURM srun executable"
+ )
+ SET(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH
+ "File that contains suppressions for the memory checker")
+ FIND_PROGRAM(SCPCOMMAND scp DOC
+ "Path to scp command, used by CTest for submitting results to a Dart server"
+ )
+ FIND_PROGRAM(COVERAGE_COMMAND gcov DOC
+ "Path to the coverage program that CTest uses for performing coverage inspection"
+ )
+ SET(COVERAGE_EXTRA_FLAGS "-l" CACHE STRING
+ "Extra command line flags to pass to the coverage tool")
+
+ # set the site name
+ SITE_NAME(SITE)
+ # set the build name
+ IF(NOT BUILDNAME)
+ SET(DART_COMPILER "${CMAKE_CXX_COMPILER}")
+ IF(NOT DART_COMPILER)
+ SET(DART_COMPILER "${CMAKE_C_COMPILER}")
+ ENDIF(NOT DART_COMPILER)
+ IF(NOT DART_COMPILER)
+ SET(DART_COMPILER "unknown")
+ ENDIF(NOT DART_COMPILER)
+ IF(WIN32)
+ SET(DART_NAME_COMPONENT "NAME_WE")
+ ELSE(WIN32)
+ SET(DART_NAME_COMPONENT "NAME")
+ ENDIF(WIN32)
+ IF(NOT BUILD_NAME_SYSTEM_NAME)
+ SET(BUILD_NAME_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
+ ENDIF(NOT BUILD_NAME_SYSTEM_NAME)
+ IF(WIN32)
+ SET(BUILD_NAME_SYSTEM_NAME "Win32")
+ ENDIF(WIN32)
+ IF(UNIX OR BORLAND)
+ GET_FILENAME_COMPONENT(DART_CXX_NAME
+ "${CMAKE_CXX_COMPILER}" ${DART_NAME_COMPONENT})
+ ELSE(UNIX OR BORLAND)
+ GET_FILENAME_COMPONENT(DART_CXX_NAME
+ "${CMAKE_BUILD_TOOL}" ${DART_NAME_COMPONENT})
+ ENDIF(UNIX OR BORLAND)
+ IF(DART_CXX_NAME MATCHES "msdev")
+ SET(DART_CXX_NAME "vs60")
+ ENDIF(DART_CXX_NAME MATCHES "msdev")
+ IF(DART_CXX_NAME MATCHES "devenv")
+ GET_VS_VERSION_STRING("${CMAKE_GENERATOR}" DART_CXX_NAME)
+ ENDIF(DART_CXX_NAME MATCHES "devenv")
+ SET(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}")
+ ENDIF(NOT BUILDNAME)
+
+ # the build command
+ BUILD_COMMAND(MAKECOMMAND_DEFAULT_VALUE
+ CONFIGURATION "\${CTEST_CONFIGURATION_TYPE}")
+ SET(MAKECOMMAND ${MAKECOMMAND_DEFAULT_VALUE}
+ CACHE STRING "Command to build the project")
+
+ # the default build configuration the ctest build handler will use
+ # if there is no -C arg given to ctest:
+ SET(DEFAULT_CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}")
+ IF(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "")
+ SET(DEFAULT_CTEST_CONFIGURATION_TYPE "Release")
+ ENDIF(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "")
+
+ IF(NOT "${CMAKE_GENERATOR}" MATCHES "Make")
+ SET(CTEST_USE_LAUNCHERS 0)
+ ENDIF(NOT "${CMAKE_GENERATOR}" MATCHES "Make")
+ 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_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}")
+ ENDIF(CTEST_USE_LAUNCHERS)
+
+ MARK_AS_ADVANCED(
+ BZRCOMMAND
+ BZR_UPDATE_OPTIONS
+ COVERAGE_COMMAND
+ COVERAGE_EXTRA_FLAGS
+ CTEST_SUBMIT_RETRY_DELAY
+ CTEST_SUBMIT_RETRY_COUNT
+ CVSCOMMAND
+ CVS_UPDATE_OPTIONS
+ DART_TESTING_TIMEOUT
+ GITCOMMAND
+ HGCOMMAND
+ MAKECOMMAND
+ MEMORYCHECK_COMMAND
+ MEMORYCHECK_SUPPRESSIONS_FILE
+ PURIFYCOMMAND
+ SCPCOMMAND
+ SLURM_SBATCH_COMMAND
+ SLURM_SRUN_COMMAND
+ SITE
+ SVNCOMMAND
+ SVN_UPDATE_OPTIONS
+ )
+ IF(NOT RUN_FROM_DART)
+ SET(RUN_FROM_CTEST_OR_DART 1)
+ INCLUDE(CTestTargets)
+ SET(RUN_FROM_CTEST_OR_DART)
+ ENDIF(NOT RUN_FROM_DART)
+ENDIF(BUILD_TESTING)
diff --git a/Modules/CTestScriptMode.cmake b/Modules/CTestScriptMode.cmake
new file mode 100644
index 000000000..e459c1d59
--- /dev/null
+++ b/Modules/CTestScriptMode.cmake
@@ -0,0 +1,24 @@
+# This file is read by ctest in script mode (-S)
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2009 Alexander Neundorf <neundorf@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.)
+
+# Determine the current system, so this information can be used
+# in ctest scripts
+include(CMakeDetermineSystem)
+
+# Also load the system specific file, which sets up e.g. the search paths.
+# This makes the FIND_XXX() calls work much better
+include(CMakeSystemSpecificInformation)
+
diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake
new file mode 100644
index 000000000..bc4d9646a
--- /dev/null
+++ b/Modules/CTestTargets.cmake
@@ -0,0 +1,95 @@
+
+#=============================================================================
+# 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.)
+
+IF(NOT RUN_FROM_CTEST_OR_DART)
+ MESSAGE(FATAL_ERROR "Do not incldue CTestTargets.cmake directly")
+ENDIF(NOT RUN_FROM_CTEST_OR_DART)
+
+# make directories in the binary tree
+FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/Testing/Temporary)
+GET_FILENAME_COMPONENT(CMAKE_HOST_PATH ${CMAKE_COMMAND} PATH)
+SET(CMAKE_TARGET_PATH ${EXECUTABLE_OUTPUT_PATH})
+FIND_PROGRAM(CMAKE_CTEST_COMMAND ctest ${CMAKE_HOST_PATH} ${CMAKE_TARGET_PATH})
+MARK_AS_ADVANCED(CMAKE_CTEST_COMMAND)
+
+# Use CTest
+# configure files
+
+IF(CTEST_NEW_FORMAT)
+ CONFIGURE_FILE(
+ ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
+ ${PROJECT_BINARY_DIR}/CTestConfiguration.ini )
+ELSE(CTEST_NEW_FORMAT)
+ CONFIGURE_FILE(
+ ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
+ ${PROJECT_BINARY_DIR}/DartConfiguration.tcl )
+ENDIF(CTEST_NEW_FORMAT)
+
+#
+# Section 3:
+#
+# Custom targets to perform dashboard builds and submissions.
+# These should NOT need to be modified from project to project.
+#
+
+SET(__conf_types "")
+IF(CMAKE_CONFIGURATION_TYPES)
+ # We need to pass the configuration type on the test command line.
+ SET(__conf_types -C "${CMAKE_CFG_INTDIR}")
+ENDIF(CMAKE_CONFIGURATION_TYPES)
+
+# Add convenience targets. Do this at most once in case of nested
+# projects.
+DEFINE_PROPERTY(GLOBAL PROPERTY CTEST_TARGETS_ADDED
+ BRIEF_DOCS "Internal property used by CTestTargets module."
+ FULL_DOCS "Set by the CTestTargets module to track addition of testing targets."
+ )
+GET_PROPERTY(_CTEST_TARGETS_ADDED GLOBAL PROPERTY CTEST_TARGETS_ADDED)
+IF(NOT _CTEST_TARGETS_ADDED)
+ SET_PROPERTY(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1)
+
+ # For all generators add basic testing targets.
+ FOREACH(mode Experimental Nightly Continuous NightlyMemoryCheck)
+ ADD_CUSTOM_TARGET(${mode}
+ ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}
+ )
+ SET_PROPERTY(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "")
+ SET_PROPERTY(TARGET ${mode} PROPERTY FOLDER "CTestDashboardTargets")
+ ENDFOREACH(mode)
+
+ # For Makefile generators add more granular targets.
+ IF("${CMAKE_GENERATOR}" MATCHES "(Ninja|Make)")
+ # Make targets for Experimental builds
+ FOREACH(mode Nightly Experimental Continuous)
+ FOREACH(testtype
+ Start Update Configure Build Test Coverage MemCheck Submit
+ # missing purify
+ )
+ ADD_CUSTOM_TARGET(${mode}${testtype}
+ ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}
+ )
+ SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "")
+ SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY FOLDER "CTestDashboardTargets")
+ ENDFOREACH(testtype)
+ ENDFOREACH(mode)
+ ENDIF("${CMAKE_GENERATOR}" MATCHES "(Ninja|Make)")
+
+ # If requested, add an alias that is the equivalent of the built-in "test"
+ # or "RUN_TESTS" target:
+ IF(CTEST_TEST_TARGET_ALIAS)
+ ADD_CUSTOM_TARGET(${CTEST_TEST_TARGET_ALIAS}
+ ${CMAKE_CTEST_COMMAND} ${__conf_types}
+ )
+ ENDIF()
+ENDIF(NOT _CTEST_TARGETS_ADDED)
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
new file mode 100644
index 000000000..90d04ac66
--- /dev/null
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -0,0 +1,45 @@
+# - 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.
+# See help for CheckCSourceCompiles for a listing of variables
+# that can modify the build.
+
+#=============================================================================
+# 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(CheckCSourceCompiles)
+
+MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
+ SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
+ SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+ 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
+ )
+ SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+ENDMACRO (CHECK_C_COMPILER_FLAG)
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
new file mode 100644
index 000000000..266933634
--- /dev/null
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -0,0 +1,95 @@
+# - 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
+
+#=============================================================================
+# 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.)
+
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+
+MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
+ IF("${VAR}" MATCHES "^${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)
+ # this one translates potentially used imported library targets to their files on disk
+ CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
+ SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ ELSE(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
+ "${SOURCE}\n")
+
+ MESSAGE(STATUS "Performing Test ${VAR}")
+ TRY_COMPILE(${VAR}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
+ "${CHECK_C_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}")
+ MESSAGE(STATUS "Performing Test ${VAR} - Success")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Source file was:\n${SOURCE}\n")
+ ELSE(${VAR})
+ MESSAGE(STATUS "Performing Test ${VAR} - Failed")
+ 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"
+ "${OUTPUT}\n"
+ "Source file was:\n${SOURCE}\n")
+ ENDIF(${VAR})
+ ENDIF("${VAR}" MATCHES "^${VAR}$")
+ENDMACRO(CHECK_C_SOURCE_COMPILES)
+
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
new file mode 100644
index 000000000..feee93a71
--- /dev/null
+++ b/Modules/CheckCSourceRuns.cmake
@@ -0,0 +1,91 @@
+# - 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
+
+#=============================================================================
+# Copyright 2006-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.)
+
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+
+MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR)
+ IF("${VAR}" MATCHES "^${VAR}$")
+ SET(MACRO_CHECK_FUNCTION_DEFINITIONS
+ "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ # this one translates potentially used imported library targets to their files on disk
+ CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
+ SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ ELSE(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
+ "${SOURCE}\n")
+
+ MESSAGE(STATUS "Performing Test ${VAR}")
+ TRY_RUN(${VAR}_EXITCODE ${VAR}_COMPILED
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
+ "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
+ "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
+ COMPILE_OUTPUT_VARIABLE OUTPUT)
+ # if it did not compile make the return value fail code of 1
+ IF(NOT ${VAR}_COMPILED)
+ SET(${VAR}_EXITCODE 1)
+ ENDIF(NOT ${VAR}_COMPILED)
+ # 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")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Return value: ${${VAR}}\n"
+ "Source file was:\n${SOURCE}\n")
+ ELSE("${${VAR}_EXITCODE}" EQUAL 0)
+ IF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
+ SET(${VAR} "${${VAR}_EXITCODE}")
+ ELSE(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
+ SET(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+ ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
+
+ MESSAGE(STATUS "Performing Test ${VAR} - Failed")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
+ "${OUTPUT}\n"
+ "Return value: ${${VAR}_EXITCODE}\n"
+ "Source file was:\n${SOURCE}\n")
+
+ ENDIF("${${VAR}_EXITCODE}" EQUAL 0)
+ ENDIF("${VAR}" MATCHES "^${VAR}$")
+ENDMACRO(CHECK_C_SOURCE_RUNS)
+
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
new file mode 100644
index 000000000..19963ea4c
--- /dev/null
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -0,0 +1,48 @@
+# - 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. See help
+# for CheckCXXSourceCompiles for a listing of variables that can
+# modify the build.
+
+#=============================================================================
+# Copyright 2006-2010 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(CheckCXXSourceCompiles)
+
+MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
+ SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
+ SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+ 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
+ )
+ SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+ENDMACRO (CHECK_CXX_COMPILER_FLAG)
+
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
new file mode 100644
index 000000000..7f7336e5b
--- /dev/null
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -0,0 +1,96 @@
+# - 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
+
+#=============================================================================
+# 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.)
+
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+
+MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
+ IF("${VAR}" MATCHES "^${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)
+ # this one translates potentially used imported library targets to their files on disk
+ CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ ELSE(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES)
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
+ "${SOURCE}\n")
+
+ MESSAGE(STATUS "Performing Test ${VAR}")
+ TRY_COMPILE(${VAR}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}"
+ "${CHECK_CXX_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}")
+ MESSAGE(STATUS "Performing Test ${VAR} - Success")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Source file was:\n${SOURCE}\n")
+ ELSE(${VAR})
+ MESSAGE(STATUS "Performing Test ${VAR} - Failed")
+ 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"
+ "${OUTPUT}\n"
+ "Source file was:\n${SOURCE}\n")
+ ENDIF(${VAR})
+ ENDIF("${VAR}" MATCHES "^${VAR}$")
+ENDMACRO(CHECK_CXX_SOURCE_COMPILES)
+
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
new file mode 100644
index 000000000..cd68d5706
--- /dev/null
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -0,0 +1,91 @@
+# - 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
+
+#=============================================================================
+# Copyright 2006-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.)
+
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+
+MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
+ IF("${VAR}" MATCHES "^${VAR}$")
+ SET(MACRO_CHECK_FUNCTION_DEFINITIONS
+ "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ # this one translates potentially used imported library targets to their files on disk
+ CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ ELSE(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES)
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
+ "${SOURCE}\n")
+
+ MESSAGE(STATUS "Performing Test ${VAR}")
+ TRY_RUN(${VAR}_EXITCODE ${VAR}_COMPILED
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
+ "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}"
+ "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
+ COMPILE_OUTPUT_VARIABLE OUTPUT)
+
+ # if it did not compile make the return value fail code of 1
+ IF(NOT ${VAR}_COMPILED)
+ SET(${VAR}_EXITCODE 1)
+ ENDIF(NOT ${VAR}_COMPILED)
+ # 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")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Return value: ${${VAR}}\n"
+ "Source file was:\n${SOURCE}\n")
+ ELSE("${${VAR}_EXITCODE}" EQUAL 0)
+ IF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
+ SET(${VAR} "${${VAR}_EXITCODE}")
+ ELSE(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
+ SET(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+ ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
+
+ MESSAGE(STATUS "Performing Test ${VAR} - Failed")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
+ "${OUTPUT}\n"
+ "Return value: ${${VAR}_EXITCODE}\n"
+ "Source file was:\n${SOURCE}\n")
+ ENDIF("${${VAR}_EXITCODE}" EQUAL 0)
+ ENDIF("${VAR}" MATCHES "^${VAR}$")
+ENDMACRO(CHECK_CXX_SOURCE_RUNS)
+
diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake
new file mode 100644
index 000000000..1b012aefd
--- /dev/null
+++ b/Modules/CheckCXXSymbolExists.cmake
@@ -0,0 +1,42 @@
+# - Check if a symbol exists as a function, variable, or macro in C++
+# CHECK_CXX_SYMBOL_EXISTS(<symbol> <files> <variable>)
+#
+# Check that the <symbol> is available after including given header
+# <files> and store the result in a <variable>. Specify the list
+# of files in one argument as a semicolon-separated list.
+# CHECK_CXX_SYMBOL_EXISTS() can be used to check in C++ files, as opposed
+# to CHECK_SYMBOL_EXISTS(), which works only for C.
+#
+# If the header files define the symbol as a macro it is considered
+# available and assumed to work. If the header files declare the
+# symbol as a function or variable then the symbol must also be
+# available for linking. If the symbol is a type or enum value
+# it will not be recognized (consider using CheckTypeSize or
+# CheckCSourceCompiles).
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+
+#=============================================================================
+# Copyright 2003-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.)
+
+INCLUDE(CheckSymbolExists)
+
+MACRO(CHECK_CXX_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
+ _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ENDMACRO(CHECK_CXX_SYMBOL_EXISTS)
diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c
new file mode 100644
index 000000000..d83107851
--- /dev/null
+++ b/Modules/CheckForPthreads.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <pthread.h>
+#include <unistd.h>
+
+void* runner(void*);
+
+int res = 0;
+#ifdef __CLASSIC_C__
+int main(){
+ int ac;
+ char*av[];
+#else
+int main(int ac, char*av[]){
+#endif
+ pthread_t tid[2];
+ pthread_create(&tid[0], 0, runner, (void*)1);
+ pthread_create(&tid[1], 0, runner, (void*)2);
+
+#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) // (no usleep on BeOS 5.)
+ usleep(1); // for strange behavior on single-processor sun
+#endif
+
+ pthread_join(tid[0], 0);
+ pthread_join(tid[1], 0);
+ if(ac > 1000){return *av[0];}
+ return res;
+}
+
+void* runner(void* args)
+{
+ int cc;
+ for ( cc = 0; cc < 10; cc ++ )
+ {
+ printf("%d CC: %d\n", (int)args, cc);
+ }
+ res ++;
+ return 0;
+}
diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake
new file mode 100644
index 000000000..abec9f738
--- /dev/null
+++ b/Modules/CheckFortranFunctionExists.cmake
@@ -0,0 +1,69 @@
+# - Check 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:
+#
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+
+#=============================================================================
+# 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.)
+
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+
+macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
+ if(NOT DEFINED ${VARIABLE})
+ message(STATUS "Looking for Fortran ${FUNCTION}")
+ if(CMAKE_REQUIRED_LIBRARIES)
+ # this one translates potentially used imported library targets to their files on disk
+ cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
+ set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ else(CMAKE_REQUIRED_LIBRARIES)
+ set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
+ endif(CMAKE_REQUIRED_LIBRARIES)
+ FILE(WRITE
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+ "
+ program TESTFortran
+ external ${FUNCTION}
+ call ${FUNCTION}()
+ end program TESTFortran
+ "
+ )
+ try_compile(${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+ CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
+ OUTPUT_VARIABLE OUTPUT
+ )
+# message(STATUS "${OUTPUT}")
+ if(${VARIABLE})
+ set(${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}")
+ message(STATUS "Looking for Fortran ${FUNCTION} - found")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n"
+ "${OUTPUT}\n\n")
+ else(${VARIABLE})
+ message(STATUS "Looking for Fortran ${FUNCTION} - not found")
+ set(${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n"
+ "${OUTPUT}\n\n")
+ endif(${VARIABLE})
+ endif(NOT DEFINED ${VARIABLE})
+endmacro(CHECK_FORTRAN_FUNCTION_EXISTS)
diff --git a/Modules/CheckFunctionExists.c b/Modules/CheckFunctionExists.c
new file mode 100644
index 000000000..607b3e8c6
--- /dev/null
+++ b/Modules/CheckFunctionExists.c
@@ -0,0 +1,23 @@
+#ifdef CHECK_FUNCTION_EXISTS
+
+char CHECK_FUNCTION_EXISTS();
+#ifdef __CLASSIC_C__
+int main(){
+ int ac;
+ char*av[];
+#else
+int main(int ac, char*av[]){
+#endif
+ CHECK_FUNCTION_EXISTS();
+ if(ac > 1000)
+ {
+ return *av[0];
+ }
+ return 0;
+}
+
+#else /* CHECK_FUNCTION_EXISTS */
+
+# error "CHECK_FUNCTION_EXISTS has to specify the function"
+
+#endif /* CHECK_FUNCTION_EXISTS */
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
new file mode 100644
index 000000000..8c469f012
--- /dev/null
+++ b/Modules/CheckFunctionExists.cmake
@@ -0,0 +1,74 @@
+# - 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 (considure using CheckSymbolExists).
+#
+# 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
+
+#=============================================================================
+# Copyright 2002-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.)
+
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+
+MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
+ IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ SET(MACRO_CHECK_FUNCTION_DEFINITIONS
+ "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
+ MESSAGE(STATUS "Looking for ${FUNCTION}")
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ # this one translates potentially used imported library targets to their files on disk
+ CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
+ SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ ELSE(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_FUNCTION_EXISTS_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_FUNCTION_EXISTS_ADD_INCLUDES)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ TRY_COMPILE(${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_ROOT}/Modules/CheckFunctionExists.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
+ "${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}"
+ OUTPUT_VARIABLE OUTPUT)
+ IF(${VARIABLE})
+ SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}")
+ MESSAGE(STATUS "Looking for ${FUNCTION} - found")
+ 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(${VARIABLE})
+ MESSAGE(STATUS "Looking for ${FUNCTION} - not found")
+ 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"
+ "${OUTPUT}\n\n")
+ ENDIF(${VARIABLE})
+ ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ENDMACRO(CHECK_FUNCTION_EXISTS)
diff --git a/Modules/CheckIncludeFile.c.in b/Modules/CheckIncludeFile.c.in
new file mode 100644
index 000000000..ddfbee8be
--- /dev/null
+++ b/Modules/CheckIncludeFile.c.in
@@ -0,0 +1,13 @@
+#include <${CHECK_INCLUDE_FILE_VAR}>
+
+#ifdef __CLASSIC_C__
+int main()
+{
+ return 0;
+}
+#else
+int main(void)
+{
+ return 0;
+}
+#endif
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
new file mode 100644
index 000000000..eb732d28b
--- /dev/null
+++ b/Modules/CheckIncludeFile.cmake
@@ -0,0 +1,77 @@
+# - 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
+#
+# an optional third argument is the CFlags to add to the compile line
+# or you can use CMAKE_REQUIRED_FLAGS
+#
+# 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
+#
+
+#=============================================================================
+# 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.)
+
+MACRO(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
+ IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ 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}")
+ IF(${ARGC} EQUAL 3)
+ SET(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS})
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}")
+ ENDIF(${ARGC} EQUAL 3)
+
+ TRY_COMPILE(${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS
+ -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
+ "${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}"
+ OUTPUT_VARIABLE OUTPUT)
+
+ IF(${ARGC} EQUAL 3)
+ SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS_SAVE})
+ ENDIF(${ARGC} EQUAL 3)
+
+ IF(${VARIABLE})
+ MESSAGE(STATUS "Looking for ${INCLUDE} - found")
+ 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(${VARIABLE})
+ MESSAGE(STATUS "Looking for ${INCLUDE} - not found")
+ SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the include file ${INCLUDE} "
+ "exists failed with the following output:\n"
+ "${OUTPUT}\n\n")
+ ENDIF(${VARIABLE})
+ ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ENDMACRO(CHECK_INCLUDE_FILE)
diff --git a/Modules/CheckIncludeFile.cxx.in b/Modules/CheckIncludeFile.cxx.in
new file mode 100644
index 000000000..40441f15a
--- /dev/null
+++ b/Modules/CheckIncludeFile.cxx.in
@@ -0,0 +1,6 @@
+#include <${CHECK_INCLUDE_FILE_VAR}>
+
+int main()
+{
+ return 0;
+}
diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake
new file mode 100644
index 000000000..c5d8f9aa2
--- /dev/null
+++ b/Modules/CheckIncludeFileCXX.cmake
@@ -0,0 +1,77 @@
+# - Check if the include file exists.
+# CHECK_INCLUDE_FILE_CXX(INCLUDE VARIABLE)
+#
+# INCLUDE - name of include file
+# VARIABLE - variable to return result
+#
+# An optional third argument is the CFlags to add to the compile line
+# or you can use CMAKE_REQUIRED_FLAGS.
+#
+# 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
+#
+
+#=============================================================================
+# 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.)
+
+MACRO(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
+ IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ 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}")
+ IF(${ARGC} EQUAL 3)
+ SET(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}")
+ ENDIF(${ARGC} EQUAL 3)
+
+ TRY_COMPILE(${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS
+ -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
+ "${CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS}"
+ OUTPUT_VARIABLE OUTPUT)
+
+ IF(${ARGC} EQUAL 3)
+ SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_SAVE})
+ ENDIF(${ARGC} EQUAL 3)
+
+ IF(${VARIABLE})
+ MESSAGE(STATUS "Looking for C++ include ${INCLUDE} - found")
+ 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(${VARIABLE})
+ MESSAGE(STATUS "Looking for C++ include ${INCLUDE} - not found")
+ SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the include file ${INCLUDE} "
+ "exists failed with the following output:\n"
+ "${OUTPUT}\n\n")
+ ENDIF(${VARIABLE})
+ ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ENDMACRO(CHECK_INCLUDE_FILE_CXX)
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
new file mode 100644
index 000000000..a94644e6a
--- /dev/null
+++ b/Modules/CheckIncludeFiles.cmake
@@ -0,0 +1,82 @@
+# - Check if the files can be included
+#
+# CHECK_INCLUDE_FILES(INCLUDE VARIABLE)
+#
+# INCLUDE - list of files to include
+# VARIABLE - variable to return result
+#
+# 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
+
+#=============================================================================
+# Copyright 2003-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.)
+
+MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
+ IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_INCLUDE_FILES_INCLUDE_DIRS)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_INCLUDE_FILES_CONTENT "/* */\n")
+ SET(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ FOREACH(FILE ${INCLUDE})
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT
+ "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
+ ENDFOREACH(FILE)
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT
+ "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(){return 0;}\n")
+ CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
+ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY IMMEDIATE)
+
+ SET(_INCLUDE ${INCLUDE}) # remove empty elements
+ IF("${_INCLUDE}" MATCHES "^([^;]+);.+;([^;]+)$")
+ LIST(LENGTH _INCLUDE _INCLUDE_LEN)
+ SET(_description "${_INCLUDE_LEN} include files ${CMAKE_MATCH_1}, ..., ${CMAKE_MATCH_2}")
+ ELSEIF("${_INCLUDE}" MATCHES "^([^;]+);([^;]+)$")
+ SET(_description "include files ${CMAKE_MATCH_1}, ${CMAKE_MATCH_2}")
+ ELSE()
+ SET(_description "include file ${_INCLUDE}")
+ ENDIF()
+
+ MESSAGE(STATUS "Looking for ${_description}")
+ TRY_COMPILE(${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS
+ -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILES_FLAGS}
+ "${CHECK_INCLUDE_FILES_INCLUDE_DIRS}"
+ OUTPUT_VARIABLE OUTPUT)
+ IF(${VARIABLE})
+ MESSAGE(STATUS "Looking for ${_description} - found")
+ 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(${VARIABLE})
+ MESSAGE(STATUS "Looking for ${_description} - not found.")
+ SET(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if files ${INCLUDE} "
+ "exist failed with the following output:\n"
+ "${OUTPUT}\nSource:\n${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
+ ENDIF(${VARIABLE})
+ ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ENDMACRO(CHECK_INCLUDE_FILES)
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
new file mode 100644
index 000000000..87a401813
--- /dev/null
+++ b/Modules/CheckLanguage.cmake
@@ -0,0 +1,65 @@
+# - Check if a language can be enabled
+# Usage:
+# check_language(<lang>)
+# where <lang> is a language that may be passed to enable_language()
+# such as "Fortran". If CMAKE_<lang>_COMPILER is already defined the
+# check does nothing. Otherwise it tries enabling the language in a
+# test project. The result is cached in CMAKE_<lang>_COMPILER as the
+# compiler that was found, or NOTFOUND if the language cannot be enabled.
+#
+# Example:
+# check_language(Fortran)
+# if(CMAKE_Fortran_COMPILER)
+# enable_language(Fortran)
+# else()
+# message(STATUS "No Fortran support")
+# endif()
+
+#=============================================================================
+# Copyright 2009-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.)
+
+macro(check_language lang)
+ if(NOT DEFINED CMAKE_${lang}_COMPILER)
+ set(_desc "Looking for a ${lang} compiler")
+ 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)
+project(Check${lang} ${lang})
+file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
+ \"set(CMAKE_${lang}_COMPILER \\\"\${CMAKE_${lang}_COMPILER}\\\")\\n\"
+ )
+")
+ execute_process(
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}
+ COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR}
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+ RESULT_VARIABLE result
+ )
+ include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/result.cmake OPTIONAL)
+ if(CMAKE_${lang}_COMPILER AND "${result}" STREQUAL "0")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "${_desc} passed with the following output:\n"
+ "${output}\n")
+ else()
+ set(CMAKE_${lang}_COMPILER NOTFOUND)
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "${_desc} failed with the following output:\n"
+ "${output}\n")
+ endif()
+ message(STATUS "${_desc} - ${CMAKE_${lang}_COMPILER}")
+ set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE FILEPATH "${lang} compiler")
+ mark_as_advanced(CMAKE_${lang}_COMPILER)
+ endif()
+endmacro()
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
new file mode 100644
index 000000000..59fca0a32
--- /dev/null
+++ b/Modules/CheckLibraryExists.cmake
@@ -0,0 +1,70 @@
+# - 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
+#
+# 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
+
+#=============================================================================
+# 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.)
+
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+
+MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
+ IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
+ "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
+ MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
+ SET(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY})
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ # this one translates potentially used imported library targets to their files on disk
+ CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
+ SET(CHECK_LIBRARY_EXISTS_LIBRARIES
+ ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES})
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ TRY_COMPILE(${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_ROOT}/Modules/CheckFunctionExists.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS
+ -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION}
+ -DLINK_DIRECTORIES:STRING=${LOCATION}
+ "-DLINK_LIBRARIES:STRING=${CHECK_LIBRARY_EXISTS_LIBRARIES}"
+ OUTPUT_VARIABLE OUTPUT)
+
+ IF(${VARIABLE})
+ MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found")
+ 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(${VARIABLE})
+ MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found")
+ 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} "
+ "failed with the following output:\n"
+ "${OUTPUT}\n\n")
+ ENDIF(${VARIABLE})
+ ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ENDMACRO(CHECK_LIBRARY_EXISTS)
diff --git a/Modules/CheckLibraryExists.lists.in b/Modules/CheckLibraryExists.lists.in
new file mode 100644
index 000000000..741b87d72
--- /dev/null
+++ b/Modules/CheckLibraryExists.lists.in
@@ -0,0 +1,8 @@
+PROJECT(CHECK_LIBRARY_EXISTS)
+
+
+ADD_DEFINITIONS(-DCHECK_FUNCTION_EXISTS=${CHECK_LIBRARY_EXISTS_FUNCTION})
+LINK_DIRECTORIES(${CHECK_LIBRARY_EXISTS_LOCATION})
+ADD_EXECUTABLE(CheckLibraryExists ${CHECK_LIBRARY_EXISTS_SOURCE})
+TARGET_LINK_LIBRARIES(CheckLibraryExists ${CHECK_LIBRARY_EXISTS_LIBRARY})
+
diff --git a/Modules/CheckPrototypeDefinition.c.in b/Modules/CheckPrototypeDefinition.c.in
new file mode 100644
index 000000000..a97344ac3
--- /dev/null
+++ b/Modules/CheckPrototypeDefinition.c.in
@@ -0,0 +1,29 @@
+@CHECK_PROTOTYPE_DEFINITION_HEADER@
+
+static void cmakeRequireSymbol(int dummy, ...) {
+ (void) dummy;
+}
+
+static void checkSymbol(void) {
+#ifndef @CHECK_PROTOTYPE_DEFINITION_SYMBOL@
+ cmakeRequireSymbol(0, &@CHECK_PROTOTYPE_DEFINITION_SYMBOL@);
+#endif
+}
+
+@CHECK_PROTOTYPE_DEFINITION_PROTO@ {
+ return @CHECK_PROTOTYPE_DEFINITION_RETURN@;
+}
+
+#ifdef __CLASSIC_C__
+int main() {
+ int ac;
+ char*av[];
+#else
+int main(int ac, char *av[]) {
+#endif
+ checkSymbol();
+ if (ac > 1000) {
+ return *av[0];
+ }
+ return 0;
+}
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
new file mode 100644
index 000000000..63d424237
--- /dev/null
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -0,0 +1,101 @@
+# - 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.
+# 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
+
+#=============================================================================
+# Copyright 2005-2009 Kitware, Inc.
+# Copyright 2010-2011 Andreas Schneider <asn@cryptomilk.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("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+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}$")
+ set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n")
+
+ set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ if (CMAKE_REQUIRED_LIBRARIES)
+ # this one translates potentially used imported library targets to their files on disk
+ cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
+ set(CHECK_PROTOTYPE_DEFINITION_LIBS
+ "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ else(CMAKE_REQUIRED_LIBRARIES)
+ set(CHECK_PROTOTYPE_DEFINITION_LIBS)
+ endif(CMAKE_REQUIRED_LIBRARIES)
+ if (CMAKE_REQUIRED_INCLUDES)
+ set(CMAKE_SYMBOL_EXISTS_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ else(CMAKE_REQUIRED_INCLUDES)
+ set(CMAKE_SYMBOL_EXISTS_INCLUDES)
+ endif(CMAKE_REQUIRED_INCLUDES)
+
+ foreach(_FILE ${_HEADER})
+ set(CHECK_PROTOTYPE_DEFINITION_HEADER
+ "${CHECK_PROTOTYPE_DEFINITION_HEADER}#include <${_FILE}>\n")
+ endforeach(_FILE)
+
+ set(CHECK_PROTOTYPE_DEFINITION_SYMBOL ${_FUNCTION})
+ set(CHECK_PROTOTYPE_DEFINITION_PROTO ${_PROTOTYPE})
+ set(CHECK_PROTOTYPE_DEFINITION_RETURN ${_RETURN})
+
+ configure_file("${__check_proto_def_dir}/CheckPrototypeDefinition.c.in"
+ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c" @ONLY)
+
+ file(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c _SOURCE)
+
+ try_compile(${_VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CHECK_PROTOTYPE_DEFINITION_FLAGS}
+ "${CHECK_PROTOTYPE_DEFINITION_LIBS}"
+ "${CMAKE_SYMBOL_EXISTS_INCLUDES}"
+ OUTPUT_VARIABLE OUTPUT)
+
+ if (${_VARIABLE})
+ set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
+ message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
+ 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 (${_VARIABLE})
+ message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
+ 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"
+ "${OUTPUT}\n\n${_SOURCE}\n\n")
+ endif (${_VARIABLE})
+ endif("${_VARIABLE}" MATCHES "^${_VARIABLE}$")
+
+endfunction(CHECK_PROTOTYPE_DEFINITION)
diff --git a/Modules/CheckSizeOf.cmake b/Modules/CheckSizeOf.cmake
new file mode 100644
index 000000000..f6d6636e5
--- /dev/null
+++ b/Modules/CheckSizeOf.cmake
@@ -0,0 +1,18 @@
+
+#=============================================================================
+# 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.)
+
+MESSAGE(SEND_ERROR
+ "Modules/CheckSizeOf.cmake has been removed. "
+ "Use Modules/CheckTypeSize.cmake instead. This "
+ "compatability check may be removed before the next release!")
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
new file mode 100644
index 000000000..18e80e3c0
--- /dev/null
+++ b/Modules/CheckStructHasMember.cmake
@@ -0,0 +1,51 @@
+# - Check if the given struct or class has the specified member variable
+# CHECK_STRUCT_HAS_MEMBER (STRUCT MEMBER HEADER VARIABLE)
+#
+# 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
+#
+# 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
+#
+# Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC)
+
+#=============================================================================
+# 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.)
+
+INCLUDE(CheckCSourceCompiles)
+
+MACRO (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
+ SET(_INCLUDE_FILES)
+ FOREACH (it ${_HEADER})
+ SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
+ ENDFOREACH (it)
+
+ SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE "
+${_INCLUDE_FILES}
+int main()
+{
+ ${_STRUCT}* tmp;
+ tmp->${_MEMBER};
+ return 0;
+}
+")
+ CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+
+ENDMACRO (CHECK_STRUCT_HAS_MEMBER)
+
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
new file mode 100644
index 000000000..e6e677d4f
--- /dev/null
+++ b/Modules/CheckSymbolExists.cmake
@@ -0,0 +1,101 @@
+# - 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.
+#
+# 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++.
+#
+# 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
+
+#=============================================================================
+# Copyright 2003-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.)
+
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+
+MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
+ _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ENDMACRO(CHECK_SYMBOL_EXISTS)
+
+MACRO(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
+ IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
+ SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ # this one translates potentially used imported library targets to their files on disk
+ CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
+ SET(CHECK_SYMBOL_EXISTS_LIBS
+ "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ ELSE(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_SYMBOL_EXISTS_LIBS)
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CMAKE_SYMBOL_EXISTS_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CMAKE_SYMBOL_EXISTS_INCLUDES)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ FOREACH(FILE ${FILES})
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT
+ "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
+ ENDFOREACH(FILE)
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT
+ "${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)
+
+ MESSAGE(STATUS "Looking for ${SYMBOL}")
+ TRY_COMPILE(${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ "${SOURCEFILE}"
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS
+ -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS}
+ "${CHECK_SYMBOL_EXISTS_LIBS}"
+ "${CMAKE_SYMBOL_EXISTS_INCLUDES}"
+ OUTPUT_VARIABLE OUTPUT)
+ IF(${VARIABLE})
+ MESSAGE(STATUS "Looking for ${SYMBOL} - found")
+ SET(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the ${SYMBOL} "
+ "exist passed with the following output:\n"
+ "${OUTPUT}\nFile ${SOURCEFILE}:\n"
+ "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
+ ELSE(${VARIABLE})
+ MESSAGE(STATUS "Looking for ${SYMBOL} - not found.")
+ SET(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the ${SYMBOL} "
+ "exist failed with the following output:\n"
+ "${OUTPUT}\nFile ${SOURCEFILE}:\n"
+ "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
+ ENDIF(${VARIABLE})
+ ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ENDMACRO(_CHECK_SYMBOL_EXISTS)
diff --git a/Modules/CheckTypeSize.c.in b/Modules/CheckTypeSize.c.in
new file mode 100644
index 000000000..b6c368801
--- /dev/null
+++ b/Modules/CheckTypeSize.c.in
@@ -0,0 +1,37 @@
+@headers@
+
+#undef KEY
+#if defined(__i386)
+# define KEY '_','_','i','3','8','6'
+#elif defined(__x86_64)
+# define KEY '_','_','x','8','6','_','6','4'
+#elif defined(__ppc__)
+# define KEY '_','_','p','p','c','_','_'
+#elif defined(__ppc64__)
+# define KEY '_','_','p','p','c','6','4','_','_'
+#endif
+
+#define SIZE (sizeof(@type@))
+char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
+ ('0' + ((SIZE / 10000)%10)),
+ ('0' + ((SIZE / 1000)%10)),
+ ('0' + ((SIZE / 100)%10)),
+ ('0' + ((SIZE / 10)%10)),
+ ('0' + (SIZE % 10)),
+ ']',
+#ifdef KEY
+ ' ','k','e','y','[', KEY, ']',
+#endif
+ '\0'};
+
+#ifdef __CLASSIC_C__
+int main(argc, argv) int argc; char *argv[];
+#else
+int main(int argc, char *argv[])
+#endif
+{
+ int require = 0;
+ require += info_size[argc];
+ (void)argv;
+ return require;
+}
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
new file mode 100644
index 000000000..1717718c9
--- /dev/null
+++ b/Modules/CheckTypeSize.cmake
@@ -0,0 +1,196 @@
+# - 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}".
+#
+# 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.
+#
+# 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
+
+#=============================================================================
+# 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.)
+
+include(CheckIncludeFile)
+include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+cmake_policy(PUSH)
+cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
+
+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}")
+
+ # Include header files.
+ set(headers)
+ if(builtin)
+ if(HAVE_SYS_TYPES_H)
+ set(headers "${headers}#include <sys/types.h>\n")
+ endif()
+ if(HAVE_STDINT_H)
+ set(headers "${headers}#include <stdint.h>\n")
+ endif()
+ if(HAVE_STDDEF_H)
+ set(headers "${headers}#include <stddef.h>\n")
+ endif()
+ endif()
+ foreach(h ${CMAKE_EXTRA_INCLUDE_FILES})
+ set(headers "${headers}#include \"${h}\"\n")
+ endforeach()
+
+ # Perform the check.
+
+ # this one translates potentially used imported library targets to their files on disk
+ cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
+
+ set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.c)
+ 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}
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS
+ "-DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}"
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
+ "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}"
+ OUTPUT_VARIABLE output
+ COPY_FILE ${bin}
+ )
+
+ if(HAVE_${var})
+ # The check compiled. Load information from the binary.
+ file(STRINGS ${bin} strings LIMIT_COUNT 10 REGEX "INFO:size")
+
+ # Parse the information strings.
+ set(regex_size ".*INFO:size\\[0*([^]]*)\\].*")
+ set(regex_key " key\\[([^]]*)\\]")
+ set(keys)
+ set(code)
+ set(mismatch)
+ set(first 1)
+ foreach(info ${strings})
+ if("${info}" MATCHES "${regex_size}")
+ # Get the type size.
+ string(REGEX REPLACE "${regex_size}" "\\1" size "${info}")
+ if(first)
+ set(${var} ${size})
+ elseif(NOT "${size}" STREQUAL "${${var}}")
+ set(mismatch 1)
+ endif()
+ set(first 0)
+
+ # Get the architecture map key.
+ string(REGEX MATCH "${regex_key}" key "${info}")
+ string(REGEX REPLACE "${regex_key}" "\\1" key "${key}")
+ if(key)
+ set(code "${code}\nset(${var}-${key} \"${size}\")")
+ list(APPEND keys ${key})
+ endif()
+ endif()
+ endforeach()
+
+ # Update the architecture-to-size map.
+ if(mismatch AND keys)
+ configure_file(${__check_type_size_dir}/CheckTypeSizeMap.cmake.in ${map} @ONLY)
+ set(${var} 0)
+ else()
+ file(REMOVE ${map})
+ endif()
+
+ if(mismatch AND NOT keys)
+ 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")
+ 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(HAVE_${var})
+ # The check failed to compile.
+ message(STATUS "Check size of ${type} - failed")
+ 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")
+ set(${var} "" CACHE INTERNAL "CHECK_TYPE_SIZE: ${type} unknown")
+ file(REMOVE ${map})
+ endif(HAVE_${var})
+endfunction()
+
+#-----------------------------------------------------------------------------
+macro(CHECK_TYPE_SIZE TYPE VARIABLE)
+ # Optionally check for standard headers.
+ if("${ARGV2}" STREQUAL "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)
+ endif()
+
+ # 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})
+ endif()
+ include(${_map_file} OPTIONAL)
+ set(_map_file)
+ set(_builtin)
+
+ # Create preprocessor code.
+ if(${VARIABLE}_KEYS)
+ set(${VARIABLE}_CODE)
+ set(_if if)
+ foreach(key ${${VARIABLE}_KEYS})
+ set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#${_if} defined(${key})\n# define ${VARIABLE} ${${VARIABLE}-${key}}\n")
+ set(_if elif)
+ endforeach()
+ set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#else\n# error ${VARIABLE} unknown\n#endif")
+ set(_if)
+ elseif(${VARIABLE})
+ set(${VARIABLE}_CODE "#define ${VARIABLE} ${${VARIABLE}}")
+ else()
+ set(${VARIABLE}_CODE "/* #undef ${VARIABLE} */")
+ endif()
+endmacro()
+
+#-----------------------------------------------------------------------------
+cmake_policy(POP)
diff --git a/Modules/CheckTypeSizeMap.cmake.in b/Modules/CheckTypeSizeMap.cmake.in
new file mode 100644
index 000000000..1e73cfff1
--- /dev/null
+++ b/Modules/CheckTypeSizeMap.cmake.in
@@ -0,0 +1 @@
+set(@var@_KEYS "@keys@")@code@
diff --git a/Modules/CheckVariableExists.c b/Modules/CheckVariableExists.c
new file mode 100644
index 000000000..752f6e486
--- /dev/null
+++ b/Modules/CheckVariableExists.c
@@ -0,0 +1,20 @@
+#ifdef CHECK_VARIABLE_EXISTS
+
+extern int CHECK_VARIABLE_EXISTS;
+
+#ifdef __CLASSIC_C__
+int main(){
+ int ac;
+ char*av[];
+#else
+int main(int ac, char*av[]){
+#endif
+ if(ac > 1000){return *av[0];}
+ return CHECK_VARIABLE_EXISTS;
+}
+
+#else /* CHECK_VARIABLE_EXISTS */
+
+# error "CHECK_VARIABLE_EXISTS has to specify the variable"
+
+#endif /* CHECK_VARIABLE_EXISTS */
diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake
new file mode 100644
index 000000000..7d6c7945d
--- /dev/null
+++ b/Modules/CheckVariableExists.cmake
@@ -0,0 +1,66 @@
+# - Check if the variable exists.
+# CHECK_VARIABLE_EXISTS(VAR 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:
+#
+# 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
+
+#=============================================================================
+# 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.)
+
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+
+
+MACRO(CHECK_VARIABLE_EXISTS VAR VARIABLE)
+ IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ SET(MACRO_CHECK_VARIABLE_DEFINITIONS
+ "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ MESSAGE(STATUS "Looking for ${VAR}")
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ # this one translates potentially used imported library targets to their files on disk
+ CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
+ SET(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
+ ELSE(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES)
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ TRY_COMPILE(${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_ROOT}/Modules/CheckVariableExists.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_VARIABLE_DEFINITIONS}
+ "${CHECK_VARIABLE_EXISTS_ADD_LIBRARIES}"
+ OUTPUT_VARIABLE OUTPUT)
+ IF(${VARIABLE})
+ SET(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}")
+ MESSAGE(STATUS "Looking for ${VAR} - found")
+ 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(${VARIABLE})
+ SET(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}")
+ MESSAGE(STATUS "Looking for ${VAR} - not found")
+ 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")
+ ENDIF(${VARIABLE})
+ ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ENDMACRO(CHECK_VARIABLE_EXISTS)
diff --git a/Modules/Compiler/Absoft-Fortran.cmake b/Modules/Compiler/Absoft-Fortran.cmake
new file mode 100644
index 000000000..1bb7b1f82
--- /dev/null
+++ b/Modules/Compiler/Absoft-Fortran.cmake
@@ -0,0 +1,10 @@
+SET(CMAKE_Fortran_FLAGS_INIT "")
+SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "")
+SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3")
+SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+SET(CMAKE_Fortran_MODDIR_FLAG "-YMOD_OUT_DIR=")
+SET(CMAKE_Fortran_MODPATH_FLAG "-p")
+SET(CMAKE_Fortran_VERBOSE_FLAG "-v")
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree")
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
new file mode 100644
index 000000000..f7baf686a
--- /dev/null
+++ b/Modules/Compiler/Clang-C.cmake
@@ -0,0 +1 @@
+include(Compiler/GNU-C)
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
new file mode 100644
index 000000000..d3c403a69
--- /dev/null
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -0,0 +1 @@
+include(Compiler/GNU-CXX)
diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake
new file mode 100644
index 000000000..675560c2a
--- /dev/null
+++ b/Modules/Compiler/Cray-C.cmake
@@ -0,0 +1 @@
+set(CMAKE_C_VERBOSE_FLAG "-v")
diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake
new file mode 100644
index 000000000..9fb191c75
--- /dev/null
+++ b/Modules/Compiler/Cray-CXX.cmake
@@ -0,0 +1 @@
+set(CMAKE_CXX_VERBOSE_FLAG "-v")
diff --git a/Modules/Compiler/Cray-Fortran.cmake b/Modules/Compiler/Cray-Fortran.cmake
new file mode 100644
index 000000000..5d81bb02c
--- /dev/null
+++ b/Modules/Compiler/Cray-Fortran.cmake
@@ -0,0 +1,6 @@
+set(CMAKE_Fortran_VERBOSE_FLAG "-v")
+set(CMAKE_Fortran_MODOUT_FLAG -em)
+set(CMAKE_Fortran_MODDIR_FLAG -J)
+set(CMAKE_Fortran_MODDIR_DEFAULT .)
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-f fixed")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-f free")
diff --git a/Modules/Compiler/G95-Fortran.cmake b/Modules/Compiler/G95-Fortran.cmake
new file mode 100644
index 000000000..fd84848b4
--- /dev/null
+++ b/Modules/Compiler/G95-Fortran.cmake
@@ -0,0 +1,9 @@
+set(CMAKE_Fortran_FLAGS_INIT "")
+set(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g")
+set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os")
+set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3")
+set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+set(CMAKE_Fortran_MODDIR_FLAG "-fmod=")
+set(CMAKE_Fortran_VERBOSE_FLAG "-v")
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
diff --git a/Modules/Compiler/GNU-ASM.cmake b/Modules/Compiler/GNU-ASM.cmake
new file mode 100644
index 000000000..e07401d54
--- /dev/null
+++ b/Modules/Compiler/GNU-ASM.cmake
@@ -0,0 +1,6 @@
+# This file is loaded when gcc/g++ is used for assembler files (the "ASM" cmake language)
+include(Compiler/GNU)
+
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm)
+
+__compiler_gnu(ASM)
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
new file mode 100644
index 000000000..9a5137a4b
--- /dev/null
+++ b/Modules/Compiler/GNU-C.cmake
@@ -0,0 +1,2 @@
+include(Compiler/GNU)
+__compiler_gnu(C)
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
new file mode 100644
index 000000000..879ab8f80
--- /dev/null
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -0,0 +1,2 @@
+include(Compiler/GNU)
+__compiler_gnu(CXX)
diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake
new file mode 100644
index 000000000..c710e8698
--- /dev/null
+++ b/Modules/Compiler/GNU-Fortran.cmake
@@ -0,0 +1,17 @@
+include(Compiler/GNU)
+__compiler_gnu(Fortran)
+
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
+
+# No -DNDEBUG for Fortran.
+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)
+
+# Fortran-specific feature flags.
+SET(CMAKE_Fortran_MODDIR_FLAG -J)
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
new file mode 100644
index 000000000..6aecf90e8
--- /dev/null
+++ b/Modules/Compiler/GNU.cmake
@@ -0,0 +1,54 @@
+
+#=============================================================================
+# 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 module is shared by multiple languages; use include blocker.
+if(__COMPILER_GNU)
+ return()
+endif()
+set(__COMPILER_GNU 1)
+
+macro(__compiler_gnu lang)
+ # Feature flags.
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ endif()
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+
+ # 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
+ # tests to always succeed. Work around this by disabling dependency tracking
+ # in try_compile mode.
+ GET_PROPERTY(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
+ if(NOT _IN_TC OR CMAKE_FORCE_DEPFILES)
+ # distcc does not transform -o to -MT when invoking the preprocessor
+ # internally, as it ought to. Work around this bug by setting -MT here
+ # even though it isn't strictly necessary.
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-MMD -MT <OBJECT> -MF <DEPFILE>")
+ endif()
+
+ # Initial configuration flags.
+ set(CMAKE_${lang}_FLAGS_INIT "")
+ set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")
+ set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
+ set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
+ set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -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>")
+ if(NOT APPLE)
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
+ endif(NOT APPLE)
+endmacro()
diff --git a/Modules/Compiler/HP-ASM.cmake b/Modules/Compiler/HP-ASM.cmake
new file mode 100644
index 000000000..8aa7bdb7d
--- /dev/null
+++ b/Modules/Compiler/HP-ASM.cmake
@@ -0,0 +1,3 @@
+SET(CMAKE_ASM_VERBOSE_FLAG "-v")
+
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s )
diff --git a/Modules/Compiler/HP-C.cmake b/Modules/Compiler/HP-C.cmake
new file mode 100644
index 000000000..dc7fbb21d
--- /dev/null
+++ b/Modules/Compiler/HP-C.cmake
@@ -0,0 +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>")
diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake
new file mode 100644
index 000000000..82c1a861e
--- /dev/null
+++ b/Modules/Compiler/HP-CXX.cmake
@@ -0,0 +1,4 @@
+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>")
diff --git a/Modules/Compiler/HP-Fortran.cmake b/Modules/Compiler/HP-Fortran.cmake
new file mode 100644
index 000000000..04fb96ea4
--- /dev/null
+++ b/Modules/Compiler/HP-Fortran.cmake
@@ -0,0 +1,3 @@
+SET(CMAKE_Fortran_VERBOSE_FLAG "-v")
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "+source=fixed")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "+source=free")
diff --git a/Modules/Compiler/Intel-ASM.cmake b/Modules/Compiler/Intel-ASM.cmake
new file mode 100644
index 000000000..59b50a15c
--- /dev/null
+++ b/Modules/Compiler/Intel-ASM.cmake
@@ -0,0 +1,13 @@
+SET(CMAKE_ASM_VERBOSE_FLAG "-v")
+
+SET(CMAKE_ASM_FLAGS_INIT "")
+SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+
+IF(UNIX)
+ SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S)
+ELSE(UNIX)
+ SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm)
+ENDIF(UNIX)
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
new file mode 100644
index 000000000..4be91d084
--- /dev/null
+++ b/Modules/Compiler/Intel-C.cmake
@@ -0,0 +1,10 @@
+SET(CMAKE_C_VERBOSE_FLAG "-v")
+
+SET(CMAKE_C_FLAGS_INIT "")
+SET(CMAKE_C_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
+SET(CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
+SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+
+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>")
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
new file mode 100644
index 000000000..ff01a81f6
--- /dev/null
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -0,0 +1,10 @@
+SET(CMAKE_CXX_VERBOSE_FLAG "-v")
+
+SET(CMAKE_CXX_FLAGS_INIT "")
+SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+
+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>")
diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake
new file mode 100644
index 000000000..467abdcf5
--- /dev/null
+++ b/Modules/Compiler/Intel-Fortran.cmake
@@ -0,0 +1,9 @@
+SET(CMAKE_Fortran_FLAGS_INIT "")
+SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os")
+SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3")
+SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+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")
diff --git a/Modules/Compiler/MIPSpro-C.cmake b/Modules/Compiler/MIPSpro-C.cmake
new file mode 100644
index 000000000..abf384ab8
--- /dev/null
+++ b/Modules/Compiler/MIPSpro-C.cmake
@@ -0,0 +1 @@
+SET(CMAKE_C_VERBOSE_FLAG "-v")
diff --git a/Modules/Compiler/MIPSpro-CXX.cmake b/Modules/Compiler/MIPSpro-CXX.cmake
new file mode 100644
index 000000000..f3c6b5f82
--- /dev/null
+++ b/Modules/Compiler/MIPSpro-CXX.cmake
@@ -0,0 +1 @@
+SET(CMAKE_CXX_VERBOSE_FLAG "-v")
diff --git a/Modules/Compiler/MIPSpro-Fortran.cmake b/Modules/Compiler/MIPSpro-Fortran.cmake
new file mode 100644
index 000000000..9220d3bf0
--- /dev/null
+++ b/Modules/Compiler/MIPSpro-Fortran.cmake
@@ -0,0 +1,3 @@
+SET(CMAKE_Fortran_VERBOSE_FLAG "-v")
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixedform")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-freeform")
diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake
new file mode 100644
index 000000000..9a89746b5
--- /dev/null
+++ b/Modules/Compiler/NAG-Fortran.cmake
@@ -0,0 +1,34 @@
+# Help CMAKE_PARSE_IMPLICIT_LINK_INFO detect NAG Fortran object files.
+if(NOT CMAKE_Fortran_COMPILER_WORKS AND NOT CMAKE_Fortran_COMPILER_FORCED)
+ message(STATUS "Detecting NAG Fortran directory")
+ # Run with -dryrun to see sample "link" line.
+ execute_process(
+ COMMAND ${CMAKE_Fortran_COMPILER} dummy.o -dryrun
+ OUTPUT_VARIABLE _dryrun
+ ERROR_VARIABLE _dryrun
+ )
+ # Match an object file.
+ string(REGEX MATCH "/[^ ]*/[^ /][^ /]*\\.o" _nag_obj "${_dryrun}")
+ if(_nag_obj)
+ # Parse object directory and convert to a regex.
+ string(REGEX REPLACE "/[^/]*$" "" _nag_dir "${_nag_obj}")
+ string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _nag_regex "${_nag_dir}")
+ set(CMAKE_Fortran_IMPLICIT_OBJECT_REGEX "^${_nag_regex}/")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Detecting NAG Fortran directory with -dryrun found\n"
+ " object: ${_nag_obj}\n"
+ " directory: ${_nag_dir}\n"
+ " regex: ${CMAKE_Fortran_IMPLICIT_OBJECT_REGEX}\n"
+ "from output:\n${_dryrun}\n\n")
+ message(STATUS "Detecting NAG Fortran directory - ${_nag_dir}")
+ else()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Detecting NAG Fortran directory with -dryrun failed:\n${_dryrun}\n\n")
+ message(STATUS "Detecting NAG Fortran directory - failed")
+ endif()
+endif()
+
+set(CMAKE_Fortran_MODDIR_FLAG "-mdir ")
+set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC")
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
diff --git a/Modules/Compiler/PGI-C.cmake b/Modules/Compiler/PGI-C.cmake
new file mode 100644
index 000000000..da88c0116
--- /dev/null
+++ b/Modules/Compiler/PGI-C.cmake
@@ -0,0 +1,4 @@
+include(Compiler/PGI)
+__compiler_pgi(C)
+set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
+set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG")
diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake
new file mode 100644
index 000000000..97c9555b1
--- /dev/null
+++ b/Modules/Compiler/PGI-CXX.cmake
@@ -0,0 +1,4 @@
+include(Compiler/PGI)
+__compiler_pgi(CXX)
+set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
+set(CMAKE_CXX_FLAGS_RELEASE_INIT "${CMAKE_CXX_FLAGS_RELEASE_INIT} -DNDEBUG")
diff --git a/Modules/Compiler/PGI-Fortran.cmake b/Modules/Compiler/PGI-Fortran.cmake
new file mode 100644
index 000000000..aebc7b1c2
--- /dev/null
+++ b/Modules/Compiler/PGI-Fortran.cmake
@@ -0,0 +1,15 @@
+include(Compiler/PGI)
+__compiler_pgi(Fortran)
+
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-Mnofreeform")
+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
new file mode 100644
index 000000000..162e3c9b8
--- /dev/null
+++ b/Modules/Compiler/PGI.cmake
@@ -0,0 +1,35 @@
+
+#=============================================================================
+# 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 module is shared by multiple languages; use include blocker.
+if(__COMPILER_PGI)
+ return()
+endif()
+set(__COMPILER_PGI 1)
+
+macro(__compiler_pgi lang)
+ # Feature flags.
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v")
+
+ # Initial configuration flags.
+ set(CMAKE_${lang}_FLAGS_INIT "")
+ set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g -O0")
+ set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O2 -s")
+ set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-fast -O3 -Mipa=fast")
+ 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>")
+endmacro()
diff --git a/Modules/Compiler/PathScale-C.cmake b/Modules/Compiler/PathScale-C.cmake
new file mode 100644
index 000000000..9db54afa0
--- /dev/null
+++ b/Modules/Compiler/PathScale-C.cmake
@@ -0,0 +1,4 @@
+include(Compiler/PathScale)
+__compiler_pathscale(C)
+set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
+set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG")
diff --git a/Modules/Compiler/PathScale-CXX.cmake b/Modules/Compiler/PathScale-CXX.cmake
new file mode 100644
index 000000000..4dd766048
--- /dev/null
+++ b/Modules/Compiler/PathScale-CXX.cmake
@@ -0,0 +1,4 @@
+include(Compiler/PathScale)
+__compiler_pathscale(CXX)
+set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
+set(CMAKE_CXX_FLAGS_RELEASE_INIT "${CMAKE_CXX_FLAGS_RELEASE_INIT} -DNDEBUG")
diff --git a/Modules/Compiler/PathScale-Fortran.cmake b/Modules/Compiler/PathScale-Fortran.cmake
new file mode 100644
index 000000000..e05bf2afc
--- /dev/null
+++ b/Modules/Compiler/PathScale-Fortran.cmake
@@ -0,0 +1,6 @@
+include(Compiler/PathScale)
+__compiler_pathscale(Fortran)
+
+SET(CMAKE_Fortran_MODDIR_FLAG "-module ")
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixedform")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-freeform")
diff --git a/Modules/Compiler/PathScale.cmake b/Modules/Compiler/PathScale.cmake
new file mode 100644
index 000000000..107f779a9
--- /dev/null
+++ b/Modules/Compiler/PathScale.cmake
@@ -0,0 +1,31 @@
+
+#=============================================================================
+# Copyright 2002-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.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__COMPILER_PATHSCALE)
+ return()
+endif()
+set(__COMPILER_PATHSCALE 1)
+
+macro(__compiler_pathscale lang)
+ # Feature flags.
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v")
+
+ # Initial configuration flags.
+ set(CMAKE_${lang}_FLAGS_INIT "")
+ set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g -O0")
+ set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os")
+ set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3")
+ set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-g -O2")
+endmacro()
diff --git a/Modules/Compiler/SCO-C.cmake b/Modules/Compiler/SCO-C.cmake
new file mode 100644
index 000000000..6e762ccae
--- /dev/null
+++ b/Modules/Compiler/SCO-C.cmake
@@ -0,0 +1,2 @@
+include(Compiler/SCO)
+__compiler_sco(C)
diff --git a/Modules/Compiler/SCO-CXX.cmake b/Modules/Compiler/SCO-CXX.cmake
new file mode 100644
index 000000000..5b713a0df
--- /dev/null
+++ b/Modules/Compiler/SCO-CXX.cmake
@@ -0,0 +1,2 @@
+include(Compiler/SCO)
+__compiler_sco(CXX)
diff --git a/Modules/Compiler/SCO.cmake b/Modules/Compiler/SCO.cmake
new file mode 100644
index 000000000..f673c8f80
--- /dev/null
+++ b/Modules/Compiler/SCO.cmake
@@ -0,0 +1,28 @@
+
+#=============================================================================
+# Copyright 2002-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.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__COMPILER_SCO)
+ return()
+endif()
+set(__COMPILER_SCO 1)
+
+macro(__compiler_sco lang)
+ # Feature flags.
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC -Kpic)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE -Kpie)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_DLL -belf)
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-Kpic -belf")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-belf -Wl,-Bexport")
+endmacro()
diff --git a/Modules/Compiler/SunPro-ASM.cmake b/Modules/Compiler/SunPro-ASM.cmake
new file mode 100644
index 000000000..dfc5702ee
--- /dev/null
+++ b/Modules/Compiler/SunPro-ASM.cmake
@@ -0,0 +1,24 @@
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s )
+
+SET(CMAKE_ASM_VERBOSE_FLAG "-#")
+
+SET(CMAKE_SHARED_LIBRARY_ASM_FLAGS "-KPIC")
+SET(CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS "-G")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG "-R")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG_SEP ":")
+SET(CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG "-h")
+
+SET(CMAKE_ASM_FLAGS_INIT "")
+SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g -xO2")
+
+# Initialize ASM link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_ASM_FLAGS "-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_ASM_FLAGS "-Bdynamic")
+ENDFOREACH(type)
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
new file mode 100644
index 000000000..a1a3ae118
--- /dev/null
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -0,0 +1,27 @@
+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")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h")
+
+SET(CMAKE_C_FLAGS_INIT "")
+SET(CMAKE_C_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")
+SET(CMAKE_C_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
+SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g -xO2")
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic")
+ENDFOREACH(type)
+
+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>")
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
new file mode 100644
index 000000000..702e42458
--- /dev/null
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -0,0 +1,33 @@
+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")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":")
+SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h")
+
+SET(CMAKE_CXX_FLAGS_INIT "")
+SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g -xO2")
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic")
+ENDFOREACH(type)
+
+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>")
+
+# 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> ")
diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake
new file mode 100644
index 000000000..86d6def34
--- /dev/null
+++ b/Modules/Compiler/SunPro-Fortran.cmake
@@ -0,0 +1,18 @@
+SET(CMAKE_Fortran_VERBOSE_FLAG "-v")
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
+
+SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC")
+SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":")
+SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-h")
+set(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG "-R")
+
+SET(CMAKE_Fortran_FLAGS_INIT "")
+SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")
+SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
+SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2")
+SET(CMAKE_Fortran_MODDIR_FLAG "-moddir=")
+SET(CMAKE_Fortran_MODPATH_FLAG "-M")
diff --git a/Modules/Compiler/TinyCC-C.cmake b/Modules/Compiler/TinyCC-C.cmake
new file mode 100644
index 000000000..4a48c0af5
--- /dev/null
+++ b/Modules/Compiler/TinyCC-C.cmake
@@ -0,0 +1,8 @@
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
+
+# no optimization in tcc:
+SET (CMAKE_C_FLAGS_INIT "")
+SET (CMAKE_C_FLAGS_DEBUG_INIT "-g")
+SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG")
+SET (CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG")
+SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g")
diff --git a/Modules/Compiler/VisualAge-C.cmake b/Modules/Compiler/VisualAge-C.cmake
new file mode 100644
index 000000000..40b609e9a
--- /dev/null
+++ b/Modules/Compiler/VisualAge-C.cmake
@@ -0,0 +1 @@
+include(Compiler/XL-C)
diff --git a/Modules/Compiler/VisualAge-CXX.cmake b/Modules/Compiler/VisualAge-CXX.cmake
new file mode 100644
index 000000000..2509b4396
--- /dev/null
+++ b/Modules/Compiler/VisualAge-CXX.cmake
@@ -0,0 +1 @@
+include(Compiler/XL-CXX)
diff --git a/Modules/Compiler/VisualAge-Fortran.cmake b/Modules/Compiler/VisualAge-Fortran.cmake
new file mode 100644
index 000000000..3ef3178d9
--- /dev/null
+++ b/Modules/Compiler/VisualAge-Fortran.cmake
@@ -0,0 +1 @@
+include(Compiler/XL-Fortran)
diff --git a/Modules/Compiler/XL-ASM.cmake b/Modules/Compiler/XL-ASM.cmake
new file mode 100644
index 000000000..e5d4ffa85
--- /dev/null
+++ b/Modules/Compiler/XL-ASM.cmake
@@ -0,0 +1,13 @@
+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_DEBUG_INIT "-g")
+SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-O -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-O -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g")
+
+SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s )
diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake
new file mode 100644
index 000000000..ae869e37e
--- /dev/null
+++ b/Modules/Compiler/XL-C.cmake
@@ -0,0 +1,9 @@
+include(Compiler/XL)
+__compiler_xl(C)
+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")
diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake
new file mode 100644
index 000000000..29c4b5e37
--- /dev/null
+++ b/Modules/Compiler/XL-CXX.cmake
@@ -0,0 +1,11 @@
+include(Compiler/XL)
+__compiler_xl(CXX)
+set(CMAKE_CXX_FLAGS_RELEASE_INIT "${CMAKE_CXX_FLAGS_RELEASE_INIT} -DNDEBUG")
+set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
+
+# -qthreaded = Ensures that all optimizations will be thread-safe
+# -qhalt=e = Halt on error messages (rather than just severe errors)
+SET(CMAKE_CXX_FLAGS_INIT "-qthreaded -qhalt=e")
+
+SET(CMAKE_CXX_COMPILE_OBJECT
+ "<CMAKE_CXX_COMPILER> -+ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake
new file mode 100644
index 000000000..e7026f11a
--- /dev/null
+++ b/Modules/Compiler/XL-Fortran.cmake
@@ -0,0 +1,17 @@
+include(Compiler/XL)
+__compiler_xl(Fortran)
+
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-qfixed") # [=<right_margin>]
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-qfree") # [=f90|ibm]
+
+SET(CMAKE_Fortran_MODDIR_FLAG "-qmoddir=")
+
+SET(CMAKE_Fortran_DEFINE_FLAG "-WF,-D")
+
+# -qthreaded = Ensures that all optimizations will be thread-safe
+# -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.
+SET(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE)
+SET(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE)
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake
new file mode 100644
index 000000000..d293610c3
--- /dev/null
+++ b/Modules/Compiler/XL.cmake
@@ -0,0 +1,53 @@
+
+#=============================================================================
+# Copyright 2002-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.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__COMPILER_XL)
+ return()
+endif()
+set(__COMPILER_XL 1)
+
+# Find the CreateExportList program that comes with this toolchain.
+find_program(CMAKE_XL_CreateExportList
+ NAMES CreateExportList
+ DOC "IBM XL CreateExportList tool"
+ )
+
+macro(__compiler_xl lang)
+ # Feature flags.
+ set(CMAKE_${lang}_VERBOSE_FLAG "-V")
+
+ set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")
+ 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>")
+
+ # 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
+ # create shared library compile line.
+ if (CMAKE_XL_CreateExportList)
+ # The compiler front-end passes all object files, archive files, and shared
+ # library files named on the command line to CreateExportList to create a
+ # list of all symbols to be exported from the shared library. This causes
+ # all archive members to be copied into the shared library whether they are
+ # needed or not. Instead we run the tool ourselves to pass only the object
+ # files so that we export only the symbols actually provided by the sources.
+ set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
+ "${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>"
+ "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
+ )
+ endif()
+endmacro()
diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake
new file mode 100644
index 000000000..870545471
--- /dev/null
+++ b/Modules/Dart.cmake
@@ -0,0 +1,124 @@
+# - 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(BUILD_TESTING)
+# The BUILD_TESTING option is created by the Dart module to determine
+# whether testing support should be enabled. The default is ON.
+
+# This file configures a project to use the Dart testing/dashboard process.
+# It is broken into 3 sections.
+#
+# Section #1: Locate programs on the client and determine site and build name
+# Section #2: Configure or copy Tcl scripts from the source tree to build tree
+# Section #3: Custom targets for performing dashboard builds.
+#
+#
+
+#=============================================================================
+# 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.)
+
+OPTION(BUILD_TESTING "Build the testing tree." ON)
+
+IF(BUILD_TESTING)
+ FIND_PACKAGE(Dart QUIET)
+
+ #
+ # Section #1:
+ #
+ # CMake commands that will not vary from project to project. Locates programs
+ # on the client and configure site name and build name.
+ #
+
+ SET(RUN_FROM_DART 1)
+ INCLUDE(CTest)
+ SET(RUN_FROM_DART)
+
+ FIND_PROGRAM(COMPRESSIONCOMMAND NAMES gzip compress zip
+ DOC "Path to program used to compress files for transfer to the dart server")
+ FIND_PROGRAM(GUNZIPCOMMAND gunzip DOC "Path to gunzip executable")
+ FIND_PROGRAM(JAVACOMMAND java DOC "Path to java command, used by the Dart server to create html.")
+ OPTION(DART_VERBOSE_BUILD "Show the actual output of the build, or if off show a . for each 1024 bytes."
+ OFF)
+ OPTION(DART_BUILD_ERROR_REPORT_LIMIT "Limit of reported errors, -1 reports all." -1 )
+ OPTION(DART_BUILD_WARNING_REPORT_LIMIT "Limit of reported warnings, -1 reports all." -1 )
+
+ SET(VERBOSE_BUILD ${DART_VERBOSE_BUILD})
+ SET(BUILD_ERROR_REPORT_LIMIT ${DART_BUILD_ERROR_REPORT_LIMIT})
+ SET(BUILD_WARNING_REPORT_LIMIT ${DART_BUILD_WARNING_REPORT_LIMIT})
+ SET (DELIVER_CONTINUOUS_EMAIL "Off" CACHE BOOL "Should Dart server send email when build errors are found in Continuous builds?")
+
+ MARK_AS_ADVANCED(
+ COMPRESSIONCOMMAND
+ DART_BUILD_ERROR_REPORT_LIMIT
+ DART_BUILD_WARNING_REPORT_LIMIT
+ DART_TESTING_TIMEOUT
+ DART_VERBOSE_BUILD
+ DELIVER_CONTINUOUS_EMAIL
+ GUNZIPCOMMAND
+ JAVACOMMAND
+ )
+
+ SET(HAVE_DART)
+ IF(EXISTS "${DART_ROOT}/Source/Client/Dart.conf.in")
+ SET(HAVE_DART 1)
+ ENDIF(EXISTS "${DART_ROOT}/Source/Client/Dart.conf.in")
+
+ #
+ # Section #2:
+ #
+ # Make necessary directories and configure testing scripts
+ #
+ # find a tcl shell command
+ IF(HAVE_DART)
+ FIND_PACKAGE(Tclsh)
+ ENDIF(HAVE_DART)
+
+
+ IF (HAVE_DART)
+ # make directories in the binary tree
+ FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/Testing/HTML/TestingResults/Dashboard"
+ "${PROJECT_BINARY_DIR}/Testing/HTML/TestingResults/Sites/${SITE}/${BUILDNAME}")
+
+ # configure files
+ CONFIGURE_FILE(
+ "${DART_ROOT}/Source/Client/Dart.conf.in"
+ "${PROJECT_BINARY_DIR}/DartConfiguration.tcl" )
+
+ #
+ # Section 3:
+ #
+ # Custom targets to perform dashboard builds and submissions.
+ # These should NOT need to be modified from project to project.
+ #
+
+ # add testing targets
+ SET(DART_EXPERIMENTAL_NAME Experimental)
+ IF(DART_EXPERIMENTAL_USE_PROJECT_NAME)
+ SET(DART_EXPERIMENTAL_NAME "${DART_EXPERIMENTAL_NAME}${PROJECT_NAME}")
+ ENDIF(DART_EXPERIMENTAL_USE_PROJECT_NAME)
+ ENDIF (HAVE_DART)
+
+ SET(RUN_FROM_CTEST_OR_DART 1)
+ INCLUDE(CTestTargets)
+ SET(RUN_FROM_CTEST_OR_DART)
+ENDIF(BUILD_TESTING)
+
+#
+# End of Dart.cmake
+#
+
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
new file mode 100644
index 000000000..ad7f80517
--- /dev/null
+++ b/Modules/DartConfiguration.tcl.in
@@ -0,0 +1,93 @@
+# This file is configured by CMake automatically as DartConfiguration.tcl
+# If you choose not to use CMake, this file may be hand configured, by
+# filling in the required variables.
+
+
+# Configuration directories and files
+SourceDirectory: @PROJECT_SOURCE_DIR@
+BuildDirectory: @PROJECT_BINARY_DIR@
+
+# Where to place the cost data store
+CostDataFile: @CTEST_COST_DATA_FILE@
+
+# Site is something like machine.domain, i.e. pragmatic.crd
+Site: @SITE@
+
+# Build name is osname-revision-compiler, i.e. Linux-2.4.2-2smp-c++
+BuildName: @BUILDNAME@
+
+# Submission information
+IsCDash: @CTEST_DROP_SITE_CDASH@
+CDashVersion: @CTEST_CDASH_VERSION@
+QueryCDashVersion: @CTEST_CDASH_QUERY_VERSION@
+DropSite: @DROP_SITE@
+DropLocation: @DROP_LOCATION@
+DropSiteUser: @DROP_SITE_USER@
+DropSitePassword: @DROP_SITE_PASSWORD@
+DropSiteMode: @DROP_SITE_MODE@
+DropMethod: @DROP_METHOD@
+TriggerSite: @TRIGGER_SITE@
+ScpCommand: @SCPCOMMAND@
+
+# Dashboard start time
+NightlyStartTime: @NIGHTLY_START_TIME@
+
+# Commands for the build/test/submit cycle
+ConfigureCommand: "@CMAKE_COMMAND@" "@PROJECT_SOURCE_DIR@"
+MakeCommand: @MAKECOMMAND@
+DefaultCTestConfigurationType: @DEFAULT_CTEST_CONFIGURATION_TYPE@
+
+# CVS options
+# Default is "-d -P -A"
+CVSCommand: @CVSCOMMAND@
+CVSUpdateOptions: @CVS_UPDATE_OPTIONS@
+
+# Subversion options
+SVNCommand: @SVNCOMMAND@
+SVNUpdateOptions: @SVN_UPDATE_OPTIONS@
+
+# Git options
+GITCommand: @GITCOMMAND@
+GITUpdateOptions: @GIT_UPDATE_OPTIONS@
+GITUpdateCustom: @CTEST_GIT_UPDATE_CUSTOM@
+
+# Generic update command
+UpdateCommand: @UPDATE_COMMAND@
+UpdateOptions: @UPDATE_OPTIONS@
+UpdateType: @UPDATE_TYPE@
+
+# Compiler info
+Compiler: @CMAKE_CXX_COMPILER@
+
+# Dynamic analysis (MemCheck)
+PurifyCommand: @PURIFYCOMMAND@
+ValgrindCommand: @VALGRIND_COMMAND@
+ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@
+MemoryCheckCommand: @MEMORYCHECK_COMMAND@
+MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@
+MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@
+
+# Coverage
+CoverageCommand: @COVERAGE_COMMAND@
+CoverageExtraFlags: @COVERAGE_EXTRA_FLAGS@
+
+# Cluster commands
+SlurmBatchCommand: @SLURM_SBATCH_COMMAND@
+SlurmRunCommand: @SLURM_SRUN_COMMAND@
+
+# Testing options
+# TimeOut is the amount of time in seconds to wait for processes
+# to complete during testing. After TimeOut seconds, the
+# process will be summarily terminated.
+# Currently set to 25 minutes
+TimeOut: @DART_TESTING_TIMEOUT@
+
+UseLaunchers: @CTEST_USE_LAUNCHERS@
+CurlOptions: @CTEST_CURL_OPTIONS@
+# warning, if you add new options here that have to do with submit,
+# you have to update cmCTestSubmitCommand.cxx
+
+# For CTest submissions that timeout, these options
+# specify behavior for retrying the submission
+CTestSubmitRetryDelay: @CTEST_SUBMIT_RETRY_DELAY@
+CTestSubmitRetryCount: @CTEST_SUBMIT_RETRY_COUNT@
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
new file mode 100644
index 000000000..edf4b4e76
--- /dev/null
+++ b/Modules/DeployQt4.cmake
@@ -0,0 +1,301 @@
+# - 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
+# Requires CMake 2.6 or greater because it uses function and
+# PARENT_SCOPE. Also depends on BundleUtilities.cmake.
+#
+# 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>])
+# 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.
+#
+# 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.
+#
+# <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.
+#
+# <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.
+#
+# 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.
+#
+# 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.
+
+#=============================================================================
+# Copyright 2011 Mike McQuaid <mike@mikemcquaid.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.)
+
+# The functions defined in this file depend on the fixup_bundle function
+# (and others) found in BundleUtilities.cmake
+
+include(BundleUtilities)
+set(DeployQt4_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
+set(DeployQt4_apple_plugins_dir "PlugIns")
+
+function(write_qt4_conf qt_conf_dir qt_conf_contents)
+ set(qt_conf_path "${qt_conf_dir}/qt.conf")
+ message(STATUS "Writing ${qt_conf_path}")
+ file(WRITE "${qt_conf_path}" "${qt_conf_contents}")
+endfunction()
+
+function(resolve_qt4_paths paths_var)
+ set(executable_path ${ARGV1})
+
+ set(paths_resolved)
+ foreach(path ${${paths_var}})
+ if(EXISTS "${path}")
+ list(APPEND paths_resolved "${path}")
+ else()
+ if(${executable_path})
+ list(APPEND paths_resolved "${executable_path}/${path}")
+ else()
+ list(APPEND paths_resolved "\${CMAKE_INSTALL_PREFIX}/${path}")
+ endif()
+ endif()
+ endforeach()
+ set(${paths_var} ${paths_resolved} PARENT_SCOPE)
+endfunction()
+
+function(fixup_qt4_executable executable)
+ set(qtplugins ${ARGV1})
+ set(libs ${ARGV2})
+ set(dirs ${ARGV3})
+ set(plugins_dir ${ARGV4})
+ set(request_qt_conf ${ARGV5})
+
+ message(STATUS "fixup_qt4_executable")
+ message(STATUS " executable='${executable}'")
+ message(STATUS " qtplugins='${qtplugins}'")
+ message(STATUS " libs='${libs}'")
+ message(STATUS " dirs='${dirs}'")
+ message(STATUS " plugins_dir='${plugins_dir}'")
+ message(STATUS " request_qt_conf='${request_qt_conf}'")
+
+ if(QT_LIBRARY_DIR)
+ list(APPEND dirs "${QT_LIBRARY_DIR}")
+ endif()
+ if(QT_BINARY_DIR)
+ list(APPEND dirs "${QT_BINARY_DIR}")
+ endif()
+
+ if(APPLE)
+ set(qt_conf_dir "${executable}/Contents/Resources")
+ set(executable_path "${executable}")
+ set(write_qt_conf TRUE)
+ if(NOT plugins_dir)
+ set(plugins_dir "${DeployQt4_apple_plugins_dir}")
+ endif()
+ else()
+ get_filename_component(executable_path "${executable}" PATH)
+ if(NOT executable_path)
+ set(executable_path ".")
+ endif()
+ set(qt_conf_dir "${executable_path}")
+ set(write_qt_conf ${request_qt_conf})
+ endif()
+
+ foreach(plugin ${qtplugins})
+ set(installed_plugin_path "")
+ install_qt4_plugin("${plugin}" "${executable}" 1 installed_plugin_path)
+ list(APPEND libs ${installed_plugin_path})
+ endforeach()
+
+ foreach(lib ${libs})
+ if(NOT EXISTS "${lib}")
+ message(FATAL_ERROR "Library does not exist: ${lib}")
+ endif()
+ endforeach()
+
+ resolve_qt4_paths(libs "${executable_path}")
+
+ if(write_qt_conf)
+ set(qt_conf_contents "[Paths]\nPlugins = ${plugins_dir}")
+ write_qt4_conf("${qt_conf_dir}" "${qt_conf_contents}")
+ endif()
+
+ fixup_bundle("${executable}" "${libs}" "${dirs}")
+endfunction()
+
+function(install_qt4_plugin_path plugin executable copy installed_plugin_path_var)
+ set(plugins_dir ${ARGV4})
+ set(component ${ARGV5})
+ set(configurations ${ARGV6})
+ if(EXISTS "${plugin}")
+ if(APPLE)
+ if(NOT plugins_dir)
+ set(plugins_dir "${DeployQt4_apple_plugins_dir}")
+ endif()
+ set(plugins_path "${executable}/Contents/${plugins_dir}")
+ else()
+ get_filename_component(plugins_path "${executable}" PATH)
+ if(NOT plugins_path)
+ set(plugins_path ".")
+ endif()
+ if(plugins_dir)
+ set(plugins_path "${plugins_path}/${plugins_dir}")
+ endif()
+ endif()
+
+ set(plugin_group "")
+
+ get_filename_component(plugin_path "${plugin}" PATH)
+ get_filename_component(plugin_parent_path "${plugin_path}" PATH)
+ get_filename_component(plugin_parent_dir_name "${plugin_parent_path}" NAME)
+ get_filename_component(plugin_name "${plugin}" NAME)
+ string(TOLOWER "${plugin_parent_dir_name}" plugin_parent_dir_name)
+
+ if("${plugin_parent_dir_name}" STREQUAL "plugins")
+ get_filename_component(plugin_group "${plugin_path}" NAME)
+ set(${plugin_group_var} "${plugin_group}")
+ endif()
+ set(plugins_path "${plugins_path}/${plugin_group}")
+
+ if(${copy})
+ file(MAKE_DIRECTORY "${plugins_path}")
+ file(COPY "${plugin}" DESTINATION "${plugins_path}")
+ else()
+ if(configurations AND (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE))
+ set(configurations CONFIGURATIONS ${configurations})
+ else()
+ unset(configurations)
+ endif()
+ install(FILES "${plugin}" DESTINATION "${plugins_path}" ${configurations} ${component})
+ endif()
+ set(${installed_plugin_path_var} "${plugins_path}/${plugin_name}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(install_qt4_plugin plugin executable copy installed_plugin_path_var)
+ set(plugins_dir ${ARGV4})
+ set(component ${ARGV5})
+ if(EXISTS "${plugin}")
+ install_qt4_plugin_path("${plugin}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}")
+ else()
+ string(TOUPPER "QT_${plugin}_PLUGIN" plugin_var)
+ set(plugin_release_var "${plugin_var}_RELEASE")
+ set(plugin_debug_var "${plugin_var}_DEBUG")
+ set(plugin_release "${${plugin_release_var}}")
+ set(plugin_debug "${${plugin_debug_var}}")
+ if(DEFINED "${plugin_release_var}" AND DEFINED "${plugin_debug_var}" AND NOT EXISTS "${plugin_release}" AND NOT EXISTS "${plugin_debug}")
+ message(WARNING "Qt plugin \"${plugin}\" not recognized or found.")
+ endif()
+ if(NOT EXISTS "${${plugin_debug_var}}")
+ set(plugin_debug "${plugin_release}")
+ endif()
+
+ if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}_release" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel")
+ install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}_debug" "${plugins_dir}" "${component}" "Debug")
+
+ if(CMAKE_BUILD_TYPE MATCHES "^Debug$")
+ set(${installed_plugin_path_var} ${${installed_plugin_path_var}_debug})
+ else()
+ set(${installed_plugin_path_var} ${${installed_plugin_path_var}_release})
+ endif()
+ else()
+ install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}")
+ endif()
+ endif()
+ set(${installed_plugin_path_var} ${${installed_plugin_path_var}} PARENT_SCOPE)
+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})
+ if(QT_LIBRARY_DIR)
+ list(APPEND dirs "${QT_LIBRARY_DIR}")
+ endif()
+ if(QT_BINARY_DIR)
+ list(APPEND dirs "${QT_BINARY_DIR}")
+ endif()
+ if(component)
+ set(component COMPONENT ${component})
+ else()
+ unset(component)
+ endif()
+
+ get_filename_component(executable_absolute "${executable}" ABSOLUTE)
+ if(EXISTS "${QT_QTCORE_LIBRARY_RELEASE}")
+ gp_file_type("${executable_absolute}" "${QT_QTCORE_LIBRARY_RELEASE}" qtcore_type)
+ elseif(EXISTS "${QT_QTCORE_LIBRARY_DEBUG}")
+ gp_file_type("${executable_absolute}" "${QT_QTCORE_LIBRARY_DEBUG}" qtcore_type)
+ endif()
+ if(qtcore_type STREQUAL "system")
+ set(qt_plugins_dir "")
+ endif()
+
+ if(QT_IS_STATIC)
+ message(WARNING "Qt built statically: not installing plugins.")
+ else()
+ foreach(plugin ${qtplugins})
+ set(installed_plugin_paths "")
+ install_qt4_plugin("${plugin}" "${executable}" 0 installed_plugin_paths "${plugins_dir}" "${component}")
+ list(APPEND libs ${installed_plugin_paths})
+ endforeach()
+ endif()
+
+ resolve_qt4_paths(libs "")
+
+ install(CODE
+ "INCLUDE(\"${DeployQt4_cmake_dir}/DeployQt4.cmake\")
+ SET(BU_CHMOD_BUNDLE_ITEMS TRUE)
+ FIXUP_QT4_EXECUTABLE(\"\${CMAKE_INSTALL_PREFIX}/${executable}\" \"\" \"${libs}\" \"${dirs}\" \"${plugins_dir}\" \"${request_qt_conf}\")"
+ ${component}
+ )
+endfunction()
diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake
new file mode 100644
index 000000000..ffeb371cc
--- /dev/null
+++ b/Modules/Documentation.cmake
@@ -0,0 +1,52 @@
+# - DocumentationVTK.cmake
+# This file provides support for the VTK documentation framework.
+# It relies on several tools (Doxygen, Perl, etc).
+
+#=============================================================================
+# 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.)
+
+#
+# Build the documentation ?
+#
+OPTION(BUILD_DOCUMENTATION "Build the documentation (Doxygen)." OFF)
+MARK_AS_ADVANCED(BUILD_DOCUMENTATION)
+
+IF (BUILD_DOCUMENTATION)
+
+ #
+ # Check for the tools
+ #
+ FIND_PACKAGE(UnixCommands)
+ FIND_PACKAGE(Doxygen)
+ FIND_PACKAGE(Gnuplot)
+ FIND_PACKAGE(HTMLHelp)
+ FIND_PACKAGE(Perl)
+ FIND_PACKAGE(Wget)
+
+ OPTION(DOCUMENTATION_HTML_HELP
+ "Build the HTML Help file (CHM)." OFF)
+
+ OPTION(DOCUMENTATION_HTML_TARZ
+ "Build a compressed tar archive of the HTML doc." OFF)
+
+ MARK_AS_ADVANCED(
+ DOCUMENTATION_HTML_HELP
+ DOCUMENTATION_HTML_TARZ
+ )
+
+ #
+ # The documentation process is controled by a batch file.
+ # We will probably need bash to create the custom target
+ #
+
+ENDIF (BUILD_DOCUMENTATION)
diff --git a/Modules/DummyCXXFile.cxx b/Modules/DummyCXXFile.cxx
new file mode 100644
index 000000000..f8b643afb
--- /dev/null
+++ b/Modules/DummyCXXFile.cxx
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
new file mode 100644
index 000000000..a0a9aead5
--- /dev/null
+++ b/Modules/ExternalProject.cmake
@@ -0,0 +1,1553 @@
+# - 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_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
+# [URL /.../src.tgz] # Full path or URL of source
+# [URL_MD5 md5] # MD5 checksum of file at URL
+# [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_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.
+#
+# 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)
+
+#=============================================================================
+# Copyright 2008-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.)
+
+# Pre-compute a regex to match documented keywords for each command.
+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_]+\\()")
+foreach(line IN LISTS lines)
+ if("${line}" MATCHES "^# [A-Za-z0-9_]+\\(")
+ if(_ep_func)
+ set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$")
+ endif()
+ string(REGEX REPLACE "^# ([A-Za-z0-9_]+)\\(.*" "\\1" _ep_func "${line}")
+ #message("function [${_ep_func}]")
+ set(_ep_keywords_${_ep_func} "^(")
+ set(_ep_keyword_sep)
+ else()
+ string(REGEX REPLACE "^# \\[([A-Z0-9_]+) .*" "\\1" _ep_key "${line}")
+ #message(" keyword [${_ep_key}]")
+ set(_ep_keywords_${_ep_func}
+ "${_ep_keywords_${_ep_func}}${_ep_keyword_sep}${_ep_key}")
+ set(_ep_keyword_sep "|")
+ endif()
+endforeach()
+if(_ep_func)
+ set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$")
+endif()
+
+
+function(_ep_parse_arguments f name ns args)
+ # Transfer the arguments to this function into target properties for the
+ # new custom target we just added so that we can set up all the build steps
+ # correctly based on target properties.
+ #
+ # We loop through ARGN and consider the namespace starting with an
+ # upper-case letter followed by at least two more upper-case letters,
+ # numbers or underscores to be keywords.
+ set(key)
+
+ foreach(arg IN LISTS 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 arg MATCHES "^(TRUE|FALSE)$")
+ if(_ep_keywords_${f} AND arg MATCHES "${_ep_keywords_${f}}")
+ set(is_value 0)
+ endif()
+ endif()
+
+ if(is_value)
+ if(key)
+ # Value
+ if(NOT arg STREQUAL "")
+ set_property(TARGET ${name} APPEND PROPERTY ${ns}${key} "${arg}")
+ else()
+ get_property(have_key TARGET ${name} PROPERTY ${ns}${key} SET)
+ if(have_key)
+ get_property(value TARGET ${name} PROPERTY ${ns}${key})
+ set_property(TARGET ${name} PROPERTY ${ns}${key} "${value};${arg}")
+ else()
+ set_property(TARGET ${name} PROPERTY ${ns}${key} "${arg}")
+ endif()
+ endif()
+ else()
+ # Missing Keyword
+ message(AUTHOR_WARNING "value '${arg}' with no previous keyword in ${f}")
+ endif()
+ else()
+ set(key "${arg}")
+ endif()
+ endforeach()
+endfunction(_ep_parse_arguments)
+
+
+define_property(DIRECTORY PROPERTY "EP_BASE" INHERITED
+ BRIEF_DOCS "Base directory for External Project storage."
+ FULL_DOCS
+ "See documentation of the ExternalProject_Add() function in the "
+ "ExternalProject module."
+ )
+
+define_property(DIRECTORY PROPERTY "EP_PREFIX" INHERITED
+ BRIEF_DOCS "Top prefix for External Project storage."
+ FULL_DOCS
+ "See documentation of the ExternalProject_Add() function in the "
+ "ExternalProject module."
+ )
+
+define_property(DIRECTORY PROPERTY "EP_STEP_TARGETS" INHERITED
+ BRIEF_DOCS
+ "List of ExternalProject steps that automatically get corresponding targets"
+ FULL_DOCS
+ "See documentation of the ExternalProject_Add_StepTargets() 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)
+ file(WRITE ${script_filename}
+"if(\"${git_tag}\" STREQUAL \"\")
+ message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
+endif()
+
+set(run 0)
+
+if(\"${gitclone_infofile}\" IS_NEWER_THAN \"${gitclone_stampfile}\")
+ set(run 1)
+endif()
+
+if(NOT run)
+ message(STATUS \"Avoiding repeated git clone, stamp file is up to date: '${gitclone_stampfile}'\")
+ return()
+endif()
+
+execute_process(
+ COMMAND \${CMAKE_COMMAND} -E remove_directory \"${source_dir}\"
+ RESULT_VARIABLE error_code
+ )
+if(error_code)
+ message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\")
+endif()
+
+execute_process(
+ COMMAND \"${git_EXECUTABLE}\" clone \"${git_repository}\" \"${src_name}\"
+ WORKING_DIRECTORY \"${work_dir}\"
+ RESULT_VARIABLE error_code
+ )
+if(error_code)
+ message(FATAL_ERROR \"Failed to clone repository: '${git_repository}'\")
+endif()
+
+execute_process(
+ COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag}
+ WORKING_DIRECTORY \"${work_dir}/${src_name}\"
+ RESULT_VARIABLE error_code
+ )
+if(error_code)
+ message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
+endif()
+
+execute_process(
+ COMMAND \"${git_EXECUTABLE}\" submodule init
+ WORKING_DIRECTORY \"${work_dir}/${src_name}\"
+ RESULT_VARIABLE error_code
+ )
+if(error_code)
+ message(FATAL_ERROR \"Failed to init submodules in: '${work_dir}/${src_name}'\")
+endif()
+
+execute_process(
+ COMMAND \"${git_EXECUTABLE}\" submodule update --recursive
+ WORKING_DIRECTORY \"${work_dir}/${src_name}\"
+ RESULT_VARIABLE error_code
+ )
+if(error_code)
+ message(FATAL_ERROR \"Failed to update submodules in: '${work_dir}/${src_name}'\")
+endif()
+
+# Complete success, update the script-last-run stamp file:
+#
+execute_process(
+ COMMAND \${CMAKE_COMMAND} -E copy
+ \"${gitclone_infofile}\"
+ \"${gitclone_stampfile}\"
+ WORKING_DIRECTORY \"${work_dir}/${src_name}\"
+ RESULT_VARIABLE error_code
+ )
+if(error_code)
+ message(FATAL_ERROR \"Failed to copy script-last-run stamp file: '${gitclone_stampfile}'\")
+endif()
+
+"
+)
+
+endfunction(_ep_write_gitclone_script)
+
+
+function(_ep_write_downloadfile_script script_filename remote local timeout md5)
+ if(timeout)
+ set(timeout_args TIMEOUT ${timeout})
+ set(timeout_msg "${timeout} seconds")
+ else()
+ set(timeout_args "# no TIMEOUT")
+ set(timeout_msg "none")
+ endif()
+
+ if(md5)
+ set(md5_args EXPECTED_MD5 ${md5})
+ else()
+ set(md5_args "# no EXPECTED_MD5")
+ endif()
+
+ file(WRITE ${script_filename}
+"message(STATUS \"downloading...
+ src='${remote}'
+ dst='${local}'
+ timeout='${timeout_msg}'\")
+
+file(DOWNLOAD
+ \"${remote}\"
+ \"${local}\"
+ SHOW_PROGRESS
+ ${md5_args}
+ ${timeout_args}
+ STATUS status
+ LOG log)
+
+list(GET status 0 status_code)
+list(GET status 1 status_string)
+
+if(NOT status_code EQUAL 0)
+ message(FATAL_ERROR \"error: downloading '${remote}' failed
+ status_code: \${status_code}
+ status_string: \${status_string}
+ log: \${log}
+\")
+endif()
+
+message(STATUS \"downloading... done\")
+"
+)
+
+endfunction(_ep_write_downloadfile_script)
+
+
+function(_ep_write_verifyfile_script script_filename local md5)
+ file(WRITE ${script_filename}
+"message(STATUS \"verifying file...
+ file='${local}'\")
+
+set(verified 0)
+
+# If an expected md5 checksum exists, compare against it:
+#
+if(NOT \"${md5}\" STREQUAL \"\")
+ execute_process(COMMAND \${CMAKE_COMMAND} -E md5sum \"${local}\"
+ OUTPUT_VARIABLE ov
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE rv)
+
+ if(NOT rv EQUAL 0)
+ message(FATAL_ERROR \"error: computing md5sum of '${local}' failed\")
+ endif()
+
+ string(REGEX MATCH \"^([0-9A-Fa-f]+)\" md5_actual \"\${ov}\")
+
+ string(TOLOWER \"\${md5_actual}\" md5_actual)
+ string(TOLOWER \"${md5}\" md5)
+
+ if(NOT \"\${md5}\" STREQUAL \"\${md5_actual}\")
+ message(FATAL_ERROR \"error: md5sum of '${local}' does not match expected value
+ md5_expected: \${md5}
+ md5_actual: \${md5_actual}
+\")
+ endif()
+
+ set(verified 1)
+endif()
+
+if(verified)
+ message(STATUS \"verifying file... done\")
+else()
+ message(STATUS \"verifying file... warning: did not verify file - no URL_MD5 checksum argument? corrupt file?\")
+endif()
+"
+)
+
+endfunction(_ep_write_verifyfile_script)
+
+
+function(_ep_write_extractfile_script script_filename name filename directory)
+ set(args "")
+
+ if(filename MATCHES "(\\.|=)(bz2|tar\\.gz|tgz|zip)$")
+ set(args xfz)
+ endif()
+
+ if(filename MATCHES "(\\.|=)tar$")
+ set(args xf)
+ 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")
+ return()
+ endif()
+
+ file(WRITE ${script_filename}
+"# Make file names absolute:
+#
+get_filename_component(filename \"${filename}\" ABSOLUTE)
+get_filename_component(directory \"${directory}\" ABSOLUTE)
+
+message(STATUS \"extracting...
+ src='\${filename}'
+ dst='\${directory}'\")
+
+if(NOT EXISTS \"\${filename}\")
+ message(FATAL_ERROR \"error: file to extract does not exist: '\${filename}'\")
+endif()
+
+# Prepare a space for extracting:
+#
+set(i 1234)
+while(EXISTS \"\${directory}/../ex-${name}\${i}\")
+ math(EXPR i \"\${i} + 1\")
+endwhile()
+set(ut_dir \"\${directory}/../ex-${name}\${i}\")
+file(MAKE_DIRECTORY \"\${ut_dir}\")
+
+# Extract it:
+#
+message(STATUS \"extracting... [tar ${args}]\")
+execute_process(COMMAND \${CMAKE_COMMAND} -E tar ${args} \${filename}
+ WORKING_DIRECTORY \${ut_dir}
+ RESULT_VARIABLE rv)
+
+if(NOT rv EQUAL 0)
+ message(STATUS \"extracting... [error clean up]\")
+ file(REMOVE_RECURSE \"\${ut_dir}\")
+ message(FATAL_ERROR \"error: extract of '\${filename}' failed\")
+endif()
+
+# Analyze what came out of the tar file:
+#
+message(STATUS \"extracting... [analysis]\")
+file(GLOB contents \"\${ut_dir}/*\")
+list(LENGTH contents n)
+if(NOT n EQUAL 1 OR NOT IS_DIRECTORY \"\${contents}\")
+ set(contents \"\${ut_dir}\")
+endif()
+
+# Move \"the one\" directory to the final directory:
+#
+message(STATUS \"extracting... [rename]\")
+file(REMOVE_RECURSE \${directory})
+get_filename_component(contents \${contents} ABSOLUTE)
+file(RENAME \${contents} \${directory})
+
+# Clean up:
+#
+message(STATUS \"extracting... [clean up]\")
+file(REMOVE_RECURSE \"\${ut_dir}\")
+
+message(STATUS \"extracting... done\")
+"
+)
+
+endfunction(_ep_write_extractfile_script)
+
+
+function(_ep_set_directories name)
+ get_property(prefix TARGET ${name} PROPERTY _EP_PREFIX)
+ if(NOT prefix)
+ get_property(prefix DIRECTORY PROPERTY EP_PREFIX)
+ if(NOT prefix)
+ get_property(base DIRECTORY PROPERTY EP_BASE)
+ if(NOT base)
+ set(prefix "${name}-prefix")
+ endif()
+ endif()
+ endif()
+ if(prefix)
+ set(tmp_default "${prefix}/tmp")
+ set(download_default "${prefix}/src")
+ set(source_default "${prefix}/src/${name}")
+ set(binary_default "${prefix}/src/${name}-build")
+ set(stamp_default "${prefix}/src/${name}-stamp")
+ set(install_default "${prefix}")
+ else() # assert(base)
+ set(tmp_default "${base}/tmp/${name}")
+ set(download_default "${base}/Download/${name}")
+ set(source_default "${base}/Source/${name}")
+ set(binary_default "${base}/Build/${name}")
+ set(stamp_default "${base}/Stamp/${name}")
+ set(install_default "${base}/Install/${name}")
+ endif()
+ get_property(build_in_source TARGET ${name} PROPERTY _EP_BUILD_IN_SOURCE)
+ if(build_in_source)
+ get_property(have_binary_dir TARGET ${name} PROPERTY _EP_BINARY_DIR SET)
+ if(have_binary_dir)
+ message(FATAL_ERROR
+ "External project ${name} has both BINARY_DIR and BUILD_IN_SOURCE!")
+ endif()
+ endif()
+ set(top "${CMAKE_CURRENT_BINARY_DIR}")
+ set(places stamp download source binary install tmp)
+ foreach(var ${places})
+ string(TOUPPER "${var}" VAR)
+ get_property(${var}_dir TARGET ${name} PROPERTY _EP_${VAR}_DIR)
+ if(NOT ${var}_dir)
+ set(${var}_dir "${${var}_default}")
+ endif()
+ if(NOT IS_ABSOLUTE "${${var}_dir}")
+ get_filename_component(${var}_dir "${top}/${${var}_dir}" ABSOLUTE)
+ endif()
+ set_property(TARGET ${name} PROPERTY _EP_${VAR}_DIR "${${var}_dir}")
+ endforeach()
+ if(build_in_source)
+ get_property(source_dir TARGET ${name} PROPERTY _EP_SOURCE_DIR)
+ set_property(TARGET ${name} PROPERTY _EP_BINARY_DIR "${source_dir}")
+ endif()
+
+ # Make the directories at CMake configure time *and* add a custom command
+ # to make them at build time. They need to exist at makefile generation
+ # time for Borland make and wmake so that CMake may generate makefiles
+ # with "cd C:\short\paths\with\no\spaces" commands in them.
+ #
+ # Additionally, the add_custom_command is still used in case somebody
+ # removes one of the necessary directories and tries to rebuild without
+ # re-running cmake.
+ foreach(var ${places})
+ string(TOUPPER "${var}" VAR)
+ get_property(dir TARGET ${name} PROPERTY _EP_${VAR}_DIR)
+ file(MAKE_DIRECTORY "${dir}")
+ if(NOT EXISTS "${dir}")
+ message(FATAL_ERROR "dir '${dir}' does not exist after file(MAKE_DIRECTORY)")
+ endif()
+ endforeach()
+endfunction(_ep_set_directories)
+
+
+# IMPORTANT: this MUST be a macro and not a function because of the
+# in-place replacements that occur in each ${var}
+#
+macro(_ep_replace_location_tags target_name)
+ set(vars ${ARGN})
+ foreach(var ${vars})
+ if(${var})
+ foreach(dir SOURCE_DIR BINARY_DIR INSTALL_DIR TMP_DIR)
+ get_property(val TARGET ${target_name} PROPERTY _EP_${dir})
+ string(REPLACE "<${dir}>" "${val}" ${var} "${${var}}")
+ endforeach()
+ endif()
+ endforeach()
+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
+ set(script_initial_cache "")
+ set(regex "^([^:]+):([^=]+)=(.*)$")
+ set(setArg "")
+ foreach(line ${args})
+ if("${line}" MATCHES "^-D")
+ 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(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}")
+ set(setArg "set(${name} \"${value}")
+ else()
+ message(WARNING "Line '${line}' does not match regex. Ignoring.")
+ endif()
+ else()
+ # Assume this is a list to append to the last var
+ set(accumulator "${accumulator};${line}")
+ endif()
+ endforeach()
+ # Catch the final line of the args
+ if(setArg)
+ set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)")
+ set(script_initial_cache "${script_initial_cache}\n${setArg}")
+ endif()
+ # 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}")
+endfunction(_ep_write_initial_cache)
+
+
+function(ExternalProject_Get_Property name)
+ foreach(var ${ARGN})
+ string(TOUPPER "${var}" VAR)
+ get_property(${var} TARGET ${name} PROPERTY _EP_${VAR})
+ if(NOT ${var})
+ message(FATAL_ERROR "External project \"${name}\" has no ${var}")
+ endif()
+ set(${var} "${${var}}" PARENT_SCOPE)
+ endforeach()
+endfunction(ExternalProject_Get_Property)
+
+
+function(_ep_get_configure_command_id name cfg_cmd_id_var)
+ get_target_property(cmd ${name} _EP_CONFIGURE_COMMAND)
+
+ if(cmd STREQUAL "")
+ # Explicit empty string means no configure step for this project
+ set(${cfg_cmd_id_var} "none" PARENT_SCOPE)
+ else()
+ if(NOT cmd)
+ # Default is "use cmake":
+ set(${cfg_cmd_id_var} "cmake" PARENT_SCOPE)
+ else()
+ # Otherwise we have to analyze the value:
+ if(cmd MATCHES "^[^;]*/configure")
+ set(${cfg_cmd_id_var} "configure" PARENT_SCOPE)
+ elseif(cmd MATCHES "^[^;]*/cmake" AND NOT cmd MATCHES ";-[PE];")
+ set(${cfg_cmd_id_var} "cmake" PARENT_SCOPE)
+ elseif(cmd MATCHES "config")
+ set(${cfg_cmd_id_var} "configure" PARENT_SCOPE)
+ else()
+ set(${cfg_cmd_id_var} "unknown:${cmd}" PARENT_SCOPE)
+ endif()
+ endif()
+ endif()
+endfunction(_ep_get_configure_command_id)
+
+
+function(_ep_get_build_command name step cmd_var)
+ set(cmd "${${cmd_var}}")
+ if(NOT cmd)
+ set(args)
+ _ep_get_configure_command_id(${name} cfg_cmd_id)
+ if(cfg_cmd_id STREQUAL "cmake")
+ # CMake project. Select build command based on generator.
+ get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
+ if("${CMAKE_GENERATOR}" MATCHES "Make" AND
+ ("${cmake_generator}" MATCHES "Make" OR NOT cmake_generator))
+ # The project uses the same Makefile generator. Use recursive make.
+ set(cmd "$(MAKE)")
+ if(step STREQUAL "INSTALL")
+ set(args install)
+ endif()
+ if(step STREQUAL "TEST")
+ set(args test)
+ endif()
+ else()
+ # Drive the project with "cmake --build".
+ get_target_property(cmake_command ${name} _EP_CMAKE_COMMAND)
+ if(cmake_command)
+ set(cmd "${cmake_command}")
+ else()
+ set(cmd "${CMAKE_COMMAND}")
+ endif()
+ set(args --build ${binary_dir} --config ${CMAKE_CFG_INTDIR})
+ if(step STREQUAL "INSTALL")
+ list(APPEND args --target install)
+ endif()
+ # But for "TEST" drive the project with corresponding "ctest".
+ if(step STREQUAL "TEST")
+ string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}")
+ set(args "")
+ endif()
+ endif()
+ else() # if(cfg_cmd_id STREQUAL "configure")
+ # Non-CMake project. Guess "make" and "make install" and "make test".
+ if("${CMAKE_GENERATOR}" MATCHES "Makefiles")
+ # Try to get the parallel arguments
+ set(cmd "$(MAKE)")
+ else()
+ set(cmd "make")
+ endif()
+ if(step STREQUAL "INSTALL")
+ set(args install)
+ endif()
+ if(step STREQUAL "TEST")
+ set(args test)
+ endif()
+ endif()
+
+ # Use user-specified arguments instead of default arguments, if any.
+ get_property(have_args TARGET ${name} PROPERTY _EP_${step}_ARGS SET)
+ if(have_args)
+ get_target_property(args ${name} _EP_${step}_ARGS)
+ endif()
+
+ list(APPEND cmd ${args})
+ endif()
+
+ set(${cmd_var} "${cmd}" PARENT_SCOPE)
+endfunction(_ep_get_build_command)
+
+function(_ep_write_log_script name step cmd_var)
+ ExternalProject_Get_Property(${name} stamp_dir)
+ set(command "${${cmd_var}}")
+
+ set(make "")
+ set(code_cygpath_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}")
+ set(make "-Dmake=$(MAKE)")
+
+ if(WIN32 AND NOT CYGWIN)
+ set(code_cygpath_make "
+if(\${make} MATCHES \"^/\")
+ execute_process(
+ COMMAND cygpath -w \${make}
+ OUTPUT_VARIABLE cygpath_make
+ ERROR_VARIABLE cygpath_make
+ RESULT_VARIABLE cygpath_error
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(NOT cygpath_error)
+ set(make \${cygpath_make})
+ endif()
+endif()
+")
+ endif()
+ endif()
+
+ set(config "")
+ if("${CMAKE_CFG_INTDIR}" MATCHES "^\\$")
+ string(REPLACE "${CMAKE_CFG_INTDIR}" "\${config}" command "${command}")
+ set(config "-Dconfig=${CMAKE_CFG_INTDIR}")
+ 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;")
+ set(code_execute_process "
+${code_cygpath_make}
+execute_process(COMMAND \${command} RESULT_VARIABLE result)
+if(result)
+ set(msg \"Command failed (\${result}):\\n\")
+ foreach(arg IN LISTS command)
+ set(msg \"\${msg} '\${arg}'\")
+ endforeach(arg)
+ message(FATAL_ERROR \"\${msg}\")
+endif()
+")
+ set(code "")
+ set(cmd "")
+ set(sep "")
+ foreach(arg IN LISTS command)
+ if("x${arg}" STREQUAL "xCOMMAND")
+ set(code "${code}set(command \"${cmd}\")${code_execute_process}")
+ set(cmd "")
+ set(sep "")
+ else()
+ set(cmd "${cmd}${sep}${arg}")
+ set(sep ";")
+ endif()
+ endforeach()
+ set(code "set(ENV{VS_UNICODE_OUTPUT} \"\")\n${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)
+ endif()
+
+ # Wrap the command in a script to log output to files.
+ set(script ${stamp_dir}/${name}-${step}.cmake)
+ set(logbase ${stamp_dir}/${name}-${step})
+ file(WRITE ${script} "
+${code_cygpath_make}
+set(ENV{VS_UNICODE_OUTPUT} \"\")
+set(command \"${command}\")
+execute_process(
+ COMMAND \${command}
+ RESULT_VARIABLE result
+ OUTPUT_FILE \"${logbase}-out.log\"
+ ERROR_FILE \"${logbase}-err.log\"
+ )
+if(result)
+ set(msg \"Command failed: \${result}\\n\")
+ foreach(arg IN LISTS command)
+ set(msg \"\${msg} '\${arg}'\")
+ endforeach(arg)
+ set(msg \"\${msg}\\nSee also\\n ${logbase}-*.log\\n\")
+ message(FATAL_ERROR \"\${msg}\")
+else()
+ set(msg \"${name} ${step} command succeeded. See also ${logbase}-*.log\\n\")
+ message(STATUS \"\${msg}\")
+endif()
+")
+ set(command ${CMAKE_COMMAND} ${make} ${config} -P ${script})
+ set(${cmd_var} "${command}" PARENT_SCOPE)
+endfunction(_ep_write_log_script)
+
+# This module used to use "/${CMAKE_CFG_INTDIR}" directly and produced
+# makefiles with "/./" in paths for custom command dependencies. Which
+# resulted in problems with parallel make -j invocations.
+#
+# This function was added so that the suffix (search below for ${cfgdir}) is
+# only set to "/${CMAKE_CFG_INTDIR}" when ${CMAKE_CFG_INTDIR} is not going to
+# be "." (multi-configuration build systems like Visual Studio and Xcode...)
+#
+function(_ep_get_configuration_subdir_suffix suffix_var)
+ set(suffix "")
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(suffix "/${CMAKE_CFG_INTDIR}")
+ endif()
+ set(${suffix_var} "${suffix}" PARENT_SCOPE)
+endfunction(_ep_get_configuration_subdir_suffix)
+
+
+function(_ep_get_step_stampfile name step stampfile_var)
+ ExternalProject_Get_Property(${name} stamp_dir)
+
+ _ep_get_configuration_subdir_suffix(cfgdir)
+ set(stampfile "${stamp_dir}${cfgdir}/${name}-${step}")
+
+ set(${stampfile_var} "${stampfile}" PARENT_SCOPE)
+endfunction()
+
+
+function(ExternalProject_Add_StepTargets name)
+ set(steps ${ARGN})
+
+ foreach(step ${steps})
+ _ep_get_step_stampfile(${name} ${step} stamp_file)
+ add_custom_target(${name}-${step}
+ DEPENDS ${stamp_file})
+
+ # 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()
+ endforeach()
+endfunction(ExternalProject_Add_StepTargets)
+
+
+function(ExternalProject_Add_Step name step)
+ set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
+ _ep_get_configuration_subdir_suffix(cfgdir)
+
+ 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}")
+
+ # Steps depending on this step.
+ get_property(dependers TARGET ${name} PROPERTY _EP_${step}_DEPENDERS)
+ foreach(depender IN LISTS dependers)
+ _ep_get_step_stampfile(${name} ${depender} depender_stamp_file)
+ add_custom_command(APPEND
+ OUTPUT ${depender_stamp_file}
+ DEPENDS ${stamp_file}
+ )
+ endforeach()
+
+ # Dependencies on files.
+ get_property(depends TARGET ${name} PROPERTY _EP_${step}_DEPENDS)
+
+ # Dependencies on steps.
+ get_property(dependees TARGET ${name} PROPERTY _EP_${step}_DEPENDEES)
+ foreach(dependee IN LISTS dependees)
+ _ep_get_step_stampfile(${name} ${dependee} dependee_stamp_file)
+ list(APPEND depends ${dependee_stamp_file})
+ endforeach()
+
+ # The command to run.
+ get_property(command TARGET ${name} PROPERTY _EP_${step}_COMMAND)
+ if(command)
+ set(comment "Performing ${step} step for '${name}'")
+ else()
+ set(comment "No ${step} step for '${name}'")
+ endif()
+ get_property(work_dir TARGET ${name} PROPERTY _EP_${step}_WORKING_DIRECTORY)
+
+ # Replace list separators.
+ get_property(sep TARGET ${name} PROPERTY _EP_LIST_SEPARATOR)
+ if(sep AND command)
+ string(REPLACE "${sep}" "\\;" command "${command}")
+ endif()
+
+ # Replace location tags.
+ _ep_replace_location_tags(${name} comment command work_dir)
+
+ # Custom comment?
+ get_property(comment_set TARGET ${name} PROPERTY _EP_${step}_COMMENT SET)
+ if(comment_set)
+ get_property(comment TARGET ${name} PROPERTY _EP_${step}_COMMENT)
+ 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)
+ else()
+ set(touch ${CMAKE_COMMAND} -E touch ${stamp_file})
+ endif()
+
+ # Wrap with log script?
+ get_property(log TARGET ${name} PROPERTY _EP_${step}_LOG)
+ if(command AND log)
+ _ep_write_log_script(${name} ${step} command)
+ endif()
+
+ add_custom_command(
+ OUTPUT ${stamp_file}
+ COMMENT ${comment}
+ COMMAND ${command}
+ COMMAND ${touch}
+ DEPENDS ${depends}
+ WORKING_DIRECTORY ${work_dir}
+ VERBATIM
+ )
+
+ # Add custom "step target"?
+ get_property(step_targets TARGET ${name} PROPERTY _EP_STEP_TARGETS)
+ if(NOT step_targets)
+ get_property(step_targets DIRECTORY PROPERTY EP_STEP_TARGETS)
+ endif()
+ foreach(st ${step_targets})
+ if("${st}" STREQUAL "${step}")
+ ExternalProject_Add_StepTargets(${name} ${step})
+ break()
+ endif()
+ endforeach()
+endfunction(ExternalProject_Add_Step)
+
+
+function(_ep_add_mkdir_command name)
+ ExternalProject_Get_Property(${name}
+ source_dir binary_dir install_dir stamp_dir download_dir tmp_dir)
+
+ _ep_get_configuration_subdir_suffix(cfgdir)
+
+ ExternalProject_Add_Step(${name} mkdir
+ COMMENT "Creating directories for '${name}'"
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${source_dir}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${binary_dir}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${install_dir}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${tmp_dir}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${stamp_dir}${cfgdir}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${download_dir}
+ )
+endfunction(_ep_add_mkdir_command)
+
+
+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 "")
+ set(${empty_var} 1 PARENT_SCOPE)
+ else()
+ set(${empty_var} 0 PARENT_SCOPE)
+ endif()
+endfunction()
+
+
+function(_ep_add_download_command name)
+ ExternalProject_Get_Property(${name} source_dir stamp_dir download_dir tmp_dir)
+
+ get_property(cmd_set TARGET ${name} PROPERTY _EP_DOWNLOAD_COMMAND SET)
+ get_property(cmd TARGET ${name} PROPERTY _EP_DOWNLOAD_COMMAND)
+ get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY)
+ get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY)
+ get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY)
+ get_property(url TARGET ${name} PROPERTY _EP_URL)
+
+ # TODO: Perhaps file:// should be copied to download dir before extraction.
+ string(REGEX REPLACE "^file://" "" url "${url}")
+
+ set(depends)
+ set(comment)
+ set(work_dir)
+
+ if(cmd_set)
+ set(work_dir ${download_dir})
+ elseif(cvs_repository)
+ find_package(CVS)
+ if(NOT CVS_EXECUTABLE)
+ message(FATAL_ERROR "error: could not find cvs for checkout of ${name}")
+ endif()
+
+ get_target_property(cvs_module ${name} _EP_CVS_MODULE)
+ if(NOT cvs_module)
+ message(FATAL_ERROR "error: no CVS_MODULE")
+ endif()
+
+ get_property(cvs_tag TARGET ${name} PROPERTY _EP_CVS_TAG)
+
+ set(repository ${cvs_repository})
+ set(module ${cvs_module})
+ set(tag ${cvs_tag})
+ configure_file(
+ "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
+ "${stamp_dir}/${name}-cvsinfo.txt"
+ @ONLY
+ )
+
+ get_filename_component(src_name "${source_dir}" NAME)
+ get_filename_component(work_dir "${source_dir}" PATH)
+ set(comment "Performing download step (CVS checkout) for '${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)
+ if(NOT Subversion_SVN_EXECUTABLE)
+ message(FATAL_ERROR "error: could not find svn for checkout of ${name}")
+ endif()
+
+ get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION)
+ get_property(svn_username TARGET ${name} PROPERTY _EP_SVN_USERNAME)
+ get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD)
+ get_property(svn_trust_cert TARGET ${name} PROPERTY _EP_SVN_TRUST_CERT)
+
+ set(repository "${svn_repository} user=${svn_username} password=${svn_password}")
+ set(module)
+ set(tag ${svn_revision})
+ configure_file(
+ "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
+ "${stamp_dir}/${name}-svninfo.txt"
+ @ONLY
+ )
+
+ get_filename_component(src_name "${source_dir}" NAME)
+ get_filename_component(work_dir "${source_dir}" PATH)
+ set(comment "Performing download step (SVN checkout) for '${name}'")
+ set(svn_user_pw_args "")
+ if(svn_username)
+ set(svn_user_pw_args ${svn_user_pw_args} "--username=${svn_username}")
+ endif()
+ if(svn_password)
+ set(svn_user_pw_args ${svn_user_pw_args} "--password=${svn_password}")
+ endif()
+ if(svn_trust_cert)
+ set(svn_trust_cert_args --trust-server-cert)
+ endif()
+ set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} ${svn_revision}
+ --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)
+ 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}'")
+ endif()
+
+ get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG)
+ if(NOT git_tag)
+ set(git_tag "master")
+ endif()
+
+ # For the download step, and the git clone operation, only the repository
+ # should be recorded in a configured RepositoryInfo file. If the repo
+ # changes, the clone script should be run again. But if only the tag
+ # changes, avoid running the clone script again. Let the 'always' running
+ # update step checkout the new tag.
+ #
+ set(repository ${git_repository})
+ set(module)
+ set(tag)
+ configure_file(
+ "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
+ "${stamp_dir}/${name}-gitinfo.txt"
+ @ONLY
+ )
+
+ get_filename_component(src_name "${source_dir}" NAME)
+ get_filename_component(work_dir "${source_dir}" PATH)
+
+ # Since git clone doesn't succeed if the non-empty source_dir exists,
+ # create a cmake script to invoke as download command.
+ # 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}
+ ${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(url)
+ get_filename_component(work_dir "${source_dir}" PATH)
+ get_property(md5 TARGET ${name} PROPERTY _EP_URL_MD5)
+ set(repository "external project URL")
+ set(module "${url}")
+ set(tag "${md5}")
+ configure_file(
+ "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
+ "${stamp_dir}/${name}-urlinfo.txt"
+ @ONLY
+ )
+ list(APPEND depends ${stamp_dir}/${name}-urlinfo.txt)
+ if(IS_DIRECTORY "${url}")
+ get_filename_component(abs_dir "${url}" ABSOLUTE)
+ set(comment "Performing download step (DIR copy) for '${name}'")
+ set(cmd ${CMAKE_COMMAND} -E remove_directory ${source_dir}
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${abs_dir} ${source_dir})
+ else()
+ if("${url}" MATCHES "^[a-z]+://")
+ # TODO: Should download and extraction be different steps?
+ string(REGEX MATCH "[^/\\?]*$" fname "${url}")
+ if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$")
+ string(REGEX MATCH "([^/\\?]+(\\.|=)(bz2|tar|tgz|tar\\.gz|zip))/.*$" match_result "${url}")
+ set(fname "${CMAKE_MATCH_1}")
+ endif()
+ if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|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)
+ _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${md5}")
+ set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake
+ COMMAND)
+ 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}" "${md5}")
+ 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}")
+ list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake)
+ endif()
+ 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 or DOWNLOAD_COMMAND")
+ endif()
+ endif()
+
+ get_property(log TARGET ${name} PROPERTY _EP_LOG_DOWNLOAD)
+ if(log)
+ set(log LOG 1)
+ else()
+ set(log "")
+ endif()
+
+ ExternalProject_Add_Step(${name} download
+ COMMENT ${comment}
+ COMMAND ${cmd}
+ WORKING_DIRECTORY ${work_dir}
+ DEPENDS ${depends}
+ DEPENDEES mkdir
+ ${log}
+ )
+endfunction(_ep_add_download_command)
+
+
+function(_ep_add_update_command name)
+ ExternalProject_Get_Property(${name} source_dir)
+
+ get_property(cmd_set TARGET ${name} PROPERTY _EP_UPDATE_COMMAND SET)
+ get_property(cmd TARGET ${name} PROPERTY _EP_UPDATE_COMMAND)
+ get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY)
+ get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY)
+ get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY)
+
+ set(work_dir)
+ set(comment)
+ set(always)
+
+ if(cmd_set)
+ set(work_dir ${source_dir})
+ elseif(cvs_repository)
+ if(NOT CVS_EXECUTABLE)
+ message(FATAL_ERROR "error: could not find cvs for update of ${name}")
+ endif()
+ set(work_dir ${source_dir})
+ set(comment "Performing update step (CVS update) for '${name}'")
+ get_property(cvs_tag TARGET ${name} PROPERTY _EP_CVS_TAG)
+ set(cmd ${CVS_EXECUTABLE} -d ${cvs_repository} -q up -dP ${cvs_tag})
+ set(always 1)
+ elseif(svn_repository)
+ if(NOT Subversion_SVN_EXECUTABLE)
+ message(FATAL_ERROR "error: could not find svn for update of ${name}")
+ endif()
+ set(work_dir ${source_dir})
+ set(comment "Performing update step (SVN update) for '${name}'")
+ get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION)
+ get_property(svn_username TARGET ${name} PROPERTY _EP_SVN_USERNAME)
+ get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD)
+ get_property(svn_trust_cert TARGET ${name} PROPERTY _EP_SVN_TRUST_CERT)
+ set(svn_user_pw_args "")
+ if(svn_username)
+ set(svn_user_pw_args ${svn_user_pw_args} "--username=${svn_username}")
+ endif()
+ if(svn_password)
+ set(svn_user_pw_args ${svn_user_pw_args} "--password=${svn_password}")
+ endif()
+ if(svn_trust_cert)
+ set(svn_trust_cert_args --trust-server-cert)
+ endif()
+ set(cmd ${Subversion_SVN_EXECUTABLE} up ${svn_revision}
+ --non-interactive ${svn_trust_cert_args} ${svn_user_pw_args})
+ set(always 1)
+ elseif(git_repository)
+ if(NOT GIT_EXECUTABLE)
+ message(FATAL_ERROR "error: could not find git for fetch of ${name}")
+ endif()
+ set(work_dir ${source_dir})
+ set(comment "Performing update step (git fetch) for '${name}'")
+ get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG)
+ if(NOT git_tag)
+ set(git_tag "master")
+ endif()
+ set(cmd ${GIT_EXECUTABLE} fetch
+ COMMAND ${GIT_EXECUTABLE} checkout ${git_tag}
+ COMMAND ${GIT_EXECUTABLE} submodule update --recursive
+ )
+ set(always 1)
+ endif()
+
+ get_property(log TARGET ${name} PROPERTY _EP_LOG_UPDATE)
+ if(log)
+ set(log LOG 1)
+ else()
+ set(log "")
+ endif()
+
+ ExternalProject_Add_Step(${name} update
+ COMMENT ${comment}
+ COMMAND ${cmd}
+ ALWAYS ${always}
+ WORKING_DIRECTORY ${work_dir}
+ DEPENDEES download
+ ${log}
+ )
+endfunction(_ep_add_update_command)
+
+
+function(_ep_add_patch_command name)
+ ExternalProject_Get_Property(${name} source_dir)
+
+ get_property(cmd_set TARGET ${name} PROPERTY _EP_PATCH_COMMAND SET)
+ get_property(cmd TARGET ${name} PROPERTY _EP_PATCH_COMMAND)
+
+ set(work_dir)
+
+ if(cmd_set)
+ set(work_dir ${source_dir})
+ endif()
+
+ ExternalProject_Add_Step(${name} patch
+ COMMAND ${cmd}
+ WORKING_DIRECTORY ${work_dir}
+ DEPENDEES download
+ )
+endfunction(_ep_add_patch_command)
+
+
+# TODO: Make sure external projects use the proper compiler
+function(_ep_add_configure_command name)
+ ExternalProject_Get_Property(${name} source_dir binary_dir tmp_dir)
+
+ # Depend on other external projects (file-level).
+ set(file_deps)
+ get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
+ foreach(dep IN LISTS deps)
+ _ep_get_step_stampfile(${dep} "done" done_stamp_file)
+ list(APPEND file_deps ${done_stamp_file})
+ endforeach()
+
+ get_property(cmd_set TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND SET)
+ if(cmd_set)
+ get_property(cmd TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND)
+ else()
+ get_target_property(cmake_command ${name} _EP_CMAKE_COMMAND)
+ if(cmake_command)
+ set(cmd "${cmake_command}")
+ else()
+ set(cmd "${CMAKE_COMMAND}")
+ endif()
+
+ 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
+ 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}")
+ list(APPEND cmd "-C${_ep_cache_args_script}")
+ endif()
+
+ get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
+ if(cmake_generator)
+ list(APPEND cmd "-G${cmake_generator}" "${source_dir}")
+ else()
+ if(CMAKE_EXTRA_GENERATOR)
+ list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}"
+ "${source_dir}")
+ else()
+ list(APPEND cmd "-G${CMAKE_GENERATOR}" "${source_dir}")
+ endif()
+ endif()
+ endif()
+
+ # If anything about the configure command changes, (command itself, cmake
+ # used, cmake args or cmake generator) then re-run the configure step.
+ # Fixes issue http://public.kitware.com/Bug/view.php?id=10258
+ #
+ if(NOT EXISTS ${tmp_dir}/${name}-cfgcmd.txt.in)
+ file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='\@cmd\@'\n")
+ endif()
+ configure_file(${tmp_dir}/${name}-cfgcmd.txt.in ${tmp_dir}/${name}-cfgcmd.txt)
+ list(APPEND file_deps ${tmp_dir}/${name}-cfgcmd.txt)
+ list(APPEND file_deps ${_ep_cache_args_script})
+
+ get_property(log TARGET ${name} PROPERTY _EP_LOG_CONFIGURE)
+ if(log)
+ set(log LOG 1)
+ else()
+ set(log "")
+ endif()
+
+ ExternalProject_Add_Step(${name} configure
+ COMMAND ${cmd}
+ WORKING_DIRECTORY ${binary_dir}
+ DEPENDEES update patch
+ DEPENDS ${file_deps}
+ ${log}
+ )
+endfunction(_ep_add_configure_command)
+
+
+function(_ep_add_build_command name)
+ ExternalProject_Get_Property(${name} binary_dir)
+
+ get_property(cmd_set TARGET ${name} PROPERTY _EP_BUILD_COMMAND SET)
+ if(cmd_set)
+ get_property(cmd TARGET ${name} PROPERTY _EP_BUILD_COMMAND)
+ else()
+ _ep_get_build_command(${name} BUILD cmd)
+ endif()
+
+ get_property(log TARGET ${name} PROPERTY _EP_LOG_BUILD)
+ if(log)
+ set(log LOG 1)
+ else()
+ set(log "")
+ endif()
+
+ ExternalProject_Add_Step(${name} build
+ COMMAND ${cmd}
+ WORKING_DIRECTORY ${binary_dir}
+ DEPENDEES configure
+ ${log}
+ )
+endfunction(_ep_add_build_command)
+
+
+function(_ep_add_install_command name)
+ ExternalProject_Get_Property(${name} binary_dir)
+
+ get_property(cmd_set TARGET ${name} PROPERTY _EP_INSTALL_COMMAND SET)
+ if(cmd_set)
+ get_property(cmd TARGET ${name} PROPERTY _EP_INSTALL_COMMAND)
+ else()
+ _ep_get_build_command(${name} INSTALL cmd)
+ endif()
+
+ get_property(log TARGET ${name} PROPERTY _EP_LOG_INSTALL)
+ if(log)
+ set(log LOG 1)
+ else()
+ set(log "")
+ endif()
+
+ ExternalProject_Add_Step(${name} install
+ COMMAND ${cmd}
+ WORKING_DIRECTORY ${binary_dir}
+ DEPENDEES build
+ ${log}
+ )
+endfunction(_ep_add_install_command)
+
+
+function(_ep_add_test_command name)
+ ExternalProject_Get_Property(${name} binary_dir)
+
+ get_property(before TARGET ${name} PROPERTY _EP_TEST_BEFORE_INSTALL)
+ get_property(after TARGET ${name} PROPERTY _EP_TEST_AFTER_INSTALL)
+ 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)
+ get_property(cmd TARGET ${name} PROPERTY _EP_TEST_COMMAND)
+ else()
+ _ep_get_build_command(${name} TEST cmd)
+ endif()
+
+ if(before)
+ set(dep_args DEPENDEES build DEPENDERS install)
+ else()
+ set(dep_args DEPENDEES install)
+ endif()
+
+ get_property(log TARGET ${name} PROPERTY _EP_LOG_TEST)
+ if(log)
+ set(log LOG 1)
+ else()
+ set(log "")
+ endif()
+
+ ExternalProject_Add_Step(${name} test
+ COMMAND ${cmd}
+ WORKING_DIRECTORY ${binary_dir}
+ ${dep_args}
+ ${log}
+ )
+ endif()
+endfunction(_ep_add_test_command)
+
+
+function(ExternalProject_Add name)
+ _ep_get_configuration_subdir_suffix(cfgdir)
+
+ # Add a custom target for the external project.
+ set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
+ set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete")
+
+ add_custom_target(${name} ALL DEPENDS ${complete_stamp_file})
+ set_property(TARGET ${name} PROPERTY _EP_IS_EXTERNAL_PROJECT 1)
+ _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)
+
+ # 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
+ # rebuilds. It is important that 'done' is not the output of any
+ # custom command so that CMake does not propagate build rules to
+ # other external project targets, which may cause problems during
+ # parallel builds. However, the Ninja generator needs to see the entire
+ # dependency graph, and can cope with custom commands belonging to
+ # multiple targets, so we add the 'done' mark as an output for Ninja only.
+ set(complete_outputs ${complete_stamp_file})
+ if(${CMAKE_GENERATOR} MATCHES "Ninja")
+ set(complete_outputs ${complete_outputs} ${done_stamp_file})
+ endif()
+
+ add_custom_command(
+ OUTPUT ${complete_outputs}
+ COMMENT "Completed '${name}'"
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${cmf_dir}${cfgdir}
+ COMMAND ${CMAKE_COMMAND} -E touch ${complete_stamp_file}
+ COMMAND ${CMAKE_COMMAND} -E touch ${done_stamp_file}
+ DEPENDS ${install_stamp_file}
+ VERBATIM
+ )
+
+
+ # Depend on other external projects (target-level).
+ get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
+ foreach(arg IN LISTS deps)
+ add_dependencies(${name} ${arg})
+ endforeach()
+
+ # Set up custom build steps based on the target properties.
+ # Each step depends on the previous one.
+ #
+ # The target depends on the output of the final step.
+ # (Already set up above in the DEPENDS of the add_custom_target command.)
+ #
+ _ep_add_mkdir_command(${name})
+ _ep_add_download_command(${name})
+ _ep_add_update_command(${name})
+ _ep_add_patch_command(${name})
+ _ep_add_configure_command(${name})
+ _ep_add_build_command(${name})
+ _ep_add_install_command(${name})
+
+ # Test is special in that it might depend on build, or it might depend
+ # on install.
+ #
+ _ep_add_test_command(${name})
+endfunction(ExternalProject_Add)
diff --git a/Modules/FLTKCompatibility.cmake b/Modules/FLTKCompatibility.cmake
new file mode 100644
index 000000000..6b6f9607b
--- /dev/null
+++ b/Modules/FLTKCompatibility.cmake
@@ -0,0 +1,15 @@
+
+#=============================================================================
+# 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.)
+
+INCLUDE(CheckIncludeFile)
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
new file mode 100644
index 000000000..a5b94d199
--- /dev/null
+++ b/Modules/FeatureSummary.cmake
@@ -0,0 +1,466 @@
+# - 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.
+#
+# 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.
+# 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.
+#
+# 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.")
+#
+#
+# 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.
+#
+# 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:")
+#
+# SET_FEATURE_INFO(<name> <description> [<url>] )
+# Does the same as SET_PACKAGE_INFO(<name> <description> <url> )
+
+#=============================================================================
+# 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.)
+
+INCLUDE(CMakeParseArguments)
+
+
+FUNCTION(ADD_FEATURE_INFO _name _enabled _desc)
+ IF (${_enabled})
+ SET_PROPERTY(GLOBAL APPEND PROPERTY ENABLED_FEATURES "${_name}")
+ ELSE ()
+ SET_PROPERTY(GLOBAL APPEND PROPERTY DISABLED_FEATURES "${_name}")
+ ENDIF ()
+
+ SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
+ENDFUNCTION(ADD_FEATURE_INFO)
+
+
+
+FUNCTION(SET_PACKAGE_PROPERTIES _name _props)
+ IF(NOT "${_props}" STREQUAL "PROPERTIES")
+ MESSAGE(FATAL_ERROR "PROPERTIES keyword is missing in SET_PACKAGE_PROPERTIES() call.")
+ ENDIF()
+
+ SET(options ) # none
+ SET(oneValueArgs DESCRIPTION URL TYPE PURPOSE )
+ SET(multiValueArgs ) # none
+
+ CMAKE_PARSE_ARGUMENTS(_SPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ IF(_SPP_UNPARSED_ARGUMENTS)
+ MESSAGE(FATAL_ERROR "Unknown keywords given to SET_PACKAGE_PROPERTIES(): \"${_SPP_UNPARSED_ARGUMENTS}\"")
+ ENDIF()
+
+ IF(_SPP_DESCRIPTION)
+ GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION)
+ IF(_info AND NOT "${_info}" STREQUAL "${_SPP_DESCRIPTION}")
+ MESSAGE(STATUS "Warning: Property DESCRIPTION for package ${_name} already set to \"${_info}\", overriding it with \"${_SPP_DESCRIPTION}\"")
+ ENDIF()
+
+ SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_SPP_DESCRIPTION}" )
+ ENDIF()
+
+
+ IF(_SPP_URL)
+ GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_name}_URL)
+ IF(_info AND NOT "${_info}" STREQUAL "${_SPP_URL}")
+ MESSAGE(STATUS "Warning: Property URL already set to \"${_info}\", overriding it with \"${_SPP_URL}\"")
+ ENDIF()
+
+ SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_SPP_URL}" )
+ ENDIF()
+
+
+ # handle the PURPOSE: use APPEND, since there can be multiple purposes for one package inside a project
+ IF(_SPP_PURPOSE)
+ SET_PROPERTY(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_SPP_PURPOSE}" )
+ ENDIF()
+
+ # handle the TYPE
+ IF(NOT _SPP_TYPE)
+ SET(_SPP_TYPE OPTIONAL)
+ ENDIF()
+
+ # List the supported types, according to their priority
+ SET(validTypes "RUNTIME" "OPTIONAL" "RECOMMENDED" "REQUIRED" )
+ LIST(FIND validTypes ${_SPP_TYPE} _typeIndexInList)
+ IF("${_typeIndexInList}" STREQUAL "-1" )
+ MESSAGE(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). "
+ "Valid types are OPTIONAL, RECOMMENDED, REQUIRED and RUNTIME." )
+ ENDIF()
+
+ GET_PROPERTY(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE)
+ LIST(FIND validTypes "${_previousType}" _prevTypeIndexInList)
+
+ # make sure a previously set TYPE is not overridden with a lower new TYPE:
+ IF("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}")
+ SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" )
+ ENDIF()
+
+ENDFUNCTION(SET_PACKAGE_PROPERTIES)
+
+
+
+FUNCTION(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
+
+ SET(_type "ANY")
+ IF("${_property}" MATCHES "REQUIRED_")
+ SET(_type "REQUIRED")
+ ELSEIF("${_property}" MATCHES "RECOMMENDED_")
+ SET(_type "RECOMMENDED")
+ ELSEIF("${_property}" MATCHES "RUNTIME_")
+ SET(_type "RUNTIME")
+ ELSEIF("${_property}" MATCHES "OPTIONAL_")
+ SET(_type "OPTIONAL")
+ ENDIF()
+
+ IF("${_property}" MATCHES "PACKAGES_FOUND")
+ SET(_property "PACKAGES_FOUND")
+ ELSEIF("${_property}" MATCHES "PACKAGES_NOT_FOUND")
+ SET(_property "PACKAGES_NOT_FOUND")
+ ENDIF()
+
+
+ SET(_currentFeatureText "")
+ GET_PROPERTY(_EnabledFeatures GLOBAL PROPERTY ${_property})
+
+ FOREACH(_currentFeature ${_EnabledFeatures})
+
+ # does this package belong to the type we currently want to list ?
+ GET_PROPERTY(_currentType GLOBAL PROPERTY _CMAKE_${_currentFeature}_TYPE)
+ IF(NOT _currentType)
+ SET(_currentType OPTIONAL)
+ ENDIF()
+
+ IF("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}")
+
+ # check whether the current feature/package should be in the output depending on whether it was QUIET or not
+ SET(includeThisOne TRUE)
+ # skip QUIET packages, except if they are REQUIRED or INCLUDE_QUIET_PACKAGES has been set
+ IF((NOT "${_currentType}" STREQUAL "REQUIRED") AND NOT _includeQuiet)
+ GET_PROPERTY(_isQuiet GLOBAL PROPERTY _CMAKE_${_currentFeature}_QUIET)
+ IF(_isQuiet)
+ SET(includeThisOne FALSE)
+ ENDIF()
+ ENDIF()
+
+ IF(includeThisOne)
+
+ SET(_currentFeatureText "${_currentFeatureText}\n * ${_currentFeature}")
+ GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_REQUIRED_VERSION)
+ IF(_info)
+ SET(_currentFeatureText "${_currentFeatureText} (required version ${_info})")
+ ENDIF(_info)
+ GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION)
+ IF(_info)
+ SET(_currentFeatureText "${_currentFeatureText} , ${_info}")
+ ENDIF(_info)
+ GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL)
+ IF(_info)
+ SET(_currentFeatureText "${_currentFeatureText} , <${_info}>")
+ ENDIF(_info)
+
+ GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE)
+ FOREACH(_purpose ${_info})
+ SET(_currentFeatureText "${_currentFeatureText}\n ${_purpose}")
+ ENDFOREACH()
+
+ ENDIF(includeThisOne)
+
+ ENDIF("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}")
+
+ ENDFOREACH(_currentFeature)
+ SET(${_var} "${_currentFeatureText}" PARENT_SCOPE)
+ENDFUNCTION(_FS_GET_FEATURE_SUMMARY)
+
+
+
+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
+
+ CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
+
+ IF(_FS_UNPARSED_ARGUMENTS)
+ MESSAGE(FATAL_ERROR "Unknown keywords given to FEATURE_SUMMARY(): \"${_FS_UNPARSED_ARGUMENTS}\"")
+ ENDIF()
+
+ IF(NOT _FS_WHAT)
+ MESSAGE(FATAL_ERROR "The call to FEATURE_SUMMARY() doesn't set the required WHAT argument.")
+ ENDIF()
+
+ SET(validWhatParts "ENABLED_FEATURES"
+ "DISABLED_FEATURES"
+ "PACKAGES_FOUND"
+ "PACKAGES_NOT_FOUND"
+ "OPTIONAL_PACKAGES_FOUND"
+ "OPTIONAL_PACKAGES_NOT_FOUND"
+ "RECOMMENDED_PACKAGES_FOUND"
+ "RECOMMENDED_PACKAGES_NOT_FOUND"
+ "REQUIRED_PACKAGES_FOUND"
+ "REQUIRED_PACKAGES_NOT_FOUND"
+ "RUNTIME_PACKAGES_FOUND"
+ "RUNTIME_PACKAGES_NOT_FOUND")
+
+ LIST(FIND validWhatParts "${_FS_WHAT}" indexInList)
+ IF(NOT "${indexInList}" STREQUAL "-1")
+ _FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary ${_FS_INCLUDE_QUIET_PACKAGES} )
+ SET(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n")
+ IF (("${_FS_WHAT}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") AND _featureSummary)
+ SET(requiredPackagesNotFound TRUE)
+ ENDIF()
+
+ ELSEIF("${_FS_WHAT}" STREQUAL "ALL")
+
+ SET(allWhatParts "ENABLED_FEATURES"
+ "RUNTIME_PACKAGES_FOUND"
+ "OPTIONAL_PACKAGES_FOUND"
+ "RECOMMENDED_PACKAGES_FOUND"
+ "REQUIRED_PACKAGES_FOUND"
+
+ "DISABLED_FEATURES"
+ "RUNTIME_PACKAGES_NOT_FOUND"
+ "OPTIONAL_PACKAGES_NOT_FOUND"
+ "RECOMMENDED_PACKAGES_NOT_FOUND"
+ "REQUIRED_PACKAGES_NOT_FOUND"
+ )
+
+ SET(title_ENABLED_FEATURES "The following features have been enabled:")
+ SET(title_DISABLED_FEATURES "The following features have been disabled:")
+ 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:")
+ SET(title_RECOMMENDED_PACKAGES_NOT_FOUND "The following RECOMMENDED packages have not been found:")
+ SET(title_REQUIRED_PACKAGES_FOUND "The following REQUIRED packages have been found:")
+ SET(title_REQUIRED_PACKAGES_NOT_FOUND "The following REQUIRED packages have not been found:")
+ SET(title_RUNTIME_PACKAGES_FOUND "The following RUNTIME packages have been found:")
+ SET(title_RUNTIME_PACKAGES_NOT_FOUND "The following RUNTIME packages have not been found:")
+
+ SET(_fullText "${_FS_DESCRIPTION}")
+ FOREACH(part ${allWhatParts})
+ SET(_tmp)
+ _FS_GET_FEATURE_SUMMARY( ${part} _tmp ${_FS_INCLUDE_QUIET_PACKAGES})
+ IF(_tmp)
+ SET(_fullText "${_fullText}\n-- ${title_${part}}\n${_tmp}\n")
+ IF("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND")
+ SET(requiredPackagesNotFound TRUE)
+ 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)
+ IF(_FS_APPEND)
+ FILE(APPEND "${_FS_FILENAME}" "${_fullText}")
+ ELSE(_FS_APPEND)
+ FILE(WRITE "${_FS_FILENAME}" "${_fullText}")
+ ENDIF()
+
+ ELSE(_FS_FILENAME)
+ IF(NOT _FS_VAR)
+ MESSAGE(STATUS "${_fullText}")
+ ENDIF()
+ ENDIF()
+
+ IF(_FS_VAR)
+ SET(${_FS_VAR} "${_fullText}" PARENT_SCOPE)
+ ENDIF()
+
+ IF(requiredPackagesNotFound AND _FS_FATAL_ON_MISSING_REQUIRED_PACKAGES)
+ MESSAGE(FATAL_ERROR "feature_summary() Error: REQUIRED package(s) are missing, aborting CMake run.")
+ ENDIF()
+
+ENDFUNCTION(FEATURE_SUMMARY)
+
+
+# The stuff below is only kept for compatibility
+
+FUNCTION(SET_PACKAGE_INFO _name _desc)
+ SET(_url "${ARGV2}")
+ SET(_purpose "${ARGV3}")
+ SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
+ IF(_url MATCHES ".+")
+ SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_url}" )
+ ENDIF()
+ IF(_purpose MATCHES ".+")
+ SET_PROPERTY(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_purpose}" )
+ ENDIF()
+ENDFUNCTION(SET_PACKAGE_INFO)
+
+
+
+FUNCTION(SET_FEATURE_INFO)
+ SET_PACKAGE_INFO(${ARGN})
+ENDFUNCTION(SET_FEATURE_INFO)
+
+
+
+FUNCTION(PRINT_ENABLED_FEATURES)
+ FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
+ENDFUNCTION(PRINT_ENABLED_FEATURES)
+
+
+
+FUNCTION(PRINT_DISABLED_FEATURES)
+ FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
+ENDFUNCTION(PRINT_DISABLED_FEATURES)
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake
new file mode 100644
index 000000000..4a0b69303
--- /dev/null
+++ b/Modules/FindALSA.cmake
@@ -0,0 +1,55 @@
+# - 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
+#
+# 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.
+# Copyright 2009-2011 Philip Lowman <philip@yhbt.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.)
+
+find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h
+ DOC "The ALSA (asound) include directory"
+)
+
+find_library(ALSA_LIBRARY NAMES asound
+ DOC "The ALSA (asound) library"
+)
+
+if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h")
+ file(STRINGS "${ALSA_INCLUDE_DIR}/alsa/version.h" alsa_version_str REGEX "^#define[\t ]+SND_LIB_VERSION_STR[\t ]+\".*\"")
+
+ string(REGEX REPLACE "^.*SND_LIB_VERSION_STR[\t ]+\"([^\"]*)\".*$" "\\1" ALSA_VERSION_STRING "${alsa_version_str}")
+ unset(alsa_version_str)
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if
+# all listed variables are TRUE
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA
+ REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR
+ VERSION_VAR ALSA_VERSION_STRING)
+
+if(ALSA_FOUND)
+ set( ALSA_LIBRARIES ${ALSA_LIBRARY} )
+ set( ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR} )
+endif()
+
+mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY)
diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake
new file mode 100644
index 000000000..713ab7e19
--- /dev/null
+++ b/Modules/FindASPELL.cmake
@@ -0,0 +1,37 @@
+# - 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
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@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.)
+
+FIND_PATH(ASPELL_INCLUDE_DIR aspell.h )
+
+FIND_PROGRAM(ASPELL_EXECUTABLE
+ NAMES aspell
+)
+
+FIND_LIBRARY(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell)
+
+# handle the QUIETLY and REQUIRED arguments and set ASPELL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASPELL DEFAULT_MSG ASPELL_LIBRARIES ASPELL_INCLUDE_DIR ASPELL_EXECUTABLE)
+
+MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARIES ASPELL_EXECUTABLE)
diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake
new file mode 100644
index 000000000..8b5b05ae3
--- /dev/null
+++ b/Modules/FindAVIFile.cmake
@@ -0,0 +1,48 @@
+# - 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
+
+#=============================================================================
+# 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.)
+
+IF (UNIX)
+
+ FIND_PATH(AVIFILE_INCLUDE_DIR avifile.h
+ /usr/local/avifile/include
+ /usr/local/include/avifile
+ )
+
+ FIND_LIBRARY(AVIFILE_AVIPLAY_LIBRARY aviplay
+ /usr/local/avifile/lib
+ )
+
+ENDIF (UNIX)
+
+# handle the QUIETLY and REQUIRED arguments and set AVIFILE_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(AVIFile DEFAULT_MSG AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY)
+
+IF (AVIFILE_FOUND)
+ SET(AVIFILE_LIBRARIES ${AVIFILE_AVIPLAY_LIBRARY})
+ SET(AVIFILE_DEFINITIONS "")
+ENDIF()
+
+MARK_AS_ADVANCED(AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY)
diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake
new file mode 100644
index 000000000..84ed3cab6
--- /dev/null
+++ b/Modules/FindArmadillo.cmake
@@ -0,0 +1,95 @@
+# - Find Armadillo
+# Find the Armadillo C++ library
+#
+# Using Armadillo:
+# find_package(Armadillo REQUIRED)
+# include_directories(${ARMADILLO_INCLUDE_DIRS})
+# add_executable(foo foo.cc)
+# target_link_libraries(foo ${ARMADILLO_LIBRARIES})
+# This module sets the following variables:
+# ARMADILLO_FOUND - set to true if the library is found
+# ARMADILLO_INCLUDE_DIRS - list of required include directories
+# ARMADILLO_LIBRARIES - list of libraries to be linked
+# ARMADILLO_VERSION_MAJOR - major version number
+# ARMADILLO_VERSION_MINOR - minor version number
+# ARMADILLO_VERSION_PATCH - patch version number
+# ARMADILLO_VERSION_STRING - version number as a string (ex: "1.0.4")
+# ARMADILLO_VERSION_NAME - name of the version (ex: "Antipodean Antileech")
+
+#=============================================================================
+# Copyright 2011 Clement Creusot <creusot@cs.york.ac.uk>
+#
+# 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.)
+
+
+# UNIX paths are standard, no need to write.
+find_library(ARMADILLO_LIBRARY
+ NAMES armadillo
+ PATHS "$ENV{ProgramFiles}/Armadillo/lib" "$ENV{ProgramFiles}/Armadillo/lib64" "$ENV{ProgramFiles}/Armadillo"
+ )
+find_path(ARMADILLO_INCLUDE_DIR
+ NAMES armadillo
+ PATHS "$ENV{ProgramFiles}/Armadillo/include"
+ )
+
+
+if(ARMADILLO_INCLUDE_DIR)
+
+ # ------------------------------------------------------------------------
+ # Extract version information from <armadillo>
+ # ------------------------------------------------------------------------
+
+ # WARNING: Early releases of Armadillo didn't have the arma_version.hpp file.
+ # (e.g. v.0.9.8-1 in ubuntu maverick packages (2001-03-15))
+ # If the file is missing, set all values to 0
+ set(ARMADILLO_VERSION_MAJOR 0)
+ set(ARMADILLO_VERSION_MINOR 0)
+ set(ARMADILLO_VERSION_PATCH 0)
+ set(ARMADILLO_VERSION_NAME "EARLY RELEASE")
+
+ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp")
+
+ # Read and parse armdillo version header file for version number
+ file(READ "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp" _armadillo_HEADER_CONTENTS)
+ string(REGEX REPLACE ".*#define ARMA_VERSION_MAJOR ([0-9]+).*" "\\1" ARMADILLO_VERSION_MAJOR "${_armadillo_HEADER_CONTENTS}")
+ string(REGEX REPLACE ".*#define ARMA_VERSION_MINOR ([0-9]+).*" "\\1" ARMADILLO_VERSION_MINOR "${_armadillo_HEADER_CONTENTS}")
+ string(REGEX REPLACE ".*#define ARMA_VERSION_PATCH ([0-9]+).*" "\\1" ARMADILLO_VERSION_PATCH "${_armadillo_HEADER_CONTENTS}")
+
+ # WARNING: The number of spaces before the version name is not one.
+ string(REGEX REPLACE ".*#define ARMA_VERSION_NAME\ +\"([0-9a-zA-Z\ _-]+)\".*" "\\1" ARMADILLO_VERSION_NAME "${_armadillo_HEADER_CONTENTS}")
+
+ endif(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp")
+
+ set(ARMADILLO_VERSION_STRING "${ARMADILLO_VERSION_MAJOR}.${ARMADILLO_VERSION_MINOR}.${ARMADILLO_VERSION_PATCH}")
+endif (ARMADILLO_INCLUDE_DIR)
+
+#======================
+
+
+# Checks 'REQUIRED', 'QUIET' and versions.
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Armadillo
+ REQUIRED_VARS ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR
+ VERSION_VAR ARMADILLO_VERSION_STRING)
+# version_var fails with cmake < 2.8.4.
+
+if (ARMADILLO_FOUND)
+ set(ARMADILLO_INCLUDE_DIRS ${ARMADILLO_INCLUDE_DIR})
+ set(ARMADILLO_LIBRARIES ${ARMADILLO_LIBRARY})
+endif (ARMADILLO_FOUND)
+
+
+# Hide internal variables
+mark_as_advanced(
+ ARMADILLO_INCLUDE_DIR
+ ARMADILLO_LIBRARY)
+
+#======================
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
new file mode 100644
index 000000000..7af336788
--- /dev/null
+++ b/Modules/FindBISON.cmake
@@ -0,0 +1,175 @@
+# - Find bison executable and provides macros 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:
+#
+# find_package(BISON)
+# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp)
+# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS})
+# ====================================================================
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2006 Tristan Carel
+#
+# 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_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable")
+MARK_AS_ADVANCED(BISON_EXECUTABLE)
+
+IF(BISON_EXECUTABLE)
+ # the bison commands should be executed with the C locale, otherwise
+ # the message (which are parsed) may be translated
+ SET(_Bison_SAVED_LC_ALL "$ENV{LC_ALL}")
+ SET(ENV{LC_ALL} C)
+
+ EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
+ OUTPUT_VARIABLE BISON_version_output
+ ERROR_VARIABLE BISON_version_error
+ RESULT_VARIABLE BISON_version_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ SET(ENV{LC_ALL} ${_Bison_SAVED_LC_ALL})
+
+ IF(NOT ${BISON_version_result} EQUAL 0)
+ 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}")
+ # 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}")
+ ENDIF()
+ ENDIF()
+
+ # internal macro
+ MACRO(BISON_TARGET_option_verbose Name BisonOutput filename)
+ LIST(APPEND BISON_TARGET_cmdopt "--verbose")
+ GET_FILENAME_COMPONENT(BISON_TARGET_output_path "${BisonOutput}" PATH)
+ GET_FILENAME_COMPONENT(BISON_TARGET_output_name "${BisonOutput}" NAME_WE)
+ ADD_CUSTOM_COMMAND(OUTPUT ${filename}
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy
+ "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
+ "${filename}"
+ DEPENDS
+ "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
+ COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ SET(BISON_${Name}_VERBOSE_FILE ${filename})
+ LIST(APPEND BISON_TARGET_extraoutputs
+ "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output")
+ ENDMACRO(BISON_TARGET_option_verbose)
+
+ # internal macro
+ MACRO(BISON_TARGET_option_extraopts Options)
+ SET(BISON_TARGET_extraopts "${Options}")
+ SEPARATE_ARGUMENTS(BISON_TARGET_extraopts)
+ LIST(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts})
+ ENDMACRO(BISON_TARGET_option_extraopts)
+
+ #============================================================
+ # BISON_TARGET (public macro)
+ #============================================================
+ #
+ MACRO(BISON_TARGET Name BisonInput BisonOutput)
+ 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)
+ 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()
+ 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()
+ 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}")
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${BISON_TARGET_outputs}
+ ${BISON_TARGET_extraoutputs}
+ COMMAND ${BISON_EXECUTABLE}
+ ARGS ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1}
+ DEPENDS ${ARGV1}
+ 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}_OUTPUTS ${BISON_TARGET_outputs})
+ SET(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt})
+ SET(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}")
+
+ ENDIF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
+ ENDMACRO(BISON_TARGET)
+ #
+ #============================================================
+
+ENDIF(BISON_EXECUTABLE)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE
+ VERSION_VAR BISON_VERSION)
+
+# FindBISON.cmake ends here
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
new file mode 100644
index 000000000..1cf31c4a6
--- /dev/null
+++ b/Modules/FindBLAS.cmake
@@ -0,0 +1,606 @@
+# - 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
+
+#=============================================================================
+# 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.)
+
+include(CheckFunctionExists)
+include(CheckFortranFunctionExists)
+
+set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+
+# Check the language being used
+get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )
+if( _LANGUAGES_ MATCHES Fortran )
+ set( _CHECK_FORTRAN TRUE )
+elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) )
+ set( _CHECK_FORTRAN FALSE )
+else()
+ if(BLAS_FIND_REQUIRED)
+ message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
+ else(BLAS_FIND_REQUIRED)
+ message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)")
+ return()
+ endif(BLAS_FIND_REQUIRED)
+endif( )
+
+macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
+# This macro checks for the existence of the combination of fortran libraries
+# given by _list. If the combination is found, this macro checks (using the
+# Check_Fortran_Function_Exists macro) whether can link against that library
+# combination using the name of a routine given by _name using the linker
+# flags given by _flags. If the combination of libraries is found and passes
+# the link test, LIBRARIES is set to the list of complete library paths that
+# have been found. Otherwise, LIBRARIES is set to FALSE.
+
+# N.B. _prefix is the prefix applied to the names of all cached variables that
+# are generated internally and marked advanced by this macro.
+
+set(_libdir ${ARGN})
+
+set(_libraries_work TRUE)
+set(${LIBRARIES})
+set(_combined_name)
+if (NOT _libdir)
+ if (WIN32)
+ set(_libdir ENV LIB)
+ elseif (APPLE)
+ set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH)
+ else ()
+ set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH)
+ endif ()
+endif ()
+
+foreach(_library ${_list})
+ set(_combined_name ${_combined_name}_${_library})
+
+ if(_libraries_work)
+ if (BLA_STATIC)
+ if (WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif ( WIN32 )
+ if (APPLE)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ else (APPLE)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif (APPLE)
+ else (BLA_STATIC)
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # for ubuntu's libblas3gf and liblapack3gf packages
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
+ endif ()
+ endif (BLA_STATIC)
+ find_library(${_prefix}_${_library}_LIBRARY
+ NAMES ${_library}
+ PATHS ${_libdir}
+ )
+ mark_as_advanced(${_prefix}_${_library}_LIBRARY)
+ set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
+ set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
+ endif(_libraries_work)
+endforeach(_library ${_list})
+if(_libraries_work)
+ # Test this combination of libraries.
+ set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread})
+# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
+ if (_CHECK_FORTRAN)
+ check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
+ else()
+ check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
+ endif()
+ set(CMAKE_REQUIRED_LIBRARIES)
+ mark_as_advanced(${_prefix}${_combined_name}_WORKS)
+ set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
+endif(_libraries_work)
+if(NOT _libraries_work)
+ set(${LIBRARIES} FALSE)
+endif(NOT _libraries_work)
+#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
+endmacro(Check_Fortran_Libraries)
+
+set(BLAS_LINKER_FLAGS)
+set(BLAS_LIBRARIES)
+set(BLAS95_LIBRARIES)
+if ($ENV{BLA_VENDOR} MATCHES ".+")
+ set(BLA_VENDOR $ENV{BLA_VENDOR})
+else ($ENV{BLA_VENDOR} MATCHES ".+")
+ if(NOT BLA_VENDOR)
+ set(BLA_VENDOR "All")
+ endif(NOT BLA_VENDOR)
+endif ($ENV{BLA_VENDOR} MATCHES ".+")
+
+if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "goto2"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
+
+if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ dgemm
+ ""
+ "f77blas;atlas"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
+
+# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
+if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "sgemm;dgemm;blas"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
+
+# BLAS in Alpha CXML library?
+if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "cxml"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
+
+# BLAS in Alpha DXML library? (now called CXML, see above)
+if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "dxml"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
+
+# BLAS in Sun Performance library?
+if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "-xlic_lib=sunperf"
+ "sunperf;sunmath"
+ ""
+ )
+ if(BLAS_LIBRARIES)
+ set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
+ endif(BLAS_LIBRARIES)
+ endif(NOT BLAS_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
+
+# BLAS in SCSL library? (SGI/Cray Scientific Library)
+if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "scsl"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
+
+# BLAS in SGIMATH library?
+if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "complib.sgimath"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
+
+# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
+if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "essl;blas"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
+
+#BLAS in acml library?
+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))
+ )
+ # try to find acml in "standard" paths
+ if( WIN32 )
+ file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
+ else()
+ file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
+ endif()
+ if( WIN32 )
+ file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" )
+ else()
+ file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" )
+ endif()
+ list(GET _ACML_ROOT 0 _ACML_ROOT)
+ list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
+ if( _ACML_ROOT )
+ get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
+ if( SIZEOF_INTEGER EQUAL 8 )
+ set( _ACML_PATH_SUFFIX "_int64" )
+ else()
+ set( _ACML_PATH_SUFFIX "" )
+ endif()
+ if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
+ set( _ACML_COMPILER32 "ifort32" )
+ set( _ACML_COMPILER64 "ifort64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
+ set( _ACML_COMPILER32 "sun32" )
+ set( _ACML_COMPILER64 "sun64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
+ set( _ACML_COMPILER32 "pgi32" )
+ if( WIN32 )
+ set( _ACML_COMPILER64 "win64" )
+ else()
+ set( _ACML_COMPILER64 "pgi64" )
+ endif()
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
+ # 32 bit builds not supported on Open64 but for code simplicity
+ # We'll just use the same directory twice
+ set( _ACML_COMPILER32 "open64_64" )
+ set( _ACML_COMPILER64 "open64_64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
+ set( _ACML_COMPILER32 "nag32" )
+ set( _ACML_COMPILER64 "nag64" )
+ else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
+ set( _ACML_COMPILER32 "gfortran32" )
+ set( _ACML_COMPILER64 "gfortran64" )
+ endif()
+
+ if( BLA_VENDOR STREQUAL "ACML_MP" )
+ set(_ACML_MP_LIB_DIRS
+ "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
+ "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
+ else() #if( _BLAS_VENDOR STREQUAL "ACML" )
+ set(_ACML_LIB_DIRS
+ "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
+ "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
+ endif()
+ endif()
+ elseif(BLAS_${BLA_VENDOR}_LIB_DIRS)
+ set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS})
+ endif()
+
+ if( BLA_VENDOR STREQUAL "ACML_MP" )
+ foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS})
+ check_fortran_libraries (
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}
+ )
+ if( BLAS_LIBRARIES )
+ break()
+ endif()
+ endforeach()
+ elseif( BLA_VENDOR STREQUAL "ACML_GPU" )
+ foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS})
+ check_fortran_libraries (
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
+ )
+ if( BLAS_LIBRARIES )
+ break()
+ endif()
+ endforeach()
+ else() #if( _BLAS_VENDOR STREQUAL "ACML" )
+ foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
+ check_fortran_libraries (
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
+ )
+ if( BLAS_LIBRARIES )
+ break()
+ endif()
+ endforeach()
+ endif()
+
+ # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "acml;acml_mv"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "acml_mp;acml_mv"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "acml;acml_mv;CALBLAS"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+endif () # ACML
+
+# Apple BLAS library?
+if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
+if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ dgemm
+ ""
+ "Accelerate"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
+
+if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
+ if ( NOT BLAS_LIBRARIES )
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ dgemm
+ ""
+ "vecLib"
+ ""
+ )
+ endif ( NOT BLAS_LIBRARIES )
+endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
+# Generic BLAS library?
+if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "blas"
+ ""
+ )
+ endif(NOT BLAS_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
+
+#BLAS in intel mkl 10 library? (em64t 64bit)
+if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+ if (NOT WIN32)
+ set(LM "-lm")
+ endif ()
+ if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
+ if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
+ find_package(Threads)
+ else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
+ find_package(Threads REQUIRED)
+ endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
+
+ set(BLAS_SEARCH_LIBS "")
+
+ if(BLA_F95)
+ 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")
+ else (WIN32)
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide")
+ endif ()
+ if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
+
+ # mkl >= 10.3
+ if (CMAKE_C_COMPILER MATCHES ".+gcc.*")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
+ else ()
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
+ endif ()
+ endif ()
+ endif (WIN32)
+ 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")
+ endif ()
+ else (BLA_F95)
+ 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")
+ else (WIN32)
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel mkl_intel_thread mkl_core guide")
+ endif ()
+ if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_intel_thread mkl_core guide")
+
+ # mkl >= 10.3
+ if (CMAKE_C_COMPILER MATCHES ".+gcc.*")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
+ else ()
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
+ endif ()
+ endif ()
+
+ #older vesions of intel mkl libs
+ if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_ia32")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_em64t")
+ endif ()
+ endif (WIN32)
+ 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 (BLA_F95)
+
+ foreach (IT ${BLAS_SEARCH_LIBS})
+ string(REPLACE " " ";" SEARCH_LIBS ${IT})
+ if (${_LIBRARIES})
+ else ()
+ check_fortran_libraries(
+ ${_LIBRARIES}
+ BLAS
+ ${BLAS_mkl_SEARCH_SYMBOL}
+ ""
+ "${SEARCH_LIBS}"
+ "${CMAKE_THREAD_LIBS_INIT};${LM}"
+ )
+ endif ()
+ endforeach ()
+
+ endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
+endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+
+
+if(BLA_F95)
+ if(BLAS95_LIBRARIES)
+ set(BLAS95_FOUND TRUE)
+ else(BLAS95_LIBRARIES)
+ set(BLAS95_FOUND FALSE)
+ endif(BLAS95_LIBRARIES)
+
+ if(NOT BLAS_FIND_QUIETLY)
+ if(BLAS95_FOUND)
+ message(STATUS "A library with BLAS95 API found.")
+ else(BLAS95_FOUND)
+ if(BLAS_FIND_REQUIRED)
+ message(FATAL_ERROR
+ "A required library with BLAS95 API not found. Please specify library location.")
+ else(BLAS_FIND_REQUIRED)
+ message(STATUS
+ "A library with BLAS95 API not found. Please specify library location.")
+ endif(BLAS_FIND_REQUIRED)
+ endif(BLAS95_FOUND)
+ endif(NOT BLAS_FIND_QUIETLY)
+ set(BLAS_FOUND TRUE)
+ set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
+else(BLA_F95)
+ if(BLAS_LIBRARIES)
+ set(BLAS_FOUND TRUE)
+ else(BLAS_LIBRARIES)
+ set(BLAS_FOUND FALSE)
+ endif(BLAS_LIBRARIES)
+
+ if(NOT BLAS_FIND_QUIETLY)
+ if(BLAS_FOUND)
+ message(STATUS "A library with BLAS API found.")
+ else(BLAS_FOUND)
+ if(BLAS_FIND_REQUIRED)
+ message(FATAL_ERROR
+ "A required library with BLAS API not found. Please specify library location."
+ )
+ else(BLAS_FIND_REQUIRED)
+ message(STATUS
+ "A library with BLAS API not found. Please specify library location."
+ )
+ endif(BLAS_FIND_REQUIRED)
+ endif(BLAS_FOUND)
+ endif(NOT BLAS_FIND_QUIETLY)
+endif(BLA_F95)
+
+set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
new file mode 100644
index 000000000..ce7f2555d
--- /dev/null
+++ b/Modules/FindBZip2.cmake
@@ -0,0 +1,56 @@
+# - 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)
+
+#=============================================================================
+# Copyright 2006-2012 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2012 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.)
+
+SET(_BZIP2_PATHS PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Bzip2;InstallPath]"
+ )
+
+FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h ${_BZIP2_PATHS} PATH_SUFFIXES include)
+
+IF (NOT BZIP2_LIBRARIES)
+ FIND_LIBRARY(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 ${_BZIP2_PATHS} PATH_SUFFIXES lib)
+ FIND_LIBRARY(BZIP2_LIBRARY_DEBUG NAMES bzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib)
+
+ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ SELECT_LIBRARY_CONFIGURATIONS(BZIP2)
+ENDIF (NOT BZIP2_LIBRARIES)
+
+IF (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h")
+ FILE(STRINGS "${BZIP2_INCLUDE_DIR}/bzlib.h" BZLIB_H REGEX "bzip2/libbzip2 version [0-9]+\\.[^ ]+ of [0-9]+ ")
+ STRING(REGEX REPLACE ".* bzip2/libbzip2 version ([0-9]+\\.[^ ]+) of [0-9]+ .*" "\\1" BZIP2_VERSION_STRING "${BZLIB_H}")
+ENDIF (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h")
+
+# handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2
+ REQUIRED_VARS BZIP2_LIBRARIES BZIP2_INCLUDE_DIR
+ VERSION_VAR BZIP2_VERSION_STRING)
+
+IF (BZIP2_FOUND)
+ INCLUDE(CheckLibraryExists)
+ CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
+ENDIF (BZIP2_FOUND)
+
+MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
new file mode 100644
index 000000000..ad6b1598d
--- /dev/null
+++ b/Modules/FindBoost.cmake
@@ -0,0 +1,1211 @@
+# - Try to find Boost include dirs and libraries
+# Usage of this module as follows:
+#
+# NOTE: Take note of the Boost_ADDITIONAL_VERSIONS variable below.
+# Due to Boost naming conventions and limitations in CMake this find
+# module is NOT future safe with respect to Boost version numbers,
+# and may break.
+#
+# == Using Header-Only libraries from within Boost: ==
+#
+# find_package( Boost 1.36.0 )
+# if(Boost_FOUND)
+# include_directories(${Boost_INCLUDE_DIRS})
+# add_executable(foo foo.cc)
+# endif()
+#
+#
+# == Using actual libraries from within Boost: ==
+#
+# 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()
+#
+#
+# The components list needs to contain actual names of boost libraries only,
+# such as "date_time" for "libboost_date_time". If you're using parts of
+# Boost that contain header files only (e.g. foreach) you do not need to
+# specify COMPONENTS.
+#
+# You should provide a minimum version number that should be used. If you provide this
+# version number and specify the REQUIRED attribute, this module will fail if it
+# can't find the specified or a later version. If you specify a version number this is
+# automatically put into the considered list of version numbers and thus doesn't need
+# to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below).
+#
+# NOTE for Visual Studio Users:
+# Automatic linking is used on MSVC & Borland compilers by default when
+# #including things in Boost. It's important to note that setting
+# Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking,
+# should you need this feature. Automatic linking typically uses static
+# libraries with a few exceptions (Boost.Python is one).
+#
+# Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for
+# more details. Adding a TARGET_LINK_LIBRARIES() as shown in the example
+# above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS
+# gets set to OFF. It is suggested you avoid automatic linking since it
+# will make your application less portable.
+#
+# =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============
+#
+# OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
+# boost version numbers that should be taken into account when searching
+# for Boost. Unfortunately boost puts the version number into the
+# actual filename for the libraries, so this variable will certainly be needed
+# in the future when new Boost versions are released.
+#
+# Currently this module searches for the following version numbers:
+# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1,
+# 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0,
+# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0,
+# 1.45, 1.45.0, 1.46, 1.46.0, 1.46.1, 1.47, 1.47.0, 1.48, 1.48.0,
+# 1.49, 1.49.0, 1.50, 1.50.0, 1.51, 1.51.0, 1.52, 1.52.0,
+# 1.53, 1.53.0, 1.54, 1.54.0, 1.55, 1.55.0, 1.56, 1.56.0
+#
+# NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should
+# add both 1.x and 1.x.0 as shown above. Official Boost include directories
+# omit the 3rd version number from include paths if it is 0 although not all
+# binary Boost releases do so.
+#
+# set(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0")
+#
+# ===================================== ============= ========================
+#
+# Variables used by this module, they can change the default behaviour and
+# need to be set before calling find_package:
+#
+# Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded
+# boost libraries. If not specified, defaults
+# to ON.
+#
+# Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static
+# boost libraries. Defaults to OFF.
+#
+# Boost_NO_SYSTEM_PATHS Set to TRUE to suppress searching in system
+# paths (or other locations outside of BOOST_ROOT
+# or BOOST_INCLUDEDIR). Useful when specifying
+# BOOST_ROOT. Defaults to OFF.
+# [Since CMake 2.8.3]
+#
+# Boost_NO_BOOST_CMAKE Do not do a find_package call in config mode
+# before searching for a regular boost install.
+# This will avoid finding boost-cmake installs.
+# Defaults to OFF.
+# [Since CMake 2.8.6]
+#
+# Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries
+# linked against a static C++ standard library
+# ('s' ABI tag). This option should be set to
+# ON or OFF because the default behavior
+# if not specified is platform dependent
+# for backwards compatibility.
+# [Since CMake 2.8.3]
+#
+# Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries
+# compiled against a special debug build of
+# Python ('y' ABI tag). Defaults to OFF.
+# [Since CMake 2.8.3]
+#
+# Boost_USE_STLPORT If enabled, searches for boost libraries
+# compiled against the STLPort standard
+# library ('p' ABI tag). Defaults to OFF.
+# [Since CMake 2.8.3]
+#
+# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
+# If enabled, searches for boost libraries
+# compiled against the deprecated STLPort
+# "native iostreams" feature ('n' ABI tag).
+# Defaults to OFF.
+# [Since CMake 2.8.3]
+#
+# Other Variables used by this module which you may want to set.
+#
+# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching
+# the boost include directory. Please see
+# the documentation above regarding this
+# annoying, but necessary variable :(
+#
+# Boost_DEBUG Set this to TRUE to enable debugging output
+# of FindBoost.cmake if you are having problems.
+# Please enable this before filing any bug
+# reports.
+#
+# Boost_DETAILED_FAILURE_MSG FindBoost doesn't output detailed information
+# about why it failed or how to fix the problem
+# unless this is set to TRUE or the REQUIRED
+# keyword is specified in find_package().
+# [Since CMake 2.8.0]
+#
+# Boost_COMPILER Set this to the compiler suffix used by Boost
+# (e.g. "-gcc43") if FindBoost has problems finding
+# the proper Boost installation
+#
+# Boost_THREADAPI When building boost.thread, sometimes the name of the
+# library contains an additional "pthread" or "win32"
+# string known as the threadapi. This can happen when
+# compiling against pthreads on Windows or win32 threads
+# on Cygwin. You may specify this variable and if set
+# when FindBoost searches for the Boost threading library
+# it will first try to match the threadapi you specify.
+# For Example: libboost_thread_win32-mgw45-mt-1_43.a
+# might be found if you specified "win32" here before
+# falling back on libboost_thread-mgw45-mt-1_43.a.
+# [Since CMake 2.8.3]
+#
+# Boost_REALPATH Resolves symbolic links for discovered boost libraries
+# to assist with packaging. For example, instead of
+# Boost_SYSTEM_LIBRARY_RELEASE being resolved to
+# "/usr/lib/libboost_system.so" it would be
+# "/usr/lib/libboost_system.so.1.42.0" instead.
+# This does not affect linking and should not be
+# enabled unless the user needs this information.
+# [Since CMake 2.8.3]
+#
+
+
+#
+# These last three variables are available also as environment variables:
+# Also, note they are completely UPPERCASE, except Boost_DIR.
+#
+# Boost_DIR or The preferred installation prefix for searching for
+# BOOST_ROOT or BOOSTROOT Boost. Set this if the module has problems finding
+# the proper Boost installation.
+#
+# Note that Boost_DIR behaves exactly as <package>_DIR
+# variables are documented to behave in find_package's
+# Config mode. That is, if it is set as a -D argument
+# to CMake, it must point to the location of the
+# BoostConfig.cmake or Boost-config.cmake file. If it
+# is set as an environment variable, it must point to
+# the root of the boost installation. BOOST_ROOT and
+# BOOSTROOT, on the other hand, will point to the root
+# in either case.
+#
+# To prevent falling back on the system paths, set
+# Boost_NO_SYSTEM_PATHS to true.
+#
+# To avoid finding boost-cmake installations, set
+# Boost_NO_BOOST_CMAKE to true.
+#
+# BOOST_INCLUDEDIR Set this to the include directory of Boost, if the
+# module has problems finding the proper Boost installation
+#
+# BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the
+# module has problems finding the proper Boost installation
+#
+# Variables defined by this module:
+#
+# Boost_FOUND System has Boost, this means the include dir was
+# found, as well as all the libraries specified in
+# the COMPONENTS list.
+#
+# Boost_INCLUDE_DIRS Boost include directories: not cached
+#
+# Boost_INCLUDE_DIR This is almost the same as above, but this one is
+# cached and may be modified by advanced users
+#
+# Boost_LIBRARIES Link to these to use the Boost libraries that you
+# specified: not cached
+#
+# Boost_LIBRARY_DIRS The path to where the Boost library files are.
+#
+# Boost_VERSION The version number of the boost libraries that
+# have been found, same as in version.hpp from Boost
+#
+# Boost_LIB_VERSION The version number in filename form as
+# it's appended to the library filenames
+#
+# Boost_MAJOR_VERSION major version number of boost
+# Boost_MINOR_VERSION minor version number of boost
+# Boost_SUBMINOR_VERSION subminor version number of boost
+#
+# Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call
+# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
+# to have diagnostic information about Boost's
+# automatic linking outputted during compilation time.
+#
+# For each component you specify in find_package(), the following (UPPER-CASE)
+# variables are set. You can use these variables if you would like to pick and
+# choose components for your targets instead of just using Boost_LIBRARIES.
+#
+# Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found.
+#
+# Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost
+# "component" (includes debug and optimized keywords
+# when needed).
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006-2008 Andreas Schneider <mail@cynapses.org>
+# Copyright 2007 Wengo
+# Copyright 2007 Mike Jackson
+# Copyright 2008 Andreas Pakulat <apaku@gmx.de>
+# Copyright 2008-2012 Philip Lowman <philip@yhbt.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.)
+
+
+#-------------------------------------------------------------------------------
+# Before we go searching, check whether boost-cmake is avaialble, unless the
+# user specifically asked NOT to search for boost-cmake.
+#
+# If Boost_DIR is set, this behaves as any find_package call would. If not,
+# it looks at BOOST_ROOT and BOOSTROOT to find Boost.
+#
+if (NOT Boost_NO_BOOST_CMAKE)
+ # If Boost_DIR is not set, look for BOOSTROOT and BOOST_ROOT as alternatives,
+ # since these are more conventional for Boost.
+ if ("$ENV{Boost_DIR}" STREQUAL "")
+ if (NOT "$ENV{BOOST_ROOT}" STREQUAL "")
+ set(ENV{Boost_DIR} $ENV{BOOST_ROOT})
+ elseif (NOT "$ENV{BOOSTROOT}" STREQUAL "")
+ set(ENV{Boost_DIR} $ENV{BOOSTROOT})
+ endif()
+ endif()
+
+ # Do the same find_package call but look specifically for the CMake version.
+ # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no
+ # need to delegate them to this find_package call.
+ find_package(Boost QUIET NO_MODULE)
+
+ # If we found boost-cmake, then we're done. Print out what we found.
+ # Otherwise let the rest of the module try to find it.
+ if (Boost_FOUND)
+ message("Boost ${Boost_FIND_VERSION} found.")
+ if (Boost_FIND_COMPONENTS)
+ message("Found Boost components:")
+ message(" ${Boost_FIND_COMPONENTS}")
+ endif()
+ return()
+ endif()
+endif()
+
+
+#-------------------------------------------------------------------------------
+# FindBoost functions & macros
+#
+
+############################################
+#
+# Check the existence of the libraries.
+#
+############################################
+# This macro was taken directly from the FindQt4.cmake file that is included
+# with the CMake distribution. This is NOT my work. All work was done by the
+# original authors of the FindQt4.cmake file. Only minor modifications were
+# made to remove references to Qt and make this file more generally applicable
+# And ELSE/ENDIF pairs were removed for readability.
+#########################################################################
+
+macro(_Boost_ADJUST_LIB_VARS basename)
+ if(Boost_INCLUDE_DIR )
+ if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
+ # if the generator supports configuration types then set
+ # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
+ if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
+ else()
+ # if there are no configuration types and CMAKE_BUILD_TYPE has no value
+ # then just use the release libraries
+ set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
+ endif()
+ # FIXME: This probably should be set for both cases
+ set(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
+ endif()
+
+ # if only the release version was found, set the debug variable also to the release version
+ if(Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
+ set(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
+ set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE})
+ set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE})
+ endif()
+
+ # if only the debug version was found, set the release variable also to the debug version
+ if(Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
+ set(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
+ set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG})
+ set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG})
+ endif()
+
+ # If the debug & release library ends up being the same, omit the keywords
+ if(${Boost_${basename}_LIBRARY_RELEASE} STREQUAL ${Boost_${basename}_LIBRARY_DEBUG})
+ set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
+ set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE} )
+ endif()
+
+ if(Boost_${basename}_LIBRARY)
+ set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
+
+ # Remove superfluous "debug" / "optimized" keywords from
+ # Boost_LIBRARY_DIRS
+ foreach(_boost_my_lib ${Boost_${basename}_LIBRARY})
+ get_filename_component(_boost_my_lib_path "${_boost_my_lib}" PATH)
+ list(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path})
+ endforeach()
+ list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
+
+ set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
+ set(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
+ endif(Boost_${basename}_LIBRARY)
+
+ endif(Boost_INCLUDE_DIR )
+ # Make variables changeble to the advanced user
+ mark_as_advanced(
+ Boost_${basename}_LIBRARY
+ Boost_${basename}_LIBRARY_RELEASE
+ Boost_${basename}_LIBRARY_DEBUG
+ )
+endmacro(_Boost_ADJUST_LIB_VARS)
+
+#-------------------------------------------------------------------------------
+
+#
+# Runs compiler with "-dumpversion" and parses major/minor
+# version with a regex.
+#
+function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
+
+ exec_program(${CMAKE_CXX_COMPILER}
+ ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
+ OUTPUT_VARIABLE _boost_COMPILER_VERSION
+ )
+ string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
+ _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
+
+ set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
+endfunction()
+
+#
+# A convenience function for marking desired components
+# as found or not
+#
+function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no)
+ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+ set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE)
+ endforeach()
+endfunction()
+
+#
+# Take a list of libraries with "thread" in it
+# and prepend duplicates with "thread_${Boost_THREADAPI}"
+# at the front of the list
+#
+function(_Boost_PREPEND_LIST_WITH_THREADAPI _output)
+ set(_orig_libnames ${ARGN})
+ string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames "${_orig_libnames}")
+ set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE)
+endfunction()
+
+#
+# If a library is found, replace its cache entry with its REALPATH
+#
+function(_Boost_SWAP_WITH_REALPATH _library _docstring)
+ if(${_library})
+ get_filename_component(_boost_filepathreal ${${_library}} REALPATH)
+ unset(${_library} CACHE)
+ set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}")
+ endif()
+endfunction()
+
+function(_Boost_CHECK_SPELLING _var)
+ if(${_var})
+ string(TOUPPER ${_var} _var_UC)
+ message(FATAL_ERROR "ERROR: ${_var} is not the correct spelling. The proper spelling is ${_var_UC}.")
+ endif()
+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(WIN32)
+ set (_boost_COMPILER "-iw")
+ else()
+ set (_boost_COMPILER "-il")
+ endif()
+ elseif (MSVC11)
+ set(_boost_COMPILER "-vc110")
+ elseif (MSVC10)
+ set(_boost_COMPILER "-vc100")
+ elseif (MSVC90)
+ set(_boost_COMPILER "-vc90")
+ elseif (MSVC80)
+ set(_boost_COMPILER "-vc80")
+ elseif (MSVC71)
+ set(_boost_COMPILER "-vc71")
+ elseif (MSVC70) # Good luck!
+ set(_boost_COMPILER "-vc7") # yes, this is correct
+ elseif (MSVC60) # Good luck!
+ set(_boost_COMPILER "-vc6") # yes, this is correct
+ elseif (BORLAND)
+ set(_boost_COMPILER "-bcb")
+ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
+ set(_boost_COMPILER "-sw")
+ elseif (MINGW)
+ if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
+ set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
+ else()
+ _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
+ set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
+ endif()
+ elseif (UNIX)
+ if (CMAKE_COMPILER_IS_GNUCXX)
+ if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
+ set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
+ else()
+ _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
+ # Determine which version of GCC we have.
+ if(APPLE)
+ if(Boost_MINOR_VERSION)
+ if(${Boost_MINOR_VERSION} GREATER 35)
+ # In Boost 1.36.0 and newer, the mangled compiler name used
+ # on Mac OS X/Darwin is "xgcc".
+ set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
+ else(${Boost_MINOR_VERSION} GREATER 35)
+ # In Boost <= 1.35.0, there is no mangled compiler name for
+ # the Mac OS X/Darwin version of GCC.
+ set(_boost_COMPILER "")
+ endif(${Boost_MINOR_VERSION} GREATER 35)
+ else(Boost_MINOR_VERSION)
+ # We don't know the Boost version, so assume it's
+ # pre-1.36.0.
+ set(_boost_COMPILER "")
+ endif(Boost_MINOR_VERSION)
+ else()
+ set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
+ endif()
+ endif()
+ endif (CMAKE_COMPILER_IS_GNUCXX)
+ else()
+ # TODO at least Boost_DEBUG here?
+ set(_boost_COMPILER "")
+ endif()
+ set(${_ret} ${_boost_COMPILER} PARENT_SCOPE)
+endfunction()
+
+#
+# End functions/macros
+#
+#-------------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------------
+# main.
+#-------------------------------------------------------------------------------
+
+if(NOT DEFINED Boost_USE_MULTITHREADED)
+ set(Boost_USE_MULTITHREADED TRUE)
+endif()
+
+# Check the version of Boost against the requested version.
+if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
+ message(SEND_ERROR "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34")
+endif()
+
+if(Boost_FIND_VERSION_EXACT)
+ # The version may appear in a directory with or without the patch
+ # level, even when the patch level is non-zero.
+ set(_boost_TEST_VERSIONS
+ "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
+ "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
+else(Boost_FIND_VERSION_EXACT)
+ # The user has not requested an exact version. Among known
+ # versions, find those that are acceptable to the user request.
+ 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.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}")
+ # Select acceptable versions.
+ foreach(version ${_Boost_KNOWN_VERSIONS})
+ if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
+ # This version is high enough.
+ list(APPEND _boost_TEST_VERSIONS "${version}")
+ elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
+ # This version is a short-form for the requested version with
+ # the patch level dropped.
+ list(APPEND _boost_TEST_VERSIONS "${version}")
+ endif()
+ endforeach(version)
+ else(Boost_FIND_VERSION)
+ # Any version is acceptable.
+ set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
+ endif(Boost_FIND_VERSION)
+endif(Boost_FIND_VERSION_EXACT)
+
+# The reason that we failed to find Boost. This will be set to a
+# user-friendly message when we fail to find some necessary piece of
+# Boost.
+set(Boost_ERROR_REASON)
+
+ if(Boost_DEBUG)
+ # Output some of their choices
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
+ 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
+ # runtime, then you can choose to link to either a static or a
+ # dynamic Boost library, the default is to do a static link. You
+ # can alter this for a specific library "whatever" by defining
+ # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
+ # linked dynamically. Alternatively you can force all Boost
+ # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
+
+ # This feature can be disabled for Boost library "whatever" by
+ # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
+ # BOOST_ALL_NO_LIB.
+
+ # If you want to observe which libraries are being linked against
+ # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
+ # code to emit a #pragma message each time a library is selected
+ # for linking.
+ set(Boost_LIB_DIAGNOSTIC_DEFINITIONS
+ "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
+ endif(WIN32)
+
+ set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM
+ C:/boost/include
+ C:/boost
+ "$ENV{ProgramFiles}/boost/include"
+ "$ENV{ProgramFiles}/boost"
+ /sw/local/include
+ )
+
+ _Boost_CHECK_SPELLING(Boost_ROOT)
+ _Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
+ _Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
+
+ # If BOOST_ROOT was defined in the environment, use it.
+ if (NOT BOOST_ROOT AND NOT $ENV{Boost_DIR} STREQUAL "")
+ set(BOOST_ROOT $ENV{Boost_DIR})
+ endif()
+
+ # If BOOST_ROOT was defined in the environment, use it.
+ if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
+ set(BOOST_ROOT $ENV{BOOST_ROOT})
+ endif()
+
+ # If BOOSTROOT was defined in the environment, use it.
+ if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
+ set(BOOST_ROOT $ENV{BOOSTROOT})
+ endif()
+
+ # If BOOST_INCLUDEDIR was defined in the environment, use it.
+ if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
+ set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
+ endif()
+
+ # If BOOST_LIBRARYDIR was defined in the environment, use it.
+ if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
+ set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
+ endif()
+
+ if( BOOST_ROOT )
+ file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
+ endif()
+
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Declared as CMake or Environmental Variables:")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ " BOOST_ROOT = ${BOOST_ROOT}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
+ endif()
+
+ if( Boost_NO_SYSTEM_PATHS)
+ set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
+ else()
+ set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM})
+ endif()
+
+ if( BOOST_ROOT )
+ set(_boost_INCLUDE_SEARCH_DIRS
+ ${BOOST_ROOT}/include
+ ${BOOST_ROOT}
+ ${_boost_INCLUDE_SEARCH_DIRS})
+ endif()
+
+ # prepend BOOST_INCLUDEDIR to search path if specified
+ if( BOOST_INCLUDEDIR )
+ file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
+ set(_boost_INCLUDE_SEARCH_DIRS
+ ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
+ endif( BOOST_INCLUDEDIR )
+
+ # ------------------------------------------------------------------------
+ # Search for Boost include DIR
+ # ------------------------------------------------------------------------
+ # Try to find Boost by stepping backwards through the Boost versions
+ # we know about.
+ if( NOT Boost_INCLUDE_DIR )
+ # Build a list of path suffixes for each version.
+ set(_boost_PATH_SUFFIXES)
+ foreach(_boost_VER ${_boost_TEST_VERSIONS})
+ # Add in a path suffix, based on the required version, ideally
+ # we could read this from version.hpp, but for that to work we'd
+ # need to know the include dir already
+ 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})
+ endif()
+
+ list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
+ list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
+
+ endforeach(_boost_VER)
+
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Include debugging info:")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
+ endif()
+
+ # Look for a standard boost header file.
+ find_path(Boost_INCLUDE_DIR
+ NAMES boost/config.hpp
+ HINTS ${_boost_INCLUDE_SEARCH_DIRS}
+ PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
+ ${_boost_FIND_OPTIONS}
+ )
+ endif( NOT Boost_INCLUDE_DIR )
+
+ # ------------------------------------------------------------------------
+ # Extract version information from version.hpp
+ # ------------------------------------------------------------------------
+
+ if(Boost_INCLUDE_DIR)
+ # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
+ # Read the whole file:
+ #
+ set(BOOST_VERSION 0)
+ set(BOOST_LIB_VERSION "")
+ file(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS)
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
+ endif()
+
+ string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
+ string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")
+
+ set(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
+ set(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")
+
+ if(NOT "${Boost_VERSION}" STREQUAL "0")
+ math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
+ math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
+ math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
+
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
+ endif(NOT "${Boost_VERSION}" STREQUAL "0")
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "version.hpp reveals boost "
+ "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
+ endif()
+ else(Boost_INCLUDE_DIR)
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
+ endif(Boost_INCLUDE_DIR)
+
+ # ------------------------------------------------------------------------
+ # Suffix initialization and compiler suffix detection.
+ # ------------------------------------------------------------------------
+
+ # 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)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
+ endif()
+ else()
+ # Attempt to guess the compiler suffix
+ # NOTE: this is not perfect yet, if you experience any issues
+ # please report them and use the Boost_COMPILER variable
+ # to work around the problems.
+ _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER)
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "guessed _boost_COMPILER = ${_boost_COMPILER}")
+ endif()
+ endif()
+
+ set (_boost_MULTITHREADED "-mt")
+ if( NOT Boost_USE_MULTITHREADED )
+ set (_boost_MULTITHREADED "")
+ endif()
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
+ endif()
+
+ #======================
+ # Systematically build up the Boost ABI tag
+ # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
+ set( _boost_RELEASE_ABI_TAG "-")
+ set( _boost_DEBUG_ABI_TAG "-")
+ # Key Use this library when:
+ # s linking statically to the C++ standard library and
+ # compiler runtime support libraries.
+ if(Boost_USE_STATIC_RUNTIME)
+ set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
+ set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s")
+ endif()
+ # g using debug versions of the standard and runtime
+ # support libraries
+ if(WIN32)
+ if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
+ OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
+ set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
+ endif()
+ endif()
+ # y using special debug build of python
+ if(Boost_USE_DEBUG_PYTHON)
+ set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
+ endif()
+ # d using a debug version of your code
+ set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
+ # p using the STLport standard library rather than the
+ # default one supplied with your compiler
+ if(Boost_USE_STLPORT)
+ set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
+ set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p")
+ endif()
+ # n using the STLport deprecated "native iostreams" feature
+ if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
+ set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
+ set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n")
+ endif()
+
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
+ endif()
+
+ # ------------------------------------------------------------------------
+ # Begin finding boost libraries
+ # ------------------------------------------------------------------------
+
+ if(BOOST_ROOT)
+ set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
+ ${BOOST_ROOT}/lib
+ ${BOOST_ROOT}/stage/lib)
+ endif()
+ set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
+ ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}
+ ${Boost_INCLUDE_DIR}/lib
+ ${Boost_INCLUDE_DIR}/../lib
+ ${Boost_INCLUDE_DIR}/stage/lib
+ )
+ set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM
+ C:/boost/lib
+ C:/boost
+ "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
+ "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib"
+ "$ENV{ProgramFiles}/boost/lib"
+ "$ENV{ProgramFiles}/boost"
+ /sw/local/lib
+ )
+ set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS})
+ if( Boost_NO_SYSTEM_PATHS )
+ set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
+ else()
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM})
+ endif()
+
+ # prepend BOOST_LIBRARYDIR to search path if specified
+ if( BOOST_LIBRARYDIR )
+ file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
+ set(_boost_LIBRARY_SEARCH_DIRS
+ ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS})
+ endif()
+
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
+ endif()
+
+ # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
+ if( Boost_USE_STATIC_LIBS )
+ set( _boost_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()
+
+ # We want to use the tag inline below without risking double dashes
+ if(_boost_RELEASE_ABI_TAG)
+ if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
+ set(_boost_RELEASE_ABI_TAG "")
+ endif()
+ endif()
+ if(_boost_DEBUG_ABI_TAG)
+ if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
+ set(_boost_DEBUG_ABI_TAG "")
+ endif()
+ endif()
+
+ # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
+ # on WIN32 was to:
+ # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
+ # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
+ # We maintain this behavior since changing it could break people's builds.
+ # To disable the ambiguous behavior, the user need only
+ # set Boost_USE_STATIC_RUNTIME either ON or OFF.
+ set(_boost_STATIC_RUNTIME_WORKAROUND false)
+ if(WIN32 AND Boost_USE_STATIC_LIBS)
+ if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
+ set(_boost_STATIC_RUNTIME_WORKAROUND true)
+ endif()
+ endif()
+
+ # On versions < 1.35, remove the System library from the considered list
+ # since it wasn't added until 1.35.
+ if(Boost_VERSION AND Boost_FIND_COMPONENTS)
+ if(Boost_VERSION LESS 103500)
+ list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
+ endif()
+ endif()
+
+ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+ set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" )
+ set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" )
+ set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND")
+
+ set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
+ set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)")
+
+ #
+ # 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} )
+ 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} )
+ endif()
+ if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
+ _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
+ endif()
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
+ endif()
+ find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
+ NAMES ${_boost_RELEASE_NAMES}
+ HINTS ${_boost_LIBRARY_SEARCH_DIRS}
+ ${_boost_FIND_OPTIONS}
+ DOC "${_boost_docstring_release}"
+ )
+
+ #
+ # 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} )
+ 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} )
+ endif()
+ if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
+ _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
+ endif()
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
+ endif()
+ find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
+ NAMES ${_boost_DEBUG_NAMES}
+ HINTS ${_boost_LIBRARY_SEARCH_DIRS}
+ ${_boost_FIND_OPTIONS}
+ DOC "${_boost_docstring_debug}"
+ )
+
+ if(Boost_REALPATH)
+ _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
+ _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" )
+ endif()
+
+ _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
+
+ endforeach(COMPONENT)
+
+ # Restore the original find library ordering
+ if( Boost_USE_STATIC_LIBS )
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif()
+
+ # ------------------------------------------------------------------------
+ # End finding boost libraries
+ # ------------------------------------------------------------------------
+
+ # ------------------------------------------------------------------------
+ # Begin long process of determining Boost_FOUND, starting with version
+ # number checks, followed by
+ # TODO: Ideally the version check logic should happen prior to searching
+ # for libraries...
+ # ------------------------------------------------------------------------
+
+ set(Boost_INCLUDE_DIRS
+ ${Boost_INCLUDE_DIR}
+ )
+
+ set(Boost_FOUND FALSE)
+ if(Boost_INCLUDE_DIR)
+ set( Boost_FOUND TRUE )
+
+ if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
+ set( Boost_FOUND FALSE )
+ set(_Boost_VERSION_AGE "old")
+ elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
+ if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
+ set( Boost_FOUND FALSE )
+ set(_Boost_VERSION_AGE "old")
+ elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
+ if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
+ set( Boost_FOUND FALSE )
+ set(_Boost_VERSION_AGE "old")
+ endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
+ endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
+ endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
+
+ if (NOT Boost_FOUND)
+ _Boost_MARK_COMPONENTS_FOUND(OFF)
+ endif()
+
+ if (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
+ # If the user requested an exact version of Boost, check
+ # that. We already know that the Boost version we have is >= the
+ # requested version.
+ set(_Boost_VERSION_AGE "new")
+
+ # If the user didn't specify a patchlevel, it's 0.
+ if (NOT Boost_FIND_VERSION_PATCH)
+ set(Boost_FIND_VERSION_PATCH 0)
+ endif (NOT Boost_FIND_VERSION_PATCH)
+
+ # We'll set Boost_FOUND true again if we have an exact version match.
+ set(Boost_FOUND FALSE)
+ _Boost_MARK_COMPONENTS_FOUND(OFF)
+ if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
+ if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
+ if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
+ set( Boost_FOUND TRUE )
+ _Boost_MARK_COMPONENTS_FOUND(ON)
+ endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
+ endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
+ endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
+ endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
+
+ if(NOT Boost_FOUND)
+ # State that we found a version of Boost that is too new or too old.
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
+ if (Boost_FIND_VERSION_PATCH)
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
+ endif (Boost_FIND_VERSION_PATCH)
+ if (NOT Boost_FIND_VERSION_EXACT)
+ set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
+ endif (NOT Boost_FIND_VERSION_EXACT)
+ set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
+ endif (NOT Boost_FOUND)
+
+ # Always check for missing components
+ set(_boost_CHECKED_COMPONENT FALSE)
+ set(_Boost_MISSING_COMPONENTS "")
+ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ string(TOUPPER ${COMPONENT} COMPONENT)
+ set(_boost_CHECKED_COMPONENT TRUE)
+ if(NOT Boost_${COMPONENT}_FOUND)
+ string(TOLOWER ${COMPONENT} COMPONENT)
+ list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
+ set( Boost_FOUND FALSE)
+ endif()
+ endforeach(COMPONENT)
+
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
+ endif()
+
+ if (_Boost_MISSING_COMPONENTS)
+ # We were unable to find some libraries, so generate a sensible
+ # error message that lists the libraries we were unable to find.
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
+ foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON} boost_${COMPONENT}\n")
+ endforeach(COMPONENT)
+
+ list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
+ list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
+ if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
+ else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
+ endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
+ endif (_Boost_MISSING_COMPONENTS)
+
+ if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
+ # Compatibility Code for backwards compatibility with CMake
+ # 2.4's FindBoost module.
+
+ # Look for the boost library path.
+ # Note that the user may not have installed any libraries
+ # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
+ set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
+
+ if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
+ get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
+ endif()
+
+ if("${_boost_LIB_DIR}" MATCHES "/include$")
+ # Strip off the trailing "/include" in the path.
+ get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
+ endif()
+
+ if(EXISTS "${_boost_LIB_DIR}/lib")
+ set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
+ else()
+ if(EXISTS "${_boost_LIB_DIR}/stage/lib")
+ set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
+ else()
+ set(_boost_LIB_DIR "")
+ endif()
+ endif()
+
+ if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
+ set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
+ endif()
+
+ endif( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
+
+ else(Boost_INCLUDE_DIR)
+ set( Boost_FOUND FALSE)
+ endif(Boost_INCLUDE_DIR)
+
+ # ------------------------------------------------------------------------
+ # Notification to end user about what was found
+ # ------------------------------------------------------------------------
+
+ if(Boost_FOUND)
+ if(NOT Boost_FIND_QUIETLY)
+ message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
+ if(Boost_FIND_COMPONENTS)
+ message(STATUS "Found the following Boost libraries:")
+ endif()
+ endif(NOT Boost_FIND_QUIETLY)
+ foreach( COMPONENT ${Boost_FIND_COMPONENTS} )
+ string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
+ if( Boost_${UPPERCOMPONENT}_FOUND )
+ if(NOT Boost_FIND_QUIETLY)
+ message (STATUS " ${COMPONENT}")
+ endif(NOT Boost_FIND_QUIETLY)
+ set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
+ endif( Boost_${UPPERCOMPONENT}_FOUND )
+ endforeach(COMPONENT)
+ else()
+ if(Boost_FIND_REQUIRED)
+ message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
+ else()
+ if(NOT Boost_FIND_QUIETLY)
+ # we opt not to automatically output Boost_ERROR_REASON here as
+ # it could be quite lengthy and somewhat imposing in its requests
+ # Since Boost is not always a required dependency we'll leave this
+ # up to the end-user.
+ if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
+ message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
+ else()
+ message(STATUS "Could NOT find Boost")
+ endif()
+ endif()
+ endif(Boost_FIND_REQUIRED)
+ endif()
+
+ # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view
+ mark_as_advanced(Boost_INCLUDE_DIR
+ Boost_INCLUDE_DIRS
+ Boost_LIBRARY_DIRS
+ )
diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake
new file mode 100644
index 000000000..c96755fa4
--- /dev/null
+++ b/Modules/FindBullet.cmake
@@ -0,0 +1,84 @@
+# - Try to find the Bullet physics engine
+#
+# This module defines the following variables
+#
+# BULLET_FOUND - Was bullet found
+# BULLET_INCLUDE_DIRS - the Bullet include directories
+# BULLET_LIBRARIES - Link to this, by default it includes
+# all bullet components (Dynamics,
+# Collision, LinearMath, & SoftBody)
+#
+# This module accepts the following variables
+#
+# BULLET_ROOT - Can be set to bullet install path or Windows build path
+#
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2009 Philip Lowman <philip@yhbt.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_BULLET_LIBRARY _var)
+ find_library(${_var}
+ NAMES
+ ${ARGN}
+ HINTS
+ ${BULLET_ROOT}
+ ${BULLET_ROOT}/out/release8/libs
+ ${BULLET_ROOT}/out/debug8/libs
+ PATH_SUFFIXES lib
+ )
+ mark_as_advanced(${_var})
+endmacro()
+
+macro(_BULLET_APPEND_LIBRARIES _list _release)
+ set(_debug ${_release}_DEBUG)
+ if(${_debug})
+ set(${_list} ${${_list}} optimized ${${_release}} debug ${${_debug}})
+ else()
+ set(${_list} ${${_list}} ${${_release}})
+ endif()
+endmacro()
+
+find_path(BULLET_INCLUDE_DIR NAMES btBulletCollisionCommon.h
+ HINTS
+ ${BULLET_ROOT}/include
+ ${BULLET_ROOT}/src
+ PATH_SUFFIXES bullet
+)
+
+# Find the libraries
+
+_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY BulletDynamics)
+_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY_DEBUG BulletDynamics_Debug BulletDynamics_d)
+_FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY BulletCollision)
+_FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY_DEBUG BulletCollision_Debug BulletCollision_d)
+_FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY BulletMath LinearMath)
+_FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY_DEBUG BulletMath_Debug BulletMath_d LinearMath_Debug LinearMath_d)
+_FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY BulletSoftBody)
+_FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY_DEBUG BulletSoftBody_Debug BulletSoftBody_d)
+
+
+# handle the QUIETLY and REQUIRED arguments and set BULLET_FOUND to TRUE if
+# all listed variables are TRUE
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG
+ BULLET_DYNAMICS_LIBRARY BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY
+ BULLET_SOFTBODY_LIBRARY BULLET_INCLUDE_DIR)
+
+set(BULLET_INCLUDE_DIRS ${BULLET_INCLUDE_DIR})
+if(BULLET_FOUND)
+ _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_DYNAMICS_LIBRARY)
+ _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_COLLISION_LIBRARY)
+ _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_MATH_LIBRARY)
+ _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_SOFTBODY_LIBRARY)
+endif()
diff --git a/Modules/FindCABLE.cmake b/Modules/FindCABLE.cmake
new file mode 100644
index 000000000..678fb07ca
--- /dev/null
+++ b/Modules/FindCABLE.cmake
@@ -0,0 +1,81 @@
+# - Find CABLE
+# This module finds if CABLE is installed and determines where the
+# include files and libraries are. This code sets the following variables:
+#
+# CABLE the path to the cable executable
+# CABLE_TCL_LIBRARY the path to the Tcl wrapper library
+# CABLE_INCLUDE_DIR the path to the include directory
+#
+# To build Tcl wrappers, you should add shared library and link it to
+# ${CABLE_TCL_LIBRARY}. You should also add ${CABLE_INCLUDE_DIR} as
+# an include directory.
+
+#=============================================================================
+# 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.)
+
+IF(NOT CABLE)
+ FIND_PATH(CABLE_BUILD_DIR cableVersion.h)
+ENDIF(NOT CABLE)
+
+IF(CABLE_BUILD_DIR)
+ LOAD_CACHE(${CABLE_BUILD_DIR}
+ EXCLUDE
+ BUILD_SHARED_LIBS
+ LIBRARY_OUTPUT_PATH
+ EXECUTABLE_OUTPUT_PATH
+ MAKECOMMAND
+ CMAKE_INSTALL_PREFIX
+ INCLUDE_INTERNALS
+ CABLE_LIBRARY_PATH
+ CABLE_EXECUTABLE_PATH)
+
+ IF(CABLE_LIBRARY_PATH)
+ FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
+ ${CABLE_LIBRARY_PATH}
+ ${CABLE_LIBRARY_PATH}/*)
+ ELSE(CABLE_LIBRARY_PATH)
+ FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
+ ${CABLE_BINARY_DIR}/CableTclFacility
+ ${CABLE_BINARY_DIR}/CableTclFacility/*)
+ ENDIF(CABLE_LIBRARY_PATH)
+
+ IF(CABLE_EXECUTABLE_PATH)
+ FIND_PROGRAM(CABLE NAMES cable PATHS
+ ${CABLE_EXECUTABLE_PATH}
+ ${CABLE_EXECUTABLE_PATH}/*)
+ ELSE(CABLE_EXECUTABLE_PATH)
+ FIND_PROGRAM(CABLE NAMES cable PATHS
+ ${CABLE_BINARY_DIR}/Executables
+ ${CABLE_BINARY_DIR}/Executables/*)
+ ENDIF(CABLE_EXECUTABLE_PATH)
+
+ FIND_PATH(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
+ ${CABLE_SOURCE_DIR})
+ELSE(CABLE_BUILD_DIR)
+ # Find the cable executable in the path.
+ FIND_PROGRAM(CABLE NAMES cable)
+
+ # Get the path where the executable sits, but without the executable
+ # name on it.
+ GET_FILENAME_COMPONENT(CABLE_ROOT_BIN ${CABLE} PATH)
+
+ # Find the cable include directory in a path relative to the cable
+ # executable.
+ FIND_PATH(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h
+ ${CABLE_ROOT_BIN}/../include/Cable)
+
+ # Find the WrapTclFacility library in a path relative to the cable
+ # executable.
+ FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS
+ ${CABLE_ROOT_BIN}/../lib/Cable)
+ENDIF(CABLE_BUILD_DIR)
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
new file mode 100644
index 000000000..56a92c199
--- /dev/null
+++ b/Modules/FindCUDA.cmake
@@ -0,0 +1,1367 @@
+# - 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.
+#
+# 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.
+#
+# 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_64_BIT_DEVICE_CODE (Default matches host bit size)
+# -- Set to ON to compile for 64 bit device code, OFF for 32 bit device code.
+# Note that making this different from the host code when generating object
+# or C files from CUDA code just won't work, because size_t gets defined by
+# nvcc in the generated source. If you compile to PTX and then load the
+# file yourself, you can mix bit sizes between device and host.
+#
+# CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE (Default ON)
+# -- Set to ON if you want the custom build rule to be attached to the source
+# file in Visual Studio. Turn OFF if you add the same cuda file to multiple
+# targets.
+#
+# This allows the user to build the target from the CUDA file; however, bad
+# things can happen if the CUDA source file is added to multiple targets.
+# When performing parallel builds it is possible for the custom build
+# command to be run more than once and in parallel causing cryptic build
+# errors. VS runs the rules for every source file in the target, and a
+# source can have only one rule no matter how many projects it is added to.
+# When the rule is run from multiple targets race conditions can occur on
+# the generated file. Eventually everything will get built, but if the user
+# is unaware of this behavior, there may be confusion. It would be nice if
+# this script could detect the reuse of source files across multiple targets
+# and turn the option off for the user, but no good solution could be found.
+#
+# CUDA_BUILD_CUBIN (Default OFF)
+# -- Set to ON to enable and extra compilation pass with the -cubin option in
+# Device mode. The output is parsed and register, shared memory usage is
+# printed during build.
+#
+# CUDA_BUILD_EMULATION (Default OFF for device mode)
+# -- Set to ON for Emulation mode. -D_DEVICEEMU is defined for CUDA C files
+# when CUDA_BUILD_EMULATION is TRUE.
+#
+# CUDA_GENERATED_OUTPUT_DIR (Default CMAKE_CURRENT_BINARY_DIR)
+# -- Set to the path you wish to have the generated files placed. If it is
+# blank output files will be placed in CMAKE_CURRENT_BINARY_DIR.
+# Intermediate files will always be placed in
+# CMAKE_CURRENT_BINARY_DIR/CMakeFiles.
+#
+# CUDA_HOST_COMPILATION_CPP (Default ON)
+# -- Set to OFF for C compilation of host code.
+#
+# CUDA_NVCC_FLAGS
+# CUDA_NVCC_FLAGS_<CONFIG>
+# -- Additional NVCC command line arguments. NOTE: multiple arguments must be
+# semi-colon delimited (e.g. --compiler-options;-Wall)
+#
+# CUDA_PROPAGATE_HOST_FLAGS (Default ON)
+# -- Set to ON to propagate CMAKE_{C,CXX}_FLAGS and their configuration
+# dependent counterparts (e.g. CMAKE_C_FLAGS_DEBUG) automatically to the
+# host compiler through nvcc's -Xcompiler flag. This helps make the
+# generated host code match the rest of the system better. Sometimes
+# certain flags give nvcc problems, and this will help you turn the flag
+# propagation off. This does not affect the flags supplied directly to nvcc
+# via CUDA_NVCC_FLAGS or through the OPTION flags specified through
+# CUDA_ADD_LIBRARY, CUDA_ADD_EXECUTABLE, or CUDA_WRAP_SRCS. Flags used for
+# shared library compilation are not affected by this flag.
+#
+# CUDA_VERBOSE_BUILD (Default OFF)
+# -- Set to ON to see all the commands used when building the CUDA file. When
+# using a Makefile generator the value defaults to VERBOSE (run make
+# VERBOSE=1 to see output), although setting CUDA_VERBOSE_BUILD to ON will
+# always print the output.
+#
+# The script creates the following macros (in alphebetical order):
+#
+# CUDA_ADD_CUFFT_TO_TARGET( cuda_target )
+# -- Adds the cufft library to the target (can be any target). Handles whether
+# you are in emulation mode or not.
+#
+# CUDA_ADD_CUBLAS_TO_TARGET( cuda_target )
+# -- Adds the cublas library to the target (can be any target). Handles
+# whether you are in emulation mode or not.
+#
+# CUDA_ADD_EXECUTABLE( cuda_target file0 file1 ...
+# [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
+# -- Creates an executable "cuda_target" which is made up of the files
+# specified. All of the non CUDA C files are compiled using the standard
+# build rules specified by CMAKE and the cuda files are compiled to object
+# files using nvcc and the host compiler. In addition CUDA_INCLUDE_DIRS is
+# added automatically to include_directories(). Some standard CMake target
+# calls can be used on the target after calling this macro
+# (e.g. set_target_properties and target_link_libraries), but setting
+# properties that adjust compilation flags will not affect code compiled by
+# nvcc. Such flags should be modified before calling CUDA_ADD_EXECUTABLE,
+# CUDA_ADD_LIBRARY or CUDA_WRAP_SRCS.
+#
+# CUDA_ADD_LIBRARY( cuda_target file0 file1 ...
+# [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
+# -- Same as CUDA_ADD_EXECUTABLE except that a library is created.
+#
+# CUDA_BUILD_CLEAN_TARGET()
+# -- Creates a 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( generated_files file0 file1 ... [STATIC | SHARED | MODULE]
+# [OPTIONS ...] )
+# -- Returns a list of generated files from the input source files to be used
+# with ADD_LIBRARY or ADD_EXECUTABLE.
+#
+# CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] )
+# -- Returns a list of PTX files generated from the input source files.
+#
+# CUDA_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_WRAP_SRCS ( cuda_target format generated_files file0 file1 ...
+# [STATIC | SHARED | MODULE] [OPTIONS ...] )
+# -- This is where all the magic happens. CUDA_ADD_EXECUTABLE,
+# CUDA_ADD_LIBRARY, CUDA_COMPILE, and CUDA_COMPILE_PTX all call this
+# function under the hood.
+#
+# Given the list of files (file0 file1 ... fileN) this macro generates
+# custom commands that generate either PTX or linkable objects (use "PTX" or
+# "OBJ" for the format argument to switch). Files that don't end with .cu
+# or have the HEADER_FILE_ONLY property are ignored.
+#
+# The arguments passed in after OPTIONS are extra command line options to
+# give to nvcc. You can also specify per configuration options by
+# specifying the name of the configuration followed by the options. General
+# options must 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
+#
+# For certain configurations (namely VS generating object files with
+# CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE set to ON), no generated file will
+# be produced for the given cuda file. This is because when you add the
+# cuda file to Visual Studio it knows that this file produces an object file
+# and will link in the resulting object file automatically.
+#
+# This script will also generate a separate cmake script that is used at
+# build time to invoke nvcc. This is for several reasons.
+#
+# 1. nvcc can return negative numbers as return values which confuses
+# Visual Studio into thinking that the command succeeded. The script now
+# checks the error codes and produces errors when there was a problem.
+#
+# 2. nvcc has been known to not delete incomplete results when it
+# encounters problems. This confuses build systems into thinking the
+# target was generated when in fact an unusable file exists. The script
+# now deletes the output files if there was an error.
+#
+# 3. By putting all the options that affect the build into a file and then
+# make the build rule dependent on the file, the output files will be
+# regenerated when the options change.
+#
+# This script also looks at optional arguments STATIC, SHARED, or MODULE to
+# determine when to target the object compilation for a shared library.
+# BUILD_SHARED_LIBS is ignored in CUDA_WRAP_SRCS, but it is respected in
+# CUDA_ADD_LIBRARY. On some systems special flags are added for building
+# objects intended for shared libraries. A preprocessor macro,
+# <target_name>_EXPORTS is defined when a shared library compilation is
+# detected.
+#
+# Flags passed into add_definitions with -D or /D are passed along to nvcc.
+#
+# The script defines the following variables:
+#
+# CUDA_VERSION_MAJOR -- The major version of cuda as reported by nvcc.
+# CUDA_VERSION_MINOR -- The minor version.
+# CUDA_VERSION
+# CUDA_VERSION_STRING -- CUDA_VERSION_MAJOR.CUDA_VERSION_MINOR
+#
+# CUDA_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_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_nvcuvenc_LIBRARY -- CUDA Video Encoder library.
+# Only available for CUDA version 3.2+.
+# Windows only.
+# CUDA_nvcuvid_LIBRARY -- CUDA Video Decoder library.
+# Only available for CUDA version 3.2+.
+# Windows only.
+#
+#
+# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
+# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
+#
+# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
+#
+# 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.
+
+# The MIT License
+#
+# License for the specific language governing rights and limitations under
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+###############################################################################
+
+# 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}")
+ # CMAKE_CURRENT_LIST_FILE contains the full path to the file currently being
+ # processed. Using this variable, we can pull out the current path, and
+ # provide a way to get access to the other files we need local to here.
+ get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+ set(CUDA_${_name} "${CMAKE_CURRENT_LIST_DIR}/FindCUDA/${_full_name}")
+ if(NOT EXISTS "${CUDA_${_name}}")
+ set(error_message "${_full_name} not found in ${CMAKE_CURRENT_LIST_DIR}/FindCUDA")
+ if(CUDA_FIND_REQUIRED)
+ message(FATAL_ERROR "${error_message}")
+ else()
+ if(NOT CUDA_FIND_QUIETLY)
+ message(STATUS "${error_message}")
+ endif()
+ endif()
+ endif()
+ # Set this variable as internal, so the user isn't bugged with it.
+ set(CUDA_${_name} ${CUDA_${_name}} CACHE INTERNAL "Location of ${_full_name}" FORCE)
+endmacro(CUDA_FIND_HELPER_FILE)
+
+#####################################################################
+## CUDA_INCLUDE_NVCC_DEPENDENCIES
+##
+
+# So we want to try and include the dependency file if it exists. If
+# it doesn't exist then we need to create an empty one, so we can
+# include it.
+
+# If it does exist, then we need to check to see if all the files it
+# depends on exist. If they don't then we should clear the dependency
+# file and regenerate it later. This covers the case where a header
+# file has disappeared or moved.
+
+macro(CUDA_INCLUDE_NVCC_DEPENDENCIES dependency_file)
+ set(CUDA_NVCC_DEPEND)
+ set(CUDA_NVCC_DEPEND_REGENERATE FALSE)
+
+
+ # Include the dependency file. Create it first if it doesn't exist . The
+ # INCLUDE puts a dependency that will force CMake to rerun and bring in the
+ # new info when it changes. DO NOT REMOVE THIS (as I did and spent a few
+ # hours figuring out why it didn't work.
+ if(NOT EXISTS ${dependency_file})
+ file(WRITE ${dependency_file} "#FindCUDA.cmake generated file. Do not edit.\n")
+ endif()
+ # Always include this file to force CMake to run again next
+ # invocation and rebuild the dependencies.
+ #message("including dependency_file = ${dependency_file}")
+ include(${dependency_file})
+
+ # Now we need to verify the existence of all the included files
+ # here. If they aren't there we need to just blank this variable and
+ # make the file regenerate again.
+# if(DEFINED CUDA_NVCC_DEPEND)
+# message("CUDA_NVCC_DEPEND set")
+# else()
+# message("CUDA_NVCC_DEPEND NOT set")
+# endif()
+ if(CUDA_NVCC_DEPEND)
+ #message("CUDA_NVCC_DEPEND found")
+ foreach(f ${CUDA_NVCC_DEPEND})
+ # message("searching for ${f}")
+ if(NOT EXISTS ${f})
+ #message("file ${f} not found")
+ set(CUDA_NVCC_DEPEND_REGENERATE TRUE)
+ endif()
+ endforeach(f)
+ else(CUDA_NVCC_DEPEND)
+ #message("CUDA_NVCC_DEPEND false")
+ # No dependencies, so regenerate the file.
+ set(CUDA_NVCC_DEPEND_REGENERATE TRUE)
+ endif(CUDA_NVCC_DEPEND)
+
+ #message("CUDA_NVCC_DEPEND_REGENERATE = ${CUDA_NVCC_DEPEND_REGENERATE}")
+ # No incoming dependencies, so we need to generate them. Make the
+ # output depend on the dependency file itself, which should cause the
+ # rule to re-run.
+ if(CUDA_NVCC_DEPEND_REGENERATE)
+ set(CUDA_NVCC_DEPEND ${dependency_file})
+ #message("Generating an empty dependency_file: ${dependency_file}")
+ file(WRITE ${dependency_file} "#FindCUDA.cmake generated file. Do not edit.\n")
+ endif(CUDA_NVCC_DEPEND_REGENERATE)
+
+endmacro(CUDA_INCLUDE_NVCC_DEPENDENCIES)
+
+###############################################################################
+###############################################################################
+# Setup variables' defaults
+###############################################################################
+###############################################################################
+
+# Allow the user to specify if the device code is supposed to be 32 or 64 bit.
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(CUDA_64_BIT_DEVICE_CODE_DEFAULT ON)
+else()
+ set(CUDA_64_BIT_DEVICE_CODE_DEFAULT OFF)
+endif()
+option(CUDA_64_BIT_DEVICE_CODE "Compile device code in 64 bit mode" ${CUDA_64_BIT_DEVICE_CODE_DEFAULT})
+
+# Attach the build rule to the source file in VS. This option
+option(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE "Attach the build rule to the CUDA source file. Enable only when the CUDA source file is added to at most one target." ON)
+
+# Prints out extra information about the cuda file during compilation
+option(CUDA_BUILD_CUBIN "Generate and parse .cubin files in Device mode." OFF)
+
+# Set whether we are using emulation or device mode.
+option(CUDA_BUILD_EMULATION "Build in Emulation mode" OFF)
+
+# Where to put the generated output.
+set(CUDA_GENERATED_OUTPUT_DIR "" CACHE PATH "Directory to put all the output files. If blank it will default to the CMAKE_CURRENT_BINARY_DIR")
+
+# Parse HOST_COMPILATION mode.
+option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON)
+
+# Extra user settable flags
+set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
+
+# Propagate the host flags to the host compiler via -Xcompiler
+option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON)
+
+# Specifies whether the commands used when compiling the .cu file will be printed out.
+option(CUDA_VERBOSE_BUILD "Print out the commands run while compiling the CUDA source file. With the Makefile generator this defaults to VERBOSE variable specified on the command line, but can be forced on with this option." OFF)
+
+mark_as_advanced(
+ CUDA_64_BIT_DEVICE_CODE
+ CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE
+ CUDA_GENERATED_OUTPUT_DIR
+ CUDA_HOST_COMPILATION_CPP
+ CUDA_NVCC_FLAGS
+ CUDA_PROPAGATE_HOST_FLAGS
+ )
+
+# Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we
+# need to add another entry for the CMAKE_BUILD_TYPE. We also need to add the
+# standerd set of 4 build types (Debug, MinSizeRel, Release, and RelWithDebInfo)
+# for completeness. We need run this loop in order to accomodate the addition
+# of extra configuration types. Duplicate entries will be removed by
+# REMOVE_DUPLICATES.
+set(CUDA_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo)
+list(REMOVE_DUPLICATES CUDA_configuration_types)
+foreach(config ${CUDA_configuration_types})
+ string(TOUPPER ${config} config_upper)
+ set(CUDA_NVCC_FLAGS_${config_upper} "" CACHE STRING "Semi-colon delimit multiple arguments.")
+ mark_as_advanced(CUDA_NVCC_FLAGS_${config_upper})
+endforeach()
+
+###############################################################################
+###############################################################################
+# Locate CUDA, Set Build Type, etc.
+###############################################################################
+###############################################################################
+
+# 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)
+ unset(CUDA_TOOLKIT_INCLUDE CACHE)
+ unset(CUDA_CUDART_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_cublas_LIBRARY CACHE)
+ unset(CUDA_cublasemu_LIBRARY CACHE)
+ unset(CUDA_cufft_LIBRARY CACHE)
+ unset(CUDA_cufftemu_LIBRARY CACHE)
+ unset(CUDA_curand_LIBRARY CACHE)
+ unset(CUDA_cusparse_LIBRARY CACHE)
+ unset(CUDA_npp_LIBRARY CACHE)
+ unset(CUDA_nvcuvenc_LIBRARY CACHE)
+ unset(CUDA_nvcuvid_LIBRARY CACHE)
+endif()
+
+if(NOT "${CUDA_SDK_ROOT_DIR}" STREQUAL "${CUDA_SDK_ROOT_DIR_INTERNAL}")
+ # No specific variables to catch. Use this kind of code before calling
+ # find_package(CUDA) to clean up any variables that may depend on this path.
+
+ # unset(MY_SPECIAL_CUDA_SDK_INCLUDE_DIR CACHE)
+ # unset(MY_SPECIAL_CUDA_SDK_LIBRARY CACHE)
+endif()
+
+# Search for the cuda distribution.
+if(NOT CUDA_TOOLKIT_ROOT_DIR)
+
+ # Search in the CUDA_BIN_PATH first.
+ find_path(CUDA_TOOLKIT_ROOT_DIR
+ NAMES nvcc nvcc.exe
+ PATHS
+ ENV CUDA_PATH
+ ENV CUDA_BIN_PATH
+ PATH_SUFFIXES bin bin64
+ DOC "Toolkit location."
+ NO_DEFAULT_PATH
+ )
+ # Now search default paths
+ find_path(CUDA_TOOLKIT_ROOT_DIR
+ NAMES nvcc nvcc.exe
+ PATHS /usr/local/bin
+ /usr/local/cuda/bin
+ DOC "Toolkit location."
+ )
+
+ if (CUDA_TOOLKIT_ROOT_DIR)
+ string(REGEX REPLACE "[/\\\\]?bin[64]*[/\\\\]?$" "" CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR})
+ # We need to force this back into the cache.
+ set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH "Toolkit location." FORCE)
+ endif(CUDA_TOOLKIT_ROOT_DIR)
+ if (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
+ if(CUDA_FIND_REQUIRED)
+ message(FATAL_ERROR "Specify CUDA_TOOLKIT_ROOT_DIR")
+ elseif(NOT CUDA_FIND_QUIETLY)
+ message("CUDA_TOOLKIT_ROOT_DIR not found or specified")
+ endif()
+ endif (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
+endif (NOT CUDA_TOOLKIT_ROOT_DIR)
+
+# CUDA_NVCC_EXECUTABLE
+find_program(CUDA_NVCC_EXECUTABLE
+ NAMES nvcc
+ PATHS "${CUDA_TOOLKIT_ROOT_DIR}"
+ ENV CUDA_PATH
+ ENV CUDA_BIN_PATH
+ PATH_SUFFIXES bin bin64
+ NO_DEFAULT_PATH
+ )
+# Search default search paths, after we search our own set of paths.
+find_program(CUDA_NVCC_EXECUTABLE nvcc)
+mark_as_advanced(CUDA_NVCC_EXECUTABLE)
+
+if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION)
+ # Compute the version.
+ execute_process (COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
+ string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR ${NVCC_OUT})
+ string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT})
+ set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.")
+ mark_as_advanced(CUDA_VERSION)
+else()
+ # Need to set these based off of the cached value
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR "${CUDA_VERSION}")
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR "${CUDA_VERSION}")
+endif()
+
+# Always set this convenience variable
+set(CUDA_VERSION_STRING "${CUDA_VERSION}")
+
+# CUDA_TOOLKIT_INCLUDE
+find_path(CUDA_TOOLKIT_INCLUDE
+ device_functions.h # Header included in toolkit
+ PATHS "${CUDA_TOOLKIT_ROOT_DIR}"
+ ENV CUDA_PATH
+ ENV CUDA_INC_PATH
+ PATH_SUFFIXES include
+ NO_DEFAULT_PATH
+ )
+# Search default search paths, after we search our own set of paths.
+find_path(CUDA_TOOLKIT_INCLUDE device_functions.h)
+mark_as_advanced(CUDA_TOOLKIT_INCLUDE)
+
+# Set the user list of include dir to nothing to initialize it.
+set (CUDA_NVCC_INCLUDE_ARGS_USER "")
+set (CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE})
+
+macro(FIND_LIBRARY_LOCAL_FIRST _var _names _doc)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ # CUDA 3.2+ on Windows moved the library directories, so we need the new
+ # and old paths.
+ set(_cuda_64bit_lib_dir "lib/x64" "lib64" )
+ endif()
+ # CUDA 3.2+ on Windows moved the library directories, so we need to new
+ # (lib/Win32) and the old path (lib).
+ find_library(${_var}
+ NAMES ${_names}
+ PATHS "${CUDA_TOOLKIT_ROOT_DIR}"
+ ENV CUDA_PATH
+ ENV CUDA_LIB_PATH
+ PATH_SUFFIXES ${_cuda_64bit_lib_dir} "lib/Win32" "lib"
+ DOC ${_doc}
+ NO_DEFAULT_PATH
+ )
+ # Search default search paths, after we search our own set of paths.
+ find_library(${_var} NAMES ${_names} DOC ${_doc})
+endmacro()
+
+# CUDA_LIBRARIES
+find_library_local_first(CUDA_CUDART_LIBRARY cudart "\"cudart\" library")
+if(CUDA_VERSION VERSION_EQUAL "3.0")
+ # The cudartemu library only existed for the 3.0 version of CUDA.
+ find_library_local_first(CUDA_CUDARTEMU_LIBRARY cudartemu "\"cudartemu\" library")
+ mark_as_advanced(
+ CUDA_CUDARTEMU_LIBRARY
+ )
+endif()
+# 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)
+ endif()
+ if(_cuda_path_to_cudart)
+ list(APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}")
+ endif()
+endif()
+
+# 1.1 toolkit on linux doesn't appear to have a separate library on
+# some platforms.
+find_library_local_first(CUDA_CUDA_LIBRARY cuda "\"cuda\" library (older versions only).")
+
+# Add cuda library to the link line only if it is found.
+if (CUDA_CUDA_LIBRARY)
+ set(CUDA_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
+endif(CUDA_CUDA_LIBRARY)
+
+mark_as_advanced(
+ CUDA_CUDA_LIBRARY
+ CUDA_CUDART_LIBRARY
+ )
+
+#######################
+# Look for some of the toolkit helper libraries
+macro(FIND_CUDA_HELPER_LIBS _name)
+ find_library_local_first(CUDA_${_name}_LIBRARY ${_name} "\"${_name}\" library")
+ mark_as_advanced(CUDA_${_name}_LIBRARY)
+endmacro(FIND_CUDA_HELPER_LIBS)
+
+#######################
+# Disable emulation for v3.1 onward
+if(CUDA_VERSION VERSION_GREATER "3.0")
+ if(CUDA_BUILD_EMULATION)
+ message(FATAL_ERROR "CUDA_BUILD_EMULATION is not supported in version 3.1 and onwards. You must disable it to proceed. You have version ${CUDA_VERSION}.")
+ endif()
+endif()
+
+# Search for additional CUDA toolkit libraries.
+if(CUDA_VERSION VERSION_LESS "3.1")
+ # Emulation libraries aren't available in version 3.1 onward.
+ find_cuda_helper_libs(cufftemu)
+ find_cuda_helper_libs(cublasemu)
+endif()
+find_cuda_helper_libs(cufft)
+find_cuda_helper_libs(cublas)
+if(NOT CUDA_VERSION VERSION_LESS "3.2")
+ # cusparse showed up in version 3.2
+ find_cuda_helper_libs(cusparse)
+ find_cuda_helper_libs(curand)
+ if (WIN32)
+ find_cuda_helper_libs(nvcuvenc)
+ find_cuda_helper_libs(nvcuvid)
+ endif()
+endif()
+if(NOT CUDA_VERSION VERSION_LESS "4.0")
+ find_cuda_helper_libs(npp)
+endif()
+
+if (CUDA_BUILD_EMULATION)
+ set(CUDA_CUFFT_LIBRARIES ${CUDA_cufftemu_LIBRARY})
+ set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublasemu_LIBRARY})
+else()
+ set(CUDA_CUFFT_LIBRARIES ${CUDA_cufft_LIBRARY})
+ set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublas_LIBRARY})
+endif()
+
+########################
+# Look for the SDK stuff. As of CUDA 3.0 NVSDKCUDA_ROOT has been replaced with
+# NVSDKCOMPUTE_ROOT with the old CUDA C contents moved into the C subdirectory
+find_path(CUDA_SDK_ROOT_DIR common/inc/cutil.h
+ "$ENV{NVSDKCOMPUTE_ROOT}/C"
+ "$ENV{NVSDKCUDA_ROOT}"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Installed Products\\NVIDIA SDK 10\\Compute;InstallDir]"
+ "/Developer/GPU\ Computing/C"
+ )
+
+# Keep the CUDA_SDK_ROOT_DIR first in order to be able to override the
+# environment variables.
+set(CUDA_SDK_SEARCH_PATH
+ "${CUDA_SDK_ROOT_DIR}"
+ "${CUDA_TOOLKIT_ROOT_DIR}/local/NVSDK0.2"
+ "${CUDA_TOOLKIT_ROOT_DIR}/NVSDK0.2"
+ "${CUDA_TOOLKIT_ROOT_DIR}/NV_CUDA_SDK"
+ "$ENV{HOME}/NVIDIA_CUDA_SDK"
+ "$ENV{HOME}/NVIDIA_CUDA_SDK_MACOSX"
+ "/Developer/CUDA"
+ )
+
+# Example of how to find an include file from the CUDA_SDK_ROOT_DIR
+
+# find_path(CUDA_CUT_INCLUDE_DIR
+# cutil.h
+# PATHS ${CUDA_SDK_SEARCH_PATH}
+# PATH_SUFFIXES "common/inc"
+# DOC "Location of cutil.h"
+# NO_DEFAULT_PATH
+# )
+# # Now search system paths
+# find_path(CUDA_CUT_INCLUDE_DIR cutil.h DOC "Location of cutil.h")
+
+# mark_as_advanced(CUDA_CUT_INCLUDE_DIR)
+
+
+# Example of how to find a library in the CUDA_SDK_ROOT_DIR
+
+# # cutil library is called cutil64 for 64 bit builds on windows. We don't want
+# # to get these confused, so we are setting the name based on the word size of
+# # the build.
+
+# if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+# set(cuda_cutil_name cutil64)
+# else(CMAKE_SIZEOF_VOID_P EQUAL 8)
+# set(cuda_cutil_name cutil32)
+# endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+
+# find_library(CUDA_CUT_LIBRARY
+# NAMES cutil ${cuda_cutil_name}
+# PATHS ${CUDA_SDK_SEARCH_PATH}
+# # The new version of the sdk shows up in common/lib, but the old one is in lib
+# PATH_SUFFIXES "common/lib" "lib"
+# DOC "Location of cutil library"
+# NO_DEFAULT_PATH
+# )
+# # Now search system paths
+# find_library(CUDA_CUT_LIBRARY NAMES cutil ${cuda_cutil_name} DOC "Location of cutil library")
+# mark_as_advanced(CUDA_CUT_LIBRARY)
+# set(CUDA_CUT_LIBRARIES ${CUDA_CUT_LIBRARY})
+
+
+
+#############################
+# Check for required components
+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_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)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(CUDA
+ REQUIRED_VARS
+ CUDA_TOOLKIT_ROOT_DIR
+ CUDA_NVCC_EXECUTABLE
+ CUDA_INCLUDE_DIRS
+ CUDA_CUDART_LIBRARY
+ VERSION_VAR
+ CUDA_VERSION
+ )
+
+
+
+###############################################################################
+###############################################################################
+# Macros
+###############################################################################
+###############################################################################
+
+###############################################################################
+# Add include directories to pass to the nvcc command.
+macro(CUDA_INCLUDE_DIRECTORIES)
+ foreach(dir ${ARGN})
+ list(APPEND CUDA_NVCC_INCLUDE_ARGS_USER -I${dir})
+ endforeach(dir ${ARGN})
+endmacro(CUDA_INCLUDE_DIRECTORIES)
+
+
+##############################################################################
+cuda_find_helper_file(parse_cubin cmake)
+cuda_find_helper_file(make2cmake cmake)
+cuda_find_helper_file(run_nvcc cmake)
+
+##############################################################################
+# Separate the OPTIONS out from the sources
+#
+macro(CUDA_GET_SOURCES_AND_OPTIONS _sources _cmake_options _options)
+ set( ${_sources} )
+ set( ${_cmake_options} )
+ set( ${_options} )
+ set( _found_options FALSE )
+ foreach(arg ${ARGN})
+ if(arg STREQUAL "OPTIONS")
+ 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"
+ )
+ list(APPEND ${_cmake_options} ${arg})
+ else()
+ if ( _found_options )
+ list(APPEND ${_options} ${arg})
+ else()
+ # Assume this is a file
+ list(APPEND ${_sources} ${arg})
+ endif()
+ endif()
+ endforeach()
+endmacro()
+
+##############################################################################
+# Parse the OPTIONS from ARGN and set the variables prefixed by _option_prefix
+#
+macro(CUDA_PARSE_NVCC_OPTIONS _option_prefix)
+ set( _found_config )
+ foreach(arg ${ARGN})
+ # Determine if we are dealing with a perconfiguration flag
+ foreach(config ${CUDA_configuration_types})
+ string(TOUPPER ${config} config_upper)
+ if (arg STREQUAL "${config_upper}")
+ set( _found_config _${arg})
+ # Set arg to nothing to keep it from being processed further
+ set( arg )
+ endif()
+ endforeach()
+
+ if ( arg )
+ list(APPEND ${_option_prefix}${_found_config} "${arg}")
+ endif()
+ endforeach()
+endmacro()
+
+##############################################################################
+# Helper to add the include directory for CUDA only once
+function(CUDA_ADD_CUDA_INCLUDE_ONCE)
+ get_directory_property(_include_directories INCLUDE_DIRECTORIES)
+ set(_add TRUE)
+ if(_include_directories)
+ foreach(dir ${_include_directories})
+ if("${dir}" STREQUAL "${CUDA_INCLUDE_DIRS}")
+ set(_add FALSE)
+ endif()
+ endforeach()
+ endif()
+ if(_add)
+ include_directories(${CUDA_INCLUDE_DIRS})
+ endif()
+endfunction()
+
+function(CUDA_BUILD_SHARED_LIBRARY shared_flag)
+ set(cmake_args ${ARGN})
+ # If SHARED, MODULE, or STATIC aren't already in the list of arguments, then
+ # add SHARED or STATIC based on the value of BUILD_SHARED_LIBS.
+ list(FIND cmake_args SHARED _cuda_found_SHARED)
+ list(FIND cmake_args MODULE _cuda_found_MODULE)
+ list(FIND cmake_args STATIC _cuda_found_STATIC)
+ if( _cuda_found_SHARED GREATER -1 OR
+ _cuda_found_MODULE GREATER -1 OR
+ _cuda_found_STATIC GREATER -1)
+ set(_cuda_build_shared_libs)
+ else()
+ if (BUILD_SHARED_LIBS)
+ set(_cuda_build_shared_libs SHARED)
+ else()
+ set(_cuda_build_shared_libs STATIC)
+ endif()
+ endif()
+ set(${shared_flag} ${_cuda_build_shared_libs} PARENT_SCOPE)
+endfunction()
+
+##############################################################################
+# Helper to avoid clashes of files with the same basename but different paths.
+# This doesn't attempt to do exactly what CMake internals do, which is to only
+# add this path when there is a conflict, since by the time a second collision
+# in names is detected it's already too late to fix the first one. For
+# consistency sake the relative path will be added to all files.
+function(CUDA_COMPUTE_BUILD_PATH path build_path)
+ #message("CUDA_COMPUTE_BUILD_PATH([${path}] ${build_path})")
+ # Only deal with CMake style paths from here on out
+ file(TO_CMAKE_PATH "${path}" bpath)
+ if (IS_ABSOLUTE "${bpath}")
+ # Absolute paths are generally unnessary, especially if something like
+ # FILE(GLOB_RECURSE) is used to pick up the files.
+ file(RELATIVE_PATH bpath "${CMAKE_CURRENT_SOURCE_DIR}" "${bpath}")
+ endif()
+
+ # This recipie is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the
+ # CMake source.
+
+ # Remove leading /
+ string(REGEX REPLACE "^[/]+" "" bpath "${bpath}")
+ # Avoid absolute paths by removing ':'
+ string(REPLACE ":" "_" bpath "${bpath}")
+ # Avoid relative paths that go up the tree
+ string(REPLACE "../" "__/" bpath "${bpath}")
+ # Avoid spaces
+ string(REPLACE " " "_" bpath "${bpath}")
+
+ # Strip off the filename. I wait until here to do it, since removin the
+ # basename can make a path that looked like path/../basename turn into
+ # path/.. (notice the trailing slash).
+ get_filename_component(bpath "${bpath}" PATH)
+
+ set(${build_path} "${bpath}" PARENT_SCOPE)
+ #message("${build_path} = ${bpath}")
+endfunction()
+
+##############################################################################
+# This helper macro populates the following variables and setups up custom
+# commands and targets to invoke the nvcc compiler to generate C or PTX source
+# dependent upon the format parameter. The compiler is invoked once with -M
+# to generate a dependency file and a second time with -cuda or -ptx to generate
+# a .cpp or .ptx file.
+# INPUT:
+# cuda_target - Target name
+# format - PTX or OBJ
+# FILE1 .. FILEN - The remaining arguments are the sources to be wrapped.
+# OPTIONS - Extra options to NVCC
+# OUTPUT:
+# generated_files - List of generated files
+##############################################################################
+##############################################################################
+
+macro(CUDA_WRAP_SRCS cuda_target format generated_files)
+
+ if( ${format} MATCHES "PTX" )
+ set( compile_to_ptx ON )
+ elseif( ${format} MATCHES "OBJ")
+ set( compile_to_ptx OFF )
+ else()
+ message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS: '${format}'. Use OBJ or PTX.")
+ endif()
+
+ # Set up all the command line flags here, so that they can be overridden on a per target basis.
+
+ set(nvcc_flags "")
+
+ # Emulation if the card isn't present.
+ if (CUDA_BUILD_EMULATION)
+ # Emulation.
+ set(nvcc_flags ${nvcc_flags} --device-emulation -D_DEVICEEMU -g)
+ else(CUDA_BUILD_EMULATION)
+ # Device mode. No flags necessary.
+ endif(CUDA_BUILD_EMULATION)
+
+ if(CUDA_HOST_COMPILATION_CPP)
+ set(CUDA_C_OR_CXX CXX)
+ else(CUDA_HOST_COMPILATION_CPP)
+ if(CUDA_VERSION VERSION_LESS "3.0")
+ set(nvcc_flags ${nvcc_flags} --host-compilation C)
+ else()
+ message(WARNING "--host-compilation flag is deprecated in CUDA version >= 3.0. Removing --host-compilation C flag" )
+ endif()
+ set(CUDA_C_OR_CXX C)
+ endif(CUDA_HOST_COMPILATION_CPP)
+
+ set(generated_extension ${CMAKE_${CUDA_C_OR_CXX}_OUTPUT_EXTENSION})
+
+ if(CUDA_64_BIT_DEVICE_CODE)
+ set(nvcc_flags ${nvcc_flags} -m64)
+ else()
+ set(nvcc_flags ${nvcc_flags} -m32)
+ endif()
+
+ # This needs to be passed in at this stage, because VS needs to fill out the
+ # value of VCInstallDir from within VS.
+ if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
+ # Add nvcc flag for 64b Windows
+ set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" )
+ endif()
+ endif()
+
+ # Figure out which configure we will use and pass that in as an argument to
+ # the script. We need to defer the decision until compilation time, because
+ # for VS projects we won't know if we are making a debug or release build
+ # until build time.
+ if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ set( CUDA_build_configuration "$(ConfigurationName)" )
+ else()
+ set( CUDA_build_configuration "${CMAKE_BUILD_TYPE}")
+ endif()
+
+ # Initialize our list of includes with the user ones followed by the CUDA system ones.
+ set(CUDA_NVCC_INCLUDE_ARGS ${CUDA_NVCC_INCLUDE_ARGS_USER} "-I${CUDA_INCLUDE_DIRS}")
+ # Get the include directories for this directory and use them for our nvcc command.
+ get_directory_property(CUDA_NVCC_INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES)
+ if(CUDA_NVCC_INCLUDE_DIRECTORIES)
+ foreach(dir ${CUDA_NVCC_INCLUDE_DIRECTORIES})
+ list(APPEND CUDA_NVCC_INCLUDE_ARGS -I${dir})
+ endforeach()
+ endif()
+
+ # Reset these variables
+ set(CUDA_WRAP_OPTION_NVCC_FLAGS)
+ foreach(config ${CUDA_configuration_types})
+ string(TOUPPER ${config} config_upper)
+ set(CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper})
+ endforeach()
+
+ CUDA_GET_SOURCES_AND_OPTIONS(_cuda_wrap_sources _cuda_wrap_cmake_options _cuda_wrap_options ${ARGN})
+ CUDA_PARSE_NVCC_OPTIONS(CUDA_WRAP_OPTION_NVCC_FLAGS ${_cuda_wrap_options})
+
+ # Figure out if we are building a shared library. BUILD_SHARED_LIBS is
+ # respected in CUDA_ADD_LIBRARY.
+ set(_cuda_build_shared_libs FALSE)
+ # SHARED, MODULE
+ list(FIND _cuda_wrap_cmake_options SHARED _cuda_found_SHARED)
+ list(FIND _cuda_wrap_cmake_options MODULE _cuda_found_MODULE)
+ if(_cuda_found_SHARED GREATER -1 OR _cuda_found_MODULE GREATER -1)
+ set(_cuda_build_shared_libs TRUE)
+ endif()
+ # STATIC
+ list(FIND _cuda_wrap_cmake_options STATIC _cuda_found_STATIC)
+ if(_cuda_found_STATIC GREATER -1)
+ set(_cuda_build_shared_libs FALSE)
+ endif()
+
+ # CUDA_HOST_FLAGS
+ if(_cuda_build_shared_libs)
+ # If we are setting up code for a shared library, then we need to add extra flags for
+ # compiling objects for shared libraries.
+ set(CUDA_HOST_SHARED_FLAGS ${CMAKE_SHARED_LIBRARY_${CUDA_C_OR_CXX}_FLAGS})
+ else()
+ set(CUDA_HOST_SHARED_FLAGS)
+ endif()
+ # Only add the CMAKE_{C,CXX}_FLAGS if we are propagating host flags. We
+ # always need to set the SHARED_FLAGS, though.
+ if(CUDA_PROPAGATE_HOST_FLAGS)
+ set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CMAKE_${CUDA_C_OR_CXX}_FLAGS} ${CUDA_HOST_SHARED_FLAGS})")
+ else()
+ set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CUDA_HOST_SHARED_FLAGS})")
+ endif()
+
+ set(CUDA_NVCC_FLAGS_CONFIG "# Build specific configuration flags")
+ # Loop over all the configuration types to generate appropriate flags for run_nvcc.cmake
+ foreach(config ${CUDA_configuration_types})
+ string(TOUPPER ${config} config_upper)
+ # CMAKE_FLAGS are strings and not lists. By not putting quotes around CMAKE_FLAGS
+ # we convert the strings to lists (like we want).
+
+ if(CUDA_PROPAGATE_HOST_FLAGS)
+ # nvcc chokes on -g3 in versions previous to 3.0, so replace it with -g
+ if(CMAKE_COMPILER_IS_GNUCC AND CUDA_VERSION VERSION_LESS "3.0")
+ string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")
+ else()
+ set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")
+ endif()
+
+ set(CUDA_HOST_FLAGS "${CUDA_HOST_FLAGS}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})")
+ endif()
+
+ # Note that if we ever want CUDA_NVCC_FLAGS_<CONFIG> to be string (instead of a list
+ # like it is currently), we can remove the quotes around the
+ # ${CUDA_NVCC_FLAGS_${config_upper}} variable like the CMAKE_HOST_FLAGS_<CONFIG> variable.
+ 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()
+
+ if(compile_to_ptx)
+ # Don't use any of the host compilation flags for PTX targets.
+ set(CUDA_HOST_FLAGS)
+ set(CUDA_NVCC_FLAGS_CONFIG)
+ endif()
+
+ # Get the list of definitions from the directory property
+ get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS)
+ if(CUDA_NVCC_DEFINITIONS)
+ foreach(_definition ${CUDA_NVCC_DEFINITIONS})
+ list(APPEND nvcc_flags "-D${_definition}")
+ endforeach()
+ endif()
+
+ if(_cuda_build_shared_libs)
+ list(APPEND nvcc_flags "-D${cuda_target}_EXPORTS")
+ endif()
+
+ # Reset the output variable
+ set(_cuda_wrap_generated_files "")
+
+ # Iterate over the macro arguments and create custom
+ # commands for all the .cu 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)
+
+ # Determine output directory
+ cuda_compute_build_path("${file}" cuda_build_path)
+ set(cuda_compile_intermediate_directory "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${cuda_target}.dir/${cuda_build_path}")
+ if(CUDA_GENERATED_OUTPUT_DIR)
+ set(cuda_compile_output_dir "${CUDA_GENERATED_OUTPUT_DIR}")
+ else()
+ if ( compile_to_ptx )
+ set(cuda_compile_output_dir "${CMAKE_CURRENT_BINARY_DIR}")
+ else()
+ set(cuda_compile_output_dir "${cuda_compile_intermediate_directory}")
+ endif()
+ endif()
+
+ # Add a custom target to generate a c or ptx file. ######################
+
+ get_filename_component( basename ${file} NAME )
+ if( compile_to_ptx )
+ set(generated_file_path "${cuda_compile_output_dir}")
+ set(generated_file_basename "${cuda_target}_generated_${basename}.ptx")
+ set(format_flag "-ptx")
+ file(MAKE_DIRECTORY "${cuda_compile_output_dir}")
+ else( compile_to_ptx )
+ set(generated_file_path "${cuda_compile_output_dir}/${CMAKE_CFG_INTDIR}")
+ set(generated_file_basename "${cuda_target}_generated_${basename}${generated_extension}")
+ set(format_flag "-c")
+ endif( compile_to_ptx )
+
+ # Set all of our file names. Make sure that whatever filenames that have
+ # generated_file_path in them get passed in through as a command line
+ # argument, so that the ${CMAKE_CFG_INTDIR} gets expanded at run time
+ # instead of configure time.
+ set(generated_file "${generated_file_path}/${generated_file_basename}")
+ set(cmake_dependency_file "${cuda_compile_intermediate_directory}/${generated_file_basename}.depend")
+ set(NVCC_generated_dependency_file "${cuda_compile_intermediate_directory}/${generated_file_basename}.NVCC-depend")
+ set(generated_cubin_file "${generated_file_path}/${generated_file_basename}.cubin.txt")
+ set(custom_target_script "${cuda_compile_intermediate_directory}/${generated_file_basename}.cmake")
+
+ # Setup properties for obj files:
+ if( NOT compile_to_ptx )
+ set_source_files_properties("${generated_file}"
+ PROPERTIES
+ EXTERNAL_OBJECT true # This is an object file not to be compiled, but only be linked.
+ )
+ endif()
+
+ # Don't add CMAKE_CURRENT_SOURCE_DIR if the path is already an absolute path.
+ get_filename_component(file_path "${file}" PATH)
+ if(IS_ABSOLUTE "${file_path}")
+ set(source_file "${file}")
+ else()
+ set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
+ endif()
+
+ # Bring in the dependencies. Creates a variable CUDA_NVCC_DEPEND #######
+ cuda_include_nvcc_dependencies(${cmake_dependency_file})
+
+ # Convience string for output ###########################################
+ if(CUDA_BUILD_EMULATION)
+ set(cuda_build_type "Emulation")
+ else(CUDA_BUILD_EMULATION)
+ set(cuda_build_type "Device")
+ endif(CUDA_BUILD_EMULATION)
+
+ # Build the NVCC made dependency file ###################################
+ set(build_cubin OFF)
+ if ( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN )
+ if ( NOT compile_to_ptx )
+ set ( build_cubin ON )
+ endif( NOT compile_to_ptx )
+ endif( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN )
+
+ # Configure the build script
+ configure_file("${CUDA_run_nvcc}" "${custom_target_script}" @ONLY)
+
+ # So if a user specifies the same cuda file as input more than once, you
+ # can have bad things happen with dependencies. Here we check an option
+ # to see if this is the behavior they want.
+ if(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE)
+ set(main_dep MAIN_DEPENDENCY ${source_file})
+ else()
+ set(main_dep DEPENDS ${source_file})
+ endif()
+
+ if(CUDA_VERBOSE_BUILD)
+ set(verbose_output ON)
+ elseif(CMAKE_GENERATOR MATCHES "Makefiles")
+ set(verbose_output "$(VERBOSE)")
+ else()
+ set(verbose_output OFF)
+ endif()
+
+ # 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}")
+ else()
+ set(cuda_build_comment_string "Building NVCC (${cuda_build_type}) object ${generated_file_relative_path}")
+ endif()
+
+ # Build the generated file and dependency file ##########################
+ add_custom_command(
+ OUTPUT ${generated_file}
+ # These output files depend on the source_file and the contents of cmake_dependency_file
+ ${main_dep}
+ DEPENDS ${CUDA_NVCC_DEPEND}
+ DEPENDS ${custom_target_script}
+ # Make sure the output directory exists before trying to write to it.
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${generated_file_path}"
+ COMMAND ${CMAKE_COMMAND} ARGS
+ -D verbose:BOOL=${verbose_output}
+ ${ccbin_flags}
+ -D build_configuration:STRING=${CUDA_build_configuration}
+ -D "generated_file:STRING=${generated_file}"
+ -D "generated_cubin_file:STRING=${generated_cubin_file}"
+ -P "${custom_target_script}"
+ WORKING_DIRECTORY "${cuda_compile_intermediate_directory}"
+ COMMENT "${cuda_build_comment_string}"
+ )
+
+ # Make sure the build system knows the file is generated.
+ set_source_files_properties(${generated_file} PROPERTIES GENERATED TRUE)
+
+ # Don't add the object file to the list of generated files if we are using
+ # visual studio and we are attaching the build rule to the cuda file. VS
+ # will add our object file to the linker automatically for us.
+ set(cuda_add_generated_file TRUE)
+
+ if(NOT compile_to_ptx AND CMAKE_GENERATOR MATCHES "Visual Studio" AND CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE)
+ # Visual Studio 8 crashes when you close the solution when you don't add the object file.
+ if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 8")
+ #message("Not adding ${generated_file}")
+ set(cuda_add_generated_file FALSE)
+ endif()
+ endif()
+
+ if(cuda_add_generated_file)
+ list(APPEND _cuda_wrap_generated_files ${generated_file})
+ endif()
+
+ # Add the other files that we want cmake to clean on a cleanup ##########
+ list(APPEND CUDA_ADDITIONAL_CLEAN_FILES "${cmake_dependency_file}")
+ list(REMOVE_DUPLICATES CUDA_ADDITIONAL_CLEAN_FILES)
+ set(CUDA_ADDITIONAL_CLEAN_FILES ${CUDA_ADDITIONAL_CLEAN_FILES} CACHE INTERNAL "List of intermediate files that are part of the cuda dependency scanning.")
+
+ endif(${file} MATCHES ".*\\.cu$" AND NOT _is_header)
+ endforeach(file)
+
+ # Set the return parameter
+ set(${generated_files} ${_cuda_wrap_generated_files})
+endmacro(CUDA_WRAP_SRCS)
+
+
+###############################################################################
+###############################################################################
+# ADD LIBRARY
+###############################################################################
+###############################################################################
+macro(CUDA_ADD_LIBRARY cuda_target)
+
+ CUDA_ADD_CUDA_INCLUDE_ONCE()
+
+ # Separate the sources from the options
+ CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
+ CUDA_BUILD_SHARED_LIBRARY(_cuda_shared_flag ${ARGN})
+ # Create custom commands and targets for each file.
+ CUDA_WRAP_SRCS( ${cuda_target} OBJ _generated_files ${_sources}
+ ${_cmake_options} ${_cuda_shared_flag}
+ OPTIONS ${_options} )
+
+ # Add the library.
+ add_library(${cuda_target} ${_cmake_options}
+ ${_generated_files}
+ ${_sources}
+ )
+
+ target_link_libraries(${cuda_target}
+ ${CUDA_LIBRARIES}
+ )
+
+ # We need to set the linker language based on what the expected generated file
+ # would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP.
+ set_target_properties(${cuda_target}
+ PROPERTIES
+ LINKER_LANGUAGE ${CUDA_C_OR_CXX}
+ )
+
+endmacro(CUDA_ADD_LIBRARY cuda_target)
+
+
+###############################################################################
+###############################################################################
+# ADD EXECUTABLE
+###############################################################################
+###############################################################################
+macro(CUDA_ADD_EXECUTABLE cuda_target)
+
+ CUDA_ADD_CUDA_INCLUDE_ONCE()
+
+ # 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_target} OBJ _generated_files ${_sources} OPTIONS ${_options} )
+
+ # Add the library.
+ add_executable(${cuda_target} ${_cmake_options}
+ ${_generated_files}
+ ${_sources}
+ )
+
+ target_link_libraries(${cuda_target}
+ ${CUDA_LIBRARIES}
+ )
+
+ # We need to set the linker language based on what the expected generated file
+ # would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP.
+ set_target_properties(${cuda_target}
+ PROPERTIES
+ LINKER_LANGUAGE ${CUDA_C_OR_CXX}
+ )
+
+endmacro(CUDA_ADD_EXECUTABLE cuda_target)
+
+
+###############################################################################
+###############################################################################
+# CUDA COMPILE
+###############################################################################
+###############################################################################
+macro(CUDA_COMPILE 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}
+ OPTIONS ${_options} )
+
+ set( ${generated_files} ${_generated_files})
+
+endmacro(CUDA_COMPILE)
+
+
+###############################################################################
+###############################################################################
+# CUDA COMPILE PTX
+###############################################################################
+###############################################################################
+macro(CUDA_COMPILE_PTX 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_ptx PTX _generated_files ${_sources} ${_cmake_options}
+ OPTIONS ${_options} )
+
+ set( ${generated_files} ${_generated_files})
+
+endmacro(CUDA_COMPILE_PTX)
+
+###############################################################################
+###############################################################################
+# CUDA ADD CUFFT TO TARGET
+###############################################################################
+###############################################################################
+macro(CUDA_ADD_CUFFT_TO_TARGET target)
+ if (CUDA_BUILD_EMULATION)
+ target_link_libraries(${target} ${CUDA_cufftemu_LIBRARY})
+ else()
+ target_link_libraries(${target} ${CUDA_cufft_LIBRARY})
+ endif()
+endmacro()
+
+###############################################################################
+###############################################################################
+# CUDA ADD CUBLAS TO TARGET
+###############################################################################
+###############################################################################
+macro(CUDA_ADD_CUBLAS_TO_TARGET target)
+ if (CUDA_BUILD_EMULATION)
+ target_link_libraries(${target} ${CUDA_cublasemu_LIBRARY})
+ else()
+ target_link_libraries(${target} ${CUDA_cublas_LIBRARY})
+ endif()
+endmacro()
+
+###############################################################################
+###############################################################################
+# CUDA BUILD CLEAN TARGET
+###############################################################################
+###############################################################################
+macro(CUDA_BUILD_CLEAN_TARGET)
+ # Call this after you add all your CUDA targets, and you will get a convience
+ # target. You should also make clean after running this target to get the
+ # build system to generate all the code again.
+
+ set(cuda_clean_target_name clean_cuda_depends)
+ if (CMAKE_GENERATOR MATCHES "Visual Studio")
+ string(TOUPPER ${cuda_clean_target_name} cuda_clean_target_name)
+ endif()
+ add_custom_target(${cuda_clean_target_name}
+ COMMAND ${CMAKE_COMMAND} -E remove ${CUDA_ADDITIONAL_CLEAN_FILES})
+
+ # Clear out the variable, so the next time we configure it will be empty.
+ # This is useful so that the files won't persist in the list after targets
+ # have been removed.
+ set(CUDA_ADDITIONAL_CLEAN_FILES "" CACHE INTERNAL "List of intermediate files that are part of the cuda dependency scanning.")
+endmacro(CUDA_BUILD_CLEAN_TARGET)
diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake
new file mode 100644
index 000000000..d41b72dc2
--- /dev/null
+++ b/Modules/FindCUDA/make2cmake.cmake
@@ -0,0 +1,93 @@
+# 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
+#
+# This code is licensed under the MIT License. See the FindCUDA.cmake script
+# for the text of the license.
+
+# The MIT License
+#
+# License for the specific language governing rights and limitations under
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+#######################################################################
+# This converts a file written in makefile syntax into one that can be included
+# by CMake.
+
+file(READ ${input_file} depend_text)
+
+if (${depend_text} MATCHES ".+")
+
+ # message("FOUND DEPENDS")
+
+ # Remember, four backslashes is escaped to one backslash in the string.
+ string(REGEX REPLACE "\\\\ " " " depend_text ${depend_text})
+
+ # This works for the nvcc -M generated dependency files.
+ string(REGEX REPLACE "^.* : " "" depend_text ${depend_text})
+ string(REGEX REPLACE "[ \\\\]*\n" ";" depend_text ${depend_text})
+
+ set(dependency_list "")
+
+ foreach(file ${depend_text})
+
+ string(REGEX REPLACE "^ +" "" file ${file})
+
+ # OK, now if we had a UNC path, nvcc has a tendency to only output the first '/'
+ # instead of '//'. Here we will test to see if the file exists, if it doesn't then
+ # try to prepend another '/' to the path and test again. If it still fails remove the
+ # path.
+
+ if(NOT EXISTS "${file}")
+ if (EXISTS "/${file}")
+ set(file "/${file}")
+ else()
+ message(WARNING " Removing non-existant dependency file: ${file}")
+ set(file "")
+ endif()
+ endif()
+
+ if(NOT IS_DIRECTORY "${file}")
+ # If softlinks start to matter, we should change this to REALPATH. For now we need
+ # to flatten paths, because nvcc can generate stuff like /bin/../include instead of
+ # just /include.
+ get_filename_component(file_absolute "${file}" ABSOLUTE)
+ list(APPEND dependency_list "${file_absolute}")
+ endif()
+
+ endforeach(file)
+
+else()
+ # message("FOUND NO DEPENDS")
+endif()
+
+# Remove the duplicate entries and sort them.
+list(REMOVE_DUPLICATES dependency_list)
+list(SORT dependency_list)
+
+foreach(file ${dependency_list})
+ set(cuda_nvcc_depend "${cuda_nvcc_depend} \"${file}\"\n")
+endforeach()
+
+file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n")
diff --git a/Modules/FindCUDA/parse_cubin.cmake b/Modules/FindCUDA/parse_cubin.cmake
new file mode 100644
index 000000000..2518c6852
--- /dev/null
+++ b/Modules/FindCUDA/parse_cubin.cmake
@@ -0,0 +1,112 @@
+# 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
+#
+# This code is licensed under the MIT License. See the FindCUDA.cmake script
+# for the text of the license.
+
+# The MIT License
+#
+# License for the specific language governing rights and limitations under
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+#######################################################################
+# Parses a .cubin file produced by nvcc and reports statistics about the file.
+
+
+file(READ ${input_file} file_text)
+
+if (${file_text} MATCHES ".+")
+
+ # 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})
+
+ list(LENGTH file_text len)
+
+ foreach(line ${file_text})
+
+ # Only look at "code { }" blocks.
+ if(line MATCHES "^code")
+
+ # Break into individual lines.
+ string(REGEX REPLACE "\n" ";" line ${line})
+
+ foreach(entry ${line})
+
+ # Extract kernel names.
+ if (${entry} MATCHES "[^g]name = ([^ ]+)")
+ string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
+
+ # Check to see if the kernel name starts with "_"
+ set(skip FALSE)
+ # if (${entry} MATCHES "^_")
+ # Skip the rest of this block.
+ # message("Skipping ${entry}")
+ # set(skip TRUE)
+ # else (${entry} MATCHES "^_")
+ message("Kernel: ${entry}")
+ # endif (${entry} MATCHES "^_")
+
+ endif(${entry} MATCHES "[^g]name = ([^ ]+)")
+
+ # Skip the rest of the block if necessary
+ if(NOT skip)
+
+ # Registers
+ if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
+ string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ message("Registers: ${entry}")
+ endif()
+
+ # Local memory
+ if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
+ string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ message("Local: ${entry}")
+ endif()
+
+ # Shared memory
+ if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
+ string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ message("Shared: ${entry}")
+ endif()
+
+ if (${entry} MATCHES "^}")
+ message("")
+ endif()
+
+ endif(NOT skip)
+
+
+ endforeach(entry)
+
+ endif(line MATCHES "^code")
+
+ endforeach(line)
+
+else()
+ # message("FOUND NO DEPENDS")
+endif()
+
+
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
new file mode 100644
index 000000000..b31011c0e
--- /dev/null
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -0,0 +1,280 @@
+# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
+#
+# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
+#
+# This code is licensed under the MIT License. See the FindCUDA.cmake script
+# for the text of the license.
+
+# The MIT License
+#
+# License for the specific language governing rights and limitations under
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+
+##########################################################################
+# This file runs the nvcc commands to produce the desired output file along with
+# the dependency file needed by CMake to compute dependencies. In addition the
+# file checks the output of each command and if the command fails it deletes the
+# output files.
+
+# Input variables
+#
+# verbose:BOOL=<> OFF: Be as quiet as possible (default)
+# ON : Describe each step
+#
+# build_configuration:STRING=<> Typically one of Debug, MinSizeRel, Release, or
+# RelWithDebInfo, but it should match one of the
+# entries in CUDA_HOST_FLAGS. This is the build
+# configuration used when compiling the code. If
+# blank or unspecified Debug is assumed as this is
+# what CMake does.
+#
+# generated_file:STRING=<> File to generate. This argument must be passed in.
+#
+# generated_cubin_file:STRING=<> File to generate. This argument must be passed
+# in if build_cubin is true.
+
+if(NOT generated_file)
+ message(FATAL_ERROR "You must specify generated_file on the command line")
+endif()
+
+# Set these up as variables to make reading the generated file easier
+set(CMAKE_COMMAND "@CMAKE_COMMAND@") # path
+set(source_file "@source_file@") # path
+set(NVCC_generated_dependency_file "@NVCC_generated_dependency_file@") # path
+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
+# 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
+set(generated_file_internal "@generated_file@") # path
+set(generated_cubin_file_internal "@generated_cubin_file@") # path
+
+set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@") # path
+set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list
+@CUDA_NVCC_FLAGS_CONFIG@
+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
+
+if(build_cubin AND NOT generated_cubin_file)
+ message(FATAL_ERROR "You must specify generated_cubin_file on the command line")
+endif()
+
+# This is the list of host compilation flags. It C or CXX should already have
+# been chosen by FindCUDA.cmake.
+@CUDA_HOST_FLAGS@
+
+# Take the compiler flags and package them up to be sent to the compiler via -Xcompiler
+set(nvcc_host_compiler_flags "")
+# If we weren't given a build_configuration, use Debug.
+if(NOT build_configuration)
+ set(build_configuration Debug)
+endif()
+string(TOUPPER "${build_configuration}" build_configuration)
+#message("CUDA_NVCC_HOST_COMPILER_FLAGS = ${CUDA_NVCC_HOST_COMPILER_FLAGS}")
+foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}})
+ # Extra quotes are added around each flag to help nvcc parse out flags with spaces.
+ set(nvcc_host_compiler_flags "${nvcc_host_compiler_flags},\"${flag}\"")
+endforeach()
+if (nvcc_host_compiler_flags)
+ set(nvcc_host_compiler_flags "-Xcompiler" ${nvcc_host_compiler_flags})
+endif()
+#message("nvcc_host_compiler_flags = \"${nvcc_host_compiler_flags}\"")
+# Add the build specific configuration flags
+list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
+
+if(DEFINED CCBIN)
+ set(CCBIN -ccbin "${CCBIN}")
+endif()
+
+# cuda_execute_process - Executes a command with optional command echo and status message.
+#
+# status - Status message to print if verbose is true
+# command - COMMAND argument from the usual execute_process argument structure
+# ARGN - Remaining arguments are the command with arguments
+#
+# CUDA_result - return value from running the command
+#
+# Make this a macro instead of a function, so that things like RESULT_VARIABLE
+# and other return variables are present after executing the process.
+macro(cuda_execute_process status command)
+ set(_command ${command})
+ if(NOT _command STREQUAL "COMMAND")
+ message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})")
+ endif()
+ if(verbose)
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E echo -- ${status})
+ # Now we need to build up our command string. We are accounting for quotes
+ # and spaces, anything else is left up to the user to fix if they want to
+ # copy and paste a runnable command line.
+ set(cuda_execute_process_string)
+ foreach(arg ${ARGN})
+ # If there are quotes, excape them, so they come through.
+ string(REPLACE "\"" "\\\"" arg ${arg})
+ # Args with spaces need quotes around them to get them to be parsed as a single argument.
+ if(arg MATCHES " ")
+ list(APPEND cuda_execute_process_string "\"${arg}\"")
+ else()
+ list(APPEND cuda_execute_process_string ${arg})
+ endif()
+ endforeach()
+ # Echo the command
+ execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${cuda_execute_process_string})
+ endif(verbose)
+ # Run the command
+ execute_process(COMMAND ${ARGN} RESULT_VARIABLE CUDA_result )
+endmacro()
+
+# Delete the target file
+cuda_execute_process(
+ "Removing ${generated_file}"
+ COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
+ )
+
+# For CUDA 2.3 and below, -G -M doesn't work, so remove the -G flag
+# for dependency generation and hope for the best.
+set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
+set(CUDA_VERSION @CUDA_VERSION@)
+if(CUDA_VERSION VERSION_LESS "3.0")
+ cmake_policy(PUSH)
+ # CMake policy 0007 NEW states that empty list elements are not
+ # ignored. I'm just setting it to avoid the warning that's printed.
+ cmake_policy(SET CMP0007 NEW)
+ # Note that this will remove all occurances of -G.
+ list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G")
+ cmake_policy(POP)
+endif()
+
+# nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This
+# can cause incorrect dependencies when #including files based on this macro which is
+# defined in the generating passes of nvcc invokation. We will go ahead and manually
+# define this for now until a future version fixes this bug.
+set(CUDACC_DEFINE -D__CUDACC__)
+
+# Generate the dependency file
+cuda_execute_process(
+ "Generating dependency file: ${NVCC_generated_dependency_file}"
+ COMMAND "${CUDA_NVCC_EXECUTABLE}"
+ -M
+ ${CUDACC_DEFINE}
+ "${source_file}"
+ -o "${NVCC_generated_dependency_file}"
+ ${CCBIN}
+ ${nvcc_flags}
+ ${nvcc_host_compiler_flags}
+ ${depends_CUDA_NVCC_FLAGS}
+ -DNVCC
+ ${CUDA_NVCC_INCLUDE_ARGS}
+ )
+
+if(CUDA_result)
+ message(FATAL_ERROR "Error generating ${generated_file}")
+endif()
+
+# Generate the cmake readable dependency file to a temp file. Don't put the
+# quotes just around the filenames for the input_file and output_file variables.
+# CMake will pass the quotes through and not be able to find the file.
+cuda_execute_process(
+ "Generating temporary cmake readable file: ${cmake_dependency_file}.tmp"
+ COMMAND "${CMAKE_COMMAND}"
+ -D "input_file:FILEPATH=${NVCC_generated_dependency_file}"
+ -D "output_file:FILEPATH=${cmake_dependency_file}.tmp"
+ -P "${CUDA_make2cmake}"
+ )
+
+if(CUDA_result)
+ message(FATAL_ERROR "Error generating ${generated_file}")
+endif()
+
+# Copy the file if it is different
+cuda_execute_process(
+ "Copy if different ${cmake_dependency_file}.tmp to ${cmake_dependency_file}"
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${cmake_dependency_file}.tmp" "${cmake_dependency_file}"
+ )
+
+if(CUDA_result)
+ message(FATAL_ERROR "Error generating ${generated_file}")
+endif()
+
+# Delete the temporary file
+cuda_execute_process(
+ "Removing ${cmake_dependency_file}.tmp and ${NVCC_generated_dependency_file}"
+ COMMAND "${CMAKE_COMMAND}" -E remove "${cmake_dependency_file}.tmp" "${NVCC_generated_dependency_file}"
+ )
+
+if(CUDA_result)
+ message(FATAL_ERROR "Error generating ${generated_file}")
+endif()
+
+# Generate the code
+cuda_execute_process(
+ "Generating ${generated_file}"
+ COMMAND "${CUDA_NVCC_EXECUTABLE}"
+ "${source_file}"
+ ${format_flag} -o "${generated_file}"
+ ${CCBIN}
+ ${nvcc_flags}
+ ${nvcc_host_compiler_flags}
+ ${CUDA_NVCC_FLAGS}
+ -DNVCC
+ ${CUDA_NVCC_INCLUDE_ARGS}
+ )
+
+if(CUDA_result)
+ # Since nvcc can sometimes leave half done files make sure that we delete the output file.
+ cuda_execute_process(
+ "Removing ${generated_file}"
+ COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
+ )
+ message(FATAL_ERROR "Error generating file ${generated_file}")
+else()
+ if(verbose)
+ message("Generated ${generated_file} successfully.")
+ endif()
+endif()
+
+# Cubin resource report commands.
+if( build_cubin )
+ # Run with -cubin to produce resource usage report.
+ cuda_execute_process(
+ "Generating ${generated_cubin_file}"
+ COMMAND "${CUDA_NVCC_EXECUTABLE}"
+ "${source_file}"
+ ${CUDA_NVCC_FLAGS}
+ ${nvcc_flags}
+ ${CCBIN}
+ ${nvcc_host_compiler_flags}
+ -DNVCC
+ -cubin
+ -o "${generated_cubin_file}"
+ ${CUDA_NVCC_INCLUDE_ARGS}
+ )
+
+ # Execute the parser script.
+ cuda_execute_process(
+ "Executing the parser script"
+ COMMAND "${CMAKE_COMMAND}"
+ -D "input_file:STRING=${generated_cubin_file}"
+ -P "${CUDA_parse_cubin}"
+ )
+
+endif( build_cubin )
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
new file mode 100644
index 000000000..cc00d53f4
--- /dev/null
+++ b/Modules/FindCURL.cmake
@@ -0,0 +1,59 @@
+# - 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)
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2012 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.)
+
+# Look for the header file.
+FIND_PATH(CURL_INCLUDE_DIR NAMES curl/curl.h)
+MARK_AS_ADVANCED(CURL_INCLUDE_DIR)
+
+# Look for the library.
+FIND_LIBRARY(CURL_LIBRARY NAMES
+ curl
+ # Windows MSVC prebuilts:
+ curllib
+ libcurl_imp
+ curllib_static
+)
+MARK_AS_ADVANCED(CURL_LIBRARY)
+
+IF(CURL_INCLUDE_DIR)
+ FOREACH(_curl_version_header curlver.h curl.h)
+ IF(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}")
+ FILE(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"")
+
+ STRING(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}")
+ UNSET(curl_version_str)
+ BREAK()
+ ENDIF()
+ ENDFOREACH(_curl_version_header)
+ENDIF()
+
+# handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL
+ REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
+ VERSION_VAR CURL_VERSION_STRING)
+
+IF(CURL_FOUND)
+ SET(CURL_LIBRARIES ${CURL_LIBRARY})
+ SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
+ENDIF(CURL_FOUND)
diff --git a/Modules/FindCVS.cmake b/Modules/FindCVS.cmake
new file mode 100644
index 000000000..57680bd97
--- /dev/null
+++ b/Modules/FindCVS.cmake
@@ -0,0 +1,69 @@
+# The module defines the following variables:
+# CVS_EXECUTABLE - path to cvs command line client
+# CVS_FOUND - true if the command line client was found
+# Example usage:
+# find_package(CVS)
+# if(CVS_FOUND)
+# message("CVS found: ${CVS_EXECUTABLE}")
+# endif(CVS_FOUND)
+
+#=============================================================================
+# Copyright 2008-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.)
+
+# CVSNT
+
+get_filename_component(
+ CVSNT_TypeLib_Win32
+ "[HKEY_CLASSES_ROOT\\TypeLib\\{2BDF7A65-0BFE-4B1A-9205-9AB900C7D0DA}\\1.0\\0\\win32]"
+ PATH)
+
+get_filename_component(
+ CVSNT_Services_EventMessagePath
+ "[HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Services\\Eventlog\\Application\\cvsnt;EventMessageFile]"
+ PATH)
+
+# WinCVS (in case CVSNT was installed in the same directory)
+
+get_filename_component(
+ WinCVS_Folder_Command
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Folder\\shell\\wincvs\\command]"
+ PATH)
+
+# TortoiseCVS (in case CVSNT was installed in the same directory)
+
+get_filename_component(
+ TortoiseCVS_Folder_Command
+ "[HKEY_CLASSES_ROOT\\CVS\\shell\\open\\command]"
+ PATH)
+
+get_filename_component(
+ TortoiseCVS_DefaultIcon
+ "[HKEY_CLASSES_ROOT\\CVS\\DefaultIcon]"
+ PATH)
+
+find_program(CVS_EXECUTABLE cvs
+ ${TortoiseCVS_DefaultIcon}
+ ${TortoiseCVS_Folder_Command}
+ ${WinCVS_Folder_Command}
+ ${CVSNT_Services_EventMessagePath}
+ ${CVSNT_TypeLib_Win32}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\CVS\\Pserver;InstallPath]"
+ DOC "CVS command line client"
+ )
+mark_as_advanced(CVS_EXECUTABLE)
+
+# Handle the QUIETLY and REQUIRED arguments and set CVS_FOUND to TRUE if
+# all listed variables are TRUE
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(CVS DEFAULT_MSG CVS_EXECUTABLE)
diff --git a/Modules/FindCoin3D.cmake b/Modules/FindCoin3D.cmake
new file mode 100644
index 000000000..8bfe97acc
--- /dev/null
+++ b/Modules/FindCoin3D.cmake
@@ -0,0 +1,84 @@
+# - 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/
+#
+# 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
+#
+
+#=============================================================================
+# Copyright 2008-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.)
+
+IF (WIN32)
+ IF (CYGWIN)
+
+ FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h)
+ FIND_LIBRARY(COIN3D_LIBRARIES Coin)
+
+ ELSE (CYGWIN)
+
+ FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\Coin3D\\2;Installation Path]/include"
+ )
+
+ FIND_LIBRARY(COIN3D_LIBRARY_DEBUG coin2d
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\Coin3D\\2;Installation Path]/lib"
+ )
+
+ FIND_LIBRARY(COIN3D_LIBRARY_RELEASE coin2
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\Coin3D\\2;Installation Path]/lib"
+ )
+
+ IF (COIN3D_LIBRARY_DEBUG AND COIN3D_LIBRARY_RELEASE)
+ SET(COIN3D_LIBRARIES optimized ${COIN3D_LIBRARY_RELEASE}
+ debug ${COIN3D_LIBRARY_DEBUG})
+ ELSE (COIN3D_LIBRARY_DEBUG AND COIN3D_LIBRARY_RELEASE)
+ IF (COIN3D_LIBRARY_DEBUG)
+ SET (COIN3D_LIBRARIES ${COIN3D_LIBRARY_DEBUG})
+ ENDIF (COIN3D_LIBRARY_DEBUG)
+ IF (COIN3D_LIBRARY_RELEASE)
+ SET (COIN3D_LIBRARIES ${COIN3D_LIBRARY_RELEASE})
+ ENDIF (COIN3D_LIBRARY_RELEASE)
+ ENDIF (COIN3D_LIBRARY_DEBUG AND COIN3D_LIBRARY_RELEASE)
+
+ ENDIF (CYGWIN)
+
+ELSE (WIN32)
+ IF(APPLE)
+ FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h
+ /Library/Frameworks/Inventor.framework/Headers
+ )
+ FIND_LIBRARY(COIN3D_LIBRARIES Coin
+ /Library/Frameworks/Inventor.framework/Libraries
+ )
+ SET(COIN3D_LIBRARIES "-framework Coin3d" CACHE STRING "Coin3D library for OSX")
+ ELSE(APPLE)
+
+ FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h)
+ FIND_LIBRARY(COIN3D_LIBRARIES Coin)
+
+ ENDIF(APPLE)
+
+ENDIF (WIN32)
+
+# handle the QUIETLY and REQUIRED arguments and set COIN3D_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Coin3D DEFAULT_MSG COIN3D_LIBRARIES COIN3D_INCLUDE_DIRS)
+
+MARK_AS_ADVANCED(COIN3D_INCLUDE_DIRS COIN3D_LIBRARIES )
+
+
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
new file mode 100644
index 000000000..3862f7ddf
--- /dev/null
+++ b/Modules/FindCups.cmake
@@ -0,0 +1,69 @@
+# - 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)
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2012 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.)
+
+find_path(CUPS_INCLUDE_DIR cups/cups.h )
+
+find_library(CUPS_LIBRARIES NAMES cups )
+
+if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
+ include(CheckLibraryExists)
+
+ # ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
+ CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
+endif (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
+
+if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
+ file(STRINGS "${CUPS_INCLUDE_DIR}/cups/cups.h" cups_version_str
+ REGEX "^#[\t ]*define[\t ]+CUPS_VERSION_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
+
+ 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(CUPS_VERSION_STRING)
+ set(CUPS_VERSION_STRING "${CUPS_VERSION_STRING}.${CUPS_VERSION_PART}")
+ else(CUPS_VERSION_STRING)
+ set(CUPS_VERSION_STRING "${CUPS_VERSION_PART}")
+ endif(CUPS_VERSION_STRING)
+ endif()
+ endforeach(VLINE)
+ endforeach(VPART)
+endif (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+if (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cups
+ REQUIRED_VARS CUPS_LIBRARIES CUPS_INCLUDE_DIR CUPS_HAS_IPP_DELETE_ATTRIBUTE
+ VERSION_VAR CUPS_VERSION_STRING)
+else (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cups
+ REQUIRED_VARS CUPS_LIBRARIES CUPS_INCLUDE_DIR
+ VERSION_VAR CUPS_VERSION_STRING)
+endif (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
+
+mark_as_advanced(CUPS_INCLUDE_DIR CUPS_LIBRARIES)
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
new file mode 100644
index 000000000..d1e13116d
--- /dev/null
+++ b/Modules/FindCurses.cmake
@@ -0,0 +1,176 @@
+# - Find the curses include file and library
+#
+# CURSES_FOUND - system has Curses
+# CURSES_INCLUDE_DIR - the Curses include directory
+# CURSES_LIBRARIES - The libraries needed to use Curses
+# CURSES_HAVE_CURSES_H - true if curses.h is available
+# CURSES_HAVE_NCURSES_H - true if ncurses.h is available
+# CURSES_HAVE_NCURSES_NCURSES_H - true if ncurses/ncurses.h is available
+# CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available
+# CURSES_LIBRARY - set for backwards compatibility with 2.4 CMake
+#
+# Set CURSES_NEED_NCURSES to TRUE before the FIND_PACKAGE() command if NCurses
+# functionality is required.
+
+#=============================================================================
+# 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.)
+
+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)
+ SET(CURSES_USE_NCURSES TRUE)
+ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY)
+# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html
+# cygwin ncurses stopped providing curses.h symlinks see above
+# message. Cygwin is an ncurses package, so force ncurses on
+# cygwin if the curses.h is missing
+IF(CYGWIN)
+ IF(NOT EXISTS /usr/include/curses.h)
+ SET(CURSES_USE_NCURSES TRUE)
+ ENDIF()
+ENDIF()
+
+
+# Not sure the logic is correct here.
+# If NCurses is required, use the function wsyncup() to check if the library
+# has NCurses functionality (at least this is where it breaks on NetBSD).
+# If wsyncup is in curses, use this one.
+# If not, try to find ncurses and check if this has the symbol.
+# Once the ncurses library is found, search the ncurses.h header first, but
+# some web pages also say that even with ncurses there is not always a ncurses.h:
+# http://osdir.com/ml/gnome.apps.mc.devel/2002-06/msg00029.html
+# So at first try ncurses.h, if not found, try to find curses.h under the same
+# 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(CheckLibraryExists)
+ CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
+ wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
+
+ IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP)
+ CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
+ wsyncup "" CURSES_NCURSES_HAS_WSYNCUP)
+ IF( CURSES_NCURSES_HAS_WSYNCUP)
+ SET(CURSES_USE_NCURSES TRUE)
+ ENDIF( CURSES_NCURSES_HAS_WSYNCUP)
+ ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP)
+
+ENDIF(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
+
+
+IF(NOT CURSES_USE_NCURSES)
+ FIND_FILE(CURSES_HAVE_CURSES_H curses.h )
+ FIND_PATH(CURSES_CURSES_H_PATH curses.h )
+ GET_FILENAME_COMPONENT(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
+ GET_FILENAME_COMPONENT(_cursesParentDir "${_cursesLibDir}" PATH)
+
+ # for compatibility with older FindCurses.cmake this has to be in the cache
+ # FORCE must not be used since this would break builds which preload a cache wqith these variables set
+ SET(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}"
+ CACHE FILEPATH "The curses include path")
+ SET(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}"
+ CACHE FILEPATH "The curses library")
+ELSE(NOT CURSES_USE_NCURSES)
+# we need to find ncurses
+ GET_FILENAME_COMPONENT(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
+ GET_FILENAME_COMPONENT(_cursesParentDir "${_cursesLibDir}" PATH)
+
+ FIND_FILE(CURSES_HAVE_NCURSES_H ncurses.h)
+ FIND_FILE(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h)
+ FIND_FILE(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h)
+ FIND_FILE(CURSES_HAVE_CURSES_H curses.h
+ HINTS "${_cursesParentDir}/include")
+
+ FIND_PATH(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h
+ ncurses/curses.h)
+ FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h
+ HINTS "${_cursesParentDir}/include")
+
+ # for compatibility with older FindCurses.cmake this has to be in the cache
+ # FORCE must not be used since this would break builds which preload
+ # however if the value of the variable has NOTFOUND in it, then
+ # it is OK to force, and we need to force in order to have it work.
+ # a cache wqith these variables set
+ # only put ncurses include and library into
+ # variables if they are found
+ IF(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H)
+ GET_FILENAME_COMPONENT(CURSES_NCURSES_INCLUDE_PATH
+ "${CURSES_HAVE_NCURSES_NCURSES_H}" PATH)
+ ENDIF(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H)
+ IF(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY)
+ SET( FORCE_IT )
+ IF(CURSES_INCLUDE_PATH MATCHES NOTFOUND)
+ SET(FORCE_IT FORCE)
+ ENDIF(CURSES_INCLUDE_PATH MATCHES NOTFOUND)
+ 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(CURSES_LIBRARY MATCHES NOTFOUND)
+ SET(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}"
+ CACHE FILEPATH "The curses library" ${FORCE_IT})
+ ENDIF(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY)
+
+ENDIF(NOT CURSES_USE_NCURSES)
+
+FIND_LIBRARY(CURSES_EXTRA_LIBRARY cur_colr HINTS "${_cursesLibDir}")
+FIND_LIBRARY(CURSES_EXTRA_LIBRARY cur_colr )
+
+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")
+
+# Need to provide the *_LIBRARIES
+SET(CURSES_LIBRARIES ${CURSES_LIBRARY})
+
+IF(CURSES_EXTRA_LIBRARY)
+ SET(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_EXTRA_LIBRARY})
+ENDIF(CURSES_EXTRA_LIBRARY)
+
+IF(CURSES_FORM_LIBRARY)
+ SET(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY})
+ENDIF(CURSES_FORM_LIBRARY)
+
+# Proper name is *_INCLUDE_DIR
+SET(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
+
+# handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG
+ CURSES_LIBRARY CURSES_INCLUDE_PATH)
+
+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
new file mode 100644
index 000000000..a4d150493
--- /dev/null
+++ b/Modules/FindCxxTest.cmake
@@ -0,0 +1,200 @@
+# - Find CxxTest
+# Find the CxxTest suite and declare a helper macro for creating unit tests
+# and integrating them with CTest.
+# For more details on CxxTest see http://cxxtest.tigris.org
+#
+# INPUT Variables
+#
+# CXXTEST_USE_PYTHON [deprecated since 1.3]
+# Only used in the case both Python & Perl
+# are detected on the system to control
+# which CxxTest code generator is used.
+# Valid only for CxxTest version 3.
+#
+# NOTE: In older versions of this Find Module,
+# this variable controlled if the Python test
+# generator was used instead of the Perl one,
+# regardless of which scripting language the
+# user had installed.
+#
+# CXXTEST_TESTGEN_ARGS (since CMake 2.8.3)
+# Specify a list of options to pass to the CxxTest code
+# generator. If not defined, --error-printer is
+# passed.
+#
+# OUTPUT Variables
+#
+# CXXTEST_FOUND
+# True if the CxxTest framework was found
+# CXXTEST_INCLUDE_DIRS
+# Where to find the CxxTest include directory
+# CXXTEST_PERL_TESTGEN_EXECUTABLE
+# The perl-based test generator
+# CXXTEST_PYTHON_TESTGEN_EXECUTABLE
+# The python-based test generator
+# CXXTEST_TESTGEN_EXECUTABLE (since CMake 2.8.3)
+# The test generator that is actually used (chosen using user preferences
+# and interpreters found in the system)
+# CXXTEST_TESTGEN_INTERPRETER (since CMake 2.8.3)
+# The full path to the Perl or Python executable on the system
+#
+# 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 );
+# }
+# };
+#
+
+#=============================================================================
+# Copyright 2008-2010 Kitware, Inc.
+# Copyright 2008-2010 Philip Lowman <philip@yhbt.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.)
+
+# Version 1.4 (11/18/10) (CMake 2.8.4)
+# Issue 11384: Added support to the CXX_ADD_TEST macro so header
+# files (containing the tests themselves) show up in
+# Visual Studio and other IDEs.
+#
+# Version 1.3 (8/19/10) (CMake 2.8.3)
+# Included patch by Simone Rossetto to check if either Python or Perl
+# are present in the system. Whichever intepreter that is detected
+# is now used to run the test generator program. If both interpreters
+# are detected, the CXXTEST_USE_PYTHON variable is obeyed.
+#
+# Also added support for CXXTEST_TESTGEN_ARGS, for manually specifying
+# options to the CxxTest code generator.
+# Version 1.2 (3/2/08)
+# Included patch from Tyler Roscoe to have the perl & python binaries
+# detected based on CXXTEST_INCLUDE_DIR
+# Version 1.1 (2/9/08)
+# Clarified example to illustrate need to call target_link_libraries()
+# Changed commands to lowercase
+# Added licensing info
+# Version 1.0 (1/8/08)
+# Fixed CXXTEST_INCLUDE_DIRS so it will work properly
+# Eliminated superfluous CXXTEST_FOUND assignment
+# Cleaned up and added more documentation
+
+#=============================================================
+# CXXTEST_ADD_TEST (public macro)
+#=============================================================
+macro(CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname)
+ set(_cxxtest_real_outfname ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_outfname})
+
+ add_custom_command(
+ OUTPUT ${_cxxtest_real_outfname}
+ DEPENDS ${ARGN}
+ COMMAND ${CXXTEST_TESTGEN_INTERPRETER}
+ ${CXXTEST_TESTGEN_EXECUTABLE} ${CXXTEST_TESTGEN_ARGS} -o ${_cxxtest_real_outfname} ${ARGN}
+ )
+
+ set_source_files_properties(${_cxxtest_real_outfname} PROPERTIES GENERATED true)
+ add_executable(${_cxxtest_testname} ${_cxxtest_real_outfname} ${ARGN})
+
+ if(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+ add_test(${_cxxtest_testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_cxxtest_testname})
+ elseif(EXECUTABLE_OUTPUT_PATH)
+ add_test(${_cxxtest_testname} ${EXECUTABLE_OUTPUT_PATH}/${_cxxtest_testname})
+ else()
+ add_test(${_cxxtest_testname} ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_testname})
+ endif()
+
+endmacro(CXXTEST_ADD_TEST)
+
+#=============================================================
+# main()
+#=============================================================
+if(NOT DEFINED CXXTEST_TESTGEN_ARGS)
+ set(CXXTEST_TESTGEN_ARGS --error-printer)
+endif()
+
+find_package(PythonInterp QUIET)
+find_package(Perl QUIET)
+
+find_path(CXXTEST_INCLUDE_DIR cxxtest/TestSuite.h)
+find_program(CXXTEST_PYTHON_TESTGEN_EXECUTABLE
+ NAMES cxxtestgen cxxtestgen.py
+ PATHS ${CXXTEST_INCLUDE_DIR})
+find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl
+ PATHS ${CXXTEST_INCLUDE_DIR})
+
+if(PYTHONINTERP_FOUND OR PERL_FOUND)
+ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+ if(PYTHONINTERP_FOUND AND (CXXTEST_USE_PYTHON OR NOT PERL_FOUND OR NOT DEFINED CXXTEST_USE_PYTHON))
+ set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE})
+ set(CXXTEST_TESTGEN_INTERPRETER ${PYTHON_EXECUTABLE})
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG
+ CXXTEST_INCLUDE_DIR CXXTEST_PYTHON_TESTGEN_EXECUTABLE)
+
+ elseif(PERL_FOUND)
+ set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PERL_TESTGEN_EXECUTABLE})
+ set(CXXTEST_TESTGEN_INTERPRETER ${PERL_EXECUTABLE})
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG
+ CXXTEST_INCLUDE_DIR CXXTEST_PERL_TESTGEN_EXECUTABLE)
+ endif()
+
+ if(CXXTEST_FOUND)
+ set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR})
+ endif()
+
+else()
+
+ set(CXXTEST_FOUND false)
+ if(NOT CxxTest_FIND_QUIETLY)
+ if(CxxTest_FIND_REQUIRED)
+ message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest, aborting!")
+ else()
+ message(STATUS "Neither Python nor Perl found, CxxTest will not be used.")
+ endif()
+ endif()
+
+endif()
diff --git a/Modules/FindCygwin.cmake b/Modules/FindCygwin.cmake
new file mode 100644
index 000000000..28f55ba0c
--- /dev/null
+++ b/Modules/FindCygwin.cmake
@@ -0,0 +1,28 @@
+# - this module looks for Cygwin
+#
+
+#=============================================================================
+# 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.)
+
+IF (WIN32)
+ FIND_PATH(CYGWIN_INSTALL_PATH
+ cygwin.bat
+ "C:/Cygwin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygwin\\setup;rootdir]"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/;native]"
+ )
+
+ MARK_AS_ADVANCED(
+ CYGWIN_INSTALL_PATH
+ )
+ENDIF (WIN32)
diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake
new file mode 100644
index 000000000..361d09e8b
--- /dev/null
+++ b/Modules/FindDCMTK.cmake
@@ -0,0 +1,154 @@
+# - find DCMTK libraries and applications
+#
+
+# 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/)
+
+#=============================================================================
+# Copyright 2004-2009 Kitware, Inc.
+# Copyright 2009-2010 Mathieu Malaterre <mathieu.malaterre@gmail.com>
+# Copyright 2010 Thomas Sondergaard <ts@medical-insight.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.)
+
+#
+# Written for VXL by Amitha Perera.
+# Upgraded for GDCM by Mathieu Malaterre.
+# 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)
+endif()
+
+
+foreach(lib
+ dcmdata
+ dcmimage
+ dcmimgle
+ dcmjpeg
+ dcmnet
+ dcmpstat
+ dcmqrdb
+ dcmsign
+ dcmsr
+ dcmtls
+ ijg12
+ ijg16
+ ijg8
+ ofstd)
+
+ find_library(DCMTK_${lib}_LIBRARY
+ ${lib}
+ PATHS
+ ${DCMTK_DIR}/${lib}/libsrc
+ ${DCMTK_DIR}/${lib}/libsrc/Release
+ ${DCMTK_DIR}/${lib}/libsrc/Debug
+ ${DCMTK_DIR}/${lib}/Release
+ ${DCMTK_DIR}/${lib}/Debug
+ ${DCMTK_DIR}/lib)
+
+ mark_as_advanced(DCMTK_${lib}_LIBRARY)
+
+ if(DCMTK_${lib}_LIBRARY)
+ list(APPEND DCMTK_LIBRARIES ${DCMTK_${lib}_LIBRARY})
+ endif()
+
+endforeach()
+
+
+set(DCMTK_config_TEST_HEADER osconfig.h)
+set(DCMTK_dcmdata_TEST_HEADER dctypes.h)
+set(DCMTK_dcmimage_TEST_HEADER dicoimg.h)
+set(DCMTK_dcmimgle_TEST_HEADER dcmimage.h)
+set(DCMTK_dcmjpeg_TEST_HEADER djdecode.h)
+set(DCMTK_dcmnet_TEST_HEADER assoc.h)
+set(DCMTK_dcmpstat_TEST_HEADER dcmpstat.h)
+set(DCMTK_dcmqrdb_TEST_HEADER dcmqrdba.h)
+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)
+
+foreach(dir
+ config
+ dcmdata
+ dcmimage
+ dcmimgle
+ dcmjpeg
+ dcmnet
+ dcmpstat
+ dcmqrdb
+ dcmsign
+ dcmsr
+ dcmtls
+ ofstd)
+ 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}
+ )
+ mark_as_advanced(DCMTK_${dir}_INCLUDE_DIR)
+
+ if(DCMTK_${dir}_INCLUDE_DIR)
+ list(APPEND
+ DCMTK_INCLUDE_DIRS
+ ${DCMTK_${dir}_INCLUDE_DIR})
+ endif()
+endforeach()
+
+if(WIN32)
+ list(APPEND DCMTK_LIBRARIES netapi32 wsock32)
+endif()
+
+if(DCMTK_ofstd_INCLUDE_DIR)
+ get_filename_component(DCMTK_dcmtk_INCLUDE_DIR
+ ${DCMTK_ofstd_INCLUDE_DIR}
+ PATH
+ CACHE)
+ list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_dcmtk_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()
diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake
new file mode 100644
index 000000000..f7c54df43
--- /dev/null
+++ b/Modules/FindDart.cmake
@@ -0,0 +1,36 @@
+# - 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.
+#
+# 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(DART_ROOT README.INSTALL
+ $ENV{DART_ROOT}
+ ${PROJECT_SOURCE_DIR}/Dart
+ /usr/share/Dart
+ C:/Dart
+ "$ENV{ProgramFiles}/Dart"
+ "C:/Program Files/Dart"
+ ${PROJECT_SOURCE_DIR}/../Dart
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Dart\\InstallPath]
+ DOC "If you have Dart installed, where is it located?"
+ )
+
+# handle the QUIETLY and REQUIRED arguments and set DART_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Dart DEFAULT_MSG DART_ROOT)
+
+MARK_AS_ADVANCED(DART_ROOT)
diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake
new file mode 100644
index 000000000..4a0fbe064
--- /dev/null
+++ b/Modules/FindDevIL.cmake
@@ -0,0 +1,74 @@
+# 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.
+
+#=============================================================================
+# Copyright 2008-2009 Kitware, Inc.
+# Copyright 2008 Christopher Harvey
+#
+# 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.)
+
+# TODO: Add version support.
+# Tested under Linux and Windows (MSVC)
+
+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"
+)
+
+#MESSAGE("IL_INCLUDE_DIR is ${IL_INCLUDE_DIR}")
+
+FIND_LIBRARY(IL_LIBRARIES
+ NAMES IL DEVIL
+ PATH_SUFFIXES lib64 lib lib32
+ DOC "The file that corresponds to the base il library."
+)
+
+#MESSAGE("IL_LIBRARIES is ${IL_LIBRARIES}")
+
+FIND_LIBRARY(ILUT_LIBRARIES
+ NAMES ILUT
+ PATH_SUFFIXES lib64 lib lib32
+ DOC "The file that corresponds to the il (system?) utility library."
+)
+
+#MESSAGE("ILUT_LIBRARIES is ${ILUT_LIBRARIES}")
+
+FIND_LIBRARY(ILU_LIBRARIES
+ NAMES ILU
+ PATH_SUFFIXES lib64 lib lib32
+ DOC "The file that corresponds to the il utility library."
+)
+
+#MESSAGE("ILU_LIBRARIES is ${ILU_LIBRARIES}")
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(IL DEFAULT_MSG
+ IL_LIBRARIES ILU_LIBRARIES
+ ILUT_LIBRARIES IL_INCLUDE_DIR)
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
new file mode 100644
index 000000000..6cc9efb18
--- /dev/null
+++ b/Modules/FindDoxygen.cmake
@@ -0,0 +1,144 @@
+# - 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)
+#
+# 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
+#
+#
+
+#=============================================================================
+# 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.)
+
+# For backwards compatibility support
+IF(Doxygen_FIND_QUIETLY)
+ SET(DOXYGEN_FIND_QUIETLY TRUE)
+ENDIF(Doxygen_FIND_QUIETLY)
+
+# ===== Rationale for OS X AppBundle mods below =====
+# With the OS X GUI version, Doxygen likes to be installed to /Applications and
+# it contains the doxygen executable in the bundle. In the versions I've
+# seen, it is located in Resources, but in general, more often binaries are
+# located in MacOS.
+#
+# NOTE: The official Doxygen.app that is distributed for OS X uses non-standard
+# conventions. Instead of the command-line "doxygen" tool being placed in
+# Doxygen.app/Contents/MacOS, "Doxywizard" is placed there instead and
+# "doxygen" is placed in Contents/Resources. This is most likely done
+# so that something happens when people double-click on the Doxygen.app
+# package. Unfortunately, CMake gets confused by this as when it sees the
+# bundle it uses "Doxywizard" as the executable to use instead of
+# "doxygen". Therefore to work-around this issue we temporarily disable
+# the app-bundle feature, just for this CMake module:
+if(APPLE)
+ # Save the old setting
+ SET(TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE})
+ # Disable the App-bundle detection feature
+ SET(CMAKE_FIND_APPBUNDLE "NEVER")
+endif()
+# FYI:
+# In the older versions of OS X Doxygen, dot was included with the
+# Doxygen bundle. But the new versions require you to download
+# Graphviz.app which contains "dot" in it's bundle.
+# ============== End OSX stuff ================
+
+#
+# Find Doxygen...
+#
+
+FIND_PROGRAM(DOXYGEN_EXECUTABLE
+ NAMES doxygen
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin"
+ /Applications/Doxygen.app/Contents/Resources
+ /Applications/Doxygen.app/Contents/MacOS
+ DOC "Doxygen documentation generation tool (http://www.doxygen.org)"
+)
+
+IF(DOXYGEN_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${DOXYGEN_EXECUTABLE} "--version" OUTPUT_VARIABLE DOXYGEN_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDIF()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Doxygen REQUIRED_VARS DOXYGEN_EXECUTABLE VERSION_VAR DOXYGEN_VERSION)
+
+#
+# Find Dot...
+#
+
+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"
+ "$ENV{ProgramFiles}/ATT/Graphviz/bin"
+ "C:/Program Files/ATT/Graphviz/bin"
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin
+ /Applications/Graphviz.app/Contents/MacOS
+ /Applications/Doxygen.app/Contents/Resources
+ /Applications/Doxygen.app/Contents/MacOS
+ DOC "Graphviz Dot tool for using Doxygen"
+ )
+
+ 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)
+ endif()
+
+endif(NOT DOXYGEN_SKIP_DOT)
+
+#
+# Backwards compatibility...
+#
+
+if(APPLE)
+ # Restore the old app-bundle setting setting
+ SET(CMAKE_FIND_APPBUNDLE ${TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE})
+endif()
+
+# Maintain the _FOUND variables as "YES" or "NO" for backwards compatibility
+# (allows people to stuff them directly into Doxyfile with configure_file())
+if(DOXYGEN_FOUND)
+ set(DOXYGEN_FOUND "YES")
+else()
+ set(DOXYGEN_FOUND "NO")
+endif()
+if(DOXYGEN_DOT_FOUND)
+ set(DOXYGEN_DOT_FOUND "YES")
+else()
+ set(DOXYGEN_DOT_FOUND "NO")
+endif()
+
+# For backwards compatibility support
+SET (DOXYGEN ${DOXYGEN_EXECUTABLE} )
+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
new file mode 100644
index 000000000..1bf074357
--- /dev/null
+++ b/Modules/FindEXPAT.cmake
@@ -0,0 +1,60 @@
+# - 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.
+
+#=============================================================================
+# Copyright 2006-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 the header file.
+FIND_PATH(EXPAT_INCLUDE_DIR NAMES expat.h)
+
+# Look for the library.
+FIND_LIBRARY(EXPAT_LIBRARY NAMES expat libexpat)
+
+if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
+ file(STRINGS "${EXPAT_INCLUDE_DIR}/expat.h" expat_version_str
+ REGEX "^#[\t ]*define[\t ]+XML_(MAJOR|MINOR|MICRO)_VERSION[\t ]+[0-9]+$")
+
+ 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(EXPAT_VERSION_STRING)
+ set(EXPAT_VERSION_STRING "${EXPAT_VERSION_STRING}.${EXPAT_VERSION_PART}")
+ else(EXPAT_VERSION_STRING)
+ set(EXPAT_VERSION_STRING "${EXPAT_VERSION_PART}")
+ endif(EXPAT_VERSION_STRING)
+ endif()
+ endforeach(VLINE)
+ endforeach(VPART)
+endif (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
+
+# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT
+ REQUIRED_VARS EXPAT_LIBRARY EXPAT_INCLUDE_DIR
+ VERSION_VAR EXPAT_VERSION_STRING)
+
+# Copy the results to the output variables.
+IF(EXPAT_FOUND)
+ SET(EXPAT_LIBRARIES ${EXPAT_LIBRARY})
+ SET(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR})
+ENDIF(EXPAT_FOUND)
+
+MARK_AS_ADVANCED(EXPAT_INCLUDE_DIR EXPAT_LIBRARY)
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
new file mode 100644
index 000000000..586f77a6e
--- /dev/null
+++ b/Modules/FindFLEX.cmake
@@ -0,0 +1,161 @@
+# - Find flex executable and provides a macro to generate custom build rules
+#
+# The module defines the following variables:
+# FLEX_FOUND - true is flex executable is found
+# FLEX_EXECUTABLE - the path to the flex executable
+# FLEX_VERSION - the version of flex
+# FLEX_LIBRARIES - The flex libraries
+# FLEX_INCLUDE_DIRS - The path to the flex headers
+#
+# The minimum required version of flex can be specified using the
+# standard syntax, e.g. FIND_PACKAGE(FLEX 2.5.13)
+#
+#
+# If flex is found on the system, the module provides the macro:
+# FLEX_TARGET(Name FlexInput FlexOutput [COMPILE_FLAGS <string>])
+# 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
+# defines a macro:
+# ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget)
+# which adds the required dependency between a scanner and a parser
+# where <FlexTarget> and <BisonTarget> are the first parameters of
+# respectively FLEX_TARGET and BISON_TARGET macros.
+#
+# ====================================================================
+# Example:
+#
+# find_package(BISON)
+# find_package(FLEX)
+#
+# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp)
+# FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
+# ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
+#
+# include_directories(${CMAKE_CURRENT_BINARY_DIR})
+# add_executable(Foo
+# Foo.cc
+# ${BISON_MyParser_OUTPUTS}
+# ${FLEX_MyScanner_OUTPUTS}
+# )
+# ====================================================================
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2006 Tristan Carel
+#
+# 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_PROGRAM(FLEX_EXECUTABLE flex DOC "path to the flex executable")
+MARK_AS_ADVANCED(FLEX_EXECUTABLE)
+
+FIND_LIBRARY(FL_LIBRARY NAMES fl
+ DOC "Path to the fl library")
+
+FIND_PATH(FLEX_INCLUDE_DIR FlexLexer.h
+ DOC "Path to the flex headers")
+
+MARK_AS_ADVANCED(FL_LIBRARY FLEX_INCLUDE_DIR)
+
+SET(FLEX_INCLUDE_DIRS ${FLEX_INCLUDE_DIR})
+SET(FLEX_LIBRARIES ${FL_LIBRARY})
+
+IF(FLEX_EXECUTABLE)
+
+ EXECUTE_PROCESS(COMMAND ${FLEX_EXECUTABLE} --version
+ OUTPUT_VARIABLE FLEX_version_output
+ ERROR_VARIABLE FLEX_version_error
+ RESULT_VARIABLE FLEX_version_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ IF(NOT ${FLEX_version_result} EQUAL 0)
+ IF(FLEX_FIND_REQUIRED)
+ MESSAGE(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}")
+ ELSE()
+ MESSAGE("Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}\nFLEX_VERSION will not be available")
+ ENDIF()
+ ELSE()
+ # older versions of flex printed "/full/path/to/executable version X.Y"
+ # newer versions use "basename(executable) X.Y"
+ GET_FILENAME_COMPONENT(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME)
+ STRING(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)$" "\\2"
+ FLEX_VERSION "${FLEX_version_output}")
+ UNSET(FLEX_EXE_NAME)
+ ENDIF()
+
+ #============================================================
+ # FLEX_TARGET (public macro)
+ #============================================================
+ #
+ 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()
+ ELSE()
+ MESSAGE(SEND_ERROR ${FLEX_TARGET_usage})
+ 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(FLEX_TARGET)
+ #============================================================
+
+
+ #============================================================
+ # ADD_FLEX_BISON_DEPENDENCY (public macro)
+ #============================================================
+ #
+ MACRO(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget)
+
+ IF(NOT FLEX_${FlexTarget}_OUTPUTS)
+ MESSAGE(SEND_ERROR "Flex target `${FlexTarget}' does not exists.")
+ ENDIF()
+
+ IF(NOT BISON_${BisonTarget}_OUTPUT_HEADER)
+ MESSAGE(SEND_ERROR "Bison target `${BisonTarget}' does not exists.")
+ ENDIF()
+
+ SET_SOURCE_FILES_PROPERTIES(${FLEX_${FlexTarget}_OUTPUTS}
+ PROPERTIES OBJECT_DEPENDS ${BISON_${BisonTarget}_OUTPUT_HEADER})
+ ENDMACRO(ADD_FLEX_BISON_DEPENDENCY)
+ #============================================================
+
+ENDIF(FLEX_EXECUTABLE)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLEX REQUIRED_VARS FLEX_EXECUTABLE
+ VERSION_VAR FLEX_VERSION)
+
+# FindFLEX.cmake ends here
diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake
new file mode 100644
index 000000000..bdea95bdc
--- /dev/null
+++ b/Modules/FindFLTK.cmake
@@ -0,0 +1,309 @@
+# - Find the native FLTK includes and library
+#
+# 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
+#
+# 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
+
+#=============================================================================
+# 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.)
+
+IF(NOT FLTK_SKIP_OPENGL)
+ FIND_PACKAGE(OpenGL)
+ENDIF()
+
+# Platform dependent libraries required by FLTK
+IF(WIN32)
+ IF(NOT CYGWIN)
+ IF(BORLAND)
+ SET( FLTK_PLATFORM_DEPENDENT_LIBS import32 )
+ ELSE(BORLAND)
+ SET( FLTK_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 )
+ ENDIF(BORLAND)
+ ENDIF(NOT CYGWIN)
+ENDIF(WIN32)
+
+IF(UNIX)
+ INCLUDE(FindX11)
+ FIND_LIBRARY(FLTK_MATH_LIBRARY m)
+ SET( FLTK_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} ${FLTK_MATH_LIBRARY})
+ENDIF(UNIX)
+
+IF(APPLE)
+ SET( FLTK_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz")
+ENDIF(APPLE)
+
+# If FLTK_INCLUDE_DIR is already defined we assigne its value to FLTK_DIR
+IF(FLTK_INCLUDE_DIR)
+ SET(FLTK_DIR ${FLTK_INCLUDE_DIR})
+ENDIF(FLTK_INCLUDE_DIR)
+
+
+# If FLTK has been built using CMake we try to find everything directly
+SET(FLTK_DIR_STRING "directory containing FLTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/fltk for an installation.")
+
+# Search only if the location is not already known.
+IF(NOT FLTK_DIR)
+ # Get the system search path as a list.
+ FILE(TO_CMAKE_PATH "$ENV{PATH}" FLTK_DIR_SEARCH2)
+
+ # Construct a set of paths relative to the system search path.
+ SET(FLTK_DIR_SEARCH "")
+ FOREACH(dir ${FLTK_DIR_SEARCH2})
+ SET(FLTK_DIR_SEARCH ${FLTK_DIR_SEARCH} "${dir}/../lib/fltk")
+ ENDFOREACH(dir)
+ STRING(REPLACE "//" "/" FLTK_DIR_SEARCH "${FLTK_DIR_SEARCH}")
+
+ #
+ # Look for an installation or build tree.
+ #
+ FIND_PATH(FLTK_DIR FLTKConfig.cmake
+ # Look for an environment variable FLTK_DIR.
+ $ENV{FLTK_DIR}
+
+ # Look in places relative to the system executable search path.
+ ${FLTK_DIR_SEARCH}
+
+ # Look in standard UNIX install locations.
+ /usr/local/lib/fltk
+ /usr/lib/fltk
+ /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}"
+ )
+ENDIF(NOT FLTK_DIR)
+
+ # Check if FLTK was built using CMake
+ IF(EXISTS ${FLTK_DIR}/FLTKConfig.cmake)
+ SET(FLTK_BUILT_WITH_CMAKE 1)
+ ENDIF(EXISTS ${FLTK_DIR}/FLTKConfig.cmake)
+
+ IF(FLTK_BUILT_WITH_CMAKE)
+ SET(FLTK_FOUND 1)
+ INCLUDE(${FLTK_DIR}/FLTKConfig.cmake)
+
+ # Fluid
+ IF(FLUID_COMMAND)
+ SET(FLTK_FLUID_EXECUTABLE ${FLUID_COMMAND} CACHE FILEPATH "Fluid executable")
+ ELSE(FLUID_COMMAND)
+ FIND_PROGRAM(FLTK_FLUID_EXECUTABLE fluid PATHS
+ ${FLTK_EXECUTABLE_DIRS}
+ ${FLTK_EXECUTABLE_DIRS}/RelWithDebInfo
+ ${FLTK_EXECUTABLE_DIRS}/Debug
+ ${FLTK_EXECUTABLE_DIRS}/Release
+ NO_SYSTEM_PATH)
+ ENDIF(FLUID_COMMAND)
+ # MARK_AS_ADVANCED(FLTK_FLUID_EXECUTABLE)
+
+ SET(FLTK_INCLUDE_DIR ${FLTK_DIR})
+ LINK_DIRECTORIES(${FLTK_LIBRARY_DIRS})
+
+ SET(FLTK_BASE_LIBRARY fltk)
+ SET(FLTK_GL_LIBRARY fltk_gl)
+ SET(FLTK_FORMS_LIBRARY fltk_forms)
+ SET(FLTK_IMAGES_LIBRARY fltk_images)
+
+ # Add the extra libraries
+ LOAD_CACHE(${FLTK_DIR}
+ READ_WITH_PREFIX
+ FL FLTK_USE_SYSTEM_JPEG
+ FL FLTK_USE_SYSTEM_PNG
+ FL FLTK_USE_SYSTEM_ZLIB
+ )
+
+ SET(FLTK_IMAGES_LIBS "")
+ IF(FLFLTK_USE_SYSTEM_JPEG)
+ SET(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_jpeg)
+ ENDIF(FLFLTK_USE_SYSTEM_JPEG)
+ IF(FLFLTK_USE_SYSTEM_PNG)
+ SET(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_png)
+ ENDIF(FLFLTK_USE_SYSTEM_PNG)
+ IF(FLFLTK_USE_SYSTEM_ZLIB)
+ SET(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_zlib)
+ ENDIF(FLFLTK_USE_SYSTEM_ZLIB)
+ SET(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL
+ "Extra libraries for fltk_images library.")
+
+ ELSE(FLTK_BUILT_WITH_CMAKE)
+
+ # if FLTK was not built using CMake
+ # Find fluid executable.
+ FIND_PROGRAM(FLTK_FLUID_EXECUTABLE fluid ${FLTK_INCLUDE_DIR}/fluid)
+
+ # Use location of fluid to help find everything else.
+ SET(FLTK_INCLUDE_SEARCH_PATH "")
+ SET(FLTK_LIBRARY_SEARCH_PATH "")
+ IF(FLTK_FLUID_EXECUTABLE)
+ GET_FILENAME_COMPONENT(FLTK_BIN_DIR "${FLTK_FLUID_EXECUTABLE}" PATH)
+ SET(FLTK_INCLUDE_SEARCH_PATH ${FLTK_INCLUDE_SEARCH_PATH}
+ ${FLTK_BIN_DIR}/../include ${FLTK_BIN_DIR}/..)
+ SET(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH}
+ ${FLTK_BIN_DIR}/../lib)
+ SET(FLTK_WRAP_UI 1)
+ ENDIF(FLTK_FLUID_EXECUTABLE)
+
+ #
+ # Try to find FLTK include dir using fltk-config
+ #
+ IF(UNIX)
+ # Use fltk-config to generate a list of possible include directories
+ FIND_PROGRAM(FLTK_CONFIG_SCRIPT fltk-config PATHS ${FLTK_BIN_DIR})
+ IF(FLTK_CONFIG_SCRIPT)
+ IF(NOT FLTK_INCLUDE_DIR)
+ EXEC_PROGRAM(${FLTK_CONFIG_SCRIPT} ARGS --cxxflags OUTPUT_VARIABLE FLTK_CXXFLAGS)
+ IF(FLTK_CXXFLAGS)
+ STRING(REGEX MATCHALL "-I[^ ]*" _fltk_temp_dirs ${FLTK_CXXFLAGS})
+ STRING(REPLACE "-I" "" _fltk_temp_dirs "${_fltk_temp_dirs}")
+ FOREACH(_dir ${_fltk_temp_dirs})
+ STRING(STRIP ${_dir} _output)
+ LIST(APPEND _FLTK_POSSIBLE_INCLUDE_DIRS ${_output})
+ ENDFOREACH()
+ ENDIF(FLTK_CXXFLAGS)
+ ENDIF()
+ ENDIF()
+ ENDIF()
+
+ SET(FLTK_INCLUDE_SEARCH_PATH ${FLTK_INCLUDE_SEARCH_PATH}
+ /usr/local/fltk
+ /usr/X11R6/include
+ ${_FLTK_POSSIBLE_INCLUDE_DIRS}
+ )
+
+ FIND_PATH(FLTK_INCLUDE_DIR
+ NAMES FL/Fl.h FL/Fl.H # fltk 1.1.9 has Fl.H (#8376)
+ PATHS ${FLTK_INCLUDE_SEARCH_PATH})
+
+ #
+ # Try to find FLTK library
+ IF(UNIX)
+ IF(FLTK_CONFIG_SCRIPT)
+ EXEC_PROGRAM(${FLTK_CONFIG_SCRIPT} ARGS --libs OUTPUT_VARIABLE _FLTK_POSSIBLE_LIBS)
+ IF(_FLTK_POSSIBLE_LIBS)
+ GET_FILENAME_COMPONENT(_FLTK_POSSIBLE_LIBRARY_DIR ${_FLTK_POSSIBLE_LIBS} PATH)
+ ENDIF()
+ ENDIF()
+ ENDIF()
+
+ SET(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH}
+ /usr/local/fltk/lib
+ /usr/X11R6/lib
+ ${FLTK_INCLUDE_DIR}/lib
+ ${_FLTK_POSSIBLE_LIBRARY_DIR}
+ )
+
+ FIND_LIBRARY(FLTK_BASE_LIBRARY NAMES fltk fltkd
+ PATHS ${FLTK_LIBRARY_SEARCH_PATH})
+ FIND_LIBRARY(FLTK_GL_LIBRARY NAMES fltkgl fltkgld fltk_gl
+ PATHS ${FLTK_LIBRARY_SEARCH_PATH})
+ FIND_LIBRARY(FLTK_FORMS_LIBRARY NAMES fltkforms fltkformsd fltk_forms
+ PATHS ${FLTK_LIBRARY_SEARCH_PATH})
+ FIND_LIBRARY(FLTK_IMAGES_LIBRARY NAMES fltkimages fltkimagesd fltk_images
+ PATHS ${FLTK_LIBRARY_SEARCH_PATH})
+
+ # Find the extra libraries needed for the fltk_images library.
+ IF(UNIX)
+ IF(FLTK_CONFIG_SCRIPT)
+ EXEC_PROGRAM(${FLTK_CONFIG_SCRIPT} ARGS --use-images --ldflags
+ OUTPUT_VARIABLE FLTK_IMAGES_LDFLAGS)
+ SET(FLTK_LIBS_EXTRACT_REGEX ".*-lfltk_images (.*) -lfltk.*")
+ IF("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}")
+ STRING(REGEX REPLACE "${FLTK_LIBS_EXTRACT_REGEX}" "\\1"
+ FLTK_IMAGES_LIBS "${FLTK_IMAGES_LDFLAGS}")
+ STRING(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}")
+ # The EXEC_PROGRAM will not be inherited into subdirectories from
+ # the file that originally included this module. Save the answer.
+ SET(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL
+ "Extra libraries for fltk_images library.")
+ ENDIF("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}")
+ ENDIF(FLTK_CONFIG_SCRIPT)
+ ENDIF(UNIX)
+
+ ENDIF(FLTK_BUILT_WITH_CMAKE)
+
+ # Append all of the required libraries together (by default, everything)
+ SET(FLTK_LIBRARIES)
+ IF(NOT FLTK_SKIP_IMAGES)
+ LIST(APPEND FLTK_LIBRARIES ${FLTK_IMAGES_LIBRARY})
+ ENDIF()
+ IF(NOT FLTK_SKIP_FORMS)
+ LIST(APPEND FLTK_LIBRARIES ${FLTK_FORMS_LIBRARY})
+ ENDIF()
+ IF(NOT FLTK_SKIP_OPENGL)
+ LIST(APPEND FLTK_LIBRARIES ${FLTK_GL_LIBRARY} ${OPENGL_gl_LIBRARY})
+ LIST(APPEND FLTK_INCLUDE_DIR ${OPENGL_INCLUDE_DIR})
+ LIST(REMOVE_DUPLICATES FLTK_INCLUDE_DIR)
+ ENDIF()
+ LIST(APPEND FLTK_LIBRARIES ${FLTK_BASE_LIBRARY})
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+IF(FLTK_SKIP_FLUID)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLTK DEFAULT_MSG FLTK_LIBRARIES FLTK_INCLUDE_DIR)
+ELSE()
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLTK DEFAULT_MSG FLTK_LIBRARIES FLTK_INCLUDE_DIR FLTK_FLUID_EXECUTABLE)
+ENDIF()
+
+IF(FLTK_FOUND)
+ IF(APPLE)
+ SET(FLTK_LIBRARIES ${FLTK_PLATFORM_DEPENDENT_LIBS} ${FLTK_LIBRARIES})
+ ELSE(APPLE)
+ SET(FLTK_LIBRARIES ${FLTK_LIBRARIES} ${FLTK_PLATFORM_DEPENDENT_LIBS})
+ ENDIF(APPLE)
+
+ # The following deprecated settings are for compatibility with CMake 1.4
+ SET (HAS_FLTK ${FLTK_FOUND})
+ SET (FLTK_INCLUDE_PATH ${FLTK_INCLUDE_DIR})
+ SET (FLTK_FLUID_EXE ${FLTK_FLUID_EXECUTABLE})
+ SET (FLTK_LIBRARY ${FLTK_LIBRARIES})
+ENDIF(FLTK_FOUND)
+
diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake
new file mode 100644
index 000000000..916474579
--- /dev/null
+++ b/Modules/FindFLTK2.cmake
@@ -0,0 +1,267 @@
+# - Find the native FLTK2 includes and library
+# The following settings are defined
+# FLTK2_FLUID_EXECUTABLE, where to find the Fluid tool
+# FLTK2_WRAP_UI, This enables the FLTK2_WRAP_UI command
+# FLTK2_INCLUDE_DIR, where to find include files
+# FLTK2_LIBRARIES, list of fltk2 libraries
+# FLTK2_FOUND, Don't use FLTK2 if false.
+# The following settings should not be used in general.
+# FLTK2_BASE_LIBRARY = the full path to fltk2.lib
+# FLTK2_GL_LIBRARY = the full path to fltk2_gl.lib
+# FLTK2_IMAGES_LIBRARY = the full path to fltk2_images.lib
+
+#=============================================================================
+# 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.)
+
+SET (FLTK2_DIR $ENV{FLTK2_DIR} )
+
+# Platform dependent libraries required by FLTK2
+IF(WIN32)
+ IF(NOT CYGWIN)
+ IF(BORLAND)
+ SET( FLTK2_PLATFORM_DEPENDENT_LIBS import32 )
+ ELSE(BORLAND)
+ SET( FLTK2_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 )
+ ENDIF(BORLAND)
+ ENDIF(NOT CYGWIN)
+ENDIF(WIN32)
+
+IF(UNIX)
+ INCLUDE(${CMAKE_ROOT}/Modules/FindX11.cmake)
+ SET( FLTK2_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} -lm)
+ENDIF(UNIX)
+
+IF(APPLE)
+ SET( FLTK2_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz")
+ENDIF(APPLE)
+
+# If FLTK2_INCLUDE_DIR is already defined we assigne its value to FLTK2_DIR
+IF(FLTK2_INCLUDE_DIR)
+ SET(FLTK2_DIR ${FLTK2_INCLUDE_DIR})
+ELSE(FLTK2_INCLUDE_DIR)
+ SET(FLTK2_INCLUDE_DIR ${FLTK2_DIR})
+ENDIF(FLTK2_INCLUDE_DIR)
+
+
+# If FLTK2 has been built using CMake we try to find everything directly
+SET(FLTK2_DIR_STRING "directory containing FLTK2Config.cmake. This is either the root of the build tree, or PREFIX/lib/fltk for an installation.")
+
+# Search only if the location is not already known.
+IF(NOT FLTK2_DIR)
+ # Get the system search path as a list.
+ FILE(TO_CMAKE_PATH "$ENV{PATH}" FLTK2_DIR_SEARCH2)
+
+ # Construct a set of paths relative to the system search path.
+ SET(FLTK2_DIR_SEARCH "")
+ FOREACH(dir ${FLTK2_DIR_SEARCH2})
+ SET(FLTK2_DIR_SEARCH ${FLTK2_DIR_SEARCH} "${dir}/../lib/fltk")
+ ENDFOREACH(dir)
+ STRING(REPLACE "//" "/" FLTK2_DIR_SEARCH "${FLTK2_DIR_SEARCH}")
+
+ #
+ # Look for an installation or build tree.
+ #
+ FIND_PATH(FLTK2_DIR FLTK2Config.cmake
+ # Look for an environment variable FLTK2_DIR.
+ $ENV{FLTK2_DIR}
+
+ # Look in places relative to the system executable search path.
+ ${FLTK2_DIR_SEARCH}
+
+ # Look in standard UNIX install locations.
+ /usr/local/lib/fltk2
+ /usr/lib/fltk2
+ /usr/local/fltk2
+ /usr/X11R6/include
+
+ # 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}"
+ )
+
+ IF(NOT FLTK2_DIR)
+ FIND_PATH(FLTK2_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH})
+ ENDIF(NOT FLTK2_DIR)
+
+ENDIF(NOT FLTK2_DIR)
+
+
+# If FLTK2 was found, load the configuration file to get the rest of the
+# settings.
+IF(FLTK2_DIR)
+
+ # Check if FLTK2 was built using CMake
+ IF(EXISTS ${FLTK2_DIR}/FLTK2Config.cmake)
+ SET(FLTK2_BUILT_WITH_CMAKE 1)
+ ENDIF(EXISTS ${FLTK2_DIR}/FLTK2Config.cmake)
+
+ IF(FLTK2_BUILT_WITH_CMAKE)
+ SET(FLTK2_FOUND 1)
+ INCLUDE(${FLTK2_DIR}/FLTK2Config.cmake)
+
+ # Fluid
+ IF(FLUID_COMMAND)
+ SET(FLTK2_FLUID_EXECUTABLE ${FLUID_COMMAND} CACHE FILEPATH "Fluid executable")
+ ELSE(FLUID_COMMAND)
+ FIND_PROGRAM(FLTK2_FLUID_EXECUTABLE fluid2 PATHS
+ ${FLTK2_EXECUTABLE_DIRS}
+ ${FLTK2_EXECUTABLE_DIRS}/RelWithDebInfo
+ ${FLTK2_EXECUTABLE_DIRS}/Debug
+ ${FLTK2_EXECUTABLE_DIRS}/Release
+ NO_SYSTEM_PATH)
+ ENDIF(FLUID_COMMAND)
+
+ MARK_AS_ADVANCED(FLTK2_FLUID_EXECUTABLE)
+ SET( FLTK_FLUID_EXECUTABLE ${FLTK2_FLUID_EXECUTABLE} )
+
+
+
+
+ SET(FLTK2_INCLUDE_DIR ${FLTK2_DIR})
+ LINK_DIRECTORIES(${FLTK2_LIBRARY_DIRS})
+
+ SET(FLTK2_BASE_LIBRARY fltk2)
+ SET(FLTK2_GL_LIBRARY fltk2_gl)
+ SET(FLTK2_IMAGES_LIBRARY fltk2_images)
+
+ # Add the extra libraries
+ LOAD_CACHE(${FLTK2_DIR}
+ READ_WITH_PREFIX
+ FL FLTK2_USE_SYSTEM_JPEG
+ FL FLTK2_USE_SYSTEM_PNG
+ FL FLTK2_USE_SYSTEM_ZLIB
+ )
+
+ SET(FLTK2_IMAGES_LIBS "")
+ IF(FLFLTK2_USE_SYSTEM_JPEG)
+ SET(FLTK2_IMAGES_LIBS ${FLTK2_IMAGES_LIBS} fltk2_jpeg)
+ ENDIF(FLFLTK2_USE_SYSTEM_JPEG)
+ IF(FLFLTK2_USE_SYSTEM_PNG)
+ SET(FLTK2_IMAGES_LIBS ${FLTK2_IMAGES_LIBS} fltk2_png)
+ ENDIF(FLFLTK2_USE_SYSTEM_PNG)
+ IF(FLFLTK2_USE_SYSTEM_ZLIB)
+ SET(FLTK2_IMAGES_LIBS ${FLTK2_IMAGES_LIBS} fltk2_zlib)
+ ENDIF(FLFLTK2_USE_SYSTEM_ZLIB)
+ SET(FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}" CACHE INTERNAL
+ "Extra libraries for fltk2_images library.")
+
+ ELSE(FLTK2_BUILT_WITH_CMAKE)
+
+ # if FLTK2 was not built using CMake
+ # Find fluid executable.
+ FIND_PROGRAM(FLTK2_FLUID_EXECUTABLE fluid2 ${FLTK2_INCLUDE_DIR}/fluid)
+
+ # Use location of fluid to help find everything else.
+ SET(FLTK2_INCLUDE_SEARCH_PATH "")
+ SET(FLTK2_LIBRARY_SEARCH_PATH "")
+ IF(FLTK2_FLUID_EXECUTABLE)
+ SET( FLTK_FLUID_EXECUTABLE ${FLTK2_FLUID_EXECUTABLE} )
+ GET_FILENAME_COMPONENT(FLTK2_BIN_DIR "${FLTK2_FLUID_EXECUTABLE}" PATH)
+ SET(FLTK2_INCLUDE_SEARCH_PATH ${FLTK2_INCLUDE_SEARCH_PATH}
+ ${FLTK2_BIN_DIR}/../include ${FLTK2_BIN_DIR}/..)
+ SET(FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_LIBRARY_SEARCH_PATH}
+ ${FLTK2_BIN_DIR}/../lib)
+ SET(FLTK2_WRAP_UI 1)
+ ENDIF(FLTK2_FLUID_EXECUTABLE)
+
+ SET(FLTK2_INCLUDE_SEARCH_PATH ${FLTK2_INCLUDE_SEARCH_PATH}
+ /usr/local/fltk2
+ /usr/X11R6/include
+ )
+
+ FIND_PATH(FLTK2_INCLUDE_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH})
+
+ SET(FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_LIBRARY_SEARCH_PATH}
+ /usr/local/fltk2/lib
+ /usr/X11R6/lib
+ ${FLTK2_INCLUDE_DIR}/lib
+ )
+
+ FIND_LIBRARY(FLTK2_BASE_LIBRARY NAMES fltk2
+ PATHS ${FLTK2_LIBRARY_SEARCH_PATH})
+ FIND_LIBRARY(FLTK2_GL_LIBRARY NAMES fltk2_gl
+ PATHS ${FLTK2_LIBRARY_SEARCH_PATH})
+ FIND_LIBRARY(FLTK2_IMAGES_LIBRARY NAMES fltk2_images
+ PATHS ${FLTK2_LIBRARY_SEARCH_PATH})
+
+ # Find the extra libraries needed for the fltk_images library.
+ IF(UNIX)
+ FIND_PROGRAM(FLTK2_CONFIG_SCRIPT fltk2-config PATHS ${FLTK2_BIN_DIR})
+ IF(FLTK2_CONFIG_SCRIPT)
+ EXEC_PROGRAM(${FLTK2_CONFIG_SCRIPT} ARGS --use-images --ldflags
+ 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}")
+ # 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
+ "Extra libraries for fltk_images library.")
+ ENDIF("${FLTK2_IMAGES_LDFLAGS}" MATCHES "${FLTK2_LIBS_EXTRACT_REGEX}")
+ ENDIF(FLTK2_CONFIG_SCRIPT)
+ ENDIF(UNIX)
+
+ ENDIF(FLTK2_BUILT_WITH_CMAKE)
+ENDIF(FLTK2_DIR)
+
+
+SET(FLTK2_FOUND 1)
+FOREACH(var FLTK2_FLUID_EXECUTABLE FLTK2_INCLUDE_DIR
+ FLTK2_BASE_LIBRARY FLTK2_GL_LIBRARY
+ FLTK2_IMAGES_LIBRARY)
+ IF(NOT ${var})
+ MESSAGE( STATUS "${var} not found" )
+ SET(FLTK2_FOUND 0)
+ ENDIF(NOT ${var})
+ENDFOREACH(var)
+
+
+IF(FLTK2_FOUND)
+ SET(FLTK2_LIBRARIES ${FLTK2_IMAGES_LIBRARY} ${FLTK2_IMAGES_LIBS} ${FLTK2_BASE_LIBRARY} ${FLTK2_GL_LIBRARY} )
+ IF(APPLE)
+ SET(FLTK2_LIBRARIES ${FLTK2_PLATFORM_DEPENDENT_LIBS} ${FLTK2_LIBRARIES})
+ ELSE(APPLE)
+ SET(FLTK2_LIBRARIES ${FLTK2_LIBRARIES} ${FLTK2_PLATFORM_DEPENDENT_LIBS})
+ ENDIF(APPLE)
+
+ # The following deprecated settings are for compatibility with CMake 1.4
+ SET (HAS_FLTK2 ${FLTK2_FOUND})
+ SET (FLTK2_INCLUDE_PATH ${FLTK2_INCLUDE_DIR})
+ SET (FLTK2_FLUID_EXE ${FLTK2_FLUID_EXECUTABLE})
+ SET (FLTK2_LIBRARY ${FLTK2_LIBRARIES})
+ELSE(FLTK2_FOUND)
+ # make FIND_PACKAGE friendly
+ IF(NOT FLTK2_FIND_QUIETLY)
+ IF(FLTK2_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR
+ "FLTK2 required, please specify its location with FLTK2_DIR.")
+ ELSE(FLTK2_FIND_REQUIRED)
+ MESSAGE(STATUS "FLTK2 was not found.")
+ ENDIF(FLTK2_FIND_REQUIRED)
+ ENDIF(NOT FLTK2_FIND_QUIETLY)
+ENDIF(FLTK2_FOUND)
+
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
new file mode 100644
index 000000000..e6f670256
--- /dev/null
+++ b/Modules/FindFreetype.cmake
@@ -0,0 +1,110 @@
+# - 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.
+
+#=============================================================================
+# 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.)
+
+# Created by Eric Wing.
+# Modifications by Alexander Neundorf.
+# This file has been renamed to "FindFreetype.cmake" instead of the correct
+# "FindFreeType.cmake" in order to be compatible with the one from KDE4, Alex.
+
+# Ugh, FreeType seems to use some #include trickery which
+# makes this harder than it should be. It looks like they
+# put ft2build.h in a common/easier-to-find location which
+# then contains a #include to a more specific header in a
+# more specific location (#include <freetype/config/ftheader.h>).
+# Then from there, they need to set a bunch of #define's
+# so you can do something like:
+# #include FT_FREETYPE_H
+# Unfortunately, using CMake's mechanisms like INCLUDE_DIRECTORIES()
+# 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
+ HINTS
+ $ENV{FREETYPE_DIR}
+ PATHS
+ /usr/local/X11R6/include
+ /usr/local/X11/include
+ /usr/freeware/include
+)
+
+FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
+ HINTS
+ $ENV{FREETYPE_DIR}/include/freetype2
+ PATHS
+ /usr/local/X11R6/include
+ /usr/local/X11/include
+ /usr/freeware/include
+ PATH_SUFFIXES freetype2
+)
+
+FIND_LIBRARY(FREETYPE_LIBRARY
+ NAMES freetype libfreetype freetype219
+ HINTS
+ $ENV{FREETYPE_DIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ /usr/local/X11R6
+ /usr/local/X11
+ /usr/freeware
+)
+
+# 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}")
+ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
+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]+$")
+
+ 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(FREETYPE_VERSION_STRING)
+ SET(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
+ ENDIF(FREETYPE_VERSION_STRING)
+ UNSET(FREETYPE_VERSION_PART)
+ ENDIF()
+ ENDFOREACH(VLINE)
+ ENDFOREACH(VPART)
+ENDIF(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
+
+
+# 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)
diff --git a/Modules/FindGCCXML.cmake b/Modules/FindGCCXML.cmake
new file mode 100644
index 000000000..261a5d180
--- /dev/null
+++ b/Modules/FindGCCXML.cmake
@@ -0,0 +1,27 @@
+# - Find the GCC-XML front-end executable.
+#
+# This module will define the following variables:
+# GCCXML - the GCC-XML front-end executable.
+
+#=============================================================================
+# 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.)
+
+FIND_PROGRAM(GCCXML
+ NAMES gccxml
+ ../GCC_XML/gccxml
+ PATHS [HKEY_CURRENT_USER\\Software\\Kitware\\GCC_XML;loc]
+ "$ENV{ProgramFiles}/GCC_XML"
+ "C:/Program Files/GCC_XML"
+)
+
+MARK_AS_ADVANCED(GCCXML)
diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake
new file mode 100644
index 000000000..c31bef5ca
--- /dev/null
+++ b/Modules/FindGDAL.cmake
@@ -0,0 +1,107 @@
+# Locate gdal
+#
+# This module accepts the following environment variables:
+#
+# GDAL_DIR or GDAL_ROOT - Specify the location of GDAL
+#
+# This module defines the following CMake variables:
+#
+# GDAL_FOUND - True if libgdal is found
+# GDAL_LIBRARY - A variable pointing to the GDAL library
+# GDAL_INCLUDE_DIR - Where to find the headers
+
+#=============================================================================
+# 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.)
+
+#
+# $GDALDIR is an environment variable that would
+# correspond to the ./configure --prefix=$GDAL_DIR
+# used in building gdal.
+#
+# Created by Eric Wing. I'm not a gdal user, but OpenSceneGraph uses it
+# for osgTerrain so I whipped this module together for completeness.
+# I actually don't know the conventions or where files are typically
+# placed in distros.
+# Any real gdal users are encouraged to correct this (but please don't
+# break the OS X framework stuff when doing so which is what usually seems
+# to happen).
+
+# This makes the presumption that you are include gdal.h like
+#
+#include "gdal.h"
+
+FIND_PATH(GDAL_INCLUDE_DIR gdal.h
+ HINTS
+ $ENV{GDAL_DIR}
+ $ENV{GDAL_ROOT}
+ PATH_SUFFIXES
+ include/gdal
+ include/GDAL
+ include
+ PATHS
+ ~/Library/Frameworks/gdal.framework/Headers
+ /Library/Frameworks/gdal.framework/Headers
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+)
+
+IF(UNIX)
+ # Use gdal-config to obtain the library version (this should hopefully
+ # allow us to -lgdal1.x.y where x.y are correct version)
+ # For some reason, libgdal development packages do not contain
+ # libgdal.so...
+ FIND_PROGRAM(GDAL_CONFIG gdal-config
+ HINTS
+ $ENV{GDAL_DIR}
+ $ENV{GDAL_ROOT}
+ PATH_SUFFIXES bin
+ PATHS
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+ )
+
+ if(GDAL_CONFIG)
+ 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(REGEX MATCHALL "-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_LIBS})
+ string(REGEX REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}")
+ endif()
+ endif()
+endif()
+
+FIND_LIBRARY(GDAL_LIBRARY
+ NAMES ${_gdal_lib} gdal gdal_i gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
+ HINTS
+ $ENV{GDAL_DIR}
+ $ENV{GDAL_ROOT}
+ ${_gdal_libpath}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ /usr/freeware
+)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL DEFAULT_MSG GDAL_LIBRARY GDAL_INCLUDE_DIR)
+
+set(GDAL_LIBRARIES ${GDAL_LIBRARY})
+set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
new file mode 100644
index 000000000..41e909805
--- /dev/null
+++ b/Modules/FindGIF.cmake
@@ -0,0 +1,80 @@
+# 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)
+#
+# $GIF_DIR is an environment variable that would
+# correspond to the ./configure --prefix=$GIF_DIR
+
+#=============================================================================
+# 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.)
+
+# Created by Eric Wing.
+# Modifications by Alexander Neundorf
+
+FIND_PATH(GIF_INCLUDE_DIR gif_lib.h
+ HINTS
+ $ENV{GIF_DIR}
+ PATH_SUFFIXES include
+ PATHS
+ ~/Library/Frameworks
+ /usr/freeware
+)
+
+# the gif library can have many names :-/
+SET(POTENTIAL_GIF_LIBS gif libgif ungif libungif giflib giflib4)
+
+FIND_LIBRARY(GIF_LIBRARY
+ NAMES ${POTENTIAL_GIF_LIBS}
+ HINTS
+ $ENV{GIF_DIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ ~/Library/Frameworks
+ /usr/freeware
+)
+
+# see readme.txt
+SET(GIF_LIBRARIES ${GIF_LIBRARY})
+
+# Very basic version detection.
+# The GIF_LIB_VERSION string in gif_lib.h seems to be unreliable, since it seems
+# to be always " Version 2.0, " in versions 3.x of giflib.
+# In version 4 the member UserData was added to GifFileType, so we check for this
+# one.
+# http://giflib.sourcearchive.com/documentation/4.1.4/files.html
+IF(GIF_INCLUDE_DIR)
+ INCLUDE(CMakePushCheckState)
+ INCLUDE(CheckStructHasMember)
+ CMAKE_PUSH_CHECK_STATE()
+ SET(GIF_VERSION 3)
+ SET(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}")
+ CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData )
+ IF(GIF_GifFileType_UserData)
+ SET(GIF_VERSION 4)
+ ENDIF()
+ CMAKE_POP_CHECK_STATE()
+ENDIF()
+
+
+# handle the QUIETLY and REQUIRED arguments and set GIF_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR
+ VERSION_VAR GIF_VERSION )
+
+MARK_AS_ADVANCED(GIF_INCLUDE_DIR GIF_LIBRARY)
diff --git a/Modules/FindGLU.cmake b/Modules/FindGLU.cmake
new file mode 100644
index 000000000..5198f11e1
--- /dev/null
+++ b/Modules/FindGLU.cmake
@@ -0,0 +1,28 @@
+
+#=============================================================================
+# 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.)
+
+# Use of this file is deprecated, and is here for backwards compatibility with CMake 1.4
+# GLU library is now found by FindOpenGL.cmake
+#
+
+MESSAGE(STATUS
+ "WARNING: you are using the obsolete 'GLU' package, please use 'OpenGL' instead")
+
+INCLUDE(FindOpenGL)
+
+IF (OPENGL_GLU_FOUND)
+ SET (GLU_LIBRARY ${OPENGL_LIBRARIES})
+ SET (GLU_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
+ENDIF (OPENGL_GLU_FOUND)
+
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
new file mode 100644
index 000000000..82057792d
--- /dev/null
+++ b/Modules/FindGLUT.cmake
@@ -0,0 +1,90 @@
+# - 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.
+# 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.
+
+#=============================================================================
+# 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.)
+
+IF (WIN32)
+ FIND_PATH( GLUT_INCLUDE_DIR NAMES GL/glut.h
+ PATHS ${GLUT_ROOT_PATH}/include )
+ FIND_LIBRARY( GLUT_glut_LIBRARY NAMES glut glut32 freeglut
+ PATHS
+ ${OPENGL_LIBRARY_DIR}
+ ${GLUT_ROOT_PATH}/Release
+ )
+ELSE (WIN32)
+
+ 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")
+ ELSE (APPLE)
+
+ FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
+ /usr/include/GL
+ /usr/openwin/share/include
+ /usr/openwin/include
+ /opt/graphics/OpenGL/include
+ /opt/graphics/OpenGL/contrib/libglut
+ )
+
+ FIND_LIBRARY( GLUT_glut_LIBRARY glut
+ /usr/openwin/lib
+ )
+
+ FIND_LIBRARY( GLUT_Xi_LIBRARY Xi
+ /usr/openwin/lib
+ )
+
+ FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu
+ /usr/openwin/lib
+ )
+
+ ENDIF (APPLE)
+
+ENDIF (WIN32)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
+
+IF (GLUT_FOUND)
+ # Is -lXi and -lXmu required on all platforms that have it?
+ # If not, we need some way to figure out what platform we are on.
+ SET( GLUT_LIBRARIES
+ ${GLUT_glut_LIBRARY}
+ ${GLUT_Xmu_LIBRARY}
+ ${GLUT_Xi_LIBRARY}
+ ${GLUT_cocoa_LIBRARY}
+ )
+
+ #The following deprecated settings are for backwards compatibility with CMake1.4
+ SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
+ SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
+ENDIF(GLUT_FOUND)
+
+MARK_AS_ADVANCED(
+ GLUT_INCLUDE_DIR
+ GLUT_glut_LIBRARY
+ GLUT_Xmu_LIBRARY
+ GLUT_Xi_LIBRARY
+ )
diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake
new file mode 100644
index 000000000..e9cc62f20
--- /dev/null
+++ b/Modules/FindGTK.cmake
@@ -0,0 +1,165 @@
+# - 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.
+#
+# 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.)
+
+# don't even bother under WIN32
+IF(UNIX)
+
+ FIND_PATH( GTK_gtk_INCLUDE_PATH NAMES gtk/gtk.h
+ PATH_SUFFIXES gtk-1.2 gtk12
+ PATHS
+ /usr/openwin/share/include
+ /usr/openwin/include
+ /opt/gnome/include
+ )
+
+ # Some Linux distributions (e.g. Red Hat) have glibconfig.h
+ # and glib.h in different directories, so we need to look
+ # for both.
+ # - Atanas Georgiev <atanas@cs.columbia.edu>
+
+ FIND_PATH( GTK_glibconfig_INCLUDE_PATH NAMES glibconfig.h
+ PATHS
+ /usr/openwin/share/include
+ /usr/local/include/glib12
+ /usr/lib/glib/include
+ /usr/local/lib/glib/include
+ /opt/gnome/include
+ /opt/gnome/lib/glib/include
+ )
+
+ FIND_PATH( GTK_glib_INCLUDE_PATH NAMES glib.h
+ PATH_SUFFIXES gtk-1.2 glib-1.2 glib12
+ PATHS
+ /usr/openwin/share/include
+ /usr/lib/glib/include
+ /opt/gnome/include
+ )
+
+ FIND_PATH( GTK_gtkgl_INCLUDE_PATH NAMES gtkgl/gtkglarea.h
+ PATHS /usr/openwin/share/include
+ /opt/gnome/include
+ )
+
+ FIND_LIBRARY( GTK_gtkgl_LIBRARY gtkgl
+ /usr/openwin/lib
+ /opt/gnome/lib
+ )
+
+ #
+ # The 12 suffix is thanks to the FreeBSD ports collection
+ #
+
+ FIND_LIBRARY( GTK_gtk_LIBRARY
+ NAMES gtk gtk12
+ PATHS /usr/openwin/lib
+ /opt/gnome/lib
+ )
+
+ FIND_LIBRARY( GTK_gdk_LIBRARY
+ NAMES gdk gdk12
+ PATHS /usr/openwin/lib
+ /opt/gnome/lib
+ )
+
+ FIND_LIBRARY( GTK_gmodule_LIBRARY
+ NAMES gmodule gmodule12
+ PATHS /usr/openwin/lib
+ /opt/gnome/lib
+ )
+
+ FIND_LIBRARY( GTK_glib_LIBRARY
+ NAMES glib glib12
+ PATHS /usr/openwin/lib
+ /opt/gnome/lib
+ )
+
+ FIND_LIBRARY( GTK_Xi_LIBRARY
+ NAMES Xi
+ PATHS /usr/openwin/lib
+ /opt/gnome/lib
+ )
+
+ FIND_LIBRARY( GTK_gthread_LIBRARY
+ NAMES gthread gthread12
+ PATHS /usr/openwin/lib
+ /opt/gnome/lib
+ )
+
+ IF(GTK_gtk_INCLUDE_PATH
+ AND GTK_glibconfig_INCLUDE_PATH
+ AND GTK_glib_INCLUDE_PATH
+ AND GTK_gtk_LIBRARY
+ AND GTK_glib_LIBRARY)
+
+ # Assume that if gtk and glib were found, the other
+ # supporting libraries have also been found.
+
+ SET( GTK_FOUND "YES" )
+ SET( GTK_INCLUDE_DIR ${GTK_gtk_INCLUDE_PATH}
+ ${GTK_glibconfig_INCLUDE_PATH}
+ ${GTK_glib_INCLUDE_PATH} )
+ SET( GTK_LIBRARIES ${GTK_gtk_LIBRARY}
+ ${GTK_gdk_LIBRARY}
+ ${GTK_glib_LIBRARY} )
+
+ IF(GTK_gmodule_LIBRARY)
+ SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gmodule_LIBRARY})
+ ENDIF(GTK_gmodule_LIBRARY)
+ IF(GTK_gthread_LIBRARY)
+ SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gthread_LIBRARY})
+ ENDIF(GTK_gthread_LIBRARY)
+ IF(GTK_Xi_LIBRARY)
+ SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_Xi_LIBRARY})
+ ENDIF(GTK_Xi_LIBRARY)
+
+ IF(GTK_gtkgl_INCLUDE_PATH AND GTK_gtkgl_LIBRARY)
+ SET( GTK_GL_FOUND "YES" )
+ SET( GTK_INCLUDE_DIR ${GTK_INCLUDE_DIR}
+ ${GTK_gtkgl_INCLUDE_PATH} )
+ SET( GTK_LIBRARIES ${GTK_gtkgl_LIBRARY} ${GTK_LIBRARIES} )
+ MARK_AS_ADVANCED(
+ GTK_gtkgl_LIBRARY
+ GTK_gtkgl_INCLUDE_PATH
+ )
+ ENDIF(GTK_gtkgl_INCLUDE_PATH AND GTK_gtkgl_LIBRARY)
+
+ ENDIF(GTK_gtk_INCLUDE_PATH
+ AND GTK_glibconfig_INCLUDE_PATH
+ AND GTK_glib_INCLUDE_PATH
+ AND GTK_gtk_LIBRARY
+ AND GTK_glib_LIBRARY)
+
+ MARK_AS_ADVANCED(
+ GTK_gdk_LIBRARY
+ GTK_glib_INCLUDE_PATH
+ GTK_glib_LIBRARY
+ GTK_glibconfig_INCLUDE_PATH
+ GTK_gmodule_LIBRARY
+ GTK_gthread_LIBRARY
+ GTK_Xi_LIBRARY
+ GTK_gtk_INCLUDE_PATH
+ GTK_gtk_LIBRARY
+ GTK_gtkgl_INCLUDE_PATH
+ GTK_gtkgl_LIBRARY
+ )
+
+ENDIF(UNIX)
+
+
+
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
new file mode 100644
index 000000000..a03c023e4
--- /dev/null
+++ b/Modules/FindGTK2.cmake
@@ -0,0 +1,590 @@
+# - FindGTK2.cmake
+# This module can find the GTK2 widget libraries and several of its other
+# optional components like gtkmm, glade, and glademm.
+#
+# NOTE: If you intend to use version checking, CMake 2.6.2 or later is
+# required.
+#
+# Specify one or more of the following components
+# as you call this find module. See example below.
+#
+# gtk
+# gtkmm
+# glade
+# glademm
+#
+# The following variables will be defined for your use
+#
+# GTK2_FOUND - Were all of your specified components found?
+# GTK2_INCLUDE_DIRS - All include directories
+# GTK2_LIBRARIES - All libraries
+#
+# GTK2_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_SKIP_MARK_AS_ADVANCED - Disable marking cache variables as advanced
+# GTK2_ADDITIONAL_SUFFIXES - Allows defining additional directories to
+# search for include files
+#
+#=================
+# Example Usage:
+#
+# Call find_package() once, here are some examples to pick from:
+#
+# Require GTK 2.6 or later
+# find_package(GTK2 2.6 REQUIRED gtk)
+#
+# Require GTK 2.10 or later and Glade
+# find_package(GTK2 2.10 REQUIRED gtk glade)
+#
+# Search for GTK/GTKMM 2.8 or later
+# find_package(GTK2 2.8 COMPONENTS gtk gtkmm)
+#
+# if(GTK2_FOUND)
+# include_directories(${GTK2_INCLUDE_DIRS})
+# add_executable(mygui mygui.cc)
+# target_link_libraries(mygui ${GTK2_LIBRARIES})
+# endif()
+#
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2008-2009 Philip Lowman <philip@yhbt.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.)
+
+# Version 1.3 (11/9/2010) (CMake 2.8.4)
+# * 11429: Add support for detecting GTK2 built with Visual Studio 10.
+# Thanks to Vincent Levesque for the patch.
+
+# Version 1.2 (8/30/2010) (CMake 2.8.3)
+# * Merge patch for detecting gdk-pixbuf library (split off
+# from core GTK in 2.21). Thanks to Vincent Untz for the patch
+# and Ricardo Cruz for the heads up.
+# Version 1.1 (8/19/2010) (CMake 2.8.3)
+# * Add support for detecting GTK2 under macports (thanks to Gary Kramlich)
+# Version 1.0 (8/12/2010) (CMake 2.8.3)
+# * Add support for detecting new pangommconfig.h header file
+# (Thanks to Sune Vuorela & the Debian Project for the patch)
+# * Add support for detecting fontconfig.h header
+# * Call find_package(Freetype) since it's required
+# * Add support for allowing users to add additional library directories
+# via the GTK2_ADDITIONAL_SUFFIXES variable (kind of a future-kludge in
+# case the GTK developers change versions on any of the directories in the
+# future).
+# Version 0.8 (1/4/2010)
+# * Get module working under MacOSX fink by adding /sw/include, /sw/lib
+# to PATHS and the gobject library
+# Version 0.7 (3/22/09)
+# * Checked into CMake CVS
+# * Added versioning support
+# * Module now defaults to searching for GTK if COMPONENTS not specified.
+# * Added HKCU prior to HKLM registry key and GTKMM specific environment
+# variable as per mailing list discussion.
+# * Added lib64 to include search path and a few other search paths where GTK
+# may be installed on Unix systems.
+# * Switched to lowercase CMake commands
+# * Prefaced internal variables with _GTK2 to prevent collision
+# * Changed internal macros to functions
+# * Enhanced documentation
+# Version 0.6 (1/8/08)
+# Added GTK2_SKIP_MARK_AS_ADVANCED option
+# Version 0.5 (12/19/08)
+# Second release to cmake mailing list
+
+#=============================================================
+# _GTK2_GET_VERSION
+# Internal function to parse the version number in gtkversion.h
+# _OUT_major = Major version number
+# _OUT_minor = Minor version number
+# _OUT_micro = Micro version number
+# _gtkversion_hdr = Header file to parse
+#=============================================================
+function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr)
+ file(READ ${_gtkversion_hdr} _contents)
+ if(_contents)
+ string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_major} "${_contents}")
+ string(REGEX REPLACE ".*#define GTK_MINOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_minor} "${_contents}")
+ string(REGEX REPLACE ".*#define GTK_MICRO_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_micro} "${_contents}")
+
+ if(NOT ${_OUT_major} MATCHES "[0-9]+")
+ message(FATAL_ERROR "Version parsing failed for GTK2_MAJOR_VERSION!")
+ endif()
+ if(NOT ${_OUT_minor} MATCHES "[0-9]+")
+ message(FATAL_ERROR "Version parsing failed for GTK2_MINOR_VERSION!")
+ endif()
+ if(NOT ${_OUT_micro} MATCHES "[0-9]+")
+ message(FATAL_ERROR "Version parsing failed for GTK2_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
+# _var = variable to set
+# _hdr = header file to look for
+#=============================================================
+function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_FIND_INCLUDE_DIR( ${_var} ${_hdr} )")
+ endif()
+
+ set(_relatives
+ # If these ever change, things will break.
+ ${GTK2_ADDITIONAL_SUFFIXES}
+ glibmm-2.4
+ glib-2.0
+ atk-1.0
+ atkmm-1.6
+ cairo
+ cairomm-1.0
+ gdk-pixbuf-2.0
+ gdkmm-2.4
+ giomm-2.4
+ gtk-2.0
+ gtkmm-2.4
+ libglade-2.0
+ libglademm-2.4
+ pango-1.0
+ pangomm-1.4
+ sigc++-2.0
+ )
+
+ set(_suffixes)
+ foreach(_d ${_relatives})
+ list(APPEND _suffixes ${_d})
+ list(APPEND _suffixes ${_d}/include) # for /usr/lib/gtk-2.0/include
+ endforeach()
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "include suffixes = ${_suffixes}")
+ endif()
+
+ find_path(${_var} ${_hdr}
+ PATHS
+ /usr/local/lib64
+ /usr/local/lib
+ /usr/lib64
+ /usr/lib
+ /opt/gnome/include
+ /opt/gnome/lib
+ /opt/openwin/include
+ /usr/openwin/lib
+ /sw/include
+ /sw/lib
+ /opt/local/include
+ /opt/local/lib
+ $ENV{GTKMM_BASEPATH}/include
+ $ENV{GTKMM_BASEPATH}/lib
+ [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/include
+ [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/include
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ PATH_SUFFIXES
+ ${_suffixes}
+ )
+
+ if(${_var})
+ set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${${_var}} PARENT_SCOPE)
+ if(NOT GTK2_SKIP_MARK_AS_ADVANCED)
+ mark_as_advanced(${_var})
+ endif()
+ endif()
+
+endfunction(_GTK2_FIND_INCLUDE_DIR)
+
+#=============================================================
+# _GTK2_FIND_LIBRARY
+# Internal function to find libraries packaged with GTK2
+# _var = library variable to create
+#=============================================================
+function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version)
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_FIND_LIBRARY( ${_var} ${_lib} ${_expand_vc} ${_append_version} )")
+ endif()
+
+ # Not GTK versions per se but the versions encoded into Windows
+ # import libraries (GtkMM 2.14.1 has a gtkmm-vc80-2_4.lib for example)
+ # Also the MSVC libraries use _ for . (this is handled below)
+ set(_versions 2.20 2.18 2.16 2.14 2.12
+ 2.10 2.8 2.6 2.4 2.2 2.0
+ 1.20 1.18 1.16 1.14 1.12
+ 1.10 1.8 1.6 1.4 1.2 1.0)
+
+ set(_library)
+ set(_library_d)
+
+ set(_library ${_lib})
+
+ if(_expand_vc AND MSVC)
+ # Add vc80/vc90/vc100 midfixes
+ if(MSVC80)
+ set(_library ${_library}-vc80)
+ elseif(MSVC90)
+ set(_library ${_library}-vc90)
+ elseif(MSVC10)
+ set(_library ${_library}-vc100)
+ endif()
+ set(_library_d ${_library}-d)
+ endif()
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "After midfix addition = ${_library} and ${_library_d}")
+ endif()
+
+ set(_lib_list)
+ set(_libd_list)
+ if(_append_version)
+ foreach(_ver ${_versions})
+ list(APPEND _lib_list "${_library}-${_ver}")
+ list(APPEND _libd_list "${_library_d}-${_ver}")
+ endforeach()
+ else()
+ set(_lib_list ${_library})
+ set(_libd_list ${_library_d})
+ endif()
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "library list = ${_lib_list} and library debug list = ${_libd_list}")
+ endif()
+
+ # For some silly reason the MSVC libraries use _ instead of .
+ # in the version fields
+ if(_expand_vc AND MSVC)
+ set(_no_dots_lib_list)
+ set(_no_dots_libd_list)
+ foreach(_l ${_lib_list})
+ string(REPLACE "." "_" _no_dots_library ${_l})
+ list(APPEND _no_dots_lib_list ${_no_dots_library})
+ endforeach()
+ # And for debug
+ set(_no_dots_libsd_list)
+ foreach(_l ${_libd_list})
+ string(REPLACE "." "_" _no_dots_libraryd ${_l})
+ list(APPEND _no_dots_libd_list ${_no_dots_libraryd})
+ endforeach()
+
+ # Copy list back to original names
+ set(_lib_list ${_no_dots_lib_list})
+ set(_libd_list ${_no_dots_libd_list})
+ endif()
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "While searching for ${_var}, our proposed library list is ${_lib_list}")
+ endif()
+
+ find_library(${_var}
+ NAMES ${_lib_list}
+ PATHS
+ /opt/gnome/lib
+ /opt/gnome/lib64
+ /usr/openwin/lib
+ /usr/openwin/lib64
+ /sw/lib
+ $ENV{GTKMM_BASEPATH}/lib
+ [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ )
+
+ if(_expand_vc AND MSVC)
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "While searching for ${_var}_DEBUG our proposed library list is ${_libd_list}")
+ endif()
+
+ find_library(${_var}_DEBUG
+ NAMES ${_libd_list}
+ PATHS
+ $ENV{GTKMM_BASEPATH}/lib
+ [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ )
+
+ if(${_var} AND ${_var}_DEBUG)
+ if(NOT GTK2_SKIP_MARK_AS_ADVANCED)
+ mark_as_advanced(${_var}_DEBUG)
+ endif()
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} optimized ${${_var}} debug ${${_var}_DEBUG})
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE)
+ endif()
+ else()
+ if(NOT GTK2_SKIP_MARK_AS_ADVANCED)
+ mark_as_advanced(${_var})
+ endif()
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${${_var}})
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE)
+ # Set debug to release
+ set(${_var}_DEBUG ${${_var}})
+ set(${_var}_DEBUG ${${_var}} PARENT_SCOPE)
+ endif()
+endfunction(_GTK2_FIND_LIBRARY)
+
+#=============================================================
+
+#
+# main()
+#
+
+set(GTK2_FOUND)
+set(GTK2_INCLUDE_DIRS)
+set(GTK2_LIBRARIES)
+
+if(NOT GTK2_FIND_COMPONENTS)
+ # Assume they only want GTK
+ set(GTK2_FIND_COMPONENTS gtk)
+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_INCLUDE_DIR gtk/gtk.h)
+ if(GTK2_GTK_INCLUDE_DIR)
+ _GTK2_GET_VERSION(GTK2_MAJOR_VERSION
+ GTK2_MINOR_VERSION
+ GTK2_PATCH_VERSION
+ ${GTK2_GTK_INCLUDE_DIR}/gtk/gtkversion.h)
+ set(GTK2_VERSION
+ ${GTK2_MAJOR_VERSION}.${GTK2_MINOR_VERSION}.${GTK2_PATCH_VERSION})
+ if(GTK2_FIND_VERSION_EXACT)
+ if(GTK2_VERSION VERSION_EQUAL GTK2_FIND_VERSION)
+ set(GTK2_FAILED_VERSION_CHECK false)
+ endif()
+ else()
+ if(GTK2_VERSION VERSION_EQUAL GTK2_FIND_VERSION OR
+ GTK2_VERSION VERSION_GREATER GTK2_FIND_VERSION)
+ set(GTK2_FAILED_VERSION_CHECK false)
+ endif()
+ endif()
+ else()
+ # If we can't find the GTK include dir, we can't do version checking
+ if(GTK2_FIND_REQUIRED AND NOT GTK2_FIND_QUIETLY)
+ message(FATAL_ERROR "Could not find GTK2 include directory")
+ endif()
+ return()
+ endif()
+
+ if(GTK2_FAILED_VERSION_CHECK)
+ if(GTK2_FIND_REQUIRED AND NOT GTK2_FIND_QUIETLY)
+ if(GTK2_FIND_VERSION_EXACT)
+ message(FATAL_ERROR "GTK2 version check failed. Version ${GTK2_VERSION} was found, version ${GTK2_FIND_VERSION} is needed exactly.")
+ else()
+ message(FATAL_ERROR "GTK2 version check failed. Version ${GTK2_VERSION} was found, at least version ${GTK2_FIND_VERSION} is required")
+ endif()
+ endif()
+
+ # If the version check fails, exit out of the module here
+ return()
+ endif()
+endif()
+
+#
+# Find all components
+#
+
+find_package(Freetype)
+list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
+list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES})
+
+foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
+ if(_GTK2_component STREQUAL "gtk")
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB_INCLUDE_DIR glib.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG_INCLUDE_DIR glibconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GLIB_LIBRARY glib false true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT_INCLUDE_DIR gobject/gobject.h)
+ _GTK2_FIND_LIBRARY (GTK2_GOBJECT_LIBRARY gobject false true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h)
+ _GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF_LIBRARY gdk_pixbuf false true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_INCLUDE_DIR gdk/gdk.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG_INCLUDE_DIR gdkconfig.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GTK_INCLUDE_DIR gtk/gtk.h)
+
+ if(UNIX)
+ _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-x11 false true)
+ _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-x11 false true)
+ else()
+ _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-win32 false true)
+ _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-win32 false true)
+ endif()
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_CAIRO_INCLUDE_DIR cairo.h)
+ _GTK2_FIND_LIBRARY (GTK2_CAIRO_LIBRARY cairo false false)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO_INCLUDE_DIR pango/pango.h)
+ _GTK2_FIND_LIBRARY (GTK2_PANGO_LIBRARY pango false true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_ATK_INCLUDE_DIR atk/atk.h)
+ _GTK2_FIND_LIBRARY (GTK2_ATK_LIBRARY atk false true)
+
+
+ elseif(_GTK2_component STREQUAL "gtkmm")
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMM_INCLUDE_DIR glibmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMMCONFIG_INCLUDE_DIR glibmmconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GLIBMM_LIBRARY glibmm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMM_INCLUDE_DIR gdkmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMMCONFIG_INCLUDE_DIR gdkmmconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GDKMM_LIBRARY gdkmm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMM_INCLUDE_DIR gtkmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMMCONFIG_INCLUDE_DIR gtkmmconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GTKMM_LIBRARY gtkmm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM_INCLUDE_DIR cairomm/cairomm.h)
+ _GTK2_FIND_LIBRARY (GTK2_CAIROMM_LIBRARY cairomm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM_INCLUDE_DIR pangomm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMMCONFIG_INCLUDE_DIR pangommconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_PANGOMM_LIBRARY pangomm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++_INCLUDE_DIR sigc++/sigc++.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++CONFIG_INCLUDE_DIR sigc++config.h)
+ _GTK2_FIND_LIBRARY (GTK2_SIGC++_LIBRARY sigc true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMM_INCLUDE_DIR giomm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMMCONFIG_INCLUDE_DIR giommconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GIOMM_LIBRARY giomm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_ATKMM_INCLUDE_DIR atkmm.h)
+ _GTK2_FIND_LIBRARY (GTK2_ATKMM_LIBRARY atkmm true true)
+
+ elseif(_GTK2_component STREQUAL "glade")
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLADE_INCLUDE_DIR glade/glade.h)
+ _GTK2_FIND_LIBRARY (GTK2_GLADE_LIBRARY glade false true)
+
+ elseif(_GTK2_component STREQUAL "glademm")
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMM_INCLUDE_DIR libglademm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMMCONFIG_INCLUDE_DIR libglademmconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GLADEMM_LIBRARY glademm true true)
+
+ else()
+ message(FATAL_ERROR "Unknown GTK2 component ${_component}")
+ endif()
+endforeach()
+
+#
+# Solve for the GTK2 version if we haven't already
+#
+if(NOT GTK2_FIND_VERSION AND GTK2_GTK_INCLUDE_DIR)
+ _GTK2_GET_VERSION(GTK2_MAJOR_VERSION
+ GTK2_MINOR_VERSION
+ GTK2_PATCH_VERSION
+ ${GTK2_GTK_INCLUDE_DIR}/gtk/gtkversion.h)
+ set(GTK2_VERSION ${GTK2_MAJOR_VERSION}.${GTK2_MINOR_VERSION}.${GTK2_PATCH_VERSION})
+endif()
+
+#
+# Try to enforce components
+#
+
+set(_GTK2_did_we_find_everything true) # This gets set to GTK2_FOUND
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
+ string(TOUPPER ${_GTK2_component} _COMPONENT_UPPER)
+
+ 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
+ GTK2_GTK_INCLUDE_DIR
+
+ GTK2_GLIB_INCLUDE_DIR
+ GTK2_GLIBCONFIG_INCLUDE_DIR
+ GTK2_GLIB_LIBRARY
+
+ GTK2_GDK_INCLUDE_DIR
+ GTK2_GDKCONFIG_INCLUDE_DIR
+ GTK2_GDK_LIBRARY
+ )
+ elseif(_GTK2_component STREQUAL "gtkmm")
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtkmm libraries were not found."
+ GTK2_GTKMM_LIBRARY
+ GTK2_GTKMM_INCLUDE_DIR
+ GTK2_GTKMMCONFIG_INCLUDE_DIR
+
+ GTK2_GLIBMM_INCLUDE_DIR
+ GTK2_GLIBMMCONFIG_INCLUDE_DIR
+ GTK2_GLIBMM_LIBRARY
+
+ GTK2_GDKMM_INCLUDE_DIR
+ GTK2_GDKMMCONFIG_INCLUDE_DIR
+ GTK2_GDKMM_LIBRARY
+ )
+ elseif(_GTK2_component STREQUAL "glade")
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glade library was not found."
+ GTK2_GLADE_LIBRARY
+ GTK2_GLADE_INCLUDE_DIR
+ )
+ elseif(_GTK2_component STREQUAL "glademm")
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glademm library was not found."
+ GTK2_GLADEMM_LIBRARY
+ GTK2_GLADEMM_INCLUDE_DIR
+ GTK2_GLADEMMCONFIG_INCLUDE_DIR
+ )
+ endif()
+
+ if(NOT GTK2_${_COMPONENT_UPPER}_FOUND)
+ set(_GTK2_did_we_find_everything false)
+ endif()
+endforeach()
+
+if(_GTK2_did_we_find_everything AND NOT GTK2_VERSION_CHECK_FAILED)
+ set(GTK2_FOUND true)
+else()
+ # Unset our variables.
+ set(GTK2_FOUND false)
+ set(GTK2_VERSION)
+ set(GTK2_VERSION_MAJOR)
+ set(GTK2_VERSION_MINOR)
+ set(GTK2_VERSION_PATCH)
+ set(GTK2_INCLUDE_DIRS)
+ set(GTK2_LIBRARIES)
+endif()
+
+if(GTK2_INCLUDE_DIRS)
+ list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS)
+endif()
+
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
new file mode 100644
index 000000000..6cffb5c59
--- /dev/null
+++ b/Modules/FindGTest.cmake
@@ -0,0 +1,158 @@
+# Locate the Google C++ Testing Framework.
+#
+# Defines the following variables:
+#
+# GTEST_FOUND - Found the Google Testing framework
+# GTEST_INCLUDE_DIRS - Include directories
+#
+# Also defines the library variables below as normal
+# variables. These contain debug/optimized keywords when
+# a debugging library is found.
+#
+# GTEST_BOTH_LIBRARIES - Both libgtest & libgtest-main
+# GTEST_LIBRARIES - libgtest
+# GTEST_MAIN_LIBRARIES - libgtest-main
+#
+# Accepts the following variables as input:
+#
+# GTEST_ROOT - (as a CMake or environment variable)
+# The root directory of the gtest install prefix
+#
+# 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)
+# include_directories(${GTEST_INCLUDE_DIRS})
+#
+# add_executable(foo foo.cc)
+# target_link_libraries(foo ${GTEST_BOTH_LIBRARIES})
+#
+# add_test(AllTestsInFoo foo)
+#
+#-----------------------
+#
+# 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.
+#
+# 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.
+#
+# Example:
+# set(FooTestArgs --foo 1 --bar 2)
+# add_executable(FooTest FooUnitTest.cc)
+# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" FooUnitTest.cc)
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2009 Philip Lowman <philip@yhbt.com>
+# Copyright 2009 Daniel Blezek <blezek@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.)
+#
+# Thanks to Daniel Blezek <blezek@gmail.com> for the GTEST_ADD_TESTS code
+
+function(GTEST_ADD_TESTS executable extra_args)
+ if(NOT ARGN)
+ message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
+ endif()
+ foreach(source ${ARGN})
+ file(READ "${source}" contents)
+ string(REGEX MATCHALL "TEST_?F?\\(([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})
+ endforeach()
+ endforeach()
+endfunction()
+
+function(_gtest_append_debugs _endvar _library)
+ if(${_library} AND ${_library}_DEBUG)
+ set(_output optimized ${${_library}} debug ${${_library}_DEBUG})
+ else()
+ set(_output ${${_library}})
+ endif()
+ set(${_endvar} ${_output} PARENT_SCOPE)
+endfunction()
+
+function(_gtest_find_library _name)
+ find_library(${_name}
+ NAMES ${ARGN}
+ HINTS
+ $ENV{GTEST_ROOT}
+ ${GTEST_ROOT}
+ PATH_SUFFIXES ${_gtest_libpath_suffixes}
+ )
+ mark_as_advanced(${_name})
+endfunction()
+
+#
+
+if(NOT DEFINED GTEST_MSVC_SEARCH)
+ set(GTEST_MSVC_SEARCH MD)
+endif()
+
+set(_gtest_libpath_suffixes lib)
+if(MSVC)
+ if(GTEST_MSVC_SEARCH STREQUAL "MD")
+ list(APPEND _gtest_libpath_suffixes
+ msvc/gtest-md/Debug
+ msvc/gtest-md/Release)
+ elseif(GTEST_MSVC_SEARCH STREQUAL "MT")
+ list(APPEND _gtest_libpath_suffixes
+ msvc/gtest/Debug
+ msvc/gtest/Release)
+ endif()
+endif()
+
+
+find_path(GTEST_INCLUDE_DIR gtest/gtest.h
+ HINTS
+ $ENV{GTEST_ROOT}/include
+ ${GTEST_ROOT}/include
+)
+mark_as_advanced(GTEST_INCLUDE_DIR)
+
+if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD")
+ # The provided /MD project files for Google Test add -md suffixes to the
+ # library names.
+ _gtest_find_library(GTEST_LIBRARY gtest-md gtest)
+ _gtest_find_library(GTEST_LIBRARY_DEBUG gtest-mdd gtestd)
+ _gtest_find_library(GTEST_MAIN_LIBRARY gtest_main-md gtest_main)
+ _gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind)
+else()
+ _gtest_find_library(GTEST_LIBRARY gtest)
+ _gtest_find_library(GTEST_LIBRARY_DEBUG gtestd)
+ _gtest_find_library(GTEST_MAIN_LIBRARY gtest_main)
+ _gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind)
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
+
+if(GTEST_FOUND)
+ set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
+ _gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY)
+ _gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY)
+ set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
+endif()
+
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake
new file mode 100644
index 000000000..6dbc02618
--- /dev/null
+++ b/Modules/FindGettext.cmake
@@ -0,0 +1,220 @@
+# - Find GNU gettext tools
+# This module looks for the GNU gettext tools. This module defines the
+# following values:
+# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
+# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
+# GETTEXT_FOUND: True if gettext has been found.
+# GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8)
+#
+# Additionally it provides the following macros:
+# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
+# This will create a target "translations" which will convert the
+# given input po files into the binary output mo file. If the
+# ALL option is used, the translations will also be created when
+# building the default target.
+# GETTEXT_PROCESS_POT( <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".
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+# Copyright 2007 Alexander Neundorf <neundorf@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.)
+
+FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
+
+FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
+
+IF(GETTEXT_MSGMERGE_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version
+ 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}")
+ ENDIF()
+ UNSET(gettext_version)
+ENDIF(GETTEXT_MSGMERGE_EXECUTABLE)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext
+ REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE
+ VERSION_VAR GETTEXT_VERSION_STRING)
+
+INCLUDE(CMakeParseArguments)
+
+FUNCTION(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name)
+ SET(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}")
+ GET_PROPERTY(currentCounter GLOBAL PROPERTY "${propertyName}")
+ IF(NOT currentCounter)
+ SET(currentCounter 1)
+ ENDIF()
+ SET(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE)
+ MATH(EXPR currentCounter "${currentCounter} + 1")
+ SET_PROPERTY(GLOBAL PROPERTY ${propertyName} ${currentCounter} )
+ENDFUNCTION()
+
+MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
+ # make it a real variable, so we can modify it here
+ SET(_firstPoFile "${_firstPoFileArg}")
+
+ SET(_gmoFiles)
+ GET_FILENAME_COMPONENT(_potName ${_potFile} NAME)
+ STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
+ GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
+
+ SET(_addToAll)
+ IF(${_firstPoFile} STREQUAL "ALL")
+ SET(_addToAll "ALL")
+ SET(_firstPoFile)
+ ENDIF(${_firstPoFile} STREQUAL "ALL")
+
+ FOREACH (_currentPoFile ${_firstPoFile} ${ARGN})
+ GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE)
+ GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH)
+ GET_FILENAME_COMPONENT(_lang ${_absFile} NAME_WE)
+ SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${_gmoFile}
+ COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
+ DEPENDS ${_absPotFile} ${_absFile}
+ )
+
+ INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
+ SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
+
+ ENDFOREACH (_currentPoFile )
+
+ IF(NOT TARGET translations)
+ ADD_CUSTOM_TARGET(translations)
+ ENDIF()
+
+ _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName)
+
+ ADD_CUSTOM_TARGET(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles})
+
+ ADD_DEPENDENCIES(translations ${uniqueTargetName})
+
+ENDMACRO(GETTEXT_CREATE_TRANSLATIONS )
+
+
+FUNCTION(GETTEXT_PROCESS_POT_FILE _potFile)
+ SET(_gmoFiles)
+ SET(_options ALL)
+ SET(_oneValueArgs INSTALL_DESTINATION)
+ SET(_multiValueArgs LANGUAGES)
+
+ CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
+
+ GET_FILENAME_COMPONENT(_potName ${_potFile} NAME)
+ STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
+ GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
+
+ FOREACH (_lang ${_parsedArguments_LANGUAGES})
+ SET(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po")
+ SET(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo")
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${_poFile}"
+ COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile}
+ DEPENDS ${_absPotFile}
+ )
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${_gmoFile}"
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile}
+ DEPENDS ${_absPotFile} ${_poFile}
+ )
+
+ IF(_parsedArguments_INSTALL_DESTINATION)
+ INSTALL(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
+ ENDIF(_parsedArguments_INSTALL_DESTINATION)
+ LIST(APPEND _gmoFiles ${_gmoFile})
+ ENDFOREACH (_lang )
+
+ IF(NOT TARGET potfiles)
+ ADD_CUSTOM_TARGET(potfiles)
+ ENDIF()
+
+ _GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName)
+
+ IF(_parsedArguments_ALL)
+ ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
+ ELSE(_parsedArguments_ALL)
+ ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles})
+ ENDIF(_parsedArguments_ALL)
+
+ ADD_DEPENDENCIES(potfiles ${uniqueTargetName})
+
+ENDFUNCTION(GETTEXT_PROCESS_POT_FILE)
+
+
+FUNCTION(GETTEXT_PROCESS_PO_FILES _lang)
+ SET(_options ALL)
+ SET(_oneValueArgs INSTALL_DESTINATION)
+ SET(_multiValueArgs PO_FILES)
+ SET(_gmoFiles)
+
+ CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
+
+ FOREACH(_current_PO_FILE ${_parsedArguments_PO_FILES})
+ GET_FILENAME_COMPONENT(_name ${_current_PO_FILE} NAME)
+ STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name})
+ SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo)
+ ADD_CUSTOM_COMMAND(OUTPUT ${_gmoFile}
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ DEPENDS ${_current_PO_FILE}
+ )
+
+ IF(_parsedArguments_INSTALL_DESTINATION)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo)
+ ENDIF(_parsedArguments_INSTALL_DESTINATION)
+ LIST(APPEND _gmoFiles ${_gmoFile})
+ ENDFOREACH(_current_PO_FILE)
+
+
+ IF(NOT TARGET pofiles)
+ ADD_CUSTOM_TARGET(pofiles)
+ ENDIF()
+
+ _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName)
+
+ IF(_parsedArguments_ALL)
+ ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
+ ELSE(_parsedArguments_ALL)
+ ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles})
+ ENDIF(_parsedArguments_ALL)
+
+ ADD_DEPENDENCIES(pofiles ${uniqueTargetName})
+
+ENDFUNCTION(GETTEXT_PROCESS_PO_FILES)
+
+IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
+ SET(GETTEXT_FOUND TRUE)
+ELSE (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
+ SET(GETTEXT_FOUND FALSE)
+ IF (GetText_REQUIRED)
+ MESSAGE(FATAL_ERROR "GetText not found")
+ ENDIF (GetText_REQUIRED)
+ENDIF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
new file mode 100644
index 000000000..f89d1afa3
--- /dev/null
+++ b/Modules/FindGit.cmake
@@ -0,0 +1,62 @@
+# 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)
+# Example usage:
+# find_package(Git)
+# if(GIT_FOUND)
+# message("git found: ${GIT_EXECUTABLE}")
+# endif()
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+# Copyright 2012 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.)
+
+# Look for 'git' or 'eg' (easy git)
+#
+set(git_names git eg)
+
+# Prefer .cmd variants on Windows unless running in a Makefile
+# in the MSYS shell.
+#
+if(WIN32)
+ if(NOT CMAKE_GENERATOR MATCHES "MSYS")
+ set(git_names git.cmd git eg.cmd eg)
+ endif()
+endif()
+
+find_program(GIT_EXECUTABLE
+ NAMES ${git_names}
+ PATH_SUFFIXES Git/cmd Git/bin
+ DOC "git command line client"
+ )
+mark_as_advanced(GIT_EXECUTABLE)
+
+if(GIT_EXECUTABLE)
+ execute_process(COMMAND ${GIT_EXECUTABLE} --version
+ OUTPUT_VARIABLE git_version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (git_version MATCHES "^git version [0-9]")
+ string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
+ endif()
+ unset(git_version)
+endif(GIT_EXECUTABLE)
+
+# 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)
+find_package_handle_standard_args(Git
+ REQUIRED_VARS GIT_EXECUTABLE
+ VERSION_VAR GIT_VERSION_STRING)
diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake
new file mode 100644
index 000000000..02f29648a
--- /dev/null
+++ b/Modules/FindGnuTLS.cmake
@@ -0,0 +1,69 @@
+# - 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
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2009 Philip Lowman <philip@yhbt.com>
+# Copyright 2009 Brad Hards <bradh@kde.org>
+# Copyright 2006 Alexander Neundorf <neundorf@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.)
+
+# Note that this doesn't try to find the gnutls-extra package.
+
+
+IF (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY)
+ # in cache already
+ SET(gnutls_FIND_QUIETLY TRUE)
+ENDIF (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY)
+
+IF (NOT WIN32)
+ # try using pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ # also fills in GNUTLS_DEFINITIONS, although that isn't normally useful
+ FIND_PACKAGE(PkgConfig QUIET)
+ PKG_CHECK_MODULES(PC_GNUTLS QUIET gnutls)
+ SET(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER})
+ SET(GNUTLS_VERSION_STRING ${PC_GNUTLS_VERSION})
+ENDIF (NOT WIN32)
+
+FIND_PATH(GNUTLS_INCLUDE_DIR gnutls/gnutls.h
+ HINTS
+ ${PC_GNUTLS_INCLUDEDIR}
+ ${PC_GNUTLS_INCLUDE_DIRS}
+ )
+
+FIND_LIBRARY(GNUTLS_LIBRARY NAMES gnutls libgnutls
+ HINTS
+ ${PC_GNUTLS_LIBDIR}
+ ${PC_GNUTLS_LIBRARY_DIRS}
+ )
+
+MARK_AS_ADVANCED(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
+
+# handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS
+ REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR
+ VERSION_VAR GNUTLS_VERSION_STRING)
+
+IF(GNUTLS_FOUND)
+ SET(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY})
+ SET(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR})
+ENDIF()
+
diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake
new file mode 100644
index 000000000..b8dc3f49a
--- /dev/null
+++ b/Modules/FindGnuplot.cmake
@@ -0,0 +1,57 @@
+# - this module looks for gnuplot
+#
+# Once done this will define
+#
+# GNUPLOT_FOUND - system has Gnuplot
+# GNUPLOT_EXECUTABLE - the Gnuplot executable
+# GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8)
+#
+# GNUPLOT_VERSION_STRING will not work for old versions like 3.7.1.
+
+#=============================================================================
+# 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.)
+
+INCLUDE(FindCygwin)
+
+FIND_PROGRAM(GNUPLOT_EXECUTABLE
+ NAMES
+ gnuplot
+ pgnuplot
+ wgnupl32
+ PATHS
+ ${CYGWIN_INSTALL_PATH}/bin
+)
+
+IF (GNUPLOT_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND "${GNUPLOT_EXECUTABLE}" --version
+ OUTPUT_VARIABLE GNUPLOT_OUTPUT_VARIABLE
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ STRING(REGEX REPLACE "^gnuplot ([0-9\\.]+)( patchlevel )?" "\\1." GNUPLOT_VERSION_STRING "${GNUPLOT_OUTPUT_VARIABLE}")
+ STRING(REGEX REPLACE "\\.$" "" GNUPLOT_VERSION_STRING "${GNUPLOT_VERSION_STRING}")
+ UNSET(GNUPLOT_OUTPUT_VARIABLE)
+ENDIF()
+
+# for compatibility
+SET(GNUPLOT ${GNUPLOT_EXECUTABLE})
+
+# handle the QUIETLY and REQUIRED arguments and set GNUPLOT_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot
+ REQUIRED_VARS GNUPLOT_EXECUTABLE
+ VERSION_VAR GNUPLOT_VERSION_STRING)
+
+MARK_AS_ADVANCED( GNUPLOT_EXECUTABLE )
+
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
new file mode 100644
index 000000000..bc606389b
--- /dev/null
+++ b/Modules/FindHDF5.cmake
@@ -0,0 +1,385 @@
+# - Find HDF5, a library for reading and writing self describing array data.
+#
+# This module invokes the HDF5 wrapper compiler that should be installed
+# alongside HDF5. Depending upon the HDF5 Configuration, the wrapper compiler
+# is called either h5cc or h5pcc. If this succeeds, the module will then call
+# the compiler with the -show argument to see what flags are used when compiling
+# an HDF5 client application.
+#
+# The module will optionally accept the COMPONENTS argument. If no COMPONENTS
+# are specified, then the find module will default to finding only the HDF5 C
+# library. If one or more COMPONENTS are specified, the module will attempt to
+# find the language bindings for the specified components. The only valid
+# components are C, CXX, Fortran, HL, and Fortran_HL. If the COMPONENTS
+# argument is not given, the module will attempt to find only the C bindings.
+#
+# 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.
+#
+# 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
+
+#=============================================================================
+# 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 module is maintained by Will Dicharry <wdicharry@stellarscience.com>.
+
+include(SelectLibraryConfigurations)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+# List of the valid HDF5 components
+set( HDF5_VALID_COMPONENTS
+ C
+ CXX
+ Fortran
+ HL
+ Fortran_HL
+)
+
+# Validate the list of find components.
+if( NOT HDF5_FIND_COMPONENTS )
+ set( HDF5_LANGUAGE_BINDINGS "C" )
+else()
+ # add the extra specified components, ensuring that they are valid.
+ foreach( component ${HDF5_FIND_COMPONENTS} )
+ list( FIND HDF5_VALID_COMPONENTS ${component} component_location )
+ if( ${component_location} EQUAL -1 )
+ message( FATAL_ERROR
+ "\"${component}\" is not a valid HDF5 component." )
+ else()
+ list( APPEND HDF5_LANGUAGE_BINDINGS ${component} )
+ endif()
+ endforeach()
+endif()
+
+# try to find the HDF5 wrapper compilers
+find_program( HDF5_C_COMPILER_EXECUTABLE
+ NAMES h5cc h5pcc
+ 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++
+ 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
+ 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 )
+
+find_program( HDF5_DIFF_EXECUTABLE
+ NAMES h5diff
+ HINTS ENV HDF5_ROOT
+ PATH_SUFFIXES bin Bin
+ DOC "HDF5 file differencing tool." )
+mark_as_advanced( HDF5_DIFF_EXECUTABLE )
+
+# Invoke the HDF5 wrapper compiler. The compiler return value is stored to the
+# return_value argument, the text output is stored to the output variable.
+macro( _HDF5_invoke_compiler language output return_value )
+ if( HDF5_${language}_COMPILER_EXECUTABLE )
+ exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE}
+ ARGS -show
+ OUTPUT_VARIABLE ${output}
+ RETURN_VALUE ${return_value}
+ )
+ if( ${${return_value}} EQUAL 0 )
+ # do nothing
+ else()
+ message( STATUS
+ "Unable to determine HDF5 ${language} flags from HDF5 wrapper." )
+ endif()
+ endif()
+endmacro()
+
+# Parse a compile line for definitions, includes, library paths, and libraries.
+macro( _HDF5_parse_compile_line
+ compile_line_var
+ include_paths
+ definitions
+ library_paths
+ libraries )
+
+ # Match the include paths
+ string( REGEX MATCHALL "-I([^\" ]+)" include_path_flags
+ "${${compile_line_var}}"
+ )
+ foreach( IPATH ${include_path_flags} )
+ string( REGEX REPLACE "^-I" "" IPATH ${IPATH} )
+ string( REGEX REPLACE "//" "/" IPATH ${IPATH} )
+ list( APPEND ${include_paths} ${IPATH} )
+ endforeach()
+
+ # Match the definitions
+ string( REGEX MATCHALL "-D[^ ]*" definition_flags "${${compile_line_var}}" )
+ foreach( DEF ${definition_flags} )
+ list( APPEND ${definitions} ${DEF} )
+ endforeach()
+
+ # Match the library paths
+ string( REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" library_path_flags
+ "${${compile_line_var}}"
+ )
+
+ foreach( LPATH ${library_path_flags} )
+ string( REGEX REPLACE "^-L" "" LPATH ${LPATH} )
+ string( REGEX REPLACE "//" "/" LPATH ${LPATH} )
+ list( APPEND ${library_paths} ${LPATH} )
+ endforeach()
+
+ # now search for the library names specified in the compile line (match -l...)
+ # match only -l's preceded by a space or comma
+ # this is to exclude directory names like xxx-linux/
+ string( REGEX MATCHALL "[, ]-l([^\", ]+)" library_name_flags
+ "${${compile_line_var}}" )
+ # strip the -l from all of the library flags and add to the search list
+ foreach( LIB ${library_name_flags} )
+ string( REGEX REPLACE "^[, ]-l" "" LIB ${LIB} )
+ list( APPEND ${libraries} ${LIB} )
+ endforeach()
+endmacro()
+
+# Try to find HDF5 using an installed hdf5-config.cmake
+if( NOT HDF5_FOUND )
+ find_package( HDF5 QUIET NO_MODULE )
+ if( HDF5_FOUND )
+ set( HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR} )
+ set( HDF5_LIBRARIES )
+ set( HDF5_C_TARGET hdf5 )
+ set( HDF5_CXX_TARGET hdf5_cpp )
+ set( HDF5_HL_TARGET hdf5_hl )
+ set( HDF5_Fortran_TARGET hdf5_fortran )
+ set( HDF5_Fortran_HL_TARGET hdf5_hl_fortran )
+ foreach( _component ${HDF5_LANGUAGE_BINDINGS} )
+ list( FIND HDF5_VALID_COMPONENTS ${_component} _component_location )
+ get_target_property( _comp_location ${HDF5_${_component}_TARGET} LOCATION )
+ if( _comp_location )
+ set( HDF5_${_component}_LIBRARY ${_comp_location} CACHE PATH
+ "HDF5 ${_component} library" )
+ mark_as_advanced( HDF5_${_component}_LIBRARY )
+ list( APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY} )
+ endif()
+ endforeach()
+ endif()
+endif()
+
+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 )
+
+ # seed the initial lists of libraries to find with items we know we need
+ set( HDF5_C_LIBRARY_NAMES_INIT hdf5 )
+ set( HDF5_HL_LIBRARY_NAMES_INIT hdf5_hl ${HDF5_C_LIBRARY_NAMES_INIT} )
+ 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
+ ${HDF5_Fortran_LIBRARY_NAMES_INIT} )
+
+ foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} )
+ if( HDF5_${LANGUAGE}_COMPILE_LINE )
+ _HDF5_parse_compile_line( HDF5_${LANGUAGE}_COMPILE_LINE
+ HDF5_${LANGUAGE}_INCLUDE_FLAGS
+ HDF5_${LANGUAGE}_DEFINITIONS
+ HDF5_${LANGUAGE}_LIBRARY_DIRS
+ HDF5_${LANGUAGE}_LIBRARY_NAMES
+ )
+
+ # take a guess that the includes may be in the 'include' sibling
+ # directory of a library directory.
+ foreach( dir ${HDF5_${LANGUAGE}_LIBRARY_DIRS} )
+ list( APPEND HDF5_${LANGUAGE}_INCLUDE_FLAGS ${dir}/../include )
+ endforeach()
+ endif()
+
+ # set the definitions for the language bindings.
+ list( APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS} )
+
+ # find the HDF5 include directories
+ if(${LANGUAGE} MATCHES "Fortran.*")
+ set(HDF5_INCLUDE_FILENAME hdf5.mod)
+ else()
+ set(HDF5_INCLUDE_FILENAME hdf5.h)
+ endif()
+
+ find_path( HDF5_${LANGUAGE}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME}
+ HINTS
+ ${HDF5_${LANGUAGE}_INCLUDE_FLAGS}
+ ENV
+ HDF5_ROOT
+ PATHS
+ $ENV{HOME}/.local/include
+ PATH_SUFFIXES
+ include
+ Include
+ )
+ mark_as_advanced( HDF5_${LANGUAGE}_INCLUDE_DIR )
+ list( APPEND HDF5_INCLUDE_DIRS ${HDF5_${LANGUAGE}_INCLUDE_DIR} )
+
+ set( HDF5_${LANGUAGE}_LIBRARY_NAMES
+ ${HDF5_${LANGUAGE}_LIBRARY_NAMES_INIT}
+ ${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
+
+ # find the HDF5 libraries
+ foreach( LIB ${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
+ 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
+ # 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 )
+ set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} )
+ else()
+ set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d )
+ set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} )
+ endif()
+ find_library( HDF5_${LIB}_LIBRARY_DEBUG
+ NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
+ HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS}
+ ENV HDF5_ROOT
+ PATH_SUFFIXES lib Lib )
+ find_library( HDF5_${LIB}_LIBRARY_RELEASE
+ NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
+ HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS}
+ ENV HDF5_ROOT
+ PATH_SUFFIXES lib Lib )
+ select_library_configurations( HDF5_${LIB} )
+ # even though we adjusted the individual library names in
+ # select_library_configurations, we still need to distinguish
+ # between debug and release variants because HDF5_LIBRARIES will
+ # need to specify different lists for debug and optimized builds.
+ # We can't just use the HDF5_${LIB}_LIBRARY variable (which was set
+ # up by the selection macro above) because it may specify debug and
+ # optimized variants for a particular library, but a list of
+ # libraries is allowed to specify debug and optimized only once.
+ list( APPEND HDF5_${LANGUAGE}_LIBRARIES_DEBUG
+ ${HDF5_${LIB}_LIBRARY_DEBUG} )
+ list( APPEND HDF5_${LANGUAGE}_LIBRARIES_RELEASE
+ ${HDF5_${LIB}_LIBRARY_RELEASE} )
+ endforeach()
+ list( APPEND HDF5_LIBRARY_DIRS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} )
+
+ # Append the libraries for this language binding to the list of all
+ # required libraries.
+ list( APPEND HDF5_LIBRARIES_DEBUG
+ ${HDF5_${LANGUAGE}_LIBRARIES_DEBUG} )
+ list( APPEND HDF5_LIBRARIES_RELEASE
+ ${HDF5_${LANGUAGE}_LIBRARIES_RELEASE} )
+ endforeach()
+
+ # We may have picked up some duplicates in various lists during the above
+ # process for the language bindings (both the C and C++ bindings depend on
+ # libz for example). Remove the duplicates. It appears that the default
+ # CMake behavior is to remove duplicates from the end of a list. However,
+ # for link lines, this is incorrect since unresolved symbols are searched
+ # for down the link line. Therefore, we reverse the list, remove the
+ # duplicates, and then reverse it again to get the duplicates removed from
+ # the beginning.
+ macro( _remove_duplicates_from_beginning _list_name )
+ list( REVERSE ${_list_name} )
+ list( REMOVE_DUPLICATES ${_list_name} )
+ list( REVERSE ${_list_name} )
+ endmacro()
+
+ if( HDF5_INCLUDE_DIRS )
+ _remove_duplicates_from_beginning( HDF5_INCLUDE_DIRS )
+ endif()
+ if( HDF5_LIBRARIES_DEBUG )
+ _remove_duplicates_from_beginning( HDF5_LIBRARIES_DEBUG )
+ endif()
+ if( HDF5_LIBRARIES_RELEASE )
+ _remove_duplicates_from_beginning( HDF5_LIBRARIES_RELEASE )
+ endif()
+ if( HDF5_LIBRARY_DIRS )
+ _remove_duplicates_from_beginning( HDF5_LIBRARY_DIRS )
+ endif()
+
+ # Construct the complete list of HDF5 libraries with debug and optimized
+ # variants when the generator supports them.
+ if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ set( HDF5_LIBRARIES )
+ foreach( _lib ${HDF5_LIBRARIES_DEBUG} )
+ list( APPEND HDF5_LIBRARIES debug ${_lib} )
+ endforeach()
+ foreach( _lib ${HDF5_LIBRARIES_RELEASE} )
+ list( APPEND HDF5_LIBRARIES optimized ${_lib} )
+ endforeach()
+ else()
+ set( HDF5_LIBRARIES ${HDF5_LIBRARIES_RELEASE} )
+ endif()
+
+ # 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 )
+ foreach( _dir IN LISTS HDF5_INCLUDE_DIRS )
+ if( EXISTS "${_dir}/H5pubconf.h" )
+ file( STRINGS "${_dir}/H5pubconf.h"
+ HDF5_HAVE_PARALLEL_DEFINE
+ REGEX "HAVE_PARALLEL 1" )
+ if( HDF5_HAVE_PARALLEL_DEFINE )
+ set( HDF5_IS_PARALLEL TRUE )
+ endif()
+ endif()
+ endforeach()
+ set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL
+ "HDF5 library compiled with parallel IO support" )
+ mark_as_advanced( HDF5_IS_PARALLEL )
+
+ # For backwards compatibility we set HDF5_INCLUDE_DIR to the value of
+ # HDF5_INCLUDE_DIRS
+ if( HDF5_INCLUDE_DIRS )
+ set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" )
+ endif()
+
+endif()
+
+find_package_handle_standard_args( HDF5 DEFAULT_MSG
+ HDF5_LIBRARIES
+ HDF5_INCLUDE_DIRS
+)
+
diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake
new file mode 100644
index 000000000..ca5709b62
--- /dev/null
+++ b/Modules/FindHSPELL.cmake
@@ -0,0 +1,46 @@
+# - Try to find Hspell
+# Once done this will define
+#
+# HSPELL_FOUND - system has Hspell
+# HSPELL_INCLUDE_DIR - the Hspell include directory
+# HSPELL_LIBRARIES - The libraries needed to use Hspell
+# HSPELL_DEFINITIONS - Compiler switches required for using Hspell
+#
+# HSPELL_VERSION_STRING - The version of Hspell found (x.y)
+# HSPELL_MAJOR_VERSION - the major version of Hspell
+# HSPELL_MINOR_VERSION - The minor version of Hspell
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@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.)
+
+FIND_PATH(HSPELL_INCLUDE_DIR hspell.h)
+
+FIND_LIBRARY(HSPELL_LIBRARIES NAMES hspell)
+
+IF (HSPELL_INCLUDE_DIR)
+ FILE(READ "${HSPELL_INCLUDE_DIR}/hspell.h" HSPELL_H)
+ STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MAJOR ([0-9]+).*" "\\1" HSPELL_VERSION_MAJOR "${HSPELL_H}")
+ STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MINOR ([0-9]+).*" "\\1" HSPELL_VERSION_MINOR "${HSPELL_H}")
+ SET(HSPELL_VERSION_STRING "${HSPELL_VERSION_MAJOR}.${HSPELL_VERSION_MINOR}")
+ENDIF()
+
+# handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL
+ REQUIRED_VARS HSPELL_LIBRARIES HSPELL_INCLUDE_DIR
+ VERSION_VAR HSPELL_VERSION_STRING)
+
+MARK_AS_ADVANCED(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES)
+
diff --git a/Modules/FindHTMLHelp.cmake b/Modules/FindHTMLHelp.cmake
new file mode 100644
index 000000000..4455b0797
--- /dev/null
+++ b/Modules/FindHTMLHelp.cmake
@@ -0,0 +1,54 @@
+# - 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)
+#
+
+#=============================================================================
+# 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.)
+
+IF(WIN32)
+
+ FIND_PROGRAM(HTML_HELP_COMPILER
+ hhc
+ "[HKEY_CURRENT_USER\\Software\\Microsoft\\HTML Help Workshop;InstallDir]"
+ "$ENV{ProgramFiles}/HTML Help Workshop"
+ "C:/Program Files/HTML Help Workshop"
+ )
+
+ GET_FILENAME_COMPONENT(HTML_HELP_COMPILER_PATH "${HTML_HELP_COMPILER}" PATH)
+
+ FIND_PATH(HTML_HELP_INCLUDE_PATH
+ htmlhelp.h
+ "${HTML_HELP_COMPILER_PATH}/include"
+ "[HKEY_CURRENT_USER\\Software\\Microsoft\\HTML Help Workshop;InstallDir]/include"
+ "$ENV{ProgramFiles}/HTML Help Workshop/include"
+ "C:/Program Files/HTML Help Workshop/include"
+ )
+
+ FIND_LIBRARY(HTML_HELP_LIBRARY
+ htmlhelp
+ "${HTML_HELP_COMPILER_PATH}/lib"
+ "[HKEY_CURRENT_USER\\Software\\Microsoft\\HTML Help Workshop;InstallDir]/lib"
+ "$ENV{ProgramFiles}/HTML Help Workshop/lib"
+ "C:/Program Files/HTML Help Workshop/lib"
+ )
+
+ MARK_AS_ADVANCED(
+ HTML_HELP_COMPILER
+ HTML_HELP_INCLUDE_PATH
+ HTML_HELP_LIBRARY
+ )
+
+ENDIF(WIN32)
diff --git a/Modules/FindITK.cmake b/Modules/FindITK.cmake
new file mode 100644
index 000000000..a3ca99899
--- /dev/null
+++ b/Modules/FindITK.cmake
@@ -0,0 +1,57 @@
+# - 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
+# compatability. 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-compatability.
+ SET(USE_ITK_FILE ${ITK_USE_FILE})
+ENDIF()
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
new file mode 100644
index 000000000..f21b63008
--- /dev/null
+++ b/Modules/FindImageMagick.cmake
@@ -0,0 +1,237 @@
+# - Find the ImageMagick binary suite.
+# This module will search for a set of ImageMagick tools specified
+# as components in the FIND_PACKAGE call. Typical components include,
+# but are not limited to (future versions of ImageMagick might have
+# additional components not listed here):
+#
+# animate
+# compare
+# composite
+# conjure
+# convert
+# display
+# identify
+# import
+# mogrify
+# montage
+# stream
+#
+# If no component is specified in the FIND_PACKAGE call, then it only
+# searches for the ImageMagick executable directory. This code defines
+# the following variables:
+#
+# ImageMagick_FOUND - TRUE if all components are found.
+# ImageMagick_EXECUTABLE_DIR - Full path to executables directory.
+# ImageMagick_<component>_FOUND - TRUE if <component> is found.
+# ImageMagick_<component>_EXECUTABLE - Full path to <component> executable.
+# ImageMagick_VERSION_STRING - the version of ImageMagick found
+# (since CMake 2.8.8)
+#
+# ImageMagick_VERSION_STRING will not work for old versions like 5.2.3.
+#
+# There are also components for the following ImageMagick APIs:
+#
+# Magick++
+# MagickWand
+# MagickCore
+#
+# For these components the following variables are set:
+#
+# ImageMagick_FOUND - TRUE if all components are found.
+# ImageMagick_INCLUDE_DIRS - Full paths to all include dirs.
+# ImageMagick_LIBRARIES - Full paths to all libraries.
+# ImageMagick_<component>_FOUND - TRUE if <component> is found.
+# ImageMagick_<component>_INCLUDE_DIRS - Full path to <component> include dirs.
+# ImageMagick_<component>_LIBRARIES - Full path to <component> libraries.
+#
+# Example Usages:
+# FIND_PACKAGE(ImageMagick)
+# FIND_PACKAGE(ImageMagick COMPONENTS convert)
+# FIND_PACKAGE(ImageMagick COMPONENTS convert mogrify display)
+# FIND_PACKAGE(ImageMagick COMPONENTS Magick++)
+# FIND_PACKAGE(ImageMagick COMPONENTS Magick++ convert)
+#
+# Note that the standard FIND_PACKAGE features are supported
+# (i.e., QUIET, REQUIRED, etc.).
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+# Copyright 2007-2008 Miguel A. Figueroa-Villanueva <miguelf at ieee dot org>
+# Copyright 2012 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.)
+
+#---------------------------------------------------------------------
+# Helper functions
+#---------------------------------------------------------------------
+FUNCTION(FIND_IMAGEMAGICK_API component header)
+ SET(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE)
+
+ FIND_PATH(ImageMagick_${component}_INCLUDE_DIR
+ NAMES ${header}
+ PATHS
+ ${ImageMagick_INCLUDE_DIRS}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include"
+ PATH_SUFFIXES
+ ImageMagick
+ DOC "Path to the ImageMagick include dir."
+ )
+ FIND_LIBRARY(ImageMagick_${component}_LIBRARY
+ NAMES ${ARGN}
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib"
+ DOC "Path to the ImageMagick Magick++ library."
+ )
+
+ IF(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY)
+ SET(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE)
+
+ LIST(APPEND ImageMagick_INCLUDE_DIRS
+ ${ImageMagick_${component}_INCLUDE_DIR}
+ )
+ LIST(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS)
+ SET(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE)
+
+ LIST(APPEND ImageMagick_LIBRARIES
+ ${ImageMagick_${component}_LIBRARY}
+ )
+ SET(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES} PARENT_SCOPE)
+ ENDIF(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY)
+ENDFUNCTION(FIND_IMAGEMAGICK_API)
+
+FUNCTION(FIND_IMAGEMAGICK_EXE component)
+ SET(_IMAGEMAGICK_EXECUTABLE
+ ${ImageMagick_EXECUTABLE_DIR}/${component}${CMAKE_EXECUTABLE_SUFFIX})
+ IF(EXISTS ${_IMAGEMAGICK_EXECUTABLE})
+ SET(ImageMagick_${component}_EXECUTABLE
+ ${_IMAGEMAGICK_EXECUTABLE}
+ PARENT_SCOPE
+ )
+ SET(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE)
+ ELSE(EXISTS ${_IMAGEMAGICK_EXECUTABLE})
+ SET(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE)
+ ENDIF(EXISTS ${_IMAGEMAGICK_EXECUTABLE})
+ENDFUNCTION(FIND_IMAGEMAGICK_EXE)
+
+#---------------------------------------------------------------------
+# Start Actual Work
+#---------------------------------------------------------------------
+# Try to find a ImageMagick installation binary path.
+FIND_PATH(ImageMagick_EXECUTABLE_DIR
+ NAMES mogrify${CMAKE_EXECUTABLE_SUFFIX}
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]"
+ DOC "Path to the ImageMagick binary directory."
+ NO_DEFAULT_PATH
+ )
+FIND_PATH(ImageMagick_EXECUTABLE_DIR
+ NAMES mogrify${CMAKE_EXECUTABLE_SUFFIX}
+ )
+
+# Find each component. Search for all tools in same dir
+# <ImageMagick_EXECUTABLE_DIR>; otherwise they should be found
+# independently and not in a cohesive module such as this one.
+UNSET(ImageMagick_REQUIRED_VARS)
+UNSET(ImageMagick_DEFAULT_EXECUTABLES)
+FOREACH(component ${ImageMagick_FIND_COMPONENTS}
+ # DEPRECATED: forced components for backward compatibility
+ convert mogrify import montage composite
+ )
+ IF(component STREQUAL "Magick++")
+ FIND_IMAGEMAGICK_API(Magick++ Magick++.h
+ Magick++ CORE_RL_Magick++_
+ )
+ LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY)
+ ELSEIF(component STREQUAL "MagickWand")
+ FIND_IMAGEMAGICK_API(MagickWand wand/MagickWand.h
+ Wand MagickWand CORE_RL_wand_
+ )
+ LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY)
+ ELSEIF(component STREQUAL "MagickCore")
+ FIND_IMAGEMAGICK_API(MagickCore magick/MagickCore.h
+ Magick MagickCore CORE_RL_magick_
+ )
+ LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY)
+ ELSE(component STREQUAL "Magick++")
+ IF(ImageMagick_EXECUTABLE_DIR)
+ FIND_IMAGEMAGICK_EXE(${component})
+ ENDIF(ImageMagick_EXECUTABLE_DIR)
+
+ IF(ImageMagick_FIND_COMPONENTS)
+ LIST(FIND ImageMagick_FIND_COMPONENTS ${component} is_requested)
+ IF(is_requested GREATER -1)
+ LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_${component}_EXECUTABLE)
+ ENDIF(is_requested GREATER -1)
+ ELSEIF(ImageMagick_${component}_EXECUTABLE)
+ # if no components were requested explicitly put all (default) executables
+ # in the list
+ LIST(APPEND ImageMagick_DEFAULT_EXECUTABLES ImageMagick_${component}_EXECUTABLE)
+ ENDIF(ImageMagick_FIND_COMPONENTS)
+ ENDIF(component STREQUAL "Magick++")
+ENDFOREACH(component)
+
+IF(NOT ImageMagick_FIND_COMPONENTS AND NOT ImageMagick_DEFAULT_EXECUTABLES)
+ # No components were requested, and none of the default components were
+ # found. Just insert mogrify into the list of the default components to
+ # find so FPHSA below has something to check
+ LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_mogrify_EXECUTABLE)
+ELSEIF(ImageMagick_DEFAULT_EXECUTABLES)
+ LIST(APPEND ImageMagick_REQUIRED_VARS ${ImageMagick_DEFAULT_EXECUTABLES})
+ENDIF()
+
+SET(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS})
+SET(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES})
+
+IF(ImageMagick_mogrify_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${ImageMagick_mogrify_EXECUTABLE} -version
+ 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}")
+ ENDIF()
+ UNSET(imagemagick_version)
+ENDIF(ImageMagick_mogrify_EXECUTABLE)
+
+#---------------------------------------------------------------------
+# Standard Package Output
+#---------------------------------------------------------------------
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ImageMagick
+ REQUIRED_VARS ${ImageMagick_REQUIRED_VARS}
+ VERSION_VAR ImageMagick_VERSION_STRING
+ )
+# Maintain consistency with all other variables.
+SET(ImageMagick_FOUND ${IMAGEMAGICK_FOUND})
+
+#---------------------------------------------------------------------
+# DEPRECATED: Setting variables for backward compatibility.
+#---------------------------------------------------------------------
+SET(IMAGEMAGICK_BINARY_PATH ${ImageMagick_EXECUTABLE_DIR}
+ CACHE PATH "Path to the ImageMagick binary directory.")
+SET(IMAGEMAGICK_CONVERT_EXECUTABLE ${ImageMagick_convert_EXECUTABLE}
+ CACHE FILEPATH "Path to ImageMagick's convert executable.")
+SET(IMAGEMAGICK_MOGRIFY_EXECUTABLE ${ImageMagick_mogrify_EXECUTABLE}
+ CACHE FILEPATH "Path to ImageMagick's mogrify executable.")
+SET(IMAGEMAGICK_IMPORT_EXECUTABLE ${ImageMagick_import_EXECUTABLE}
+ CACHE FILEPATH "Path to ImageMagick's import executable.")
+SET(IMAGEMAGICK_MONTAGE_EXECUTABLE ${ImageMagick_montage_EXECUTABLE}
+ CACHE FILEPATH "Path to ImageMagick's montage executable.")
+SET(IMAGEMAGICK_COMPOSITE_EXECUTABLE ${ImageMagick_composite_EXECUTABLE}
+ CACHE FILEPATH "Path to ImageMagick's composite executable.")
+MARK_AS_ADVANCED(
+ IMAGEMAGICK_BINARY_PATH
+ IMAGEMAGICK_CONVERT_EXECUTABLE
+ IMAGEMAGICK_MOGRIFY_EXECUTABLE
+ IMAGEMAGICK_IMPORT_EXECUTABLE
+ IMAGEMAGICK_MONTAGE_EXECUTABLE
+ IMAGEMAGICK_COMPOSITE_EXECUTABLE
+ )
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
new file mode 100644
index 000000000..d49b44a55
--- /dev/null
+++ b/Modules/FindJNI.cmake
@@ -0,0 +1,261 @@
+# - 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:
+#
+# 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.
+#
+# 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.)
+
+# Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var}
+MACRO(java_append_library_directories _var)
+ # Determine java arch-specific library subdir
+ # Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk
+ # 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")
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
+ SET(_java_libarch "i386")
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
+ SET(_java_libarch "alpha")
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+ # Subdir is "arm" for both big-endian (arm) and little-endian (armel).
+ SET(_java_libarch "arm")
+ 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")
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
+ SET(_java_libarch "ppc64")
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
+ SET(_java_libarch "ppc")
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
+ # Both flavours can run on the same processor
+ SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9")
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)")
+ SET(_java_libarch "parisc" "parisc64")
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
+ # s390 binaries can run on s390x machines
+ SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x")
+ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
+ SET(_java_libarch "sh")
+ ELSE(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}")
+ ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+
+ # Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or
+ # system is non-Linux (where the code above has not been well tested)
+ IF(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux"))
+ LIST(APPEND _java_libarch "i386" "amd64" "ppc")
+ ENDIF(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux"))
+
+ # Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer
+ # current value to a hardcoded list. Remove possible duplicates.
+ LIST(REMOVE_DUPLICATES _java_libarch)
+
+ FOREACH(_path ${ARGN})
+ IF(_path MATCHES "{libarch}")
+ FOREACH(_libarch ${_java_libarch})
+ STRING(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}")
+ LIST(APPEND ${_var} "${_newpath}")
+ ENDFOREACH(_libarch)
+ ELSE(_path MATCHES "{libarch}")
+ LIST(APPEND ${_var} "${_path}")
+ ENDIF(_path MATCHES "{libarch}")
+ ENDFOREACH(_path)
+ENDMACRO(java_append_library_directories)
+
+GET_FILENAME_COMPONENT(java_install_version
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME)
+
+SET(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
+ /usr/lib/java/jre/lib/{libarch}
+ /usr/lib/jvm/jre/lib/{libarch}
+ /usr/local/lib/java/jre/lib/{libarch}
+ /usr/local/share/java/jre/lib/{libarch}
+ /usr/lib/j2sdk1.4-sun/jre/lib/{libarch}
+ /usr/lib/j2sdk1.5-sun/jre/lib/{libarch}
+ /opt/sun-jdk-1.5.0.04/jre/lib/{libarch}
+ /usr/lib/jvm/java-6-sun/jre/lib/{libarch}
+ /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch}
+ /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex
+ /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch}
+ /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora
+ # Debian specific paths for default JVM
+ /usr/lib/jvm/default-java/jre/lib/{libarch}
+ /usr/lib/jvm/default-java/jre/lib
+ /usr/lib/jvm/default-java/lib
+ )
+
+SET(JAVA_JVM_LIBRARY_DIRECTORIES)
+FOREACH(dir ${JAVA_AWT_LIBRARY_DIRECTORIES})
+ SET(JAVA_JVM_LIBRARY_DIRECTORIES
+ ${JAVA_JVM_LIBRARY_DIRECTORIES}
+ "${dir}"
+ "${dir}/client"
+ "${dir}/server"
+ )
+ENDFOREACH(dir)
+
+
+SET(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
+ /usr/local/lib/java/include
+ /usr/lib/jvm/java/include
+ /usr/lib/jvm/java-6-sun/include
+ /usr/lib/jvm/java-1.5.0-sun/include
+ /usr/lib/jvm/java-6-sun-1.6.0.00/include # can this one be removed according to #8821 ? Alex
+ /usr/lib/jvm/java-6-openjdk/include
+ /usr/local/share/java/include
+ /usr/lib/j2sdk1.4-sun/include
+ /usr/lib/j2sdk1.5-sun/include
+ /opt/sun-jdk-1.5.0.04/include
+ # Debian specific path for default JVM
+ /usr/lib/jvm/default-java/include
+ )
+
+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}")
+ ENDIF(EXISTS ${jpath}/${JAVA_INC_PATH})
+ ENDFOREACH(JAVA_INC_PATH)
+ FOREACH(JAVA_LIB_PATH
+ ../lib ../jre/lib ../jre/lib/i386
+ ../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}")
+ ENDIF(EXISTS ${jpath}/${JAVA_LIB_PATH})
+ ENDFOREACH(JAVA_LIB_PATH)
+ENDFOREACH(JAVA_PROG)
+
+IF(APPLE)
+ IF(EXISTS ~/Library/Frameworks/JavaVM.framework)
+ SET(JAVA_HAVE_FRAMEWORK 1)
+ ENDIF(EXISTS ~/Library/Frameworks/JavaVM.framework)
+ IF(EXISTS /Library/Frameworks/JavaVM.framework)
+ SET(JAVA_HAVE_FRAMEWORK 1)
+ ENDIF(EXISTS /Library/Frameworks/JavaVM.framework)
+ IF(EXISTS /System/Library/Frameworks/JavaVM.framework)
+ SET(JAVA_HAVE_FRAMEWORK 1)
+ ENDIF(EXISTS /System/Library/Frameworks/JavaVM.framework)
+
+ IF(JAVA_HAVE_FRAMEWORK)
+ IF(NOT JAVA_AWT_LIBRARY)
+ SET (JAVA_AWT_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE)
+ ENDIF(NOT JAVA_AWT_LIBRARY)
+
+ IF(NOT JAVA_JVM_LIBRARY)
+ SET (JAVA_JVM_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE)
+ ENDIF(NOT JAVA_JVM_LIBRARY)
+
+ 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(EXISTS /System/Library/Frameworks/JavaVM.framework/Headers/jawt.h)
+ ENDIF(NOT JAVA_AWT_INCLUDE_PATH)
+
+ # 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}
+ )
+ ENDIF(JAVA_HAVE_FRAMEWORK)
+ELSE(APPLE)
+ FIND_LIBRARY(JAVA_AWT_LIBRARY jawt
+ PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
+ )
+ FIND_LIBRARY(JAVA_JVM_LIBRARY NAMES jvm JavaVM
+ PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES}
+ )
+ENDIF(APPLE)
+
+# add in the include path
+FIND_PATH(JAVA_INCLUDE_PATH jni.h
+ ${JAVA_AWT_INCLUDE_DIRECTORIES}
+)
+
+FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h
+ ${JAVA_INCLUDE_PATH}
+ ${JAVA_INCLUDE_PATH}/win32
+ ${JAVA_INCLUDE_PATH}/linux
+ ${JAVA_INCLUDE_PATH}/freebsd
+ ${JAVA_INCLUDE_PATH}/solaris
+ ${JAVA_INCLUDE_PATH}/hp-ux
+ ${JAVA_INCLUDE_PATH}/alpha
+)
+
+FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h
+ ${JAVA_INCLUDE_PATH}
+)
+
+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)
+
+MARK_AS_ADVANCED(
+ JAVA_AWT_LIBRARY
+ JAVA_JVM_LIBRARY
+ JAVA_AWT_INCLUDE_PATH
+ JAVA_INCLUDE_PATH
+ JAVA_INCLUDE_PATH2
+)
+
+SET(JNI_LIBRARIES
+ ${JAVA_AWT_LIBRARY}
+ ${JAVA_JVM_LIBRARY}
+)
+
+SET(JNI_INCLUDE_DIRS
+ ${JAVA_INCLUDE_PATH}
+ ${JAVA_INCLUDE_PATH2}
+ ${JAVA_AWT_INCLUDE_PATH}
+)
+
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
new file mode 100644
index 000000000..349e7e175
--- /dev/null
+++ b/Modules/FindJPEG.cmake
@@ -0,0 +1,43 @@
+# - 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.
+
+#=============================================================================
+# 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.)
+
+FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h)
+
+SET(JPEG_NAMES ${JPEG_NAMES} jpeg)
+FIND_LIBRARY(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
+
+# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR)
+
+IF(JPEG_FOUND)
+ SET(JPEG_LIBRARIES ${JPEG_LIBRARY})
+ENDIF(JPEG_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} )
+IF(JPEG_LIBRARY)
+ GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH)
+ENDIF(JPEG_LIBRARY)
+
+MARK_AS_ADVANCED(JPEG_LIBRARY JPEG_INCLUDE_DIR )
diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake
new file mode 100644
index 000000000..6dc7e4db7
--- /dev/null
+++ b/Modules/FindJasper.cmake
@@ -0,0 +1,53 @@
+# - 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)
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2012 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.)
+
+FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h)
+
+IF (NOT JASPER_LIBRARIES)
+ FIND_PACKAGE(JPEG)
+
+ FIND_LIBRARY(JASPER_LIBRARY_RELEASE NAMES jasper libjasper)
+ FIND_LIBRARY(JASPER_LIBRARY_DEBUG NAMES jasperd)
+
+ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ SELECT_LIBRARY_CONFIGURATIONS(JASPER)
+ENDIF (NOT JASPER_LIBRARIES)
+
+IF (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h")
+ FILE(STRINGS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*")
+
+ STRING(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}")
+ENDIF (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h")
+
+# handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper
+ REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES
+ VERSION_VAR JASPER_VERSION_STRING)
+
+IF (JASPER_FOUND)
+ SET(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} )
+ENDIF (JASPER_FOUND)
+
+MARK_AS_ADVANCED(JASPER_INCLUDE_DIR)
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
new file mode 100644
index 000000000..345702122
--- /dev/null
+++ b/Modules/FindJava.cmake
@@ -0,0 +1,204 @@
+# - 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)
+#
+# The minimum required version of Java can be specified using the
+# 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
+#
+# 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.
+#
+# Example Usages:
+# FIND_PACKAGE(Java)
+# FIND_PACKAGE(Java COMPONENTS Runtime)
+# FIND_PACKAGE(Java COMPONENTS Development)
+#
+
+#=============================================================================
+# Copyright 2002-2009 Kitware, Inc.
+# Copyright 2009-2011 Mathieu Malaterre <mathieu.malaterre@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.)
+
+# The HINTS option should only be used for values computed from the system.
+SET(_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"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/bin"
+ "[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.
+SET(_JAVA_PATHS
+ /usr/lib/java/bin
+ /usr/share/java/bin
+ /usr/local/java/bin
+ /usr/local/java/share/bin
+ /usr/java/j2sdk1.4.2_04
+ /usr/lib/j2sdk1.4-sun/bin
+ /usr/java/j2sdk1.4.2_09/bin
+ /usr/lib/j2sdk1.5-sun/bin
+ /opt/sun-jdk-1.5.0.04/bin
+ )
+FIND_PROGRAM(Java_JAVA_EXECUTABLE
+ NAMES java
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+IF(Java_JAVA_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${Java_JAVA_EXECUTABLE} -version
+ RESULT_VARIABLE res
+ OUTPUT_VARIABLE var
+ ERROR_VARIABLE var # sun-java output to stderr
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_STRIP_TRAILING_WHITESPACE)
+ IF( res )
+ IF(${Java_FIND_REQUIRED})
+ MESSAGE( FATAL_ERROR "Error executing java -version" )
+ ELSE()
+ MESSAGE( STATUS "Warning, could not run java --version")
+ ENDIF()
+ ELSE()
+ # extract major/minor version and patch level from "java -version" output
+ # Tested on linux using
+ # 1. Sun / Sun OEM
+ # 2. OpenJDK 1.6
+ # 3. GCJ 1.5
+ # 4. Kaffe 1.4.2
+ 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_]+\".*")
+ # Kaffe style
+ STRING( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*"
+ "\\1" Java_VERSION_STRING "${var}" )
+ ELSE()
+ IF(NOT Java_FIND_QUIETLY)
+ message(WARNING "regex not supported: ${var}. Please report")
+ ENDIF(NOT Java_FIND_QUIETLY)
+ ENDIF()
+ STRING( REGEX REPLACE "([0-9]+).*" "\\1" Java_VERSION_MAJOR "${Java_VERSION_STRING}" )
+ STRING( REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_MINOR "${Java_VERSION_STRING}" )
+ STRING( REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_PATCH "${Java_VERSION_STRING}" )
+ # warning tweak version can be empty:
+ STRING( REGEX REPLACE "[0-9]+\\.[0-9]+\\.[0-9]+[_\\.]?([0-9]*).*$" "\\1" Java_VERSION_TWEAK "${Java_VERSION_STRING}" )
+ if( Java_VERSION_TWEAK STREQUAL "" ) # check case where tweak is not defined
+ set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH})
+ else( )
+ set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}.${Java_VERSION_TWEAK})
+ endif( )
+ ENDIF()
+
+ENDIF(Java_JAVA_EXECUTABLE)
+
+
+FIND_PROGRAM(Java_JAR_EXECUTABLE
+ NAMES jar
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+FIND_PROGRAM(Java_JAVAC_EXECUTABLE
+ NAMES javac
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+FIND_PROGRAM(Java_JAVAH_EXECUTABLE
+ NAMES javah
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+FIND_PROGRAM(Java_JAVADOC_EXECUTABLE
+ NAMES javadoc
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+if(Java_FIND_COMPONENTS)
+ 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
+ )
+ 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
+ )
+ else()
+ message(FATAL_ERROR "Comp: ${component} is not handled")
+ endif()
+ set(Java_${component}_FOUND TRUE)
+ endforeach(component)
+else()
+ # Check for everything
+ 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
+ )
+endif()
+
+
+MARK_AS_ADVANCED(
+ Java_JAVA_EXECUTABLE
+ Java_JAR_EXECUTABLE
+ Java_JAVAC_EXECUTABLE
+ Java_JAVAH_EXECUTABLE
+ Java_JAVADOC_EXECUTABLE
+ )
+
+# LEGACY
+SET(JAVA_RUNTIME ${Java_JAVA_EXECUTABLE})
+SET(JAVA_ARCHIVE ${Java_JAR_EXECUTABLE})
+SET(JAVA_COMPILE ${Java_JAVAC_EXECUTABLE})
+
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake
new file mode 100644
index 000000000..9d1081405
--- /dev/null
+++ b/Modules/FindKDE3.cmake
@@ -0,0 +1,299 @@
+# - Find the KDE3 include and library dirs, KDE preprocessors and define a some macros
+#
+# This module defines the following variables:
+# KDE3_DEFINITIONS - compiler definitions required for compiling KDE software
+# KDE3_INCLUDE_DIR - the KDE include directory
+# KDE3_INCLUDE_DIRS - the KDE and the Qt include directory, for use with INCLUDE_DIRECTORIES()
+# KDE3_LIB_DIR - the directory where the KDE libraries are installed, for use with LINK_DIRECTORIES()
+# QT_AND_KDECORE_LIBS - this contains both the Qt and the kdecore library
+# KDE3_DCOPIDL_EXECUTABLE - the dcopidl executable
+# KDE3_DCOPIDL2CPP_EXECUTABLE - the dcopidl2cpp executable
+# KDE3_KCFGC_EXECUTABLE - the kconfig_compiler executable
+# KDE3_FOUND - set to TRUE if all of the above has been found
+#
+# The following user adjustable options are provided:
+#
+# KDE3_BUILD_TESTS - enable this to build KDE testcases
+#
+#
+# It also adds the following macros (from KDE3Macros.cmake)
+# SRCS_VAR is always the variable which contains the list of source files for your application or library.
+#
+# KDE3_AUTOMOC(file1 ... fileN)
+# Call this if you want to have automatic moc file handling.
+# This means if you include "foo.moc" in the source file foo.cpp
+# a moc file for the header foo.h will be created automatically.
+# You can set the property SKIP_AUTOMAKE using SET_SOURCE_FILES_PROPERTIES()
+# to exclude some files in the list from being processed.
+#
+# KDE3_ADD_MOC_FILES(SRCS_VAR file1 ... fileN )
+# If you don't use the KDE3_AUTOMOC() macro, for the files
+# listed here moc files will be created (named "foo.moc.cpp")
+#
+# KDE3_ADD_DCOP_SKELS(SRCS_VAR header1.h ... headerN.h )
+# Use this to generate DCOP skeletions from the listed headers.
+#
+# KDE3_ADD_DCOP_STUBS(SRCS_VAR header1.h ... headerN.h )
+# Use this to generate DCOP stubs from the listed headers.
+#
+# KDE3_ADD_UI_FILES(SRCS_VAR file1.ui ... fileN.ui )
+# Use this to add the Qt designer ui files to your application/library.
+#
+# KDE3_ADD_KCFG_FILES(SRCS_VAR file1.kcfgc ... fileN.kcfgc )
+# Use this to add KDE kconfig compiler files to your application/library.
+#
+# KDE3_INSTALL_LIBTOOL_FILE(target)
+# This will create and install a simple libtool file for the given target.
+#
+# KDE3_ADD_EXECUTABLE(name file1 ... fileN )
+# Currently identical to ADD_EXECUTABLE(), may provide some advanced features in the future.
+#
+# KDE3_ADD_KPART(name [WITH_PREFIX] file1 ... fileN )
+# Create a KDE plugin (KPart, kioslave, etc.) from the given source files.
+# If WITH_PREFIX is given, the resulting plugin will have the prefix "lib", otherwise it won't.
+# It creates and installs an appropriate libtool la-file.
+#
+# KDE3_ADD_KDEINIT_EXECUTABLE(name file1 ... fileN )
+# Create a KDE application in the form of a module loadable via kdeinit.
+# A library named kdeinit_<name> will be created and a small executable which links to it.
+#
+# The option KDE3_ENABLE_FINAL to enable all-in-one compilation is
+# no longer supported.
+#
+#
+# Author: Alexander Neundorf <neundorf@kde.org>
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@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.)
+
+IF(NOT UNIX AND KDE3_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported")
+ENDIF(NOT UNIX AND KDE3_FIND_REQUIRED)
+
+# If Qt4 has already been found, fail.
+IF(QT4_FOUND)
+ IF(KDE3_FIND_REQUIRED)
+ MESSAGE( FATAL_ERROR "KDE3/Qt3 and Qt4 cannot be used together in one project.")
+ ELSE(KDE3_FIND_REQUIRED)
+ IF(NOT KDE3_FIND_QUIETLY)
+ MESSAGE( STATUS "KDE3/Qt3 and Qt4 cannot be used together in one project.")
+ ENDIF(NOT KDE3_FIND_QUIETLY)
+ RETURN()
+ ENDIF(KDE3_FIND_REQUIRED)
+ENDIF(QT4_FOUND)
+
+
+SET(QT_MT_REQUIRED TRUE)
+#SET(QT_MIN_VERSION "3.0.0")
+
+#this line includes FindQt.cmake, which searches the Qt library and headers
+IF(KDE3_FIND_REQUIRED)
+ SET(_REQ_STRING_KDE3 "REQUIRED")
+ENDIF(KDE3_FIND_REQUIRED)
+
+FIND_PACKAGE(Qt3 ${_REQ_STRING_KDE3})
+FIND_PACKAGE(X11 ${_REQ_STRING_KDE3})
+
+
+#now try to find some kde stuff
+FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES kde-config
+ HINTS
+ $ENV{KDEDIR}/bin
+ PATHS
+ /opt/kde3/bin
+ /opt/kde/bin
+ )
+
+SET(KDE3PREFIX)
+IF(KDECONFIG_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --version
+ OUTPUT_VARIABLE kde_config_version )
+
+ STRING(REGEX MATCH "KDE: .\\." kde_version "${kde_config_version}")
+ IF ("${kde_version}" MATCHES "KDE: 3\\.")
+ EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --prefix
+ OUTPUT_VARIABLE kdedir )
+ STRING(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}")
+
+ ENDIF ("${kde_version}" MATCHES "KDE: 3\\.")
+ENDIF(KDECONFIG_EXECUTABLE)
+
+
+
+# at first the KDE include direcory
+# kpassdlg.h comes from kdeui and doesn't exist in KDE4 anymore
+FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h
+ HINTS
+ $ENV{KDEDIR}/include
+ ${KDE3PREFIX}/include
+ PATHS
+ /opt/kde3/include
+ /opt/kde/include
+ /usr/include/kde
+ /usr/local/include/kde
+ )
+
+#now the KDE library directory
+FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore
+ HINTS
+ $ENV{KDEDIR}/lib
+ ${KDE3PREFIX}/lib
+ PATHS
+ /opt/kde3/lib
+ /opt/kde/lib
+)
+
+SET(QT_AND_KDECORE_LIBS ${QT_LIBRARIES} ${KDE3_KDECORE_LIBRARY})
+
+GET_FILENAME_COMPONENT(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH )
+
+IF(NOT KDE3_LIBTOOL_DIR)
+ IF(KDE3_KDECORE_LIBRARY MATCHES lib64)
+ SET(KDE3_LIBTOOL_DIR /lib64/kde3)
+ ELSE(KDE3_KDECORE_LIBRARY MATCHES lib64)
+ SET(KDE3_LIBTOOL_DIR /lib/kde3)
+ ENDIF(KDE3_KDECORE_LIBRARY MATCHES lib64)
+ENDIF(NOT KDE3_LIBTOOL_DIR)
+
+#now search for the dcop utilities
+FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl
+ HINTS
+ $ENV{KDEDIR}/bin
+ ${KDE3PREFIX}/bin
+ PATHS
+ /opt/kde3/bin
+ /opt/kde/bin
+ )
+
+FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp
+ HINTS
+ $ENV{KDEDIR}/bin
+ ${KDE3PREFIX}/bin
+ PATHS
+ /opt/kde3/bin
+ /opt/kde/bin
+ )
+
+FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler
+ HINTS
+ $ENV{KDEDIR}/bin
+ ${KDE3PREFIX}/bin
+ PATHS
+ /opt/kde3/bin
+ /opt/kde/bin
+ )
+
+
+#SET KDE3_FOUND
+IF (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE)
+ SET(KDE3_FOUND TRUE)
+ELSE (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE)
+ SET(KDE3_FOUND FALSE)
+ENDIF (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE)
+
+# add some KDE specific stuff
+SET(KDE3_DEFINITIONS -DQT_CLEAN_NAMESPACE -D_GNU_SOURCE)
+
+# set compiler flags only if KDE3 has actually been found
+IF(KDE3_FOUND)
+ SET(_KDE3_USE_FLAGS FALSE)
+ IF(CMAKE_COMPILER_IS_GNUCXX)
+ SET(_KDE3_USE_FLAGS TRUE) # use flags for gnu compiler
+ EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version
+ OUTPUT_VARIABLE out)
+ # gnu gcc 2.96 does not work with flags
+ # I guess 2.95 also doesn't then
+ IF("${out}" MATCHES "2.9[56]")
+ SET(_KDE3_USE_FLAGS FALSE)
+ ENDIF("${out}" MATCHES "2.9[56]")
+ ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+
+ #only on linux, but NOT e.g. on FreeBSD:
+ IF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS)
+ SET (KDE3_DEFINITIONS ${KDE3_DEFINITIONS} -D_XOPEN_SOURCE=500 -D_BSD_SOURCE)
+ SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
+ SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common")
+ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS)
+
+ # works on FreeBSD, NOT tested on NetBSD and OpenBSD
+ IF (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS)
+ SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
+ SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common")
+ ENDIF (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS)
+
+ # if no special buildtype is selected, add -O2 as default optimization
+ IF (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS)
+ SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
+ SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
+ ENDIF (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS)
+
+#SET(CMAKE_SHARED_LINKER_FLAGS "-avoid-version -module -Wl,--no-undefined -Wl,--allow-shlib-undefined")
+#SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc")
+#SET(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc")
+ENDIF(KDE3_FOUND)
+
+
+# KDE3Macros.cmake contains all the KDE specific macros
+INCLUDE(KDE3Macros)
+
+
+MACRO (KDE3_PRINT_RESULTS)
+ IF(KDE3_INCLUDE_DIR)
+ MESSAGE(STATUS "Found KDE3 include dir: ${KDE3_INCLUDE_DIR}")
+ ELSE(KDE3_INCLUDE_DIR)
+ MESSAGE(STATUS "Didn't find KDE3 headers")
+ ENDIF(KDE3_INCLUDE_DIR)
+
+ IF(KDE3_LIB_DIR)
+ MESSAGE(STATUS "Found KDE3 library dir: ${KDE3_LIB_DIR}")
+ ELSE(KDE3_LIB_DIR)
+ MESSAGE(STATUS "Didn't find KDE3 core library")
+ ENDIF(KDE3_LIB_DIR)
+
+ IF(KDE3_DCOPIDL_EXECUTABLE)
+ MESSAGE(STATUS "Found KDE3 dcopidl preprocessor: ${KDE3_DCOPIDL_EXECUTABLE}")
+ ELSE(KDE3_DCOPIDL_EXECUTABLE)
+ MESSAGE(STATUS "Didn't find the KDE3 dcopidl preprocessor")
+ ENDIF(KDE3_DCOPIDL_EXECUTABLE)
+
+ IF(KDE3_DCOPIDL2CPP_EXECUTABLE)
+ MESSAGE(STATUS "Found KDE3 dcopidl2cpp preprocessor: ${KDE3_DCOPIDL2CPP_EXECUTABLE}")
+ ELSE(KDE3_DCOPIDL2CPP_EXECUTABLE)
+ MESSAGE(STATUS "Didn't find the KDE3 dcopidl2cpp preprocessor")
+ ENDIF(KDE3_DCOPIDL2CPP_EXECUTABLE)
+
+ IF(KDE3_KCFGC_EXECUTABLE)
+ MESSAGE(STATUS "Found KDE3 kconfig_compiler preprocessor: ${KDE3_KCFGC_EXECUTABLE}")
+ ELSE(KDE3_KCFGC_EXECUTABLE)
+ MESSAGE(STATUS "Didn't find the KDE3 kconfig_compiler preprocessor")
+ ENDIF(KDE3_KCFGC_EXECUTABLE)
+
+ENDMACRO (KDE3_PRINT_RESULTS)
+
+
+IF (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND)
+ #bail out if something wasn't found
+ KDE3_PRINT_RESULTS()
+ MESSAGE(FATAL_ERROR "Could NOT find everything required for compiling KDE 3 programs")
+
+ENDIF (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND)
+
+
+IF (NOT KDE3_FIND_QUIETLY)
+ KDE3_PRINT_RESULTS()
+ENDIF (NOT KDE3_FIND_QUIETLY)
+
+#add the found Qt and KDE include directories to the current include path
+SET(KDE3_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${KDE3_INCLUDE_DIR})
+
diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake
new file mode 100644
index 000000000..ed4f270b0
--- /dev/null
+++ b/Modules/FindKDE4.cmake
@@ -0,0 +1,100 @@
+# 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>
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@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.)
+
+# If Qt3 has already been found, fail.
+IF(QT_QT_LIBRARY)
+ IF(KDE4_FIND_REQUIRED)
+ MESSAGE( FATAL_ERROR "KDE4/Qt4 and Qt3 cannot be used together in one project.")
+ ELSE(KDE4_FIND_REQUIRED)
+ IF(NOT KDE4_FIND_QUIETLY)
+ MESSAGE( STATUS "KDE4/Qt4 and Qt3 cannot be used together in one project.")
+ ENDIF(NOT KDE4_FIND_QUIETLY)
+ RETURN()
+ ENDIF(KDE4_FIND_REQUIRED)
+ENDIF(QT_QT_LIBRARY)
+
+FILE(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)
+
+# when cross compiling, searching kde4-config in order to run it later on
+# doesn't make a lot of sense. We'll have to do something about this.
+# Searching always in the target environment ? Then we get at least the correct one,
+# still it can't be used to run it. Alex
+
+# For KDE4 kde-config has been renamed to kde4-config
+FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config
+ # the suffix must be used since KDEDIRS can be a list of directories which don't have bin/ appended
+ PATH_SUFFIXES bin
+ HINTS
+ ${CMAKE_INSTALL_PREFIX}
+ ${_KDEDIRS}
+ /opt/kde4
+ ONLY_CMAKE_FIND_ROOT_PATH
+ )
+
+IF (NOT KDE4_KDECONFIG_EXECUTABLE)
+ IF (KDE4_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config")
+ ENDIF (KDE4_FIND_REQUIRED)
+ENDIF (NOT KDE4_KDECONFIG_EXECUTABLE)
+
+
+# when cross compiling, KDE4_DATA_DIR may be already preset
+IF(NOT KDE4_DATA_DIR)
+ IF(CMAKE_CROSSCOMPILING)
+ # when cross compiling, don't run kde4-config but use its location as install dir
+ GET_FILENAME_COMPONENT(KDE4_DATA_DIR "${KDE4_KDECONFIG_EXECUTABLE}" PATH)
+ GET_FILENAME_COMPONENT(KDE4_DATA_DIR "${KDE4_DATA_DIR}" PATH)
+ ELSE(CMAKE_CROSSCOMPILING)
+ # then ask kde4-config for the kde data dirs
+
+ IF(KDE4_KDECONFIG_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data OUTPUT_VARIABLE _data_DIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+ FILE(TO_CMAKE_PATH "${_data_DIR}" _data_DIR)
+ # then check the data dirs for FindKDE4Internal.cmake
+ FIND_PATH(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake HINTS ${_data_DIR})
+ ENDIF(KDE4_KDECONFIG_EXECUTABLE)
+ ENDIF(CMAKE_CROSSCOMPILING)
+ENDIF(NOT KDE4_DATA_DIR)
+
+# if it has been found...
+IF (KDE4_DATA_DIR)
+
+ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${KDE4_DATA_DIR}/cmake/modules)
+
+ IF (KDE4_FIND_QUIETLY)
+ SET(_quiet QUIET)
+ ENDIF (KDE4_FIND_QUIETLY)
+
+ IF (KDE4_FIND_REQUIRED)
+ SET(_req REQUIRED)
+ ENDIF (KDE4_FIND_REQUIRED)
+
+ # use FindKDE4Internal.cmake to do the rest
+ FIND_PACKAGE(KDE4Internal ${_req} ${_quiet})
+ELSE (KDE4_DATA_DIR)
+ IF (KDE4_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}")
+ ENDIF (KDE4_FIND_REQUIRED)
+ENDIF (KDE4_DATA_DIR)
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
new file mode 100644
index 000000000..0ae98dfa7
--- /dev/null
+++ b/Modules/FindLAPACK.cmake
@@ -0,0 +1,336 @@
+# - 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
+
+#=============================================================================
+# 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.)
+
+set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+
+get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
+if (NOT _LANGUAGES_ MATCHES Fortran)
+include(CheckFunctionExists)
+else (NOT _LANGUAGES_ MATCHES Fortran)
+include(CheckFortranFunctionExists)
+endif (NOT _LANGUAGES_ MATCHES Fortran)
+
+set(LAPACK_FOUND FALSE)
+set(LAPACK95_FOUND FALSE)
+
+# TODO: move this stuff to separate module
+
+macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads)
+# This macro checks for the existence of the combination of fortran libraries
+# given by _list. If the combination is found, this macro checks (using the
+# Check_Fortran_Function_Exists macro) whether can link against that library
+# combination using the name of a routine given by _name using the linker
+# flags given by _flags. If the combination of libraries is found and passes
+# the link test, LIBRARIES is set to the list of complete library paths that
+# have been found. Otherwise, LIBRARIES is set to FALSE.
+
+# N.B. _prefix is the prefix applied to the names of all cached variables that
+# are generated internally and marked advanced by this macro.
+
+set(_libraries_work TRUE)
+set(${LIBRARIES})
+set(_combined_name)
+if (NOT _libdir)
+ if (WIN32)
+ set(_libdir ENV LIB)
+ elseif (APPLE)
+ set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH)
+ else ()
+ set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH)
+ endif ()
+endif ()
+foreach(_library ${_list})
+ set(_combined_name ${_combined_name}_${_library})
+
+ if(_libraries_work)
+ if (BLA_STATIC)
+ if (WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif ( WIN32 )
+ if (APPLE)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ else (APPLE)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif (APPLE)
+ else (BLA_STATIC)
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # for ubuntu's libblas3gf and liblapack3gf packages
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
+ endif ()
+ endif (BLA_STATIC)
+ find_library(${_prefix}_${_library}_LIBRARY
+ NAMES ${_library}
+ PATHS ${_libdir}
+ )
+ mark_as_advanced(${_prefix}_${_library}_LIBRARY)
+ set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
+ set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
+ endif(_libraries_work)
+endforeach(_library ${_list})
+
+if(_libraries_work)
+ # Test this combination of libraries.
+ if(UNIX AND BLA_STATIC)
+ set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blas} "-Wl,--end-group" ${_threads})
+ else(UNIX AND BLA_STATIC)
+ set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads})
+ endif(UNIX AND BLA_STATIC)
+# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
+ if (NOT _LANGUAGES_ MATCHES Fortran)
+ check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
+ else (NOT _LANGUAGES_ MATCHES Fortran)
+ check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
+ endif (NOT _LANGUAGES_ MATCHES Fortran)
+ set(CMAKE_REQUIRED_LIBRARIES)
+ mark_as_advanced(${_prefix}${_combined_name}_WORKS)
+ set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
+ #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
+endif(_libraries_work)
+
+ if(_libraries_work)
+ set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads})
+ else(_libraries_work)
+ set(${LIBRARIES} FALSE)
+ endif(_libraries_work)
+
+endmacro(Check_Lapack_Libraries)
+
+
+set(LAPACK_LINKER_FLAGS)
+set(LAPACK_LIBRARIES)
+set(LAPACK95_LIBRARIES)
+
+
+if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+ find_package(BLAS)
+else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+ find_package(BLAS REQUIRED)
+endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+
+
+if(BLAS_FOUND)
+ set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
+ if ($ENV{BLA_VENDOR} MATCHES ".+")
+ set(BLA_VENDOR $ENV{BLA_VENDOR})
+ else ($ENV{BLA_VENDOR} MATCHES ".+")
+ if(NOT BLA_VENDOR)
+ set(BLA_VENDOR "All")
+ endif(NOT BLA_VENDOR)
+ endif ($ENV{BLA_VENDOR} MATCHES ".+")
+
+if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
+ if(NOT LAPACK_LIBRARIES)
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "goto2"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif(NOT LAPACK_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
+
+
+#acml lapack
+ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
+ if (BLAS_LIBRARIES MATCHES ".+acml.+")
+ set (LAPACK_LIBRARIES ${BLAS_LIBRARIES})
+ endif ()
+ endif ()
+
+# Apple LAPACK library?
+if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
+ if(NOT LAPACK_LIBRARIES)
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "Accelerate"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif(NOT LAPACK_LIBRARIES)
+endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
+if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
+ if ( NOT LAPACK_LIBRARIES )
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "vecLib"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif ( NOT LAPACK_LIBRARIES )
+endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
+# Generic LAPACK library?
+if (BLA_VENDOR STREQUAL "Generic" OR
+ BLA_VENDOR STREQUAL "ATLAS" OR
+ BLA_VENDOR STREQUAL "All")
+ if ( NOT LAPACK_LIBRARIES )
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "lapack"
+ "${BLAS_LIBRARIES}"
+ ""
+ )
+ endif ( NOT LAPACK_LIBRARIES )
+endif ()
+#intel lapack
+if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+ if (NOT WIN32)
+ set(LM "-lm")
+ endif ()
+ if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
+ if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+ find_PACKAGE(Threads)
+ else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+ find_package(Threads REQUIRED)
+ endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
+ 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(NOT LAPACK95_LIBRARIES)
+ 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(NOT LAPACK95_LIBRARIES)
+ else(BLA_F95)
+ if(NOT LAPACK_LIBRARIES)
+ # old
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "mkl_lapack"
+ "${BLAS_LIBRARIES}"
+ "${CMAKE_THREAD_LIBS_INIT};${LM}"
+ )
+ endif(NOT LAPACK_LIBRARIES)
+ if(NOT LAPACK_LIBRARIES)
+ # new >= 10.3
+ check_lapack_libraries(
+ LAPACK_LIBRARIES
+ LAPACK
+ cheev
+ ""
+ "mkl_gf_lp64"
+ "${BLAS_LIBRARIES}"
+ "${CMAKE_THREAD_LIBS_INIT};${LM}"
+ )
+ endif(NOT LAPACK_LIBRARIES)
+ endif(BLA_F95)
+ endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
+endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
+else(BLAS_FOUND)
+ message(STATUS "LAPACK requires BLAS")
+endif(BLAS_FOUND)
+
+if(BLA_F95)
+ if(LAPACK95_LIBRARIES)
+ set(LAPACK95_FOUND TRUE)
+ else(LAPACK95_LIBRARIES)
+ set(LAPACK95_FOUND FALSE)
+ endif(LAPACK95_LIBRARIES)
+ if(NOT LAPACK_FIND_QUIETLY)
+ if(LAPACK95_FOUND)
+ message(STATUS "A library with LAPACK95 API found.")
+ else(LAPACK95_FOUND)
+ if(LAPACK_FIND_REQUIRED)
+ message(FATAL_ERROR
+ "A required library with LAPACK95 API not found. Please specify library location."
+ )
+ else(LAPACK_FIND_REQUIRED)
+ message(STATUS
+ "A library with LAPACK95 API not found. Please specify library location."
+ )
+ endif(LAPACK_FIND_REQUIRED)
+ endif(LAPACK95_FOUND)
+ endif(NOT LAPACK_FIND_QUIETLY)
+ set(LAPACK_FOUND "${LAPACK95_FOUND}")
+ set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}")
+else(BLA_F95)
+ if(LAPACK_LIBRARIES)
+ set(LAPACK_FOUND TRUE)
+ else(LAPACK_LIBRARIES)
+ set(LAPACK_FOUND FALSE)
+ endif(LAPACK_LIBRARIES)
+
+ if(NOT LAPACK_FIND_QUIETLY)
+ if(LAPACK_FOUND)
+ message(STATUS "A library with LAPACK API found.")
+ else(LAPACK_FOUND)
+ if(LAPACK_FIND_REQUIRED)
+ message(FATAL_ERROR
+ "A required library with LAPACK API not found. Please specify library location."
+ )
+ else(LAPACK_FIND_REQUIRED)
+ message(STATUS
+ "A library with LAPACK API not found. Please specify library location."
+ )
+ endif(LAPACK_FIND_REQUIRED)
+ endif(LAPACK_FOUND)
+ endif(NOT LAPACK_FIND_QUIETLY)
+endif(BLA_F95)
+
+set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake
new file mode 100644
index 000000000..950daca5a
--- /dev/null
+++ b/Modules/FindLATEX.cmake
@@ -0,0 +1,126 @@
+# - Find Latex
+# This module finds if Latex is installed and determines where the
+# executables are. This code sets the following variables:
+#
+# 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
+#
+
+#=============================================================================
+# 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.)
+
+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
+ "Path to the MikTex binary directory."
+ )
+ 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
+ )
+
+ GET_FILENAME_COMPONENT(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\7.04;GS_DLL]" PATH
+ )
+
+ FIND_PATH(GHOSTSCRIPT_BINARY_PATH gswin32.exe
+ ${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00}
+ ${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04}
+ DOC "Path to the GhostScript binary directory."
+ )
+ MARK_AS_ADVANCED(GHOSTSCRIPT_BINARY_PATH)
+
+ FIND_PATH(GHOSTSCRIPT_LIBRARY_PATH ps2pdf13.bat
+ "${GHOSTSCRIPT_BINARY_PATH}/../lib"
+ DOC "Path to the GhostScript library directory."
+ )
+ MARK_AS_ADVANCED(GHOSTSCRIPT_LIBRARY_PATH)
+
+ENDIF (WIN32)
+
+FIND_PROGRAM(LATEX_COMPILER
+ NAMES latex
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+
+FIND_PROGRAM(PDFLATEX_COMPILER
+ NAMES pdflatex
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+
+FIND_PROGRAM(BIBTEX_COMPILER
+ NAMES bibtex
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+
+FIND_PROGRAM(MAKEINDEX_COMPILER
+ NAMES makeindex
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+
+FIND_PROGRAM(DVIPS_CONVERTER
+ NAMES dvips
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+
+FIND_PROGRAM(DVIPDF_CONVERTER
+ NAMES dvipdfm dvipdft dvipdf
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+
+IF (WIN32)
+ FIND_PROGRAM(PS2PDF_CONVERTER
+ NAMES ps2pdf14.bat
+ PATHS ${GHOSTSCRIPT_LIBRARY_PATH}
+ )
+ELSE (WIN32)
+ FIND_PROGRAM(PS2PDF_CONVERTER
+ NAMES ps2pdf14 ps2pdf
+ )
+ENDIF (WIN32)
+
+FIND_PROGRAM(LATEX2HTML_CONVERTER
+ NAMES latex2html
+ PATHS ${MIKTEX_BINARY_PATH}
+ /usr/bin
+)
+
+
+MARK_AS_ADVANCED(
+ LATEX_COMPILER
+ PDFLATEX_COMPILER
+ BIBTEX_COMPILER
+ MAKEINDEX_COMPILER
+ DVIPS_CONVERTER
+ DVIPDF_CONVERTER
+ PS2PDF_CONVERTER
+ LATEX2HTML_CONVERTER
+)
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake
new file mode 100644
index 000000000..be931c525
--- /dev/null
+++ b/Modules/FindLibArchive.cmake
@@ -0,0 +1,67 @@
+# - 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
+
+#=============================================================================
+# Copyright 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.)
+
+find_path(LibArchive_INCLUDE_DIR
+ NAMES archive.h
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\LibArchive;InstallPath]/include"
+ )
+
+find_library(LibArchive_LIBRARY
+ NAMES archive libarchive
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\LibArchive;InstallPath]/lib"
+ )
+
+mark_as_advanced(LibArchive_INCLUDE_DIR LibArchive_LIBRARY)
+
+# Extract the version number from the header.
+if(LibArchive_INCLUDE_DIR AND EXISTS "${LibArchive_INCLUDE_DIR}/archive.h")
+ # The version string appears in one of two known formats in the header:
+ # #define ARCHIVE_LIBRARY_VERSION "libarchive 2.4.12"
+ # #define ARCHIVE_VERSION_STRING "libarchive 2.8.4"
+ # Match either format.
+ set(_LibArchive_VERSION_REGEX "^#define[ \t]+ARCHIVE[_A-Z]+VERSION[_A-Z]*[ \t]+\"libarchive +([0-9]+)\\.([0-9]+)\\.([0-9]+)[^\"]*\".*$")
+ file(STRINGS "${LibArchive_INCLUDE_DIR}/archive.h" _LibArchive_VERSION_STRING LIMIT_COUNT 1 REGEX "${_LibArchive_VERSION_REGEX}")
+ if(_LibArchive_VERSION_STRING)
+ string(REGEX REPLACE "${_LibArchive_VERSION_REGEX}" "\\1.\\2.\\3" LibArchive_VERSION "${_LibArchive_VERSION_STRING}")
+ endif()
+ unset(_LibArchive_VERSION_REGEX)
+ unset(_LibArchive_VERSION_STRING)
+endif()
+
+# Handle the QUIETLY and REQUIRED arguments and set LIBARCHIVE_FOUND
+# to TRUE if all listed variables are TRUE.
+# (Use ${CMAKE_ROOT}/Modules instead of ${CMAKE_CURRENT_LIST_DIR} because CMake
+# itself includes this FindLibArchive when built with an older CMake that does
+# not provide it. The older CMake also does not have CMAKE_CURRENT_LIST_DIR.)
+include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(LibArchive
+ REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
+ VERSION_VAR LibArchive_VERSION
+ )
+set(LibArchive_FOUND ${LIBARCHIVE_FOUND})
+unset(LIBARCHIVE_FOUND)
+
+if(LibArchive_FOUND)
+ set(LibArchive_INCLUDE_DIRS ${LibArchive_INCLUDE_DIR})
+ set(LibArchive_LIBRARIES ${LibArchive_LIBRARY})
+endif()
diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake
new file mode 100644
index 000000000..729f5ce73
--- /dev/null
+++ b/Modules/FindLibLZMA.cmake
@@ -0,0 +1,69 @@
+# - 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")
+
+#=============================================================================
+# Copyright 2008 Per Øyvind Karlsen <peroyvind@mandriva.org>
+# Copyright 2009 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2009 Helio Chissini de Castro <helio@kde.org>
+# Copyright 2012 Mario Bensi <mbensi@ipsquad.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_PATH(LIBLZMA_INCLUDE_DIR lzma.h )
+FIND_LIBRARY(LIBLZMA_LIBRARY lzma)
+
+IF(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h")
+ FILE(READ "${LIBLZMA_INCLUDE_DIR}/lzma/version.h" LIBLZMA_HEADER_CONTENTS)
+
+ STRING(REGEX REPLACE ".*#define LZMA_VERSION_MAJOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MAJOR "${LIBLZMA_HEADER_CONTENTS}")
+ STRING(REGEX REPLACE ".*#define LZMA_VERSION_MINOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MINOR "${LIBLZMA_HEADER_CONTENTS}")
+ STRING(REGEX REPLACE ".*#define LZMA_VERSION_PATCH ([0-9]+).*" "\\1" LIBLZMA_VERSION_PATCH "${LIBLZMA_HEADER_CONTENTS}")
+
+ SET(LIBLZMA_VERSION_STRING "${LIBLZMA_VERSION_MAJOR}.${LIBLZMA_VERSION_MINOR}.${LIBLZMA_VERSION_PATCH}")
+ENDIF(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h")
+
+# We're using new code known now as XZ, even library still been called LZMA
+# it can be found in http://tukaani.org/xz/
+# Avoid using old codebase
+IF (LIBLZMA_LIBRARY)
+ INCLUDE(CheckLibraryExists)
+ 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)
+ENDIF (LIBLZMA_LIBRARY)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZMA REQUIRED_VARS LIBLZMA_INCLUDE_DIR
+ LIBLZMA_LIBRARY
+ LIBLZMA_HAS_AUTO_DECODER
+ LIBLZMA_HAS_EASY_ENCODER
+ LIBLZMA_HAS_LZMA_PRESET
+ VERSION_VAR LIBLZMA_VERSION_STRING
+ )
+
+IF (LIBLZMA_FOUND)
+ SET(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY})
+ SET(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR})
+ENDIF (LIBLZMA_FOUND)
+
+MARK_AS_ADVANCED( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY )
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
new file mode 100644
index 000000000..48a549806
--- /dev/null
+++ b/Modules/FindLibXml2.cmake
@@ -0,0 +1,66 @@
+# - 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)
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@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.)
+
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+FIND_PACKAGE(PkgConfig QUIET)
+PKG_CHECK_MODULES(PC_LIBXML QUIET libxml-2.0)
+SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
+
+FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
+ HINTS
+ ${PC_LIBXML_INCLUDEDIR}
+ ${PC_LIBXML_INCLUDE_DIRS}
+ PATH_SUFFIXES libxml2
+ )
+
+FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
+ HINTS
+ ${PC_LIBXML_LIBDIR}
+ ${PC_LIBXML_LIBRARY_DIRS}
+ )
+
+FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
+# for backwards compat. with KDE 4.0.x:
+SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
+
+IF(PC_LIBXML_VERSION)
+ SET(LIBXML2_VERSION_STRING ${PC_LIBXML_VERSION})
+ELSEIF(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h")
+ FILE(STRINGS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h" libxml2_version_str
+ REGEX "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\".*\"")
+
+ STRING(REGEX REPLACE "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
+ LIBXML2_VERSION_STRING "${libxml2_version_str}")
+ UNSET(libxml2_version_str)
+ENDIF()
+
+# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
+ REQUIRED_VARS LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR
+ VERSION_VAR LIBXML2_VERSION_STRING)
+
+MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)
diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake
new file mode 100644
index 000000000..dd5aac461
--- /dev/null
+++ b/Modules/FindLibXslt.cmake
@@ -0,0 +1,74 @@
+# - 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
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@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.)
+
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+FIND_PACKAGE(PkgConfig QUIET)
+PKG_CHECK_MODULES(PC_LIBXSLT QUIET libxslt)
+SET(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER})
+
+FIND_PATH(LIBXSLT_INCLUDE_DIR NAMES libxslt/xslt.h
+ HINTS
+ ${PC_LIBXSLT_INCLUDEDIR}
+ ${PC_LIBXSLT_INCLUDE_DIRS}
+ )
+
+FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt
+ HINTS
+ ${PC_LIBXSLT_LIBDIR}
+ ${PC_LIBXSLT_LIBRARY_DIRS}
+ )
+
+FIND_LIBRARY(LIBXSLT_EXSLT_LIBRARY NAMES exslt libexslt
+ HINTS
+ ${PC_LIBXSLT_LIBDIR}
+ ${PC_LIBXSLT_LIBRARY_DIRS}
+ )
+
+SET(LIBXSLT_EXSLT_LIBRARIES ${LIBXSLT_EXSLT_LIBRARY} )
+
+FIND_PROGRAM(LIBXSLT_XSLTPROC_EXECUTABLE xsltproc)
+
+IF(PC_LIBXSLT_VERSION)
+ SET(LIBXSLT_VERSION_STRING ${PC_LIBXSLT_VERSION})
+ELSEIF(LIBXSLT_INCLUDE_DIR AND EXISTS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h")
+ FILE(STRINGS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h" libxslt_version_str
+ REGEX "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\".*\"")
+
+ STRING(REGEX REPLACE "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
+ LIBXSLT_VERSION_STRING "${libxslt_version_str}")
+ UNSET(libxslt_version_str)
+ENDIF()
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt
+ REQUIRED_VARS LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR
+ VERSION_VAR LIBXSLT_VERSION_STRING)
+
+MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR
+ LIBXSLT_LIBRARIES
+ LIBXSLT_EXSLT_LIBRARY
+ LIBXSLT_XSLTPROC_EXECUTABLE)
diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake
new file mode 100644
index 000000000..9a5cc1703
--- /dev/null
+++ b/Modules/FindLua50.cmake
@@ -0,0 +1,90 @@
+# Locate Lua library
+# This module defines
+# LUA50_FOUND, if false, do not try to link to Lua
+# LUA_LIBRARIES, both lua and lualib
+# LUA_INCLUDE_DIR, where to find lua.h and lualib.h (and probably lauxlib.h)
+#
+# Note that the expected include convention is
+# #include "lua.h"
+# and not
+# #include <lua/lua.h>
+# This is because, the lua location is not standardized and may exist
+# in locations other than lua/
+
+#=============================================================================
+# 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.)
+
+FIND_PATH(LUA_INCLUDE_DIR lua.h
+ HINTS
+ $ENV{LUA_DIR}
+ PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+)
+
+FIND_LIBRARY(LUA_LIBRARY_lua
+ NAMES lua50 lua5.0 lua-5.0 lua5 lua
+ HINTS
+ $ENV{LUA_DIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+# In an OS X framework, lualib is usually included as part of the framework
+# (like GLU in OpenGL.framework)
+IF(${LUA_LIBRARY_lua} MATCHES "framework")
+ SET( LUA_LIBRARIES "${LUA_LIBRARY_lua}" CACHE STRING "Lua framework")
+ELSE(${LUA_LIBRARY_lua} MATCHES "framework")
+ FIND_LIBRARY(LUA_LIBRARY_lualib
+ NAMES lualib50 lualib5.0 lualib5 lualib
+ HINTS
+ $ENV{LUALIB_DIR}
+ $ENV{LUA_DIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ )
+ IF(LUA_LIBRARY_lualib AND LUA_LIBRARY_lua)
+ # include the math library for Unix
+ IF(UNIX AND NOT APPLE)
+ FIND_LIBRARY(MATH_LIBRARY_FOR_LUA m)
+ SET( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua};${MATH_LIBRARY_FOR_LUA}" CACHE STRING "This is the concatentation of lua and lualib libraries")
+ # For Windows and Mac, don't need to explicitly include the math library
+ ELSE(UNIX AND NOT APPLE)
+ SET( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua}" CACHE STRING "This is the concatentation of lua and lualib libraries")
+ ENDIF(UNIX AND NOT APPLE)
+ ENDIF(LUA_LIBRARY_lualib AND LUA_LIBRARY_lua)
+ENDIF(${LUA_LIBRARY_lua} MATCHES "framework")
+
+
+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(Lua50 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES)
+
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
new file mode 100644
index 000000000..e111d3624
--- /dev/null
+++ b/Modules/FindLua51.cmake
@@ -0,0 +1,81 @@
+# Locate Lua library
+# This module defines
+# LUA51_FOUND, if false, do not try to link to Lua
+# LUA_LIBRARIES
+# LUA_INCLUDE_DIR, where to find lua.h
+# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
+#
+# Note that the expected include convention is
+# #include "lua.h"
+# and not
+# #include <lua/lua.h>
+# This is because, the lua location is not standardized and may exist
+# in locations other than lua/
+
+#=============================================================================
+# 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.)
+
+FIND_PATH(LUA_INCLUDE_DIR lua.h
+ HINTS
+ $ENV{LUA_DIR}
+ PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+)
+
+FIND_LIBRARY(LUA_LIBRARY
+ NAMES lua51 lua5.1 lua-5.1 lua
+ HINTS
+ $ENV{LUA_DIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+IF(LUA_LIBRARY)
+ # include the math library for Unix
+ IF(UNIX AND NOT APPLE)
+ 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
+ ELSE(UNIX AND NOT APPLE)
+ SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
+ ENDIF(UNIX AND NOT APPLE)
+ENDIF(LUA_LIBRARY)
+
+IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
+ FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
+
+ STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
+ UNSET(lua_version_str)
+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(Lua51
+ REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
+ VERSION_VAR LUA_VERSION_STRING)
+
+MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
+
diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake
new file mode 100644
index 000000000..3df284241
--- /dev/null
+++ b/Modules/FindMFC.cmake
@@ -0,0 +1,60 @@
+# - 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.
+
+#=============================================================================
+# 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.)
+
+# Assume no MFC support
+SET(MFC_FOUND "NO")
+
+# Only attempt the try_compile call if it has a chance to succeed:
+SET(MFC_ATTEMPT_TRY_COMPILE 0)
+IF(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW)
+ SET(MFC_ATTEMPT_TRY_COMPILE 1)
+ENDIF(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW)
+
+IF(MFC_ATTEMPT_TRY_COMPILE)
+ IF("MFC_HAVE_MFC" MATCHES "^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)
+ MESSAGE(STATUS "Looking for MFC")
+ TRY_COMPILE(MFC_HAVE_MFC
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
+ CMAKE_FLAGS
+ -DCMAKE_MFC_FLAG:STRING=2
+ -DCOMPILE_DEFINITIONS:STRING=-D_AFXDLL
+ OUTPUT_VARIABLE OUTPUT)
+ IF(MFC_HAVE_MFC)
+ MESSAGE(STATUS "Looking for MFC - found")
+ SET(MFC_HAVE_MFC 1 CACHE INTERNAL "Have MFC?")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if MFC exists passed with the following output:\n"
+ "${OUTPUT}\n\n")
+ ELSE(MFC_HAVE_MFC)
+ MESSAGE(STATUS "Looking for MFC - not found")
+ SET(MFC_HAVE_MFC 0 CACHE INTERNAL "Have MFC?")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if MFC exists failed with the following output:\n"
+ "${OUTPUT}\n\n")
+ ENDIF(MFC_HAVE_MFC)
+ ENDIF("MFC_HAVE_MFC" MATCHES "^MFC_HAVE_MFC$")
+
+ IF(MFC_HAVE_MFC)
+ SET(MFC_FOUND "YES")
+ ENDIF(MFC_HAVE_MFC)
+ENDIF(MFC_ATTEMPT_TRY_COMPILE)
diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake
new file mode 100644
index 000000000..cf4ef58f8
--- /dev/null
+++ b/Modules/FindMPEG.cmake
@@ -0,0 +1,44 @@
+# - Find the native MPEG includes and library
+# This module defines
+# MPEG_INCLUDE_DIR, where to find MPEG.h, etc.
+# MPEG_LIBRARIES, the libraries required to use MPEG.
+# MPEG_FOUND, If false, do not try to use MPEG.
+# also defined, but not for general use are
+# MPEG_mpeg2_LIBRARY, where to find the MPEG library.
+# MPEG_vo_LIBRARY, where to find the vo library.
+
+#=============================================================================
+# 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.)
+
+FIND_PATH(MPEG_INCLUDE_DIR mpeg2dec/include/video_out.h
+ /usr/local/livid
+)
+
+FIND_LIBRARY(MPEG_mpeg2_LIBRARY mpeg2
+ /usr/local/livid/mpeg2dec/libmpeg2/.libs
+)
+
+FIND_LIBRARY( MPEG_vo_LIBRARY vo
+ /usr/local/livid/mpeg2dec/libvo/.libs
+)
+
+# handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY)
+
+IF(MPEG_FOUND)
+ SET( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} ${MPEG_vo_LIBRARY} )
+ENDIF(MPEG_FOUND)
+
+MARK_AS_ADVANCED(MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY)
diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake
new file mode 100644
index 000000000..fab37cf54
--- /dev/null
+++ b/Modules/FindMPEG2.cmake
@@ -0,0 +1,54 @@
+# - Find the native MPEG2 includes and library
+# This module defines
+# MPEG2_INCLUDE_DIR, path to mpeg2dec/mpeg2.h, etc.
+# MPEG2_LIBRARIES, the libraries required to use MPEG2.
+# MPEG2_FOUND, If false, do not try to use MPEG2.
+# also defined, but not for general use are
+# MPEG2_mpeg2_LIBRARY, where to find the MPEG2 library.
+# MPEG2_vo_LIBRARY, where to find the vo library.
+
+#=============================================================================
+# Copyright 2003-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.)
+
+FIND_PATH(MPEG2_INCLUDE_DIR
+ NAMES mpeg2.h mpeg2dec/mpeg2.h
+ PATHS /usr/local/livid
+)
+
+FIND_LIBRARY(MPEG2_mpeg2_LIBRARY mpeg2
+ /usr/local/livid/mpeg2dec/libmpeg2/.libs
+)
+
+FIND_LIBRARY( MPEG2_vo_LIBRARY vo
+ /usr/local/livid/mpeg2dec/libvo/.libs
+)
+
+
+# handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR)
+
+IF(MPEG2_FOUND)
+ SET( MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY}
+ ${MPEG2_vo_LIBRARY})
+
+ #some native mpeg2 installations will depend
+ #on libSDL, if found, add it in.
+ INCLUDE( FindSDL )
+ IF(SDL_FOUND)
+ SET( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY})
+ ENDIF(SDL_FOUND)
+ENDIF(MPEG2_FOUND)
+
+MARK_AS_ADVANCED(MPEG2_INCLUDE_DIR MPEG2_mpeg2_LIBRARY MPEG2_vo_LIBRARY)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
new file mode 100644
index 000000000..ae50ca7b9
--- /dev/null
+++ b/Modules/FindMPI.cmake
@@ -0,0 +1,631 @@
+# - 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.
+#
+# === 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
+# 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
+# === 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.
+#
+# === 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
+# In new projects, please use the MPI_<lang>_XXX equivalents.
+
+#=============================================================================
+# Copyright 2001-2011 Kitware, Inc.
+# Copyright 2010-2011 Todd Gamblin tgamblin@llnl.gov
+# Copyright 2001-2009 Dave Partyka
+#
+# 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 this to handle the QUIETLY and REQUIRED arguments
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(GetPrerequisites)
+
+#
+# This part detects MPI compilers, attempting to wade through the mess of compiler names in
+# a sensible way.
+#
+# The compilers are detected in this order:
+#
+# 1. Try to find the most generic availble MPI compiler, as this is usually set up by
+# cluster admins. e.g., if plain old mpicc is available, we'll use it and assume it's
+# the right compiler.
+#
+# 2. If a generic mpicc is NOT found, then we attempt to find one that matches
+# CMAKE_<lang>_COMPILER_ID. e.g. if you are using XL compilers, we'll try to find mpixlc
+# and company, but not mpiicc. This hopefully prevents toolchain mismatches.
+#
+# If you want to force a particular MPI compiler other than what we autodetect (e.g. if you
+# want to compile regular stuff with GNU and parallel stuff with Intel), you can always set
+# your favorite MPI_<lang>_COMPILER explicitly and this stuff will be ignored.
+#
+
+# Start out with the generic MPI compiler names, as these are most commonly used.
+set(_MPI_C_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r)
+set(_MPI_CXX_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++
+ mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r)
+set(_MPI_Fortran_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r
+ mpif90 mpif90_r mpf90 mpf90_r
+ mpif77 mpif77_r mpf77 mpf77_r)
+
+# GNU compiler names
+set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r)
+set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r)
+set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpgfortran_r
+ mpig77 mpig77_r mpg77 mpg77_r)
+
+# Intel MPI compiler names
+set(_MPI_Intel_C_COMPILER_NAMES mpiicc)
+set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++ mpiiCC)
+set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77)
+
+# PGI compiler names
+set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc)
+set(_MPI_PGI_CXX_COMPILER_NAMES mpipgCC mppgCC)
+set(_MPI_PGI_Fortran_COMPILER_NAMES mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77)
+
+# XLC MPI Compiler names
+set(_MPI_XL_C_COMPILER_NAMES mpxlc mpxlc_r mpixlc mpixlc_r)
+set(_MPI_XL_CXX_COMPILER_NAMES mpixlcxx mpixlC mpixlc++ mpxlcxx mpxlc++ mpixlc++ mpxlCC
+ mpixlcxx_r mpixlC_r mpixlc++_r mpxlcxx_r mpxlc++_r mpixlc++_r mpxlCC_r)
+set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95_r
+ mpixlf90 mpixlf90_r mpxlf90 mpxlf90_r
+ mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r
+ mpixlf mpixlf_r mpxlf mpxlf_r)
+
+# append vendor-specific compilers to the list if we either don't know the compiler id,
+# 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}")
+ list(APPEND _MPI_${lang}_COMPILER_NAMES ${_MPI_${id}_${lang}_COMPILER_NAMES})
+ endif()
+ unset(_MPI_${id}_${lang}_COMPILER_NAMES) # clean up the namespace here
+ endforeach()
+endforeach()
+
+
+# Names to try for MPI exec
+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)
+ 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/")
+endif()
+
+# Build a list of prefixes to search for MPI.
+foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH})
+ foreach(MpiPackageDir ${_MPI_PREFIX_PATH})
+ if(EXISTS ${SystemPrefixDir}/${MpiPackageDir})
+ list(APPEND _MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}")
+ endif()
+ endforeach()
+endforeach()
+
+
+#
+# interrogate_mpi_compiler(lang try_libs)
+#
+# Attempts to extract compiler and linker args from an MPI compiler. The arguments set
+# by this function are:
+#
+# MPI_<lang>_INCLUDE_PATH MPI_<lang>_LINK_FLAGS MPI_<lang>_FOUND
+# MPI_<lang>_COMPILE_FLAGS MPI_<lang>_LIBRARIES
+#
+# MPI_<lang>_COMPILER must be set beforehand to the absolute path to an MPI compiler for
+# <lang>. Additionally, MPI_<lang>_INCLUDE_PATH and MPI_<lang>_LIBRARIES may be set
+# to skip autodetection.
+#
+# If try_libs is TRUE, this will also attempt to find plain MPI libraries in the usual
+# way. In general, this is not as effective as interrogating the compilers, as it
+# ignores language-specific flags and libraries. However, some MPI implementations
+# (Windows implementations) do not have compiler wrappers, so this approach must be used.
+#
+function (interrogate_mpi_compiler lang try_libs)
+ # MPI_${lang}_NO_INTERROGATE will be set to a compiler name when the *regular* compiler was
+ # discovered to be the MPI compiler. This happens on machines like the Cray XE6 that use
+ # modules to set cc, CC, and ftn to the MPI compilers. If the user force-sets another MPI
+ # compiler, MPI_${lang}_COMPILER won't be equal to MPI_${lang}_NO_INTERROGATE, and we'll
+ # inspect that compiler anew. This allows users to set new compilers w/o rm'ing cache.
+ string(COMPARE NOTEQUAL "${MPI_${lang}_NO_INTERROGATE}" "${MPI_${lang}_COMPILER}" interrogate)
+
+ # If MPI is set already in the cache, don't bother with interrogating the compiler.
+ if (interrogate AND ((NOT MPI_${lang}_INCLUDE_PATH) OR (NOT MPI_${lang}_LIBRARIES)))
+ 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)
+
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ # If we appear to have -showme:compile, then we should
+ # also have -showme:link. Try it.
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -showme:link
+ OUTPUT_VARIABLE MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE MPI_COMPILER_RETURN)
+
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ # We probably have -showme:incdirs and -showme:libdirs as well,
+ # so grab that while we're at it.
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -showme:incdirs
+ OUTPUT_VARIABLE MPI_INCDIRS OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_INCDIRS ERROR_STRIP_TRAILING_WHITESPACE)
+
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -showme:libdirs
+ OUTPUT_VARIABLE MPI_LIBDIRS OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_LIBDIRS ERROR_STRIP_TRAILING_WHITESPACE)
+
+ else()
+ # reset things here if something went wrong.
+ set(MPI_COMPILE_CMDLINE)
+ set(MPI_LINK_CMDLINE)
+ endif()
+ endif ()
+
+ # 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)
+ 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)
+
+ # If we have compile-info, also have link-info.
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -link-info
+ OUTPUT_VARIABLE MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE MPI_COMPILER_RETURN)
+ endif()
+
+ # make sure we got compile and link. Reset vars if something's wrong.
+ if (NOT MPI_COMPILER_RETURN EQUAL 0)
+ set(MPI_COMPILE_CMDLINE)
+ set(MPI_LINK_CMDLINE)
+ endif()
+ endif()
+
+ # 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)
+ endif()
+
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE
+ # into MPI_LINK_CMDLINE, if we didn't find the link line.
+ if (NOT MPI_LINK_CMDLINE)
+ set(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE})
+ endif()
+ else()
+ message(STATUS "Unable to determine MPI from MPI driver ${MPI_${lang}_COMPILER}")
+ set(MPI_COMPILE_CMDLINE)
+ set(MPI_LINK_CMDLINE)
+ endif()
+
+ # Here, we're done with the interrogation part, and we'll try to extract args we care
+ # about from what we learned from the compiler wrapper scripts.
+
+ # If interrogation came back with something, extract our variable from the MPI command line
+ if (MPI_COMPILE_CMDLINE OR MPI_LINK_CMDLINE)
+ # Extract compile flags from the compile command line.
+ string(REGEX MATCHALL "(^| )-[Df]([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}")
+ set(MPI_COMPILE_FLAGS_WORK)
+
+ foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
+ if (MPI_COMPILE_FLAGS_WORK)
+ set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}")
+ else()
+ set(MPI_COMPILE_FLAGS_WORK ${FLAG})
+ endif()
+ endforeach()
+
+ # Extract include paths from compile command line
+ 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})
+ list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
+ endforeach()
+
+ # try using showme:incdirs if extracting didn't work.
+ if (NOT MPI_INCLUDE_PATH_WORK)
+ set(MPI_INCLUDE_PATH_WORK ${MPI_INCDIRS})
+ separate_arguments(MPI_INCLUDE_PATH_WORK)
+ endif()
+
+ # If all else fails, just search for mpi.h in the normal include paths.
+ if (NOT MPI_INCLUDE_PATH_WORK)
+ set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+ find_path(MPI_HEADER_PATH mpi.h
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES include)
+ set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH})
+ endif()
+
+ # Extract linker paths from the link command line
+ string(REGEX MATCHALL "(^| |-Wl,)-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
+ set(MPI_LINK_PATH)
+ foreach(LPATH ${MPI_ALL_LINK_PATHS})
+ string(REGEX REPLACE "^(| |-Wl,)-L" "" LPATH ${LPATH})
+ string(REGEX REPLACE "//" "/" LPATH ${LPATH})
+ list(APPEND MPI_LINK_PATH ${LPATH})
+ endforeach()
+
+ # try using showme:libdirs if extracting didn't work.
+ if (NOT MPI_LINK_PATH)
+ set(MPI_LINK_PATH ${MPI_LIBDIRS})
+ separate_arguments(MPI_LINK_PATH)
+ endif()
+
+ # Extract linker flags from the link command line
+ string(REGEX MATCHALL "(^| )-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+ set(MPI_LINK_FLAGS_WORK)
+ foreach(FLAG ${MPI_ALL_LINK_FLAGS})
+ if (MPI_LINK_FLAGS_WORK)
+ set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}")
+ else()
+ set(MPI_LINK_FLAGS_WORK ${FLAG})
+ endif()
+ endforeach()
+
+ # 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)
+ set(MPI_LINK_PATH
+ "${MPI_LINK_PATH};${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+ endif ()
+
+ # Determine full path names for all of the libraries that one needs
+ # to link against in an MPI program
+ foreach(LIB ${MPI_LIBNAMES})
+ string(REGEX REPLACE "^ ?-l" "" LIB ${LIB})
+ # MPI_LIB is cached by find_library, but we don't want that. Clear it first.
+ set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+ find_library(MPI_LIB NAMES ${LIB} HINTS ${MPI_LINK_PATH})
+
+ if (MPI_LIB)
+ list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB})
+ elseif (NOT MPI_FIND_QUIETLY)
+ message(WARNING "Unable to find MPI library ${LIB}")
+ endif()
+ endforeach()
+
+ # Sanity check MPI_LIBRARIES to make sure there are enough libraries
+ list(LENGTH MPI_LIBRARIES_WORK MPI_NUMLIBS)
+ list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED)
+ if (NOT MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
+ set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND")
+ endif()
+ endif()
+
+ elseif(try_libs)
+ # If we didn't have an MPI compiler script to interrogate, attempt to find everything
+ # with plain old find functions. This is nasty because MPI implementations have LOTS of
+ # different library names, so this section isn't going to be very generic. We need to
+ # make sure it works for MS MPI, though, since there are no compiler wrappers for that.
+ find_path(MPI_HEADER_PATH mpi.h
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES include Inc)
+ set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH})
+
+ # 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)
+ else()
+ set(MS_MPI_ARCH_DIR 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})
+ set(MPI_LIBRARIES_WORK ${MPI_LIB})
+
+ # Right now, we only know about the extra libs for C++.
+ # We could add Fortran here (as there is usually libfmpich, etc.), but
+ # this really only has to work with MS MPI on Windows.
+ # Assume that other MPI's are covered by the compiler wrappers.
+ if (${lang} STREQUAL CXX)
+ set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+ find_library(MPI_LIB
+ NAMES mpi++ mpicxx cxx mpi_cxx
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES lib)
+ if (MPI_LIBRARIES_WORK AND MPI_LIB)
+ list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB})
+ endif()
+ endif()
+
+ if (NOT MPI_LIBRARIES_WORK)
+ set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND")
+ endif()
+ endif()
+
+ # If we found MPI, set up all of the appropriate cache entries
+ set(MPI_${lang}_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI ${lang} compilation flags" FORCE)
+ set(MPI_${lang}_INCLUDE_PATH ${MPI_INCLUDE_PATH_WORK} CACHE STRING "MPI ${lang} include path" FORCE)
+ set(MPI_${lang}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${lang} linking flags" FORCE)
+ set(MPI_${lang}_LIBRARIES ${MPI_LIBRARIES_WORK} CACHE STRING "MPI ${lang} libraries to link against" FORCE)
+ mark_as_advanced(MPI_${lang}_COMPILE_FLAGS MPI_${lang}_INCLUDE_PATH MPI_${lang}_LINK_FLAGS MPI_${lang}_LIBRARIES)
+
+ # clear out our temporary lib/header detectionv variable here.
+ set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI lib detection" FORCE)
+ set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI header detection" FORCE)
+ endif()
+
+ # finally set a found variable for each MPI language
+ if (MPI_${lang}_INCLUDE_PATH AND MPI_${lang}_LIBRARIES)
+ set(MPI_${lang}_FOUND TRUE PARENT_SCOPE)
+ else()
+ set(MPI_${lang}_FOUND FALSE PARENT_SCOPE)
+ endif()
+endfunction()
+
+
+# This function attempts to compile with the regular compiler, to see if MPI programs
+# work with it. This is a last ditch attempt after we've tried interrogating mpicc and
+# friends, and after we've tried to find generic libraries. Works on machines like
+# Cray XE6, where the modules environment changes what MPI version cc, CC, and ftn use.
+function(try_regular_compiler lang success)
+ set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
+ if (${lang} STREQUAL Fortran)
+ set(test_file ${scratch_directory}/cmake_mpi_test.f90)
+ file(WRITE ${test_file}
+ "program hello\n"
+ "include 'mpif.h'\n"
+ "integer ierror\n"
+ "call MPI_INIT(ierror)\n"
+ "call MPI_FINALIZE(ierror)\n"
+ "end\n")
+ else()
+ if (${lang} STREQUAL CXX)
+ set(test_file ${scratch_directory}/cmake_mpi_test.cpp)
+ else()
+ set(test_file ${scratch_directory}/cmake_mpi_test.c)
+ endif()
+ file(WRITE ${test_file}
+ "#include <mpi.h>\n"
+ "int main(int argc, char **argv) {\n"
+ " MPI_Init(&argc, &argv);\n"
+ " MPI_Finalize();\n"
+ "}\n")
+ endif()
+ try_compile(compiler_has_mpi ${scratch_directory} ${test_file})
+ if (compiler_has_mpi)
+ set(MPI_${lang}_NO_INTERROGATE ${CMAKE_${lang}_COMPILER} CACHE STRING "Whether to interrogate MPI ${lang} compiler" FORCE)
+ set(MPI_${lang}_COMPILER ${CMAKE_${lang}_COMPILER} CACHE STRING "MPI ${lang} compiler" FORCE)
+ set(MPI_${lang}_COMPILE_FLAGS "" CACHE STRING "MPI ${lang} compilation flags" FORCE)
+ set(MPI_${lang}_INCLUDE_PATH "" CACHE STRING "MPI ${lang} include path" FORCE)
+ set(MPI_${lang}_LINK_FLAGS "" CACHE STRING "MPI ${lang} linking flags" FORCE)
+ set(MPI_${lang}_LIBRARIES "" CACHE STRING "MPI ${lang} libraries to link against" FORCE)
+ endif()
+ set(${success} ${compiler_has_mpi} PARENT_SCOPE)
+ unset(compiler_has_mpi CACHE)
+endfunction()
+
+# End definitions, commence real work here.
+
+# Most mpi distros have some form of mpiexec which gives us something we can reliably look for.
+find_program(MPIEXEC
+ NAMES ${_MPI_EXEC_NAMES}
+ PATHS ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES bin
+ DOC "Executable for running MPI programs.")
+
+# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin).
+# This gives us a fairly reliable base directory to search for /bin /lib and /include from.
+get_filename_component(_MPI_BASE_DIR "${MPIEXEC}" PATH)
+get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH)
+
+set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.")
+set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.")
+set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIEXEC.")
+set(MPIEXEC_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run MPI applications.")
+mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
+
+
+#=============================================================================
+# Backward compatibility input hacks. Propagate the FindMPI hints to C and
+# CXX if the respective new versions are not defined. Translate the old
+# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${lang}_LIBRARIES.
+#
+# Once we find the new variables, we translate them back into their old
+# equivalents below.
+foreach (lang C CXX)
+ # Old input variables.
+ set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS)
+
+ # Set new vars based on their old equivalents, if the new versions are not already set.
+ foreach (var ${_MPI_OLD_INPUT_VARS})
+ if (NOT MPI_${lang}_${var} AND MPI_${var})
+ set(MPI_${lang}_${var} "${MPI_${var}}")
+ endif()
+ endforeach()
+
+ # Special handling for MPI_LIBRARY and MPI_EXTRA_LIBRARY, which we nixed in the
+ # new FindMPI. These need to be merged into MPI_<lang>_LIBRARIES
+ if (NOT MPI_${lang}_LIBRARIES AND (MPI_LIBRARY OR MPI_EXTRA_LIBRARY))
+ set(MPI_${lang}_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
+ endif()
+endforeach()
+#=============================================================================
+
+
+# This loop finds the compilers and sends them off for interrogation.
+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)
+ # 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()
+ 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})
+ interrogate_mpi_compiler(${lang} ${try_libs})
+ mark_as_advanced(MPI_${lang}_COMPILER)
+
+ # last ditch try -- if nothing works so far, just try running the regular compiler and
+ # see if we can create an MPI executable.
+ set(regular_compiler_worked 0)
+ if (NOT MPI_${lang}_LIBRARIES OR NOT MPI_${lang}_INCLUDE_PATH)
+ try_regular_compiler(${lang} regular_compiler_worked)
+ endif()
+
+ if (regular_compiler_worked)
+ find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_COMPILER)
+ else()
+ find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_LIBRARIES MPI_${lang}_INCLUDE_PATH)
+ endif()
+ endif()
+endforeach()
+
+
+#=============================================================================
+# More backward compatibility stuff
+#
+# Bare MPI sans ${lang} vars are set to CXX then C, depending on what was found.
+# This mimics the behavior of the old language-oblivious FindMPI.
+set(_MPI_OLD_VARS FOUND COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES)
+if (MPI_CXX_FOUND)
+ foreach (var ${_MPI_OLD_VARS})
+ set(MPI_${var} ${MPI_CXX_${var}})
+ endforeach()
+elseif (MPI_C_FOUND)
+ foreach (var ${_MPI_OLD_VARS})
+ set(MPI_${var} ${MPI_C_${var}})
+ endforeach()
+else()
+ # Note that we might still have found Fortran, but you'll need to use MPI_Fortran_FOUND
+ set(MPI_FOUND FALSE)
+endif()
+
+# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache.
+if (MPI_LIBRARIES)
+ list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
+ set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE)
+else()
+ set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE)
+endif()
+
+list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
+if (MPI_NUMLIBS GREATER 1)
+ set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES})
+ list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0)
+ set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY_WORK} CACHE STRING "Extra MPI libraries to link against" FORCE)
+else()
+ set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE)
+endif()
+#=============================================================================
+
+# unset these vars to cleanup namespace
+unset(_MPI_OLD_VARS)
+unset(_MPI_PREFIX_PATH)
+unset(_MPI_BASE_DIR)
+foreach (lang C CXX Fortran)
+ unset(_MPI_${lang}_COMPILER_NAMES)
+endforeach()
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
new file mode 100644
index 000000000..1cdb07174
--- /dev/null
+++ b/Modules/FindMatlab.cmake
@@ -0,0 +1,120 @@
+# - 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
+
+#=============================================================================
+# 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.)
+
+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")
+ ELSE(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
+ 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(${CMAKE_GENERATOR} MATCHES "Visual Studio 7")
+ 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(${CMAKE_GENERATOR} MATCHES "Borland")
+ IF(MATLAB_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Generator not compatible: ${CMAKE_GENERATOR}")
+ ENDIF(MATLAB_FIND_REQUIRED)
+ ENDIF(${CMAKE_GENERATOR} MATCHES "Borland")
+ ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 7")
+ ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
+ FIND_LIBRARY(MATLAB_MEX_LIBRARY
+ libmex
+ ${MATLAB_ROOT}
+ )
+ FIND_LIBRARY(MATLAB_MX_LIBRARY
+ libmx
+ ${MATLAB_ROOT}
+ )
+ FIND_LIBRARY(MATLAB_ENG_LIBRARY
+ libeng
+ ${MATLAB_ROOT}
+ )
+
+ FIND_PATH(MATLAB_INCLUDE_DIR
+ "mex.h"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/include"
+ )
+ELSE( WIN32 )
+ 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/
+ )
+ ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ # 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/
+ )
+ ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ 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(WIN32)
+
+# This is common to UNIX and Win32:
+SET(MATLAB_LIBRARIES
+ ${MATLAB_MEX_LIBRARY}
+ ${MATLAB_MX_LIBRARY}
+ ${MATLAB_ENG_LIBRARY}
+)
+
+IF(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES)
+ SET(MATLAB_FOUND 1)
+ENDIF(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES)
+
+MARK_AS_ADVANCED(
+ MATLAB_LIBRARIES
+ MATLAB_MEX_LIBRARY
+ MATLAB_MX_LIBRARY
+ MATLAB_ENG_LIBRARY
+ MATLAB_INCLUDE_DIR
+ MATLAB_FOUND
+ MATLAB_ROOT
+)
+
diff --git a/Modules/FindMotif.cmake b/Modules/FindMotif.cmake
new file mode 100644
index 000000000..e35411272
--- /dev/null
+++ b/Modules/FindMotif.cmake
@@ -0,0 +1,44 @@
+# - 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
+
+#=============================================================================
+# 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.)
+
+SET(MOTIF_FOUND 0)
+
+IF(UNIX)
+ FIND_PATH(MOTIF_INCLUDE_DIR
+ Xm/Xm.h
+ /usr/openwin/include
+ )
+
+ FIND_LIBRARY(MOTIF_LIBRARIES
+ Xm
+ /usr/openwin/lib
+ )
+
+ENDIF(UNIX)
+
+# handle the QUIETLY and REQUIRED arguments and set MOTIF_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Motif DEFAULT_MSG MOTIF_LIBRARIES MOTIF_INCLUDE_DIR)
+
+
+MARK_AS_ADVANCED(
+ MOTIF_INCLUDE_DIR
+ MOTIF_LIBRARIES
+)
diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake
new file mode 100644
index 000000000..cb3ce4813
--- /dev/null
+++ b/Modules/FindOpenAL.cmake
@@ -0,0 +1,99 @@
+# 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.
+#
+# 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 makes the presumption that you are include al.h like
+# #include "al.h"
+# and not
+# #include <AL/al.h>
+# The reason for this is that the latter is not entirely portable.
+# Windows/Creative Labs does not by default put their headers in AL/ and
+# OS X uses the convention <OpenAL/al.h>.
+#
+# For Windows, Creative Labs seems to have added a registry key for their
+# OpenAL 1.1 installer. I have added that key to the list of search paths,
+# however, the key looks like it could be a little fragile depending on
+# if they decide to change the 1.00.0000 number for bug fix releases.
+# Also, they seem to have laid down groundwork for multiple library platforms
+# which puts the library in an extra subdirectory. Currently there is only
+# Win32 and I have hardcoded that here. This may need to be adjusted as
+# platforms are introduced.
+# The OpenAL 1.0 installer doesn't seem to have a useful key I can use.
+# I do not know if the Nvidia OpenAL SDK has a registry key.
+#
+# For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger).
+# To support the framework, I originally wrote special framework detection
+# code in this module which I have now removed with CMake's introduction
+# of native support for frameworks.
+# In addition, OpenAL is open source, and it is possible to compile on Panther.
+# Furthermore, due to bugs in the initial OpenAL release, and the
+# transition to OpenAL 1.1, it is common to need to override the built-in
+# framework.
+# Per my request, CMake should search for frameworks first in
+# the following order:
+# ~/Library/Frameworks/OpenAL.framework/Headers
+# /Library/Frameworks/OpenAL.framework/Headers
+# /System/Library/Frameworks/OpenAL.framework/Headers
+#
+# On OS X, this will prefer the Framework version (if found) over others.
+# People will have to manually change the cache values of
+# OPENAL_LIBRARY to override this selection or set the CMake environment
+# CMAKE_INCLUDE_PATH to modify the search paths.
+
+FIND_PATH(OPENAL_INCLUDE_DIR al.h
+ HINTS
+ $ENV{OPENALDIR}
+ PATH_SUFFIXES include/AL include/OpenAL include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
+)
+
+FIND_LIBRARY(OPENAL_LIBRARY
+ NAMES OpenAL al openal OpenAL32
+ HINTS
+ $ENV{OPENALDIR}
+ PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
+)
+
+
+# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
new file mode 100644
index 000000000..98d8808c0
--- /dev/null
+++ b/Modules/FindOpenGL.cmake
@@ -0,0 +1,160 @@
+# - Try to find OpenGL
+# Once done this will define
+#
+# 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
+#
+# 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
+#
+# 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.
+#
+# 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 (WIN32)
+ IF (CYGWIN)
+
+ FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h )
+
+ FIND_LIBRARY(OPENGL_gl_LIBRARY opengl32 )
+
+ FIND_LIBRARY(OPENGL_glu_LIBRARY glu32 )
+
+ ELSE (CYGWIN)
+
+ IF(BORLAND)
+ SET (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32")
+ SET (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32")
+ ELSE(BORLAND)
+ SET (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32")
+ SET (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32")
+ ENDIF(BORLAND)
+
+ ENDIF (CYGWIN)
+
+ELSE (WIN32)
+
+ IF (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")
+
+ ELSE(APPLE)
+ # Handle HP-UX cases where we only want to find OpenGL in either hpux64
+ # or hpux32 depending on if we're doing a 64 bit build.
+ IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ SET(HPUX_IA_OPENGL_LIB_PATH /opt/graphics/OpenGL/lib/hpux32/)
+ ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ SET(HPUX_IA_OPENGL_LIB_PATH
+ /opt/graphics/OpenGL/lib/hpux64/
+ /opt/graphics/OpenGL/lib/pa20_64)
+ ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+
+ # The first line below is to make sure that the proper headers
+ # are used on a Linux machine with the NVidia drivers installed.
+ # They replace Mesa with NVidia's own library but normally do not
+ # install headers and that causes the linking to
+ # fail since the compiler finds the Mesa headers but NVidia's library.
+ # Make sure the NVIDIA directory comes BEFORE the others.
+ # - Atanas Georgiev <atanas@cs.columbia.edu>
+
+ FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
+ /usr/share/doc/NVIDIA_GLX-1.0/include
+ /usr/openwin/share/include
+ /opt/graphics/OpenGL/include /usr/X11R6/include
+ )
+
+ FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
+ /usr/share/doc/NVIDIA_GLX-1.0/include
+ /usr/openwin/share/include
+ /opt/graphics/OpenGL/include /usr/X11R6/include
+ )
+
+ FIND_LIBRARY(OPENGL_gl_LIBRARY
+ NAMES GL MesaGL
+ PATHS /opt/graphics/OpenGL/lib
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ ${HPUX_IA_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.
+ # It's not true on OSX.
+
+ IF (OPENGL_gl_LIBRARY)
+ IF(NOT X11_FOUND)
+ INCLUDE(FindX11)
+ ENDIF(NOT X11_FOUND)
+ IF (X11_FOUND)
+ IF (NOT APPLE)
+ SET (OPENGL_LIBRARIES ${X11_LIBRARIES})
+ ENDIF (NOT APPLE)
+ ENDIF (X11_FOUND)
+ ENDIF (OPENGL_gl_LIBRARY)
+
+ FIND_LIBRARY(OPENGL_glu_LIBRARY
+ NAMES GLU MesaGLU
+ PATHS ${OPENGL_gl_LIBRARY}
+ /opt/graphics/OpenGL/lib
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ )
+
+ ENDIF(APPLE)
+ENDIF (WIN32)
+
+IF(OPENGL_gl_LIBRARY)
+
+ IF(OPENGL_xmesa_INCLUDE_DIR)
+ SET( OPENGL_XMESA_FOUND "YES" )
+ ELSE(OPENGL_xmesa_INCLUDE_DIR)
+ SET( OPENGL_XMESA_FOUND "NO" )
+ ENDIF(OPENGL_xmesa_INCLUDE_DIR)
+
+ 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} )
+ ELSE(OPENGL_glu_LIBRARY)
+ SET( OPENGL_GLU_FOUND "NO" )
+ ENDIF(OPENGL_glu_LIBRARY)
+
+ # This deprecated setting is for backward compatibility with CMake1.4
+ SET (OPENGL_LIBRARY ${OPENGL_LIBRARIES})
+
+ENDIF(OPENGL_gl_LIBRARY)
+
+# This deprecated setting is for backward compatibility with CMake1.4
+SET(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
+
+# handle the QUIETLY and REQUIRED arguments and set OPENGL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL DEFAULT_MSG OPENGL_gl_LIBRARY)
+
+MARK_AS_ADVANCED(
+ OPENGL_INCLUDE_DIR
+ OPENGL_xmesa_INCLUDE_DIR
+ OPENGL_glu_LIBRARY
+ OPENGL_gl_LIBRARY
+)
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
new file mode 100644
index 000000000..b96a2ecfb
--- /dev/null
+++ b/Modules/FindOpenMP.cmake
@@ -0,0 +1,167 @@
+# - 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 set.
+#
+# 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/
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2008-2009 André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no>
+# Copyright 2012 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.)
+
+set(_OPENMP_REQUIRED_VARS)
+
+function(_OPENMP_FLAG_CANDIDATES LANG)
+ set(OpenMP_FLAG_CANDIDATES
+ #GNU
+ "-fopenmp"
+ #Microsoft Visual Studio
+ "/openmp"
+ #Intel windows
+ "-Qopenmp"
+ #PathScale, Intel
+ "-openmp"
+ #Empty, if compiler automatically accepts openmp
+ " "
+ #Sun
+ "-xopenmp"
+ #HP
+ "+Oopenmp"
+ #IBM XL C/c++
+ "-qsmp"
+ #Portland Group, MIPSpro
+ "-mp"
+ )
+
+ set(OMP_FLAG_GNU "-fopenmp")
+ set(OMP_FLAG_HP "+Oopenmp")
+ if(WIN32)
+ set(OMP_FLAG_Intel "-Qopenmp")
+ else()
+ set(OMP_FLAG_Intel "-openmp")
+ endif()
+ set(OMP_FLAG_MIPSpro "-mp")
+ set(OMP_FLAG_MSVC "/openmp")
+ set(OMP_FLAG_PathScale "-openmp")
+ set(OMP_FLAG_PGI "-mp")
+ set(OMP_FLAG_SunPro "-xopenmp")
+ set(OMP_FLAG_XL "-qsmp")
+
+ # Move the flag that matches the compiler to the head of the list,
+ # this is faster and doesn't clutter the output that much. If that
+ # flag doesn't work we will still try all.
+ if(OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID})
+ list(REMOVE_ITEM OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}")
+ list(INSERT OpenMP_FLAG_CANDIDATES 0 "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}")
+ endif()
+
+ set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_FLAG_CANDIDATES}" PARENT_SCOPE)
+endfunction(_OPENMP_FLAG_CANDIDATES)
+
+# sample openmp source code to test
+set(OpenMP_C_TEST_SOURCE
+"
+#include <omp.h>
+int main() {
+#ifdef _OPENMP
+ return 0;
+#else
+ breaks_on_purpose
+#endif
+}
+")
+
+# check c compiler
+if(CMAKE_C_COMPILER_LOADED)
+ # if these are set then do not try to find them again,
+ # by avoiding any try_compiles for the flags
+ if(OpenMP_C_FLAGS)
+ unset(OpenMP_C_FLAG_CANDIDATES)
+ else()
+ _OPENMP_FLAG_CANDIDATES("C")
+ include(CheckCSourceCompiles)
+ endif()
+
+ foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
+ 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}]")
+ check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
+ set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+ if(OpenMP_FLAG_DETECTED)
+ set(OpenMP_C_FLAGS_INTERNAL "${FLAG}")
+ break()
+ endif(OpenMP_FLAG_DETECTED)
+ endforeach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
+
+ set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}"
+ CACHE STRING "C compiler flags for OpenMP parallization")
+
+ list(APPEND _OPENMP_REQUIRED_VARS OpenMP_C_FLAGS)
+ unset(OpenMP_C_FLAG_CANDIDATES)
+endif()
+
+# check cxx compiler
+if(CMAKE_CXX_COMPILER_LOADED)
+ # if these are set then do not try to find them again,
+ # by avoiding any try_compiles for the flags
+ if(OpenMP_CXX_FLAGS)
+ unset(OpenMP_CXX_FLAG_CANDIDATES)
+ else()
+ _OPENMP_FLAG_CANDIDATES("CXX")
+ include(CheckCXXSourceCompiles)
+
+ # use the same source for CXX as C for now
+ set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE})
+ endif()
+
+ foreach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES})
+ 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}]")
+ check_cxx_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
+ set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+ if(OpenMP_FLAG_DETECTED)
+ set(OpenMP_CXX_FLAGS_INTERNAL "${FLAG}")
+ break()
+ endif(OpenMP_FLAG_DETECTED)
+ endforeach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES})
+
+ set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}"
+ CACHE STRING "C++ compiler flags for OpenMP parallization")
+
+ list(APPEND _OPENMP_REQUIRED_VARS OpenMP_CXX_FLAGS)
+ unset(OpenMP_CXX_FLAG_CANDIDATES)
+ unset(OpenMP_CXX_TEST_SOURCE)
+endif()
+
+if(_OPENMP_REQUIRED_VARS)
+ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+ find_package_handle_standard_args(OpenMP
+ REQUIRED_VARS ${_OPENMP_REQUIRED_VARS})
+
+ mark_as_advanced(${_OPENMP_REQUIRED_VARS})
+
+ unset(_OPENMP_REQUIRED_VARS)
+else()
+ message(SEND_ERROR "FindOpenMP requires C or CXX language to be enabled")
+endif()
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
new file mode 100644
index 000000000..d1fc2d259
--- /dev/null
+++ b/Modules/FindOpenSSL.cmake
@@ -0,0 +1,304 @@
+# - Try to find the OpenSSL encryption library
+# Once done this will define
+#
+# OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL
+#
+# 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)
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2009-2011 Mathieu Malaterre <mathieu.malaterre@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.)
+
+if (UNIX)
+ find_package(PkgConfig QUIET)
+ pkg_check_modules(_OPENSSL QUIET openssl)
+endif (UNIX)
+
+# http://www.slproweb.com/products/Win32OpenSSL.html
+SET(_OPENSSL_ROOT_HINTS
+ $ENV{OPENSSL_ROOT_DIR}
+ ${OPENSSL_ROOT_DIR}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
+ )
+SET(_OPENSSL_ROOT_PATHS
+ "$ENV{PROGRAMFILES}/OpenSSL"
+ "$ENV{PROGRAMFILES}/OpenSSL-Win32"
+ "$ENV{PROGRAMFILES}/OpenSSL-Win64"
+ "C:/OpenSSL/"
+ "C:/OpenSSL-Win32/"
+ "C:/OpenSSL-Win64/"
+ )
+SET(_OPENSSL_ROOT_HINTS_AND_PATHS
+ HINTS ${_OPENSSL_ROOT_HINTS}
+ PATHS ${_OPENSSL_ROOT_PATHS}
+ )
+
+FIND_PATH(OPENSSL_INCLUDE_DIR
+ NAMES
+ openssl/ssl.h
+ HINTS
+ ${_OPENSSL_INCLUDEDIR}
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ include
+)
+
+IF(WIN32 AND NOT CYGWIN)
+ # MINGW should go here too
+ IF(MSVC)
+ # /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
+ # 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
+ # * MT for static-release
+ # * MTd for static-debug
+
+ # Implementation details:
+ # 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
+ FIND_LIBRARY(LIB_EAY_DEBUG
+ NAMES
+ libeay32MDd
+ libeay32
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+
+ FIND_LIBRARY(LIB_EAY_RELEASE
+ NAMES
+ libeay32MD
+ libeay32
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+
+ FIND_LIBRARY(SSL_EAY_DEBUG
+ NAMES
+ ssleay32MDd
+ ssleay32
+ ssl
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+
+ FIND_LIBRARY(SSL_EAY_RELEASE
+ NAMES
+ ssleay32MD
+ ssleay32
+ ssl
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+
+ if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ set( OPENSSL_LIBRARIES
+ optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG}
+ optimized ${LIB_EAY_RELEASE} debug ${LIB_EAY_DEBUG}
+ )
+ else()
+ set( OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} )
+ endif()
+ MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE)
+ MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE)
+ ELSEIF(MINGW)
+ # same player, for MingW
+ FIND_LIBRARY(LIB_EAY
+ NAMES
+ libeay32
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "lib/MinGW"
+ )
+
+ FIND_LIBRARY(SSL_EAY
+ NAMES
+ ssleay32
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "lib/MinGW"
+ )
+
+ MARK_AS_ADVANCED(SSL_EAY LIB_EAY)
+ set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
+ ELSE(MSVC)
+ # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
+ FIND_LIBRARY(LIB_EAY
+ NAMES
+ libeay32
+ HINTS
+ ${_OPENSSL_LIBDIR}
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ lib
+ )
+
+ FIND_LIBRARY(SSL_EAY
+ NAMES
+ ssleay32
+ 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} )
+ ENDIF(MSVC)
+ELSE(WIN32 AND NOT CYGWIN)
+
+ FIND_LIBRARY(OPENSSL_SSL_LIBRARY
+ NAMES
+ ssl
+ ssleay32
+ ssleay32MD
+ HINTS
+ ${_OPENSSL_LIBDIR}
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ lib
+ )
+
+ FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARY
+ NAMES
+ crypto
+ HINTS
+ ${_OPENSSL_LIBDIR}
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ lib
+ )
+
+ MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
+
+ # compat defines
+ SET(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
+ SET(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+
+ SET(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
+
+ENDIF(WIN32 AND NOT CYGWIN)
+
+function(from_hex HEX DEC)
+ string(TOUPPER "${HEX}" HEX)
+ set(_res 0)
+ string(LENGTH "${HEX}" _strlen)
+
+ while (_strlen GREATER 0)
+ math(EXPR _res "${_res} * 16")
+ string(SUBSTRING "${HEX}" 0 1 NIBBLE)
+ string(SUBSTRING "${HEX}" 1 -1 HEX)
+ if (NIBBLE STREQUAL "A")
+ math(EXPR _res "${_res} + 10")
+ elseif (NIBBLE STREQUAL "B")
+ math(EXPR _res "${_res} + 11")
+ elseif (NIBBLE STREQUAL "C")
+ math(EXPR _res "${_res} + 12")
+ elseif (NIBBLE STREQUAL "D")
+ math(EXPR _res "${_res} + 13")
+ elseif (NIBBLE STREQUAL "E")
+ math(EXPR _res "${_res} + 14")
+ elseif (NIBBLE STREQUAL "F")
+ math(EXPR _res "${_res} + 15")
+ else()
+ math(EXPR _res "${_res} + ${NIBBLE}")
+ endif()
+
+ string(LENGTH "${HEX}" _strlen)
+ endwhile()
+
+ set(${DEC} ${_res} PARENT_SCOPE)
+endfunction(from_hex)
+
+if (OPENSSL_INCLUDE_DIR)
+ if (_OPENSSL_VERSION)
+ set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
+ elseif(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])+.*")
+
+ # 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.
+ # Major, minor, and fix directly translate into the version numbers shown in
+ # the string. The patch field translates to the single character suffix that
+ # indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so
+ # on.
+
+ string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$"
+ "\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}")
+ list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR)
+ list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR)
+ from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR)
+ list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX)
+ from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX)
+ list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
+
+ if (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
+ from_hex("${OPENSSL_VERSION_PATCH}" _tmp)
+ # 96 is the ASCII code of 'a' minus 1
+ math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96")
+ unset(_tmp)
+ # Once anyone knows how OpenSSL would call the patch versions beyond 'z'
+ # this should be updated to handle that, too. This has not happened yet
+ # so it is simply ignored here for now.
+ string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
+ endif (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
+
+ set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
+ endif (_OPENSSL_VERSION)
+endif (OPENSSL_INCLUDE_DIR)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+if (OPENSSL_VERSION)
+ find_package_handle_standard_args(OpenSSL
+ REQUIRED_VARS
+ OPENSSL_LIBRARIES
+ OPENSSL_INCLUDE_DIR
+ VERSION_VAR
+ OPENSSL_VERSION
+ FAIL_MESSAGE
+ "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
+ )
+else (OPENSSL_VERSION)
+ find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
+ OPENSSL_LIBRARIES
+ OPENSSL_INCLUDE_DIR
+ )
+endif (OPENSSL_VERSION)
+
+MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
new file mode 100644
index 000000000..52f931689
--- /dev/null
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -0,0 +1,246 @@
+# - Find OpenSceneGraph
+# This module searches for the OpenSceneGraph core "osg" library as well as
+# OpenThreads, and whatever additional COMPONENTS (nodekits) that you specify.
+# See http://www.openscenegraph.org
+#
+# NOTE: To use this module effectively you must either require CMake >= 2.6.3
+# with cmake_minimum_required(VERSION 2.6.3) or download and place
+# FindOpenThreads.cmake, Findosg_functions.cmake, Findosg.cmake,
+# and Find<etc>.cmake files into your CMAKE_MODULE_PATH.
+#
+#==================================
+#
+# This module accepts the following variables (note mixed case)
+#
+# OpenSceneGraph_DEBUG - Enable debugging output
+#
+# OpenSceneGraph_MARK_AS_ADVANCED - Mark cache variables as advanced
+# automatically
+#
+# The following environment variables are also respected for finding the OSG
+# and it's various components. CMAKE_PREFIX_PATH can also be used for this
+# (see find_library() CMake documentation).
+#
+# <MODULE>_DIR (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file)
+# OSG_DIR
+# OSGDIR
+# OSG_ROOT
+#
+# This module defines the following output variables:
+#
+# OPENSCENEGRAPH_FOUND - Was the OSG and all of the specified components found?
+#
+# OPENSCENEGRAPH_VERSION - The version of the OSG which was found
+#
+# OPENSCENEGRAPH_INCLUDE_DIRS - Where to find the headers
+#
+# OPENSCENEGRAPH_LIBRARIES - The OSG libraries
+#
+#==================================
+# Example Usage:
+#
+# find_package(OpenSceneGraph 2.0.0 REQUIRED osgDB osgUtil)
+# # libOpenThreads & libosg automatically searched
+# include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
+#
+# add_executable(foo foo.cc)
+# target_link_libraries(foo ${OPENSCENEGRAPH_LIBRARIES})
+#
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2009 Philip Lowman <philip@yhbt.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.)
+
+#
+# Naming convention:
+# Local variables of the form _osg_foo
+# Input variables of the form OpenSceneGraph_FOO
+# Output variables of the form OPENSCENEGRAPH_FOO
+#
+
+include(Findosg_functions)
+
+set(_osg_modules_to_process)
+foreach(_osg_component ${OpenSceneGraph_FIND_COMPONENTS})
+ list(APPEND _osg_modules_to_process ${_osg_component})
+endforeach()
+list(APPEND _osg_modules_to_process "osg" "OpenThreads")
+list(REMOVE_DUPLICATES _osg_modules_to_process)
+
+if(OpenSceneGraph_DEBUG)
+ message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Components = ${_osg_modules_to_process}")
+endif()
+
+#
+# First we need to find and parse osg/Version
+#
+OSG_FIND_PATH(OSG osg/Version)
+if(OpenSceneGraph_MARK_AS_ADVANCED)
+ OSG_MARK_AS_ADVANCED(OSG)
+endif()
+
+# Try to ascertain the version...
+if(OSG_INCLUDE_DIR)
+ if(OpenSceneGraph_DEBUG)
+ message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}")
+ endif()
+
+ set(_osg_Version_file "${OSG_INCLUDE_DIR}/osg/Version")
+ if("${OSG_INCLUDE_DIR}" MATCHES "\\.framework$" AND NOT EXISTS "${_osg_Version_file}")
+ set(_osg_Version_file "${OSG_INCLUDE_DIR}/Headers/Version")
+ endif()
+
+ if(EXISTS "${_osg_Version_file}")
+ file(READ "${_osg_Version_file}" _osg_Version_contents)
+ else()
+ set(_osg_Version_contents "unknown")
+ endif()
+
+ string(REGEX MATCH ".*#define OSG_VERSION_MAJOR[ \t]+[0-9]+.*"
+ _osg_old_defines "${_osg_Version_contents}")
+ string(REGEX MATCH ".*#define OPENSCENEGRAPH_MAJOR_VERSION[ \t]+[0-9]+.*"
+ _osg_new_defines "${_osg_Version_contents}")
+ if(_osg_old_defines)
+ string(REGEX REPLACE ".*#define OSG_VERSION_MAJOR[ \t]+([0-9]+).*"
+ "\\1" _osg_VERSION_MAJOR ${_osg_Version_contents})
+ string(REGEX REPLACE ".*#define OSG_VERSION_MINOR[ \t]+([0-9]+).*"
+ "\\1" _osg_VERSION_MINOR ${_osg_Version_contents})
+ string(REGEX REPLACE ".*#define OSG_VERSION_PATCH[ \t]+([0-9]+).*"
+ "\\1" _osg_VERSION_PATCH ${_osg_Version_contents})
+ elseif(_osg_new_defines)
+ string(REGEX REPLACE ".*#define OPENSCENEGRAPH_MAJOR_VERSION[ \t]+([0-9]+).*"
+ "\\1" _osg_VERSION_MAJOR ${_osg_Version_contents})
+ string(REGEX REPLACE ".*#define OPENSCENEGRAPH_MINOR_VERSION[ \t]+([0-9]+).*"
+ "\\1" _osg_VERSION_MINOR ${_osg_Version_contents})
+ string(REGEX REPLACE ".*#define OPENSCENEGRAPH_PATCH_VERSION[ \t]+([0-9]+).*"
+ "\\1" _osg_VERSION_PATCH ${_osg_Version_contents})
+ else()
+ message(WARNING "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Failed to parse version number, please report this as a bug")
+ endif()
+
+ set(OPENSCENEGRAPH_VERSION "${_osg_VERSION_MAJOR}.${_osg_VERSION_MINOR}.${_osg_VERSION_PATCH}"
+ CACHE INTERNAL "The version of OSG which was detected")
+ if(OpenSceneGraph_DEBUG)
+ message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Detected version ${OPENSCENEGRAPH_VERSION}")
+ endif()
+endif()
+
+#
+# Version checking
+#
+if(OpenSceneGraph_FIND_VERSION AND OPENSCENEGRAPH_VERSION)
+ if(OpenSceneGraph_FIND_VERSION_EXACT)
+ if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION})
+ set(_osg_version_not_exact TRUE)
+ endif()
+ else()
+ # version is too low
+ if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION} AND
+ NOT OPENSCENEGRAPH_VERSION VERSION_GREATER ${OpenSceneGraph_FIND_VERSION})
+ set(_osg_version_not_high_enough TRUE)
+ endif()
+ endif()
+endif()
+
+set(_osg_quiet)
+if(OpenSceneGraph_FIND_QUIETLY)
+ set(_osg_quiet "QUIET")
+endif()
+#
+# Here we call FIND_PACKAGE() on all of the components
+#
+foreach(_osg_module ${_osg_modules_to_process})
+ if(OpenSceneGraph_DEBUG)
+ message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Calling find_package(${_osg_module} ${_osg_required} ${_osg_quiet})")
+ endif()
+ 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})
+
+ if(OpenSceneGraph_MARK_AS_ADVANCED)
+ OSG_MARK_AS_ADVANCED(${_osg_module})
+ endif()
+endforeach()
+
+if(OPENSCENEGRAPH_INCLUDE_DIR)
+ list(REMOVE_DUPLICATES OPENSCENEGRAPH_INCLUDE_DIR)
+endif()
+
+#
+# Inform the users with an error message based on
+# what version they have vs. what version was
+# required.
+#
+if(OpenSceneGraph_FIND_REQUIRED)
+ set(_osg_version_output_type FATAL_ERROR)
+else()
+ set(_osg_version_output_type STATUS)
+endif()
+if(_osg_version_not_high_enough)
+ set(_osg_EPIC_FAIL TRUE)
+ if(NOT OpenSceneGraph_FIND_QUIETLY)
+ message(${_osg_version_output_type}
+ "ERROR: Version ${OpenSceneGraph_FIND_VERSION} or higher of the OSG "
+ "is required. Version ${OPENSCENEGRAPH_VERSION} was found.")
+ endif()
+elseif(_osg_version_not_exact)
+ set(_osg_EPIC_FAIL TRUE)
+ if(NOT OpenSceneGraph_FIND_QUIETLY)
+ message(${_osg_version_output_type}
+ "ERROR: Version ${OpenSceneGraph_FIND_VERSION} of the OSG is required "
+ "(exactly), version ${OPENSCENEGRAPH_VERSION} was found.")
+ endif()
+else()
+
+ #
+ # Check each module to see if it's found
+ #
+ if(OpenSceneGraph_FIND_REQUIRED)
+ set(_osg_missing_message)
+ foreach(_osg_module ${_osg_modules_to_process})
+ string(TOUPPER ${_osg_module} _osg_module_UC)
+ if(NOT ${_osg_module_UC}_FOUND)
+ set(_osg_missing_nodekit_fail true)
+ set(_osg_missing_message "${_osg_missing_message} ${_osg_module}")
+ endif()
+ endforeach()
+
+ if(_osg_missing_nodekit_fail)
+ message(FATAL_ERROR "ERROR: Missing the following osg "
+ "libraries: ${_osg_missing_message}.\n"
+ "Consider using CMAKE_PREFIX_PATH or the OSG_DIR "
+ "environment variable. See the "
+ "${CMAKE_CURRENT_LIST_FILE} for more details.")
+ endif()
+ endif()
+
+ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph DEFAULT_MSG OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR)
+endif()
+
+if(_osg_EPIC_FAIL)
+ # Zero out everything, we didn't meet version requirements
+ set(OPENSCENEGRAPH_FOUND FALSE)
+ set(OPENSCENEGRAPH_LIBRARIES)
+ set(OPENSCENEGRAPH_INCLUDE_DIR)
+endif()
+
+set(OPENSCENEGRAPH_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIR})
+
diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake
new file mode 100644
index 000000000..6b81fbe3a
--- /dev/null
+++ b/Modules/FindOpenThreads.cmake
@@ -0,0 +1,123 @@
+# OpenThreads is a C++ based threading library. Its largest userbase
+# seems to OpenSceneGraph so you might notice I accept OSGDIR as an
+# environment path.
+# I consider this part of the Findosg* suite used to find OpenSceneGraph
+# components.
+# Each component is separate and you must opt in to each module.
+#
+# Locate OpenThreads
+# This module defines
+# OPENTHREADS_LIBRARY
+# OPENTHREADS_FOUND, if false, do not try to link to OpenThreads
+# OPENTHREADS_INCLUDE_DIR, where to find the headers
+#
+# $OPENTHREADS_DIR is an environment variable that would
+# correspond to the ./configure --prefix=$OPENTHREADS_DIR
+# used in building osg.
+#
+# Created by Eric Wing.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <OpenThreads/Thread>
+
+# To make it easier for one-step automated configuration/builds,
+# we leverage environmental paths. This is preferable
+# to the -DVAR=value switches because it insulates the
+# users from changes we may make in this script.
+# It also offers a little more flexibility than setting
+# the CMAKE_*_PATH since we can target specific components.
+# However, the default CMake behavior will search system paths
+# before anything else. This is problematic in the cases
+# where you have an older (stable) version installed, but
+# are trying to build a newer version.
+# CMake doesn't offer a nice way to globally control this behavior
+# so we have to do a nasty "double FIND_" in this module.
+# The first FIND disables the CMAKE_ search paths and only checks
+# the environmental paths.
+# If nothing is found, then the second find will search the
+# standard install paths.
+# Explicit -DVAR=value arguments should still be able to override everything.
+
+find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
+ HINTS
+ # enough environment variables?
+ $ENV{OPENTHREADS_INCLUDE_DIR}
+ $ENV{OPENTHREADS_DIR}
+ $ENV{OSG_INCLUDE_DIR}
+ $ENV{OSG_DIR}
+ $ENV{OSGDIR}
+ $ENV{OpenThreads_ROOT}
+ $ENV{OSG_ROOT}
+ PATHS
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+ /usr/freeware
+ PATH_SUFFIXES include
+)
+
+
+find_library(OPENTHREADS_LIBRARY
+ NAMES OpenThreads OpenThreadsWin32
+ HINTS
+ $ENV{OPENTHREADS_LIBRARY_DIR}
+ $ENV{OPENTHREADS_DIR}
+ $ENV{OSG_LIBRARY_DIR}
+ $ENV{OSG_DIR}
+ $ENV{OSGDIR}
+ $ENV{OpenThreads_ROOT}
+ $ENV{OSG_ROOT}
+ PATHS
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ /usr/freeware
+ PATH_SUFFIXES lib64 lib
+)
+
+find_library(OPENTHREADS_LIBRARY_DEBUG
+ NAMES OpenThreadsd OpenThreadsWin32d
+ HINTS
+ $ENV{OPENTHREADS_DEBUG_LIBRARY_DIR}
+ $ENV{OPENTHREADS_LIBRARY_DIR}
+ $ENV{OPENTHREADS_DIR}
+ $ENV{OSG_LIBRARY_DIR}
+ $ENV{OSG_DIR}
+ $ENV{OSGDIR}
+ $ENV{OpenThreads_ROOT}
+ $ENV{OSG_ROOT}
+ PATHS
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ /usr/freeware
+ PATH_SUFFIXES lib64 lib
+)
+
+if(OPENTHREADS_LIBRARY_DEBUG)
+ set(OPENTHREADS_LIBRARIES
+ optimized ${OPENTHREADS_LIBRARY}
+ debug ${OPENTHREADS_LIBRARY_DEBUG})
+else()
+ set(OPENTHREADS_LIBRARIES ${OPENTHREADS_LIBRARY})
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenThreads DEFAULT_MSG
+ OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR)
diff --git a/Modules/FindPHP4.cmake b/Modules/FindPHP4.cmake
new file mode 100644
index 000000000..6c2965a7a
--- /dev/null
+++ b/Modules/FindPHP4.cmake
@@ -0,0 +1,85 @@
+# - 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.
+#
+# 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(PHP4_POSSIBLE_INCLUDE_PATHS
+ /usr/include/php4
+ /usr/local/include/php4
+ /usr/include/php
+ /usr/local/include/php
+ /usr/local/apache/php
+ )
+
+SET(PHP4_POSSIBLE_LIB_PATHS
+ /usr/lib
+ )
+
+FIND_PATH(PHP4_FOUND_INCLUDE_PATH main/php.h
+ ${PHP4_POSSIBLE_INCLUDE_PATHS})
+
+IF(PHP4_FOUND_INCLUDE_PATH)
+ SET(php4_paths "${PHP4_POSSIBLE_INCLUDE_PATHS}")
+ FOREACH(php4_path Zend main TSRM)
+ SET(php4_paths ${php4_paths} "${PHP4_FOUND_INCLUDE_PATH}/${php4_path}")
+ ENDFOREACH(php4_path Zend main TSRM)
+ SET(PHP4_INCLUDE_PATH "${php4_paths}" INTERNAL "PHP4 include paths")
+ENDIF(PHP4_FOUND_INCLUDE_PATH)
+
+FIND_PROGRAM(PHP4_EXECUTABLE NAMES php4 php )
+
+MARK_AS_ADVANCED(
+ PHP4_EXECUTABLE
+ PHP4_FOUND_INCLUDE_PATH
+ )
+
+IF(APPLE)
+# this is a hack for now
+ SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
+ "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -Wl,-flat_namespace")
+ FOREACH(symbol
+ __efree
+ __emalloc
+ __estrdup
+ __object_init_ex
+ __zend_get_parameters_array_ex
+ __zend_list_find
+ __zval_copy_ctor
+ _add_property_zval_ex
+ _alloc_globals
+ _compiler_globals
+ _convert_to_double
+ _convert_to_long
+ _zend_error
+ _zend_hash_find
+ _zend_register_internal_class_ex
+ _zend_register_list_destructors_ex
+ _zend_register_resource
+ _zend_rsrc_list_get_rsrc_type
+ _zend_wrong_param_count
+ _zval_used_for_init
+ )
+ SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
+ "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS},-U,${symbol}")
+ ENDFOREACH(symbol)
+ENDIF(APPLE)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PHP4 DEFAULT_MSG PHP4_EXECUTABLE PHP4_INCLUDE_PATH)
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
new file mode 100644
index 000000000..a6c181cb1
--- /dev/null
+++ b/Modules/FindPNG.cmake
@@ -0,0 +1,75 @@
+# - Find the native PNG includes and library
+#
+# This module searches libpng, the library for working with PNG images.
+#
+# 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.
+#
+# 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.
+#
+# 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(PNG_FIND_QUIETLY)
+ set(_FIND_ZLIB_ARG QUIET)
+endif(PNG_FIND_QUIETLY)
+find_package(ZLIB ${_FIND_ZLIB_ARG})
+
+if(ZLIB_FOUND)
+ find_path(PNG_PNG_INCLUDE_DIR png.h
+ /usr/local/include/libpng # OpenBSD
+ )
+
+ set(PNG_NAMES ${PNG_NAMES} png libpng png15 libpng15 png15d libpng15d png14 libpng14 png14d libpng14d png12 libpng12 png12d libpng12d)
+ find_library(PNG_LIBRARY NAMES ${PNG_NAMES} )
+
+ if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
+ # png.h includes zlib.h. Sigh.
+ SET(PNG_INCLUDE_DIRS ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
+ SET(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS} ) # for backward compatiblity
+ SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
+
+ if (CYGWIN)
+ if(BUILD_SHARED_LIBS)
+ # No need to define PNG_USE_DLL here, because it's default for Cygwin.
+ else(BUILD_SHARED_LIBS)
+ SET (PNG_DEFINITIONS -DPNG_STATIC)
+ endif(BUILD_SHARED_LIBS)
+ endif (CYGWIN)
+
+ endif (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
+
+ if (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h")
+ file(STRINGS "${PNG_PNG_INCLUDE_DIR}/png.h" png_version_str REGEX "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\".+\"")
+
+ string(REGEX REPLACE "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\"([^\"]+)\".*" "\\1" PNG_VERSION_STRING "${png_version_str}")
+ unset(png_version_str)
+ endif (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h")
+endif(ZLIB_FOUND)
+
+# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
+# all listed variables are TRUE
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(PNG
+ REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR
+ VERSION_VAR PNG_VERSION_STRING)
+
+mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
new file mode 100644
index 000000000..cdcf9ca7c
--- /dev/null
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -0,0 +1,296 @@
+# 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 <UPPERCASED_NAME>_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 [REQUIRED_VARS <var1>...<varN>]
+# [VERSION_VAR <versionvar>]
+# [HANDLE_COMPONENTS]
+# [CONFIG_MODE]
+# [FAIL_MESSAGE "Custom failure message"] )
+#
+# As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_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 <NAME>_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(BISON REQUIRED_VARS BISON_EXECUTABLE
+# VERSION_VAR BISON_VERSION)
+# In this case, BISON is considered to be found if the variable(s) listed
+# after REQUIRED_VAR are all valid, i.e. BISON_EXECUTABLE in this case.
+# Also the version of BISON will be checked by using the version contained
+# in BISON_VERSION.
+# 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.
+# The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper
+# success/error message.
+
+#=============================================================================
+# 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.)
+
+INCLUDE(FindPackageMessage)
+INCLUDE(CMakeParseArguments)
+
+# internal helper macro
+MACRO(_FPHSA_FAILURE_MESSAGE _msg)
+ IF (${_NAME}_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "${_msg}")
+ ELSE (${_NAME}_FIND_REQUIRED)
+ IF (NOT ${_NAME}_FIND_QUIETLY)
+ MESSAGE(STATUS "${_msg}")
+ ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+ ENDIF (${_NAME}_FIND_REQUIRED)
+ENDMACRO(_FPHSA_FAILURE_MESSAGE _msg)
+
+
+# internal helper macro to generate the failure message when used in CONFIG_MODE:
+MACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
+ # <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
+ IF(${_NAME}_CONFIG)
+ _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
+ ELSE(${_NAME}_CONFIG)
+ # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
+ # List them all in the error message:
+ IF(${_NAME}_CONSIDERED_CONFIGS)
+ SET(configsText "")
+ LIST(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
+ MATH(EXPR configsCount "${configsCount} - 1")
+ FOREACH(currentConfigIndex RANGE ${configsCount})
+ LIST(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
+ LIST(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
+ SET(configsText "${configsText} ${filename} (version ${version})\n")
+ ENDFOREACH(currentConfigIndex)
+ _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
+
+ ELSE(${_NAME}_CONSIDERED_CONFIGS)
+ # Simple case: No Config-file was found at all:
+ _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
+ ENDIF(${_NAME}_CONSIDERED_CONFIGS)
+ ENDIF(${_NAME}_CONFIG)
+ENDMACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
+
+
+FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
+
+# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in
+# new extended or in the "old" mode:
+ SET(options CONFIG_MODE HANDLE_COMPONENTS)
+ SET(oneValueArgs FAIL_MESSAGE VERSION_VAR)
+ SET(multiValueArgs REQUIRED_VARS)
+ SET(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
+ LIST(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
+
+ IF(${INDEX} EQUAL -1)
+ SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
+ SET(FPHSA_REQUIRED_VARS ${ARGN})
+ SET(FPHSA_VERSION_VAR)
+ ELSE(${INDEX} EQUAL -1)
+
+ CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
+
+ IF(FPHSA_UNPARSED_ARGUMENTS)
+ MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
+ ENDIF(FPHSA_UNPARSED_ARGUMENTS)
+
+ IF(NOT FPHSA_FAIL_MESSAGE)
+ SET(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
+ ENDIF(NOT FPHSA_FAIL_MESSAGE)
+ ENDIF(${INDEX} EQUAL -1)
+
+# now that we collected all arguments, process them
+
+ IF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
+ SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
+ ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
+
+ # In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package()
+ # when it successfully found the config-file, including version checking:
+ IF(FPHSA_CONFIG_MODE)
+ LIST(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
+ LIST(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
+ SET(FPHSA_VERSION_VAR ${_NAME}_VERSION)
+ ENDIF(FPHSA_CONFIG_MODE)
+
+ IF(NOT FPHSA_REQUIRED_VARS)
+ MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
+ ENDIF(NOT FPHSA_REQUIRED_VARS)
+
+ LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
+
+ STRING(TOUPPER ${_NAME} _NAME_UPPER)
+ STRING(TOLOWER ${_NAME} _NAME_LOWER)
+
+ # collect all variables which were not found, so they can be printed, so the
+ # user knows better what went wrong (#6375)
+ SET(MISSING_VARS "")
+ SET(DETAILS "")
+ SET(${_NAME_UPPER}_FOUND TRUE)
+ # check if all passed variables are valid
+ FOREACH(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
+ IF(NOT ${_CURRENT_VAR})
+ SET(${_NAME_UPPER}_FOUND FALSE)
+ SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
+ ELSE(NOT ${_CURRENT_VAR})
+ SET(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
+ ENDIF(NOT ${_CURRENT_VAR})
+ ENDFOREACH(_CURRENT_VAR)
+
+ # component handling
+ UNSET(FOUND_COMPONENTS_MSG)
+ UNSET(MISSING_COMPONENTS_MSG)
+
+ IF(FPHSA_HANDLE_COMPONENTS)
+ FOREACH(comp ${${_NAME}_FIND_COMPONENTS})
+ IF(${_NAME}_${comp}_FOUND)
+
+ IF(NOT DEFINED FOUND_COMPONENTS_MSG)
+ SET(FOUND_COMPONENTS_MSG "found components: ")
+ ENDIF()
+ SET(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}")
+
+ ELSE()
+
+ IF(NOT DEFINED MISSING_COMPONENTS_MSG)
+ SET(MISSING_COMPONENTS_MSG "missing components: ")
+ ENDIF()
+ SET(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}")
+
+ IF(${_NAME}_FIND_REQUIRED_${comp})
+ SET(${_NAME_UPPER}_FOUND FALSE)
+ SET(MISSING_VARS "${MISSING_VARS} ${comp}")
+ ENDIF()
+
+ ENDIF()
+ ENDFOREACH(comp)
+ SET(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
+ SET(DETAILS "${DETAILS}[c${COMPONENT_MSG}]")
+ ENDIF(FPHSA_HANDLE_COMPONENTS)
+
+ # version handling:
+ SET(VERSION_MSG "")
+ SET(VERSION_OK TRUE)
+ SET(VERSION ${${FPHSA_VERSION_VAR}} )
+ IF (${_NAME}_FIND_VERSION)
+
+ IF(VERSION)
+
+ 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)
+ ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
+ SET(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
+ ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
+
+ ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified:
+ 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 ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
+ SET(VERSION_MSG "(found suitable version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")")
+ ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
+ ENDIF(${_NAME}_FIND_VERSION_EXACT)
+
+ ELSE(VERSION)
+
+ # if the package was not found, but a version was given, add that to the output:
+ IF(${_NAME}_FIND_VERSION_EXACT)
+ SET(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
+ ELSE(${_NAME}_FIND_VERSION_EXACT)
+ SET(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
+ ENDIF(${_NAME}_FIND_VERSION_EXACT)
+
+ ENDIF(VERSION)
+ ELSE (${_NAME}_FIND_VERSION)
+ IF(VERSION)
+ SET(VERSION_MSG "(found version \"${VERSION}\")")
+ ENDIF(VERSION)
+ ENDIF (${_NAME}_FIND_VERSION)
+
+ IF(VERSION_OK)
+ SET(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
+ ELSE(VERSION_OK)
+ SET(${_NAME_UPPER}_FOUND FALSE)
+ ENDIF(VERSION_OK)
+
+
+ # print the result:
+ IF (${_NAME_UPPER}_FOUND)
+ FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
+ ELSE (${_NAME_UPPER}_FOUND)
+
+ IF(FPHSA_CONFIG_MODE)
+ _FPHSA_HANDLE_FAILURE_CONFIG_MODE()
+ ELSE(FPHSA_CONFIG_MODE)
+ IF(NOT VERSION_OK)
+ _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
+ ELSE(NOT VERSION_OK)
+ _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
+ ENDIF(NOT VERSION_OK)
+ ENDIF(FPHSA_CONFIG_MODE)
+
+ ENDIF (${_NAME_UPPER}_FOUND)
+
+ SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
+
+ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _FIRST_ARG)
diff --git a/Modules/FindPackageMessage.cmake b/Modules/FindPackageMessage.cmake
new file mode 100644
index 000000000..48d3472b5
--- /dev/null
+++ b/Modules/FindPackageMessage.cmake
@@ -0,0 +1,49 @@
+# FIND_PACKAGE_MESSAGE(<name> "message for user" "find result details")
+#
+# This macro is intended to be used in FindXXX.cmake modules files.
+# It will print a message once for each unique find result.
+# This is useful for telling the user where a package was found.
+# The first argument specifies the name (XXX) of the package.
+# The second argument specifies the message to display.
+# The third argument lists details about the find result so that
+# if they change the message will be displayed again.
+# The macro also obeys the QUIET argument to the find_package command.
+#
+# Example:
+#
+# IF(X11_FOUND)
+# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
+# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
+# ELSE(X11_FOUND)
+# ...
+# ENDIF(X11_FOUND)
+
+#=============================================================================
+# Copyright 2008-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.)
+
+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}")
+ SET(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
+ IF(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
+ # The message has not yet been printed.
+ MESSAGE(STATUS "${msg}")
+
+ # Save the find details in the cache to avoid printing the same
+ # message again.
+ SET("${DETAILS_VAR}" "${details}"
+ CACHE INTERNAL "Details about finding ${pkg}")
+ ENDIF(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
+ ENDIF(NOT ${pkg}_FIND_QUIETLY)
+ENDFUNCTION(FIND_PACKAGE_MESSAGE)
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake
new file mode 100644
index 000000000..ae686df75
--- /dev/null
+++ b/Modules/FindPerl.cmake
@@ -0,0 +1,83 @@
+# - 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)
+
+#=============================================================================
+# 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.)
+
+INCLUDE(FindCygwin)
+
+SET(PERL_POSSIBLE_BIN_PATHS
+ ${CYGWIN_INSTALL_PATH}/bin
+ )
+
+IF(WIN32)
+ GET_FILENAME_COMPONENT(
+ ActivePerl_CurrentVersion
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl;CurrentVersion]"
+ NAME)
+ SET(PERL_POSSIBLE_BIN_PATHS ${PERL_POSSIBLE_BIN_PATHS}
+ "C:/Perl/bin"
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl\\${ActivePerl_CurrentVersion}]/bin
+ )
+ENDIF(WIN32)
+
+FIND_PROGRAM(PERL_EXECUTABLE
+ NAMES perl
+ PATHS ${PERL_POSSIBLE_BIN_PATHS}
+ )
+
+IF(PERL_EXECUTABLE)
+ ### PERL_VERSION
+ EXECUTE_PROCESS(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:version
+ OUTPUT_VARIABLE
+ PERL_VERSION_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_VERSION_RESULT_VARIABLE
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ IF(NOT PERL_VERSION_RESULT_VARIABLE AND NOT PERL_VERSION_OUTPUT_VARIABLE MATCHES "^version='UNKNOWN'")
+ STRING(REGEX REPLACE "version='([^']+)'.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE})
+ ELSE()
+ EXECUTE_PROCESS(
+ COMMAND ${PERL_EXECUTABLE} -v
+ OUTPUT_VARIABLE PERL_VERSION_OUTPUT_VARIABLE
+ RESULT_VARIABLE PERL_VERSION_RESULT_VARIABLE
+ ERROR_QUIET
+ 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})
+ 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})
+ ENDIF()
+ ENDIF()
+ENDIF(PERL_EXECUTABLE)
+
+# Deprecated settings for compatibility with CMake1.4
+SET(PERL ${PERL_EXECUTABLE})
+
+# handle the QUIETLY and REQUIRED arguments and set PERL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl
+ REQUIRED_VARS PERL_EXECUTABLE
+ VERSION_VAR PERL_VERSION_STRING)
+
+MARK_AS_ADVANCED(PERL_EXECUTABLE)
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake
new file mode 100644
index 000000000..b2ffd3cf6
--- /dev/null
+++ b/Modules/FindPerlLibs.cmake
@@ -0,0 +1,255 @@
+# - Find Perl libraries
+# This module finds if PERL is installed and determines where the include files
+# and libraries are. It also determines what the name of the library is. This
+# code sets the following variables:
+#
+# PERLLIBS_FOUND = True if perl.h & libperl were found
+# PERL_INCLUDE_PATH = path to where perl.h is found
+# PERL_LIBRARY = path to libperl
+# PERL_EXECUTABLE = full path to the perl binary
+#
+# The minimum required version of Perl can be specified using the
+# standard syntax, e.g. FIND_PACKAGE(PerlLibs 6.0)
+#
+# The following variables are also available if needed
+# (introduced after CMake 2.6.4)
+#
+# PERL_SITESEARCH = path to the sitesearch install dir
+# 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.
+# Copyright 2008 Andreas Schneider <asn@cryptomilk.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.)
+
+# find the perl executable
+include(FindPerl)
+
+if (PERL_EXECUTABLE)
+ ### PERL_PREFIX
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:prefix
+ OUTPUT_VARIABLE
+ PERL_PREFIX_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_PREFIX_RESULT_VARIABLE
+ )
+
+ if (NOT PERL_PREFIX_RESULT_VARIABLE)
+ string(REGEX REPLACE "prefix='([^']+)'.*" "\\1" PERL_PREFIX ${PERL_PREFIX_OUTPUT_VARIABLE})
+ endif (NOT PERL_PREFIX_RESULT_VARIABLE)
+
+ ### PERL_ARCHNAME
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:archname
+ OUTPUT_VARIABLE
+ PERL_ARCHNAME_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_ARCHNAME_RESULT_VARIABLE
+ )
+ if (NOT PERL_ARCHNAME_RESULT_VARIABLE)
+ string(REGEX REPLACE "archname='([^']+)'.*" "\\1" PERL_ARCHNAME ${PERL_ARCHNAME_OUTPUT_VARIABLE})
+ endif (NOT PERL_ARCHNAME_RESULT_VARIABLE)
+
+
+
+ ### PERL_EXTRA_C_FLAGS
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:cppflags
+ OUTPUT_VARIABLE
+ PERL_CPPFLAGS_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_CPPFLAGS_RESULT_VARIABLE
+ )
+ if (NOT PERL_CPPFLAGS_RESULT_VARIABLE)
+ string(REGEX REPLACE "cppflags='([^']+)'.*" "\\1" PERL_EXTRA_C_FLAGS ${PERL_CPPFLAGS_OUTPUT_VARIABLE})
+ endif (NOT PERL_CPPFLAGS_RESULT_VARIABLE)
+
+ ### PERL_SITESEARCH
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:installsitesearch
+ OUTPUT_VARIABLE
+ PERL_SITESEARCH_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_SITESEARCH_RESULT_VARIABLE
+ )
+ if (NOT PERL_SITESEARCH_RESULT_VARIABLE)
+ string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITESEARCH ${PERL_SITESEARCH_OUTPUT_VARIABLE})
+ file(TO_CMAKE_PATH "${PERL_SITESEARCH}" PERL_SITESEARCH)
+ endif (NOT PERL_SITESEARCH_RESULT_VARIABLE)
+
+ ### PERL_SITELIB
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:installsitelib
+ OUTPUT_VARIABLE
+ PERL_SITELIB_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_SITELIB_RESULT_VARIABLE
+ )
+ if (NOT PERL_SITELIB_RESULT_VARIABLE)
+ string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITELIB ${PERL_SITELIB_OUTPUT_VARIABLE})
+ file(TO_CMAKE_PATH "${PERL_SITELIB}" PERL_SITELIB)
+ endif (NOT PERL_SITELIB_RESULT_VARIABLE)
+
+ ### PERL_VENDORARCH
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:installvendorarch
+ OUTPUT_VARIABLE
+ PERL_VENDORARCH_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_VENDORARCH_RESULT_VARIABLE
+ )
+ if (NOT PERL_VENDORARCH_RESULT_VARIABLE)
+ string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORARCH ${PERL_VENDORARCH_OUTPUT_VARIABLE})
+ file(TO_CMAKE_PATH "${PERL_VENDORARCH}" PERL_VENDORARCH)
+ endif (NOT PERL_VENDORARCH_RESULT_VARIABLE)
+
+ ### PERL_VENDORLIB
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:installvendorlib
+ OUTPUT_VARIABLE
+ PERL_VENDORLIB_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_VENDORLIB_RESULT_VARIABLE
+ )
+ if (NOT PERL_VENDORLIB_RESULT_VARIABLE)
+ string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORLIB ${PERL_VENDORLIB_OUTPUT_VARIABLE})
+ file(TO_CMAKE_PATH "${PERL_VENDORLIB}" PERL_VENDORLIB)
+ endif (NOT PERL_VENDORLIB_RESULT_VARIABLE)
+
+ macro(perl_adjust_darwin_lib_variable varname)
+ string( TOUPPER PERL_${varname} FINDPERL_VARNAME )
+ string( TOLOWER install${varname} PERL_VARNAME )
+
+ if (NOT PERL_MINUSV_OUTPUT_VARIABLE)
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V
+ OUTPUT_VARIABLE
+ PERL_MINUSV_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_MINUSV_RESULT_VARIABLE
+ )
+ endif()
+
+ if (NOT PERL_MINUSV_RESULT_VARIABLE)
+ string(REGEX MATCH "(${PERL_VARNAME}.*points? to the Updates directory)"
+ PERL_NEEDS_ADJUSTMENT ${PERL_MINUSV_OUTPUT_VARIABLE})
+
+ if (PERL_NEEDS_ADJUSTMENT)
+ string(REGEX REPLACE "(.*)/Updates/" "/System/\\1/" ${FINDPERL_VARNAME} ${${FINDPERL_VARNAME}})
+ endif (PERL_NEEDS_ADJUSTMENT)
+
+ endif (NOT PERL_MINUSV_RESULT_VARIABLE)
+ endmacro()
+
+ ### PERL_ARCHLIB
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:installarchlib
+ OUTPUT_VARIABLE
+ PERL_ARCHLIB_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_ARCHLIB_RESULT_VARIABLE
+ )
+ if (NOT PERL_ARCHLIB_RESULT_VARIABLE)
+ string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_ARCHLIB ${PERL_ARCHLIB_OUTPUT_VARIABLE})
+ perl_adjust_darwin_lib_variable( ARCHLIB )
+ file(TO_CMAKE_PATH "${PERL_ARCHLIB}" PERL_ARCHLIB)
+ endif (NOT PERL_ARCHLIB_RESULT_VARIABLE)
+
+ ### PERL_PRIVLIB
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:installprivlib
+ OUTPUT_VARIABLE
+ PERL_PRIVLIB_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_PRIVLIB_RESULT_VARIABLE
+ )
+ if (NOT PERL_PRIVLIB_RESULT_VARIABLE)
+ string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_PRIVLIB ${PERL_PRIVLIB_OUTPUT_VARIABLE})
+ perl_adjust_darwin_lib_variable( PRIVLIB )
+ file(TO_CMAKE_PATH "${PERL_PRIVLIB}" PERL_PRIVLIB)
+ endif (NOT PERL_PRIVLIB_RESULT_VARIABLE)
+
+ ### PERL_POSSIBLE_LIBRARY_NAMES
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V:libperl
+ OUTPUT_VARIABLE
+ PERL_LIBRARY_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_LIBRARY_RESULT_VARIABLE
+ )
+ if (NOT PERL_LIBRARY_RESULT_VARIABLE)
+ string(REGEX REPLACE "libperl='([^']+)'.*" "\\1" PERL_POSSIBLE_LIBRARY_NAMES ${PERL_LIBRARY_OUTPUT_VARIABLE})
+ else (NOT PERL_LIBRARY_RESULT_VARIABLE)
+ set(PERL_POSSIBLE_LIBRARY_NAMES perl${PERL_VERSION_STRING} perl)
+ endif (NOT PERL_LIBRARY_RESULT_VARIABLE)
+
+ ### PERL_INCLUDE_PATH
+ find_path(PERL_INCLUDE_PATH
+ NAMES
+ perl.h
+ PATHS
+ ${PERL_ARCHLIB}/CORE
+ /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
+ /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
+ /usr/lib/perl5/${PERL_VERSION_STRING}/CORE
+ /usr/lib/perl/${PERL_VERSION_STRING}/CORE
+ )
+
+ ### PERL_LIBRARY
+ find_library(PERL_LIBRARY
+ NAMES
+ ${PERL_POSSIBLE_LIBRARY_NAMES}
+ PATHS
+ ${PERL_ARCHLIB}/CORE
+ /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
+ /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
+ /usr/lib/perl5/${PERL_VERSION_STRING}/CORE
+ /usr/lib/perl/${PERL_VERSION_STRING}/CORE
+ )
+
+endif (PERL_EXECUTABLE)
+
+# handle the QUIETLY and REQUIRED arguments and set PERLLIBS_FOUND to TRUE if
+# all listed variables are TRUE
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLUDE_PATH
+ VERSION_VAR PERL_VERSION_STRING)
+
+# Introduced after CMake 2.6.4 to bring module into compliance
+set(PERL_INCLUDE_DIR ${PERL_INCLUDE_PATH})
+set(PERL_INCLUDE_DIRS ${PERL_INCLUDE_PATH})
+set(PERL_LIBRARIES ${PERL_LIBRARY})
+# For backward compatibility with CMake before 2.8.8
+set(PERL_VERSION ${PERL_VERSION_STRING})
+
+mark_as_advanced(
+ PERL_INCLUDE_PATH
+ PERL_LIBRARY
+)
diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake
new file mode 100644
index 000000000..2e3ac1400
--- /dev/null
+++ b/Modules/FindPhysFS.cmake
@@ -0,0 +1,57 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h
+ HINTS
+ $ENV{PHYSFSDIR}
+ PATH_SUFFIXES include/physfs include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+)
+
+FIND_LIBRARY(PHYSFS_LIBRARY
+ NAMES physfs
+ HINTS
+ $ENV{PHYSFSDIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+# handle the QUIETLY and REQUIRED arguments and set PHYSFS_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR)
+
diff --git a/Modules/FindPike.cmake b/Modules/FindPike.cmake
new file mode 100644
index 000000000..125e42832
--- /dev/null
+++ b/Modules/FindPike.cmake
@@ -0,0 +1,37 @@
+# - 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.
+#
+# 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.)
+
+FILE(GLOB PIKE_POSSIBLE_INCLUDE_PATHS
+ /usr/include/pike/*
+ /usr/local/include/pike/*)
+
+FIND_PATH(PIKE_INCLUDE_PATH program.h
+ ${PIKE_POSSIBLE_INCLUDE_PATHS})
+
+FIND_PROGRAM(PIKE_EXECUTABLE
+ NAMES pike7.4
+ )
+
+MARK_AS_ADVANCED(
+ PIKE_EXECUTABLE
+ PIKE_INCLUDE_PATH
+ )
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
new file mode 100644
index 000000000..39d3a76ab
--- /dev/null
+++ b/Modules/FindPkgConfig.cmake
@@ -0,0 +1,373 @@
+# - a pkg-config module for CMake
+#
+# Usage:
+# pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
+# checks for all the given modules
+#
+# pkg_search_module(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
+# checks for given modules and uses the first working one
+#
+# When the 'REQUIRED' argument was set, macros will fail with an error
+# when module(s) could not be found
+#
+# When the 'QUIET' argument is set, no status messages will be printed.
+#
+# It sets the following variables:
+# PKG_CONFIG_FOUND ... if pkg-config executable was found
+# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
+# PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
+# (since CMake 2.8.8)
+#
+# For the following variables two sets of values exist; first one is the
+# common one and has the given PREFIX. The second set contains flags
+# which are given out when pkgconfig was called with the '--static'
+# option.
+# <XPREFIX>_FOUND ... set to 1 if module(s) exist
+# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
+# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
+# <XPREFIX>_LDFLAGS ... all required linker flags
+# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
+# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
+# <XPREFIX>_CFLAGS ... all required cflags
+# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
+#
+# <XPREFIX> = <PREFIX> for common case
+# <XPREFIX> = <PREFIX>_STATIC for static linking
+#
+# There are some special variables whose prefix depends on the count
+# of given modules. When there is only one module, <PREFIX> stays
+# unchanged. When there are multiple modules, the prefix will be
+# changed to <PREFIX>_<MODNAME>:
+# <XPREFIX>_VERSION ... version of the module
+# <XPREFIX>_PREFIX ... prefix-directory of the module
+# <XPREFIX>_INCLUDEDIR ... include-dir of the module
+# <XPREFIX>_LIBDIR ... lib-dir of the module
+#
+# <XPREFIX> = <PREFIX> when |MODULES| == 1, else
+# <XPREFIX> = <PREFIX>_<MODNAME>
+#
+# A <MODULE> parameter can have the following formats:
+# {MODNAME} ... matches any version
+# {MODNAME}>={VERSION} ... at least version <VERSION> is required
+# {MODNAME}={VERSION} ... exactly version <VERSION> is required
+# {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
+#
+# Examples
+# pkg_check_modules (GLIB2 glib-2.0)
+#
+# pkg_check_modules (GLIB2 glib-2.0>=2.10)
+# requires at least version 2.10 of glib2 and defines e.g.
+# GLIB2_VERSION=2.10.3
+#
+# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
+# requires both glib2 and gtk2, and defines e.g.
+# FOO_glib-2.0_VERSION=2.10.3
+# FOO_gtk+-2.0_VERSION=2.8.20
+#
+# pkg_check_modules (XRENDER REQUIRED xrender)
+# defines e.g.:
+# XRENDER_LIBRARIES=Xrender;X11
+# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
+#
+# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# 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.
+#
+# 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.)
+
+### Common stuff ####
+set(PKG_CONFIG_VERSION 1)
+
+find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
+mark_as_advanced(PKG_CONFIG_EXECUTABLE)
+
+if (PKG_CONFIG_EXECUTABLE)
+ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --version
+ OUTPUT_VARIABLE PKG_CONFIG_VERSION_STRING
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif (PKG_CONFIG_EXECUTABLE)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(PkgConfig
+ REQUIRED_VARS PKG_CONFIG_EXECUTABLE
+ VERSION_VAR PKG_CONFIG_VERSION_STRING)
+
+# This is needed because the module name is "PkgConfig" but the name of
+# this variable has always been PKG_CONFIG_FOUND so this isn't automatically
+# handled by FPHSA.
+set(PKG_CONFIG_FOUND "${PKGCONFIG_FOUND}")
+
+# Unsets the given variables
+macro(_pkgconfig_unset var)
+ set(${var} "" CACHE INTERNAL "")
+endmacro(_pkgconfig_unset)
+
+macro(_pkgconfig_set var value)
+ set(${var} ${value} CACHE INTERNAL "")
+endmacro(_pkgconfig_set)
+
+# Invokes pkgconfig, cleans up the result and sets variables
+macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
+ set(_pkgconfig_invoke_result)
+
+ execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist}
+ OUTPUT_VARIABLE _pkgconfig_invoke_result
+ RESULT_VARIABLE _pkgconfig_failed)
+
+ if (_pkgconfig_failed)
+ set(_pkgconfig_${_varname} "")
+ _pkgconfig_unset(${_prefix}_${_varname})
+ else(_pkgconfig_failed)
+ 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}")
+ endif(NOT ${_regexp} STREQUAL "")
+
+ separate_arguments(_pkgconfig_invoke_result)
+
+ #message(STATUS " ${_varname} ... ${_pkgconfig_invoke_result}")
+ set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result})
+ _pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}")
+ endif(_pkgconfig_failed)
+endmacro(_pkgconfig_invoke)
+
+# Invokes pkgconfig two times; once without '--static' and once with
+# '--static'
+macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
+ _pkgconfig_invoke("${_pkglist}" ${_prefix} ${_varname} "${cleanup_regexp}" ${ARGN})
+ _pkgconfig_invoke("${_pkglist}" ${_prefix} STATIC_${_varname} "${cleanup_regexp}" --static ${ARGN})
+endmacro(_pkgconfig_invoke_dyn)
+
+# Splits given arguments into options and a package list
+macro(_pkgconfig_parse_options _result _is_req _is_silent)
+ set(${_is_req} 0)
+ set(${_is_silent} 0)
+
+ foreach(_pkg ${ARGN})
+ if (_pkg STREQUAL "REQUIRED")
+ set(${_is_req} 1)
+ endif (_pkg STREQUAL "REQUIRED")
+ if (_pkg STREQUAL "QUIET")
+ set(${_is_silent} 1)
+ endif (_pkg STREQUAL "QUIET")
+ endforeach(_pkg ${ARGN})
+
+ set(${_result} ${ARGN})
+ list(REMOVE_ITEM ${_result} "REQUIRED")
+ list(REMOVE_ITEM ${_result} "QUIET")
+endmacro(_pkgconfig_parse_options)
+
+###
+macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
+ _pkgconfig_unset(${_prefix}_FOUND)
+ _pkgconfig_unset(${_prefix}_VERSION)
+ _pkgconfig_unset(${_prefix}_PREFIX)
+ _pkgconfig_unset(${_prefix}_INCLUDEDIR)
+ _pkgconfig_unset(${_prefix}_LIBDIR)
+ _pkgconfig_unset(${_prefix}_LIBS)
+ _pkgconfig_unset(${_prefix}_LIBS_L)
+ _pkgconfig_unset(${_prefix}_LIBS_PATHS)
+ _pkgconfig_unset(${_prefix}_LIBS_OTHER)
+ _pkgconfig_unset(${_prefix}_CFLAGS)
+ _pkgconfig_unset(${_prefix}_CFLAGS_I)
+ _pkgconfig_unset(${_prefix}_CFLAGS_OTHER)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBDIR)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS_L)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER)
+ _pkgconfig_unset(${_prefix}_STATIC_CFLAGS)
+ _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I)
+ _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER)
+
+ # create a better addressable variable of the modules and calculate its size
+ set(_pkg_check_modules_list ${ARGN})
+ list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt)
+
+ if(PKG_CONFIG_EXECUTABLE)
+ # 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}'")
+ else(_pkg_check_modules_cnt EQUAL 1)
+ message(STATUS "checking for modules '${_pkg_check_modules_list}'")
+ endif(_pkg_check_modules_cnt EQUAL 1)
+ endif(NOT ${_is_silent})
+
+ set(_pkg_check_modules_packages)
+ set(_pkg_check_modules_failed)
+
+ # 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}")
+ else(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
+ set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
+ set(_pkg_check_modules_pkg_op)
+ set(_pkg_check_modules_pkg_ver)
+ endif(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
+
+ # handle the operands
+ if (_pkg_check_modules_pkg_op STREQUAL ">=")
+ list(APPEND _pkg_check_modules_exist_query --atleast-version)
+ endif(_pkg_check_modules_pkg_op STREQUAL ">=")
+
+ if (_pkg_check_modules_pkg_op STREQUAL "=")
+ list(APPEND _pkg_check_modules_exist_query --exact-version)
+ endif(_pkg_check_modules_pkg_op STREQUAL "=")
+
+ if (_pkg_check_modules_pkg_op STREQUAL "<=")
+ list(APPEND _pkg_check_modules_exist_query --max-version)
+ endif(_pkg_check_modules_pkg_op STREQUAL "<=")
+
+ # create the final query which is of the format:
+ # * --atleast-version <version> <pkg-name>
+ # * --exact-version <version> <pkg-name>
+ # * --max-version <version> <pkg-name>
+ # * --exists <pkg-name>
+ if (_pkg_check_modules_pkg_op)
+ list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
+ else(_pkg_check_modules_pkg_op)
+ list(APPEND _pkg_check_modules_exist_query --exists)
+ endif(_pkg_check_modules_pkg_op)
+
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX)
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR)
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR)
+
+ list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}")
+ list(APPEND _pkg_check_modules_packages "${_pkg_check_modules_pkg_name}")
+
+ # execute the query
+ execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query}
+ RESULT_VARIABLE _pkgconfig_retval)
+
+ # evaluate result and tell failures
+ if (_pkgconfig_retval)
+ if(NOT ${_is_silent})
+ message(STATUS " package '${_pkg_check_modules_pkg}' not found")
+ endif(NOT ${_is_silent})
+
+ set(_pkg_check_modules_failed 1)
+ endif(_pkgconfig_retval)
+ endforeach(_pkg_check_modules_pkg)
+
+ if(_pkg_check_modules_failed)
+ # fail when requested
+ if (${_is_required})
+ message(SEND_ERROR "A required package was not found")
+ endif (${_is_required})
+ else(_pkg_check_modules_failed)
+ # when we are here, we checked whether requested modules
+ # exist. Now, go through them and set variables
+
+ _pkgconfig_set(${_prefix}_FOUND 1)
+ list(LENGTH _pkg_check_modules_packages pkg_count)
+
+ # iterate through all modules again and set individual variables
+ foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages})
+ # handle case when there is only one package required
+ if (pkg_count EQUAL 1)
+ set(_pkg_check_prefix "${_prefix}")
+ else(pkg_count EQUAL 1)
+ set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}")
+ endif(pkg_count EQUAL 1)
+
+ _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 )
+
+ if (NOT ${_is_silent})
+ message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
+ endif (NOT ${_is_silent})
+ endforeach(_pkg_check_modules_pkg)
+
+ # set variables which are combined for multiple modules
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other )
+
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
+ endif(_pkg_check_modules_failed)
+ else(PKG_CONFIG_EXECUTABLE)
+ if (${_is_required})
+ message(SEND_ERROR "pkg-config tool not found")
+ endif (${_is_required})
+ endif(PKG_CONFIG_EXECUTABLE)
+endmacro(_pkg_check_modules_internal)
+
+###
+### User visible macros start here
+###
+
+###
+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_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+ endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
+endmacro(pkg_check_modules)
+
+###
+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})
+
+ if (NOT ${_pkg_is_silent})
+ message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
+ endif (NOT ${_pkg_is_silent})
+
+ # 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}")
+ endif(NOT _pkg_modules_found)
+
+ if (${_prefix}_FOUND)
+ set(_pkg_modules_found 1)
+ endif(${_prefix}_FOUND)
+ endforeach(_pkg_alt)
+
+ if (NOT ${_prefix}_FOUND)
+ if(${_pkg_is_required})
+ message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found")
+ endif(${_pkg_is_required})
+ endif(NOT ${_prefix}_FOUND)
+
+ _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+ endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
+endmacro(pkg_search_module)
+
+### Local Variables:
+### mode: cmake
+### End:
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
new file mode 100644
index 000000000..94e5676fe
--- /dev/null
+++ b/Modules/FindPostgreSQL.cmake
@@ -0,0 +1,172 @@
+# - 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.
+#
+# 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)
+
+#=============================================================================
+# 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.)
+
+# ----------------------------------------------------------------------------
+# History:
+# This module is derived from the module originally found in the VTK source tree.
+#
+# ----------------------------------------------------------------------------
+# Note:
+# PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the
+# version mumber of the implementation of PostgreSQL.
+# In Windows the default installation of PostgreSQL uses that as part of the path.
+# E.g C:\Program Files\PostgreSQL\8.4.
+# Currently, the following version numbers are known to this module:
+# "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")
+# before calling FIND_PACKAGE(PostgreSQL) in your CMakeLists.txt file.
+# This will mean that the versions you set here will be found first in the order
+# specified before the default ones are searched.
+#
+# ----------------------------------------------------------------------------
+# You may need to manually set:
+# PostgreSQL_INCLUDE_DIR - the path to where the PostgreSQL include files are.
+# PostgreSQL_LIBRARY_DIR - The path to where the PostgreSQL library files are.
+# If FindPostgreSQL.cmake cannot find the include files or the library files.
+#
+# ----------------------------------------------------------------------------
+# The following variables are set if PostgreSQL is found:
+# PostgreSQL_FOUND - Set to true when PostgreSQL is found.
+# PostgreSQL_INCLUDE_DIRS - Include directories for PostgreSQL
+# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries
+# PostgreSQL_LIBRARIES - The PostgreSQL libraries.
+#
+# ----------------------------------------------------------------------------
+# If you have installed PostgreSQL in a non-standard location.
+# (Please note that in the following comments, it is assumed that <Your Path>
+# points to the root directory of the include directory of PostgreSQL.)
+# Then you have three options.
+# 1) After CMake runs, set PostgreSQL_INCLUDE_DIR to <Your Path>/include and
+# PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is
+# 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/PostgreSQL<-version>. This will allow find_path()
+# to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file
+# SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include")
+# 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have
+# installed PostgreSQL, e.g. <Your Path>.
+#
+# ----------------------------------------------------------------------------
+
+set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include")
+set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}")
+set(PostgreSQL_LIBRARY_PATH_DESCRIPTION "top-level directory containing the PostgreSQL libraries.")
+set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache entry to the ${PostgreSQL_LIBRARY_PATH_DESCRIPTION}")
+set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4")
+
+
+set(PostgreSQL_ROOT_DIRECTORIES $ENV{PostgreSQL_ROOT})
+if(PostgreSQL_ROOT_DIRECTORIES)
+ file(TO_CMAKE_PATH ${PostgreSQL_ROOT_DIRECTORIES} PostgreSQL_ROOT_DIRECTORIES)
+endif(PostgreSQL_ROOT_DIRECTORIES)
+
+set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
+ "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(suffix)
+endif( WIN32 )
+set( PostgreSQL_ROOT_DIRECTORIES
+ ${PostgreSQL_ROOT_DIRECTORIES}
+ ${PostgreSQL_ROOT}
+ ${PostgreSQL_ADDITIONAL_SEARCH_PATHS}
+)
+
+#
+# Look for an installation.
+#
+find_path(PostgreSQL_INCLUDE_DIR
+ NAMES libpq-fe.h
+ PATHS
+ # Look in other places.
+ ${PostgreSQL_ROOT_DIRECTORIES}
+ PATH_SUFFIXES
+ pgsql
+ postgresql
+ include
+ # Help the user find it if we cannot.
+ DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
+)
+
+find_path(PostgreSQL_TYPE_INCLUDE_DIR
+ NAMES catalog/pg_type.h
+ PATHS
+ # Look in other places.
+ ${PostgreSQL_ROOT_DIRECTORIES}
+ PATH_SUFFIXES
+ pgsql/server
+ postgresql/server
+ include/server
+ # Help the user find it if we cannot.
+ DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
+)
+
+# The PostgreSQL library.
+set (PostgreSQL_LIBRARY_TO_FIND pq)
+# Setting some more prefixes for the library
+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})
+endif()
+
+find_library( PostgreSQL_LIBRARY
+ NAMES ${PostgreSQL_LIBRARY_TO_FIND}
+ PATHS
+ ${PostgreSQL_ROOT_DIRECTORIES}
+ PATH_SUFFIXES
+ lib
+)
+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}")
+ unset(pgsql_version_str)
+endif()
+
+# Did we find anything?
+include(FindPackageHandleStandardArgs)
+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})
+
+# 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(PostgreSQL_FOUND)
+
+mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY )
diff --git a/Modules/FindProducer.cmake b/Modules/FindProducer.cmake
new file mode 100644
index 000000000..26c804ac1
--- /dev/null
+++ b/Modules/FindProducer.cmake
@@ -0,0 +1,78 @@
+# Though Producer isn't directly part of OpenSceneGraph, its primary user
+# is OSG so I consider this part of the Findosg* suite used to find
+# OpenSceneGraph components. You'll notice that I accept OSGDIR as an
+# environment path.
+#
+# Each component is separate and you must opt in to each module. You must
+# also opt into OpenGL (and OpenThreads?) as these
+# modules won't do it for you. This is to allow you control over your own
+# system piece by piece in case you need to opt out of certain components
+# or change the Find behavior for a particular module (perhaps because the
+# default FindOpenGL.cmake module doesn't work with your system as an
+# example).
+# If you want to use a more convenient module that includes everything,
+# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+#
+# Locate Producer
+# This module defines
+# PRODUCER_LIBRARY
+# PRODUCER_FOUND, if false, do not try to link to Producer
+# PRODUCER_INCLUDE_DIR, where to find the headers
+#
+# $PRODUCER_DIR is an environment variable that would
+# correspond to the ./configure --prefix=$PRODUCER_DIR
+# used in building osg.
+#
+# Created by Eric Wing.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <Producer/CameraGroup>
+
+# Try the user's environment request before anything else.
+FIND_PATH(PRODUCER_INCLUDE_DIR Producer/CameraGroup
+ HINTS
+ $ENV{PRODUCER_DIR}
+ $ENV{OSG_DIR}
+ $ENV{OSGDIR}
+ PATH_SUFFIXES include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw/include # Fink
+ /opt/local/include # DarwinPorts
+ /opt/csw/include # Blastwave
+ /opt/include
+ [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]/include
+ [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
+)
+
+FIND_LIBRARY(PRODUCER_LIBRARY
+ NAMES Producer
+ HINTS
+ $ENV{PRODUCER_DIR}
+ $ENV{OSG_DIR}
+ $ENV{OSGDIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Producer DEFAULT_MSG
+ PRODUCER_LIBRARY PRODUCER_INCLUDE_DIR)
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
new file mode 100644
index 000000000..1e1e49301
--- /dev/null
+++ b/Modules/FindProtobuf.cmake
@@ -0,0 +1,218 @@
+# 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)
+#
+# 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
+#
+# 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:
+#
+# find_package(Protobuf REQUIRED)
+# include_directories(${PROTOBUF_INCLUDE_DIRS})
+#
+# include_directories(${CMAKE_CURRENT_BINARY_DIR})
+# PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS 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 macro & add_executable() or add_library()
+# calls only work properly within the same directory.
+#
+# ====================================================================
+#
+# PROTOBUF_GENERATE_CPP (public function)
+# SRCS = Variable to define with autogenerated
+# source files
+# HDRS = Variable to define with autogenerated
+# header files
+# ARGN = proto files
+#
+# ====================================================================
+
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2009-2011 Philip Lowman <philip@yhbt.com>
+# Copyright 2008 Esben Mose Hansen, Ange Optimization ApS
+#
+# 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(PROTOBUF_GENERATE_CPP SRCS HDRS)
+ if(NOT ARGN)
+ message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files")
+ return()
+ endif(NOT ARGN)
+
+ 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})
+ set(${HDRS})
+ 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}.pb.cc")
+ list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
+
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc"
+ "${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}
+ COMMENT "Running C++ protocol buffer compiler on ${FIL}"
+ VERBATIM )
+ endforeach()
+
+ set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
+ set(${SRCS} ${${SRCS}} PARENT_SCOPE)
+ set(${HDRS} ${${HDRS}} PARENT_SCOPE)
+endfunction()
+
+# 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)
+ mark_as_advanced(${name}_LIBRARY)
+
+ find_library(${name}_LIBRARY_DEBUG
+ NAMES ${filename}
+ PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug)
+ mark_as_advanced(${name}_LIBRARY_DEBUG)
+
+ if(NOT ${name}_LIBRARY_DEBUG)
+ # There is no debug library
+ set(${name}_LIBRARY_DEBUG ${${name}_LIBRARY} PARENT_SCOPE)
+ set(${name}_LIBRARIES ${${name}_LIBRARY} PARENT_SCOPE)
+ else()
+ # There IS a debug library
+ set(${name}_LIBRARIES
+ optimized ${${name}_LIBRARY}
+ debug ${${name}_LIBRARY_DEBUG}
+ PARENT_SCOPE
+ )
+ endif()
+endfunction()
+
+#
+# Main.
+#
+
+# By default have PROTOBUF_GENERATE_CPP macro pass -I to protoc
+# for each directory where a proto file is referenced.
+if(NOT DEFINED PROTOBUF_GENERATE_CPP_APPEND_PATH)
+ set(PROTOBUF_GENERATE_CPP_APPEND_PATH TRUE)
+endif()
+
+
+# Google's provided vcproj files generate libraries with a "lib"
+# prefix on Windows
+if(MSVC)
+ set(PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
+ set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
+
+ find_path(PROTOBUF_SRC_ROOT_FOLDER protobuf.pc.in)
+endif()
+
+# The Protobuf library
+_protobuf_find_libraries(PROTOBUF protobuf)
+#DOC "The Google Protocol Buffers RELEASE Library"
+
+_protobuf_find_libraries(PROTOBUF_LITE protobuf-lite)
+
+# The Protobuf Protoc Library
+_protobuf_find_libraries(PROTOBUF_PROTOC protoc)
+
+# Restore original find library prefixes
+if(MSVC)
+ set(CMAKE_FIND_LIBRARY_PREFIXES "${PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES}")
+endif()
+
+
+# Find the include directory
+find_path(PROTOBUF_INCLUDE_DIR
+ google/protobuf/service.h
+ PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/src
+)
+mark_as_advanced(PROTOBUF_INCLUDE_DIR)
+
+# Find the protoc Executable
+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
+)
+mark_as_advanced(PROTOBUF_PROTOC_EXECUTABLE)
+
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROTOBUF DEFAULT_MSG
+ PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR)
+
+if(PROTOBUF_FOUND)
+ set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIR})
+endif()
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
new file mode 100644
index 000000000..a131c5fde
--- /dev/null
+++ b/Modules/FindPythonInterp.cmake
@@ -0,0 +1,141 @@
+# - Find python interpreter
+# This module finds if Python interpreter is installed and determines where the
+# executables are. This code sets the following variables:
+#
+# PYTHONINTERP_FOUND - Was the Python executable found
+# PYTHON_EXECUTABLE - path to the Python interpreter
+#
+# PYTHON_VERSION_STRING - Python version found e.g. 2.5.2
+# PYTHON_VERSION_MAJOR - Python major version found e.g. 2
+# PYTHON_VERSION_MINOR - Python minor version found e.g. 5
+# PYTHON_VERSION_PATCH - Python patch version found e.g. 2
+#
+# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of
+# version numbers that should be taken into account when searching for Python.
+# You need to set this variable before calling find_package(PythonInterp).
+
+#=============================================================================
+# Copyright 2005-2010 Kitware, Inc.
+# Copyright 2011 Bjoern Ricks <bjoern.ricks@gmail.com>
+# Copyright 2012 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(_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)
+
+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})
+ unset(_PYTHON_FIND_OTHER_VERSIONS)
+ if(NOT PythonInterp_FIND_VERSION_EXACT)
+ foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
+ if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
+ list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
+ endif()
+ endforeach()
+ endif(NOT PythonInterp_FIND_VERSION_EXACT)
+ unset(_PYTHON_FIND_MAJ_MIN)
+ unset(_PYTHON_FIND_MAJ)
+ else(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
+ list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION})
+ set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS})
+ endif(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
+else(PythonInterp_FIND_VERSION)
+ set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
+endif(PythonInterp_FIND_VERSION)
+
+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}
+ )
+
+unset(_PYTHON_FIND_OTHER_VERSIONS)
+unset(_PYTHON1_VERSIONS)
+unset(_PYTHON2_VERSIONS)
+unset(_PYTHON3_VERSIONS)
+
+# Search for newest python version if python executable isn't found
+if(NOT PYTHON_EXECUTABLE)
+ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
+ set(_Python_NAMES python${_CURRENT_VERSION})
+ if(WIN32)
+ list(APPEND _Python_NAMES python)
+ endif()
+ find_program(PYTHON_EXECUTABLE
+ NAMES ${_Python_NAMES}
+ PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
+ )
+ endforeach()
+endif()
+
+# determine python version string
+if(PYTHON_EXECUTABLE)
+ execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
+ "import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))"
+ OUTPUT_VARIABLE _VERSION
+ RESULT_VARIABLE _PYTHON_VERSION_RESULT
+ ERROR_QUIET)
+ if(NOT _PYTHON_VERSION_RESULT)
+ string(REPLACE ";" "." PYTHON_VERSION_STRING "${_VERSION}")
+ list(GET _VERSION 0 PYTHON_VERSION_MAJOR)
+ list(GET _VERSION 1 PYTHON_VERSION_MINOR)
+ list(GET _VERSION 2 PYTHON_VERSION_PATCH)
+ if(PYTHON_VERSION_PATCH EQUAL 0)
+ # it's called "Python 2.7", not "2.7.0"
+ string(REGEX REPLACE "\\.0$" "" PYTHON_VERSION_STRING "${PYTHON_VERSION_STRING}")
+ endif()
+ else()
+ # sys.version predates sys.version_info, so use that
+ execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)"
+ OUTPUT_VARIABLE _VERSION
+ RESULT_VARIABLE _PYTHON_VERSION_RESULT
+ ERROR_QUIET)
+ if(NOT _PYTHON_VERSION_RESULT)
+ 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}")
+ else()
+ set(PYTHON_VERSION_PATCH "0")
+ endif()
+ else()
+ # sys.version was first documented for Python 1.5, so assume
+ # this is older.
+ set(PYTHON_VERSION_STRING "1.4")
+ set(PYTHON_VERSION_MAJOR "1")
+ set(PYTHON_VERSION_MAJOR "4")
+ set(PYTHON_VERSION_MAJOR "0")
+ endif()
+ endif()
+ unset(_PYTHON_VERSION_RESULT)
+ unset(_VERSION)
+endif(PYTHON_EXECUTABLE)
+
+# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
+# all listed variables are TRUE
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
+
+mark_as_advanced(PYTHON_EXECUTABLE)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
new file mode 100644
index 000000000..11ff19623
--- /dev/null
+++ b/Modules/FindPythonLibs.cmake
@@ -0,0 +1,275 @@
+# - Find python libraries
+# This module finds if Python is installed and determines where the
+# include files and libraries are. It also determines what the name of
+# the library is. This code sets the following variables:
+#
+# PYTHONLIBS_FOUND - have the Python libs been found
+# PYTHON_LIBRARIES - path to the python library
+# PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated)
+# PYTHON_INCLUDE_DIRS - path to where Python.h is found
+# PYTHON_DEBUG_LIBRARIES - path to the debug library (deprecated)
+# PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8)
+#
+# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of
+# version numbers that should be taken into account when searching for Python.
+# You need to set this variable before calling find_package(PythonLibs).
+#
+# If you'd like to specify the installation of Python to use, you should modify
+# the following cache variables:
+# PYTHON_LIBRARY - path to the python library
+# PYTHON_INCLUDE_DIR - path to where Python.h is found
+
+#=============================================================================
+# 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.)
+
+INCLUDE(CMakeFindFrameworks)
+# Search for the python framework on Apple.
+CMAKE_FIND_FRAMEWORKS(Python)
+
+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)
+
+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}")
+ UNSET(_PYTHON_FIND_OTHER_VERSIONS)
+ IF(PythonLibs_FIND_VERSION_EXACT)
+ IF(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
+ SET(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}")
+ ELSE(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
+ SET(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}")
+ ENDIF(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
+ ELSE(PythonLibs_FIND_VERSION_EXACT)
+ FOREACH(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
+ IF(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
+ LIST(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
+ ENDIF()
+ ENDFOREACH()
+ ENDIF(PythonLibs_FIND_VERSION_EXACT)
+ UNSET(_PYTHON_FIND_MAJ_MIN)
+ UNSET(_PYTHON_FIND_MAJ)
+ ELSE(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
+ SET(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS})
+ ENDIF(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
+ELSE(PythonLibs_FIND_VERSION)
+ SET(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
+ENDIF(PythonLibs_FIND_VERSION)
+
+# 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}
+ )
+
+UNSET(_PYTHON_FIND_OTHER_VERSIONS)
+UNSET(_PYTHON1_VERSIONS)
+UNSET(_PYTHON2_VERSIONS)
+UNSET(_PYTHON3_VERSIONS)
+
+FOREACH(_CURRENT_VERSION ${_Python_VERSIONS})
+ STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION})
+ IF(WIN32)
+ FIND_LIBRARY(PYTHON_DEBUG_LIBRARY
+ NAMES python${_CURRENT_VERSION_NO_DOTS}_d python
+ PATHS
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
+ )
+ ENDIF(WIN32)
+
+ 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}
+ PATHS
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
+ # Avoid finding the .dll in the PATH. We want the .lib.
+ NO_SYSTEM_ENVIRONMENT_PATH
+ )
+ # Look for the static library in the Python config directory
+ FIND_LIBRARY(PYTHON_LIBRARY
+ NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION}
+ # Avoid finding the .dll in the PATH. We want the .lib.
+ NO_SYSTEM_ENVIRONMENT_PATH
+ # This is where the static library is usually located
+ 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(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR)
+
+ 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(dir)
+ ENDIF(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR)
+
+ 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}
+ )
+
+ # For backward compatibility, set PYTHON_INCLUDE_PATH.
+ SET(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}")
+
+ IF(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h")
+ FILE(STRINGS "${PYTHON_INCLUDE_DIR}/patchlevel.h" python_version_str
+ REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"")
+ STRING(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1"
+ PYTHONLIBS_VERSION_STRING "${python_version_str}")
+ UNSET(python_version_str)
+ ENDIF(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h")
+
+ IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR)
+ BREAK()
+ ENDIF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR)
+ENDFOREACH(_CURRENT_VERSION)
+
+MARK_AS_ADVANCED(
+ PYTHON_DEBUG_LIBRARY
+ PYTHON_LIBRARY
+ PYTHON_INCLUDE_DIR
+)
+
+# We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the
+# cache entries because they are meant to specify the location of a single
+# library. We now set the variables listed by the documentation for this
+# module.
+SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
+SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
+
+# These variables have been historically named in this module different from
+# what SELECT_LIBRARY_CONFIGURATIONS() expects.
+SET(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}")
+SET(PYTHON_LIBRARY_RELEASE "${PYTHON_LIBRARY}")
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+SELECT_LIBRARY_CONFIGURATIONS(PYTHON)
+# SELECT_LIBRARY_CONFIGURATIONS() sets ${PREFIX}_FOUND if it has a library.
+# Unset this, this prefix doesn't match the module prefix, they are different
+# for historical reasons.
+UNSET(PYTHON_FOUND)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs
+ REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS
+ VERSION_VAR PYTHONLIBS_VERSION_STRING)
+
+# PYTHON_ADD_MODULE(<name> src1 src2 ... srcN) is used to build modules for python.
+# PYTHON_WRITE_MODULES_HEADER(<filename>) writes a header file you can include
+# in your sources to initialize the static python modules
+FUNCTION(PYTHON_ADD_MODULE _NAME )
+ GET_PROPERTY(_TARGET_SUPPORTS_SHARED_LIBS
+ GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
+ OPTION(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE)
+ OPTION(PYTHON_MODULE_${_NAME}_BUILD_SHARED
+ "Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS})
+
+ # Mark these options as advanced
+ MARK_AS_ADVANCED(PYTHON_ENABLE_MODULE_${_NAME}
+ PYTHON_MODULE_${_NAME}_BUILD_SHARED)
+
+ IF(PYTHON_ENABLE_MODULE_${_NAME})
+ IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
+ SET(PY_MODULE_TYPE MODULE)
+ ELSE(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
+ SET(PY_MODULE_TYPE STATIC)
+ SET_PROPERTY(GLOBAL APPEND PROPERTY PY_STATIC_MODULES_LIST ${_NAME})
+ ENDIF(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
+
+ SET_PROPERTY(GLOBAL APPEND PROPERTY PY_MODULES_LIST ${_NAME})
+ ADD_LIBRARY(${_NAME} ${PY_MODULE_TYPE} ${ARGN})
+# TARGET_LINK_LIBRARIES(${_NAME} ${PYTHON_LIBRARIES})
+
+ IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
+ SET_TARGET_PROPERTIES(${_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}")
+ IF(WIN32 AND NOT CYGWIN)
+ SET_TARGET_PROPERTIES(${_NAME} PROPERTIES SUFFIX ".pyd")
+ ENDIF(WIN32 AND NOT CYGWIN)
+ ENDIF(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
+
+ ENDIF(PYTHON_ENABLE_MODULE_${_NAME})
+ENDFUNCTION(PYTHON_ADD_MODULE)
+
+FUNCTION(PYTHON_WRITE_MODULES_HEADER _filename)
+
+ GET_PROPERTY(PY_STATIC_MODULES_LIST GLOBAL PROPERTY PY_STATIC_MODULES_LIST)
+
+ GET_FILENAME_COMPONENT(_name "${_filename}" NAME)
+ STRING(REPLACE "." "_" _name "${_name}")
+ STRING(TOUPPER ${_name} _nameUpper)
+ SET(_filename ${CMAKE_CURRENT_BINARY_DIR}/${_filename})
+
+ SET(_filenameTmp "${_filename}.in")
+ FILE(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n")
+ FILE(APPEND ${_filenameTmp}
+"#ifndef ${_nameUpper}
+#define ${_nameUpper}
+
+#include <Python.h>
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif /* __cplusplus */
+
+")
+
+ FOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
+ FILE(APPEND ${_filenameTmp} "extern void init${PYTHON_MODULE_PREFIX}${_currentModule}(void);\n\n")
+ ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
+
+ FILE(APPEND ${_filenameTmp}
+"#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+")
+
+
+ FOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
+ FILE(APPEND ${_filenameTmp} "int ${_name}_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON_MODULE_PREFIX}${_currentModule});\n}\n\n")
+ ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
+
+ FILE(APPEND ${_filenameTmp} "void ${_name}_LoadAllPythonModules(void)\n{\n")
+ FOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
+ FILE(APPEND ${_filenameTmp} " ${_name}_${_currentModule}();\n")
+ ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
+ FILE(APPEND ${_filenameTmp} "}\n\n")
+ FILE(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n ${_name}_LoadAllPythonModules();\n}\n#endif\n\n#endif\n")
+
+# with CONFIGURE_FILE() cmake complains that you may not use a file created using FILE(WRITE) as input file for CONFIGURE_FILE()
+ EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET)
+
+ENDFUNCTION(PYTHON_WRITE_MODULES_HEADER)
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake
new file mode 100644
index 000000000..2b8dfd7fb
--- /dev/null
+++ b/Modules/FindQt.cmake
@@ -0,0 +1,160 @@
+# - 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.
+#
+# 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.
+
+#=============================================================================
+# 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.)
+
+# look for signs of qt3 installations
+FILE(GLOB GLOB_TEMP_VAR /usr/lib/qt-3*/bin/qmake)
+IF(GLOB_TEMP_VAR)
+ SET(QT3_INSTALLED TRUE)
+ENDIF(GLOB_TEMP_VAR)
+SET(GLOB_TEMP_VAR)
+
+FILE(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-3*/bin/qmake)
+IF(GLOB_TEMP_VAR)
+ SET(QT3_INSTALLED TRUE)
+ENDIF(GLOB_TEMP_VAR)
+SET(GLOB_TEMP_VAR)
+
+# look for qt4 installations
+FILE(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-4*/bin/qmake)
+IF(GLOB_TEMP_VAR)
+ SET(QT4_INSTALLED TRUE)
+ENDIF(GLOB_TEMP_VAR)
+SET(GLOB_TEMP_VAR)
+
+FILE(GLOB GLOB_TEMP_VAR /usr/local/Trolltech/Qt-4*/bin/qmake)
+IF(GLOB_TEMP_VAR)
+ SET(QT4_INSTALLED TRUE)
+ENDIF(GLOB_TEMP_VAR)
+SET(GLOB_TEMP_VAR)
+
+# now find qmake
+FIND_PROGRAM(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin")
+IF(QT_QMAKE_EXECUTABLE_FINDQT)
+ EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE_FINDQT} ARGS "-query QT_VERSION"
+ OUTPUT_VARIABLE QTVERSION)
+ IF(QTVERSION MATCHES "4.*")
+ SET(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "QT4 qmake program.")
+ SET(QT4_INSTALLED TRUE)
+ ENDIF(QTVERSION MATCHES "4.*")
+ IF(QTVERSION MATCHES "Unknown")
+ SET(QT3_INSTALLED TRUE)
+ ENDIF(QTVERSION MATCHES "Unknown")
+ENDIF(QT_QMAKE_EXECUTABLE_FINDQT)
+
+IF(QT_QMAKE_EXECUTABLE_FINDQT)
+ EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE_FINDQT}
+ ARGS "-query QT_INSTALL_HEADERS"
+ OUTPUT_VARIABLE qt_headers )
+ENDIF(QT_QMAKE_EXECUTABLE_FINDQT)
+
+FIND_FILE( QT4_QGLOBAL_H_FILE qglobal.h
+ "${QT_SEARCH_PATH}/Qt/include"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/include/Qt"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/include/Qt"
+ ${qt_headers}/Qt
+ $ENV{QTDIR}/include/Qt
+ /usr/local/qt/include/Qt
+ /usr/local/include/Qt
+ /usr/lib/qt/include/Qt
+ /usr/include/Qt
+ /usr/share/qt4/include/Qt
+ C:/Progra~1/qt/include/Qt )
+
+IF(QT4_QGLOBAL_H_FILE)
+ SET(QT4_INSTALLED TRUE)
+ENDIF(QT4_QGLOBAL_H_FILE)
+
+FIND_FILE( QT3_QGLOBAL_H_FILE qglobal.h
+ "${QT_SEARCH_PATH}/Qt/include"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
+ C:/Qt/3.3.3Educational/include
+ $ENV{QTDIR}/include
+ /usr/include/qt3/Qt
+ /usr/local/qt/include
+ /usr/local/include
+ /usr/lib/qt/include
+ /usr/include
+ /usr/share/qt3/include
+ C:/Progra~1/qt/include
+ /usr/include/qt3 )
+
+IF(QT3_QGLOBAL_H_FILE)
+ SET(QT3_INSTALLED TRUE)
+ENDIF(QT3_QGLOBAL_H_FILE)
+
+IF(QT3_INSTALLED AND QT4_INSTALLED )
+ # force user to pick if we have both
+ SET(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of QT to use: 3 or 4")
+ELSE(QT3_INSTALLED AND QT4_INSTALLED )
+ # if only one found then pick that one
+ IF(QT3_INSTALLED)
+ SET(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of QT to use: 3 or 4")
+ ENDIF(QT3_INSTALLED)
+ IF(QT4_INSTALLED)
+ SET(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of QT to use: 3 or 4")
+ ENDIF(QT4_INSTALLED)
+ENDIF(QT3_INSTALLED AND QT4_INSTALLED )
+
+IF(DESIRED_QT_VERSION MATCHES 3)
+ SET(Qt3_FIND_REQUIRED ${Qt_FIND_REQUIRED})
+ SET(Qt3_FIND_QUIETLY ${Qt_FIND_QUIETLY})
+ INCLUDE(FindQt3)
+ENDIF(DESIRED_QT_VERSION MATCHES 3)
+IF(DESIRED_QT_VERSION MATCHES 4)
+ SET(Qt4_FIND_REQUIRED ${Qt_FIND_REQUIRED})
+ SET(Qt4_FIND_QUIETLY ${Qt_FIND_QUIETLY})
+ INCLUDE(FindQt4)
+ENDIF(DESIRED_QT_VERSION MATCHES 4)
+
+IF(NOT QT3_INSTALLED AND NOT QT4_INSTALLED)
+ IF(QT_REQUIRED)
+ MESSAGE(SEND_ERROR "CMake was unable to find any QT versions, put qmake in your path, or set QT_QMAKE_EXECUTABLE.")
+ ENDIF(QT_REQUIRED)
+ELSE(NOT QT3_INSTALLED AND NOT QT4_INSTALLED)
+ IF(NOT QT_FOUND AND NOT DESIRED_QT_VERSION)
+ IF(QT_REQUIRED)
+ MESSAGE(SEND_ERROR "Multiple versions of QT found please set DESIRED_QT_VERSION")
+ ELSE(QT_REQUIRED)
+ MESSAGE("Multiple versions of QT found please set DESIRED_QT_VERSION")
+ ENDIF(QT_REQUIRED)
+ ENDIF(NOT QT_FOUND AND NOT DESIRED_QT_VERSION)
+ 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.")
+ ELSE(QT_REQUIRED)
+ 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.")
+ ENDIF(QT_REQUIRED)
+ ENDIF(NOT QT_FOUND AND DESIRED_QT_VERSION)
+ENDIF(NOT QT3_INSTALLED AND NOT QT4_INSTALLED)
+MARK_AS_ADVANCED(QT3_QGLOBAL_H_FILE QT4_QGLOBAL_H_FILE QT_QMAKE_EXECUTABLE_FINDQT)
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
new file mode 100644
index 000000000..2d8dbde22
--- /dev/null
+++ b/Modules/FindQt3.cmake
@@ -0,0 +1,302 @@
+# - Locate Qt include paths and libraries
+# This module defines:
+# QT_INCLUDE_DIR - where to find qt.h, etc.
+# QT_LIBRARIES - the libraries to link against to use Qt.
+# QT_DEFINITIONS - definitions to use when
+# compiling code that uses Qt.
+# QT_FOUND - If false, don't try to use Qt.
+# QT_VERSION_STRING - the version of Qt found
+#
+# If you need the multithreaded version of Qt, set QT_MT_REQUIRED to TRUE
+#
+# Also defined, but not for general use are:
+# QT_MOC_EXECUTABLE, where to find the moc tool.
+# QT_UIC_EXECUTABLE, where to find the uic tool.
+# QT_QT_LIBRARY, where to find the Qt library.
+# QT_QTMAIN_LIBRARY, where to find the qtmain
+# library. This is only required by Qt3 on Windows.
+
+# These are around for backwards compatibility
+# they will be set
+# QT_WRAP_CPP, set true if QT_MOC_EXECUTABLE is found
+# QT_WRAP_UI set true if QT_UIC_EXECUTABLE is found
+
+#=============================================================================
+# 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.)
+
+# If Qt4 has already been found, fail.
+IF(QT4_FOUND)
+ IF(Qt3_FIND_REQUIRED)
+ MESSAGE( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project.")
+ ELSE(Qt3_FIND_REQUIRED)
+ IF(NOT Qt3_FIND_QUIETLY)
+ MESSAGE( STATUS "Qt3 and Qt4 cannot be used together in one project.")
+ ENDIF(NOT Qt3_FIND_QUIETLY)
+ RETURN()
+ ENDIF(Qt3_FIND_REQUIRED)
+ENDIF(QT4_FOUND)
+
+
+FILE(GLOB GLOB_PATHS /usr/lib/qt-3*)
+FOREACH(GLOB_PATH ${GLOB_PATHS})
+ LIST(APPEND GLOB_PATHS_BIN "${GLOB_PATH}/bin")
+ENDFOREACH(GLOB_PATH)
+FIND_PATH(QT_INCLUDE_DIR qt.h
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
+ $ENV{QTDIR}/include
+ ${GLOB_PATHS}
+ /usr/local/qt/include
+ /usr/lib/qt/include
+ /usr/lib/qt3/include
+ /usr/include/qt
+ /usr/share/qt3/include
+ C:/Progra~1/qt/include
+ /usr/include/qt3
+ )
+
+# if qglobal.h is not in the qt_include_dir then set
+# QT_INCLUDE_DIR to NOTFOUND
+IF(NOT EXISTS ${QT_INCLUDE_DIR}/qglobal.h)
+ SET(QT_INCLUDE_DIR QT_INCLUDE_DIR-NOTFOUND CACHE PATH "path to Qt3 include directory" FORCE)
+ENDIF(NOT EXISTS ${QT_INCLUDE_DIR}/qglobal.h)
+
+IF(QT_INCLUDE_DIR)
+ #extract the version string from qglobal.h
+ FILE(READ ${QT_INCLUDE_DIR}/qglobal.h QGLOBAL_H)
+ STRING(REGEX MATCH "#define[\t ]+QT_VERSION_STR[\t ]+\"[0-9]+.[0-9]+.[0-9]+[a-z]*\"" QGLOBAL_H "${QGLOBAL_H}")
+ STRING(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+[a-z]*)\".*" "\\1" qt_version_str "${QGLOBAL_H}")
+
+ # Under windows the qt library (MSVC) has the format qt-mtXYZ where XYZ is the
+ # version X.Y.Z, so we need to remove the dots from version
+ STRING(REGEX REPLACE "\\." "" qt_version_str_lib "${qt_version_str}")
+ SET(QT_VERSION_STRING "${qt_version_str}")
+ENDIF(QT_INCLUDE_DIR)
+
+FILE(GLOB GLOB_PATHS_LIB /usr/lib/qt-3*/lib/)
+IF (QT_MT_REQUIRED)
+ FIND_LIBRARY(QT_QT_LIBRARY
+ NAMES
+ qt-mt qt-mt${qt_version_str_lib} qt-mtnc${qt_version_str_lib}
+ qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 qt-mt3
+ PATHS
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib"
+ $ENV{QTDIR}/lib
+ ${GLOB_PATHS_LIB}
+ /usr/local/qt/lib
+ /usr/lib/qt/lib
+ /usr/lib/qt3/lib
+ /usr/lib/qt3/lib64
+ /usr/share/qt3/lib
+ C:/Progra~1/qt/lib
+ )
+
+ELSE (QT_MT_REQUIRED)
+ FIND_LIBRARY(QT_QT_LIBRARY
+ NAMES
+ qt qt-${qt_version_str_lib} qt-edu${qt_version_str_lib}
+ qt-mt qt-mt${qt_version_str_lib} qt-mtnc${qt_version_str_lib}
+ qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 qt-mt3
+ PATHS
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib"
+ $ENV{QTDIR}/lib
+ ${GLOB_PATHS_LIB}
+ /usr/local/qt/lib
+ /usr/lib/qt/lib
+ /usr/lib/qt3/lib
+ /usr/lib/qt3/lib64
+ /usr/share/qt3/lib
+ C:/Progra~1/qt/lib
+ )
+ENDIF (QT_MT_REQUIRED)
+
+
+FIND_LIBRARY(QT_QASSISTANTCLIENT_LIBRARY
+ NAMES qassistantclient
+ PATHS
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib"
+ $ENV{QTDIR}/lib
+ ${GLOB_PATHS_LIB}
+ /usr/local/qt/lib
+ /usr/lib/qt3/lib
+ /usr/lib/qt3/lib64
+ /usr/share/qt3/lib
+ C:/Progra~1/qt/lib
+ )
+
+# qt 3 should prefer QTDIR over the PATH
+FIND_PROGRAM(QT_MOC_EXECUTABLE
+ NAMES moc-qt3 moc
+ HINTS
+ $ENV{QTDIR}/bin
+ PATHS
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
+ $ENV{QTDIR}/bin
+ ${GLOB_PATHS_BIN}
+ /usr/local/qt/bin
+ /usr/lib/qt/bin
+ /usr/lib/qt3/bin
+ /usr/share/qt3/bin
+ C:/Progra~1/qt/bin
+ /usr/X11R6/bin
+ )
+
+IF(QT_MOC_EXECUTABLE)
+ SET ( QT_WRAP_CPP "YES")
+ENDIF(QT_MOC_EXECUTABLE)
+
+# qt 3 should prefer QTDIR over the PATH
+FIND_PROGRAM(QT_UIC_EXECUTABLE
+ NAMES uic-qt3 uic
+ HINTS
+ $ENV{QTDIR}/bin
+ PATHS
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
+ ${GLOB_PATHS_BIN}
+ /usr/local/qt/bin
+ /usr/lib/qt/bin
+ /usr/lib/qt3/bin
+ /usr/share/qt3/bin
+ C:/Progra~1/qt/bin
+ /usr/X11R6/bin
+ )
+
+IF(QT_UIC_EXECUTABLE)
+ SET ( QT_WRAP_UI "YES")
+ENDIF(QT_UIC_EXECUTABLE)
+
+IF (WIN32)
+ FIND_LIBRARY(QT_QTMAIN_LIBRARY qtmain
+ HINTS
+ $ENV{QTDIR}/lib
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib"
+ PATHS
+ "$ENV{ProgramFiles}/qt/lib"
+ "C:/Program Files/qt/lib"
+ DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise."
+ )
+ENDIF (WIN32)
+
+#support old QT_MIN_VERSION if set, but not if version is supplied by find_package()
+IF(NOT Qt3_FIND_VERSION AND QT_MIN_VERSION)
+ SET(Qt3_FIND_VERSION ${QT_MIN_VERSION})
+ENDIF(NOT Qt3_FIND_VERSION AND QT_MIN_VERSION)
+
+# if the include a library are found then we have it
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt3
+ REQUIRED_VARS QT_QT_LIBRARY QT_INCLUDE_DIR QT_MOC_EXECUTABLE
+ VERSION_VAR QT_VERSION_STRING)
+SET(QT_FOUND ${QT3_FOUND} )
+
+IF(QT_FOUND)
+ SET( QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT_LIBRARY} )
+ SET( QT_DEFINITIONS "")
+
+ IF (WIN32 AND NOT CYGWIN)
+ IF (QT_QTMAIN_LIBRARY)
+ # for version 3
+ SET (QT_DEFINITIONS -DQT_DLL -DQT_THREAD_SUPPORT -DNO_DEBUG)
+ SET (QT_LIBRARIES imm32.lib ${QT_QT_LIBRARY} ${QT_QTMAIN_LIBRARY} )
+ SET (QT_LIBRARIES ${QT_LIBRARIES} winmm wsock32)
+ ELSE (QT_QTMAIN_LIBRARY)
+ # for version 2
+ SET (QT_LIBRARIES imm32.lib ws2_32.lib ${QT_QT_LIBRARY} )
+ ENDIF (QT_QTMAIN_LIBRARY)
+ ELSE (WIN32 AND NOT CYGWIN)
+ SET (QT_LIBRARIES ${QT_QT_LIBRARY} )
+
+ SET (QT_DEFINITIONS -DQT_SHARED -DQT_NO_DEBUG)
+ IF(QT_QT_LIBRARY MATCHES "qt-mt")
+ SET (QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_THREAD_SUPPORT -D_REENTRANT)
+ ENDIF(QT_QT_LIBRARY MATCHES "qt-mt")
+
+ ENDIF (WIN32 AND NOT CYGWIN)
+
+ IF (QT_QASSISTANTCLIENT_LIBRARY)
+ SET (QT_LIBRARIES ${QT_QASSISTANTCLIENT_LIBRARY} ${QT_LIBRARIES})
+ ENDIF (QT_QASSISTANTCLIENT_LIBRARY)
+
+ # Backwards compatibility for CMake1.4 and 1.2
+ SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} )
+ SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} )
+ # for unix add X11 stuff
+ IF(UNIX)
+ FIND_PACKAGE(X11)
+ IF (X11_FOUND)
+ SET (QT_LIBRARIES ${QT_LIBRARIES} ${X11_LIBRARIES})
+ ENDIF (X11_FOUND)
+ IF (CMAKE_DL_LIBS)
+ SET (QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_DL_LIBS})
+ ENDIF (CMAKE_DL_LIBS)
+ ENDIF(UNIX)
+ IF(QT_QT_LIBRARY MATCHES "qt-mt")
+ FIND_PACKAGE(Threads)
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
+ ENDIF(QT_QT_LIBRARY MATCHES "qt-mt")
+ENDIF(QT_FOUND)
+
+IF(QT_MOC_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${QT_MOC_EXECUTABLE} "-v"
+ OUTPUT_VARIABLE QTVERSION_MOC
+ ERROR_QUIET)
+ENDIF(QT_MOC_EXECUTABLE)
+IF(QT_UIC_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${QT_UIC_EXECUTABLE} "-version"
+ OUTPUT_VARIABLE QTVERSION_UIC
+ ERROR_QUIET)
+ENDIF(QT_UIC_EXECUTABLE)
+
+SET(_QT_UIC_VERSION_3 FALSE)
+IF("${QTVERSION_UIC}" MATCHES ".* 3..*")
+ SET(_QT_UIC_VERSION_3 TRUE)
+ENDIF("${QTVERSION_UIC}" MATCHES ".* 3..*")
+
+SET(_QT_MOC_VERSION_3 FALSE)
+IF("${QTVERSION_MOC}" MATCHES ".* 3..*")
+ SET(_QT_MOC_VERSION_3 TRUE)
+ENDIF("${QTVERSION_MOC}" MATCHES ".* 3..*")
+
+SET(QT_WRAP_CPP FALSE)
+IF (QT_MOC_EXECUTABLE AND _QT_MOC_VERSION_3)
+ SET ( QT_WRAP_CPP TRUE)
+ENDIF (QT_MOC_EXECUTABLE AND _QT_MOC_VERSION_3)
+
+SET(QT_WRAP_UI FALSE)
+IF (QT_UIC_EXECUTABLE AND _QT_UIC_VERSION_3)
+ SET ( QT_WRAP_UI TRUE)
+ENDIF (QT_UIC_EXECUTABLE AND _QT_UIC_VERSION_3)
+
+MARK_AS_ADVANCED(
+ QT_INCLUDE_DIR
+ QT_QT_LIBRARY
+ QT_QTMAIN_LIBRARY
+ QT_QASSISTANTCLIENT_LIBRARY
+ QT_UIC_EXECUTABLE
+ QT_MOC_EXECUTABLE
+ QT_WRAP_CPP
+ QT_WRAP_UI
+ )
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
new file mode 100644
index 000000000..2f1708d70
--- /dev/null
+++ b/Modules/FindQt4.cmake
@@ -0,0 +1,1216 @@
+# - 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.
+#
+# 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.
+#
+# 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-direcotry 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 ... )
+# 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 a 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 exists and are not updated in any way.
+#
+#
+# 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.
+#
+# 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
+#
+#
+# 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
+
+#=============================================================================
+# 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.)
+
+# Use FIND_PACKAGE( Qt4 COMPONENTS ... ) to enable modules
+IF( Qt4_FIND_COMPONENTS )
+ FOREACH( component ${Qt4_FIND_COMPONENTS} )
+ STRING( TOUPPER ${component} _COMPONENT )
+ SET( QT_USE_${_COMPONENT} 1 )
+ ENDFOREACH( component )
+
+ # To make sure we don't use QtCore or QtGui when not in COMPONENTS
+ IF(NOT QT_USE_QTCORE)
+ SET( QT_DONT_USE_QTCORE 1 )
+ ENDIF(NOT QT_USE_QTCORE)
+
+ IF(NOT QT_USE_QTGUI)
+ SET( QT_DONT_USE_QTGUI 1 )
+ ENDIF(NOT QT_USE_QTGUI)
+
+ENDIF( Qt4_FIND_COMPONENTS )
+
+# If Qt3 has already been found, fail.
+IF(QT_QT_LIBRARY)
+ IF(Qt4_FIND_REQUIRED)
+ MESSAGE( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.")
+ ELSE(Qt4_FIND_REQUIRED)
+ IF(NOT Qt4_FIND_QUIETLY)
+ MESSAGE( STATUS "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.")
+ ENDIF(NOT Qt4_FIND_QUIETLY)
+ RETURN()
+ ENDIF(Qt4_FIND_REQUIRED)
+ENDIF(QT_QT_LIBRARY)
+
+
+INCLUDE(CheckCXXSymbolExists)
+INCLUDE(MacroAddFileDependencies)
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
+
+SET( QT_DEFINITIONS "")
+
+# convenience macro for dealing with debug/release library names
+MACRO (_QT4_ADJUST_LIB_VARS _camelCaseBasename)
+
+ STRING(TOUPPER "${_camelCaseBasename}" basename)
+
+ # The name of the imported targets, i.e. the prefix "Qt4::" must not change,
+ # since it is stored in EXPORT-files as name of a required library. If the name would change
+ # here, this would lead to the imported Qt4-library targets not being resolved by cmake anymore.
+ IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
+
+ IF(NOT TARGET Qt4::${_camelCaseBasename})
+ ADD_LIBRARY(Qt4::${_camelCaseBasename} UNKNOWN IMPORTED )
+
+ IF (QT_${basename}_LIBRARY_RELEASE)
+ SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ if(QT_USE_FRAMEWORKS)
+ SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}/${_camelCaseBasename}" )
+ else()
+ SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" )
+ endif()
+ ENDIF (QT_${basename}_LIBRARY_RELEASE)
+
+ IF (QT_${basename}_LIBRARY_DEBUG)
+ SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ if(QT_USE_FRAMEWORKS)
+ SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}/${_camelCaseBasename}" )
+ else()
+ SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" )
+ endif()
+ ENDIF (QT_${basename}_LIBRARY_DEBUG)
+ ENDIF(NOT TARGET Qt4::${_camelCaseBasename})
+
+ # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these
+ # imported targets. This works better in general, and is also in almost all cases fully
+ # backward compatible. The only issue is when a project A which had this enabled then exports its
+ # libraries via export or EXPORT_LIBRARY_DEPENDENCIES(). In this case the libraries from project
+ # A will depend on the imported Qt targets, and the names of these imported targets will be stored
+ # in the dependency files on disk. This means when a project B then uses project A, these imported
+ # targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a
+ # library file on disk, and not as a target, and linking will fail:
+ IF(QT_USE_IMPORTED_TARGETS)
+ SET(QT_${basename}_LIBRARY Qt4::${_camelCaseBasename} )
+ SET(QT_${basename}_LIBRARIES Qt4::${_camelCaseBasename} )
+ ELSE(QT_USE_IMPORTED_TARGETS)
+
+ # if the release- as well as the debug-version of the library have been found:
+ IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
+ # if the generator supports configuration types then set
+ # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
+ IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
+ ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ # if there are no configuration types and CMAKE_BUILD_TYPE has no value
+ # then just use the release libraries
+ SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} )
+ ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
+ ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
+
+ # if only the release version was found, set the debug variable also to the release version
+ IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
+ SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE})
+ SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE})
+ SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_RELEASE})
+ ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
+
+ # if only the debug version was found, set the release variable also to the debug version
+ IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
+ SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG})
+ SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG})
+ SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG})
+ ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
+
+ # put the value in the cache:
+ SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE)
+
+ ENDIF(QT_USE_IMPORTED_TARGETS)
+
+ SET(QT_${basename}_FOUND 1)
+
+ ELSE (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
+
+ SET(QT_${basename}_LIBRARY "" CACHE STRING "The Qt ${basename} library" FORCE)
+
+ ENDIF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
+
+ IF (QT_${basename}_INCLUDE_DIR)
+ #add the include directory to QT_INCLUDES
+ SET(QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${QT_INCLUDES})
+ ENDIF (QT_${basename}_INCLUDE_DIR)
+
+ # Make variables changeble to the advanced user
+ MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR)
+ENDMACRO (_QT4_ADJUST_LIB_VARS)
+
+function(_QT4_QUERY_QMAKE VAR RESULT)
+ execute_process(COMMAND "${QT_QMAKE_EXECUTABLE}" -query ${VAR}
+ RESULT_VARIABLE return_code
+ OUTPUT_VARIABLE output ERROR_VARIABLE output
+ OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
+ if(NOT return_code)
+ file(TO_CMAKE_PATH "${output}" output)
+ set(${RESULT} ${output} PARENT_SCOPE)
+ endif(NOT return_code)
+endfunction(_QT4_QUERY_QMAKE)
+
+
+SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
+
+GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
+# check for qmake
+# Debian uses qmake-qt4
+# macports' Qt uses qmake-mac
+FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac PATHS
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin"
+ $ENV{QTDIR}/bin
+ DOC "The qmake executable for the Qt installation to use"
+)
+
+# double check that it was a Qt4 qmake, if not, re-find with different names
+IF (QT_QMAKE_EXECUTABLE)
+
+ IF(QT_QMAKE_EXECUTABLE_LAST)
+ STRING(COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED)
+ ENDIF(QT_QMAKE_EXECUTABLE_LAST)
+
+ SET(QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE)
+
+ _qt4_query_qmake(QT_VERSION QTVERSION)
+
+ # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path
+ IF(NOT QTVERSION)
+ SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE)
+ FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
+ $ENV{QTDIR}/bin
+ DOC "The qmake executable for the Qt installation to use"
+ )
+ IF(QT_QMAKE_EXECUTABLE)
+ _qt4_query_qmake(QT_VERSION QTVERSION)
+ ENDIF(QT_QMAKE_EXECUTABLE)
+ ENDIF(NOT QTVERSION)
+
+ENDIF (QT_QMAKE_EXECUTABLE)
+
+IF (QT_QMAKE_EXECUTABLE AND QTVERSION)
+
+ # ask qmake for the mkspecs directory
+ # we do this first because QT_LIBINFIX might be set
+ IF (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED)
+ _qt4_query_qmake(QMAKE_MKSPECS qt_mkspecs_dirs)
+ # do not replace : on windows as it might be a drive letter
+ # and windows should already use ; as a separator
+ IF(NOT WIN32)
+ STRING(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}")
+ ENDIF(NOT WIN32)
+ set(qt_cross_paths)
+ foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
+ set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/mkspecs")
+ endforeach(qt_cross_path)
+ 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")
+ ENDIF()
+
+ IF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
+ FILE(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents)
+ STRING(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}")
+ STRING(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}")
+ STRING(REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}")
+ STRING(REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}")
+ STRING(REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}")
+ ENDIF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
+ IF("${QT_EDITION}" MATCHES "DesktopLight")
+ SET(QT_EDITION_DESKTOPLIGHT 1)
+ ENDIF("${QT_EDITION}" MATCHES "DesktopLight")
+
+ # ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the
+ # others and for setting QT_LIBRARY_DIR
+ IF (NOT (QT_QTCORE_LIBRARY_RELEASE OR QT_QTCORE_LIBRARY_DEBUG) OR QT_QMAKE_CHANGED)
+ _qt4_query_qmake(QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP)
+ SET(QT_QTCORE_LIBRARY_RELEASE NOTFOUND)
+ SET(QT_QTCORE_LIBRARY_DEBUG NOTFOUND)
+ FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE
+ NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4
+ HINTS ${QT_LIBRARY_DIR_TMP}
+ NO_DEFAULT_PATH
+ )
+ FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG
+ NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4
+ HINTS ${QT_LIBRARY_DIR_TMP}
+ NO_DEFAULT_PATH
+ )
+
+ IF(NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG)
+ FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE
+ NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4
+ HINTS ${QT_LIBRARY_DIR_TMP}
+ )
+ FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG
+ NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4
+ HINTS ${QT_LIBRARY_DIR_TMP}
+ )
+ ENDIF(NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG)
+
+ # try dropping a hint if trying to use Visual Studio with Qt built by mingw
+ IF(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC)
+ IF(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a)
+ MESSAGE( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by mingw. Those compilers do not produce code compatible with each other.")
+ ENDIF(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a)
+ ENDIF(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC)
+
+ ENDIF ()
+
+ # set QT_LIBRARY_DIR based on location of QtCore found.
+ IF(QT_QTCORE_LIBRARY_RELEASE)
+ GET_FILENAME_COMPONENT(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_RELEASE}" PATH)
+ SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE)
+ SET(QT_QTCORE_FOUND 1)
+ ELSEIF(QT_QTCORE_LIBRARY_DEBUG)
+ GET_FILENAME_COMPONENT(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_DEBUG}" PATH)
+ 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(Qt4_FIND_REQUIRED)
+ MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.")
+ ENDIF(Qt4_FIND_REQUIRED)
+ ENDIF()
+
+ # ask qmake for the binary dir
+ IF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED)
+ _qt4_query_qmake(QT_INSTALL_BINS qt_bins)
+ SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE)
+ ENDIF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED)
+
+ IF (APPLE)
+ SET(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK})
+ IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
+ SET(QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE)
+ SET(CMAKE_FIND_FRAMEWORK FIRST)
+ ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
+ SET(QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE)
+ SET(CMAKE_FIND_FRAMEWORK LAST)
+ ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
+ ENDIF (APPLE)
+
+ # ask qmake for the include dir
+ IF (QT_LIBRARY_DIR AND (NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED))
+ _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers)
+ SET(QT_QTCORE_INCLUDE_DIR NOTFOUND)
+ FIND_PATH(QT_QTCORE_INCLUDE_DIR QtCore
+ HINTS ${qt_headers} ${QT_LIBRARY_DIR}
+ PATH_SUFFIXES QtCore qt4/QtCore
+ )
+
+ # Set QT_HEADERS_DIR based on finding QtCore header
+ IF(QT_QTCORE_INCLUDE_DIR)
+ IF(QT_USE_FRAMEWORKS)
+ SET(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE)
+ ELSE(QT_USE_FRAMEWORKS)
+ GET_FILENAME_COMPONENT(qt_headers "${QT_QTCORE_INCLUDE_DIR}/../" ABSOLUTE)
+ SET(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE)
+ ENDIF(QT_USE_FRAMEWORKS)
+ ELSEIF()
+ MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_HEADERS as ${qt_headers}")
+ MESSAGE("Warning: But QtCore couldn't be found. Qt must NOT be installed correctly.")
+ ENDIF()
+ ENDIF()
+
+ IF(APPLE)
+ SET(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_OLD})
+ ENDIF(APPLE)
+
+ # Set QT_INCLUDE_DIR based on QT_HEADERS_DIR
+ IF(QT_HEADERS_DIR)
+ IF(QT_USE_FRAMEWORKS)
+ # Qt/Mac frameworks has two include dirs.
+ # One is the framework include for which CMake will add a -F flag
+ # and the other is an include dir for non-framework Qt modules
+ SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR} ${QT_QTCORE_LIBRARY_RELEASE} )
+ ELSE(QT_USE_FRAMEWORKS)
+ SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR})
+ ENDIF(QT_USE_FRAMEWORKS)
+ ENDIF(QT_HEADERS_DIR)
+
+ # Set QT_INCLUDES
+ SET( QT_INCLUDES ${QT_MKSPECS_DIR}/default ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})
+
+
+ # ask qmake for the documentation directory
+ IF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED)
+ _qt4_query_qmake(QT_INSTALL_DOCS qt_doc_dir)
+ SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE)
+ ENDIF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED)
+
+
+ # ask qmake for the plugins directory
+ IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED)
+ _qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir)
+ SET(QT_PLUGINS_DIR NOTFOUND)
+ foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
+ set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins")
+ endforeach(qt_cross_path)
+ 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")
+ ENDIF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED)
+
+ # ask qmake for the translations directory
+ IF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED)
+ _qt4_query_qmake(QT_INSTALL_TRANSLATIONS qt_translations_dir)
+ SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE)
+ ENDIF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED)
+
+ # ask qmake for the imports directory
+ IF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED)
+ _qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir)
+ if(qt_imports_dir)
+ SET(QT_IMPORTS_DIR NOTFOUND)
+ foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
+ set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports")
+ endforeach(qt_cross_path)
+ FIND_PATH(QT_IMPORTS_DIR NAMES Qt
+ HINTS ${qt_cross_paths} ${qt_imports_dir}
+ DOC "The location of the Qt imports"
+ NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ mark_as_advanced(QT_IMPORTS_DIR)
+ endif(qt_imports_dir)
+ ENDIF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED)
+
+ # Make variables changeble to the advanced user
+ MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR
+ QT_PLUGINS_DIR QT_TRANSLATIONS_DIR)
+
+
+
+
+ #############################################
+ #
+ # 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})
+ # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
+ SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}")
+ # 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)
+ CHECK_CXX_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS)
+ CHECK_CXX_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC)
+ IF(Q_WS_MAC)
+ IF(QT_QMAKE_CHANGED)
+ UNSET(QT_MAC_USE_COCOA CACHE)
+ ENDIF(QT_QMAKE_CHANGED)
+ CHECK_CXX_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA)
+ ENDIF(Q_WS_MAC)
+
+ IF (QT_QTCOPY_REQUIRED)
+ CHECK_CXX_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY)
+ IF (NOT QT_IS_QTCOPY)
+ MESSAGE(FATAL_ERROR "qt-copy is required, but hasn't been found")
+ ENDIF (NOT QT_IS_QTCOPY)
+ ENDIF (QT_QTCOPY_REQUIRED)
+
+ # 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})
+ #
+ #############################################
+
+
+
+ ########################################
+ #
+ # Setting the INCLUDE-Variables
+ #
+ ########################################
+
+ SET(QT_MODULES QtGui Qt3Support QtSvg QtScript QtTest QtUiTools
+ QtHelp QtWebKit QtXmlPatterns phonon QtNetwork QtMultimedia
+ QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus QtScriptTools
+ QtDeclarative)
+
+ IF(Q_WS_X11)
+ SET(QT_MODULES ${QT_MODULES} QtMotif)
+ ENDIF(Q_WS_X11)
+
+ IF(QT_QMAKE_CHANGED)
+ FOREACH(QT_MODULE ${QT_MODULES})
+ STRING(TOUPPER ${QT_MODULE} _upper_qt_module)
+ SET(QT_${_upper_qt_module}_INCLUDE_DIR NOTFOUND)
+ SET(QT_${_upper_qt_module}_LIBRARY_RELEASE NOTFOUND)
+ SET(QT_${_upper_qt_module}_LIBRARY_DEBUG NOTFOUND)
+ ENDFOREACH(QT_MODULE)
+ SET(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR NOTFOUND)
+ SET(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NOTFOUND)
+ SET(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NOTFOUND)
+ SET(QT_QTASSISTANTCLIENT_INCLUDE_DIR NOTFOUND)
+ SET(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NOTFOUND)
+ SET(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NOTFOUND)
+ SET(QT_QTASSISTANT_INCLUDE_DIR NOTFOUND)
+ SET(QT_QTASSISTANT_LIBRARY_RELEASE NOTFOUND)
+ SET(QT_QTASSISTANT_LIBRARY_DEBUG NOTFOUND)
+ SET(QT_QTCLUCENE_LIBRARY_RELEASE NOTFOUND)
+ SET(QT_QTCLUCENE_LIBRARY_DEBUG NOTFOUND)
+ SET(QT_QAXCONTAINER_INCLUDE_DIR NOTFOUND)
+ SET(QT_QAXCONTAINER_LIBRARY_RELEASE NOTFOUND)
+ SET(QT_QAXCONTAINER_LIBRARY_DEBUG NOTFOUND)
+ SET(QT_QAXSERVER_INCLUDE_DIR NOTFOUND)
+ SET(QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND)
+ SET(QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND)
+ IF(Q_WS_WIN)
+ SET(QT_QTMAIN_LIBRARY_DEBUG NOTFOUND)
+ SET(QT_QTMAIN_LIBRARY_RELEASE NOTFOUND)
+ ENDIF(Q_WS_WIN)
+ ENDIF(QT_QMAKE_CHANGED)
+
+ FOREACH(QT_MODULE ${QT_MODULES})
+ STRING(TOUPPER ${QT_MODULE} _upper_qt_module)
+ FIND_PATH(QT_${_upper_qt_module}_INCLUDE_DIR ${QT_MODULE}
+ PATHS
+ ${QT_HEADERS_DIR}/${QT_MODULE}
+ ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+ # phonon doesn't seem consistent, let's try phonondefs.h for some
+ # installations
+ IF(${QT_MODULE} STREQUAL "phonon")
+ FIND_PATH(QT_${_upper_qt_module}_INCLUDE_DIR phonondefs.h
+ PATHS
+ ${QT_HEADERS_DIR}/${QT_MODULE}
+ ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+ ENDIF(${QT_MODULE} STREQUAL "phonon")
+ ENDFOREACH(QT_MODULE)
+
+ IF(Q_WS_WIN)
+ SET(QT_MODULES ${QT_MODULES} QAxContainer QAxServer)
+ # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR
+ FIND_PATH(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt
+ PATHS ${QT_HEADERS_DIR}/ActiveQt
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+ FIND_PATH(QT_QAXSERVER_INCLUDE_DIR ActiveQt
+ PATHS ${QT_HEADERS_DIR}/ActiveQt
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+ ENDIF(Q_WS_WIN)
+
+ # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR
+ FIND_PATH(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents
+ PATHS
+ ${QT_HEADERS_DIR}/QtDesigner
+ ${QT_LIBRARY_DIR}/QtDesigner.framework/Headers
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+
+ # Set QT_QTASSISTANT_INCLUDE_DIR
+ FIND_PATH(QT_QTASSISTANT_INCLUDE_DIR QtAssistant
+ PATHS
+ ${QT_HEADERS_DIR}/QtAssistant
+ ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+
+ # Set QT_QTASSISTANTCLIENT_INCLUDE_DIR
+ FIND_PATH(QT_QTASSISTANTCLIENT_INCLUDE_DIR QAssistantClient
+ PATHS
+ ${QT_HEADERS_DIR}/QtAssistant
+ ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+
+ ########################################
+ #
+ # Setting the LIBRARY-Variables
+ #
+ ########################################
+
+ # find the libraries
+ FOREACH(QT_MODULE ${QT_MODULES})
+ STRING(TOUPPER ${QT_MODULE} _upper_qt_module)
+ FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_RELEASE
+ NAMES ${QT_MODULE}${QT_LIBINFIX} ${QT_MODULE}${QT_LIBINFIX}4
+ PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+ FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_DEBUG
+ NAMES ${QT_MODULE}${QT_LIBINFIX}_debug ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4
+ PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+ ENDFOREACH(QT_MODULE)
+
+ # QtUiTools is sometimes not in the same directory as the other found libraries
+ # e.g. on Mac, its never a framework like the others are
+ IF(QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE)
+ FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR})
+ ENDIF(QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE)
+
+ # Set QT_QTDESIGNERCOMPONENTS_LIBRARY
+ FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents${QT_LIBINFIX} QtDesignerComponents${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents${QT_LIBINFIX}_debug QtDesignerComponents${QT_LIBINFIX}d QtDesignerComponents${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+
+ # Set QT_QTMAIN_LIBRARY
+ IF(Q_WS_WIN)
+ FIND_LIBRARY(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ ENDIF(Q_WS_WIN)
+
+ # Set QT_QTASSISTANTCLIENT_LIBRARY
+ FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+
+ # Set QT_QTASSISTANT_LIBRARY
+ FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 QtAssistant${QT_LIBINFIX} QtAssistant${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 QtAssistant${QT_LIBINFIX}_debug QtAssistant${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+
+ # Set QT_QTHELP_LIBRARY
+ FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} QtCLucene${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene${QT_LIBINFIX}_debug QtCLucene${QT_LIBINFIX}d QtCLucene${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE)
+ FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR})
+ ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE)
+
+
+ ############################################
+ #
+ # Check the existence of the libraries.
+ #
+ ############################################
+
+
+ # Set QT_xyz_LIBRARY variable and add
+ # library include path to QT_INCLUDES
+ _QT4_ADJUST_LIB_VARS(QtCore)
+
+ FOREACH(QT_MODULE ${QT_MODULES})
+ _QT4_ADJUST_LIB_VARS(${QT_MODULE})
+ ENDFOREACH(QT_MODULE)
+
+ _QT4_ADJUST_LIB_VARS(QtAssistant)
+ _QT4_ADJUST_LIB_VARS(QtAssistantClient)
+ _QT4_ADJUST_LIB_VARS(QtCLucene)
+ _QT4_ADJUST_LIB_VARS(QtDesignerComponents)
+
+ # platform dependent libraries
+ IF(Q_WS_WIN)
+ _QT4_ADJUST_LIB_VARS(qtmain)
+ _QT4_ADJUST_LIB_VARS(QAxServer)
+ _QT4_ADJUST_LIB_VARS(QAxContainer)
+ ENDIF(Q_WS_WIN)
+
+
+ #######################################
+ #
+ # Check the executables of Qt
+ # ( moc, uic, rcc )
+ #
+ #######################################
+
+
+ IF(QT_QMAKE_CHANGED)
+ SET(QT_UIC_EXECUTABLE NOTFOUND)
+ SET(QT_MOC_EXECUTABLE NOTFOUND)
+ SET(QT_UIC3_EXECUTABLE NOTFOUND)
+ SET(QT_RCC_EXECUTABLE NOTFOUND)
+ SET(QT_DBUSCPP2XML_EXECUTABLE NOTFOUND)
+ SET(QT_DBUSXML2CPP_EXECUTABLE NOTFOUND)
+ SET(QT_LUPDATE_EXECUTABLE NOTFOUND)
+ SET(QT_LRELEASE_EXECUTABLE NOTFOUND)
+ SET(QT_QCOLLECTIONGENERATOR_EXECUTABLE NOTFOUND)
+ SET(QT_DESIGNER_EXECUTABLE NOTFOUND)
+ SET(QT_LINGUIST_EXECUTABLE NOTFOUND)
+ ENDIF(QT_QMAKE_CHANGED)
+
+ FIND_PROGRAM(QT_MOC_EXECUTABLE
+ NAMES moc-qt4 moc
+ PATHS ${QT_BINARY_DIR}
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+
+ FIND_PROGRAM(QT_UIC_EXECUTABLE
+ NAMES uic-qt4 uic
+ 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
+ PATHS ${QT_BINARY_DIR}
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+
+ FIND_PROGRAM(QT_LRELEASE_EXECUTABLE
+ NAMES lrelease-qt4 lrelease
+ 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
+ PATHS ${QT_BINARY_DIR}
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+
+ FIND_PROGRAM(QT_LINGUIST_EXECUTABLE
+ NAMES linguist-qt4 linguist
+ PATHS ${QT_BINARY_DIR}
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+
+ IF (QT_MOC_EXECUTABLE)
+ SET(QT_WRAP_CPP "YES")
+ ENDIF (QT_MOC_EXECUTABLE)
+
+ IF (QT_UIC_EXECUTABLE)
+ SET(QT_WRAP_UI "YES")
+ ENDIF (QT_UIC_EXECUTABLE)
+
+
+
+ MARK_AS_ADVANCED( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE
+ QT_RCC_EXECUTABLE QT_DBUSXML2CPP_EXECUTABLE QT_DBUSCPP2XML_EXECUTABLE
+ QT_LUPDATE_EXECUTABLE QT_LRELEASE_EXECUTABLE QT_QCOLLECTIONGENERATOR_EXECUTABLE
+ QT_DESIGNER_EXECUTABLE QT_LINGUIST_EXECUTABLE)
+
+
+ # get the directory of the current file, used later on in the file
+ GET_FILENAME_COMPONENT( _qt4_current_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+
+ ###############################################
+ #
+ # configuration/system dependent settings
+ #
+ ###############################################
+
+ INCLUDE("${_qt4_current_dir}/Qt4ConfigDependentSettings.cmake")
+
+
+ #######################################
+ #
+ # Check the plugins of Qt
+ #
+ #######################################
+
+ 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_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_INPUTMETHODS_PLUGINS qimsw_multi )
+ SET( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler )
+ IF(APPLE)
+ SET( QT_PHONON_BACKEND_PLUGINS phonon_qt7 )
+ ELSEIF(WIN32)
+ SET( QT_PHONON_BACKEND_PLUGINS phonon_ds9 )
+ ENDIF()
+ SET( QT_SCRIPT_PLUGINS qtscriptdbus )
+ SET( QT_SQLDRIVERS_PLUGINS qsqldb2 qsqlibase qsqlite qsqlite2 qsqlmysql qsqloci qsqlodbc qsqlpsql qsqltds )
+
+ 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_QTSCRIPT_PLUGINS ${QT_SCRIPT_PLUGINS} )
+ SET( QT_QTSQL_PLUGINS ${QT_SQLDRIVERS_PLUGINS} )
+ SET( QT_QTSVG_PLUGINS qsvg qsvgicon )
+
+ IF(QT_QMAKE_CHANGED)
+ FOREACH(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES})
+ STRING(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type)
+ SET(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE})
+ FOREACH(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS})
+ STRING(TOUPPER ${QT_PLUGIN} _upper_qt_plugin)
+ UNSET(QT_${_upper_qt_plugin}_LIBRARY_RELEASE CACHE)
+ UNSET(QT_${_upper_qt_plugin}_LIBRARY_DEBUG CACHE)
+ UNSET(QT_${_upper_qt_plugin}_LIBRARY CACHE)
+ UNSET(QT_${_upper_qt_plugin}_PLUGIN_RELEASE CACHE)
+ UNSET(QT_${_upper_qt_plugin}_PLUGIN_DEBUG CACHE)
+ UNSET(QT_${_upper_qt_plugin}_PLUGIN CACHE)
+ ENDFOREACH(QT_PLUGIN)
+ ENDFOREACH(QT_PLUGIN_TYPE)
+ ENDIF(QT_QMAKE_CHANGED)
+
+ # find_library works better than find_file but we need to set prefixes to only match plugins
+ FOREACH(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES})
+ STRING(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type)
+ SET(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE})
+ FOREACH(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS})
+ STRING(TOUPPER ${QT_PLUGIN} _upper_qt_plugin)
+ IF(QT_IS_STATIC)
+ FIND_LIBRARY(QT_${_upper_qt_plugin}_LIBRARY_RELEASE
+ NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4
+ PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+ FIND_LIBRARY(QT_${_upper_qt_plugin}_LIBRARY_DEBUG
+ NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4
+ PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+ _QT4_ADJUST_LIB_VARS(${QT_PLUGIN})
+ ELSE(QT_IS_STATIC)
+ # find_library works easier/better than find_file but we need to set suffixes to only match plugins
+ SET(CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_MODULE_SUFFIX} ${CMAKE_SHARED_LIBRARY_SUFFIX})
+ FIND_LIBRARY(QT_${_upper_qt_plugin}_PLUGIN_RELEASE
+ NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4
+ PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+ FIND_LIBRARY(QT_${_upper_qt_plugin}_PLUGIN_DEBUG
+ NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4
+ PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ )
+ MARK_AS_ADVANCED(QT_${_upper_qt_plugin}_PLUGIN_RELEASE QT_${_upper_qt_plugin}_PLUGIN_DEBUG)
+ SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT})
+ ENDIF(QT_IS_STATIC)
+ ENDFOREACH(QT_PLUGIN)
+ ENDFOREACH(QT_PLUGIN_TYPE)
+
+
+ ######################################
+ #
+ # Macros for building Qt files
+ #
+ ######################################
+
+ INCLUDE("${_qt4_current_dir}/Qt4Macros.cmake")
+
+ # set version variables
+ STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}")
+ STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}")
+ STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}")
+
+ENDIF(QT_QMAKE_EXECUTABLE AND QTVERSION)
+
+#support old QT_MIN_VERSION if set, but not if version is supplied by find_package()
+IF(NOT Qt4_FIND_VERSION AND QT_MIN_VERSION)
+ SET(Qt4_FIND_VERSION ${QT_MIN_VERSION})
+ENDIF(NOT Qt4_FIND_VERSION AND QT_MIN_VERSION)
+
+IF( Qt4_FIND_COMPONENTS )
+
+ # if components specified in find_package(), make sure each of those pieces were found
+ SET(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR)
+ FOREACH( component ${Qt4_FIND_COMPONENTS} )
+ STRING( TOUPPER ${component} _COMPONENT )
+ if(${_COMPONENT} STREQUAL "QTMAIN")
+ IF(Q_WS_WIN)
+ SET(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_LIBRARY)
+ ENDIF(Q_WS_WIN)
+ else(${_COMPONENT} STREQUAL "QTMAIN")
+ SET(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_INCLUDE_DIR QT_${_COMPONENT}_LIBRARY)
+ endif(${_COMPONENT} STREQUAL "QTMAIN")
+ ENDFOREACH( component )
+
+ if(Qt4_FIND_COMPONENTS MATCHES QtGui)
+ SET(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_UIC_EXECUTABLE)
+ endif(Qt4_FIND_COMPONENTS MATCHES QtGui)
+
+ELSE( Qt4_FIND_COMPONENTS )
+
+ # if no components specified, we'll make a default set of required variables to say Qt is found
+ SET(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR
+ QT_LIBRARY_DIR QT_QTCORE_LIBRARY)
+
+ENDIF( Qt4_FIND_COMPONENTS )
+
+if (QT_VERSION_MAJOR GREATER 4)
+ SET(VERSION_MSG "Found unsuitable Qt version \"${QTVERSION}\" from ${QT_QMAKE_EXECUTABLE}")
+ SET(QT4_FOUND FALSE)
+ IF(Qt4_FIND_REQUIRED)
+ MESSAGE( FATAL_ERROR "${VERSION_MSG}, this code requires Qt 4.x")
+ ELSE(Qt4_FIND_REQUIRED)
+ IF(NOT Qt4_FIND_QUIETLY)
+ MESSAGE( STATUS "${VERSION_MSG}")
+ ENDIF(NOT Qt4_FIND_QUIETLY)
+ ENDIF(Qt4_FIND_REQUIRED)
+else()
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4
+ REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS}
+ VERSION_VAR QTVERSION
+ )
+endif()
+
+#######################################
+#
+# compatibility settings
+#
+#######################################
+# Backwards compatibility for CMake1.4 and 1.2
+SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} )
+SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} )
+SET( QT_QT_LIBRARY "")
+SET(QT_FOUND ${QT4_FOUND})
+
diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake
new file mode 100644
index 000000000..038c2dd65
--- /dev/null
+++ b/Modules/FindQuickTime.cmake
@@ -0,0 +1,47 @@
+# Locate QuickTime
+# This module defines
+# QUICKTIME_LIBRARY
+# QUICKTIME_FOUND, if false, do not try to link to gdal
+# QUICKTIME_INCLUDE_DIR, where to find the headers
+#
+# $QUICKTIME_DIR is an environment variable that would
+# correspond to the ./configure --prefix=$QUICKTIME_DIR
+#
+# Created by Eric Wing.
+
+#=============================================================================
+# 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.)
+
+# QuickTime on OS X looks different than QuickTime for Windows,
+# so I am going to case the two.
+
+IF(APPLE)
+ FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime/QuickTime.h)
+ FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime)
+ELSE(APPLE)
+ FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime.h
+ HINTS
+ $ENV{QUICKTIME_DIR}/include
+ $ENV{QUICKTIME_DIR}
+ )
+ FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime
+ HINTS
+ $ENV{QUICKTIME_DIR}/lib
+ $ENV{QUICKTIME_DIR}
+ )
+ENDIF(APPLE)
+
+# handle the QUIETLY and REQUIRED arguments and set QUICKTIME_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(QuickTime DEFAULT_MSG QUICKTIME_LIBRARY QUICKTIME_INCLUDE_DIR)
diff --git a/Modules/FindRTI.cmake b/Modules/FindRTI.cmake
new file mode 100644
index 000000000..031c13854
--- /dev/null
+++ b/Modules/FindRTI.cmake
@@ -0,0 +1,102 @@
+# - Try to find M&S HLA RTI libraries
+# This module finds if any HLA RTI is installed and locates the standard RTI
+# include files and libraries.
+#
+# RTI is a simulation infrastructure standardized by IEEE and SISO. It has a
+# well defined C++ API that assures that simulation applications are
+# independent on a particular RTI implementation.
+# http://en.wikipedia.org/wiki/Run-Time_Infrastructure_(simulation)
+#
+# This code sets the following variables:
+# RTI_INCLUDE_DIR = the directory where RTI includes file are found
+# RTI_LIBRARIES = The libraries to link against to use RTI
+# RTI_DEFINITIONS = -DRTI_USES_STD_FSTREAM
+# RTI_FOUND = Set to FALSE if any HLA RTI was not found
+#
+# Report problems to <certi-devel@nongnu.org>
+
+#=============================================================================
+# Copyright 2008-2009 Kitware, Inc.
+# Copyright 2008 Petr Gotthard <gotthard@honeywell.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(RTI_MESSAGE_QUIETLY QUIET TYPE MSG)
+ IF(NOT ${QUIET})
+ MESSAGE(${TYPE} "${MSG}")
+ ENDIF(NOT ${QUIET})
+ENDMACRO(RTI_MESSAGE_QUIETLY QUIET TYPE MSG)
+
+# Detect the CERTI installation, http://www.cert.fr/CERTI
+IF ("$ENV{CERTI_HOME}" STRGREATER "")
+ FILE(TO_CMAKE_PATH "$ENV{CERTI_HOME}" CERTI_HOME)
+ RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "Using environment defined CERTI_HOME: ${CERTI_HOME}")
+ENDIF ("$ENV{CERTI_HOME}" STRGREATER "")
+
+SET(RTI_DEFINITIONS "-DRTI_USES_STD_FSTREAM")
+
+# Detect the MAK Technologies RTI installation, http://www.mak.com/products/rti.php
+# note: the following list is ordered to find the most recent version first
+SET(RTI_POSSIBLE_DIRS
+ ${CERTI_HOME}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MAK Technologies\\MAK RTI 3.2 MSVC++ 8.0;Location]"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MAK RTI 3.2-win32-msvc++8.0;InstallLocation]"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MAK Technologies\\MAK RTI 2.2;Location]"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MAK RTI 2.2;InstallLocation]")
+
+SET(RTI_OLD_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
+# The MAK RTI has the "lib" prefix even on Windows.
+SET(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
+
+FIND_LIBRARY(RTI_LIBRARY
+ NAMES RTI RTI-NG
+ PATHS ${RTI_POSSIBLE_DIRS}
+ PATH_SUFFIXES lib
+ DOC "The RTI Library")
+
+IF (RTI_LIBRARY)
+ SET(RTI_LIBRARIES ${RTI_LIBRARY})
+ RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI library found: ${RTI_LIBRARY}")
+ELSE (RTI_LIBRARY)
+ RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI library NOT found")
+ENDIF (RTI_LIBRARY)
+
+FIND_LIBRARY(RTI_FEDTIME_LIBRARY
+ NAMES FedTime
+ PATHS ${RTI_POSSIBLE_DIRS}
+ PATH_SUFFIXES lib
+ DOC "The FedTime Library")
+
+IF (RTI_FEDTIME_LIBRARY)
+ SET(RTI_LIBRARIES ${RTI_LIBRARIES} ${RTI_FEDTIME_LIBRARY})
+ RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI FedTime found: ${RTI_FEDTIME_LIBRARY}")
+ENDIF (RTI_FEDTIME_LIBRARY)
+
+FIND_PATH(RTI_INCLUDE_DIR
+ NAMES RTI.hh
+ PATHS ${RTI_POSSIBLE_DIRS}
+ PATH_SUFFIXES include
+ DOC "The RTI Include Files")
+
+IF (RTI_INCLUDE_DIR)
+ RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI headers found: ${RTI_INCLUDE_DIR}")
+ELSE (RTI_INCLUDE_DIR)
+ RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI headers NOT found")
+ENDIF (RTI_INCLUDE_DIR)
+
+# Set the modified system variables back to the original value.
+SET(CMAKE_FIND_LIBRARY_PREFIXES "${RTI_OLD_FIND_LIBRARY_PREFIXES}")
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(RTI DEFAULT_MSG
+ RTI_LIBRARY RTI_INCLUDE_DIR)
+
+# $Id$
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
new file mode 100644
index 000000000..5e973e485
--- /dev/null
+++ b/Modules/FindRuby.cmake
@@ -0,0 +1,243 @@
+# - 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.
+#
+# The minimum required version of Ruby can be specified using the
+# standard syntax, e.g. FIND_PACKAGE(Ruby 1.8)
+#
+# It also determines what the name of the library is. This
+# code sets the following variables:
+#
+# RUBY_EXECUTABLE = full path to the ruby binary
+# RUBY_INCLUDE_DIRS = include dirs to be used when using the ruby library
+# RUBY_LIBRARY = full path to the ruby library
+# RUBY_VERSION = the version of ruby which was found, e.g. "1.8.7"
+# RUBY_FOUND = set to true if ruby ws found successfully
+#
+# RUBY_INCLUDE_PATH = same as RUBY_INCLUDE_DIRS, only provided for compatibility reasons, don't use it
+
+#=============================================================================
+# Copyright 2004-2009 Kitware, Inc.
+# Copyright 2008-2009 Alexander Neundorf <neundorf@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.)
+
+# RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'`
+# RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'`
+# RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'`
+# RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'`
+# RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
+
+# uncomment the following line to get debug output for this file
+# SET(_RUBY_DEBUG_OUTPUT TRUE)
+
+# Determine the list of possible names of the ruby executable depending
+# on which version of ruby is required
+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)
+ SET(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${RUBY_FIND_VERSION_MINOR}")
+ELSE(Ruby_FIND_VERSION_MAJOR AND Ruby_FIND_VERSION_MINOR)
+ SET(Ruby_FIND_VERSION_SHORT_NODOT "18")
+ENDIF(Ruby_FIND_VERSION_MAJOR AND Ruby_FIND_VERSION_MINOR)
+
+SET(_RUBY_POSSIBLE_EXECUTABLE_NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES} ruby1.9 ruby19)
+
+# if we want a version below 1.9, also look for ruby 1.8
+IF("${Ruby_FIND_VERSION_SHORT_NODOT}" VERSION_LESS "19")
+ SET(_RUBY_POSSIBLE_EXECUTABLE_NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES} ruby1.8 ruby18)
+ENDIF("${Ruby_FIND_VERSION_SHORT_NODOT}" VERSION_LESS "19")
+
+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)
+ EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']"
+ RESULT_VARIABLE _RUBY_SUCCESS
+ OUTPUT_VARIABLE _RUBY_OUTPUT
+ ERROR_QUIET)
+ ENDIF(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT)
+ SET(${OUTVAR} "${_RUBY_OUTPUT}" PARENT_SCOPE)
+ ENDFUNCTION(_RUBY_CONFIG_VAR)
+
+
+ # query the ruby version
+ _RUBY_CONFIG_VAR("MAJOR" RUBY_VERSION_MAJOR)
+ _RUBY_CONFIG_VAR("MINOR" RUBY_VERSION_MINOR)
+ _RUBY_CONFIG_VAR("TEENY" RUBY_VERSION_PATCH)
+
+ # query the different directories
+ _RUBY_CONFIG_VAR("archdir" RUBY_ARCH_DIR)
+ _RUBY_CONFIG_VAR("arch" RUBY_ARCH)
+ _RUBY_CONFIG_VAR("rubyhdrdir" RUBY_HDR_DIR)
+ _RUBY_CONFIG_VAR("libdir" RUBY_POSSIBLE_LIB_DIR)
+ _RUBY_CONFIG_VAR("rubylibdir" RUBY_RUBY_LIB_DIR)
+
+ # site_ruby
+ _RUBY_CONFIG_VAR("sitearchdir" RUBY_SITEARCH_DIR)
+ _RUBY_CONFIG_VAR("sitelibdir" RUBY_SITELIB_DIR)
+
+ # vendor_ruby available ?
+ EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'"
+ OUTPUT_VARIABLE RUBY_HAS_VENDOR_RUBY ERROR_QUIET)
+
+ IF(RUBY_HAS_VENDOR_RUBY)
+ _RUBY_CONFIG_VAR("vendorlibdir" RUBY_VENDORLIB_DIR)
+ _RUBY_CONFIG_VAR("vendorarchdir" RUBY_VENDORARCH_DIR)
+ ENDIF(RUBY_HAS_VENDOR_RUBY)
+
+ # save the results in the cache so we don't have to run ruby the next time again
+ SET(RUBY_VERSION_MAJOR ${RUBY_VERSION_MAJOR} CACHE PATH "The Ruby major version" FORCE)
+ 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_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)
+ SET(RUBY_SITELIB_DIR ${RUBY_SITELIB_DIR} CACHE PATH "The Ruby site lib dir" FORCE)
+ SET(RUBY_HAS_VENDOR_RUBY ${RUBY_HAS_VENDOR_RUBY} CACHE BOOL "Vendor Ruby is available" FORCE)
+ SET(RUBY_VENDORARCH_DIR ${RUBY_VENDORARCH_DIR} CACHE PATH "The Ruby vendor arch dir" FORCE)
+ SET(RUBY_VENDORLIB_DIR ${RUBY_VENDORLIB_DIR} CACHE PATH "The Ruby vendor lib dir" FORCE)
+
+ MARK_AS_ADVANCED(
+ RUBY_ARCH_DIR
+ RUBY_ARCH
+ RUBY_HDR_DIR
+ RUBY_POSSIBLE_LIB_DIR
+ RUBY_RUBY_LIB_DIR
+ RUBY_SITEARCH_DIR
+ RUBY_SITELIB_DIR
+ RUBY_HAS_VENDOR_RUBY
+ RUBY_VENDORARCH_DIR
+ RUBY_VENDORLIB_DIR
+ RUBY_VERSION_MAJOR
+ RUBY_VERSION_MINOR
+ RUBY_VERSION_PATCH
+ )
+ENDIF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
+
+# In case RUBY_EXECUTABLE could not be executed (e.g. cross compiling)
+# try to detect which version we found. This is not too good.
+IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
+ # by default assume 1.8.0
+ SET(RUBY_VERSION_MAJOR 1)
+ 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)
+ SET(RUBY_VERSION_MAJOR 1)
+ SET(RUBY_VERSION_MINOR 9)
+ ENDIF(${RUBY_EXECUTABLE} MATCHES "ruby1.?9" OR RUBY_HDR_DIR)
+ENDIF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
+
+IF(RUBY_VERSION_MAJOR)
+ SET(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}")
+ SET(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}")
+ SET(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}")
+ SET(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}")
+ENDIF(RUBY_VERSION_MAJOR)
+
+FIND_PATH(RUBY_INCLUDE_DIR
+ NAMES ruby.h
+ HINTS
+ ${RUBY_HDR_DIR}
+ ${RUBY_ARCH_DIR}
+ /usr/lib/ruby/${_RUBY_VERSION_SHORT}/i586-linux-gnu/ )
+
+SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIR} )
+
+# if ruby > 1.8 is required or if ruby > 1.8 was found, search for the config.h dir
+IF( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR)
+ FIND_PATH(RUBY_CONFIG_INCLUDE_DIR
+ NAMES ruby/config.h config.h
+ HINTS
+ ${RUBY_HDR_DIR}/${RUBY_ARCH}
+ ${RUBY_ARCH_DIR}
+ )
+
+ SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIRS} ${RUBY_CONFIG_INCLUDE_DIR} )
+ENDIF( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR)
+
+
+# Determine the list of possible names for the ruby library
+SET(_RUBY_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_RUBY_VERSION_SHORT} ruby${_RUBY_VERSION_SHORT_NODOT} ruby-${_RUBY_VERSION_SHORT} ruby-${RUBY_VERSION})
+
+IF(WIN32)
+ SET( _RUBY_MSVC_RUNTIME "" )
+ IF( MSVC60 )
+ SET( _RUBY_MSVC_RUNTIME "60" )
+ ENDIF( MSVC60 )
+ IF( MSVC70 )
+ SET( _RUBY_MSVC_RUNTIME "70" )
+ ENDIF( MSVC70 )
+ IF( MSVC71 )
+ SET( _RUBY_MSVC_RUNTIME "71" )
+ ENDIF( MSVC71 )
+ IF( MSVC80 )
+ SET( _RUBY_MSVC_RUNTIME "80" )
+ ENDIF( MSVC80 )
+ IF( MSVC90 )
+ SET( _RUBY_MSVC_RUNTIME "90" )
+ ENDIF( MSVC90 )
+
+ 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" )
+ENDIF(WIN32)
+
+FIND_LIBRARY(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR} )
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+SET(_RUBY_REQUIRED_VARS RUBY_EXECUTABLE RUBY_INCLUDE_DIR RUBY_LIBRARY)
+IF(_RUBY_VERSION_SHORT_NODOT GREATER 18)
+ LIST(APPEND _RUBY_REQUIRED_VARS RUBY_CONFIG_INCLUDE_DIR)
+ENDIF(_RUBY_VERSION_SHORT_NODOT GREATER 18)
+
+IF(_RUBY_DEBUG_OUTPUT)
+ MESSAGE(STATUS "--------FindRuby.cmake debug------------")
+ MESSAGE(STATUS "_RUBY_POSSIBLE_EXECUTABLE_NAMES: ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}")
+ MESSAGE(STATUS "_RUBY_POSSIBLE_LIB_NAMES: ${_RUBY_POSSIBLE_LIB_NAMES}")
+ MESSAGE(STATUS "RUBY_ARCH_DIR: ${RUBY_ARCH_DIR}")
+ MESSAGE(STATUS "RUBY_HDR_DIR: ${RUBY_HDR_DIR}")
+ MESSAGE(STATUS "RUBY_POSSIBLE_LIB_DIR: ${RUBY_POSSIBLE_LIB_DIR}")
+ MESSAGE(STATUS "Found RUBY_VERSION: \"${RUBY_VERSION}\" , short: \"${_RUBY_VERSION_SHORT}\", nodot: \"${_RUBY_VERSION_SHORT_NODOT}\"")
+ MESSAGE(STATUS "_RUBY_REQUIRED_VARS: ${_RUBY_REQUIRED_VARS}")
+ MESSAGE(STATUS "RUBY_EXECUTABLE: ${RUBY_EXECUTABLE}")
+ MESSAGE(STATUS "RUBY_LIBRARY: ${RUBY_LIBRARY}")
+ MESSAGE(STATUS "RUBY_INCLUDE_DIR: ${RUBY_INCLUDE_DIR}")
+ MESSAGE(STATUS "RUBY_CONFIG_INCLUDE_DIR: ${RUBY_CONFIG_INCLUDE_DIR}")
+ MESSAGE(STATUS "--------------------")
+ENDIF(_RUBY_DEBUG_OUTPUT)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ruby REQUIRED_VARS ${_RUBY_REQUIRED_VARS}
+ VERSION_VAR RUBY_VERSION )
+
+MARK_AS_ADVANCED(
+ RUBY_EXECUTABLE
+ RUBY_LIBRARY
+ RUBY_INCLUDE_DIR
+ RUBY_CONFIG_INCLUDE_DIR
+ )
+
+# Set some variables for compatibility with previous version of this file
+SET(RUBY_POSSIBLE_LIB_PATH ${RUBY_POSSIBLE_LIB_DIR})
+SET(RUBY_RUBY_LIB_PATH ${RUBY_RUBY_LIB_DIR})
+SET(RUBY_INCLUDE_PATH ${RUBY_INCLUDE_DIRS})
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
new file mode 100644
index 000000000..1c04726ea
--- /dev/null
+++ b/Modules/FindSDL.cmake
@@ -0,0 +1,173 @@
+# 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
+#
+# 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.
+#
+# Don't forget to include SDLmain.h and SDLmain.m your project for the
+# OS X framework based version. (Other versions link to -lSDLmain which
+# this module will try to find on your behalf.) Also for OS X, this
+# module will automatically add the -framework Cocoa on your behalf.
+#
+#
+# Additional Note: If you see an empty SDL_LIBRARY_TEMP in your configuration
+# and no SDL_LIBRARY, it means CMake did not find your SDL library
+# (SDL.dll, libsdl.so, SDL.framework, etc).
+# Set SDL_LIBRARY_TEMP to point to your SDL library, and configure again.
+# Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this value
+# as appropriate. These values are used to generate the final SDL_LIBRARY
+# variable, but when these values are unset, SDL_LIBRARY does not get created.
+#
+#
+# $SDLDIR is an environment variable that would
+# correspond to the ./configure --prefix=$SDLDIR
+# used in building SDL.
+# l.e.galup 9-20-02
+#
+# Modified by Eric Wing.
+# Added code to assist with automated building by using environmental variables
+# and providing a more controlled/consistent search behavior.
+# Added new modifications to recognize OS X frameworks and
+# additional Unix paths (FreeBSD, etc).
+# Also corrected the header search path to follow "proper" SDL guidelines.
+# Added a search for SDLmain which is needed by some platforms.
+# Added a search for threads which is needed by some platforms.
+# Added needed compile switches for MinGW.
+#
+# On OSX, this will prefer the Framework version (if found) over others.
+# People will have to manually change the cache values of
+# SDL_LIBRARY to override this selection or set the CMake environment
+# CMAKE_INCLUDE_PATH to modify the search paths.
+#
+# Note that the header path has changed from SDL/SDL.h to just SDL.h
+# This needed to change because "proper" SDL convention
+# is #include "SDL.h", not <SDL/SDL.h>. This is done for portability
+# reasons because not all systems place things in SDL/ (see FreeBSD).
+
+#=============================================================================
+# Copyright 2003-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.)
+
+FIND_PATH(SDL_INCLUDE_DIR SDL.h
+ HINTS
+ $ENV{SDLDIR}
+ PATH_SUFFIXES include/SDL include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local/include/SDL12
+ /usr/local/include/SDL11 # FreeBSD ports
+ /usr/include/SDL12
+ /usr/include/SDL11
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+)
+
+# 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 lib64 lib
+ PATHS
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+IF(NOT SDL_BUILDING_LIBRARY)
+ 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
+ # necessarily need it.
+ FIND_LIBRARY(SDLMAIN_LIBRARY
+ NAMES SDLmain SDLmain-1.1
+ HINTS
+ $ENV{SDLDIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ )
+ ENDIF(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework")
+ENDIF(NOT SDL_BUILDING_LIBRARY)
+
+# SDL may require threads on your system.
+# The Apple build may not need an explicit flag because one of the
+# frameworks may already provide it.
+# But for non-OSX systems, I will use the CMake Threads package.
+IF(NOT APPLE)
+ FIND_PACKAGE(Threads)
+ENDIF(NOT APPLE)
+
+# MinGW needs an additional library, mwindows
+# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows
+# (Actually on second look, I think it only needs one of the m* libraries.)
+IF(MINGW)
+ SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
+ENDIF(MINGW)
+
+IF(SDL_LIBRARY_TEMP)
+ # For SDLmain
+ IF(NOT SDL_BUILDING_LIBRARY)
+ IF(SDLMAIN_LIBRARY)
+ SET(SDL_LIBRARY_TEMP ${SDLMAIN_LIBRARY} ${SDL_LIBRARY_TEMP})
+ ENDIF(SDLMAIN_LIBRARY)
+ ENDIF(NOT SDL_BUILDING_LIBRARY)
+
+ # For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
+ # CMake doesn't display the -framework Cocoa string in the UI even
+ # though it actually is there if I modify a pre-used variable.
+ # I think it has something to do with the CACHE STRING.
+ # So I use a temporary variable until the end so I can set the
+ # "real" variable in one-shot.
+ IF(APPLE)
+ SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "-framework Cocoa")
+ ENDIF(APPLE)
+
+ # For threads, as mentioned Apple doesn't need this.
+ # In fact, there seems to be a problem if I used the Threads package
+ # and try using this line, so I'm just skipping it entirely for OS X.
+ IF(NOT APPLE)
+ SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
+ ENDIF(NOT APPLE)
+
+ # For MinGW library
+ IF(MINGW)
+ SET(SDL_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL_LIBRARY_TEMP})
+ ENDIF(MINGW)
+
+ # Set the final string here so the GUI reflects the final state.
+ SET(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
+ # Set the temp variable to INTERNAL so it is not seen in the CMake GUI
+ SET(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "")
+ENDIF(SDL_LIBRARY_TEMP)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL
+ REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR)
diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake
new file mode 100644
index 000000000..f215bda47
--- /dev/null
+++ b/Modules/FindSDL_image.cmake
@@ -0,0 +1,70 @@
+# Locate SDL_image library
+# This module defines
+# SDLIMAGE_LIBRARY, the name of the library to link against
+# SDLIMAGE_FOUND, if false, do not try to link to SDL
+# SDLIMAGE_INCLUDE_DIR, where to find SDL/SDL.h
+#
+# $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).
+
+#=============================================================================
+# 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.)
+
+FIND_PATH(SDLIMAGE_INCLUDE_DIR SDL_image.h
+ HINTS
+ $ENV{SDLIMAGEDIR}
+ $ENV{SDLDIR}
+ PATH_SUFFIXES include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local/include/SDL
+ /usr/include/SDL
+ /usr/local/include/SDL12
+ /usr/local/include/SDL11 # FreeBSD ports
+ /usr/include/SDL12
+ /usr/include/SDL11
+ /sw/include/SDL # Fink
+ /sw/include
+ /opt/local/include/SDL # DarwinPorts
+ /opt/local/include
+ /opt/csw/include/SDL # Blastwave
+ /opt/csw/include
+ /opt/include/SDL
+ /opt/include
+)
+
+FIND_LIBRARY(SDLIMAGE_LIBRARY
+ NAMES SDL_image
+ HINTS
+ $ENV{SDLIMAGEDIR}
+ $ENV{SDLDIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLIMAGE
+ REQUIRED_VARS SDLIMAGE_LIBRARY SDLIMAGE_INCLUDE_DIR)
diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake
new file mode 100644
index 000000000..7cc1a6b09
--- /dev/null
+++ b/Modules/FindSDL_mixer.cmake
@@ -0,0 +1,70 @@
+# Locate SDL_mixer library
+# This module defines
+# SDLMIXER_LIBRARY, the name of the library to link against
+# SDLMIXER_FOUND, if false, do not try to link to SDL
+# SDLMIXER_INCLUDE_DIR, where to find SDL/SDL.h
+#
+# $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).
+
+#=============================================================================
+# 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.)
+
+FIND_PATH(SDLMIXER_INCLUDE_DIR SDL_mixer.h
+ HINTS
+ $ENV{SDLMIXERDIR}
+ $ENV{SDLDIR}
+ PATH_SUFFIXES include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local/include/SDL
+ /usr/include/SDL
+ /usr/local/include/SDL12
+ /usr/local/include/SDL11 # FreeBSD ports
+ /usr/include/SDL12
+ /usr/include/SDL11
+ /sw/include/SDL # Fink
+ /sw/include
+ /opt/local/include/SDL # DarwinPorts
+ /opt/local/include
+ /opt/csw/include/SDL # Blastwave
+ /opt/csw/include
+ /opt/include/SDL
+ /opt/include
+)
+
+FIND_LIBRARY(SDLMIXER_LIBRARY
+ NAMES SDL_mixer
+ HINTS
+ $ENV{SDLMIXERDIR}
+ $ENV{SDLDIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLMIXER
+ REQUIRED_VARS SDLMIXER_LIBRARY SDLMIXER_INCLUDE_DIR)
diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake
new file mode 100644
index 000000000..ca1de7977
--- /dev/null
+++ b/Modules/FindSDL_net.cmake
@@ -0,0 +1,69 @@
+# Locate SDL_net library
+# This module defines
+# SDLNET_LIBRARY, the name of the library to link against
+# SDLNET_FOUND, if false, do not try to link against
+# SDLNET_INCLUDE_DIR, where to find the headers
+#
+# $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).
+
+#=============================================================================
+# 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.)
+
+FIND_PATH(SDLNET_INCLUDE_DIR SDL_net.h
+ HINTS
+ $ENV{SDLNETDIR}
+ $ENV{SDLDIR}
+ PATH_SUFFIXES include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local/include/SDL
+ /usr/include/SDL
+ /usr/local/include/SDL12
+ /usr/local/include/SDL11 # FreeBSD ports
+ /usr/include/SDL12
+ /usr/include/SDL11
+ /sw/include/SDL # Fink
+ /sw/include
+ /opt/local/include/SDL # DarwinPorts
+ /opt/local/include
+ /opt/csw/include/SDL # Blastwave
+ /opt/csw/include
+ /opt/include/SDL
+ /opt/include
+)
+FIND_LIBRARY(SDLNET_LIBRARY
+ NAMES SDL_net
+ HINTS
+ $ENV{SDLNETDIR}
+ $ENV{SDLDIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLNET
+ REQUIRED_VARS SDLNET_LIBRARY SDLNET_INCLUDE_DIR)
diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake
new file mode 100644
index 000000000..35294a5e4
--- /dev/null
+++ b/Modules/FindSDL_sound.cmake
@@ -0,0 +1,401 @@
+# 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
+# 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.
+
+#
+# This module also defines (but you shouldn't need to use directly)
+# SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link
+# against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one.
+# And might define the following as needed
+# MIKMOD_LIBRARY
+# MODPLUG_LIBRARY
+# OGG_LIBRARY
+# VORBIS_LIBRARY
+# SMPEG_LIBRARY
+# FLAC_LIBRARY
+# SPEEX_LIBRARY
+#
+# Typically, you should not use these variables directly, and you should use
+# SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other audio libraries
+# (if needed) to successfully compile on your system .
+#
+# Created by Eric Wing.
+# This module is a bit more complicated than the other FindSDL* family modules.
+# The reason is that SDL_sound can be compiled in a large variety of different ways
+# which are independent of platform. SDL_sound may dynamically link against other 3rd
+# party libraries to get additional codec support, such as Ogg Vorbis, SMPEG, ModPlug,
+# MikMod, FLAC, Speex, and potentially others.
+# Under some circumstances which I don't fully understand,
+# there seems to be a requirement
+# that dependent libraries of libraries you use must also be explicitly
+# linked against in order to successfully compile. SDL_sound does not currently
+# have any system in place to know how it was compiled.
+# So this CMake module does the hard work in trying to discover which 3rd party
+# libraries are required for building (if any).
+# This module uses a brute force approach to create a test program that uses SDL_sound,
+# and then tries to build it. If the build fails, it parses the error output for
+# known symbol names to figure out which libraries are needed.
+#
+# Responds to the $SDLDIR and $SDLSOUNDDIR environmental variable that would
+# correspond to the ./configure --prefix=$SDLDIR used in building SDL.
+#
+# On OSX, this will prefer the Framework version (if found) over others.
+# People will have to manually change the cache values of
+# SDL_LIBRARY to override this selectionor set the CMake environment
+# CMAKE_INCLUDE_PATH to modify the search paths.
+#
+
+#=============================================================================
+# 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.)
+
+SET(SDL_SOUND_EXTRAS "" CACHE STRING "SDL_sound extra flags")
+MARK_AS_ADVANCED(SDL_SOUND_EXTRAS)
+
+# Find SDL_sound.h
+FIND_PATH(SDL_SOUND_INCLUDE_DIR SDL_sound.h
+ HINTS
+ $ENV{SDLSOUNDDIR}/include
+ $ENV{SDLSOUNDDIR}
+ $ENV{SDLDIR}/include
+ $ENV{SDLDIR}
+ PATHS
+ /usr/local/include/SDL
+ /usr/include/SDL
+ /usr/local/include/SDL12
+ /usr/local/include/SDL11 # FreeBSD ports
+ /usr/include/SDL12
+ /usr/include/SDL11
+ /sw/include/SDL # Fink
+ /sw/include
+ /opt/local/include/SDL # DarwinPorts
+ /opt/local/include
+ /opt/csw/include/SDL # Blastwave
+ /opt/csw/include
+ /opt/include/SDL
+ /opt/include
+ )
+
+FIND_LIBRARY(SDL_SOUND_LIBRARY
+ NAMES SDL_sound
+ HINTS
+ $ENV{SDLSOUNDDIR}/lib
+ $ENV{SDLSOUNDDIR}
+ $ENV{SDLDIR}/lib
+ $ENV{SDLDIR}
+ PATHS
+ /sw/lib
+ /opt/local/lib
+ /opt/csw/lib
+ /opt/lib
+ )
+
+IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
+
+ # CMake is giving me problems using TRY_COMPILE with the CMAKE_FLAGS
+ # for the :STRING syntax if I have multiple values contained in a
+ # single variable. This is a problem for the SDL_LIBRARY variable
+ # because it does just that. When I feed this variable to the command,
+ # only the first value gets the appropriate modifier (e.g. -I) and
+ # the rest get dropped.
+ # To get multiple single variables to work, I must separate them with a "\;"
+ # I could go back and modify the FindSDL.cmake module, but that's kind of painful.
+ # The solution would be to try something like:
+ # SET(SDL_TRY_COMPILE_LIBRARY_LIST "${SDL_TRY_COMPILE_LIBRARY_LIST}\;${CMAKE_THREAD_LIBS_INIT}")
+ # Instead, it was suggested on the mailing list to write a temporary CMakeLists.txt
+ # with a temporary test project and invoke that with TRY_COMPILE.
+ # See message thread "Figuring out dependencies for a library in order to build"
+ # 2005-07-16
+ # TRY_COMPILE(
+ # MY_RESULT
+ # ${CMAKE_BINARY_DIR}
+ # ${PROJECT_SOURCE_DIR}/DetermineSoundLibs.c
+ # CMAKE_FLAGS
+ # -DINCLUDE_DIRECTORIES:STRING=${SDL_INCLUDE_DIR}\;${SDL_SOUND_INCLUDE_DIR}
+ # -DLINK_LIBRARIES:STRING=${SDL_SOUND_LIBRARY}\;${SDL_LIBRARY}
+ # OUTPUT_VARIABLE MY_OUTPUT
+ # )
+
+ # To minimize external dependencies, create a sdlsound test program
+ # which will be used to figure out if additional link dependencies are
+ # required for the link phase.
+ FILE(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/DetermineSoundLibs.c
+ "#include \"SDL_sound.h\"
+ #include \"SDL.h\"
+ int main(int argc, char* argv[])
+ {
+ Sound_AudioInfo desired;
+ Sound_Sample* sample;
+
+ SDL_Init(0);
+ Sound_Init();
+
+ /* This doesn't actually have to work, but Init() is a no-op
+ * for some of the decoders, so this should force more symbols
+ * to be pulled in.
+ */
+ sample = Sound_NewSampleFromFile(argv[1], &desired, 4096);
+
+ Sound_Quit();
+ SDL_Quit();
+ return 0;
+ }"
+ )
+
+ # Calling
+ # TARGET_LINK_LIBRARIES(DetermineSoundLibs "${SDL_SOUND_LIBRARY} ${SDL_LIBRARY})
+ # causes problems when SDL_LIBRARY looks like
+ # /Library/Frameworks/SDL.framework;-framework Cocoa
+ # The ;-framework Cocoa seems to be confusing CMake once the OS X
+ # framework support was added. I was told that breaking up the list
+ # would fix the problem.
+ SET(TMP_TRY_LIBS)
+ FOREACH(lib ${SDL_SOUND_LIBRARY} ${SDL_LIBRARY})
+ SET(TMP_TRY_LIBS "${TMP_TRY_LIBS} \"${lib}\"")
+ ENDFOREACH(lib)
+
+ # MESSAGE("TMP_TRY_LIBS ${TMP_TRY_LIBS}")
+
+ # Write the CMakeLists.txt and test project
+ # Weird, this is still sketchy. If I don't quote the variables
+ # in the TARGET_LINK_LIBRARIES, I seem to loose everything
+ # 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
+ "PROJECT(DetermineSoundLibs)
+ INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
+ ADD_EXECUTABLE(DetermineSoundLibs DetermineSoundLibs.c)
+ TARGET_LINK_LIBRARIES(DetermineSoundLibs ${TMP_TRY_LIBS})"
+ )
+
+ TRY_COMPILE(
+ MY_RESULT
+ ${PROJECT_BINARY_DIR}/CMakeTmp
+ ${PROJECT_BINARY_DIR}/CMakeTmp
+ DetermineSoundLibs
+ OUTPUT_VARIABLE MY_OUTPUT
+ )
+
+ # MESSAGE("${MY_RESULT}")
+ # MESSAGE(${MY_OUTPUT})
+
+ IF(NOT MY_RESULT)
+
+ # I expect that MPGLIB, VOC, WAV, AIFF, and SHN are compiled in statically.
+ # I think Timidity is also compiled in statically.
+ # I've never had to explcitly link against Quicktime, so I'll skip that for now.
+
+ SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARY})
+
+ # Find MikMod
+ IF("${MY_OUTPUT}" MATCHES "MikMod_")
+ FIND_LIBRARY(MIKMOD_LIBRARY
+ NAMES libmikmod-coreaudio mikmod
+ PATHS
+ $ENV{MIKMODDIR}/lib
+ $ENV{MIKMODDIR}
+ $ENV{SDLSOUNDDIR}/lib
+ $ENV{SDLSOUNDDIR}
+ $ENV{SDLDIR}/lib
+ $ENV{SDLDIR}
+ /sw/lib
+ /opt/local/lib
+ /opt/csw/lib
+ /opt/lib
+ )
+ IF(MIKMOD_LIBRARY)
+ SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MIKMOD_LIBRARY})
+ ENDIF(MIKMOD_LIBRARY)
+ ENDIF("${MY_OUTPUT}" MATCHES "MikMod_")
+
+ # Find ModPlug
+ IF("${MY_OUTPUT}" MATCHES "MODPLUG_")
+ FIND_LIBRARY(MODPLUG_LIBRARY
+ NAMES modplug
+ PATHS
+ $ENV{MODPLUGDIR}/lib
+ $ENV{MODPLUGDIR}
+ $ENV{SDLSOUNDDIR}/lib
+ $ENV{SDLSOUNDDIR}
+ $ENV{SDLDIR}/lib
+ $ENV{SDLDIR}
+ /sw/lib
+ /opt/local/lib
+ /opt/csw/lib
+ /opt/lib
+ )
+ IF(MODPLUG_LIBRARY)
+ SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MODPLUG_LIBRARY})
+ ENDIF(MODPLUG_LIBRARY)
+ ENDIF("${MY_OUTPUT}" MATCHES "MODPLUG_")
+
+
+ # Find Ogg and Vorbis
+ IF("${MY_OUTPUT}" MATCHES "ov_")
+ FIND_LIBRARY(VORBIS_LIBRARY
+ NAMES vorbis Vorbis VORBIS
+ PATHS
+ $ENV{VORBISDIR}/lib
+ $ENV{VORBISDIR}
+ $ENV{OGGDIR}/lib
+ $ENV{OGGDIR}
+ $ENV{SDLSOUNDDIR}/lib
+ $ENV{SDLSOUNDDIR}
+ $ENV{SDLDIR}/lib
+ $ENV{SDLDIR}
+ /sw/lib
+ /opt/local/lib
+ /opt/csw/lib
+ /opt/lib
+ )
+ IF(VORBIS_LIBRARY)
+ SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${VORBIS_LIBRARY})
+ ENDIF(VORBIS_LIBRARY)
+
+ FIND_LIBRARY(OGG_LIBRARY
+ NAMES ogg Ogg OGG
+ PATHS
+ $ENV{OGGDIR}/lib
+ $ENV{OGGDIR}
+ $ENV{VORBISDIR}/lib
+ $ENV{VORBISDIR}
+ $ENV{SDLSOUNDDIR}/lib
+ $ENV{SDLSOUNDDIR}
+ $ENV{SDLDIR}/lib
+ $ENV{SDLDIR}
+ /sw/lib
+ /opt/local/lib
+ /opt/csw/lib
+ /opt/lib
+ )
+ IF(OGG_LIBRARY)
+ SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY})
+ ENDIF(OGG_LIBRARY)
+ ENDIF("${MY_OUTPUT}" MATCHES "ov_")
+
+
+ # Find SMPEG
+ IF("${MY_OUTPUT}" MATCHES "SMPEG_")
+ FIND_LIBRARY(SMPEG_LIBRARY
+ NAMES smpeg SMPEG Smpeg SMpeg
+ PATHS
+ $ENV{SMPEGDIR}/lib
+ $ENV{SMPEGDIR}
+ $ENV{SDLSOUNDDIR}/lib
+ $ENV{SDLSOUNDDIR}
+ $ENV{SDLDIR}/lib
+ $ENV{SDLDIR}
+ /sw/lib
+ /opt/local/lib
+ /opt/csw/lib
+ /opt/lib
+ )
+ IF(SMPEG_LIBRARY)
+ SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SMPEG_LIBRARY})
+ ENDIF(SMPEG_LIBRARY)
+ ENDIF("${MY_OUTPUT}" MATCHES "SMPEG_")
+
+
+ # Find FLAC
+ IF("${MY_OUTPUT}" MATCHES "FLAC_")
+ FIND_LIBRARY(FLAC_LIBRARY
+ NAMES flac FLAC
+ PATHS
+ $ENV{FLACDIR}/lib
+ $ENV{FLACDIR}
+ $ENV{SDLSOUNDDIR}/lib
+ $ENV{SDLSOUNDDIR}
+ $ENV{SDLDIR}/lib
+ $ENV{SDLDIR}
+ /sw/lib
+ /opt/local/lib
+ /opt/csw/lib
+ /opt/lib
+ )
+ IF(FLAC_LIBRARY)
+ SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${FLAC_LIBRARY})
+ ENDIF(FLAC_LIBRARY)
+ ENDIF("${MY_OUTPUT}" MATCHES "FLAC_")
+
+
+ # Hmmm...Speex seems to depend on Ogg. This might be a problem if
+ # the TRY_COMPILE attempt gets blocked at SPEEX before it can pull
+ # in the Ogg symbols. I'm not sure if I should duplicate the ogg stuff
+ # above for here or if two ogg entries will screw up things.
+ IF("${MY_OUTPUT}" MATCHES "speex_")
+ FIND_LIBRARY(SPEEX_LIBRARY
+ NAMES speex SPEEX
+ PATHS
+ $ENV{SPEEXDIR}/lib
+ $ENV{SPEEXDIR}
+ $ENV{SDLSOUNDDIR}/lib
+ $ENV{SDLSOUNDDIR}
+ $ENV{SDLDIR}/lib
+ $ENV{SDLDIR}
+ /sw/lib
+ /opt/local/lib
+ /opt/csw/lib
+ /opt/lib
+ )
+ IF(SPEEX_LIBRARY)
+ SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SPEEX_LIBRARY})
+ ENDIF(SPEEX_LIBRARY)
+
+ # Find OGG (needed for Speex)
+ # We might have already found Ogg for Vorbis, so skip it if so.
+ IF(NOT OGG_LIBRARY)
+ FIND_LIBRARY(OGG_LIBRARY
+ NAMES ogg Ogg OGG
+ PATHS
+ $ENV{OGGDIR}/lib
+ $ENV{OGGDIR}
+ $ENV{VORBISDIR}/lib
+ $ENV{VORBISDIR}
+ $ENV{SPEEXDIR}/lib
+ $ENV{SPEEXDIR}
+ $ENV{SDLSOUNDDIR}/lib
+ $ENV{SDLSOUNDDIR}
+ $ENV{SDLDIR}/lib
+ $ENV{SDLDIR}
+ /sw/lib
+ /opt/local/lib
+ /opt/csw/lib
+ /opt/lib
+ )
+ IF(OGG_LIBRARY)
+ SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY})
+ ENDIF(OGG_LIBRARY)
+ ENDIF(NOT OGG_LIBRARY)
+ ENDIF("${MY_OUTPUT}" MATCHES "speex_")
+
+ ELSE(NOT MY_RESULT)
+ SET(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARY}" CACHE INTERNAL "SDL_sound and dependent libraries")
+ ENDIF(NOT MY_RESULT)
+
+ SET(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}" CACHE INTERNAL "SDL_sound and dependent libraries")
+ ENDIF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_SOUND
+ REQUIRED_VARS SDL_SOUND_LIBRARIES SDL_SOUND_INCLUDE_DIR)
diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake
new file mode 100644
index 000000000..184b6c3f5
--- /dev/null
+++ b/Modules/FindSDL_ttf.cmake
@@ -0,0 +1,70 @@
+# Locate SDL_ttf library
+# This module defines
+# SDLTTF_LIBRARY, the name of the library to link against
+# SDLTTF_FOUND, if false, do not try to link to SDL
+# SDLTTF_INCLUDE_DIR, where to find SDL/SDL.h
+#
+# $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).
+
+#=============================================================================
+# 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.)
+
+FIND_PATH(SDLTTF_INCLUDE_DIR SDL_ttf.h
+ HINTS
+ $ENV{SDLTTFDIR}
+ $ENV{SDLDIR}
+ PATH_SUFFIXES include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local/include/SDL
+ /usr/include/SDL
+ /usr/local/include/SDL12
+ /usr/local/include/SDL11 # FreeBSD ports
+ /usr/include/SDL12
+ /usr/include/SDL11
+ /sw/include/SDL # Fink
+ /sw/include
+ /opt/local/include/SDL # DarwinPorts
+ /opt/local/include
+ /opt/csw/include/SDL # Blastwave
+ /opt/csw/include
+ /opt/include/SDL
+ /opt/include
+)
+
+FIND_LIBRARY(SDLTTF_LIBRARY
+ NAMES SDL_ttf
+ HINTS
+ $ENV{SDLTTFDIR}
+ $ENV{SDLDIR}
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ PATH_SUFFIXES lib64 lib
+)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLTTF
+ REQUIRED_VARS SDLTTF_LIBRARY SDLTTF_INCLUDE_DIR)
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake
new file mode 100644
index 000000000..2e34eb1b4
--- /dev/null
+++ b/Modules/FindSWIG.cmake
@@ -0,0 +1,68 @@
+# - Find SWIG
+# This module finds an installed SWIG. It sets the following variables:
+# SWIG_FOUND - set to true if SWIG is found
+# SWIG_DIR - the directory where swig is installed
+# SWIG_EXECUTABLE - the path to the swig executable
+# SWIG_VERSION - the version number of the swig executable
+#
+# The minimum required version of SWIG can be specified using the
+# standard syntax, e.g. FIND_PACKAGE(SWIG 1.1)
+#
+# All information is collected from the SWIG_EXECUTABLE so the
+# version to be found can be changed from the command line by
+# means of setting SWIG_EXECUTABLE
+#
+
+#=============================================================================
+# Copyright 2004-2009 Kitware, Inc.
+# Copyright 2011 Mathieu Malaterre <mathieu.malaterre@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.)
+
+FIND_PROGRAM(SWIG_EXECUTABLE NAMES swig2.0 swig)
+
+IF(SWIG_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -swiglib
+ OUTPUT_VARIABLE SWIG_swiglib_output
+ ERROR_VARIABLE SWIG_swiglib_error
+ RESULT_VARIABLE SWIG_swiglib_result)
+
+ IF(SWIG_swiglib_result)
+ IF(SWIG_FIND_REQUIRED)
+ MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}")
+ ELSE(SWIG_FIND_REQUIRED)
+ MESSAGE(STATUS "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}")
+ ENDIF(SWIG_FIND_REQUIRED)
+ ELSE(SWIG_swiglib_result)
+ 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})
+ IF(SWIG_DIR)
+ SET(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake)
+ EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -version
+ OUTPUT_VARIABLE SWIG_version_output
+ ERROR_VARIABLE SWIG_version_output
+ RESULT_VARIABLE SWIG_version_result)
+ IF(SWIG_version_result)
+ MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${SWIG_version_output}")
+ ELSE(SWIG_version_result)
+ STRING(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1"
+ SWIG_version_output "${SWIG_version_output}")
+ SET(SWIG_VERSION ${SWIG_version_output} CACHE STRING "Swig version" FORCE)
+ ENDIF(SWIG_version_result)
+ ENDIF(SWIG_DIR)
+ ENDIF(SWIG_swiglib_result)
+ENDIF(SWIG_EXECUTABLE)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR
+ VERSION_VAR SWIG_VERSION )
diff --git a/Modules/FindSelfPackers.cmake b/Modules/FindSelfPackers.cmake
new file mode 100644
index 000000000..ffca84200
--- /dev/null
+++ b/Modules/FindSelfPackers.cmake
@@ -0,0 +1,68 @@
+# - Find upx
+# This module looks for some executable packers (i.e. softwares 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
+
+#=============================================================================
+# 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.)
+
+INCLUDE(FindCygwin)
+
+FIND_PROGRAM(SELF_PACKER_FOR_EXECUTABLE
+ upx
+ ${CYGWIN_INSTALL_PATH}/bin
+ /bin
+ /usr/bin
+ /usr/local/bin
+ /sbin
+)
+
+FIND_PROGRAM(SELF_PACKER_FOR_SHARED_LIB
+ upx
+ ${CYGWIN_INSTALL_PATH}/bin
+ /bin
+ /usr/bin
+ /usr/local/bin
+ /sbin
+)
+
+MARK_AS_ADVANCED(
+ SELF_PACKER_FOR_EXECUTABLE
+ SELF_PACKER_FOR_SHARED_LIB
+)
+
+#
+# Set flags
+#
+IF (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx")
+ SET (SELF_PACKER_FOR_EXECUTABLE_FLAGS "-q" CACHE STRING
+ "Flags for the executable self-packer.")
+ELSE (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx")
+ SET (SELF_PACKER_FOR_EXECUTABLE_FLAGS "" CACHE STRING
+ "Flags for the executable self-packer.")
+ENDIF (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx")
+
+IF (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx")
+ SET (SELF_PACKER_FOR_SHARED_LIB_FLAGS "-q" CACHE STRING
+ "Flags for the shared lib self-packer.")
+ELSE (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx")
+ SET (SELF_PACKER_FOR_SHARED_LIB_FLAGS "" CACHE STRING
+ "Flags for the shared lib self-packer.")
+ENDIF (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx")
+
+MARK_AS_ADVANCED(
+ SELF_PACKER_FOR_EXECUTABLE_FLAGS
+ SELF_PACKER_FOR_SHARED_LIB_FLAGS
+)
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
new file mode 100644
index 000000000..48d195a1e
--- /dev/null
+++ b/Modules/FindSquish.cmake
@@ -0,0 +1,125 @@
+#
+# ---- Find Squish
+# This module can be used to find Squish (currently support is aimed at version 3).
+#
+# ---- Variables and Macros
+# SQUISH_FOUND If false, don't try to use Squish
+#
+# 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?
+#
+# macro SQUISH_ADD_TEST(testName applicationUnderTest testSuite testCase)
+#
+# ---- Typical Use
+# ENABLE_TESTING()
+# FIND_PACKAGE(Squish)
+# IF (SQUISH_FOUND)
+# SQUISH_ADD_TEST(myTestName myApplication testSuiteName testCaseName)
+# ENDIF (SQUISH_FOUND)
+#
+
+#=============================================================================
+# Copyright 2008-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.)
+
+SET(SQUISH_INSTALL_DIR_STRING "Directory containing the bin, doc, and lib directories for Squish; this should be the root of the installation directory.")
+SET(SQUISH_SERVER_EXECUTABLE_STRING "The squishserver executable program.")
+SET(SQUISH_CLIENT_EXECUTABLE_STRING "The squishclient executable program.")
+
+# Search only if the location is not already known.
+IF(NOT SQUISH_INSTALL_DIR)
+ # Get the system search path as a list.
+ FILE(TO_CMAKE_PATH "$ENV{PATH}" SQUISH_INSTALL_DIR_SEARCH2)
+
+ # Construct a set of paths relative to the system search path.
+ SET(SQUISH_INSTALL_DIR_SEARCH "")
+ FOREACH(dir ${SQUISH_INSTALL_DIR_SEARCH2})
+ SET(SQUISH_INSTALL_DIR_SEARCH ${SQUISH_INSTALL_DIR_SEARCH} "${dir}/../lib/fltk")
+ ENDFOREACH(dir)
+ STRING(REPLACE "//" "/" SQUISH_INSTALL_DIR_SEARCH "${SQUISH_INSTALL_DIR_SEARCH}")
+
+ # Look for an installation
+ FIND_PATH(SQUISH_INSTALL_DIR bin/squishrunner
+ # Look for an environment variable SQUISH_INSTALL_DIR.
+ $ENV{SQUISH_INSTALL_DIR}
+
+ # Look in places relative to the system executable search path.
+ ${SQUISH_INSTALL_DIR_SEARCH}
+
+ # Look in standard UNIX install locations.
+ #/usr/local/squish
+
+ DOC "The ${SQUISH_INSTALL_DIR_STRING}"
+ )
+ENDIF(NOT SQUISH_INSTALL_DIR)
+
+# search for the executables
+IF(SQUISH_INSTALL_DIR)
+ SET(SQUISH_INSTALL_DIR_FOUND 1)
+
+ # find the client program
+ IF(NOT SQUISH_CLIENT_EXECUTABLE)
+ FIND_PROGRAM(SQUISH_CLIENT_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishrunner DOC "The ${SQUISH_CLIENT_EXECUTABLE_STRING}")
+ ENDIF(NOT SQUISH_CLIENT_EXECUTABLE)
+
+ # find the server program
+ IF(NOT SQUISH_SERVER_EXECUTABLE)
+ FIND_PROGRAM(SQUISH_SERVER_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishserver DOC "The ${SQUISH_SERVER_EXECUTABLE_STRING}")
+ ENDIF(NOT SQUISH_SERVER_EXECUTABLE)
+
+ELSE(SQUISH_INSTALL_DIR)
+ SET(SQUISH_INSTALL_DIR_FOUND 0)
+ENDIF(SQUISH_INSTALL_DIR)
+
+# record if executables are set
+IF(SQUISH_CLIENT_EXECUTABLE)
+ SET(SQUISH_CLIENT_EXECUTABLE_FOUND 1)
+ELSE(SQUISH_CLIENT_EXECUTABLE)
+ SET(SQUISH_CLIENT_EXECUTABLE_FOUND 0)
+ENDIF(SQUISH_CLIENT_EXECUTABLE)
+
+IF(SQUISH_SERVER_EXECUTABLE)
+ SET(SQUISH_SERVER_EXECUTABLE_FOUND 1)
+ELSE(SQUISH_SERVER_EXECUTABLE)
+ SET(SQUISH_SERVER_EXECUTABLE_FOUND 0)
+ENDIF(SQUISH_SERVER_EXECUTABLE)
+
+# record if Squish was found
+SET(SQUISH_FOUND 1)
+FOREACH(var SQUISH_INSTALL_DIR_FOUND SQUISH_CLIENT_EXECUTABLE_FOUND SQUISH_SERVER_EXECUTABLE_FOUND)
+ IF(NOT ${var})
+ SET(SQUISH_FOUND 0)
+ ENDIF(NOT ${var})
+ENDFOREACH(var)
+
+MACRO(SQUISH_ADD_TEST testName testAUT testCase envVars testWraper)
+ ADD_TEST(${testName}
+ ${CMAKE_COMMAND} -V -VV
+ "-Dsquish_aut:STRING=${testAUT}"
+ "-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}"
+ "-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}"
+ "-Dsquish_libqtdir:STRING=${QT_LIBRARY_DIR}"
+ "-Dsquish_test_case:STRING=${testCase}"
+ "-Dsquish_env_vars:STRING=${envVars}"
+ "-Dsquish_wrapper:STRING=${testWraper}"
+ -P "${CMAKE_ROOT}/Modules/SquishTestScript.cmake"
+ )
+ SET_TESTS_PROPERTIES(${testName}
+ PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED;ERROR;FATAL"
+ )
+ENDMACRO(SQUISH_ADD_TEST)
+
diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake
new file mode 100644
index 000000000..4166d99ab
--- /dev/null
+++ b/Modules/FindSubversion.cmake
@@ -0,0 +1,131 @@
+# - 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
+#
+# The minimum required version of Subversion can be specified using the
+# standard syntax, e.g. FIND_PACKAGE(Subversion 1.4)
+#
+# If the command line client executable is found two macros are defined:
+# Subversion_WC_INFO(<dir> <var-prefix>)
+# 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
+# variable:
+# <var-prefix>_LAST_CHANGED_LOG - last log of base revision
+# Example usage:
+# FIND_PACKAGE(Subversion)
+# IF(SUBVERSION_FOUND)
+# Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
+# MESSAGE("Current revision is ${Project_WC_REVISION}")
+# Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
+# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
+# ENDIF(SUBVERSION_FOUND)
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Tristan Carel
+#
+# 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_PROGRAM(Subversion_SVN_EXECUTABLE svn
+ DOC "subversion command line client")
+MARK_AS_ADVANCED(Subversion_SVN_EXECUTABLE)
+
+IF(Subversion_SVN_EXECUTABLE)
+ # the subversion commands should be executed with the C locale, otherwise
+ # the message (which are parsed) may be translated, Alex
+ SET(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}")
+ SET(ENV{LC_ALL} C)
+
+ EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} --version
+ OUTPUT_VARIABLE Subversion_VERSION_SVN
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ # restore the previous LC_ALL
+ SET(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL})
+
+ STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*"
+ "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}")
+
+ MACRO(Subversion_WC_INFO dir prefix)
+ # the subversion commands should be executed with the C locale, otherwise
+ # the message (which are parsed) may be translated, Alex
+ SET(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}")
+ SET(ENV{LC_ALL} C)
+
+ EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} info ${dir}
+ OUTPUT_VARIABLE ${prefix}_WC_INFO
+ ERROR_VARIABLE Subversion_svn_info_error
+ RESULT_VARIABLE Subversion_svn_info_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ IF(NOT ${Subversion_svn_info_result} EQUAL 0)
+ MESSAGE(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} info ${dir}\" failed with output:\n${Subversion_svn_info_error}")
+ ELSE(NOT ${Subversion_svn_info_result} EQUAL 0)
+
+ STRING(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*"
+ "\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}")
+ STRING(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*"
+ "\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}")
+ STRING(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*"
+ "\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}")
+ STRING(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*"
+ "\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}")
+ STRING(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*"
+ "\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}")
+ STRING(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*"
+ "\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}")
+
+ ENDIF(NOT ${Subversion_svn_info_result} EQUAL 0)
+
+ # restore the previous LC_ALL
+ SET(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL})
+
+ ENDMACRO(Subversion_WC_INFO)
+
+ MACRO(Subversion_WC_LOG dir prefix)
+ # This macro can block if the certificate is not signed:
+ # svn ask you to accept the certificate and wait for your answer
+ # This macro requires a svn server network access (Internet most of the time)
+ # and can also be slow since it access the svn server
+ EXECUTE_PROCESS(COMMAND
+ ${Subversion_SVN_EXECUTABLE} --non-interactive log -r BASE ${dir}
+ OUTPUT_VARIABLE ${prefix}_LAST_CHANGED_LOG
+ ERROR_VARIABLE Subversion_svn_log_error
+ RESULT_VARIABLE Subversion_svn_log_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ IF(NOT ${Subversion_svn_log_result} EQUAL 0)
+ MESSAGE(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Subversion_svn_log_error}")
+ ENDIF(NOT ${Subversion_svn_log_result} EQUAL 0)
+ ENDMACRO(Subversion_WC_LOG)
+
+ENDIF(Subversion_SVN_EXECUTABLE)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Subversion REQUIRED_VARS Subversion_SVN_EXECUTABLE
+ VERSION_VAR Subversion_VERSION_SVN )
+
+# for compatibility
+SET(Subversion_FOUND ${SUBVERSION_FOUND})
+SET(Subversion_SVN_FOUND ${SUBVERSION_FOUND})
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
new file mode 100644
index 000000000..7f6d3a7ee
--- /dev/null
+++ b/Modules/FindTCL.cmake
@@ -0,0 +1,215 @@
+# - 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
+#
+# 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.
+
+#=============================================================================
+# 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.)
+
+INCLUDE(CMakeFindFrameworks)
+INCLUDE(FindTclsh)
+INCLUDE(FindWish)
+
+IF(TCLSH_VERSION_STRING)
+ SET(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}")
+ELSE(TCLSH_VERSION_STRING)
+ GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
+ GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
+ STRING(REGEX REPLACE
+ "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
+ENDIF(TCLSH_VERSION_STRING)
+
+GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH)
+GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}")
+
+GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH)
+GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH)
+
+GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH)
+GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY}")
+
+GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH)
+GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}")
+
+SET(TCLTK_POSSIBLE_LIB_PATHS
+ "${TCL_INCLUDE_PATH_PARENT}/lib"
+ "${TK_INCLUDE_PATH_PARENT}/lib"
+ "${TCL_LIBRARY_PATH}"
+ "${TK_LIBRARY_PATH}"
+ "${TCL_TCLSH_PATH_PARENT}/lib"
+ "${TK_WISH_PATH_PARENT}/lib"
+ )
+
+IF(WIN32)
+ GET_FILENAME_COMPONENT(
+ ActiveTcl_CurrentVersion
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
+ NAME)
+ SET(TCLTK_POSSIBLE_LIB_PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib"
+ "$ENV{ProgramFiles}/Tcl/Lib"
+ "C:/Program Files/Tcl/lib"
+ "C:/Tcl/lib"
+ )
+ENDIF(WIN32)
+
+FIND_LIBRARY(TCL_LIBRARY
+ NAMES
+ tcl
+ tcl${TCL_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION}
+ tcl86 tcl8.6
+ tcl85 tcl8.5
+ tcl84 tcl8.4
+ tcl83 tcl8.3
+ tcl82 tcl8.2
+ tcl80 tcl8.0
+ PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
+ )
+
+FIND_LIBRARY(TK_LIBRARY
+ NAMES
+ tk
+ tk${TK_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION}
+ tk86 tk8.6
+ tk85 tk8.5
+ tk84 tk8.4
+ tk83 tk8.3
+ tk82 tk8.2
+ tk80 tk8.0
+ PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
+ )
+
+CMAKE_FIND_FRAMEWORKS(Tcl)
+CMAKE_FIND_FRAMEWORKS(Tk)
+
+SET(TCL_FRAMEWORK_INCLUDES)
+IF(Tcl_FRAMEWORKS)
+ IF(NOT TCL_INCLUDE_PATH)
+ FOREACH(dir ${Tcl_FRAMEWORKS})
+ SET(TCL_FRAMEWORK_INCLUDES ${TCL_FRAMEWORK_INCLUDES} ${dir}/Headers)
+ ENDFOREACH(dir)
+ ENDIF(NOT TCL_INCLUDE_PATH)
+ENDIF(Tcl_FRAMEWORKS)
+
+SET(TK_FRAMEWORK_INCLUDES)
+IF(Tk_FRAMEWORKS)
+ IF(NOT TK_INCLUDE_PATH)
+ FOREACH(dir ${Tk_FRAMEWORKS})
+ SET(TK_FRAMEWORK_INCLUDES ${TK_FRAMEWORK_INCLUDES}
+ ${dir}/Headers ${dir}/PrivateHeaders)
+ ENDFOREACH(dir)
+ ENDIF(NOT TK_INCLUDE_PATH)
+ENDIF(Tk_FRAMEWORKS)
+
+SET(TCLTK_POSSIBLE_INCLUDE_PATHS
+ "${TCL_LIBRARY_PATH_PARENT}/include"
+ "${TK_LIBRARY_PATH_PARENT}/include"
+ "${TCL_INCLUDE_PATH}"
+ "${TK_INCLUDE_PATH}"
+ ${TCL_FRAMEWORK_INCLUDES}
+ ${TK_FRAMEWORK_INCLUDES}
+ "${TCL_TCLSH_PATH_PARENT}/include"
+ "${TK_WISH_PATH_PARENT}/include"
+ /usr/include/tcl${TK_LIBRARY_VERSION}
+ /usr/include/tcl${TCL_LIBRARY_VERSION}
+ /usr/include/tcl8.6
+ /usr/include/tcl8.5
+ /usr/include/tcl8.4
+ /usr/include/tcl8.3
+ /usr/include/tcl8.2
+ /usr/include/tcl8.0
+ )
+
+IF(WIN32)
+ SET(TCLTK_POSSIBLE_INCLUDE_PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/include"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/include"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/include"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/include"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/include"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/include"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/include"
+ "$ENV{ProgramFiles}/Tcl/include"
+ "C:/Program Files/Tcl/include"
+ "C:/Tcl/include"
+ )
+ENDIF(WIN32)
+
+FIND_PATH(TCL_INCLUDE_PATH
+ NAMES tcl.h
+ HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
+ )
+
+FIND_PATH(TK_INCLUDE_PATH
+ NAMES tk.h
+ HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
+ )
+
+# handle the QUIETLY and REQUIRED arguments and set TCL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
+SET(TCLTK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
+SET(TCLTK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCLTK DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH TK_LIBRARY TK_INCLUDE_PATH)
+SET(TK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
+SET(TK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(TK DEFAULT_MSG TK_LIBRARY TK_INCLUDE_PATH)
+
+MARK_AS_ADVANCED(
+ TCL_INCLUDE_PATH
+ TK_INCLUDE_PATH
+ TCL_LIBRARY
+ TK_LIBRARY
+ )
diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
new file mode 100644
index 000000000..16f9e238a
--- /dev/null
+++ b/Modules/FindTIFF.cmake
@@ -0,0 +1,48 @@
+# - 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.
+
+#=============================================================================
+# 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.)
+
+FIND_PATH(TIFF_INCLUDE_DIR tiff.h)
+
+SET(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3)
+FIND_LIBRARY(TIFF_LIBRARY NAMES ${TIFF_NAMES} )
+
+IF(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h")
+ FILE(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str
+ REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*")
+
+ STRING(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*"
+ "\\1" TIFF_VERSION_STRING "${tiff_version_str}")
+ UNSET(tiff_version_str)
+ENDIF()
+
+# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF
+ REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR
+ VERSION_VAR TIFF_VERSION_STRING)
+
+IF(TIFF_FOUND)
+ SET( TIFF_LIBRARIES ${TIFF_LIBRARY} )
+ENDIF(TIFF_FOUND)
+
+MARK_AS_ADVANCED(TIFF_INCLUDE_DIR TIFF_LIBRARY)
diff --git a/Modules/FindTclStub.cmake b/Modules/FindTclStub.cmake
new file mode 100644
index 000000000..79d14aeb4
--- /dev/null
+++ b/Modules/FindTclStub.cmake
@@ -0,0 +1,130 @@
+# - 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
+# Using Stub Libraries:
+# http://safari.oreilly.com/0130385603/ch48lev1sec3
+# This code sets the following variables:
+# TCL_STUB_LIBRARY = path to Tcl stub library
+# TK_STUB_LIBRARY = path to Tk stub library
+# TTK_STUB_LIBRARY = path to ttk stub library
+#
+# In an effort to remove some clutter and clear up some issues for people
+# who are not necessarily Tcl/Tk gurus/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.
+
+#=============================================================================
+# Copyright 2008-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.)
+
+INCLUDE(FindTCL)
+
+GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
+GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
+
+GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH)
+GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}")
+
+GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH)
+GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH)
+
+GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH)
+GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY}")
+
+GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH)
+GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}")
+
+SET(TCLTK_POSSIBLE_LIB_PATHS
+ "${TCL_INCLUDE_PATH_PARENT}/lib"
+ "${TK_INCLUDE_PATH_PARENT}/lib"
+ "${TCL_LIBRARY_PATH}"
+ "${TK_LIBRARY_PATH}"
+ "${TCL_TCLSH_PATH_PARENT}/lib"
+ "${TK_WISH_PATH_PARENT}/lib"
+)
+
+IF(WIN32)
+ GET_FILENAME_COMPONENT(
+ ActiveTcl_CurrentVersion
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
+ NAME)
+ SET(TCLTK_POSSIBLE_LIB_PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib"
+ "$ENV{ProgramFiles}/Tcl/Lib"
+ "C:/Program Files/Tcl/lib"
+ "C:/Tcl/lib"
+ )
+ENDIF(WIN32)
+
+FIND_LIBRARY(TCL_STUB_LIBRARY
+ NAMES
+ tclstub
+ tclstub${TK_LIBRARY_VERSION} tclstub${TCL_TCLSH_VERSION} tclstub${TK_WISH_VERSION}
+ tclstub86 tclstub8.6
+ tclstub85 tclstub8.5
+ tclstub84 tclstub8.4
+ tclstub83 tclstub8.3
+ tclstub82 tclstub8.2
+ tclstub80 tclstub8.0
+ PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
+)
+
+FIND_LIBRARY(TK_STUB_LIBRARY
+ NAMES
+ tkstub
+ tkstub${TCL_LIBRARY_VERSION} tkstub${TCL_TCLSH_VERSION} tkstub${TK_WISH_VERSION}
+ tkstub86 tkstub8.6
+ tkstub85 tkstub8.5
+ tkstub84 tkstub8.4
+ tkstub83 tkstub8.3
+ tkstub82 tkstub8.2
+ tkstub80 tkstub8.0
+ PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
+)
+
+FIND_LIBRARY(TTK_STUB_LIBRARY
+ NAMES
+ ttkstub
+ ttkstub${TCL_LIBRARY_VERSION} ttkstub${TCL_TCLSH_VERSION} ttkstub${TK_WISH_VERSION}
+ ttkstub88 ttkstub8.8
+ ttkstub87 ttkstub8.7
+ ttkstub86 ttkstub8.6
+ ttkstub85 ttkstub8.5
+ PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
+)
+
+MARK_AS_ADVANCED(
+ TCL_STUB_LIBRARY
+ TK_STUB_LIBRARY
+ )
diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake
new file mode 100644
index 000000000..a45f28528
--- /dev/null
+++ b/Modules/FindTclsh.cmake
@@ -0,0 +1,100 @@
+# - 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.
+#
+# 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(CYGWIN)
+ FIND_PROGRAM(TCL_TCLSH NAMES cygtclsh83 cygtclsh80)
+ENDIF(CYGWIN)
+
+GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH)
+GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}")
+
+GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH)
+GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH)
+
+GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH)
+GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY}")
+
+GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH)
+GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}")
+
+SET(TCLTK_POSSIBLE_BIN_PATHS
+ "${TCL_INCLUDE_PATH_PARENT}/bin"
+ "${TK_INCLUDE_PATH_PARENT}/bin"
+ "${TCL_LIBRARY_PATH_PARENT}/bin"
+ "${TK_LIBRARY_PATH_PARENT}/bin"
+ "${TK_WISH_PATH_PARENT}/bin"
+ )
+
+IF(WIN32)
+ GET_FILENAME_COMPONENT(
+ ActiveTcl_CurrentVersion
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
+ NAME)
+ SET(TCLTK_POSSIBLE_BIN_PATHS ${TCLTK_POSSIBLE_BIN_PATHS}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/bin"
+ )
+ENDIF(WIN32)
+
+SET(TCL_TCLSH_NAMES
+ tclsh
+ tclsh${TCL_LIBRARY_VERSION} tclsh${TK_LIBRARY_VERSION} tclsh${TK_WISH_VERSION}
+ tclsh86 tclsh8.6
+ tclsh85 tclsh8.5
+ tclsh84 tclsh8.4
+ tclsh83 tclsh8.3
+ tclsh82 tclsh8.2
+ tclsh80 tclsh8.0
+ )
+
+FIND_PROGRAM(TCL_TCLSH
+ NAMES ${TCL_TCLSH_NAMES}
+ HINTS ${TCLTK_POSSIBLE_BIN_PATHS}
+ )
+
+IF(TCL_TCLSH)
+ EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -E echo puts "\$tcl_version"
+ COMMAND "${TCL_TCLSH}"
+ OUTPUT_VARIABLE TCLSH_VERSION_STRING
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDIF(TCL_TCLSH)
+
+# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh
+ REQUIRED_VARS TCL_TCLSH
+ VERSION_VAR TCLSH_VERSION_STRING)
+
+MARK_AS_ADVANCED(TCL_TCLSH)
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
new file mode 100644
index 000000000..21614fb66
--- /dev/null
+++ b/Modules/FindThreads.cmake
@@ -0,0 +1,166 @@
+# - 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
+# For systems with multiple thread libraries, caller can set
+# CMAKE_THREAD_PREFER_PTHREAD
+
+#=============================================================================
+# 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.)
+
+INCLUDE (CheckIncludeFiles)
+INCLUDE (CheckLibraryExists)
+INCLUDE (CheckSymbolExists)
+SET(Threads_FOUND FALSE)
+
+# Do we have sproc?
+IF(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
+ CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H)
+ENDIF()
+
+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_HAVE_PTHREAD_H)
+
+ #
+ # We have pthread.h
+ # Let's check for the library now.
+ #
+ SET(CMAKE_HAVE_THREADS_LIBRARY)
+ IF(NOT THREADS_HAVE_PTHREAD_ARG)
+ # Check if pthread functions are in normal C library
+ CHECK_SYMBOL_EXISTS(pthread_create pthread.h CMAKE_HAVE_LIBC_CREATE)
+ IF(CMAKE_HAVE_LIBC_CREATE)
+ SET(CMAKE_THREAD_LIBS_INIT "")
+ SET(CMAKE_HAVE_THREADS_LIBRARY 1)
+ SET(Threads_FOUND TRUE)
+ 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()
+ ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*")
+ ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY)
+ ENDIF(NOT THREADS_HAVE_PTHREAD_ARG)
+
+ 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 MATCHES "^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("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
+
+ IF(THREADS_HAVE_PTHREAD_ARG)
+ SET(Threads_FOUND TRUE)
+ SET(CMAKE_THREAD_LIBS_INIT "-pthread")
+ ENDIF()
+
+ ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY)
+ ENDIF(CMAKE_HAVE_PTHREAD_H)
+ENDIF()
+
+IF(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE)
+ SET(CMAKE_USE_PTHREADS_INIT 1)
+ SET(Threads_FOUND TRUE)
+ENDIF()
+
+IF(CMAKE_SYSTEM 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-*")
+ # Use libcma if it exists and can be used. It provides more
+ # symbols than the plain pthread library. CMA threads
+ # have actually been deprecated:
+ # http://docs.hp.com/en/B3920-90091/ch12s03.html#d0e11395
+ # http://docs.hp.com/en/947/d8.html
+ # but we need to maintain compatibility here.
+ # The CMAKE_HP_PTHREADS setting actually indicates whether CMA threads
+ # are available.
+ CHECK_LIBRARY_EXISTS(cma pthread_attr_create "" CMAKE_HAVE_HP_CMA)
+ IF(CMAKE_HAVE_HP_CMA)
+ SET(CMAKE_THREAD_LIBS_INIT "-lcma")
+ SET(CMAKE_HP_PTHREADS_INIT 1)
+ SET(Threads_FOUND TRUE)
+ ENDIF(CMAKE_HAVE_HP_CMA)
+ SET(CMAKE_USE_PTHREADS_INIT 1)
+ ENDIF()
+
+ IF(CMAKE_SYSTEM MATCHES "OSF1-V*")
+ SET(CMAKE_USE_PTHREADS_INIT 0)
+ SET(CMAKE_THREAD_LIBS_INIT )
+ ENDIF()
+
+ IF(CMAKE_SYSTEM MATCHES "CYGWIN_NT*")
+ SET(CMAKE_USE_PTHREADS_INIT 1)
+ SET(Threads_FOUND TRUE)
+ SET(CMAKE_THREAD_LIBS_INIT )
+ SET(CMAKE_USE_WIN32_THREADS_INIT 0)
+ ENDIF()
+ENDIF(CMAKE_USE_PTHREADS_INIT)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND)
diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake
new file mode 100644
index 000000000..9c0264d22
--- /dev/null
+++ b/Modules/FindUnixCommands.cmake
@@ -0,0 +1,93 @@
+# - Find unix commands from cygwin
+# This module looks for some usual Unix commands.
+#
+
+#=============================================================================
+# 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.)
+
+INCLUDE(FindCygwin)
+
+FIND_PROGRAM(BASH
+ bash
+ ${CYGWIN_INSTALL_PATH}/bin
+ /bin
+ /usr/bin
+ /usr/local/bin
+ /sbin
+)
+MARK_AS_ADVANCED(
+ BASH
+)
+
+FIND_PROGRAM(CP
+ cp
+ ${CYGWIN_INSTALL_PATH}/bin
+ /bin
+ /usr/bin
+ /usr/local/bin
+ /sbin
+)
+MARK_AS_ADVANCED(
+ CP
+)
+
+FIND_PROGRAM(GZIP
+ gzip
+ ${CYGWIN_INSTALL_PATH}/bin
+ /bin
+ /usr/bin
+ /usr/local/bin
+ /sbin
+)
+MARK_AS_ADVANCED(
+ GZIP
+)
+
+FIND_PROGRAM(MV
+ mv
+ ${CYGWIN_INSTALL_PATH}/bin
+ /bin
+ /usr/bin
+ /usr/local/bin
+ /sbin
+)
+MARK_AS_ADVANCED(
+ MV
+)
+
+FIND_PROGRAM(RM
+ rm
+ ${CYGWIN_INSTALL_PATH}/bin
+ /bin
+ /usr/bin
+ /usr/local/bin
+ /sbin
+)
+MARK_AS_ADVANCED(
+ RM
+)
+
+FIND_PROGRAM(TAR
+ NAMES
+ tar
+ gtar
+ PATH
+ ${CYGWIN_INSTALL_PATH}/bin
+ /bin
+ /usr/bin
+ /usr/local/bin
+ /sbin
+)
+MARK_AS_ADVANCED(
+ TAR
+)
diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake
new file mode 100644
index 000000000..6b1772fa4
--- /dev/null
+++ b/Modules/FindVTK.cmake
@@ -0,0 +1,141 @@
+# - 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 consitent 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(UseVTKConfig40) # 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(VTK_BINARY_PATH AND USE_BUILT_VTK)
+ IF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK)
+ SET(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY}
+ ${VTK_INSTALL_PATH}/lib/vtk)
+ ENDIF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK)
+
+ # 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(UseVTKConfig40) # 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-compatability.
+ SET(USE_VTK_FILE ${VTK_USE_FILE})
+ELSE(VTK_FOUND)
+ # VTK not found, explain to the user how to specify its location.
+ IF(VTK_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR ${VTK_DIR_MESSAGE})
+ ELSE(VTK_FIND_REQUIRED)
+ IF(NOT VTK_FIND_QUIETLY)
+ MESSAGE(STATUS ${VTK_DIR_MESSAGE})
+ ENDIF(NOT VTK_FIND_QUIETLY)
+ ENDIF(VTK_FIND_REQUIRED)
+ENDIF(VTK_FOUND)
diff --git a/Modules/FindWget.cmake b/Modules/FindWget.cmake
new file mode 100644
index 000000000..c94132c27
--- /dev/null
+++ b/Modules/FindWget.cmake
@@ -0,0 +1,36 @@
+# - 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.
+#
+# 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(FindCygwin)
+
+FIND_PROGRAM(WGET_EXECUTABLE
+ wget
+ ${CYGWIN_INSTALL_PATH}/bin
+)
+
+# handle the QUIETLY and REQUIRED arguments and set WGET_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Wget DEFAULT_MSG WGET_EXECUTABLE)
+
+MARK_AS_ADVANCED( WGET_EXECUTABLE )
+
+# WGET option is deprecated.
+# use WGET_EXECUTABLE instead.
+SET (WGET ${WGET_EXECUTABLE} )
diff --git a/Modules/FindWish.cmake b/Modules/FindWish.cmake
new file mode 100644
index 000000000..a4960cd17
--- /dev/null
+++ b/Modules/FindWish.cmake
@@ -0,0 +1,85 @@
+# - Find wish installation
+# This module finds if TCL is installed and determines where the
+# include files and libraries are. It also determines what the name of
+# the library is. This code sets the following variables:
+#
+# TK_WISH = the path to the wish executable
+#
+# if UNIX is defined, then it will look for the cygwin version first
+
+#=============================================================================
+# 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.)
+
+IF(UNIX)
+ FIND_PROGRAM(TK_WISH cygwish80 )
+ENDIF(UNIX)
+
+GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
+GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
+
+GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH)
+GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH)
+
+GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH)
+GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY}")
+
+GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH)
+GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH)
+STRING(REGEX REPLACE
+ "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}")
+
+SET(TCLTK_POSSIBLE_BIN_PATHS
+ "${TCL_INCLUDE_PATH_PARENT}/bin"
+ "${TK_INCLUDE_PATH_PARENT}/bin"
+ "${TCL_LIBRARY_PATH_PARENT}/bin"
+ "${TK_LIBRARY_PATH_PARENT}/bin"
+ "${TCL_TCLSH_PATH_PARENT}/bin"
+ )
+
+IF(WIN32)
+ GET_FILENAME_COMPONENT(
+ ActiveTcl_CurrentVersion
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
+ NAME)
+ SET(TCLTK_POSSIBLE_BIN_PATHS ${TCLTK_POSSIBLE_BIN_PATHS}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/bin"
+ )
+ENDIF(WIN32)
+
+SET(TK_WISH_NAMES
+ wish
+ wish${TCL_LIBRARY_VERSION} wish${TK_LIBRARY_VERSION} wish${TCL_TCLSH_VERSION}
+ wish86 wish8.6
+ wish85 wish8.5
+ wish84 wish8.4
+ wish83 wish8.3
+ wish82 wish8.2
+ wish80 wish8.0
+ )
+
+FIND_PROGRAM(TK_WISH
+ NAMES ${TK_WISH_NAMES}
+ HINTS ${TCLTK_POSSIBLE_BIN_PATHS}
+ )
+
+MARK_AS_ADVANCED(TK_WISH)
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
new file mode 100644
index 000000000..76fb3c911
--- /dev/null
+++ b/Modules/FindX11.cmake
@@ -0,0 +1,492 @@
+# - Find X11 installation
+# Try to find X11 on UNIX systems. The following values are defined
+# X11_FOUND - True if X11 is available
+# X11_INCLUDE_DIR - include directories to use X11
+# X11_LIBRARIES - link against these to use X11
+#
+# and also the following more fine grained variables:
+# 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
+
+
+#=============================================================================
+# 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.)
+
+IF (UNIX)
+ SET(X11_FOUND 0)
+ # X11 is never a framework and some header files may be
+ # found in tcl on the mac
+ SET(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK})
+ SET(CMAKE_FIND_FRAMEWORK NEVER)
+ SET(X11_INC_SEARCH_PATH
+ /usr/pkg/xorg/include
+ /usr/X11R6/include
+ /usr/X11R7/include
+ /usr/include/X11
+ /usr/openwin/include
+ /usr/openwin/share/include
+ /opt/graphics/OpenGL/include
+ )
+
+ SET(X11_LIB_SEARCH_PATH
+ /usr/pkg/xorg/lib
+ /usr/X11R6/lib
+ /usr/X11R7/lib
+ /usr/openwin/lib
+ )
+
+ FIND_PATH(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xlib_INCLUDE_PATH X11/Xlib.h ${X11_INC_SEARCH_PATH})
+
+ # Look for includes; keep the list sorted by name of the cmake *_INCLUDE_PATH
+ # variable (which doesn't need to match the include file name).
+
+ # Solaris lacks XKBrules.h, so we should skip kxkbd there.
+ FIND_PATH(X11_ICE_INCLUDE_PATH X11/ICE/ICE.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_SM_INCLUDE_PATH X11/SM/SM.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xaccessrules_INCLUDE_PATH X11/extensions/XKBrules.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xaccessstr_INCLUDE_PATH X11/extensions/XKBstr.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xau_INCLUDE_PATH X11/Xauth.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_xf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xi_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xkbfile_INCLUDE_PATH X11/extensions/XKBfile.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xmu_INCLUDE_PATH X11/Xmu/Xmu.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_XRes_INCLUDE_PATH X11/extensions/XRes.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xt_INCLUDE_PATH X11/Intrinsic.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_Xv_INCLUDE_PATH X11/extensions/Xvlib.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_XSync_INCLUDE_PATH X11/extensions/sync.h ${X11_INC_SEARCH_PATH})
+
+
+ FIND_LIBRARY(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH})
+
+ # Find additional X libraries. Keep list sorted by library name.
+ FIND_LIBRARY(X11_ICE_LIB ICE ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_SM_LIB SM ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xau_LIB Xau ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xdamage_LIB Xdamage ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xdmcp_LIB Xdmcp ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xmu_LIB Xmu ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xscreensaver_LIB Xss ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH})
+
+ SET(X11_LIBRARY_DIR "")
+ IF(X11_X11_LIB)
+ GET_FILENAME_COMPONENT(X11_LIBRARY_DIR ${X11_X11_LIB} PATH)
+ ENDIF(X11_X11_LIB)
+
+ SET(X11_INCLUDE_DIR) # start with empty list
+ IF(X11_X11_INCLUDE_PATH)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH})
+ ENDIF(X11_X11_INCLUDE_PATH)
+
+ IF(X11_Xlib_INCLUDE_PATH)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH})
+ ENDIF(X11_Xlib_INCLUDE_PATH)
+
+ IF(X11_Xutil_INCLUDE_PATH)
+ SET(X11_Xutil_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH})
+ ENDIF(X11_Xutil_INCLUDE_PATH)
+
+ IF(X11_Xshape_INCLUDE_PATH)
+ SET(X11_Xshape_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH})
+ ENDIF(X11_Xshape_INCLUDE_PATH)
+
+ SET(X11_LIBRARIES) # start with empty list
+ IF(X11_X11_LIB)
+ SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB})
+ ENDIF(X11_X11_LIB)
+
+ IF(X11_Xext_LIB)
+ SET(X11_Xext_FOUND TRUE)
+ SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB})
+ ENDIF(X11_Xext_LIB)
+
+ IF(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH)
+ SET(X11_Xt_FOUND TRUE)
+ ENDIF(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH)
+
+ IF(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH)
+ SET(X11_Xft_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xft_INCLUDE_PATH})
+ ENDIF(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH)
+
+ IF(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH)
+ SET(X11_Xv_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xv_INCLUDE_PATH})
+ ENDIF(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH)
+
+ IF (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH)
+ SET(X11_Xau_FOUND TRUE)
+ ENDIF (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH)
+
+ IF (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB)
+ SET(X11_Xdmcp_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdmcp_INCLUDE_PATH})
+ ENDIF (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB)
+
+ IF (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH)
+ SET(X11_Xaccess_FOUND TRUE)
+ SET(X11_Xaccess_INCLUDE_PATH ${X11_Xaccessstr_INCLUDE_PATH})
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xaccess_INCLUDE_PATH})
+ ENDIF (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH)
+
+ IF (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB)
+ SET(X11_Xpm_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xpm_INCLUDE_PATH})
+ ENDIF (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB)
+
+ IF (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB)
+ SET(X11_Xcomposite_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcomposite_INCLUDE_PATH})
+ ENDIF (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB)
+
+ IF (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB)
+ SET(X11_Xdamage_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdamage_INCLUDE_PATH})
+ ENDIF (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB)
+
+ IF (X11_XShm_INCLUDE_PATH)
+ SET(X11_XShm_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XShm_INCLUDE_PATH})
+ ENDIF (X11_XShm_INCLUDE_PATH)
+
+ IF (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB)
+ SET(X11_XTest_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH})
+ ENDIF (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB)
+
+ IF (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB)
+ SET(X11_Xi_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xi_INCLUDE_PATH})
+ ENDIF (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB)
+
+ IF (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB)
+ SET(X11_Xinerama_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH})
+ ENDIF (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB)
+
+ IF (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB)
+ SET(X11_Xfixes_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xfixes_INCLUDE_PATH})
+ ENDIF (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB)
+
+ IF (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB)
+ SET(X11_Xrender_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH})
+ ENDIF (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB)
+
+ IF (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB)
+ SET(X11_XRes_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XRes_INCLUDE_PATH})
+ ENDIF (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB)
+
+ IF (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB)
+ SET(X11_Xrandr_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH})
+ ENDIF (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB)
+
+ IF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB)
+ SET(X11_xf86misc_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH})
+ ENDIF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB)
+
+ IF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB)
+ SET(X11_xf86vmode_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH})
+ ENDIF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB)
+
+ IF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB)
+ SET(X11_Xcursor_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcursor_INCLUDE_PATH})
+ ENDIF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB)
+
+ IF (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB)
+ SET(X11_Xscreensaver_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xscreensaver_INCLUDE_PATH})
+ ENDIF (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB)
+
+ IF (X11_dpms_INCLUDE_PATH)
+ SET(X11_dpms_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_dpms_INCLUDE_PATH})
+ ENDIF (X11_dpms_INCLUDE_PATH)
+
+ IF (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH)
+ SET(X11_Xkb_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkb_INCLUDE_PATH} )
+ ENDIF (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH)
+
+ IF (X11_Xkbfile_INCLUDE_PATH AND X11_Xkbfile_LIB AND X11_Xlib_INCLUDE_PATH)
+ SET(X11_Xkbfile_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkbfile_INCLUDE_PATH} )
+ ENDIF (X11_Xkbfile_INCLUDE_PATH AND X11_Xkbfile_LIB AND X11_Xlib_INCLUDE_PATH)
+
+ IF (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB)
+ SET(X11_Xmu_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xmu_INCLUDE_PATH})
+ ENDIF (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB)
+
+ IF (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB)
+ SET(X11_Xinput_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH})
+ ENDIF (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB)
+
+ IF (X11_XSync_INCLUDE_PATH)
+ SET(X11_XSync_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XSync_INCLUDE_PATH})
+ ENDIF (X11_XSync_INCLUDE_PATH)
+
+ IF(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH)
+ SET(X11_ICE_FOUND TRUE)
+ ENDIF(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH)
+
+ IF(X11_SM_LIB AND X11_SM_INCLUDE_PATH)
+ SET(X11_SM_FOUND TRUE)
+ ENDIF(X11_SM_LIB AND X11_SM_INCLUDE_PATH)
+
+
+ # Deprecated variable for backwards compatibility with CMake 1.4
+ IF (X11_X11_INCLUDE_PATH AND X11_LIBRARIES)
+ SET(X11_FOUND 1)
+ ENDIF (X11_X11_INCLUDE_PATH AND X11_LIBRARIES)
+
+ IF(X11_FOUND)
+ INCLUDE(CheckFunctionExists)
+ INCLUDE(CheckLibraryExists)
+
+ # Translated from an autoconf-generated configure script.
+ # See libs.m4 in autoconf's m4 directory.
+ IF($ENV{ISC} MATCHES "^yes$")
+ SET(X11_X_EXTRA_LIBS -lnsl_s -linet)
+ ELSE($ENV{ISC} MATCHES "^yes$")
+ SET(X11_X_EXTRA_LIBS "")
+
+ # See if XOpenDisplay in X11 works by itself.
+ CHECK_LIBRARY_EXISTS("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO)
+ IF(NOT X11_LIB_X11_SOLO)
+ # Find library needed for dnet_ntoa.
+ CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA)
+ IF (X11_LIB_DNET_HAS_DNET_NTOA)
+ SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet)
+ ELSE (X11_LIB_DNET_HAS_DNET_NTOA)
+ CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA)
+ IF (X11_LIB_DNET_STUB_HAS_DNET_NTOA)
+ SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub)
+ ENDIF (X11_LIB_DNET_STUB_HAS_DNET_NTOA)
+ ENDIF (X11_LIB_DNET_HAS_DNET_NTOA)
+ ENDIF(NOT X11_LIB_X11_SOLO)
+
+ # Find library needed for gethostbyname.
+ CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME)
+ IF(NOT CMAKE_HAVE_GETHOSTBYNAME)
+ CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
+ IF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
+ SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lnsl)
+ ELSE (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
+ CHECK_LIBRARY_EXISTS("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
+ IF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
+ SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd)
+ ENDIF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
+ ENDIF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
+ ENDIF(NOT CMAKE_HAVE_GETHOSTBYNAME)
+
+ # Find library needed for connect.
+ CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT)
+ IF(NOT CMAKE_HAVE_CONNECT)
+ CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT)
+ IF (CMAKE_LIB_SOCKET_HAS_CONNECT)
+ SET (X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS})
+ ENDIF (CMAKE_LIB_SOCKET_HAS_CONNECT)
+ ENDIF(NOT CMAKE_HAVE_CONNECT)
+
+ # Find library needed for remove.
+ CHECK_FUNCTION_EXISTS("remove" CMAKE_HAVE_REMOVE)
+ IF(NOT CMAKE_HAVE_REMOVE)
+ CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE)
+ IF (CMAKE_LIB_POSIX_HAS_REMOVE)
+ SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix)
+ ENDIF (CMAKE_LIB_POSIX_HAS_REMOVE)
+ ENDIF(NOT CMAKE_HAVE_REMOVE)
+
+ # Find library needed for shmat.
+ CHECK_FUNCTION_EXISTS("shmat" CMAKE_HAVE_SHMAT)
+ IF(NOT CMAKE_HAVE_SHMAT)
+ CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT)
+ IF (CMAKE_LIB_IPS_HAS_SHMAT)
+ SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc)
+ ENDIF (CMAKE_LIB_IPS_HAS_SHMAT)
+ ENDIF(NOT CMAKE_HAVE_SHMAT)
+ ENDIF($ENV{ISC} MATCHES "^yes$")
+
+ IF (X11_ICE_FOUND)
+ CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}"
+ CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
+ IF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
+ SET (X11_X_PRE_LIBS ${X11_ICE_LIB})
+ IF(X11_SM_LIB)
+ SET (X11_X_PRE_LIBS ${X11_SM_LIB} ${X11_X_PRE_LIBS})
+ ENDIF(X11_SM_LIB)
+ ENDIF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
+ ENDIF (X11_ICE_FOUND)
+
+ # Build the final list of libraries.
+ SET(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS})
+
+ INCLUDE(FindPackageMessage)
+ FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
+ "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
+ ELSE (X11_FOUND)
+ IF (X11_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find X11")
+ ENDIF (X11_FIND_REQUIRED)
+ ENDIF (X11_FOUND)
+
+ MARK_AS_ADVANCED(
+ X11_X11_INCLUDE_PATH
+ X11_X11_LIB
+ X11_Xext_LIB
+ X11_Xau_LIB
+ X11_Xau_INCLUDE_PATH
+ X11_Xlib_INCLUDE_PATH
+ X11_Xutil_INCLUDE_PATH
+ X11_Xcomposite_INCLUDE_PATH
+ X11_Xcomposite_LIB
+ X11_Xaccess_INCLUDE_PATH
+ X11_Xfixes_LIB
+ X11_Xfixes_INCLUDE_PATH
+ X11_Xrandr_LIB
+ X11_Xrandr_INCLUDE_PATH
+ X11_Xdamage_LIB
+ X11_Xdamage_INCLUDE_PATH
+ X11_Xrender_LIB
+ X11_Xrender_INCLUDE_PATH
+ X11_XRes_LIB
+ X11_XRes_INCLUDE_PATH
+ X11_Xxf86misc_LIB
+ X11_xf86misc_INCLUDE_PATH
+ X11_Xxf86vm_LIB
+ X11_xf86vmode_INCLUDE_PATH
+ X11_Xi_LIB
+ X11_Xi_INCLUDE_PATH
+ X11_Xinerama_LIB
+ X11_Xinerama_INCLUDE_PATH
+ X11_XTest_LIB
+ X11_XTest_INCLUDE_PATH
+ X11_Xcursor_LIB
+ X11_Xcursor_INCLUDE_PATH
+ X11_dpms_INCLUDE_PATH
+ X11_Xt_LIB
+ X11_Xt_INCLUDE_PATH
+ X11_Xdmcp_LIB
+ X11_LIBRARIES
+ X11_Xaccessrules_INCLUDE_PATH
+ X11_Xaccessstr_INCLUDE_PATH
+ X11_Xdmcp_INCLUDE_PATH
+ X11_Xkb_INCLUDE_PATH
+ X11_Xkblib_INCLUDE_PATH
+ X11_Xkbfile_INCLUDE_PATH
+ X11_Xkbfile_LIB
+ X11_Xmu_INCLUDE_PATH
+ X11_Xmu_LIB
+ X11_Xscreensaver_INCLUDE_PATH
+ X11_Xscreensaver_LIB
+ X11_Xpm_INCLUDE_PATH
+ X11_Xpm_LIB
+ X11_Xinput_LIB
+ X11_Xinput_INCLUDE_PATH
+ X11_Xft_LIB
+ X11_Xft_INCLUDE_PATH
+ X11_Xshape_INCLUDE_PATH
+ X11_Xv_LIB
+ X11_Xv_INCLUDE_PATH
+ X11_XShm_INCLUDE_PATH
+ X11_ICE_LIB
+ X11_ICE_INCLUDE_PATH
+ X11_SM_LIB
+ X11_SM_INCLUDE_PATH
+ X11_XSync_INCLUDE_PATH
+ )
+ SET(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE})
+ENDIF (UNIX)
+
+# X11_FIND_REQUIRED_<component> could be checked too
diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake
new file mode 100644
index 000000000..eccfb487a
--- /dev/null
+++ b/Modules/FindXMLRPC.cmake
@@ -0,0 +1,146 @@
+# - Find xmlrpc
+# Find the native XMLRPC headers and libraries.
+# XMLRPC_INCLUDE_DIRS - where to find xmlrpc.h, etc.
+# XMLRPC_LIBRARIES - List of libraries when using xmlrpc.
+# XMLRPC_FOUND - True if xmlrpc found.
+# XMLRPC modules may be specified as components for this find module.
+# Modules may be listed by running "xmlrpc-c-config". Modules include:
+# c++ C++ wrapper code
+# libwww-client libwww-based client
+# cgi-server CGI-based server
+# abyss-server ABYSS-based server
+# Typical usage:
+# FIND_PACKAGE(XMLRPC REQUIRED libwww-client)
+
+#=============================================================================
+# 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.)
+
+# First find the config script from which to obtain other values.
+FIND_PROGRAM(XMLRPC_C_CONFIG NAMES xmlrpc-c-config)
+
+# Check whether we found anything.
+IF(XMLRPC_C_CONFIG)
+ SET(XMLRPC_FOUND 1)
+ELSE(XMLRPC_C_CONFIG)
+ SET(XMLRPC_FOUND 0)
+ENDIF(XMLRPC_C_CONFIG)
+
+# Lookup the include directories needed for the components requested.
+IF(XMLRPC_FOUND)
+ # Use the newer EXECUTE_PROCESS command if it is available.
+ IF(COMMAND EXECUTE_PROCESS)
+ EXECUTE_PROCESS(
+ COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --cflags
+ OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT
+ )
+ ELSE(COMMAND EXECUTE_PROCESS)
+ EXEC_PROGRAM(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --cflags"
+ OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS
+ RETURN_VALUE XMLRPC_C_CONFIG_RESULT
+ )
+ ENDIF(COMMAND EXECUTE_PROCESS)
+
+ # Parse the include flags.
+ IF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$")
+ # Convert the compile flags to a CMake list.
+ STRING(REGEX REPLACE " +" ";"
+ XMLRPC_C_CONFIG_CFLAGS "${XMLRPC_C_CONFIG_CFLAGS}")
+
+ # 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}")
+ ENDIF("${flag}" MATCHES "^-I")
+ ENDFOREACH(flag)
+ ELSE("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$")
+ MESSAGE("Error running ${XMLRPC_C_CONFIG}: [${XMLRPC_C_CONFIG_RESULT}]")
+ SET(XMLRPC_FOUND 0)
+ ENDIF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$")
+ENDIF(XMLRPC_FOUND)
+
+# Lookup the libraries needed for the components requested.
+IF(XMLRPC_FOUND)
+ # Use the newer EXECUTE_PROCESS command if it is available.
+ IF(COMMAND EXECUTE_PROCESS)
+ EXECUTE_PROCESS(
+ COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --libs
+ OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT
+ )
+ ELSE(COMMAND EXECUTE_PROCESS)
+ EXEC_PROGRAM(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --libs"
+ OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS
+ RETURN_VALUE XMLRPC_C_CONFIG_RESULT
+ )
+ ENDIF(COMMAND EXECUTE_PROCESS)
+
+ # Parse the library names and directories.
+ IF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$")
+ STRING(REGEX REPLACE " +" ";"
+ XMLRPC_C_CONFIG_LIBS "${XMLRPC_C_CONFIG_LIBS}")
+
+ # Look for -L flags for directories and -l flags for library names.
+ 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}")
+ ENDIF("${flag}" MATCHES "^-L")
+ ENDFOREACH(flag)
+
+ # Search for each library needed using the directories given.
+ FOREACH(name ${XMLRPC_LIBRARY_NAMES})
+ # Look for this library.
+ FIND_LIBRARY(XMLRPC_${name}_LIBRARY
+ NAMES ${name}
+ HINTS ${XMLRPC_LIBRARY_DIRS}
+ )
+ MARK_AS_ADVANCED(XMLRPC_${name}_LIBRARY)
+
+ # If any library is not found then the whole package is not found.
+ IF(NOT XMLRPC_${name}_LIBRARY)
+ SET(XMLRPC_FOUND 0)
+ ENDIF(NOT XMLRPC_${name}_LIBRARY)
+
+ # Build an ordered list of all the libraries needed.
+ SET(XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES} "${XMLRPC_${name}_LIBRARY}")
+ ENDFOREACH(name)
+ ELSE("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$")
+ MESSAGE("Error running ${XMLRPC_C_CONFIG}: [${XMLRPC_C_CONFIG_RESULT}]")
+ SET(XMLRPC_FOUND 0)
+ ENDIF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$")
+ENDIF(XMLRPC_FOUND)
+
+# Report the results.
+IF(NOT XMLRPC_FOUND)
+ SET(XMLRPC_DIR_MESSAGE
+ "XMLRPC was not found. Make sure the entries XMLRPC_* are set.")
+ IF(NOT XMLRPC_FIND_QUIETLY)
+ MESSAGE(STATUS "${XMLRPC_DIR_MESSAGE}")
+ ELSE(NOT XMLRPC_FIND_QUIETLY)
+ IF(XMLRPC_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "${XMLRPC_DIR_MESSAGE}")
+ ENDIF(XMLRPC_FIND_REQUIRED)
+ ENDIF(NOT XMLRPC_FIND_QUIETLY)
+ENDIF(NOT XMLRPC_FOUND)
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
new file mode 100644
index 000000000..166e29181
--- /dev/null
+++ b/Modules/FindZLIB.cmake
@@ -0,0 +1,92 @@
+# - Find zlib
+# 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.
+#
+# 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
+#
+# 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
+#
+# An includer may set ZLIB_ROOT to a zlib installation root to tell
+# this module where to look.
+
+#=============================================================================
+# Copyright 2001-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.)
+
+SET(_ZLIB_SEARCHES)
+
+# Search ZLIB_ROOT first if it is set.
+IF(ZLIB_ROOT)
+ SET(_ZLIB_SEARCH_ROOT PATHS ${ZLIB_ROOT} NO_DEFAULT_PATH)
+ LIST(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT)
+ENDIF()
+
+# Normal search.
+SET(_ZLIB_SEARCH_NORMAL
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]"
+ "$ENV{PROGRAMFILES}/zlib"
+ )
+LIST(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
+
+SET(ZLIB_NAMES z zlib zdll zlib1 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)
+ENDFOREACH()
+
+MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
+
+IF(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
+ FILE(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$")
+
+ STRING(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}")
+ STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}")
+ STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}")
+ SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}")
+
+ # 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]+).*$")
+ SET(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}")
+ SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}")
+ ENDIF( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$")
+
+ SET(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}")
+ SET(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}")
+ SET(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}")
+ENDIF()
+
+# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR
+ VERSION_VAR ZLIB_VERSION_STRING)
+
+IF(ZLIB_FOUND)
+ SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
+ SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
+ENDIF()
+
diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake
new file mode 100644
index 000000000..0106372e3
--- /dev/null
+++ b/Modules/Findosg.cmake
@@ -0,0 +1,54 @@
+#
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgUtil/SceneView>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSG osg/PositionAttitudeTransform)
+OSG_FIND_LIBRARY(OSG osg)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osg DEFAULT_MSG OSG_LIBRARY OSG_INCLUDE_DIR)
diff --git a/Modules/FindosgAnimation.cmake b/Modules/FindosgAnimation.cmake
new file mode 100644
index 000000000..b9b44a081
--- /dev/null
+++ b/Modules/FindosgAnimation.cmake
@@ -0,0 +1,51 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgAnimation/Animation>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGANIMATION osgAnimation/Animation)
+OSG_FIND_LIBRARY(OSGANIMATION osgAnimation)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgAnimation DEFAULT_MSG
+ OSGANIMATION_LIBRARY OSGANIMATION_INCLUDE_DIR)
diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake
new file mode 100644
index 000000000..eabdde72d
--- /dev/null
+++ b/Modules/FindosgDB.cmake
@@ -0,0 +1,51 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgDB/DatabasePager>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGDB osgDB/DatabasePager)
+OSG_FIND_LIBRARY(OSGDB osgDB)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgDB DEFAULT_MSG
+ OSGDB_LIBRARY OSGDB_INCLUDE_DIR)
diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake
new file mode 100644
index 000000000..81d5af5a2
--- /dev/null
+++ b/Modules/FindosgFX.cmake
@@ -0,0 +1,51 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgFX/BumpMapping>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGFX osgFX/BumpMapping)
+OSG_FIND_LIBRARY(OSGFX osgFX)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgFX DEFAULT_MSG
+ OSGFX_LIBRARY OSGFX_INCLUDE_DIR)
diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake
new file mode 100644
index 000000000..a4fe79b0d
--- /dev/null
+++ b/Modules/FindosgGA.cmake
@@ -0,0 +1,51 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgGA/FlightManipulator>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGGA osgGA/FlightManipulator)
+OSG_FIND_LIBRARY(OSGGA osgGA)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgGA DEFAULT_MSG
+ OSGGA_LIBRARY OSGGA_INCLUDE_DIR)
diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake
new file mode 100644
index 000000000..24e6ed585
--- /dev/null
+++ b/Modules/FindosgIntrospection.cmake
@@ -0,0 +1,51 @@
+# This is part of the Findosg* suite used to find OpenSceneGraph components.
+# Each component is separate and you must opt in to each module. You must
+# also opt into OpenGL and OpenThreads (and Producer if needed) as these
+# modules won't do it for you. This is to allow you control over your own
+# system piece by piece in case you need to opt out of certain components
+# or change the Find behavior for a particular module (perhaps because the
+# default FindOpenGL.cmake module doesn't work with your system as an
+# example).
+# If you want to use a more convenient module that includes everything,
+# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+#
+# Locate osgINTROSPECTION
+# This module defines
+#
+# OSGINTROSPECTION_FOUND - Was osgIntrospection found?
+# OSGINTROSPECTION_INCLUDE_DIR - Where to find the headers
+# OSGINTROSPECTION_LIBRARIES - The libraries to link for osgIntrospection (use this)
+#
+# OSGINTROSPECTION_LIBRARY - The osgIntrospection library
+# OSGINTROSPECTION_LIBRARY_DEBUG - The osgIntrospection debug library
+#
+# $OSGDIR is an environment variable that would
+# correspond to the ./configure --prefix=$OSGDIR
+# used in building osg.
+#
+# Created by Eric Wing.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgIntrospection/Reflection>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGINTROSPECTION osgIntrospection/Reflection)
+OSG_FIND_LIBRARY(OSGINTROSPECTION osgIntrospection)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgIntrospection DEFAULT_MSG
+ OSGINTROSPECTION_LIBRARY OSGINTROSPECTION_INCLUDE_DIR)
diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake
new file mode 100644
index 000000000..f71b5fd5c
--- /dev/null
+++ b/Modules/FindosgManipulator.cmake
@@ -0,0 +1,51 @@
+# This is part of the Findosg* suite used to find OpenSceneGraph components.
+# Each component is separate and you must opt in to each module. You must
+# also opt into OpenGL and OpenThreads (and Producer if needed) as these
+# modules won't do it for you. This is to allow you control over your own
+# system piece by piece in case you need to opt out of certain components
+# or change the Find behavior for a particular module (perhaps because the
+# default FindOpenGL.cmake module doesn't work with your system as an
+# example).
+# If you want to use a more convenient module that includes everything,
+# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+#
+# Locate osgManipulator
+# This module defines
+#
+# OSGMANIPULATOR_FOUND - Was osgManipulator found?
+# OSGMANIPULATOR_INCLUDE_DIR - Where to find the headers
+# OSGMANIPULATOR_LIBRARIES - The libraries to link for osgManipulator (use this)
+#
+# OSGMANIPULATOR_LIBRARY - The osgManipulator library
+# OSGMANIPULATOR_LIBRARY_DEBUG - The osgManipulator debug library
+#
+# $OSGDIR is an environment variable that would
+# correspond to the ./configure --prefix=$OSGDIR
+# used in building osg.
+#
+# Created by Eric Wing.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgManipulator/TrackballDragger>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGMANIPULATOR osgManipulator/TrackballDragger)
+OSG_FIND_LIBRARY(OSGMANIPULATOR osgManipulator)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgManipulator DEFAULT_MSG
+ OSGMANIPULATOR_LIBRARY OSGMANIPULATOR_INCLUDE_DIR)
diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake
new file mode 100644
index 000000000..f23a83fdd
--- /dev/null
+++ b/Modules/FindosgParticle.cmake
@@ -0,0 +1,51 @@
+# This is part of the Findosg* suite used to find OpenSceneGraph components.
+# Each component is separate and you must opt in to each module. You must
+# also opt into OpenGL and OpenThreads (and Producer if needed) as these
+# modules won't do it for you. This is to allow you control over your own
+# system piece by piece in case you need to opt out of certain components
+# or change the Find behavior for a particular module (perhaps because the
+# default FindOpenGL.cmake module doesn't work with your system as an
+# example).
+# If you want to use a more convenient module that includes everything,
+# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+#
+# Locate osgParticle
+# This module defines
+#
+# OSGPARTICLE_FOUND - Was osgParticle found?
+# OSGPARTICLE_INCLUDE_DIR - Where to find the headers
+# OSGPARTICLE_LIBRARIES - The libraries to link for osgParticle (use this)
+#
+# OSGPARTICLE_LIBRARY - The osgParticle library
+# OSGPARTICLE_LIBRARY_DEBUG - The osgParticle debug library
+#
+# $OSGDIR is an environment variable that would
+# correspond to the ./configure --prefix=$OSGDIR
+# used in building osg.
+#
+# Created by Eric Wing.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgParticle/FireEffect>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGPARTICLE osgParticle/FireEffect)
+OSG_FIND_LIBRARY(OSGPARTICLE osgParticle)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgParticle DEFAULT_MSG
+ OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR)
diff --git a/Modules/FindosgPresentation.cmake b/Modules/FindosgPresentation.cmake
new file mode 100644
index 000000000..f89e25f9c
--- /dev/null
+++ b/Modules/FindosgPresentation.cmake
@@ -0,0 +1,52 @@
+# This is part of the Findosg* suite used to find OpenSceneGraph components.
+# Each component is separate and you must opt in to each module. You must
+# also opt into OpenGL and OpenThreads (and Producer if needed) as these
+# modules won't do it for you. This is to allow you control over your own
+# system piece by piece in case you need to opt out of certain components
+# or change the Find behavior for a particular module (perhaps because the
+# default FindOpenGL.cmake module doesn't work with your system as an
+# example).
+# If you want to use a more convenient module that includes everything,
+# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+#
+# Locate osgPresentation
+# This module defines
+#
+# OSGPRESENTATION_FOUND - Was osgPresentation found?
+# OSGPRESENTATION_INCLUDE_DIR - Where to find the headers
+# OSGPRESENTATION_LIBRARIES - The libraries to link for osgPresentation (use this)
+#
+# OSGPRESENTATION_LIBRARY - The osgPresentation library
+# OSGPRESENTATION_LIBRARY_DEBUG - The osgPresentation debug library
+#
+# $OSGDIR is an environment variable that would
+# correspond to the ./configure --prefix=$OSGDIR
+# used in building osg.
+#
+# Created by Eric Wing.
+# Modified to work with osgPresentation by Robert Osfield, January 2012.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgPresentation/SlideEventHandler>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGPRESENTATION osgPresentation/SlideEventHandler)
+OSG_FIND_LIBRARY(OSGPRESENTATION osgPresentation)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgPresentation DEFAULT_MSG
+ OSGPRESENTATION_LIBRARY OSGPRESENTATION_INCLUDE_DIR)
diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake
new file mode 100644
index 000000000..51f609064
--- /dev/null
+++ b/Modules/FindosgProducer.cmake
@@ -0,0 +1,51 @@
+# This is part of the Findosg* suite used to find OpenSceneGraph components.
+# Each component is separate and you must opt in to each module. You must
+# also opt into OpenGL and OpenThreads (and Producer if needed) as these
+# modules won't do it for you. This is to allow you control over your own
+# system piece by piece in case you need to opt out of certain components
+# or change the Find behavior for a particular module (perhaps because the
+# default FindOpenGL.cmake module doesn't work with your system as an
+# example).
+# If you want to use a more convenient module that includes everything,
+# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
+#
+# Locate osgProducer
+# This module defines
+#
+# OSGPRODUCER_FOUND - Was osgProducer found?
+# OSGPRODUCER_INCLUDE_DIR - Where to find the headers
+# OSGPRODUCER_LIBRARIES - The libraries to link for osgProducer (use this)
+#
+# OSGPRODUCER_LIBRARY - The osgProducer library
+# OSGPRODUCER_LIBRARY_DEBUG - The osgProducer debug library
+#
+# $OSGDIR is an environment variable that would
+# correspond to the ./configure --prefix=$OSGDIR
+# used in building osg.
+#
+# Created by Eric Wing.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgProducer/OsgSceneHandler>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGPRODUCER osgProducer/OsgSceneHandler)
+OSG_FIND_LIBRARY(OSGPRODUCER osgProducer)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgProducer DEFAULT_MSG
+ OSGPRODUCER_LIBRARY OSGPRODUCER_INCLUDE_DIR)
diff --git a/Modules/FindosgQt.cmake b/Modules/FindosgQt.cmake
new file mode 100644
index 000000000..ddc91287b
--- /dev/null
+++ b/Modules/FindosgQt.cmake
@@ -0,0 +1,52 @@
+# 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.
+#
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgQt/GraphicsWindowQt>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGQT osgQt/GraphicsWindowQt)
+OSG_FIND_LIBRARY(OSGQT osgQt)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgQt DEFAULT_MSG
+ OSGQT_LIBRARY OSGQT_INCLUDE_DIR)
diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake
new file mode 100644
index 000000000..278f8ae9e
--- /dev/null
+++ b/Modules/FindosgShadow.cmake
@@ -0,0 +1,51 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgShadow/ShadowTexture>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGSHADOW osgShadow/ShadowTexture)
+OSG_FIND_LIBRARY(OSGSHADOW osgShadow)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgShadow DEFAULT_MSG
+ OSGSHADOW_LIBRARY OSGSHADOW_INCLUDE_DIR)
diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake
new file mode 100644
index 000000000..15daf64fe
--- /dev/null
+++ b/Modules/FindosgSim.cmake
@@ -0,0 +1,51 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgSim/ImpostorSprite>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGSIM osgSim/ImpostorSprite)
+OSG_FIND_LIBRARY(OSGSIM osgSim)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgSim DEFAULT_MSG
+ OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR)
diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake
new file mode 100644
index 000000000..fbf373e59
--- /dev/null
+++ b/Modules/FindosgTerrain.cmake
@@ -0,0 +1,51 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgTerrain/Terrain>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGTERRAIN osgTerrain/Terrain)
+OSG_FIND_LIBRARY(OSGTERRAIN osgTerrain)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgTerrain DEFAULT_MSG
+ OSGTERRAIN_LIBRARY OSGTERRAIN_INCLUDE_DIR)
diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake
new file mode 100644
index 000000000..22f825f54
--- /dev/null
+++ b/Modules/FindosgText.cmake
@@ -0,0 +1,51 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgText/Text>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGTEXT osgText/Text)
+OSG_FIND_LIBRARY(OSGTEXT osgText)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgText DEFAULT_MSG
+ OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR)
diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake
new file mode 100644
index 000000000..05a74df84
--- /dev/null
+++ b/Modules/FindosgUtil.cmake
@@ -0,0 +1,51 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgUtil/SceneView>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGUTIL osgUtil/SceneView)
+OSG_FIND_LIBRARY(OSGUTIL osgUtil)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgUtil DEFAULT_MSG
+ OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR)
diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake
new file mode 100644
index 000000000..650dbd7ef
--- /dev/null
+++ b/Modules/FindosgViewer.cmake
@@ -0,0 +1,51 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgViewer/Viewer>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGVIEWER osgViewer/Viewer)
+OSG_FIND_LIBRARY(OSGVIEWER osgViewer)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgViewer DEFAULT_MSG
+ OSGVIEWER_LIBRARY OSGVIEWER_INCLUDE_DIR)
diff --git a/Modules/FindosgVolume.cmake b/Modules/FindosgVolume.cmake
new file mode 100644
index 000000000..3ad7edc24
--- /dev/null
+++ b/Modules/FindosgVolume.cmake
@@ -0,0 +1,51 @@
+# 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.
+
+#=============================================================================
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgVolume/Volume>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGVOLUME osgVolume/Volume)
+OSG_FIND_LIBRARY(OSGVOLUME osgVolume)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgVolume DEFAULT_MSG
+ OSGVOLUME_LIBRARY OSGVOLUME_INCLUDE_DIR)
diff --git a/Modules/FindosgWidget.cmake b/Modules/FindosgWidget.cmake
new file mode 100644
index 000000000..206a8b7f5
--- /dev/null
+++ b/Modules/FindosgWidget.cmake
@@ -0,0 +1,51 @@
+# 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.
+#
+# 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.)
+
+# Header files are presumed to be included like
+# #include <osg/PositionAttitudeTransform>
+# #include <osgWidget/Widget>
+
+include(Findosg_functions)
+OSG_FIND_PATH (OSGWIDGET osgWidget/Widget)
+OSG_FIND_LIBRARY(OSGWIDGET osgWidget)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgWidget DEFAULT_MSG
+ OSGWIDGET_LIBRARY OSGWIDGET_INCLUDE_DIR)
diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake
new file mode 100644
index 000000000..ab836ff9f
--- /dev/null
+++ b/Modules/Findosg_functions.cmake
@@ -0,0 +1,105 @@
+#
+# This CMake file contains two macros to assist with searching for OSG
+# libraries and nodekits.
+#
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2009 Philip Lowman <philip@yhbt.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.)
+
+#
+# OSG_FIND_PATH
+#
+function(OSG_FIND_PATH module header)
+ string(TOUPPER ${module} module_uc)
+
+ # Try the user's environment request before anything else.
+ find_path(${module_uc}_INCLUDE_DIR ${header}
+ HINTS
+ $ENV{${module_uc}_DIR}
+ $ENV{OSG_DIR}
+ $ENV{OSGDIR}
+ $ENV{OSG_ROOT}
+ PATH_SUFFIXES include
+ PATHS
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+ /usr/freeware
+ )
+endfunction(OSG_FIND_PATH module header)
+
+
+#
+# OSG_FIND_LIBRARY
+#
+function(OSG_FIND_LIBRARY module library)
+ string(TOUPPER ${module} module_uc)
+
+ find_library(${module_uc}_LIBRARY
+ NAMES ${library}
+ HINTS
+ $ENV{${module_uc}_DIR}
+ $ENV{OSG_DIR}
+ $ENV{OSGDIR}
+ $ENV{OSG_ROOT}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+ /usr/freeware
+ )
+
+ find_library(${module_uc}_LIBRARY_DEBUG
+ NAMES ${library}d
+ HINTS
+ $ENV{${module_uc}_DIR}
+ $ENV{OSG_DIR}
+ $ENV{OSGDIR}
+ $ENV{OSG_ROOT}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+ /usr/freeware
+ )
+
+ if(NOT ${module_uc}_LIBRARY_DEBUG)
+ # They don't have a debug library
+ set(${module_uc}_LIBRARY_DEBUG ${${module_uc}_LIBRARY} PARENT_SCOPE)
+ set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE)
+ else()
+ # They really have a FOO_LIBRARY_DEBUG
+ set(${module_uc}_LIBRARIES
+ optimized ${${module_uc}_LIBRARY}
+ debug ${${module_uc}_LIBRARY_DEBUG}
+ PARENT_SCOPE
+ )
+ endif()
+endfunction(OSG_FIND_LIBRARY module library)
+
+#
+# OSG_MARK_AS_ADVANCED
+# Just a convenience function for calling MARK_AS_ADVANCED
+#
+function(OSG_MARK_AS_ADVANCED _module)
+ string(TOUPPER ${_module} _module_UC)
+ mark_as_advanced(${_module_UC}_INCLUDE_DIR)
+ mark_as_advanced(${_module_UC}_LIBRARY)
+ mark_as_advanced(${_module_UC}_LIBRARY_DEBUG)
+endfunction()
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
new file mode 100644
index 000000000..865a6c5d1
--- /dev/null
+++ b/Modules/FindwxWidgets.cmake
@@ -0,0 +1,1044 @@
+# - Find a wxWidgets (a.k.a., wxWindows) installation.
+# This module finds if wxWidgets is installed and selects a default
+# configuration to use. wxWidgets is a modular library. To specify the
+# modules that you will use, you need to name them as components to
+# the package:
+#
+# FIND_PACKAGE(wxWidgets COMPONENTS core base ...)
+#
+# There are two search branches: a windows style and a unix style. For
+# windows, the following variables are searched for and set to
+# defaults in case of multiple choices. Change them if the defaults
+# are not desired (i.e., these are the only variables you should
+# change to select a configuration):
+#
+# wxWidgets_ROOT_DIR - Base wxWidgets directory
+# (e.g., C:/wxWidgets-2.6.3).
+# wxWidgets_LIB_DIR - Path to wxWidgets libraries
+# (e.g., C:/wxWidgets-2.6.3/lib/vc_lib).
+# wxWidgets_CONFIGURATION - Configuration to use
+# (e.g., msw, mswd, mswu, mswunivud, etc.)
+# wxWidgets_EXCLUDE_COMMON_LIBRARIES
+# - Set to TRUE to exclude linking of
+# commonly required libs (e.g., png tiff
+# jpeg zlib regex expat).
+#
+# For unix style it uses the wx-config utility. You can select between
+# debug/release, unicode/ansi, universal/non-universal, and
+# static/shared in the QtDialog or ccmake interfaces by turning ON/OFF
+# the following variables:
+#
+# wxWidgets_USE_DEBUG
+# wxWidgets_USE_UNICODE
+# wxWidgets_USE_UNIVERSAL
+# wxWidgets_USE_STATIC
+#
+# There is also a wxWidgets_CONFIG_OPTIONS variable for all other
+# options that need to be passed to the wx-config utility. For
+# example, to use the base toolkit found in the /usr/local path, set
+# the variable (before calling the FIND_PACKAGE command) as such:
+#
+# SET(wxWidgets_CONFIG_OPTIONS --toolkit=base --prefix=/usr)
+#
+# The following are set after the configuration is done for both
+# windows and unix style:
+#
+# wxWidgets_FOUND - Set to TRUE if wxWidgets was found.
+# wxWidgets_INCLUDE_DIRS - Include directories for WIN32
+# i.e., where to find "wx/wx.h" and
+# "wx/setup.h"; possibly empty for unices.
+# wxWidgets_LIBRARIES - Path to the wxWidgets libraries.
+# wxWidgets_LIBRARY_DIRS - compile time link dirs, useful for
+# rpath on UNIX. Typically an empty string
+# in WIN32 environment.
+# wxWidgets_DEFINITIONS - Contains defines required to compile/link
+# against WX, e.g. WXUSINGDLL
+# wxWidgets_DEFINITIONS_DEBUG- Contains defines required to compile/link
+# against WX debug builds, e.g. __WXDEBUG__
+# wxWidgets_CXX_FLAGS - Include dirs and compiler flags for
+# unices, empty on WIN32. Essentially
+# "`wx-config --cxxflags`".
+# wxWidgets_USE_FILE - Convenience include file.
+#
+# Sample usage:
+# # Note that for MinGW users the order of libs is important!
+# FIND_PACKAGE(wxWidgets COMPONENTS net gl core base)
+# IF(wxWidgets_FOUND)
+# INCLUDE(${wxWidgets_USE_FILE})
+# # and for each of your dependent executable/library targets:
+# TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES})
+# ENDIF(wxWidgets_FOUND)
+#
+# 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})
+
+#=============================================================================
+# Copyright 2004-2009 Kitware, Inc.
+# Copyright 2007-2009 Miguel A. Figueroa-Villanueva <miguelf at ieee dot 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.)
+
+#
+# FIXME: check this and provide a correct sample usage...
+# Remember to connect back to the upper text.
+# Sample usage with monolithic wx build:
+#
+# FIND_PACKAGE(wxWidgets COMPONENTS mono)
+# ...
+
+# NOTES
+#
+# This module has been tested on the WIN32 platform with wxWidgets
+# 2.6.2, 2.6.3, and 2.5.3. However, it has been designed to
+# easily extend support to all possible builds, e.g., static/shared,
+# debug/release, unicode, universal, multilib/monolithic, etc..
+#
+# If you want to use the module and your build type is not supported
+# out-of-the-box, please contact me to exchange information on how
+# your system is setup and I'll try to add support for it.
+#
+# AUTHOR
+#
+# Miguel A. Figueroa-Villanueva (miguelf at ieee dot org).
+# Jan Woetzel (jw at mip.informatik.uni-kiel.de).
+#
+# Based on previous works of:
+# Jan Woetzel (FindwxWindows.cmake),
+# Jorgen Bodde and Jerry Fath (FindwxWin.cmake).
+
+# TODO/ideas
+#
+# (1) Option/Setting to use all available wx libs
+# In contrast to expert developer who lists the
+# minimal set of required libs in wxWidgets_USE_LIBS
+# there is the newbie user:
+# - who just wants to link against WX with more 'magic'
+# - doesn't know the internal structure of WX or how it was built,
+# in particular if it is monolithic or not
+# - want to link against all available WX libs
+# Basically, the intent here is to mimic what wx-config would do by
+# default (i.e., `wx-config --libs`).
+#
+# Possible solution:
+# Add a reserved keyword "std" that initializes to what wx-config
+# would default to. If the user has not set the wxWidgets_USE_LIBS,
+# default to "std" instead of "base core" as it is now. To implement
+# "std" will basically boil down to a FOR_EACH lib-FOUND, but maybe
+# checking whether a minimal set was found.
+
+
+# FIXME: This and all the DBG_MSG calls should be removed after the
+# module stabilizes.
+#
+# Helper macro to control the debugging output globally. There are
+# two versions for controlling how verbose your output should be.
+MACRO(DBG_MSG _MSG)
+# MESSAGE(STATUS
+# "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
+ENDMACRO(DBG_MSG)
+MACRO(DBG_MSG_V _MSG)
+# MESSAGE(STATUS
+# "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
+ENDMACRO(DBG_MSG_V)
+
+# Clear return values in case the module is loaded more than once.
+SET(wxWidgets_FOUND FALSE)
+SET(wxWidgets_INCLUDE_DIRS "")
+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.
+#
+# If wxWidgets_USE_LIBS is set:
+# - if using <components>, then override wxWidgets_USE_LIBS
+# - else set wxWidgets_FIND_COMPONENTS to wxWidgets_USE_LIBS
+IF(wxWidgets_USE_LIBS AND NOT wxWidgets_FIND_COMPONENTS)
+ SET(wxWidgets_FIND_COMPONENTS ${wxWidgets_USE_LIBS})
+ENDIF(wxWidgets_USE_LIBS AND NOT wxWidgets_FIND_COMPONENTS)
+DBG_MSG("wxWidgets_FIND_COMPONENTS : ${wxWidgets_FIND_COMPONENTS}")
+
+# Add the convenience use file if available.
+#
+# Get dir of this file which may reside in:
+# - CMAKE_MAKE_ROOT/Modules on CMake installation
+# - CMAKE_MODULE_PATH if user prefers his own specialized version
+SET(wxWidgets_USE_FILE "")
+GET_FILENAME_COMPONENT(
+ wxWidgets_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
+# Prefer an existing customized version, but the user might override
+# the FindwxWidgets module and not the UsewxWidgets one.
+IF(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake")
+ SET(wxWidgets_USE_FILE
+ "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake")
+ELSE(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake")
+ SET(wxWidgets_USE_FILE UsewxWidgets)
+ENDIF(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake")
+
+#=====================================================================
+#=====================================================================
+IF(WIN32 AND NOT CYGWIN AND NOT MSYS)
+ SET(wxWidgets_FIND_STYLE "win32")
+ELSE(WIN32 AND NOT CYGWIN AND NOT MSYS)
+ IF(UNIX OR MSYS)
+ SET(wxWidgets_FIND_STYLE "unix")
+ ENDIF(UNIX OR MSYS)
+ENDIF(WIN32 AND NOT CYGWIN AND NOT MSYS)
+
+#=====================================================================
+# WIN32_FIND_STYLE
+#=====================================================================
+IF(wxWidgets_FIND_STYLE STREQUAL "win32")
+ # Useful common wx libs needed by almost all components.
+ SET(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat)
+
+ # DEPRECATED: Use FIND_PACKAGE(wxWidgets COMPONENTS mono) instead.
+ IF(NOT wxWidgets_FIND_COMPONENTS)
+ IF(wxWidgets_USE_MONOLITHIC)
+ SET(wxWidgets_FIND_COMPONENTS mono)
+ ELSE(wxWidgets_USE_MONOLITHIC)
+ SET(wxWidgets_FIND_COMPONENTS core base) # this is default
+ ENDIF(wxWidgets_USE_MONOLITHIC)
+ ENDIF(NOT wxWidgets_FIND_COMPONENTS)
+
+ # Add the common (usually required libs) unless
+ # wxWidgets_EXCLUDE_COMMON_LIBRARIES has been set.
+ IF(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES)
+ LIST(APPEND wxWidgets_FIND_COMPONENTS
+ ${wxWidgets_COMMON_LIBRARIES})
+ ENDIF(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES)
+
+ #-------------------------------------------------------------------
+ # WIN32: Helper MACROS
+ #-------------------------------------------------------------------
+ #
+ # Get filename components for a configuration. For example,
+ # if _CONFIGURATION = mswunivud, then _UNV=univ, _UCD=u _DBG=d
+ # if _CONFIGURATION = mswu, then _UNV="", _UCD=u _DBG=""
+ #
+ MACRO(WX_GET_NAME_COMPONENTS _CONFIGURATION _UNV _UCD _DBG)
+ STRING(REGEX MATCH "univ" ${_UNV} "${_CONFIGURATION}")
+ STRING(REGEX REPLACE "msw.*(u)[d]*$" "u" ${_UCD} "${_CONFIGURATION}")
+ IF(${_UCD} STREQUAL ${_CONFIGURATION})
+ SET(${_UCD} "")
+ ENDIF(${_UCD} STREQUAL ${_CONFIGURATION})
+ STRING(REGEX MATCH "d$" ${_DBG} "${_CONFIGURATION}")
+ ENDMACRO(WX_GET_NAME_COMPONENTS)
+
+ #
+ # Find libraries associated to a configuration.
+ #
+ MACRO(WX_FIND_LIBS _UNV _UCD _DBG)
+ DBG_MSG_V("m_unv = ${_UNV}")
+ DBG_MSG_V("m_ucd = ${_UCD}")
+ DBG_MSG_V("m_dbg = ${_DBG}")
+
+ # FIXME: What if both regex libs are available. regex should be
+ # found outside the loop and only wx${LIB}${_UCD}${_DBG}.
+ # Find wxWidgets common libraries.
+ FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla)
+ FIND_LIBRARY(WX_${LIB}${_DBG}
+ NAMES
+ wx${LIB}${_UCD}${_DBG} # for regex
+ wx${LIB}${_DBG}
+ PATHS ${WX_LIB_DIR}
+ NO_DEFAULT_PATH
+ )
+ MARK_AS_ADVANCED(WX_${LIB}${_DBG})
+ ENDFOREACH(LIB)
+
+ # Find wxWidgets multilib base libraries.
+ FIND_LIBRARY(WX_base${_DBG}
+ NAMES
+ wxbase29${_UCD}${_DBG}
+ wxbase28${_UCD}${_DBG}
+ wxbase27${_UCD}${_DBG}
+ wxbase26${_UCD}${_DBG}
+ wxbase25${_UCD}${_DBG}
+ PATHS ${WX_LIB_DIR}
+ NO_DEFAULT_PATH
+ )
+ MARK_AS_ADVANCED(WX_base${_DBG})
+ FOREACH(LIB net odbc xml)
+ FIND_LIBRARY(WX_${LIB}${_DBG}
+ NAMES
+ wxbase29${_UCD}${_DBG}_${LIB}
+ wxbase28${_UCD}${_DBG}_${LIB}
+ wxbase27${_UCD}${_DBG}_${LIB}
+ wxbase26${_UCD}${_DBG}_${LIB}
+ wxbase25${_UCD}${_DBG}_${LIB}
+ PATHS ${WX_LIB_DIR}
+ NO_DEFAULT_PATH
+ )
+ MARK_AS_ADVANCED(WX_${LIB}${_DBG})
+ ENDFOREACH(LIB)
+
+ # Find wxWidgets monolithic library.
+ FIND_LIBRARY(WX_mono${_DBG}
+ NAMES
+ wxmsw${_UNV}29${_UCD}${_DBG}
+ wxmsw${_UNV}28${_UCD}${_DBG}
+ wxmsw${_UNV}27${_UCD}${_DBG}
+ wxmsw${_UNV}26${_UCD}${_DBG}
+ wxmsw${_UNV}25${_UCD}${_DBG}
+ PATHS ${WX_LIB_DIR}
+ NO_DEFAULT_PATH
+ )
+ MARK_AS_ADVANCED(WX_mono${_DBG})
+
+ # Find wxWidgets multilib libraries.
+ FOREACH(LIB core adv aui html media xrc dbgrid gl qa richtext
+ stc ribbon propgrid webview)
+ FIND_LIBRARY(WX_${LIB}${_DBG}
+ NAMES
+ wxmsw${_UNV}29${_UCD}${_DBG}_${LIB}
+ wxmsw${_UNV}28${_UCD}${_DBG}_${LIB}
+ wxmsw${_UNV}27${_UCD}${_DBG}_${LIB}
+ wxmsw${_UNV}26${_UCD}${_DBG}_${LIB}
+ wxmsw${_UNV}25${_UCD}${_DBG}_${LIB}
+ PATHS ${WX_LIB_DIR}
+ NO_DEFAULT_PATH
+ )
+ MARK_AS_ADVANCED(WX_${LIB}${_DBG})
+ ENDFOREACH(LIB)
+ ENDMACRO(WX_FIND_LIBS)
+
+ #
+ # Clear all library paths, so that FIND_LIBRARY refinds them.
+ #
+ # Clear a lib, reset its found flag, and mark as advanced.
+ MACRO(WX_CLEAR_LIB _LIB)
+ SET(${_LIB} "${_LIB}-NOTFOUND" CACHE FILEPATH "Cleared." FORCE)
+ SET(${_LIB}_FOUND FALSE)
+ MARK_AS_ADVANCED(${_LIB})
+ ENDMACRO(WX_CLEAR_LIB)
+ # Clear all debug or release library paths (arguments are "d" or "").
+ MACRO(WX_CLEAR_ALL_LIBS _DBG)
+ # Clear wxWidgets common libraries.
+ FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla)
+ WX_CLEAR_LIB(WX_${LIB}${_DBG})
+ ENDFOREACH(LIB)
+
+ # Clear wxWidgets multilib base libraries.
+ WX_CLEAR_LIB(WX_base${_DBG})
+ FOREACH(LIB net odbc xml)
+ WX_CLEAR_LIB(WX_${LIB}${_DBG})
+ ENDFOREACH(LIB)
+
+ # Clear wxWidgets monolithic library.
+ WX_CLEAR_LIB(WX_mono${_DBG})
+
+ # Clear wxWidgets multilib libraries.
+ FOREACH(LIB core adv aui html media xrc dbgrid gl qa richtext
+ stc ribbon propgrid)
+ WX_CLEAR_LIB(WX_${LIB}${_DBG})
+ ENDFOREACH(LIB)
+ ENDMACRO(WX_CLEAR_ALL_LIBS)
+ # Clear all wxWidgets debug libraries.
+ MACRO(WX_CLEAR_ALL_DBG_LIBS)
+ WX_CLEAR_ALL_LIBS("d")
+ ENDMACRO(WX_CLEAR_ALL_DBG_LIBS)
+ # Clear all wxWidgets release libraries.
+ MACRO(WX_CLEAR_ALL_REL_LIBS)
+ WX_CLEAR_ALL_LIBS("")
+ ENDMACRO(WX_CLEAR_ALL_REL_LIBS)
+
+ #
+ # Set the wxWidgets_LIBRARIES variable.
+ # Also, Sets output variable wxWidgets_FOUND to FALSE if it fails.
+ #
+ MACRO(WX_SET_LIBRARIES _LIBS _DBG)
+ DBG_MSG_V("Looking for ${${_LIBS}}")
+ IF(WX_USE_REL_AND_DBG)
+ FOREACH(LIB ${${_LIBS}})
+ DBG_MSG_V("Searching for ${LIB} and ${LIB}d")
+ DBG_MSG_V("WX_${LIB} : ${WX_${LIB}}")
+ DBG_MSG_V("WX_${LIB}d : ${WX_${LIB}d}")
+ IF(WX_${LIB} AND WX_${LIB}d)
+ DBG_MSG_V("Found ${LIB} and ${LIB}d")
+ LIST(APPEND wxWidgets_LIBRARIES
+ debug ${WX_${LIB}d} optimized ${WX_${LIB}}
+ )
+ ELSE(WX_${LIB} AND WX_${LIB}d)
+ DBG_MSG_V("- not found due to missing WX_${LIB}=${WX_${LIB}} or WX_${LIB}d=${WX_${LIB}d}")
+ SET(wxWidgets_FOUND FALSE)
+ ENDIF(WX_${LIB} AND WX_${LIB}d)
+ ENDFOREACH(LIB)
+ ELSE(WX_USE_REL_AND_DBG)
+ FOREACH(LIB ${${_LIBS}})
+ DBG_MSG_V("Searching for ${LIB}${_DBG}")
+ DBG_MSG_V("WX_${LIB}${_DBG} : ${WX_${LIB}${_DBG}}")
+ IF(WX_${LIB}${_DBG})
+ DBG_MSG_V("Found ${LIB}${_DBG}")
+ LIST(APPEND wxWidgets_LIBRARIES ${WX_${LIB}${_DBG}})
+ ELSE(WX_${LIB}${_DBG})
+ DBG_MSG_V(
+ "- not found due to missing WX_${LIB}${_DBG}=${WX_${LIB}${_DBG}}")
+ SET(wxWidgets_FOUND FALSE)
+ ENDIF(WX_${LIB}${_DBG})
+ ENDFOREACH(LIB)
+ ENDIF(WX_USE_REL_AND_DBG)
+
+ DBG_MSG_V("OpenGL")
+ LIST(FIND ${_LIBS} gl WX_USE_GL)
+ IF(NOT WX_USE_GL EQUAL -1)
+ DBG_MSG_V("- is required.")
+ LIST(APPEND wxWidgets_LIBRARIES opengl32 glu32)
+ ENDIF(NOT WX_USE_GL EQUAL -1)
+
+ LIST(APPEND wxWidgets_LIBRARIES winmm comctl32 rpcrt4 wsock32)
+ ENDMACRO(WX_SET_LIBRARIES)
+
+ #-------------------------------------------------------------------
+ # WIN32: Start actual work.
+ #-------------------------------------------------------------------
+
+ # Look for an installation tree.
+ FIND_PATH(wxWidgets_ROOT_DIR
+ NAMES include/wx/wx.h
+ PATHS
+ $ENV{wxWidgets_ROOT_DIR}
+ $ENV{WXWIN}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" # WX 2.6.x
+ C:/
+ D:/
+ $ENV{ProgramFiles}
+ PATH_SUFFIXES
+ wxWidgets-2.9.4
+ wxWidgets-2.9.3
+ wxWidgets-2.9.2
+ wxWidgets-2.9.1
+ wxWidgets-2.9.0
+ wxWidgets-2.8.9
+ wxWidgets-2.8.8
+ wxWidgets-2.8.7
+ wxWidgets-2.8.6
+ wxWidgets-2.8.5
+ wxWidgets-2.8.4
+ wxWidgets-2.8.3
+ wxWidgets-2.8.2
+ wxWidgets-2.8.1
+ wxWidgets-2.8.0
+ wxWidgets-2.7.4
+ wxWidgets-2.7.3
+ wxWidgets-2.7.2
+ wxWidgets-2.7.1
+ wxWidgets-2.7.0
+ wxWidgets-2.7.0-1
+ wxWidgets-2.6.4
+ wxWidgets-2.6.3
+ wxWidgets-2.6.2
+ wxWidgets-2.6.1
+ wxWidgets-2.5.4
+ wxWidgets-2.5.3
+ wxWidgets-2.5.2
+ wxWidgets-2.5.1
+ wxWidgets
+ DOC "wxWidgets base/installation directory?"
+ )
+
+ # If wxWidgets_ROOT_DIR changed, clear lib dir.
+ IF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR)
+ SET(WX_ROOT_DIR ${wxWidgets_ROOT_DIR}
+ CACHE INTERNAL "wxWidgets_ROOT_DIR")
+ SET(wxWidgets_LIB_DIR "wxWidgets_LIB_DIR-NOTFOUND"
+ CACHE PATH "Cleared." FORCE)
+ ENDIF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR)
+
+ IF(WX_ROOT_DIR)
+ # Select one default tree inside the already determined wx tree.
+ # Prefer static/shared order usually consistent with build
+ # settings.
+ IF(MINGW)
+ SET(WX_LIB_DIR_PREFIX gcc)
+ ELSE(MINGW)
+ SET(WX_LIB_DIR_PREFIX vc)
+ ENDIF(MINGW)
+ IF(BUILD_SHARED_LIBS)
+ FIND_PATH(wxWidgets_LIB_DIR
+ NAMES
+ msw/wx/setup.h
+ mswd/wx/setup.h
+ mswu/wx/setup.h
+ mswud/wx/setup.h
+ mswuniv/wx/setup.h
+ mswunivd/wx/setup.h
+ mswunivu/wx/setup.h
+ mswunivud/wx/setup.h
+ PATHS
+ ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll # prefer shared
+ ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib
+ DOC "Path to wxWidgets libraries?"
+ NO_DEFAULT_PATH
+ )
+ ELSE(BUILD_SHARED_LIBS)
+ FIND_PATH(wxWidgets_LIB_DIR
+ NAMES
+ msw/wx/setup.h
+ mswd/wx/setup.h
+ mswu/wx/setup.h
+ mswud/wx/setup.h
+ mswuniv/wx/setup.h
+ mswunivd/wx/setup.h
+ mswunivu/wx/setup.h
+ mswunivud/wx/setup.h
+ PATHS
+ ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib # prefer static
+ ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll
+ DOC "Path to wxWidgets libraries?"
+ NO_DEFAULT_PATH
+ )
+ ENDIF(BUILD_SHARED_LIBS)
+
+ # If wxWidgets_LIB_DIR changed, clear all libraries.
+ IF(NOT WX_LIB_DIR STREQUAL wxWidgets_LIB_DIR)
+ SET(WX_LIB_DIR ${wxWidgets_LIB_DIR} CACHE INTERNAL "wxWidgets_LIB_DIR")
+ WX_CLEAR_ALL_DBG_LIBS()
+ WX_CLEAR_ALL_REL_LIBS()
+ ENDIF(NOT WX_LIB_DIR STREQUAL wxWidgets_LIB_DIR)
+
+ IF(WX_LIB_DIR)
+ # If building shared libs, define WXUSINGDLL to use dllimport.
+ 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(WX_LIB_DIR MATCHES ".*[dD][lL][lL].*")
+
+ # Search for available configuration types.
+ FOREACH(CFG mswunivud mswunivd mswud mswd mswunivu mswuniv mswu msw)
+ SET(WX_${CFG}_FOUND FALSE)
+ IF(EXISTS ${WX_LIB_DIR}/${CFG})
+ LIST(APPEND WX_CONFIGURATION_LIST ${CFG})
+ SET(WX_${CFG}_FOUND TRUE)
+ SET(WX_CONFIGURATION ${CFG})
+ ENDIF(EXISTS ${WX_LIB_DIR}/${CFG})
+ ENDFOREACH(CFG)
+ DBG_MSG_V("WX_CONFIGURATION_LIST=${WX_CONFIGURATION_LIST}")
+
+ IF(WX_CONFIGURATION)
+ SET(wxWidgets_FOUND TRUE)
+
+ # If the selected configuration wasn't found force the default
+ # one. Otherwise, use it but still force a refresh for
+ # updating the doc string with the current list of available
+ # configurations.
+ IF(NOT WX_${wxWidgets_CONFIGURATION}_FOUND)
+ SET(wxWidgets_CONFIGURATION ${WX_CONFIGURATION} CACHE STRING
+ "Set wxWidgets configuration (${WX_CONFIGURATION_LIST})" FORCE)
+ ELSE(NOT WX_${wxWidgets_CONFIGURATION}_FOUND)
+ SET(wxWidgets_CONFIGURATION ${wxWidgets_CONFIGURATION} CACHE STRING
+ "Set wxWidgets configuration (${WX_CONFIGURATION_LIST})" FORCE)
+ ENDIF(NOT WX_${wxWidgets_CONFIGURATION}_FOUND)
+
+ # If release config selected, and both release/debug exist.
+ IF(WX_${wxWidgets_CONFIGURATION}d_FOUND)
+ OPTION(wxWidgets_USE_REL_AND_DBG
+ "Use release and debug configurations?" TRUE)
+ SET(WX_USE_REL_AND_DBG ${wxWidgets_USE_REL_AND_DBG})
+ ELSE(WX_${wxWidgets_CONFIGURATION}d_FOUND)
+ # If the option exists (already in cache), force it false.
+ IF(wxWidgets_USE_REL_AND_DBG)
+ SET(wxWidgets_USE_REL_AND_DBG FALSE CACHE BOOL
+ "No ${wxWidgets_CONFIGURATION}d found." FORCE)
+ ENDIF(wxWidgets_USE_REL_AND_DBG)
+ SET(WX_USE_REL_AND_DBG FALSE)
+ ENDIF(WX_${wxWidgets_CONFIGURATION}d_FOUND)
+
+ # Get configuration parameters from the name.
+ WX_GET_NAME_COMPONENTS(${wxWidgets_CONFIGURATION} UNV UCD DBG)
+
+ # Set wxWidgets lib setup include directory.
+ IF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
+ SET(wxWidgets_INCLUDE_DIRS
+ ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION})
+ ELSE(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
+ DBG_MSG("wxWidgets_FOUND FALSE because ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h does not exists.")
+ SET(wxWidgets_FOUND FALSE)
+ ENDIF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
+
+ # Set wxWidgets main include directory.
+ IF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h)
+ LIST(APPEND wxWidgets_INCLUDE_DIRS ${WX_ROOT_DIR}/include)
+ ELSE(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h)
+ DBG_MSG("wxWidgets_FOUND FALSE because WX_ROOT_DIR=${WX_ROOT_DIR} has no ${WX_ROOT_DIR}/include/wx/wx.h")
+ SET(wxWidgets_FOUND FALSE)
+ ENDIF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h)
+
+ # Find wxWidgets libraries.
+ WX_FIND_LIBS("${UNV}" "${UCD}" "${DBG}")
+ IF(WX_USE_REL_AND_DBG)
+ WX_FIND_LIBS("${UNV}" "${UCD}" "d")
+ ENDIF(WX_USE_REL_AND_DBG)
+
+ # Settings for requested libs (i.e., include dir, libraries, etc.).
+ WX_SET_LIBRARIES(wxWidgets_FIND_COMPONENTS "${DBG}")
+
+ # Add necessary definitions for unicode builds
+ IF("${UCD}" STREQUAL "u")
+ LIST(APPEND wxWidgets_DEFINITIONS UNICODE _UNICODE)
+ ENDIF("${UCD}" STREQUAL "u")
+
+ # Add necessary definitions for debug builds
+ SET(wxWidgets_DEFINITIONS_DEBUG _DEBUG __WXDEBUG__)
+
+ ENDIF(WX_CONFIGURATION)
+ ENDIF(WX_LIB_DIR)
+ ENDIF(WX_ROOT_DIR)
+
+#=====================================================================
+# UNIX_FIND_STYLE
+#=====================================================================
+ELSE(wxWidgets_FIND_STYLE STREQUAL "win32")
+ IF(wxWidgets_FIND_STYLE STREQUAL "unix")
+ #-----------------------------------------------------------------
+ # UNIX: Helper MACROS
+ #-----------------------------------------------------------------
+ #
+ # Set the default values based on "wx-config --selected-config".
+ #
+ MACRO(WX_CONFIG_SELECT_GET_DEFAULT)
+ EXECUTE_PROCESS(
+ COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
+ ${wxWidgets_CONFIG_OPTIONS} --selected-config
+ OUTPUT_VARIABLE _wx_selected_config
+ RESULT_VARIABLE _wx_result
+ ERROR_QUIET
+ )
+ 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}.*")
+ SET(wxWidgets_DEFAULT_${_upper_opt_name} ON)
+ ELSE(_wx_selected_config MATCHES ".*${_opt_name}.*")
+ SET(wxWidgets_DEFAULT_${_upper_opt_name} OFF)
+ ENDIF(_wx_selected_config MATCHES ".*${_opt_name}.*")
+ ENDFOREACH(_opt_name)
+ ELSE(_wx_result EQUAL 0)
+ FOREACH(_upper_opt_name DEBUG STATIC UNICODE UNIVERSAL)
+ SET(wxWidgets_DEFAULT_${_upper_opt_name} OFF)
+ ENDFOREACH(_upper_opt_name)
+ ENDIF(_wx_result EQUAL 0)
+ ENDMACRO(WX_CONFIG_SELECT_GET_DEFAULT)
+
+ #
+ # Query a boolean configuration option to determine if the system
+ # has both builds available. If so, provide the selection option
+ # to the user.
+ #
+ MACRO(WX_CONFIG_SELECT_QUERY_BOOL _OPT_NAME _OPT_HELP)
+ EXECUTE_PROCESS(
+ COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
+ ${wxWidgets_CONFIG_OPTIONS} --${_OPT_NAME}=yes
+ RESULT_VARIABLE _wx_result_yes
+ OUTPUT_QUIET
+ ERROR_QUIET
+ )
+ EXECUTE_PROCESS(
+ COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
+ ${wxWidgets_CONFIG_OPTIONS} --${_OPT_NAME}=no
+ RESULT_VARIABLE _wx_result_no
+ OUTPUT_QUIET
+ ERROR_QUIET
+ )
+ STRING(TOUPPER ${_OPT_NAME} _UPPER_OPT_NAME)
+ IF(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0)
+ OPTION(wxWidgets_USE_${_UPPER_OPT_NAME}
+ ${_OPT_HELP} ${wxWidgets_DEFAULT_${_UPPER_OPT_NAME}})
+ ELSE(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0)
+ # If option exists (already in cache), force to available one.
+ IF(DEFINED wxWidgets_USE_${_UPPER_OPT_NAME})
+ IF(_wx_result_yes EQUAL 0)
+ SET(wxWidgets_USE_${_UPPER_OPT_NAME} ON CACHE BOOL ${_OPT_HELP} FORCE)
+ ELSE(_wx_result_yes EQUAL 0)
+ SET(wxWidgets_USE_${_UPPER_OPT_NAME} OFF CACHE BOOL ${_OPT_HELP} FORCE)
+ ENDIF(_wx_result_yes EQUAL 0)
+ ENDIF(DEFINED wxWidgets_USE_${_UPPER_OPT_NAME})
+ ENDIF(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0)
+ ENDMACRO(WX_CONFIG_SELECT_QUERY_BOOL)
+
+ #
+ # Set wxWidgets_SELECT_OPTIONS to wx-config options for selecting
+ # among multiple builds.
+ #
+ MACRO(WX_CONFIG_SELECT_SET_OPTIONS)
+ SET(wxWidgets_SELECT_OPTIONS ${wxWidgets_CONFIG_OPTIONS})
+ FOREACH(_opt_name debug static unicode universal)
+ STRING(TOUPPER ${_opt_name} _upper_opt_name)
+ IF(DEFINED wxWidgets_USE_${_upper_opt_name})
+ IF(wxWidgets_USE_${_upper_opt_name})
+ LIST(APPEND wxWidgets_SELECT_OPTIONS --${_opt_name}=yes)
+ ELSE(wxWidgets_USE_${_upper_opt_name})
+ LIST(APPEND wxWidgets_SELECT_OPTIONS --${_opt_name}=no)
+ ENDIF(wxWidgets_USE_${_upper_opt_name})
+ ENDIF(DEFINED wxWidgets_USE_${_upper_opt_name})
+ ENDFOREACH(_opt_name)
+ ENDMACRO(WX_CONFIG_SELECT_SET_OPTIONS)
+
+ #-----------------------------------------------------------------
+ # UNIX: Start actual work.
+ #-----------------------------------------------------------------
+ # Support cross-compiling, only search in the target platform.
+ FIND_PROGRAM(wxWidgets_CONFIG_EXECUTABLE wx-config
+ ONLY_CMAKE_FIND_ROOT_PATH
+ )
+
+ IF(wxWidgets_CONFIG_EXECUTABLE)
+ SET(wxWidgets_FOUND TRUE)
+
+ # get defaults based on "wx-config --selected-config"
+ WX_CONFIG_SELECT_GET_DEFAULT()
+
+ # for each option: if both builds are available, provide option
+ WX_CONFIG_SELECT_QUERY_BOOL(debug "Use debug build?")
+ WX_CONFIG_SELECT_QUERY_BOOL(unicode "Use unicode build?")
+ WX_CONFIG_SELECT_QUERY_BOOL(universal "Use universal build?")
+ WX_CONFIG_SELECT_QUERY_BOOL(static "Link libraries statically?")
+
+ # process selection to set wxWidgets_SELECT_OPTIONS
+ WX_CONFIG_SELECT_SET_OPTIONS()
+ DBG_MSG("wxWidgets_SELECT_OPTIONS=${wxWidgets_SELECT_OPTIONS}")
+
+ # run the wx-config program to get cxxflags
+ EXECUTE_PROCESS(
+ COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
+ ${wxWidgets_SELECT_OPTIONS} --cxxflags
+ OUTPUT_VARIABLE wxWidgets_CXX_FLAGS
+ RESULT_VARIABLE RET
+ ERROR_QUIET
+ )
+ IF(RET EQUAL 0)
+ STRING(STRIP "${wxWidgets_CXX_FLAGS}" wxWidgets_CXX_FLAGS)
+ SEPARATE_ARGUMENTS(wxWidgets_CXX_FLAGS)
+
+ DBG_MSG_V("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
+
+ # parse definitions from cxxflags;
+ # drop -D* from CXXFLAGS and the -D prefix
+ STRING(REGEX MATCHALL "-D[^;]+"
+ wxWidgets_DEFINITIONS "${wxWidgets_CXX_FLAGS}")
+ STRING(REGEX REPLACE "-D[^;]+(;|$)" ""
+ wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}")
+ STRING(REGEX REPLACE ";$" ""
+ wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}")
+ STRING(REPLACE "-D" ""
+ wxWidgets_DEFINITIONS "${wxWidgets_DEFINITIONS}")
+
+ # parse include dirs from cxxflags; drop -I prefix
+ STRING(REGEX MATCHALL "-I[^;]+"
+ wxWidgets_INCLUDE_DIRS "${wxWidgets_CXX_FLAGS}")
+ STRING(REGEX REPLACE "-I[^;]+;" ""
+ wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}")
+ STRING(REPLACE "-I" ""
+ wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}")
+
+ DBG_MSG_V("wxWidgets_DEFINITIONS=${wxWidgets_DEFINITIONS}")
+ DBG_MSG_V("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}")
+ DBG_MSG_V("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
+
+ ELSE(RET EQUAL 0)
+ SET(wxWidgets_FOUND FALSE)
+ DBG_MSG_V(
+ "${wxWidgets_CONFIG_EXECUTABLE} --cxxflags FAILED with RET=${RET}")
+ ENDIF(RET EQUAL 0)
+
+ # run the wx-config program to get the libs
+ # - NOTE: wx-config doesn't verify that the libs requested exist
+ # it just produces the names. Maybe a TRY_COMPILE would
+ # be useful here...
+ STRING(REPLACE ";" ","
+ wxWidgets_FIND_COMPONENTS "${wxWidgets_FIND_COMPONENTS}")
+ EXECUTE_PROCESS(
+ COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
+ ${wxWidgets_SELECT_OPTIONS} --libs ${wxWidgets_FIND_COMPONENTS}
+ OUTPUT_VARIABLE wxWidgets_LIBRARIES
+ RESULT_VARIABLE RET
+ ERROR_QUIET
+ )
+ IF(RET EQUAL 0)
+ STRING(STRIP "${wxWidgets_LIBRARIES}" wxWidgets_LIBRARIES)
+ SEPARATE_ARGUMENTS(wxWidgets_LIBRARIES)
+ STRING(REPLACE "-framework;" "-framework "
+ wxWidgets_LIBRARIES "${wxWidgets_LIBRARIES}")
+ STRING(REPLACE "-arch;" "-arch "
+ wxWidgets_LIBRARIES "${wxWidgets_LIBRARIES}")
+ STRING(REPLACE "-isysroot;" "-isysroot "
+ wxWidgets_LIBRARIES "${wxWidgets_LIBRARIES}")
+
+ # extract linkdirs (-L) for rpath (i.e., LINK_DIRECTORIES)
+ STRING(REGEX MATCHALL "-L[^;]+"
+ wxWidgets_LIBRARY_DIRS "${wxWidgets_LIBRARIES}")
+ STRING(REPLACE "-L" ""
+ wxWidgets_LIBRARY_DIRS "${wxWidgets_LIBRARY_DIRS}")
+
+ DBG_MSG_V("wxWidgets_LIBRARIES=${wxWidgets_LIBRARIES}")
+ DBG_MSG_V("wxWidgets_LIBRARY_DIRS=${wxWidgets_LIBRARY_DIRS}")
+
+ ELSE(RET EQUAL 0)
+ SET(wxWidgets_FOUND FALSE)
+ DBG_MSG("${wxWidgets_CONFIG_EXECUTABLE} --libs ${wxWidgets_FIND_COMPONENTS} FAILED with RET=${RET}")
+ ENDIF(RET EQUAL 0)
+ ENDIF(wxWidgets_CONFIG_EXECUTABLE)
+
+#=====================================================================
+# Neither UNIX_FIND_STYLE, nor WIN32_FIND_STYLE
+#=====================================================================
+ ELSE(wxWidgets_FIND_STYLE STREQUAL "unix")
+ IF(NOT wxWidgets_FIND_QUIETLY)
+ MESSAGE(STATUS
+ "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): \n"
+ " Platform unknown/unsupported. It's neither WIN32 nor UNIX "
+ "find style."
+ )
+ ENDIF(NOT wxWidgets_FIND_QUIETLY)
+ ENDIF(wxWidgets_FIND_STYLE STREQUAL "unix")
+ENDIF(wxWidgets_FIND_STYLE STREQUAL "win32")
+
+# Debug output:
+DBG_MSG("wxWidgets_FOUND : ${wxWidgets_FOUND}")
+DBG_MSG("wxWidgets_INCLUDE_DIRS : ${wxWidgets_INCLUDE_DIRS}")
+DBG_MSG("wxWidgets_LIBRARY_DIRS : ${wxWidgets_LIBRARY_DIRS}")
+DBG_MSG("wxWidgets_LIBRARIES : ${wxWidgets_LIBRARIES}")
+DBG_MSG("wxWidgets_CXX_FLAGS : ${wxWidgets_CXX_FLAGS}")
+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})
+
+#=====================================================================
+# Macros for use in wxWidgets apps.
+# - This module will not fail to find wxWidgets based on the code
+# below. Hence, it's required to check for validity of:
+#
+# wxWidgets_wxrc_EXECUTABLE
+#=====================================================================
+
+# Resource file compiler.
+FIND_PROGRAM(wxWidgets_wxrc_EXECUTABLE wxrc
+ ${wxWidgets_ROOT_DIR}/utils/wxrc/vc_msw
+ )
+
+#
+# WX_SPLIT_ARGUMENTS_ON(<keyword> <left> <right> <arg1> <arg2> ...)
+#
+# Sets <left> and <right> to contain arguments to the left and right,
+# respectively, of <keyword>.
+#
+# Example usage:
+# FUNCTION(WXWIDGETS_ADD_RESOURCES outfiles)
+# WX_SPLIT_ARGUMENTS_ON(OPTIONS wxrc_files wxrc_options ${ARGN})
+# ...
+# ENDFUNCTION(WXWIDGETS_ADD_RESOURCES)
+#
+# WXWIDGETS_ADD_RESOURCES(sources ${xrc_files} OPTIONS -e -o file.C)
+#
+# NOTE: This is a generic piece of code that should be renamed to
+# SPLIT_ARGUMENTS_ON and put in a file serving the same purpose as
+# FindPackageStandardArgs.cmake. At the time of this writing
+# FindQt4.cmake has a QT4_EXTRACT_OPTIONS, which I basically copied
+# here a bit more generalized. So, there are already two find modules
+# using this approach.
+#
+FUNCTION(WX_SPLIT_ARGUMENTS_ON _keyword _leftvar _rightvar)
+ # FIXME: Document that the input variables will be cleared.
+ #LIST(APPEND ${_leftvar} "")
+ #LIST(APPEND ${_rightvar} "")
+ SET(${_leftvar} "")
+ SET(${_rightvar} "")
+
+ SET(_doing_right FALSE)
+ FOREACH(element ${ARGN})
+ IF("${element}" STREQUAL "${_keyword}")
+ SET(_doing_right TRUE)
+ ELSE("${element}" STREQUAL "${_keyword}")
+ IF(_doing_right)
+ LIST(APPEND ${_rightvar} "${element}")
+ ELSE(_doing_right)
+ LIST(APPEND ${_leftvar} "${element}")
+ ENDIF(_doing_right)
+ ENDIF("${element}" STREQUAL "${_keyword}")
+ ENDFOREACH(element)
+
+ SET(${_leftvar} ${${_leftvar}} PARENT_SCOPE)
+ SET(${_rightvar} ${${_rightvar}} PARENT_SCOPE)
+ENDFUNCTION(WX_SPLIT_ARGUMENTS_ON)
+
+#
+# WX_GET_DEPENDENCIES_FROM_XML(
+# <depends>
+# <match_pattern>
+# <clean_pattern>
+# <xml_contents>
+# <depends_path>
+# )
+#
+# FIXME: Add documentation here...
+#
+FUNCTION(WX_GET_DEPENDENCIES_FROM_XML
+ _depends
+ _match_patt
+ _clean_patt
+ _xml_contents
+ _depends_path
+ )
+
+ STRING(REGEX MATCHALL
+ ${_match_patt}
+ dep_file_list
+ "${${_xml_contents}}"
+ )
+ FOREACH(dep_file ${dep_file_list})
+ STRING(REGEX REPLACE ${_clean_patt} "" dep_file "${dep_file}")
+
+ # make the file have an absolute path
+ IF(NOT IS_ABSOLUTE "${dep_file}")
+ SET(dep_file "${${_depends_path}}/${dep_file}")
+ ENDIF(NOT IS_ABSOLUTE "${dep_file}")
+
+ # append file to dependency list
+ LIST(APPEND ${_depends} "${dep_file}")
+ ENDFOREACH(dep_file)
+
+ SET(${_depends} ${${_depends}} PARENT_SCOPE)
+ENDFUNCTION(WX_GET_DEPENDENCIES_FROM_XML)
+
+#
+# WXWIDGETS_ADD_RESOURCES(<sources> <xrc_files>
+# OPTIONS <options> [NO_CPP_CODE])
+#
+# Adds a custom command for resource file compilation of the
+# <xrc_files> and appends the output files to <sources>.
+#
+# Example usages:
+# WXWIDGETS_ADD_RESOURCES(sources xrc/main_frame.xrc)
+# WXWIDGETS_ADD_RESOURCES(sources ${xrc_files} OPTIONS -e -o altname.cxx)
+#
+FUNCTION(WXWIDGETS_ADD_RESOURCES _outfiles)
+ WX_SPLIT_ARGUMENTS_ON(OPTIONS rc_file_list rc_options ${ARGN})
+
+ # Parse files for dependencies.
+ SET(rc_file_list_abs "")
+ SET(rc_depends "")
+ FOREACH(rc_file ${rc_file_list})
+ GET_FILENAME_COMPONENT(depends_path ${rc_file} PATH)
+
+ GET_FILENAME_COMPONENT(rc_file_abs ${rc_file} ABSOLUTE)
+ LIST(APPEND rc_file_list_abs "${rc_file_abs}")
+
+ # All files have absolute paths or paths relative to the location
+ # of the rc file.
+ FILE(READ "${rc_file_abs}" rc_file_contents)
+
+ # get bitmap/bitmap2 files
+ WX_GET_DEPENDENCIES_FROM_XML(
+ rc_depends
+ "<bitmap[^<]+"
+ "^<bitmap[^>]*>"
+ rc_file_contents
+ depends_path
+ )
+
+ # get url files
+ WX_GET_DEPENDENCIES_FROM_XML(
+ rc_depends
+ "<url[^<]+"
+ "^<url[^>]*>"
+ rc_file_contents
+ depends_path
+ )
+
+ # get wxIcon files
+ WX_GET_DEPENDENCIES_FROM_XML(
+ rc_depends
+ "<object[^>]*class=\"wxIcon\"[^<]+"
+ "^<object[^>]*>"
+ rc_file_contents
+ depends_path
+ )
+ ENDFOREACH(rc_file)
+
+ #
+ # Parse options.
+ #
+ # If NO_CPP_CODE option specified, then produce .xrs file rather
+ # than a .cpp file (i.e., don't add the default --cpp-code option).
+ LIST(FIND rc_options NO_CPP_CODE index)
+ IF(index EQUAL -1)
+ LIST(APPEND rc_options --cpp-code)
+ # wxrc's default output filename for cpp code.
+ SET(outfile resource.cpp)
+ ELSE(index EQUAL -1)
+ LIST(REMOVE_AT rc_options ${index})
+ # wxrc's default output filename for xrs file.
+ SET(outfile resource.xrs)
+ ENDIF(index EQUAL -1)
+
+ # Get output name for use in ADD_CUSTOM_COMMAND.
+ # - short option scanning
+ LIST(FIND rc_options -o index)
+ IF(NOT index EQUAL -1)
+ MATH(EXPR filename_index "${index} + 1")
+ LIST(GET rc_options ${filename_index} outfile)
+ #LIST(REMOVE_AT rc_options ${index} ${filename_index})
+ ENDIF(NOT index EQUAL -1)
+ # - long option scanning
+ STRING(REGEX MATCH "--output=[^;]*" outfile_opt "${rc_options}")
+ IF(outfile_opt)
+ STRING(REPLACE "--output=" "" outfile "${outfile_opt}")
+ ENDIF(outfile_opt)
+ #STRING(REGEX REPLACE "--output=[^;]*;?" "" rc_options "${rc_options}")
+ #STRING(REGEX REPLACE ";$" "" rc_options "${rc_options}")
+
+ IF(NOT IS_ABSOLUTE "${outfile}")
+ SET(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
+ ENDIF(NOT IS_ABSOLUTE "${outfile}")
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${outfile}"
+ COMMAND ${wxWidgets_wxrc_EXECUTABLE} ${rc_options} ${rc_file_list_abs}
+ DEPENDS ${rc_file_list_abs} ${rc_depends}
+ )
+
+ # Add generated header to output file list.
+ LIST(FIND rc_options -e short_index)
+ LIST(FIND rc_options --extra-cpp-code long_index)
+ IF(NOT short_index EQUAL -1 OR NOT long_index EQUAL -1)
+ GET_FILENAME_COMPONENT(outfile_ext ${outfile} EXT)
+ STRING(REPLACE "${outfile_ext}" ".h" outfile_header "${outfile}")
+ LIST(APPEND ${_outfiles} "${outfile_header}")
+ SET_SOURCE_FILES_PROPERTIES(
+ "${outfile_header}" PROPERTIES GENERATED TRUE
+ )
+ ENDIF(NOT short_index EQUAL -1 OR NOT long_index EQUAL -1)
+
+ # Add generated file to output file list.
+ LIST(APPEND ${_outfiles} "${outfile}")
+
+ SET(${_outfiles} ${${_outfiles}} PARENT_SCOPE)
+ENDFUNCTION(WXWIDGETS_ADD_RESOURCES)
diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake
new file mode 100644
index 000000000..dfb28ff90
--- /dev/null
+++ b/Modules/FindwxWindows.cmake
@@ -0,0 +1,706 @@
+# - Find wxWindows (wxWidgets) installation
+# This module finds if wxWindows/wxWidgets is installed and determines where
+# the include files and libraries are. It also determines what the name of
+# the library is.
+# Please note this file is DEPRECATED and replaced by FindwxWidgets.cmake.
+# This code sets the following variables:
+#
+# WXWINDOWS_FOUND = system has WxWindows
+# WXWINDOWS_LIBRARIES = path to the wxWindows libraries
+# on Unix/Linux with additional
+# linker flags from
+# "wx-config --libs"
+# CMAKE_WXWINDOWS_CXX_FLAGS = Compiler flags for wxWindows,
+# essentially "`wx-config --cxxflags`"
+# on Linux
+# WXWINDOWS_INCLUDE_DIR = where to find "wx/wx.h" and "wx/setup.h"
+# WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on
+# Unix
+# WXWINDOWS_DEFINITIONS = extra defines
+#
+# OPTIONS
+# If you need OpenGL support please
+# SET(WXWINDOWS_USE_GL 1)
+# in your CMakeLists.txt *before* you include this file.
+#
+# HAVE_ISYSTEM - true required to replace -I by -isystem on g++
+#
+# For convenience include Use_wxWindows.cmake in your project's
+# CMakeLists.txt using INCLUDE(Use_wxWindows).
+#
+# USAGE
+# SET(WXWINDOWS_USE_GL 1)
+# FIND_PACKAGE(wxWindows)
+#
+# NOTES
+# wxWidgets 2.6.x is supported for monolithic builds
+# e.g. compiled in wx/build/msw dir as:
+# nmake -f makefile.vc BUILD=debug SHARED=0 USE_OPENGL=1 MONOLITHIC=1
+#
+# DEPRECATED
+#
+# CMAKE_WX_CAN_COMPILE
+# WXWINDOWS_LIBRARY
+# CMAKE_WX_CXX_FLAGS
+# WXWINDOWS_INCLUDE_PATH
+#
+# AUTHOR
+# Jan Woetzel <http://www.mip.informatik.uni-kiel.de/~jw> (07/2003-01/2006)
+
+#=============================================================================
+# Copyright 2000-2009 Kitware, Inc.
+# Copyright 2003-2006 Jan Woetzel
+#
+# 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.)
+
+# ------------------------------------------------------------------
+#
+# -removed OPTION for CMAKE_WXWINDOWS_USE_GL. Force the developer to SET it before calling this.
+# -major update for wx 2.6.2 and monolithic build option. (10/2005)
+#
+# STATUS
+# tested with:
+# cmake 1.6.7, Linux (Suse 7.3), wxWindows 2.4.0, gcc 2.95
+# cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.0, gcc 3.3
+# cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.1-patch1, gcc 3.3
+# cmake 1.6.7, MS Windows XP home, wxWindows 2.4.1, MS Visual Studio .net 7 2002 (static build)
+# cmake 2.0.5 on Windows XP and Suse Linux 9.2
+# cmake 2.0.6 on Windows XP and Suse Linux 9.2, wxWidgets 2.6.2 MONOLITHIC build
+# cmake 2.2.2 on Windows XP, MS Visual Studio .net 2003 7.1 wxWidgets 2.6.2 MONOLITHIC build
+#
+# TODO
+# -OPTION for unicode builds
+# -further testing of DLL linking under MS WIN32
+# -better support for non-monolithic builds
+#
+
+
+IF(WIN32)
+ SET(WIN32_STYLE_FIND 1)
+ENDIF(WIN32)
+IF(MINGW)
+ SET(WIN32_STYLE_FIND 0)
+ SET(UNIX_STYLE_FIND 1)
+ENDIF(MINGW)
+IF(UNIX)
+ SET(UNIX_STYLE_FIND 1)
+ENDIF(UNIX)
+
+
+IF(WIN32_STYLE_FIND)
+
+ ## ######################################################################
+ ##
+ ## Windows specific:
+ ##
+ ## candidates for root/base directory of wxwindows
+ ## should have subdirs include and lib containing include/wx/wx.h
+ ## fix the root dir to avoid mixing of headers/libs from different
+ ## versions/builds:
+
+ SET (WXWINDOWS_POSSIBLE_ROOT_PATHS
+ $ENV{WXWIN}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" ## WX 2.6.x
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]" ## WX 2.4.x
+ C:\\wxWidgets-2.6.2
+ D:\\wxWidgets-2.6.2
+ C:\\wxWidgets-2.6.1
+ D:\\wxWidgets-2.6.1
+ C:\\wxWindows-2.4.2
+ D:\\wxWindows-2.4.2
+ )
+
+ ## WX supports monolithic and multiple smaller libs (since 2.5.x), we prefer monolithic for now.
+ ## monolithic = WX is built as a single big library
+ ## e.g. compile on WIN32 as "nmake -f makefile.vc MONOLITHIC=1 BUILD=debug SHARED=0 USE_OPENGL=1" (JW)
+ OPTION(WXWINDOWS_USE_MONOLITHIC "Use monolithic build of WX??" ON)
+ MARK_AS_ADVANCED(WXWINDOWS_USE_MONOLITHIC)
+
+ ## GL libs used?
+ OPTION(WXWINDOWS_USE_GL "Use Wx with GL support(glcanvas)?" ON)
+ MARK_AS_ADVANCED(WXWINDOWS_USE_GL)
+
+
+ ## avoid mixing of headers and libs between multiple installed WX versions,
+ ## select just one tree here:
+ FIND_PATH(WXWINDOWS_ROOT_DIR include/wx/wx.h
+ ${WXWINDOWS_POSSIBLE_ROOT_PATHS} )
+ # MESSAGE("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}")
+
+
+ ## find libs for combination of static/shared with release/debug
+ ## be careful if you add something here,
+ ## avoid mixing of headers and libs of different wx versions,
+ ## there may be multiple WX versions installed.
+ SET (WXWINDOWS_POSSIBLE_LIB_PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib"
+ )
+
+ ## monolithic?
+ IF (WXWINDOWS_USE_MONOLITHIC)
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY
+ NAMES wx wxmsw wxmsw26
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static release build library" )
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY
+ NAMES wxd wxmswd wxmsw26d
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static debug build library" )
+
+ FIND_LIBRARY(WXWINDOWS_SHARED_LIBRARY
+ NAMES wxmsw26 wxmsw262 wxmsw24 wxmsw242 wxmsw241 wxmsw240 wx23_2 wx22_9
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows shared release build library" )
+
+ FIND_LIBRARY(WXWINDOWS_SHARED_DEBUG_LIBRARY
+ NAMES wxmsw26d wxmsw262d wxmsw24d wxmsw241d wxmsw240d wx23_2d wx22_9d
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows shared debug build library " )
+
+
+ ##
+ ## required for WXWINDOWS_USE_GL
+ ## gl lib is always build separate:
+ ##
+ FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_GL
+ NAMES wx_gl wxmsw_gl wxmsw26_gl
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static release build GL library" )
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
+ NAMES wxd_gl wxmswd_gl wxmsw26d_gl
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static debug build GL library" )
+
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
+ NAMES wxpngd
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static debug png library" )
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_PNG
+ NAMES wxpng
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static png library" )
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
+ NAMES wxtiffd
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static debug tiff library" )
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_TIFF
+ NAMES wxtiff
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static tiff library" )
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
+ NAMES wxjpegd wxjpgd
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static debug jpeg library" )
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_JPEG
+ NAMES wxjpeg wxjpg
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static jpeg library" )
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
+ NAMES wxzlibd
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static debug zlib library" )
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_ZLIB
+ NAMES wxzlib
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static zib library" )
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
+ NAMES wxregexd
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static debug regex library" )
+
+ FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_REGEX
+ NAMES wxregex
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows static regex library" )
+
+
+
+ ## untested:
+ FIND_LIBRARY(WXWINDOWS_SHARED_LIBRARY_GL
+ NAMES wx_gl wxmsw_gl wxmsw26_gl
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows shared release build GL library" )
+
+ FIND_LIBRARY(WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
+ NAMES wxd_gl wxmswd_gl wxmsw26d_gl
+ PATHS
+ "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
+ ${WXWINDOWS_POSSIBLE_LIB_PATHS}
+ DOC "wxWindows shared debug build GL library" )
+
+
+ ELSE (WXWINDOWS_USE_MONOLITHIC)
+ ## WX is built as multiple small pieces libraries instead of monolithic
+
+ ## DEPECATED (jw) replaced by more general WXWINDOWS_USE_MONOLITHIC ON/OFF
+ # OPTION(WXWINDOWS_SEPARATE_LIBS_BUILD "Is wxWindows build with separate libs?" OFF)
+
+ ## HACK: This is very dirty.
+ ## because the libs of a particular version are explicitly listed
+ ## and NOT searched/verified.
+ ## TODO: Really search for each lib, then decide for
+ ## monolithic x debug x shared x GL (=16 combinations) for at least 18 libs
+ ## --> about 288 combinations
+ ## thus we need a different approach so solve this correctly ...
+
+ MESSAGE(STATUS "Warning: You are trying to use wxWidgets without monolithic build (WXWINDOWS_SEPARATE_LIBS_BUILD). This is a HACK, libraries are not verified! (JW).")
+
+ SET(WXWINDOWS_STATIC_LIBS ${WXWINDOWS_STATIC_LIBS}
+ wxbase26
+ wxbase26_net
+ wxbase26_odbc
+ wxbase26_xml
+ wxmsw26_adv
+ wxmsw26_core
+ wxmsw26_dbgrid
+ wxmsw26_gl
+ wxmsw26_html
+ wxmsw26_media
+ wxmsw26_qa
+ wxmsw26_xrc
+ wxexpat
+ wxjpeg
+ wxpng
+ wxregex
+ wxtiff
+ wxzlib
+ comctl32
+ rpcrt4
+ wsock32
+ )
+ ## HACK: feed in to optimized / debug libaries if both were FOUND.
+ SET(WXWINDOWS_STATIC_DEBUG_LIBS ${WXWINDOWS_STATIC_DEBUG_LIBS}
+ wxbase26d
+ wxbase26d_net
+ wxbase26d_odbc
+ wxbase26d_xml
+ wxmsw26d_adv
+ wxmsw26d_core
+ wxmsw26d_dbgrid
+ wxmsw26d_gl
+ wxmsw26d_html
+ wxmsw26d_media
+ wxmsw26d_qa
+ wxmsw26d_xrc
+ wxexpatd
+ wxjpegd
+ wxpngd
+ wxregexd
+ wxtiffd
+ wxzlibd
+ comctl32
+ rpcrt4
+ wsock32
+ )
+ ENDIF (WXWINDOWS_USE_MONOLITHIC)
+
+
+ ##
+ ## now we should have found all WX libs available on the system.
+ ## let the user decide which of the available onse to use.
+ ##
+
+ ## if there is at least one shared lib available
+ ## let user choose wether to use shared or static wxwindows libs
+ IF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY)
+ ## default value OFF because wxWindows MSVS default build is static
+ OPTION(WXWINDOWS_USE_SHARED_LIBS
+ "Use shared versions (dll) of wxWindows libraries?" OFF)
+ MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS)
+ ENDIF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY)
+
+ ## add system libraries wxwindows always seems to depend on
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ comctl32
+ rpcrt4
+ wsock32
+ )
+
+ IF (NOT WXWINDOWS_USE_SHARED_LIBS)
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ ## these ones dont seem required, in particular ctl3d32 is not neccesary (Jan Woetzel 07/2003)
+ # ctl3d32
+ debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB} optimized ${WXWINDOWS_STATIC_LIBRARY_ZLIB}
+ debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX} optimized ${WXWINDOWS_STATIC_LIBRARY_REGEX}
+ debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG} optimized ${WXWINDOWS_STATIC_LIBRARY_PNG}
+ debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG} optimized ${WXWINDOWS_STATIC_LIBRARY_JPEG}
+ debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF} optimized ${WXWINDOWS_STATIC_LIBRARY_TIFF}
+ )
+ ENDIF (NOT WXWINDOWS_USE_SHARED_LIBS)
+
+ ## opengl/glu: TODO/FIXME: better use FindOpenGL.cmake here
+ ## assume release versions of glu an dopengl, here.
+ IF (WXWINDOWS_USE_GL)
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ opengl32
+ glu32 )
+ ENDIF (WXWINDOWS_USE_GL)
+
+ ##
+ ## select between use of shared or static wxWindows lib then set libs to use
+ ## for debug and optimized build. so the user can switch between debug and
+ ## release build e.g. within MS Visual Studio without running cmake with a
+ ## different build directory again.
+ ##
+ ## then add the build specific include dir for wx/setup.h
+ ##
+
+ IF(WXWINDOWS_USE_SHARED_LIBS)
+ ##MESSAGE("DBG wxWindows use shared lib selected.")
+ ## assume that both builds use the same setup(.h) for simplicity
+
+ ## shared: both wx (debug and release) found?
+ ## assume that both builds use the same setup(.h) for simplicity
+ IF(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY)
+ ##MESSAGE("DBG wx shared: debug and optimized found.")
+ FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
+ ${WXWINDOWS_ROOT_DIR}/lib/mswdlld
+ ${WXWINDOWS_ROOT_DIR}/lib/mswdll
+ ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd
+ ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw )
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY}
+ optimized ${WXWINDOWS_SHARED_LIBRARY} )
+ IF (WXWINDOWS_USE_GL)
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL}
+ optimized ${WXWINDOWS_SHARED_LIBRARY_GL} )
+ ENDIF (WXWINDOWS_USE_GL)
+ ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY)
+
+ ## shared: only debug wx lib found?
+ IF(WXWINDOWS_SHARED_DEBUG_LIBRARY)
+ IF(NOT WXWINDOWS_SHARED_LIBRARY)
+ ##MESSAGE("DBG wx shared: debug (but no optimized) found.")
+ FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
+ ${WXWINDOWS_ROOT_DIR}/lib/mswdlld
+ ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd )
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
+ IF (WXWINDOWS_USE_GL)
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} )
+ ENDIF (WXWINDOWS_USE_GL)
+ ENDIF(NOT WXWINDOWS_SHARED_LIBRARY)
+ ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY)
+
+ ## shared: only release wx lib found?
+ IF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
+ IF(WXWINDOWS_SHARED_LIBRARY)
+ ##MESSAGE("DBG wx shared: optimized (but no debug) found.")
+ FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
+ ${WXWINDOWS_ROOT_DIR}/lib/mswdll
+ ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw )
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
+ IF (WXWINDOWS_USE_GL)
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} )
+ ENDIF (WXWINDOWS_USE_GL)
+ ENDIF(WXWINDOWS_SHARED_LIBRARY)
+ ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
+
+ ## shared: none found?
+ IF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
+ IF(NOT WXWINDOWS_SHARED_LIBRARY)
+ MESSAGE(STATUS
+ "No shared wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
+ ENDIF(NOT WXWINDOWS_SHARED_LIBRARY)
+ ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
+
+ #########################################################################################
+ ELSE(WXWINDOWS_USE_SHARED_LIBS)
+
+ ##jw: DEPRECATED IF(NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
+
+ ## static: both wx (debug and release) found?
+ ## assume that both builds use the same setup(.h) for simplicity
+ IF(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY)
+ ##MESSAGE("DBG wx static: debug and optimized found.")
+ FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
+ ${WXWINDOWS_ROOT_DIR}/lib/mswd
+ ${WXWINDOWS_ROOT_DIR}/lib/msw
+ ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd
+ ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw )
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY}
+ optimized ${WXWINDOWS_STATIC_LIBRARY} )
+ IF (WXWINDOWS_USE_GL)
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL}
+ optimized ${WXWINDOWS_STATIC_LIBRARY_GL} )
+ ENDIF (WXWINDOWS_USE_GL)
+ ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY)
+
+ ## static: only debug wx lib found?
+ IF(WXWINDOWS_STATIC_DEBUG_LIBRARY)
+ IF(NOT WXWINDOWS_STATIC_LIBRARY)
+ ##MESSAGE("DBG wx static: debug (but no optimized) found.")
+ FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
+ ${WXWINDOWS_ROOT_DIR}/lib/mswd
+ ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd )
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ ${WXWINDOWS_STATIC_DEBUG_LIBRARY} )
+ IF (WXWINDOWS_USE_GL)
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL} )
+ ENDIF (WXWINDOWS_USE_GL)
+ ENDIF(NOT WXWINDOWS_STATIC_LIBRARY)
+ ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY)
+
+ ## static: only release wx lib found?
+ IF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
+ IF(WXWINDOWS_STATIC_LIBRARY)
+ ##MESSAGE("DBG wx static: optimized (but no debug) found.")
+ FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
+ ${WXWINDOWS_ROOT_DIR}/lib/msw
+ ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw )
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ ${WXWINDOWS_STATIC_LIBRARY} )
+ IF (WXWINDOWS_USE_GL)
+ SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
+ ${WXWINDOWS_STATIC_LIBRARY_GL} )
+ ENDIF (WXWINDOWS_USE_GL)
+ ENDIF(WXWINDOWS_STATIC_LIBRARY)
+ ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
+
+ ## static: none found?
+ IF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
+ IF(NOT WXWINDOWS_STATIC_LIBRARY)
+ MESSAGE(STATUS
+ "No static wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
+ ENDIF(NOT WXWINDOWS_STATIC_LIBRARY)
+ ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
+ ENDIF(WXWINDOWS_USE_SHARED_LIBS)
+
+
+ ## not neccessary in wxWindows 2.4.1 and 2.6.2
+ ## but it may fix a previous bug, see
+ ## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap
+ OPTION(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF)
+ MARK_AS_ADVANCED(WXWINDOWS_SET_DEFINITIONS)
+ IF (WXWINDOWS_SET_DEFINITIONS)
+ SET(WXWINDOWS_DEFINITIONS "-DWINVER=0x400")
+ ELSE (WXWINDOWS_SET_DEFINITIONS)
+ # clear:
+ SET(WXWINDOWS_DEFINITIONS "")
+ ENDIF (WXWINDOWS_SET_DEFINITIONS)
+
+
+
+ ## Find the include directories for wxwindows
+ ## the first, build specific for wx/setup.h was determined before.
+ ## add inc dir for general for "wx/wx.h"
+ FIND_PATH(WXWINDOWS_INCLUDE_DIR wx/wx.h
+ "${WXWINDOWS_ROOT_DIR}/include" )
+ ## append the build specific include dir for wx/setup.h:
+ IF (WXWINDOWS_INCLUDE_DIR_SETUPH)
+ SET(WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} ${WXWINDOWS_INCLUDE_DIR_SETUPH} )
+ ENDIF (WXWINDOWS_INCLUDE_DIR_SETUPH)
+
+
+
+ MARK_AS_ADVANCED(
+ WXWINDOWS_ROOT_DIR
+ WXWINDOWS_INCLUDE_DIR
+ WXWINDOWS_INCLUDE_DIR_SETUPH
+ WXWINDOWS_STATIC_LIBRARY
+ WXWINDOWS_STATIC_LIBRARY_GL
+ WXWINDOWS_STATIC_DEBUG_LIBRARY
+ WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
+ WXWINDOWS_STATIC_LIBRARY_ZLIB
+ WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
+ WXWINDOWS_STATIC_LIBRARY_REGEX
+ WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
+ WXWINDOWS_STATIC_LIBRARY_PNG
+ WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
+ WXWINDOWS_STATIC_LIBRARY_JPEG
+ WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
+ WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
+ WXWINDOWS_STATIC_LIBRARY_TIFF
+ WXWINDOWS_SHARED_LIBRARY
+ WXWINDOWS_SHARED_DEBUG_LIBRARY
+ WXWINDOWS_SHARED_LIBRARY_GL
+ WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
+ )
+
+
+ELSE(WIN32_STYLE_FIND)
+
+ IF (UNIX_STYLE_FIND)
+ ## ######################################################################
+ ##
+ ## UNIX/Linux specific:
+ ##
+ ## use backquoted wx-config to query and set flags and libs:
+ ## 06/2003 Jan Woetzel
+ ##
+
+ OPTION(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON)
+ MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS)
+
+ # JW removed option and force the develper th SET it.
+ # OPTION(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional
+ # --gl-libs for wx-config)?" OFF)
+
+ # wx-config should be in your path anyhow, usually no need to set WXWIN or
+ # search in ../wx or ../../wx
+ FIND_PROGRAM(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE wx-config
+ $ENV{WXWIN}
+ $ENV{WXWIN}/bin
+ ../wx/bin
+ ../../wx/bin )
+
+ # check wether wx-config was found:
+ IF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
+
+ # use shared/static wx lib?
+ # remember: always link shared to use systems GL etc. libs (no static
+ # linking, just link *against* static .a libs)
+ IF(WXWINDOWS_USE_SHARED_LIBS)
+ SET(WX_CONFIG_ARGS_LIBS "--libs")
+ ELSE(WXWINDOWS_USE_SHARED_LIBS)
+ SET(WX_CONFIG_ARGS_LIBS "--static --libs")
+ ENDIF(WXWINDOWS_USE_SHARED_LIBS)
+
+ # do we need additionial wx GL stuff like GLCanvas ?
+ IF(WXWINDOWS_USE_GL)
+ SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" )
+ ENDIF(WXWINDOWS_USE_GL)
+ ##MESSAGE("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===")
+
+ # set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user:
+ IF (HAVE_ISYSTEM) # does the compiler support -isystem ?
+ IF (NOT APPLE) # -isystem seem sto be unsuppored on Mac
+ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX )
+ IF (CMAKE_CXX_COMPILER MATCHES g\\+\\+)
+ SET(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`")
+ ELSE(CMAKE_CXX_COMPILER MATCHES g\\+\\+)
+ SET(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`")
+ ENDIF(CMAKE_CXX_COMPILER MATCHES g\\+\\+)
+ ENDIF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX )
+ ENDIF (NOT APPLE)
+ ENDIF (HAVE_ISYSTEM)
+ ##MESSAGE("DBG: for compilation:
+ ##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===")
+
+ # keep the back-quoted string for clarity
+ SET(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`")
+ ##MESSAGE("DBG2: for linking:
+ ##WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}===")
+
+ # evaluate wx-config output to separate linker flags and linkdirs for
+ # rpath:
+ EXEC_PROGRAM(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE}
+ ARGS ${WX_CONFIG_ARGS_LIBS}
+ OUTPUT_VARIABLE WX_CONFIG_LIBS )
+
+ ## extract linkdirs (-L) for rpath
+ ## use regular expression to match wildcard equivalent "-L*<endchar>"
+ ## with <endchar> is a space or a semicolon
+ STRING(REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" )
+ # MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}")
+
+ ## remove prefix -L because we need the pure directory for LINK_DIRECTORIES
+ ## replace -L by ; because the separator seems to be lost otherwise (bug or
+ ## feature?)
+ IF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX)
+ STRING(REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX} )
+ # MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}")
+ ENDIF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX)
+
+
+ ## replace space separated string by semicolon separated vector to make it
+ ## work with LINK_DIRECTORIES
+ SEPARATE_ARGUMENTS(WXWINDOWS_LINK_DIRECTORIES)
+
+ MARK_AS_ADVANCED(
+ CMAKE_WXWINDOWS_CXX_FLAGS
+ WXWINDOWS_INCLUDE_DIR
+ WXWINDOWS_LIBRARIES
+ CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
+ )
+
+
+ ## we really need wx-config...
+ ELSE(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
+ MESSAGE(STATUS "Cannot find wx-config anywhere on the system. Please put the file into your path or specify it in CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE.")
+ MARK_AS_ADVANCED(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
+ ENDIF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
+
+
+
+ ELSE(UNIX_STYLE_FIND)
+ MESSAGE(STATUS "FindwxWindows.cmake: Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX")
+ ENDIF(UNIX_STYLE_FIND)
+ENDIF(WIN32_STYLE_FIND)
+
+
+IF(WXWINDOWS_LIBRARIES)
+ IF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS)
+ ## found all we need.
+ SET(WXWINDOWS_FOUND 1)
+
+ ## set deprecated variables for backward compatibility:
+ SET(CMAKE_WX_CAN_COMPILE ${WXWINDOWS_FOUND})
+ SET(WXWINDOWS_LIBRARY ${WXWINDOWS_LIBRARIES})
+ SET(WXWINDOWS_INCLUDE_PATH ${WXWINDOWS_INCLUDE_DIR})
+ SET(WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES})
+ SET(CMAKE_WX_CXX_FLAGS ${CMAKE_WXWINDOWS_CXX_FLAGS})
+
+ ENDIF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS)
+ENDIF(WXWINDOWS_LIBRARIES)
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
new file mode 100644
index 000000000..2455c5f8b
--- /dev/null
+++ b/Modules/FortranCInterface.cmake
@@ -0,0 +1,293 @@
+# - 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")
+# 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> ...])
+# 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()
+# 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_"
+# 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> ...
+# 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
+# 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_().
+#
+# Example usage:
+# 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.
+#
+# 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.)
+
+#=============================================================================
+# Copyright 2008-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.)
+
+#-----------------------------------------------------------------------------
+# Execute at most once in a project.
+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)
+
+#-----------------------------------------------------------------------------
+# Verify that C and Fortran are available.
+foreach(lang C Fortran)
+ if(NOT CMAKE_${lang}_COMPILER_LOADED)
+ message(FATAL_ERROR
+ "FortranCInterface requires the ${lang} language to be enabled.")
+ endif()
+endforeach()
+
+#-----------------------------------------------------------------------------
+set(FortranCInterface_SOURCE_DIR ${CMAKE_ROOT}/Modules/FortranCInterface)
+
+# MinGW's make tool does not always like () in the path
+if("${CMAKE_GENERATOR}" MATCHES "MinGW" AND
+ "${FortranCInterface_SOURCE_DIR}" MATCHES "[()]")
+ file(COPY ${FortranCInterface_SOURCE_DIR}/
+ DESTINATION ${CMAKE_BINARY_DIR}/CMakeFiles/FortranCInterfaceMinGW)
+ set(FortranCInterface_SOURCE_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/FortranCInterfaceMinGW)
+endif()
+
+# Create the interface detection project if it does not exist.
+if(NOT FortranCInterface_BINARY_DIR)
+ set(FortranCInterface_BINARY_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/FortranCInterface)
+ include(${FortranCInterface_SOURCE_DIR}/Detect.cmake)
+endif()
+
+# Load the detection results.
+include(${FortranCInterface_BINARY_DIR}/Output.cmake)
+
+#-----------------------------------------------------------------------------
+function(FortranCInterface_HEADER file)
+ # Parse arguments.
+ if(IS_ABSOLUTE "${file}")
+ set(FILE "${file}")
+ else()
+ set(FILE "${CMAKE_CURRENT_BINARY_DIR}/${file}")
+ endif()
+ set(MACRO_NAMESPACE "FortranCInterface_")
+ set(SYMBOL_NAMESPACE)
+ set(SYMBOLS)
+ set(doing)
+ foreach(arg ${ARGN})
+ if("x${arg}" MATCHES "^x(SYMBOLS|SYMBOL_NAMESPACE|MACRO_NAMESPACE)$")
+ set(doing "${arg}")
+ elseif("x${doing}" MATCHES "^x(SYMBOLS)$")
+ list(APPEND "${doing}" "${arg}")
+ elseif("x${doing}" MATCHES "^x(SYMBOL_NAMESPACE|MACRO_NAMESPACE)$")
+ set("${doing}" "${arg}")
+ set(doing)
+ else()
+ message(AUTHOR_WARNING "Unknown argument: \"${arg}\"")
+ endif()
+ endforeach()
+
+ # Generate macro definitions.
+ set(HEADER_CONTENT)
+ set(_desc_GLOBAL "/* Mangling for Fortran global symbols without underscores. */")
+ set(_desc_GLOBAL_ "/* Mangling for Fortran global symbols with underscores. */")
+ set(_desc_MODULE "/* Mangling for Fortran module symbols without underscores. */")
+ set(_desc_MODULE_ "/* Mangling for Fortran module symbols with underscores. */")
+ foreach(macro GLOBAL GLOBAL_ MODULE MODULE_)
+ if(FortranCInterface_${macro}_MACRO)
+ set(HEADER_CONTENT "${HEADER_CONTENT}
+${_desc_${macro}}
+#define ${MACRO_NAMESPACE}${macro}${FortranCInterface_${macro}_MACRO}
+")
+ endif()
+ endforeach()
+
+ # Generate symbol mangling definitions.
+ if(SYMBOLS)
+ set(HEADER_CONTENT "${HEADER_CONTENT}
+/*--------------------------------------------------------------------------*/
+/* Mangle some symbols automatically. */
+")
+ endif()
+ foreach(f ${SYMBOLS})
+ if("${f}" MATCHES ":")
+ # Module symbol name. Parse "<module>:<function>" syntax.
+ string(REPLACE ":" ";" pieces "${f}")
+ list(GET pieces 0 module)
+ list(GET pieces 1 function)
+ string(TOUPPER "${module}" m_upper)
+ string(TOLOWER "${module}" m_lower)
+ string(TOUPPER "${function}" f_upper)
+ string(TOLOWER "${function}" f_lower)
+ if("${function}" MATCHES "_")
+ set(form "_")
+ else()
+ set(form "")
+ endif()
+ if(FortranCInterface_MODULE${form}_MACRO)
+ set(HEADER_CONTENT "${HEADER_CONTENT}#define ${SYMBOL_NAMESPACE}${module}_${function} ${MACRO_NAMESPACE}MODULE${form}(${m_lower},${f_lower}, ${m_upper},${f_upper})\n")
+ else()
+ message(AUTHOR_WARNING "No FortranCInterface mangling known for ${f}")
+ endif()
+ else()
+ # Global symbol name.
+ if("${f}" MATCHES "_")
+ set(form "_")
+ else()
+ set(form "")
+ endif()
+ string(TOUPPER "${f}" f_upper)
+ string(TOLOWER "${f}" f_lower)
+ if(FortranCInterface_GLOBAL${form}_MACRO)
+ set(HEADER_CONTENT "${HEADER_CONTENT}#define ${SYMBOL_NAMESPACE}${f} ${MACRO_NAMESPACE}GLOBAL${form}(${f_lower}, ${f_upper})\n")
+ else()
+ message(AUTHOR_WARNING "No FortranCInterface mangling known for ${f}")
+ endif()
+ endif()
+ endforeach(f)
+
+ # Store the content.
+ configure_file(${FortranCInterface_SOURCE_DIR}/Macro.h.in ${FILE} @ONLY)
+endfunction()
+
+function(FortranCInterface_VERIFY)
+ # Check arguments.
+
+ set(lang C)
+ set(quiet 0)
+ set(verify_cxx 0)
+ foreach(arg ${ARGN})
+ if("${arg}" STREQUAL "QUIET")
+ set(quiet 1)
+ elseif("${arg}" STREQUAL "CXX")
+ set(lang CXX)
+ set(verify_cxx 1)
+ else()
+ message(FATAL_ERROR
+ "FortranCInterface_VERIFY - called with unknown argument:\n ${arg}")
+ endif()
+ endforeach()
+
+ if(NOT CMAKE_${lang}_COMPILER_LOADED)
+ message(FATAL_ERROR
+ "FortranCInterface_VERIFY(${lang}) requires ${lang} to be enabled.")
+ endif()
+
+ # Build the verification project if not yet built.
+ if(NOT DEFINED FortranCInterface_VERIFIED_${lang})
+ set(_desc "Verifying Fortran/${lang} Compiler Compatibility")
+ message(STATUS "${_desc}")
+
+ # Build a sample project which reports symbols.
+ try_compile(FortranCInterface_VERIFY_${lang}_COMPILED
+ ${FortranCInterface_BINARY_DIR}/Verify${lang}
+ ${FortranCInterface_SOURCE_DIR}/Verify
+ VerifyFortranC
+ CMAKE_FLAGS -DVERIFY_CXX=${verify_cxx}
+ -DCMAKE_VERBOSE_MAKEFILE=ON
+ "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
+ "-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}"
+ "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
+ OUTPUT_VARIABLE _output)
+ file(WRITE "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" "${_output}")
+
+ # Report results.
+ if(FortranCInterface_VERIFY_${lang}_COMPILED)
+ message(STATUS "${_desc} - Success")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "${_desc} passed with the following output:\n${_output}\n\n")
+ set(FortranCInterface_VERIFIED_${lang} 1 CACHE INTERNAL "Fortran/${lang} compatibility")
+ else()
+ message(STATUS "${_desc} - Failed")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "${_desc} failed with the following output:\n${_output}\n\n")
+ set(FortranCInterface_VERIFIED_${lang} 0 CACHE INTERNAL "Fortran/${lang} compatibility")
+ endif()
+ unset(FortranCInterface_VERIFY_${lang}_COMPILED CACHE)
+ endif()
+
+ # 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}")
+ message(FATAL_ERROR
+ "The Fortran compiler:\n ${CMAKE_Fortran_COMPILER}\n"
+ "and the ${lang} compiler:\n ${CMAKE_${lang}_COMPILER}\n"
+ "failed to compile a simple test project using both languages. "
+ "The output was:\n ${_output}")
+ endif()
+endfunction()
+
+# Restore including context policies.
+cmake_policy(POP)
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
new file mode 100644
index 000000000..d35a72ce8
--- /dev/null
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -0,0 +1,108 @@
+#=============================================================================
+# 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.
+#=============================================================================
+
+cmake_minimum_required(VERSION 2.6.3)
+project(FortranCInterface C Fortran)
+include(${FortranCInterface_BINARY_DIR}/Input.cmake OPTIONAL)
+
+# Check if the C compiler supports '$' in identifiers.
+include(CheckCSourceCompiles)
+check_c_source_compiles("
+extern int dollar$(void);
+int main() { return 0; }
+" C_SUPPORTS_DOLLAR)
+
+# List manglings of global symbol names to try.
+set(global_symbols
+ my_sub # VisualAge
+ my_sub_ # GNU, Intel, HP, SunPro, MIPSpro
+ my_sub__ # GNU g77
+ MY_SUB # Intel on Windows
+ mysub # VisualAge
+ mysub_ # GNU, Intel, HP, SunPro, MIPSpro
+ MYSUB # Intel on Windows
+ ${FortranCInterface_GLOBAL_SYMBOLS}
+ )
+list(REMOVE_DUPLICATES global_symbols)
+
+# List manglings of module symbol names to try.
+set(module_symbols
+ __my_module_MOD_my_sub # GNU 4.3
+ __my_module_NMOD_my_sub # VisualAge
+ __my_module__my_sub # GNU 4.2
+ __mymodule_MOD_mysub # GNU 4.3
+ __mymodule_NMOD_mysub # VisualAge
+ __mymodule__mysub # GNU 4.2
+ my_module$my_sub # HP
+ my_module_mp_my_sub_ # Intel
+ MY_MODULE_mp_MY_SUB # Intel on Windows
+ my_module_my_sub_ # PGI
+ my_module_MP_my_sub # NAG
+ mymodule$mysub # HP
+ mymodule_mp_mysub_ # Intel
+ MYMODULE_mp_MYSUB # Intel on Windows
+ mymodule_mysub_ # PGI
+ mymodule_MP_mysub # NAG
+ ${FortranCInterface_MODULE_SYMBOLS}
+ )
+list(REMOVE_DUPLICATES module_symbols)
+
+# Note that some compiler manglings cannot be invoked from C:
+# MIPSpro uses "MY_SUB.in.MY_MODULE"
+# SunPro uses "my_module.my_sub_"
+# PathScale uses "MY_SUB.in.MY_MODULE"
+
+# Add module symbols only with Fortran90.
+if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ set(myfort_modules mymodule.f90 my_module.f90)
+ set(call_mod call_mod.f90)
+ set_property(SOURCE main.F PROPERTY COMPILE_DEFINITIONS CALL_MOD)
+else()
+ set(module_symbols)
+endif()
+
+# Generate C symbol sources.
+set(symbol_sources)
+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:
+ # - PathScale Fortran uses module init symbols but module symbols
+ # use '.in.' so we cannot provide them anyway.
+ # - Cray Fortran >= 7.3.2 uses module init symbols but module symbols
+ # use 'mysub$mymodule_' so we cannot provide them anyway.
+ list(APPEND symbol_sources mymodule_.c my_module_.c)
+endif()
+foreach(symbol IN LISTS global_symbols module_symbols)
+ # Skip symbols with '$' if C cannot handle them.
+ if(C_SUPPORTS_DOLLAR OR NOT "${symbol}" MATCHES "\\$")
+ if("${symbol}" MATCHES "SUB")
+ set(upper "-UPPER")
+ else()
+ set(upper)
+ endif()
+ string(REPLACE "$" "S" name "${symbol}")
+ set(source ${CMAKE_CURRENT_BINARY_DIR}/symbols/${name}${upper}.c)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/symbol.c.in ${source} @ONLY)
+ list(APPEND symbol_sources ${source})
+ endif()
+endforeach()
+
+# Provide symbols through Fortran.
+add_library(myfort STATIC mysub.f my_sub.f ${myfort_modules})
+
+# Provide symbols through C but fall back to Fortran.
+add_library(symbols STATIC ${symbol_sources})
+target_link_libraries(symbols myfort)
+
+# Require symbols through Fortran.
+add_executable(FortranCInterface main.F call_sub.f ${call_mod})
+target_link_libraries(FortranCInterface symbols)
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
new file mode 100644
index 000000000..2ea43d132
--- /dev/null
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -0,0 +1,183 @@
+#=============================================================================
+# 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.
+#=============================================================================
+
+configure_file(${FortranCInterface_SOURCE_DIR}/Input.cmake.in
+ ${FortranCInterface_BINARY_DIR}/Input.cmake @ONLY)
+
+# Detect the Fortran/C interface on the first run or when the
+# configuration changes.
+if(${FortranCInterface_BINARY_DIR}/Input.cmake
+ IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
+ OR ${FortranCInterface_SOURCE_DIR}/Output.cmake.in
+ IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
+ OR ${FortranCInterface_SOURCE_DIR}/CMakeLists.txt
+ IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
+ OR ${CMAKE_CURRENT_LIST_FILE}
+ IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
+ )
+ message(STATUS "Detecting Fortran/C Interface")
+else()
+ return()
+endif()
+
+# Invalidate verification results.
+unset(FortranCInterface_VERIFIED_C CACHE)
+unset(FortranCInterface_VERIFIED_CXX CACHE)
+
+set(_result)
+
+# Build a sample project which reports symbols.
+try_compile(FortranCInterface_COMPILED
+ ${FortranCInterface_BINARY_DIR}
+ ${FortranCInterface_SOURCE_DIR}
+ FortranCInterface
+ CMAKE_FLAGS
+ "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
+ "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
+ OUTPUT_VARIABLE FortranCInterface_OUTPUT)
+set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED})
+unset(FortranCInterface_COMPILED CACHE)
+
+# Locate the sample project executable.
+if(FortranCInterface_COMPILED)
+ find_program(FortranCInterface_EXE
+ NAMES FortranCInterface
+ PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Debug
+ NO_DEFAULT_PATH
+ )
+ set(FortranCInterface_EXE ${FortranCInterface_EXE})
+ unset(FortranCInterface_EXE CACHE)
+else()
+ set(_result "Failed to compile")
+ set(FortranCInterface_EXE)
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Fortran/C interface test project failed with the following output:\n"
+ "${FortranCInterface_OUTPUT}\n")
+endif()
+
+# Load symbols from INFO:symbol[] strings in the executable.
+set(FortranCInterface_SYMBOLS)
+if(FortranCInterface_EXE)
+ file(STRINGS "${FortranCInterface_EXE}" _info_strings
+ LIMIT_COUNT 8 REGEX "INFO:[^[]*\\[")
+ foreach(info ${_info_strings})
+ if("${info}" MATCHES ".*INFO:symbol\\[([^]]*)\\].*")
+ string(REGEX REPLACE ".*INFO:symbol\\[([^]]*)\\].*" "\\1" symbol "${info}")
+ list(APPEND FortranCInterface_SYMBOLS ${symbol})
+ endif()
+ endforeach()
+elseif(NOT _result)
+ set(_result "Failed to load sample executable")
+endif()
+
+set(_case_mysub "LOWER")
+set(_case_my_sub "LOWER")
+set(_case_MYSUB "UPPER")
+set(_case_MY_SUB "UPPER")
+set(_global_regex "^(_*)(mysub|MYSUB)([_$]*)$")
+set(_global__regex "^(_*)(my_sub|MY_SUB)([_$]*)$")
+set(_module_regex "^(_*)(mymodule|MYMODULE)([A-Za-z_$]*)(mysub|MYSUB)([_$]*)$")
+set(_module__regex "^(_*)(my_module|MY_MODULE)([A-Za-z_$]*)(my_sub|MY_SUB)([_$]*)$")
+
+# Parse the symbol names.
+foreach(symbol ${FortranCInterface_SYMBOLS})
+ foreach(form "" "_")
+ # Look for global symbols.
+ string(REGEX REPLACE "${_global_${form}regex}"
+ "\\1;\\2;\\3" pieces "${symbol}")
+ list(LENGTH pieces len)
+ if(len EQUAL 3)
+ set(FortranCInterface_GLOBAL_${form}SYMBOL "${symbol}")
+ list(GET pieces 0 FortranCInterface_GLOBAL_${form}PREFIX)
+ list(GET pieces 1 name)
+ list(GET pieces 2 FortranCInterface_GLOBAL_${form}SUFFIX)
+ set(FortranCInterface_GLOBAL_${form}CASE "${_case_${name}}")
+ endif()
+
+ # Look for module symbols.
+ string(REGEX REPLACE "${_module_${form}regex}"
+ "\\1;\\2;\\3;\\4;\\5" pieces "${symbol}")
+ list(LENGTH pieces len)
+ if(len EQUAL 5)
+ set(FortranCInterface_MODULE_${form}SYMBOL "${symbol}")
+ list(GET pieces 0 FortranCInterface_MODULE_${form}PREFIX)
+ list(GET pieces 1 module)
+ list(GET pieces 2 FortranCInterface_MODULE_${form}MIDDLE)
+ list(GET pieces 3 name)
+ list(GET pieces 4 FortranCInterface_MODULE_${form}SUFFIX)
+ set(FortranCInterface_MODULE_${form}CASE "${_case_${name}}")
+ endif()
+ endforeach()
+endforeach()
+
+# Construct mangling macro definitions.
+set(_name_LOWER "name")
+set(_name_UPPER "NAME")
+foreach(form "" "_")
+ if(FortranCInterface_GLOBAL_${form}SYMBOL)
+ if(FortranCInterface_GLOBAL_${form}PREFIX)
+ set(_prefix "${FortranCInterface_GLOBAL_${form}PREFIX}##")
+ else()
+ set(_prefix "")
+ endif()
+ if(FortranCInterface_GLOBAL_${form}SUFFIX)
+ set(_suffix "##${FortranCInterface_GLOBAL_${form}SUFFIX}")
+ else()
+ set(_suffix "")
+ endif()
+ set(_name "${_name_${FortranCInterface_GLOBAL_${form}CASE}}")
+ set(FortranCInterface_GLOBAL${form}_MACRO
+ "(name,NAME) ${_prefix}${_name}${_suffix}")
+ endif()
+ if(FortranCInterface_MODULE_${form}SYMBOL)
+ if(FortranCInterface_MODULE_${form}PREFIX)
+ set(_prefix "${FortranCInterface_MODULE_${form}PREFIX}##")
+ else()
+ set(_prefix "")
+ endif()
+ if(FortranCInterface_MODULE_${form}SUFFIX)
+ set(_suffix "##${FortranCInterface_MODULE_${form}SUFFIX}")
+ else()
+ set(_suffix "")
+ endif()
+ set(_name "${_name_${FortranCInterface_MODULE_${form}CASE}}")
+ set(_middle "##${FortranCInterface_MODULE_${form}MIDDLE}##")
+ set(FortranCInterface_MODULE${form}_MACRO
+ "(mod_name,name, mod_NAME,NAME) ${_prefix}mod_${_name}${_middle}${_name}${_suffix}")
+ endif()
+endforeach()
+
+# Summarize what is available.
+foreach(scope GLOBAL MODULE)
+ if(FortranCInterface_${scope}_SYMBOL AND
+ FortranCInterface_${scope}__SYMBOL)
+ set(FortranCInterface_${scope}_FOUND 1)
+ else()
+ set(FortranCInterface_${scope}_FOUND 0)
+ endif()
+endforeach()
+
+# Record the detection results.
+configure_file(${FortranCInterface_SOURCE_DIR}/Output.cmake.in
+ ${FortranCInterface_BINARY_DIR}/Output.cmake @ONLY)
+file(APPEND ${FortranCInterface_BINARY_DIR}/Output.cmake "\n")
+
+# Report the results.
+if(FortranCInterface_GLOBAL_FOUND)
+ if(FortranCInterface_MODULE_FOUND)
+ set(_result "Found GLOBAL and MODULE mangling")
+ else(FortranCInterface_MODULE_FOUND)
+ set(_result "Found GLOBAL but not MODULE mangling")
+ endif()
+elseif(NOT _result)
+ set(_result "Failed to recognize symbols")
+endif()
+message(STATUS "Detecting Fortran/C Interface - ${_result}")
diff --git a/Modules/FortranCInterface/Input.cmake.in b/Modules/FortranCInterface/Input.cmake.in
new file mode 100644
index 000000000..f261e3b45
--- /dev/null
+++ b/Modules/FortranCInterface/Input.cmake.in
@@ -0,0 +1,3 @@
+set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@")
+set(FortranCInterface_GLOBAL_SYMBOLS "@FortranCInterface_GLOBAL_SYMBOLS@")
+set(FortranCInterface_MODULE_SYMBOLS "@FortranCInterface_MODULE_SYMBOLS@")
diff --git a/Modules/FortranCInterface/Macro.h.in b/Modules/FortranCInterface/Macro.h.in
new file mode 100644
index 000000000..d015a6239
--- /dev/null
+++ b/Modules/FortranCInterface/Macro.h.in
@@ -0,0 +1,4 @@
+#ifndef @MACRO_NAMESPACE@HEADER_INCLUDED
+#define @MACRO_NAMESPACE@HEADER_INCLUDED
+@HEADER_CONTENT@
+#endif
diff --git a/Modules/FortranCInterface/Output.cmake.in b/Modules/FortranCInterface/Output.cmake.in
new file mode 100644
index 000000000..bce410e76
--- /dev/null
+++ b/Modules/FortranCInterface/Output.cmake.in
@@ -0,0 +1,33 @@
+# Global symbol without underscore.
+set(FortranCInterface_GLOBAL_SYMBOL "@FortranCInterface_GLOBAL_SYMBOL@")
+set(FortranCInterface_GLOBAL_PREFIX "@FortranCInterface_GLOBAL_PREFIX@")
+set(FortranCInterface_GLOBAL_SUFFIX "@FortranCInterface_GLOBAL_SUFFIX@")
+set(FortranCInterface_GLOBAL_CASE "@FortranCInterface_GLOBAL_CASE@")
+set(FortranCInterface_GLOBAL_MACRO "@FortranCInterface_GLOBAL_MACRO@")
+
+# Global symbol with underscore.
+set(FortranCInterface_GLOBAL__SYMBOL "@FortranCInterface_GLOBAL__SYMBOL@")
+set(FortranCInterface_GLOBAL__PREFIX "@FortranCInterface_GLOBAL__PREFIX@")
+set(FortranCInterface_GLOBAL__SUFFIX "@FortranCInterface_GLOBAL__SUFFIX@")
+set(FortranCInterface_GLOBAL__CASE "@FortranCInterface_GLOBAL__CASE@")
+set(FortranCInterface_GLOBAL__MACRO "@FortranCInterface_GLOBAL__MACRO@")
+
+# Module symbol without underscore.
+set(FortranCInterface_MODULE_SYMBOL "@FortranCInterface_MODULE_SYMBOL@")
+set(FortranCInterface_MODULE_PREFIX "@FortranCInterface_MODULE_PREFIX@")
+set(FortranCInterface_MODULE_MIDDLE "@FortranCInterface_MODULE_MIDDLE@")
+set(FortranCInterface_MODULE_SUFFIX "@FortranCInterface_MODULE_SUFFIX@")
+set(FortranCInterface_MODULE_CASE "@FortranCInterface_MODULE_CASE@")
+set(FortranCInterface_MODULE_MACRO "@FortranCInterface_MODULE_MACRO@")
+
+# Module symbol with underscore.
+set(FortranCInterface_MODULE__SYMBOL "@FortranCInterface_MODULE__SYMBOL@")
+set(FortranCInterface_MODULE__PREFIX "@FortranCInterface_MODULE__PREFIX@")
+set(FortranCInterface_MODULE__MIDDLE "@FortranCInterface_MODULE__MIDDLE@")
+set(FortranCInterface_MODULE__SUFFIX "@FortranCInterface_MODULE__SUFFIX@")
+set(FortranCInterface_MODULE__CASE "@FortranCInterface_MODULE__CASE@")
+set(FortranCInterface_MODULE__MACRO "@FortranCInterface_MODULE__MACRO@")
+
+# Summarize what was found.
+set(FortranCInterface_GLOBAL_FOUND @FortranCInterface_GLOBAL_FOUND@)
+set(FortranCInterface_MODULE_FOUND @FortranCInterface_MODULE_FOUND@)
diff --git a/Modules/FortranCInterface/Verify/CMakeLists.txt b/Modules/FortranCInterface/Verify/CMakeLists.txt
new file mode 100644
index 000000000..e969f2408
--- /dev/null
+++ b/Modules/FortranCInterface/Verify/CMakeLists.txt
@@ -0,0 +1,34 @@
+#=============================================================================
+# 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.
+#=============================================================================
+
+cmake_minimum_required(VERSION 2.7)
+project(VerifyFortranC C Fortran)
+
+option(VERIFY_CXX "Whether to verify C++ and Fortran" OFF)
+if(VERIFY_CXX)
+ enable_language(CXX)
+ set(VerifyCXX VerifyCXX.cxx)
+ add_definitions(-DVERIFY_CXX)
+endif()
+
+include(FortranCInterface)
+
+FortranCInterface_HEADER(VerifyFortran.h SYMBOLS VerifyFortran)
+include_directories(${VerifyFortranC_BINARY_DIR})
+
+add_library(VerifyFortran STATIC VerifyFortran.f)
+add_executable(VerifyFortranC main.c VerifyC.c ${VerifyCXX})
+target_link_libraries(VerifyFortranC VerifyFortran)
+
+if(NOT VERIFY_CXX)
+ # The entry point (main) is defined in C; link with the C compiler.
+ set_property(TARGET VerifyFortranC PROPERTY LINKER_LANGUAGE C)
+endif()
diff --git a/Modules/FortranCInterface/Verify/VerifyC.c b/Modules/FortranCInterface/Verify/VerifyC.c
new file mode 100644
index 000000000..7f847ef01
--- /dev/null
+++ b/Modules/FortranCInterface/Verify/VerifyC.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+void VerifyC(void)
+{
+ printf("VerifyC\n");
+}
diff --git a/Modules/FortranCInterface/Verify/VerifyCXX.cxx b/Modules/FortranCInterface/Verify/VerifyCXX.cxx
new file mode 100644
index 000000000..689fac53d
--- /dev/null
+++ b/Modules/FortranCInterface/Verify/VerifyCXX.cxx
@@ -0,0 +1,4 @@
+extern "C" void VerifyCXX(void)
+{
+ delete new int;
+}
diff --git a/Modules/FortranCInterface/Verify/VerifyFortran.f b/Modules/FortranCInterface/Verify/VerifyFortran.f
new file mode 100644
index 000000000..a17e48d1b
--- /dev/null
+++ b/Modules/FortranCInterface/Verify/VerifyFortran.f
@@ -0,0 +1,3 @@
+ subroutine VerifyFortran
+ print *, 'VerifyFortran'
+ end
diff --git a/Modules/FortranCInterface/Verify/main.c b/Modules/FortranCInterface/Verify/main.c
new file mode 100644
index 000000000..582ef1d90
--- /dev/null
+++ b/Modules/FortranCInterface/Verify/main.c
@@ -0,0 +1,16 @@
+extern void VerifyC(void);
+#ifdef VERIFY_CXX
+extern void VerifyCXX(void);
+#endif
+#include "VerifyFortran.h"
+extern void VerifyFortran(void);
+
+int main(void)
+{
+ VerifyC();
+#ifdef VERIFY_CXX
+ VerifyCXX();
+#endif
+ VerifyFortran();
+ return 0;
+}
diff --git a/Modules/FortranCInterface/call_mod.f90 b/Modules/FortranCInterface/call_mod.f90
new file mode 100644
index 000000000..9b6af640e
--- /dev/null
+++ b/Modules/FortranCInterface/call_mod.f90
@@ -0,0 +1,6 @@
+subroutine call_mod
+ use mymodule
+ use my_module
+ call mysub()
+ call my_sub()
+end subroutine call_mod
diff --git a/Modules/FortranCInterface/call_sub.f b/Modules/FortranCInterface/call_sub.f
new file mode 100644
index 000000000..ce3d50b14
--- /dev/null
+++ b/Modules/FortranCInterface/call_sub.f
@@ -0,0 +1,4 @@
+ subroutine call_sub
+ call mysub()
+ call my_sub()
+ end
diff --git a/Modules/FortranCInterface/main.F b/Modules/FortranCInterface/main.F
new file mode 100644
index 000000000..84991b0ee
--- /dev/null
+++ b/Modules/FortranCInterface/main.F
@@ -0,0 +1,6 @@
+ program main
+ call call_sub()
+#ifdef CALL_MOD
+ call call_mod()
+#endif
+ end
diff --git a/Modules/FortranCInterface/my_module.f90 b/Modules/FortranCInterface/my_module.f90
new file mode 100644
index 000000000..82713b43e
--- /dev/null
+++ b/Modules/FortranCInterface/my_module.f90
@@ -0,0 +1,8 @@
+module my_module
+ interface my_interface
+ module procedure my_sub
+ end interface
+contains
+ subroutine my_sub
+ end subroutine my_sub
+end module my_module
diff --git a/Modules/FortranCInterface/my_module_.c b/Modules/FortranCInterface/my_module_.c
new file mode 100644
index 000000000..6510ae977
--- /dev/null
+++ b/Modules/FortranCInterface/my_module_.c
@@ -0,0 +1 @@
+void my_module_(void) {}
diff --git a/Modules/FortranCInterface/my_sub.f b/Modules/FortranCInterface/my_sub.f
new file mode 100644
index 000000000..247ba0678
--- /dev/null
+++ b/Modules/FortranCInterface/my_sub.f
@@ -0,0 +1,2 @@
+ subroutine my_sub
+ end
diff --git a/Modules/FortranCInterface/mymodule.f90 b/Modules/FortranCInterface/mymodule.f90
new file mode 100644
index 000000000..ef6281a3f
--- /dev/null
+++ b/Modules/FortranCInterface/mymodule.f90
@@ -0,0 +1,8 @@
+module mymodule
+ interface myinterface
+ module procedure mysub
+ end interface
+contains
+ subroutine mysub
+ end subroutine mysub
+end module mymodule
diff --git a/Modules/FortranCInterface/mymodule_.c b/Modules/FortranCInterface/mymodule_.c
new file mode 100644
index 000000000..52706058e
--- /dev/null
+++ b/Modules/FortranCInterface/mymodule_.c
@@ -0,0 +1 @@
+void mymodule_(void) {}
diff --git a/Modules/FortranCInterface/mysub.f b/Modules/FortranCInterface/mysub.f
new file mode 100644
index 000000000..1c27ff452
--- /dev/null
+++ b/Modules/FortranCInterface/mysub.f
@@ -0,0 +1,2 @@
+ subroutine mysub
+ end
diff --git a/Modules/FortranCInterface/symbol.c.in b/Modules/FortranCInterface/symbol.c.in
new file mode 100644
index 000000000..369fa4597
--- /dev/null
+++ b/Modules/FortranCInterface/symbol.c.in
@@ -0,0 +1,4 @@
+const char* @symbol@(void)
+{
+ return "INFO:symbol[@symbol@]";
+}
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
new file mode 100644
index 000000000..0302e4bef
--- /dev/null
+++ b/Modules/GNUInstallDirs.cmake
@@ -0,0 +1,188 @@
+# - 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
+# 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.
+
+#=============================================================================
+# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
+# Copyright 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.)
+
+# Installation directories
+#
+if(NOT DEFINED CMAKE_INSTALL_BINDIR)
+ set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
+ set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
+ set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
+ set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
+ set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
+endif()
+
+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)
+ set(_LIBDIR_DEFAULT "lib")
+ # Override this default 'lib' with 'lib64' iff:
+ # - we are on Linux system but NOT cross-compiling
+ # - we are NOT on debian
+ # - we are on a 64 bits system
+ # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
+ # For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
+ # CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
+ # See http://wiki.debian.org/Multiarch
+ if(CMAKE_SYSTEM_NAME MATCHES "Linux"
+ 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()
+ else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
+ if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
+ message(AUTHOR_WARNING
+ "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
+ "Please enable at least one language before including GNUInstallDirs.")
+ else()
+ if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+ set(_LIBDIR_DEFAULT "lib64")
+ endif()
+ endif()
+ endif()
+ endif()
+ set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
+ set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
+ set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
+endif()
+
+if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
+ set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
+endif()
+
+#-----------------------------------------------------------------------------
+# Values whose defaults are relative to DATAROOTDIR. Store empty values in
+# the cache and store the defaults in local variables if the cache values are
+# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
+
+if(NOT CMAKE_INSTALL_DATADIR)
+ set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
+ 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")
+endif()
+
+if(NOT CMAKE_INSTALL_LOCALEDIR)
+ set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
+ 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}")
+endif()
+
+#-----------------------------------------------------------------------------
+
+mark_as_advanced(
+ CMAKE_INSTALL_BINDIR
+ CMAKE_INSTALL_SBINDIR
+ CMAKE_INSTALL_LIBEXECDIR
+ CMAKE_INSTALL_SYSCONFDIR
+ CMAKE_INSTALL_SHAREDSTATEDIR
+ CMAKE_INSTALL_LOCALSTATEDIR
+ CMAKE_INSTALL_LIBDIR
+ CMAKE_INSTALL_INCLUDEDIR
+ CMAKE_INSTALL_OLDINCLUDEDIR
+ CMAKE_INSTALL_DATAROOTDIR
+ CMAKE_INSTALL_DATADIR
+ CMAKE_INSTALL_INFODIR
+ CMAKE_INSTALL_LOCALEDIR
+ CMAKE_INSTALL_MANDIR
+ CMAKE_INSTALL_DOCDIR
+ )
+
+# Result directories
+#
+foreach(dir
+ BINDIR
+ SBINDIR
+ LIBEXECDIR
+ SYSCONFDIR
+ SHAREDSTATEDIR
+ LOCALSTATEDIR
+ LIBDIR
+ INCLUDEDIR
+ OLDINCLUDEDIR
+ DATAROOTDIR
+ DATADIR
+ INFODIR
+ LOCALEDIR
+ MANDIR
+ DOCDIR
+ )
+ if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ else()
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
+ endif()
+endforeach()
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
new file mode 100644
index 000000000..ce23d5d25
--- /dev/null
+++ b/Modules/GenerateExportHeader.cmake
@@ -0,0 +1,351 @@
+# - 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}
+# )
+#
+# And in the ABI header files:
+#
+# #include "somelib_export.h"
+# class SOMELIB_EXPORT SomeClass {
+# ...
+# };
+#
+# The CMake fragment will generate a file in the ${CMAKE_CURRENT_BUILD_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.
+#
+# 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
+# )
+#
+# 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:
+#
+# 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.
+#
+# add_library(somelib someclass.cpp)
+# generate_export_header(somelib
+# DEPRECATED_MACRO_NAME KDE_DEPRECATED
+# )
+#
+# creates the macro KDE_DEPRECATED instead of SOMELIB_DEPRECATED.
+#
+# If LIBRARY_TARGET is a static library, macros are defined without values.
+#
+# If the same sources are used to create both a shared and a static library, the
+# uppercased symbol ${BASE_NAME}_STATIC_DEFINE should be used when building the
+# static library
+#
+# add_library(shared_variant SHARED ${lib_SRCS})
+# add_library(static_variant ${lib_SRCS})
+# generate_export_header(shared_variant BASE_NAME libshared_and_static)
+# set_target_properties(static_variant PROPERTIES
+# COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE)
+#
+# This will cause the export macros to expand to nothing when building the
+# static library.
+#
+# If DEFINE_NO_DEPRECATED is specified, then a macro ${BASE_NAME}_NO_DEPRECATED
+# will be defined
+# This macro can be used to remove deprecated code from preprocessor output.
+#
+# 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
+# };
+#
+# #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_)
+#
+# Generates the macros VTK_SOMELIB_EXPORT etc.
+
+#=============================================================================
+# Copyright 2011 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(CMakeParseArguments)
+include(CheckCXXCompilerFlag)
+
+# TODO: Install this macro separately?
+macro(_check_cxx_compiler_attribute _ATTRIBUTE _RESULT)
+ check_cxx_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; }
+ int main() { return somefunc();}" ${_RESULT}
+ )
+endmacro()
+
+macro(_test_compiler_hidden_visibility)
+
+ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2")
+ set(GCC_TOO_OLD TRUE)
+ message(WARNING "GCC version older than 4.2")
+ elseif(CMAKE_COMPILER_IS_GNUC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2")
+ set(GCC_TOO_OLD TRUE)
+ message(WARNING "GCC version older than 4.2")
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0")
+ set(_INTEL_TOO_OLD TRUE)
+ message(WARNING "Intel compiler older than 12.0")
+ endif()
+
+
+ # 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)
+ check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
+ check_cxx_compiler_flag(-fvisibility-inlines-hidden
+ COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
+ option(USE_COMPILER_HIDDEN_VISIBILITY
+ "Use HIDDEN visibility support if available." ON)
+ mark_as_advanced(USE_COMPILER_HIDDEN_VISIBILITY)
+ endif()
+endmacro()
+
+macro(_test_compiler_has_deprecated)
+ if("${CMAKE_CXX_COMPILER_ID}" MATCHES Borland
+ 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)
+ set(COMPILER_HAS_DEPRECATED "" CACHE INTERNAL
+ "Compiler support for a deprecated attribute")
+ else()
+ _check_cxx_compiler_attribute("__attribute__((__deprecated__))"
+ COMPILER_HAS_DEPRECATED_ATTR)
+ if(COMPILER_HAS_DEPRECATED_ATTR)
+ set(COMPILER_HAS_DEPRECATED "${COMPILER_HAS_DEPRECATED_ATTR}"
+ CACHE INTERNAL "Compiler support for a deprecated attribute")
+ else()
+ _check_cxx_compiler_attribute("__declspec(deprecated)"
+ COMPILER_HAS_DEPRECATED)
+ endif()
+ endif()
+endmacro()
+
+get_filename_component(_GENERATE_EXPORT_HEADER_MODULE_DIR
+ "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY)
+ set(DEFINE_DEPRECATED)
+ set(DEFINE_EXPORT)
+ set(DEFINE_IMPORT)
+ set(DEFINE_NO_EXPORT)
+
+ if (COMPILER_HAS_DEPRECATED_ATTR)
+ set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))")
+ elseif(COMPILER_HAS_DEPRECATED)
+ set(DEFINE_DEPRECATED "__declspec(deprecated)")
+ endif()
+
+ get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
+
+ if(NOT ${type} STREQUAL "STATIC_LIBRARY")
+ if(WIN32)
+ set(DEFINE_EXPORT "__declspec(dllexport)")
+ set(DEFINE_IMPORT "__declspec(dllimport)")
+ elseif(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY)
+ set(DEFINE_EXPORT "__attribute__((visibility(\"default\")))")
+ set(DEFINE_IMPORT "__attribute__((visibility(\"default\")))")
+ set(DEFINE_NO_EXPORT "__attribute__((visibility(\"hidden\")))")
+ endif()
+ endif()
+endmacro()
+
+macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
+ # Option overrides
+ set(options DEFINE_NO_DEPRECATED)
+ set(oneValueArgs PREFIX_NAME BASE_NAME EXPORT_MACRO_NAME EXPORT_FILE_NAME
+ DEPRECATED_MACRO_NAME NO_EXPORT_MACRO_NAME STATIC_DEFINE
+ NO_DEPRECATED_MACRO_NAME)
+ set(multiValueArgs)
+
+ cmake_parse_arguments(_GEH "${options}" "${oneValueArgs}" "${multiValueArgs}"
+ ${ARGN})
+
+ set(BASE_NAME "${TARGET_LIBRARY}")
+
+ if(_GEH_BASE_NAME)
+ set(BASE_NAME ${_GEH_BASE_NAME})
+ endif()
+
+ string(TOUPPER ${BASE_NAME} BASE_NAME_UPPER)
+ string(TOLOWER ${BASE_NAME} BASE_NAME_LOWER)
+
+ # Default options
+ set(EXPORT_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_EXPORT")
+ set(NO_EXPORT_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_NO_EXPORT")
+ set(EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${BASE_NAME_LOWER}_export.h")
+ set(DEPRECATED_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_DEPRECATED")
+ set(STATIC_DEFINE "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_STATIC_DEFINE")
+ set(NO_DEPRECATED_MACRO_NAME
+ "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_NO_DEPRECATED")
+
+ if(_GEH_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown keywords given to GENERATE_EXPORT_HEADER(): \"${_GEH_UNPARSED_ARGUMENTS}\"")
+ endif()
+
+ if(_GEH_EXPORT_MACRO_NAME)
+ set(EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_EXPORT_MACRO_NAME})
+ endif()
+ if(_GEH_EXPORT_FILE_NAME)
+ if(IS_ABSOLUTE ${_GEH_EXPORT_FILE_NAME})
+ set(EXPORT_FILE_NAME ${_GEH_EXPORT_FILE_NAME})
+ else()
+ set(EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${_GEH_EXPORT_FILE_NAME}")
+ endif()
+ endif()
+ if(_GEH_DEPRECATED_MACRO_NAME)
+ set(DEPRECATED_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_DEPRECATED_MACRO_NAME})
+ endif()
+ if(_GEH_NO_EXPORT_MACRO_NAME)
+ set(NO_EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_NO_EXPORT_MACRO_NAME})
+ endif()
+ if(_GEH_STATIC_DEFINE)
+ set(STATIC_DEFINE ${_GEH_PREFIX_NAME}${_GEH_STATIC_DEFINE})
+ endif()
+
+ if(_GEH_DEFINE_NO_DEPRECATED)
+ set(DEFINE_NO_DEPRECATED TRUE)
+ endif()
+
+ if(_GEH_NO_DEPRECATED_MACRO_NAME)
+ set(NO_DEPRECATED_MACRO_NAME
+ ${_GEH_PREFIX_NAME}${_GEH_NO_DEPRECATED_MACRO_NAME})
+ endif()
+
+ set(INCLUDE_GUARD_NAME "${EXPORT_MACRO_NAME}_H")
+
+ get_target_property(EXPORT_IMPORT_CONDITION ${TARGET_LIBRARY} DEFINE_SYMBOL)
+
+ if(NOT EXPORT_IMPORT_CONDITION)
+ set(EXPORT_IMPORT_CONDITION ${TARGET_LIBRARY}_EXPORTS)
+ endif()
+
+ configure_file("${_GENERATE_EXPORT_HEADER_MODULE_DIR}/exportheader.cmake.in"
+ "${EXPORT_FILE_NAME}" @ONLY)
+endmacro()
+
+function(GENERATE_EXPORT_HEADER TARGET_LIBRARY)
+ get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
+ if(${type} STREQUAL "MODULE")
+ message(WARNING "This macro should not be used with libraries of type MODULE")
+ return()
+ endif()
+ if(NOT ${type} STREQUAL "STATIC_LIBRARY" AND NOT ${type} STREQUAL "SHARED_LIBRARY")
+ message(WARNING "This macro can only be used with libraries")
+ return()
+ endif()
+ _test_compiler_hidden_visibility()
+ _test_compiler_has_deprecated()
+ _do_set_macro_values(${TARGET_LIBRARY})
+ _do_generate_export_header(${TARGET_LIBRARY} ${ARGN})
+endfunction()
+
+function(add_compiler_export_flags)
+
+ _test_compiler_hidden_visibility()
+ _test_compiler_has_deprecated()
+
+ if(NOT (USE_COMPILER_HIDDEN_VISIBILITY AND COMPILER_HAS_HIDDEN_VISIBILITY))
+ # Just return if there are no flags to add.
+ return()
+ endif()
+
+ set (EXTRA_FLAGS "-fvisibility=hidden")
+
+ if(COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
+ set (EXTRA_FLAGS "${EXTRA_FLAGS} -fvisibility-inlines-hidden")
+ endif()
+
+ # Either return the extra flags needed in the supplied argument, or to the
+ # CMAKE_CXX_FLAGS if no argument is supplied.
+ if(ARGV0)
+ set(${ARGV0} "${EXTRA_FLAGS}" PARENT_SCOPE)
+ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}" PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
new file mode 100644
index 000000000..d215685dd
--- /dev/null
+++ b/Modules/GetPrerequisites.cmake
@@ -0,0 +1,877 @@
+# - 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)
+# 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
+# prerequisites will be found recursively, if set to 0 only direct
+# prerequisites are listed. <exclude_system> must be 0 or 1 indicating whether
+# to include or exclude "system" prerequisites. With <verbose> set to 0 only
+# the full path names of the prerequisites are printed, set to 1 extra
+# informatin will be displayed.
+#
+# LIST_PREREQUISITES_BY_GLOB(<glob_arg> <glob_exp>)
+# Print the prerequisites of shared library and executable files matching a
+# globbing pattern. <glob_arg> is GLOB or GLOB_RECURSE and <glob_exp> is a
+# globbing expression used with "file(GLOB" or "file(GLOB_RECURSE" to retrieve
+# a list of matching files. If a matching file is executable, its prerequisites
+# are listed.
+#
+# Any additional (optional) arguments provided are passed along as the
+# optional arguments to the list_prerequisites calls.
+#
+# GP_APPEND_UNIQUE(<list_var> <value>)
+# Append <value> to the list variable <list_var> only if the value is not
+# already in the list.
+#
+# IS_FILE_EXECUTABLE(<file> <result_var>)
+# Return 1 in <result_var> if <file> is a binary executable, 0 otherwise.
+#
+# GP_ITEM_DEFAULT_EMBEDDED_PATH(<item> <default_embedded_path_var>)
+# Return the path that others should refer to the item by when the item
+# is embedded inside a bundle.
+#
+# Override on a per-project basis by providing a project-specific
+# gp_item_default_embedded_path_override function.
+#
+# GP_RESOLVE_ITEM(<context> <item> <exepath> <dirs> <resolved_item_var>)
+# 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>.
+#
+# Use <exepath> and <dirs> if necessary to resolve non-absolute <file>
+# values -- but only for non-embedded items.
+#
+# Possible types are:
+# system
+# local
+# embedded
+# other
+# Override on a per-project basis by providing a project-specific
+# gp_resolved_file_type_override function.
+#
+# GP_FILE_TYPE(<original_file> <file> <type_var>)
+# Return the type of <file> with respect to <original_file>. String
+# describing type of prerequisite is returned in variable named <type_var>.
+#
+# Possible types are:
+# system
+# local
+# embedded
+# other
+
+#=============================================================================
+# Copyright 2008-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.)
+
+function(gp_append_unique list_var value)
+ set(contains 0)
+
+ foreach(item ${${list_var}})
+ if("${item}" STREQUAL "${value}")
+ set(contains 1)
+ break()
+ endif("${item}" STREQUAL "${value}")
+ endforeach(item)
+
+ if(NOT contains)
+ set(${list_var} ${${list_var}} "${value}" PARENT_SCOPE)
+ endif(NOT contains)
+endfunction(gp_append_unique)
+
+
+function(is_file_executable file result_var)
+ #
+ # A file is not executable until proven otherwise:
+ #
+ set(${result_var} 0 PARENT_SCOPE)
+
+ get_filename_component(file_full "${file}" ABSOLUTE)
+ string(TOLOWER "${file_full}" file_full_lower)
+
+ # If file name ends in .exe on Windows, *assume* executable:
+ #
+ if(WIN32 AND NOT UNIX)
+ if("${file_full_lower}" MATCHES "\\.exe$")
+ set(${result_var} 1 PARENT_SCOPE)
+ return()
+ endif("${file_full_lower}" MATCHES "\\.exe$")
+
+ # A clause could be added here that uses output or return value of dumpbin
+ # to determine ${result_var}. In 99%+? practical cases, the exe name
+ # match will be sufficient...
+ #
+ endif(WIN32 AND NOT UNIX)
+
+ # Use the information returned from the Unix shell command "file" to
+ # determine if ${file_full} should be considered an executable file...
+ #
+ # If the file command's output contains "executable" and does *not* contain
+ # "text" then it is likely an executable suitable for prerequisite analysis
+ # via the get_prerequisites macro.
+ #
+ if(UNIX)
+ if(NOT file_cmd)
+ find_program(file_cmd "file")
+ endif(NOT file_cmd)
+
+ if(file_cmd)
+ execute_process(COMMAND "${file_cmd}" "${file_full}"
+ OUTPUT_VARIABLE file_ov
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ # 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
+ # the file contains the word "text" or "executable" we are not fooled
+ # into thinking "the wrong thing" because the file name matches the
+ # other 'file' command output we are looking for...
+ #
+ string(REPLACE "${file_full}" " _file_full_ " file_ov "${file_ov}")
+ string(TOLOWER "${file_ov}" file_ov)
+
+ #message(STATUS "file_ov='${file_ov}'")
+ if("${file_ov}" MATCHES "executable")
+ #message(STATUS "executable!")
+ if("${file_ov}" MATCHES "text")
+ #message(STATUS "but text, so *not* a binary executable!")
+ else("${file_ov}" MATCHES "text")
+ set(${result_var} 1 PARENT_SCOPE)
+ return()
+ endif("${file_ov}" MATCHES "text")
+ endif("${file_ov}" MATCHES "executable")
+
+ # Also detect position independent executables on Linux,
+ # where "file" gives "shared object ... (uses shared libraries)"
+ if("${file_ov}" MATCHES "shared object.*\(uses shared libs\)")
+ set(${result_var} 1 PARENT_SCOPE)
+ return()
+ endif()
+
+ else(file_cmd)
+ message(STATUS "warning: No 'file' command, skipping execute_process...")
+ endif(file_cmd)
+ endif(UNIX)
+endfunction(is_file_executable)
+
+
+function(gp_item_default_embedded_path item default_embedded_path_var)
+
+ # On Windows and Linux, "embed" prerequisites in the same directory
+ # as the executable by default:
+ #
+ set(path "@executable_path")
+ set(overridden 0)
+
+ # On the Mac, relative to the executable depending on the type
+ # of the thing we are embedding:
+ #
+ if(APPLE)
+ #
+ # The assumption here is that all executables in the bundle will be
+ # in same-level-directories inside the bundle. The parent directory
+ # of an executable inside the bundle should be MacOS or a sibling of
+ # MacOS and all embedded paths returned from here will begin with
+ # "@executable_path/../" and will work from all executables in all
+ # such same-level-directories inside the bundle.
+ #
+
+ # By default, embed things right next to the main bundle executable:
+ #
+ set(path "@executable_path/../../Contents/MacOS")
+
+ # Embed .dylibs right next to the main bundle executable:
+ #
+ if(item MATCHES "\\.dylib$")
+ set(path "@executable_path/../MacOS")
+ set(overridden 1)
+ endif(item MATCHES "\\.dylib$")
+
+ # Embed frameworks in the embedded "Frameworks" directory (sibling of MacOS):
+ #
+ if(NOT overridden)
+ if(item MATCHES "[^/]+\\.framework/")
+ set(path "@executable_path/../Frameworks")
+ set(overridden 1)
+ endif(item MATCHES "[^/]+\\.framework/")
+ endif(NOT overridden)
+ endif()
+
+ # Provide a hook so that projects can override the default embedded location
+ # of any given library by whatever logic they choose:
+ #
+ if(COMMAND gp_item_default_embedded_path_override)
+ gp_item_default_embedded_path_override("${item}" path)
+ endif(COMMAND gp_item_default_embedded_path_override)
+
+ set(${default_embedded_path_var} "${path}" PARENT_SCOPE)
+endfunction(gp_item_default_embedded_path)
+
+
+function(gp_resolve_item context item exepath dirs resolved_item_var)
+ set(resolved 0)
+ set(resolved_item "${item}")
+
+ # Is it already resolved?
+ #
+ if(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}")
+ set(resolved 1)
+ endif(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}")
+
+ if(NOT resolved)
+ if(item MATCHES "@executable_path")
+ #
+ # @executable_path references are assumed relative to exepath
+ #
+ string(REPLACE "@executable_path" "${exepath}" ri "${item}")
+ get_filename_component(ri "${ri}" ABSOLUTE)
+
+ if(EXISTS "${ri}")
+ #message(STATUS "info: embedded item exists (${ri})")
+ set(resolved 1)
+ set(resolved_item "${ri}")
+ else(EXISTS "${ri}")
+ message(STATUS "warning: embedded item does not exist '${ri}'")
+ endif(EXISTS "${ri}")
+ endif(item MATCHES "@executable_path")
+ endif(NOT resolved)
+
+ if(NOT resolved)
+ if(item MATCHES "@loader_path")
+ #
+ # @loader_path references are assumed relative to the
+ # PATH of the given "context" (presumably another library)
+ #
+ get_filename_component(contextpath "${context}" PATH)
+ string(REPLACE "@loader_path" "${contextpath}" ri "${item}")
+ get_filename_component(ri "${ri}" ABSOLUTE)
+
+ if(EXISTS "${ri}")
+ #message(STATUS "info: embedded item exists (${ri})")
+ set(resolved 1)
+ set(resolved_item "${ri}")
+ else(EXISTS "${ri}")
+ message(STATUS "warning: embedded item does not exist '${ri}'")
+ endif(EXISTS "${ri}")
+ endif(item MATCHES "@loader_path")
+ endif(NOT resolved)
+
+ if(NOT resolved)
+ 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
+ #
+ string(REPLACE "@rpath/" "" norpath_item "${item}")
+
+ set(ri "ri-NOTFOUND")
+ find_file(ri "${norpath_item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
+ if(ri)
+ #message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
+ set(resolved 1)
+ set(resolved_item "${ri}")
+ set(ri "ri-NOTFOUND")
+ endif(ri)
+
+ endif(item MATCHES "@rpath")
+ endif(NOT resolved)
+
+ if(NOT resolved)
+ set(ri "ri-NOTFOUND")
+ find_file(ri "${item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
+ find_file(ri "${item}" ${exepath} ${dirs} /usr/lib)
+ if(ri)
+ #message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
+ set(resolved 1)
+ set(resolved_item "${ri}")
+ set(ri "ri-NOTFOUND")
+ endif(ri)
+ endif(NOT resolved)
+
+ if(NOT resolved)
+ if(item MATCHES "[^/]+\\.framework/")
+ set(fw "fw-NOTFOUND")
+ find_file(fw "${item}"
+ "~/Library/Frameworks"
+ "/Library/Frameworks"
+ "/System/Library/Frameworks"
+ )
+ if(fw)
+ #message(STATUS "info: 'find_file' found framework (${fw})")
+ set(resolved 1)
+ set(resolved_item "${fw}")
+ set(fw "fw-NOTFOUND")
+ endif(fw)
+ endif(item MATCHES "[^/]+\\.framework/")
+ endif(NOT resolved)
+
+ # Using find_program on Windows will find dll files that are in the PATH.
+ # (Converting simple file names into full path names if found.)
+ #
+ if(WIN32 AND NOT UNIX)
+ if(NOT resolved)
+ set(ri "ri-NOTFOUND")
+ find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH)
+ find_program(ri "${item}" PATHS "${exepath};${dirs}")
+ if(ri)
+ #message(STATUS "info: 'find_program' in exepath/dirs (${ri})")
+ set(resolved 1)
+ set(resolved_item "${ri}")
+ set(ri "ri-NOTFOUND")
+ endif(ri)
+ endif(NOT resolved)
+ endif(WIN32 AND NOT UNIX)
+
+ # Provide a hook so that projects can override item resolution
+ # by whatever logic they choose:
+ #
+ if(COMMAND gp_resolve_item_override)
+ gp_resolve_item_override("${context}" "${item}" "${exepath}" "${dirs}" resolved_item resolved)
+ endif(COMMAND gp_resolve_item_override)
+
+ if(NOT resolved)
+ message(STATUS "
+warning: cannot resolve item '${item}'
+
+ possible problems:
+ need more directories?
+ need to use InstallRequiredSystemLibraries?
+ run in install tree instead of build tree?
+")
+# message(STATUS "
+#******************************************************************************
+#warning: cannot resolve item '${item}'
+#
+# possible problems:
+# need more directories?
+# need to use InstallRequiredSystemLibraries?
+# run in install tree instead of build tree?
+#
+# context='${context}'
+# item='${item}'
+# exepath='${exepath}'
+# dirs='${dirs}'
+# resolved_item_var='${resolved_item_var}'
+#******************************************************************************
+#")
+ endif(NOT resolved)
+
+ set(${resolved_item_var} "${resolved_item}" PARENT_SCOPE)
+endfunction(gp_resolve_item)
+
+
+function(gp_resolved_file_type original_file file exepath dirs type_var)
+ #message(STATUS "**")
+
+ if(NOT IS_ABSOLUTE "${original_file}")
+ message(STATUS "warning: gp_resolved_file_type expects absolute full path for first arg original_file")
+ endif()
+
+ set(is_embedded 0)
+ set(is_local 0)
+ set(is_system 0)
+
+ set(resolved_file "${file}")
+
+ if("${file}" MATCHES "^@(executable|loader)_path")
+ set(is_embedded 1)
+ endif()
+
+ if(NOT is_embedded)
+ if(NOT IS_ABSOLUTE "${file}")
+ gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file)
+ endif()
+
+ string(TOLOWER "${original_file}" original_lower)
+ string(TOLOWER "${resolved_file}" lower)
+
+ if(UNIX)
+ if(resolved_file MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/|/usr/bin/)")
+ set(is_system 1)
+ endif()
+ endif()
+
+ if(APPLE)
+ if(resolved_file MATCHES "^(/System/Library/|/usr/lib/)")
+ set(is_system 1)
+ endif()
+ endif()
+
+ if(WIN32)
+ string(TOLOWER "$ENV{SystemRoot}" sysroot)
+ string(REGEX REPLACE "\\\\" "/" sysroot "${sysroot}")
+
+ string(TOLOWER "$ENV{windir}" windir)
+ string(REGEX REPLACE "\\\\" "/" windir "${windir}")
+
+ if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
+ set(is_system 1)
+ endif()
+
+ if(UNIX)
+ # if cygwin, we can get the properly formed windows paths from cygpath
+ find_program(CYGPATH_EXECUTABLE cygpath)
+
+ if(CYGPATH_EXECUTABLE)
+ execute_process(COMMAND ${CYGPATH_EXECUTABLE} -W
+ OUTPUT_VARIABLE env_windir
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${CYGPATH_EXECUTABLE} -S
+ OUTPUT_VARIABLE env_sysdir
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(TOLOWER "${env_windir}" windir)
+ string(TOLOWER "${env_sysdir}" sysroot)
+
+ if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
+ set(is_system 1)
+ endif()
+ endif(CYGPATH_EXECUTABLE)
+ endif(UNIX)
+ endif(WIN32)
+
+ if(NOT is_system)
+ get_filename_component(original_path "${original_lower}" PATH)
+ get_filename_component(path "${lower}" 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}")
+ set(is_embedded 1)
+ endif()
+ endif()
+ endif()
+ endif()
+ endif()
+
+ # Return type string based on computed booleans:
+ #
+ set(type "other")
+
+ if(is_system)
+ set(type "system")
+ elseif(is_embedded)
+ set(type "embedded")
+ elseif(is_local)
+ set(type "local")
+ endif()
+
+ #message(STATUS "gp_resolved_file_type: '${file}' '${resolved_file}'")
+ #message(STATUS " type: '${type}'")
+
+ if(NOT is_embedded)
+ if(NOT IS_ABSOLUTE "${resolved_file}")
+ if(lower MATCHES "^msvc[^/]+dll" AND is_system)
+ message(STATUS "info: non-absolute msvc file '${file}' returning type '${type}'")
+ else()
+ message(STATUS "warning: gp_resolved_file_type non-absolute file '${file}' returning type '${type}' -- possibly incorrect")
+ endif()
+ endif()
+ endif()
+
+ # Provide a hook so that projects can override the decision on whether a
+ # library belongs to the system or not by whatever logic they choose:
+ #
+ if(COMMAND gp_resolved_file_type_override)
+ gp_resolved_file_type_override("${resolved_file}" type)
+ endif()
+
+ set(${type_var} "${type}" PARENT_SCOPE)
+
+ #message(STATUS "**")
+endfunction()
+
+
+function(gp_file_type original_file file type_var)
+ if(NOT IS_ABSOLUTE "${original_file}")
+ message(STATUS "warning: gp_file_type expects absolute full path for first arg original_file")
+ endif()
+
+ get_filename_component(exepath "${original_file}" PATH)
+
+ set(type "")
+ gp_resolved_file_type("${original_file}" "${file}" "${exepath}" "" type)
+
+ set(${type_var} "${type}" PARENT_SCOPE)
+endfunction(gp_file_type)
+
+
+function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
+ set(verbose 0)
+ set(eol_char "E")
+
+ if(NOT IS_ABSOLUTE "${target}")
+ message("warning: target '${target}' is not absolute...")
+ endif(NOT IS_ABSOLUTE "${target}")
+
+ if(NOT EXISTS "${target}")
+ message("warning: target '${target}' does not exist...")
+ endif(NOT EXISTS "${target}")
+
+ # <setup-gp_tool-vars>
+ #
+ # 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 "")
+ set(gp_tool "ldd")
+ if(APPLE)
+ set(gp_tool "otool")
+ endif(APPLE)
+ if(WIN32 AND NOT UNIX) # This is how to check for cygwin, har!
+ set(gp_tool "dumpbin")
+ endif(WIN32 AND NOT UNIX)
+ endif("${gp_tool}" STREQUAL "")
+
+ set(gp_tool_known 0)
+
+ 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("${gp_tool}" STREQUAL "ldd")
+
+ if("${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("${gp_tool}" STREQUAL "otool")
+
+ if("${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)
+ set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE.
+ endif("${gp_tool}" STREQUAL "dumpbin")
+
+ if(NOT gp_tool_known)
+ 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 and otool.")
+ return()
+ endif(NOT gp_tool_known)
+
+ set(gp_cmd_paths ${gp_cmd_paths}
+ "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin"
+ "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
+ "C:/Program Files/Microsoft Visual Studio 8/VC/BIN"
+ "C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN"
+ "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN"
+ "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN"
+ "/usr/local/bin"
+ "/usr/bin"
+ )
+
+ find_program(gp_cmd ${gp_tool} PATHS ${gp_cmd_paths})
+
+ if(NOT gp_cmd)
+ message(STATUS "warning: could not find '${gp_tool}' - cannot analyze prerequisites...")
+ return()
+ endif(NOT gp_cmd)
+
+ 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
+ # different command prompt.
+ #
+ get_filename_component(gp_cmd_dir "${gp_cmd}" PATH)
+ get_filename_component(gp_cmd_dlls_dir "${gp_cmd_dir}/../../Common7/IDE" ABSOLUTE)
+ # Use cmake paths as a user may have a PATH element ending with a backslash.
+ # This will escape the list delimiter and create havoc!
+ if(EXISTS "${gp_cmd_dlls_dir}")
+ # only add to the path if it is not already in the path
+ 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}")
+ set(gp_found_cmd_dlls_dir 1)
+ endif()
+ endforeach(gp_env_path_element)
+
+ if(NOT gp_found_cmd_dlls_dir)
+ file(TO_NATIVE_PATH "${gp_cmd_dlls_dir}" gp_cmd_dlls_dir)
+ set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}")
+ endif()
+ endif(EXISTS "${gp_cmd_dlls_dir}")
+ endif("${gp_tool}" STREQUAL "dumpbin")
+ #
+ # </setup-gp_tool-vars>
+
+ 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}")
+ endforeach(dir)
+ endif("${gp_tool}" STREQUAL "ldd")
+
+
+ # Track new prerequisites at each new level of recursion. Start with an
+ # empty list at each level:
+ #
+ set(unseen_prereqs)
+
+ # Run gp_cmd on the target:
+ #
+ execute_process(
+ COMMAND ${gp_cmd} ${gp_cmd_args} ${target}
+ OUTPUT_VARIABLE gp_cmd_ov
+ )
+
+ if("${gp_tool}" STREQUAL "ldd")
+ set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
+ endif("${gp_tool}" STREQUAL "ldd")
+
+ if(verbose)
+ message(STATUS "<RawOutput cmd='${gp_cmd} ${gp_cmd_args} ${target}'>")
+ message(STATUS "gp_cmd_ov='${gp_cmd_ov}'")
+ message(STATUS "</RawOutput>")
+ endif(verbose)
+
+ get_filename_component(target_dir "${target}" PATH)
+
+ # Convert to a list of lines:
+ #
+ string(REGEX REPLACE ";" "\\\\;" candidates "${gp_cmd_ov}")
+ string(REGEX 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")
+ execute_process(
+ COMMAND otool -D ${target}
+ OUTPUT_VARIABLE gp_install_id_ov
+ )
+ # second line is install name
+ string(REGEX REPLACE ".*:\n" "" gp_install_id "${gp_install_id_ov}")
+ if(gp_install_id)
+ # trim
+ string(REGEX MATCH "[^\n ].*[^\n ]" gp_install_id "${gp_install_id}")
+ #message("INSTALL ID is \"${gp_install_id}\"")
+ endif(gp_install_id)
+ endif("${gp_tool}" STREQUAL "otool")
+
+ # Analyze each line for file names that match the regular expression:
+ #
+ foreach(candidate ${candidates})
+ if("${candidate}" MATCHES "${gp_regex}")
+
+ # Extract information from each candidate:
+ if(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}")
+ string(REGEX REPLACE "${gp_regex_fallback}" "\\1" raw_item "${candidate}")
+ else(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}")
+ string(REGEX REPLACE "${gp_regex}" "\\1" raw_item "${candidate}")
+ endif(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}")
+
+ if(gp_regex_cmp_count GREATER 1)
+ string(REGEX REPLACE "${gp_regex}" "\\2" raw_compat_version "${candidate}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" compat_major_version "${raw_compat_version}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" compat_minor_version "${raw_compat_version}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" compat_patch_version "${raw_compat_version}")
+ endif(gp_regex_cmp_count GREATER 1)
+
+ if(gp_regex_cmp_count GREATER 2)
+ string(REGEX REPLACE "${gp_regex}" "\\3" raw_current_version "${candidate}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" current_major_version "${raw_current_version}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" current_minor_version "${raw_current_version}")
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" current_patch_version "${raw_current_version}")
+ endif(gp_regex_cmp_count GREATER 2)
+
+ # Use the raw_item as the list entries returned by this function. Use the
+ # gp_resolve_item function to resolve it to an actual full path file if
+ # necessary.
+ #
+ set(item "${raw_item}")
+
+ # Add each item unless it is excluded:
+ #
+ set(add_item 1)
+
+ if("${item}" STREQUAL "${gp_install_id}")
+ set(add_item 0)
+ endif("${item}" STREQUAL "${gp_install_id}")
+
+ if(add_item AND ${exclude_system})
+ set(type "")
+ gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type)
+
+ if("${type}" STREQUAL "system")
+ set(add_item 0)
+ endif("${type}" STREQUAL "system")
+ endif(add_item AND ${exclude_system})
+
+ if(add_item)
+ list(LENGTH ${prerequisites_var} list_length_before_append)
+ gp_append_unique(${prerequisites_var} "${item}")
+ list(LENGTH ${prerequisites_var} list_length_after_append)
+
+ if(${recurse})
+ # If item was really added, this is the first time we have seen it.
+ # Add it to unseen_prereqs so that we can recursively add *its*
+ # prerequisites...
+ #
+ # But first: resolve its name to an absolute full path name such
+ # 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)
+ set(unseen_prereqs ${unseen_prereqs} "${resolved_item}")
+ endif(NOT list_length_before_append EQUAL list_length_after_append)
+ endif(${recurse})
+ endif(add_item)
+ else("${candidate}" MATCHES "${gp_regex}")
+ if(verbose)
+ message(STATUS "ignoring non-matching line: '${candidate}'")
+ endif(verbose)
+ endif("${candidate}" MATCHES "${gp_regex}")
+ endforeach(candidate)
+
+ list(LENGTH ${prerequisites_var} prerequisites_var_length)
+ if(prerequisites_var_length GREATER 0)
+ list(SORT ${prerequisites_var})
+ endif(prerequisites_var_length GREATER 0)
+ if(${recurse})
+ set(more_inputs ${unseen_prereqs})
+ foreach(input ${more_inputs})
+ get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}")
+ endforeach(input)
+ endif(${recurse})
+
+ set(${prerequisites_var} ${${prerequisites_var}} PARENT_SCOPE)
+endfunction(get_prerequisites)
+
+
+function(list_prerequisites target)
+ if("${ARGV1}" STREQUAL "")
+ set(all 1)
+ else("${ARGV1}" STREQUAL "")
+ set(all "${ARGV1}")
+ endif("${ARGV1}" STREQUAL "")
+
+ if("${ARGV2}" STREQUAL "")
+ set(exclude_system 0)
+ else("${ARGV2}" STREQUAL "")
+ set(exclude_system "${ARGV2}")
+ endif("${ARGV2}" STREQUAL "")
+
+ if("${ARGV3}" STREQUAL "")
+ set(verbose 0)
+ else("${ARGV3}" STREQUAL "")
+ set(verbose "${ARGV3}")
+ endif("${ARGV3}" STREQUAL "")
+
+ set(count 0)
+ set(count_str "")
+ set(print_count "${verbose}")
+ set(print_prerequisite_type "${verbose}")
+ set(print_target "${verbose}")
+ set(type_str "")
+
+ get_filename_component(exepath "${target}" PATH)
+
+ set(prereqs "")
+ get_prerequisites("${target}" prereqs ${exclude_system} ${all} "${exepath}" "")
+
+ if(print_target)
+ message(STATUS "File '${target}' depends on:")
+ endif(print_target)
+
+ foreach(d ${prereqs})
+ math(EXPR count "${count} + 1")
+
+ if(print_count)
+ set(count_str "${count}. ")
+ endif(print_count)
+
+ if(print_prerequisite_type)
+ gp_file_type("${target}" "${d}" type)
+ set(type_str " (${type})")
+ endif(print_prerequisite_type)
+
+ message(STATUS "${count_str}${d}${type_str}")
+ endforeach(d)
+endfunction(list_prerequisites)
+
+
+function(list_prerequisites_by_glob glob_arg glob_exp)
+ message(STATUS "=============================================================================")
+ message(STATUS "List prerequisites of executables matching ${glob_arg} '${glob_exp}'")
+ message(STATUS "")
+ file(${glob_arg} file_list ${glob_exp})
+ foreach(f ${file_list})
+ is_file_executable("${f}" is_f_executable)
+ if(is_f_executable)
+ message(STATUS "=============================================================================")
+ list_prerequisites("${f}" ${ARGN})
+ message(STATUS "")
+ endif(is_f_executable)
+ endforeach(f)
+endfunction(list_prerequisites_by_glob)
diff --git a/Modules/ITKCompatibility.cmake b/Modules/ITKCompatibility.cmake
new file mode 100644
index 000000000..efd9c284e
--- /dev/null
+++ b/Modules/ITKCompatibility.cmake
@@ -0,0 +1,17 @@
+
+#=============================================================================
+# Copyright 2006-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.)
+
+# work around an old bug in ITK prior to verison 3.0
+SET(TIFF_RIGHT_VERSION 1)
+
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
new file mode 100644
index 000000000..65d254a4a
--- /dev/null
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -0,0 +1,401 @@
+# 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.
+
+#=============================================================================
+# Copyright 2006-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.)
+
+IF(MSVC)
+ FILE(TO_CMAKE_PATH "$ENV{SYSTEMROOT}" SYSTEMROOT)
+
+ IF(CMAKE_CL_64)
+ IF(MSVC_VERSION GREATER 1599)
+ # VS 10 and later:
+ SET(CMAKE_MSVC_ARCH x64)
+ ELSE()
+ # VS 9 and earlier:
+ SET(CMAKE_MSVC_ARCH amd64)
+ ENDIF()
+ ELSE(CMAKE_CL_64)
+ SET(CMAKE_MSVC_ARCH x86)
+ ENDIF(CMAKE_CL_64)
+
+ GET_FILENAME_COMPONENT(devenv_dir "${CMAKE_MAKE_PROGRAM}" PATH)
+ GET_FILENAME_COMPONENT(base_dir "${devenv_dir}/../.." ABSOLUTE)
+
+ IF(MSVC70)
+ SET(__install__libs
+ "${SYSTEMROOT}/system32/msvcp70.dll"
+ "${SYSTEMROOT}/system32/msvcr70.dll"
+ )
+ ENDIF(MSVC70)
+
+ IF(MSVC71)
+ SET(__install__libs
+ "${SYSTEMROOT}/system32/msvcp71.dll"
+ "${SYSTEMROOT}/system32/msvcr71.dll"
+ )
+ ENDIF(MSVC71)
+
+ IF(MSVC80)
+ # Find the runtime library redistribution directory.
+ GET_FILENAME_COMPONENT(msvc_install_dir
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]" ABSOLUTE)
+ FIND_PATH(MSVC80_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest
+ PATHS
+ "${msvc_install_dir}/../../VC/redist"
+ "${base_dir}/VC/redist"
+ )
+ MARK_AS_ADVANCED(MSVC80_REDIST_DIR)
+ SET(MSVC80_CRT_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT")
+
+ # Install the manifest that allows DLLs to be loaded from the
+ # directory containing the executable.
+ IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+ SET(__install__libs
+ "${MSVC80_CRT_DIR}/Microsoft.VC80.CRT.manifest"
+ "${MSVC80_CRT_DIR}/msvcm80.dll"
+ "${MSVC80_CRT_DIR}/msvcp80.dll"
+ "${MSVC80_CRT_DIR}/msvcr80.dll"
+ )
+ ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+
+ IF(CMAKE_INSTALL_DEBUG_LIBRARIES)
+ SET(MSVC80_CRT_DIR
+ "${MSVC80_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugCRT")
+ SET(__install__libs ${__install__libs}
+ "${MSVC80_CRT_DIR}/Microsoft.VC80.DebugCRT.manifest"
+ "${MSVC80_CRT_DIR}/msvcm80d.dll"
+ "${MSVC80_CRT_DIR}/msvcp80d.dll"
+ "${MSVC80_CRT_DIR}/msvcr80d.dll"
+ )
+ ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
+ ENDIF(MSVC80)
+
+ IF(MSVC90)
+ # Find the runtime library redistribution directory.
+ GET_FILENAME_COMPONENT(msvc_install_dir
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]" ABSOLUTE)
+ GET_FILENAME_COMPONENT(msvc_express_install_dir
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]" ABSOLUTE)
+ FIND_PATH(MSVC90_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
+ PATHS
+ "${msvc_install_dir}/../../VC/redist"
+ "${msvc_express_install_dir}/../../VC/redist"
+ "${base_dir}/VC/redist"
+ )
+ MARK_AS_ADVANCED(MSVC90_REDIST_DIR)
+ SET(MSVC90_CRT_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT")
+
+ # Install the manifest that allows DLLs to be loaded from the
+ # directory containing the executable.
+ IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+ SET(__install__libs
+ "${MSVC90_CRT_DIR}/Microsoft.VC90.CRT.manifest"
+ "${MSVC90_CRT_DIR}/msvcm90.dll"
+ "${MSVC90_CRT_DIR}/msvcp90.dll"
+ "${MSVC90_CRT_DIR}/msvcr90.dll"
+ )
+ ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+
+ IF(CMAKE_INSTALL_DEBUG_LIBRARIES)
+ SET(MSVC90_CRT_DIR
+ "${MSVC90_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugCRT")
+ SET(__install__libs ${__install__libs}
+ "${MSVC90_CRT_DIR}/Microsoft.VC90.DebugCRT.manifest"
+ "${MSVC90_CRT_DIR}/msvcm90d.dll"
+ "${MSVC90_CRT_DIR}/msvcp90d.dll"
+ "${MSVC90_CRT_DIR}/msvcr90d.dll"
+ )
+ ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
+ ENDIF(MSVC90)
+
+ MACRO(MSVCRT_FILES_FOR_VERSION version)
+ SET(v "${version}")
+
+ # Find the runtime library redistribution directory.
+ GET_FILENAME_COMPONENT(msvc_install_dir
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${v}.0;InstallDir]" ABSOLUTE)
+ FIND_PATH(MSVC${v}_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT
+ PATHS
+ "${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"
+ )
+ MARK_AS_ADVANCED(MSVC${v}_REDIST_DIR)
+ SET(MSVC${v}_CRT_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT")
+
+ 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"
+ )
+ ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+
+ IF(CMAKE_INSTALL_DEBUG_LIBRARIES)
+ SET(MSVC${v}_CRT_DIR
+ "${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"
+ )
+ ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
+ ENDMACRO()
+
+ IF(MSVC10)
+ MSVCRT_FILES_FOR_VERSION(10)
+ ENDIF()
+
+ IF(MSVC11)
+ MSVCRT_FILES_FOR_VERSION(11)
+ ENDIF()
+
+ IF(CMAKE_INSTALL_MFC_LIBRARIES)
+ IF(MSVC70)
+ SET(__install__libs ${__install__libs}
+ "${SYSTEMROOT}/system32/mfc70.dll"
+ )
+ ENDIF(MSVC70)
+
+ IF(MSVC71)
+ SET(__install__libs ${__install__libs}
+ "${SYSTEMROOT}/system32/mfc71.dll"
+ )
+ ENDIF(MSVC71)
+
+ IF(MSVC80)
+ IF(CMAKE_INSTALL_DEBUG_LIBRARIES)
+ SET(MSVC80_MFC_DIR
+ "${MSVC80_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugMFC")
+ SET(__install__libs ${__install__libs}
+ "${MSVC80_MFC_DIR}/Microsoft.VC80.DebugMFC.manifest"
+ "${MSVC80_MFC_DIR}/mfc80d.dll"
+ "${MSVC80_MFC_DIR}/mfc80ud.dll"
+ "${MSVC80_MFC_DIR}/mfcm80d.dll"
+ "${MSVC80_MFC_DIR}/mfcm80ud.dll"
+ )
+ ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
+
+ SET(MSVC80_MFC_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFC")
+ # Install the manifest that allows DLLs to be loaded from the
+ # directory containing the executable.
+ IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+ SET(__install__libs ${__install__libs}
+ "${MSVC80_MFC_DIR}/Microsoft.VC80.MFC.manifest"
+ "${MSVC80_MFC_DIR}/mfc80.dll"
+ "${MSVC80_MFC_DIR}/mfc80u.dll"
+ "${MSVC80_MFC_DIR}/mfcm80.dll"
+ "${MSVC80_MFC_DIR}/mfcm80u.dll"
+ )
+ ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+
+ # include the language dll's for vs8 as well as the actuall dll's
+ SET(MSVC80_MFCLOC_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFCLOC")
+ # Install the manifest that allows DLLs to be loaded from the
+ # directory containing the executable.
+ SET(__install__libs ${__install__libs}
+ "${MSVC80_MFCLOC_DIR}/Microsoft.VC80.MFCLOC.manifest"
+ "${MSVC80_MFCLOC_DIR}/mfc80chs.dll"
+ "${MSVC80_MFCLOC_DIR}/mfc80cht.dll"
+ "${MSVC80_MFCLOC_DIR}/mfc80enu.dll"
+ "${MSVC80_MFCLOC_DIR}/mfc80esp.dll"
+ "${MSVC80_MFCLOC_DIR}/mfc80deu.dll"
+ "${MSVC80_MFCLOC_DIR}/mfc80fra.dll"
+ "${MSVC80_MFCLOC_DIR}/mfc80ita.dll"
+ "${MSVC80_MFCLOC_DIR}/mfc80jpn.dll"
+ "${MSVC80_MFCLOC_DIR}/mfc80kor.dll"
+ )
+ ENDIF(MSVC80)
+
+ IF(MSVC90)
+ IF(CMAKE_INSTALL_DEBUG_LIBRARIES)
+ SET(MSVC90_MFC_DIR
+ "${MSVC90_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugMFC")
+ SET(__install__libs ${__install__libs}
+ "${MSVC90_MFC_DIR}/Microsoft.VC90.DebugMFC.manifest"
+ "${MSVC90_MFC_DIR}/mfc90d.dll"
+ "${MSVC90_MFC_DIR}/mfc90ud.dll"
+ "${MSVC90_MFC_DIR}/mfcm90d.dll"
+ "${MSVC90_MFC_DIR}/mfcm90ud.dll"
+ )
+ ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
+
+ SET(MSVC90_MFC_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFC")
+ # Install the manifest that allows DLLs to be loaded from the
+ # directory containing the executable.
+ IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+ SET(__install__libs ${__install__libs}
+ "${MSVC90_MFC_DIR}/Microsoft.VC90.MFC.manifest"
+ "${MSVC90_MFC_DIR}/mfc90.dll"
+ "${MSVC90_MFC_DIR}/mfc90u.dll"
+ "${MSVC90_MFC_DIR}/mfcm90.dll"
+ "${MSVC90_MFC_DIR}/mfcm90u.dll"
+ )
+ ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+
+ # include the language dll's for vs9 as well as the actuall dll's
+ SET(MSVC90_MFCLOC_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFCLOC")
+ # Install the manifest that allows DLLs to be loaded from the
+ # directory containing the executable.
+ SET(__install__libs ${__install__libs}
+ "${MSVC90_MFCLOC_DIR}/Microsoft.VC90.MFCLOC.manifest"
+ "${MSVC90_MFCLOC_DIR}/mfc90chs.dll"
+ "${MSVC90_MFCLOC_DIR}/mfc90cht.dll"
+ "${MSVC90_MFCLOC_DIR}/mfc90enu.dll"
+ "${MSVC90_MFCLOC_DIR}/mfc90esp.dll"
+ "${MSVC90_MFCLOC_DIR}/mfc90deu.dll"
+ "${MSVC90_MFCLOC_DIR}/mfc90fra.dll"
+ "${MSVC90_MFCLOC_DIR}/mfc90ita.dll"
+ "${MSVC90_MFCLOC_DIR}/mfc90jpn.dll"
+ "${MSVC90_MFCLOC_DIR}/mfc90kor.dll"
+ )
+ ENDIF(MSVC90)
+
+ MACRO(MFC_FILES_FOR_VERSION version)
+ SET(v "${version}")
+
+ 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"
+ )
+ ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
+
+ 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"
+ )
+ ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+
+ # include the language dll's as well as the actuall dll's
+ SET(MSVC${v}_MFCLOC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFCLOC")
+ SET(__install__libs ${__install__libs}
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0chs.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0cht.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0enu.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0esp.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0deu.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0fra.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0ita.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0jpn.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0kor.dll"
+ )
+ ENDMACRO()
+
+ IF(MSVC10)
+ MFC_FILES_FOR_VERSION(10)
+ ENDIF()
+
+ IF(MSVC11)
+ MFC_FILES_FOR_VERSION(11)
+ ENDIF()
+ ENDIF(CMAKE_INSTALL_MFC_LIBRARIES)
+
+ FOREACH(lib
+ ${__install__libs}
+ )
+ IF(EXISTS ${lib})
+ SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
+ ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
+ ELSE(EXISTS ${lib})
+ IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
+ MESSAGE(WARNING "system runtime library file does not exist: '${lib}'")
+ # This warning indicates an incomplete Visual Studio installation
+ # or a bug somewhere above here in this file.
+ # If you would like to avoid this warning, fix the real problem, or
+ # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
+ # this file.
+ ENDIF()
+ ENDIF(EXISTS ${lib})
+ ENDFOREACH(lib)
+ENDIF(MSVC)
+
+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 )
+ ENDIF()
+ FOREACH(lib
+ ${__install__libs}
+ )
+ IF(EXISTS ${lib})
+ SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
+ ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
+ ELSE()
+ IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
+ MESSAGE(WARNING "system runtime library file does not exist: '${lib}'")
+ # This warning indicates an incomplete Watcom installation
+ # or a bug somewhere above here in this file.
+ # If you would like to avoid this warning, fix the real problem, or
+ # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
+ # this file.
+ ENDIF()
+ ENDIF()
+ ENDFOREACH()
+ENDIF()
+
+
+# Include system runtime libraries in the installation if any are
+# specified by CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS.
+IF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
+ IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP)
+ IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION)
+ IF(WIN32)
+ SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin)
+ ELSE(WIN32)
+ SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib)
+ ENDIF(WIN32)
+ ENDIF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION)
+ INSTALL(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
+ DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION})
+ ENDIF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP)
+ENDIF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
diff --git a/Modules/IntelVSImplicitPath/CMakeLists.txt b/Modules/IntelVSImplicitPath/CMakeLists.txt
new file mode 100644
index 000000000..96dc4e612
--- /dev/null
+++ b/Modules/IntelVSImplicitPath/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required (VERSION 2.8)
+project(IntelFortranImplicit Fortran)
+add_custom_command(
+ OUTPUT output.cmake
+ COMMAND ${CMAKE_COMMAND} -P ${IntelFortranImplicit_SOURCE_DIR}/detect.cmake
+ )
+add_library(FortranLib hello.f output.cmake)
diff --git a/Modules/IntelVSImplicitPath/detect.cmake b/Modules/IntelVSImplicitPath/detect.cmake
new file mode 100644
index 000000000..20753bef4
--- /dev/null
+++ b/Modules/IntelVSImplicitPath/detect.cmake
@@ -0,0 +1,9 @@
+# look at each path and try to find ifconsol.lib
+set(LIB "$ENV{LIB}")
+foreach(dir ${LIB})
+ file(TO_CMAKE_PATH "${dir}" dir)
+ if(EXISTS "${dir}/ifconsol.lib")
+ file(WRITE output.cmake "list(APPEND implicit_dirs \"${dir}\")\n")
+ break()
+ endif()
+endforeach()
diff --git a/Modules/IntelVSImplicitPath/hello.f b/Modules/IntelVSImplicitPath/hello.f
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Modules/IntelVSImplicitPath/hello.f
diff --git a/Modules/KDE3Macros.cmake b/Modules/KDE3Macros.cmake
new file mode 100644
index 000000000..5b76000e8
--- /dev/null
+++ b/Modules/KDE3Macros.cmake
@@ -0,0 +1,411 @@
+#
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@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.)
+
+# See FindKDE3.cmake for documentation.
+#
+# this file contains the following macros:
+# KDE3_ADD_DCOP_SKELS
+# KDE3_ADD_DCOP_STUBS
+# KDE3_ADD_MOC_FILES
+# KDE3_ADD_UI_FILES
+# KDE3_ADD_KCFG_FILES
+# KDE3_AUTOMOC
+# KDE3_INSTALL_LIBTOOL_FILE
+# KDE3_CREATE_FINAL_FILE
+# KDE3_ADD_KPART
+# KDE3_ADD_KDEINIT_EXECUTABLE
+# KDE3_ADD_EXECUTABLE
+
+
+#neundorf@kde.org
+
+INCLUDE(AddFileDependencies)
+
+#create the kidl and skeletion file for dcop stuff
+#usage: KDE_ADD_COP_SKELS(foo_SRCS ${dcop_headers})
+MACRO(KDE3_ADD_DCOP_SKELS _sources)
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
+ GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
+
+ SET(_skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp)
+ SET(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl)
+
+ IF (NOT HAVE_${_basename}_KIDL_RULE)
+ SET(HAVE_${_basename}_KIDL_RULE ON)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_kidl}
+ COMMAND ${KDE3_DCOPIDL_EXECUTABLE}
+ ARGS ${_tmp_FILE} > ${_kidl}
+ DEPENDS ${_tmp_FILE}
+ )
+
+ ENDIF (NOT HAVE_${_basename}_KIDL_RULE)
+
+ IF (NOT HAVE_${_basename}_SKEL_RULE)
+ SET(HAVE_${_basename}_SKEL_RULE ON)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_skel}
+ COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
+ ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl}
+ DEPENDS ${_kidl}
+ )
+
+ ENDIF (NOT HAVE_${_basename}_SKEL_RULE)
+
+ SET(${_sources} ${${_sources}} ${_skel})
+
+ ENDFOREACH (_current_FILE)
+
+ENDMACRO(KDE3_ADD_DCOP_SKELS)
+
+
+MACRO(KDE3_ADD_DCOP_STUBS _sources)
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
+
+ GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
+
+ SET(_stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp)
+ SET(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl)
+
+ IF (NOT HAVE_${_basename}_KIDL_RULE)
+ SET(HAVE_${_basename}_KIDL_RULE ON)
+
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_kidl}
+ COMMAND ${KDE3_DCOPIDL_EXECUTABLE}
+ ARGS ${_tmp_FILE} > ${_kidl}
+ DEPENDS ${_tmp_FILE}
+ )
+
+ ENDIF (NOT HAVE_${_basename}_KIDL_RULE)
+
+
+ IF (NOT HAVE_${_basename}_STUB_RULE)
+ SET(HAVE_${_basename}_STUB_RULE ON)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_stub_CPP}
+ COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
+ ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl}
+ DEPENDS ${_kidl}
+ )
+
+ ENDIF (NOT HAVE_${_basename}_STUB_RULE)
+
+ SET(${_sources} ${${_sources}} ${_stub_CPP})
+
+ ENDFOREACH (_current_FILE)
+
+ENDMACRO(KDE3_ADD_DCOP_STUBS)
+
+
+MACRO(KDE3_ADD_KCFG_FILES _sources)
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
+
+ GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
+
+ FILE(READ ${_tmp_FILE} _contents)
+ STRING(REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}")
+
+ SET(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
+ SET(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_src_FILE}
+ COMMAND ${KDE3_KCFGC_EXECUTABLE}
+ ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE}
+ DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} )
+
+ SET(${_sources} ${${_sources}} ${_src_FILE})
+
+ ENDFOREACH (_current_FILE)
+
+ENDMACRO(KDE3_ADD_KCFG_FILES)
+
+
+#create the moc files and add them to the list of sources
+#usage: KDE_ADD_MOC_FILES(foo_SRCS ${moc_headers})
+MACRO(KDE3_ADD_MOC_FILES _sources)
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
+
+ GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
+ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
+ COMMAND ${QT_MOC_EXECUTABLE}
+ ARGS ${_tmp_FILE} -o ${_moc}
+ DEPENDS ${_tmp_FILE}
+ )
+
+ SET(${_sources} ${${_sources}} ${_moc})
+
+ ENDFOREACH (_current_FILE)
+ENDMACRO(KDE3_ADD_MOC_FILES)
+
+
+GET_FILENAME_COMPONENT( KDE3_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+#create the implementation files from the ui files and add them to the list of sources
+#usage: KDE_ADD_UI_FILES(foo_SRCS ${ui_files})
+MACRO(KDE3_ADD_UI_FILES _sources )
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
+
+ GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
+ SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
+ SET(_src ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
+ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_header}
+ COMMAND ${QT_UIC_EXECUTABLE}
+ ARGS -L ${KDE3_LIB_DIR}/kde3/plugins/designer -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE}
+ DEPENDS ${_tmp_FILE}
+ )
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_src}
+ COMMAND ${CMAKE_COMMAND}
+ ARGS
+ -DKDE_UIC_PLUGIN_DIR:FILEPATH=${KDE3_LIB_DIR}/kde3/plugins/designer
+ -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE}
+ -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE}
+ -DKDE_UIC_CPP_FILE:FILEPATH=${_src}
+ -DKDE_UIC_H_FILE:FILEPATH=${_header}
+ -P ${KDE3_MODULE_DIR}/kde3uic.cmake
+ DEPENDS ${_header}
+ )
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
+ COMMAND ${QT_MOC_EXECUTABLE}
+ ARGS ${_header} -o ${_moc}
+ DEPENDS ${_header}
+ )
+
+ SET(${_sources} ${${_sources}} ${_src} ${_moc} )
+
+ ENDFOREACH (_current_FILE)
+ENDMACRO(KDE3_ADD_UI_FILES)
+
+
+MACRO(KDE3_AUTOMOC)
+ SET(_matching_FILES )
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
+
+ # if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
+ # here. this is required to make bouic work correctly:
+ # we need to add generated .cpp files to the sources (to compile them),
+ # but we cannot let automoc handle them, as the .cpp files don't exist yet when
+ # cmake is run for the very first time on them -> however the .cpp files might
+ # exist at a later run. at that time we need to skip them, so that we don't add two
+ # different rules for the same moc file
+ GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC)
+
+ IF (EXISTS ${_abs_FILE} AND NOT _skip)
+
+ FILE(READ ${_abs_FILE} _contents)
+
+ GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH)
+
+ STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}")
+ IF(_match)
+ FOREACH (_current_MOC_INC ${_match})
+ STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
+
+ GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE)
+# SET(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h)
+ SET(_header ${_abs_PATH}/${_basename}.h)
+ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
+ COMMAND ${QT_MOC_EXECUTABLE}
+ ARGS ${_header} -o ${_moc}
+ DEPENDS ${_header}
+ )
+
+ ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
+
+ ENDFOREACH (_current_MOC_INC)
+ ENDIF(_match)
+
+ ENDIF (EXISTS ${_abs_FILE} AND NOT _skip)
+ ENDFOREACH (_current_FILE)
+ENDMACRO(KDE3_AUTOMOC)
+
+# only used internally by KDE3_INSTALL_ICONS
+MACRO (_KDE3_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME)
+
+ # if the string doesn't match the pattern, the result is the full string, so all three have the same content
+ IF (NOT ${_group} STREQUAL ${_install_NAME} )
+ SET(_icon_GROUP "actions")
+
+ IF (${_group} STREQUAL "mime")
+ SET(_icon_GROUP "mimetypes")
+ ENDIF (${_group} STREQUAL "mime")
+
+ IF (${_group} STREQUAL "filesys")
+ SET(_icon_GROUP "filesystems")
+ ENDIF (${_group} STREQUAL "filesys")
+
+ IF (${_group} STREQUAL "device")
+ SET(_icon_GROUP "devices")
+ ENDIF (${_group} STREQUAL "device")
+
+ IF (${_group} STREQUAL "app")
+ SET(_icon_GROUP "apps")
+ ENDIF (${_group} STREQUAL "app")
+
+ IF (${_group} STREQUAL "action")
+ SET(_icon_GROUP "actions")
+ ENDIF (${_group} STREQUAL "action")
+
+# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" )
+ INSTALL(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} )
+ ENDIF (NOT ${_group} STREQUAL ${_install_NAME} )
+
+ENDMACRO (_KDE3_ADD_ICON_INSTALL_RULE)
+
+
+MACRO (KDE3_INSTALL_ICONS _theme )
+ SET(_defaultpath "${CMAKE_INSTALL_PREFIX}/share/icons")
+ # first the png icons
+ FILE(GLOB _icons *.png)
+ FOREACH (_current_ICON ${_icons} )
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}")
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}")
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}")
+ _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
+ ${_defaultpath}/${_theme}/${_size}x${_size}
+ ${_group} ${_current_ICON} ${_name})
+ ENDFOREACH (_current_ICON)
+
+ # and now the svg icons
+ FILE(GLOB _icons *.svgz)
+ FOREACH (_current_ICON ${_icons} )
+ STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}")
+ STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}")
+ _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
+ ${_defaultpath}/${_theme}/scalable
+ ${_group} ${_current_ICON} ${_name})
+ ENDFOREACH (_current_ICON)
+
+ENDMACRO (KDE3_INSTALL_ICONS)
+
+MACRO(KDE3_INSTALL_LIBTOOL_FILE _target)
+ GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
+
+ GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
+ GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
+ SET(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la)
+
+ FILE(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n")
+ FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
+ FILE(APPEND ${_laname} "dlname='${_soname}'\n")
+ FILE(APPEND ${_laname} "# Names of this library\n")
+ IF(CYGWIN)
+ FILE(APPEND ${_laname} "library_names='${_soname}'\n")
+ ELSE(CYGWIN)
+ FILE(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n")
+ ENDIF(CYGWIN)
+ FILE(APPEND ${_laname} "# The name of the static archive\n")
+ FILE(APPEND ${_laname} "old_library=''\n")
+ FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n")
+ FILE(APPEND ${_laname} "dependency_libs=''\n")
+# FILE(APPEND ${_laname} "dependency_libs='${${_target}_LIB_DEPENDS}'\n")
+ FILE(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n")
+ FILE(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n")
+ FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n")
+ FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n")
+ FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
+ FILE(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}/lib/kde3'\n")
+
+ INSTALL_FILES(${KDE3_LIBTOOL_DIR} FILES ${_laname})
+ENDMACRO(KDE3_INSTALL_LIBTOOL_FILE)
+
+
+MACRO(KDE3_CREATE_FINAL_FILE _filename)
+ FILE(WRITE ${_filename} "//autogenerated file\n")
+ FOREACH (_current_FILE ${ARGN})
+ FILE(APPEND ${_filename} "#include \"${_current_FILE}\"\n")
+ ENDFOREACH (_current_FILE)
+
+ENDMACRO(KDE3_CREATE_FINAL_FILE)
+
+
+# OPTION(KDE3_ENABLE_FINAL "Enable final all-in-one compilation")
+OPTION(KDE3_BUILD_TESTS "Build the tests")
+
+
+MACRO(KDE3_ADD_KPART _target_NAME _with_PREFIX)
+#is the first argument is "WITH_PREFIX" then keep the standard "lib" prefix, otherwise SET the prefix empty
+ IF (${_with_PREFIX} STREQUAL "WITH_PREFIX")
+ SET(_first_SRC)
+ ELSE (${_with_PREFIX} STREQUAL "WITH_PREFIX")
+ SET(_first_SRC ${_with_PREFIX})
+ ENDIF (${_with_PREFIX} STREQUAL "WITH_PREFIX")
+
+# IF (KDE3_ENABLE_FINAL)
+# KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${_first_SRC} ${ARGN})
+# ADD_LIBRARY(${_target_NAME} MODULE ${_target_NAME}_final.cpp)
+# ELSE (KDE3_ENABLE_FINAL)
+ ADD_LIBRARY(${_target_NAME} MODULE ${_first_SRC} ${ARGN})
+# ENDIF (KDE3_ENABLE_FINAL)
+
+ IF(_first_SRC)
+ SET_TARGET_PROPERTIES(${_target_NAME} PROPERTIES PREFIX "")
+ ENDIF(_first_SRC)
+
+ KDE3_INSTALL_LIBTOOL_FILE(${_target_NAME})
+
+ENDMACRO(KDE3_ADD_KPART)
+
+
+MACRO(KDE3_ADD_KDEINIT_EXECUTABLE _target_NAME )
+
+# IF (KDE3_ENABLE_FINAL)
+# KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN})
+# ADD_LIBRARY(kdeinit_${_target_NAME} SHARED ${_target_NAME}_final.cpp)
+# ELSE (KDE3_ENABLE_FINAL)
+ ADD_LIBRARY(kdeinit_${_target_NAME} SHARED ${ARGN} )
+# ENDIF (KDE3_ENABLE_FINAL)
+
+ CONFIGURE_FILE(${KDE3_MODULE_DIR}/kde3init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp)
+
+ ADD_EXECUTABLE( ${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp )
+ TARGET_LINK_LIBRARIES( ${_target_NAME} kdeinit_${_target_NAME} )
+
+ENDMACRO(KDE3_ADD_KDEINIT_EXECUTABLE)
+
+
+MACRO(KDE3_ADD_EXECUTABLE _target_NAME )
+
+# IF (KDE3_ENABLE_FINAL)
+# KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN})
+# ADD_EXECUTABLE(${_target_NAME} ${_target_NAME}_final.cpp)
+# ELSE (KDE3_ENABLE_FINAL)
+ ADD_EXECUTABLE(${_target_NAME} ${ARGN} )
+# ENDIF (KDE3_ENABLE_FINAL)
+
+ENDMACRO(KDE3_ADD_EXECUTABLE)
+
+
diff --git a/Modules/MacOSXBundleInfo.plist.in b/Modules/MacOSXBundleInfo.plist.in
new file mode 100644
index 000000000..a466dc7c4
--- /dev/null
+++ b/Modules/MacOSXBundleInfo.plist.in
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
+ <key>CFBundleGetInfoString</key>
+ <string>${MACOSX_BUNDLE_INFO_STRING}</string>
+ <key>CFBundleIconFile</key>
+ <string>${MACOSX_BUNDLE_ICON_FILE}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleLongVersionString</key>
+ <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
+ <key>CFBundleName</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+ <key>LSRequiresCarbon</key>
+ <true/>
+ <key>NSHumanReadableCopyright</key>
+ <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
+</dict>
+</plist>
diff --git a/Modules/MacOSXFrameworkInfo.plist.in b/Modules/MacOSXFrameworkInfo.plist.in
new file mode 100644
index 000000000..18eaef2f7
--- /dev/null
+++ b/Modules/MacOSXFrameworkInfo.plist.in
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${MACOSX_FRAMEWORK_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string>${MACOSX_FRAMEWORK_ICON_FILE}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${MACOSX_FRAMEWORK_IDENTIFIER}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>${MACOSX_FRAMEWORK_BUNDLE_VERSION}</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${MACOSX_FRAMEWORK_SHORT_VERSION_STRING}</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+</dict>
+</plist>
diff --git a/Modules/MacroAddFileDependencies.cmake b/Modules/MacroAddFileDependencies.cmake
new file mode 100644
index 000000000..527447b80
--- /dev/null
+++ b/Modules/MacroAddFileDependencies.cmake
@@ -0,0 +1,33 @@
+# - 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.
+#
+# 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 (MACRO_ADD_FILE_DEPENDENCIES _file)
+
+ GET_SOURCE_FILE_PROPERTY(_deps ${_file} OBJECT_DEPENDS)
+ IF (_deps)
+ SET(_deps ${_deps} ${ARGN})
+ ELSE (_deps)
+ SET(_deps ${ARGN})
+ ENDIF (_deps)
+
+ SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}")
+
+ENDMACRO (MACRO_ADD_FILE_DEPENDENCIES)
diff --git a/Modules/NSIS.InstallOptions.ini.in b/Modules/NSIS.InstallOptions.ini.in
new file mode 100644
index 000000000..d92d77959
--- /dev/null
+++ b/Modules/NSIS.InstallOptions.ini.in
@@ -0,0 +1,46 @@
+[Settings]
+NumFields=5
+
+[Field 1]
+Type=label
+Text=By default @CPACK_PACKAGE_INSTALL_DIRECTORY@ does not add its directory to the system PATH.
+Left=0
+Right=-1
+Top=0
+Bottom=20
+
+[Field 2]
+Type=radiobutton
+Text=Do not add @CPACK_PACKAGE_NAME@ to the system PATH
+Left=0
+Right=-1
+Top=30
+Bottom=40
+State=1
+
+[Field 3]
+Type=radiobutton
+Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for all users
+Left=0
+Right=-1
+Top=40
+Bottom=50
+State=0
+
+[Field 4]
+Type=radiobutton
+Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for current user
+Left=0
+Right=-1
+Top=50
+Bottom=60
+State=0
+
+[Field 5]
+Type=CheckBox
+Text=Create @CPACK_PACKAGE_NAME@ Desktop Icon
+Left=0
+Right=-1
+Top=80
+Bottom=90
+State=0
diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in
new file mode 100644
index 000000000..43f72f6aa
--- /dev/null
+++ b/Modules/NSIS.template.in
@@ -0,0 +1,972 @@
+; CPack install script designed for a nmake build
+
+;--------------------------------
+; You must define these values
+
+ !define VERSION "@CPACK_PACKAGE_VERSION@"
+ !define PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
+ !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"
+
+;--------------------------------
+;Variables
+
+ Var MUI_TEMP
+ Var STARTMENU_FOLDER
+ Var SV_ALLUSERS
+ Var START_MENU
+ Var DO_NOT_ADD_TO_PATH
+ Var ADD_TO_PATH_ALL_USERS
+ Var ADD_TO_PATH_CURRENT_USER
+ Var INSTALL_DESKTOP
+ Var IS_DEFAULT_INSTALLDIR
+;--------------------------------
+;Include Modern UI
+
+ !include "MUI.nsh"
+
+ ;Default installation folder
+ InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+
+;--------------------------------
+;General
+
+ ;Name and file
+ Name "@CPACK_NSIS_PACKAGE_NAME@"
+ OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
+
+ ;Set compression
+ SetCompressor @CPACK_NSIS_COMPRESSOR@
+
+@CPACK_NSIS_DEFINES@
+
+ !include Sections.nsh
+
+;--- Component support macros: ---
+; The code for the add/remove functionality is from:
+; http://nsis.sourceforge.net/Add/Remove_Functionality
+; It has been modified slightly and extended to provide
+; inter-component dependencies.
+Var AR_SecFlags
+Var AR_RegFlags
+@CPACK_NSIS_SECTION_SELECTED_VARS@
+
+; Loads the "selected" flag for the section named SecName into the
+; variable VarName.
+!macro LoadSectionSelectedIntoVar SecName VarName
+ SectionGetFlags ${${SecName}} $${VarName}
+ IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits
+!macroend
+
+; Loads the value of a variable... can we get around this?
+!macro LoadVar VarName
+ IntOp $R0 0 + $${VarName}
+!macroend
+
+; Sets the value of a variable
+!macro StoreVar VarName IntValue
+ IntOp $${VarName} 0 + ${IntValue}
+!macroend
+
+!macro InitSection SecName
+ ; This macro reads component installed flag from the registry and
+ ;changes checked state of the section on the components page.
+ ;Input: section index constant name specified in Section command.
+
+ ClearErrors
+ ;Reading component status from registry
+ ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed"
+ IfErrors "default_${SecName}"
+ ;Status will stay default if registry value not found
+ ;(component was never installed)
+ IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
+ SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags
+ IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off
+ IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit
+
+ ; Note whether this component was installed before
+ !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags
+ IntOp $R0 $AR_RegFlags & $AR_RegFlags
+
+ ;Writing modified flags
+ SectionSetFlags ${${SecName}} $AR_SecFlags
+
+ "default_${SecName}:"
+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
+!macroend
+
+!macro FinishSection SecName
+ ; This macro reads section flag set by user and removes the section
+ ;if it is not selected.
+ ;Then it writes component installed flag to registry
+ ;Input: section index constant name specified in Section command.
+
+ SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags
+ ;Checking lowest bit:
+ IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
+ IntCmp $AR_SecFlags 1 "leave_${SecName}"
+ ;Section is not selected:
+ ;Calling Section uninstall macro and writing zero installed flag
+ !insertmacro "Remove_${${SecName}}"
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
+ "Installed" 0
+ Goto "exit_${SecName}"
+
+ "leave_${SecName}:"
+ ;Section is selected:
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
+ "Installed" 1
+
+ "exit_${SecName}:"
+!macroend
+
+!macro RemoveSection SecName
+ ; This macro is used to call section's Remove_... macro
+ ;from the uninstaller.
+ ;Input: section index constant name specified in Section command.
+
+ !insertmacro "Remove_${${SecName}}"
+!macroend
+
+; Determine whether the selection of SecName changed
+!macro MaybeSelectionChanged SecName
+ !insertmacro LoadVar ${SecName}_selected
+ SectionGetFlags ${${SecName}} $R1
+ IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
+
+ ; See if the status has changed:
+ IntCmp $R0 $R1 "${SecName}_unchanged"
+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
+
+ IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
+ !insertmacro "Deselect_required_by_${SecName}"
+ goto "${SecName}_unchanged"
+
+ "${SecName}_was_selected:"
+ !insertmacro "Select_${SecName}_depends"
+
+ "${SecName}_unchanged:"
+!macroend
+;--- End of Add/Remove macros ---
+
+;--------------------------------
+;Interface Settings
+
+ !define MUI_HEADERIMAGE
+ !define MUI_ABORTWARNING
+
+;--------------------------------
+; path functions
+
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+
+;----------------------------------------
+; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
+;----------------------------------------
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+;====================================================
+; get_NT_environment
+; Returns: the selected environment
+; Output : head of the stack
+;====================================================
+!macro select_NT_profile UN
+Function ${UN}select_NT_profile
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single
+ DetailPrint "Selected environment for all users"
+ Push "all"
+ Return
+ environment_single:
+ DetailPrint "Selected environment for current user only."
+ Push "current"
+ Return
+FunctionEnd
+!macroend
+!insertmacro select_NT_profile ""
+!insertmacro select_NT_profile "un."
+;----------------------------------------------------
+!define NT_current_env 'HKCU "Environment"'
+!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+
+!ifndef WriteEnvStr_RegKey
+ !ifdef ALL_USERS
+ !define WriteEnvStr_RegKey \
+ 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+ !else
+ !define WriteEnvStr_RegKey 'HKCU "Environment"'
+ !endif
+!endif
+
+; AddToPath - Adds the given dir to the search path.
+; Input - head of the stack
+; Note - Win9x systems requires reboot
+
+Function AddToPath
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+
+ # don't add if the path doesn't exist
+ IfFileExists "$0\*.*" "" AddToPath_done
+
+ ReadEnvStr $1 PATH
+ ; if the path is too long for a NSIS variable NSIS will return a 0
+ ; length string. If we find that, then warn and skip any path
+ ; modification as it will trash the existing path.
+ StrLen $2 $1
+ IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done
+ CheckPathLength_ShowPathWarning:
+ Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!"
+ Goto AddToPath_done
+ CheckPathLength_Done:
+ Push "$1;"
+ Push "$0;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ Push "$1;"
+ Push "$0\;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ GetFullPathName /SHORT $3 $0
+ Push "$1;"
+ Push "$3;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ Push "$1;"
+ Push "$3\;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+
+ Call IsNT
+ Pop $1
+ StrCmp $1 1 AddToPath_NT
+ ; Not on NT
+ StrCpy $1 $WINDIR 2
+ FileOpen $1 "$1\autoexec.bat" a
+ FileSeek $1 -1 END
+ FileReadByte $1 $2
+ IntCmp $2 26 0 +2 +2 # DOS EOF
+ FileSeek $1 -1 END # write over EOF
+ FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
+ FileClose $1
+ SetRebootFlag true
+ Goto AddToPath_done
+
+ AddToPath_NT:
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey
+ ReadRegStr $1 ${NT_current_env} "PATH"
+ Goto DoTrim
+ ReadAllKey:
+ ReadRegStr $1 ${NT_all_env} "PATH"
+ DoTrim:
+ StrCmp $1 "" AddToPath_NTdoIt
+ Push $1
+ Call Trim
+ Pop $1
+ StrCpy $0 "$1;$0"
+ AddToPath_NTdoIt:
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey
+ WriteRegExpandStr ${NT_current_env} "PATH" $0
+ Goto DoSend
+ WriteAllKey:
+ WriteRegExpandStr ${NT_all_env} "PATH" $0
+ DoSend:
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ AddToPath_done:
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+
+; RemoveFromPath - Remove a given dir from the path
+; Input: head of the stack
+
+Function un.RemoveFromPath
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+
+ IntFmt $6 "%c" 26 # DOS EOF
+
+ Call un.IsNT
+ Pop $1
+ StrCmp $1 1 unRemoveFromPath_NT
+ ; Not on NT
+ StrCpy $1 $WINDIR 2
+ FileOpen $1 "$1\autoexec.bat" r
+ GetTempFileName $4
+ FileOpen $2 $4 w
+ GetFullPathName /SHORT $0 $0
+ StrCpy $0 "SET PATH=%PATH%;$0"
+ Goto unRemoveFromPath_dosLoop
+
+ unRemoveFromPath_dosLoop:
+ FileRead $1 $3
+ StrCpy $5 $3 1 -1 # read last char
+ StrCmp $5 $6 0 +2 # if DOS EOF
+ StrCpy $3 $3 -1 # remove DOS EOF so we can compare
+ StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "" unRemoveFromPath_dosLoopEnd
+ FileWrite $2 $3
+ Goto unRemoveFromPath_dosLoop
+ unRemoveFromPath_dosLoopRemoveLine:
+ SetRebootFlag true
+ Goto unRemoveFromPath_dosLoop
+
+ unRemoveFromPath_dosLoopEnd:
+ FileClose $2
+ FileClose $1
+ StrCpy $1 $WINDIR 2
+ Delete "$1\autoexec.bat"
+ CopyFiles /SILENT $4 "$1\autoexec.bat"
+ Delete $4
+ Goto unRemoveFromPath_done
+
+ unRemoveFromPath_NT:
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey
+ ReadRegStr $1 ${NT_current_env} "PATH"
+ Goto unDoTrim
+ unReadAllKey:
+ ReadRegStr $1 ${NT_all_env} "PATH"
+ unDoTrim:
+ StrCpy $5 $1 1 -1 # copy last char
+ StrCmp $5 ";" +2 # if last char != ;
+ StrCpy $1 "$1;" # append ;
+ Push $1
+ Push "$0;"
+ Call un.StrStr ; Find `$0;` in $1
+ Pop $2 ; pos of our dir
+ StrCmp $2 "" unRemoveFromPath_done
+ ; else, it is in path
+ # $0 - path to add
+ # $1 - path var
+ StrLen $3 "$0;"
+ StrLen $4 $2
+ StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
+ StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
+ StrCpy $3 $5$6
+
+ StrCpy $5 $3 1 -1 # copy last char
+ StrCmp $5 ";" 0 +2 # if last char == ;
+ StrCpy $3 $3 -1 # remove last char
+
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey
+ WriteRegExpandStr ${NT_current_env} "PATH" $3
+ Goto unDoSend
+ unWriteAllKey:
+ WriteRegExpandStr ${NT_all_env} "PATH" $3
+ unDoSend:
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ unRemoveFromPath_done:
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Uninstall sutff
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+###########################################
+# Utility Functions #
+###########################################
+
+;====================================================
+; IsNT - Returns 1 if the current system is NT, 0
+; otherwise.
+; Output: head of the stack
+;====================================================
+; IsNT
+; no input
+; output, top of the stack = 1 if NT or 0 if not
+;
+; Usage:
+; Call IsNT
+; Pop $R0
+; ($R0 at this point is 1 or 0)
+
+!macro IsNT un
+Function ${un}IsNT
+ Push $0
+ ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
+ StrCmp $0 "" 0 IsNT_yes
+ ; we are not NT.
+ Pop $0
+ Push 0
+ Return
+
+ IsNT_yes:
+ ; NT!!!
+ Pop $0
+ Push 1
+FunctionEnd
+!macroend
+!insertmacro IsNT ""
+!insertmacro IsNT "un."
+
+; StrStr
+; input, top of stack = string to search for
+; top of stack-1 = string to search in
+; output, top of stack (replaces with the portion of the string remaining)
+; modifies no other variables.
+;
+; Usage:
+; Push "this is a long ass string"
+; Push "ass"
+; Call StrStr
+; Pop $R0
+; ($R0 at this point is "ass string")
+
+!macro StrStr un
+Function ${un}StrStr
+Exch $R1 ; st=haystack,old$R1, $R1=needle
+ Exch ; st=old$R1,haystack
+ Exch $R2 ; st=old$R1,old$R2, $R2=haystack
+ Push $R3
+ Push $R4
+ Push $R5
+ StrLen $R3 $R1
+ StrCpy $R4 0
+ ; $R1=needle
+ ; $R2=haystack
+ ; $R3=len(needle)
+ ; $R4=cnt
+ ; $R5=tmp
+ loop:
+ StrCpy $R5 $R2 $R3 $R4
+ StrCmp $R5 $R1 done
+ StrCmp $R5 "" done
+ IntOp $R4 $R4 + 1
+ Goto loop
+done:
+ StrCpy $R1 $R2 "" $R4
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Exch $R1
+FunctionEnd
+!macroend
+!insertmacro StrStr ""
+!insertmacro StrStr "un."
+
+Function Trim ; Added by Pelaca
+ Exch $R1
+ Push $R2
+Loop:
+ StrCpy $R2 "$R1" 1 -1
+ StrCmp "$R2" " " RTrim
+ StrCmp "$R2" "$\n" RTrim
+ StrCmp "$R2" "$\r" RTrim
+ StrCmp "$R2" ";" RTrim
+ GoTo Done
+RTrim:
+ StrCpy $R1 "$R1" -1
+ Goto Loop
+Done:
+ Pop $R2
+ Exch $R1
+FunctionEnd
+
+Function ConditionalAddToRegisty
+ Pop $0
+ Pop $1
+ StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
+ WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
+ "$1" "$0"
+ ;MessageBox MB_OK "Set Registry: '$1' to '$0'"
+ DetailPrint "Set install registry entry: '$1' to '$0'"
+ ConditionalAddToRegisty_EmptyString:
+FunctionEnd
+
+;--------------------------------
+
+!ifdef CPACK_USES_DOWNLOAD
+Function DownloadFile
+ IfFileExists $INSTDIR\* +2
+ CreateDirectory $INSTDIR
+ Pop $0
+
+ ; Skip if already downloaded
+ IfFileExists $INSTDIR\$0 0 +2
+ Return
+
+ StrCpy $1 "@CPACK_DOWNLOAD_SITE@"
+
+ try_again:
+ NSISdl::download "$1/$0" "$INSTDIR\$0"
+
+ Pop $1
+ StrCmp $1 "success" success
+ StrCmp $1 "Cancelled" cancel
+ MessageBox MB_OK "Download failed: $1"
+ cancel:
+ Return
+ success:
+FunctionEnd
+!endif
+
+;--------------------------------
+; Installation types
+@CPACK_NSIS_INSTALLATION_TYPES@
+
+;--------------------------------
+; Component sections
+@CPACK_NSIS_COMPONENT_SECTIONS@
+
+;--------------------------------
+; Define some macro setting for the gui
+@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
+@CPACK_NSIS_INSTALLER_ICON_CODE@
+@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
+@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
+
+;--------------------------------
+;Pages
+ !insertmacro MUI_PAGE_WELCOME
+
+ !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
+ Page custom InstallOptionsPage
+ !insertmacro MUI_PAGE_DIRECTORY
+
+ ;Start Menu Folder Page Configuration
+ !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
+ !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+ !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
+ !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
+
+ @CPACK_NSIS_PAGE_COMPONENTS@
+
+ !insertmacro MUI_PAGE_INSTFILES
+ !insertmacro MUI_PAGE_FINISH
+
+ !insertmacro MUI_UNPAGE_CONFIRM
+ !insertmacro MUI_UNPAGE_INSTFILES
+
+;--------------------------------
+;Languages
+
+ !insertmacro MUI_LANGUAGE "English" ;first language is the default language
+ !insertmacro MUI_LANGUAGE "Albanian"
+ !insertmacro MUI_LANGUAGE "Arabic"
+ !insertmacro MUI_LANGUAGE "Basque"
+ !insertmacro MUI_LANGUAGE "Belarusian"
+ !insertmacro MUI_LANGUAGE "Bosnian"
+ !insertmacro MUI_LANGUAGE "Breton"
+ !insertmacro MUI_LANGUAGE "Bulgarian"
+ !insertmacro MUI_LANGUAGE "Croatian"
+ !insertmacro MUI_LANGUAGE "Czech"
+ !insertmacro MUI_LANGUAGE "Danish"
+ !insertmacro MUI_LANGUAGE "Dutch"
+ !insertmacro MUI_LANGUAGE "Estonian"
+ !insertmacro MUI_LANGUAGE "Farsi"
+ !insertmacro MUI_LANGUAGE "Finnish"
+ !insertmacro MUI_LANGUAGE "French"
+ !insertmacro MUI_LANGUAGE "German"
+ !insertmacro MUI_LANGUAGE "Greek"
+ !insertmacro MUI_LANGUAGE "Hebrew"
+ !insertmacro MUI_LANGUAGE "Hungarian"
+ !insertmacro MUI_LANGUAGE "Icelandic"
+ !insertmacro MUI_LANGUAGE "Indonesian"
+ !insertmacro MUI_LANGUAGE "Irish"
+ !insertmacro MUI_LANGUAGE "Italian"
+ !insertmacro MUI_LANGUAGE "Japanese"
+ !insertmacro MUI_LANGUAGE "Korean"
+ !insertmacro MUI_LANGUAGE "Kurdish"
+ !insertmacro MUI_LANGUAGE "Latvian"
+ !insertmacro MUI_LANGUAGE "Lithuanian"
+ !insertmacro MUI_LANGUAGE "Luxembourgish"
+ !insertmacro MUI_LANGUAGE "Macedonian"
+ !insertmacro MUI_LANGUAGE "Malay"
+ !insertmacro MUI_LANGUAGE "Mongolian"
+ !insertmacro MUI_LANGUAGE "Norwegian"
+ !insertmacro MUI_LANGUAGE "Polish"
+ !insertmacro MUI_LANGUAGE "Portuguese"
+ !insertmacro MUI_LANGUAGE "PortugueseBR"
+ !insertmacro MUI_LANGUAGE "Romanian"
+ !insertmacro MUI_LANGUAGE "Russian"
+ !insertmacro MUI_LANGUAGE "Serbian"
+ !insertmacro MUI_LANGUAGE "SerbianLatin"
+ !insertmacro MUI_LANGUAGE "SimpChinese"
+ !insertmacro MUI_LANGUAGE "Slovak"
+ !insertmacro MUI_LANGUAGE "Slovenian"
+ !insertmacro MUI_LANGUAGE "Spanish"
+ !insertmacro MUI_LANGUAGE "Swedish"
+ !insertmacro MUI_LANGUAGE "Thai"
+ !insertmacro MUI_LANGUAGE "TradChinese"
+ !insertmacro MUI_LANGUAGE "Turkish"
+ !insertmacro MUI_LANGUAGE "Ukrainian"
+ !insertmacro MUI_LANGUAGE "Welsh"
+
+
+;--------------------------------
+;Reserve Files
+
+ ;These files should be inserted before other files in the data block
+ ;Keep these lines before any File command
+ ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
+
+ ReserveFile "NSIS.InstallOptions.ini"
+ !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
+
+;--------------------------------
+;Installer Sections
+
+Section "-Core installation"
+ ;Use the entire tree produced by the INSTALL target. Keep the
+ ;list of directories here in sync with the RMDir commands below.
+ SetOutPath "$INSTDIR"
+ @CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@
+ @CPACK_NSIS_FULL_INSTALL@
+
+ ;Store installation folder
+ WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
+
+ ;Create uninstaller
+ WriteUninstaller "$INSTDIR\Uninstall.exe"
+ Push "DisplayName"
+ Push "@CPACK_NSIS_DISPLAY_NAME@"
+ Call ConditionalAddToRegisty
+ Push "DisplayVersion"
+ Push "@CPACK_PACKAGE_VERSION@"
+ Call ConditionalAddToRegisty
+ Push "Publisher"
+ Push "@CPACK_PACKAGE_VENDOR@"
+ Call ConditionalAddToRegisty
+ Push "UninstallString"
+ Push "$INSTDIR\Uninstall.exe"
+ Call ConditionalAddToRegisty
+ Push "NoRepair"
+ Push "1"
+ Call ConditionalAddToRegisty
+
+ !ifdef CPACK_NSIS_ADD_REMOVE
+ ;Create add/remove functionality
+ Push "ModifyPath"
+ Push "$INSTDIR\AddRemove.exe"
+ Call ConditionalAddToRegisty
+ !else
+ Push "NoModify"
+ Push "1"
+ Call ConditionalAddToRegisty
+ !endif
+
+ ; Optional registration
+ Push "DisplayIcon"
+ Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
+ Call ConditionalAddToRegisty
+ Push "HelpLink"
+ Push "@CPACK_NSIS_HELP_LINK@"
+ Call ConditionalAddToRegisty
+ Push "URLInfoAbout"
+ Push "@CPACK_NSIS_URL_INFO_ABOUT@"
+ Call ConditionalAddToRegisty
+ Push "Contact"
+ Push "@CPACK_NSIS_CONTACT@"
+ Call ConditionalAddToRegisty
+ !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+
+ ;Create shortcuts
+ CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
+@CPACK_NSIS_CREATE_ICONS@
+@CPACK_NSIS_CREATE_ICONS_EXTRA@
+ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
+
+ ;Read a value from an InstallOptions INI file
+ !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
+ !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State"
+ !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State"
+
+ ; Write special uninstall registry entries
+ Push "StartMenu"
+ Push "$STARTMENU_FOLDER"
+ Call ConditionalAddToRegisty
+ Push "DoNotAddToPath"
+ Push "$DO_NOT_ADD_TO_PATH"
+ Call ConditionalAddToRegisty
+ Push "AddToPathAllUsers"
+ Push "$ADD_TO_PATH_ALL_USERS"
+ Call ConditionalAddToRegisty
+ Push "AddToPathCurrentUser"
+ Push "$ADD_TO_PATH_CURRENT_USER"
+ Call ConditionalAddToRegisty
+ Push "InstallToDesktop"
+ Push "$INSTALL_DESKTOP"
+ Call ConditionalAddToRegisty
+
+ !insertmacro MUI_STARTMENU_WRITE_END
+
+@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
+
+SectionEnd
+
+Section "-Add to path"
+ Push $INSTDIR\bin
+ StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath
+ StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0
+ Call AddToPath
+ doNotAddToPath:
+SectionEnd
+
+;--------------------------------
+; Create custom pages
+Function InstallOptionsPage
+ !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@"
+ !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
+
+FunctionEnd
+
+;--------------------------------
+; determine admin versus local install
+Function un.onInit
+
+ ClearErrors
+ UserInfo::GetName
+ IfErrors noLM
+ Pop $0
+ UserInfo::GetAccountType
+ Pop $1
+ StrCmp $1 "Admin" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Admin group'
+ Goto done
+ StrCmp $1 "Power" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Power Users group'
+ Goto done
+
+ noLM:
+ ;Get installation folder from registry if available
+
+ done:
+
+FunctionEnd
+
+;--- Add/Remove callback functions: ---
+!macro SectionList MacroName
+ ;This macro used to perform operation on multiple sections.
+ ;List all of your components in following manner here.
+@CPACK_NSIS_COMPONENT_SECTION_LIST@
+!macroend
+
+Section -FinishComponents
+ ;Removes unselected components and writes component status to registry
+ !insertmacro SectionList "FinishSection"
+
+!ifdef CPACK_NSIS_ADD_REMOVE
+ ; Get the name of the installer executable
+ System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
+ StrCpy $R3 $R0
+
+ ; Strip off the last 13 characters, to see if we have AddRemove.exe
+ StrLen $R1 $R0
+ IntOp $R1 $R0 - 13
+ StrCpy $R2 $R0 13 $R1
+ StrCmp $R2 "AddRemove.exe" addremove_installed
+
+ ; We're not running AddRemove.exe, so install it
+ CopyFiles $R3 $INSTDIR\AddRemove.exe
+
+ addremove_installed:
+!endif
+SectionEnd
+;--- End of Add/Remove callback functions ---
+
+;--------------------------------
+; Component dependencies
+Function .onSelChange
+ !insertmacro SectionList MaybeSelectionChanged
+FunctionEnd
+
+;--------------------------------
+;Uninstaller Section
+
+Section "Uninstall"
+ ReadRegStr $START_MENU SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu"
+ ;MessageBox MB_OK "Start menu is in: $START_MENU"
+ ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath"
+ ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers"
+ ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser"
+ ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
+ ReadRegStr $INSTALL_DESKTOP SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop"
+ ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
+
+@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
+
+ ;Remove files we installed.
+ ;Keep the list of directories here in sync with the File commands above.
+@CPACK_NSIS_DELETE_FILES@
+@CPACK_NSIS_DELETE_DIRECTORIES@
+
+!ifdef CPACK_NSIS_ADD_REMOVE
+ ;Remove the add/remove program
+ Delete "$INSTDIR\AddRemove.exe"
+!endif
+
+ ;Remove the uninstaller itself.
+ Delete "$INSTDIR\Uninstall.exe"
+ DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+ ;Remove the installation directory if it is empty.
+ RMDir "$INSTDIR"
+
+ ; Remove the registry entries.
+ DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+ ; Removes all optional components
+ !insertmacro SectionList "RemoveSection"
+
+ !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
+
+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
+@CPACK_NSIS_DELETE_ICONS@
+@CPACK_NSIS_DELETE_ICONS_EXTRA@
+
+ ;Delete empty start menu parent diretories
+ StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
+
+ startMenuDeleteLoop:
+ ClearErrors
+ RMDir $MUI_TEMP
+ GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
+
+ IfErrors startMenuDeleteLoopDone
+
+ StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
+ startMenuDeleteLoopDone:
+
+ ; If the user changed the shortcut, then untinstall may not work. This should
+ ; try to fix it.
+ StrCpy $MUI_TEMP "$START_MENU"
+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
+@CPACK_NSIS_DELETE_ICONS_EXTRA@
+
+ ;Delete empty start menu parent diretories
+ StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
+
+ secondStartMenuDeleteLoop:
+ ClearErrors
+ RMDir $MUI_TEMP
+ GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
+
+ IfErrors secondStartMenuDeleteLoopDone
+
+ StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop
+ secondStartMenuDeleteLoopDone:
+
+ DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+ Push $INSTDIR\bin
+ StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0
+ Call un.RemoveFromPath
+ doNotRemoveFromPath:
+SectionEnd
+
+;--------------------------------
+; determine admin versus local install
+; Is install for "AllUsers" or "JustMe"?
+; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
+; This function is used for the very first "custom page" of the installer.
+; This custom page does not show up visibly, but it executes prior to the
+; first visible page and sets up $INSTDIR properly...
+; Choose different default installation folder based on SV_ALLUSERS...
+; "Program Files" for AllUsers, "My Documents" for JustMe...
+
+Function .onInit
+ StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst
+
+ ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "UninstallString"
+ StrCmp $0 "" inst
+
+ MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \
+ "@CPACK_NSIS_PACKAGE_NAME@ is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \
+ IDYES uninst IDNO inst
+ Abort
+
+;Run the uninstaller
+uninst:
+ ClearErrors
+ ExecWait '$0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
+
+ IfErrors uninst_failed inst
+uninst_failed:
+ MessageBox MB_OK|MB_ICONSTOP "Uninstall failed."
+ Abort
+
+
+inst:
+ ; Reads components status for registry
+ !insertmacro SectionList "InitSection"
+
+ ; check to see if /D has been used to change
+ ; the install directory by comparing it to the
+ ; install directory that is expected to be the
+ ; default
+ StrCpy $IS_DEFAULT_INSTALLDIR 0
+ StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2
+ StrCpy $IS_DEFAULT_INSTALLDIR 1
+
+ StrCpy $SV_ALLUSERS "JustMe"
+ ; if default install dir then change the default
+ ; if it is installed for JustMe
+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+ StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+
+ ClearErrors
+ UserInfo::GetName
+ IfErrors noLM
+ Pop $0
+ UserInfo::GetAccountType
+ Pop $1
+ StrCmp $1 "Admin" 0 +4
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Admin group'
+ StrCpy $SV_ALLUSERS "AllUsers"
+ Goto done
+ StrCmp $1 "Power" 0 +4
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Power Users group'
+ StrCpy $SV_ALLUSERS "AllUsers"
+ Goto done
+
+ noLM:
+ StrCpy $SV_ALLUSERS "AllUsers"
+ ;Get installation folder from registry if available
+
+ done:
+ StrCmp $SV_ALLUSERS "AllUsers" 0 +3
+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+ StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+
+ StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
+ !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
+
+ noOptionsPage:
+FunctionEnd
diff --git a/Modules/Platform/AIX-GNU-ASM.cmake b/Modules/Platform/AIX-GNU-ASM.cmake
new file mode 100644
index 000000000..c256df6f9
--- /dev/null
+++ b/Modules/Platform/AIX-GNU-ASM.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-GNU)
+__aix_compiler_gnu(ASM)
diff --git a/Modules/Platform/AIX-GNU-C.cmake b/Modules/Platform/AIX-GNU-C.cmake
new file mode 100644
index 000000000..f49d528b3
--- /dev/null
+++ b/Modules/Platform/AIX-GNU-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-GNU)
+__aix_compiler_gnu(C)
diff --git a/Modules/Platform/AIX-GNU-CXX.cmake b/Modules/Platform/AIX-GNU-CXX.cmake
new file mode 100644
index 000000000..ec8e83fa1
--- /dev/null
+++ b/Modules/Platform/AIX-GNU-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-GNU)
+__aix_compiler_gnu(CXX)
diff --git a/Modules/Platform/AIX-GNU-Fortran.cmake b/Modules/Platform/AIX-GNU-Fortran.cmake
new file mode 100644
index 000000000..07772a716
--- /dev/null
+++ b/Modules/Platform/AIX-GNU-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-GNU)
+__aix_compiler_gnu(Fortran)
diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake
new file mode 100644
index 000000000..81ba3657f
--- /dev/null
+++ b/Modules/Platform/AIX-GNU.cmake
@@ -0,0 +1,26 @@
+
+#=============================================================================
+# 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 module is shared by multiple languages; use include blocker.
+if(__AIX_COMPILER_GNU)
+ return()
+endif()
+set(__AIX_COMPILER_GNU 1)
+
+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,-brtl,-bnoipath")
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib
+endmacro()
diff --git a/Modules/Platform/AIX-VisualAge-C.cmake b/Modules/Platform/AIX-VisualAge-C.cmake
new file mode 100644
index 000000000..67b3171dc
--- /dev/null
+++ b/Modules/Platform/AIX-VisualAge-C.cmake
@@ -0,0 +1 @@
+include(Platform/AIX-XL-C)
diff --git a/Modules/Platform/AIX-VisualAge-CXX.cmake b/Modules/Platform/AIX-VisualAge-CXX.cmake
new file mode 100644
index 000000000..7894d244f
--- /dev/null
+++ b/Modules/Platform/AIX-VisualAge-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/AIX-XL-CXX)
diff --git a/Modules/Platform/AIX-VisualAge-Fortran.cmake b/Modules/Platform/AIX-VisualAge-Fortran.cmake
new file mode 100644
index 000000000..19e59d666
--- /dev/null
+++ b/Modules/Platform/AIX-VisualAge-Fortran.cmake
@@ -0,0 +1 @@
+include(Platform/AIX-XL-Fortran)
diff --git a/Modules/Platform/AIX-XL-ASM.cmake b/Modules/Platform/AIX-XL-ASM.cmake
new file mode 100644
index 000000000..ea0944ba4
--- /dev/null
+++ b/Modules/Platform/AIX-XL-ASM.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-XL)
+__aix_compiler_xl(ASM)
diff --git a/Modules/Platform/AIX-XL-C.cmake b/Modules/Platform/AIX-XL-C.cmake
new file mode 100644
index 000000000..5e437fafd
--- /dev/null
+++ b/Modules/Platform/AIX-XL-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-XL)
+__aix_compiler_xl(C)
diff --git a/Modules/Platform/AIX-XL-CXX.cmake b/Modules/Platform/AIX-XL-CXX.cmake
new file mode 100644
index 000000000..ef38a5f23
--- /dev/null
+++ b/Modules/Platform/AIX-XL-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-XL)
+__aix_compiler_xl(CXX)
diff --git a/Modules/Platform/AIX-XL-Fortran.cmake b/Modules/Platform/AIX-XL-Fortran.cmake
new file mode 100644
index 000000000..6d4f6559f
--- /dev/null
+++ b/Modules/Platform/AIX-XL-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-XL)
+__aix_compiler_xl(Fortran)
diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake
new file mode 100644
index 000000000..1f9415219
--- /dev/null
+++ b/Modules/Platform/AIX-XL.cmake
@@ -0,0 +1,28 @@
+
+#=============================================================================
+# Copyright 2002-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.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__AIX_COMPILER_XL)
+ return()
+endif()
+set(__AIX_COMPILER_XL 1)
+
+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,-brtl,-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_${lang}_FLAGS " ")
+ set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ")
+endmacro()
diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake
new file mode 100644
index 000000000..a9f773ed1
--- /dev/null
+++ b/Modules/Platform/AIX.cmake
@@ -0,0 +1,29 @@
+SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
+SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so
+SET(CMAKE_DL_LIBS "-lld")
+
+# RPATH support on AIX is called libpath. By default the runtime
+# libpath is paths specified by -L followed by /usr/lib and /lib. In
+# order to prevent the -L paths from being used we must force use of
+# -Wl,-blibpath:/usr/lib:/lib whether RPATH support is on or not.
+# When our own RPATH is to be added it may be inserted before the
+# "always" paths.
+SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib)
+
+# Files named "libfoo.a" may actually be shared libraries.
+SET_PROPERTY(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1)
+
+# since .a can be a static or shared library on AIX, we can not do this.
+# at some point if we wanted it, we would have to figure out if a .a is
+# static or shared, then we could add this back:
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+#FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+# SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-bstatic")
+# SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-bdynamic")
+#ENDFOREACH(type)
+
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/BSDOS.cmake b/Modules/Platform/BSDOS.cmake
new file mode 100644
index 000000000..cf9d17bfd
--- /dev/null
+++ b/Modules/Platform/BSDOS.cmake
@@ -0,0 +1,2 @@
+INCLUDE(Platform/UnixPaths)
+
diff --git a/Modules/Platform/BeOS.cmake b/Modules/Platform/BeOS.cmake
new file mode 100644
index 000000000..3ffb67cb8
--- /dev/null
+++ b/Modules/Platform/BeOS.cmake
@@ -0,0 +1,12 @@
+SET(BEOS 1)
+
+SET(CMAKE_DL_LIBS root be)
+SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/BlueGeneL.cmake b/Modules/Platform/BlueGeneL.cmake
new file mode 100644
index 000000000..7794a26cf
--- /dev/null
+++ b/Modules/Platform/BlueGeneL.cmake
@@ -0,0 +1,40 @@
+#the compute nodes on BlueGene/L don't support shared libs
+SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared
+SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
+
+SET(CMAKE_LINK_LIBRARY_SUFFIX "")
+SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
+SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
+SET(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a
+SET(CMAKE_EXECUTABLE_SUFFIX "") # .exe
+SET(CMAKE_DL_LIBS "" )
+
+SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+
+
+INCLUDE(Platform/UnixPaths)
+
+IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_C_LINK_EXECUTABLE
+ "<CMAKE_C_COMPILER> -Wl,-relax <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lgcc,-lc -lnss_files -lnss_dns -lresolv")
+ELSE(CMAKE_COMPILER_IS_GNUCC)
+ # when using IBM xlc we probably don't want to link to -lgcc
+ SET(CMAKE_C_LINK_EXECUTABLE
+ "<CMAKE_C_COMPILER> -Wl,-relax <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lc -lnss_files -lnss_dns -lresolv")
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
+IF(CMAKE_COMPILER_IS_GNUCXX)
+ SET(CMAKE_CXX_LINK_EXECUTABLE
+ "<CMAKE_CXX_COMPILER> -Wl,-relax <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lstdc++,-lgcc,-lc -lnss_files -lnss_dns -lresolv")
+ELSE(CMAKE_COMPILER_IS_GNUCXX)
+ # when using the IBM xlC we probably don't want to link to -lgcc
+ SET(CMAKE_CXX_LINK_EXECUTABLE
+ "<CMAKE_CXX_COMPILER> -Wl,-relax <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lstdc++,-lc -lnss_files -lnss_dns -lresolv")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/Modules/Platform/BlueGeneP-base.cmake b/Modules/Platform/BlueGeneP-base.cmake
new file mode 100644
index 000000000..c0241e19d
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-base.cmake
@@ -0,0 +1,125 @@
+
+#=============================================================================
+# 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.)
+
+#
+# BlueGeneP base platform file.
+#
+# NOTE: Do not set your platform to "BlueGeneP-base". This file is included
+# by the real platform files. Use one of these two platforms instead:
+#
+# BlueGeneP-dynamic For dynamically linked builds
+# BlueGeneP-static For statically linked builds
+#
+# This platform file tries its best to adhere to the behavior of the MPI
+# compiler wrappers included with the latest BG/P drivers.
+#
+
+
+#
+# For BGP 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 BGP 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.
+#
+set(CMAKE_SYSTEM_LIBRARY_PATH
+ /bgsys/drivers/ppcfloor/comm/default/lib # default comm layer (used by mpi compiler wrappers)
+ /bgsys/drivers/ppcfloor/comm/sys/lib # DCMF, other lower-level comm libraries
+ /bgsys/drivers/ppcfloor/runtime/SPI # other low-level stuff
+ /bgsys/drivers/ppcfloor/gnu-linux/lib # CNK python installation directory
+ /bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/lib # CNK Linux image -- standard runtime libs, pthread, etc.
+)
+
+#
+# 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")
+
+#
+# This macro needs to be called for dynamic library support. Unfortunately on BGP,
+# 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(__BlueGeneP_set_dynamic_flags compiler_id lang)
+ if (${compiler_id} STREQUAL XL)
+ # Flags for XL compilers if we explicitly detected XL
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-qpie")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-qpic")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-qmkshrobj -qnostaticlink")
+ set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-qnostaticlink -qnostaticlink=libgcc")
+ else()
+ # Assume flags for GNU compilers (if the ID is GNU *or* anything else).
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+ set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-dynamic")
+ 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
+
+ set(BGP_${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 ${BGP_${lang}_DYNAMIC_EXE_FLAGS} ${BGP_${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(__BlueGeneP_set_static_flags compiler_id lang)
+ set(BGP_${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 ${BGP_${lang}_DEFAULT_EXE_FLAGS}")
+endmacro()
diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake
new file mode 100644
index 000000000..bd4696b6b
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-dynamic-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.)
+
+__BlueGeneP_set_dynamic_flags(GNU C)
diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake
new file mode 100644
index 000000000..9c995dc7b
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-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.)
+
+__BlueGeneP_set_dynamic_flags(GNU CXX)
diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake
new file mode 100644
index 000000000..19d6be8ec
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-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.)
+
+__BlueGeneP_set_dynamic_flags(GNU Fortran)
diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake
new file mode 100644
index 000000000..2dbbbc0ec
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-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.)
+
+__BlueGeneP_set_dynamic_flags(XL C)
diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake
new file mode 100644
index 000000000..2bc51272b
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-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.)
+
+__BlueGeneP_set_dynamic_flags(XL CXX)
diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake
new file mode 100644
index 000000000..59da63da6
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-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.)
+
+__BlueGeneP_set_dynamic_flags(XL Fortran)
diff --git a/Modules/Platform/BlueGeneP-dynamic.cmake b/Modules/Platform/BlueGeneP-dynamic.cmake
new file mode 100644
index 000000000..8f96f2f13
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-dynamic.cmake
@@ -0,0 +1,19 @@
+
+#=============================================================================
+# 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/BlueGeneP-base)
+set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
+set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
diff --git a/Modules/Platform/BlueGeneP-static-GNU-C.cmake b/Modules/Platform/BlueGeneP-static-GNU-C.cmake
new file mode 100644
index 000000000..412a7a3e5
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-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.)
+
+__BlueGeneP_set_static_flags(GNU C)
diff --git a/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake b/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake
new file mode 100644
index 000000000..418f0d8d5
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-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.)
+
+__BlueGeneP_set_static_flags(GNU CXX)
diff --git a/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake b/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake
new file mode 100644
index 000000000..119195b30
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-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.)
+
+__BlueGeneP_set_static_flags(GNU Fortran)
diff --git a/Modules/Platform/BlueGeneP-static-XL-C.cmake b/Modules/Platform/BlueGeneP-static-XL-C.cmake
new file mode 100644
index 000000000..1f2095932
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-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.)
+
+__BlueGeneP_set_static_flags(XL C)
diff --git a/Modules/Platform/BlueGeneP-static-XL-CXX.cmake b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake
new file mode 100644
index 000000000..f027a533f
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-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.)
+
+__BlueGeneP_set_static_flags(XL CXX)
diff --git a/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake b/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake
new file mode 100644
index 000000000..778d4bd91
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-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.)
+
+__BlueGeneP_set_static_flags(XL Fortran)
diff --git a/Modules/Platform/BlueGeneP-static.cmake b/Modules/Platform/BlueGeneP-static.cmake
new file mode 100644
index 000000000..c4f5f21a6
--- /dev/null
+++ b/Modules/Platform/BlueGeneP-static.cmake
@@ -0,0 +1,19 @@
+
+#=============================================================================
+# 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/BlueGeneP-base)
+set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
diff --git a/Modules/Platform/CYGWIN-GNU-C.cmake b/Modules/Platform/CYGWIN-GNU-C.cmake
new file mode 100644
index 000000000..9eb0ecf29
--- /dev/null
+++ b/Modules/Platform/CYGWIN-GNU-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/CYGWIN-GNU)
+__cygwin_compiler_gnu(C)
diff --git a/Modules/Platform/CYGWIN-GNU-CXX.cmake b/Modules/Platform/CYGWIN-GNU-CXX.cmake
new file mode 100644
index 000000000..2603dcd49
--- /dev/null
+++ b/Modules/Platform/CYGWIN-GNU-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/CYGWIN-GNU)
+__cygwin_compiler_gnu(CXX)
diff --git a/Modules/Platform/CYGWIN-GNU-Fortran.cmake b/Modules/Platform/CYGWIN-GNU-Fortran.cmake
new file mode 100644
index 000000000..d3b49b6f9
--- /dev/null
+++ b/Modules/Platform/CYGWIN-GNU-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/CYGWIN-GNU)
+__cygwin_compiler_gnu(Fortran)
diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake
new file mode 100644
index 000000000..eae313a50
--- /dev/null
+++ b/Modules/Platform/CYGWIN-GNU.cmake
@@ -0,0 +1,56 @@
+
+#=============================================================================
+# 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 module is shared by multiple languages; use include blocker.
+if(__CYGWIN_COMPILER_GNU)
+ return()
+endif()
+set(__CYGWIN_COMPILER_GNU 1)
+
+# TODO: Is -Wl,--enable-auto-import now always default?
+set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--enable-auto-import")
+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
+ "<CMAKE_${lang}_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_${lang}_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> <LANGUAGE_COMPILE_FLAGS> <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>")
+ 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>")
+
+ # No -fPIC on cygwin
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
+
+ # Initialize C link type selection flags. These flags are used when
+ # building a shared library, shared module, or executable that links
+ # to other libraries to select whether to use the static or shared
+ # versions of the libraries.
+ FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic")
+ ENDFOREACH(type)
+
+ set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-all-symbols")
+ # 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}")
+endmacro()
diff --git a/Modules/Platform/CYGWIN-windres.cmake b/Modules/Platform/CYGWIN-windres.cmake
new file mode 100644
index 000000000..8bc1b15e9
--- /dev/null
+++ b/Modules/Platform/CYGWIN-windres.cmake
@@ -0,0 +1 @@
+SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <FLAGS> <DEFINES> <SOURCE> <OBJECT>")
diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake
new file mode 100644
index 000000000..b7ad2cee1
--- /dev/null
+++ b/Modules/Platform/CYGWIN.cmake
@@ -0,0 +1,64 @@
+if("${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS "2.8.3.20101214")
+ set(__USE_CMAKE_LEGACY_CYGWIN_WIN32 1)
+endif()
+if(NOT DEFINED WIN32)
+ set(WIN32 0)
+ if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32)
+ if(NOT DEFINED CMAKE_LEGACY_CYGWIN_WIN32
+ AND DEFINED ENV{CMAKE_LEGACY_CYGWIN_WIN32})
+ set(CMAKE_LEGACY_CYGWIN_WIN32 $ENV{CMAKE_LEGACY_CYGWIN_WIN32})
+ endif()
+ if(CMAKE_LEGACY_CYGWIN_WIN32)
+ message(STATUS "Defining WIN32 under Cygwin due to CMAKE_LEGACY_CYGWIN_WIN32")
+ set(WIN32 1)
+ elseif("x${CMAKE_LEGACY_CYGWIN_WIN32}" STREQUAL "x")
+ message(WARNING "CMake no longer defines WIN32 on Cygwin!"
+ "\n"
+ "(1) If you are just trying to build this project, ignore this warning "
+ "or quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or "
+ "in the CMake cache. "
+ "If later configuration or build errors occur then this project may "
+ "have been written under the assumption that Cygwin is WIN32. "
+ "In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead."
+ "\n"
+ "(2) If you are developing this project, add the line\n"
+ " set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required\n"
+ "at the top of your top-level CMakeLists.txt file or set the minimum "
+ "required version of CMake to 2.8.4 or higher. "
+ "Then teach your project to build on Cygwin without WIN32.")
+ endif()
+ elseif(DEFINED CMAKE_LEGACY_CYGWIN_WIN32)
+ message(AUTHOR_WARNING "CMAKE_LEGACY_CYGWIN_WIN32 ignored because\n"
+ " cmake_minimum_required(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})\n"
+ "is at least 2.8.4.")
+ endif()
+endif()
+if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32)
+ # Pass WIN32 legacy setting to scripts.
+ if(WIN32)
+ set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 1)
+ else()
+ set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 0)
+ endif()
+ unset(__USE_CMAKE_LEGACY_CYGWIN_WIN32)
+endif()
+
+SET(CYGWIN 1)
+
+SET(CMAKE_SHARED_LIBRARY_PREFIX "cyg")
+SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
+SET(CMAKE_SHARED_MODULE_PREFIX "cyg")
+SET(CMAKE_SHARED_MODULE_SUFFIX ".dll")
+SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib")
+SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a")
+SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe
+# Modules have a different default prefix that shared libs.
+SET(CMAKE_MODULE_EXISTS 1)
+
+SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a")
+
+# Shared libraries on cygwin can be named with their version number.
+SET(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1)
+
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/Catamount.cmake b/Modules/Platform/Catamount.cmake
new file mode 100644
index 000000000..01493fc21
--- /dev/null
+++ b/Modules/Platform/Catamount.cmake
@@ -0,0 +1,26 @@
+#Catamount, which runs on the compute nodes of Cray machines, e.g. RedStorm, doesn't support shared libs
+SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared
+SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
+
+SET(CMAKE_LINK_LIBRARY_SUFFIX "")
+SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
+SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
+SET(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a
+SET(CMAKE_EXECUTABLE_SUFFIX "") # .exe
+SET(CMAKE_DL_LIBS "" )
+
+SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+
+INCLUDE(Platform/UnixPaths)
+
+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/Darwin-Absoft-Fortran.cmake b/Modules/Platform/Darwin-Absoft-Fortran.cmake
new file mode 100644
index 000000000..beb41a3b8
--- /dev/null
+++ b/Modules/Platform/Darwin-Absoft-Fortran.cmake
@@ -0,0 +1 @@
+set(CMAKE_Fortran_VERBOSE_FLAG "-X -v") # Runs gcc under the hood.
diff --git a/Modules/Platform/Darwin-GNU-C.cmake b/Modules/Platform/Darwin-GNU-C.cmake
new file mode 100644
index 000000000..4e326c4ca
--- /dev/null
+++ b/Modules/Platform/Darwin-GNU-C.cmake
@@ -0,0 +1,4 @@
+include(Platform/Darwin-GNU)
+__darwin_compiler_gnu(C)
+cmake_gnu_has_isysroot(C)
+cmake_gnu_set_osx_deployment_target_flag(C)
diff --git a/Modules/Platform/Darwin-GNU-CXX.cmake b/Modules/Platform/Darwin-GNU-CXX.cmake
new file mode 100644
index 000000000..b39487e58
--- /dev/null
+++ b/Modules/Platform/Darwin-GNU-CXX.cmake
@@ -0,0 +1,4 @@
+include(Platform/Darwin-GNU)
+__darwin_compiler_gnu(CXX)
+cmake_gnu_has_isysroot(CXX)
+cmake_gnu_set_osx_deployment_target_flag(CXX)
diff --git a/Modules/Platform/Darwin-GNU-Fortran.cmake b/Modules/Platform/Darwin-GNU-Fortran.cmake
new file mode 100644
index 000000000..8e8acc377
--- /dev/null
+++ b/Modules/Platform/Darwin-GNU-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/Darwin-GNU)
+__darwin_compiler_gnu(Fortran)
diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake
new file mode 100644
index 000000000..8a50a6ab9
--- /dev/null
+++ b/Modules/Platform/Darwin-GNU.cmake
@@ -0,0 +1,64 @@
+
+#=============================================================================
+# 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 module is shared by multiple languages; use include blocker.
+if(__DARWIN_COMPILER_GNU)
+ return()
+endif()
+set(__DARWIN_COMPILER_GNU 1)
+
+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")
+endmacro()
+
+macro(cmake_gnu_has_isysroot lang)
+ if("x${CMAKE_${lang}_HAS_ISYSROOT}" STREQUAL "x")
+ set(_doc "${lang} compiler has -isysroot")
+ message(STATUS "Checking whether ${_doc}")
+ execute_process(
+ COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help"
+ OUTPUT_VARIABLE _gcc_help
+ ERROR_VARIABLE _gcc_help
+ )
+ if("${_gcc_help}" MATCHES "isysroot")
+ message(STATUS "Checking whether ${_doc} - yes")
+ set(CMAKE_${lang}_HAS_ISYSROOT 1)
+ else()
+ message(STATUS "Checking whether ${_doc} - no")
+ set(CMAKE_${lang}_HAS_ISYSROOT 0)
+ endif()
+ endif()
+endmacro()
+
+macro(cmake_gnu_set_osx_deployment_target_flag lang)
+ if(NOT DEFINED CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG)
+ set(_doc "${lang} compiler supports OSX deployment target flag")
+ message(STATUS "Checking whether ${_doc}")
+ execute_process(
+ COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help"
+ OUTPUT_VARIABLE _gcc_help
+ ERROR_VARIABLE _gcc_help
+ )
+ if("${_gcc_help}" MATCHES "macosx-version-min")
+ message(STATUS "Checking whether ${_doc} - yes")
+ set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=")
+ else()
+ message(STATUS "Checking whether ${_doc} - no")
+ set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "")
+ endif()
+ set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG_CODE "SET(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG \"${CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG}\")")
+ endif()
+endmacro()
diff --git a/Modules/Platform/Darwin-NAG-Fortran.cmake b/Modules/Platform/Darwin-NAG-Fortran.cmake
new file mode 100644
index 000000000..933f9e1a2
--- /dev/null
+++ b/Modules/Platform/Darwin-NAG-Fortran.cmake
@@ -0,0 +1,5 @@
+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>")
diff --git a/Modules/Platform/Darwin-VisualAge-C.cmake b/Modules/Platform/Darwin-VisualAge-C.cmake
new file mode 100644
index 000000000..859914f86
--- /dev/null
+++ b/Modules/Platform/Darwin-VisualAge-C.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin-XL-C)
diff --git a/Modules/Platform/Darwin-VisualAge-CXX.cmake b/Modules/Platform/Darwin-VisualAge-CXX.cmake
new file mode 100644
index 000000000..46c1005df
--- /dev/null
+++ b/Modules/Platform/Darwin-VisualAge-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin-XL-CXX)
diff --git a/Modules/Platform/Darwin-XL-C.cmake b/Modules/Platform/Darwin-XL-C.cmake
new file mode 100644
index 000000000..934ebcc8c
--- /dev/null
+++ b/Modules/Platform/Darwin-XL-C.cmake
@@ -0,0 +1,5 @@
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj")
+SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle")
+
+# Enable shared library versioning.
+SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-install_name")
diff --git a/Modules/Platform/Darwin-XL-CXX.cmake b/Modules/Platform/Darwin-XL-CXX.cmake
new file mode 100644
index 000000000..22ae0183a
--- /dev/null
+++ b/Modules/Platform/Darwin-XL-CXX.cmake
@@ -0,0 +1,5 @@
+SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj")
+SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "-bundle")
+
+# Enable shared library versioning.
+SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-install_name")
diff --git a/Modules/Platform/Darwin-icc.cmake b/Modules/Platform/Darwin-icc.cmake
new file mode 100644
index 000000000..b592e5f55
--- /dev/null
+++ b/Modules/Platform/Darwin-icc.cmake
@@ -0,0 +1,131 @@
+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(CMAKE_COMPILER_IS_GNUCC)
+
+# 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(CMAKE_COMPILER_IS_GNUCXX)
+ENDIF ( _OSX_VERSION MATCHES "^10.4" )
+
+
+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(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
+ # now put _CMAKE_OSX_MACHINE into the cache
+ SET(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE}
+ CACHE STRING "Build architectures for OSX")
+ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
+
+
+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("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$")
+
+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(NOT XCODE)
+
+# Xcode does not support -isystem yet.
+IF(XCODE)
+ SET(CMAKE_INCLUDE_SYSTEM_FLAG_C)
+ SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+ENDIF(XCODE)
+
+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
new file mode 100644
index 000000000..e247bae28
--- /dev/null
+++ b/Modules/Platform/Darwin-icpc.cmake
@@ -0,0 +1,3 @@
+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
new file mode 100644
index 000000000..eff07b295
--- /dev/null
+++ b/Modules/Platform/Darwin.cmake
@@ -0,0 +1,268 @@
+SET(APPLE 1)
+
+# Darwin versions:
+# 6.x == Mac OSX 10.2 (Jaguar)
+# 7.x == Mac OSX 10.3 (Panther)
+# 8.x == Mac OSX 10.4 (Tiger)
+# 9.x == Mac OSX 10.5 (Leopard)
+# 10.x == Mac OSX 10.6 (Snow Leopard)
+# 11.x == Mac OSX 10.7 (Lion)
+# 12.x == Mac OSX 10.8 (Mountain Lion)
+STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_SYSTEM_VERSION}")
+STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\2" DARWIN_MINOR_VERSION "${CMAKE_SYSTEM_VERSION}")
+
+# Do not use the "-Wl,-search_paths_first" flag with the OSX 10.2 compiler.
+# Done this way because it is too early to do a TRY_COMPILE.
+IF(NOT DEFINED HAVE_FLAG_SEARCH_PATHS_FIRST)
+ SET(HAVE_FLAG_SEARCH_PATHS_FIRST 0)
+ IF("${DARWIN_MAJOR_VERSION}" GREATER 6)
+ SET(HAVE_FLAG_SEARCH_PATHS_FIRST 1)
+ ENDIF("${DARWIN_MAJOR_VERSION}" GREATER 6)
+ENDIF(NOT DEFINED HAVE_FLAG_SEARCH_PATHS_FIRST)
+# More desirable, but does not work:
+ #INCLUDE(CheckCXXCompilerFlag)
+ #CHECK_CXX_COMPILER_FLAG("-Wl,-search_paths_first" HAVE_FLAG_SEARCH_PATHS_FIRST)
+
+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_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
+SET(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
+SET(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
+SET(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
+
+SET(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names")
+SET(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names")
+
+IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
+ SET(CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
+ SET(CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
+ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST)
+
+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_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")
+
+# 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
+# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun)
+# hardcode CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did before, Alex
+IF(NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
+ FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL install_name_tool)
+ MARK_AS_ADVANCED(CMAKE_INSTALL_NAME_TOOL)
+ENDIF(NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
+
+# Set the assumed (Pre 10.5 or Default) location of the developer tools
+SET(OSX_DEVELOPER_ROOT "/Developer")
+
+# Use the xcode-select tool if it's available (Xcode >= 3.0 installations)
+FIND_PROGRAM(CMAKE_XCODE_SELECT xcode-select)
+MARK_AS_ADVANCED(CMAKE_XCODE_SELECT)
+IF(CMAKE_XCODE_SELECT)
+ EXECUTE_PROCESS(COMMAND ${CMAKE_XCODE_SELECT} "-print-path"
+ OUTPUT_VARIABLE OSX_DEVELOPER_ROOT
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDIF(CMAKE_XCODE_SELECT)
+
+# Find installed SDKs
+# Start with Xcode-4.3+ default SDKs directory
+SET(_CMAKE_OSX_SDKS_DIR
+ "${OSX_DEVELOPER_ROOT}/Platforms/MacOSX.platform/Developer/SDKs")
+FILE(GLOB _CMAKE_OSX_SDKS "${_CMAKE_OSX_SDKS_DIR}/*")
+
+# If not present, try pre-4.3 SDKs directory
+IF(NOT _CMAKE_OSX_SDKS)
+SET(_CMAKE_OSX_SDKS_DIR "${OSX_DEVELOPER_ROOT}/SDKs")
+ FILE(GLOB _CMAKE_OSX_SDKS "${_CMAKE_OSX_SDKS_DIR}/*")
+ENDIF(NOT _CMAKE_OSX_SDKS)
+
+EXECUTE_PROCESS(COMMAND sw_vers -productVersion
+ OUTPUT_VARIABLE CURRENT_OSX_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+#----------------------------------------------------------------------------
+# _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(_CURRENT_OSX_VERSION VERSION_GREATER 10.3)
+
+#----------------------------------------------------------------------------
+# CMAKE_OSX_SYSROOT
+
+# Environment variable set by the user overrides our default.
+# Use the same environment variable that Xcode uses.
+SET(ENV_SDKROOT "$ENV{SDKROOT}")
+
+# Set CMAKE_OSX_SYSROOT_DEFAULT based on _CURRENT_OSX_VERSION,
+# accounting for the known specially named SDKs.
+SET(CMAKE_OSX_SYSROOT_DEFAULT
+ "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CURRENT_OSX_VERSION}.sdk")
+
+IF(_CURRENT_OSX_VERSION STREQUAL "10.4")
+ SET(CMAKE_OSX_SYSROOT_DEFAULT
+ "${_CMAKE_OSX_SDKS_DIR}/MacOSX10.4u.sdk")
+ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.4")
+
+IF(_CURRENT_OSX_VERSION STREQUAL "10.3")
+ SET(CMAKE_OSX_SYSROOT_DEFAULT
+ "${_CMAKE_OSX_SDKS_DIR}/MacOSX10.3.9.sdk")
+ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.3")
+
+# Use environment or default as initial cache value:
+IF(NOT ENV_SDKROOT STREQUAL "")
+ SET(CMAKE_OSX_SYSROOT_VALUE ${ENV_SDKROOT})
+ELSE(NOT ENV_SDKROOT STREQUAL "")
+ SET(CMAKE_OSX_SYSROOT_VALUE ${CMAKE_OSX_SYSROOT_DEFAULT})
+ENDIF(NOT ENV_SDKROOT STREQUAL "")
+
+# Set cache variable - end user may change this during ccmake or cmake-gui configure.
+SET(CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT_VALUE} CACHE PATH
+ "The product will be built against the headers and libraries located inside the indicated SDK.")
+
+#----------------------------------------------------------------------------
+function(SanityCheckSDKAndDeployTarget _sdk_path _deploy)
+ if(_deploy STREQUAL "")
+ return()
+ endif()
+
+ if(_sdk_path STREQUAL "")
+ message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET='${_deploy}' but CMAKE_OSX_SYSROOT is empty... - either set CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to empty")
+ endif()
+
+ string(REGEX REPLACE "(.*MacOSX*)(....)(.*\\.sdk)" "\\2" SDK "${_sdk_path}")
+ if(_deploy GREATER "${SDK}")
+ message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET (${_deploy}) is greater than CMAKE_OSX_SYSROOT SDK (${_sdk_path}). Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${SDK} or lower")
+ endif()
+endfunction(SanityCheckSDKAndDeployTarget)
+#----------------------------------------------------------------------------
+
+# Make sure the combination of SDK and Deployment Target are allowed
+SanityCheckSDKAndDeployTarget("${CMAKE_OSX_SYSROOT}" "${CMAKE_OSX_DEPLOYMENT_TARGET}")
+
+# set _CMAKE_OSX_MACHINE to uname -m
+EXECUTE_PROCESS(COMMAND uname -m
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE _CMAKE_OSX_MACHINE)
+
+# check for Power PC and change to ppc
+IF(_CMAKE_OSX_MACHINE MATCHES "Power")
+ SET(_CMAKE_OSX_MACHINE ppc)
+ENDIF(_CMAKE_OSX_MACHINE MATCHES "Power")
+
+# check for environment variable CMAKE_OSX_ARCHITECTURES
+# if it is set.
+IF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
+ SET(CMAKE_OSX_ARCHITECTURES_VALUE "$ENV{CMAKE_OSX_ARCHITECTURES}")
+ELSE(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
+ SET(CMAKE_OSX_ARCHITECTURES_VALUE "")
+ENDIF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
+
+# now put _CMAKE_OSX_MACHINE into the cache
+SET(CMAKE_OSX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES_VALUE} CACHE STRING
+ "Build architectures for OSX")
+
+
+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("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$")
+
+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")
+ENDIF(NOT XCODE)
+
+# Xcode does not support -isystem yet.
+IF(XCODE)
+ SET(CMAKE_INCLUDE_SYSTEM_FLAG_C)
+ SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+ENDIF(XCODE)
+
+IF("${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5")
+ # Need to list dependent shared libraries on link line. When building
+ # with -isysroot (for universal binaries), the linker always looks for
+ # dependent libraries under the sysroot. Listing them on the link
+ # line works around the problem.
+ SET(CMAKE_LINK_DEPENDENT_LIBRARY_FILES 1)
+ENDIF()
+
+SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
+SET(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
+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>")
+
+SET(CMAKE_C_CREATE_MACOSX_FRAMEWORK
+ "<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_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>")
+
+
+# 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(_apps_paths)
+FOREACH(_path
+ "~/Applications"
+ "/Applications"
+ "${OSX_DEVELOPER_ROOT}/../Applications" # Xcode 4.3+
+ "${OSX_DEVELOPER_ROOT}/Applications" # pre-4.3
+ )
+ GET_FILENAME_COMPONENT(_apps "${_path}" ABSOLUTE)
+ IF(EXISTS "${_apps}")
+ LIST(APPEND _apps_paths "${_apps}")
+ ENDIF()
+ENDFOREACH()
+LIST(REMOVE_DUPLICATES _apps_paths)
+SET(CMAKE_SYSTEM_APPBUNDLE_PATH
+ ${_apps_paths})
+UNSET(_apps_paths)
+
+INCLUDE(Platform/UnixPaths)
+LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ /sw # Fink
+ /opt/local # MacPorts
+ )
diff --git a/Modules/Platform/DragonFly.cmake b/Modules/Platform/DragonFly.cmake
new file mode 100644
index 000000000..f6e0f810f
--- /dev/null
+++ b/Modules/Platform/DragonFly.cmake
@@ -0,0 +1,5 @@
+# DragonFly BSD was forked from FreeBSD and is still very close to it
+# http://www.dragonflybsd.org
+# see http://archive.netbsd.se/?ml=dfbsd-users&a=2007-07&m=4678361
+
+INCLUDE(Platform/FreeBSD)
diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake
new file mode 100644
index 000000000..82fe961fb
--- /dev/null
+++ b/Modules/Platform/FreeBSD.cmake
@@ -0,0 +1,28 @@
+IF(EXISTS /usr/include/dlfcn.h)
+ SET(CMAKE_DL_LIBS "")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+ SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
+ SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
+ SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
+ SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
+ SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+ SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+ENDIF(EXISTS /usr/include/dlfcn.h)
+
+# Shared libraries with no builtin soname may not be linked safely by
+# specifying the file path.
+SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ENDFOREACH(type)
+
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/GNU.cmake b/Modules/Platform/GNU.cmake
new file mode 100644
index 000000000..4bcfd51ce
--- /dev/null
+++ b/Modules/Platform/GNU.cmake
@@ -0,0 +1,13 @@
+# GCC is the default compiler on GNU/Hurd.
+SET(CMAKE_DL_LIBS "dl")
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
+SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+
+SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-gnu[a-z0-9_]*")
+
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/GNUtoMS_lib.bat.in b/Modules/Platform/GNUtoMS_lib.bat.in
new file mode 100644
index 000000000..2da920ab0
--- /dev/null
+++ b/Modules/Platform/GNUtoMS_lib.bat.in
@@ -0,0 +1,3 @@
+@echo off
+call "@CMAKE_GNUtoMS_BAT@"
+lib /machine:"@CMAKE_GNUtoMS_ARCH@" %*
diff --git a/Modules/Platform/GNUtoMS_lib.cmake b/Modules/Platform/GNUtoMS_lib.cmake
new file mode 100644
index 000000000..ca9b0f8da
--- /dev/null
+++ b/Modules/Platform/GNUtoMS_lib.cmake
@@ -0,0 +1,10 @@
+# Usage: cmake -Dlib=lib.bat -Ddef=out.def -Ddll=out.dll -Dimp=out.dll.a -P GNUtoMS_lib.cmake
+get_filename_component(name ${dll} NAME) # .dll file name
+string(REGEX REPLACE "\\.dll\\.a$" ".lib" out "${imp}") # .dll.a -> .lib
+execute_process(
+ COMMAND ${lib} /def:${def} /name:${name} /out:${out}
+ RESULT_VARIABLE res
+ )
+if(res)
+ message(FATAL_ERROR "lib failed: ${res}")
+endif()
diff --git a/Modules/Platform/Generic-ADSP-ASM.cmake b/Modules/Platform/Generic-ADSP-ASM.cmake
new file mode 100644
index 000000000..cec4c2f68
--- /dev/null
+++ b/Modules/Platform/Generic-ADSP-ASM.cmake
@@ -0,0 +1,7 @@
+INCLUDE(Platform/Generic-ADSP-Common)
+
+SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm)
+SET(CMAKE_ASM_OUTPUT_EXTENSION ".doj" )
+SET(CMAKE_ASM_COMPILE_OBJECT
+ "<CMAKE_ASM_COMPILER> <FLAGS> -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <OBJECT> <SOURCE>")
+
diff --git a/Modules/Platform/Generic-ADSP-C.cmake b/Modules/Platform/Generic-ADSP-C.cmake
new file mode 100644
index 000000000..f0644687f
--- /dev/null
+++ b/Modules/Platform/Generic-ADSP-C.cmake
@@ -0,0 +1,20 @@
+
+INCLUDE(Platform/Generic-ADSP-Common)
+
+
+SET(CMAKE_C_OUTPUT_EXTENSION ".doj")
+
+SET(CMAKE_C_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "")
+SET(CMAKE_C_FLAGS_RELEASE_INIT "")
+SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "")
+
+SET(CMAKE_C_CREATE_STATIC_LIBRARY
+ "<CMAKE_C_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_C_LINK_FLAGS> <OBJECTS>")
+
+SET(CMAKE_C_LINK_EXECUTABLE
+ "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+
+SET(CMAKE_C_CREATE_SHARED_LIBRARY)
+SET(CMAKE_C_CREATE_MODULE_LIBRARY)
+
diff --git a/Modules/Platform/Generic-ADSP-CXX.cmake b/Modules/Platform/Generic-ADSP-CXX.cmake
new file mode 100644
index 000000000..21daa81c9
--- /dev/null
+++ b/Modules/Platform/Generic-ADSP-CXX.cmake
@@ -0,0 +1,18 @@
+INCLUDE(Platform/Generic-ADSP-Common)
+
+SET(CMAKE_CXX_OUTPUT_EXTENSION ".doj")
+
+SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "")
+SET(CMAKE_CXX_FLAGS_RELEASE_INIT "")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "")
+
+SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
+ "<CMAKE_CXX_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_CXX_LINK_FLAGS> <OBJECTS>")
+
+SET(CMAKE_CXX_LINK_EXECUTABLE
+ "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+
+SET(CMAKE_CXX_CREATE_SHARED_LIBRARY)
+SET(CMAKE_CXX_CREATE_MODULE_LIBRARY)
+
diff --git a/Modules/Platform/Generic-ADSP-Common.cmake b/Modules/Platform/Generic-ADSP-Common.cmake
new file mode 100644
index 000000000..10fb34e00
--- /dev/null
+++ b/Modules/Platform/Generic-ADSP-Common.cmake
@@ -0,0 +1,120 @@
+# support for the Analog Devices toolchain for their DSPs
+# Raphael Cotty" <raphael.cotty (AT) googlemail.com>
+#
+# it supports three architectures:
+# Blackfin
+# TS (TigerShark)
+# 21k (Sharc 21xxx)
+
+IF(NOT ADSP)
+
+ SET(ADSP TRUE)
+
+ SET(CMAKE_STATIC_LIBRARY_SUFFIX ".dlb")
+ SET(CMAKE_SHARED_LIBRARY_SUFFIX "")
+ SET(CMAKE_EXECUTABLE_SUFFIX ".dxe")
+
+ # if ADSP_PROCESSOR has not been set, but CMAKE_SYSTEM_PROCESSOR has,
+ # assume that this is the processor name to use for the compiler
+ IF(CMAKE_SYSTEM_PROCESSOR AND NOT ADSP_PROCESSOR)
+ SET(ADSP_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
+ ENDIF(CMAKE_SYSTEM_PROCESSOR AND NOT ADSP_PROCESSOR)
+
+ # if ADSP_PROCESSOR_SILICIUM_REVISION has not been set, use "none"
+ IF(NOT ADSP_PROCESSOR_SILICIUM_REVISION)
+ SET(ADSP_PROCESSOR_SILICIUM_REVISION "none")
+ ENDIF(NOT ADSP_PROCESSOR_SILICIUM_REVISION)
+
+ # this file is included from the C and CXX files, so handle both here
+
+ GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_C_COMPILER}" PATH)
+ IF(NOT _ADSP_DIR)
+ GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_CXX_COMPILER}" PATH)
+ ENDIF(NOT _ADSP_DIR)
+ IF(NOT _ADSP_DIR)
+ GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_ASM_COMPILER}" PATH)
+ ENDIF(NOT _ADSP_DIR)
+
+ # detect architecture
+
+ IF(CMAKE_C_COMPILER MATCHES ccblkfn OR CMAKE_CXX_COMPILER MATCHES ccblkfn OR CMAKE_ASM_COMPILER MATCHES easmBLKFN)
+ IF(NOT ADSP_PROCESSOR)
+ SET(ADSP_PROCESSOR "ADSP-BF561")
+ ENDIF(NOT ADSP_PROCESSOR)
+ SET(ADSP_BLACKFIN TRUE)
+ SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/Blackfin")
+ ENDIF(CMAKE_C_COMPILER MATCHES ccblkfn OR CMAKE_CXX_COMPILER MATCHES ccblkfn OR CMAKE_ASM_COMPILER MATCHES easmBLKFN)
+
+ IF(CMAKE_C_COMPILER MATCHES ccts OR CMAKE_CXX_COMPILER MATCHES ccts OR CMAKE_ASM_COMPILER MATCHES easmTS)
+ IF(NOT ADSP_PROCESSOR)
+ SET(ADSP_PROCESSOR "ADSP-TS101")
+ ENDIF(NOT ADSP_PROCESSOR)
+ SET(ADSP_TS TRUE)
+ SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/TS")
+ ENDIF(CMAKE_C_COMPILER MATCHES ccts OR CMAKE_CXX_COMPILER MATCHES ccts OR CMAKE_ASM_COMPILER MATCHES easmTS)
+
+ IF(CMAKE_C_COMPILER MATCHES cc21k OR CMAKE_CXX_COMPILER MATCHES cc21k OR CMAKE_ASM_COMPILER MATCHES easm21k)
+ IF(NOT ADSP_PROCESSOR)
+ SET(ADSP_PROCESSOR "ADSP-21060")
+ ENDIF(NOT ADSP_PROCESSOR)
+ SET(ADSP_21K TRUE)
+
+ SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") # default if nothing matches
+ IF (ADSP_PROCESSOR MATCHES "210..$")
+ SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k")
+ ENDIF(ADSP_PROCESSOR MATCHES "210..$")
+
+ IF (ADSP_PROCESSOR MATCHES "211..$")
+ SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/211k")
+ ENDIF(ADSP_PROCESSOR MATCHES "211..$")
+
+ IF (ADSP_PROCESSOR MATCHES "212..$")
+ SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/212k")
+ ENDIF(ADSP_PROCESSOR MATCHES "212..$")
+
+ IF (ADSP_PROCESSOR MATCHES "213..$")
+ SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/213k")
+ ENDIF(ADSP_PROCESSOR MATCHES "213..$")
+
+ SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k")
+ ENDIF(CMAKE_C_COMPILER MATCHES cc21k OR CMAKE_CXX_COMPILER MATCHES cc21k OR CMAKE_ASM_COMPILER MATCHES easm21k)
+
+
+ LINK_DIRECTORIES("${_ADSP_FAMILY_DIR}/lib")
+
+ # vdk support
+ FIND_PROGRAM( ADSP_VDKGEN_EXECUTABLE vdkgen "${_ADSP_FAMILY_DIR}/vdk" )
+
+ MACRO(ADSP_GENERATE_VDK VDK_GENERATED_HEADER VDK_GENERATED_SOURCE VDK_KERNEL_SUPPORT_FILE)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${VDK_GENERATED_HEADER} ${VDK_GENERATED_SOURCE}
+ COMMAND ${ADSP_VDKGEN_EXECUTABLE} ${VDK_KERNEL_SUPPORT_FILE} -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -MM
+ DEPENDS ${VDK_KERNEL_SUPPORT_FILE}
+ )
+ ENDMACRO(ADSP_GENERATE_VDK VDK_GENERATED_HEADER VDK_GENERATED_SOURCE VDK_KERNEL_SUPPORT_FILE)
+
+ # loader support
+ FIND_PROGRAM( ADSP_ELFLOADER_EXECUTABLE elfloader "${_ADSP_FAMILY_DIR}" )
+
+ # BOOT_MODE: prom, flash, spi, spislave, UART, TWI, FIFO
+ # FORMAT: hex, ASCII, binary, include
+ # WIDTH: 8, 16
+ MACRO(ADSP_CREATE_LOADER_FILE TARGET_NAME BOOT_MODE FORMAT WIDTH)
+ ADD_CUSTOM_COMMAND(
+ TARGET ${TARGET_NAME}
+ POST_BUILD
+ COMMAND ${ADSP_ELFLOADER_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.dxe -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -b ${BOOT_MODE} -f ${FORMAT} -width ${WIDTH} -o ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.ldr
+ COMMENT "Building the loader file"
+ )
+ ENDMACRO(ADSP_CREATE_LOADER_FILE TARGET_NAME BOOT_MODE FORMAT WIDTH)
+
+ MACRO(ADSP_CREATE_LOADER_FILE_INIT TARGET_NAME BOOT_MODE FORMAT WIDTH INITIALIZATION_FILE)
+ ADD_CUSTOM_COMMAND(
+ TARGET ${TARGET_NAME}
+ POST_BUILD
+ COMMAND ${ADSP_ELFLOADER_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.dxe -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -b ${BOOT_MODE} -f ${FORMAT} -width ${WIDTH} -o ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.ldr -init ${INITIALIZATION_FILE}
+ COMMENT "Building the loader file"
+ )
+ ENDMACRO(ADSP_CREATE_LOADER_FILE_INIT TARGET_NAME BOOT_MODE FORMAT WIDTH INITIALIZATION_FILE)
+
+ENDIF(NOT ADSP)
diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake
new file mode 100644
index 000000000..ac81c3560
--- /dev/null
+++ b/Modules/Platform/Generic-SDCC-C.cmake
@@ -0,0 +1,54 @@
+
+# This file implements basic support for sdcc (http://sdcc.sourceforge.net/)
+# a free C compiler for 8 and 16 bit microcontrollers.
+# To use it either a toolchain file is required or cmake has to be run like this:
+# cmake -DCMAKE_C_COMPILER=sdcc -DCMAKE_SYSTEM_NAME=Generic <dir...>
+# Since sdcc doesn't support C++, C++ support should be disabled in the
+# CMakeLists.txt using the PROJECT() command:
+# PROJECT(my_project C)
+
+SET(CMAKE_STATIC_LIBRARY_PREFIX "")
+SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
+SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib
+SET(CMAKE_SHARED_LIBRARY_SUFFIX ".lib") # .so
+SET(CMAKE_IMPORT_LIBRARY_PREFIX )
+SET(CMAKE_IMPORT_LIBRARY_SUFFIX )
+SET(CMAKE_EXECUTABLE_SUFFIX ".ihx") # intel hex file
+SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib")
+SET(CMAKE_DL_LIBS "")
+
+SET(CMAKE_C_OUTPUT_EXTENSION ".rel")
+
+# find sdcclib as CMAKE_AR
+# since cmake may already have searched for "ar", sdcclib has to
+# be searched with a different variable name (SDCCLIB_EXECUTABLE)
+# and must then be forced into the cache
+GET_FILENAME_COMPONENT(SDCC_LOCATION "${CMAKE_C_COMPILER}" PATH)
+FIND_PROGRAM(SDCCLIB_EXECUTABLE sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH)
+FIND_PROGRAM(SDCCLIB_EXECUTABLE sdcclib)
+SET(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE)
+
+# CMAKE_C_FLAGS_INIT and CMAKE_EXE_LINKER_FLAGS_INIT should be set in a CMAKE_SYSTEM_PROCESSOR file
+IF(NOT DEFINED CMAKE_C_FLAGS_INIT)
+ SET(CMAKE_C_FLAGS_INIT "-mmcs51 --model-small")
+ENDIF(NOT DEFINED CMAKE_C_FLAGS_INIT)
+
+IF(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT)
+ SET (CMAKE_EXE_LINKER_FLAGS_INIT --model-small)
+ENDIF(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT)
+
+# compile a C file into an object file
+SET(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <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>")
+
+# needs sdcc 2.7.0 + sddclib from cvs
+SET(CMAKE_C_CREATE_STATIC_LIBRARY
+ "\"${CMAKE_COMMAND}\" -E remove <TARGET>"
+ "<CMAKE_AR> -a <TARGET> <LINK_FLAGS> <OBJECTS> ")
+
+# not supported by sdcc
+SET(CMAKE_C_CREATE_SHARED_LIBRARY "")
+SET(CMAKE_C_CREATE_MODULE_LIBRARY "")
+
diff --git a/Modules/Platform/Generic.cmake b/Modules/Platform/Generic.cmake
new file mode 100644
index 000000000..a4e2ec6c1
--- /dev/null
+++ b/Modules/Platform/Generic.cmake
@@ -0,0 +1,17 @@
+# This is a platform definition file for platforms without
+# operating system, typically embedded platforms.
+# It is used when CMAKE_SYSTEM_NAME is set to "Generic"
+#
+# It is intentionally empty, since nothing is known
+# about the platform. So everything has to be specified
+# in the system/compiler files ${CMAKE_SYSTEM_NAME}-<compiler_basename>.cmake
+# and/or ${CMAKE_SYSTEM_NAME}-<compiler_basename>-${CMAKE_SYSTEM_PROCESSOR}.cmake
+
+# (embedded) targets without operating system usually don't support shared libraries
+SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+
+# To help the find_xxx() commands, set at least the following so CMAKE_FIND_ROOT_PATH
+# works at least for some simple cases:
+SET(CMAKE_SYSTEM_INCLUDE_PATH /include )
+SET(CMAKE_SYSTEM_LIBRARY_PATH /lib )
+SET(CMAKE_SYSTEM_PROGRAM_PATH /bin )
diff --git a/Modules/Platform/HP-UX-GNU-C.cmake b/Modules/Platform/HP-UX-GNU-C.cmake
new file mode 100644
index 000000000..5f9ac4200
--- /dev/null
+++ b/Modules/Platform/HP-UX-GNU-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/HP-UX-GNU)
+__hpux_compiler_gnu(C)
diff --git a/Modules/Platform/HP-UX-GNU-CXX.cmake b/Modules/Platform/HP-UX-GNU-CXX.cmake
new file mode 100644
index 000000000..689bed088
--- /dev/null
+++ b/Modules/Platform/HP-UX-GNU-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/HP-UX-GNU)
+__hpux_compiler_gnu(CXX)
diff --git a/Modules/Platform/HP-UX-GNU-Fortran.cmake b/Modules/Platform/HP-UX-GNU-Fortran.cmake
new file mode 100644
index 000000000..ee0181fe4
--- /dev/null
+++ b/Modules/Platform/HP-UX-GNU-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/HP-UX-GNU)
+__hpux_compiler_gnu(Fortran)
diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake
new file mode 100644
index 000000000..eb909fe99
--- /dev/null
+++ b/Modules/Platform/HP-UX-GNU.cmake
@@ -0,0 +1,27 @@
+
+#=============================================================================
+# 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 module is shared by multiple languages; use include blocker.
+if(__HPUX_COMPILER_GNU)
+ return()
+endif()
+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_RUNTIME_${lang}_FLAG "-Wl,+b")
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
+ set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h")
+endmacro()
diff --git a/Modules/Platform/HP-UX-HP-ASM.cmake b/Modules/Platform/HP-UX-HP-ASM.cmake
new file mode 100644
index 000000000..05c69e41b
--- /dev/null
+++ b/Modules/Platform/HP-UX-HP-ASM.cmake
@@ -0,0 +1,2 @@
+include(Platform/HP-UX-HP)
+__hpux_compiler_hp(ASM)
diff --git a/Modules/Platform/HP-UX-HP-C.cmake b/Modules/Platform/HP-UX-HP-C.cmake
new file mode 100644
index 000000000..100093590
--- /dev/null
+++ b/Modules/Platform/HP-UX-HP-C.cmake
@@ -0,0 +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>")
diff --git a/Modules/Platform/HP-UX-HP-CXX.cmake b/Modules/Platform/HP-UX-HP-CXX.cmake
new file mode 100644
index 000000000..dfa1e4e45
--- /dev/null
+++ b/Modules/Platform/HP-UX-HP-CXX.cmake
@@ -0,0 +1,14 @@
+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_ASSEMBLY_SOURCE
+ "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE>"
+ "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
+ "rm -f `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.o"
+ )
+
+set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
+set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "+O3 -DNDEBUG")
+set(CMAKE_CXX_FLAGS_RELEASE_INIT "+O2 -DNDEBUG")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g")
diff --git a/Modules/Platform/HP-UX-HP-Fortran.cmake b/Modules/Platform/HP-UX-HP-Fortran.cmake
new file mode 100644
index 000000000..30acab807
--- /dev/null
+++ b/Modules/Platform/HP-UX-HP-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/HP-UX-HP)
+__hpux_compiler_hp(Fortran)
diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake
new file mode 100644
index 000000000..871ea1323
--- /dev/null
+++ b/Modules/Platform/HP-UX-HP.cmake
@@ -0,0 +1,31 @@
+
+#=============================================================================
+# Copyright 2002-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.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__HPUX_COMPILER_HP)
+ return()
+endif()
+set(__HPUX_COMPILER_HP 1)
+
+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_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 "")
+endmacro()
diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake
new file mode 100644
index 000000000..ab3dc2266
--- /dev/null
+++ b/Modules/Platform/HP-UX.cmake
@@ -0,0 +1,50 @@
+SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib)
+
+SET(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so
+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
+# link line with -L flags.
+SET(CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH 1)
+SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
+
+# Shared libraries with no builtin soname may not be linked safely by
+# specifying the file path.
+SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
+
+# set flags for gcc support
+INCLUDE(Platform/UnixPaths)
+
+# Look in both 32-bit and 64-bit implict link directories, but tell
+# CMake not to pass the paths to the linker. The linker will find the
+# library for the proper architecture. In the future we should detect
+# which path will be used by the linker. Since the pointer type size
+# CMAKE_SIZEOF_VOID_P is not set until after this file executes, we
+# would need to append to CMAKE_SYSTEM_LIBRARY_PATH at a later point
+# (after CMakeTest(LANG)Compiler.cmake runs for at least one language).
+LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux32)
+LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux64)
+LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+ /usr/lib/hpux32 /usr/lib/hpux64)
+
+# 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(type)
+FOREACH(type EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default")
+ENDFOREACH(type)
+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")
+ENDFOREACH(type)
+
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
new file mode 100644
index 000000000..9dda3c528
--- /dev/null
+++ b/Modules/Platform/Haiku.cmake
@@ -0,0 +1,24 @@
+SET(BEOS 1)
+
+SET(CMAKE_DL_LIBS root be)
+SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+
+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)
+
+IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ SET(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH
+ "Install path prefix, prepended onto install directories." FORCE)
+ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake
new file mode 100644
index 000000000..fac941f3b
--- /dev/null
+++ b/Modules/Platform/IRIX.cmake
@@ -0,0 +1,45 @@
+SET(CMAKE_DL_LIBS "")
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
+IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
+ "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>")
+ SET (CMAKE_CXX_FLAGS_INIT "")
+ SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
+ SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2")
+ SET (CMAKE_C_FLAGS_INIT "")
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
+# set flags for gcc support
+INCLUDE(Platform/UnixPaths)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCC)
+ SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE
+ "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE>"
+ "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
+ )
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE
+ "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>"
+ "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
+ )
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ENDFOREACH(type)
+
+# The IRIX linker needs to find transitive shared library dependencies
+# in the -L path.
+SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake
new file mode 100644
index 000000000..b60a7f297
--- /dev/null
+++ b/Modules/Platform/IRIX64.cmake
@@ -0,0 +1,73 @@
+SET(CMAKE_DL_LIBS "")
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
+SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+IF(NOT CMAKE_COMPILER_IS_GNUCC)
+ # Set default flags init.
+ SET(CMAKE_C_FLAGS_INIT "")
+ SET(CMAKE_CXX_FLAGS_INIT "")
+ SET(CMAKE_Fortran_FLAGS_INIT "")
+ SET(CMAKE_EXE_LINKER_FLAGS_INIT "")
+ SET(CMAKE_SHARED_LINKER_FLAGS_INIT "")
+ SET(CMAKE_MODULE_LINKER_FLAGS_INIT "")
+
+ # If no -o32, -n32, or -64 flag is given, set a reasonable default.
+ IF("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)")
+ ELSE("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)")
+ # Check if this is a 64-bit CMake.
+ IF(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$")
+ EXEC_PROGRAM(file ARGS ${CMAKE_COMMAND} OUTPUT_VARIABLE CMAKE_FILE_SELF)
+ SET(CMAKE_FILE_SELF "${CMAKE_FILE_SELF}" CACHE INTERNAL
+ "Output of file command on ${CMAKE_COMMAND}.")
+ ENDIF(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$")
+
+ # Set initial flags to match cmake executable.
+ IF(CMAKE_FILE_SELF MATCHES " 64-bit ")
+ SET(CMAKE_C_FLAGS_INIT "-64")
+ SET(CMAKE_CXX_FLAGS_INIT "-64")
+ SET(CMAKE_Fortran_FLAGS_INIT "-64")
+ SET(CMAKE_EXE_LINKER_FLAGS_INIT "-64")
+ SET(CMAKE_SHARED_LINKER_FLAGS_INIT "-64")
+ SET(CMAKE_MODULE_LINKER_FLAGS_INIT "-64")
+ ENDIF(CMAKE_FILE_SELF MATCHES " 64-bit ")
+ ENDIF("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)")
+
+ # Set remaining defaults.
+ SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
+ "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>")
+ SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
+ SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2")
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
+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_ASSEMBLY_SOURCE
+ "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE>"
+ "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
+ )
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
+
+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_ASSEMBLY_SOURCE
+ "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE>"
+ "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
+ )
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ENDFOREACH(type)
+
+# The IRIX linker needs to find transitive shared library dependencies
+# in the -L path.
+SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
diff --git a/Modules/Platform/Linux-Absoft-Fortran.cmake b/Modules/Platform/Linux-Absoft-Fortran.cmake
new file mode 100644
index 000000000..beb41a3b8
--- /dev/null
+++ b/Modules/Platform/Linux-Absoft-Fortran.cmake
@@ -0,0 +1 @@
+set(CMAKE_Fortran_VERBOSE_FLAG "-X -v") # Runs gcc under the hood.
diff --git a/Modules/Platform/Linux-Clang-C.cmake b/Modules/Platform/Linux-Clang-C.cmake
new file mode 100644
index 000000000..dbf89564a
--- /dev/null
+++ b/Modules/Platform/Linux-Clang-C.cmake
@@ -0,0 +1 @@
+INCLUDE(Platform/Linux-GNU-C)
diff --git a/Modules/Platform/Linux-Clang-CXX.cmake b/Modules/Platform/Linux-Clang-CXX.cmake
new file mode 100644
index 000000000..8fe251c4d
--- /dev/null
+++ b/Modules/Platform/Linux-Clang-CXX.cmake
@@ -0,0 +1 @@
+INCLUDE(Platform/Linux-GNU-CXX)
diff --git a/Modules/Platform/Linux-GNU-C.cmake b/Modules/Platform/Linux-GNU-C.cmake
new file mode 100644
index 000000000..3ab142f13
--- /dev/null
+++ b/Modules/Platform/Linux-GNU-C.cmake
@@ -0,0 +1,2 @@
+INCLUDE(Platform/Linux-GNU)
+__linux_compiler_gnu(C)
diff --git a/Modules/Platform/Linux-GNU-CXX.cmake b/Modules/Platform/Linux-GNU-CXX.cmake
new file mode 100644
index 000000000..9e4f904f2
--- /dev/null
+++ b/Modules/Platform/Linux-GNU-CXX.cmake
@@ -0,0 +1,2 @@
+INCLUDE(Platform/Linux-GNU)
+__linux_compiler_gnu(CXX)
diff --git a/Modules/Platform/Linux-GNU-Fortran.cmake b/Modules/Platform/Linux-GNU-Fortran.cmake
new file mode 100644
index 000000000..e364c872a
--- /dev/null
+++ b/Modules/Platform/Linux-GNU-Fortran.cmake
@@ -0,0 +1,2 @@
+INCLUDE(Platform/Linux-GNU)
+__linux_compiler_gnu(Fortran)
diff --git a/Modules/Platform/Linux-GNU.cmake b/Modules/Platform/Linux-GNU.cmake
new file mode 100644
index 000000000..0e254c6ea
--- /dev/null
+++ b/Modules/Platform/Linux-GNU.cmake
@@ -0,0 +1,25 @@
+
+#=============================================================================
+# Copyright 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.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__LINUX_COMPILER_GNU)
+ return()
+endif()
+set(__LINUX_COMPILER_GNU 1)
+
+macro(__linux_compiler_gnu lang)
+ # We pass this for historical reasons. Projects may have
+ # executables that use dlopen but do not set ENABLE_EXPORTS.
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic")
+endmacro()
diff --git a/Modules/Platform/Linux-Intel-C.cmake b/Modules/Platform/Linux-Intel-C.cmake
new file mode 100644
index 000000000..c909e68fc
--- /dev/null
+++ b/Modules/Platform/Linux-Intel-C.cmake
@@ -0,0 +1,2 @@
+INCLUDE(Platform/Linux-Intel)
+__linux_compiler_intel(C)
diff --git a/Modules/Platform/Linux-Intel-CXX.cmake b/Modules/Platform/Linux-Intel-CXX.cmake
new file mode 100644
index 000000000..0b7daf475
--- /dev/null
+++ b/Modules/Platform/Linux-Intel-CXX.cmake
@@ -0,0 +1,2 @@
+INCLUDE(Platform/Linux-Intel)
+__linux_compiler_intel(CXX)
diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake
new file mode 100644
index 000000000..342b5c2fa
--- /dev/null
+++ b/Modules/Platform/Linux-Intel-Fortran.cmake
@@ -0,0 +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")
diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake
new file mode 100644
index 000000000..47bf24659
--- /dev/null
+++ b/Modules/Platform/Linux-Intel.cmake
@@ -0,0 +1,50 @@
+
+#=============================================================================
+# 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 module is shared by multiple languages; use include blocker.
+if(__LINUX_COMPILER_INTEL)
+ return()
+endif()
+set(__LINUX_COMPILER_INTEL 1)
+
+if(NOT XIAR)
+ set(_intel_xiar_hints)
+ foreach(lang C CXX Fortran)
+ if(IS_ABSOLUTE "${CMAKE_${lang}_COMPILER}")
+ get_filename_component(_hint "${CMAKE_${lang}_COMPILER}" PATH)
+ list(APPEND _intel_xiar_hints ${_hint})
+ endif()
+ endforeach()
+ find_program(XIAR NAMES xiar HINTS ${_intel_xiar_hints})
+ mark_as_advanced(XIAR)
+endif(NOT XIAR)
+
+macro(__linux_compiler_intel lang)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+
+ # We pass this for historical reasons. Projects may have
+ # executables that use dlopen but do not set ENABLE_EXPORTS.
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic")
+
+ if(XIAR)
+ # INTERPROCEDURAL_OPTIMIZATION
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO -ipo)
+ set(CMAKE_${lang}_CREATE_STATIC_LIBRARY_IPO
+ "${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> "
+ "${XIAR} -s <TARGET> ")
+ endif()
+endmacro()
diff --git a/Modules/Platform/Linux-NAG-Fortran.cmake b/Modules/Platform/Linux-NAG-Fortran.cmake
new file mode 100644
index 000000000..353bae6dd
--- /dev/null
+++ b/Modules/Platform/Linux-NAG-Fortran.cmake
@@ -0,0 +1,10 @@
+set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood.
+
+# Need one "-Wl," level to send flag through to gcc.
+# Use "-Xlinker" to get through gcc to real linker.
+set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-Wl,-shared")
+set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-Xlinker,-rpath,-Xlinker,")
+set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":")
+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG "-Wl,-Xlinker,-rpath-link,-Xlinker,")
+set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-Xlinker,-soname,-Xlinker,")
+set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-rdynamic")
diff --git a/Modules/Platform/Linux-PGI-C.cmake b/Modules/Platform/Linux-PGI-C.cmake
new file mode 100644
index 000000000..edf4f3f0e
--- /dev/null
+++ b/Modules/Platform/Linux-PGI-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-PGI)
+__linux_compiler_pgi(C)
diff --git a/Modules/Platform/Linux-PGI-CXX.cmake b/Modules/Platform/Linux-PGI-CXX.cmake
new file mode 100644
index 000000000..d425f886e
--- /dev/null
+++ b/Modules/Platform/Linux-PGI-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-PGI)
+__linux_compiler_pgi(CXX)
diff --git a/Modules/Platform/Linux-PGI-Fortran.cmake b/Modules/Platform/Linux-PGI-Fortran.cmake
new file mode 100644
index 000000000..e8731a384
--- /dev/null
+++ b/Modules/Platform/Linux-PGI-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-PGI)
+__linux_compiler_pgi(Fortran)
diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake
new file mode 100644
index 000000000..3cbb35c72
--- /dev/null
+++ b/Modules/Platform/Linux-PGI.cmake
@@ -0,0 +1,27 @@
+
+#=============================================================================
+# 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 module is shared by multiple languages; use include blocker.
+if(__LINUX_COMPILER_PGI)
+ return()
+endif()
+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_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+endmacro()
diff --git a/Modules/Platform/Linux-PathScale-C.cmake b/Modules/Platform/Linux-PathScale-C.cmake
new file mode 100644
index 000000000..009f398fe
--- /dev/null
+++ b/Modules/Platform/Linux-PathScale-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-PathScale)
+__linux_compiler_pathscale(C)
diff --git a/Modules/Platform/Linux-PathScale-CXX.cmake b/Modules/Platform/Linux-PathScale-CXX.cmake
new file mode 100644
index 000000000..b6a5771aa
--- /dev/null
+++ b/Modules/Platform/Linux-PathScale-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-PathScale)
+__linux_compiler_pathscale(CXX)
diff --git a/Modules/Platform/Linux-PathScale-Fortran.cmake b/Modules/Platform/Linux-PathScale-Fortran.cmake
new file mode 100644
index 000000000..5662d3d88
--- /dev/null
+++ b/Modules/Platform/Linux-PathScale-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-PathScale)
+__linux_compiler_pathscale(Fortran)
diff --git a/Modules/Platform/Linux-PathScale.cmake b/Modules/Platform/Linux-PathScale.cmake
new file mode 100644
index 000000000..d230ab225
--- /dev/null
+++ b/Modules/Platform/Linux-PathScale.cmake
@@ -0,0 +1,27 @@
+
+#=============================================================================
+# Copyright 2002-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.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__LINUX_COMPILER_PATHSCALE)
+ return()
+endif()
+set(__LINUX_COMPILER_PATHSCALE 1)
+
+macro(__linux_compiler_pathscale lang)
+ # Shared library compile and link flags.
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+endmacro()
diff --git a/Modules/Platform/Linux-SunPro-CXX.cmake b/Modules/Platform/Linux-SunPro-CXX.cmake
new file mode 100644
index 000000000..8ee96586d
--- /dev/null
+++ b/Modules/Platform/Linux-SunPro-CXX.cmake
@@ -0,0 +1,9 @@
+# Sun C++ 5.9 does not support -Wl, but Sun C++ 5.11 does not work without it.
+# Query the compiler flags to detect whether to use -Wl.
+execute_process(COMMAND ${CMAKE_CXX_COMPILER} -flags OUTPUT_VARIABLE _cxx_flags ERROR_VARIABLE _cxx_error)
+if("${_cxx_flags}" MATCHES "\n-W[^\n]*component")
+ set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-Wl,-rpath-link,")
+else()
+ set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-rpath-link ")
+endif()
+SET(CMAKE_EXE_EXPORTS_CXX_FLAG "--export-dynamic")
diff --git a/Modules/Platform/Linux-TinyCC-C.cmake b/Modules/Platform/Linux-TinyCC-C.cmake
new file mode 100644
index 000000000..b753268ea
--- /dev/null
+++ b/Modules/Platform/Linux-TinyCC-C.cmake
@@ -0,0 +1,4 @@
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "")
+SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "")
+SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-soname ")
diff --git a/Modules/Platform/Linux-VisualAge-C.cmake b/Modules/Platform/Linux-VisualAge-C.cmake
new file mode 100644
index 000000000..0622b63c3
--- /dev/null
+++ b/Modules/Platform/Linux-VisualAge-C.cmake
@@ -0,0 +1 @@
+include(Platform/Linux-XL-C)
diff --git a/Modules/Platform/Linux-VisualAge-CXX.cmake b/Modules/Platform/Linux-VisualAge-CXX.cmake
new file mode 100644
index 000000000..b878ba02c
--- /dev/null
+++ b/Modules/Platform/Linux-VisualAge-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Linux-XL-CXX)
diff --git a/Modules/Platform/Linux-VisualAge-Fortran.cmake b/Modules/Platform/Linux-VisualAge-Fortran.cmake
new file mode 100644
index 000000000..1939a8a2f
--- /dev/null
+++ b/Modules/Platform/Linux-VisualAge-Fortran.cmake
@@ -0,0 +1 @@
+include(Platform/Linux-XL-Fortran)
diff --git a/Modules/Platform/Linux-XL-C.cmake b/Modules/Platform/Linux-XL-C.cmake
new file mode 100644
index 000000000..b1b07f617
--- /dev/null
+++ b/Modules/Platform/Linux-XL-C.cmake
@@ -0,0 +1 @@
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj")
diff --git a/Modules/Platform/Linux-XL-CXX.cmake b/Modules/Platform/Linux-XL-CXX.cmake
new file mode 100644
index 000000000..071a975ed
--- /dev/null
+++ b/Modules/Platform/Linux-XL-CXX.cmake
@@ -0,0 +1 @@
+SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj")
diff --git a/Modules/Platform/Linux-XL-Fortran.cmake b/Modules/Platform/Linux-XL-Fortran.cmake
new file mode 100644
index 000000000..5da574e2e
--- /dev/null
+++ b/Modules/Platform/Linux-XL-Fortran.cmake
@@ -0,0 +1 @@
+SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-qmkshrobj")
diff --git a/Modules/Platform/Linux-como.cmake b/Modules/Platform/Linux-como.cmake
new file mode 100644
index 000000000..7ea732082
--- /dev/null
+++ b/Modules/Platform/Linux-como.cmake
@@ -0,0 +1,17 @@
+# create a shared C++ library
+SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
+ "<CMAKE_CXX_COMPILER> --prelink_objects <OBJECTS>"
+ "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
+
+# create a C++ static library
+SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
+ "<CMAKE_CXX_COMPILER> --prelink_objects <OBJECTS>"
+ "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
+ "<CMAKE_RANLIB> <TARGET> ")
+
+SET(CMAKE_CXX_LINK_EXECUTABLE
+ "<CMAKE_CXX_COMPILER> --prelink_objects <OBJECTS>"
+ "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "")
diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
new file mode 100644
index 000000000..38f469b33
--- /dev/null
+++ b/Modules/Platform/Linux.cmake
@@ -0,0 +1,57 @@
+SET(CMAKE_DL_LIBS "dl")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+SET(CMAKE_SHARED_LIBRARY_RPATH_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.
+SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ENDFOREACH(type)
+
+# Debian policy requires that shared libraries be installed without
+# executable permission. Fedora policy requires that shared libraries
+# be installed with the executable permission. Since the native tools
+# create shared libraries with execute permission in the first place a
+# reasonable policy seems to be to install with execute permission by
+# default. In order to support debian packages we provide an option
+# here. The option default is based on the current distribution, but
+# packagers can set it explicitly on the command line.
+IF(DEFINED CMAKE_INSTALL_SO_NO_EXE)
+ # Store the decision variable in the cache. This preserves any
+ # setting the user provides on the command line.
+ SET(CMAKE_INSTALL_SO_NO_EXE "${CMAKE_INSTALL_SO_NO_EXE}" CACHE INTERNAL
+ "Install .so files without execute permission.")
+ELSE(DEFINED CMAKE_INSTALL_SO_NO_EXE)
+ # Store the decision variable as an internal cache entry to avoid
+ # checking the platform every time. This option is advanced enough
+ # that only package maintainers should need to adjust it. They are
+ # capable of providing a setting on the command line.
+ IF(EXISTS "/etc/debian_version")
+ SET(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
+ "Install .so files without execute permission.")
+ ELSE(EXISTS "/etc/debian_version")
+ SET(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL
+ "Install .so files without execute permission.")
+ ENDIF(EXISTS "/etc/debian_version")
+ENDIF(DEFINED CMAKE_INSTALL_SO_NO_EXE)
+
+# Match multiarch library directory names.
+SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*")
+
+INCLUDE(Platform/UnixPaths)
+
+# Debian has lib64 paths only for compatibility so they should not be
+# searched.
+IF(EXISTS "/etc/debian_version")
+ SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
+ENDIF(EXISTS "/etc/debian_version")
diff --git a/Modules/Platform/MP-RAS.cmake b/Modules/Platform/MP-RAS.cmake
new file mode 100644
index 000000000..ff22a4fda
--- /dev/null
+++ b/Modules/Platform/MP-RAS.cmake
@@ -0,0 +1,14 @@
+IF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
+ SET(CMAKE_C_COMPILE_OPTIONS_PIE -K PIE)
+ SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
+ELSE(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
+ SET(CMAKE_C_COMPILE_OPTIONS_PIE -K PIE)
+ SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
+ SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport")
+ENDIF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")
+
+INCLUDE(Platform/UnixPaths)
+
+
diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake
new file mode 100644
index 000000000..e1b66b84c
--- /dev/null
+++ b/Modules/Platform/NetBSD.cmake
@@ -0,0 +1,15 @@
+IF(EXISTS /usr/include/dlfcn.h)
+ SET(CMAKE_DL_LIBS "")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+ SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
+ SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
+ SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
+ SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
+ SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+ SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+ENDIF(EXISTS /usr/include/dlfcn.h)
+
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake
new file mode 100644
index 000000000..49a30e971
--- /dev/null
+++ b/Modules/Platform/OSF1.cmake
@@ -0,0 +1,47 @@
+SET(CMAKE_DL_LIBS "")
+
+IF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]")
+ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]")
+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")
+ SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fpic") # -pic
+ SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fpic") # -pic
+ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.*")
+
+
+
+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,")
+ ELSE(CMAKE_COMPILER_IS_GNUCXX)
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-rpath ")
+ ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+ IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
+ ELSE(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-rpath ")
+ ENDIF(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
+
+SET(CMAKE_MAKE_INCLUDE_FROM_ROOT 1) # include $(CMAKE_BINARY_DIR)/...
+
+IF(CMAKE_COMPILER_IS_GNUCXX)
+ # include the gcc flags
+ELSE (CMAKE_COMPILER_IS_GNUCXX)
+ # use default OSF compiler flags
+ SET (CMAKE_C_FLAGS_INIT "")
+ SET (CMAKE_C_FLAGS_DEBUG_INIT "-g")
+ SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG")
+ SET (CMAKE_C_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
+ SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2")
+ SET (CMAKE_CXX_FLAGS_INIT "")
+ SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
+ SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake
new file mode 100644
index 000000000..b4ed66fb0
--- /dev/null
+++ b/Modules/Platform/OpenBSD.cmake
@@ -0,0 +1,18 @@
+INCLUDE(Platform/NetBSD)
+
+# On OpenBSD, the compile time linker does not share it's configuration with
+# the runtime linker. This will extract the library search paths from the
+# system's ld.so.hints file which will allow CMake to set the appropriate
+# -rpath-link flags
+IF(NOT CMAKE_PLATFORM_RUNTIME_PATH)
+ EXECUTE_PROCESS(COMMAND /sbin/ldconfig -r
+ OUTPUT_VARIABLE LDCONFIG_HINTS
+ ERROR_QUIET)
+ STRING(REGEX REPLACE ".*search\\ directories:\\ ([^\n]*).*" "\\1"
+ LDCONFIG_HINTS "${LDCONFIG_HINTS}")
+ STRING(REGEX REPLACE ":" ";"
+ CMAKE_PLATFORM_RUNTIME_PATH
+ "${LDCONFIG_HINTS}")
+ENDIF()
+
+SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1)
diff --git a/Modules/Platform/OpenVMS.cmake b/Modules/Platform/OpenVMS.cmake
new file mode 100644
index 000000000..c52effab6
--- /dev/null
+++ b/Modules/Platform/OpenVMS.cmake
@@ -0,0 +1,8 @@
+INCLUDE(Platform/UnixPaths)
+
+SET(CMAKE_C_CREATE_STATIC_LIBRARY
+ "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>"
+ "<CMAKE_RANLIB> <TARGET>"
+ )
+SET(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
+SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe
diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake
new file mode 100644
index 000000000..8cdbe02c1
--- /dev/null
+++ b/Modules/Platform/QNX.cmake
@@ -0,0 +1,33 @@
+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)
+
+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.
+SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ENDFOREACH(type)
+# 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/RISCos.cmake b/Modules/Platform/RISCos.cmake
new file mode 100644
index 000000000..3b2a092bf
--- /dev/null
+++ b/Modules/Platform/RISCos.cmake
@@ -0,0 +1,6 @@
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0")
+SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o")
+SET(CMAKE_DL_LIBS "")
+SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-D,08000000")
+
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/SCO_SV.cmake b/Modules/Platform/SCO_SV.cmake
new file mode 100644
index 000000000..cbdcb7dae
--- /dev/null
+++ b/Modules/Platform/SCO_SV.cmake
@@ -0,0 +1,2 @@
+SET(CMAKE_DL_LIBS "")
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/SINIX.cmake b/Modules/Platform/SINIX.cmake
new file mode 100644
index 000000000..e0809f8e3
--- /dev/null
+++ b/Modules/Platform/SINIX.cmake
@@ -0,0 +1,4 @@
+SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "")
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/SunOS-GNU-C.cmake b/Modules/Platform/SunOS-GNU-C.cmake
new file mode 100644
index 000000000..6a96c00ee
--- /dev/null
+++ b/Modules/Platform/SunOS-GNU-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/SunOS-GNU)
+__sunos_compiler_gnu(C)
diff --git a/Modules/Platform/SunOS-GNU-CXX.cmake b/Modules/Platform/SunOS-GNU-CXX.cmake
new file mode 100644
index 000000000..6b9f6fa86
--- /dev/null
+++ b/Modules/Platform/SunOS-GNU-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/SunOS-GNU)
+__sunos_compiler_gnu(CXX)
diff --git a/Modules/Platform/SunOS-GNU-Fortran.cmake b/Modules/Platform/SunOS-GNU-Fortran.cmake
new file mode 100644
index 000000000..c6b188836
--- /dev/null
+++ b/Modules/Platform/SunOS-GNU-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/SunOS-GNU)
+__sunos_compiler_gnu(Fortran)
diff --git a/Modules/Platform/SunOS-GNU.cmake b/Modules/Platform/SunOS-GNU.cmake
new file mode 100644
index 000000000..7169056de
--- /dev/null
+++ b/Modules/Platform/SunOS-GNU.cmake
@@ -0,0 +1,34 @@
+
+#=============================================================================
+# 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 module is shared by multiple languages; use include blocker.
+if(__SUNOS_COMPILER_GNU)
+ return()
+endif()
+set(__SUNOS_COMPILER_GNU 1)
+
+macro(__sunos_compiler_gnu lang)
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-R")
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
+ set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-h")
+
+ # Initialize C link type selection flags. These flags are used when
+ # building a shared library, shared module, or executable that links
+ # to other libraries to select whether to use the static or shared
+ # versions of the libraries.
+ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
+ set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic")
+ set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic")
+ endforeach()
+endmacro()
diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake
new file mode 100644
index 000000000..de287aa70
--- /dev/null
+++ b/Modules/Platform/SunOS.cmake
@@ -0,0 +1,32 @@
+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")
+ SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r")
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R")
+ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+ENDIF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
+
+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(CMAKE_COMPILER_IS_GNUCC)
+ # Take default rule from CMakeDefaultMakeRuleVariables.cmake.
+ ENDIF(CMAKE_COMPILER_IS_GNUCC)
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+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("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro)
+
+# The Sun linker needs to find transitive shared library dependencies
+# in the -L path.
+SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
+
+# Shared libraries with no builtin soname may not be linked safely by
+# specifying the file path.
+SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
diff --git a/Modules/Platform/Tru64.cmake b/Modules/Platform/Tru64.cmake
new file mode 100644
index 000000000..cf9d17bfd
--- /dev/null
+++ b/Modules/Platform/Tru64.cmake
@@ -0,0 +1,2 @@
+INCLUDE(Platform/UnixPaths)
+
diff --git a/Modules/Platform/ULTRIX.cmake b/Modules/Platform/ULTRIX.cmake
new file mode 100644
index 000000000..4d0cf755d
--- /dev/null
+++ b/Modules/Platform/ULTRIX.cmake
@@ -0,0 +1,5 @@
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0")
+SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o")
+SET(CMAKE_DL_LIBS "")
+SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-D,08000000")
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/UNIX_SV.cmake b/Modules/Platform/UNIX_SV.cmake
new file mode 100644
index 000000000..869b3a6a0
--- /dev/null
+++ b/Modules/Platform/UNIX_SV.cmake
@@ -0,0 +1,5 @@
+SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "")
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
+SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport")
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
new file mode 100644
index 000000000..5ee7ddbd6
--- /dev/null
+++ b/Modules/Platform/UnixPaths.cmake
@@ -0,0 +1,88 @@
+
+#=============================================================================
+# Copyright 2006-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.)
+
+# Block multiple inclusion because "CMakeCInformation.cmake" includes
+# "Platform/${CMAKE_SYSTEM_NAME}" even though the generic module
+# "CMakeSystemSpecificInformation.cmake" already included it.
+# The extra inclusion is a work-around documented next to the include()
+# call, so this can be removed when the work-around is removed.
+IF(__UNIX_PATHS_INCLUDED)
+ RETURN()
+ENDIF()
+SET(__UNIX_PATHS_INCLUDED 1)
+
+SET(UNIX 1)
+
+# also add 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)
+
+# List common installation prefixes. These will be used for all
+# search types.
+LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ # Standard
+ /usr/local /usr /
+
+ # CMake install location
+ "${_CMAKE_INSTALL_DIR}"
+
+ # Project install destination.
+ "${CMAKE_INSTALL_PREFIX}"
+ )
+
+# List common include file locations not under the common prefixes.
+LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH
+ # Windows API on Cygwin
+ /usr/include/w32api
+
+ # X11
+ /usr/X11R6/include /usr/include/X11
+
+ # Other
+ /usr/pkg/include
+ /opt/csw/include /opt/include
+ /usr/openwin/include
+ )
+
+LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+ # Windows API on Cygwin
+ /usr/lib/w32api
+
+ # X11
+ /usr/X11R6/lib /usr/lib/X11
+
+ # Other
+ /usr/pkg/lib
+ /opt/csw/lib /opt/lib
+ /usr/openwin/lib
+ )
+
+LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH
+ /usr/pkg/bin
+ )
+
+LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+ /lib /usr/lib /usr/lib32 /usr/lib64
+ )
+
+LIST(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
+ /usr/include
+ )
+LIST(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
+ /usr/include
+ )
+
+# Enable use of lib64 search path variants by default.
+SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
diff --git a/Modules/Platform/UnixWare.cmake b/Modules/Platform/UnixWare.cmake
new file mode 100644
index 000000000..3112ee1ef
--- /dev/null
+++ b/Modules/Platform/UnixWare.cmake
@@ -0,0 +1,5 @@
+SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "")
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-Wl,-Bexport")
+INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/Windows-Borland-C.cmake b/Modules/Platform/Windows-Borland-C.cmake
new file mode 100644
index 000000000..e2f76aacb
--- /dev/null
+++ b/Modules/Platform/Windows-Borland-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-Embarcadero-C)
diff --git a/Modules/Platform/Windows-Borland-CXX.cmake b/Modules/Platform/Windows-Borland-CXX.cmake
new file mode 100644
index 000000000..809490f95
--- /dev/null
+++ b/Modules/Platform/Windows-Borland-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-Embarcadero-CXX)
diff --git a/Modules/Platform/Windows-Embarcadero-C.cmake b/Modules/Platform/Windows-Embarcadero-C.cmake
new file mode 100644
index 000000000..607fd4ebe
--- /dev/null
+++ b/Modules/Platform/Windows-Embarcadero-C.cmake
@@ -0,0 +1,3 @@
+set(_lang C)
+include(Platform/Windows-Embarcadero)
+__embarcadero_language(C)
diff --git a/Modules/Platform/Windows-Embarcadero-CXX.cmake b/Modules/Platform/Windows-Embarcadero-CXX.cmake
new file mode 100644
index 000000000..279a4def4
--- /dev/null
+++ b/Modules/Platform/Windows-Embarcadero-CXX.cmake
@@ -0,0 +1,3 @@
+set(_lang CXX)
+include(Platform/Windows-Embarcadero)
+__embarcadero_language(CXX)
diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake
new file mode 100644
index 000000000..62e8eb704
--- /dev/null
+++ b/Modules/Platform/Windows-Embarcadero.cmake
@@ -0,0 +1,130 @@
+
+#=============================================================================
+# Copyright 2002-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.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__WINDOWS_EMBARCADERO)
+ return()
+endif()
+set(__WINDOWS_EMBARCADERO 1)
+
+SET(BORLAND 1)
+
+if("${CMAKE_${_lang}_COMPILER_VERSION}" VERSION_LESS 6.30)
+ # Borland target type flags (bcc32 -h -t):
+ set(_tW "-tW") # -tW GUI App (implies -U__CONSOLE__)
+ set(_tC "-tWC") # -tWC Console App (implies -D__CONSOLE__=1)
+ set(_tD "-tWD") # -tWD Build a DLL (implies -D__DLL__=1 -D_DLL=1)
+ set(_tM "-tWM") # -tWM Enable threads (implies -D__MT__=1 -D_MT=1)
+ set(_tR "-tWR -tW-") # -tWR Use DLL runtime (implies -D_RTLDLL, and '-tW' too!!)
+ # Notes:
+ # - The flags affect linking so we pass them to the linker.
+ # - The flags affect preprocessing so we pass them to the compiler.
+ # - Since '-tWR' implies '-tW' we use '-tWR -tW-' instead.
+ # - Since '-tW-' disables '-tWD' we use '-tWR -tW- -tWD' for DLLs.
+else()
+ set(EMBARCADERO 1)
+ set(_tC "-tC") # Target is a console application
+ set(_tD "-tD") # Target is a shared library
+ set(_tM "-tM") # Target is multi-threaded
+ set(_tR "-tR") # Target uses the dynamic RTL
+ set(_tW "-tW") # Target is a Windows application
+endif()
+set(_COMPILE_C "-c")
+set(_COMPILE_CXX "-P -c")
+
+SET(CMAKE_LIBRARY_PATH_FLAG "-L")
+SET(CMAKE_LINK_LIBRARY_FLAG "")
+
+SET(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib")
+
+# uncomment these out to debug makefiles
+#SET(CMAKE_START_TEMP_FILE "")
+#SET(CMAKE_END_TEMP_FILE "")
+#SET(CMAKE_VERBOSE_MAKEFILE 1)
+
+# Borland cannot handle + in the file name, so mangle object file name
+SET (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON")
+
+# extra flags for a win32 exe
+SET(CMAKE_CREATE_WIN32_EXE "${_tW}" )
+# extra flags for a console app
+SET(CMAKE_CREATE_CONSOLE_EXE "${_tC}" )
+
+SET (CMAKE_BUILD_TYPE Debug CACHE STRING
+ "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.")
+
+SET (CMAKE_EXE_LINKER_FLAGS_INIT "${_tM} -lS:10000000 -lSc:10000000 ")
+SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v")
+SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v")
+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_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_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT})
+
+
+macro(__embarcadero_language lang)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_DLL "${_tD}") # Note: This variable is a ';' separated list
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "${_tD}") # ... while this is a space separated string.
+
+ # compile a source file into an object file
+ # 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> ${CMAKE_START_TEMP_FILE}-DWIN32 -o<OBJECT> <FLAGS> ${_COMPILE_${lang}} <SOURCE>${CMAKE_END_TEMP_FILE}"
+ )
+
+ set(CMAKE_${lang}_LINK_EXECUTABLE
+ "<CMAKE_${lang}_COMPILER> ${_tR} -e<TARGET> ${CMAKE_START_TEMP_FILE}<LINK_FLAGS> <FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}"
+ # "implib -c -w <TARGET_IMPLIB> <TARGET>"
+ )
+
+ # place <DEFINES> outside the response file because Borland refuses
+ # to parse quotes from the response file.
+ set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
+ "cpp32 <DEFINES> ${CMAKE_START_TEMP_FILE}-DWIN32 <FLAGS> -o<PREPROCESSED_SOURCE> ${_COMPILE_${lang}} <SOURCE>${CMAKE_END_TEMP_FILE}"
+ )
+ # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not
+
+ # Create a module library.
+ set(CMAKE_${lang}_CREATE_SHARED_MODULE
+ "<CMAKE_${lang}_COMPILER> ${_tR} ${_tD} ${CMAKE_START_TEMP_FILE}-e<TARGET> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}"
+ )
+
+ # Create an import library for another target.
+ set(CMAKE_${lang}_CREATE_IMPORT_LIBRARY
+ "implib -c -w <TARGET_IMPLIB> <TARGET>"
+ )
+
+ # Create a shared library.
+ # First create a module and then its import library.
+ set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
+ ${CMAKE_${lang}_CREATE_SHARED_MODULE}
+ ${CMAKE_${lang}_CREATE_IMPORT_LIBRARY}
+ )
+
+ # create a static library
+ set(CMAKE_${lang}_CREATE_STATIC_LIBRARY
+ "tlib ${CMAKE_START_TEMP_FILE}/p512 <LINK_FLAGS> /a <TARGET_QUOTED> <OBJECTS>${CMAKE_END_TEMP_FILE}"
+ )
+
+ # Initial configuration flags.
+ set(CMAKE_${lang}_FLAGS_INIT "${_tM}")
+ set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-Od -v")
+ set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG")
+ set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
+ set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-Od")
+ set(CMAKE_${lang}_STANDARD_LIBRARIES_INIT "import32.lib")
+endmacro()
diff --git a/Modules/Platform/Windows-G95-Fortran.cmake b/Modules/Platform/Windows-G95-Fortran.cmake
new file mode 100644
index 000000000..af0800825
--- /dev/null
+++ b/Modules/Platform/Windows-G95-Fortran.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-GNU-Fortran)
diff --git a/Modules/Platform/Windows-GNU-C-ABI.cmake b/Modules/Platform/Windows-GNU-C-ABI.cmake
new file mode 100644
index 000000000..1189263fa
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-C-ABI.cmake
@@ -0,0 +1 @@
+__windows_compiler_gnu_abi(C)
diff --git a/Modules/Platform/Windows-GNU-C.cmake b/Modules/Platform/Windows-GNU-C.cmake
new file mode 100644
index 000000000..ecf89dc1b
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-GNU)
+__windows_compiler_gnu(C)
diff --git a/Modules/Platform/Windows-GNU-CXX-ABI.cmake b/Modules/Platform/Windows-GNU-CXX-ABI.cmake
new file mode 100644
index 000000000..f3c701c3c
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-CXX-ABI.cmake
@@ -0,0 +1 @@
+__windows_compiler_gnu_abi(CXX)
diff --git a/Modules/Platform/Windows-GNU-CXX.cmake b/Modules/Platform/Windows-GNU-CXX.cmake
new file mode 100644
index 000000000..23e655229
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-GNU)
+__windows_compiler_gnu(CXX)
diff --git a/Modules/Platform/Windows-GNU-Fortran-ABI.cmake b/Modules/Platform/Windows-GNU-Fortran-ABI.cmake
new file mode 100644
index 000000000..179280b4d
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-Fortran-ABI.cmake
@@ -0,0 +1 @@
+__windows_compiler_gnu_abi(Fortran)
diff --git a/Modules/Platform/Windows-GNU-Fortran.cmake b/Modules/Platform/Windows-GNU-Fortran.cmake
new file mode 100644
index 000000000..b81b79679
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-Fortran.cmake
@@ -0,0 +1,5 @@
+include(Platform/Windows-GNU)
+__windows_compiler_gnu(Fortran)
+
+# gfortran on 64-bit MinGW defines __SIZEOF_POINTER__
+set(CMAKE_Fortran_SIZEOF_DATA_PTR_DEFAULT 4)
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
new file mode 100644
index 000000000..4a37eca87
--- /dev/null
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -0,0 +1,187 @@
+
+#=============================================================================
+# 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 module is shared by multiple languages; use include blocker.
+if(__WINDOWS_GNU)
+ return()
+endif()
+set(__WINDOWS_GNU 1)
+
+set(CMAKE_IMPORT_LIBRARY_PREFIX "lib")
+set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
+set(CMAKE_SHARED_MODULE_PREFIX "lib")
+set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+
+set(CMAKE_EXECUTABLE_SUFFIX ".exe")
+set(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a")
+set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
+set(CMAKE_SHARED_MODULE_SUFFIX ".dll")
+set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
+
+if(MSYS OR MINGW)
+ set(CMAKE_EXTRA_LINK_EXTENSIONS ".lib") # MinGW can also link to a MS .lib
+endif()
+
+if(MINGW)
+ set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32")
+ set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
+endif()
+
+set(CMAKE_DL_LIBS "")
+set(CMAKE_LIBRARY_PATH_FLAG "-L")
+set(CMAKE_LINK_LIBRARY_FLAG "-l")
+set(CMAKE_LINK_DEF_FILE_FLAG "") # Empty string: passing the file is enough
+set(CMAKE_LINK_LIBRARY_SUFFIX "")
+set(CMAKE_CREATE_WIN32_EXE "-mwindows")
+
+set(CMAKE_GNULD_IMAGE_VERSION
+ "-Wl,--major-image-version,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>")
+
+# Check if GNU ld is too old to support @FILE syntax.
+set(__WINDOWS_GNU_LD_RESPONSE 1)
+execute_process(COMMAND ld -v OUTPUT_VARIABLE _help ERROR_VARIABLE _help)
+if("${_help}" MATCHES "GNU ld .* 2\\.1[1-6]")
+ set(__WINDOWS_GNU_LD_RESPONSE 0)
+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_FINISH "<CMAKE_RANLIB> <TARGET>")
+
+ # Initialize C link type selection flags. These flags are used when
+ # building a shared library, shared module, or executable that links
+ # to other libraries to select whether to use the static or shared
+ # versions of the libraries.
+ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
+ set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic")
+ set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic")
+ endforeach(type)
+ endif()
+
+ # No -fPIC on Windows
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
+ 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_INCLUDES 1)
+
+ # We prefer "@" for response files but it is not supported by gcc 3.
+ execute_process(COMMAND ${CMAKE_${lang}_COMPILER} --version OUTPUT_VARIABLE _ver ERROR_VARIABLE _ver)
+ if("${_ver}" MATCHES "\\(GCC\\) 3\\.")
+ if("${lang}" STREQUAL "Fortran")
+ # The GNU Fortran compiler reports an error:
+ # no input files; unwilling to write output files
+ # when the response file is passed with "-Wl,@".
+ set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 0)
+ else()
+ # Use "-Wl,@" to pass the response file to the linker.
+ set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Wl,@")
+ 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)
+ # 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>")
+ 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>")
+ 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>")
+
+ list(APPEND CMAKE_${lang}_ABI_FILES "Platform/Windows-GNU-${lang}-ABI")
+
+ # Support very long lists of object files.
+ # TODO: check for which gcc versions this is still needed, not needed for gcc >= 4.4.
+ # Ninja generator doesn't support this work around.
+ if("${CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG}" STREQUAL "@" AND NOT CMAKE_GENERATOR MATCHES "Ninja")
+ foreach(rule CREATE_SHARED_MODULE CREATE_SHARED_LIBRARY LINK_EXECUTABLE)
+ # The gcc/collect2/ld toolchain does not use response files
+ # internally so we cannot pass long object lists. Instead pass
+ # the object file list in a response file to the archiver to put
+ # them in a temporary archive. Hand the archive to the linker.
+ string(REPLACE "<OBJECTS>" "-Wl,--whole-archive <OBJECT_DIR>/objects.a -Wl,--no-whole-archive"
+ CMAKE_${lang}_${rule} "${CMAKE_${lang}_${rule}}")
+ set(CMAKE_${lang}_${rule}
+ "<CMAKE_COMMAND> -E remove -f <OBJECT_DIR>/objects.a"
+ "<CMAKE_AR> cr <OBJECT_DIR>/objects.a <OBJECTS>"
+ "${CMAKE_${lang}_${rule}}"
+ )
+ endforeach()
+ endif()
+endmacro()
+
+macro(__windows_compiler_gnu_abi lang)
+ if(CMAKE_NO_GNUtoMS)
+ set(CMAKE_GNUtoMS 0)
+ else()
+ option(CMAKE_GNUtoMS "Convert GNU import libraries to MS format (requires Visual Studio)" OFF)
+ endif()
+
+ if(CMAKE_GNUtoMS AND NOT CMAKE_GNUtoMS_LIB)
+ # Find MS development environment setup script for this architecture.
+ if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4)
+ find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars32.bat
+ DOC "Visual Studio vcvars32.bat"
+ PATHS
+ "[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"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++;ProductDir]/bin"
+ )
+ set(CMAKE_GNUtoMS_ARCH x86)
+ elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
+ find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvarsamd64.bat
+ DOC "Visual Studio vcvarsamd64.bat"
+ PATHS
+ "[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"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin/amd64"
+ )
+ set(CMAKE_GNUtoMS_ARCH amd64)
+ endif()
+ set_property(CACHE CMAKE_GNUtoMS_VCVARS PROPERTY ADVANCED 1)
+ if(CMAKE_GNUtoMS_VCVARS)
+ # Create helper script to run lib.exe from MS environment.
+ string(REPLACE "/" "\\" CMAKE_GNUtoMS_BAT "${CMAKE_GNUtoMS_VCVARS}")
+ set(CMAKE_GNUtoMS_LIB ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeGNUtoMS_lib.bat)
+ configure_file(${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.bat.in ${CMAKE_GNUtoMS_LIB})
+ else()
+ message(WARNING "Disabling CMAKE_GNUtoMS option because CMAKE_GNUtoMS_VCVARS is not set.")
+ set(CMAKE_GNUtoMS 0)
+ endif()
+ endif()
+
+ if(CMAKE_GNUtoMS)
+ # Teach CMake how to create a MS import library at link time.
+ set(CMAKE_${lang}_GNUtoMS_RULE " -Wl,--output-def,<TARGET_NAME>.def"
+ "<CMAKE_COMMAND> -Dlib=\"${CMAKE_GNUtoMS_LIB}\" -Ddef=<TARGET_NAME>.def -Ddll=<TARGET> -Dimp=<TARGET_IMPLIB> -P \"${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.cmake\""
+ )
+ endif()
+endmacro()
diff --git a/Modules/Platform/Windows-Intel-ASM.cmake b/Modules/Platform/Windows-Intel-ASM.cmake
new file mode 100644
index 000000000..31d08c7ad
--- /dev/null
+++ b/Modules/Platform/Windows-Intel-ASM.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-Intel)
+__windows_compiler_intel(ASM)
diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake
new file mode 100644
index 000000000..767fec541
--- /dev/null
+++ b/Modules/Platform/Windows-Intel-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-Intel)
+__windows_compiler_intel(C)
diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake
new file mode 100644
index 000000000..ec5f0aec6
--- /dev/null
+++ b/Modules/Platform/Windows-Intel-CXX.cmake
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 000000000..5c016a8fd
--- /dev/null
+++ b/Modules/Platform/Windows-Intel-Fortran.cmake
@@ -0,0 +1,11 @@
+include(Platform/Windows-Intel)
+set(CMAKE_BUILD_TYPE_INIT Debug)
+set(_COMPILE_Fortran " /fpp")
+set(CMAKE_Fortran_MODDIR_FLAG "-module:")
+set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib")
+__windows_compiler_intel(Fortran)
+SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads")
+SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/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
new file mode 100644
index 000000000..2a54a981b
--- /dev/null
+++ b/Modules/Platform/Windows-Intel.cmake
@@ -0,0 +1,108 @@
+
+#=============================================================================
+# Copyright 2002-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.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__WINDOWS_INTEL)
+ return()
+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(CMAKE_VERBOSE_MAKEFILE)
+ SET(CMAKE_CL_NOLOGO "/nologo")
+ENDIF(CMAKE_VERBOSE_MAKEFILE)
+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 "/STACK:10000000 /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_ROOT_BIN}/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(_XILINK_HELP MATCHES MANIFEST)
+ IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake")
+ FILE(WRITE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake
+ "
+SET(_INTEL_XILINK_TEST_RUN 1)
+SET(_INTEL_COMPILER_SUPPORTS_MANIFEST ${_INTEL_COMPILER_SUPPORTS_MANIFEST})
+")
+ ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake")
+ENDIF(NOT _INTEL_XILINK_TEST_RUN)
+
+macro(__windows_compiler_intel lang)
+ set(CMAKE_${lang}_COMPILE_OBJECT
+ "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo<OBJECT> <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}_LINK_EXECUTABLE
+ "<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> -link /implib:<TARGET_IMPLIB> <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()
+endmacro()
diff --git a/Modules/Platform/Windows-NMcl.cmake b/Modules/Platform/Windows-NMcl.cmake
new file mode 100644
index 000000000..7add0b060
--- /dev/null
+++ b/Modules/Platform/Windows-NMcl.cmake
@@ -0,0 +1,4 @@
+# this is for the numega compiler which is really a front
+# end for visual studio, but adds memory checking code.
+
+include(Platform/Windows-cl)
diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake
new file mode 100644
index 000000000..be6abb690
--- /dev/null
+++ b/Modules/Platform/Windows-cl.cmake
@@ -0,0 +1,253 @@
+# try to load any previously computed information for C on this platform
+INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL)
+# try to load any previously computed information for CXX on this platform
+INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL)
+
+SET(WIN32 1)
+
+INCLUDE(Platform/cl)
+
+SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows)
+SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console)
+
+IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
+ SET (CMAKE_NO_BUILD_TYPE 1)
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
+IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")
+ SET (CMAKE_NO_BUILD_TYPE 1)
+ SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING
+ "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.")
+ MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES)
+ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")
+# does the compiler support pdbtype and is it the newer compiler
+IF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
+ SET(CMAKE_COMPILER_2005 1)
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
+
+# make sure to enable languages after setting configuration types
+ENABLE_LANGUAGE(RC)
+SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
+
+# for nmake we need to compute some information about the compiler
+# that is being used.
+# the compiler may be free command line, 6, 7, or 71, and
+# each have properties that must be determined.
+# to avoid running these tests with each cmake run, the
+# test results are saved in CMakeCPlatform.cmake, a file
+# that is automatically copied into try_compile directories
+# by the global generator.
+SET(MSVC_IDE 1)
+IF(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja")
+ SET(MSVC_IDE 0)
+ IF(NOT CMAKE_VC_COMPILER_TESTS_RUN)
+ SET(CMAKE_VC_COMPILER_TESTS 1)
+ SET(testNmakeCLVersionFile
+ "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c")
+ STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}")
+ MESSAGE(STATUS "Check for CL compiler version")
+ SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER})
+ IF (NOT CMAKE_C_COMPILER)
+ SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER})
+ ENDIF(NOT CMAKE_C_COMPILER)
+ EXEC_PROGRAM(${CMAKE_TEST_COMPILER}
+ ARGS /nologo -EP \"${testNmakeCLVersionFile}\"
+ OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
+ RETURN_VALUE CMAKE_COMPILER_RETURN
+ )
+ IF(NOT CMAKE_COMPILER_RETURN)
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining the version of compiler passed with the following output:\n"
+ "${CMAKE_COMPILER_OUTPUT}\n\n")
+ STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}")
+ STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1"
+ compilerVersion "${compilerVersion}")
+ MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}")
+ SET(MSVC60)
+ SET(MSVC70)
+ SET(MSVC71)
+ SET(MSVC80)
+ SET(CMAKE_COMPILER_2005)
+ IF("${compilerVersion}" LESS 1300)
+ SET(MSVC60 1)
+ SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1)
+ ENDIF("${compilerVersion}" LESS 1300)
+ IF("${compilerVersion}" EQUAL 1300)
+ SET(MSVC70 1)
+ SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0)
+ ENDIF("${compilerVersion}" EQUAL 1300)
+ IF("${compilerVersion}" EQUAL 1310)
+ SET(MSVC71 1)
+ SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0)
+ ENDIF("${compilerVersion}" EQUAL 1310)
+ IF("${compilerVersion}" EQUAL 1400)
+ SET(MSVC80 1)
+ SET(CMAKE_COMPILER_2005 1)
+ ENDIF("${compilerVersion}" EQUAL 1400)
+ IF("${compilerVersion}" EQUAL 1500)
+ SET(MSVC90 1)
+ ENDIF("${compilerVersion}" EQUAL 1500)
+ IF("${compilerVersion}" EQUAL 1600)
+ SET(MSVC10 1)
+ ENDIF("${compilerVersion}" EQUAL 1600)
+ SET(MSVC_VERSION "${compilerVersion}")
+ ELSE(NOT CMAKE_COMPILER_RETURN)
+ MESSAGE(STATUS "Check for CL compiler version - failed")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining the version of compiler failed with the following output:\n"
+ "${CMAKE_COMPILER_OUTPUT}\n\n")
+ ENDIF(NOT CMAKE_COMPILER_RETURN)
+ # try to figure out if we are running the free command line
+ # tools from Microsoft. These tools do not provide debug libraries,
+ # so the link flags used have to be different.
+ MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2")
+ SET(testForFreeVCFile
+ "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx")
+ STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}")
+ MESSAGE(STATUS "Check if this is a free VC compiler")
+ EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2
+ ARGS /nologo /MD /EHsc
+ \"${testForFreeVCFile}\"
+ OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
+ RETURN_VALUE CMAKE_COMPILER_RETURN
+ )
+ IF(CMAKE_COMPILER_RETURN)
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if this is a free VC compiler failed with the following output:\n"
+ "${CMAKE_COMPILER_OUTPUT}\n\n")
+ MESSAGE(STATUS "Check if this is a free VC compiler - yes")
+ SET(CMAKE_USING_VC_FREE_TOOLS 1)
+ ELSE(CMAKE_COMPILER_RETURN)
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if this is a free VC compiler passed with the following output:\n"
+ "${CMAKE_COMPILER_OUTPUT}\n\n")
+ MESSAGE(STATUS "Check if this is a free VC compiler - no")
+ SET(CMAKE_USING_VC_FREE_TOOLS 0)
+ ENDIF(CMAKE_COMPILER_RETURN)
+ MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3")
+ ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN)
+ENDIF(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja")
+
+IF(MSVC_C_ARCHITECTURE_ID MATCHES 64)
+ SET(CMAKE_CL_64 1)
+ELSE(MSVC_C_ARCHITECTURE_ID MATCHES 64)
+ SET(CMAKE_CL_64 0)
+ENDIF(MSVC_C_ARCHITECTURE_ID MATCHES 64)
+IF(CMAKE_FORCE_WIN64 OR CMAKE_FORCE_IA64)
+ SET(CMAKE_CL_64 1)
+ENDIF(CMAKE_FORCE_WIN64 OR CMAKE_FORCE_IA64)
+
+IF("${MSVC_VERSION}" GREATER 1599)
+ SET(MSVC_INCREMENTAL_DEFAULT ON)
+ENDIF()
+
+# default to Debug builds
+IF(MSVC_VERSION GREATER 1310)
+ # for 2005 make sure the manifest is put in the dll with mt
+ SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
+ SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}")
+ # create a C shared library
+ SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
+ # create a C shared module just copy the shared library rule
+ SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")
+ SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}")
+ SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}")
+
+ SET(CMAKE_BUILD_TYPE_INIT Debug)
+ SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR")
+ SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
+ SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
+ SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")
+ SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
+ SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
+ SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
+ SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
+ 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 ")
+ SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}")
+ELSE(MSVC_VERSION GREATER 1310)
+ IF(CMAKE_USING_VC_FREE_TOOLS)
+ MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available")
+ SET(CMAKE_BUILD_TYPE_INIT Release)
+ SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR")
+ SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ")
+ SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
+ SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")
+ SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ")
+ SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
+ SET (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
+ SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
+ ELSE(CMAKE_USING_VC_FREE_TOOLS)
+ SET(CMAKE_BUILD_TYPE_INIT Debug)
+ SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR")
+ SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ")
+ SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
+ SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
+ SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")
+ SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ")
+ SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
+ SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
+ SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
+ ENDIF(CMAKE_USING_VC_FREE_TOOLS)
+ 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(MSVC_VERSION GREATER 1310)
+
+SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
+
+# executable linker flags
+SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
+# set the stack size and the machine type
+SET(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID})
+IF(NOT _MACHINE_ARCH_FLAG)
+ SET(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID})
+ENDIF(NOT _MACHINE_ARCH_FLAG)
+SET (CMAKE_EXE_LINKER_FLAGS_INIT
+ "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_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" )
+ENDIF()
+
+IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
+ SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
+ SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
+ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
+ SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}")
+ SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}")
+ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
+# for release and minsize release default to no incremental linking
+SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO")
+
+# copy the EXE_LINKER flags to SHARED and MODULE linker flags
+# 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_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
+SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
+# module linker flags
+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})
+SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
+SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
+
+# save computed information for this platform
+IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake")
+ CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE)
+ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake")
+
+IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake")
+ CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE)
+ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake")
diff --git a/Modules/Platform/Windows-cl.cmake.in b/Modules/Platform/Windows-cl.cmake.in
new file mode 100644
index 000000000..82a0e595f
--- /dev/null
+++ b/Modules/Platform/Windows-cl.cmake.in
@@ -0,0 +1,14 @@
+SET(CMAKE_VC_COMPILER_TESTS_RUN 1)
+SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE @CMAKE_COMPILER_SUPPORTS_PDBTYPE@)
+SET(CMAKE_COMPILER_2005 @CMAKE_COMPILER_2005@)
+SET(CMAKE_USING_VC_FREE_TOOLS @CMAKE_USING_VC_FREE_TOOLS@)
+SET(CMAKE_CL_64 @CMAKE_CL_64@)
+SET(MSVC60 @MSVC60@)
+SET(MSVC70 @MSVC70@)
+SET(MSVC71 @MSVC71@)
+SET(MSVC80 @MSVC80@)
+SET(MSVC90 @MSVC90@)
+SET(MSVC10 @MSVC10@)
+SET(MSVC_IDE @MSVC_IDE@)
+SET(MSVC_VERSION @MSVC_VERSION@)
+SET(WIN32 1)
diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake
new file mode 100644
index 000000000..f5046bf35
--- /dev/null
+++ b/Modules/Platform/Windows-df.cmake
@@ -0,0 +1,70 @@
+# compiler support for fortran CVF compiler on windows
+
+SET(CMAKE_WINDOWS_OBJECT_PATH 1)
+SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:")
+SET(CMAKE_LINK_LIBRARY_FLAG "")
+SET(WIN32 1)
+IF(CMAKE_VERBOSE_MAKEFILE)
+ SET(CMAKE_CL_NOLOGO)
+ELSE(CMAKE_VERBOSE_MAKEFILE)
+ SET(CMAKE_CL_NOLOGO "/nologo")
+ENDIF(CMAKE_VERBOSE_MAKEFILE)
+
+SET(CMAKE_Fortran_MODDIR_FLAG "-module:")
+
+SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY
+ "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+
+SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY})
+
+# create a C++ static library
+SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
+
+# compile a C++ file into an object file
+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_Fortran_LINK_EXECUTABLE
+ "<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /exe:<TARGET> /link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+
+SET(CMAKE_CREATE_WIN32_EXE /winapp)
+SET(CMAKE_CREATE_CONSOLE_EXE )
+
+IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
+ SET (CMAKE_NO_BUILD_TYPE 1)
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
+IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8")
+ SET (CMAKE_NO_BUILD_TYPE 1)
+ SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING
+ "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.")
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8")
+# does the compiler support pdbtype and is it the newer compiler
+
+SET(CMAKE_BUILD_TYPE_INIT Debug)
+SET (CMAKE_Fortran_FLAGS_INIT "")
+SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full")
+SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/Optimize:2 /Define:NDEBUG")
+SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/Optimize:1 /Define:NDEBUG")
+SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/Optimize:1 /debug:full /Define:NDEBUG")
+
+SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib")
+
+# executable linker flags
+SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
+SET (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES")
+IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
+ SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept")
+ SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept")
+ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
+ SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
+ SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug")
+ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
+
+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})
diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake
new file mode 100644
index 000000000..14b3b81d5
--- /dev/null
+++ b/Modules/Platform/Windows-wcl386.cmake
@@ -0,0 +1,122 @@
+SET(CMAKE_LIBRARY_PATH_FLAG "libpath ")
+SET(CMAKE_LINK_LIBRARY_FLAG "library ")
+SET(CMAKE_LINK_LIBRARY_FILE_FLAG "library")
+
+IF(CMAKE_VERBOSE_MAKEFILE)
+ SET(CMAKE_WCL_QUIET)
+ SET(CMAKE_WLINK_QUIET)
+ SET(CMAKE_LIB_QUIET)
+ELSE(CMAKE_VERBOSE_MAKEFILE)
+ SET(CMAKE_WCL_QUIET "-zq")
+ SET(CMAKE_WLINK_QUIET "option quiet")
+ SET(CMAKE_LIB_QUIET "-q")
+ENDIF(CMAKE_VERBOSE_MAKEFILE)
+
+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_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.
+
+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}")
+
+SET(CMAKE_C_CREATE_IMPORT_LIBRARY
+ "wlib -c -q -n -b <TARGET_IMPLIB> +'<TARGET_UNQUOTED>'")
+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}")
+
+
+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}")
+
+# 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}")
+
+# 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}")
+
+# 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}")
+
+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})
+
+# create a C shared library
+SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
+
+# create a C shared module
+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> ")
+
+# create a C static library
+SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY})
+
+IF(NOT CMAKE_WATCOM_COMPILER_TESTS_RUN)
+ SET(CMAKE_WATCOM_COMPILER_TESTS_RUN 1)
+ SET(testWatcomVersionFile
+ "${CMAKE_ROOT}/Modules/CMakeTestWatcomVersion.c")
+ STRING(REGEX REPLACE "/" "\\\\" testWatcomVersionFile "${testWatcomVersionFile}")
+ MESSAGE(STATUS "Check for Watcom compiler version")
+ SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER})
+ IF (NOT CMAKE_C_COMPILER)
+ SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER})
+ ENDIF()
+ EXECUTE_PROCESS(COMMAND ${CMAKE_TEST_COMPILER}
+ -q -pc \"${testWatcomVersionFile}\"
+ OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
+ RESULT_VARIABLE CMAKE_COMPILER_RETURN
+ )
+ STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}")
+ STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1"
+ compilerVersion "${compilerVersion}")
+ IF("${CMAKE_COMPILER_RETURN}" STREQUAL "0")
+ SET(WATCOM16)
+ SET(WATCOM17)
+ SET(WATCOM18)
+ SET(WATCOM19)
+ IF("${compilerVersion}" LESS 1270)
+ SET(WATCOM16 1)
+ ENDIF()
+ IF("${compilerVersion}" EQUAL 1270)
+ SET(WATCOM17 1)
+ ENDIF()
+ IF("${compilerVersion}" EQUAL 1280)
+ SET(WATCOM18 1)
+ ENDIF()
+ IF("${compilerVersion}" EQUAL 1290)
+ SET(WATCOM19 1)
+ ENDIF()
+ ENDIF()
+ENDIF()
diff --git a/Modules/Platform/Windows-windres.cmake b/Modules/Platform/Windows-windres.cmake
new file mode 100644
index 000000000..8bc1b15e9
--- /dev/null
+++ b/Modules/Platform/Windows-windres.cmake
@@ -0,0 +1 @@
+SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <FLAGS> <DEFINES> <SOURCE> <OBJECT>")
diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake
new file mode 100644
index 000000000..09cb8d303
--- /dev/null
+++ b/Modules/Platform/Windows.cmake
@@ -0,0 +1,36 @@
+SET(WIN32 1)
+
+SET(CMAKE_STATIC_LIBRARY_PREFIX "")
+SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
+SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib
+SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so
+SET(CMAKE_IMPORT_LIBRARY_PREFIX "")
+SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
+SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe
+SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib")
+SET(CMAKE_DL_LIBS "")
+
+SET(CMAKE_FIND_LIBRARY_PREFIXES "")
+SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
+
+# for borland make long command lines are redirected to a file
+# with the following syntax, see Windows-bcc32.cmake for use
+IF(CMAKE_GENERATOR MATCHES "Borland")
+ SET(CMAKE_START_TEMP_FILE "@&&|\n")
+ SET(CMAKE_END_TEMP_FILE "\n|")
+ENDIF(CMAKE_GENERATOR MATCHES "Borland")
+
+# for nmake make long command lines are redirected to a file
+# with the following syntax, see Windows-bcc32.cmake for use
+IF(CMAKE_GENERATOR MATCHES "NMake")
+ SET(CMAKE_START_TEMP_FILE "@<<\n")
+ SET(CMAKE_END_TEMP_FILE "\n<<")
+ENDIF(CMAKE_GENERATOR MATCHES "NMake")
+
+INCLUDE(Platform/WindowsPaths)
+
+# uncomment these out to debug nmake and borland makefiles
+#SET(CMAKE_START_TEMP_FILE "")
+#SET(CMAKE_END_TEMP_FILE "")
+#SET(CMAKE_VERBOSE_MAKEFILE 1)
+
diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake
new file mode 100644
index 000000000..c7b15b342
--- /dev/null
+++ b/Modules/Platform/WindowsPaths.cmake
@@ -0,0 +1,96 @@
+
+#=============================================================================
+# Copyright 2006-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.)
+
+# Block multiple inclusion because "CMakeCInformation.cmake" includes
+# "Platform/${CMAKE_SYSTEM_NAME}" even though the generic module
+# "CMakeSystemSpecificInformation.cmake" already included it.
+# The extra inclusion is a work-around documented next to the include()
+# call, so this can be removed when the work-around is removed.
+IF(__WINDOWS_PATHS_INCLUDED)
+ RETURN()
+ENDIF()
+SET(__WINDOWS_PATHS_INCLUDED 1)
+
+# Add the program-files folder(s) to the list of installation
+# prefixes.
+#
+# 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>
+#
+# Windows 32-bit Binary:
+# 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}")
+ 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)")
+ ENDIF()
+ ENDIF()
+ENDIF()
+
+# 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}"
+
+ # MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set)
+ /
+ )
+
+LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH
+ )
+
+# mingw can also link against dlls which can also be in /bin, so list this too
+LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+ "${CMAKE_INSTALL_PREFIX}/bin"
+ "${_CMAKE_INSTALL_DIR}/bin"
+ /bin
+ )
+
+LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH
+ )
diff --git a/Modules/Platform/Xenix.cmake b/Modules/Platform/Xenix.cmake
new file mode 100644
index 000000000..cf9d17bfd
--- /dev/null
+++ b/Modules/Platform/Xenix.cmake
@@ -0,0 +1,2 @@
+INCLUDE(Platform/UnixPaths)
+
diff --git a/Modules/Platform/cl.cmake b/Modules/Platform/cl.cmake
new file mode 100644
index 000000000..c0f014b58
--- /dev/null
+++ b/Modules/Platform/cl.cmake
@@ -0,0 +1,62 @@
+SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:")
+SET(CMAKE_LINK_LIBRARY_FLAG "")
+SET(MSVC 1)
+
+# hack: if a new cmake (which uses CMAKE__LINKER) runs on an old build tree
+# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache
+# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun)
+# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex
+IF(NOT DEFINED CMAKE_LINKER)
+ SET(CMAKE_LINKER link)
+ENDIF(NOT DEFINED CMAKE_LINKER)
+
+IF(CMAKE_VERBOSE_MAKEFILE)
+ SET(CMAKE_CL_NOLOGO)
+ELSE(CMAKE_VERBOSE_MAKEFILE)
+ SET(CMAKE_CL_NOLOGO "/nologo")
+ENDIF(CMAKE_VERBOSE_MAKEFILE)
+# create a shared C++ library
+SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
+ "<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}")
+SET(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}")
+
+# create a C shared module
+SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")
+
+# create a C++ static library
+SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
+
+# create a C static library
+SET(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_CXX_CREATE_STATIC_LIBRARY}")
+
+# compile a C++ file into an object file
+SET(CMAKE_CXX_COMPILE_OBJECT
+ "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP /Fo<OBJECT> /Fd<TARGET_PDB> -c <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_CL_NOLOGO} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
+
+SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1)
+SET(CMAKE_C_LINK_EXECUTABLE
+ "<CMAKE_C_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+
+SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
+SET(CMAKE_CXX_LINK_EXECUTABLE
+ "<CMAKE_CXX_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+
+SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE
+ "<CMAKE_C_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
+
+SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE
+ "<CMAKE_CXX_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP -E <SOURCE>${CMAKE_END_TEMP_FILE}")
+
+SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE
+ "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
+
+SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE
+ "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /TP /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
+
diff --git a/Modules/Platform/eCos.cmake b/Modules/Platform/eCos.cmake
new file mode 100644
index 000000000..b437c1a9b
--- /dev/null
+++ b/Modules/Platform/eCos.cmake
@@ -0,0 +1,65 @@
+# support for eCos http://ecos.sourceware.org
+
+# Guard against multiple inclusion, which e.g. leads to multiple calls to add_definition() #12987
+IF(__ECOS_CMAKE_INCLUDED)
+ RETURN()
+ENDIF()
+SET(__ECOS_CMAKE_INCLUDED TRUE)
+
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared
+SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
+
+SET(CMAKE_LINK_LIBRARY_SUFFIX "")
+SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
+SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
+SET(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a
+SET(CMAKE_EXECUTABLE_SUFFIX ".elf") # same suffix as if built using UseEcos.cmake
+SET(CMAKE_DL_LIBS "" )
+
+SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
+SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+
+
+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)
+ MESSAGE(FATAL_ERROR "GNU gcc is required for eCos")
+ENDIF(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC)
+IF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC)
+ MESSAGE(FATAL_ERROR "GNU g++ is required for eCos")
+ENDIF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC)
+
+# find eCos system files
+FIND_PATH(ECOS_SYSTEM_CONFIG_HEADER_PATH NAMES pkgconf/system.h)
+FIND_LIBRARY(ECOS_SYSTEM_TARGET_LIBRARY NAMES libtarget.a)
+
+IF(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH)
+ MESSAGE(FATAL_ERROR "Could not find eCos pkgconf/system.h. Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.")
+ENDIF(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH)
+
+IF(NOT ECOS_SYSTEM_TARGET_LIBRARY)
+ MESSAGE(FATAL_ERROR "Could not find eCos \"libtarget.a\". Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.")
+ENDIF(NOT ECOS_SYSTEM_TARGET_LIBRARY)
+
+GET_FILENAME_COMPONENT(ECOS_LIBTARGET_DIRECTORY "${ECOS_SYSTEM_TARGET_LIBRARY}" PATH)
+INCLUDE_DIRECTORIES(${ECOS_SYSTEM_CONFIG_HEADER_PATH})
+ADD_DEFINITIONS(-D__ECOS__=1 -D__ECOS=1)
+
+# special link commands for eCos executables
+SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld <LINK_LIBRARIES>")
+SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld <LINK_LIBRARIES>")
+
+# eCos doesn't 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/gas.cmake b/Modules/Platform/gas.cmake
new file mode 100644
index 000000000..c34aef17a
--- /dev/null
+++ b/Modules/Platform/gas.cmake
@@ -0,0 +1,19 @@
+IF(UNIX)
+ SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o)
+ELSE(UNIX)
+ SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj)
+ENDIF(UNIX)
+
+SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>")
+
+SET(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY
+ "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
+ "<CMAKE_RANLIB> <TARGET> ")
+
+SET(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
+ "<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+
+# to be done
+SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
+SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
+
diff --git a/Modules/Platform/kFreeBSD.cmake b/Modules/Platform/kFreeBSD.cmake
new file mode 100644
index 000000000..c1295fb0d
--- /dev/null
+++ b/Modules/Platform/kFreeBSD.cmake
@@ -0,0 +1,4 @@
+# kFreeBSD looks just like Linux.
+INCLUDE(Platform/Linux)
+
+SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-kfreebsd-gnu[a-z0-9_]*")
diff --git a/Modules/Platform/syllable.cmake b/Modules/Platform/syllable.cmake
new file mode 100644
index 000000000..2d11d08b3
--- /dev/null
+++ b/Modules/Platform/syllable.cmake
@@ -0,0 +1,33 @@
+# this is the platform file for the Syllable OS (http://www.syllable.org)
+# Syllable is a free OS (GPL), which is mostly POSIX conform
+# the linker accepts the rpath related arguments, but this is later on
+# ignored by the runtime linker
+# shared libs are found exclusively via the environment variable DLL_PATH,
+# which may contain also dirs containing the special variable @bindir@
+# by default @bindir@/lib is part of DLL_PATH
+# in order to run the cmake tests successfully it is required that also
+# @bindir@/. and @bindir@/../lib are in DLL_PATH
+
+
+SET(CMAKE_DL_LIBS "dl")
+SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
+SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
+SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+#SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ENDFOREACH(type)
+
+INCLUDE(Platform/UnixPaths)
+
+# these are Syllable specific:
+LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH /usr/indexes)
diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
new file mode 100644
index 000000000..eff4766b1
--- /dev/null
+++ b/Modules/ProcessorCount.cmake
@@ -0,0 +1,183 @@
+# - 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.
+#
+# This function is guaranteed to return a positive integer (>=1) if it
+# succeeds. It returns 0 if there's a problem determining the processor count.
+#
+# Example use, in a ctest -S dashboard script:
+#
+# include(ProcessorCount)
+# ProcessorCount(N)
+# if(NOT N EQUAL 0)
+# set(CTEST_BUILD_FLAGS -j${N})
+# set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
+# endif()
+#
+# This function is intended to offer an approximation of the value of the
+# number of compute cores available on the current machine, such that you
+# may use that value for parallel building and parallel testing. It is meant
+# to help utilize as much of the machine as seems reasonable. Of course,
+# knowledge of what else might be running on the machine simultaneously
+# should be used when deciding whether to request a machine's full capacity
+# all for yourself.
+
+# A more reliable way might be to compile a small C program that uses the CPUID
+# instruction, but that again requires compiler support or compiling assembler
+# code.
+
+#=============================================================================
+# Copyright 2010-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.)
+
+function(ProcessorCount var)
+ # Unknown:
+ set(count 0)
+
+ if(WIN32)
+ # Windows:
+ set(count "$ENV{NUMBER_OF_PROCESSORS}")
+ #message("ProcessorCount: WIN32, trying environment variable")
+ endif()
+
+ if(NOT count)
+ # Mac, FreeBSD, OpenBSD (systems with sysctl):
+ find_program(ProcessorCount_cmd_sysctl sysctl
+ PATHS /usr/sbin /sbin)
+ if(ProcessorCount_cmd_sysctl)
+ execute_process(COMMAND ${ProcessorCount_cmd_sysctl} -n hw.ncpu
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE count)
+ #message("ProcessorCount: trying sysctl '${ProcessorCount_cmd_sysctl}'")
+ endif()
+ endif()
+
+ if(NOT count)
+ # Linux (systems with getconf):
+ find_program(ProcessorCount_cmd_getconf getconf)
+ if(ProcessorCount_cmd_getconf)
+ execute_process(COMMAND ${ProcessorCount_cmd_getconf} _NPROCESSORS_ONLN
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE count)
+ #message("ProcessorCount: trying getconf '${ProcessorCount_cmd_getconf}'")
+ endif()
+ endif()
+
+ if(NOT count)
+ # HPUX (systems with machinfo):
+ find_program(ProcessorCount_cmd_machinfo machinfo
+ PATHS /usr/contrib/bin)
+ if(ProcessorCount_cmd_machinfo)
+ execute_process(COMMAND ${ProcessorCount_cmd_machinfo}
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE machinfo_output)
+ string(REGEX MATCHALL "Number of CPUs = ([0-9]+)" procs "${machinfo_output}")
+ set(count "${CMAKE_MATCH_1}")
+ #message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'")
+ endif()
+ endif()
+
+ if(NOT count)
+ # IRIX (systems with hinv):
+ find_program(ProcessorCount_cmd_hinv hinv
+ PATHS /sbin)
+ if(ProcessorCount_cmd_hinv)
+ execute_process(COMMAND ${ProcessorCount_cmd_hinv}
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE hinv_output)
+ string(REGEX MATCHALL "([0-9]+) .* Processors" procs "${hinv_output}")
+ set(count "${CMAKE_MATCH_1}")
+ #message("ProcessorCount: trying hinv '${ProcessorCount_cmd_hinv}'")
+ endif()
+ endif()
+
+ if(NOT count)
+ # AIX (systems with lsconf):
+ find_program(ProcessorCount_cmd_lsconf lsconf
+ PATHS /usr/sbin)
+ if(ProcessorCount_cmd_lsconf)
+ execute_process(COMMAND ${ProcessorCount_cmd_lsconf}
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE lsconf_output)
+ string(REGEX MATCHALL "Number Of Processors: ([0-9]+)" procs "${lsconf_output}")
+ set(count "${CMAKE_MATCH_1}")
+ #message("ProcessorCount: trying lsconf '${ProcessorCount_cmd_lsconf}'")
+ endif()
+ endif()
+
+ if(NOT count)
+ # QNX (systems with pidin):
+ find_program(ProcessorCount_cmd_pidin pidin)
+ if(ProcessorCount_cmd_pidin)
+ execute_process(COMMAND ${ProcessorCount_cmd_pidin} info
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE pidin_output)
+ string(REGEX MATCHALL "Processor[0-9]+: " procs "${pidin_output}")
+ list(LENGTH procs count)
+ #message("ProcessorCount: trying pidin '${ProcessorCount_cmd_pidin}'")
+ endif()
+ endif()
+
+ if(NOT count)
+ # Sun (systems where uname -X emits "NumCPU" in its output):
+ find_program(ProcessorCount_cmd_uname 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()
+
+ # Execute this code when all previously attempted methods return empty
+ # output:
+ #
+ if(NOT count)
+ # Systems with /proc/cpuinfo:
+ set(cpuinfo_file /proc/cpuinfo)
+ if(EXISTS "${cpuinfo_file}")
+ file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$")
+ list(LENGTH procs count)
+ #message("ProcessorCount: trying cpuinfo '${cpuinfo_file}'")
+ 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:
+ #
+ if(NOT count)
+ set(count "$ENV{NUMBER_OF_PROCESSORS}")
+ #message("ProcessorCount: last fallback, trying environment variable")
+ endif()
+
+ # Ensure an integer return (avoid inadvertently returning an empty string
+ # or an error string)... If it's not a decimal integer, return 0:
+ #
+ if(NOT count MATCHES "^[0-9]+$")
+ set(count 0)
+ endif()
+
+ set(${var} ${count} PARENT_SCOPE)
+endfunction()
diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake
new file mode 100644
index 000000000..10af3bc95
--- /dev/null
+++ b/Modules/Qt4ConfigDependentSettings.cmake
@@ -0,0 +1,295 @@
+# This file is included by FindQt4.cmake, don't include it directly.
+
+#=============================================================================
+# 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.)
+
+
+###############################################
+#
+# configuration/system dependent settings
+#
+###############################################
+
+# find dependencies for some Qt modules
+# when doing builds against a static Qt, they are required
+# when doing builds against a shared Qt, they are not required
+# if a user needs the dependencies, and they couldn't be found, they can set
+# the variables themselves.
+
+SET(QT_QTGUI_LIB_DEPENDENCIES "")
+SET(QT_QTCORE_LIB_DEPENDENCIES "")
+SET(QT_QTNETWORK_LIB_DEPENDENCIES "")
+SET(QT_QTOPENGL_LIB_DEPENDENCIES "")
+SET(QT_QTDBUS_LIB_DEPENDENCIES "")
+SET(QT_QTHELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY})
+
+
+IF(Q_WS_WIN)
+ # On Windows, qconfig.pri has "shared" for shared library builds
+ IF(NOT QT_CONFIG MATCHES "shared")
+ SET(QT_IS_STATIC 1)
+ ENDIF(NOT QT_CONFIG MATCHES "shared")
+ELSE(Q_WS_WIN)
+ # On other platforms, check file extension to know if its static
+ IF(QT_QTCORE_LIBRARY_RELEASE)
+ GET_FILENAME_COMPONENT(qtcore_lib_ext "${QT_QTCORE_LIBRARY_RELEASE}" EXT)
+ IF("${qtcore_lib_ext}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}")
+ SET(QT_IS_STATIC 1)
+ ENDIF("${qtcore_lib_ext}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}")
+ ENDIF(QT_QTCORE_LIBRARY_RELEASE)
+ IF(QT_QTCORE_LIBRARY_DEBUG)
+ GET_FILENAME_COMPONENT(qtcore_lib_ext "${QT_QTCORE_LIBRARY_DEBUG}" EXT)
+ IF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX})
+ SET(QT_IS_STATIC 1)
+ ENDIF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX})
+ ENDIF(QT_QTCORE_LIBRARY_DEBUG)
+ENDIF(Q_WS_WIN)
+
+# build using shared Qt needs -DQT_DLL on Windows
+IF(Q_WS_WIN AND NOT QT_IS_STATIC)
+ SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_DLL)
+ENDIF(Q_WS_WIN AND NOT QT_IS_STATIC)
+
+IF(NOT QT_IS_STATIC)
+ RETURN()
+ENDIF(NOT QT_IS_STATIC)
+
+# QtOpenGL dependencies
+find_package(OpenGL)
+SET (QT_QTOPENGL_LIB_DEPENDENCIES ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY})
+
+
+## system png
+IF(QT_QCONFIG MATCHES "system-png")
+ find_package(PNG)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${PNG_LIBRARY})
+ENDIF(QT_QCONFIG MATCHES "system-png")
+
+## system jpeg
+IF(QT_QCONFIG MATCHES "system-jpeg")
+ find_package(JPEG)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${JPEG_LIBRARIES})
+ENDIF(QT_QCONFIG MATCHES "system-jpeg")
+
+## system tiff
+IF(QT_QCONFIG MATCHES "system-tiff")
+ find_package(TIFF)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${TIFF_LIBRARIES})
+ENDIF(QT_QCONFIG MATCHES "system-tiff")
+
+## system mng
+IF(QT_QCONFIG MATCHES "system-mng")
+ find_library(MNG_LIBRARY NAMES mng)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${MNG_LIBRARY})
+ENDIF(QT_QCONFIG MATCHES "system-mng")
+
+# for X11, get X11 library directory
+IF(Q_WS_X11)
+ FIND_PACKAGE(X11)
+ENDIF(Q_WS_X11)
+
+
+## X11 SM
+IF(QT_QCONFIG MATCHES "x11sm")
+ IF(X11_SM_LIB AND X11_ICE_LIB)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_SM_LIB} ${X11_ICE_LIB})
+ ENDIF(X11_SM_LIB AND X11_ICE_LIB)
+ENDIF(QT_QCONFIG MATCHES "x11sm")
+
+
+## Xi
+IF(QT_QCONFIG MATCHES "tablet")
+ IF(X11_Xi_LIB)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xi_LIB})
+ ENDIF(X11_Xi_LIB)
+ENDIF(QT_QCONFIG MATCHES "tablet")
+
+
+## Xrender
+IF(QT_QCONFIG MATCHES "xrender")
+ IF(X11_Xrender_LIB)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xrender_LIB})
+ ENDIF(X11_Xrender_LIB)
+ENDIF(QT_QCONFIG MATCHES "xrender")
+
+
+## Xrandr
+IF(QT_QCONFIG MATCHES "xrandr")
+ IF(X11_Xrandr_LIB)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xrandr_LIB})
+ ENDIF(X11_Xrandr_LIB)
+ENDIF(QT_QCONFIG MATCHES "xrandr")
+
+
+## Xcursor
+IF(QT_QCONFIG MATCHES "xcursor")
+ IF(X11_Xcursor_LIB)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xcursor_LIB})
+ ENDIF(X11_Xcursor_LIB)
+ENDIF(QT_QCONFIG MATCHES "xcursor")
+
+
+## Xinerama
+IF(QT_QCONFIG MATCHES "xinerama")
+ IF(X11_Xinerama_LIB)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xinerama_LIB})
+ ENDIF(X11_Xinerama_LIB)
+ENDIF(QT_QCONFIG MATCHES "xinerama")
+
+
+## Xfixes
+IF(QT_QCONFIG MATCHES "xfixes")
+ IF(X11_Xfixes_LIB)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xfixes_LIB})
+ ENDIF(X11_Xfixes_LIB)
+ENDIF(QT_QCONFIG MATCHES "xfixes")
+
+
+## fontconfig
+IF(QT_QCONFIG MATCHES "fontconfig")
+ FIND_LIBRARY(QT_FONTCONFIG_LIBRARY NAMES fontconfig)
+ MARK_AS_ADVANCED(QT_FONTCONFIG_LIBRARY)
+ IF(QT_FONTCONFIG_LIBRARY)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY})
+ ENDIF(QT_FONTCONFIG_LIBRARY)
+ENDIF(QT_QCONFIG MATCHES "fontconfig")
+
+
+## system-freetype
+IF(QT_QCONFIG MATCHES "system-freetype")
+ find_package(Freetype)
+ if(FREETYPE_LIBRARIES)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${FREETYPE_LIBRARIES})
+ endif(FREETYPE_LIBRARIES)
+ENDIF(QT_QCONFIG MATCHES "system-freetype")
+
+
+## system-zlib
+IF(QT_QCONFIG MATCHES "system-zlib")
+ find_package(ZLIB)
+ SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${ZLIB_LIBRARIES})
+ENDIF(QT_QCONFIG MATCHES "system-zlib")
+
+
+## openssl
+IF(NOT Q_WS_WIN)
+ SET(_QT_NEED_OPENSSL 0)
+ IF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl")
+ SET(_QT_NEED_OPENSSL 1)
+ ENDIF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl")
+ IF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked")
+ SET(_QT_NEED_OPENSSL 1)
+ ENDIF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked")
+ IF(_QT_NEED_OPENSSL)
+ FIND_PACKAGE(OpenSSL)
+ IF(OPENSSL_LIBRARIES)
+ SET(QT_QTNETWORK_LIB_DEPENDENCIES ${QT_QTNETWORK_LIB_DEPENDENCIES} ${OPENSSL_LIBRARIES})
+ ENDIF(OPENSSL_LIBRARIES)
+ ENDIF(_QT_NEED_OPENSSL)
+ENDIF(NOT Q_WS_WIN)
+
+
+## dbus
+IF(QT_QCONFIG MATCHES "dbus")
+
+ FIND_LIBRARY(QT_DBUS_LIBRARY NAMES dbus-1 )
+ IF(QT_DBUS_LIBRARY)
+ SET(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY})
+ ENDIF(QT_DBUS_LIBRARY)
+ MARK_AS_ADVANCED(QT_DBUS_LIBRARY)
+
+ENDIF(QT_QCONFIG MATCHES "dbus")
+
+
+## glib
+IF(QT_QCONFIG MATCHES "glib")
+
+ # Qt 4.2.0+ uses glib-2.0
+ FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0 )
+ FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0 )
+ MARK_AS_ADVANCED(QT_GLIB_LIBRARY)
+ MARK_AS_ADVANCED(QT_GTHREAD_LIBRARY)
+
+ IF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY)
+ SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES}
+ ${QT_GTHREAD_LIBRARY} ${QT_GLIB_LIBRARY})
+ ENDIF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY)
+
+
+ # Qt 4.5+ also links to gobject-2.0
+ IF(QT_VERSION_MINOR GREATER 4)
+ FIND_LIBRARY(QT_GOBJECT_LIBRARY NAMES gobject-2.0 PATHS ${_glib_query_output} )
+ MARK_AS_ADVANCED(QT_GOBJECT_LIBRARY)
+
+ IF(QT_GOBJECT_LIBRARY)
+ SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES}
+ ${QT_GOBJECT_LIBRARY})
+ ENDIF(QT_GOBJECT_LIBRARY)
+ ENDIF(QT_VERSION_MINOR GREATER 4)
+
+ENDIF(QT_QCONFIG MATCHES "glib")
+
+
+## clock-monotonic, just see if we need to link with rt
+IF(QT_QCONFIG MATCHES "clock-monotonic")
+ SET(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
+ SET(CMAKE_REQUIRED_LIBRARIES rt)
+ CHECK_SYMBOL_EXISTS(_POSIX_TIMERS "unistd.h;time.h" QT_POSIX_TIMERS)
+ SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
+ IF(QT_POSIX_TIMERS)
+ FIND_LIBRARY(QT_RT_LIBRARY NAMES rt)
+ MARK_AS_ADVANCED(QT_RT_LIBRARY)
+ IF(QT_RT_LIBRARY)
+ SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_RT_LIBRARY})
+ ENDIF(QT_RT_LIBRARY)
+ ENDIF(QT_POSIX_TIMERS)
+ENDIF(QT_QCONFIG MATCHES "clock-monotonic")
+
+
+IF(Q_WS_X11)
+ # X11 libraries Qt always depends on
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB})
+
+ set(CMAKE_THREAD_PREFER_PTHREADS 1)
+ find_package(Threads)
+ if(CMAKE_USE_PTHREADS_INIT)
+ SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT})
+ endif(CMAKE_USE_PTHREADS_INIT)
+
+ SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_DL_LIBS})
+
+ENDIF(Q_WS_X11)
+
+
+IF(Q_WS_WIN)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} imm32 winmm)
+ SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ws2_32)
+ENDIF(Q_WS_WIN)
+
+
+IF(Q_WS_MAC)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework Carbon")
+
+ # Qt 4.0, 4.1, 4.2 use QuickTime
+ IF(QT_VERSION_MINOR LESS 3)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework QuickTime")
+ ENDIF(QT_VERSION_MINOR LESS 3)
+
+ # Qt 4.2+ use AppKit
+ IF(QT_VERSION_MINOR GREATER 1)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework AppKit")
+ ENDIF(QT_VERSION_MINOR GREATER 1)
+
+ SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} "-framework ApplicationServices")
+ENDIF(Q_WS_MAC)
+
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
new file mode 100644
index 000000000..68f3c8085
--- /dev/null
+++ b/Modules/Qt4Macros.cmake
@@ -0,0 +1,441 @@
+# This file is included by FindQt4.cmake, don't include it directly.
+
+#=============================================================================
+# 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.)
+
+
+######################################
+#
+# Macros for building Qt files
+#
+######################################
+
+
+MACRO (QT4_EXTRACT_OPTIONS _qt4_files _qt4_options)
+ SET(${_qt4_files})
+ SET(${_qt4_options})
+ SET(_QT4_DOING_OPTIONS FALSE)
+ FOREACH(_currentArg ${ARGN})
+ IF ("${_currentArg}" STREQUAL "OPTIONS")
+ SET(_QT4_DOING_OPTIONS TRUE)
+ ELSE ("${_currentArg}" STREQUAL "OPTIONS")
+ IF(_QT4_DOING_OPTIONS)
+ LIST(APPEND ${_qt4_options} "${_currentArg}")
+ ELSE(_QT4_DOING_OPTIONS)
+ LIST(APPEND ${_qt4_files} "${_currentArg}")
+ ENDIF(_QT4_DOING_OPTIONS)
+ ENDIF ("${_currentArg}" STREQUAL "OPTIONS")
+ ENDFOREACH(_currentArg)
+ENDMACRO (QT4_EXTRACT_OPTIONS)
+
+
+# macro used to create the names of output files preserving relative dirs
+MACRO (QT4_MAKE_OUTPUT_FILE infile prefix ext outfile )
+ STRING(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength)
+ STRING(LENGTH ${infile} _infileLength)
+ SET(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR})
+ IF(_infileLength GREATER _binlength)
+ STRING(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile)
+ IF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile})
+ ELSE(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
+ ENDIF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ ELSE(_infileLength GREATER _binlength)
+ FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
+ ENDIF(_infileLength GREATER _binlength)
+ IF(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path
+ STRING(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}")
+ ENDIF(WIN32 AND rel MATCHES "^[a-zA-Z]:")
+ SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
+ STRING(REPLACE ".." "__" _outfile ${_outfile})
+ GET_FILENAME_COMPONENT(outpath ${_outfile} PATH)
+ GET_FILENAME_COMPONENT(_outfile ${_outfile} NAME_WE)
+ FILE(MAKE_DIRECTORY ${outpath})
+ SET(${outfile} ${outpath}/${prefix}${_outfile}.${ext})
+ENDMACRO (QT4_MAKE_OUTPUT_FILE )
+
+
+MACRO (QT4_GET_MOC_FLAGS _moc_flags)
+ SET(${_moc_flags})
+ GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
+
+ FOREACH(_current ${_inc_DIRS})
+ IF("${_current}" MATCHES "\\.framework/?$")
+ STRING(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}")
+ SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}")
+ ELSE("${_current}" MATCHES "\\.framework/?$")
+ SET(${_moc_flags} ${${_moc_flags}} "-I${_current}")
+ ENDIF("${_current}" MATCHES "\\.framework/?$")
+ ENDFOREACH(_current ${_inc_DIRS})
+
+ GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS)
+ FOREACH(_current ${_defines})
+ SET(${_moc_flags} ${${_moc_flags}} "-D${_current}")
+ ENDFOREACH(_current ${_defines})
+
+ IF(Q_WS_WIN)
+ SET(${_moc_flags} ${${_moc_flags}} -DWIN32)
+ ENDIF(Q_WS_WIN)
+
+ENDMACRO(QT4_GET_MOC_FLAGS)
+
+
+# helper macro to set up a moc rule
+MACRO (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options)
+ # For Windows, create a parameters file to work around command line length limit
+ IF (WIN32)
+ # Pass the parameters in a file. Set the working directory to
+ # be that containing the parameters file and reference it by
+ # just the file name. This is necessary because the moc tool on
+ # MinGW builds does not seem to handle spaces in the path to the
+ # file given with the @ syntax.
+ GET_FILENAME_COMPONENT(_moc_outfile_name "${outfile}" NAME)
+ GET_FILENAME_COMPONENT(_moc_outfile_dir "${outfile}" PATH)
+ IF(_moc_outfile_dir)
+ SET(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir})
+ ENDIF(_moc_outfile_dir)
+ SET (_moc_parameters_file ${outfile}_parameters)
+ SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}")
+ STRING (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
+ FILE (WRITE ${_moc_parameters_file} "${_moc_parameters}")
+ ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+ COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters
+ DEPENDS ${infile}
+ ${_moc_working_dir}
+ VERBATIM)
+ ELSE (WIN32)
+ ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+ COMMAND ${QT_MOC_EXECUTABLE}
+ ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile}
+ DEPENDS ${infile} VERBATIM)
+ ENDIF (WIN32)
+ENDMACRO (QT4_CREATE_MOC_COMMAND)
+
+
+MACRO (QT4_GENERATE_MOC infile outfile )
+# get include dirs and flags
+ QT4_GET_MOC_FLAGS(moc_flags)
+ GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE)
+ SET(_outfile "${outfile}")
+ IF(NOT IS_ABSOLUTE "${outfile}")
+ SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
+ ENDIF(NOT IS_ABSOLUTE "${outfile}")
+ QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "")
+ SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file
+ENDMACRO (QT4_GENERATE_MOC)
+
+
+# QT4_WRAP_CPP(outfiles inputfile ... )
+
+MACRO (QT4_WRAP_CPP outfiles )
+ # get include dirs
+ QT4_GET_MOC_FLAGS(moc_flags)
+ QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN})
+
+ FOREACH (it ${moc_files})
+ GET_FILENAME_COMPONENT(it ${it} ABSOLUTE)
+ QT4_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile)
+ QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}")
+ SET(${outfiles} ${${outfiles}} ${outfile})
+ ENDFOREACH(it)
+
+ENDMACRO (QT4_WRAP_CPP)
+
+
+# QT4_WRAP_UI(outfiles inputfile ... )
+
+MACRO (QT4_WRAP_UI outfiles )
+ QT4_EXTRACT_OPTIONS(ui_files ui_options ${ARGN})
+
+ FOREACH (it ${ui_files})
+ GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
+ GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
+ SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
+ ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+ COMMAND ${QT_UIC_EXECUTABLE}
+ ARGS ${ui_options} -o ${outfile} ${infile}
+ MAIN_DEPENDENCY ${infile} VERBATIM)
+ SET(${outfiles} ${${outfiles}} ${outfile})
+ ENDFOREACH (it)
+
+ENDMACRO (QT4_WRAP_UI)
+
+
+# QT4_ADD_RESOURCES(outfiles inputfile ... )
+
+MACRO (QT4_ADD_RESOURCES outfiles )
+ QT4_EXTRACT_OPTIONS(rcc_files rcc_options ${ARGN})
+
+ FOREACH (it ${rcc_files})
+ GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE)
+ GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
+ GET_FILENAME_COMPONENT(rc_path ${infile} PATH)
+ SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx)
+
+ SET(_RC_DEPENDS)
+ IF(EXISTS "${infile}")
+ # parse file for dependencies
+ # all files are absolute paths or relative to the location of the qrc file
+ FILE(READ "${infile}" _RC_FILE_CONTENTS)
+ STRING(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}")
+ FOREACH(_RC_FILE ${_RC_FILES})
+ STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}")
+ IF(NOT IS_ABSOLUTE "${_RC_FILE}")
+ SET(_RC_FILE "${rc_path}/${_RC_FILE}")
+ ENDIF(NOT IS_ABSOLUTE "${_RC_FILE}")
+ SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}")
+ ENDFOREACH(_RC_FILE)
+ # Since this cmake macro is doing the dependency scanning for these files,
+ # 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)
+ ELSE(EXISTS "${infile}")
+ # The .qrc file does not exist (yet). Let's add a dependency and hope
+ # that it will be generated later
+ SET(out_depends)
+ ENDIF(EXISTS "${infile}")
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+ COMMAND ${QT_RCC_EXECUTABLE}
+ ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
+ MAIN_DEPENDENCY ${infile}
+ DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM)
+ SET(${outfiles} ${${outfiles}} ${outfile})
+ ENDFOREACH (it)
+
+ENDMACRO (QT4_ADD_RESOURCES)
+
+
+MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename)
+ GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE)
+ SET(_header "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h")
+ SET(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp")
+ SET(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc")
+
+ GET_SOURCE_FILE_PROPERTY(_nonamespace ${_interface} NO_NAMESPACE)
+ IF(_nonamespace)
+ SET(_params -N -m)
+ ELSE(_nonamespace)
+ SET(_params -m)
+ ENDIF(_nonamespace)
+
+ GET_SOURCE_FILE_PROPERTY(_classname ${_interface} CLASSNAME)
+ IF(_classname)
+ SET(_params ${_params} -c ${_classname})
+ ENDIF(_classname)
+
+ GET_SOURCE_FILE_PROPERTY(_include ${_interface} INCLUDE)
+ IF(_include)
+ SET(_params ${_params} -i ${_include})
+ ENDIF(_include)
+
+ ADD_CUSTOM_COMMAND(OUTPUT "${_impl}" "${_header}"
+ COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile}
+ DEPENDS ${_infile} VERBATIM)
+
+ SET_SOURCE_FILES_PROPERTIES("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE)
+
+ QT4_GENERATE_MOC("${_header}" "${_moc}")
+
+ LIST(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}")
+ MACRO_ADD_FILE_DEPENDENCIES("${_impl}" "${_moc}")
+
+ENDMACRO(QT4_ADD_DBUS_INTERFACE)
+
+
+MACRO(QT4_ADD_DBUS_INTERFACES _sources)
+ FOREACH (_current_FILE ${ARGN})
+ GET_FILENAME_COMPONENT(_infile ${_current_FILE} ABSOLUTE)
+ GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME)
+ # get the part before the ".xml" suffix
+ STRING(TOLOWER ${_basename} _basename)
+ STRING(REGEX REPLACE "(.*\\.)?([^\\.]+)\\.xml" "\\2" _basename ${_basename})
+ QT4_ADD_DBUS_INTERFACE(${_sources} ${_infile} ${_basename}interface)
+ ENDFOREACH (_current_FILE)
+ENDMACRO(QT4_ADD_DBUS_INTERFACES)
+
+
+MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options )
+ QT4_EXTRACT_OPTIONS(_customName _qt4_dbus_options ${ARGN})
+
+ GET_FILENAME_COMPONENT(_in_file ${_header} ABSOLUTE)
+ GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE)
+
+ IF (_customName)
+ if (IS_ABSOLUTE ${_customName})
+ get_filename_component(_containingDir ${_customName} PATH)
+ if (NOT EXISTS ${_containingDir})
+ file(MAKE_DIRECTORY "${_containingDir}")
+ endif()
+ SET(_target ${_customName})
+ else()
+ SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName})
+ endif()
+ ELSE (_customName)
+ SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml)
+ ENDIF (_customName)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_target}
+ COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_qt4_dbus_options} ${_in_file} -o ${_target}
+ DEPENDS ${_in_file} VERBATIM
+ )
+ENDMACRO(QT4_GENERATE_DBUS_INTERFACE)
+
+
+MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName)
+ GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE)
+
+ SET(_optionalBasename "${ARGV4}")
+ IF (_optionalBasename)
+ SET(_basename ${_optionalBasename} )
+ ELSE (_optionalBasename)
+ STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile})
+ STRING(TOLOWER ${_basename} _basename)
+ ENDIF (_optionalBasename)
+
+ SET(_optionalClassName "${ARGV5}")
+ 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}
+ DEPENDS ${_infile} VERBATIM
+ )
+ ELSE(_optionalClassName)
+ ADD_CUSTOM_COMMAND(OUTPUT "${_impl}" "${_header}"
+ COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile}
+ DEPENDS ${_infile} VERBATIM
+ )
+ ENDIF(_optionalClassName)
+
+ QT4_GENERATE_MOC("${_header}" "${_moc}")
+ SET_SOURCE_FILES_PROPERTIES("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE)
+ MACRO_ADD_FILE_DEPENDENCIES("${_impl}" "${_moc}")
+
+ LIST(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}")
+ENDMACRO(QT4_ADD_DBUS_ADAPTOR)
+
+
+MACRO(QT4_AUTOMOC)
+ QT4_GET_MOC_FLAGS(_moc_INCS)
+
+ SET(_matching_FILES )
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
+ # if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
+ # This is required to make uic work correctly:
+ # we need to add generated .cpp files to the sources (to compile them),
+ # but we cannot let automoc handle them, as the .cpp files don't exist yet when
+ # cmake is run for the very first time on them -> however the .cpp files might
+ # exist at a later run. at that time we need to skip them, so that we don't add two
+ # different rules for the same moc file
+ GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC)
+
+ IF ( NOT _skip AND EXISTS ${_abs_FILE} )
+
+ FILE(READ ${_abs_FILE} _contents)
+
+ GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH)
+
+ STRING(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]" _match "${_contents}")
+ IF(_match)
+ FOREACH (_current_MOC_INC ${_match})
+ STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
+
+ GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE)
+ IF(EXISTS ${_abs_PATH}/${_basename}.hpp)
+ SET(_header ${_abs_PATH}/${_basename}.hpp)
+ ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp)
+ SET(_header ${_abs_PATH}/${_basename}.h)
+ ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp)
+ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
+ QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "")
+ MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
+ ENDFOREACH (_current_MOC_INC)
+ ENDIF(_match)
+ ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} )
+ ENDFOREACH (_current_FILE)
+ENDMACRO(QT4_AUTOMOC)
+
+
+MACRO(QT4_CREATE_TRANSLATION _qm_files)
+ QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options ${ARGN})
+ SET(_my_sources)
+ SET(_my_dirs)
+ SET(_my_tsfiles)
+ SET(_ts_pro)
+ FOREACH (_file ${_lupdate_files})
+ GET_FILENAME_COMPONENT(_ext ${_file} EXT)
+ GET_FILENAME_COMPONENT(_abs_FILE ${_file} ABSOLUTE)
+ IF(_ext MATCHES "ts")
+ LIST(APPEND _my_tsfiles ${_abs_FILE})
+ ELSE(_ext MATCHES "ts")
+ IF(NOT _ext)
+ LIST(APPEND _my_dirs ${_abs_FILE})
+ ELSE(NOT _ext)
+ LIST(APPEND _my_sources ${_abs_FILE})
+ ENDIF(NOT _ext)
+ ENDIF(_ext MATCHES "ts")
+ ENDFOREACH(_file)
+ FOREACH(_ts_file ${_my_tsfiles})
+ IF(_my_sources)
+ # make a .pro file to call lupdate on, so we don't make our commands too
+ # long for some systems
+ GET_FILENAME_COMPONENT(_ts_name ${_ts_file} NAME_WE)
+ 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}\"")
+ ENDFOREACH(_pro_src ${_my_sources})
+ SET(_pro_includes)
+ GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
+ FOREACH(_pro_include ${_inc_DIRS})
+ GET_FILENAME_COMPONENT(_abs_include "${_pro_include}" ABSOLUTE)
+ SET(_pro_includes "${_pro_includes} \"${_abs_include}\"")
+ ENDFOREACH(_pro_include ${CMAKE_CXX_INCLUDE_PATH})
+ FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}\nINCLUDEPATH = ${_pro_includes}\n")
+ ENDIF(_my_sources)
+ ADD_CUSTOM_COMMAND(OUTPUT ${_ts_file}
+ COMMAND ${QT_LUPDATE_EXECUTABLE}
+ ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file}
+ DEPENDS ${_my_sources} ${_ts_pro} VERBATIM)
+ ENDFOREACH(_ts_file)
+ QT4_ADD_TRANSLATION(${_qm_files} ${_my_tsfiles})
+ENDMACRO(QT4_CREATE_TRANSLATION)
+
+
+MACRO(QT4_ADD_TRANSLATION _qm_files)
+ FOREACH (_current_FILE ${ARGN})
+ GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
+ GET_FILENAME_COMPONENT(qm ${_abs_FILE} NAME_WE)
+ GET_SOURCE_FILE_PROPERTY(output_location ${_abs_FILE} OUTPUT_LOCATION)
+ IF(output_location)
+ FILE(MAKE_DIRECTORY "${output_location}")
+ SET(qm "${output_location}/${qm}.qm")
+ ELSE(output_location)
+ SET(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm")
+ ENDIF(output_location)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${qm}
+ COMMAND ${QT_LRELEASE_EXECUTABLE}
+ ARGS ${_abs_FILE} -qm ${qm}
+ DEPENDS ${_abs_FILE} VERBATIM
+ )
+ SET(${_qm_files} ${${_qm_files}} ${qm})
+ ENDFOREACH (_current_FILE)
+ENDMACRO(QT4_ADD_TRANSLATION)
diff --git a/Modules/RepositoryInfo.txt.in b/Modules/RepositoryInfo.txt.in
new file mode 100644
index 000000000..df8e32272
--- /dev/null
+++ b/Modules/RepositoryInfo.txt.in
@@ -0,0 +1,3 @@
+repository='@repository@'
+module='@module@'
+tag='@tag@'
diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake
new file mode 100644
index 000000000..2e8ade0df
--- /dev/null
+++ b/Modules/SelectLibraryConfigurations.cmake
@@ -0,0 +1,81 @@
+# 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, basename_LIBRARY_DEBUG,
+# and basename_LIBRARY_RELEASE will be set to the release value. If only
+# basename_LIBRARY_DEBUG is defined, then basename_LIBRARY,
+# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value.
+#
+# 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 values.
+
+#=============================================================================
+# Copyright 2009 Will Dicharry <wdicharry@stellarscience.com>
+# 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.)
+
+# This macro was adapted from the FindQt4 CMake module and is maintained by Will
+# Dicharry <wdicharry@stellarscience.com>.
+
+# Utility macro to check if one variable exists while another doesn't, and set
+# one that doesn't exist to the one that exists.
+macro( _set_library_name basename GOOD BAD )
+ if( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} )
+ set( ${basename}_LIBRARY_${BAD} ${${basename}_LIBRARY_${GOOD}} )
+ set( ${basename}_LIBRARY ${${basename}_LIBRARY_${GOOD}} )
+ set( ${basename}_LIBRARIES ${${basename}_LIBRARY_${GOOD}} )
+ endif( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} )
+endmacro( _set_library_name )
+
+macro( select_library_configurations basename )
+ # if only the release version was found, set the debug to be the release
+ # version.
+ _set_library_name( ${basename} RELEASE DEBUG )
+ # if only the debug version was found, set the release value to be the
+ # debug value.
+ _set_library_name( ${basename} DEBUG RELEASE )
+ if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
+ NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE)
+ # if the generator supports configuration types or CMAKE_BUILD_TYPE
+ # is set, then set optimized and debug options.
+ if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ set( ${basename}_LIBRARY
+ optimized ${${basename}_LIBRARY_RELEASE}
+ debug ${${basename}_LIBRARY_DEBUG} )
+ set( ${basename}_LIBRARIES
+ optimized ${${basename}_LIBRARY_RELEASE}
+ debug ${${basename}_LIBRARY_DEBUG} )
+ else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ # If there are no configuration types or build type, just use
+ # the release version
+ set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
+ set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} )
+ endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ endif()
+
+ set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH
+ "The ${basename} library" )
+
+ if( ${basename}_LIBRARY )
+ set( ${basename}_FOUND TRUE )
+ endif( ${basename}_LIBRARY )
+
+ mark_as_advanced( ${basename}_LIBRARY
+ ${basename}_LIBRARY_RELEASE
+ ${basename}_LIBRARY_DEBUG
+ )
+endmacro( select_library_configurations )
diff --git a/Modules/SquishRunTestCase.bat b/Modules/SquishRunTestCase.bat
new file mode 100755
index 000000000..5c5d388b0
--- /dev/null
+++ b/Modules/SquishRunTestCase.bat
@@ -0,0 +1,11 @@
+echo 'Starting the squish server...'
+start %1
+
+echo 'Running the test case...'
+%2 --testcase %3 --wrapper %4 --aut %5
+set result=%ERRORLEVEL%
+
+echo 'Stopping the squish server...'
+%1 --stop
+
+exit \b %result%
diff --git a/Modules/SquishRunTestCase.sh b/Modules/SquishRunTestCase.sh
new file mode 100755
index 000000000..409b46a3e
--- /dev/null
+++ b/Modules/SquishRunTestCase.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+echo "Starting the squish server...$1 --daemon"
+$1 --daemon
+
+echo "Running the test case...$2 --testcase $3 --wrapper $4 --aut $5"
+$2 --testcase $3 --wrapper $4 --aut $5
+returnValue=$?
+
+echo "Stopping the squish server...$1 --stop"
+$1 --stop
+
+exit $returnValue
diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake
new file mode 100644
index 000000000..9eac9707f
--- /dev/null
+++ b/Modules/SquishTestScript.cmake
@@ -0,0 +1,72 @@
+#
+# 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.
+#
+# 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.)
+
+cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
+
+# print out the variable that we are using
+message(STATUS "squish_aut='${squish_aut}'")
+
+message(STATUS "squish_server_executable='${squish_server_executable}'")
+message(STATUS "squish_client_executable='${squish_client_executable}'")
+message(STATUS "squish_libqtdir ='${squish_libqtdir}'")
+message(STATUS "squish_test_case='${squish_test_case}'")
+message(STATUS "squish_wrapper='${squish_wrapper}'")
+message(STATUS "squish_env_vars='${squish_env_vars}'")
+
+# parse enviornment variables
+foreach(i ${squish_env_vars})
+ message(STATUS "parsing env var key/value pair ${i}")
+ string(REGEX MATCH "([^=]*)=(.*)" squish_env_name ${i})
+ message(STATUS "key=${CMAKE_MATCH_1}")
+ message(STATUS "value=${CMAKE_MATCH_2}")
+ set ( ENV{${CMAKE_MATCH_1}} ${CMAKE_MATCH_2} )
+endforeach()
+
+if (QT4_INSTALLED)
+ # record qt lib directory
+ set ( ENV{${SQUISH_LIBQTDIR}} ${squish_libqtdir} )
+endif (QT4_INSTALLED)
+
+# run the test
+if (WIN32)
+ execute_process(
+ COMMAND ${CMAKE_ROOT}/Modules/SquishRunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
+ RESULT_VARIABLE test_rv
+ )
+endif (WIN32)
+
+if (UNIX)
+ execute_process(
+ COMMAND ${CMAKE_ROOT}/Modules/SquishRunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
+ RESULT_VARIABLE test_rv
+ )
+endif (UNIX)
+
+# check for an error with running the test
+if(NOT "${test_rv}" STREQUAL "0")
+ message(FATAL_ERROR "Error running Squish test")
+endif(NOT "${test_rv}" STREQUAL "0")
+
+
+
diff --git a/Modules/SystemInformation.cmake b/Modules/SystemInformation.cmake
new file mode 100644
index 000000000..d4f22331d
--- /dev/null
+++ b/Modules/SystemInformation.cmake
@@ -0,0 +1,103 @@
+
+#=============================================================================
+# Copyright 2007-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.)
+
+CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})
+PROJECT(DumpInformation)
+
+# first get the standard information for th platform
+INCLUDE_DIRECTORIES("This does not exists")
+GET_DIRECTORY_PROPERTY(incl INCLUDE_DIRECTORIES)
+SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${DumpInformation_BINARY_DIR};${DumpInformation_SOURCE_DIR}")
+
+CONFIGURE_FILE("${CMAKE_ROOT}/Modules/SystemInformation.in" "${RESULT_FILE}")
+
+
+FILE(APPEND "${RESULT_FILE}"
+ "\n=================================================================\n")
+FILE(APPEND "${RESULT_FILE}"
+ "=== VARIABLES\n")
+FILE(APPEND "${RESULT_FILE}"
+ "=================================================================\n")
+GET_CMAKE_PROPERTY(res VARIABLES)
+FOREACH(var ${res})
+ FILE(APPEND "${RESULT_FILE}" "${var} \"${${var}}\"\n")
+ENDFOREACH(var ${res})
+
+FILE(APPEND "${RESULT_FILE}"
+ "\n=================================================================\n")
+FILE(APPEND "${RESULT_FILE}"
+ "=== COMMANDS\n")
+FILE(APPEND "${RESULT_FILE}"
+ "=================================================================\n")
+GET_CMAKE_PROPERTY(res COMMANDS)
+FOREACH(var ${res})
+ FILE(APPEND "${RESULT_FILE}" "${var}\n")
+ENDFOREACH(var ${res})
+
+FILE(APPEND "${RESULT_FILE}"
+ "\n=================================================================\n")
+FILE(APPEND "${RESULT_FILE}"
+ "=== MACROS\n")
+FILE(APPEND "${RESULT_FILE}"
+ "=================================================================\n")
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllMacros.txt "")
+GET_CMAKE_PROPERTY(res MACROS)
+FOREACH(var ${res})
+ FILE(APPEND "${RESULT_FILE}" "${var}\n")
+ENDFOREACH(var ${res})
+
+FILE(APPEND "${RESULT_FILE}"
+ "\n=================================================================\n")
+FILE(APPEND "${RESULT_FILE}"
+ "=== OTHER\n")
+FILE(APPEND "${RESULT_FILE}"
+ "=================================================================\n")
+GET_DIRECTORY_PROPERTY(res INCLUDE_DIRECTORIES)
+FOREACH(var ${res})
+ FILE(APPEND "${RESULT_FILE}" "INCLUDE_DIRECTORY: ${var}\n")
+ENDFOREACH(var)
+
+GET_DIRECTORY_PROPERTY(res LINK_DIRECTORIES)
+FOREACH(var ${res})
+ FILE(APPEND "${RESULT_FILE}" "LINK_DIRECTORIES: ${var}\n")
+ENDFOREACH(var)
+
+GET_DIRECTORY_PROPERTY(res INCLUDE_REGULAR_EXPRESSION)
+FILE(APPEND "${RESULT_FILE}" "INCLUDE_REGULAR_EXPRESSION: ${res}\n")
+
+# include other files if they are present, such as when run from within the
+# binary tree
+MACRO(DUMP_FILE THE_FILE)
+ IF (EXISTS "${THE_FILE}")
+ FILE(APPEND "${RESULT_FILE}"
+ "\n=================================================================\n")
+ FILE(APPEND "${RESULT_FILE}"
+ "=== ${THE_FILE}\n")
+ FILE(APPEND "${RESULT_FILE}"
+ "=================================================================\n")
+
+ FILE(READ "${THE_FILE}" FILE_CONTENTS LIMIT 50000)
+ FILE(APPEND "${RESULT_FILE}" "${FILE_CONTENTS}")
+ ENDIF (EXISTS "${THE_FILE}")
+ENDMACRO(DUMP_FILE)
+
+DUMP_FILE("../CMakeCache.txt")
+DUMP_FILE("../CMakeFiles/CMakeOutput.log")
+DUMP_FILE("../CMakeFiles/CMakeError.log")
+DUMP_FILE("../CMakeFiles/CMakeSystem.cmake")
+
+FOREACH (EXTRA_FILE ${EXTRA_DUMP_FILES})
+ DUMP_FILE("${EXTRA_FILE}")
+ENDFOREACH (EXTRA_FILE)
+
diff --git a/Modules/SystemInformation.in b/Modules/SystemInformation.in
new file mode 100644
index 000000000..f2aef5055
--- /dev/null
+++ b/Modules/SystemInformation.in
@@ -0,0 +1,88 @@
+Avoid ctest truncation of output: CTEST_FULL_OUTPUT
+========================================================
+=== MAIN VARIABLES
+========================================================
+CMAKE_STATIC_LIBRARY_PREFIX == "${CMAKE_STATIC_LIBRARY_PREFIX}"
+CMAKE_STATIC_LIBRARY_SUFFIX == "${CMAKE_STATIC_LIBRARY_SUFFIX}"
+CMAKE_SHARED_LIBRARY_PREFIX == "${CMAKE_SHARED_LIBRARY_PREFIX}"
+CMAKE_SHARED_LIBRARY_SUFFIX == "${CMAKE_SHARED_LIBRARY_SUFFIX}"
+CMAKE_SHARED_MODULE_PREFIX == "${CMAKE_SHARED_MODULE_PREFIX}"
+CMAKE_SHARED_MODULE_SUFFIX == "${CMAKE_SHARED_MODULE_SUFFIX}"
+
+
+CMAKE_DL_LIBS == "${CMAKE_DL_LIBS}"
+CMAKE_LIBRARY_PATH_FLAG == "${CMAKE_LIBRARY_PATH_FLAG}"
+CMAKE_LINK_LIBRARY_FLAG == "${CMAKE_LINK_LIBRARY_FLAG}"
+CMAKE_SKIP_RPATH == "${CMAKE_SKIP_RPATH}"
+CMAKE_SYSTEM_INFO_FILE == "${CMAKE_SYSTEM_INFO_FILE}"
+CMAKE_SYSTEM_NAME == "${CMAKE_SYSTEM_NAME}"
+CMAKE_SYSTEM == "${CMAKE_SYSTEM}"
+CMAKE_CXX_COMPILER == "${CMAKE_CXX_COMPILER}"
+CMAKE_C_COMPILER == "${CMAKE_C_COMPILER}"
+CMAKE_COMPILER_IS_GNUCC == "${CMAKE_COMPILER_IS_GNUCC}"
+CMAKE_COMPILER_IS_GNUCXX == "${CMAKE_COMPILER_IS_GNUCXX}"
+
+// C shared library flag
+CMAKE_SHARED_LIBRARY_C_FLAGS == "${CMAKE_SHARED_LIBRARY_C_FLAGS}"
+CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS == "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}"
+CMAKE_SHARED_LIBRARY_LINK_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_FLAGS}"
+CMAKE_SHARED_LIBRARY_RUNTIME_FLAG == "${CMAKE_SHARED_LIBRARY_RUNTIME_FLAG}"
+CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP == "${CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP}"
+CMAKE_SHARED_LIBRARY_LINK_STATIC_C_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_STATIC_C_FLAGS}"
+CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_C_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_C_FLAGS}"
+
+// C shared module flags
+CMAKE_SHARED_MODULE_C_FLAGS == "${CMAKE_SHARED_MODULE_C_FLAGS}"
+CMAKE_SHARED_MODULE_CREATE_C_FLAGS == "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}"
+CMAKE_SHARED_MODULE_LINK_STATIC_C_FLAGS == "${CMAKE_SHARED_MODULE_LINK_STATIC_C_FLAGS}"
+CMAKE_SHARED_MODULE_LINK_DYNAMIC_C_FLAGS == "${CMAKE_SHARED_MODULE_LINK_DYNAMIC_C_FLAGS}"
+
+// C exe flags
+CMAKE_EXE_LINK_STATIC_C_FLAGS == "${CMAKE_EXE_LINK_STATIC_C_FLAGS}"
+CMAKE_EXE_LINK_DYNAMIC_C_FLAGS == "${CMAKE_EXE_LINK_DYNAMIC_C_FLAGS}"
+
+// CXX shared library flags
+CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS == "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}"
+CMAKE_SHARED_LIBRARY_CXX_FLAGS == "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
+CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}"
+CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG == "${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}"
+CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP == "${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP}"
+CMAKE_SHARED_LIBRARY_LINK_STATIC_CXX_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_STATIC_CXX_FLAGS}"
+CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_CXX_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_CXX_FLAGS}"
+
+// CXX shared module flags
+CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS == "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS}"
+CMAKE_SHARED_MODULE_CXX_FLAGS == "${CMAKE_SHARED_MODULE_CXX_FLAGS}"
+CMAKE_SHARED_MODULE_LINK_STATIC_CXX_FLAGS == "${CMAKE_SHARED_MODULE_LINK_STATIC_CXX_FLAGS}"
+CMAKE_SHARED_MODULE_LINK_DYNAMIC_CXX_FLAGS == "${CMAKE_SHARED_MODULE_LINK_DYNAMIC_CXX_FLAGS}"
+
+// CXX exe flags
+CMAKE_EXE_LINK_STATIC_CXX_FLAGS == "${CMAKE_EXE_LINK_STATIC_CXX_FLAGS}"
+CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS == "${CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS}"
+
+CMAKE_USER_MAKE_RULES_OVERRIDE == "${CMAKE_USER_MAKE_RULES_OVERRIDE}"
+CMAKE_VERBOSE_MAKEFILE == "${CMAKE_VERBOSE_MAKEFILE}"
+CMAKE_BUILD_TYPE == "${CMAKE_BUILD_TYPE}"
+CMAKE_CXX_FLAGS == "${CMAKE_CXX_FLAGS}"
+CMAKE_CXX_FLAGS_DEBUG == "${CMAKE_CXX_FLAGS_DEBUG}"
+CMAKE_CXX_FLAGS_MINSIZEREL == "${CMAKE_CXX_FLAGS_MINSIZEREL}"
+CMAKE_CXX_FLAGS_RELEASE == "${CMAKE_CXX_FLAGS_RELEASE}"
+CMAKE_CXX_FLAGS_RELWITHDEBINFO == "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
+
+CMAKE_C_FLAGS == "${CMAKE_C_FLAGS}"
+CMAKE_C_FLAGS_DEBUG == "${CMAKE_C_FLAGS_DEBUG}"
+CMAKE_C_FLAGS_MINSIZEREL == "${CMAKE_C_FLAGS_MINSIZEREL}"
+CMAKE_C_FLAGS_RELEASE == "${CMAKE_C_FLAGS_RELEASE}"
+CMAKE_C_FLAGS_RELWITHDEBINFO == "${CMAKE_C_FLAGS_RELWITHDEBINFO}"
+
+// build rules
+CMAKE_CXX_CREATE_SHARED_LIBRARY == "${CMAKE_CXX_CREATE_SHARED_LIBRARY}"
+CMAKE_CXX_CREATE_SHARED_MODULE == "${CMAKE_CXX_CREATE_SHARED_MODULE}"
+CMAKE_C_CREATE_SHARED_LIBRARY == "${CMAKE_C_CREATE_SHARED_LIBRARY}"
+CMAKE_C_CREATE_SHARED_MODULE == "${CMAKE_C_CREATE_SHARED_MODULE}"
+CMAKE_CXX_CREATE_STATIC_LIBRARY == "${CMAKE_CXX_CREATE_STATIC_LIBRARY}"
+CMAKE_C_CREATE_STATIC_LIBRARY == "${CMAKE_C_CREATE_STATIC_LIBRARY}"
+CMAKE_CXX_COMPILE_OBJECT == "${CMAKE_CXX_COMPILE_OBJECT}"
+CMAKE_C_COMPILE_OBJECT == "${CMAKE_C_COMPILE_OBJECT}"
+CMAKE_C_LINK_EXECUTABLE == "${CMAKE_C_LINK_EXECUTABLE}"
+CMAKE_CXX_LINK_EXECUTABLE == "${CMAKE_CXX_LINK_EXECUTABLE}"
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake
new file mode 100644
index 000000000..996060210
--- /dev/null
+++ b/Modules/TestBigEndian.cmake
@@ -0,0 +1,112 @@
+# - 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
+#
+
+#=============================================================================
+# 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.)
+
+MACRO(TEST_BIG_ENDIAN VARIABLE)
+ IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+ MESSAGE(STATUS "Check if the system is big endian")
+ MESSAGE(STATUS "Searching 16 bit integer")
+
+ INCLUDE(CheckTypeSize)
+
+ CHECK_TYPE_SIZE("unsigned short" CMAKE_SIZEOF_UNSIGNED_SHORT)
+ IF(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2)
+ MESSAGE(STATUS "Using unsigned short")
+ SET(CMAKE_16BIT_TYPE "unsigned short")
+ ELSE(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2)
+ CHECK_TYPE_SIZE("unsigned int" CMAKE_SIZEOF_UNSIGNED_INT)
+ IF(CMAKE_SIZEOF_UNSIGNED_INT)
+ MESSAGE(STATUS "Using unsigned int")
+ SET(CMAKE_16BIT_TYPE "unsigned int")
+
+ ELSE(CMAKE_SIZEOF_UNSIGNED_INT)
+
+ CHECK_TYPE_SIZE("unsigned long" CMAKE_SIZEOF_UNSIGNED_LONG)
+ IF(CMAKE_SIZEOF_UNSIGNED_LONG)
+ MESSAGE(STATUS "Using unsigned long")
+ SET(CMAKE_16BIT_TYPE "unsigned long")
+ ELSE(CMAKE_SIZEOF_UNSIGNED_LONG)
+ MESSAGE(FATAL_ERROR "no suitable type found")
+ ENDIF(CMAKE_SIZEOF_UNSIGNED_LONG)
+
+ ENDIF(CMAKE_SIZEOF_UNSIGNED_INT)
+
+ ENDIF(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2)
+
+
+ CONFIGURE_FILE("${CMAKE_ROOT}/Modules/TestEndianess.c.in"
+ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c"
+ IMMEDIATE @ONLY)
+
+ FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c"
+ TEST_ENDIANESS_FILE_CONTENT)
+
+ TRY_COMPILE(HAVE_${VARIABLE}
+ "${CMAKE_BINARY_DIR}"
+ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c"
+ OUTPUT_VARIABLE OUTPUT
+ COPY_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin" )
+
+ IF(HAVE_${VARIABLE})
+
+ FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin"
+ CMAKE_TEST_ENDIANESS_STRINGS_LE LIMIT_COUNT 1 REGEX "THIS IS LITTLE ENDIAN")
+
+ FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin"
+ CMAKE_TEST_ENDIANESS_STRINGS_BE LIMIT_COUNT 1 REGEX "THIS IS BIG ENDIAN")
+
+ # on mac, if there are universal binaries built both will be true
+ # return the result depending on the machine on which cmake runs
+ IF(CMAKE_TEST_ENDIANESS_STRINGS_BE AND CMAKE_TEST_ENDIANESS_STRINGS_LE)
+ IF(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+ SET(CMAKE_TEST_ENDIANESS_STRINGS_BE TRUE)
+ SET(CMAKE_TEST_ENDIANESS_STRINGS_LE FALSE)
+ ELSE(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+ SET(CMAKE_TEST_ENDIANESS_STRINGS_BE FALSE)
+ SET(CMAKE_TEST_ENDIANESS_STRINGS_LE TRUE)
+ ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+ MESSAGE(STATUS "TEST_BIG_ENDIAN found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !")
+ ENDIF(CMAKE_TEST_ENDIANESS_STRINGS_BE AND CMAKE_TEST_ENDIANESS_STRINGS_LE)
+
+ IF(CMAKE_TEST_ENDIANESS_STRINGS_LE)
+ SET(${VARIABLE} 0 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE)
+ MESSAGE(STATUS "Check if the system is big endian - little endian")
+ ENDIF(CMAKE_TEST_ENDIANESS_STRINGS_LE)
+
+ IF(CMAKE_TEST_ENDIANESS_STRINGS_BE)
+ SET(${VARIABLE} 1 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE)
+ MESSAGE(STATUS "Check if the system is big endian - big endian")
+ ENDIF(CMAKE_TEST_ENDIANESS_STRINGS_BE)
+
+ IF(NOT CMAKE_TEST_ENDIANESS_STRINGS_BE AND NOT CMAKE_TEST_ENDIANESS_STRINGS_LE)
+ MESSAGE(SEND_ERROR "TEST_BIG_ENDIAN found no result!")
+ ENDIF(NOT CMAKE_TEST_ENDIANESS_STRINGS_BE AND NOT CMAKE_TEST_ENDIANESS_STRINGS_LE)
+
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the system is big endian passed with the following output:\n${OUTPUT}\nTestEndianess.c:\n${TEST_ENDIANESS_FILE_CONTENT}\n\n")
+
+ ELSE(HAVE_${VARIABLE})
+ MESSAGE(STATUS "Check if the system is big endian - failed")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the system is big endian failed with the following output:\n${OUTPUT}\nTestEndianess.c:\n${TEST_ENDIANESS_FILE_CONTENT}\n\n")
+ SET(${VARIABLE})
+ ENDIF(HAVE_${VARIABLE})
+ ENDIF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+ENDMACRO(TEST_BIG_ENDIAN)
+
+
diff --git a/Modules/TestCXXAcceptsFlag.cmake b/Modules/TestCXXAcceptsFlag.cmake
new file mode 100644
index 000000000..52d0cf3e6
--- /dev/null
+++ b/Modules/TestCXXAcceptsFlag.cmake
@@ -0,0 +1,43 @@
+# - Test CXX compiler for a flag
+# Check if the CXX compiler accepts a flag
+#
+# Macro CHECK_CXX_ACCEPTS_FLAG(FLAGS VARIABLE) -
+# checks if the function exists
+# FLAGS - the flags to try
+# VARIABLE - variable to store the result
+#
+
+#=============================================================================
+# 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.)
+
+MACRO(CHECK_CXX_ACCEPTS_FLAG FLAGS VARIABLE)
+ IF(NOT DEFINED ${VARIABLE})
+ MESSAGE(STATUS "Checking to see if CXX compiler accepts flag ${FLAGS}")
+ TRY_COMPILE(${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_ROOT}/Modules/DummyCXXFile.cxx
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${FLAGS}
+ OUTPUT_VARIABLE OUTPUT)
+ IF(${VARIABLE})
+ MESSAGE(STATUS "Checking to see if CXX compiler accepts flag ${FLAGS} - yes")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the CXX compiler accepts the flag ${FLAGS} passed with "
+ "the following output:\n${OUTPUT}\n\n")
+ ELSE(${VARIABLE})
+ MESSAGE(STATUS "Checking to see if CXX compiler accepts flag ${FLAGS} - no")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the CXX compiler accepts the flag ${FLAGS} failed with "
+ "the following output:\n${OUTPUT}\n\n")
+ ENDIF(${VARIABLE})
+ ENDIF(NOT DEFINED ${VARIABLE})
+ENDMACRO(CHECK_CXX_ACCEPTS_FLAG)
diff --git a/Modules/TestEndianess.c.in b/Modules/TestEndianess.c.in
new file mode 100644
index 000000000..c924f7858
--- /dev/null
+++ b/Modules/TestEndianess.c.in
@@ -0,0 +1,23 @@
+/* A 16 bit integer is required. */
+typedef @CMAKE_16BIT_TYPE@ cmakeint16;
+
+/* On a little endian machine, these 16bit ints will give "THIS IS LITTLE ENDIAN."
+ On a big endian machine the characters will be exchanged pairwise. */
+const cmakeint16 info_little[] = {0x4854, 0x5349, 0x4920, 0x2053, 0x494c, 0x5454, 0x454c, 0x4520, 0x444e, 0x4149, 0x2e4e, 0x0000};
+
+/* on a big endian machine, these 16bit ints will give "THIS IS BIG ENDIAN."
+ On a little endian machine the characters will be exchanged pairwise. */
+const cmakeint16 info_big[] = {0x5448, 0x4953, 0x2049, 0x5320, 0x4249, 0x4720, 0x454e, 0x4449, 0x414e, 0x2e2e, 0x0000};
+
+#ifdef __CLASSIC_C__
+int main(argc, argv) int argc; char *argv[];
+#else
+int main(int argc, char *argv[])
+#endif
+{
+ int require = 0;
+ require += info_little[argc];
+ require += info_big[argc];
+ (void)argv;
+ return require;
+}
diff --git a/Modules/TestForANSIForScope.cmake b/Modules/TestForANSIForScope.cmake
new file mode 100644
index 000000000..ae2acef7e
--- /dev/null
+++ b/Modules/TestForANSIForScope.cmake
@@ -0,0 +1,44 @@
+# - 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.
+#
+# 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_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$")
+ MESSAGE(STATUS "Check for ANSI scope")
+ TRY_COMPILE(CMAKE_ANSI_FOR_SCOPE ${CMAKE_BINARY_DIR}
+ ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx
+ OUTPUT_VARIABLE OUTPUT)
+ IF (CMAKE_ANSI_FOR_SCOPE)
+ MESSAGE(STATUS "Check for ANSI scope - found")
+ SET (CMAKE_NO_ANSI_FOR_SCOPE 0 CACHE INTERNAL
+ "Does the compiler support ansi for scope.")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the CXX compiler understands ansi for scopes passed with "
+ "the following output:\n${OUTPUT}\n\n")
+ ELSE (CMAKE_ANSI_FOR_SCOPE)
+ MESSAGE(STATUS "Check for ANSI scope - not found")
+ SET (CMAKE_NO_ANSI_FOR_SCOPE 1 CACHE INTERNAL
+ "Does the compiler support ansi for scope.")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the CXX compiler understands ansi for scopes failed with "
+ "the following output:\n${OUTPUT}\n\n")
+ ENDIF (CMAKE_ANSI_FOR_SCOPE)
+ENDIF("CMAKE_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$")
+
+
+
+
+
diff --git a/Modules/TestForANSIStreamHeaders.cmake b/Modules/TestForANSIStreamHeaders.cmake
new file mode 100644
index 000000000..19c1ab2f2
--- /dev/null
+++ b/Modules/TestForANSIStreamHeaders.cmake
@@ -0,0 +1,34 @@
+# - 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.
+#
+# 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(CheckIncludeFileCXX)
+
+IF(NOT CMAKE_NO_ANSI_STREAM_HEADERS)
+ CHECK_INCLUDE_FILE_CXX(iostream CMAKE_ANSI_STREAM_HEADERS)
+ IF (CMAKE_ANSI_STREAM_HEADERS)
+ SET (CMAKE_NO_ANSI_STREAM_HEADERS 0 CACHE INTERNAL
+ "Does the compiler support headers like iostream.")
+ ELSE (CMAKE_ANSI_STREAM_HEADERS)
+ SET (CMAKE_NO_ANSI_STREAM_HEADERS 1 CACHE INTERNAL
+ "Does the compiler support headers like iostream.")
+ ENDIF (CMAKE_ANSI_STREAM_HEADERS)
+
+ MARK_AS_ADVANCED(CMAKE_NO_ANSI_STREAM_HEADERS)
+ENDIF(NOT CMAKE_NO_ANSI_STREAM_HEADERS)
+
+
diff --git a/Modules/TestForANSIStreamHeaders.cxx b/Modules/TestForANSIStreamHeaders.cxx
new file mode 100644
index 000000000..cfb768608
--- /dev/null
+++ b/Modules/TestForANSIStreamHeaders.cxx
@@ -0,0 +1,6 @@
+#include <iostream>
+
+int main(int,char *[])
+{
+ return 0;
+}
diff --git a/Modules/TestForAnsiForScope.cxx b/Modules/TestForAnsiForScope.cxx
new file mode 100644
index 000000000..f2ec76077
--- /dev/null
+++ b/Modules/TestForAnsiForScope.cxx
@@ -0,0 +1,7 @@
+int main(int, char*[])
+{
+ int i;
+ for(int i=0; i < 1; ++i);
+ (void)i;
+ return 0;
+}
diff --git a/Modules/TestForSSTREAM.cmake b/Modules/TestForSSTREAM.cmake
new file mode 100644
index 000000000..8dd53e744
--- /dev/null
+++ b/Modules/TestForSSTREAM.cmake
@@ -0,0 +1,43 @@
+# - 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
+#
+
+#=============================================================================
+# Copyright 2006-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.)
+
+IF("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^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
+ OUTPUT_VARIABLE OUTPUT)
+ IF (CMAKE_HAS_ANSI_STRING_STREAM)
+ MESSAGE(STATUS "Check for sstream - found")
+ SET (CMAKE_NO_ANSI_STRING_STREAM 0 CACHE INTERNAL
+ "Does the compiler support sstream")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the CXX compiler has sstream passed with "
+ "the following output:\n${OUTPUT}\n\n")
+ ELSE (CMAKE_HAS_ANSI_STRING_STREAM)
+ MESSAGE(STATUS "Check for sstream - not found")
+ SET (CMAKE_NO_ANSI_STRING_STREAM 1 CACHE INTERNAL
+ "Does the compiler support sstream")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the CXX compiler has sstream failed with "
+ "the following output:\n${OUTPUT}\n\n")
+ ENDIF (CMAKE_HAS_ANSI_STRING_STREAM)
+ENDIF("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$")
+
+
+
+
diff --git a/Modules/TestForSSTREAM.cxx b/Modules/TestForSSTREAM.cxx
new file mode 100644
index 000000000..af4a4bbef
--- /dev/null
+++ b/Modules/TestForSSTREAM.cxx
@@ -0,0 +1,11 @@
+#include <sstream>
+int main(int, char*[])
+{
+ std::ostringstream os;
+ os << "12345";
+ if(os.str().size() == 5)
+ {
+ return 0;
+ }
+ return -1;
+}
diff --git a/Modules/TestForSTDNamespace.cmake b/Modules/TestForSTDNamespace.cmake
new file mode 100644
index 000000000..932d6e994
--- /dev/null
+++ b/Modules/TestForSTDNamespace.cmake
@@ -0,0 +1,43 @@
+# - Test for std:: namespace support
+# check if the compiler supports std:: on stl classes
+# CMAKE_NO_STD_NAMESPACE - defined by the results
+#
+
+#=============================================================================
+# 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.)
+
+IF("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$")
+ MESSAGE(STATUS "Check for STD namespace")
+ TRY_COMPILE(CMAKE_STD_NAMESPACE ${CMAKE_BINARY_DIR}
+ ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx
+ OUTPUT_VARIABLE OUTPUT)
+ IF (CMAKE_STD_NAMESPACE)
+ MESSAGE(STATUS "Check for STD namespace - found")
+ SET (CMAKE_NO_STD_NAMESPACE 0 CACHE INTERNAL
+ "Does the compiler support std::.")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the CXX compiler has std namespace passed with "
+ "the following output:\n${OUTPUT}\n\n")
+ ELSE (CMAKE_STD_NAMESPACE)
+ MESSAGE(STATUS "Check for STD namespace - not found")
+ SET (CMAKE_NO_STD_NAMESPACE 1 CACHE INTERNAL
+ "Does the compiler support std::.")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the CXX compiler has std namespace failed with "
+ "the following output:\n${OUTPUT}\n\n")
+ ENDIF (CMAKE_STD_NAMESPACE)
+ENDIF("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$")
+
+
+
+
diff --git a/Modules/TestForSTDNamespace.cxx b/Modules/TestForSTDNamespace.cxx
new file mode 100644
index 000000000..fc3ac5911
--- /dev/null
+++ b/Modules/TestForSTDNamespace.cxx
@@ -0,0 +1,6 @@
+#include <list>
+int main(int, char*[])
+{
+ std::list<int>();
+ return 0;
+}
diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake
new file mode 100644
index 000000000..60e1e46b4
--- /dev/null
+++ b/Modules/UseEcos.cmake
@@ -0,0 +1,236 @@
+# - This module defines variables and macros required to build eCos application.
+# This file contains the following macros:
+# ECOS_ADD_INCLUDE_DIRECTORIES() - add the eCos include dirs
+# ECOS_ADD_EXECUTABLE(name source1 ... sourceN ) - create an eCos executable
+# ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN ) - adjusts the path of the source files and puts the result into VAR
+#
+# Macros for selecting the toolchain:
+# ECOS_USE_ARM_ELF_TOOLS() - enable the ARM ELF toolchain for the directory where it is called
+# ECOS_USE_I386_ELF_TOOLS() - enable the i386 ELF toolchain for the directory where it is called
+# ECOS_USE_PPC_EABI_TOOLS() - enable the PowerPC toolchain for the directory where it is called
+#
+# It contains the following variables:
+# ECOS_DEFINITIONS
+# ECOSCONFIG_EXECUTABLE
+# ECOS_CONFIG_FILE - defaults to ecos.ecc, if your eCos configuration file has a different name, adjust this variable
+# for internal use only:
+# ECOS_ADD_TARGET_LIB
+
+#=============================================================================
+# Copyright 2006-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.)
+
+# first check that ecosconfig is available
+FIND_PROGRAM(ECOSCONFIG_EXECUTABLE NAMES ecosconfig)
+IF(NOT ECOSCONFIG_EXECUTABLE)
+ MESSAGE(SEND_ERROR "ecosconfig was not found. Either include it in the system path or set it manually using ccmake.")
+ELSE(NOT ECOSCONFIG_EXECUTABLE)
+ MESSAGE(STATUS "Found ecosconfig: ${ECOSCONFIG_EXECUTABLE}")
+ENDIF(NOT ECOSCONFIG_EXECUTABLE)
+
+# check that ECOS_REPOSITORY is set correctly
+IF (NOT EXISTS $ENV{ECOS_REPOSITORY}/ecos.db)
+ MESSAGE(SEND_ERROR "The environment variable ECOS_REPOSITORY is not set correctly. Set it to the directory which contains the file ecos.db")
+ELSE (NOT EXISTS $ENV{ECOS_REPOSITORY}/ecos.db)
+ MESSAGE(STATUS "ECOS_REPOSITORY is set to $ENV{ECOS_REPOSITORY}")
+ENDIF (NOT EXISTS $ENV{ECOS_REPOSITORY}/ecos.db)
+
+# check that tclsh (coming with TCL) is available, otherwise ecosconfig doesn't work
+FIND_PACKAGE(Tclsh)
+IF (NOT TCL_TCLSH)
+ MESSAGE(SEND_ERROR "The TCL tclsh was not found. Please install TCL, it is required for building eCos applications.")
+ELSE (NOT TCL_TCLSH)
+ MESSAGE(STATUS "tlcsh found: ${TCL_TCLSH}")
+ENDIF (NOT TCL_TCLSH)
+
+#add the globale include-diretories
+#usage: ECOS_ADD_INCLUDE_DIRECTORIES()
+MACRO(ECOS_ADD_INCLUDE_DIRECTORIES)
+#check for ProjectSources.txt one level higher
+ IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt)
+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
+ ELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt)
+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/)
+ ENDIF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt)
+
+#the ecos include directory
+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/ecos/install/include/)
+
+ENDMACRO(ECOS_ADD_INCLUDE_DIRECTORIES)
+
+
+#we want to compile for the xscale processor, in this case the following macro has to be called
+#usage: ECOS_USE_ARM_ELF_TOOLS()
+MACRO (ECOS_USE_ARM_ELF_TOOLS)
+ SET(CMAKE_CXX_COMPILER "arm-elf-c++")
+ SET(CMAKE_COMPILER_IS_GNUCXX 1)
+ SET(CMAKE_C_COMPILER "arm-elf-gcc")
+ SET(CMAKE_AR "arm-elf-ar")
+ SET(CMAKE_RANLIB "arm-elf-ranlib")
+#for linking
+ SET(ECOS_LD_MCPU "-mcpu=xscale")
+#for compiling
+ ADD_DEFINITIONS(-mcpu=xscale -mapcs-frame)
+#for the obj-tools
+ SET(ECOS_ARCH_PREFIX "arm-elf-")
+ENDMACRO (ECOS_USE_ARM_ELF_TOOLS)
+
+#usage: ECOS_USE_PPC_EABI_TOOLS()
+MACRO (ECOS_USE_PPC_EABI_TOOLS)
+ SET(CMAKE_CXX_COMPILER "powerpc-eabi-c++")
+ SET(CMAKE_COMPILER_IS_GNUCXX 1)
+ SET(CMAKE_C_COMPILER "powerpc-eabi-gcc")
+ SET(CMAKE_AR "powerpc-eabi-ar")
+ SET(CMAKE_RANLIB "powerpc-eabi-ranlib")
+#for linking
+ SET(ECOS_LD_MCPU "")
+#for compiling
+ ADD_DEFINITIONS()
+#for the obj-tools
+ SET(ECOS_ARCH_PREFIX "powerpc-eabi-")
+ENDMACRO (ECOS_USE_PPC_EABI_TOOLS)
+
+#usage: ECOS_USE_I386_ELF_TOOLS()
+MACRO (ECOS_USE_I386_ELF_TOOLS)
+ SET(CMAKE_CXX_COMPILER "i386-elf-c++")
+ SET(CMAKE_COMPILER_IS_GNUCXX 1)
+ SET(CMAKE_C_COMPILER "i386-elf-gcc")
+ SET(CMAKE_AR "i386-elf-ar")
+ SET(CMAKE_RANLIB "i386-elf-ranlib")
+#for linking
+ SET(ECOS_LD_MCPU "")
+#for compiling
+ ADD_DEFINITIONS()
+#for the obj-tools
+ SET(ECOS_ARCH_PREFIX "i386-elf-")
+ENDMACRO (ECOS_USE_I386_ELF_TOOLS)
+
+
+#since the actual sources are located one level upwards
+#a "../" has to be prepended in front of every source file
+#call the following macro to achieve this, the first parameter
+#is the name of the new list of source files with adjusted paths,
+#followed by all source files
+#usage: ECOS_ADJUST_DIRECTORY(adjusted_SRCS ${my_srcs})
+MACRO(ECOS_ADJUST_DIRECTORY _target_FILES )
+ FOREACH (_current_FILE ${ARGN})
+ GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
+ IF (NOT ${_abs_FILE} STREQUAL ${_current_FILE})
+ GET_FILENAME_COMPONENT(_abs_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../${_current_FILE} ABSOLUTE)
+ ENDIF (NOT ${_abs_FILE} STREQUAL ${_current_FILE})
+ LIST(APPEND ${_target_FILES} ${_abs_FILE})
+ ENDFOREACH (_current_FILE)
+ENDMACRO(ECOS_ADJUST_DIRECTORY)
+
+# the default ecos config file name
+# maybe in the future also out-of-source builds may be possible
+SET(ECOS_CONFIG_FILE ecos.ecc)
+
+#creates the dependancy from all source files on the ecos target.ld,
+#adds the command for compiling ecos
+MACRO(ECOS_ADD_TARGET_LIB)
+# when building out-of-source, create the ecos/ subdir
+ IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ecos)
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ecos)
+ ENDIF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ecos)
+
+#sources depend on target.ld
+ SET_SOURCE_FILES_PROPERTIES(
+ ${ARGN}
+ PROPERTIES
+ OBJECT_DEPENDS
+ ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld
+ )
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld
+ COMMAND sh -c \"make -C ${CMAKE_CURRENT_BINARY_DIR}/ecos || exit -1\; if [ -e ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld ] \; then touch ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld\; fi\"
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile
+ )
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile
+ COMMAND sh -c \" cd ${CMAKE_CURRENT_BINARY_DIR}/ecos\; ${ECOSCONFIG_EXECUTABLE} --config=${CMAKE_CURRENT_SOURCE_DIR}/ecos/${ECOS_CONFIG_FILE} tree || exit -1\;\"
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ecos/${ECOS_CONFIG_FILE}
+ )
+
+ ADD_CUSTOM_TARGET( ecos make -C ${CMAKE_CURRENT_BINARY_DIR}/ecos/ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile )
+ENDMACRO(ECOS_ADD_TARGET_LIB)
+
+# get the directory of the current file, used later on in the file
+GET_FILENAME_COMPONENT( ECOS_CMAKE_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+#macro for creating an executable ecos application
+#the first parameter is the name of the executable,
+#the second is the list of all source files (where the path
+#has been adjusted beforehand by calling ECOS_ADJUST_DIRECTORY()
+#usage: ECOS_ADD_EXECUTABLE(my_app ${adjusted_SRCS})
+MACRO(ECOS_ADD_EXECUTABLE _exe_NAME )
+ #definitions, valid for all ecos projects
+ #the optimization and "-g" for debugging has to be enabled
+ #in the project-specific CMakeLists.txt
+ ADD_DEFINITIONS(-D__ECOS__=1 -D__ECOS=1)
+ SET(ECOS_DEFINITIONS -Wall -Wno-long-long -pipe -fno-builtin)
+
+#the executable depends on ecos target.ld
+ ECOS_ADD_TARGET_LIB(${ARGN})
+
+# when using nmake makefiles, the custom buildtype supresses the default cl.exe flags
+# and the rules for creating objects are adjusted for gcc
+ SET(CMAKE_BUILD_TYPE CUSTOM_ECOS_BUILD)
+ SET(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <FLAGS> -o <OBJECT> -c <SOURCE>")
+ SET(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <FLAGS> -o <OBJECT> -c <SOURCE>")
+# special link commands for ecos-executables
+ SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}")
+ SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}")
+# some strict compiler flags
+ SET (CMAKE_C_FLAGS "-Wstrict-prototypes")
+ SET (CMAKE_CXX_FLAGS "-Woverloaded-virtual -fno-rtti -Wctor-dtor-privacy -fno-strict-aliasing -fno-exceptions")
+
+ ADD_EXECUTABLE(${_exe_NAME} ${ARGN})
+ SET_TARGET_PROPERTIES(${_exe_NAME} PROPERTIES SUFFIX ".elf")
+
+#create a binary file
+ ADD_CUSTOM_COMMAND(
+ TARGET ${_exe_NAME}
+ POST_BUILD
+ COMMAND ${ECOS_ARCH_PREFIX}objcopy
+ ARGS -O binary ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.bin
+ )
+
+#and an srec file
+ ADD_CUSTOM_COMMAND(
+ TARGET ${_exe_NAME}
+ POST_BUILD
+ COMMAND ${ECOS_ARCH_PREFIX}objcopy
+ ARGS -O srec ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.srec
+ )
+
+#add the created files to the clean-files
+ SET_DIRECTORY_PROPERTIES(
+ PROPERTIES
+ ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.bin;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.srec;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst;"
+ )
+
+ ADD_CUSTOM_TARGET(ecosclean ${CMAKE_COMMAND} -DECOS_DIR=${CMAKE_CURRENT_BINARY_DIR}/ecos/ -P ${ECOS_CMAKE_MODULE_DIR}/ecos_clean.cmake )
+ ADD_CUSTOM_TARGET(normalclean ${CMAKE_MAKE_PROGRAM} clean WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ ADD_DEPENDENCIES (ecosclean normalclean)
+
+
+ ADD_CUSTOM_TARGET( listing
+ COMMAND echo -e \"\\n--- Symbols sorted by address ---\\n\" > ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst
+ COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -n ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst
+ COMMAND echo -e \"\\n--- Symbols sorted by size ---\\n\" >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst
+ COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -r --size-sort ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst
+ COMMAND echo -e \"\\n--- Full assembly listing ---\\n\" >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst
+ COMMAND ${ECOS_ARCH_PREFIX}objdump -S -x -d -C ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst )
+
+ENDMACRO(ECOS_ADD_EXECUTABLE)
+
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
new file mode 100644
index 000000000..0b2d1b833
--- /dev/null
+++ b/Modules/UseJava.cmake
@@ -0,0 +1,881 @@
+# - 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 SRC1 SRC2 .. SRCN RCS1 RCS2 .. RCSN)
+#
+# This command creates a <TARGET_NAME>.jar. It compiles the given source
+# files (SRC) and adds the given resource files (RCS) to the jar file.
+# If only resource files are given then just a jar file is created.
+#
+# Additional instructions:
+# To add compile flags to the target you can set these flags with
+# the following variable:
+#
+# set(CMAKE_JAVA_COMPILE_FLAGS -nowarn)
+#
+# To add a path or a jar file to the class path you can do this
+# with the CMAKE_JAVA_INCLUDE_PATH variable.
+#
+# set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar)
+#
+# To use a different output name for the target you can set it with:
+#
+# set(CMAKE_JAVA_TARGET_OUTPUT_NAME shibboleet.jar)
+# add_jar(foobar foobar.java)
+#
+# To use a different output directory than CMAKE_CURRENT_BINARY_DIR
+# you can set it with:
+#
+# set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin)
+#
+# To define an entry point in your jar you can set it with:
+#
+# set(CMAKE_JAVA_JAR_ENTRY_POINT com/examples/MyProject/Main)
+#
+# To add a VERSION to the target output name you can set it using
+# CMAKE_JAVA_TARGET_VERSION. 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_JAVA_TARGET_VERSION 1.2.0)
+# add_jar(shibboleet shibbotleet.java)
+#
+# If the target is a JNI library, utilize the following commands to
+# create a JNI symbolic link:
+#
+# set(CMAKE_JNI_TARGET TRUE)
+# set(CMAKE_JAVA_TARGET_VERSION 1.2.0)
+# add_jar(shibboleet shibbotleet.java)
+# 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)
+#
+# 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)
+#
+# 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)
+#
+# 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]
+# )
+#
+# 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
+# )
+#
+# The second signature for create_javadoc works on a given list of
+# files.
+#
+# create_javadoc(<VAR>
+# FILES file1 [file2 ...]
+# [CLASSPATH <classpath>]
+# [INSTALLPATH <install path>]
+# [DOCTITLE "the documentation title"]
+# [WINDOWTITLE "the title of the document"]
+# [AUTHOR TRUE|FALSE]
+# [USE TRUE|FALSE]
+# [VERSION TRUE|FALSE]
+# )
+#
+# Example:
+# create_javadoc(my_example_doc
+# FILES ${example_SRCS}
+# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
+# WINDOWTITLE "My example"
+# DOCTITLE "<h1>My example</h1>"
+# AUTHOR TRUE
+# USE TRUE
+# VERSION TRUE
+# )
+#
+# Both signatures share most of the options. These options are the
+# same as what you can find in the javadoc manpage. Please look at
+# the manpage for CLASSPATH, DOCTITLE, WINDOWTITLE, AUTHOR, USE and
+# VERSION.
+#
+# The documentation will be by default installed to
+#
+# ${CMAKE_INSTALL_PREFIX}/share/javadoc/<VAR>
+#
+# if you don't set the INSTALLPATH.
+#
+
+#=============================================================================
+# Copyright 2010-2011 Andreas schneider <asn@redhat.com>
+# Copyright 2010 Ben Boeckel <ben.boeckel@kitware.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 (__java_copy_file src dest comment)
+ add_custom_command(
+ OUTPUT ${dest}
+ COMMAND cmake -E copy_if_different
+ ARGS ${src}
+ ${dest}
+ DEPENDS ${src}
+ COMMENT ${comment})
+endfunction (__java_copy_file src dest comment)
+
+# define helper scripts
+set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake)
+set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake)
+
+function(add_jar _TARGET_NAME)
+ set(_JAVA_SOURCE_FILES ${ARGN})
+
+ if (NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR)
+ set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
+ endif(NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR)
+
+ if (CMAKE_JAVA_JAR_ENTRY_POINT)
+ set(_ENTRY_POINT_OPTION e)
+ set(_ENTRY_POINT_VALUE ${CMAKE_JAVA_JAR_ENTRY_POINT})
+ endif (CMAKE_JAVA_JAR_ENTRY_POINT)
+
+ if (LIBRARY_OUTPUT_PATH)
+ set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
+ else (LIBRARY_OUTPUT_PATH)
+ set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR})
+ endif (LIBRARY_OUTPUT_PATH)
+
+ set(CMAKE_JAVA_INCLUDE_PATH
+ ${CMAKE_JAVA_INCLUDE_PATH}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_JAVA_OBJECT_OUTPUT_PATH}
+ ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH}
+ )
+
+ if (WIN32 AND NOT CYGWIN)
+ set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
+ else (WIN32 AND NOT CYGWIN)
+ set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
+ endif(WIN32 AND NOT CYGWIN)
+
+ foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH})
+ set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
+ endforeach(JAVA_INCLUDE_DIR)
+
+ set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_JAVA_TARGET_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
+
+ set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar")
+ if (CMAKE_JAVA_TARGET_OUTPUT_NAME AND CMAKE_JAVA_TARGET_VERSION)
+ set(_JAVA_TARGET_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}-${CMAKE_JAVA_TARGET_VERSION}.jar")
+ set(_JAVA_TARGET_OUTPUT_LINK "${CMAKE_JAVA_TARGET_OUTPUT_NAME}.jar")
+ elseif (CMAKE_JAVA_TARGET_VERSION)
+ set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}-${CMAKE_JAVA_TARGET_VERSION}.jar")
+ set(_JAVA_TARGET_OUTPUT_LINK "${_TARGET_NAME}.jar")
+ elseif (CMAKE_JAVA_TARGET_OUTPUT_NAME)
+ set(_JAVA_TARGET_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}.jar")
+ endif (CMAKE_JAVA_TARGET_OUTPUT_NAME AND CMAKE_JAVA_TARGET_VERSION)
+ # reset
+ set(CMAKE_JAVA_TARGET_OUTPUT_NAME)
+
+ set(_JAVA_CLASS_FILES)
+ set(_JAVA_COMPILE_FILES)
+ set(_JAVA_DEPENDS)
+ set(_JAVA_RESOURCE_FILES)
+ 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)
+
+ file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_JAVA_TARGET_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)
+ string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
+ if (${_BIN_LEN} LESS ${_SRC_LEN})
+ set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH})
+ else (${_BIN_LEN} LESS ${_SRC_LEN})
+ set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH})
+ endif (${_BIN_LEN} LESS ${_SRC_LEN})
+ get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH)
+
+ if (_JAVA_EXT MATCHES ".java")
+ list(APPEND _JAVA_COMPILE_FILES ${_JAVA_SOURCE_FILE})
+ set(_JAVA_CLASS_FILE "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_REL_PATH}/${_JAVA_FILE}.class")
+ set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES} ${_JAVA_CLASS_FILE})
+
+ elseif (_JAVA_EXT MATCHES ".jar"
+ OR _JAVA_EXT MATCHES ".war"
+ OR _JAVA_EXT MATCHES ".ear"
+ OR _JAVA_EXT MATCHES ".sar")
+ list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_SOURCE_FILE})
+
+ elseif (_JAVA_EXT STREQUAL "")
+ list(APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH})
+ list(APPEND _JAVA_DEPENDS ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}})
+
+ else (_JAVA_EXT MATCHES ".java")
+ __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})
+ endif (_JAVA_EXT MATCHES ".java")
+ endforeach(_JAVA_SOURCE_FILE)
+
+ # create an empty java_class_filelist
+ if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist)
+ file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "")
+ endif()
+
+ if (_JAVA_COMPILE_FILES)
+ # Compile the java files and create a list of class files
+ add_custom_command(
+ # NOTE: this command generates an artificial dependency file
+ OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
+ COMMAND ${Java_JAVAC_EXECUTABLE}
+ ${CMAKE_JAVA_COMPILE_FLAGS}
+ -classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}"
+ -d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+ ${_JAVA_COMPILE_FILES}
+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
+ DEPENDS ${_JAVA_COMPILE_FILES}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMENT "Building Java objects for ${_TARGET_NAME}.jar"
+ )
+ add_custom_command(
+ OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist
+ COMMAND ${CMAKE_COMMAND}
+ -DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+ -DCMAKE_JAR_CLASSES_PREFIX="${CMAKE_JAR_CLASSES_PREFIX}"
+ -P ${_JAVA_CLASS_FILELIST_SCRIPT}
+ DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ endif (_JAVA_COMPILE_FILES)
+
+ # create the jar file
+ set(_JAVA_JAR_OUTPUT_PATH
+ ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME})
+ if (CMAKE_JNI_TARGET)
+ 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
+ COMMAND ${CMAKE_COMMAND}
+ -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR}
+ -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}
+ -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK}
+ -P ${_JAVA_SYMLINK_SCRIPT}
+ COMMAND ${CMAKE_COMMAND}
+ -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR}
+ -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_JAR_OUTPUT_PATH}
+ -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK}
+ -P ${_JAVA_SYMLINK_SCRIPT}
+ DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist
+ WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+ COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}"
+ )
+ else ()
+ 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
+ COMMAND ${CMAKE_COMMAND}
+ -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR}
+ -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}
+ -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK}
+ -P ${_JAVA_SYMLINK_SCRIPT}
+ WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+ DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist
+ COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}"
+ )
+ endif (CMAKE_JNI_TARGET)
+
+ # Add the target and make sure we have the latest resource files.
+ add_custom_target(${_TARGET_NAME} ALL DEPENDS ${_JAVA_JAR_OUTPUT_PATH})
+
+ set_property(
+ TARGET
+ ${_TARGET_NAME}
+ PROPERTY
+ INSTALL_FILES
+ ${_JAVA_JAR_OUTPUT_PATH}
+ )
+
+ if (_JAVA_TARGET_OUTPUT_LINK)
+ set_property(
+ TARGET
+ ${_TARGET_NAME}
+ PROPERTY
+ INSTALL_FILES
+ ${_JAVA_JAR_OUTPUT_PATH}
+ ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK}
+ )
+
+ if (CMAKE_JNI_TARGET)
+ set_property(
+ TARGET
+ ${_TARGET_NAME}
+ PROPERTY
+ JNI_SYMLINK
+ ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK}
+ )
+ endif (CMAKE_JNI_TARGET)
+ endif (_JAVA_TARGET_OUTPUT_LINK)
+
+ set_property(
+ TARGET
+ ${_TARGET_NAME}
+ PROPERTY
+ JAR_FILE
+ ${_JAVA_JAR_OUTPUT_PATH}
+ )
+
+ set_property(
+ TARGET
+ ${_TARGET_NAME}
+ PROPERTY
+ CLASSDIR
+ ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+ )
+
+endfunction(add_jar)
+
+function(INSTALL_JAR _TARGET_NAME _DESTINATION)
+ get_property(__FILES
+ TARGET
+ ${_TARGET_NAME}
+ PROPERTY
+ INSTALL_FILES
+ )
+
+ if (__FILES)
+ install(
+ FILES
+ ${__FILES}
+ DESTINATION
+ ${_DESTINATION}
+ )
+ else (__FILES)
+ message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.")
+ endif (__FILES)
+endfunction(INSTALL_JAR _TARGET_NAME _DESTINATION)
+
+function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION)
+ get_property(__SYMLINK
+ TARGET
+ ${_TARGET_NAME}
+ PROPERTY
+ JNI_SYMLINK
+ )
+
+ if (__SYMLINK)
+ install(
+ FILES
+ ${__SYMLINK}
+ DESTINATION
+ ${_DESTINATION}
+ )
+ else (__SYMLINK)
+ message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.")
+ endif (__SYMLINK)
+endfunction(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION)
+
+function (find_jar VARIABLE)
+ set(_jar_names)
+ set(_jar_files)
+ set(_jar_versions)
+ set(_jar_paths
+ /usr/share/java/
+ /usr/local/share/java/
+ ${Java_JAR_PATHS})
+ set(_jar_doc "NOTSET")
+
+ set(_state "name")
+
+ foreach (arg ${ARGN})
+ if (${_state} STREQUAL "name")
+ if (${arg} STREQUAL "VERSIONS")
+ set(_state "versions")
+ elseif (${arg} STREQUAL "NAMES")
+ set(_state "names")
+ elseif (${arg} STREQUAL "PATHS")
+ set(_state "paths")
+ elseif (${arg} STREQUAL "DOC")
+ set(_state "doc")
+ else (${arg} STREQUAL "NAMES")
+ set(_jar_names ${arg})
+ if (_jar_doc STREQUAL "NOTSET")
+ set(_jar_doc "Finding ${arg} jar")
+ endif (_jar_doc STREQUAL "NOTSET")
+ endif (${arg} STREQUAL "VERSIONS")
+ elseif (${_state} STREQUAL "versions")
+ if (${arg} STREQUAL "NAMES")
+ set(_state "names")
+ elseif (${arg} STREQUAL "PATHS")
+ set(_state "paths")
+ elseif (${arg} STREQUAL "DOC")
+ set(_state "doc")
+ else (${arg} STREQUAL "NAMES")
+ set(_jar_versions ${_jar_versions} ${arg})
+ endif (${arg} STREQUAL "NAMES")
+ elseif (${_state} STREQUAL "names")
+ if (${arg} STREQUAL "VERSIONS")
+ set(_state "versions")
+ elseif (${arg} STREQUAL "PATHS")
+ set(_state "paths")
+ elseif (${arg} STREQUAL "DOC")
+ set(_state "doc")
+ else (${arg} STREQUAL "VERSIONS")
+ set(_jar_names ${_jar_names} ${arg})
+ if (_jar_doc STREQUAL "NOTSET")
+ set(_jar_doc "Finding ${arg} jar")
+ endif (_jar_doc STREQUAL "NOTSET")
+ endif (${arg} STREQUAL "VERSIONS")
+ elseif (${_state} STREQUAL "paths")
+ if (${arg} STREQUAL "VERSIONS")
+ set(_state "versions")
+ elseif (${arg} STREQUAL "NAMES")
+ set(_state "names")
+ elseif (${arg} STREQUAL "DOC")
+ set(_state "doc")
+ else (${arg} STREQUAL "VERSIONS")
+ set(_jar_paths ${_jar_paths} ${arg})
+ endif (${arg} STREQUAL "VERSIONS")
+ elseif (${_state} STREQUAL "doc")
+ if (${arg} STREQUAL "VERSIONS")
+ set(_state "versions")
+ elseif (${arg} STREQUAL "NAMES")
+ set(_state "names")
+ elseif (${arg} STREQUAL "PATHS")
+ set(_state "paths")
+ else (${arg} STREQUAL "VERSIONS")
+ set(_jar_doc ${arg})
+ endif (${arg} STREQUAL "VERSIONS")
+ endif (${_state} STREQUAL "name")
+ endforeach (arg ${ARGN})
+
+ if (NOT _jar_names)
+ message(FATAL_ERROR "find_jar: No name to search for given")
+ endif (NOT _jar_names)
+
+ foreach (jar_name ${_jar_names})
+ foreach (version ${_jar_versions})
+ set(_jar_files ${_jar_files} ${jar_name}-${version}.jar)
+ endforeach (version ${_jar_versions})
+ set(_jar_files ${_jar_files} ${jar_name}.jar)
+ endforeach (jar_name ${_jar_names})
+
+ find_file(${VARIABLE}
+ NAMES ${_jar_files}
+ PATHS ${_jar_paths}
+ DOC ${_jar_doc}
+ NO_DEFAULT_PATH)
+endfunction (find_jar VARIABLE)
+
+function(create_javadoc _target)
+ set(_javadoc_packages)
+ set(_javadoc_files)
+ set(_javadoc_sourcepath)
+ set(_javadoc_classpath)
+ set(_javadoc_installpath "${CMAKE_INSTALL_PREFIX}/share/javadoc")
+ set(_javadoc_doctitle)
+ set(_javadoc_windowtitle)
+ set(_javadoc_author FALSE)
+ set(_javadoc_version FALSE)
+ set(_javadoc_use FALSE)
+
+ set(_state "package")
+
+ foreach (arg ${ARGN})
+ if (${_state} STREQUAL "package")
+ if (${arg} STREQUAL "PACKAGES")
+ set(_state "packages")
+ elseif (${arg} STREQUAL "FILES")
+ set(_state "files")
+ elseif (${arg} STREQUAL "SOURCEPATH")
+ set(_state "sourcepath")
+ elseif (${arg} STREQUAL "CLASSPATH")
+ set(_state "classpath")
+ elseif (${arg} STREQUAL "INSTALLPATH")
+ set(_state "installpath")
+ elseif (${arg} STREQUAL "DOCTITLE")
+ set(_state "doctitle")
+ elseif (${arg} STREQUAL "WINDOWTITLE")
+ set(_state "windowtitle")
+ elseif (${arg} STREQUAL "AUTHOR")
+ set(_state "author")
+ elseif (${arg} STREQUAL "USE")
+ set(_state "use")
+ elseif (${arg} STREQUAL "VERSION")
+ set(_state "version")
+ else ()
+ set(_javadoc_packages ${arg})
+ set(_state "packages")
+ endif ()
+ elseif (${_state} STREQUAL "packages")
+ if (${arg} STREQUAL "FILES")
+ set(_state "files")
+ elseif (${arg} STREQUAL "SOURCEPATH")
+ set(_state "sourcepath")
+ elseif (${arg} STREQUAL "CLASSPATH")
+ set(_state "classpath")
+ elseif (${arg} STREQUAL "INSTALLPATH")
+ set(_state "installpath")
+ elseif (${arg} STREQUAL "DOCTITLE")
+ set(_state "doctitle")
+ elseif (${arg} STREQUAL "WINDOWTITLE")
+ set(_state "windowtitle")
+ elseif (${arg} STREQUAL "AUTHOR")
+ set(_state "author")
+ elseif (${arg} STREQUAL "USE")
+ set(_state "use")
+ elseif (${arg} STREQUAL "VERSION")
+ set(_state "version")
+ else ()
+ list(APPEND _javadoc_packages ${arg})
+ endif ()
+ elseif (${_state} STREQUAL "files")
+ if (${arg} STREQUAL "PACKAGES")
+ set(_state "packages")
+ elseif (${arg} STREQUAL "SOURCEPATH")
+ set(_state "sourcepath")
+ elseif (${arg} STREQUAL "CLASSPATH")
+ set(_state "classpath")
+ elseif (${arg} STREQUAL "INSTALLPATH")
+ set(_state "installpath")
+ elseif (${arg} STREQUAL "DOCTITLE")
+ set(_state "doctitle")
+ elseif (${arg} STREQUAL "WINDOWTITLE")
+ set(_state "windowtitle")
+ elseif (${arg} STREQUAL "AUTHOR")
+ set(_state "author")
+ elseif (${arg} STREQUAL "USE")
+ set(_state "use")
+ elseif (${arg} STREQUAL "VERSION")
+ set(_state "version")
+ else ()
+ list(APPEND _javadoc_files ${arg})
+ endif ()
+ elseif (${_state} STREQUAL "sourcepath")
+ if (${arg} STREQUAL "PACKAGES")
+ set(_state "packages")
+ elseif (${arg} STREQUAL "FILES")
+ set(_state "files")
+ elseif (${arg} STREQUAL "CLASSPATH")
+ set(_state "classpath")
+ elseif (${arg} STREQUAL "INSTALLPATH")
+ set(_state "installpath")
+ elseif (${arg} STREQUAL "DOCTITLE")
+ set(_state "doctitle")
+ elseif (${arg} STREQUAL "WINDOWTITLE")
+ set(_state "windowtitle")
+ elseif (${arg} STREQUAL "AUTHOR")
+ set(_state "author")
+ elseif (${arg} STREQUAL "USE")
+ set(_state "use")
+ elseif (${arg} STREQUAL "VERSION")
+ set(_state "version")
+ else ()
+ list(APPEND _javadoc_sourcepath ${arg})
+ endif ()
+ elseif (${_state} STREQUAL "classpath")
+ if (${arg} STREQUAL "PACKAGES")
+ set(_state "packages")
+ elseif (${arg} STREQUAL "FILES")
+ set(_state "files")
+ elseif (${arg} STREQUAL "SOURCEPATH")
+ set(_state "sourcepath")
+ elseif (${arg} STREQUAL "INSTALLPATH")
+ set(_state "installpath")
+ elseif (${arg} STREQUAL "DOCTITLE")
+ set(_state "doctitle")
+ elseif (${arg} STREQUAL "WINDOWTITLE")
+ set(_state "windowtitle")
+ elseif (${arg} STREQUAL "AUTHOR")
+ set(_state "author")
+ elseif (${arg} STREQUAL "USE")
+ set(_state "use")
+ elseif (${arg} STREQUAL "VERSION")
+ set(_state "version")
+ else ()
+ list(APPEND _javadoc_classpath ${arg})
+ endif ()
+ elseif (${_state} STREQUAL "installpath")
+ if (${arg} STREQUAL "PACKAGES")
+ set(_state "packages")
+ elseif (${arg} STREQUAL "FILES")
+ set(_state "files")
+ elseif (${arg} STREQUAL "SOURCEPATH")
+ set(_state "sourcepath")
+ elseif (${arg} STREQUAL "DOCTITLE")
+ set(_state "doctitle")
+ elseif (${arg} STREQUAL "WINDOWTITLE")
+ set(_state "windowtitle")
+ elseif (${arg} STREQUAL "AUTHOR")
+ set(_state "author")
+ elseif (${arg} STREQUAL "USE")
+ set(_state "use")
+ elseif (${arg} STREQUAL "VERSION")
+ set(_state "version")
+ else ()
+ set(_javadoc_installpath ${arg})
+ endif ()
+ elseif (${_state} STREQUAL "doctitle")
+ if (${arg} STREQUAL "PACKAGES")
+ set(_state "packages")
+ elseif (${arg} STREQUAL "FILES")
+ set(_state "files")
+ elseif (${arg} STREQUAL "SOURCEPATH")
+ set(_state "sourcepath")
+ elseif (${arg} STREQUAL "INSTALLPATH")
+ set(_state "installpath")
+ elseif (${arg} STREQUAL "CLASSPATH")
+ set(_state "classpath")
+ elseif (${arg} STREQUAL "WINDOWTITLE")
+ set(_state "windowtitle")
+ elseif (${arg} STREQUAL "AUTHOR")
+ set(_state "author")
+ elseif (${arg} STREQUAL "USE")
+ set(_state "use")
+ elseif (${arg} STREQUAL "VERSION")
+ set(_state "version")
+ else ()
+ set(_javadoc_doctitle ${arg})
+ endif ()
+ elseif (${_state} STREQUAL "windowtitle")
+ if (${arg} STREQUAL "PACKAGES")
+ set(_state "packages")
+ elseif (${arg} STREQUAL "FILES")
+ set(_state "files")
+ elseif (${arg} STREQUAL "SOURCEPATH")
+ set(_state "sourcepath")
+ elseif (${arg} STREQUAL "CLASSPATH")
+ set(_state "classpath")
+ elseif (${arg} STREQUAL "INSTALLPATH")
+ set(_state "installpath")
+ elseif (${arg} STREQUAL "DOCTITLE")
+ set(_state "doctitle")
+ elseif (${arg} STREQUAL "AUTHOR")
+ set(_state "author")
+ elseif (${arg} STREQUAL "USE")
+ set(_state "use")
+ elseif (${arg} STREQUAL "VERSION")
+ set(_state "version")
+ else ()
+ set(_javadoc_windowtitle ${arg})
+ endif ()
+ elseif (${_state} STREQUAL "author")
+ if (${arg} STREQUAL "PACKAGES")
+ set(_state "packages")
+ elseif (${arg} STREQUAL "FILES")
+ set(_state "files")
+ elseif (${arg} STREQUAL "SOURCEPATH")
+ set(_state "sourcepath")
+ elseif (${arg} STREQUAL "CLASSPATH")
+ set(_state "classpath")
+ elseif (${arg} STREQUAL "INSTALLPATH")
+ set(_state "installpath")
+ elseif (${arg} STREQUAL "DOCTITLE")
+ set(_state "doctitle")
+ elseif (${arg} STREQUAL "WINDOWTITLE")
+ set(_state "windowtitle")
+ elseif (${arg} STREQUAL "AUTHOR")
+ set(_state "author")
+ elseif (${arg} STREQUAL "USE")
+ set(_state "use")
+ elseif (${arg} STREQUAL "VERSION")
+ set(_state "version")
+ else ()
+ set(_javadoc_author ${arg})
+ endif ()
+ elseif (${_state} STREQUAL "use")
+ if (${arg} STREQUAL "PACKAGES")
+ set(_state "packages")
+ elseif (${arg} STREQUAL "FILES")
+ set(_state "files")
+ elseif (${arg} STREQUAL "SOURCEPATH")
+ set(_state "sourcepath")
+ elseif (${arg} STREQUAL "CLASSPATH")
+ set(_state "classpath")
+ elseif (${arg} STREQUAL "INSTALLPATH")
+ set(_state "installpath")
+ elseif (${arg} STREQUAL "DOCTITLE")
+ set(_state "doctitle")
+ elseif (${arg} STREQUAL "WINDOWTITLE")
+ set(_state "windowtitle")
+ elseif (${arg} STREQUAL "AUTHOR")
+ set(_state "author")
+ elseif (${arg} STREQUAL "USE")
+ set(_state "use")
+ elseif (${arg} STREQUAL "VERSION")
+ set(_state "version")
+ else ()
+ set(_javadoc_use ${arg})
+ endif ()
+ elseif (${_state} STREQUAL "version")
+ if (${arg} STREQUAL "PACKAGES")
+ set(_state "packages")
+ elseif (${arg} STREQUAL "FILES")
+ set(_state "files")
+ elseif (${arg} STREQUAL "SOURCEPATH")
+ set(_state "sourcepath")
+ elseif (${arg} STREQUAL "CLASSPATH")
+ set(_state "classpath")
+ elseif (${arg} STREQUAL "INSTALLPATH")
+ set(_state "installpath")
+ elseif (${arg} STREQUAL "DOCTITLE")
+ set(_state "doctitle")
+ elseif (${arg} STREQUAL "WINDOWTITLE")
+ set(_state "windowtitle")
+ elseif (${arg} STREQUAL "AUTHOR")
+ set(_state "author")
+ elseif (${arg} STREQUAL "USE")
+ set(_state "use")
+ elseif (${arg} STREQUAL "VERSION")
+ set(_state "version")
+ else ()
+ set(_javadoc_version ${arg})
+ endif ()
+ endif (${_state} STREQUAL "package")
+ endforeach (arg ${ARGN})
+
+ set(_javadoc_builddir ${CMAKE_CURRENT_BINARY_DIR}/javadoc/${_target})
+ set(_javadoc_options -d ${_javadoc_builddir})
+
+ if (_javadoc_sourcepath)
+ set(_start TRUE)
+ foreach(_path ${_javadoc_sourcepath})
+ if (_start)
+ set(_sourcepath ${_path})
+ set(_start FALSE)
+ else (_start)
+ set(_sourcepath ${_sourcepath}:${_path})
+ endif (_start)
+ endforeach(_path ${_javadoc_sourcepath})
+ set(_javadoc_options ${_javadoc_options} -sourcepath ${_sourcepath})
+ endif (_javadoc_sourcepath)
+
+ if (_javadoc_classpath)
+ set(_start TRUE)
+ foreach(_path ${_javadoc_classpath})
+ if (_start)
+ set(_classpath ${_path})
+ set(_start FALSE)
+ else (_start)
+ set(_classpath ${_classpath}:${_path})
+ endif (_start)
+ endforeach(_path ${_javadoc_classpath})
+ set(_javadoc_options ${_javadoc_options} -classpath "${_classpath}")
+ endif (_javadoc_classpath)
+
+ if (_javadoc_doctitle)
+ set(_javadoc_options ${_javadoc_options} -doctitle '${_javadoc_doctitle}')
+ endif (_javadoc_doctitle)
+
+ if (_javadoc_windowtitle)
+ set(_javadoc_options ${_javadoc_options} -windowtitle '${_javadoc_windowtitle}')
+ endif (_javadoc_windowtitle)
+
+ if (_javadoc_author)
+ set(_javadoc_options ${_javadoc_options} -author)
+ endif (_javadoc_author)
+
+ if (_javadoc_use)
+ set(_javadoc_options ${_javadoc_options} -use)
+ endif (_javadoc_use)
+
+ if (_javadoc_version)
+ set(_javadoc_options ${_javadoc_options} -version)
+ endif (_javadoc_version)
+
+ add_custom_target(${_target}_javadoc ALL
+ COMMAND ${Java_JAVADOC_EXECUTABLE} ${_javadoc_options}
+ ${_javadoc_files}
+ ${_javadoc_packages}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+
+ install(
+ DIRECTORY ${_javadoc_builddir}
+ DESTINATION ${_javadoc_installpath}
+ )
+endfunction(create_javadoc)
diff --git a/Modules/UseJavaClassFilelist.cmake b/Modules/UseJavaClassFilelist.cmake
new file mode 100644
index 000000000..c842bf71a
--- /dev/null
+++ b/Modules/UseJavaClassFilelist.cmake
@@ -0,0 +1,52 @@
+#
+# 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>
+#
+# 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_JAVA_CLASS_OUTPUT_PATH)
+ if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}")
+
+ set(_JAVA_GLOBBED_FILES)
+ if (CMAKE_JAR_CLASSES_PREFIX)
+ foreach(JAR_CLASS_PREFIX ${CMAKE_JAR_CLASSES_PREFIX})
+ message(STATUS "JAR_CLASS_PREFIX: ${JAR_CLASS_PREFIX}")
+
+ file(GLOB_RECURSE _JAVA_GLOBBED_TMP_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${JAR_CLASS_PREFIX}/*.class")
+ if (_JAVA_GLOBBED_TMP_FILES)
+ list(APPEND _JAVA_GLOBBED_FILES ${_JAVA_GLOBBED_TMP_FILES})
+ endif (_JAVA_GLOBBED_TMP_FILES)
+ endforeach(JAR_CLASS_PREFIX ${CMAKE_JAR_CLASSES_PREFIX})
+ else()
+ file(GLOB_RECURSE _JAVA_GLOBBED_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/*.class")
+ endif (CMAKE_JAR_CLASSES_PREFIX)
+
+ set(_JAVA_CLASS_FILES)
+ # file(GLOB_RECURSE foo RELATIVE) is broken so we need this.
+ foreach(_JAVA_GLOBBED_FILE ${_JAVA_GLOBBED_FILES})
+ file(RELATIVE_PATH _JAVA_CLASS_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH} ${_JAVA_GLOBBED_FILE})
+ set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES}${_JAVA_CLASS_FILE}\n)
+ endforeach(_JAVA_GLOBBED_FILE ${_JAVA_GLOBBED_FILES})
+
+ # write to file
+ file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist ${_JAVA_CLASS_FILES})
+
+ else (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}")
+ message(SEND_ERROR "FATAL: Java class output path doesn't exist")
+ endif (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}")
+else (CMAKE_JAVA_CLASS_OUTPUT_PATH)
+ message(SEND_ERROR "FATAL: Can't find CMAKE_JAVA_CLASS_OUTPUT_PATH")
+endif (CMAKE_JAVA_CLASS_OUTPUT_PATH)
diff --git a/Modules/UseJavaSymlinks.cmake b/Modules/UseJavaSymlinks.cmake
new file mode 100644
index 000000000..c66ee1ea1
--- /dev/null
+++ b/Modules/UseJavaSymlinks.cmake
@@ -0,0 +1,32 @@
+#
+# Helper script for UseJava.cmake
+#
+
+#=============================================================================
+# Copyright 2010-2011 Andreas schneider <asn@redhat.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.)
+
+if (UNIX AND _JAVA_TARGET_OUTPUT_LINK)
+ if (_JAVA_TARGET_OUTPUT_NAME)
+ find_program(LN_EXECUTABLE
+ NAMES
+ ln
+ )
+
+ execute_process(
+ COMMAND ${LN_EXECUTABLE} -sf "${_JAVA_TARGET_OUTPUT_NAME}" "${_JAVA_TARGET_OUTPUT_LINK}"
+ WORKING_DIRECTORY ${_JAVA_TARGET_DIR}
+ )
+ else (_JAVA_TARGET_OUTPUT_NAME)
+ message(SEND_ERROR "FATAL: Can't find _JAVA_TARGET_OUTPUT_NAME")
+ endif (_JAVA_TARGET_OUTPUT_NAME)
+endif (UNIX AND _JAVA_TARGET_OUTPUT_LINK)
diff --git a/Modules/UsePkgConfig.cmake b/Modules/UsePkgConfig.cmake
new file mode 100644
index 000000000..7f4318f05
--- /dev/null
+++ b/Modules/UsePkgConfig.cmake
@@ -0,0 +1,78 @@
+# - Obsolete pkg-config module for CMake, use FindPkgConfig instead.
+#
+# This module defines the following macro:
+#
+# PKGCONFIG(package includedir libdir linkflags cflags)
+#
+# Calling PKGCONFIG will fill the desired information into the 4 given arguments,
+# e.g. PKGCONFIG(libart-2.0 LIBART_INCLUDE_DIR LIBART_LINK_DIR LIBART_LINK_FLAGS LIBART_CFLAGS)
+# if pkg-config was NOT found or the specified software package doesn't exist, the
+# variable will be empty when the function returns, otherwise they will contain
+# the respective information
+#
+
+#=============================================================================
+# Copyright 2006-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.)
+
+FIND_PROGRAM(PKGCONFIG_EXECUTABLE NAMES pkg-config )
+
+MACRO(PKGCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
+ MESSAGE(STATUS
+ "WARNING: you are using the obsolete 'PKGCONFIG' macro, use FindPkgConfig")
+# reset the variables at the beginning
+ SET(${_include_DIR})
+ SET(${_link_DIR})
+ SET(${_link_FLAGS})
+ SET(${_cflags})
+
+ # if pkg-config has been found
+ IF(PKGCONFIG_EXECUTABLE)
+
+ EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --exists RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
+
+ # and if the package of interest also exists for pkg-config, then get the information
+ IF(NOT _return_VALUE)
+
+ EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=includedir
+ OUTPUT_VARIABLE ${_include_DIR} )
+ STRING(REGEX REPLACE "[\r\n]" " " ${_include_DIR} "${${_include_DIR}}")
+
+
+ EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=libdir
+ OUTPUT_VARIABLE ${_link_DIR} )
+ STRING(REGEX REPLACE "[\r\n]" " " ${_link_DIR} "${${_link_DIR}}")
+
+ EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --libs
+ OUTPUT_VARIABLE ${_link_FLAGS} )
+ STRING(REGEX REPLACE "[\r\n]" " " ${_link_FLAGS} "${${_link_FLAGS}}")
+
+ EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --cflags
+ OUTPUT_VARIABLE ${_cflags} )
+ STRING(REGEX REPLACE "[\r\n]" " " ${_cflags} "${${_cflags}}")
+
+ ELSE( NOT _return_VALUE)
+
+ MESSAGE(STATUS "PKGCONFIG() indicates that ${_package} is not installed (install the package which contains ${_package}.pc if you want to support this feature)")
+
+ ENDIF(NOT _return_VALUE)
+
+ # if pkg-config has NOT been found, INFORM the user
+ ELSE(PKGCONFIG_EXECUTABLE)
+
+ MESSAGE(STATUS "WARNING: PKGCONFIG() indicates that the tool pkg-config has not been found on your system. You should install it.")
+
+ ENDIF(PKGCONFIG_EXECUTABLE)
+
+ENDMACRO(PKGCONFIG _include_DIR _link_DIR _link_FLAGS _cflags)
+
+MARK_AS_ADVANCED(PKGCONFIG_EXECUTABLE)
diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake
new file mode 100644
index 000000000..027504fc5
--- /dev/null
+++ b/Modules/UseQt4.cmake
@@ -0,0 +1,108 @@
+# - 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.
+#
+# 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.)
+
+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()
+
+INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
+
+SET(QT_LIBRARIES "")
+SET(QT_LIBRARIES_PLUGINS "")
+
+IF (QT_USE_QTMAIN)
+ IF (Q_WS_WIN)
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
+ ENDIF (Q_WS_WIN)
+ENDIF (QT_USE_QTMAIN)
+
+IF(QT_DONT_USE_QTGUI)
+ SET(QT_USE_QTGUI 0)
+ELSE(QT_DONT_USE_QTGUI)
+ SET(QT_USE_QTGUI 1)
+ENDIF(QT_DONT_USE_QTGUI)
+
+IF(QT_DONT_USE_QTCORE)
+ SET(QT_USE_QTCORE 0)
+ELSE(QT_DONT_USE_QTCORE)
+ SET(QT_USE_QTCORE 1)
+ENDIF(QT_DONT_USE_QTCORE)
+
+IF (QT_USE_QT3SUPPORT)
+ ADD_DEFINITIONS(-DQT3_SUPPORT)
+ENDIF (QT_USE_QT3SUPPORT)
+
+# 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_QTUITOOLS_MODULE_DEPENDS QTGUI QTXML QTCORE)
+SET(QT_QTHELP_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE)
+IF(QT_QTDBUS_FOUND)
+ SET(QT_PHONON_MODULE_DEPENDS QTGUI QTDBUS QTCORE)
+ELSE(QT_QTDBUS_FOUND)
+ SET(QT_PHONON_MODULE_DEPENDS QTGUI QTCORE)
+ENDIF(QT_QTDBUS_FOUND)
+SET(QT_QTDBUS_MODULE_DEPENDS QTXML QTCORE)
+SET(QT_QTXMLPATTERNS_MODULE_DEPENDS QTNETWORK QTCORE)
+SET(QT_QAXCONTAINER_MODULE_DEPENDS QTGUI QTCORE)
+SET(QT_QAXSERVER_MODULE_DEPENDS QTGUI QTCORE)
+SET(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE)
+SET(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE)
+SET(QT_QTDECLARATIVE_MODULE_DEPENDS QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTGUI QTCORE)
+SET(QT_QTMULTIMEDIA_MODULE_DEPENDS QTGUI QTCORE)
+SET(QT_QTOPENGL_MODULE_DEPENDS QTGUI QTCORE)
+SET(QT_QTSCRIPT_MODULE_DEPENDS QTCORE)
+SET(QT_QTGUI_MODULE_DEPENDS QTCORE)
+SET(QT_QTTEST_MODULE_DEPENDS QTCORE)
+SET(QT_QTXML_MODULE_DEPENDS QTCORE)
+SET(QT_QTSQL_MODULE_DEPENDS QTCORE)
+SET(QT_QTNETWORK_MODULE_DEPENDS QTCORE)
+
+# Qt modules (in order of dependence)
+FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
+ QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP
+ QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTXMLPATTERNS QTGUI QTTEST
+ QTDBUS QTXML QTSQL QTNETWORK QTCORE)
+
+ IF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
+ IF (QT_${module}_FOUND)
+ IF(QT_USE_${module})
+ STRING(REPLACE "QT" "" qt_module_def "${module}")
+ ADD_DEFINITIONS(-DQT_${qt_module_def}_LIB)
+ INCLUDE_DIRECTORIES(${QT_${module}_INCLUDE_DIR})
+ ENDIF(QT_USE_${module})
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
+ SET(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS})
+ IF(QT_IS_STATIC)
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES})
+ ENDIF(QT_IS_STATIC)
+ FOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})
+ SET(QT_USE_${depend_module}_DEPENDS 1)
+ ENDFOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})
+ ELSE (QT_${module}_FOUND)
+ MESSAGE("Qt ${module} library not found.")
+ ENDIF (QT_${module}_FOUND)
+ ENDIF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
+
+ENDFOREACH(module)
+
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
new file mode 100644
index 000000000..ef7672440
--- /dev/null
+++ b/Modules/UseSWIG.cmake
@@ -0,0 +1,253 @@
+# - 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.
+# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify
+# where to write all the swig generated module (swig -outdir option)
+# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used
+# to specify extra dependencies for the generated modules.
+# If the source file generated by swig need some special flag you can use
+# SET_SOURCE_FILES_PROPERTIES( ${swig_generated_file_fullname}
+# PROPERTIES COMPILE_FLAGS "-bla")
+
+
+#=============================================================================
+# Copyright 2004-2009 Kitware, Inc.
+# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@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.)
+
+SET(SWIG_CXX_EXTENSION "cxx")
+SET(SWIG_EXTRA_LIBRARIES "")
+
+SET(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py")
+
+#
+# For given swig module initialize variables associated with it
+#
+MACRO(SWIG_MODULE_INITIALIZE name language)
+ STRING(TOUPPER "${language}" swig_uppercase_language)
+ STRING(TOLOWER "${language}" swig_lowercase_language)
+ SET(SWIG_MODULE_${name}_LANGUAGE "${swig_uppercase_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")
+ 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).
+ SET(SWIG_MODULE_${name}_REAL_NAME "_${name}")
+ ELSEIF("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL")
+ SET(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow")
+ ENDIF()
+ENDMACRO(SWIG_MODULE_INITIALIZE)
+
+#
+# For a given language, input file, and output file, determine extra files that
+# will be generated. This is internal swig macro.
+#
+
+MACRO(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
+ SET(${outfiles} "")
+ 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)
+ ENDIF(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND")
+ FOREACH(it ${SWIG_${language}_EXTRA_FILE_EXTENSION})
+ SET(${outfiles} ${${outfiles}}
+ "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}")
+ ENDFOREACH(it)
+ENDMACRO(SWIG_GET_EXTRA_OUTPUT_FILES)
+
+#
+# Take swig (*.i) file and add proper custom commands for it
+#
+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)
+ GET_SOURCE_FILE_PROPERTY(swig_source_file_flags ${infile} SWIG_FLAGS)
+ IF("${swig_source_file_flags}" STREQUAL "NOTFOUND")
+ SET(swig_source_file_flags "")
+ ENDIF("${swig_source_file_flags}" STREQUAL "NOTFOUND")
+ 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(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}")
+ 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(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}")
+ 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(swig_source_file_generated)
+ SET(swig_source_file_fullname "${CMAKE_CURRENT_SOURCE_DIR}/${infile}")
+ ENDIF(swig_source_file_generated)
+ ENDIF(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}")
+ ENDIF(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}")
+
+ 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(swig_source_file_relative_path)
+ # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
+ IF(CMAKE_SWIG_OUTDIR)
+ SET(swig_outdir ${CMAKE_SWIG_OUTDIR})
+ ELSE(CMAKE_SWIG_OUTDIR)
+ SET(swig_outdir ${CMAKE_CURRENT_BINARY_DIR})
+ ENDIF(CMAKE_SWIG_OUTDIR)
+ SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
+ swig_extra_generated_files
+ "${swig_outdir}"
+ "${infile}")
+ SET(swig_generated_file_fullname
+ "${swig_generated_file_fullname}/${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
+ "${swig_generated_file_fullname}${SWIG_MODULE_${name}_LANGUAGE}_wrap")
+
+ IF(swig_source_file_cplusplus)
+ SET(swig_generated_file_fullname
+ "${swig_generated_file_fullname}.${SWIG_CXX_EXTENSION}")
+ ELSE(swig_source_file_cplusplus)
+ SET(swig_generated_file_fullname
+ "${swig_generated_file_fullname}.c")
+ ENDIF(swig_source_file_cplusplus)
+
+ #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)
+ SET(swig_include_dirs)
+ FOREACH(it ${cmake_include_directories})
+ SET(swig_include_dirs ${swig_include_dirs} "-I${it}")
+ ENDFOREACH(it)
+
+ SET(swig_special_flags)
+ # default is c, so add c++ flag if it is c++
+ IF(swig_source_file_cplusplus)
+ SET(swig_special_flags ${swig_special_flags} "-c++")
+ ENDIF(swig_source_file_cplusplus)
+ SET(swig_extra_flags)
+ IF(SWIG_MODULE_${name}_EXTRA_FLAGS)
+ SET(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS})
+ ENDIF(SWIG_MODULE_${name}_EXTRA_FLAGS)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${swig_generated_file_fullname}" ${swig_extra_generated_files}
+ # Let's create the ${swig_outdir} at execution time, in case dir contains $(OutDir)
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${swig_outdir}
+ COMMAND "${SWIG_EXECUTABLE}"
+ ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
+ ${swig_source_file_flags}
+ ${CMAKE_SWIG_FLAGS}
+ -outdir ${swig_outdir}
+ ${swig_special_flags}
+ ${swig_extra_flags}
+ ${swig_include_dirs}
+ -o "${swig_generated_file_fullname}"
+ "${swig_source_file_fullname}"
+ MAIN_DEPENDENCY "${swig_source_file_fullname}"
+ DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS}
+ COMMENT "Swig source")
+ SET_SOURCE_FILES_PROPERTIES("${swig_generated_file_fullname}" ${swig_extra_generated_files}
+ PROPERTIES GENERATED 1)
+ SET(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files})
+ENDMACRO(SWIG_ADD_SOURCE_TO_MODULE)
+
+#
+# Create Swig module
+#
+MACRO(SWIG_ADD_MODULE name language)
+ SWIG_MODULE_INITIALIZE(${name} ${language})
+ SET(swig_dot_i_sources)
+ SET(swig_other_sources)
+ FOREACH(it ${ARGN})
+ IF(${it} MATCHES ".*\\.i$")
+ SET(swig_dot_i_sources ${swig_dot_i_sources} "${it}")
+ ELSE(${it} MATCHES ".*\\.i$")
+ SET(swig_other_sources ${swig_other_sources} "${it}")
+ ENDIF(${it} MATCHES ".*\\.i$")
+ ENDFOREACH(it)
+
+ SET(swig_generated_sources)
+ FOREACH(it ${swig_dot_i_sources})
+ SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source ${it})
+ SET(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}")
+ ENDFOREACH(it)
+ GET_DIRECTORY_PROPERTY(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
+ SET_DIRECTORY_PROPERTIES(PROPERTIES
+ ADDITIONAL_MAKE_CLEAN_FILES "${swig_extra_clean_files};${swig_generated_sources}")
+ ADD_LIBRARY(${SWIG_MODULE_${name}_REAL_NAME}
+ MODULE
+ ${swig_generated_sources}
+ ${swig_other_sources})
+ STRING(TOLOWER "${language}" swig_lowercase_language)
+ IF ("${swig_lowercase_language}" STREQUAL "java")
+ IF (APPLE)
+ # In java you want:
+ # System.loadLibrary("LIBRARY");
+ # then JNI will look for a library whose name is platform dependent, namely
+ # MacOS : libLIBRARY.jnilib
+ # Windows: LIBRARY.dll
+ # Linux : libLIBRARY.so
+ SET_TARGET_PROPERTIES (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib")
+ ENDIF (APPLE)
+ ENDIF ("${swig_lowercase_language}" STREQUAL "java")
+ IF ("${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"
+ # instead of ".dll" as of Python 2.5. Older python versions do support
+ # this suffix.
+ # http://docs.python.org/whatsnew/ports.html#SECTION0001510000000000000000
+ # <quote>
+ # Windows: .dll is no longer supported as a filename extension for extension modules.
+ # .pyd is now the only filename extension that will be searched for.
+ # </quote>
+ IF(WIN32 AND NOT CYGWIN)
+ SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd")
+ ENDIF(WIN32 AND NOT CYGWIN)
+ ENDIF ("${swig_lowercase_language}" STREQUAL "python")
+ENDMACRO(SWIG_ADD_MODULE)
+
+#
+# Like TARGET_LINK_LIBRARIES but for swig modules
+#
+MACRO(SWIG_LINK_LIBRARIES name)
+ IF(SWIG_MODULE_${name}_REAL_NAME)
+ TARGET_LINK_LIBRARIES(${SWIG_MODULE_${name}_REAL_NAME} ${ARGN})
+ ELSE(SWIG_MODULE_${name}_REAL_NAME)
+ MESSAGE(SEND_ERROR "Cannot find Swig library \"${name}\".")
+ ENDIF(SWIG_MODULE_${name}_REAL_NAME)
+ENDMACRO(SWIG_LINK_LIBRARIES name)
+
diff --git a/Modules/UseVTK40.cmake b/Modules/UseVTK40.cmake
new file mode 100644
index 000000000..c1157d6be
--- /dev/null
+++ b/Modules/UseVTK40.cmake
@@ -0,0 +1,29 @@
+#
+
+#=============================================================================
+# 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
new file mode 100644
index 000000000..4df59b9dd
--- /dev/null
+++ b/Modules/UseVTKBuildSettings40.cmake
@@ -0,0 +1,38 @@
+#
+
+#=============================================================================
+# 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
new file mode 100644
index 000000000..ca5e7aa3c
--- /dev/null
+++ b/Modules/UseVTKConfig40.cmake
@@ -0,0 +1,409 @@
+#
+
+#=============================================================================
+# 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(VTK_USE_RENDERING)
+IF(VTK_USE_HYBRID)
+ SET(VTK_KITS ${VTK_KITS} HYBRID)
+ENDIF(VTK_USE_HYBRID)
+IF(VTK_USE_PARALLEL)
+ SET(VTK_KITS ${VTK_KITS} PARALLEL)
+ENDIF(VTK_USE_PARALLEL)
+IF(VTK_USE_PATENTED)
+ SET(VTK_KITS ${VTK_KITS} PATENTED)
+ENDIF(VTK_USE_PATENTED)
+
+# Create the list of available languages.
+SET(VTK_LANGUAGES "")
+IF(VTK_WRAP_TCL)
+ SET(VTK_LANGUAGES ${VTK_LANGUAGES} TCL)
+ENDIF(VTK_WRAP_TCL)
+IF(VTK_WRAP_PYTHON)
+ SET(VTK_LANGUAGES ${VTK_LANGUAGES} PYTHON)
+ENDIF(VTK_WRAP_PYTHON)
+IF(VTK_WRAP_JAVA)
+ SET(VTK_LANGUAGES ${VTK_LANGUAGES} JAVA)
+ENDIF(VTK_WRAP_JAVA)
+
+# 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(VTK_USE_X)
+ENDIF(VTK_USE_RENDERING)
+
+IF(VTK_OPENGL_HAS_OSMESA)
+ SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
+ ${VTK40_OSMESA_INCLUDE_PATH})
+ENDIF(VTK_OPENGL_HAS_OSMESA)
+
+IF(VTK_USE_MPI)
+ SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_MPI_INCLUDE_PATH})
+ENDIF(VTK_USE_MPI)
+
+IF(VTK_WRAP_TCL)
+ SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_TCL_INCLUDE_PATH})
+ENDIF(VTK_WRAP_TCL)
+
+IF(VTK_WRAP_PYTHON)
+ SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_PYTHON_INCLUDE_PATH})
+ENDIF(VTK_WRAP_PYTHON)
+
+IF(VTK_WRAP_JAVA)
+ SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
+ ${VTK40_JAVA_INCLUDE_PATH} ${VTK40_JAVA_INCLUDE_PATH2})
+ENDIF(VTK_WRAP_JAVA)
+
+IF(VTK_HAVE_VG500)
+ SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
+ ${VTK40_VLI_INCLUDE_PATH_FOR_VG500})
+ENDIF(VTK_HAVE_VG500)
+
+IF(VTK_HAVE_VP1000)
+ SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
+ ${VTK40_VLI_INCLUDE_PATH_FOR_VP1000})
+ENDIF(VTK_HAVE_VP1000)
+
+# 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(VTK_USE_PARALLEL)
+ IF(VTK_USE_HYBRID)
+ SET(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Hybrid)
+ ENDIF(VTK_USE_HYBRID)
+ IF(VTK_USE_PATENTED)
+ SET(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Patented)
+ ENDIF(VTK_USE_PATENTED)
+ IF(VTK_USE_RENDERING)
+ SET(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Rendering)
+ ENDIF(VTK_USE_RENDERING)
+
+ # 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(VTK_WRAP_TCL)
+ IF(VTK_WRAP_PYTHON)
+ SET(VTK_WRAP_PYTHON_EXE ${VTK40_VTK_WRAP_PYTHON_EXE})
+ ENDIF(VTK_WRAP_PYTHON)
+ 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(VTK_WRAP_JAVA)
+
+ELSE(EXISTS ${VTK_DIR}/Common)
+ # 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(VTK_WRAP_TCL)
+ IF(VTK_WRAP_PYTHON)
+ SET(VTK_WRAP_PYTHON_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapPython)
+ ENDIF(VTK_WRAP_PYTHON)
+ 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(VTK_WRAP_JAVA)
+ENDIF(EXISTS ${VTK_DIR}/Common)
+
+# 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(WIN32)
+ELSE(CMAKE_COMPILER_IS_GNUCXX)
+ IF(CMAKE_ANSI_CFLAGS)
+ SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
+ ENDIF(CMAKE_ANSI_CFLAGS)
+ IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
+ SET(VTK_REQUIRED_CXX_FLAGS
+ "${VTK_REQUIRED_CXX_FLAGS} -timplicit_local -no_implicit_include")
+ ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+
+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(CMAKE_X_CFLAGS)
+ENDIF(VTK_USE_X)
+
+# 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
new file mode 100644
index 000000000..01a15168e
--- /dev/null
+++ b/Modules/Use_wxWindows.cmake
@@ -0,0 +1,64 @@
+#
+# This convenience include finds if wxWindows is installed
+# and set the appropriate libs, incdirs, flags etc.
+# author Jan Woetzel <jw -at- mip.informatik.uni-kiel.de> (07/2003)
+##
+# -----------------------------------------------------
+# USAGE:
+# just include Use_wxWindows.cmake
+# in your projects CMakeLists.txt
+# INCLUDE( ${CMAKE_MODULE_PATH}/Use_wxWindows.cmake)
+##
+# if you are sure you need GL then
+# SET(WXWINDOWS_USE_GL 1)
+# *before* you include this file.
+
+#=============================================================================
+# Copyright 2003-2009 Kitware, Inc.
+# Copyright 2003 Jan Woetzel
+#
+# 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.)
+
+# -----------------------------------------------------
+# 16.Feb.2004: changed INCLUDE to FIND_PACKAGE to read from users own non-system CMAKE_MODULE_PATH (Jan Woetzel JW)
+# 07/2006: rewrite as FindwxWidgets.cmake, kept for backward compatibility JW
+
+MESSAGE(STATUS "Use_wxWindows.cmake is DEPRECATED. \n"
+"Please use FIND_PACKAGE(wxWidgets) and INCLUDE(${wxWidgets_USE_FILE}) instead. (JW)")
+
+
+# ------------------------
+
+FIND_PACKAGE( wxWindows )
+
+IF(WXWINDOWS_FOUND)
+
+#MESSAGE("DBG Use_wxWindows.cmake: WXWINDOWS_INCLUDE_DIR=${WXWINDOWS_INCLUDE_DIR} WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES} WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES} CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS} WXWINDOWS_DEFINITIONS=${WXWINDOWS_DEFINITIONS}")
+
+ IF(WXWINDOWS_INCLUDE_DIR)
+ INCLUDE_DIRECTORIES(${WXWINDOWS_INCLUDE_DIR})
+ ENDIF(WXWINDOWS_INCLUDE_DIR)
+ IF(WXWINDOWS_LINK_DIRECTORIES)
+ LINK_DIRECTORIES(${WXWINDOWS_LINK_DIRECTORIES})
+ ENDIF(WXWINDOWS_LINK_DIRECTORIES)
+ IF(WXWINDOWS_LIBRARIES)
+ LINK_LIBRARIES(${WXWINDOWS_LIBRARIES})
+ ENDIF(WXWINDOWS_LIBRARIES)
+ IF (CMAKE_WXWINDOWS_CXX_FLAGS)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_WXWINDOWS_CXX_FLAGS}")
+ ENDIF(CMAKE_WXWINDOWS_CXX_FLAGS)
+ IF(WXWINDOWS_DEFINITIONS)
+ ADD_DEFINITIONS(${WXWINDOWS_DEFINITIONS})
+ ENDIF(WXWINDOWS_DEFINITIONS)
+ELSE(WXWINDOWS_FOUND)
+ MESSAGE(SEND_ERROR "wxWindows not found by Use_wxWindows.cmake")
+ENDIF(WXWINDOWS_FOUND)
+
diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake
new file mode 100644
index 000000000..a0f2e8632
--- /dev/null
+++ b/Modules/UsewxWidgets.cmake
@@ -0,0 +1,89 @@
+# - Convenience include for using wxWidgets library.
+# Determines if wxWidgets was FOUND and sets the appropriate libs, incdirs,
+# flags, etc. INCLUDE_DIRECTORIES and LINK_DIRECTORIES are called.
+#
+# USAGE
+# # Note that for MinGW users the order of libs is important!
+# FIND_PACKAGE(wxWidgets REQUIRED net gl core base)
+# INCLUDE(${wxWidgets_USE_FILE})
+# # and for each of your dependent executable/library targets:
+# TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES})
+#
+# DEPRECATED
+# LINK_LIBRARIES is not called in favor of adding dependencies per target.
+#
+# AUTHOR
+# Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
+
+#=============================================================================
+# Copyright 2004-2009 Kitware, Inc.
+# Copyright 2006 Jan Woetzel
+#
+# 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.)
+
+# debug message and logging.
+# comment these out for distribution
+IF (NOT LOGFILE )
+ # SET(LOGFILE "${PROJECT_BINARY_DIR}/CMakeOutput.log")
+ENDIF (NOT LOGFILE )
+MACRO(MSG _MSG)
+ # FILE(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}\n")
+ # MESSAGE(STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
+ENDMACRO(MSG)
+
+
+MSG("wxWidgets_FOUND=${wxWidgets_FOUND}")
+IF (wxWidgets_FOUND)
+ IF (wxWidgets_INCLUDE_DIRS)
+ IF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
+ INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS})
+ ELSE(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
+ INCLUDE_DIRECTORIES(SYSTEM ${wxWidgets_INCLUDE_DIRS})
+ ENDIF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
+ MSG("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}")
+ ENDIF(wxWidgets_INCLUDE_DIRS)
+
+ IF (wxWidgets_LIBRARY_DIRS)
+ LINK_DIRECTORIES(${wxWidgets_LIBRARY_DIRS})
+ MSG("wxWidgets_LIBRARY_DIRS=${wxWidgets_LIBRARY_DIRS}")
+ ENDIF(wxWidgets_LIBRARY_DIRS)
+
+ IF (wxWidgets_DEFINITIONS)
+ SET_PROPERTY(DIRECTORY APPEND
+ PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS})
+ MSG("wxWidgets_DEFINITIONS=${wxWidgets_DEFINITIONS}")
+ ENDIF(wxWidgets_DEFINITIONS)
+
+ IF (wxWidgets_DEFINITIONS_DEBUG)
+ SET_PROPERTY(DIRECTORY APPEND
+ PROPERTY COMPILE_DEFINITIONS_DEBUG ${wxWidgets_DEFINITIONS_DEBUG})
+ MSG("wxWidgets_DEFINITIONS_DEBUG=${wxWidgets_DEFINITIONS_DEBUG}")
+ ENDIF(wxWidgets_DEFINITIONS_DEBUG)
+
+ IF (wxWidgets_CXX_FLAGS)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
+ MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
+ ENDIF(wxWidgets_CXX_FLAGS)
+
+ # DEPRECATED JW
+ # just for backward compatibility: add deps to all targets
+ # library projects better use advanced FIND_PACKAGE(wxWidgets) directly.
+ #IF(wxWidgets_LIBRARIES)
+ # LINK_LIBRARIES(${wxWidgets_LIBRARIES})
+ # # BUG: str too long: MSG("wxWidgets_LIBRARIES=${wxWidgets_LIBRARIES}")
+ # IF(LOGFILE)
+ # FILE(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${wxWidgets_LIBRARIES}\n")
+ # ENDIF(LOGFILE)
+ #ENDIF(wxWidgets_LIBRARIES)
+
+ELSE (wxWidgets_FOUND)
+ MESSAGE("wxWidgets requested but not found.")
+ENDIF(wxWidgets_FOUND)
diff --git a/Modules/VTKCompatibility.cmake b/Modules/VTKCompatibility.cmake
new file mode 100644
index 000000000..802969f2f
--- /dev/null
+++ b/Modules/VTKCompatibility.cmake
@@ -0,0 +1,52 @@
+
+#=============================================================================
+# 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.)
+
+IF(APPLE)
+ SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}")
+ SET(CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_C_CREATE_SHARED_MODULE}")
+ STRING( REGEX REPLACE "CMAKE_C_COMPILER"
+ CMAKE_CXX_COMPILER CMAKE_CXX_CREATE_SHARED_MODULE
+ "${CMAKE_CXX_CREATE_SHARED_MODULE}")
+ STRING( REGEX REPLACE "CMAKE_C_COMPILER"
+ CMAKE_CXX_COMPILER CMAKE_CXX_CREATE_SHARED_LIBRARY
+ "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
+ENDIF(APPLE)
+
+SET(VTKFTGL_BINARY_DIR "${VTK_BINARY_DIR}/Utilities/ftgl"
+ CACHE INTERNAL "")
+SET(VTKFREETYPE_BINARY_DIR "${VTK_BINARY_DIR}/Utilities/freetype"
+ CACHE INTERNAL "")
+SET(VTKFTGL_SOURCE_DIR "${VTK_SOURCE_DIR}/Utilities/ftgl"
+ CACHE INTERNAL "")
+SET(VTKFREETYPE_SOURCE_DIR "${VTK_SOURCE_DIR}/Utilities/freetype"
+ CACHE INTERNAL "")
+
+SET(VTK_GLEXT_FILE "${VTK_SOURCE_DIR}/Utilities/ParseOGLExt/headers/glext.h"
+ CACHE FILEPATH
+ "Location of the OpenGL extensions header file (glext.h).")
+SET(VTK_GLXEXT_FILE
+ "${VTK_SOURCE_DIR}/Utilities/ParseOGLExt/headers/glxext.h" CACHE FILEPATH
+ "Location of the GLX extensions header file (glxext.h).")
+SET(VTK_WGLEXT_FILE "${VTK_SOURCE_DIR}/Utilities/ParseOGLExt/headers/wglext.h"
+ CACHE FILEPATH
+ "Location of the WGL extensions header file (wglext.h).")
+
+# work around an old bug in VTK
+SET(TIFF_RIGHT_VERSION 1)
+
+# for very old VTK (versions prior to 4.2)
+MACRO(SOURCE_FILES)
+ message (FATAL_ERROR "You are trying to build a very old version of VTK (prior to VTK 4.2). To do this you need to use CMake 2.0 as it was the last version of CMake to support VTK 4.0.")
+ENDMACRO(SOURCE_FILES)
+
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
new file mode 100644
index 000000000..038cb5798
--- /dev/null
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -0,0 +1,44 @@
+# WRITE_BASIC_CONFIG_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
+#
+# Deprecated, see WRITE_BASIC_PACKAGE_VERSION_FILE(), it is identical.
+
+#=============================================================================
+# Copyright 2008-2011 Alexander Neundorf, <neundorf@kde.org>
+# 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.)
+
+include(CMakeParseArguments)
+
+function(WRITE_BASIC_CONFIG_VERSION_FILE _filename)
+
+ set(options )
+ set(oneValueArgs VERSION COMPATIBILITY )
+ set(multiValueArgs )
+
+ cmake_parse_arguments(CVF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if(CVF_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown keywords given to WRITE_BASIC_CONFIG_VERSION_FILE(): \"${CVF_UNPARSED_ARGUMENTS}\"")
+ endif(CVF_UNPARSED_ARGUMENTS)
+
+ set(versionTemplateFile "${CMAKE_ROOT}/Modules/BasicConfigVersion-${CVF_COMPATIBILITY}.cmake.in")
+ if(NOT EXISTS "${versionTemplateFile}")
+ message(FATAL_ERROR "Bad COMPATIBILITY value used for WRITE_BASIC_CONFIG_VERSION_FILE(): \"${CVF_COMPATIBILITY}\"")
+ endif()
+
+ if("${CVF_VERSION}" STREQUAL "")
+ message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
+ endif()
+
+ configure_file("${versionTemplateFile}" "${_filename}" @ONLY)
+
+endfunction(WRITE_BASIC_CONFIG_VERSION_FILE)
diff --git a/Modules/ecos_clean.cmake b/Modules/ecos_clean.cmake
new file mode 100644
index 000000000..7a563ae23
--- /dev/null
+++ b/Modules/ecos_clean.cmake
@@ -0,0 +1,26 @@
+
+#=============================================================================
+# 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.)
+
+file(GLOB _files ${ECOS_DIR}/*)
+
+# remove all directories, which consist of lower-case letters only
+# this skips e.g. CVS/ and .subversion/
+foreach(_entry ${_files})
+ if(IS_DIRECTORY ${_entry})
+ get_filename_component(dir ${_entry} NAME)
+ if(${dir} MATCHES "^[a-z]+$")
+ file(REMOVE_RECURSE ${_entry})
+ endif(${dir} MATCHES "^[a-z]+$")
+ endif(IS_DIRECTORY ${_entry})
+endforeach(_entry)
diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in
new file mode 100644
index 000000000..80a879d7e
--- /dev/null
+++ b/Modules/exportheader.cmake.in
@@ -0,0 +1,35 @@
+
+#ifndef @INCLUDE_GUARD_NAME@
+#define @INCLUDE_GUARD_NAME@
+
+#ifdef @STATIC_DEFINE@
+# define @EXPORT_MACRO_NAME@
+# define @NO_EXPORT_MACRO_NAME@
+#else
+# ifndef @EXPORT_MACRO_NAME@
+# ifdef @EXPORT_IMPORT_CONDITION@
+ /* We are building this library */
+# define @EXPORT_MACRO_NAME@ @DEFINE_EXPORT@
+# else
+ /* We are using this library */
+# define @EXPORT_MACRO_NAME@ @DEFINE_IMPORT@
+# endif
+# endif
+
+# ifndef @NO_EXPORT_MACRO_NAME@
+# define @NO_EXPORT_MACRO_NAME@ @DEFINE_NO_EXPORT@
+# endif
+#endif
+
+#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
+
+#cmakedefine01 DEFINE_NO_DEPRECATED
+#if DEFINE_NO_DEPRECATED
+# define @NO_DEPRECATED_MACRO_NAME@
+#endif
+
+#endif
diff --git a/Modules/kde3init_dummy.cpp.in b/Modules/kde3init_dummy.cpp.in
new file mode 100644
index 000000000..7135c73a1
--- /dev/null
+++ b/Modules/kde3init_dummy.cpp.in
@@ -0,0 +1,6 @@
+
+/* used by KDE3Macros.cmake */
+
+extern "C" int kdemain(int argc, char* argv[]);
+extern "C" int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }
+int main(int argc, char* argv[]) { return kdemain(argc,argv); }
diff --git a/Modules/kde3uic.cmake b/Modules/kde3uic.cmake
new file mode 100644
index 000000000..6f904ac92
--- /dev/null
+++ b/Modules/kde3uic.cmake
@@ -0,0 +1,33 @@
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@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.)
+
+# used internally by KDE3Macros.cmake
+# neundorf@kde.org
+
+
+EXECUTE_PROCESS(COMMAND ${KDE_UIC_EXECUTABLE}
+ -L ${KDE_UIC_PLUGIN_DIR} -nounload -tr tr2i18n
+ -impl ${KDE_UIC_H_FILE}
+ ${KDE_UIC_FILE}
+ OUTPUT_VARIABLE _uic_CONTENTS
+ ERROR_QUIET
+ )
+
+STRING(REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" )
+STRING(REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" )
+
+FILE(WRITE ${KDE_UIC_CPP_FILE} "#include <kdialog.h>\n#include <klocale.h>\n\n")
+FILE(APPEND ${KDE_UIC_CPP_FILE} "${_uic_CONTENTS}")
+
diff --git a/Modules/readme.txt b/Modules/readme.txt
new file mode 100644
index 000000000..7d61d8d27
--- /dev/null
+++ b/Modules/readme.txt
@@ -0,0 +1,151 @@
+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 relevent 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_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:
+
+# - 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.
+
+A package can be 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).