From 2f5181c10196a2b5cd3bef141010976cfe122fa9 Mon Sep 17 00:00:00 2001 From: Modestas Vainius Date: Sat, 7 Feb 2009 16:14:30 +0200 Subject: [PATCH] Import cmake 2.6.3~rc11 Signed-off-by: Modestas Vainius --- CMakeLists.txt | 4 +- CTestConfig.cmake | 5 + CTestCustom.cmake.in | 1 + ChangeLog.manual | 138 +++ Modules/CMakeASM-ATTInformation.cmake | 2 + Modules/CMakeASMInformation.cmake | 2 +- Modules/CMakeASM_MASMInformation.cmake | 10 + Modules/CMakeCInformation.cmake | 16 +- Modules/CMakeCXXInformation.cmake | 2 +- Modules/CMakeDetermineASM-ATTCompiler.cmake | 2 +- Modules/CMakeDetermineASMCompiler.cmake | 2 +- Modules/CMakeDetermineASM_MASMCompiler.cmake | 13 + Modules/CMakeDetermineFortranCompiler.cmake | 28 +- Modules/CMakeFortranCompilerId.F90.in | 4 + Modules/CMakeFortranInformation.cmake | 1 + Modules/CMakeGenericSystem.cmake | 6 +- Modules/CMakePlatformId.h.in | 6 + Modules/CMakeRCInformation.cmake | 5 +- Modules/CMakeSystemSpecificInformation.cmake | 2 +- Modules/CMakeTestASM-ATTCompiler.cmake | 1 + Modules/CMakeTestASM_MASMCompiler.cmake | 10 + Modules/CPack.OSXX11.Info.plist.in | 13 + Modules/CPack.RuntimeScript.in | 21 + Modules/CPack.cmake | 8 +- Modules/CPackRPM.cmake | 22 +- Modules/CTest.cmake | 4 +- Modules/CheckForPthreads.c | 2 +- Modules/FindBoost.cmake | 507 +++++--- Modules/FindCoin3D.cmake | 72 ++ Modules/FindCurses.cmake | 22 +- Modules/FindCxxTest.cmake | 113 ++ Modules/FindDevIL.cmake | 50 + Modules/FindDoxygen.cmake | 174 +-- Modules/FindEXPAT.cmake | 2 +- Modules/FindFLTK.cmake | 124 +- Modules/FindGDAL.cmake | 100 +- Modules/FindGLUT.cmake | 1 + Modules/FindGettext.cmake | 4 +- Modules/FindKDE3.cmake | 6 +- Modules/FindKDE4.cmake | 2 +- Modules/FindLibXml2.cmake | 16 +- Modules/FindLua50.cmake | 2 +- Modules/FindLua51.cmake | 2 +- Modules/FindMFC.cmake | 52 +- Modules/FindMPEG2.cmake | 2 +- Modules/FindOpenMP.cmake | 108 ++ Modules/FindOpenSceneGraph.cmake | 213 ++++ Modules/FindOpenThreads.cmake | 143 +-- Modules/FindPerlLibs.cmake | 3 +- Modules/FindProducer.cmake | 9 +- Modules/FindPythonInterp.cmake | 1 + Modules/FindQt4.cmake | 505 +++----- Modules/FindRTI.cmake | 88 ++ Modules/FindSquish.cmake | 119 ++ Modules/FindTclStub.cmake | 12 + Modules/Findosg.cmake | 59 +- Modules/FindosgAnimation.cmake | 38 + Modules/FindosgDB.cmake | 58 +- Modules/FindosgFX.cmake | 58 +- Modules/FindosgGA.cmake | 58 +- Modules/FindosgIntrospection.cmake | 60 +- Modules/FindosgManipulator.cmake | 58 +- Modules/FindosgParticle.cmake | 58 +- Modules/FindosgProducer.cmake | 58 +- Modules/FindosgShadow.cmake | 58 +- Modules/FindosgSim.cmake | 58 +- Modules/FindosgTerrain.cmake | 58 +- Modules/FindosgText.cmake | 58 +- Modules/FindosgUtil.cmake | 58 +- Modules/FindosgViewer.cmake | 58 +- Modules/FindosgVolume.cmake | 38 + Modules/FindosgWidget.cmake | 38 + Modules/Findosg_functions.cmake | 91 ++ Modules/FindwxWidgets.cmake | 25 +- Modules/FortranCInterface.cmake | 231 ++++ Modules/FortranCInterface.h.in | 9 + Modules/GetPrerequisites.cmake | 22 +- Modules/InstallRequiredSystemLibraries.cmake | 24 +- Modules/Platform/Darwin.cmake | 6 +- Modules/Platform/Haiku.cmake | 21 + Modules/Platform/Linux.cmake | 2 + Modules/Platform/OpenBSD.cmake | 1 + Modules/Platform/SunOS-SunPro-Fortran.cmake | 7 +- Modules/Platform/Windows-g77.cmake | 7 + Modules/Platform/Windows-gcc.cmake | 8 + Modules/Platform/WindowsPaths.cmake | 57 +- Modules/SquishRunTestCase.bat | 11 + Modules/SquishRunTestCase.sh | 13 + Modules/SquishTestScript.cmake | 59 + Modules/UseQt4.cmake | 9 +- Source/CMakeLists.txt | 14 +- Source/CPack/cmCPackBundleGenerator.cxx | 149 +-- Source/CPack/cmCPackBundleGenerator.h | 14 +- Source/CPack/cmCPackDragNDropGenerator.cxx | 253 ++++ Source/CPack/cmCPackDragNDropGenerator.h | 47 + Source/CPack/cmCPackGenerator.cxx | 67 +- Source/CPack/cmCPackGenerator.h | 13 +- Source/CPack/cmCPackGeneratorFactory.cxx | 7 +- Source/CPack/cmCPackLog.cxx | 10 +- Source/CPack/cmCPackNSISGenerator.cxx | 82 +- Source/CPack/cmCPackNSISGenerator.h | 8 +- Source/CPack/cmCPackOSXX11Generator.cxx | 13 +- Source/CPack/cmCPackPackageMakerGenerator.cxx | 35 +- Source/CPack/cpack.cxx | 9 +- Source/CTest/cmCTestBuildAndTestHandler.cxx | 10 +- Source/CTest/cmCTestBuildHandler.cxx | 7 +- Source/CTest/cmCTestScriptHandler.cxx | 29 +- Source/CTest/cmCTestTestCommand.cxx | 14 +- Source/CTest/cmCTestTestCommand.h | 19 +- Source/CTest/cmCTestUpdateHandler.cxx | 62 +- Source/CursesDialog/cmCursesMainForm.cxx | 13 +- Source/QtDialog/CMake.desktop | 2 +- Source/QtDialog/CMakeLists.txt | 15 +- Source/QtDialog/CMakeSetupDialog.cxx | 81 +- Source/QtDialog/Compilers.h | 21 + Source/QtDialog/Compilers.ui | 87 ++ Source/QtDialog/CrossCompiler.ui | 213 ++++ Source/QtDialog/FirstConfigure.cxx | 509 ++++++++ Source/QtDialog/FirstConfigure.h | 177 +++ Source/QtDialog/QCMakeWidgets.cxx | 33 +- Source/cmAddCustomTargetCommand.cxx | 23 +- Source/cmAddCustomTargetCommand.h | 15 +- Source/cmBootstrapCommands.cxx | 6 +- Source/cmCMakeMinimumRequired.cxx | 30 +- Source/cmCMakeMinimumRequired.h | 15 +- Source/cmCMakePolicyCommand.cxx | 18 +- Source/cmCMakePolicyCommand.h | 30 +- Source/cmCTest.cxx | 17 +- Source/cmCallVisualStudioMacro.cxx | 29 +- Source/cmCommand.h | 11 +- Source/cmCommandArgumentLexer.cxx | 249 ++-- Source/cmCommandArgumentLexer.h | 62 +- Source/cmCommandArgumentLexer.in.l | 13 +- Source/cmCommandArgumentParser.cxx | 1069 ++++++++++------- Source/cmCommandArgumentParser.y | 31 +- Source/cmCommandArgumentParserHelper.cxx | 44 +- Source/cmCommandArgumentParserHelper.h | 5 +- Source/cmCommandArgumentParserTokens.h | 79 +- Source/cmComputeLinkDepends.cxx | 23 +- Source/cmComputeLinkDepends.h | 5 +- Source/cmComputeLinkInformation.cxx | 8 +- Source/cmComputeLinkInformation.h | 13 +- Source/cmCoreTryCompile.cxx | 10 +- Source/cmDependsJavaLexer.cxx | 6 +- Source/cmDependsJavaLexer.h | 6 +- Source/cmDocumentVariables.cxx | 44 +- Source/cmDocumentation.cxx | 129 +- Source/cmDocumentation.h | 12 +- Source/cmDocumentationFormatter.cxx | 7 +- Source/cmDocumentationFormatter.h | 8 +- Source/cmDocumentationFormatterDocbook.cxx | 34 +- Source/cmDocumentationFormatterDocbook.h | 7 +- Source/cmDocumentationFormatterHTML.cxx | 11 +- Source/cmDocumentationFormatterHTML.h | 7 +- Source/cmDocumentationFormatterMan.cxx | 30 +- Source/cmDocumentationFormatterMan.h | 10 +- Source/cmEnableLanguageCommand.cxx | 6 +- Source/cmExportBuildFileGenerator.cxx | 12 +- Source/cmExportFileGenerator.cxx | 10 +- Source/cmExportInstallFileGenerator.cxx | 15 +- Source/cmExportInstallFileGenerator.h | 8 +- Source/cmExtraCodeBlocksGenerator.cxx | 11 +- Source/cmExtraEclipseCDT4Generator.cxx | 229 ++-- Source/cmExtraEclipseCDT4Generator.h | 14 +- Source/cmFileCommand.cxx | 171 ++- Source/cmFileCommand.h | 7 +- Source/cmFindBase.cxx | 18 +- Source/cmFindCommon.cxx | 5 +- Source/cmFindLibraryCommand.cxx | 292 ++++- Source/cmFindPackageCommand.cxx | 305 +++-- Source/cmFindPackageCommand.h | 14 +- Source/cmForEachCommand.cxx | 29 +- Source/cmForEachCommand.h | 8 +- Source/cmFunctionBlocker.h | 20 +- Source/cmFunctionCommand.cxx | 32 +- Source/cmFunctionCommand.h | 11 +- Source/cmGetTargetPropertyCommand.h | 20 +- Source/cmGlobalGenerator.cxx | 41 +- Source/cmGlobalGenerator.h | 17 +- Source/cmGlobalMSYSMakefileGenerator.cxx | 9 +- Source/cmGlobalNMakeMakefileGenerator.cxx | 17 +- Source/cmGlobalVisualStudio6Generator.cxx | 28 +- Source/cmGlobalVisualStudio71Generator.cxx | 13 +- Source/cmGlobalVisualStudio7Generator.cxx | 71 +- Source/cmGlobalVisualStudio7Generator.h | 21 +- Source/cmGlobalXCodeGenerator.cxx | 195 ++- Source/cmGlobalXCodeGenerator.h | 6 +- Source/cmIfCommand.cxx | 609 +++++----- Source/cmIfCommand.h | 10 +- Source/cmIncludeCommand.cxx | 12 +- Source/cmIncludeCommand.h | 14 +- Source/cmIncludeExternalMSProjectCommand.h | 9 +- Source/cmInstallCommand.cxx | 31 +- Source/cmInstallExportGenerator.cxx | 28 +- Source/cmInstallExportGenerator.h | 5 +- Source/cmInstallFilesCommand.cxx | 8 +- Source/cmInstallGenerator.cxx | 8 +- Source/cmInstallProgramsCommand.cxx | 8 +- Source/cmInstallTargetGenerator.cxx | 97 +- Source/cmInstallTargetGenerator.h | 13 +- Source/cmLinkDirectoriesCommand.h | 11 +- Source/cmListFileCache.cxx | 23 +- Source/cmListFileCache.h | 5 +- Source/cmLocalGenerator.cxx | 164 ++- Source/cmLocalGenerator.h | 32 +- Source/cmLocalUnixMakefileGenerator3.cxx | 79 +- Source/cmLocalUnixMakefileGenerator3.h | 18 +- Source/cmLocalVisualStudio6Generator.cxx | 148 ++- Source/cmLocalVisualStudio7Generator.cxx | 57 +- Source/cmMacroCommand.cxx | 60 +- Source/cmMacroCommand.h | 11 +- Source/cmMakefile.cxx | 523 ++++++-- Source/cmMakefile.h | 135 ++- .../cmMakefileExecutableTargetGenerator.cxx | 39 +- Source/cmMakefileLibraryTargetGenerator.cxx | 45 +- Source/cmMakefileTargetGenerator.cxx | 98 +- Source/cmMakefileTargetGenerator.h | 9 +- Source/cmOrderDirectories.cxx | 29 +- Source/cmOutputRequiredFilesCommand.cxx | 11 +- Source/cmPolicies.cxx | 32 + Source/cmPolicies.h | 9 +- Source/cmSetCommand.cxx | 6 +- Source/cmSetTargetPropertiesCommand.h | 7 +- Source/cmSourceFile.cxx | 24 +- Source/cmSystemTools.cxx | 9 +- Source/cmTarget.cxx | 137 ++- Source/cmTarget.h | 7 +- Source/cmTargetLinkLibrariesCommand.cxx | 45 +- Source/cmTargetLinkLibrariesCommand.h | 16 +- Source/cmUnsetCommand.cxx | 64 + Source/cmUnsetCommand.h | 84 ++ Source/cmWhileCommand.cxx | 35 +- Source/cmWhileCommand.h | 8 +- Source/cmake.cxx | 64 +- Source/cmake.h | 9 +- Source/cmakemain.cxx | 16 +- Source/kwsys/CTestConfig.cmake | 10 +- Source/kwsys/DynamicLoader.cxx | 5 +- Source/kwsys/ProcessUNIX.c | 9 +- Source/kwsys/System.c | 6 + Source/kwsys/SystemInformation.cxx | 55 +- Source/kwsys/SystemTools.cxx | 70 +- Source/kwsys/SystemTools.hxx.in | 27 +- Source/kwsys/testDynamicLoader.cxx | 8 +- Source/kwsys/testProcess.c | 6 +- Templates/DLLHeader.dsptemplate | 8 + Templates/EXEHeader.dsptemplate | 8 + Templates/EXEWinHeader.dsptemplate | 8 + Templates/TestDriver.cxx.in | 22 +- Templates/staticLibHeader.dsptemplate | 8 + Tests/CMakeLists.txt | 56 + Tests/CTestUpdateCVS.cmake.in | 114 ++ Tests/CTestUpdateCommon.cmake | 159 +++ Tests/CTestUpdateSVN.cmake.in | 116 ++ Tests/Complex/CMakeLists.txt | 6 + Tests/Complex/Executable/complex.cxx | 6 + Tests/Complex/cmTestConfigure.h.in | 4 + Tests/ComplexOneConfig/CMakeLists.txt | 6 + Tests/ComplexOneConfig/Executable/complex.cxx | 6 + Tests/ComplexOneConfig/cmTestConfigure.h.in | 4 + Tests/ComplexRelativePaths/CMakeLists.txt | 6 + .../Executable/complex.cxx | 6 + .../ComplexRelativePaths/cmTestConfigure.h.in | 4 + Tests/CustomCommand/CMakeLists.txt | 7 +- Tests/ExportImport/Export/CMakeLists.txt | 4 + Tests/ExportImport/Import/CMakeLists.txt | 9 +- Tests/FindPackageTest/Baz 1.1/BazConfig.cmake | 1 + .../Baz 1.1/BazConfigVersion.cmake | 8 + .../Baz 1.2/CMake/BazConfig.cmake | 1 + .../Baz 1.2/CMake/BazConfigVersion.cmake | 8 + Tests/FindPackageTest/CMakeLists.txt | 20 +- Tests/FindPackageTest/FindRecursiveA.cmake | 1 + Tests/FindPackageTest/FindRecursiveB.cmake | 1 + Tests/FindPackageTest/FindRecursiveC.cmake | 1 + .../lib/RecursiveA/recursivea-config.cmake | 1 + .../cmake/zot-4.0/zot-config-version.cmake | 8 + .../lib/cmake/zot-4.0/zot-config.cmake | 1 + .../lib/zot/zot-config-version.cmake | 10 + .../FindPackageTest/lib/zot/zot-config.cmake | 2 + Tests/Fortran/CMakeLists.txt | 170 ++- Tests/Fortran/foo.c | 11 + Tests/Fortran/foo.f | 9 + Tests/Fortran/mysub.f | 4 + Tests/PolicyScope/Bar.cmake | 8 + Tests/PolicyScope/CMakeLists.txt | 86 ++ Tests/PolicyScope/FindFoo.cmake | 2 + Tests/PolicyScope/main.c | 4 + Tests/StringFileTest/CMakeLists.txt | 7 + Tests/Unset/CMakeLists.txt | 55 + Tests/Unset/unset.c | 4 + Utilities/cmcurl/CMake/CurlTests.c | 2 +- Utilities/cmcurl/CMakeLists.txt | 7 +- Utilities/cmcurl/Testing/curltest.c | 3 +- Utilities/cmcurl/curl/curl.h | 4 +- Utilities/cmcurl/select.c | 4 +- Utilities/cmtar/util.c | 7 + Utilities/cmzlib/zconf.h | 4 +- Utilities/cmzlib/zutil.h | 10 +- bootstrap | 18 +- 299 files changed, 10082 insertions(+), 4182 deletions(-) create mode 100644 Modules/CMakeASM_MASMInformation.cmake create mode 100644 Modules/CMakeDetermineASM_MASMCompiler.cmake create mode 100644 Modules/CMakeTestASM_MASMCompiler.cmake create mode 100644 Modules/FindCoin3D.cmake create mode 100644 Modules/FindCxxTest.cmake create mode 100644 Modules/FindDevIL.cmake create mode 100755 Modules/FindOpenMP.cmake create mode 100644 Modules/FindOpenSceneGraph.cmake create mode 100644 Modules/FindRTI.cmake create mode 100644 Modules/FindSquish.cmake create mode 100644 Modules/FindosgAnimation.cmake create mode 100644 Modules/FindosgVolume.cmake create mode 100644 Modules/FindosgWidget.cmake create mode 100644 Modules/Findosg_functions.cmake create mode 100755 Modules/FortranCInterface.cmake create mode 100644 Modules/FortranCInterface.h.in create mode 100755 Modules/Platform/Haiku.cmake create mode 100644 Modules/SquishRunTestCase.bat create mode 100755 Modules/SquishRunTestCase.sh create mode 100644 Modules/SquishTestScript.cmake create mode 100644 Source/CPack/cmCPackDragNDropGenerator.cxx create mode 100644 Source/CPack/cmCPackDragNDropGenerator.h create mode 100644 Source/QtDialog/Compilers.h create mode 100644 Source/QtDialog/Compilers.ui create mode 100644 Source/QtDialog/CrossCompiler.ui create mode 100644 Source/QtDialog/FirstConfigure.cxx create mode 100644 Source/QtDialog/FirstConfigure.h create mode 100644 Source/cmUnsetCommand.cxx create mode 100644 Source/cmUnsetCommand.h create mode 100644 Tests/CTestUpdateCVS.cmake.in create mode 100644 Tests/CTestUpdateCommon.cmake create mode 100644 Tests/CTestUpdateSVN.cmake.in create mode 100644 Tests/FindPackageTest/Baz 1.1/BazConfig.cmake create mode 100644 Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake create mode 100644 Tests/FindPackageTest/Baz 1.2/CMake/BazConfig.cmake create mode 100644 Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake create mode 100644 Tests/FindPackageTest/FindRecursiveA.cmake create mode 100644 Tests/FindPackageTest/FindRecursiveB.cmake create mode 100644 Tests/FindPackageTest/FindRecursiveC.cmake create mode 100644 Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake create mode 100644 Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake create mode 100644 Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake create mode 100644 Tests/FindPackageTest/lib/zot/zot-config-version.cmake create mode 100644 Tests/FindPackageTest/lib/zot/zot-config.cmake create mode 100755 Tests/Fortran/foo.c create mode 100755 Tests/Fortran/foo.f create mode 100755 Tests/Fortran/mysub.f create mode 100644 Tests/PolicyScope/Bar.cmake create mode 100644 Tests/PolicyScope/CMakeLists.txt create mode 100644 Tests/PolicyScope/FindFoo.cmake create mode 100644 Tests/PolicyScope/main.c create mode 100644 Tests/Unset/CMakeLists.txt create mode 100644 Tests/Unset/unset.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f228abbb..d877f3393 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -353,8 +353,8 @@ ENDMACRO (CMAKE_BUILD_UTILITIES) # The CMake version number. SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 6) -SET(CMake_VERSION_PATCH 2) -#SET(CMake_VERSION_RC 6) +SET(CMake_VERSION_PATCH 3) +SET(CMake_VERSION_RC 11) # CVS versions are odd, if this is an odd minor version # then set the CMake_VERSION_DATE variable IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$") diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 49b04bbbc..e94e4b0d7 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -5,3 +5,8 @@ set(CTEST_DROP_METHOD "http") set(CTEST_DROP_SITE "www.cdash.org") set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake") set(CTEST_DROP_SITE_CDASH TRUE) + +# use old trigger stuff so that cmake 2.4 and below will not +# get errors on trigger +SET (TRIGGER_SITE + "http://public.kitware.com/cgi-bin/Submit-CMake-TestingResults.cgi") diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 68f0dedd0..1b18ece96 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -2,6 +2,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION} "xtree.[0-9]+. : warning C4702: unreachable code" "warning LNK4221" + "warning LNK4204" # Occurs by race condition with objects in small libs "variable .var_args[2]*. is used before its value is set" "jobserver unavailable" "warning: \\(Long double usage is reported only once for each file" diff --git a/ChangeLog.manual b/ChangeLog.manual index bd31d9b15..64d8e2d10 100755 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,141 @@ +Changes in CMake 2.6.3 RC 11 +- Fix old-style install to prefix top +- Fix Docs for relative paths in link_directories +- Fix OS X dylib version flags for more linkers +- Add some extra search paths for Haiku +- Fix FindDoxygen not respecting QUIET and REQUIRED +- Fix FindGDAL, FindLua50 FindLua51 FindMPEG2 +- add FindOpenSceneGraph.cmake +- Fixes for FindOSG +- Fix FindQt4 find .moc files if there are spaces between # and include#8433. +- Change haiku to use dlopen functions and not BEOS stuff + +Changes in CMake 2.6.3 RC 10 +- Fix issue #7470. Allow spaces in the path names for CPack NSIS. +- Fix crash with set properties and empty values +- Enforce matching cmake_policy push/pop scope in scripts +- Document find_package refind +- add unset command +- add/fix many osg modules +- Fixes for FindBoost.cmake +- Fixes for FindDoxygen.cmake +- Fixes for FindFLTK.cmake +- Fix endif in FindKDE4.cmake +- Fix HEADER_FILE_ONLY with VS and midl files #7845 +- Add #7833 changes to support OSXX11 file associations +- Fix target ordering in VS IDE solution files +- Fix LOCATION property for Mac App Bundle targets +- Better diagnosis of mismatching logical blocks +- Improve scoping of policies (see cmake_policy and CMP0011) + +Changes in CMake 2.6.3 RC 9 +- Fix borland 55 build +- Pop a function scope even on error +- Provide variable CMAKE_VERSION + +Changes in CMake 2.6.3 RC 8 +- CMAKE_VERBOSE_MAKEFILE fix for KDevelop3 +- FindGettext.cmake fix #8122 +- FindPythonInterp.cmake find python 2.6 on windows +- cmake_minimum_required forward compatibility +- Fix (#7289) in cmDocumentationFormatterDocbook.cxx +- Fix #8203: codeblocks + mingw quoting issue +- Clean per-config export files during install +- Bug fixes for Eclipse CDT4 generator +- find_package refind when previously found file is removed +- Support '-' in target names for VS6 +- Fix component-name test on installation +- Warn when build directory is too long +- Fix set cache FORCE and -D command line to work together +- Enable LOCATION property for imported targets +- Allow cmake-gui to be built by cmake 2.4 +- Fix installation from read-only source file +- Fix for rc and vs6 -D flags +- Create DEBUG_CONFIGURATIONS global property + +Changes in CMake 2.6.3 RC 7 +- Add both 32/64-bit Program Files as windows paths +- Fix potential crash with ctest and log being null + +Changes in CMake 2.6.3 RC 6 +- Fix project(foo NONE) enable c later bug on OSX +- Fix Haiku default paths +- RPM Update generator to handle optional dependencies using Requires +- Fix FindCurses for Haiku +- Look for doxygen in more places +- Look for different expat names on windows +- FindLibxml2 use FindPkgConfig.cmake instead of UsePkgConfig.cmake, +- Add translations support to FindQt4.cmake +- FindWxWidgets Fixed placement of initial wxWidgets_FOUND=TRUE +- Fix GetPrerequisites.cmake to work with 0 libs +- Add support for Squish +- Make bundle startup optional in bundle generator +- Fix runtime search path ordering with symlinks (fix from RC4) +- Fix escaping of empty custom command argument on Windows +- Teach find_package more config file locations +- Fix scope of find_package definitions in find-modules +- Teach find_package to push/pop policies for version files + +Changes in CMake 2.6.3 RC 5 +- add EXCLUDE, INCLUDE to ctest_test command in ctest -S scripts +- Set CMAKE_SYSTEM in ctest -S scripts by reading CMakeDetermineSystem +- Fix for GetLibraryNamesInternal called on imported target issue on osx +- Add FortranCInterface.cmake module to discover Fortran/C interfaces +- Fix Fortran compiler specified with -D issue +- Add support for the MS masm and masm64 assemblers, works with nmake/make +- Improvments to FindQt4.cmake +- InstallRequiredSystemLibraries fix for win64 +- Fix flags for Sun Fortran, and g77 +- Fix imported library issue with OSX +- Fix -D and CACHE FORCE issue +- Have kwsys submit dashboards to cdash.org + +Changes in CMake 2.6.3 RC 4 +- Fix for SccProvider in visual studio +- fix for missing package_source target +- FindQt4 QT_PHONON_MODULE_DEPENDS fixes +- Fixes for GetPrerequisites.cmake system libraries on Mac and UNIX +- Merge in kwsys Haiku DynaimcLoader change +Changes in CMake 2.6.3 RC 3 +- Merge in CMakeLists.txt curl Haiku change +Changes in CMake 2.6.3 RC 2 +- Merge in more Haiku changes +Changes in CMake 2.6.3 RC 1 +- Better reporting when nmake compiler environment is not correct +- Fix bug #5936 set locale when running cvs and svn +- Teach find_library to find OpenBSD-style libs (issue #3470). +- Fix lib/ to lib/64/ search path conversion +- Fix CPack DESTDIR issue +- Support longer command lines with windows nmake and make +- Fix bug with color check for dependency scanning +- Use new link info during dependency scanning +- Fix find_* search order with path suffixes +- Fix install with multiple configurations and makefiles. +- Improve find_package interface for recursive find modules. +- Fix build issues with older visual studio versions +- Fix Xcode release builds +- Put custom target sources in Xcode projects +- Fix return value from cmake -E time commands +- Fix documentation for cmake --debug-trycompile +- Add Haiku support +- Fix bug, allow enable_language to be called for C after CXX +- Add FindCoin3D.cmake +- Fix bug in FindGLUT.cmake +- Better find of perl in FindPerlLibs.cmake +- FindQt4 Fix #7784, Fix #7433 +- FindQt4 refind qt when qmake changes +- Fix to find wxWidgets_LIB_DIR for windows platform more generally. +- Find ttkstup in FindTclStub.cmake +- Skip a command if its arguments fail to parse +- Fix convenience rule working directory +- Add support for source code control and visual stuido +- Add parenthetical expressions to if +- Fix Rc command with -D options and nmake +- Fix NSIS detection on windows 2000 +- Display an error message in ccmake when there are errors + +CMake 2.6.2 released + Changes in CMake 2.6.2 RC 6 - Fix bug#7669 cpack did not work when sym-linked after install diff --git a/Modules/CMakeASM-ATTInformation.cmake b/Modules/CMakeASM-ATTInformation.cmake index fb44b102a..353473af9 100644 --- a/Modules/CMakeASM-ATTInformation.cmake +++ b/Modules/CMakeASM-ATTInformation.cmake @@ -1,3 +1,5 @@ +# support for AT&T syntax assemblers, e.g. GNU as + SET(ASM_DIALECT "-ATT") SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm) INCLUDE(CMakeASMInformation) diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index 998962f97..95a0645c7 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -7,7 +7,7 @@ ELSE(UNIX) 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") diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake new file mode 100644 index 000000000..05366b9b4 --- /dev/null +++ b/Modules/CMakeASM_MASMInformation.cmake @@ -0,0 +1,10 @@ +# 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 " /c /Fo ") + +INCLUDE(CMakeASMInformation) +SET(ASM_DIALECT) diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index a2ad460f9..bb3142ccc 100755 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -12,7 +12,7 @@ IF(UNIX) ELSE(UNIX) SET(CMAKE_C_OUTPUT_EXTENSION .obj) ENDIF(UNIX) - +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) @@ -32,10 +32,20 @@ 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) + 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) + INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} + OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +ENDIF (NOT _INCLUDED_FILE) +# some systems include the compiler information in the system file +# and if this is the enable_language command then it may not have been +# included at this point, or needs to be included again so that the +# language_INIT variables are set correctly +IF (NOT _INCLUDED_FILE) + INCLUDE(Platform/${CMAKE_SYSTEM_NAME} + OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) ENDIF (NOT _INCLUDED_FILE) diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index c5608e0ad..a5923a399 100755 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -13,7 +13,7 @@ ELSE(UNIX) SET(CMAKE_CXX_OUTPUT_EXTENSION .obj) ENDIF(UNIX) - +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) diff --git a/Modules/CMakeDetermineASM-ATTCompiler.cmake b/Modules/CMakeDetermineASM-ATTCompiler.cmake index 71e98c289..5861159ec 100644 --- a/Modules/CMakeDetermineASM-ATTCompiler.cmake +++ b/Modules/CMakeDetermineASM-ATTCompiler.cmake @@ -1,4 +1,4 @@ -# determine the compiler to use for ASM using AT&T syntax +# 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) diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index eac8c55cd..da7194af9 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -17,7 +17,7 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_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} DOC "Assembler") + 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) diff --git a/Modules/CMakeDetermineASM_MASMCompiler.cmake b/Modules/CMakeDetermineASM_MASMCompiler.cmake new file mode 100644 index 000000000..3b72e072b --- /dev/null +++ b/Modules/CMakeDetermineASM_MASMCompiler.cmake @@ -0,0 +1,13 @@ +# 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/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index defb5a7f8..7afa5ee3d 100755 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -53,7 +53,7 @@ IF(NOT CMAKE_Fortran_COMPILER) # CMake/Source/CMakeLists.txt, IF YOU CHANGE THIS LIST, # PLEASE UPDATE THAT FILE AS WELL! SET(CMAKE_Fortran_COMPILER_LIST - ifort ifc efc f95 pgf95 lf95 xlf95 fort gfortran g95 f90 + ifort ifc efc f95 pgf95 lf95 xlf95 fort gfortran gfortran-4 g95 f90 pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77 ) ENDIF(CMAKE_Fortran_COMPILER_INIT) @@ -63,6 +63,32 @@ IF(NOT CMAKE_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) diff --git a/Modules/CMakeFortranCompilerId.F90.in b/Modules/CMakeFortranCompilerId.F90.in index 0949b5051..c7facb550 100644 --- a/Modules/CMakeFortranCompilerId.F90.in +++ b/Modules/CMakeFortranCompilerId.F90.in @@ -50,6 +50,10 @@ PROGRAM CMakeFortranCompilerId 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]' +! Haiku also defines __BEOS__ so we must +! put it prior to the check for __BEOS__ #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) PRINT *, 'INFO:platform[BeOS]' #elif defined(__QNX__) || defined(__QNXNTO__) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 461573784..25ebe21e3 100755 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -3,6 +3,7 @@ # It also loads the available platform file for the system-compiler # if it exists. +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) diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index d66e809a9..2599f2b26 100755 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -26,11 +26,7 @@ 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_INIT_VALUE FALSE) -IF(CMAKE_GENERATOR MATCHES "KDevelop3") - SET(CMAKE_INIT_VALUE TRUE) -ENDIF(CMAKE_GENERATOR MATCHES "KDevelop3") -SET(CMAKE_VERBOSE_MAKEFILE ${CMAKE_INIT_VALUE} 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_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 diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 1f1fca6ff..8e786ba79 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -35,6 +35,12 @@ #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" diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake index dcef7ee1b..0efba7c32 100755 --- a/Modules/CMakeRCInformation.cmake +++ b/Modules/CMakeRCInformation.cmake @@ -3,12 +3,15 @@ # 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) 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.") @@ -23,7 +26,7 @@ SET(CMAKE_INCLUDE_FLAG_RC "-I") # compile a Resource file into an object file IF(NOT CMAKE_RC_COMPILE_OBJECT) SET(CMAKE_RC_COMPILE_OBJECT - " /fo ") + " /fo ") ENDIF(NOT CMAKE_RC_COMPILE_OBJECT) MARK_AS_ADVANCED( diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index 561f5e31e..5a8c10cb3 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -29,7 +29,7 @@ IF(NOT _INCLUDED_SYSTEM_INFO_FILE) IF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt) CONFIGURE_FILE(${CMAKE_BINARY_DIR}/CMakeCache.txt ${CMAKE_BINARY_DIR}/CopyOfCMakeCache.txt COPYONLY) - MESSAGE("You CMakeCache.txt file was copied to CopyOfCMakeCache.txt. " + 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) diff --git a/Modules/CMakeTestASM-ATTCompiler.cmake b/Modules/CMakeTestASM-ATTCompiler.cmake index 3844f5bda..1b4ef4fa7 100644 --- a/Modules/CMakeTestASM-ATTCompiler.cmake +++ b/Modules/CMakeTestASM-ATTCompiler.cmake @@ -4,6 +4,7 @@ # 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(ASM_DIALECT "-ATT") INCLUDE(CMakeTestASMCompiler) SET(ASM_DIALECT) diff --git a/Modules/CMakeTestASM_MASMCompiler.cmake b/Modules/CMakeTestASM_MASMCompiler.cmake new file mode 100644 index 000000000..9bdf13ad8 --- /dev/null +++ b/Modules/CMakeTestASM_MASMCompiler.cmake @@ -0,0 +1,10 @@ + +# This file is used by EnableLanguage in cmGlobalGenerator to +# determine that the selected ASM_MASM "compiler" (should be masm or masm64) +# 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(ASM_DIALECT "_MASM") +INCLUDE(CMakeTestASMCompiler) +SET(ASM_DIALECT) diff --git a/Modules/CPack.OSXX11.Info.plist.in b/Modules/CPack.OSXX11.Info.plist.in index 30ce2de8b..851b67ba8 100644 --- a/Modules/CPack.OSXX11.Info.plist.in +++ b/Modules/CPack.OSXX11.Info.plist.in @@ -4,6 +4,19 @@ CFBundleDevelopmentRegion English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + @CPACK_FILE_ASSOCIATION_EXTENSION@ + + CFBundleTypeName + @CPACK_FILE_ASSOCIATION_TYPE@ + CFBundleTypeRole + Editor + + CFBundleExecutable @CPACK_PACKAGE_FILE_NAME@ CFBundleGetInfoString diff --git a/Modules/CPack.RuntimeScript.in b/Modules/CPack.RuntimeScript.in index 72dd14ec4..eaecdd8fa 100755 --- a/Modules/CPack.RuntimeScript.in +++ b/Modules/CPack.RuntimeScript.in @@ -5,6 +5,26 @@ CWD="`dirname \"$0\"`" TMP=/tmp/$UID/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 < 10 )) || ((( $major == 10)) && (( $minor < 5 )))); then version=`sw_vers -productVersion` if [ "$?" = "0" ]; then major=${version%%\.*} @@ -42,6 +62,7 @@ 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 || \ diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 75e0c2057..553ceeac2 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -708,6 +708,7 @@ if(NOT CPACK_GENERATOR) 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) @@ -715,17 +716,18 @@ if(NOT CPACK_GENERATOR) 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" 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" 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) @@ -768,7 +770,7 @@ mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX 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_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP) # Set some other variables cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index e441e69ea..8b55d722d 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -126,11 +126,24 @@ IF (NOT CPACK_RPM_PACKAGE_DESCRIPTION) ENDIF (CPACK_PACKAGE_DESCRIPTION_FILE) ENDIF (NOT CPACK_RPM_PACKAGE_DESCRIPTION) +# CPACK_RPM_PACKAGE_REQUIRES +# Placeholder used to specify binary RPM dependencies (if any) +# see http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html +IF(CPACK_RPM_PACKAGE_REQUIRES) + IF(CPACK_RPM_PACKAGE_DEBUG) + MESSAGE("CPackRPM:Debug: User defined Requires:\n ${CPACK_RPM_PACKAGE_REQUIRES}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + SET(TMP_RPM_REQUIRES "Requires: ${CPACK_RPM_PACKAGE_REQUIRES}") +ENDIF(CPACK_RPM_PACKAGE_REQUIRES) + # 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) @@ -177,14 +190,13 @@ ELSE(CPACK_RPM_USER_BINARY_SPECFILE) 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 = ${PACK_TEMPORARY_DIRECTORY}") + 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 = ${PACK_PACKAGE_INSTALL_DIRECTORY}") + MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") - MESSAGE("CPackRPM:Debug: CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}") ENDIF(CPACK_RPM_PACKAGE_DEBUG) FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE} "# -*- rpm-spec -*- @@ -196,6 +208,7 @@ Release: ${CPACK_RPM_PACKAGE_RELEASE} License: ${CPACK_RPM_PACKAGE_LICENSE} Group: ${CPACK_RPM_PACKAGE_GROUP} Vendor: ${CPACK_RPM_PACKAGE_VENDOR} +${TMP_RPM_REQUIRES} ${TMP_RPM_BUILDARCH} #%define prefix ${CMAKE_INSTALL_PREFIX} @@ -228,6 +241,9 @@ ${CPACK_RPM_PACKAGE_DESCRIPTION} /* %changelog +* Mon Oct 03 2008 Erk + Update generator to handle optional dependencies using Requires + Update DEBUG output typos. * Mon Aug 25 2008 Erk Update generator to handle optional post-install * Tue Aug 16 2007 Erk diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index 10d6ff51f..952e18eed 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -1,5 +1,5 @@ -# - Configure a project for testing with CTest/Dart -# This file configures a project to use the CTest/Dart +# - Configure a project for testing with CTest/CDash +# This file configures a project to use the CTest/CDash/Dart # testing/dashboard process. This module should be included # in the CMakeLists.txt file at the top of a project. Typical usage: # INCLUDE(CTest) diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c index a846567ff..d83107851 100644 --- a/Modules/CheckForPthreads.c +++ b/Modules/CheckForPthreads.c @@ -16,7 +16,7 @@ int main(int ac, char*av[]){ pthread_create(&tid[0], 0, runner, (void*)1); pthread_create(&tid[1], 0, runner, (void*)2); -#if defined(__BEOS__) && !defined(__ZETA__) // (no usleep on BeOS 5.) +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) // (no usleep on BeOS 5.) usleep(1); // for strange behavior on single-processor sun #endif diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index c0f09b28a..8ea67e5bc 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1,50 +1,97 @@ # - Try to find Boost include dirs and libraries # Usage of this module as follows: # -# SET(Boost_USE_STATIC_LIBS ON) -# SET(Boost_USE_MULTITHREAD OFF) -# FIND_PACKAGE( Boost 1.34.1 COMPONENTS date_time filesystem iostreams ... ) +# == Using Header-Only libraries from within Boost: == # -# 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 the libraries. Unfortunately boost puts the version number into the -# actual filename for the libraries, so this might be needed in the future -# when new Boost versions are released. +# FIND_PACKAGE( Boost 1.36.0 ) +# INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +# ADD_EXECUTABLE(foo foo.cc) # -# 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 +# == Using actual libraries from within Boost: == +# +# SET(Boost_USE_STATIC_LIBS ON) +# SET(Boost_USE_MULTITHREADED ON) +# FIND_PACKAGE( Boost 1.36.0 COMPONENTS date_time filesystem system ... ) +# INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +# +# ADD_EXECUTABLE(foo foo.cc) +# TARGET_LINK_LIBRARIES(foo ${Boost_LIBRARIES}) # # The components list needs to be the actual names of boost libraries, that is # the part of the actual library files that differ on different libraries. So # its "date_time" for "libboost_date_time...". Anything else will result in -# errors +# errors. If you're using parts of Boost that contains header files only (e.g. +# foreach) you do not need to specify COMPONENTS. # -# You can provide a minimum version number that should be used. If you provide this +# 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 +# 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, +# autolinking typically uses static libraries by default. +# +# 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. +# +# =========== 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 +# +# 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 "0.99" "0.99.0" "1.78" "1.78.0") +# +# ============================================================================ # # Variables used by this module, they can change the default behaviour and need to be set # before calling find_package: -# Boost_USE_MULTITHREAD Can be set to OFF to use the non-multithreaded -# boost libraries. Defaults to ON. +# +# 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. +# +# 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. The default list -# of version numbers is: -# 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 -# If you want to look for an older or newer -# version set this variable to a list of -# strings, where each string contains a number, i.e. -# SET(Boost_ADDITIONAL_VERSIONS "0.99.0" "1.35.0") +# 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_COMPILER Set this to the compiler suffix used by boost (e.g. -gcc43) if the +# module has problems finding the proper Boost installation +# # BOOST_ROOT or BOOSTROOT Preferred installation prefix for searching for Boost, # set this if the module has problems finding the proper Boost installation +# # 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 # @@ -55,21 +102,31 @@ # # 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 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 its 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 Only set on windows. Can be used with add_definitions -# to print diagnostic information about the automatic -# linking done on windows. - +# +# Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call +# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINTIIONS}) +# to have diagnostic information about +# Boost's automatic linking outputted +# during compilation time. +# # For each component you list the following variables are set. # ATTENTION: The component names need to be in lower case, just as the boost # library names however the cmake variables use upper case for the component @@ -91,23 +148,43 @@ # BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # -OPTION(Boost_USE_MULTITHREADED - "Use the multithreaded versions of the Boost libraries" ON) - -if (Boost_FIND_VERSION_EXACT) - if (Boost_FIND_VERSION_PATCH) - set( _boost_TEST_VERSIONS - "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}") - else (Boost_FIND_VERSION_PATCH) - set( _boost_TEST_VERSIONS - "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.0" - "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") - endif (Boost_FIND_VERSION_PATCH) -else (Boost_FIND_VERSION_EXACT) - set( _boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "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" ) -endif (Boost_FIND_VERSION_EXACT) + +IF(NOT DEFINED Boost_USE_MULTITHREADED) + SET(Boost_USE_MULTITHREADED TRUE) +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.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 @@ -155,9 +232,27 @@ MACRO (_Boost_ADJUST_LIB_VARS basename) ENDIF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) IF (Boost_${basename}_LIBRARY) - SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library") - GET_FILENAME_COMPONENT(Boost_LIBRARY_DIRS "${Boost_${basename}_LIBRARY}" PATH) - SET(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory") + IF(WIN32) + # Workaround issue #8378. + SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE STRING "The Boost ${basename} library") + ELSE() + SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library") + ENDIF() + + # 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) + + IF(WIN32) + # Workaround issue #8378. + SET(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE STRING "Boost library directory") + ELSE() + SET(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory") + ENDIF() SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found") ENDIF (Boost_${basename}_LIBRARY) @@ -170,6 +265,23 @@ MACRO (_Boost_ADJUST_LIB_VARS basename) ) 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() + + #------------------------------------------------------------------------------- @@ -199,8 +311,24 @@ IF (_boost_IN_CACHE) MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") ENDIF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} " + "is already in the cache. For debugging messages, please clear the cache.") + endif() ELSE (_boost_IN_CACHE) # Need to search for boost + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost not in cache") + # 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}") + endif() IF(WIN32) # In windows, automatic linking is performed, so you do not have @@ -226,20 +354,11 @@ ELSE (_boost_IN_CACHE) SET(_boost_INCLUDE_SEARCH_DIRS C:/boost/include - "C:/boost" - "$ENV{ProgramFiles}/boost/boost_${Boost_FIND_VERSION_MAJOR}_${Boost_FIND_VERSION_MINOR}_${Boost_FIND_VERSION_PATCH}" - "$ENV{ProgramFiles}/Boost" + C:/boost + "$ENV{ProgramFiles}/boost" /sw/local/include ) - SET(_boost_LIBRARIES_SEARCH_DIRS - C:/boost/lib - "C:/boost" - "$ENV{ProgramFiles}/boost/boost_${Boost_FIND_VERSION_MAJOR}_${Boost_FIND_VERSION_MINOR}_${Boost_FIND_VERSION_PATCH}/lib" - "$ENV{ProgramFiles}/Boost" - /sw/local/lib - ) - # 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}) @@ -254,22 +373,34 @@ ELSE (_boost_IN_CACHE) IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR}) ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) - + # If BOOST_LIBRARYDIR was defined in the environment, use it. IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR}) ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) - + IF( BOOST_ROOT ) file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT) + ENDIF( BOOST_ROOT ) + + 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_ROOT ) SET(_boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT} ${_boost_INCLUDE_SEARCH_DIRS}) - SET(_boost_LIBRARIES_SEARCH_DIRS - ${BOOST_ROOT}/lib - ${BOOST_ROOT}/stage/lib - ${_boost_LIBRARIES_SEARCH_DIRS}) ENDIF( BOOST_ROOT ) IF( BOOST_INCLUDEDIR ) @@ -278,12 +409,9 @@ ELSE (_boost_IN_CACHE) ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) ENDIF( BOOST_INCLUDEDIR ) - IF( BOOST_LIBRARYDIR ) - file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) - SET(_boost_LIBRARIES_SEARCH_DIRS - ${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS}) - ENDIF( BOOST_LIBRARYDIR ) - + # ------------------------------------------------------------------------ + # Search for Boost include DIR + # ------------------------------------------------------------------------ # Try to find Boost by stepping backwards through the Boost versions # we know about. IF( NOT Boost_INCLUDE_DIR ) @@ -293,21 +421,33 @@ ELSE (_boost_IN_CACHE) # 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 - if (WIN32 AND NOT CYGWIN) - set(_boost_PATH_SUFFIX boost_${_boost_VER}) - else (WIN32 AND NOT CYGWIN) - set(_boost_PATH_SUFFIX boost-${_boost_VER}) - endif (WIN32 AND NOT CYGWIN) + set(_boost_BOOSTIFIED_VERSION) - IF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") + # 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_PATH_SUFFIX ${_boost_PATH_SUFFIX}) - ELSEIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+") + _boost_BOOSTIFIED_VERSION ${_boost_VER}) + ELSEIF(_boost_VER MATCHES "[0-9]+\\.[0-9]+") STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" - _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX}) - ENDIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - LIST(APPEND _boost_PATH_SUFFIXES "${_boost_PATH_SUFFIX}") + _boost_BOOSTIFIED_VERSION ${_boost_VER}) + ENDIF() + + LIST(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") + IF(WIN32) + # Yay Boost Pro! We dig your underscores. + LIST(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") + ENDIF() + 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 @@ -316,6 +456,10 @@ ELSE (_boost_IN_CACHE) PATH_SUFFIXES ${_boost_PATH_SUFFIXES} ) 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 @@ -324,6 +468,10 @@ ELSE (_boost_IN_CACHE) 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}") @@ -339,74 +487,109 @@ ELSE (_boost_IN_CACHE) 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 ) + if ( MSVC AND Boost_USE_STATIC_LIBS ) SET (Boost_LIB_PREFIX "lib") - ENDIF ( WIN32 AND Boost_USE_STATIC_LIBS ) - SET (_boost_COMPILER "-gcc") - IF (MSVC90) - SET (_boost_COMPILER "-vc90") - ELSEIF (MSVC80) - SET (_boost_COMPILER "-vc80") - ELSEIF (MSVC71) - SET (_boost_COMPILER "-vc71") - ENDIF(MSVC90) - IF (MINGW) - EXEC_PROGRAM(${CMAKE_CXX_COMPILER} - ARGS -dumpversion - OUTPUT_VARIABLE _boost_COMPILER_VERSION - ) - STRING(REGEX REPLACE "([0-9])\\.([0-9])\\.[0-9]" "\\1\\2" - _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) - SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") - ENDIF(MINGW) - IF (UNIX) - IF (NOT CMAKE_COMPILER_IS_GNUCC) - # We assume that we have the Intel compiler. - SET (_boost_COMPILER "-il") - ELSE (NOT CMAKE_COMPILER_IS_GNUCC) - # Determine which version of GCC we have. - EXEC_PROGRAM(${CMAKE_CXX_COMPILER} - ARGS -dumpversion - OUTPUT_VARIABLE _boost_COMPILER_VERSION - ) - STRING(REGEX REPLACE "([0-9])\\.([0-9])\\.[0-9]" "\\1\\2" - _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) - 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 (NOT CMAKE_COMPILER_IS_GNUCC) - ENDIF(UNIX) + 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(Boost_COMPILER) + # 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. + if (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}" MATCHES "icl" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") + if(WIN32) + set (_boost_COMPILER "-iw") + else() + set (_boost_COMPILER "-il") + endif() + 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) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "guessed _boost_COMPILER = ${_boost_COMPILER}") + endif() + endif(Boost_COMPILER) SET (_boost_MULTITHREADED "-mt") - - IF( NOT Boost_USE_MULTITHREADED ) - SET (_boost_MULTITHREADED "") - ENDIF( NOT Boost_USE_MULTITHREADED ) + 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() SET( _boost_STATIC_TAG "") + set( _boost_ABI_TAG "") IF (WIN32) IF(MSVC) SET (_boost_ABI_TAG "g") @@ -416,10 +599,42 @@ ELSE (_boost_IN_CACHE) ENDIF( Boost_USE_STATIC_LIBS ) ENDIF(WIN32) SET (_boost_ABI_TAG "${_boost_ABI_TAG}d") + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_STATIC_TAG = ${_boost_STATIC_TAG}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_ABI_TAG = ${_boost_ABI_TAG}") + endif() # ------------------------------------------------------------------------ # Begin finding boost libraries # ------------------------------------------------------------------------ + + SET(_boost_LIBRARIES_SEARCH_DIRS + C:/boost/lib + C:/boost + "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib" + "$ENV{ProgramFiles}/boost" + /sw/local/lib + ) + IF( BOOST_ROOT ) + SET(_boost_LIBRARIES_SEARCH_DIRS + ${BOOST_ROOT}/lib + ${BOOST_ROOT}/stage/lib + ${_boost_LIBRARIES_SEARCH_DIRS}) + ENDIF( BOOST_ROOT ) + + IF( BOOST_LIBRARYDIR ) + file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) + SET(_boost_LIBRARIES_SEARCH_DIRS + ${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS}) + ENDIF( BOOST_LIBRARYDIR ) + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_LIBRARIES_SEARCH_DIRS = ${_boost_LIBRARIES_SEARCH_DIRS}") + endif() + FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT) SET( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" ) @@ -439,6 +654,8 @@ ELSE (_boost_IN_CACHE) FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG} ${Boost_LIB_PREFIX}boost_${COMPONENT} @@ -448,6 +665,8 @@ ELSE (_boost_IN_CACHE) FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG} ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG} ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_boost_ABI_TAG} @@ -540,6 +759,10 @@ ELSE (_boost_IN_CACHE) endforeach(COMPONENT) endif (Boost_FOUND) + 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. @@ -621,18 +844,10 @@ ELSE (_boost_IN_CACHE) ENDIF(Boost_FIND_REQUIRED) ENDIF(Boost_FOUND) - # Under Windows, automatic linking is performed, so no need to specify the libraries. - IF (WIN32) - IF (NOT MINGW) - SET(Boost_LIBRARIES "") - ENDIF (NOT MINGW) - ENDIF(WIN32) - # 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 - Boost_USE_MULTITHREADED ) ENDIF(_boost_IN_CACHE) diff --git a/Modules/FindCoin3D.cmake b/Modules/FindCoin3D.cmake new file mode 100644 index 000000000..e42d3e4ee --- /dev/null +++ b/Modules/FindCoin3D.cmake @@ -0,0 +1,72 @@ +# - 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 +# + + +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(FindPackageHandleStandardArgs) +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/FindCurses.cmake b/Modules/FindCurses.cmake index 2a1df7465..6e12379b3 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -15,7 +15,6 @@ 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) @@ -80,21 +79,32 @@ ELSE(NOT CURSES_USE_NCURSES) # 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") + 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") + 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 ) diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake new file mode 100644 index 000000000..07082c63f --- /dev/null +++ b/Modules/FindCxxTest.cmake @@ -0,0 +1,113 @@ +# - 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 +# If true, the CXXTEST_ADD_TEST macro will use +# the Python test generator instead of Perl. +# +# OUTPUT Variables +# +# CXXTEST_FOUND +# True if the CxxTest framework was found +# CXXTEST_INCLUDE_DIR +# 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. +# +# MACROS for use by CMake users: +# +# CXXTEST_ADD_TEST( ) +# 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) +# INCLUDE_DIRECTORIES(${CXXTEST_INCLUDE_DIR}) +# +# ENABLE_TESTING() +# CXXTEST_ADD_TEST(unittest_foo foo_test.cc ${CMAKE_CURRENT_SOURCE_DIR}/foo_test.h) +# +# This will: +# 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 +# +# class MyTestSuite : public CxxTest::TestSuite +# { +# public: +# void testAddition( void ) +# { +# TS_ASSERT( 1 + 1 > 1 ); +# TS_ASSERT_EQUALS( 1 + 1, 2 ); +# } +# }; +# +# +# FindCxxTest.cmake +# Copyright (c) 2008 +# Philip Lowman +# +# 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}) + IF(CXXTEST_USE_PYTHON) + SET(_cxxtest_executable ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE}) + ELSE() + SET(_cxxtest_executable ${CXXTEST_PERL_TESTGEN_EXECUTABLE}) + ENDIF() + + ADD_CUSTOM_COMMAND( + OUTPUT ${_cxxtest_real_outfname} + DEPENDS ${ARGN} + COMMAND ${_cxxtest_executable} + --error-printer -o ${_cxxtest_real_outfname} ${ARGN} + ) + + SET_SOURCE_FILES_PROPERTIES(${_cxxtest_real_outfname} PROPERTIES GENERATED true) + ADD_EXECUTABLE(${_cxxtest_testname} ${_cxxtest_real_outfname}) + + 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() +#============================================================= + +FIND_PATH(CXXTEST_INCLUDE_DIR cxxtest/TestSuite.h) +FIND_PROGRAM(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl) +FIND_PROGRAM(CXXTEST_PYTHON_TESTGEN_EXECUTABLE cxxtestgen.py) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG CXXTEST_INCLUDE_DIR) +SET(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR}) diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake new file mode 100644 index 000000000..82ec3f10a --- /dev/null +++ b/Modules/FindDevIL.cmake @@ -0,0 +1,50 @@ +# This module locates the developer's image library. +# http://openil.sourceforge.net/ +# +# This module sets: +# IL_LIBRARY the name of the IL library. +# ILU_LIBRARY the name of the ILU library. +# ILUT_LIBRARY the name of the ILUT library. +# 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. + +# Original file by: Christopher Harvey +# TODO: Add version support. +# Tested under Linux and Windows (MSVC) + +INCLUDE(FindPackageHandleStandardArgs) + +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_LIBRARY + NAMES IL + PATH_SUFFIXES lib64 lib lib32 + DOC "The file that corresponds to the base il library." +) + +#MESSAGE("IL_LIBRARY is ${IL_LIBRARY}") + +FIND_LIBRARY(ILUT_LIBRARY + NAMES ILUT + PATH_SUFFIXES lib64 lib lib32 + DOC "The file that corresponds to the il (system?) utility library." +) + +#MESSAGE("ILUT_LIBRARY is ${ILUT_LIBRARY}") + +FIND_LIBRARY(ILU_LIBRARY + NAMES ILU + PATH_SUFFIXES lib64 lib lib32 + DOC "The file that corresponds to the il utility library." +) + +#MESSAGE("ILU_LIBRARY is ${ILU_LIBRARY}") + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(IL DEFAULT_MSG + IL_LIBRARY ILU_LIBRARY + ILUT_LIBRARY IL_INCLUDE_DIR) diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index b489a4900..2cbe7b4a4 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -1,102 +1,126 @@ # - This module looks for Doxygen and the path to Graphviz's dot -# Doxygen is a documentation generation tool see http://www.doxygen.org -# With the OS X GUI version, it 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. This code sets the following variables: -# DOXYGEN_EXECUTABLE = The path to the doxygen command. -# DOXYGEN_DOT_EXECUTABLE = The path to the dot program used by doxygen. -# DOXYGEN_DOT_PATH = The path to dot not including the executable -# DOXYGEN = same as DOXYGEN_EXECUTABLE for backwards compatibility -# DOT = same as DOXYGEN_DOT_EXECUTABLE for backwards compatibility +# 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_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 +# +# -# 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 actually placed in Contents/Resources. This is most likely -# to accomodate people who double-click on the Doxygen.app package and expect -# to see something happen. However, the CMake backend gets horribly confused -# by this. Once CMake sees the bundle, it indiscrimately uses Doxywizard -# as the executable to use. The only work-around I have found is to disable -# the app-bundle feature for only this command. -# 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") # For backwards compatibility support -# DOXYGEN_FIND_QUIETLY, but it should have been -# Doxygen_FIND_QUIETLY. IF(Doxygen_FIND_QUIETLY) SET(DOXYGEN_FIND_QUIETLY TRUE) ENDIF(Doxygen_FIND_QUIETLY) -IF (NOT DOXYGEN_FIND_QUIETLY) - MESSAGE(STATUS "Looking for doxygen...") -ENDIF (NOT 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 + 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) - SET (DOXYGEN_FOUND "YES") - IF (NOT DOXYGEN_FIND_QUIETLY) - MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN_EXECUTABLE}") - ENDIF (NOT DOXYGEN_FIND_QUIETLY) -ELSE (DOXYGEN_EXECUTABLE) - IF (NOT DOXYGEN_FIND_QUIETLY) - IF (DOXYGEN_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Looking for doxygen... - NOT found") - ELSE (DOXYGEN_FIND_REQUIRED) - MESSAGE(STATUS "Looking for doxygen... - NOT found") - ENDIF (DOXYGEN_FIND_REQUIRED) - ENDIF (NOT DOXYGEN_FIND_QUIETLY) -ENDIF (DOXYGEN_EXECUTABLE) - -# In the older versions of OS X Doxygen, dot was included with the -# Doxygen bundle. But the new versions place make you download Graphviz.app -# which contains dot in its bundle. -IF (NOT DOXYGEN_FIND_QUIETLY) - MESSAGE(STATUS "Looking for dot tool...") -ENDIF (NOT DOXYGEN_FIND_QUIETLY) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Doxygen DEFAULT_MSG DOXYGEN_EXECUTABLE) -FIND_PROGRAM(DOXYGEN_DOT_EXECUTABLE - NAMES dot - PATHS "$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" -) +# +# Find Dot... +# -IF (NOT DOXYGEN_FIND_QUIETLY) - IF (DOXYGEN_DOT_EXECUTABLE) - MESSAGE(STATUS "Looking for dot tool... - found ${DOXYGEN_DOT_EXECUTABLE}") +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) - ELSE (DOXYGEN_DOT_EXECUTABLE) - MESSAGE(STATUS "Looking for dot tool... - NOT found") - ENDIF (DOXYGEN_DOT_EXECUTABLE) -ENDIF (NOT DOXYGEN_FIND_QUIETLY) + 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() -# Restore the old app-bundle setting setting -SET(CMAKE_FIND_APPBUNDLE ${TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE}) +# 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() -# Backwards compatibility for CMake4.3 and less +# For backwards compatibility support SET (DOXYGEN ${DOXYGEN_EXECUTABLE} ) SET (DOT ${DOXYGEN_DOT_EXECUTABLE} ) MARK_AS_ADVANCED( - DOXYGEN_FOUND DOXYGEN_EXECUTABLE - DOXYGEN_DOT_FOUND DOXYGEN_DOT_EXECUTABLE DOXYGEN_DOT_PATH ) diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index ee5b2fafe..ee804e1ff 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -9,7 +9,7 @@ FIND_PATH(EXPAT_INCLUDE_DIR NAMES expat.h) # Look for the library. -FIND_LIBRARY(EXPAT_LIBRARY NAMES expat) +FIND_LIBRARY(EXPAT_LIBRARY NAMES expat libexpat) # handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if # all listed variables are TRUE diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index 1dc4a59b0..25ddb189c 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -1,20 +1,37 @@ # - Find the native FLTK includes and library -# The following settings are defined -# FLTK_FLUID_EXECUTABLE, where to find the Fluid tool -# FLTK_WRAP_UI, This enables the FLTK_WRAP_UI command -# FLTK_INCLUDE_DIR, where to find include files -# FLTK_LIBRARIES, list of fltk libraries -# FLTK_FOUND, Don't use FLTK if false. -# The following settings should not be used in general. -# 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 - -IF (FLTK_INCLUDE_DIR) - # Already in cache, be silent - SET(FLTK_FIND_QUIETLY TRUE) -ENDIF (FLTK_INCLUDE_DIR) +# +# 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 + +IF(NOT FLTK_SKIP_OPENGL) + FIND_PACKAGE(OpenGL) +ENDIF() # Platform dependent libraries required by FLTK IF(WIN32) @@ -87,6 +104,8 @@ IF(NOT FLTK_DIR) # 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] @@ -113,7 +132,7 @@ ENDIF(NOT FLTK_DIR) INCLUDE(${FLTK_DIR}/FLTKConfig.cmake) # Fluid - IF(FLUID_COMMAND) + IF(FLUID_COMMAND) SET(FLTK_FLUID_EXECUTABLE ${FLUID_COMMAND} CACHE FILEPATH "Fluid executable") ELSE(FLUID_COMMAND) FIND_PROGRAM(FLTK_FLUID_EXECUTABLE fluid PATHS @@ -172,17 +191,53 @@ ENDIF(NOT FLTK_DIR) 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 FL/Fl.h ${FLTK_INCLUDE_SEARCH_PATH}) + 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 @@ -196,7 +251,6 @@ ENDIF(NOT FLTK_DIR) # Find the extra libraries needed for the fltk_images library. IF(UNIX) - FIND_PROGRAM(FLTK_CONFIG_SCRIPT fltk-config PATHS ${FLTK_BIN_DIR}) IF(FLTK_CONFIG_SCRIPT) EXEC_PROGRAM(${FLTK_CONFIG_SCRIPT} ARGS --use-images --ldflags OUTPUT_VARIABLE FLTK_IMAGES_LDFLAGS) @@ -215,19 +269,29 @@ ENDIF(NOT FLTK_DIR) 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}) -SET(FLTK_FOUND 1) -FOREACH(var FLTK_FLUID_EXECUTABLE FLTK_INCLUDE_DIR - FLTK_BASE_LIBRARY FLTK_GL_LIBRARY - FLTK_FORMS_LIBRARY FLTK_IMAGES_LIBRARY) - IF(NOT ${var}) - SET(FLTK_FOUND 0) - ENDIF(NOT ${var}) -ENDFOREACH(var) +INCLUDE(FindPackageHandleStandardArgs) +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) - SET(FLTK_LIBRARIES ${FLTK_IMAGES_LIBRARY} ${FLTK_IMAGES_LIBS} ${FLTK_BASE_LIBRARY} ${FLTK_GL_LIBRARY} - ${FLTK_FORMS_LIBRARY} ) IF(APPLE) SET(FLTK_LIBRARIES ${FLTK_PLATFORM_DEPENDENT_LIBS} ${FLTK_LIBRARIES}) ELSE(APPLE) @@ -241,5 +305,3 @@ IF(FLTK_FOUND) SET (FLTK_LIBRARY ${FLTK_LIBRARIES}) ENDIF(FLTK_FOUND) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLTK DEFAULT_MSG FLTK_LIBRARIES FLTK_INCLUDE_DIR) diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index e21fe833e..e69ee3f7a 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -1,8 +1,14 @@ # Locate gdal -# This module defines -# GDAL_LIBRARY -# GDAL_FOUND, if false, do not try to link to gdal -# GDAL_INCLUDE_DIR, where to find the headers +# +# 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 # # $GDALDIR is an environment variable that would # correspond to the ./configure --prefix=$GDAL_DIR @@ -17,57 +23,71 @@ # to happen). # This makes the presumption that you are include gdal.h like -# #include "gdal.h" +# +#include "gdal.h" FIND_PATH(GDAL_INCLUDE_DIR gdal.h HINTS - $ENV{GDAL_DIR} - PATH_SUFFIXES include + $ENV{GDAL_DIR} + $ENV{GDAL_ROOT} + PATH_SUFFIXES + include/gdal + include/GDAL + include PATHS - ~/Library/Frameworks/gdal.framework/Headers - /Library/Frameworks/gdal.framework/Headers - /usr/local/include/gdal - /usr/local/include/GDAL - /usr/local/include - /usr/include/gdal - /usr/include/GDAL - /usr/include - /sw/include/gdal - /sw/include/GDAL - /sw/include # Fink - /opt/local/include/gdal - /opt/local/include/GDAL - /opt/local/include # DarwinPorts - /opt/csw/include/gdal - /opt/csw/include/GDAL - /opt/csw/include # Blastwave - /opt/include/gdal - /opt/include/GDAL - /opt/include + ~/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 GDAL + NAMES ${_gdal_lib} gdal gdal_i gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL HINTS - $ENV{GDAL_DIR} + $ENV{GDAL_DIR} + $ENV{GDAL_ROOT} + ${_gdal_libpath} PATH_SUFFIXES lib64 lib PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr /sw /opt/local /opt/csw /opt /usr/freeware - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;GDAL_ROOT]/lib ) -SET(GDAL_FOUND "NO") -IF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR) - SET(GDAL_FOUND "YES") -ENDIF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR) - - +include(FindPackageHandleStandardArgs) +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/FindGLUT.cmake b/Modules/FindGLUT.cmake index 74b7ff1d2..c838b0191 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -11,6 +11,7 @@ IF (WIN32) FIND_PATH( GLUT_INCLUDE_DIR NAMES GL/glut.h PATHS ${GLUT_ROOT_PATH}/include ) FIND_LIBRARY( GLUT_glut_LIBRARY NAMES glut glut32 + PATHS ${OPENGL_LIBRARY_DIR} ${GLUT_ROOT_PATH}/Release ) diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 99a270505..c7dee5257 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -18,7 +18,9 @@ FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge) FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt) -MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFile) +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(_potBasename ${_potFile} NAME_WE) diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index 0cf8b2404..0ae94dc47 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -106,13 +106,13 @@ 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\\.") + 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 ("${kde_version}" MATCHES "KDE: 3\\.") ENDIF(KDECONFIG_EXECUTABLE) diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake index e6d0488bf..25c8d8aed 100644 --- a/Modules/FindKDE4.cmake +++ b/Modules/FindKDE4.cmake @@ -16,7 +16,7 @@ IF(QT_QT_LIBRARY) ELSE(KDE4_FIND_REQUIRED) IF(NOT KDE4_FIND_QUIETLY) MESSAGE( STATUS "KDE4/Qt4 and Qt3 cannot be used together in one project.") - ENDIF(NOT KDE_FIND_QUIETLY) + ENDIF(NOT KDE4_FIND_QUIETLY) RETURN() ENDIF(KDE4_FIND_REQUIRED) ENDIF(QT_QT_LIBRARY) diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake index 42c554ce3..c5efc721b 100644 --- a/Modules/FindLibXml2.cmake +++ b/Modules/FindLibXml2.cmake @@ -21,20 +21,22 @@ ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) IF (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls - INCLUDE(UsePkgConfig) - PKGCONFIG(libxml-2.0 _LibXml2IncDir _LibXml2LinkDir _LibXml2LinkFlags _LibXml2Cflags) - SET(LIBXML2_DEFINITIONS ${_LibXml2Cflags}) + FIND_PACKAGE(PkgConfig) + PKG_CHECK_MODULES(PC_LIBXML libxml-2.0) + SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) ENDIF (NOT WIN32) FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h - PATHS - ${_LibXml2IncDir} + HINTS + ${PC_LIBXML_INCLUDEDIR} + ${PC_LIBXML_INCLUDE_DIRS} PATH_SUFFIXES libxml2 ) FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2 - PATHS - ${_LibXml2LinkDir} + HINTS + ${PC_LIBXML_LIBDIR} + ${PC_LIBXML_LIBRARY_DIRS} ) FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint) diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake index 6da7aa134..6d952c4f1 100644 --- a/Modules/FindLua50.cmake +++ b/Modules/FindLua50.cmake @@ -28,7 +28,7 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h ) FIND_LIBRARY(LUA_LIBRARY_lua - NAMES lua50 lua5.0 lua5 lua + NAMES lua50 lua5.0 lua-5.0 lua5 lua HINTS $ENV{LUA_DIR} PATH_SUFFIXES lib64 lib diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake index 5f50ec2ca..2be4a0132 100644 --- a/Modules/FindLua51.cmake +++ b/Modules/FindLua51.cmake @@ -28,7 +28,7 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h ) FIND_LIBRARY(LUA_LIBRARY - NAMES lua51 lua5.1 lua + NAMES lua51 lua5.1 lua-5.1 lua HINTS $ENV{LUA_DIR} PATH_SUFFIXES lib64 lib diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake index 7e3bcc118..ada220561 100644 --- a/Modules/FindMFC.cmake +++ b/Modules/FindMFC.cmake @@ -1,19 +1,47 @@ # - Find MFC on Windows -# Find the native MFC - i.e. decide if this is an MS VC box. +# Find the native MFC - i.e. decide if an application can link to the MFC +# libraries. # MFC_FOUND - Was MFC support found # You don't need to include anything or link anything to use it. # Assume no MFC support -SET( MFC_FOUND "NO" ) -# Add MFC support if win32 and not cygwin and not borland -IF( WIN32 ) - IF( NOT CYGWIN ) - IF( NOT BORLAND ) - IF( NOT MINGW ) - SET( MFC_FOUND "YES" ) - ENDIF( NOT MINGW ) - ENDIF( NOT BORLAND ) - ENDIF( NOT CYGWIN ) -ENDIF( WIN32 ) +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/FindMPEG2.cmake b/Modules/FindMPEG2.cmake index 0ce75f5cd..1aa791346 100644 --- a/Modules/FindMPEG2.cmake +++ b/Modules/FindMPEG2.cmake @@ -31,7 +31,7 @@ IF(MPEG2_FOUND) #some native mpeg2 installations will depend #on libSDL, if found, add it in. - INCLUDE( FindSDL.cmake ) + INCLUDE( FindSDL ) IF(SDL_FOUND) SET( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY}) ENDIF(SDL_FOUND) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake new file mode 100755 index 000000000..848f57ff9 --- /dev/null +++ b/Modules/FindOpenMP.cmake @@ -0,0 +1,108 @@ +# - 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 2008, 2009 Andre.Brodtkorb@ifi.uio.no +# +# Redistribution AND use is allowed according to the terms of the New +# BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) +include(FindPackageHandleStandardArgs) + +set(OpenMP_C_FLAG_CANDIDATES + #Gnu + "-fopenmp" + #Microsoft Visual Studio + "/openmp" + #Intel windows + "-Qopenmp" + #Intel + "-openmp" + #Empty, if compiler automatically accepts openmp + " " + #Sun + "-xopenmp" + #HP + "+Oopenmp" + #IBM XL C/c++ + "-qsmp" + #Portland Group + "-mp" +) +set(OpenMP_CXX_FLAG_CANDIDATES ${OpenMP_C_FLAG_CANDIDATES}) + +# sample openmp source code to test +set(OpenMP_C_TEST_SOURCE +" +#include +int main() { +#ifdef _OPENMP + return 0; +#else + breaks_on_purpose +#endif +} +") +# use the same source for CXX as C for now +set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE}) +# if these are set then do not try to find them again, +# by avoiding any try_compiles for the flags +if(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS) + set(OpenMP_C_FLAG_CANDIDATES) + set(OpenMP_CXX_FLAG_CANDIDATES) +endif(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS) + +# check c compiler +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_CXX_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}) + +# check cxx compiler +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_C_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_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}" + CACHE STRING "C compiler flags for OpenMP parallization") + +set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}" + CACHE STRING "C++ compiler flags for OpenMP parallization") +# handle the standard arguments for find_package +find_package_handle_standard_args(OpenMP DEFAULT_MSG + OpenMP_C_FLAGS OpenMP_CXX_FLAGS ) + +mark_as_advanced( + OpenMP_C_FLAGS + OpenMP_CXX_FLAGS +) diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake new file mode 100644 index 000000000..7bdd2b28c --- /dev/null +++ b/Modules/FindOpenSceneGraph.cmake @@ -0,0 +1,213 @@ +# - Find OpenSceneGraph +# This module searches for the OpenSceneGraph core "osg" library as well as +# OpenThreads, and whatever additional COMPONENTS that you specify. +# See http://www.openscenegraph.org +# +# NOTE: If you would like to use this module in your CMAKE_MODULE_PATH instead +# of requiring CMake >= 2.6.3, you will also need to download +# FindOpenThreads.cmake, Findosg_functions.cmake, Findosg.cmake, as well as +# files for any Components you need to call (FindosgDB.cmake, +# FindosgUtil.cmake, etc.) +# +#================================== +# +# 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). +# +# _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 COMPONENTS osgDB osgUtil) +# include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}) +# +# add_executable(foo foo.cc) +# target_link_libraries(foo ${OPENSCENEGRAPH_LIBRARIES}) +# +#================================== +# +# Naming convention: +# Local variables of the form _osg_foo +# Input variables of the form OpenSceneGraph_FOO +# Output variables of the form OPENSCENEGRAPH_FOO +# +# Copyright (c) 2009, Philip Lowman +# +# Redistribution AND use is allowed according to the terms of the New +# BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# +#================================== + +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("[ 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("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}") + endif() + + file(READ "${OSG_INCLUDE_DIR}/osg/Version" _osg_Version_contents) + + 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("[ 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("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Detected version ${OPENSCENEGRAPH_VERSION}") + endif() +endif() + +# +# Version checking +# +if(OpenSceneGraph_FIND_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_required) +set(_osg_quiet) +if(OpenSceneGraph_FIND_REQUIRED) + set(_osg_required "REQUIRED") +endif() +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("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Calling find_package(${_osg_module} ${_osg_required} ${_osg_quiet})") + endif() + find_package(${_osg_module} ${_osg_required} ${_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() + # If the version was OK, we should hit this case where we can do the + # typical user notifications + include(FindPackageHandleStandardArgs) + 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 index 75fdbdd36..3fe44b576 100644 --- a/Modules/FindOpenThreads.cmake +++ b/Modules/FindOpenThreads.cmake @@ -38,108 +38,73 @@ # standard install paths. # Explicit -DVAR=value arguments should still be able to override everything. -FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread +find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread HINTS - $ENV{OPENTHREADS_INCLUDE_DIR} - $ENV{OPENTHREADS_DIR}/include - $ENV{OPENTHREADS_DIR} - $ENV{OSG_INCLUDE_DIR} - $ENV{OSG_DIR}/include - $ENV{OSG_DIR} - $ENV{OSGDIR}/include - $ENV{OSGDIR} + # 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 - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include - /usr/include - /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 + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + /usr/freeware + PATH_SUFFIXES include ) -FIND_LIBRARY(OPENTHREADS_LIBRARY +find_library(OPENTHREADS_LIBRARY NAMES OpenThreads OpenThreadsWin32 HINTS - $ENV{OPENTHREADS_LIBRARY_DIR} - $ENV{OPENTHREADS_DIR}/lib64 - $ENV{OPENTHREADS_DIR}/lib - $ENV{OPENTHREADS_DIR} - $ENV{OSG_LIBRARY_DIR} - $ENV{OSG_DIR}/lib64 - $ENV{OSG_DIR}/lib - $ENV{OSG_DIR} - $ENV{OSGDIR}/lib64 - $ENV{OSGDIR}/lib - $ENV{OSGDIR} + $ENV{OPENTHREADS_LIBRARY_DIR} + $ENV{OPENTHREADS_DIR} + $ENV{OSG_LIBRARY_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OpenThreads_ROOT} + $ENV{OSG_ROOT} PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local/lib64 - /usr/local/lib - /usr/lib64 - /usr/lib - /sw/lib64 - /sw/lib - /opt/local/lib64 - /opt/local/lib - /opt/csw/lib64 - /opt/csw/lib - /opt/lib64 - /opt/lib - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]/lib - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib + /sw + /opt/local + /opt/csw + /opt + /usr/freeware + PATH_SUFFIXES lib64 lib ) - -FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG +find_library(OPENTHREADS_LIBRARY_DEBUG NAMES OpenThreadsd OpenThreadsWin32d HINTS - $ENV{OPENTHREADS_DEBUG_LIBRARY_DIR} - $ENV{OPENTHREADS_LIBRARY_DIR} - $ENV{OPENTHREADS_DIR}/lib64 - $ENV{OPENTHREADS_DIR}/lib - $ENV{OPENTHREADS_DIR} - $ENV{OSG_LIBRARY_DIR} - $ENV{OSG_DIR}/lib64 - $ENV{OSG_DIR}/lib - $ENV{OSG_DIR} - $ENV{OSGDIR}/lib64 - $ENV{OSGDIR}/lib - $ENV{OSGDIR} + $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 - /usr/local/lib64 - /usr/local/lib - /usr/lib64 - /usr/lib - /sw/lib64 - /sw/lib - /opt/local/lib64 - /opt/local/lib - /opt/csw/lib64 - /opt/csw/lib - /opt/lib64 - /opt/lib - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]/lib - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib + /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() -IF(OPENTHREADS_LIBRARY) - IF(NOT OPENTHREADS_LIBRARY_DEBUG) - #MESSAGE("-- Warning Debug OpenThreads not found, using: ${OPENTHREADS_LIBRARY}") - #SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}") - SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}" CACHE FILEPATH "Debug version of OpenThreads Library (use regular version if not available)" FORCE) - ENDIF(NOT OPENTHREADS_LIBRARY_DEBUG) -ENDIF(OPENTHREADS_LIBRARY) - -SET(OPENTHREADS_FOUND "NO") -IF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY) - SET(OPENTHREADS_FOUND "YES") - # MESSAGE("-- Found OpenThreads: "${OPENTHREADS_LIBRARY}) -ENDIF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY) - +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenThreads DEFAULT_MSG + OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR) diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake index 884af6ec9..50a5629ad 100644 --- a/Modules/FindPerlLibs.cmake +++ b/Modules/FindPerlLibs.cmake @@ -22,8 +22,9 @@ SET(PERL_POSSIBLE_LIB_PATHS FIND_PATH(PERL_INCLUDE_PATH perl.h ${PERL_POSSIBLE_INCLUDE_PATHS}) +# find the perl executable +INCLUDE(FindPerl) -FIND_PROGRAM(PERL_EXECUTABLE perl ) IF(PERL_EXECUTABLE) EXEC_PROGRAM(${PERL_EXECUTABLE} diff --git a/Modules/FindProducer.cmake b/Modules/FindProducer.cmake index db51d3a94..d8151ef6f 100644 --- a/Modules/FindProducer.cmake +++ b/Modules/FindProducer.cmake @@ -64,9 +64,6 @@ FIND_LIBRARY(PRODUCER_LIBRARY /opt ) -SET(PRODUCER_FOUND "NO") -IF(PRODUCER_LIBRARY AND PRODUCER_INCLUDE_DIR) - SET(PRODUCER_FOUND "YES") -ENDIF(PRODUCER_LIBRARY AND PRODUCER_INCLUDE_DIR) - - +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Producer DEFAULT_MSG + PRODUCER_LIBRARY PRODUCER_INCLUDE_DIR) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 5074c6928..82ebd98c2 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -9,6 +9,7 @@ FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath] diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 8280fdf4e..16ce8451a 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -177,7 +177,6 @@ # You do not need to use these variables if you include QT_USE_FILE. # # QT_INCLUDE_DIR Path to "include" of Qt4 -# QT_QT_INCLUDE_DIR Path to "include/Qt" # QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support" # QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant" # QT_QTCORE_INCLUDE_DIR Path to "include/QtCore" @@ -200,9 +199,12 @@ # QT_QTXMLPATTERNS_INCLUDE_DIR Path to "include/QtXmlPatterns" # QT_PHONON_INCLUDE_DIR Path to "include/phonon" # +# 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_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. @@ -244,9 +246,6 @@ # QT_LUPDATE_EXECUTABLE Where to find the lupdate tool. # QT_LRELEASE_EXECUTABLE Where to find the lrelease tool. # -# QT_DOC_DIR Path to "doc" of Qt4 -# QT_MKSPECS_DIR Path to "mkspecs" of Qt4 -# # # These are around for backwards compatibility # they will be set @@ -321,6 +320,12 @@ FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 PATHS IF (QT_QMAKE_EXECUTABLE) + IF(QT_QMAKE_EXECUTABLE_LAST AND NOT QT_QMAKE_EXECUTABLE_LAST MATCHES "^${QT_QMAKE_EXECUTABLE}$") + SET(QT_QMAKE_CHANGED 1) + ENDIF(QT_QMAKE_EXECUTABLE_LAST AND NOT QT_QMAKE_EXECUTABLE_LAST MATCHES "^${QT_QMAKE_EXECUTABLE}$") + + SET(QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE) + SET(QT4_QMAKE_FOUND FALSE) EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) @@ -386,65 +391,65 @@ IF (QT4_QMAKE_FOUND) # ask qmake for the library dir # Set QT_LIBRARY_DIR - IF (NOT QT_LIBRARY_DIR) + IF (NOT QT_LIBRARY_DIR OR QT_QMAKE_CHANGED) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_LIBS" OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${QT_LIBRARY_DIR_TMP}" QT_LIBRARY_DIR_TMP) IF(EXISTS "${QT_LIBRARY_DIR_TMP}") - SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir") + SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir" FORCE) ELSE(EXISTS "${QT_LIBRARY_DIR_TMP}") MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}") MESSAGE("Warning: ${QT_LIBRARY_DIR_TMP} does NOT exist, Qt must NOT be installed correctly.") ENDIF(EXISTS "${QT_LIBRARY_DIR_TMP}") - ENDIF(NOT QT_LIBRARY_DIR) + ENDIF(NOT QT_LIBRARY_DIR OR QT_QMAKE_CHANGED) IF (APPLE) IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) SET(QT_USE_FRAMEWORKS ON - CACHE BOOL "Set to ON if Qt build uses frameworks.") + CACHE BOOL "Set to ON if Qt build uses frameworks." FORCE) ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) SET(QT_USE_FRAMEWORKS OFF - CACHE BOOL "Set to ON if Qt build uses frameworks.") + CACHE BOOL "Set to ON if Qt build uses frameworks." FORCE) ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) MARK_AS_ADVANCED(QT_USE_FRAMEWORKS) ENDIF (APPLE) # ask qmake for the binary dir - IF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR) + IF ((QT_LIBRARY_DIR AND NOT QT_BINARY_DIR) OR QT_QMAKE_CHANGED) EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_BINS" OUTPUT_VARIABLE qt_bins ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_bins}" qt_bins) - SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "") - ENDIF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR) + SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE) + ENDIF ((QT_LIBRARY_DIR AND NOT QT_BINARY_DIR) OR QT_QMAKE_CHANGED) # ask qmake for the include dir - IF (QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR) + IF ((QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR) OR QT_QMAKE_CHANGED) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_HEADERS" OUTPUT_VARIABLE qt_headers ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_headers}" qt_headers) - SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "") - ENDIF(QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR) + SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "" FORCE) + ENDIF ((QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR) OR QT_QMAKE_CHANGED) # ask qmake for the documentation directory - IF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR) + IF ((QT_LIBRARY_DIR AND NOT QT_DOC_DIR) OR QT_QMAKE_CHANGED) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_DOCS" OUTPUT_VARIABLE qt_doc_dir ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_doc_dir}" qt_doc_dir) - SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs") - ENDIF (QT_LIBRARY_DIR AND NOT 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 mkspecs directory - IF (QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR) + IF ((QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR) OR QT_QMAKE_CHANGED) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QMAKE_MKSPECS" OUTPUT_VARIABLE qt_mkspecs_dirs ) @@ -453,48 +458,119 @@ IF (QT4_QMAKE_FOUND) IF(UNIX) STRING(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}") ENDIF(UNIX) + SET(QT_MKSPECS_DIR NOTFOUND) FIND_PATH(QT_MKSPECS_DIR qconfig.pri PATHS ${qt_mkspecs_dirs} DOC "The location of the Qt mkspecs containing qconfig.pri" NO_DEFAULT_PATH ) - ENDIF (QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR) + ENDIF ((QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR) OR QT_QMAKE_CHANGED) # ask qmake for the plugins directory - IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR) + IF ((QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR) OR QT_QMAKE_CHANGED) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_PLUGINS" OUTPUT_VARIABLE qt_plugins_dir ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_plugins_dir}" qt_plugins_dir) - SET(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins") - ENDIF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR) + SET(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins" FORCE) + 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) + EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} + ARGS "-query QT_INSTALL_TRANSLATIONS" + OUTPUT_VARIABLE qt_translations_dir ) + # make sure we have / and not \ as qmake gives on windows + FILE(TO_CMAKE_PATH "${qt_translations_dir}" 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) + ######################################## # # Setting the INCLUDE-Variables # ######################################## - FIND_PATH(QT_QTCORE_INCLUDE_DIR QtGlobal + SET(QT_MODULES QtCore QtGui Qt3Support QtSvg QtScript QtTest QtUiTools + QtHelp QtWebKit QtXmlPatterns phonon QtMotif QtNetwork + QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus) + + 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) + 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 + ) + ENDFOREACH(QT_MODULE) + + # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR + FIND_PATH(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents PATHS - ${QT_HEADERS_DIR}/QtCore - ${QT_LIBRARY_DIR}/QtCore.framework/Headers + ${QT_HEADERS_DIR}/QtDesigner + ${QT_LIBRARY_DIR}/QtDesigner.framework/Headers NO_DEFAULT_PATH ) - + + # Set QT_QTASSISTANT_INCLUDE_DIR + FIND_PATH(QT_QTASSISTANT_INCLUDE_DIR QAssistantClient + PATHS + ${QT_HEADERS_DIR}/QtAssistant + ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers + NO_DEFAULT_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 + ) + # Set QT_INCLUDE_DIR by removine "/QtCore" in the string ${QT_QTCORE_INCLUDE_DIR} IF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) IF (QT_USE_FRAMEWORKS) SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR}) ELSE (QT_USE_FRAMEWORKS) STRING( REGEX REPLACE "/QtCore$" "" qt4_include_dir ${QT_QTCORE_INCLUDE_DIR}) - SET( QT_INCLUDE_DIR ${qt4_include_dir} CACHE PATH "") + SET( QT_INCLUDE_DIR ${qt4_include_dir}) ENDIF (QT_USE_FRAMEWORKS) ENDIF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) IF( NOT QT_INCLUDE_DIR) IF(Qt4_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "Could NOT find QtGlobal header") + MESSAGE( FATAL_ERROR "Could NOT find QtCore header") ENDIF(Qt4_FIND_REQUIRED) ENDIF( NOT QT_INCLUDE_DIR) + + # Make variables changeble to the advanced user + MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_INCLUDE_DIR QT_DOC_DIR QT_MKSPECS_DIR + QT_PLUGINS_DIR QT_TRANSLATIONS_DIR) + + # Set QT_INCLUDES + SET( QT_INCLUDES ${QT_MKSPECS_DIR}/default ${QT_INCLUDE_DIR} ) + ############################################# # @@ -515,6 +591,9 @@ IF (QT4_QMAKE_FOUND) CHECK_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN) CHECK_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS) CHECK_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC) + IF(Q_WS_MAC) + CHECK_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA) + ENDIF(Q_WS_MAC) IF (QT_QTCOPY_REQUIRED) CHECK_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY) @@ -529,252 +608,25 @@ IF (QT4_QMAKE_FOUND) # ############################################# - # Set QT_QT3SUPPORT_INCLUDE_DIR - FIND_PATH(QT_QT3SUPPORT_INCLUDE_DIR Qt3Support - PATHS - ${QT_INCLUDE_DIR}/Qt3Support - ${QT_LIBRARY_DIR}/Qt3Support.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QT_INCLUDE_DIR - FIND_PATH(QT_QT_INCLUDE_DIR qglobal.h - PATHS - ${QT_INCLUDE_DIR}/Qt - ${QT_LIBRARY_DIR}/QtCore.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTGUI_INCLUDE_DIR - FIND_PATH(QT_QTGUI_INCLUDE_DIR QtGui - PATHS - ${QT_INCLUDE_DIR}/QtGui - ${QT_LIBRARY_DIR}/QtGui.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTSVG_INCLUDE_DIR - FIND_PATH(QT_QTSVG_INCLUDE_DIR QtSvg - PATHS - ${QT_INCLUDE_DIR}/QtSvg - ${QT_LIBRARY_DIR}/QtSvg.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTSCRIPT_INCLUDE_DIR - FIND_PATH(QT_QTSCRIPT_INCLUDE_DIR QtScript - PATHS - ${QT_INCLUDE_DIR}/QtScript - ${QT_LIBRARY_DIR}/QtScript.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTTEST_INCLUDE_DIR - FIND_PATH(QT_QTTEST_INCLUDE_DIR QtTest - PATHS - ${QT_INCLUDE_DIR}/QtTest - ${QT_LIBRARY_DIR}/QtTest.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTUITOOLS_INCLUDE_DIR - FIND_PATH(QT_QTUITOOLS_INCLUDE_DIR QtUiTools - PATHS - ${QT_INCLUDE_DIR}/QtUiTools - ${QT_LIBRARY_DIR}/QtUiTools.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTMOTIF_INCLUDE_DIR - IF(Q_WS_X11) - FIND_PATH(QT_QTMOTIF_INCLUDE_DIR QtMotif - PATHS - ${QT_INCLUDE_DIR}/QtMotif - NO_DEFAULT_PATH ) - ENDIF(Q_WS_X11) - - # Set QT_QTNETWORK_INCLUDE_DIR - FIND_PATH(QT_QTNETWORK_INCLUDE_DIR QtNetwork - PATHS - ${QT_INCLUDE_DIR}/QtNetwork - ${QT_LIBRARY_DIR}/QtNetwork.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTNSPLUGIN_INCLUDE_DIR - FIND_PATH(QT_QTNSPLUGIN_INCLUDE_DIR QtNsPlugin - PATHS - ${QT_INCLUDE_DIR}/QtNsPlugin - ${QT_LIBRARY_DIR}/QtNsPlugin.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTOPENGL_INCLUDE_DIR - FIND_PATH(QT_QTOPENGL_INCLUDE_DIR QtOpenGL - PATHS - ${QT_INCLUDE_DIR}/QtOpenGL - ${QT_LIBRARY_DIR}/QtOpenGL.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTSQL_INCLUDE_DIR - FIND_PATH(QT_QTSQL_INCLUDE_DIR QtSql - PATHS - ${QT_INCLUDE_DIR}/QtSql - ${QT_LIBRARY_DIR}/QtSql.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTXML_INCLUDE_DIR - FIND_PATH(QT_QTXML_INCLUDE_DIR QtXml - PATHS - ${QT_INCLUDE_DIR}/QtXml - ${QT_LIBRARY_DIR}/QtXml.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTASSISTANT_INCLUDE_DIR - FIND_PATH(QT_QTASSISTANT_INCLUDE_DIR QtAssistant - PATHS - ${QT_INCLUDE_DIR}/QtAssistant - ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTDESIGNER_INCLUDE_DIR - FIND_PATH(QT_QTDESIGNER_INCLUDE_DIR QDesignerComponents - PATHS - ${QT_INCLUDE_DIR}/QtDesigner - ${QT_LIBRARY_DIR}/QtDesigner.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR - FIND_PATH(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents - PATHS - ${QT_INCLUDE_DIR}/QtDesigner - ${QT_LIBRARY_DIR}/QtDesigner.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTDBUS_INCLUDE_DIR - FIND_PATH(QT_QTDBUS_INCLUDE_DIR QtDBus - PATHS - ${QT_INCLUDE_DIR}/QtDBus - ${QT_LIBRARY_DIR}/QtDBus.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTASSISTANTCLIENT_INCLUDE_DIR - FIND_PATH(QT_QTASSISTANTCLIENT_INCLUDE_DIR QAssistantClient - PATHS - ${QT_INCLUDE_DIR}/QtAssistant - ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTHELP_INCLUDE_DIR - FIND_PATH(QT_QTHELP_INCLUDE_DIR QtHelp - PATHS - ${QT_INCLUDE_DIR}/QtHelp - ${QT_LIBRARY_DIR}/QtHelp.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTWEBKIT_INCLUDE_DIR - FIND_PATH(QT_QTWEBKIT_INCLUDE_DIR QtWebKit - PATHS - ${QT_INCLUDE_DIR}/QtWebKit - ${QT_LIBRARY_DIR}/QtWebKit.framework/Headers - NO_DEFAULT_PATH - ) - - # Set QT_QTXMLPATTERNS_INCLUDE_DIR - FIND_PATH(QT_QTXMLPATTERNS_INCLUDE_DIR QtXmlPatterns - PATHS - ${QT_INCLUDE_DIR}/QtXmlPatterns - ${QT_LIBRARY_DIR}/QtXmlPatterns.framework/Headers - NO_DEFAULT_PATH - ) - # Set QT_PHONON_INCLUDE_DIR - FIND_PATH(QT_PHONON_INCLUDE_DIR phonon - PATHS - ${QT_INCLUDE_DIR}/phonon - ${QT_LIBRARY_DIR}/phonon.framework/Headers - NO_DEFAULT_PATH - ) - - # Make variables changeble to the advanced user - MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_INCLUDE_DIR QT_QT_INCLUDE_DIR QT_DOC_DIR QT_MKSPECS_DIR QT_PLUGINS_DIR) - - # Set QT_INCLUDES - SET( QT_INCLUDES ${QT_QT_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default ${QT_INCLUDE_DIR} ) - - # Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore." as part of the filename - FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE NAMES QtCore QtCore4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH ) - FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore_debug QtCored QtCored4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QT3SUPPORT_LIBRARY - FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_RELEASE NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG NAMES Qt3Support_debug Qt3Supportd Qt3Supportd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QTGUI_LIBRARY - FIND_LIBRARY(QT_QTGUI_LIBRARY_RELEASE NAMES QtGui QtGui4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG NAMES QtGui_debug QtGuid QtGuid4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QTMOTIF_LIBRARY - IF(Q_WS_X11) - FIND_LIBRARY(QT_QTMOTIF_LIBRARY_RELEASE NAMES QtMotif PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTMOTIF_LIBRARY_DEBUG NAMES QtMotif_debug PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - ENDIF(Q_WS_X11) - - # Set QT_QTNETWORK_LIBRARY - FIND_LIBRARY(QT_QTNETWORK_LIBRARY_RELEASE NAMES QtNetwork QtNetwork4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG NAMES QtNetwork_debug QtNetworkd QtNetworkd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QTNSPLUGIN_LIBRARY - FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_RELEASE NAMES QtNsPlugin PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_DEBUG NAMES QtNsPlugin_debug PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QTOPENGL_LIBRARY - FIND_LIBRARY(QT_QTOPENGL_LIBRARY_RELEASE NAMES QtOpenGL QtOpenGL4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG NAMES QtOpenGL_debug QtOpenGLd QtOpenGLd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QTSQL_LIBRARY - FIND_LIBRARY(QT_QTSQL_LIBRARY_RELEASE NAMES QtSql QtSql4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG NAMES QtSql_debug QtSqld QtSqld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QTXML_LIBRARY - FIND_LIBRARY(QT_QTXML_LIBRARY_RELEASE NAMES QtXml QtXml4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG NAMES QtXml_debug QtXmld QtXmld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QTSVG_LIBRARY - FIND_LIBRARY(QT_QTSVG_LIBRARY_RELEASE NAMES QtSvg QtSvg4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTSVG_LIBRARY_DEBUG NAMES QtSvg_debug QtSvgd QtSvgd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + # 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_MODULE}4 + PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH + ) + FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_DEBUG + NAMES ${QT_MODULE}_debug ${QT_MODULE}d ${QT_MODULE}d4 + PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH + ) + ENDFOREACH(QT_MODULE) - # Set QT_QTUITOOLS_LIBRARY - FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools QtUiTools4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_DEBUG NAMES QtUiTools_debug QtUiToolsd QtUiToolsd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # QtUiTools not with other frameworks with binary installation (in /usr/lib) IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE) FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools PATHS ${QT_LIBRARY_DIR}) ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE) - # Set QT_QTTEST_LIBRARY - FIND_LIBRARY(QT_QTTEST_LIBRARY_RELEASE NAMES QtTest QtTest4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTTEST_LIBRARY_DEBUG NAMES QtTest_debug QtTestd QtTestd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QTDBUS_LIBRARY - # This was introduced with Qt 4.2, where also the naming scheme for debug libs was changed - # So does any of the debug lib names listed here actually exist ? - FIND_LIBRARY(QT_QTDBUS_LIBRARY_RELEASE NAMES QtDBus QtDBus4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTDBUS_LIBRARY_DEBUG NAMES QtDBus_debug QtDBusd QtDBusd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QTSCRIPT_LIBRARY - FIND_LIBRARY(QT_QTSCRIPT_LIBRARY_RELEASE NAMES QtScript QtScript4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTSCRIPT_LIBRARY_DEBUG NAMES QtScript_debug QtScriptd QtScriptd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - IF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE ) # try dropping a hint if trying to use Visual Studio with Qt built by mingw @@ -789,14 +641,6 @@ IF (QT4_QMAKE_FOUND) ENDIF(Qt4_FIND_REQUIRED) ENDIF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE ) - # Set QT_QTASSISTANT_LIBRARY - FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient QtAssistantClient4 QtAssistant QtAssistant4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClientd QtAssistantClientd4 QtAssistantClient_debug QtAssistant_debug QtAssistantd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QTDESIGNER_LIBRARY - FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_RELEASE NAMES QtDesigner QtDesigner4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG NAMES QtDesigner_debug QtDesignerd QtDesignerd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - # Set QT_QTDESIGNERCOMPONENTS_LIBRARY FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents QtDesignerComponents4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents_debug QtDesignerComponentsd QtDesignerComponentsd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) @@ -812,10 +656,12 @@ IF (QT4_QMAKE_FOUND) # Set QT_QTASSISTANTCLIENT_LIBRARY FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient QtAssistantClient4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient_debug QtAssistantClientd QtAssistantClientd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTASSISTANT_LIBRARY + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient QtAssistantClient4 QtAssistant QtAssistant4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient_debug QtAssistantClientd QtAssistantClientd4 QtAssistant_debug QtAssistantd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTHELP_LIBRARY - FIND_LIBRARY(QT_QTHELP_LIBRARY_RELEASE NAMES QtHelp QtHelp4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTHELP_LIBRARY_DEBUG NAMES QtHelp_debug QtHelpd QtHelpd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene QtCLucene4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene_debug QtCLucened QtCLucened4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # QtCLucene not with other frameworks with binary installation (in /usr/lib) @@ -823,18 +669,6 @@ IF (QT4_QMAKE_FOUND) FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene PATHS ${QT_LIBRARY_DIR}) ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE) - # Set QT_QTWEBKIT_LIBRARY - FIND_LIBRARY(QT_QTWEBKIT_LIBRARY_RELEASE NAMES QtWebKit QtWebKit4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTWEBKIT_LIBRARY_DEBUG NAMES QtWebKit_debug QtWebKitd QtWebKitd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_QTXMLPATTERNS_LIBRARY - FIND_LIBRARY(QT_QTXMLPATTERNS_LIBRARY_RELEASE NAMES QtXmlPatterns QtXmlPatterns4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTXMLPATTERNS_LIBRARY_DEBUG NAMES QtXmlPatterns_debug QtXmlPatternsd QtXmlPatternsd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - - # Set QT_PHONON_LIBRARY - FIND_LIBRARY(QT_PHONON_LIBRARY_RELEASE NAMES phonon phonon4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_PHONON_LIBRARY_DEBUG NAMES phonon_debug phonond phonond4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - ############################################ # # Check the existence of the libraries. @@ -871,7 +705,11 @@ IF (QT4_QMAKE_FOUND) SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE FILEPATH "The Qt ${basename} library") + IF(QT_QMAKE_CHANGED) + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE FILEPATH "The Qt ${basename} library" FORCE) + ELSE(QT_QMAKE_CHANGED) + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE FILEPATH "The Qt ${basename} library") + ENDIF(QT_QMAKE_CHANGED) IF (QT_${basename}_LIBRARY) SET(QT_${basename}_FOUND 1) @@ -913,11 +751,9 @@ IF (QT4_QMAKE_FOUND) _QT4_ADJUST_LIB_VARS(QTXMLPATTERNS) _QT4_ADJUST_LIB_VARS(PHONON) _QT4_ADJUST_LIB_VARS(QTCLUCENE) + _QT4_ADJUST_LIB_VARS(QTMOTIF) # platform dependent libraries - IF(Q_WS_X11) - _QT4_ADJUST_LIB_VARS(QTMOTIF) - ENDIF(Q_WS_X11) IF(WIN32) _QT4_ADJUST_LIB_VARS(QTMAIN) ENDIF(WIN32) @@ -942,10 +778,26 @@ IF (QT4_QMAKE_FOUND) FILE(TO_CMAKE_PATH "${QT_UIC_EXECUTABLE_INTERNAL}" QT_UIC_EXECUTABLE_INTERNAL) - SET(QT_MOC_EXECUTABLE - ${QT_MOC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The moc executable") - SET(QT_UIC_EXECUTABLE - ${QT_UIC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The uic executable") + IF(QT_QMAKE_CHANGED) + SET(QT_MOC_EXECUTABLE + ${QT_MOC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The moc executable" FORCE) + SET(QT_UIC_EXECUTABLE + ${QT_UIC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The uic executable" FORCE) + ELSE(QT_QMAKE_CHANGED) + SET(QT_MOC_EXECUTABLE + ${QT_MOC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The moc executable") + SET(QT_UIC_EXECUTABLE + ${QT_UIC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The uic executable") + ENDIF(QT_QMAKE_CHANGED) + + IF(QT_QMAKE_CHANGED) + 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) + ENDIF(QT_QMAKE_CHANGED) FIND_PROGRAM(QT_UIC3_EXECUTABLE NAMES uic3 @@ -1027,12 +879,14 @@ IF (QT4_QMAKE_FOUND) SET(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR}) IF(_infileLength GREATER _binlength) STRING(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile) - ENDIF(_infileLength GREATER _binlength) - IF(CMAKE_CURRENT_BINARY_DIR MATCHES "${_checkinfile}") - FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile}) - ELSE(CMAKE_CURRENT_BINARY_DIR MATCHES "${_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(CMAKE_CURRENT_BINARY_DIR MATCHES "${_checkinfile}") + ENDIF(_infileLength GREATER _binlength) SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}") STRING(REPLACE ".." "__" _outfile ${_outfile}) GET_FILENAME_COMPONENT(outpath ${_outfile} PATH) @@ -1277,7 +1131,7 @@ IF (QT4_QMAKE_FOUND) GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH) - STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}") + STRING(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]" _match "${_contents}") IF(_match) FOREACH (_current_MOC_INC ${_match}) STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") @@ -1294,24 +1148,36 @@ IF (QT4_QMAKE_FOUND) MACRO(QT4_CREATE_TRANSLATION _qm_files) QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options ${ARGN}) - MESSAGE("lupdate_files ${_lupdate_files}") - MESSAGE("lupdate_options ${_lupdate_options}") 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") - LIST(APPEND _my_sources ${_abs_FILE}) + 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) + STRING(REPLACE ";" " " _pro_srcs "${_my_sources}") + FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}") + ENDIF(_my_sources) ADD_CUSTOM_COMMAND(OUTPUT ${_ts_file} COMMAND ${QT_LUPDATE_EXECUTABLE} - ARGS ${_lupdate_options} ${_my_sources} -ts ${_ts_file} - DEPENDS ${_my_sources}) + ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file} + DEPENDS ${_my_sources} ${_ts_pro}) ENDFOREACH(_ts_file) QT4_ADD_TRANSLATION(${_qm_files} ${_my_tsfiles}) ENDMACRO(QT4_CREATE_TRANSLATION) @@ -1523,8 +1389,8 @@ IF (QT4_QMAKE_FOUND) ENDIF(OPENSSL_LIBRARIES) ENDIF(QT_QCONFIG MATCHES "openssl" AND NOT Q_WS_WIN) - ## qdbus - IF(QT_QCONFIG MATCHES "qdbus") + ## dbus + IF(QT_QCONFIG MATCHES "dbus") # if the dbus library isn't found, we'll assume its not required to build # shared Qt on Linux doesn't require it @@ -1550,7 +1416,7 @@ IF (QT4_QMAKE_FOUND) MARK_AS_ADVANCED(QT_DBUS_LIBRARY) ENDIF(NOT QT_DBUS_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "qdbus") + ENDIF(QT_QCONFIG MATCHES "dbus") ## glib IF(QT_QCONFIG MATCHES "glib") @@ -1574,15 +1440,16 @@ IF (QT4_QMAKE_FOUND) FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0 PATHS ${_glib_query_output} ) FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0 PATHS ${_glib_query_output} ) - - 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) - + MARK_AS_ADVANCED(QT_GLIB_LIBRARY) MARK_AS_ADVANCED(QT_GTHREAD_LIBRARY) ENDIF(NOT QT_GLIB_LIBRARY OR NOT 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) + ENDIF(QT_QCONFIG MATCHES "glib") ## clock-monotonic, just see if we need to link with rt diff --git a/Modules/FindRTI.cmake b/Modules/FindRTI.cmake new file mode 100644 index 000000000..3bfa72d31 --- /dev/null +++ b/Modules/FindRTI.cmake @@ -0,0 +1,88 @@ +# - 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 standartized 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 + +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(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(RTI DEFAULT_MSG + RTI_LIBRARY RTI_INCLUDE_DIR) + +# $Id: FindRTI.cmake,v 1.3.2.2 2009-02-04 16:44:12 hoffman Exp $ diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake new file mode 100644 index 000000000..d51a04b8a --- /dev/null +++ b/Modules/FindSquish.cmake @@ -0,0 +1,119 @@ +# +# ---- 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_VERSION_MAJOR The major version of Squish found +# SQUISH_VERSION_MINOR The minor version of Squish found +# SQUISH_VERSION_PATCH The patch version of Squish found +# +# SQUISH_INSTALL_DIR The Squish installation directory (containing bin, lib, etc) +# SQUISH_SERVER_EXECUTABLE The squishserver executable +# SQUISH_CLIENT_EXECUTABLE The squishrunner executable +# +# SQUISH_INSTALL_DIR_FOUND Was the install directory found? +# SQUISH_SERVER_EXECUTABLE_FOUND Was the server executable found? +# SQUISH_CLIENT_EXECUTABLE_FOUND Was the client executable found? +# +# 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) +# + +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. + IF(UNIX) + STRING(REGEX MATCHALL "[^:]+" SQUISH_INSTALL_DIR_SEARCH1 "$ENV{PATH}") + ELSE(UNIX) + STRING(REGEX REPLACE "\\\\" "/" SQUISH_INSTALL_DIR_SEARCH1 "$ENV{PATH}") + ENDIF(UNIX) + STRING(REGEX REPLACE "/;" ";" SQUISH_INSTALL_DIR_SEARCH2 ${SQUISH_INSTALL_DIR_SEARCH1}) + + # 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) + + # 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/FindTclStub.cmake b/Modules/FindTclStub.cmake index 788dbe4b5..196d57b41 100644 --- a/Modules/FindTclStub.cmake +++ b/Modules/FindTclStub.cmake @@ -8,6 +8,7 @@ # 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 @@ -101,6 +102,17 @@ FIND_LIBRARY(TK_STUB_LIBRARY 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/Findosg.cmake b/Modules/Findosg.cmake index 7804baee0..f4ec42e29 100644 --- a/Modules/Findosg.cmake +++ b/Modules/Findosg.cmake @@ -1,3 +1,7 @@ +# +# 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 @@ -11,9 +15,13 @@ # # Locate osg # This module defines -# OSG_LIBRARY -# OSG_FOUND, if false, do not try to link to osg -# OSG_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,44 +33,9 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSG_INCLUDE_DIR osg/PositionAttitudeTransform - HINTS - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSG_LIBRARY - NAMES osg - HINTS - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSG_FOUND "NO") -IF(OSG_LIBRARY AND OSG_INCLUDE_DIR) - SET(OSG_FOUND "YES") -ENDIF(OSG_LIBRARY AND OSG_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSG osg/PositionAttitudeTransform) +OSG_FIND_LIBRARY(OSG osg) +include(FindPackageHandleStandardArgs) +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..ed31232f6 --- /dev/null +++ b/Modules/FindosgAnimation.cmake @@ -0,0 +1,38 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgAnimation +# This module defines +# +# OSGANIMATION_FOUND - Was osgAnimation found? +# OSGANIMATION_INCLUDE_DIR - Where to find the headers +# OSGANIMATION_LIBRARIES - The libraries to link against for the OSG (use this) +# +# OSGANIMATION_LIBRARY - The OSG library +# OSGANIMATION_LIBRARY_DEBUG - The OSG debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGANIMATION osgAnimation/Animation) +OSG_FIND_LIBRARY(OSGANIMATION osgAnimation) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgAnimation DEFAULT_MSG + OSGANIMATION_LIBRARY OSGANIMATION_INCLUDE_DIR) diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake index 88da80761..9a1921085 100644 --- a/Modules/FindosgDB.cmake +++ b/Modules/FindosgDB.cmake @@ -11,9 +11,13 @@ # # Locate osgDB # This module defines -# OSGDB_LIBRARY -# OSGDB_FOUND, if false, do not try to link to osgDB -# OSGDB_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGDB_INCLUDE_DIR osgDB/DatabasePager - HINTS - $ENV{OSGDB_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGDB_LIBRARY - NAMES osgDB - HINTS - $ENV{OSGDB_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGDB_FOUND "NO") -IF(OSGDB_LIBRARY AND OSGDB_INCLUDE_DIR) - SET(OSGDB_FOUND "YES") -ENDIF(OSGDB_LIBRARY AND OSGDB_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGDB osgDB/DatabasePager) +OSG_FIND_LIBRARY(OSGDB osgDB) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgDB DEFAULT_MSG + OSGDB_LIBRARY OSGDB_INCLUDE_DIR) diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake index 9b45c3106..43d5bd2fa 100644 --- a/Modules/FindosgFX.cmake +++ b/Modules/FindosgFX.cmake @@ -11,9 +11,13 @@ # # Locate osgFX # This module defines -# OSGFX_LIBRARY -# OSGFX_FOUND, if false, do not try to link to osgFX -# OSGFX_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGFX_INCLUDE_DIR osgFX/BumpMapping - HINTS - $ENV{OSGFX_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGFX_LIBRARY - NAMES osgFX - HINTS - $ENV{OSGFX_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGFX_FOUND "NO") -IF(OSGFX_LIBRARY AND OSGFX_INCLUDE_DIR) - SET(OSGFX_FOUND "YES") -ENDIF(OSGFX_LIBRARY AND OSGFX_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGFX osgFX/BumpMapping) +OSG_FIND_LIBRARY(OSGFX osgFX) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgFX DEFAULT_MSG + OSGFX_LIBRARY OSGFX_INCLUDE_DIR) diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake index c1585d063..9dfa13b99 100644 --- a/Modules/FindosgGA.cmake +++ b/Modules/FindosgGA.cmake @@ -11,9 +11,13 @@ # # Locate osgGA # This module defines -# OSGGA_LIBRARY -# OSGGA_FOUND, if false, do not try to link to osgGA -# OSGGA_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGGA_INCLUDE_DIR osgGA/FlightManipulator - HINTS - $ENV{OSGGA_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGGA_LIBRARY - NAMES osgGA - HINTS - $ENV{OSGGA_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGGA_FOUND "NO") -IF(OSGGA_LIBRARY AND OSGGA_INCLUDE_DIR) - SET(OSGGA_FOUND "YES") -ENDIF(OSGGA_LIBRARY AND OSGGA_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGGA osgGA/FlightManipulator) +OSG_FIND_LIBRARY(OSGGA osgGA) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgGA DEFAULT_MSG + OSGGA_LIBRARY OSGGA_INCLUDE_DIR) diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake index cf7ffac2f..af1768767 100644 --- a/Modules/FindosgIntrospection.cmake +++ b/Modules/FindosgIntrospection.cmake @@ -9,11 +9,15 @@ # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. # -# Locate osgIntrospection +# Locate osgINTROSPECTION # This module defines -# OSGINTROSPECTION_LIBRARY -# OSGINTROSPECTION_FOUND, if false, do not try to link to osgIntrospection -# OSGINTROSPECTION_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGINTROSPECTION_INCLUDE_DIR osgIntrospection/Reflection - HINTS - $ENV{OSGINTROSPECTION_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGINTROSPECTION_LIBRARY - NAMES osgIntrospection - HINTS - $ENV{OSGINTROSPECTION_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGINTROSPECTION_FOUND "NO") -IF(OSGINTROSPECTION_LIBRARY AND OSGINTROSPECTION_INCLUDE_DIR) - SET(OSGINTROSPECTION_FOUND "YES") -ENDIF(OSGINTROSPECTION_LIBRARY AND OSGINTROSPECTION_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGINTROSPECTION osgIntrospection/Reflection) +OSG_FIND_LIBRARY(OSGINTROSPECTION osgIntrospection) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgIntrospection DEFAULT_MSG + OSGINTROSPECTION_LIBRARY OSGINTROSPECTION_INCLUDE_DIR) diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake index 17a6424dc..ca0b6b840 100644 --- a/Modules/FindosgManipulator.cmake +++ b/Modules/FindosgManipulator.cmake @@ -11,9 +11,13 @@ # # Locate osgManipulator # This module defines -# OSG_LIBRARY -# OSGMANIPULATOR_FOUND, if false, do not try to link to osgManipulator -# OSGMANIPULATOR_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGMANIPULATOR_INCLUDE_DIR osgManipulator/TrackballDragger - HINTS - $ENV{OSGMANIPULATOR_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGMANIPULATOR_LIBRARY - NAMES osgManipulator - HINTS - $ENV{OSGMANIPULATOR_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGMANIPULATOR_FOUND "NO") -IF(OSGMANIPULATOR_LIBRARY AND OSGMANIPULATOR_INCLUDE_DIR) - SET(OSGMANIPULATOR_FOUND "YES") -ENDIF(OSGMANIPULATOR_LIBRARY AND OSGMANIPULATOR_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGMANIPULATOR osgManipulator/TrackballDragger) +OSG_FIND_LIBRARY(OSGMANIPULATOR osgManipulator) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgManipulator DEFAULT_MSG + OSGMANIPULATOR_LIBRARY OSGMANIPULATOR_INCLUDE_DIR) diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake index 8514b2ff6..5a5b31699 100644 --- a/Modules/FindosgParticle.cmake +++ b/Modules/FindosgParticle.cmake @@ -11,9 +11,13 @@ # # Locate osgParticle # This module defines -# OSGPARTICLE_LIBRARY -# OSGPARTICLE_FOUND, if false, do not try to link to osgParticle -# OSGPARTICLE_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGPARTICLE_INCLUDE_DIR osgParticle/FireEffect - HINTS - $ENV{OSGPARTICLE_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGPARTICLE_LIBRARY - NAMES osgParticle - HINTS - $ENV{OSGPARTICLE_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGPARTICLE_FOUND "NO") -IF(OSGPARTICLE_LIBRARY AND OSGPARTICLE_INCLUDE_DIR) - SET(OSGPARTICLE_FOUND "YES") -ENDIF(OSGPARTICLE_LIBRARY AND OSGPARTICLE_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGPARTICLE osgParticle/FireEffect) +OSG_FIND_LIBRARY(OSGPARTICLE osgParticle) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgParticle DEFAULT_MSG + OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR) diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake index 0852527b6..19e00ed62 100644 --- a/Modules/FindosgProducer.cmake +++ b/Modules/FindosgProducer.cmake @@ -11,9 +11,13 @@ # # Locate osgProducer # This module defines -# OSGPRODUCER_LIBRARY -# OSGPRODUCER_FOUND, if false, do not try to link to osgProducer -# OSGPRODUCER_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGPRODUCER_INCLUDE_DIR osgProducer/OsgSceneHandler - HINTS - $ENV{OSGPRODUCER_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGPRODUCER_LIBRARY - NAMES osgProducer - HINTS - $ENV{OSGPRODUCER_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGPRODUCER_FOUND "NO") -IF(OSGPRODUCER_LIBRARY AND OSGPRODUCER_INCLUDE_DIR) - SET(OSGPRODUCER_FOUND "YES") -ENDIF(OSGPRODUCER_LIBRARY AND OSGPRODUCER_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGPRODUCER osgProducer/OsgSceneHandler) +OSG_FIND_LIBRARY(OSGPRODUCER osgProducer) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgProducer DEFAULT_MSG + OSGPRODUCER_LIBRARY OSGPRODUCER_INCLUDE_DIR) diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake index ddb59fb91..665aa5e2e 100644 --- a/Modules/FindosgShadow.cmake +++ b/Modules/FindosgShadow.cmake @@ -11,9 +11,13 @@ # # Locate osgShadow # This module defines -# OSGSHADOW_LIBRARY -# OSGSHADOW_FOUND, if false, do not try to link to osgShadow -# OSGSHADOW_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGSHADOW_INCLUDE_DIR osgShadow/ShadowTexture - HINTS - $ENV{OSGSHADOW_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGSHADOW_LIBRARY - NAMES osgShadow - HINTS - $ENV{OSGSHADOW_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGSHADOW_FOUND "NO") -IF(OSGSHADOW_LIBRARY AND OSGSHADOW_INCLUDE_DIR) - SET(OSGSHADOW_FOUND "YES") -ENDIF(OSGSHADOW_LIBRARY AND OSGSHADOW_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGSHADOW osgShadow/ShadowTexture) +OSG_FIND_LIBRARY(OSGSHADOW osgShadow) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgShadow DEFAULT_MSG + OSGSHADOW_LIBRARY OSGSHADOW_INCLUDE_DIR) diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake index 1293af7cd..eec216666 100644 --- a/Modules/FindosgSim.cmake +++ b/Modules/FindosgSim.cmake @@ -11,9 +11,13 @@ # # Locate osgSim # This module defines -# OSGSIM_LIBRARY -# OSGSIM_FOUND, if false, do not try to link to osgSim -# OSGSIM_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGSIM_INCLUDE_DIR osgSim/ImpostorSprite - HINTS - $ENV{OSGSIM_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGSIM_LIBRARY - NAMES osgSim - HINTS - $ENV{OSGSIM_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGSIM_FOUND "NO") -IF(OSGSIM_LIBRARY AND OSGSIM_INCLUDE_DIR) - SET(OSGSIM_FOUND "YES") -ENDIF(OSGSIM_LIBRARY AND OSGSIM_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGSIM osgSim/ImpostorSprite) +OSG_FIND_LIBRARY(OSGSIM osgSim) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgSim DEFAULT_MSG + OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR) diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake index 3f3a559d7..fbd732a8f 100644 --- a/Modules/FindosgTerrain.cmake +++ b/Modules/FindosgTerrain.cmake @@ -11,9 +11,13 @@ # # Locate osgTerrain # This module defines -# OSGTERRAIN_LIBRARY -# OSGTERRAIN_FOUND, if false, do not try to link to osgTerrain -# OSGTERRAIN_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGTERRAIN_INCLUDE_DIR osgTerrain/Terrain - HINTS - $ENV{OSGTERRAIN_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGTERRAIN_LIBRARY - NAMES osgTerrain - HINTS - $ENV{OSGTERRAIN_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGTERRAIN_FOUND "NO") -IF(OSGTERRAIN_LIBRARY AND OSGTERRAIN_INCLUDE_DIR) - SET(OSGTERRAIN_FOUND "YES") -ENDIF(OSGTERRAIN_LIBRARY AND OSGTERRAIN_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGTERRAIN osgTerrain/Terrain) +OSG_FIND_LIBRARY(OSGTERRAIN osgTerrain) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgTerrain DEFAULT_MSG + OSGTERRAIN_LIBRARY OSGTERRAIN_INCLUDE_DIR) diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake index 7eef2a1c5..b98ed2256 100644 --- a/Modules/FindosgText.cmake +++ b/Modules/FindosgText.cmake @@ -11,9 +11,13 @@ # # Locate osgText # This module defines -# OSGTEXT_LIBRARY -# OSGTEXT_FOUND, if false, do not try to link to osgText -# OSGTEXT_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGTEXT_INCLUDE_DIR osgText/Text - HINTS - $ENV{OSGTEXT_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGTEXT_LIBRARY - NAMES osgText - HINTS - $ENV{OSGTEXT_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGTEXT_FOUND "NO") -IF(OSGTEXT_LIBRARY AND OSGTEXT_INCLUDE_DIR) - SET(OSGTEXT_FOUND "YES") -ENDIF(OSGTEXT_LIBRARY AND OSGTEXT_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGTEXT osgText/Text) +OSG_FIND_LIBRARY(OSGTEXT osgText) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgText DEFAULT_MSG + OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR) diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake index f73d82bd3..e88c5d8d4 100644 --- a/Modules/FindosgUtil.cmake +++ b/Modules/FindosgUtil.cmake @@ -11,9 +11,13 @@ # # Locate osgUtil # This module defines -# OSGUTIL_LIBRARY -# OSGUTIL_FOUND, if false, do not try to link to osgUtil -# OSGUTIL_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGUTIL_INCLUDE_DIR osgUtil/SceneView - HINTS - $ENV{OSGUTIL_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGUTIL_LIBRARY - NAMES osgUtil - HINTS - $ENV{OSGUTIL_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGUTIL_FOUND "NO") -IF(OSGUTIL_LIBRARY AND OSGUTIL_INCLUDE_DIR) - SET(OSGUTIL_FOUND "YES") -ENDIF(OSGUTIL_LIBRARY AND OSGUTIL_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGUTIL osgUtil/SceneView) +OSG_FIND_LIBRARY(OSGUTIL osgUtil) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgUtil DEFAULT_MSG + OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR) diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake index d240a8c03..e1370a007 100644 --- a/Modules/FindosgViewer.cmake +++ b/Modules/FindosgViewer.cmake @@ -11,9 +11,13 @@ # # Locate osgViewer # This module defines -# OSGVIEWER_LIBRARY -# OSGVIEWER_FOUND, if false, do not try to link to osgViewer -# OSGVIEWER_INCLUDE_DIR, where to find the headers +# +# 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 @@ -25,46 +29,10 @@ # #include # #include -# Try the user's environment request before anything else. -FIND_PATH(OSGVIEWER_INCLUDE_DIR osgViewer/Viewer - HINTS - $ENV{OSGVIEWER_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] - [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] -) - -FIND_LIBRARY(OSGVIEWER_LIBRARY - NAMES osgViewer - HINTS - $ENV{OSGVIEWER_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt -) - -SET(OSGVIEWER_FOUND "NO") -IF(OSGVIEWER_LIBRARY AND OSGVIEWER_INCLUDE_DIR) - SET(OSGVIEWER_FOUND "YES") -ENDIF(OSGVIEWER_LIBRARY AND OSGVIEWER_INCLUDE_DIR) +include(Findosg_functions) +OSG_FIND_PATH (OSGVIEWER osgViewer/Viewer) +OSG_FIND_LIBRARY(OSGVIEWER osgViewer) +include(FindPackageHandleStandardArgs) +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..52e51bd75 --- /dev/null +++ b/Modules/FindosgVolume.cmake @@ -0,0 +1,38 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgVolume +# This module defines +# +# OSGVOLUME_FOUND - Was osgVolume found? +# OSGVOLUME_INCLUDE_DIR - Where to find the headers +# OSGVOLUME_LIBRARIES - The libraries to link for osgVolume (use this) +# +# OSGVOLUME_LIBRARY - The osgVolume library +# OSGVOLUME_LIBRARY_DEBUG - The osgVolume debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGVOLUME osgVolume/Volume) +OSG_FIND_LIBRARY(OSGVOLUME osgVolume) + +include(FindPackageHandleStandardArgs) +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..5f4342015 --- /dev/null +++ b/Modules/FindosgWidget.cmake @@ -0,0 +1,38 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgWidget +# This module defines +# +# OSGWIDGET_FOUND - Was osgWidget found? +# OSGWIDGET_INCLUDE_DIR - Where to find the headers +# OSGWIDGET_LIBRARIES - The libraries to link for osgWidget (use this) +# +# OSGWIDGET_LIBRARY - The osgWidget library +# OSGWIDGET_LIBRARY_DEBUG - The osgWidget debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# FindosgWidget.cmake tweaked from Findosg* suite as created by Eric Wing. + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGWIDGET osgWidget/Widget) +OSG_FIND_LIBRARY(OSGWIDGET osgWidget) + +include(FindPackageHandleStandardArgs) +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..128be376f --- /dev/null +++ b/Modules/Findosg_functions.cmake @@ -0,0 +1,91 @@ +# +# This CMake file contains two macros to assist with searching for OSG +# libraries and nodekits. +# + +# +# 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 index ec82b520c..11df1b56c 100755 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -400,6 +400,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") 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 @@ -446,7 +447,15 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ENDIF(MINGW) IF(BUILD_SHARED_LIBS) FIND_PATH(wxWidgets_LIB_DIR - NAMES msw/build.cfg mswd/build.cfg + 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 @@ -455,7 +464,15 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ) ELSE(BUILD_SHARED_LIBS) FIND_PATH(wxWidgets_LIB_DIR - NAMES msw/build.cfg mswd/build.cfg + 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 @@ -472,8 +489,6 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ENDIF(NOT WX_LIB_DIR STREQUAL wxWidgets_LIB_DIR) IF(WX_LIB_DIR) - SET(wxWidgets_FOUND TRUE) - # If building shared libs, define WXUSINGDLL to use dllimport. IF(WX_LIB_DIR MATCHES ".*[dD][lL][lL].*") SET(wxWidgets_DEFINITIONS "-DWXUSINGDLL") @@ -492,6 +507,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") 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 diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake new file mode 100755 index 000000000..6551658c7 --- /dev/null +++ b/Modules/FortranCInterface.cmake @@ -0,0 +1,231 @@ +# FortranCInterface.cmake +# +# This file defines the function create_fortran_c_interface. +# this function is used to create a configured header file +# that contains a mapping from C to a Fortran function using +# the correct name mangling scheme as defined by the current +# fortran compiler. +# +# The function tages a list of functions and the name of +# a header file to configure. +# +# This file also defines some helper functions that are used +# to detect the fortran name mangling scheme used by the +# current Fortran compiler. +# test_fortran_mangling - test a single fortran mangling +# discover_fortran_mangling - loop over all combos of fortran +# name mangling and call test_fortran_mangling until one of them +# works. +# discover_fortran_module_mangling - try different types of +# fortran modle name mangling to find one that works +# +# +# +# this function tests a single fortran mangling. +# CODE - test code to try should define a subroutine called "sub" +# PREFIX - string to put in front of sub +# POSTFIX - string to put after sub +# ISUPPER - if TRUE then sub will be called as SUB +# DOC - string used in status checking Fortran ${DOC} linkage +# SUB - the name of the SUB to call +# RESULT place to store result TRUE if this linkage works, FALSE +# if not. +# +function(test_fortran_mangling CODE PREFIX ISUPPER POSTFIX DOC SUB RESULT) + if(ISUPPER) + string(TOUPPER "${SUB}" sub) + else(ISUPPER) + string(TOLOWER "${SUB}" sub) + endif(ISUPPER) + set(FUNCTION "${PREFIX}${sub}${POSTFIX}") + # create a fortran file with sub called sub + # + set(TMP_DIR + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckFortranLink") + file(REMOVE_RECURSE "${TMP_DIR}") + file(WRITE "${TMP_DIR}/test.f" "${CODE}" ) + message(STATUS "checking Fortran ${DOC} linkage: ${FUNCTION}") + file(WRITE "${TMP_DIR}/ctof.c" + " + extern ${FUNCTION}(); + int main() { ${FUNCTION}(); return 0;} + " + ) + file(WRITE "${TMP_DIR}/CMakeLists.txt" + " + project(testf C Fortran) + add_library(flib test.f) + add_executable(ctof ctof.c) + target_link_libraries(ctof flib) + " + ) + set(FORTRAN_NAME_MANGLE_TEST FALSE) + try_compile(FORTRAN_NAME_MANGLE_TEST "${TMP_DIR}" "${TMP_DIR}" + testf + OUTPUT_VARIABLE output) + if(FORTRAN_NAME_MANGLE_TEST) + set(${RESULT} TRUE PARENT_SCOPE) + else() + set(${RESULT} FALSE PARENT_SCOPE) + endif() +endfunction(test_fortran_mangling) + +# this function discovers the name mangling scheme used +# for functions in a fortran module. +function(discover_fortran_module_mangling prefix suffix found) + set(CODE + " + module test_interface + interface dummy + module procedure sub + end interface + contains + subroutine sub + end subroutine + end module test_interface + ") + set(worked FALSE) + foreach(interface + "test_interface$" + "TEST_INTERFACE_mp_" + "_test_interface__" + "__test_interface__" + "__test_interface_NMOD_" + "__test_interface_MOD_") + test_fortran_mangling("${CODE}" "${interface}" + ${FORTRAN_C_MANGLING_UPPERCASE} "" "module" "sub" worked) + if(worked) + # if this is the upper case module match then + # lower case it for the extraction of pre and post strings + if("${interface}" MATCHES "TEST_INTERFACE") + string(TOLOWER "${interface}" interface) + endif() + string(REGEX REPLACE "(.*)test_interface(.*)" "\\1" pre "${interface}") + string(REGEX REPLACE "(.*)test_interface(.*)" "\\2" post "${interface}") + set(${prefix} "${pre}" PARENT_SCOPE) + set(${suffix} "${post}" PARENT_SCOPE) + set(${found} TRUE PARENT_SCOPE) + return() + endif(worked) + endforeach(interface) + if(NOT worked) + message(STATUS "Failed to find C binding to Fortran module functions.") + set(${prefix} "BROKEN_C_FORTRAN_MODULE_BINDING" PARENT_SCOPE) + set(${suffix} "BROKEN_C_FORTRAN_MODULE_BINDING" PARENT_SCOPE) + set(${found} FALSE PARENT_SCOPE) + endif(NOT worked) +endfunction(discover_fortran_module_mangling) + + +function(discover_fortran_mangling prefix isupper suffix extra_under_score + found ) + set(CODE + " + subroutine sub + end subroutine sub + ") + foreach(post "_" "") + foreach(isup FALSE TRUE) + foreach(pre "" "_" "__") + set(worked FALSE) + test_fortran_mangling("${CODE}" "${pre}" ${isup} + "${post}" "function" sub worked ) + if(worked) + message(STATUS "found Fortran function linkage") + set(${isupper} "${isup}" PARENT_SCOPE) + set(${prefix} "${pre}" PARENT_SCOPE) + set(${suffix} "${post}" PARENT_SCOPE) + set(${found} TRUE PARENT_SCOPE) + set(CODE + " + subroutine my_sub + end subroutine my_sub + ") + set(worked FALSE) + test_fortran_mangling("${CODE}" "${pre}" ${isup} + "${post}" "function with _ " my_sub worked ) + if(worked) + set(${extra_under_score} FALSE PARENT_SCOPE) + else(worked) + test_fortran_mangling("${CODE}" "${pre}" ${isup} + "${post}_" "function with _ " my_sub worked ) + if(worked) + set(${extra_under_score} TRUE PARENT_SCOPE) + endif(worked) + endif(worked) + return() + endif() + endforeach() + endforeach() + endforeach() + set(${found} FALSE PARENT_SCOPE) +endfunction(discover_fortran_mangling) + +function(create_fortran_c_interface NAMESPACE FUNCTIONS HEADER) + if(NOT FORTRAN_C_MANGLING_FOUND) + # find regular fortran function mangling + discover_fortran_mangling(prefix isupper suffix extra_under found) + if(NOT found) + message(SEND_ERROR "Could not find fortran c name mangling.") + return() + endif(NOT found) + # find fortran module function mangling + set(FORTRAN_C_PREFIX "${prefix}" CACHE INTERNAL + "PREFIX for Fortran to c name mangling") + set(FORTRAN_C_SUFFIX "${suffix}" CACHE INTERNAL + "SUFFIX for Fortran to c name mangling") + set(FORTRAN_C_MANGLING_UPPERCASE ${isupper} CACHE INTERNAL + "Was fortran to c mangling found" ) + set(FORTRAN_C_MANGLING_EXTRA_UNDERSCORE ${extra_under} CACHE INTERNAL + "If a function has a _ in the name does the compiler append an extra _" ) + set(FORTRAN_C_MANGLING_FOUND TRUE CACHE INTERNAL + "Was fortran to c mangling found" ) + set(prefix ) + set(suffix ) + set(found FALSE) + # only try this if the compiler is F90 compatible + if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + discover_fortran_module_mangling(prefix suffix found) + endif(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + if(found) + message(STATUS "found Fortran module linkage") + else(found) + message(STATUS "Failed to find Fortran module linkage") + endif(found) + set(FORTRAN_C_MODULE_PREFIX "${prefix}" CACHE INTERNAL + "PREFIX for Fortran to c name mangling") + set(FORTRAN_C_MODULE_SUFFIX "${suffix}" CACHE INTERNAL + "SUFFIX for Fortran to c name mangling") + set(FORTRAN_C_MODULE_MANGLING_FOUND ${found} CACHE INTERNAL + "Was for Fortran to c name mangling found for modules") + endif(NOT FORTRAN_C_MANGLING_FOUND) + foreach(f ${${FUNCTIONS}}) + if(FORTRAN_C_MANGLING_UPPERCASE) + string(TOUPPER "${f}" fcase) + else() + string(TOLOWER "${f}" fcase) + endif() + if("${f}" MATCHES ":") + string(REGEX REPLACE "(.*):(.*)" "\\1" module "${f}") + string(REGEX REPLACE "(.*):(.*)" "\\2" function "${f}") + string(REGEX REPLACE "(.*):(.*)" "\\1" module_case "${fcase}") + string(REGEX REPLACE "(.*):(.*)" "\\2" function_case "${fcase}") + set(HEADER_CONTENT "${HEADER_CONTENT} +#define ${NAMESPACE}${module}_${function} ${FORTRAN_C_MODULE_PREFIX}${module_case}${FORTRAN_C_MODULE_SUFFIX}${function_case} +") + else("${f}" MATCHES ":") + set(function "${FORTRAN_C_PREFIX}${fcase}${FORTRAN_C_SUFFIX}") + if("${f}" MATCHES "_" AND FORTRAN_C_MANGLING_EXTRA_UNDERSCORE) + set(function "${function}_") + endif("${f}" MATCHES "_" AND FORTRAN_C_MANGLING_EXTRA_UNDERSCORE) + set(HEADER_CONTENT "${HEADER_CONTENT} +#define ${NAMESPACE}${f} ${function} +") + endif("${f}" MATCHES ":") + endforeach(f) + configure_file( + "${CMAKE_ROOT}/Modules/FortranCInterface.h.in" + ${HEADER} @ONLY) + message(STATUS "created ${HEADER}") +endfunction() + diff --git a/Modules/FortranCInterface.h.in b/Modules/FortranCInterface.h.in new file mode 100644 index 000000000..02501758f --- /dev/null +++ b/Modules/FortranCInterface.h.in @@ -0,0 +1,9 @@ +/* This file is automatically generated by CMake, DO NOT EDIT. + It contains a mapping from Fortran functions so they can + be called from C or C++. */ + + +@HEADER_CONTENT@ + + + diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 68b17bcd4..e7457d61b 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -69,9 +69,17 @@ function(gp_file_type original_file file type_var) endif("${file}" MATCHES "^@(executable|loader)_path") if(NOT is_embedded) - if("${file}" MATCHES "^(/System/Library/|/usr/lib/)") - set(is_system 1) - endif("${file}" MATCHES "^(/System/Library/|/usr/lib/)") + if(UNIX) + if("${file}" MATCHES "^(/lib/|/lib32/|/lib64/)") + set(is_system 1) + endif("${file}" MATCHES "^(/lib/|/lib32/|/lib64/)") + endif(UNIX) + + if(APPLE) + if("${file}" MATCHES "^(/System/Library/|/usr/lib/)") + set(is_system 1) + endif("${file}" MATCHES "^(/System/Library/|/usr/lib/)") + endif(APPLE) if(WIN32) string(TOLOWER "$ENV{SystemRoot}" sysroot) @@ -406,7 +414,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if("${gp_tool}" STREQUAL "ldd") set(gp_cmd_args "") - set(gp_regex "^\t([\t ]+)[\t ].*${eol_char}$") + set(gp_regex "^[\t ]*[^\t ]+ => ([^\t ]+).*${eol_char}$") set(gp_regex_cmp_count 1) set(gp_tool_known 1) endif("${gp_tool}" STREQUAL "ldd") @@ -560,8 +568,10 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa endif("${candidate}" MATCHES "${gp_regex}") endforeach(candidate) - list(SORT ${prerequisites_var}) - + 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}) diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 7744dfa19..057924c92 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -14,12 +14,14 @@ IF(MSVC) FILE(TO_CMAKE_PATH "$ENV{SYSTEMROOT}" SYSTEMROOT) + IF(MSVC70) SET(__install__libs "${SYSTEMROOT}/system32/msvcp70.dll" "${SYSTEMROOT}/system32/msvcr70.dll" ) ENDIF(MSVC70) + IF(MSVC71) SET(__install__libs "${SYSTEMROOT}/system32/msvcp71.dll" @@ -33,10 +35,15 @@ IF(MSVC) 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(MSVC80) # Find the runtime library redistribution directory. FIND_PATH(MSVC80_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../VC/redist" + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../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") @@ -62,16 +69,18 @@ IF(MSVC) ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) ENDIF(MSVC80) + IF(MSVC90) # Find the runtime library redistribution directory. FIND_PATH(MSVC90_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]/../../VC/redist" - - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]/../../VC/redist" + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]/../../VC/redist" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]/../../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. SET(__install__libs @@ -91,6 +100,7 @@ IF(MSVC) ) ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) ENDIF(MSVC90) + IF(CMAKE_INSTALL_MFC_LIBRARIES) IF(MSVC70) SET(__install__libs ${__install__libs} @@ -142,6 +152,7 @@ IF(MSVC) "${MSVC80_MFCLOC_DIR}/mfc80kor.dll" ) ENDIF(MSVC80) + IF(MSVC90) IF(CMAKE_INSTALL_DEBUG_LIBRARIES) SET(MSVC90_MFC_DIR @@ -184,6 +195,7 @@ IF(MSVC) ENDIF(MSVC90) ENDIF(CMAKE_INSTALL_MFC_LIBRARIES) + FOREACH(lib ${__install__libs} ) @@ -205,5 +217,3 @@ IF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) ENDIF(WIN32) ENDIF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP) ENDIF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) - - diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 97472cb96..2d89cef2f 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -27,8 +27,8 @@ SET(CMAKE_SHARED_MODULE_SUFFIX ".so") SET(CMAKE_MODULE_EXISTS 1) SET(CMAKE_DL_LIBS "") -SET(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG -Wl,-compatibility_version,) -SET(CMAKE_C_OSX_CURRENT_VERSION_FLAG -Wl,-current_version,) +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}") @@ -52,7 +52,7 @@ SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") # 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) - SET(CMAKE_INSTALL_NAME_TOOL install_name_tool) + FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL install_name_tool) ENDIF(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) # find installed SDKs FILE(GLOB _CMAKE_OSX_SDKS "/Developer/SDKs/*") diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake new file mode 100755 index 000000000..84ded8086 --- /dev/null +++ b/Modules/Platform/Haiku.cmake @@ -0,0 +1,21 @@ +SET(BEOS 1) + +# GCC is the default compiler on Haiku. +INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) + +SET(CMAKE_DL_LIBS root be) +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,") +SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_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) diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index eba4bb3f8..4e4c2cbaf 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -59,3 +59,5 @@ INCLUDE(Platform/UnixPaths) IF(EXISTS "/etc/debian_version") SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) ENDIF(EXISTS "/etc/debian_version") +# always include the gcc compiler information +INCLUDE(Platform/gcc) diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake index cbdcb7dae..422227be2 100644 --- a/Modules/Platform/OpenBSD.cmake +++ b/Modules/Platform/OpenBSD.cmake @@ -1,2 +1,3 @@ SET(CMAKE_DL_LIBS "") +SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1) INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/SunOS-SunPro-Fortran.cmake b/Modules/Platform/SunOS-SunPro-Fortran.cmake index 5739c58e8..1006bf28e 100644 --- a/Modules/Platform/SunOS-SunPro-Fortran.cmake +++ b/Modules/Platform/SunOS-SunPro-Fortran.cmake @@ -1,2 +1,5 @@ -SET(CMAKE_Fortran_MODDIR_FLAG "-moddir=") -SET(CMAKE_Fortran_MODPATH_FLAG "-M") +set(CMAKE_Fortran_MODDIR_FLAG "-moddir=") +set(CMAKE_Fortran_MODPATH_FLAG "-M") +set(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG "-R") +set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC") + diff --git a/Modules/Platform/Windows-g77.cmake b/Modules/Platform/Windows-g77.cmake index 193b92527..ad24db678 100755 --- a/Modules/Platform/Windows-g77.cmake +++ b/Modules/Platform/Windows-g77.cmake @@ -14,3 +14,10 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty SET(CMAKE_LIBRARY_PATH_FLAG "-L") SET(CMAKE_LINK_LIBRARY_FLAG "-l") +SET (CMAKE_Fortran_FLAGS_INIT "") +SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") +SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-O1") +SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "-O2") +SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-02 -g") + + diff --git a/Modules/Platform/Windows-gcc.cmake b/Modules/Platform/Windows-gcc.cmake index 51857ebdc..73c10c135 100755 --- a/Modules/Platform/Windows-gcc.cmake +++ b/Modules/Platform/Windows-gcc.cmake @@ -15,6 +15,12 @@ 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_SHARED_MODULE_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}") # -pic +SET(CMAKE_SHARED_MODULE_CXX_FLAGS + "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") # -pic +SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS + "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}") # -shared SET(CMAKE_LIBRARY_PATH_FLAG "-L") SET(CMAKE_LINK_LIBRARY_FLAG "-l") SET(CMAKE_EXTRA_LINK_EXTENSIONS ".lib") # MinGW can also link to a MS .lib @@ -23,6 +29,8 @@ SET(CMAKE_CREATE_WIN32_EXE "-mwindows") 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(MINGW) SET(CMAKE_GNULD_IMAGE_VERSION diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake index 45ed4795d..00e3afa12 100755 --- a/Modules/Platform/WindowsPaths.cmake +++ b/Modules/Platform/WindowsPaths.cmake @@ -1,15 +1,56 @@ +# 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} = +# (executed from cygwin): +# ENV{ProgramFiles(x86)} = +# ENV{ProgramFiles} = [C:\Program Files] +# ENV{ProgramW6432} = +# +# 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)} = +# 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}") -# List common installation prefixes. These will be used for all -# search types. +# Add other locations. LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH - # Standard - "$ENV{ProgramFiles}" - - # CMake install location - "${_CMAKE_INSTALL_DIR}" - # Project install destination. "${CMAKE_INSTALL_PREFIX}" diff --git a/Modules/SquishRunTestCase.bat b/Modules/SquishRunTestCase.bat new file mode 100644 index 000000000..293e88f8f --- /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..775134579 --- /dev/null +++ b/Modules/SquishTestScript.cmake @@ -0,0 +1,59 @@ +# +# This script launches a GUI test using Squish. You should not call +# the script directly; instead, you should acces 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. +# + +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/UseQt4.cmake b/Modules/UseQt4.cmake index 495b999f2..f82ba77d1 100755 --- a/Modules/UseQt4.cmake +++ b/Modules/UseQt4.cmake @@ -11,6 +11,9 @@ SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_ SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG) INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR}) +IF(Q_WS_MAC AND QT_USE_FRAMEWORKS) + INCLUDE_DIRECTORIES(${QT_QTCORE_LIBRARY}) +ENDIF(Q_WS_MAC AND QT_USE_FRAMEWORKS) SET(QT_LIBRARIES "") @@ -41,7 +44,11 @@ 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 QTCORE) -SET(QT_PHONON_MODULE_DEPENDS QTGUI QTDBUS 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) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index b4a04f522..2621c9dac 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -302,19 +302,6 @@ IF(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) TARGET_LINK_LIBRARIES(CMakeLib rpcrt4) ENDIF(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) -# With the Microsoft compiler (for _bstr_t support used from -# cmCallVisualStudioMacro) we need the comsupp lib. Needed when -# _MSC_VER and HAVE_COMDEF_H are defined... -# -IF(MSVC) - IF(MSVC60) - # comsuppd did not yet exist in VS6 - TARGET_LINK_LIBRARIES(CMakeLib comsupp) - ELSE(MSVC60) - TARGET_LINK_LIBRARIES(CMakeLib optimized comsupp debug comsuppd) - ENDIF(MSVC60) -ENDIF(MSVC) - # # CTestLib # @@ -389,6 +376,7 @@ ENDIF(UNIX) IF(APPLE) SET(CPACK_SRCS ${CPACK_SRCS} CPack/cmCPackBundleGenerator.cxx + CPack/cmCPackDragNDropGenerator.cxx CPack/cmCPackOSXX11Generator.cxx CPack/cmCPackPackageMakerGenerator.cxx ) diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index d23618016..81d5545c5 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCPackBundleGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-07-22 18:04:24 $ - Version: $Revision: 1.2.2.3 $ + Date: $Date: 2009-02-04 16:44:18 $ + Version: $Revision: 1.2.2.6 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -19,6 +19,8 @@ #include "cmCPackLog.h" #include "cmSystemTools.h" +#include + //---------------------------------------------------------------------- cmCPackBundleGenerator::cmCPackBundleGenerator() { @@ -32,37 +34,19 @@ cmCPackBundleGenerator::~cmCPackBundleGenerator() //---------------------------------------------------------------------- int cmCPackBundleGenerator::InitializeInternal() { - const std::string hdiutil_path = cmSystemTools::FindProgram("hdiutil", - std::vector(), false); - if(hdiutil_path.empty()) + const char* name = this->GetOption("CPACK_BUNDLE_NAME"); + if(0 == name) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot locate hdiutil command" + "CPACK_BUNDLE_NAME must be set to use the Bundle generator." << std::endl); - return 0; - } - this->SetOptionIfNotSet("CPACK_COMMAND_HDIUTIL", hdiutil_path.c_str()); - const std::string setfile_path = cmSystemTools::FindProgram("SetFile", - std::vector(1, "/Developer/Tools"), false); - if(setfile_path.empty()) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot locate SetFile command" - << std::endl); return 0; } - this->SetOptionIfNotSet("CPACK_COMMAND_SETFILE", setfile_path.c_str()); return this->Superclass::InitializeInternal(); } -//---------------------------------------------------------------------- -const char* cmCPackBundleGenerator::GetOutputExtension() -{ - return ".dmg"; -} - //---------------------------------------------------------------------- const char* cmCPackBundleGenerator::GetPackagingInstallPrefix() { @@ -80,7 +64,8 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName, (void) files; // Get required arguments ... - const std::string cpack_bundle_name = this->GetOption("CPACK_BUNDLE_NAME") ? this->GetOption("CPACK_BUNDLE_NAME") : ""; + const std::string cpack_bundle_name = this->GetOption("CPACK_BUNDLE_NAME") + ? this->GetOption("CPACK_BUNDLE_NAME") : ""; if(cpack_bundle_name.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -90,7 +75,8 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName, return 0; } - const std::string cpack_bundle_plist = this->GetOption("CPACK_BUNDLE_PLIST") ? this->GetOption("CPACK_BUNDLE_PLIST") : ""; + const std::string cpack_bundle_plist = this->GetOption("CPACK_BUNDLE_PLIST") + ? this->GetOption("CPACK_BUNDLE_PLIST") : ""; if(cpack_bundle_plist.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -100,7 +86,8 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName, return 0; } - const std::string cpack_bundle_icon = this->GetOption("CPACK_BUNDLE_ICON") ? this->GetOption("CPACK_BUNDLE_ICON") : ""; + const std::string cpack_bundle_icon = this->GetOption("CPACK_BUNDLE_ICON") + ? this->GetOption("CPACK_BUNDLE_ICON") : ""; if(cpack_bundle_icon.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -110,18 +97,13 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName, return 0; } - const std::string cpack_bundle_startup_command = this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") ? this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") : ""; - if(cpack_bundle_startup_command.empty()) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "CPACK_BUNDLE_STARTUP_COMMAND must be set." - << std::endl); - - return 0; - } - // Get optional arguments ... - const std::string cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON") ? this->GetOption("CPACK_PACKAGE_ICON") : ""; + const std::string cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON") + ? this->GetOption("CPACK_PACKAGE_ICON") : ""; + + const std::string cpack_bundle_startup_command = + this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") + ? this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") : ""; // The staging directory contains everything that will end-up inside the // final disk image ... @@ -170,24 +152,28 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName, return 0; } - // Install a user-provided startup command (could be an executable or a - // script) ... - cmOStringStream command_source; - command_source << cpack_bundle_startup_command; + // Optionally a user-provided startup command (could be an + // executable or a script) ... + if(!cpack_bundle_startup_command.empty()) + { + cmOStringStream command_source; + command_source << cpack_bundle_startup_command; - cmOStringStream command_target; - command_target << application.str() << "/" << cpack_bundle_name; + cmOStringStream command_target; + command_target << application.str() << "/" << cpack_bundle_name; - if(!this->CopyFile(command_source, command_target)) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error copying startup command. Check the value of CPACK_BUNDLE_STARTUP_COMMAND." - << std::endl); + if(!this->CopyFile(command_source, command_target)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error copying startup command. " + " Check the value of CPACK_BUNDLE_STARTUP_COMMAND." + << std::endl); - return 0; - } + return 0; + } - cmSystemTools::SetPermissions(command_target.str().c_str(), 0777); + cmSystemTools::SetPermissions(command_target.str().c_str(), 0777); + } // Add a symlink to /Applications so users can drag-and-drop the bundle // into it @@ -208,7 +194,8 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName, if(!this->CopyFile(package_icon_source, package_icon_destination)) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error copying disk volume icon. Check the value of CPACK_PACKAGE_ICON." + "Error copying disk volume icon. " + "Check the value of CPACK_PACKAGE_ICON." << std::endl); return 0; @@ -242,16 +229,14 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName, if(!cpack_package_icon.empty()) { cmOStringStream temp_mount; - temp_mount << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "/mnt"; - cmSystemTools::MakeDirectory(temp_mount.str().c_str()); cmOStringStream attach_command; attach_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); attach_command << " attach"; - attach_command << " -mountpoint \"" << temp_mount.str() << "\""; attach_command << " \"" << temp_image.str() << "\""; - if(!this->RunCommand(attach_command)) + std::string attach_output; + if(!this->RunCommand(attach_command, &attach_output)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error attaching temporary disk image." @@ -260,6 +245,10 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName, return 0; } + cmsys::RegularExpression mountpoint_regex(".*(/Volumes/[^\n]+)\n.*"); + mountpoint_regex.find(attach_output.c_str()); + temp_mount << mountpoint_regex.match(1); + cmOStringStream setfile_command; setfile_command << this->GetOption("CPACK_COMMAND_SETFILE"); setfile_command << " -a C"; @@ -309,51 +298,3 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName, return 1; } - -//---------------------------------------------------------------------- -bool cmCPackBundleGenerator::CopyFile(cmOStringStream& source, - cmOStringStream& target) -{ - if(!cmSystemTools::CopyFileIfDifferent( - source.str().c_str(), - target.str().c_str())) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error copying " - << source.str() - << " to " - << target.str() - << std::endl); - - return false; - } - - return true; -} - -//---------------------------------------------------------------------- -bool cmCPackBundleGenerator::RunCommand(cmOStringStream& command) -{ - std::string output; - int exit_code = 1; - - bool result = cmSystemTools::RunSingleCommand( - command.str().c_str(), - &output, - &exit_code, - 0, - this->GeneratorVerbose, - 0); - - if(!result || exit_code) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error executing: " - << command.str() - << std::endl); - - return false; - } - - return true; -} diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h index a41efa9c0..7416fcb9a 100644 --- a/Source/CPack/cmCPackBundleGenerator.h +++ b/Source/CPack/cmCPackBundleGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCPackBundleGenerator.h,v $ Language: C++ - Date: $Date: 2008-06-25 13:51:33 $ - Version: $Revision: 1.1.2.2 $ + Date: $Date: 2009-02-04 16:44:18 $ + Version: $Revision: 1.1.2.3 $ Copyright (c) 2002 Kitware, Inc. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -18,31 +18,27 @@ #ifndef cmCPackBundleGenerator_h #define cmCPackBundleGenerator_h -#include "cmCPackGenerator.h" +#include "cmCPackDragNDropGenerator.h" /** \class cmCPackBundleGenerator * \brief A generator for OSX bundles * * Based on Gimp.app */ -class cmCPackBundleGenerator : public cmCPackGenerator +class cmCPackBundleGenerator : public cmCPackDragNDropGenerator { public: - cmCPackTypeMacro(cmCPackBundleGenerator, cmCPackGenerator); + cmCPackTypeMacro(cmCPackBundleGenerator, cmCPackDragNDropGenerator); cmCPackBundleGenerator(); virtual ~cmCPackBundleGenerator(); protected: virtual int InitializeInternal(); - virtual const char* GetOutputExtension(); virtual const char* GetPackagingInstallPrefix(); int CompressFiles(const char* outFileName, const char* toplevel, const std::vector& files); - bool CopyFile(cmOStringStream& source, cmOStringStream& target); - bool RunCommand(cmOStringStream& command); - std::string InstallPrefix; }; diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx new file mode 100644 index 000000000..9682d81b1 --- /dev/null +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -0,0 +1,253 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmCPackDragNDropGenerator.cxx,v $ + Language: C++ + Date: $Date: 2009-02-05 03:04:12 $ + Version: $Revision: 1.1.2.2 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#include "cmCPackDragNDropGenerator.h" +#include "cmCPackLog.h" +#include "cmSystemTools.h" + +#include + +//---------------------------------------------------------------------- +cmCPackDragNDropGenerator::cmCPackDragNDropGenerator() +{ +} + +//---------------------------------------------------------------------- +cmCPackDragNDropGenerator::~cmCPackDragNDropGenerator() +{ +} + +//---------------------------------------------------------------------- +int cmCPackDragNDropGenerator::InitializeInternal() +{ + const std::string hdiutil_path = cmSystemTools::FindProgram("hdiutil", + std::vector(), false); + if(hdiutil_path.empty()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot locate hdiutil command" + << std::endl); + return 0; + } + this->SetOptionIfNotSet("CPACK_COMMAND_HDIUTIL", hdiutil_path.c_str()); + + const std::string setfile_path = cmSystemTools::FindProgram("SetFile", + std::vector(1, "/Developer/Tools"), false); + if(setfile_path.empty()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot locate SetFile command" + << std::endl); + return 0; + } + this->SetOptionIfNotSet("CPACK_COMMAND_SETFILE", setfile_path.c_str()); + + return this->Superclass::InitializeInternal(); +} + +//---------------------------------------------------------------------- +const char* cmCPackDragNDropGenerator::GetOutputExtension() +{ + return ".dmg"; +} + +//---------------------------------------------------------------------- +int cmCPackDragNDropGenerator::CompressFiles(const char* outFileName, + const char* toplevel, const std::vector& files) +{ + (void) files; + + // Get optional arguments ... + const std::string cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON") + ? this->GetOption("CPACK_PACKAGE_ICON") : ""; + + // The staging directory contains everything that will end-up inside the + // final disk image ... + cmOStringStream staging; + staging << toplevel; + + // Add a symlink to /Applications so users can drag-and-drop the bundle + // into it + cmOStringStream application_link; + application_link << staging.str() << "/Applications"; + cmSystemTools::CreateSymlink("/Applications", + application_link.str().c_str()); + + // Optionally add a custom volume icon ... + if(!cpack_package_icon.empty()) + { + cmOStringStream package_icon_source; + package_icon_source << cpack_package_icon; + + cmOStringStream package_icon_destination; + package_icon_destination << staging.str() << "/.VolumeIcon.icns"; + + if(!this->CopyFile(package_icon_source, package_icon_destination)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error copying disk volume icon. " + "Check the value of CPACK_PACKAGE_ICON." + << std::endl); + + return 0; + } + } + + // Create a temporary read-write disk image ... + cmOStringStream temp_image; + temp_image << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "/temp.dmg"; + + cmOStringStream temp_image_command; + temp_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); + temp_image_command << " create"; + temp_image_command << " -ov"; + temp_image_command << " -srcfolder \"" << staging.str() << "\""; + temp_image_command << " -volname \"" + << this->GetOption("CPACK_PACKAGE_FILE_NAME") << "\""; + temp_image_command << " -format UDRW"; + temp_image_command << " \"" << temp_image.str() << "\""; + + if(!this->RunCommand(temp_image_command)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error generating temporary disk image." + << std::endl); + + return 0; + } + + // Optionally set the custom icon flag for the image ... + if(!cpack_package_icon.empty()) + { + cmOStringStream temp_mount; + + cmOStringStream attach_command; + attach_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); + attach_command << " attach"; + attach_command << " \"" << temp_image.str() << "\""; + + std::string attach_output; + if(!this->RunCommand(attach_command, &attach_output)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error attaching temporary disk image." + << std::endl); + + return 0; + } + + cmsys::RegularExpression mountpoint_regex(".*(/Volumes/[^\n]+)\n.*"); + mountpoint_regex.find(attach_output.c_str()); + temp_mount << mountpoint_regex.match(1); + + cmOStringStream setfile_command; + setfile_command << this->GetOption("CPACK_COMMAND_SETFILE"); + setfile_command << " -a C"; + setfile_command << " \"" << temp_mount.str() << "\""; + + if(!this->RunCommand(setfile_command)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error assigning custom icon to temporary disk image." + << std::endl); + + return 0; + } + + cmOStringStream detach_command; + detach_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); + detach_command << " detach"; + detach_command << " \"" << temp_mount.str() << "\""; + + if(!this->RunCommand(detach_command)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error detaching temporary disk image." + << std::endl); + + return 0; + } + } + + // Create the final compressed read-only disk image ... + cmOStringStream final_image_command; + final_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); + final_image_command << " convert \"" << temp_image.str() << "\""; + final_image_command << " -format UDZO"; + final_image_command << " -imagekey"; + final_image_command << " zlib-level=9"; + final_image_command << " -o \"" << outFileName << "\""; + + if(!this->RunCommand(final_image_command)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error compressing disk image." + << std::endl); + + return 0; + } + + return 1; +} + +//---------------------------------------------------------------------- +bool cmCPackDragNDropGenerator::CopyFile(cmOStringStream& source, + cmOStringStream& target) +{ + if(!cmSystemTools::CopyFileIfDifferent( + source.str().c_str(), + target.str().c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error copying " + << source.str() + << " to " + << target.str() + << std::endl); + + return false; + } + + return true; +} + +//---------------------------------------------------------------------- +bool cmCPackDragNDropGenerator::RunCommand(cmOStringStream& command, + std::string* output) +{ + int exit_code = 1; + + bool result = cmSystemTools::RunSingleCommand( + command.str().c_str(), + output, + &exit_code, + 0, + this->GeneratorVerbose, + 0); + + if(!result || exit_code) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error executing: " + << command.str() + << std::endl); + + return false; + } + + return true; +} diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h new file mode 100644 index 000000000..3dd676671 --- /dev/null +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -0,0 +1,47 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmCPackDragNDropGenerator.h,v $ + Language: C++ + Date: $Date: 2009-02-05 03:04:18 $ + Version: $Revision: 1.1.2.2 $ + + Copyright (c) 2002 Kitware, Inc. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef cmCPackDragNDropGenerator_h +#define cmCPackDragNDropGenerator_h + +#include "cmCPackGenerator.h" + +/** \class cmCPackDragNDropGenerator + * \brief A generator for OSX drag-n-drop installs + */ +class cmCPackDragNDropGenerator : public cmCPackGenerator +{ +public: + cmCPackTypeMacro(cmCPackDragNDropGenerator, cmCPackGenerator); + + cmCPackDragNDropGenerator(); + virtual ~cmCPackDragNDropGenerator(); + +protected: + virtual int InitializeInternal(); + virtual const char* GetOutputExtension(); + int CompressFiles(const char* outFileName, const char* toplevel, + const std::vector& files); + + bool CopyFile(cmOStringStream& source, cmOStringStream& target); + bool RunCommand(cmOStringStream& command, std::string* output = 0); + + std::string InstallPrefix; +}; + +#endif + diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 54b6c01f7..235d513e8 100755 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCPackGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-09-24 14:07:49 $ - Version: $Revision: 1.6.2.4 $ + Date: $Date: 2008-10-24 15:18:55 $ + Version: $Revision: 1.6.2.5 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -642,10 +642,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( if ( setDestDir ) { - // For DESTDIR based packaging, use the *project* CMAKE_INSTALL_PREFIX - // underneath the tempInstallDirectory. The value of the project's - // CMAKE_INSTALL_PREFIX is sent in here as the value of the - // CPACK_INSTALL_PREFIX variable. + // For DESTDIR based packaging, use the *project* + // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The + // value of the project's CMAKE_INSTALL_PREFIX is sent in here as + // the value of the CPACK_INSTALL_PREFIX variable. + // std::string dir; if (this->GetOption("CPACK_INSTALL_PREFIX")) { @@ -653,6 +654,29 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( } mf->AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str()); + cmCPackLogger( + cmCPackLog::LOG_DEBUG, + "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf->AddDefinition)" + << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" + << std::endl); + + // Make sure that DESTDIR + CPACK_INSTALL_PREFIX directory + // exists: + // + if (cmSystemTools::StringStartsWith(dir.c_str(), "/")) + { + dir = tempInstallDirectory + dir; + } + else + { + dir = tempInstallDirectory + "/" + dir; + } + + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Creating directory: '" << dir << "'" << std::endl); + if ( !cmsys::SystemTools::MakeDirectory(dir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -660,19 +684,14 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( << dir << std::endl); return 0; } - - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf->AddDefinition)" - << std::endl); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" - << std::endl); } else { - mf->AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory.c_str()); + mf->AddDefinition("CMAKE_INSTALL_PREFIX", + tempInstallDirectory.c_str()); - if ( !cmsys::SystemTools::MakeDirectory(tempInstallDirectory.c_str())) + if ( !cmsys::SystemTools::MakeDirectory( + tempInstallDirectory.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating temporary directory: " @@ -681,9 +700,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( } cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Using non-DESTDIR install... (mf->AddDefinition)" << std::endl); + "- Using non-DESTDIR install... (mf->AddDefinition)" + << std::endl); cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Setting CMAKE_INSTALL_PREFIX to '" << tempInstallDirectory + "- Setting CMAKE_INSTALL_PREFIX to '" + << tempInstallDirectory << "'" << std::endl); } @@ -770,7 +791,8 @@ int cmCPackGenerator::DoPackage() = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); if ( cmSystemTools::FileExists(toplevelDirectory) ) { - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove toplevel directory: " + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + "Remove toplevel directory: " << toplevelDirectory << std::endl); if ( !cmSystemTools::RemoveADirectory(toplevelDirectory) ) { @@ -1077,7 +1099,8 @@ bool cmCPackGenerator::SupportsComponentInstallation() const //---------------------------------------------------------------------- cmCPackInstallationType* -cmCPackGenerator::GetInstallationType(const char *projectName, const char *name) +cmCPackGenerator::GetInstallationType(const char *projectName, + const char *name) { (void) projectName; bool hasInstallationType = this->InstallationTypes.count(name) != 0; @@ -1138,7 +1161,8 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) = this->IsSet((macroPrefix + "_DOWNLOADED").c_str()) || cmSystemTools::IsOn(this->GetOption("CPACK_DOWNLOAD_ALL")); - const char* archiveFile = this->GetOption((macroPrefix + "_ARCHIVE_FILE").c_str()); + const char* archiveFile = this->GetOption((macroPrefix + + "_ARCHIVE_FILE").c_str()); if (archiveFile && *archiveFile) { component->ArchiveFile = archiveFile; @@ -1190,7 +1214,8 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) dependIt != dependsVector.end(); ++dependIt) { - cmCPackComponent *child = GetComponent(projectName, dependIt->c_str()); + cmCPackComponent *child = GetComponent(projectName, + dependIt->c_str()); component->Dependencies.push_back(child); child->ReverseDependencies.push_back(component); } diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 9838f6aed..f86768fd7 100755 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCPackGenerator.h,v $ Language: C++ - Date: $Date: 2008-09-24 14:07:50 $ - Version: $Revision: 1.2.2.3 $ + Date: $Date: 2008-10-24 15:18:55 $ + Version: $Revision: 1.2.2.4 $ Copyright (c) 2002 Kitware, Inc. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -127,9 +127,12 @@ protected: bool setDestDir, const char* tempInstallDirectory); virtual bool SupportsComponentInstallation() const; - virtual cmCPackInstallationType* GetInstallationType(const char *projectName, const char* name); - virtual cmCPackComponent* GetComponent(const char *projectName, const char* name); - virtual cmCPackComponentGroup* GetComponentGroup(const char *projectName, const char* name); + virtual cmCPackInstallationType* GetInstallationType(const char *projectName, + const char* name); + virtual cmCPackComponent* GetComponent(const char *projectName, + const char* name); + virtual cmCPackComponentGroup* GetComponentGroup(const char *projectName, + const char* name); bool GeneratorVerbose; std::string Name; diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 2f821756d..6cd3297d8 100755 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCPackGeneratorFactory.cxx,v $ Language: C++ - Date: $Date: 2008-06-25 13:51:39 $ - Version: $Revision: 1.2.2.1 $ + Date: $Date: 2009-02-04 16:44:18 $ + Version: $Revision: 1.2.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -25,6 +25,7 @@ #include "cmCPackSTGZGenerator.h" #include "cmCPackNSISGenerator.h" #ifdef __APPLE__ +# include "cmCPackDragNDropGenerator.h" # include "cmCPackBundleGenerator.h" # include "cmCPackPackageMakerGenerator.h" # include "cmCPackOSXX11Generator.h" @@ -67,6 +68,8 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() this->RegisterGenerator("TZ", "Tar Compress compression", cmCPackTarCompressGenerator::CreateGenerator); #ifdef __APPLE__ + this->RegisterGenerator("DragNDrop", "Mac OSX Drag And Drop", + cmCPackDragNDropGenerator::CreateGenerator); this->RegisterGenerator("Bundle", "Mac OSX bundle", cmCPackBundleGenerator::CreateGenerator); this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer", diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx index a498f322c..4244bd3a4 100644 --- a/Source/CPack/cmCPackLog.cxx +++ b/Source/CPack/cmCPackLog.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCPackLog.cxx,v $ Language: C++ - Date: $Date: 2006-03-10 18:06:26 $ - Version: $Revision: 1.7 $ + Date: $Date: 2009-02-04 16:44:18 $ + Version: $Revision: 1.7.12.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -18,6 +18,7 @@ #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" //---------------------------------------------------------------------- cmCPackLog::cmCPackLog() @@ -221,4 +222,9 @@ void cmCPackLog::Log(int tag, const char* file, int line, { this->NewLine = true; } + + if ( error ) + { + cmSystemTools::SetErrorOccured(); + } } diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 6a30a29fa..6105c4f88 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCPackNSISGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-07-13 21:55:24 $ - Version: $Revision: 1.31.2.2 $ + Date: $Date: 2009-02-04 16:44:18 $ + Version: $Revision: 1.31.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -111,7 +111,8 @@ int cmCPackNSISGenerator::CompressFiles(const char* outFileName, std::string::size_type slash = fileN.find('/'); if (slash != std::string::npos) { - // If this is a component installation, determine which component it is. + // If this is a component installation, determine which component it + // is. componentName = fileN.substr(0, slash); // Strip off the component part of the path. @@ -284,12 +285,17 @@ int cmCPackNSISGenerator::CompressFiles(const char* outFileName, } } - this->SetOptionIfNotSet("CPACK_NSIS_INSTALLATION_TYPES", installTypesCode.c_str()); - this->SetOptionIfNotSet("CPACK_NSIS_PAGE_COMPONENTS", "!insertmacro MUI_PAGE_COMPONENTS"); + this->SetOptionIfNotSet("CPACK_NSIS_INSTALLATION_TYPES", + installTypesCode.c_str()); + this->SetOptionIfNotSet("CPACK_NSIS_PAGE_COMPONENTS", + "!insertmacro MUI_PAGE_COMPONENTS"); this->SetOptionIfNotSet("CPACK_NSIS_FULL_INSTALL", ""); - this->SetOptionIfNotSet("CPACK_NSIS_COMPONENT_SECTIONS", componentCode.c_str()); - this->SetOptionIfNotSet("CPACK_NSIS_COMPONENT_SECTION_LIST", sectionList.c_str()); - this->SetOptionIfNotSet("CPACK_NSIS_SECTION_SELECTED_VARS", selectedVarsList.c_str()); + this->SetOptionIfNotSet("CPACK_NSIS_COMPONENT_SECTIONS", + componentCode.c_str()); + this->SetOptionIfNotSet("CPACK_NSIS_COMPONENT_SECTION_LIST", + sectionList.c_str()); + this->SetOptionIfNotSet("CPACK_NSIS_SECTION_SELECTED_VARS", + selectedVarsList.c_str()); this->SetOption("CPACK_NSIS_DEFINES", defines.c_str()); } @@ -342,13 +348,17 @@ int cmCPackNSISGenerator::InitializeInternal() "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath, cmsys::SystemTools::KeyWOW64_32) ) { - cmCPackLogger - (cmCPackLog::LOG_ERROR, - "Cannot find NSIS registry value. This is usually caused by NSIS " - "not being installed. Please install NSIS from " - "http://nsis.sourceforge.net" - << std::endl); - return 0; + if ( !cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) ) + { + cmCPackLogger + (cmCPackLog::LOG_ERROR, + "Cannot find NSIS registry value. This is usually caused by NSIS " + "not being installed. Please install NSIS from " + "http://nsis.sourceforge.net" + << std::endl); + return 0; + } } path.push_back(nsisPath); #endif @@ -590,7 +600,8 @@ bool cmCPackNSISGenerator::SupportsComponentInstallation() const //---------------------------------------------------------------------- std::string cmCPackNSISGenerator:: -CreateComponentDescription(cmCPackComponent *component, cmOStringStream& macrosOut) +CreateComponentDescription(cmCPackComponent *component, + cmOStringStream& macrosOut) { // Basic description of the component std::string componentCode = "Section "; @@ -640,7 +651,8 @@ CreateComponentDescription(cmCPackComponent *component, cmOStringStream& macrosO } // Create the directory for the upload area - const char* userUploadDirectory = this->GetOption("CPACK_UPLOAD_DIRECTORY"); + const char* userUploadDirectory = + this->GetOption("CPACK_UPLOAD_DIRECTORY"); std::string uploadDirectory; if (userUploadDirectory && *userUploadDirectory) { @@ -770,7 +782,8 @@ CreateComponentDescription(cmCPackComponent *component, cmOStringStream& macrosO } else { - componentCode += " File /r \"${INST_DIR}\\" + component->Name + "\\*.*\"\n"; + componentCode += " File /r \"${INST_DIR}\\" + + component->Name + "\\*.*\"\n"; } componentCode += " noinstall_" + component->Name + ":\n"; componentCode += "SectionEnd\n"; @@ -780,20 +793,25 @@ CreateComponentDescription(cmCPackComponent *component, cmOStringStream& macrosO macrosOut << " IntCmp $" << component->Name << "_was_installed 0 noremove_" << component->Name << "\n"; std::vector::iterator pathIt; - for (pathIt = component->Files.begin(); - pathIt != component->Files.end(); - ++pathIt) - { - macrosOut << " Delete \"$INSTDIR\\" - << cmSystemTools::ConvertToWindowsOutputPath(pathIt->c_str()) + std::string path; + for (pathIt = component->Files.begin(); + pathIt != component->Files.end(); + ++pathIt) + { + path = *pathIt; + cmSystemTools::ReplaceString(path, "/", "\\"); + macrosOut << " Delete \"$INSTDIR\\" + << path.c_str() << "\"\n"; } - for (pathIt = component->Directories.begin(); - pathIt != component->Directories.end(); - ++pathIt) + for (pathIt = component->Directories.begin(); + pathIt != component->Directories.end(); + ++pathIt) { - macrosOut << " RMDir \"$INSTDIR\\" - << cmSystemTools::ConvertToWindowsOutputPath(pathIt->c_str()) + path = *pathIt; + cmSystemTools::ReplaceString(path, "/", "\\"); + macrosOut << " RMDir \"$INSTDIR\\" + << path.c_str() << "\"\n"; } macrosOut << " noremove_" << component->Name << ":\n"; @@ -837,7 +855,8 @@ std::string cmCPackNSISGenerator::CreateSelectionDependenciesDescription out << " SectionGetFlags ${" << (*dependIt)->Name << "} $0\n"; out << " IntOp $0 $0 | ${SF_SELECTED}\n"; out << " SectionSetFlags ${" << (*dependIt)->Name << "} $0\n"; - out << " IntOp $" << (*dependIt)->Name << "_selected 0 + ${SF_SELECTED}\n"; + out << " IntOp $" << (*dependIt)->Name + << "_selected 0 + ${SF_SELECTED}\n"; // Recurse out << CreateSelectionDependenciesDescription(*dependIt, visited).c_str(); } @@ -872,7 +891,8 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription out << " IntOp $" << (*dependIt)->Name << "_selected 0 + 0\n"; // Recurse - out << CreateDeselectionDependenciesDescription(*dependIt, visited).c_str(); + out << + CreateDeselectionDependenciesDescription(*dependIt, visited).c_str(); } return out.str(); diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index 8a7bb02cb..b795ff3da 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCPackNSISGenerator.h,v $ Language: C++ - Date: $Date: 2008-07-13 21:55:24 $ - Version: $Revision: 1.11.2.2 $ + Date: $Date: 2008-10-24 15:18:55 $ + Version: $Revision: 1.11.2.3 $ Copyright (c) 2002 Kitware, Inc. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -65,8 +65,8 @@ protected: (cmCPackComponent *component, std::set& visited); - /// Produce NSIS code that de-selects all of the components that are dependent - /// on this component, recursively. + /// Produce NSIS code that de-selects all of the components that are + /// dependent on this component, recursively. std::string CreateDeselectionDependenciesDescription (cmCPackComponent *component, std::set& visited); diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 3059c5802..20cf7262c 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCPackOSXX11Generator.cxx,v $ Language: C++ - Date: $Date: 2007-10-31 12:50:17 $ - Version: $Revision: 1.5 $ + Date: $Date: 2009-02-04 16:44:18 $ + Version: $Revision: 1.5.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -89,10 +89,15 @@ int cmCPackOSXX11Generator::CompressFiles(const char* outFileName, std::string contentsDirectory = packageDirFileName + "/Contents"; std::string resourcesDirectory = contentsDirectory + "/Resources"; std::string appDirectory = contentsDirectory + "/MacOS"; + std::string scriptDirectory = resourcesDirectory + "/Scripts"; + std::string resourceFileName = this->GetOption("CPACK_PACKAGE_FILE_NAME"); + resourceFileName += ".rsrc"; const char* dir = resourcesDirectory.c_str(); const char* appdir = appDirectory.c_str(); + const char* scrDir = scriptDirectory.c_str(); const char* contDir = contentsDirectory.c_str(); + const char* rsrcFile = resourceFileName.c_str(); const char* iconFile = this->GetOption("CPACK_PACKAGE_ICON"); if ( iconFile ) { @@ -124,6 +129,10 @@ int cmCPackOSXX11Generator::CompressFiles(const char* outFileName, !this->CopyResourcePlistFile("RuntimeScript", dir) || !this->CopyResourcePlistFile("OSXX11.Info.plist", contDir, "Info.plist" ) || + !this->CopyResourcePlistFile("OSXX11.main.scpt", scrDir, + "main.scpt", true ) || + !this->CopyResourcePlistFile("OSXScriptLauncher.rsrc", dir, + rsrcFile, true) || !this->CopyResourcePlistFile("OSXScriptLauncher", appdir, this->GetOption("CPACK_PACKAGE_FILE_NAME"), true) ) diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 4f8e055ed..ebdab77ad 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCPackPackageMakerGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-07-30 18:54:49 $ - Version: $Revision: 1.23.2.3 $ + Date: $Date: 2008-10-24 15:18:55 $ + Version: $Revision: 1.23.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -179,7 +179,8 @@ int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName, // Create the directory where downloaded component packages will // be placed. - const char* userUploadDirectory = this->GetOption("CPACK_UPLOAD_DIRECTORY"); + const char* userUploadDirectory = + this->GetOption("CPACK_UPLOAD_DIRECTORY"); std::string uploadDirectory; if (userUploadDirectory && *userUploadDirectory) { @@ -222,15 +223,20 @@ int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName, { if (this->PackageCompatibilityVersion < 10.5) { - cmCPackLogger(cmCPackLog::LOG_WARNING, - "CPack warning: please set CPACK_OSX_PACKAGE_VERSION to 10.5 or greater enable downloaded packages. CPack will build a non-downloaded package." - << std::endl); + cmCPackLogger( + cmCPackLog::LOG_WARNING, + "CPack warning: please set CPACK_OSX_PACKAGE_VERSION to 10.5 " + "or greater enable downloaded packages. CPack will build a " + "non-downloaded package." + << std::endl); } if (this->PackageMakerVersion < 3) { cmCPackLogger(cmCPackLog::LOG_WARNING, - "CPack warning: unable to build downloaded packages with PackageMaker versions prior to 3.0. CPack will build a non-downloaded package." + "CPack warning: unable to build downloaded " + "packages with PackageMaker versions prior " + "to 3.0. CPack will build a non-downloaded package." << std::endl); } @@ -605,7 +611,8 @@ GenerateComponentPackage(const char *packageFile, const cmCPackComponent& component) { cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Building component package: " << packageFile << std::endl); + "- Building component package: " << + packageFile << std::endl); // The command that will be used to run PackageMaker cmOStringStream pkgCmd; @@ -638,7 +645,8 @@ GenerateComponentPackage(const char *packageFile, // Create the Info.plist file for this component std::string moduleVersionSuffix = "."; moduleVersionSuffix += component.Name; - this->SetOption("CPACK_MODULE_VERSION_SUFFIX", moduleVersionSuffix.c_str()); + this->SetOption("CPACK_MODULE_VERSION_SUFFIX", + moduleVersionSuffix.c_str()); std::string infoFileName = component.Name; infoFileName += "-Info.plist"; if (!this->CopyResourcePlistFile("Info.plist", infoFileName.c_str())) @@ -801,7 +809,8 @@ cmCPackPackageMakerGenerator::CreateChoice(const cmCPackComponent& component, out << "Name << "Choice'].selected"; + out << " && choices['" << + (*dependIt)->Name << "Choice'].selected"; AddDependencyAttributes(**dependIt, visited, out); } } diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index a8444f988..91ae67f1d 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cpack.cxx,v $ Language: C++ - Date: $Date: 2008-09-24 14:07:50 $ - Version: $Revision: 1.42.2.2 $ + Date: $Date: 2009-02-04 16:44:18 $ + Version: $Revision: 1.42.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -474,5 +474,10 @@ int main (int argc, char *argv[]) #define cout no_cout_use_cmCPack_Log } + if (cmSystemTools::GetErrorOccuredFlag()) + { + return 1; + } + return 0; } diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index d9977eaad..ea534f717 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCTestBuildAndTestHandler.cxx,v $ Language: C++ - Date: $Date: 2008-09-04 21:10:45 $ - Version: $Revision: 1.20.2.2 $ + Date: $Date: 2009-01-13 18:03:54 $ + Version: $Revision: 1.20.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -359,10 +359,10 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) out << "Run test in directory: " << this->BuildRunDir << "\n"; cmSystemTools::ChangeDirectory(this->BuildRunDir.c_str()); } - out << "Running test executable: " << fullPath << " "; + out << "Running test command: \"" << fullPath << "\""; for(k=0; k < this->TestCommandArgs.size(); ++k) { - out << this->TestCommandArgs[k] << " "; + out << " \"" << this->TestCommandArgs[k] << "\""; } out << "\n"; @@ -386,7 +386,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) if(runTestRes != cmsysProcess_State_Exited || retval != 0) { - out << "Failed to run test command: " << testCommand[0] << "\n"; + out << "Test command failed: " << testCommand[0] << "\n"; retval = 1; } diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 0fec50bcb..7f25ebc31 100755 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCTestBuildHandler.cxx,v $ Language: C++ - Date: $Date: 2008-03-24 22:23:26 $ - Version: $Revision: 1.61.2.1 $ + Date: $Date: 2009-01-13 18:03:54 $ + Version: $Revision: 1.61.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -165,7 +165,8 @@ static cmCTestBuildCompileErrorWarningRex cmCTestWarningErrorFileLine[] = { { "^Warning W[0-9]+ ([a-zA-Z.\\:/0-9_+ ~-]+) ([0-9]+):", 1, 2 }, { "^([a-zA-Z./0-9_+ ~-]+):([0-9]+):", 1, 2 }, - { "^([a-zA-Z.\\:/0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, + { "^([a-zA-Z.\\:/0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, + { "^[0-9]+>([a-zA-Z.\\:/0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, { "^([a-zA-Z./0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, { "\"([a-zA-Z./0-9_+ ~-]+)\", line ([0-9]+)", 1, 2 }, { "File = ([a-zA-Z./0-9_+ ~-]+), Line = ([0-9]+)", 1, 2 }, diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 453b668d2..33cdfe6e2 100755 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCTestScriptHandler.cxx,v $ Language: C++ - Date: $Date: 2008-01-23 15:28:01 $ - Version: $Revision: 1.43 $ + Date: $Date: 2008-12-02 12:07:40 $ + Version: $Revision: 1.43.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -380,10 +380,35 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) f->CTestScriptHandler = this; this->Makefile->AddFunctionBlocker(f); + /* Execute CMakeDetermineSystem and CMakeSystemSpecificInformation, so + that variables like CMAKE_SYSTEM and also the search paths for libraries, + header and executables are set correctly and can be used. Makes new-style + ctest scripting easier. */ + std::string systemFile = + this->Makefile->GetModulesFile("CMakeDetermineSystem.cmake"); + if (!this->Makefile->ReadListFile(0, systemFile.c_str()) || + cmSystemTools::GetErrorOccuredFlag()) + { + return 2; + } + + systemFile = + this->Makefile->GetModulesFile("CMakeSystemSpecificInformation.cmake"); + if (!this->Makefile->ReadListFile(0, systemFile.c_str()) || + cmSystemTools::GetErrorOccuredFlag()) + { + cmCTestLog(this->CTest, DEBUG, "Error in read: " << systemFile.c_str() + << std::endl); + return 2; + } + // finally read in the script if (!this->Makefile->ReadListFile(0, script.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { + cmCTestLog(this->CTest, DEBUG, "Error in read script: " + << script.c_str() + << std::endl); return 2; } diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index e937c9869..ba000532b 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCTestTestCommand.cxx,v $ Language: C++ - Date: $Date: 2006-03-15 16:02:08 $ - Version: $Revision: 1.10 $ + Date: $Date: 2008-12-02 12:07:40 $ + Version: $Revision: 1.10.12.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -24,6 +24,8 @@ cmCTestTestCommand::cmCTestTestCommand() this->Arguments[ctt_START] = "START"; this->Arguments[ctt_END] = "END"; this->Arguments[ctt_STRIDE] = "STRIDE"; + this->Arguments[ctt_EXCLUDE] = "EXCLUDE"; + this->Arguments[ctt_INCLUDE] = "INCLUDE"; this->Arguments[ctt_LAST] = 0; this->Last = ctt_LAST; } @@ -68,6 +70,14 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() handler->SetOption("TestsToRunInformation", testsToRunString.str().c_str()); } + if(this->Values[ctt_EXCLUDE]) + { + handler->SetOption("ExcludeRegularExpression", this->Values[ctt_EXCLUDE]); + } + if(this->Values[ctt_INCLUDE]) + { + handler->SetOption("IncludeRegularExpression", this->Values[ctt_INCLUDE]); + } return handler; } diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index a6c6c3d96..046a5ff81 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCTestTestCommand.h,v $ Language: C++ - Date: $Date: 2006-03-29 17:01:24 $ - Version: $Revision: 1.6 $ + Date: $Date: 2008-12-02 12:07:40 $ + Version: $Revision: 1.6.12.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -44,7 +44,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "CTEST_TEST";} + virtual const char* GetName() { return "ctest_test";} /** * Succinct documentation. @@ -60,9 +60,16 @@ public: virtual const char* GetFullDocumentation() { return - " CTEST_TEST([BUILD build_dir] [RETURN_VALUE res])\n" + " ctest_test([BUILD build_dir]\n" + " [START start number] [END end number]\n" + " [STRIDE stride number] [EXCLUDE exclude regex ]\n" + " [INCLUDE include regex] [RETURN_VALUE res] )\n" "Tests the given build directory and stores results in Test.xml. The " - "second argument is a variable that will hold value."; + "second argument is a variable that will hold value. Optionally, " + "you can specify the starting test number START, the ending test number " + "END, the number of tests to skip between each test STRIDE, a regular " + "expression for tests to run INCLUDE, or a regular expression for tests " + "to not run EXCLUDE."; } cmTypeMacro(cmCTestTestCommand, cmCTestHandlerCommand); @@ -77,6 +84,8 @@ protected: ctt_START, ctt_END, ctt_STRIDE, + ctt_EXCLUDE, + ctt_INCLUDE, ctt_LAST }; }; diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 624fcdc6a..3334784eb 100755 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCTestUpdateHandler.cxx,v $ Language: C++ - Date: $Date: 2008-01-31 21:38:14 $ - Version: $Revision: 1.41 $ + Date: $Date: 2009-01-13 18:03:54 $ + Version: $Revision: 1.41.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -180,6 +180,46 @@ private: //********************************************************************** //---------------------------------------------------------------------- +class cmCTestUpdateHandlerLocale +{ +public: + cmCTestUpdateHandlerLocale(); + ~cmCTestUpdateHandlerLocale(); +private: + std::string saveLCMessages; +}; + +cmCTestUpdateHandlerLocale::cmCTestUpdateHandlerLocale() +{ + const char* lcmess = cmSystemTools::GetEnv("LC_MESSAGES"); + if(lcmess) + { + saveLCMessages = lcmess; + } + // if LC_MESSAGES is not set to C, then + // set it, so that svn/cvs info will be in english ascii + if(! (lcmess && strcmp(lcmess, "C") == 0)) + { + cmSystemTools::PutEnv("LC_MESSAGES=C"); + } +} + +cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale() +{ + // restore the value of LC_MESSAGES after running the version control + // commands + if(saveLCMessages.size()) + { + std::string put = "LC_MESSAGES="; + put += saveLCMessages; + cmSystemTools::PutEnv(put.c_str()); + } + else + { + cmSystemTools::UnsetEnv("LC_MESSAGES"); + } +} + //---------------------------------------------------------------------- cmCTestUpdateHandler::cmCTestUpdateHandler() { @@ -252,6 +292,10 @@ int cmCTestUpdateHandler::ProcessHandler() std::string goutput; std::string errors; + // Make sure VCS tool messages are in English so we can parse them. + cmCTestUpdateHandlerLocale fixLocale; + static_cast(fixLocale); + std::string checkoutErrorMessages; int retVal = 0; @@ -319,7 +363,7 @@ int cmCTestUpdateHandler::ProcessHandler() } if(!this->CTest->InitializeFromCommand(this->Command)) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestLog(this->CTest, HANDLER_OUTPUT, " Fatal Error in initialize: " << std::endl); cmSystemTools::SetFatalErrorOccured(); @@ -640,7 +684,9 @@ int cmCTestUpdateHandler::ProcessHandler() "(Updated to|At) revision ([0-9]+)\\."); cmsys::RegularExpression file_removed_line( - "cvs update: `(.*)' is no longer in the repository"); + "cvs update: `?([^']*)'? is no longer in the repository"); + cmsys::RegularExpression file_removed_line2( + "cvs update: warning: `?([^']*)'? is not \\(any longer\\) pertinent"); cmsys::RegularExpression file_update_line("([A-Z]) *(.*)"); std::string current_path = ""; bool first_file = true; @@ -689,6 +735,11 @@ int cmCTestUpdateHandler::ProcessHandler() removed_line = "D " + file_removed_line.match(1); line = removed_line.c_str(); } + else if ( file_removed_line2.find(line) ) + { + removed_line = "D " + file_removed_line2.match(1); + line = removed_line.c_str(); + } if ( file_update_line.find(line) ) { if ( file_count == 0 ) @@ -700,7 +751,7 @@ int cmCTestUpdateHandler::ProcessHandler() std::string upFile = file_update_line.match(2); char mod = upChar[0]; bool modifiedOrConflict = false; - if ( mod == 'X') + if ( mod == 'X' || mod == 'L') { continue; } @@ -1102,7 +1153,6 @@ int cmCTestUpdateHandler::ProcessHandler() } os << "" << std::endl; os << "" << std::endl; - if (! res ) { cmCTestLog(this->CTest, ERROR_MESSAGE, diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index e6df2ca2d..3c9737526 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCursesMainForm.cxx,v $ Language: C++ - Date: $Date: 2008-03-07 21:32:09 $ - Version: $Revision: 1.73 $ + Date: $Date: 2008-10-24 15:18:55 $ + Version: $Revision: 1.73.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -683,14 +683,15 @@ int cmCursesMainForm::Configure(int noconfigure) { this->OkToGenerate = false; } - // reset error condition - cmSystemTools::ResetErrorOccuredFlag(); int xx,yy; getmaxyx(stdscr, yy, xx); cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm( this->Errors, - cmSystemTools::GetErrorOccuredFlag() ? "Errors occurred during the last pass." : - "CMake produced the following output."); + cmSystemTools::GetErrorOccuredFlag() + ? "Errors occurred during the last pass." : + "CMake produced the following output."); + // reset error condition + cmSystemTools::ResetErrorOccuredFlag(); CurrentForm = msgs; msgs->Render(1,1,xx,yy); msgs->HandleInput(); diff --git a/Source/QtDialog/CMake.desktop b/Source/QtDialog/CMake.desktop index 0c82538ad..9568501b9 100644 --- a/Source/QtDialog/CMake.desktop +++ b/Source/QtDialog/CMake.desktop @@ -8,6 +8,6 @@ Icon=CMakeSetup.png Terminal=false X-MultipleArgs=false Type=Application -Categories=Application;Development; +Categories=Development; StartupNotify=true MimeType=application/x-cmakecache; diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index b74987ef5..4032b474e 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -16,11 +16,11 @@ ELSE(NOT QT4_FOUND) SET(SRCS AddCacheEntry.cxx AddCacheEntry.h - CMakeFirstConfigure.cxx - CMakeFirstConfigure.h CMakeSetup.cxx CMakeSetupDialog.cxx CMakeSetupDialog.h + FirstConfigure.cxx + FirstConfigure.h QCMake.cxx QCMake.h QCMakeCacheView.cxx @@ -31,15 +31,17 @@ ELSE(NOT QT4_FOUND) QMacInstallDialog.h ) QT4_WRAP_UI(UI_SRCS - CMakeFirstConfigure.ui CMakeSetupDialog.ui + Compilers.ui + CrossCompiler.ui AddCacheEntry.ui MacInstallDialog.ui ) QT4_WRAP_CPP(MOC_SRCS AddCacheEntry.h - CMakeFirstConfigure.h + Compilers.h CMakeSetupDialog.h + FirstConfigure.h QCMake.h QCMakeCacheView.h QCMakeWidgets.h @@ -70,6 +72,11 @@ ELSE(NOT QT4_FOUND) ENDIF(APPLE) SET(CMAKE_INSTALL_DESTINATION_ARGS BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") + ELSE(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) + # Since the built CMake will install itself instead of the + # generating CMake, tell it that the install rules were generated + # by CMake 2.4. + INSTALL(CODE "SET(CMAKE_INSTALL_SELF_2_4 1)") ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) # if qt is not static and we are on windows then skip the install # I don't want to distribute qt dlls diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index e815c193c..1ad5b494a 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: CMakeSetupDialog.cxx,v $ Language: C++ - Date: $Date: 2008-07-13 21:55:25 $ - Version: $Revision: 1.40.2.7 $ + Date: $Date: 2008-12-31 15:14:30 $ + Version: $Revision: 1.40.2.8 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -36,7 +36,7 @@ #include "QCMake.h" #include "QCMakeCacheView.h" #include "AddCacheEntry.h" -#include "CMakeFirstConfigure.h" +#include "FirstConfigure.h" QCMakeThread::QCMakeThread(QObject* p) : QThread(p), CMakeInstance(NULL) @@ -552,7 +552,7 @@ void CMakeSetupDialog::setEnabledState(bool enabled) bool CMakeSetupDialog::setupFirstConfigure() { - CMakeFirstConfigure dialog; + FirstConfigure dialog; // initialize dialog and restore saved settings @@ -561,7 +561,7 @@ bool CMakeSetupDialog::setupFirstConfigure() // restore from settings dialog.loadFromSettings(); - + if(dialog.exec() == QDialog::Accepted) { dialog.saveToSettings(); @@ -593,45 +593,42 @@ bool CMakeSetupDialog::setupFirstConfigure() } else if(dialog.crossCompilerSetup()) { - QString toolchainFile = dialog.crossCompilerToolChainFile(); - if(!toolchainFile.isEmpty()) - { - m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_TOOLCHAIN_FILE", - "Cross Compile ToolChain File", toolchainFile, false); - } - else + QString fortranCompiler = dialog.getFortranCompiler(); + if(!fortranCompiler.isEmpty()) { - QString fortranCompiler = dialog.getFortranCompiler(); - if(!fortranCompiler.isEmpty()) - { - m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER", - "Fortran compiler.", fortranCompiler, false); - } - - QString mode = dialog.getCrossIncludeMode(); - m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE", - "CMake Find Include Mode", mode, false); - mode = dialog.getCrossLibraryMode(); - m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY", - "CMake Find Library Mode", mode, false); - mode = dialog.getCrossProgramMode(); - m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM", - "CMake Find Program Mode", mode, false); - - QString rootPath = dialog.getCrossRoot(); - m->insertProperty(QCMakeProperty::PATH, "CMAKE_FIND_ROOT_PATH", - "CMake Find Root Path", rootPath, false); - - QString systemName = dialog.getSystemName(); - m->insertProperty(QCMakeProperty::STRING, "CMAKE_SYSTEM_NAME", - "CMake System Name", systemName, false); - QString cxxCompiler = dialog.getCXXCompiler(); - m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER", - "CXX compiler.", cxxCompiler, false); - QString cCompiler = dialog.getCCompiler(); - m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER", - "C compiler.", cCompiler, false); + m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER", + "Fortran compiler.", fortranCompiler, false); } + + QString mode = dialog.getCrossIncludeMode(); + m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE", + "CMake Find Include Mode", mode, false); + mode = dialog.getCrossLibraryMode(); + m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY", + "CMake Find Library Mode", mode, false); + mode = dialog.getCrossProgramMode(); + m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM", + "CMake Find Program Mode", mode, false); + + QString rootPath = dialog.getCrossRoot(); + m->insertProperty(QCMakeProperty::PATH, "CMAKE_FIND_ROOT_PATH", + "CMake Find Root Path", rootPath, false); + + QString systemName = dialog.getSystemName(); + m->insertProperty(QCMakeProperty::STRING, "CMAKE_SYSTEM_NAME", + "CMake System Name", systemName, false); + QString cxxCompiler = dialog.getCXXCompiler(); + m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER", + "CXX compiler.", cxxCompiler, false); + QString cCompiler = dialog.getCCompiler(); + m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER", + "C compiler.", cCompiler, false); + } + else if(dialog.crossCompilerToolChainFile()) + { + QString toolchainFile = dialog.getCrossCompilerToolChainFile(); + m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_TOOLCHAIN_FILE", + "Cross Compile ToolChain File", toolchainFile, false); } return true; } diff --git a/Source/QtDialog/Compilers.h b/Source/QtDialog/Compilers.h new file mode 100644 index 000000000..e9c90a504 --- /dev/null +++ b/Source/QtDialog/Compilers.h @@ -0,0 +1,21 @@ + + +#ifndef COMPILERS_HPP +#define COMPILERS_HPP + +#include +#include + +class Compilers : public QWidget, public Ui::Compilers +{ + Q_OBJECT +public: + Compilers(QWidget* p=NULL) : + QWidget(p) + { + this->setupUi(this); + } +}; + +#endif + diff --git a/Source/QtDialog/Compilers.ui b/Source/QtDialog/Compilers.ui new file mode 100644 index 000000000..41f70acdb --- /dev/null +++ b/Source/QtDialog/Compilers.ui @@ -0,0 +1,87 @@ + + Compilers + + + + 0 + 0 + 506 + 115 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Compilers + + + + 4 + + + 4 + + + 4 + + + + + C + + + + + + + + + + C++ + + + + + + + + + + Fortran + + + + + + + + + + + + + + QCMakeFilePathEditor + QLineEdit +
QCMakeWidgets.h
+
+
+ + +
diff --git a/Source/QtDialog/CrossCompiler.ui b/Source/QtDialog/CrossCompiler.ui new file mode 100644 index 000000000..1fb1ebf49 --- /dev/null +++ b/Source/QtDialog/CrossCompiler.ui @@ -0,0 +1,213 @@ + + CrossCompiler + + + + 0 + 0 + 433 + 319 + + + + CrossCompiler + + + + + + + 0 + 0 + + + + Target System + + + + + + + 0 + 0 + + + + Operating System + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Version + + + true + + + + + + + + + + + 0 + 0 + + + + Processor + + + true + + + + + + + + + + + + + + 0 + 0 + + + + Find Program/Library/Include + + + + + + + 0 + 0 + + + + Target Root + + + true + + + + + + + + + + + 0 + 0 + + + + Program Mode + + + + + + + + + + + 0 + 0 + + + + Library Mode + + + + + + + + + + + 0 + 0 + + + + Include Mode + + + + + + + + + + + + + Qt::TabFocus + + + + + + + + QCMakePathEditor + QLineEdit +
QCMakeWidgets.h
+
+ + Compilers + QWidget +
Compilers.h
+ 1 +
+
+ + systemVersion + systemProcessor + CrossCompilers + crossFindRoot + crossProgramMode + crossLibraryMode + crossIncludeMode + + + +
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx new file mode 100644 index 000000000..f522760c0 --- /dev/null +++ b/Source/QtDialog/FirstConfigure.cxx @@ -0,0 +1,509 @@ + +#include "FirstConfigure.h" +#include "Compilers.h" + +#include +#include +#include +#include + + +StartCompilerSetup::StartCompilerSetup(QWidget* p) + : QWizardPage(p) +{ + QVBoxLayout* l = new QVBoxLayout(this); + l->addWidget(new QLabel(tr("Specify the generator for this project"))); + this->GeneratorOptions = new QComboBox(this); + l->addWidget(this->GeneratorOptions); + l->addSpacing(6); + + this->CompilerSetupOptions[0] = new QRadioButton("Use default native compilers", this); + this->CompilerSetupOptions[1] = new QRadioButton("Specify native compilers", this); + this->CompilerSetupOptions[2] = new QRadioButton("Specify toolchain file for cross-compiling", this); + this->CompilerSetupOptions[3] = new QRadioButton("Specify options for cross-compiling", this); + l->addWidget(this->CompilerSetupOptions[0]); + l->addWidget(this->CompilerSetupOptions[1]); + l->addWidget(this->CompilerSetupOptions[2]); + l->addWidget(this->CompilerSetupOptions[3]); + + this->CompilerSetupOptions[0]->setChecked(true); + + QObject::connect(this->CompilerSetupOptions[0], SIGNAL(toggled(bool)), + this, SLOT(onSelectionChanged(bool))); + QObject::connect(this->CompilerSetupOptions[1], SIGNAL(toggled(bool)), + this, SLOT(onSelectionChanged(bool))); + QObject::connect(this->CompilerSetupOptions[2], SIGNAL(toggled(bool)), + this, SLOT(onSelectionChanged(bool))); + QObject::connect(this->CompilerSetupOptions[3], SIGNAL(toggled(bool)), + this, SLOT(onSelectionChanged(bool))); +} + +StartCompilerSetup::~StartCompilerSetup() +{ +} + +void StartCompilerSetup::setGenerators(const QStringList& gens) +{ + this->GeneratorOptions->clear(); + this->GeneratorOptions->addItems(gens); +}; + +void StartCompilerSetup::setCurrentGenerator(const QString& gen) +{ + int idx = this->GeneratorOptions->findText(gen); + if(idx != -1) + { + this->GeneratorOptions->setCurrentIndex(idx); + } +} + +QString StartCompilerSetup::getGenerator() const +{ + return this->GeneratorOptions->currentText(); +}; + +bool StartCompilerSetup::defaultSetup() const +{ + return this->CompilerSetupOptions[0]->isChecked(); +} + +bool StartCompilerSetup::compilerSetup() const +{ + return this->CompilerSetupOptions[1]->isChecked(); +} + +bool StartCompilerSetup::crossCompilerToolChainFile() const +{ + return this->CompilerSetupOptions[2]->isChecked(); +} + +bool StartCompilerSetup::crossCompilerSetup() const +{ + return this->CompilerSetupOptions[3]->isChecked(); +} + +void StartCompilerSetup::onSelectionChanged(bool on) +{ + if(on) + selectionChanged(); +} + +int StartCompilerSetup::nextId() const +{ + if(compilerSetup()) + return NativeSetup; + if(crossCompilerSetup()) + return CrossSetup; + if(crossCompilerToolChainFile()) + return ToolchainSetup; + return -1; +} + +NativeCompilerSetup::NativeCompilerSetup(QWidget* p) + : QWizardPage(p) +{ + QVBoxLayout* l = new QVBoxLayout(this); + QWidget* c = new QWidget(this); + l->addWidget(c); + this->setupUi(c); +} + +NativeCompilerSetup::~NativeCompilerSetup() +{ +} + +QString NativeCompilerSetup::getCCompiler() const +{ + return this->CCompiler->text(); +} + +void NativeCompilerSetup::setCCompiler(const QString& s) +{ + this->CCompiler->setText(s); +} + +QString NativeCompilerSetup::getCXXCompiler() const +{ + return this->CXXCompiler->text(); +} + +void NativeCompilerSetup::setCXXCompiler(const QString& s) +{ + this->CXXCompiler->setText(s); +} + +QString NativeCompilerSetup::getFortranCompiler() const +{ + return this->FortranCompiler->text(); +} + +void NativeCompilerSetup::setFortranCompiler(const QString& s) +{ + this->FortranCompiler->setText(s); +} + + +CrossCompilerSetup::CrossCompilerSetup(QWidget* p) + : QWizardPage(p) +{ + this->setupUi(this); + QWidget::setTabOrder(systemName, systemVersion); + QWidget::setTabOrder(systemVersion, systemProcessor); + QWidget::setTabOrder(systemProcessor, CrossCompilers->CCompiler); + QWidget::setTabOrder(CrossCompilers->CCompiler, CrossCompilers->CXXCompiler); + QWidget::setTabOrder(CrossCompilers->CXXCompiler, CrossCompilers->FortranCompiler); + QWidget::setTabOrder(CrossCompilers->FortranCompiler, crossFindRoot); + QWidget::setTabOrder(crossFindRoot, crossProgramMode); + QWidget::setTabOrder(crossProgramMode, crossLibraryMode); + QWidget::setTabOrder(crossLibraryMode, crossIncludeMode); + + // fill in combo boxes + QStringList modes; + modes << "Search in Target Root, then native system"; + modes << "Search only in Target Root"; + modes << "Search only in native system"; + crossProgramMode->addItems(modes); + crossLibraryMode->addItems(modes); + crossIncludeMode->addItems(modes); + crossProgramMode->setCurrentIndex(2); + crossLibraryMode->setCurrentIndex(1); + crossIncludeMode->setCurrentIndex(1); + + this->registerField("systemName*", this->systemName); +} + +CrossCompilerSetup::~CrossCompilerSetup() +{ +} + +QString CrossCompilerSetup::getCCompiler() const +{ + return this->CrossCompilers->CCompiler->text(); +} + +void CrossCompilerSetup::setCCompiler(const QString& s) +{ + this->CrossCompilers->CCompiler->setText(s); +} + +QString CrossCompilerSetup::getCXXCompiler() const +{ + return this->CrossCompilers->CXXCompiler->text(); +} + +void CrossCompilerSetup::setCXXCompiler(const QString& s) +{ + this->CrossCompilers->CXXCompiler->setText(s); +} + +QString CrossCompilerSetup::getFortranCompiler() const +{ + return this->CrossCompilers->FortranCompiler->text(); +} + +void CrossCompilerSetup::setFortranCompiler(const QString& s) +{ + this->CrossCompilers->FortranCompiler->setText(s); +} + +QString CrossCompilerSetup::getSystem() const +{ + return this->systemName->text(); +} + +void CrossCompilerSetup::setSystem(const QString& t) +{ + this->systemName->setText(t); +} + + +QString CrossCompilerSetup::getVersion() const +{ + return this->systemVersion->text(); +} + +void CrossCompilerSetup::setVersion(const QString& t) +{ + this->systemVersion->setText(t); +} + + +QString CrossCompilerSetup::getProcessor() const +{ + return this->systemProcessor->text(); +} + +void CrossCompilerSetup::setProcessor(const QString& t) +{ + this->systemProcessor->setText(t); +} + +QString CrossCompilerSetup::getFindRoot() const +{ + return this->crossFindRoot->text(); +} + +void CrossCompilerSetup::setFindRoot(const QString& t) +{ + return this->crossFindRoot->setText(t); +} + +int CrossCompilerSetup::getProgramMode() const +{ + return this->crossProgramMode->currentIndex(); +} + +int CrossCompilerSetup::getLibraryMode() const +{ + return this->crossLibraryMode->currentIndex(); +} + +int CrossCompilerSetup::getIncludeMode() const +{ + return this->crossIncludeMode->currentIndex(); +} + +void CrossCompilerSetup::setProgramMode(int m) +{ + this->crossProgramMode->setCurrentIndex(m); +} + +void CrossCompilerSetup::setLibraryMode(int m) +{ + this->crossLibraryMode->setCurrentIndex(m); +} + +void CrossCompilerSetup::setIncludeMode(int m) +{ + this->crossIncludeMode->setCurrentIndex(m); +} + +ToolchainCompilerSetup::ToolchainCompilerSetup(QWidget* p) + : QWizardPage(p) +{ + QVBoxLayout* l = new QVBoxLayout(this); + l->addWidget(new QLabel(tr("Specify the Toolchain file"))); + this->ToolchainFile = new QCMakeFilePathEditor(this); + l->addWidget(this->ToolchainFile); +} + +ToolchainCompilerSetup::~ToolchainCompilerSetup() +{ +} + +QString ToolchainCompilerSetup::toolchainFile() const +{ + return this->ToolchainFile->text(); +} + +void ToolchainCompilerSetup::setToolchainFile(const QString& t) +{ + this->ToolchainFile->setText(t); +} + + + +FirstConfigure::FirstConfigure() +{ + //this->setOption(QWizard::HaveFinishButtonOnEarlyPages, true); + this->mStartCompilerSetupPage = new StartCompilerSetup(this); + this->setPage(Start, this->mStartCompilerSetupPage); + QObject::connect(this->mStartCompilerSetupPage, SIGNAL(selectionChanged()), + this, SLOT(restart())); + + this->mNativeCompilerSetupPage = new NativeCompilerSetup(this); + this->setPage(NativeSetup, this->mNativeCompilerSetupPage); + + this->mCrossCompilerSetupPage = new CrossCompilerSetup(this); + this->setPage(CrossSetup, this->mCrossCompilerSetupPage); + + this->mToolchainCompilerSetupPage = new ToolchainCompilerSetup(this); + this->setPage(ToolchainSetup, this->mToolchainCompilerSetupPage); +} + +FirstConfigure::~FirstConfigure() +{ +} + +void FirstConfigure::setGenerators(const QStringList& gens) +{ + this->mStartCompilerSetupPage->setGenerators(gens); +} + +QString FirstConfigure::getGenerator() const +{ + return this->mStartCompilerSetupPage->getGenerator(); +} + +void FirstConfigure::loadFromSettings() +{ + QSettings settings; + // restore generator + settings.beginGroup("Settings/StartPath"); + QString lastGen = settings.value("LastGenerator").toString(); + this->mStartCompilerSetupPage->setCurrentGenerator(lastGen); + settings.endGroup(); + + // restore compiler setup + settings.beginGroup("Settings/Compiler"); + this->mNativeCompilerSetupPage->setCCompiler(settings.value("CCompiler").toString()); + this->mNativeCompilerSetupPage->setCXXCompiler(settings.value("CXXCompiler").toString()); + this->mNativeCompilerSetupPage->setFortranCompiler(settings.value("FortranCompiler").toString()); + settings.endGroup(); + + // restore cross compiler setup + settings.beginGroup("Settings/CrossCompiler"); + this->mCrossCompilerSetupPage->setCCompiler(settings.value("CCompiler").toString()); + this->mCrossCompilerSetupPage->setCXXCompiler(settings.value("CXXCompiler").toString()); + this->mCrossCompilerSetupPage->setFortranCompiler(settings.value("FortranCompiler").toString()); + this->mToolchainCompilerSetupPage->setToolchainFile(settings.value("ToolChainFile").toString()); + this->mCrossCompilerSetupPage->setSystem(settings.value("SystemName").toString()); + this->mCrossCompilerSetupPage->setVersion(settings.value("SystemVersion").toString()); + this->mCrossCompilerSetupPage->setProcessor(settings.value("SystemProcessor").toString()); + this->mCrossCompilerSetupPage->setFindRoot(settings.value("FindRoot").toString()); + this->mCrossCompilerSetupPage->setProgramMode(settings.value("ProgramMode", 0).toInt()); + this->mCrossCompilerSetupPage->setLibraryMode(settings.value("LibraryMode", 0).toInt()); + this->mCrossCompilerSetupPage->setIncludeMode(settings.value("IncludeMode", 0).toInt()); + settings.endGroup(); +} + +void FirstConfigure::saveToSettings() +{ + QSettings settings; + + // save generator + settings.beginGroup("Settings/StartPath"); + QString lastGen = this->mStartCompilerSetupPage->getGenerator(); + settings.setValue("LastGenerator", lastGen); + settings.endGroup(); + + // save compiler setup + settings.beginGroup("Settings/Compiler"); + settings.setValue("CCompiler", this->mNativeCompilerSetupPage->getCCompiler()); + settings.setValue("CXXCompiler", this->mNativeCompilerSetupPage->getCXXCompiler()); + settings.setValue("FortranCompiler", this->mNativeCompilerSetupPage->getFortranCompiler()); + settings.endGroup(); + + // save cross compiler setup + settings.beginGroup("Settings/CrossCompiler"); + settings.setValue("CCompiler", this->mCrossCompilerSetupPage->getCCompiler()); + settings.setValue("CXXCompiler", this->mCrossCompilerSetupPage->getCXXCompiler()); + settings.setValue("FortranCompiler", this->mCrossCompilerSetupPage->getFortranCompiler()); + settings.setValue("ToolChainFile", this->getCrossCompilerToolChainFile()); + settings.setValue("SystemName", this->mCrossCompilerSetupPage->getSystem()); + settings.setValue("SystemVersion", this->mCrossCompilerSetupPage->getVersion()); + settings.setValue("SystemProcessor", this->mCrossCompilerSetupPage->getProcessor()); + settings.setValue("FindRoot", this->mCrossCompilerSetupPage->getFindRoot()); + settings.setValue("ProgramMode", this->mCrossCompilerSetupPage->getProgramMode()); + settings.setValue("LibraryMode", this->mCrossCompilerSetupPage->getLibraryMode()); + settings.setValue("IncludeMode", this->mCrossCompilerSetupPage->getIncludeMode()); + settings.endGroup(); +} + +bool FirstConfigure::defaultSetup() const +{ + return this->mStartCompilerSetupPage->defaultSetup(); +} + +bool FirstConfigure::compilerSetup() const +{ + return this->mStartCompilerSetupPage->compilerSetup(); +} + +bool FirstConfigure::crossCompilerSetup() const +{ + return this->mStartCompilerSetupPage->crossCompilerSetup(); +} + +bool FirstConfigure::crossCompilerToolChainFile() const +{ + return this->mStartCompilerSetupPage->crossCompilerToolChainFile(); +} + +QString FirstConfigure::getCrossCompilerToolChainFile() const +{ + return this->mToolchainCompilerSetupPage->toolchainFile(); +} + +QString FirstConfigure::getSystemName() const +{ + return this->mCrossCompilerSetupPage->getSystem(); +} + +QString FirstConfigure::getCCompiler() const +{ + if(this->compilerSetup()) + { + return this->mNativeCompilerSetupPage->getCCompiler(); + } + else if(this->crossCompilerSetup()) + { + return this->mCrossCompilerSetupPage->getCCompiler(); + } + return QString(); +} + +QString FirstConfigure::getCXXCompiler() const +{ + if(this->compilerSetup()) + { + return this->mNativeCompilerSetupPage->getCXXCompiler(); + } + else if(this->crossCompilerSetup()) + { + return this->mCrossCompilerSetupPage->getCXXCompiler(); + } + return QString(); +} + +QString FirstConfigure::getFortranCompiler() const +{ + if(this->compilerSetup()) + { + return this->mNativeCompilerSetupPage->getFortranCompiler(); + } + else if(this->crossCompilerSetup()) + { + return this->mCrossCompilerSetupPage->getFortranCompiler(); + } + return QString(); +} + + +QString FirstConfigure::getSystemVersion() const +{ + return this->mCrossCompilerSetupPage->getVersion(); +} + +QString FirstConfigure::getSystemProcessor() const +{ + return this->mCrossCompilerSetupPage->getProcessor(); +} + +QString FirstConfigure::getCrossRoot() const +{ + return this->mCrossCompilerSetupPage->getFindRoot(); +} + +const QString CrossModes[] = +{ + "BOTH", + "ONLY", + "NEVER" +}; + +QString FirstConfigure::getCrossProgramMode() const +{ + return CrossModes[this->mCrossCompilerSetupPage->getProgramMode()]; +} + +QString FirstConfigure::getCrossLibraryMode() const +{ + return CrossModes[this->mCrossCompilerSetupPage->getLibraryMode()]; +} + +QString FirstConfigure::getCrossIncludeMode() const +{ + return CrossModes[this->mCrossCompilerSetupPage->getIncludeMode()]; +} + diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h new file mode 100644 index 000000000..f4e368bfc --- /dev/null +++ b/Source/QtDialog/FirstConfigure.h @@ -0,0 +1,177 @@ + +#ifndef FirstConfigure_h +#define FirstConfigure_h + +#include +#include +#include "ui_Compilers.h" +#include "ui_CrossCompiler.h" + +class QRadioButton; +class QComboBox; + +//! the wizard pages we'll use for the first configure of a build +enum FirstConfigurePages +{ + Start, + NativeSetup, + ToolchainSetup, + CrossSetup, + Done +}; + +//! the first page that gives basic options for what compilers setup to choose from +class StartCompilerSetup : public QWizardPage +{ + Q_OBJECT + public: + StartCompilerSetup(QWidget* p); + ~StartCompilerSetup(); + void setGenerators(const QStringList& gens); + void setCurrentGenerator(const QString& gen); + QString getGenerator() const; + + bool defaultSetup() const; + bool compilerSetup() const; + bool crossCompilerSetup() const; + bool crossCompilerToolChainFile() const; + + int nextId() const; + + signals: + void selectionChanged(); + + protected slots: + void onSelectionChanged(bool); + + protected: + QComboBox* GeneratorOptions; + QRadioButton* CompilerSetupOptions[4]; +}; + +//! the page that gives basic options for native compilers +class NativeCompilerSetup : public QWizardPage, protected Ui::Compilers +{ + Q_OBJECT + public: + NativeCompilerSetup(QWidget* p); + ~NativeCompilerSetup(); + + QString getCCompiler() const; + void setCCompiler(const QString&); + + QString getCXXCompiler() const; + void setCXXCompiler(const QString&); + + QString getFortranCompiler() const; + void setFortranCompiler(const QString&); + + int nextId() const { return -1; } +}; + +//! the page that gives options for cross compilers +class CrossCompilerSetup : public QWizardPage, protected Ui::CrossCompiler +{ + Q_OBJECT + public: + CrossCompilerSetup(QWidget* p); + ~CrossCompilerSetup(); + + QString getSystem() const; + void setSystem(const QString&); + + QString getVersion() const; + void setVersion(const QString&); + + QString getProcessor() const; + void setProcessor(const QString&); + + QString getCCompiler() const; + void setCCompiler(const QString&); + + QString getCXXCompiler() const; + void setCXXCompiler(const QString&); + + QString getFortranCompiler() const; + void setFortranCompiler(const QString&); + + QString getFindRoot() const; + void setFindRoot(const QString&); + + enum CrossMode + { + BOTH, + ONLY, + NEVER + }; + + int getProgramMode() const; + void setProgramMode(int); + int getLibraryMode() const; + void setLibraryMode(int); + int getIncludeMode() const; + void setIncludeMode(int); + + int nextId() const { return -1; } +}; + +//! the page that gives options for a toolchain file +class ToolchainCompilerSetup : public QWizardPage +{ + Q_OBJECT + public: + ToolchainCompilerSetup(QWidget* p); + ~ToolchainCompilerSetup(); + + QString toolchainFile() const; + void setToolchainFile(const QString&); + + int nextId() const { return -1; } + + protected: + QCMakeFilePathEditor* ToolchainFile; +}; + +//! the wizard with the pages +class FirstConfigure : public QWizard +{ + Q_OBJECT +public: + FirstConfigure(); + ~FirstConfigure(); + + void setGenerators(const QStringList& gens); + QString getGenerator() const; + + bool defaultSetup() const; + bool compilerSetup() const; + bool crossCompilerSetup() const; + bool crossCompilerToolChainFile() const; + + QString getCCompiler() const; + QString getCXXCompiler() const; + QString getFortranCompiler() const; + + QString getSystemName() const; + QString getSystemVersion() const; + QString getSystemProcessor() const; + QString getCrossRoot() const; + QString getCrossProgramMode() const; + QString getCrossLibraryMode() const; + QString getCrossIncludeMode() const; + + QString getCrossCompilerToolChainFile() const; + + void loadFromSettings(); + void saveToSettings(); + +protected: + StartCompilerSetup* mStartCompilerSetupPage; + NativeCompilerSetup* mNativeCompilerSetupPage; + CrossCompilerSetup* mCrossCompilerSetupPage; + ToolchainCompilerSetup* mToolchainCompilerSetupPage; + +}; + +#endif // FirstConfigure_h + diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx index afd00e638..20bf336da 100644 --- a/Source/QtDialog/QCMakeWidgets.cxx +++ b/Source/QtDialog/QCMakeWidgets.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: QCMakeWidgets.cxx,v $ Language: C++ - Date: $Date: 2008-05-23 20:09:44 $ - Version: $Revision: 1.1.2.2 $ + Date: $Date: 2008-12-31 15:14:30 $ + Version: $Revision: 1.1.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -104,15 +104,32 @@ void QCMakePathEditor::chooseFile() } } -QCMakeFileCompleter::QCMakeFileCompleter(QObject* o, bool dirs) - : QCompleter(o) +// use same QDirModel for all completers +static QDirModel* fileDirModel() +{ + static QDirModel* m = NULL; + if(!m) + { + m = new QDirModel(); + } + return m; +} +static QDirModel* pathDirModel() { - QDirModel* model = new QDirModel(this); - if(dirs) + static QDirModel* m = NULL; + if(!m) { - model->setFilter(QDir::AllDirs | QDir::Drives | QDir::NoDotAndDotDot); + m = new QDirModel(); + m->setFilter(QDir::AllDirs | QDir::Drives | QDir::NoDotAndDotDot); } - this->setModel(model); + return m; +} + +QCMakeFileCompleter::QCMakeFileCompleter(QObject* o, bool dirs) + : QCompleter(o) +{ + QDirModel* m = dirs ? pathDirModel() : fileDirModel(); + this->setModel(m); } QString QCMakeFileCompleter::pathFromIndex(const QModelIndex& idx) const diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index ceaf91491..c78d40e32 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmAddCustomTargetCommand.cxx,v $ Language: C++ - Date: $Date: 2008-03-07 22:05:06 $ - Version: $Revision: 1.37 $ + Date: $Date: 2008-10-24 15:18:45 $ + Version: $Revision: 1.37.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -55,6 +55,7 @@ bool cmAddCustomTargetCommand bool verbatim = false; std::string comment_buffer; const char* comment = 0; + std::vector sources; // Keep track of parser state. enum tdoing { @@ -62,6 +63,7 @@ bool cmAddCustomTargetCommand doing_depends, doing_working_directory, doing_comment, + doing_source, doing_verbatim }; tdoing doing = doing_command; @@ -111,6 +113,10 @@ bool cmAddCustomTargetCommand currentLine.clear(); } } + else if(copy == "SOURCES") + { + doing = doing_source; + } else { switch (doing) @@ -128,6 +134,9 @@ bool cmAddCustomTargetCommand comment_buffer = copy; comment = comment_buffer.c_str(); break; + case doing_source: + sources.push_back(copy); + break; default: this->SetError("Wrong syntax. Unknown type of argument."); return false; @@ -164,9 +173,13 @@ bool cmAddCustomTargetCommand // Add the utility target to the makefile. bool escapeOldStyle = !verbatim; - this->Makefile->AddUtilityCommand(args[0].c_str(), excludeFromAll, - working_directory.c_str(), depends, - commandLines, escapeOldStyle, comment); + cmTarget* target = + this->Makefile->AddUtilityCommand(args[0].c_str(), excludeFromAll, + working_directory.c_str(), depends, + commandLines, escapeOldStyle, comment); + + // Add additional user-specified source files to the target. + target->AddSources(sources); return true; } diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index f4310d1ea..3b744bf8f 100644 --- a/Source/cmAddCustomTargetCommand.h +++ b/Source/cmAddCustomTargetCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmAddCustomTargetCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.22 $ + Date: $Date: 2008-10-24 15:18:45 $ + Version: $Revision: 1.22.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -68,7 +68,8 @@ public: " [COMMAND command2 [args2...] ...]\n" " [DEPENDS depend depend depend ... ]\n" " [WORKING_DIRECTORY dir]\n" - " [COMMENT comment] [VERBATIM])\n" + " [COMMENT comment] [VERBATIM]\n" + " [SOURCES src1 [src2...]])\n" "Adds a target with the given name that executes the given commands. " "The target has no output file and is ALWAYS CONSIDERED OUT OF DATE " "even if the commands try to create a file with the name of the " @@ -94,7 +95,13 @@ public: "Use of VERBATIM is recommended as it enables correct behavior. " "When VERBATIM is not given the behavior is platform specific. " "In the future VERBATIM may be enabled by default. The only reason " - "it is an option is to preserve compatibility with older CMake code."; + "it is an option is to preserve compatibility with older CMake code." + "\n" + "The SOURCES option specifies additional source files to be included " + "in the custom target. " + "Specified source files will be added to IDE project files for " + "convenience in editing even if they have not build rules." + ; } cmTypeMacro(cmAddCustomTargetCommand, cmCommand); diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx index 56ab238eb..1d2e4e57e 100644 --- a/Source/cmBootstrapCommands.cxx +++ b/Source/cmBootstrapCommands.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmBootstrapCommands.cxx,v $ Language: C++ - Date: $Date: 2008-07-13 21:55:23 $ - Version: $Revision: 1.27.2.1 $ + Date: $Date: 2009-02-04 16:44:16 $ + Version: $Revision: 1.27.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -93,6 +93,7 @@ #include "cmTargetLinkLibrariesCommand.cxx" #include "cmTryCompileCommand.cxx" #include "cmTryRunCommand.cxx" +#include "cmUnsetCommand.cxx" void GetBootstrapCommands(std::list& commands) { @@ -163,4 +164,5 @@ void GetBootstrapCommands(std::list& commands) commands.push_back(new cmTargetLinkLibrariesCommand); commands.push_back(new cmTryCompileCommand); commands.push_back(new cmTryRunCommand); + commands.push_back(new cmUnsetCommand); } diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index 14a64c022..05bdd397a 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCMakeMinimumRequired.cxx,v $ Language: C++ - Date: $Date: 2008-03-24 22:23:26 $ - Version: $Revision: 1.17.2.1 $ + Date: $Date: 2009-01-13 18:03:49 $ + Version: $Revision: 1.17.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -47,10 +47,7 @@ bool cmCMakeMinimumRequired } else { - cmOStringStream e; - e << "called with unknown argument \"" << args[i].c_str() << "\"."; - this->SetError(e.str().c_str()); - return false; + this->UnknownArguments.push_back(args[i]); } } if(doing_version) @@ -62,7 +59,7 @@ bool cmCMakeMinimumRequired // Make sure there was a version to check. if(version_string.empty()) { - return true; + return this->EnforceUnknownArguments(); } // Save the required version string. @@ -107,6 +104,12 @@ bool cmCMakeMinimumRequired return true; } + // The version is not from the future, so enforce unknown arguments. + if(!this->EnforceUnknownArguments()) + { + return false; + } + if (required_major < 2 || required_major == 2 && required_minor < 4) { this->Makefile->SetPolicyVersion("2.4"); @@ -119,3 +122,16 @@ bool cmCMakeMinimumRequired return true; } +//---------------------------------------------------------------------------- +bool cmCMakeMinimumRequired::EnforceUnknownArguments() +{ + if(!this->UnknownArguments.empty()) + { + cmOStringStream e; + e << "called with unknown argument \"" + << this->UnknownArguments[0] << "\"."; + this->SetError(e.str().c_str()); + return false; + } + return true; +} diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 23c616d19..12b9639de 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCMakeMinimumRequired.h,v $ Language: C++ - Date: $Date: 2008-03-18 14:23:54 $ - Version: $Revision: 1.12.2.1 $ + Date: $Date: 2009-01-13 18:03:49 $ + Version: $Revision: 1.12.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -77,12 +77,17 @@ public: "When version 2.4 or lower is given the command implicitly invokes\n" " cmake_policy(VERSION 2.4)\n" "which enables compatibility features for CMake 2.4 and lower.\n" - "The FATAL_ERROR option is accepted but ignored. It is left from " - "CMake versions 2.4 and lower in which failure to meet the minimum " - "version was a warning by default."; + "The FATAL_ERROR option is accepted but ignored by CMake 2.6 " + "and higher. " + "It should be specified so CMake versions 2.4 and lower fail with an " + "error instead of just a warning."; } cmTypeMacro(cmCMakeMinimumRequired, cmCommand); + +private: + std::vector UnknownArguments; + bool EnforceUnknownArguments(); }; diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 37f1c1d5e..3907a1270 100755 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCMakePolicyCommand.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:16 $ - Version: $Revision: 1.2.2.2 $ + Date: $Date: 2009-02-04 16:44:16 $ + Version: $Revision: 1.2.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -43,7 +43,8 @@ bool cmCMakePolicyCommand this->SetError("PUSH may not be given additional arguments."); return false; } - return this->Makefile->PushPolicy(); + this->Makefile->PushPolicy(); + return true; } else if(args[0] == "POP") { @@ -52,15 +53,8 @@ bool cmCMakePolicyCommand this->SetError("POP may not be given additional arguments."); return false; } - if(this->Makefile->PopPolicy(false)) - { - return true; - } - else - { - this->SetError("POP without matching PUSH"); - return false; - } + this->Makefile->PopPolicy(); + return true; } else if(args[0] == "VERSION") { diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index b82f98a1f..bb760aefc 100755 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCMakePolicyCommand.h,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.4.2.2 $ + Date: $Date: 2009-02-04 16:44:16 $ + Version: $Revision: 1.4.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -113,16 +113,26 @@ public: "The output variable value will be \"OLD\" or \"NEW\" if the " "policy is set, and empty otherwise." "\n" + "CMake keeps policy settings on a stack, so changes made by the " + "cmake_policy command affect only the top of the stack. " + "A new entry on the policy stack is managed automatically for each " + "subdirectory to protect its parents and siblings. " + "CMake also manages a new entry for scripts loaded by include() and " + "find_package() commands except when invoked with the NO_POLICY_SCOPE " + "option (see also policy CMP0011). " + "The cmake_policy command provides an interface to manage custom " + "entries on the policy stack:\n" " cmake_policy(PUSH)\n" " cmake_policy(POP)\n" - "Push and pop the current policy setting state on a stack. " - "Each PUSH must have a matching POP. " - "This is useful when mixing multiple projects, subprojects, and " - "files included from external projects that may each have been " - "written for a different version of CMake. " - "Each subdirectory entered by the project automatically pushes " - "a new level on the stack to isolate the subdirectories from " - "their parents."; + "Each PUSH must have a matching POP to erase any changes. " + "This is useful to make temporary changes to policy settings." + "\n" + "Functions and macros record policy settings when they are created " + "and use the pre-record policies when they are invoked. " + "If the function or macro implementation sets policies, the changes " + "automatically propagate up through callers until they reach the " + "closest nested policy stack entry." + ; } cmTypeMacro(cmCMakePolicyCommand, cmCommand); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 4c2622c63..832d34146 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCTest.cxx,v $ Language: C++ - Date: $Date: 2008-02-03 13:57:41 $ - Version: $Revision: 1.334 $ + Date: $Date: 2009-01-01 17:49:40 $ + Version: $Revision: 1.334.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -49,10 +49,15 @@ #include // auto_ptr -#if defined(__BEOS__) +#if defined(__BEOS__) && !defined(__HAIKU__) #include /* disable_debugger() API. */ #endif +#if defined(__HAIKU__) +#include /* disable_debugger() API. */ +#endif + + #define DEBUGOUT std::cout << __LINE__ << " "; std::cout #define DEBUGERR std::cerr << __LINE__ << " "; std::cerr @@ -607,7 +612,7 @@ void cmCTest::BlockTestErrorDiagnostics() cmSystemTools::PutEnv("DASHBOARD_TEST_FROM_CTEST=" CMake_VERSION); #if defined(_WIN32) SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); -#elif defined(__BEOS__) +#elif defined(__BEOS__) || defined(__HAIKU__) disable_debugger(1); #endif } @@ -1134,14 +1139,14 @@ int cmCTest::RunTest(std::vector argv, args.push_back(argv[i]); } } - if ( *log ) + if ( log ) { *log << "* Run internal CTest" << std::endl; } std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory(); *retVal = inst.Run(args, output); - if ( *log ) + if ( log ) { *log << output->c_str(); } diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx index fd5b69ebe..e769acd57 100644 --- a/Source/cmCallVisualStudioMacro.cxx +++ b/Source/cmCallVisualStudioMacro.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCallVisualStudioMacro.cxx,v $ Language: C++ - Date: $Date: 2008-07-31 15:52:24 $ - Version: $Revision: 1.3.2.1 $ + Date: $Date: 2008-10-24 15:18:45 $ + Version: $Revision: 1.3.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -35,6 +35,31 @@ static bool LogErrorsAsMessages; #include +//---------------------------------------------------------------------------- +// Copied from a correct comdef.h to avoid problems with deficient versions +// of comdef.h that exist in the wild... Fixes issue #7533. +// +#if ( _MSC_VER >= 1300 ) +// VS7 and later: +#ifdef _NATIVE_WCHAR_T_DEFINED +# ifdef _DEBUG +# pragma comment(lib, "comsuppwd.lib") +# else +# pragma comment(lib, "comsuppw.lib") +# endif +#else +# ifdef _DEBUG +# pragma comment(lib, "comsuppd.lib") +# else +# pragma comment(lib, "comsupp.lib") +# endif +#endif +#else +// VS6 only had comsupp.lib: +# pragma comment(lib, "comsupp.lib") +#endif + + //---------------------------------------------------------------------------- ///! Use ReportHRESULT to make a cmSystemTools::Message after calling ///! a COM method that may have failed. diff --git a/Source/cmCommand.h b/Source/cmCommand.h index e9b3bfff3..89e427ff1 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCommand.h,v $ Language: C++ - Date: $Date: 2008-03-01 20:20:35 $ - Version: $Revision: 1.27 $ + Date: $Date: 2008-10-24 15:18:45 $ + Version: $Revision: 1.27.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -64,7 +64,12 @@ public: cmExecutionStatus &status) { std::vector expandedArguments; - this->Makefile->ExpandArguments(args, expandedArguments); + if(!this->Makefile->ExpandArguments(args, expandedArguments)) + { + // There was an error expanding arguments. It was already + // reported, so we can skip this command without error. + return true; + } return this->InitialPass(expandedArguments,status); } diff --git a/Source/cmCommandArgumentLexer.cxx b/Source/cmCommandArgumentLexer.cxx index 9305570f4..4c4d2d633 100644 --- a/Source/cmCommandArgumentLexer.cxx +++ b/Source/cmCommandArgumentLexer.cxx @@ -1,3 +1,19 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmCommandArgumentLexer.cxx,v $ + Language: C++ + Date: $Date: 2009-01-01 17:49:40 $ + Version: $Revision: 1.15.2.1 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ #include "cmStandardIncludes.h" #line 2 "cmCommandArgumentLexer.cxx" @@ -11,7 +27,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -33,7 +49,7 @@ /* C99 systems have . Non-C99 systems may or may not. */ -#if __STDC_VERSION__ >= 199901L +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. @@ -56,7 +72,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -87,6 +102,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -96,11 +113,12 @@ typedef unsigned int flex_uint32_t; #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST @@ -136,8 +154,6 @@ typedef void* yyscan_t; #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) #define yy_flex_debug yyg->yy_flex_debug_r -int cmCommandArgument_yylex_init (yyscan_t* scanner); - /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. @@ -195,14 +211,9 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int yy_size_t; +typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -357,8 +368,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 13 -#define YY_END_OF_BUFFER 14 +#define YY_NUM_RULES 14 +#define YY_END_OF_BUFFER 15 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -366,11 +377,11 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[26] = +static yyconst flex_int16_t yy_accept[30] = { 0, - 0, 0, 0, 0, 0, 0, 14, 8, 9, 6, - 5, 13, 10, 4, 11, 12, 8, 0, 3, 6, - 0, 7, 1, 2, 0 + 0, 0, 0, 0, 0, 0, 15, 9, 10, 7, + 6, 14, 11, 5, 12, 13, 9, 0, 0, 4, + 7, 0, 8, 2, 0, 3, 0, 1, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -381,14 +392,14 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, - 1, 1, 1, 5, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 1, 6, 1, 1, 4, 1, 4, 4, 4, 4, + 1, 1, 1, 5, 4, 4, 4, 4, 6, 4, + 4, 4, 4, 4, 4, 4, 4, 7, 4, 4, + 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, + 1, 9, 1, 1, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 7, 1, 8, 1, 1, 1, 1, 1, + 4, 4, 10, 1, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -405,39 +416,46 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[9] = +static yyconst flex_int32_t yy_meta[12] = { 0, - 1, 2, 3, 1, 3, 3, 3, 3 + 1, 2, 3, 4, 3, 4, 4, 4, 3, 5, + 3 } ; -static yyconst flex_int16_t yy_base[28] = +static yyconst flex_int16_t yy_base[35] = { 0, - 0, 0, 18, 17, 16, 15, 20, 0, 5, 14, - 7, 25, 25, 25, 0, 25, 0, 3, 25, 0, - 9, 25, 25, 25, 25, 14, 16 + 0, 0, 31, 30, 29, 28, 36, 0, 6, 16, + 0, 41, 41, 41, 0, 41, 0, 22, 22, 41, + 18, 18, 41, 41, 7, 41, 4, 41, 41, 20, + 21, 26, 9, 30 } ; -static yyconst flex_int16_t yy_def[28] = +static yyconst flex_int16_t yy_def[35] = { 0, - 25, 1, 1, 1, 1, 1, 25, 26, 25, 26, - 25, 25, 25, 25, 27, 25, 26, 9, 25, 10, - 25, 25, 25, 25, 0, 25, 25 + 29, 1, 1, 1, 1, 1, 29, 30, 31, 32, + 33, 29, 29, 29, 34, 29, 30, 31, 18, 29, + 32, 33, 29, 29, 18, 29, 18, 29, 0, 29, + 29, 29, 29, 29 } ; -static yyconst flex_int16_t yy_nxt[34] = +static yyconst flex_int16_t yy_nxt[53] = { 0, - 8, 8, 9, 10, 11, 12, 13, 14, 18, 23, - 21, 19, 21, 24, 17, 17, 22, 20, 22, 25, - 16, 16, 15, 15, 7, 25, 25, 25, 25, 25, - 25, 25, 25 + 8, 8, 9, 10, 11, 10, 10, 10, 12, 13, + 14, 19, 22, 28, 27, 20, 17, 17, 17, 17, + 17, 17, 26, 17, 18, 18, 21, 21, 25, 21, + 23, 24, 23, 23, 23, 29, 16, 16, 15, 15, + 7, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29 } ; -static yyconst flex_int16_t yy_chk[34] = +static yyconst flex_int16_t yy_chk[53] = { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 9, 18, - 11, 9, 21, 21, 26, 26, 27, 10, 27, 7, - 6, 5, 4, 3, 25, 25, 25, 25, 25, 25, - 25, 25, 25 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 9, 33, 27, 25, 9, 10, 10, 21, 21, + 30, 30, 22, 30, 31, 31, 32, 32, 19, 32, + 34, 18, 34, 34, 34, 7, 6, 5, 4, 3, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29 } ; /* The intent behind this definition is that it'll catch @@ -454,8 +472,8 @@ static yyconst flex_int16_t yy_chk[34] = Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCommandArgumentLexer.cxx,v $ Language: C++ - Date: $Date: 2007-09-24 15:16:13 $ - Version: $Revision: 1.15 $ + Date: $Date: 2009-01-01 17:49:40 $ + Version: $Revision: 1.15.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -474,11 +492,14 @@ Run flex like this: flex --prefix=cmCommandArgument_yy --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l Modify cmCommandArgumentLexer.cxx: + - add #include "cmStandardIncludes.h" to top of file + - put header block at top of file - remove TABs - remove "yyscanner" argument from these methods: yy_fatal_error, cmCommandArgument_yyalloc, cmCommandArgument_yyrealloc, cmCommandArgument_yyfree - remove all YY_BREAK lines occurring right after return statements - change while ( 1 ) to for(;;) + - add "return 0;" to end of cmCommandArgument_yylex Modify cmCommandArgumentLexer.h: - remove TABs @@ -503,7 +524,7 @@ Modify cmCommandArgumentLexer.h: /*--------------------------------------------------------------------------*/ -#line 505 "cmCommandArgumentLexer.cxx" +#line 508 "cmCommandArgumentLexer.cxx" #define INITIAL 0 #define ESCAPES 1 @@ -557,6 +578,10 @@ struct yyguts_t static int yy_init_globals (yyscan_t yyscanner ); +int cmCommandArgument_yylex_init (yyscan_t* scanner); + +int cmCommandArgument_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ @@ -626,7 +651,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -720,10 +745,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 62 "cmCommandArgumentLexer.in.l" +#line 64 "cmCommandArgumentLexer.in.l" -#line 727 "cmCommandArgumentLexer.cxx" +#line 732 "cmCommandArgumentLexer.cxx" if ( !yyg->yy_init ) { @@ -776,13 +801,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 26 ) + if ( yy_current_state >= 30 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 25 ); + while ( yy_base[yy_current_state] != 41 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -808,58 +833,66 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 64 "cmCommandArgumentLexer.in.l" +#line 66 "cmCommandArgumentLexer.in.l" +{ + //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; + yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2); + return cal_ENVCURLY; +} +case 2: +YY_RULE_SETUP +#line 72 "cmCommandArgumentLexer.in.l" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2); return cal_NCURLY; } -case 2: +case 3: YY_RULE_SETUP -#line 70 "cmCommandArgumentLexer.in.l" +#line 78 "cmCommandArgumentLexer.in.l" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2); return cal_ATNAME; } -case 3: +case 4: YY_RULE_SETUP -#line 76 "cmCommandArgumentLexer.in.l" +#line 84 "cmCommandArgumentLexer.in.l" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->DCURLYVariable; return cal_DCURLY; } -case 4: +case 5: YY_RULE_SETUP -#line 83 "cmCommandArgumentLexer.in.l" +#line 91 "cmCommandArgumentLexer.in.l" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->RCURLYVariable; return cal_RCURLY; } -case 5: +case 6: YY_RULE_SETUP -#line 90 "cmCommandArgumentLexer.in.l" +#line 98 "cmCommandArgumentLexer.in.l" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->ATVariable; return cal_AT; } -case 6: +case 7: YY_RULE_SETUP -#line 97 "cmCommandArgumentLexer.in.l" +#line 105 "cmCommandArgumentLexer.in.l" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); return cal_NAME; } -case 7: +case 8: YY_RULE_SETUP -#line 103 "cmCommandArgumentLexer.in.l" +#line 111 "cmCommandArgumentLexer.in.l" { if ( !yyextra->HandleEscapeSymbol(yylvalp, *(yytext+1)) ) { @@ -867,53 +900,53 @@ YY_RULE_SETUP } return cal_SYMBOL; } -case 8: -/* rule 8 can match eol */ +case 9: +/* rule 9 can match eol */ YY_RULE_SETUP -#line 111 "cmCommandArgumentLexer.in.l" +#line 119 "cmCommandArgumentLexer.in.l" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); return cal_SYMBOL; } -case 9: +case 10: YY_RULE_SETUP -#line 117 "cmCommandArgumentLexer.in.l" +#line 125 "cmCommandArgumentLexer.in.l" { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->DOLLARVariable; return cal_DOLLAR; } -case 10: +case 11: YY_RULE_SETUP -#line 123 "cmCommandArgumentLexer.in.l" +#line 131 "cmCommandArgumentLexer.in.l" { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->LCURLYVariable; return cal_LCURLY; } -case 11: +case 12: YY_RULE_SETUP -#line 129 "cmCommandArgumentLexer.in.l" +#line 137 "cmCommandArgumentLexer.in.l" { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->BSLASHVariable; return cal_BSLASH; } -case 12: +case 13: YY_RULE_SETUP -#line 135 "cmCommandArgumentLexer.in.l" +#line 143 "cmCommandArgumentLexer.in.l" { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->BSLASHVariable; return cal_SYMBOL; } -case 13: +case 14: YY_RULE_SETUP -#line 141 "cmCommandArgumentLexer.in.l" +#line 149 "cmCommandArgumentLexer.in.l" ECHO; YY_BREAK -#line 929 "cmCommandArgumentLexer.cxx" +#line 943 "cmCommandArgumentLexer.cxx" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(ESCAPES): case YY_STATE_EOF(NOESCAPES): @@ -1172,6 +1205,14 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmCommandArgument_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + yyg->yy_n_chars += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; @@ -1202,7 +1243,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 26 ) + if ( yy_current_state >= 30 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1231,11 +1272,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 26 ) + if ( yy_current_state >= 30 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 25); + yy_is_jam = (yy_current_state == 29); return yy_is_jam ? 0 : yy_current_state; } @@ -1562,7 +1603,9 @@ static void cmCommandArgument_yyensure_buffer_stack (yyscan_t yyscanner) yyg->yy_buffer_stack = (struct yy_buffer_state**)cmCommandArgument_yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); - + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in cmCommandArgument_yyensure_buffer_stack()" ); + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); yyg->yy_buffer_stack_max = num_to_alloc; @@ -1580,6 +1623,8 @@ static void cmCommandArgument_yyensure_buffer_stack (yyscan_t yyscanner) (yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in cmCommandArgument_yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -1874,6 +1919,42 @@ int cmCommandArgument_yylex_init(yyscan_t* ptr_yy_globals) return yy_init_globals ( *ptr_yy_globals ); } +/* cmCommandArgument_yylex_init_extra has the same functionality as cmCommandArgument_yylex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to cmCommandArgument_yyalloc in + * the yyextra field. + */ + +int cmCommandArgument_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + cmCommandArgument_yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) cmCommandArgument_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + cmCommandArgument_yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -1985,7 +2066,7 @@ void cmCommandArgument_yyfree (void * ptr , yyscan_t) #define YYTABLES_NAME "yytables" -#line 141 "cmCommandArgumentLexer.in.l" +#line 149 "cmCommandArgumentLexer.in.l" diff --git a/Source/cmCommandArgumentLexer.h b/Source/cmCommandArgumentLexer.h index a5d00b352..46856b198 100644 --- a/Source/cmCommandArgumentLexer.h +++ b/Source/cmCommandArgumentLexer.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCommandArgumentLexer.h,v $ Language: C++ - Date: $Date: 2007-07-27 14:55:24 $ - Version: $Revision: 1.5 $ + Date: $Date: 2009-01-01 17:49:41 $ + Version: $Revision: 1.5.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -25,7 +25,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -47,7 +47,7 @@ /* C99 systems have . Non-C99 systems may or may not. */ -#if __STDC_VERSION__ >= 199901L +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. @@ -70,7 +70,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -101,6 +100,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -110,11 +111,12 @@ typedef unsigned int flex_uint32_t; #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST @@ -140,21 +142,19 @@ typedef void* yyscan_t; #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) #define yy_flex_debug yyg->yy_flex_debug_r -int cmCommandArgument_yylex_init (yyscan_t* scanner); +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int yy_size_t; +typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -209,24 +209,16 @@ struct yy_buffer_state #endif /* !YY_STRUCT_YY_BUFFER_STATE */ void cmCommandArgument_yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void cmCommandArgument_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , - yyscan_t yyscanner ); -YY_BUFFER_STATE cmCommandArgument_yy_create_buffer (FILE *file,int size , - yyscan_t yyscanner ); -void cmCommandArgument_yy_delete_buffer (YY_BUFFER_STATE b , - yyscan_t yyscanner ); -void cmCommandArgument_yy_flush_buffer (YY_BUFFER_STATE b , - yyscan_t yyscanner ); -void cmCommandArgument_yypush_buffer_state (YY_BUFFER_STATE new_buffer , - yyscan_t yyscanner ); +void cmCommandArgument_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmCommandArgument_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void cmCommandArgument_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void cmCommandArgument_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void cmCommandArgument_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); void cmCommandArgument_yypop_buffer_state (yyscan_t yyscanner ); -YY_BUFFER_STATE cmCommandArgument_yy_scan_buffer (char *base,yy_size_t size , - yyscan_t yyscanner ); -YY_BUFFER_STATE cmCommandArgument_yy_scan_string (yyconst char *yy_str , - yyscan_t yyscanner ); -YY_BUFFER_STATE cmCommandArgument_yy_scan_bytes (yyconst char *bytes,int len , - yyscan_t yyscanner ); +YY_BUFFER_STATE cmCommandArgument_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmCommandArgument_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmCommandArgument_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *cmCommandArgument_yyalloc (yy_size_t ,yyscan_t yyscanner ); void *cmCommandArgument_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -250,6 +242,10 @@ void cmCommandArgument_yyfree (void * ,yyscan_t yyscanner ); #define YY_EXTRA_TYPE void * #endif +int cmCommandArgument_yylex_init (yyscan_t* scanner); + +int cmCommandArgument_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ @@ -261,8 +257,7 @@ void cmCommandArgument_yyset_debug (int debug_flag ,yyscan_t yyscanner ); YY_EXTRA_TYPE cmCommandArgument_yyget_extra (yyscan_t yyscanner ); -void cmCommandArgument_yyset_extra (YY_EXTRA_TYPE user_defined , - yyscan_t yyscanner ); +void cmCommandArgument_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *cmCommandArgument_yyget_in (yyscan_t yyscanner ); @@ -325,8 +320,7 @@ extern int cmCommandArgument_yylex (yyscan_t yyscanner); #define YY_DECL int cmCommandArgument_yylex (yyscan_t yyscanner) #endif /* !YY_DECL */ -/* yy_get_previous_state - get the state just before - the EOB char was reached */ +/* yy_get_previous_state - get the state just before the EOB char was reached */ #undef YY_NEW_FILE #undef YY_FLUSH_BUFFER diff --git a/Source/cmCommandArgumentLexer.in.l b/Source/cmCommandArgumentLexer.in.l index 8fad73309..eaeeb846a 100644 --- a/Source/cmCommandArgumentLexer.in.l +++ b/Source/cmCommandArgumentLexer.in.l @@ -4,8 +4,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCommandArgumentLexer.in.l,v $ Language: C++ - Date: $Date: 2007-06-05 13:19:27 $ - Version: $Revision: 1.10 $ + Date: $Date: 2009-01-01 17:49:41 $ + Version: $Revision: 1.10.4.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -25,11 +25,13 @@ Run flex like this: Modify cmCommandArgumentLexer.cxx: - add #include "cmStandardIncludes.h" to top of file + - put header block at top of file - remove TABs - remove "yyscanner" argument from these methods: yy_fatal_error, cmCommandArgument_yyalloc, cmCommandArgument_yyrealloc, cmCommandArgument_yyfree - remove all YY_BREAK lines occurring right after return statements - change while ( 1 ) to for(;;) + - add "return 0;" to end of cmCommandArgument_yylex Modify cmCommandArgumentLexer.h: - remove TABs @@ -56,12 +58,19 @@ Modify cmCommandArgumentLexer.h: %option reentrant %option noyywrap +%option nounput %pointer %s ESCAPES %s NOESCAPES %% +\$ENV\{ { + //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; + yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2); + return cal_ENVCURLY; +} + \$[A-Za-z0-9/_.+-]+\{ { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2); diff --git a/Source/cmCommandArgumentParser.cxx b/Source/cmCommandArgumentParser.cxx index 8ea1e3aee..e1d41b88b 100644 --- a/Source/cmCommandArgumentParser.cxx +++ b/Source/cmCommandArgumentParser.cxx @@ -3,22 +3,23 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCommandArgumentParser.cxx,v $ Language: C++ - Date: $Date: 2007-07-27 14:55:24 $ - Version: $Revision: 1.13 $ + Date: $Date: 2009-01-01 17:49:41 $ + Version: $Revision: 1.13.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -/* A Bison parser, made by GNU Bison 2.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, - 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, - Inc. +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,13 +36,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -50,16 +59,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* turn off some warning as this is generated code */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4702 ) /* unreachable code */ -#endif - /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.1" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -86,31 +90,33 @@ /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { - cal_NCURLY = 258, - cal_DCURLY = 259, - cal_DOLLAR = 260, - cal_LCURLY = 261, - cal_RCURLY = 262, - cal_NAME = 263, - cal_BSLASH = 264, - cal_SYMBOL = 265, - cal_AT = 266, - cal_ERROR = 267, - cal_ATNAME = 268 + cal_ENVCURLY = 258, + cal_NCURLY = 259, + cal_DCURLY = 260, + cal_DOLLAR = 261, + cal_LCURLY = 262, + cal_RCURLY = 263, + cal_NAME = 264, + cal_BSLASH = 265, + cal_SYMBOL = 266, + cal_AT = 267, + cal_ERROR = 268, + cal_ATNAME = 269 }; #endif /* Tokens. */ -#define cal_NCURLY 258 -#define cal_DCURLY 259 -#define cal_DOLLAR 260 -#define cal_LCURLY 261 -#define cal_RCURLY 262 -#define cal_NAME 263 -#define cal_BSLASH 264 -#define cal_SYMBOL 265 -#define cal_AT 266 -#define cal_ERROR 267 -#define cal_ATNAME 268 +#define cal_ENVCURLY 258 +#define cal_NCURLY 259 +#define cal_DCURLY 260 +#define cal_DOLLAR 261 +#define cal_LCURLY 262 +#define cal_RCURLY 263 +#define cal_NAME 264 +#define cal_BSLASH 265 +#define cal_SYMBOL 266 +#define cal_AT 267 +#define cal_ERROR 268 +#define cal_ATNAME 269 @@ -123,8 +129,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCommandArgumentParser.cxx,v $ Language: C++ - Date: $Date: 2007-07-27 14:55:24 $ - Version: $Revision: 1.13 $ + Date: $Date: 2009-01-01 17:49:41 $ + Version: $Revision: 1.13.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -140,12 +146,11 @@ This file must be translated to C and modified to build everywhere. Run bison like this: - bison --yacc --name-prefix=cmCommandArgument_yy - --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx - cmCommandArgumentParser.y + bison --yacc --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y Modify cmCommandArgumentParser.cxx: - remove TABs + - put header block at top of file */ @@ -183,11 +188,10 @@ YY_DECL; static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); #define YYDEBUG 1 -// Set these high so that +/* Configure the parser to support large input. */ #define YYMAXDEPTH 100000 #define YYINITDEPTH 10000 - /* Disable some warnings in the generated code. */ #ifdef __BORLANDC__ # pragma warn -8004 /* Variable assigned a value that is not used. */ @@ -199,6 +203,8 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but no case. */ +# pragma warning (disable: 4244) /* loss of precision */ +# pragma warning (disable: 4702) /* unreachable code */ #endif @@ -220,7 +226,7 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); # define YYTOKEN_TABLE 0 #endif -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -232,23 +238,56 @@ typedef int YYSTYPE; /* Copy the second part of user declarations. */ -/* Line 219 of yacc.c. */ -#line 195 "cmCommandArgumentParser.cxx" +/* Line 216 of yacc.c. */ +#line 227 "cmCommandArgumentParser.cxx" -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ +#ifdef short +# undef short #endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; #endif -#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; #endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif #endif +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS @@ -261,7 +300,32 @@ typedef int YYSTYPE; # endif #endif -#if ! defined (yyoverflow) || YYERROR_VERBOSE +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -269,64 +333,76 @@ typedef int YYSTYPE; # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if defined (__STDC__) || defined (__cplusplus) +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# define YYINCLUDED_STDLIB_H +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# ifdef __cplusplus -extern "C" { +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif -# ifdef __cplusplus -} -# endif # endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short int yyss; + yytype_int16 yyss; YYSTYPE yyvs; }; @@ -336,13 +412,13 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ +# if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -353,7 +429,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (0) + while (YYID (0)) # endif # endif @@ -371,39 +447,33 @@ union yyalloc yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (0) + while (YYID (0)) #endif -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short int yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 21 +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 25 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 25 +#define YYLAST 40 -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 14 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 9 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 21 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 27 +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 15 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 10 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 24 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 33 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 268 +#define YYMAXUTOK 269 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -431,107 +501,110 @@ static const unsigned char yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13 + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned char yyprhs[] = +static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 7, 10, 11, 14, 16, 18, - 20, 22, 24, 26, 28, 30, 34, 38, 40, 41, - 44, 46 + 20, 22, 24, 26, 28, 30, 34, 38, 42, 44, + 46, 49, 50, 53, 55 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yysigned_char yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = { - 15, 0, -1, 16, -1, 17, -1, 17, 9, -1, - -1, 18, 17, -1, 19, -1, 20, -1, 8, -1, - 11, -1, 5, -1, 6, -1, 7, -1, 10, -1, - 3, 21, 7, -1, 4, 21, 7, -1, 13, -1, - -1, 22, 21, -1, 8, -1, 20, -1 + 16, 0, -1, 17, -1, 18, -1, 18, 10, -1, + -1, 19, 18, -1, 20, -1, 21, -1, 9, -1, + 12, -1, 6, -1, 7, -1, 8, -1, 11, -1, + 3, 22, 8, -1, 4, 23, 8, -1, 5, 23, + 8, -1, 14, -1, 23, -1, 11, 22, -1, -1, + 24, 23, -1, 9, -1, 21, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned char yyrline[] = +static const yytype_uint8 yyrline[] = { - 0, 95, 95, 102, 107, 113, 117, 123, 128, 134, - 139, 144, 149, 154, 159, 165, 171, 177, 183, 187, - 193, 198 + 0, 116, 116, 123, 128, 134, 138, 144, 149, 155, + 160, 165, 170, 175, 180, 186, 192, 198, 204, 210, + 215, 221, 225, 231, 236 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "cal_NCURLY", "cal_DCURLY", "\"$\"", - "\"{\"", "\"}\"", "cal_NAME", "\"\\\\\"", "cal_SYMBOL", "\"@\"", - "cal_ERROR", "cal_ATNAME", "$accept", "Start", + "$end", "error", "$undefined", "cal_ENVCURLY", "cal_NCURLY", + "cal_DCURLY", "\"$\"", "\"{\"", "\"}\"", "cal_NAME", "\"\\\\\"", + "cal_SYMBOL", "\"@\"", "cal_ERROR", "cal_ATNAME", "$accept", "Start", "GoalWithOptionalBackSlash", "Goal", "String", "OuterText", "Variable", - "MultipleIds", "ID", 0 + "EnvVarName", "MultipleIds", "ID", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268 + 265, 266, 267, 268, 269 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = +static const yytype_uint8 yyr1[] = { - 0, 14, 15, 16, 16, 17, 17, 18, 18, 19, - 19, 19, 19, 19, 19, 20, 20, 20, 21, 21, - 22, 22 + 0, 15, 16, 17, 17, 18, 18, 19, 19, 20, + 20, 20, 20, 20, 20, 21, 21, 21, 21, 22, + 22, 23, 23, 24, 24 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = +static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 2, 0, 2, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 3, 1, 0, 2, - 1, 1 + 1, 1, 1, 1, 1, 3, 3, 3, 1, 1, + 2, 0, 2, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const unsigned char yydefact[] = +static const yytype_uint8 yydefact[] = { - 5, 18, 18, 11, 12, 13, 9, 14, 10, 17, - 0, 2, 3, 5, 7, 8, 20, 21, 0, 18, - 0, 1, 4, 6, 15, 19, 16 + 5, 21, 21, 21, 11, 12, 13, 9, 14, 10, + 18, 0, 2, 3, 5, 7, 8, 23, 21, 24, + 0, 19, 21, 0, 0, 1, 4, 6, 20, 15, + 22, 16, 17 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yysigned_char yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = { - -1, 10, 11, 12, 13, 14, 17, 18, 19 + -1, 11, 12, 13, 14, 15, 19, 20, 21, 22 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -3 -static const yysigned_char yypact[] = +static const yytype_int8 yypact[] = { - -1, 12, 12, -3, -3, -3, -3, -3, -3, -3, - 8, -3, 2, -1, -3, -3, -3, -3, 6, 12, - 11, -3, -3, -3, -3, -3, -3 + 0, 14, 26, 26, -3, -3, -3, -3, -3, -3, + -3, 10, -3, 3, 0, -3, -3, -3, 14, -3, + 7, -3, 26, 13, 16, -3, -3, -3, -3, -3, + -3, -3, -3 }; /* YYPGOTO[NTERM-NUM]. */ -static const yysigned_char yypgoto[] = +static const yytype_int8 yypgoto[] = { - -3, -3, -3, 9, -3, -3, 1, -2, -3 + -3, -3, -3, 8, -3, -3, 2, 9, -2, -3 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -539,27 +612,32 @@ static const yysigned_char yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 -static const unsigned char yytable[] = +static const yytype_uint8 yytable[] = { - 20, 15, 1, 2, 3, 4, 5, 6, 21, 7, - 8, 22, 9, 24, 15, 1, 2, 25, 26, 0, - 16, 0, 23, 0, 0, 9 + 23, 24, 16, 1, 2, 3, 4, 5, 6, 7, + 25, 8, 9, 26, 10, 29, 16, 1, 2, 3, + 30, 31, 27, 17, 32, 18, 0, 28, 10, 1, + 2, 3, 0, 0, 0, 17, 0, 0, 0, 0, + 10 }; -static const yysigned_char yycheck[] = +static const yytype_int8 yycheck[] = { - 2, 0, 3, 4, 5, 6, 7, 8, 0, 10, - 11, 9, 13, 7, 13, 3, 4, 19, 7, -1, - 8, -1, 13, -1, -1, 13 + 2, 3, 0, 3, 4, 5, 6, 7, 8, 9, + 0, 11, 12, 10, 14, 8, 14, 3, 4, 5, + 22, 8, 14, 9, 8, 11, -1, 18, 14, 3, + 4, 5, -1, -1, -1, 9, -1, -1, -1, -1, + 14 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const unsigned char yystos[] = +static const yytype_uint8 yystos[] = { - 0, 3, 4, 5, 6, 7, 8, 10, 11, 13, - 15, 16, 17, 18, 19, 20, 8, 20, 21, 22, - 21, 0, 9, 17, 7, 21, 7 + 0, 3, 4, 5, 6, 7, 8, 9, 11, 12, + 14, 16, 17, 18, 19, 20, 21, 9, 11, 21, + 22, 23, 24, 23, 23, 0, 10, 18, 22, 8, + 23, 8, 8 }; #define yyerrok (yyerrstatus = 0) @@ -587,7 +665,7 @@ do \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ + YYPOPSTACK (1); \ goto yybackup; \ } \ else \ @@ -595,7 +673,7 @@ do \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (0) +while (YYID (0)) #define YYTERROR 1 @@ -610,7 +688,7 @@ while (0) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ - if (N) \ + if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ @@ -624,7 +702,7 @@ while (0) (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ - while (0) + while (YYID (0)) #endif @@ -664,36 +742,96 @@ while (0) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (0) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (short int *bottom, short int *top) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) - short int *bottom; - short int *top; + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) + for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -702,37 +840,45 @@ yy_stack_print (bottom, top) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (0) +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void -yy_reduce_print (yyrule) +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; int yyrule; #endif { + int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (stderr, "\n"); + } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (Rule); \ -} while (0) + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -766,42 +912,44 @@ int yydebug; #if YYERROR_VERBOSE # ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) +# if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -# else +#else +static YYSIZE_T yystrlen (yystr) - const char *yystr; -# endif + const char *yystr; +#endif { - const char *yys = yystr; - - while (*yys++ != '\0') + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) continue; - - return yys - yystr - 1; + return yylen; } # endif # endif # ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static char * -# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -# else +#else +static char * yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif + char *yydest; + const char *yysrc; +#endif { char *yyd = yydest; const char *yys = yysrc; @@ -827,7 +975,7 @@ yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - size_t yyn = 0; + YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) @@ -862,53 +1010,123 @@ yytnamerr (char *yyres, const char *yystr) } # endif -#endif /* YYERROR_VERBOSE */ - - - -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + int yyn = yypact[yystate]; - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - switch (yytype) - { - default: - break; + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; } - YYFPRINTF (yyoutput, ")"); } +#endif /* YYERROR_VERBOSE */ + -#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else @@ -919,8 +1137,7 @@ yydestruct (yymsg, yytype, yyvaluep) YYSTYPE *yyvaluep; #endif { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; @@ -938,13 +1155,13 @@ yydestruct (yymsg, yytype, yyvaluep) /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); -# else +#else int yyparse (); -# endif +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); @@ -961,20 +1178,24 @@ int yyparse (); `----------*/ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () - ; + #endif #endif { @@ -994,6 +1215,12 @@ int yynerrs; int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif /* Three stacks and their tools: `yyss': related to states, @@ -1004,9 +1231,9 @@ int yynerrs; to reallocate them elsewhere. */ /* The state stack. */ - short int yyssa[YYINITDEPTH]; - short int *yyss = yyssa; - short int *yyssp; + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; @@ -1015,7 +1242,7 @@ int yynerrs; -#define YYPOPSTACK (yyvsp--, yyssp--) +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; @@ -1024,9 +1251,9 @@ int yynerrs; YYSTYPE yyval; - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1050,8 +1277,7 @@ int yynerrs; `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ + have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: @@ -1064,11 +1290,11 @@ int yynerrs; #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of + /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short int *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the @@ -1096,7 +1322,7 @@ int yynerrs; yystacksize = YYMAXDEPTH; { - short int *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) @@ -1131,12 +1357,10 @@ int yynerrs; `-----------*/ yybackup: -/* Do appropriate processing given the current state. */ -/* Read a look-ahead token if we need one and don't already have one. */ -/* yyresume: */ + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; @@ -1178,22 +1402,21 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the token being shifted unless it is eof. */ + /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; + yystate = yyn; *++yyvsp = yylval; - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - yystate = yyn; goto yynewstate; @@ -1229,162 +1452,179 @@ yyreduce: switch (yyn) { case 2: -#line 96 "cmCommandArgumentParser.y" +#line 117 "cmCommandArgumentParser.y" { (yyval.str) = 0; - yyGetParser->SetResult((yyvsp[0].str)); + yyGetParser->SetResult((yyvsp[(1) - (1)].str)); } break; case 3: -#line 103 "cmCommandArgumentParser.y" +#line 124 "cmCommandArgumentParser.y" { - (yyval.str) = (yyvsp[0].str); + (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 4: -#line 108 "cmCommandArgumentParser.y" +#line 129 "cmCommandArgumentParser.y" { - (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); + (yyval.str) = yyGetParser->CombineUnions((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } break; case 5: -#line 113 "cmCommandArgumentParser.y" +#line 134 "cmCommandArgumentParser.y" { (yyval.str) = 0; } break; case 6: -#line 118 "cmCommandArgumentParser.y" +#line 139 "cmCommandArgumentParser.y" { - (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); + (yyval.str) = yyGetParser->CombineUnions((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); } break; case 7: -#line 124 "cmCommandArgumentParser.y" +#line 145 "cmCommandArgumentParser.y" { - (yyval.str) = (yyvsp[0].str); + (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 8: -#line 129 "cmCommandArgumentParser.y" +#line 150 "cmCommandArgumentParser.y" { - (yyval.str) = (yyvsp[0].str); + (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 9: -#line 135 "cmCommandArgumentParser.y" +#line 156 "cmCommandArgumentParser.y" { - (yyval.str) = (yyvsp[0].str); + (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 10: -#line 140 "cmCommandArgumentParser.y" +#line 161 "cmCommandArgumentParser.y" { - (yyval.str) = (yyvsp[0].str); + (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 11: -#line 145 "cmCommandArgumentParser.y" +#line 166 "cmCommandArgumentParser.y" { - (yyval.str) = (yyvsp[0].str); + (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 12: -#line 150 "cmCommandArgumentParser.y" +#line 171 "cmCommandArgumentParser.y" { - (yyval.str) = (yyvsp[0].str); + (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 13: -#line 155 "cmCommandArgumentParser.y" +#line 176 "cmCommandArgumentParser.y" { - (yyval.str) = (yyvsp[0].str); + (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 14: -#line 160 "cmCommandArgumentParser.y" +#line 181 "cmCommandArgumentParser.y" { - (yyval.str) = (yyvsp[0].str); + (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 15: -#line 166 "cmCommandArgumentParser.y" +#line 187 "cmCommandArgumentParser.y" { - (yyval.str) = - yyGetParser->ExpandSpecialVariable((yyvsp[-2].str),(yyvsp[-1].str)); - //std::cerr << __LINE__ << " here: [" << $1 << "] [" << $2 << "] - //[" << $3 << "]" << std::endl; + (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[(1) - (3)].str),(yyvsp[(2) - (3)].str)); + //std::cerr << __LINE__ << " here: [" << $1 << "] [" << $2 << "] [" << $3 << "]" << std::endl; } break; case 16: -#line 172 "cmCommandArgumentParser.y" +#line 193 "cmCommandArgumentParser.y" { - (yyval.str) = yyGetParser->ExpandVariable((yyvsp[-1].str)); - //std::cerr << __LINE__ << " here: [" << $1 << "] [" << $2 << "] - //[" << $3 << "]" << std::endl; + (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[(1) - (3)].str),(yyvsp[(2) - (3)].str)); + //std::cerr << __LINE__ << " here: [" << $1 << "] [" << $2 << "] [" << $3 << "]" << std::endl; } break; case 17: -#line 178 "cmCommandArgumentParser.y" +#line 199 "cmCommandArgumentParser.y" { - (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str)); + (yyval.str) = yyGetParser->ExpandVariable((yyvsp[(2) - (3)].str)); + //std::cerr << __LINE__ << " here: [" << $1 << "] [" << $2 << "] [" << $3 << "]" << std::endl; } break; case 18: -#line 183 "cmCommandArgumentParser.y" +#line 205 "cmCommandArgumentParser.y" { - (yyval.str) = 0; + (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[(1) - (1)].str)); } break; case 19: -#line 188 "cmCommandArgumentParser.y" +#line 211 "cmCommandArgumentParser.y" { - (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); + (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 20: -#line 194 "cmCommandArgumentParser.y" +#line 216 "cmCommandArgumentParser.y" { - (yyval.str) = (yyvsp[0].str); + (yyval.str) = (yyvsp[(1) - (2)].str); } break; case 21: -#line 199 "cmCommandArgumentParser.y" +#line 221 "cmCommandArgumentParser.y" { - (yyval.str) = (yyvsp[0].str); + (yyval.str) = 0; } break; + case 22: +#line 226 "cmCommandArgumentParser.y" + { + (yyval.str) = yyGetParser->CombineUnions((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); +} + break; - default: break; - } + case 23: +#line 232 "cmCommandArgumentParser.y" + { + (yyval.str) = (yyvsp[(1) - (1)].str); +} + break; -/* Line 1126 of yacc.c. */ -#line 1338 "cmCommandArgumentParser.cxx" - - yyvsp -= yylen; - yyssp -= yylen; + case 24: +#line 237 "cmCommandArgumentParser.y" + { + (yyval.str) = (yyvsp[(1) - (1)].str); +} + break; +/* Line 1267 of yacc.c. */ +#line 1606 "cmCommandArgumentParser.cxx" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; @@ -1413,110 +1653,41 @@ yyerrlab: if (!yyerrstatus) { ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - char *yymsg = 0; -# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -#if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -#endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; } + } - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - - if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yymsg; - int yyi = 0; - while ((*yyp = *yyf)) - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - yyerror (yymsg); - YYSTACK_FREE (yymsg); - } - else - { - yyerror (YY_("syntax error")); + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) goto yyexhaustedlab; - } - } - else -#endif /* YYERROR_VERBOSE */ - yyerror (YY_("syntax error")); + } + } +#endif } @@ -1534,7 +1705,8 @@ yyerrlab: } else { - yydestruct ("Error: discarding", yytoken, &yylval); + yydestruct ("Error: discarding", + yytoken, &yylval); yychar = YYEMPTY; } } @@ -1552,11 +1724,14 @@ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ - if (0) + if (/*CONSTCOND*/ 0) goto yyerrorlab; -yyvsp -= yylen; - yyssp -= yylen; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; @@ -1586,8 +1761,9 @@ yyerrlab1: YYABORT; - yydestruct ("Error: popping", yystos[yystate], yyvsp); - YYPOPSTACK; + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } @@ -1598,7 +1774,7 @@ yyerrlab1: *++yyvsp = yylval; - /* Shift the error token. */ + /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; @@ -1633,21 +1809,30 @@ yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); - YYPOPSTACK; + YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif - return yyresult; +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 204 "cmCommandArgumentParser.y" +#line 242 "cmCommandArgumentParser.y" /* End of grammar */ @@ -1656,3 +1841,5 @@ void cmCommandArgumentError(yyscan_t yyscanner, const char* message) { yyGetParser->Error(message); } + + diff --git a/Source/cmCommandArgumentParser.y b/Source/cmCommandArgumentParser.y index 8fa53299c..d144047bc 100644 --- a/Source/cmCommandArgumentParser.y +++ b/Source/cmCommandArgumentParser.y @@ -4,8 +4,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCommandArgumentParser.y,v $ Language: C++ - Date: $Date: 2006-10-04 18:37:41 $ - Version: $Revision: 1.10 $ + Date: $Date: 2009-01-01 17:49:41 $ + Version: $Revision: 1.10.10.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -25,6 +25,7 @@ Run bison like this: Modify cmCommandArgumentParser.cxx: - remove TABs + - put header block at top of file */ @@ -62,9 +63,9 @@ YY_DECL; static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); #define YYDEBUG 1 -//#define YYMAXDEPTH 100000 -//#define YYINITDEPTH 10000 - +/* Configure the parser to support large input. */ +#define YYMAXDEPTH 100000 +#define YYINITDEPTH 10000 /* Disable some warnings in the generated code. */ #ifdef __BORLANDC__ @@ -77,6 +78,8 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but no case. */ +# pragma warning (disable: 4244) /* loss of precision */ +# pragma warning (disable: 4702) /* unreachable code */ #endif %} @@ -91,6 +94,7 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); /*-------------------------------------------------------------------------*/ /* Tokens */ +%token cal_ENVCURLY %token cal_NCURLY %token cal_DCURLY %token cal_DOLLAR "$" @@ -179,6 +183,12 @@ cal_SYMBOL } Variable: +cal_ENVCURLY EnvVarName cal_RCURLY +{ + $$ = yyGetParser->ExpandSpecialVariable($1,$2); + //std::cerr << __LINE__ << " here: [" << $1 << "] [" << $2 << "] [" << $3 << "]" << std::endl; +} +| cal_NCURLY MultipleIds cal_RCURLY { $$ = yyGetParser->ExpandSpecialVariable($1,$2); @@ -196,6 +206,17 @@ cal_ATNAME $$ = yyGetParser->ExpandVariableForAt($1); } +EnvVarName: +MultipleIds +{ + $$ = $1; +} +| +cal_SYMBOL EnvVarName +{ + $$ = $1; +} + MultipleIds: { $$ = 0; diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 3295cb226..9baac9526 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCommandArgumentParserHelper.cxx,v $ Language: C++ - Date: $Date: 2007-06-06 20:20:02 $ - Version: $Revision: 1.20 $ + Date: $Date: 2009-01-01 17:49:41 $ + Version: $Revision: 1.20.4.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -87,8 +87,25 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, } return this->EmptyVariable; } - cmSystemTools::Error("Key ", key, - " is not used yet. For now only $ENV{..} is allowed"); + if ( strcmp(key, "CACHE") == 0 ) + { + if(const char* c = this->Makefile->GetCacheManager()->GetCacheValue(var)) + { + if(this->EscapeQuotes) + { + return this->AddString(cmSystemTools::EscapeQuotes(c).c_str()); + } + else + { + return this->AddString(c); + } + } + return this->EmptyVariable; + } + cmOStringStream e; + e << "Syntax $" << key << "{} is not supported. " + << "Only ${}, $ENV{}, and $CACHE{} are allowed."; + this->SetError(e.str()); return 0; } @@ -216,10 +233,11 @@ bool cmCommandArgumentParserHelper::HandleEscapeSymbol this->AllocateParserType(pt, "\0", 1); break; default: - char buffer[2]; - buffer[0] = symbol; - buffer[1] = 0; - cmSystemTools::Error("Invalid escape sequence \\", buffer); + { + cmOStringStream e; + e << "Invalid escape sequence \\" << symbol; + this->SetError(e.str()); + } return false; } return true; @@ -300,7 +318,7 @@ void cmCommandArgumentParserHelper::Error(const char* str) unsigned long pos = static_cast(this->InputBufferPos); cmOStringStream ostr; ostr << str << " (" << pos << ")"; - this->ErrorString = ostr.str(); + this->SetError(ostr.str()); } void cmCommandArgumentParserHelper::SetMakefile(const cmMakefile* mf) @@ -318,3 +336,11 @@ void cmCommandArgumentParserHelper::SetResult(const char* value) this->Result = value; } +void cmCommandArgumentParserHelper::SetError(std::string const& msg) +{ + // Keep only the first error. + if(this->ErrorString.empty()) + { + this->ErrorString = msg; + } +} diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index 08e19a5f8..cc783e67b 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCommandArgumentParserHelper.h,v $ Language: C++ - Date: $Date: 2007-06-06 20:20:02 $ - Version: $Revision: 1.11 $ + Date: $Date: 2009-01-01 17:49:41 $ + Version: $Revision: 1.11.4.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -95,6 +95,7 @@ private: char* AddString(const char* str); void CleanupParser(); + void SetError(std::string const& msg); std::vector Variables; const cmMakefile* Makefile; diff --git a/Source/cmCommandArgumentParserTokens.h b/Source/cmCommandArgumentParserTokens.h index b6c094d80..47a0b8e08 100644 --- a/Source/cmCommandArgumentParserTokens.h +++ b/Source/cmCommandArgumentParserTokens.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCommandArgumentParserTokens.h,v $ Language: C++ - Date: $Date: 2007-07-27 14:55:24 $ - Version: $Revision: 1.5 $ + Date: $Date: 2009-01-01 17:49:41 $ + Version: $Revision: 1.5.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -14,11 +14,12 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -/* A Bison parser, made by GNU Bison 2.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, - 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, - Inc. +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,10 +36,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE @@ -46,36 +55,38 @@ /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { - cal_NCURLY = 258, - cal_DCURLY = 259, - cal_DOLLAR = 260, - cal_LCURLY = 261, - cal_RCURLY = 262, - cal_NAME = 263, - cal_BSLASH = 264, - cal_SYMBOL = 265, - cal_AT = 266, - cal_ERROR = 267, - cal_ATNAME = 268 + cal_ENVCURLY = 258, + cal_NCURLY = 259, + cal_DCURLY = 260, + cal_DOLLAR = 261, + cal_LCURLY = 262, + cal_RCURLY = 263, + cal_NAME = 264, + cal_BSLASH = 265, + cal_SYMBOL = 266, + cal_AT = 267, + cal_ERROR = 268, + cal_ATNAME = 269 }; #endif /* Tokens. */ -#define cal_NCURLY 258 -#define cal_DCURLY 259 -#define cal_DOLLAR 260 -#define cal_LCURLY 261 -#define cal_RCURLY 262 -#define cal_NAME 263 -#define cal_BSLASH 264 -#define cal_SYMBOL 265 -#define cal_AT 266 -#define cal_ERROR 267 -#define cal_ATNAME 268 +#define cal_ENVCURLY 258 +#define cal_NCURLY 259 +#define cal_DCURLY 260 +#define cal_DOLLAR 261 +#define cal_LCURLY 262 +#define cal_RCURLY 263 +#define cal_NAME 264 +#define cal_BSLASH 265 +#define cal_SYMBOL 266 +#define cal_AT 267 +#define cal_ERROR 268 +#define cal_ATNAME 269 -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -84,5 +95,3 @@ typedef int YYSTYPE; - - diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index faf2c8885..95289766a 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmComputeLinkDepends.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.12.2.6 $ + Date: $Date: 2009-01-13 18:03:49 $ + Version: $Revision: 1.12.2.7 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -188,6 +188,7 @@ cmComputeLinkDepends // The configuration being linked. this->Config = (config && *config)? config : 0; + this->LinkType = this->Target->ComputeLinkType(this->Config); // Enable debug mode if requested. this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE"); @@ -446,13 +447,6 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, std::vector deplist; cmSystemTools::ExpandListArgument(value, deplist); - // Compute which library configuration to link. - cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED; - if(this->Config && cmSystemTools::UpperCase(this->Config) == "DEBUG") - { - linkType = cmTarget::DEBUG; - } - // Look for entries meant for this configuration. std::vector actual_libs; cmTarget::LinkLibraryType llt = cmTarget::GENERAL; @@ -500,7 +494,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, } // If the library is meant for this link type then use it. - if(llt == cmTarget::GENERAL || llt == linkType) + if(llt == cmTarget::GENERAL || llt == this->LinkType) { actual_libs.push_back(*di); } @@ -524,19 +518,12 @@ void cmComputeLinkDepends::AddTargetLinkEntries(int depender_index, LinkLibraryVectorType const& libs) { - // Compute which library configuration to link. - cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED; - if(this->Config && cmSystemTools::UpperCase(this->Config) == "DEBUG") - { - linkType = cmTarget::DEBUG; - } - // Look for entries meant for this configuration. std::vector actual_libs; for(cmTarget::LinkLibraryVectorType::const_iterator li = libs.begin(); li != libs.end(); ++li) { - if(li->second == cmTarget::GENERAL || li->second == linkType) + if(li->second == cmTarget::GENERAL || li->second == this->LinkType) { actual_libs.push_back(li->first); } diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 925fe3d06..1c8249ba1 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmComputeLinkDepends.h,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.5.2.6 $ + Date: $Date: 2009-01-13 18:03:51 $ + Version: $Revision: 1.5.2.7 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -72,6 +72,7 @@ private: // Configuration information. const char* Config; + cmTarget::LinkLibraryType LinkType; // Output information. EntryVector FinalLinkEntries; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 7a58994db..bdcc29fb9 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmComputeLinkInformation.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.24.2.10 $ + Date: $Date: 2008-10-24 15:18:45 $ + Version: $Revision: 1.24.2.11 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -594,7 +594,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt) std::string exe = tgt->GetFullPath(config, this->UseImportLibrary, true); linkItem += exe; - this->Items.push_back(Item(linkItem, true)); + this->Items.push_back(Item(linkItem, true, tgt)); this->Depends.push_back(exe); } else @@ -1020,7 +1020,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item, } // Now add the full path to the library. - this->Items.push_back(Item(item, true)); + this->Items.push_back(Item(item, true, target)); } //---------------------------------------------------------------------------- diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 2d9c54981..fee1e245b 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmComputeLinkInformation.h,v $ Language: C++ - Date: $Date: 2008-07-28 15:31:35 $ - Version: $Revision: 1.15.2.3 $ + Date: $Date: 2008-10-24 15:18:45 $ + Version: $Revision: 1.15.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -40,11 +40,14 @@ public: struct Item { - Item(): Value(), IsPath(true) {} - Item(Item const& item): Value(item.Value), IsPath(item.IsPath) {} - Item(std::string const& v, bool p): Value(v), IsPath(p) {} + Item(): Value(), IsPath(true), Target(0) {} + Item(Item const& item): + Value(item.Value), IsPath(item.IsPath), Target(item.Target) {} + Item(std::string const& v, bool p, cmTarget* target = 0): + Value(v), IsPath(p), Target(target) {} std::string Value; bool IsPath; + cmTarget* Target; }; typedef std::vector ItemVector; ItemVector const& GetItems(); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 2342fe000..e4263f237 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCoreTryCompile.cxx,v $ Language: C++ - Date: $Date: 2008-03-26 18:08:25 $ - Version: $Revision: 1.7.2.2 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.7.2.3 $ Copyright (c) 2007 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -310,7 +310,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) if(!cmSystemTools::CopyFileAlways(this->OutputFile.c_str(), copyFile.c_str())) { - cmSystemTools::Error("Could not COPY_FILE"); + cmOStringStream emsg; + emsg << "Could not COPY_FILE.\n" + << " OutputFile: '" << this->OutputFile.c_str() << "'\n" + << " copyFile: '" << copyFile.c_str() << "'\n"; + cmSystemTools::Error(emsg.str().c_str()); return -1; } } diff --git a/Source/cmDependsJavaLexer.cxx b/Source/cmDependsJavaLexer.cxx index 9844c83ff..50102fc63 100644 --- a/Source/cmDependsJavaLexer.cxx +++ b/Source/cmDependsJavaLexer.cxx @@ -23,7 +23,7 @@ #include #include -#if defined(__BEOS__) +#if defined(__BEOS__) || defined (__HAIKU__) #include /* prevents a conflict with a #define later on... */ #endif @@ -646,8 +646,8 @@ static yyconst flex_int16_t yy_chk[479] = Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDependsJavaLexer.cxx,v $ Language: C++ - Date: $Date: 2007-09-24 15:16:13 $ - Version: $Revision: 1.12 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.12.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. diff --git a/Source/cmDependsJavaLexer.h b/Source/cmDependsJavaLexer.h index 45939cb80..d2f9a128f 100644 --- a/Source/cmDependsJavaLexer.h +++ b/Source/cmDependsJavaLexer.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDependsJavaLexer.h,v $ Language: C++ - Date: $Date: 2007-07-27 14:55:24 $ - Version: $Revision: 1.5 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.5.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -38,7 +38,7 @@ #include #include -#if defined(__BEOS__) +#if defined(__BEOS__) || defined(__HAIKU__) #include /* prevents a conflict with a #define later on... */ #endif diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 25ef0b2ab..fb7f11685 100755 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -208,6 +208,20 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "This specifies the minor version of the CMake" " executable being run.",false, "Variables that Provide Information"); + cm->DefineProperty + ("CMAKE_PATCH_VERSION", cmProperty::VARIABLE, + "The patch version of cmake (i.e. the 3 in X.X.3).", + "This specifies the patch version of the CMake" + " executable being run.",false, + "Variables that Provide Information"); + cm->DefineProperty + ("CMAKE_VERSION", cmProperty::VARIABLE, + "The full version of cmake in major.minor.patch format.", + "This specifies the full version of the CMake executable being run. " + "This variable is defined by versions 2.6.3 and higher. " + "See variables CMAKE_MAJOR_VERSION, CMAKE_MINOR_VERSION, and " + "CMAKE_PATCH_VERSION for individual version components.", false, + "Variables that Provide Information"); cm->DefineProperty ("CMAKE_PARENT_LIST_FILE", cmProperty::VARIABLE, @@ -576,9 +590,16 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "add_executable(CMakeSetup WIN32 ${SRCS})\n",false, "Variables That Change Behavior"); - + cm->DefineProperty + ("CMAKE_COLOR_MAKEFILE", cmProperty::VARIABLE, + "Enables color output when using the Makefile generator.", + "When enabled, the generated Makefiles will produce colored output. " + "Default is ON.",false, + "Variables That Change Behavior"); + + // Variables defined by CMake that describe the system - + cm->DefineProperty ("CMAKE_SYSTEM", cmProperty::VARIABLE, "Name of system cmake is compiling for.", @@ -822,18 +843,23 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "See that target property for additional information.", false, "Variables that Control the Build"); - cm->DefineProperty ("CMAKE_DEBUG_POSTFIX", cmProperty::VARIABLE, - "A postfix to add to targets when build as debug.", - "This variable is used to initialize the DEBUG_POSTFIX " - "property on all the targets. If set the postfix will be " - "appended to any targets built when the configuration is " - "Debug.", + "See variable CMAKE__POSTFIX.", + "This variable is a special case of the more-general " + "CMAKE__POSTFIX variable for the DEBUG configuration.", false, "Variables that Control the Build"); - + cm->DefineProperty + ("CMAKE__POSTFIX", cmProperty::VARIABLE, + "Default filename postfix for libraries under configuration .", + "When a non-executable target is created its _POSTFIX " + "target property is initialized with the value of this variable " + "if it is set.", + false, + "Variables that Control the Build"); + cm->DefineProperty ("CMAKE_BUILD_WITH_INSTALL_RPATH", cmProperty::VARIABLE, "Use the install path for the RPATH", diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 4270fbff3..23b9e8517 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDocumentation.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.69.2.2 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.69.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -201,6 +201,26 @@ static const char *cmDocumentationCopyright[][3] = {0, 0, 0} }; +//---------------------------------------------------------------------------- +#define DOCUMENT_INTRO(type, default_name, desc) \ + static char const *cmDocumentation##type##Intro[2] = { default_name, desc }; +#define GET_DOCUMENT_INTRO(type) cmDocumentation##type##Intro + +DOCUMENT_INTRO(Modules, "cmakemodules", + "Reference of available CMake modules."); +DOCUMENT_INTRO(CustomModules, "cmakecustommodules", + "Reference of available CMake custom modules."); +DOCUMENT_INTRO(Policies, "cmakepolicies", + "Reference of CMake policies."); +DOCUMENT_INTRO(Properties, "cmakeprops", + "Reference of CMake properties."); +DOCUMENT_INTRO(Variables, "cmakevars", + "Reference of CMake variables."); +DOCUMENT_INTRO(Commands, "cmakecommands", + "Reference of available CMake commands."); +DOCUMENT_INTRO(CompatCommands, "cmakecompat", + "Reference of CMake compatibility commands."); + //---------------------------------------------------------------------------- cmDocumentation::cmDocumentation() :CurrentFormatter(0) @@ -321,7 +341,27 @@ void cmDocumentation::ClearSections() } //---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os) +void cmDocumentation::AddDocumentIntroToPrint(const char* intro[2]) +{ + const char* docname = this->GetDocName(false); + if(intro && docname) + { + cmDocumentationSection* section; + std::string desc(""); + + desc += docname; + desc += " - "; + desc += intro[1]; + + section = new cmDocumentationSection("Introduction", "NAME"); + section->Append(0, desc.c_str(), 0); + this->PrintSections.push_back(section); + } +} + +//---------------------------------------------------------------------------- +bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os, + const char* docname) { if ((this->CurrentFormatter->GetForm() != HTMLForm) && (this->CurrentFormatter->GetForm() != DocbookForm) @@ -330,6 +370,16 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os) this->PrintVersion(os); } + // Handle Document Name. docname==0 disables intro. + this->SetDocName(""); + if (docname) + { + if (*docname) + this->SetDocName(docname); + else // empty string was given. select default if possible + this->SetDocName(this->GetDefaultDocName(ht)); + } + switch (ht) { case cmDocumentation::Usage: @@ -595,6 +645,7 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) // given stream. std::ofstream* fout = 0; std::ostream* s = &os; + std::string docname(""); if(i->Filename.length() > 0) { fout = new std::ofstream(i->Filename.c_str(), std::ios::out); @@ -606,10 +657,14 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) { result = false; } + if(i->Filename != "-") + { + docname = cmSystemTools::GetFilenameWithoutLastExtension(i->Filename); + } } // Print this documentation type to the stream. - if(!this->PrintDocumentation(i->HelpType, *s) || !*s) + if(!this->PrintDocumentation(i->HelpType, *s, docname.c_str()) || !*s) { result = false; } @@ -634,7 +689,7 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) cmDocumentation::Form cmDocumentation::GetFormFromFilename( const std::string& filename) { - std::string ext = cmSystemTools::GetFilenameExtension(filename); + std::string ext = cmSystemTools::GetFilenameLastExtension(filename); ext = cmSystemTools::UpperCase(ext); if ((ext == ".HTM") || (ext == ".HTML")) { @@ -869,6 +924,12 @@ void cmDocumentation::SetName(const char* name) this->NameString = name?name:""; } +//---------------------------------------------------------------------------- +void cmDocumentation::SetDocName(const char *docname) +{ + this->DocName = docname?docname:""; +} + //---------------------------------------------------------------------------- void cmDocumentation::SetSection(const char *name, cmDocumentationSection *section) @@ -1233,7 +1294,7 @@ bool cmDocumentation::PrintDocumentationUsage(std::ostream& os) bool cmDocumentation::PrintDocumentationFull(std::ostream& os) { this->CreateFullDocumentation(); - this->CurrentFormatter->PrintHeader(GetNameString(), os); + this->CurrentFormatter->PrintHeader(GetNameString(), GetNameString(), os); this->Print(os); this->CurrentFormatter->PrintFooter(os); return true; @@ -1244,11 +1305,12 @@ bool cmDocumentation::PrintDocumentationModules(std::ostream& os) { this->ClearSections(); this->CreateModulesSection(); + this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Modules)); this->AddSectionToPrint("Description"); this->AddSectionToPrint("Modules"); this->AddSectionToPrint("Copyright"); this->AddSectionToPrint("See Also"); - this->CurrentFormatter->PrintHeader(this->GetNameString(), os); + this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); this->Print(os); this->CurrentFormatter->PrintFooter(os); return true; @@ -1259,13 +1321,14 @@ bool cmDocumentation::PrintDocumentationCustomModules(std::ostream& os) { this->ClearSections(); this->CreateCustomModulesSection(); + this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(CustomModules)); this->AddSectionToPrint("Description"); this->AddSectionToPrint("Custom CMake Modules"); // the custom modules are most probably not under Kitware's copyright, Alex // this->AddSectionToPrint("Copyright"); this->AddSectionToPrint("See Also"); - this->CurrentFormatter->PrintHeader(this->GetNameString(), os); + this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); this->Print(os); this->CurrentFormatter->PrintFooter(os); return true; @@ -1275,12 +1338,13 @@ bool cmDocumentation::PrintDocumentationCustomModules(std::ostream& os) bool cmDocumentation::PrintDocumentationPolicies(std::ostream& os) { this->ClearSections(); + this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Policies)); this->AddSectionToPrint("Description"); this->AddSectionToPrint("Policies"); this->AddSectionToPrint("Copyright"); this->AddSectionToPrint("See Also"); - this->CurrentFormatter->PrintHeader(this->GetNameString(), os); + this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); this->Print(os); this->CurrentFormatter->PrintFooter(os); return true; @@ -1290,6 +1354,7 @@ bool cmDocumentation::PrintDocumentationPolicies(std::ostream& os) bool cmDocumentation::PrintDocumentationProperties(std::ostream& os) { this->ClearSections(); + this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Properties)); this->AddSectionToPrint("Properties Description"); for (std::vector::iterator i = this->PropertySections.begin(); @@ -1299,7 +1364,7 @@ bool cmDocumentation::PrintDocumentationProperties(std::ostream& os) } this->AddSectionToPrint("Copyright"); this->AddSectionToPrint("Standard See Also"); - this->CurrentFormatter->PrintHeader(this->GetNameString(), os); + this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); this->Print(os); this->CurrentFormatter->PrintFooter(os); return true; @@ -1309,6 +1374,7 @@ bool cmDocumentation::PrintDocumentationProperties(std::ostream& os) bool cmDocumentation::PrintDocumentationVariables(std::ostream& os) { this->ClearSections(); + this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Variables)); for (std::vector::iterator i = this->VariableSections.begin(); i != this->VariableSections.end(); ++i) @@ -1317,7 +1383,7 @@ bool cmDocumentation::PrintDocumentationVariables(std::ostream& os) } this->AddSectionToPrint("Copyright"); this->AddSectionToPrint("Standard See Also"); - this->CurrentFormatter->PrintHeader(this->GetNameString(), os); + this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); this->Print(os); this->CurrentFormatter->PrintFooter(os); return true; @@ -1327,10 +1393,11 @@ bool cmDocumentation::PrintDocumentationVariables(std::ostream& os) bool cmDocumentation::PrintDocumentationCurrentCommands(std::ostream& os) { this->ClearSections(); + this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(Commands)); this->AddSectionToPrint("Commands"); this->AddSectionToPrint("Copyright"); this->AddSectionToPrint("Standard See Also"); - this->CurrentFormatter->PrintHeader(this->GetNameString(), os); + this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); this->Print(os); this->CurrentFormatter->PrintFooter(os); return true; @@ -1340,11 +1407,12 @@ bool cmDocumentation::PrintDocumentationCurrentCommands(std::ostream& os) bool cmDocumentation::PrintDocumentationCompatCommands(std::ostream& os) { this->ClearSections(); + this->AddDocumentIntroToPrint(GET_DOCUMENT_INTRO(CompatCommands)); this->AddSectionToPrint("Compatibility Commands Description"); this->AddSectionToPrint("Compatibility Commands"); this->AddSectionToPrint("Copyright"); this->AddSectionToPrint("Standard See Also"); - this->CurrentFormatter->PrintHeader(GetNameString(), os); + this->CurrentFormatter->PrintHeader(GetDocName(), GetNameString(), os); this->Print(os); this->CurrentFormatter->PrintFooter(os); return true; @@ -1465,6 +1533,41 @@ const char* cmDocumentation::GetNameString() const } } +//---------------------------------------------------------------------------- +const char* cmDocumentation::GetDocName(bool fallbackToNameString) const +{ + if (this->DocName.length() > 0) + { + return this->DocName.c_str(); + } + else if (fallbackToNameString) + { + return this->GetNameString(); + } + else + return 0; +} + +//---------------------------------------------------------------------------- +#define CASE_DEFAULT_DOCNAME(doctype) \ + case cmDocumentation::doctype : \ + return GET_DOCUMENT_INTRO(doctype)[0]; +const char* cmDocumentation::GetDefaultDocName(Type ht) const +{ + switch (ht) + { + CASE_DEFAULT_DOCNAME(Modules) + CASE_DEFAULT_DOCNAME(CustomModules) + CASE_DEFAULT_DOCNAME(Policies) + CASE_DEFAULT_DOCNAME(Properties) + CASE_DEFAULT_DOCNAME(Variables) + CASE_DEFAULT_DOCNAME(Commands) + CASE_DEFAULT_DOCNAME(CompatCommands) + default: break; + } + return 0; +} + //---------------------------------------------------------------------------- bool cmDocumentation::IsOption(const char* arg) const { diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index e4594a658..8c8867bc1 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDocumentation.h,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.33.2.1 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.33.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -61,7 +61,7 @@ public: bool PrintRequestedDocumentation(std::ostream& os); /** Print help of the given type. */ - bool PrintDocumentation(Type ht, std::ostream& os); + bool PrintDocumentation(Type ht, std::ostream& os, const char* docname=0); /** Set the program name for standard document generation. */ void SetName(const char* name); @@ -124,6 +124,7 @@ public: private: void SetForm(Form f); + void SetDocName(const char* docname); bool CreateSingleModule(const char* fname, const char* moduleName, @@ -134,6 +135,8 @@ private: bool CreateCustomModulesSection(); void CreateFullDocumentation(); + void AddDocumentIntroToPrint(const char* intro[2]); + bool PrintCopyright(std::ostream& os); bool PrintVersion(std::ostream& os); bool PrintDocumentationGeneric(std::ostream& os, const char *section); @@ -157,9 +160,12 @@ private: const char* GetNameString() const; + const char* GetDocName(bool fallbackToNameString = true) const; + const char* GetDefaultDocName(Type ht) const; bool IsOption(const char* arg) const; std::string NameString; + std::string DocName; std::map AllSections; std::string SeeAlsoString; diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx index 6372184e7..1a0c76c1c 100644 --- a/Source/cmDocumentationFormatter.cxx +++ b/Source/cmDocumentationFormatter.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDocumentationFormatter.cxx,v $ Language: C++ - Date: $Date: 2008-07-22 18:04:24 $ - Version: $Revision: 1.1.2.2 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.1.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -118,7 +118,8 @@ cmDocumentationFormatter::ComputeSectionLinkPrefix(std::string const& name) { return "module"; } - else if(name.find("Name") != name.npos) + else if(name.find("Name") != name.npos || + name.find("Introduction") != name.npos) { return "name"; } diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h index 911c7edae..40f8908d3 100644 --- a/Source/cmDocumentationFormatter.h +++ b/Source/cmDocumentationFormatter.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDocumentationFormatter.h,v $ Language: C++ - Date: $Date: 2008-05-05 17:38:19 $ - Version: $Revision: 1.8.2.1 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.8.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -52,7 +52,9 @@ public: virtual cmDocumentationEnums::Form GetForm() const = 0; - virtual void PrintHeader(const char* /*name*/, std::ostream& /*os*/) {} + virtual void PrintHeader(const char* /*docname*/, + const char* /*appname*/, + std::ostream& /*os*/) {} virtual void PrintFooter(std::ostream& /*os*/) {} virtual void PrintSection(std::ostream& os, const cmDocumentationSection& section, diff --git a/Source/cmDocumentationFormatterDocbook.cxx b/Source/cmDocumentationFormatterDocbook.cxx index 4bfc60f69..70b22b7a1 100644 --- a/Source/cmDocumentationFormatterDocbook.cxx +++ b/Source/cmDocumentationFormatterDocbook.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDocumentationFormatterDocbook.cxx,v $ Language: C++ - Date: $Date: 2008-05-15 19:39:54 $ - Version: $Revision: 1.1.2.2 $ + Date: $Date: 2009-01-13 18:03:51 $ + Version: $Revision: 1.1.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -134,20 +134,23 @@ void cmDocumentationFormatterDocbook const std::vector &entries = section.GetEntries(); - os << "\n"; - for(std::vector::const_iterator op - = entries.begin(); op != entries.end(); ++ op ) + if (!entries.empty()) { - if(op->Name.size()) + os << "\n"; + for(std::vector::const_iterator op + = entries.begin(); op != entries.end(); ++ op ) { - os << " Name.c_str()); - os << "\">"; - cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); - os << "\n"; + if(op->Name.size()) + { + os << " Name.c_str()); + os << "\">"; + cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); + os << "\n"; + } } + os << "\n" ; } - os << "\n" ; for(std::vector::const_iterator op = entries.begin(); op != entries.end();) @@ -229,8 +232,9 @@ void cmDocumentationFormatterDocbook::PrintParagraph(std::ostream& os, } //---------------------------------------------------------------------------- -void cmDocumentationFormatterDocbook::PrintHeader(const char* name, - std::ostream& os) +void cmDocumentationFormatterDocbook::PrintHeader(const char* docname, + const char* appname, + std::ostream& os) { // this one is used to ensure that we don't create multiple link targets // with the same name. We can clear it here since we are at the @@ -244,7 +248,7 @@ void cmDocumentationFormatterDocbook::PrintHeader(const char* name, " ]>\n" "
\n" "\n" - "" << name << "\n" + "" << docname << " - " << appname << "\n" "\n"; } diff --git a/Source/cmDocumentationFormatterDocbook.h b/Source/cmDocumentationFormatterDocbook.h index ac24fddfb..43ce905cd 100644 --- a/Source/cmDocumentationFormatterDocbook.h +++ b/Source/cmDocumentationFormatterDocbook.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDocumentationFormatterDocbook.h,v $ Language: C++ - Date: $Date: 2008-02-19 19:33:43 $ - Version: $Revision: 1.1 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.1.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -31,7 +31,8 @@ public: virtual cmDocumentationEnums::Form GetForm() const { return cmDocumentationEnums::DocbookForm;} - virtual void PrintHeader(const char* name, std::ostream& os); + virtual void PrintHeader(const char* docname, const char* appname, + std::ostream& os); virtual void PrintFooter(std::ostream& os); virtual void PrintSection(std::ostream& os, const cmDocumentationSection& section, diff --git a/Source/cmDocumentationFormatterHTML.cxx b/Source/cmDocumentationFormatterHTML.cxx index 793fd15bd..6b3af0bb1 100644 --- a/Source/cmDocumentationFormatterHTML.cxx +++ b/Source/cmDocumentationFormatterHTML.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDocumentationFormatterHTML.cxx,v $ Language: C++ - Date: $Date: 2008-07-22 18:04:24 $ - Version: $Revision: 1.11.2.2 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.11.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -202,10 +202,13 @@ void cmDocumentationFormatterHTML::PrintParagraph(std::ostream& os, } //---------------------------------------------------------------------------- -void cmDocumentationFormatterHTML::PrintHeader(const char* /*name*/, +void cmDocumentationFormatterHTML::PrintHeader(const char* docname, + const char* appname, std::ostream& os) { - os << "\n"; + os << ""; + os << docname << " - " << appname; + os << "\n"; } //---------------------------------------------------------------------------- diff --git a/Source/cmDocumentationFormatterHTML.h b/Source/cmDocumentationFormatterHTML.h index b2defd970..1e05a891f 100644 --- a/Source/cmDocumentationFormatterHTML.h +++ b/Source/cmDocumentationFormatterHTML.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDocumentationFormatterHTML.h,v $ Language: C++ - Date: $Date: 2008-03-05 16:05:22 $ - Version: $Revision: 1.3 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.3.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -30,7 +30,8 @@ public: virtual cmDocumentationEnums::Form GetForm() const { return cmDocumentationEnums::HTMLForm;} - virtual void PrintHeader(const char* name, std::ostream& os); + virtual void PrintHeader(const char* docname, const char* appname, + std::ostream& os); virtual void PrintFooter(std::ostream& os); virtual void PrintSection(std::ostream& os, const cmDocumentationSection& section, diff --git a/Source/cmDocumentationFormatterMan.cxx b/Source/cmDocumentationFormatterMan.cxx index 4194fd2c1..106827e19 100644 --- a/Source/cmDocumentationFormatterMan.cxx +++ b/Source/cmDocumentationFormatterMan.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDocumentationFormatterMan.cxx,v $ Language: C++ - Date: $Date: 2007-10-22 16:48:39 $ - Version: $Revision: 1.5 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.5.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -57,30 +57,44 @@ void cmDocumentationFormatterMan } } +void cmDocumentationFormatterMan::EscapeText(std::string& man_text) +{ + cmSystemTools::ReplaceString(man_text, "\\", "\\\\"); + cmSystemTools::ReplaceString(man_text, "-", "\\-"); +} + void cmDocumentationFormatterMan::PrintPreformatted(std::ostream& os, const char* text) { std::string man_text = text; - cmSystemTools::ReplaceString(man_text, "\\", "\\\\"); - os << man_text << "\n"; + this->EscapeText(man_text); + os << ".nf\n" << man_text; + if (*text && man_text.at(man_text.length()-1) != '\n') + os << "\n"; + os << ".fi\n"; } void cmDocumentationFormatterMan::PrintParagraph(std::ostream& os, const char* text) { std::string man_text = text; - cmSystemTools::ReplaceString(man_text, "\\", "\\\\"); + this->EscapeText(man_text); os << man_text << "\n\n"; } //---------------------------------------------------------------------------- -void cmDocumentationFormatterMan::PrintHeader(const char* name, +void cmDocumentationFormatterMan::PrintHeader(const char* docname, + const char* appname, std::ostream& os) { - os << ".TH " << name << " 1 \"" + std::string s_docname(docname), s_appname(appname); + + this->EscapeText(s_docname); + this->EscapeText(s_appname); + os << ".TH " << s_docname << " 1 \"" << cmSystemTools::GetCurrentDateTime("%B %d, %Y").c_str() - << "\" \"" << name + << "\" \"" << s_appname << " " << cmVersion::GetCMakeVersion() << "\"\n"; } diff --git a/Source/cmDocumentationFormatterMan.h b/Source/cmDocumentationFormatterMan.h index d53f7a52a..76d6270cb 100644 --- a/Source/cmDocumentationFormatterMan.h +++ b/Source/cmDocumentationFormatterMan.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDocumentationFormatterMan.h,v $ Language: C++ - Date: $Date: 2007-10-22 16:48:39 $ - Version: $Revision: 1.2 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.2.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -30,12 +30,16 @@ public: virtual cmDocumentationEnums::Form GetForm() const { return cmDocumentationEnums::ManForm;} - virtual void PrintHeader(const char* name, std::ostream& os); + virtual void PrintHeader(const char* docname, const char* appname, + std::ostream& os); virtual void PrintSection(std::ostream& os, const cmDocumentationSection& section, const char* name); virtual void PrintPreformatted(std::ostream& os, const char* text); virtual void PrintParagraph(std::ostream& os, const char* text); + +private: + void EscapeText(std::string& man_text); }; #endif diff --git a/Source/cmEnableLanguageCommand.cxx b/Source/cmEnableLanguageCommand.cxx index aba07ee18..fb61ba9bb 100644 --- a/Source/cmEnableLanguageCommand.cxx +++ b/Source/cmEnableLanguageCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmEnableLanguageCommand.cxx,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.5 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.5.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -25,7 +25,7 @@ bool cmEnableLanguageCommand if(args.size() < 1 ) { this->SetError - ("ENABLE_LANGUAGE called with incorrect number of arguments"); + ("called with incorrect number of arguments"); return false; } for (std::vector::const_iterator it = args.begin(); diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index beb452cad..079a3b889 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmExportBuildFileGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-02-06 19:20:35 $ - Version: $Revision: 1.6 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.6.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -106,16 +106,10 @@ cmExportBuildFileGenerator std::string prop = "IMPORTED_LOCATION"; prop += suffix; std::string value; - if(target->IsFrameworkOnApple()) + if(target->IsFrameworkOnApple() || target->IsAppBundleOnApple()) { value = target->GetFullPath(config, false); } - else if(target->IsAppBundleOnApple()) - { - value = target->GetFullPath(config, false); - value += ".app/Contents/MacOS/"; - value += target->GetFullName(config, false); - } else { value = target->GetFullPath(config, false, true); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 77d710316..24eb44673 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmExportFileGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-05-01 16:35:39 $ - Version: $Revision: 1.11.2.3 $ + Date: $Date: 2009-01-13 18:03:51 $ + Version: $Revision: 1.11.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -177,11 +177,7 @@ cmExportFileGenerator cmTarget* target, ImportPropertyMap& properties) { // Compute which library configuration to link. - cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED; - if(config && cmSystemTools::UpperCase(config) == "DEBUG") - { - linkType = cmTarget::DEBUG; - } + cmTarget::LinkLibraryType linkType = target->ComputeLinkType(config); // Construct the list of libs linked for this configuration. std::vector actual_libs; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index a6191cb1e..ccc00f49b 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmExportInstallFileGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-02-06 19:20:35 $ - Version: $Revision: 1.8 $ + Date: $Date: 2009-01-13 18:03:51 $ + Version: $Revision: 1.8.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -27,6 +27,15 @@ cmExportInstallFileGenerator { } +//---------------------------------------------------------------------------- +std::string cmExportInstallFileGenerator::GetConfigImportFileGlob() +{ + std::string glob = this->FileBase; + glob += "-*"; + glob += this->FileExt; + return glob; +} + //---------------------------------------------------------------------------- bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) { @@ -55,7 +64,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) os << "# Load information for each installed configuration.\n" << "GET_FILENAME_COMPONENT(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" << "FILE(GLOB CONFIG_FILES \"${_DIR}/" - << this->FileBase << "-*" << this->FileExt << "\")\n" + << this->GetConfigImportFileGlob() << "\")\n" << "FOREACH(f ${CONFIG_FILES})\n" << " INCLUDE(${f})\n" << "ENDFOREACH(f)\n" diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index 40a2fcfec..e8cb3fb65 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmExportInstallFileGenerator.h,v $ Language: C++ - Date: $Date: 2008-02-01 13:56:00 $ - Version: $Revision: 1.2 $ + Date: $Date: 2009-01-13 18:03:51 $ + Version: $Revision: 1.2.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -59,6 +59,10 @@ public: for installation. */ std::map const& GetConfigImportFiles() { return this->ConfigImportFiles; } + + /** Compute the globbing expression used to load per-config import + files from the main file. */ + std::string GetConfigImportFileGlob(); protected: // Implement virtual methods from the superclass. diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index ed31d3fe8..e106aaa76 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmExtraCodeBlocksGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.18.2.1 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.18.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. Copyright (c) 2004 Alexander Neundorf neundorf@kde.org, All rights reserved. @@ -418,6 +418,13 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( command += "" "; command += target; } + else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0) + { + command += " -f "; + command += makefile; + command += " "; + command += target; + } else { command += " -f ""; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 19c563348..268c3c5cb 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmExtraEclipseCDT4Generator.cxx,v $ Language: C++ - Date: $Date: 2008-08-06 21:04:19 $ - Version: $Revision: 1.13.2.2 $ + Date: $Date: 2009-01-15 14:17:20 $ + Version: $Revision: 1.13.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. Copyright (c) 2004 Alexander Neundorf neundorf@kde.org, All rights reserved. @@ -40,6 +40,36 @@ cmExtraEclipseCDT4Generator // this->SupportedGlobalGenerators.push_back("MSYS Makefiles"); #endif this->SupportedGlobalGenerators.push_back("Unix Makefiles"); + + // don't create these targets in Eclipse, they are too many and + // should be only rarely used directly + this->TargetsToIgnore.insert("preinstall"); + this->TargetsToIgnore.insert("install/local"); + this->TargetsToIgnore.insert("ContinuousBuild"); + this->TargetsToIgnore.insert("ContinuousConfigure"); + this->TargetsToIgnore.insert("ContinuousCoverage"); + this->TargetsToIgnore.insert("ContinuousMemCheck"); + this->TargetsToIgnore.insert("ContinuousStart"); + this->TargetsToIgnore.insert("ContinuousSubmit"); + this->TargetsToIgnore.insert("ContinuousTest"); + this->TargetsToIgnore.insert("ContinuousUpdate"); + this->TargetsToIgnore.insert("ExperimentalBuild"); + this->TargetsToIgnore.insert("ExperimentalConfigure"); + this->TargetsToIgnore.insert("ExperimentalCoverage"); + this->TargetsToIgnore.insert("ExperimentalMemCheck"); + this->TargetsToIgnore.insert("ExperimentalStart"); + this->TargetsToIgnore.insert("ExperimentalSubmit"); + this->TargetsToIgnore.insert("ExperimentalTest"); + this->TargetsToIgnore.insert("ExperimentalUpdate"); + this->TargetsToIgnore.insert("NightlyBuild"); + this->TargetsToIgnore.insert("NightlyConfigure"); + this->TargetsToIgnore.insert("NightlyCoverage"); + this->TargetsToIgnore.insert("NightlyMemCheck"); + this->TargetsToIgnore.insert("NightlyMemoryCheck"); + this->TargetsToIgnore.insert("NightlyStart"); + this->TargetsToIgnore.insert("NightlySubmit"); + this->TargetsToIgnore.insert("NightlyTest"); + this->TargetsToIgnore.insert("NightlyUpdate"); } //---------------------------------------------------------------------------- @@ -66,7 +96,6 @@ void cmExtraEclipseCDT4Generator = static_cast(generator); mf->SetToolSupportsColor(true); mf->SetForceVerboseMakefiles(true); - mf->EnableInstallTarget(); } //---------------------------------------------------------------------------- @@ -351,42 +380,14 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() } } // for EXECUTABLE_OUTPUT_PATH when not in binary dir - std::string outputPath = mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); - if (!outputPath.empty() && !cmSystemTools::IsSubDirectory( - outputPath.c_str(), this->HomeOutputDirectory.c_str())) - { - std::string name = this->GetPathBasename(outputPath); - - // make sure linked resource name is unique - while (this->GlobalGenerator->GetProjectMap().find(name) - != this->GlobalGenerator->GetProjectMap().end()) - { - name += "_"; - } - this->AppendLinkedResource(fout, name, - this->GetEclipsePath(outputPath)); - this->OutLinkedResources.push_back(name); - } + this->AppendOutLinkedResource(fout, + mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"), + mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH")); // for LIBRARY_OUTPUT_PATH when not in binary dir - if (outputPath != mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH")) - { - outputPath = mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH"); - if (!outputPath.empty() && !cmSystemTools::IsSubDirectory( - outputPath.c_str(), this->HomeOutputDirectory.c_str())) - { - std::string name = this->GetPathBasename(outputPath); + this->AppendOutLinkedResource(fout, + mf->GetSafeDefinition("CMAKE_LIBRARY_OUTPUT_DIRECTORY"), + mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH")); - // make sure linked resource name is unique - while (this->GlobalGenerator->GetProjectMap().find(name) - != this->GlobalGenerator->GetProjectMap().end()) - { - name += "_"; - } - this->AppendLinkedResource(fout, name, - this->GetEclipsePath(outputPath)); - this->OutLinkedResources.push_back(name); - } - } fout << "\t\n"; } @@ -573,7 +574,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const { emmited.insert(def); fout << "\n"; + << "\" path=\"\" value=\"" << this->EscapeForXML(val) + << "\"/>\n"; } } } @@ -615,22 +617,12 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const if (generator->GetAllTargetName()) { emmited.insert(generator->GetAllTargetName()); - cmExtraEclipseCDT4Generator::AppendTarget(fout, - generator->GetAllTargetName(), - make); + this->AppendTarget(fout, generator->GetAllTargetName(), make); } - if (generator->GetPreinstallTargetName()) - { - emmited.insert(generator->GetPreinstallTargetName()); - cmExtraEclipseCDT4Generator - ::AppendTarget(fout, generator->GetPreinstallTargetName(), make); - } - if (generator->GetCleanTargetName()) { emmited.insert(generator->GetCleanTargetName()); - cmExtraEclipseCDT4Generator - ::AppendTarget(fout, generator->GetCleanTargetName(), make); + this->AppendTarget(fout, generator->GetCleanTargetName(), make); } // add all executable and library targets and some of the GLOBAL @@ -643,47 +635,56 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t) { + bool addFastTarget = false; switch(t->second.GetType()) { + case cmTarget::EXECUTABLE: + case cmTarget::STATIC_LIBRARY: + case cmTarget::SHARED_LIBRARY: + case cmTarget::MODULE_LIBRARY: + addFastTarget = true; + // no break here case cmTarget::UTILITY: case cmTarget::GLOBAL_TARGET: { - // only add these global targets - if (!( (t->first=="install") - || (t->first=="install/strip") - || (t->first=="test") - || (t->first=="Experimental") - || (t->first=="Nightly") - || (t->first=="edit_cache") - || (t->first=="package") - || (t->first=="package_source") - || (t->first=="rebuild_cache") )) + bool insertTarget = true; + if(insertTarget && + (std::set::const_iterator( + this->TargetsToIgnore.find(t->first)) != + this->TargetsToIgnore.end())) + { + insertTarget = false; + } + + if(insertTarget && (emmited.find(t->first) != emmited.end())) { - break; + insertTarget = false; } + // add the edit_cache target only if it's not ccmake // otherwise ccmake will be executed in the log view of Eclipse, // which is no terminal, so curses don't work there, Alex - if (t->first=="edit_cache") + if (insertTarget && (t->first=="edit_cache")) { if (strstr(mf->GetRequiredDefinition("CMAKE_EDIT_COMMAND"), "ccmake")!=NULL) { - break; + insertTarget = false; } } - } - case cmTarget::EXECUTABLE: - case cmTarget::STATIC_LIBRARY: - case cmTarget::SHARED_LIBRARY: - case cmTarget::MODULE_LIBRARY: - { - if(emmited.find(t->first) == emmited.end()) + + if (insertTarget) { emmited.insert(t->first); - cmExtraEclipseCDT4Generator::AppendTarget(fout, t->first, make); + this->AppendTarget(fout, t->first, make); + if (addFastTarget || t->first=="install") + { + std::string fastTarget = t->first; + fastTarget = fastTarget + "/fast"; + this->AppendTarget(fout, fastTarget, make); + } } - break; + break; } // ignore these: case cmTarget::INSTALL_FILES: @@ -698,7 +699,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const "\n" ; - this->AppendStorageScanners(fout); + this->AppendStorageScanners(fout, *mf); fout << "\n" "\n" @@ -792,12 +793,40 @@ cmExtraEclipseCDT4Generator::GenerateProjectName(const std::string& name, return name + (type.empty() ? "" : "-") + type + "@" + path; } +std::string cmExtraEclipseCDT4Generator::EscapeForXML(const std::string& value) +{ + std::string str = value; + cmSystemTools::ReplaceString(str, "&", "&"); + cmSystemTools::ReplaceString(str, "<", "<"); + cmSystemTools::ReplaceString(str, ">", ">"); + cmSystemTools::ReplaceString(str, "\"", """); + // NOTE: This one is not necessary, since as of Eclipse CDT4 it will + // automatically change this to the original value ('). + //cmSystemTools::ReplaceString(str, "'", "'"); + return str; +} + //---------------------------------------------------------------------------- // Helper functions //---------------------------------------------------------------------------- void cmExtraEclipseCDT4Generator -::AppendStorageScanners(cmGeneratedFileStream& fout) +::AppendStorageScanners(cmGeneratedFileStream& fout, + const cmMakefile& makefile) { + // we need the "make" and the C (or C++) compiler which are used, Alex + std::string make = makefile.GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + std::string compiler = makefile.GetSafeDefinition("CMAKE_C_COMPILER"); + if (compiler.empty()) + { + compiler = makefile.GetSafeDefinition("CMAKE_CXX_COMPILER"); + } + if (compiler.empty()) //Hmm, what to do now ? + { + compiler = "gcc"; + } + + + // the following right now hardcodes gcc behaviour :-/ fout << "\n" "\n"; } @@ -881,3 +910,51 @@ void cmExtraEclipseCDT4Generator "\t\t\n" ; } + +bool cmExtraEclipseCDT4Generator +::AppendOutLinkedResource(cmGeneratedFileStream& fout, + const std::string& defname, + const std::string& altdefname) +{ + if (defname.empty() && altdefname.empty()) + { + return false; + } + + std::string outputPath = (defname.empty() ? altdefname : defname); + + if (!cmSystemTools::FileIsFullPath(outputPath.c_str())) + { + outputPath = this->HomeOutputDirectory + "/" + outputPath; + } + if (cmSystemTools::IsSubDirectory(outputPath.c_str(), + this->HomeOutputDirectory.c_str())) + { + return false; + } + + std::string name = this->GetPathBasename(outputPath); + + // make sure linked resource name is unique + while (this->GlobalGenerator->GetProjectMap().find(name) + != this->GlobalGenerator->GetProjectMap().end()) + { + name += "_"; + } + + if (std::find(this->OutLinkedResources.begin(), + this->OutLinkedResources.end(), + name) + != this->OutLinkedResources.end()) + { + return false; + } + else + { + this->AppendLinkedResource(fout, name, + this->GetEclipsePath(outputPath)); + this->OutLinkedResources.push_back(name); + return true; + } +} + diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index bd2143f3e..6d0231ddf 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmExtraEclipseCDT4Generator.h,v $ Language: C++ - Date: $Date: 2008-02-19 21:27:03 $ - Version: $Revision: 1.4 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.4.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. Copyright (c) 2004 Alexander Neundorf, neundorf@kde.org. All rights reserved. @@ -84,8 +84,11 @@ private: const std::string& type, const std::string& path); + static std::string EscapeForXML(const std::string& value); + // Helper functions - static void AppendStorageScanners(cmGeneratedFileStream& fout); + static void AppendStorageScanners(cmGeneratedFileStream& fout, + const cmMakefile& makefile); static void AppendTarget (cmGeneratedFileStream& fout, const std::string& target, const std::string& make); @@ -104,10 +107,15 @@ private: const std::string& name, const std::string& path); + bool AppendOutLinkedResource(cmGeneratedFileStream& fout, + const std::string& defname, + const std::string& altdefname); + std::vector SrcLinkedResources; std::vector OutLinkedResources; std::string HomeDirectory; std::string HomeOutputDirectory; + std::set TargetsToIgnore; bool IsOutOfSourceBuild; bool GenerateSourceProject; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index aaf765ad8..3f1f87b24 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmFileCommand.cxx,v $ Language: C++ - Date: $Date: 2008-09-12 14:56:20 $ - Version: $Revision: 1.103.2.7 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.103.2.8 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -112,6 +112,10 @@ bool cmFileCommand { return this->HandleInstallCommand(args); } + else if ( subCommand == "DIFFERENT" ) + { + return this->HandleDifferentCommand(args); + } else if ( subCommand == "RPATH_CHANGE" || subCommand == "CHRPATH" ) { return this->HandleRPathChangeCommand(args); @@ -830,6 +834,67 @@ bool cmFileCommand::HandleMakeDirectoryCommand( return true; } +//---------------------------------------------------------------------------- +bool +cmFileCommand::HandleDifferentCommand(std::vector const& args) +{ + /* + FILE(DIFFERENT FILES ) + */ + + // Evaluate arguments. + const char* file_lhs = 0; + const char* file_rhs = 0; + const char* var = 0; + enum Doing { DoingNone, DoingVar, DoingFileLHS, DoingFileRHS }; + Doing doing = DoingVar; + for(unsigned int i=1; i < args.size(); ++i) + { + if(args[i] == "FILES") + { + doing = DoingFileLHS; + } + else if(doing == DoingVar) + { + var = args[i].c_str(); + doing = DoingNone; + } + else if(doing == DoingFileLHS) + { + file_lhs = args[i].c_str(); + doing = DoingFileRHS; + } + else if(doing == DoingFileRHS) + { + file_rhs = args[i].c_str(); + doing = DoingNone; + } + else + { + cmOStringStream e; + e << "DIFFERENT given unknown argument " << args[i]; + this->SetError(e.str().c_str()); + return false; + } + } + if(!var) + { + this->SetError("DIFFERENT not given result variable name."); + return false; + } + if(!file_lhs || !file_rhs) + { + this->SetError("DIFFERENT not given FILES option with two file names."); + return false; + } + + // Compare the files. + const char* result = + cmSystemTools::FilesDiffer(file_lhs, file_rhs)? "1" : "0"; + this->Makefile->AddDefinition(var, result); + return true; +} + //---------------------------------------------------------------------------- // File installation helper class. struct cmFileInstaller @@ -1049,7 +1114,7 @@ bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile, this->Makefile->DisplayStatus(message.c_str(), -1); // Copy the file. - if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true)) + if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true, false)) { cmOStringStream e; e << "INSTALL cannot copy file \"" << fromFile @@ -1064,7 +1129,13 @@ bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile, // Set the file modification time of the destination file. if(copy && !always) { - cmSystemTools::CopyFileTime(fromFile, toFile); + if (!cmSystemTools::CopyFileTime(fromFile, toFile)) + { + cmOStringStream e; + e << "Problem setting modification time on file \"" << toFile << "\""; + this->FileCommand->SetError(e.str().c_str()); + return false; + } } // Set permissions of the destination file. @@ -1682,11 +1753,10 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, bool& optional) { std::string stype = "FILES"; - bool doing_files = false; - bool doing_properties = false; - bool doing_permissions_file = false; - bool doing_permissions_dir = false; - bool doing_permissions_match = false; + enum Doing { DoingNone, DoingFiles, DoingProperties, + DoingPermissionsFile, DoingPermissionsDir, + DoingPermissionsMatch, DoingSelf24 }; + Doing doing = DoingNone; bool use_given_permissions_file = false; bool use_given_permissions_dir = false; bool use_source_permissions = false; @@ -1711,10 +1781,7 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, i++; destination = args[i]; - doing_files = false; - doing_properties = false; - doing_permissions_file = false; - doing_permissions_dir = false; + doing = DoingNone; } else if ( *cstr == "TYPE" && i < args.size()-1 ) { @@ -1733,10 +1800,7 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, i++; optional = true; } - doing_properties = false; - doing_files = false; - doing_permissions_file = false; - doing_permissions_dir = false; + doing = DoingNone; } else if ( *cstr == "RENAME" && i < args.size()-1 ) { @@ -1750,10 +1814,7 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, i++; rename = args[i]; - doing_properties = false; - doing_files = false; - doing_permissions_file = false; - doing_permissions_dir = false; + doing = DoingNone; } else if ( *cstr == "REGEX" && i < args.size()-1 ) { @@ -1767,10 +1828,7 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, this->SetError(e.str().c_str()); return false; } - doing_properties = false; - doing_files = false; - doing_permissions_file = false; - doing_permissions_dir = false; + doing = DoingNone; } else if ( *cstr == "EXCLUDE" ) { @@ -1784,7 +1842,7 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, return false; } current_match_rule->Properties.Exclude = true; - doing_permissions_match = true; + doing = DoingPermissionsMatch; } else if ( *cstr == "PROPERTIES" ) { @@ -1796,27 +1854,19 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, return false; } - doing_properties = true; - doing_files = false; - doing_permissions_file = false; - doing_permissions_dir = false; + doing = DoingProperties; } else if ( *cstr == "PERMISSIONS" ) { if(current_match_rule) { - doing_permissions_match = true; - doing_permissions_file = false; + doing = DoingPermissionsMatch; } else { - doing_permissions_match = false; - doing_permissions_file = true; + doing = DoingPermissionsFile; use_given_permissions_file = true; } - doing_properties = false; - doing_files = false; - doing_permissions_dir = false; } else if ( *cstr == "DIR_PERMISSIONS" ) { @@ -1829,10 +1879,7 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, } use_given_permissions_dir = true; - doing_properties = false; - doing_files = false; - doing_permissions_file = false; - doing_permissions_dir = true; + doing = DoingPermissionsDir; } else if ( *cstr == "USE_SOURCE_PERMISSIONS" ) { @@ -1844,10 +1891,7 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, return false; } - doing_properties = false; - doing_files = false; - doing_permissions_file = false; - doing_permissions_dir = false; + doing = DoingNone; use_source_permissions = true; } else if ( *cstr == "FILES_MATCHING" ) @@ -1860,14 +1904,19 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, return false; } - doing_properties = false; - doing_files = false; - doing_permissions_file = false; - doing_permissions_dir = false; + doing = DoingNone; installer.MatchlessFiles = false; } else if ( *cstr == "COMPONENTS" ) { + if(this->Makefile->IsOn("CMAKE_INSTALL_SELF_2_4")) + { + // When CMake 2.4 builds this CMake version we need to support + // the install scripts it generates since it asks this CMake + // to install itself using the rules it generated. + doing = DoingSelf24; + continue; + } cmOStringStream e; e << "INSTALL called with old-style COMPONENTS argument. " << "This script was generated with an older version of CMake. " @@ -1884,7 +1933,7 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, this->SetError(e.str().c_str()); return false; } - else if ( *cstr == "FILES" && !doing_files) + else if(*cstr == "FILES" && doing != DoingFiles) { if(current_match_rule) { @@ -1894,35 +1943,32 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, return false; } - doing_files = true; - doing_properties = false; - doing_permissions_file = false; - doing_permissions_dir = false; + doing = DoingFiles; } - else if ( doing_properties && i < args.size()-1 ) + else if(doing == DoingProperties && i < args.size()-1) { properties[args[i]] = args[i+1].c_str(); i++; } - else if ( doing_files ) + else if(doing == DoingFiles) { files.push_back(*cstr); } - else if(doing_permissions_file) + else if(doing == DoingPermissionsFile) { if(!installer.CheckPermissions(args[i], permissions_file)) { return false; } } - else if(doing_permissions_dir) + else if(doing == DoingPermissionsDir) { if(!installer.CheckPermissions(args[i], permissions_dir)) { return false; } } - else if(doing_permissions_match) + else if(doing == DoingPermissionsMatch) { if(!installer.CheckPermissions( args[i], current_match_rule->Properties.Permissions)) @@ -1930,6 +1976,13 @@ bool cmFileCommand::ParseInstallArgs(std::vector const& args, return false; } } + else if(doing == DoingSelf24) + { + // Ignore these arguments for compatibility. This should be + // reached only when CMake 2.4 is installing the current + // CMake. It can be removed when CMake 2.6 or higher is + // required to build CMake. + } else { this->SetError("called with inappropriate arguments"); diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 96ee8ba41..f9a28e5ac 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmFileCommand.h,v $ Language: C++ - Date: $Date: 2008-09-12 14:56:20 $ - Version: $Revision: 1.35.2.4 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.35.2.6 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -145,7 +145,7 @@ public: "TO_NATIVE_PATH works just like TO_CMAKE_PATH, but will convert from " " a cmake style path into the native path style \\ for windows and / " "for UNIX.\n" - "DOWNLOAD will download the givin URL to the given file. " + "DOWNLOAD will download the given URL to the given file. " "If LOG var is specified a log of the download will be put in var. " "If STATUS var is specified the status of the operation will" " be put in var. The status is returned in a list of length 2. " @@ -172,6 +172,7 @@ protected: bool HandleRPathChangeCommand(std::vector const& args); bool HandleRPathCheckCommand(std::vector const& args); bool HandleRPathRemoveCommand(std::vector const& args); + bool HandleDifferentCommand(std::vector const& args); // file(INSTALL ...) related functions bool HandleInstallCommand(std::vector const& args); diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index af71497e3..82b66b41e 100755 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmFindBase.cxx,v $ Language: C++ - Date: $Date: 2008-06-13 12:55:17 $ - Version: $Revision: 1.35.2.4 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.35.2.5 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -61,8 +61,10 @@ cmFindBase::cmFindBase() "a cmake style list of paths. For example ENV PATH would be a way " "to list the system path variable. The argument " "after DOC will be used for the documentation string in " - "the cache. PATH_SUFFIXES can be used to give sub directories " - "that will be appended to the search paths.\n" + "the cache. " + "PATH_SUFFIXES specifies additional subdirectories to check below " + "each search path." + "\n" "If NO_DEFAULT_PATH is specified, then no additional paths are " "added to the search. " "If NO_DEFAULT_PATH is not specified, the search process is as follows:\n" @@ -489,13 +491,7 @@ void cmFindBase::AddPathSuffixes() // later with lib being replaced for lib64 which may exist paths.push_back(p); } - } - // now put the path without the path suffixes in the SearchPaths - for(i = finalPath.begin(); - i != finalPath.end(); ++i) - { - // put all search paths in because it may later be replaced - // by lib64 stuff fixes bug 4009 + // now put the path without the path suffixes in the SearchPaths paths.push_back(*i); } } diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index ebbb8120c..0f9722ead 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmFindCommon.cxx,v $ Language: C++ - Date: $Date: 2008-06-13 12:55:17 $ - Version: $Revision: 1.1.2.1 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.1.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -375,7 +375,6 @@ void cmFindCommon::AddEnvPath(const char* variable) // Get a path from the environment. std::vector tmp; cmSystemTools::GetPath(tmp, variable); - // Relative paths are interpreted with respect to the current // working directory. this->AddPathsInternal(tmp, EnvPath); diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 5cbb963fc..b998fe8d0 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmFindLibraryCommand.cxx,v $ Language: C++ - Date: $Date: 2008-06-13 12:55:17 $ - Version: $Revision: 1.58.2.1 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.58.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -16,6 +16,8 @@ =========================================================================*/ #include "cmFindLibraryCommand.h" #include "cmCacheManager.h" +#include +#include cmFindLibraryCommand::cmFindLibraryCommand() { @@ -180,6 +182,7 @@ void cmFindLibraryCommand::AddLib64Paths() cmSystemTools::ReplaceString(s, "lib/", "lib64/"); // try to replace lib with lib64 and see if it is there, // then prepend it to the path + // Note that all paths have trailing slashes. if((s != *i) && cmSystemTools::FileIsDirectory(s.c_str())) { path64.push_back(s); @@ -187,7 +190,7 @@ void cmFindLibraryCommand::AddLib64Paths() } // now just add a 64 to the path name and if it is there, // add it to the path - s2 += "64"; + s2 += "64/"; if(cmSystemTools::FileIsDirectory(s2.c_str())) { found64 = true; @@ -227,74 +230,257 @@ std::string cmFindLibraryCommand::FindLibrary() } //---------------------------------------------------------------------------- -std::string cmFindLibraryCommand::FindNormalLibrary() +struct cmFindLibraryHelper { + cmFindLibraryHelper(cmMakefile* mf); + + // Context information. + cmMakefile* Makefile; + cmGlobalGenerator* GG; + + // List of valid prefixes and suffixes. + std::vector Prefixes; + std::vector Suffixes; + std::string PrefixRegexStr; + std::string SuffixRegexStr; + + // Keep track of the best library file found so far. + typedef std::vector::size_type size_type; + std::string BestPath; + size_type BestPrefix; + size_type BestSuffix; + + // Support for OpenBSD shared library naming: lib.so.. + bool OpenBSD; + unsigned int BestMajor; + unsigned int BestMinor; + + // Current name under consideration. + cmsys::RegularExpression NameRegex; + bool TryRawName; + std::string RawName; + + // Current full path under consideration. + std::string TestPath; + + void RegexFromLiteral(std::string& out, std::string const& in); + void RegexFromList(std::string& out, std::vector const& in); + size_type GetPrefixIndex(std::string const& prefix) + { + return cmsys_stl::find(this->Prefixes.begin(), this->Prefixes.end(), + prefix) - this->Prefixes.begin(); + } + size_type GetSuffixIndex(std::string const& suffix) + { + return cmsys_stl::find(this->Suffixes.begin(), this->Suffixes.end(), + suffix) - this->Suffixes.begin(); + } + bool HasValidSuffix(std::string const& name); + void SetName(std::string const& name); + bool CheckDirectory(std::string const& path); +}; + +//---------------------------------------------------------------------------- +cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf): + Makefile(mf) +{ + this->GG = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + // Collect the list of library name prefixes/suffixes to try. const char* prefixes_list = this->Makefile->GetRequiredDefinition("CMAKE_FIND_LIBRARY_PREFIXES"); const char* suffixes_list = this->Makefile->GetRequiredDefinition("CMAKE_FIND_LIBRARY_SUFFIXES"); - std::vector prefixes; - std::vector suffixes; - cmSystemTools::ExpandListArgument(prefixes_list, prefixes, true); - cmSystemTools::ExpandListArgument(suffixes_list, suffixes, true); + cmSystemTools::ExpandListArgument(prefixes_list, this->Prefixes, true); + cmSystemTools::ExpandListArgument(suffixes_list, this->Suffixes, true); + this->RegexFromList(this->PrefixRegexStr, this->Prefixes); + this->RegexFromList(this->SuffixRegexStr, this->Suffixes); - // Search the entire path for each name. - std::string tryPath; - for(std::vector::const_iterator ni = this->Names.begin(); - ni != this->Names.end() ; ++ni) + // Check whether to use OpenBSD-style library version comparisons. + this->OpenBSD = + this->Makefile->GetCMakeInstance() + ->GetPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING"); + + this->TryRawName = false; + + // No library file has yet been found. + this->BestPrefix = this->Prefixes.size(); + this->BestSuffix = this->Suffixes.size(); + this->BestMajor = 0; + this->BestMinor = 0; +} + +//---------------------------------------------------------------------------- +void cmFindLibraryHelper::RegexFromLiteral(std::string& out, + std::string const& in) +{ + for(std::string::const_iterator ci = in.begin(); ci != in.end(); ++ci) { - // If the original library name provided by the user matches one of - // the suffixes, try it first. - bool tryOrig = false; - std::string const& name = *ni; - for(std::vector::const_iterator si = suffixes.begin(); - !tryOrig && si != suffixes.end(); ++si) + char ch = *ci; + if(ch == '[' || ch == ']' || ch == '(' || ch == ')' || ch == '\\' || + ch == '.' || ch == '*' || ch == '+' || ch == '?' || ch == '-' || + ch == '^' || ch == '$') { - std::string const& suffix = *si; - if(name.length() > suffix.length() && - name.substr(name.size()-suffix.length()) == suffix) - { - tryOrig = true; - } + out += "\\"; } +#if defined(_WIN32) || defined(__APPLE__) + out += tolower(ch); +#else + out += ch; +#endif + } +} - for(std::vector::const_iterator - p = this->SearchPaths.begin(); - p != this->SearchPaths.end(); ++p) +//---------------------------------------------------------------------------- +void cmFindLibraryHelper::RegexFromList(std::string& out, + std::vector const& in) +{ + // Surround the list in parens so the '|' does not apply to anything + // else and the result can be checked after matching. + out += "("; + const char* sep = ""; + for(std::vector::const_iterator si = in.begin(); + si != in.end(); ++si) + { + // Separate from previous item. + out += sep; + sep = "|"; + + // Append this item. + this->RegexFromLiteral(out, *si); + } + out += ")"; +} + +//---------------------------------------------------------------------------- +bool cmFindLibraryHelper::HasValidSuffix(std::string const& name) +{ + // Check if the given name ends in a valid library suffix. + for(std::vector::const_iterator si = this->Suffixes.begin(); + si != this->Suffixes.end(); ++si) + { + std::string const& suffix = *si; + if(name.length() > suffix.length() && + name.substr(name.size()-suffix.length()) == suffix) + { + return true; + } + } + return false; +} + +//---------------------------------------------------------------------------- +void cmFindLibraryHelper::SetName(std::string const& name) +{ + // Consider checking the raw name too. + this->TryRawName = this->HasValidSuffix(name); + this->RawName = name; + + // Build a regular expression to match library names. + std::string regex = "^"; + regex += this->PrefixRegexStr; + this->RegexFromLiteral(regex, name); + regex += this->SuffixRegexStr; + if(this->OpenBSD) + { + regex += "(\\.[0-9]+\\.[0-9]+)?"; + } + regex += "$"; + this->NameRegex.compile(regex.c_str()); +} + +//---------------------------------------------------------------------------- +bool cmFindLibraryHelper::CheckDirectory(std::string const& path) +{ + // If the original library name provided by the user matches one of + // the suffixes, try it first. This allows users to search + // specifically for a static library on some platforms (on MS tools + // one cannot tell just from the library name whether it is a static + // library or an import library). + if(this->TryRawName) + { + this->TestPath = path; + this->TestPath += this->RawName; + if(cmSystemTools::FileExists(this->TestPath.c_str(), true)) + { + this->BestPath = + cmSystemTools::CollapseFullPath(this->TestPath.c_str()); + cmSystemTools::ConvertToUnixSlashes(this->BestPath); + return true; + } + } + + // Search for a file matching the library name regex. + std::string dir = path; + cmSystemTools::ConvertToUnixSlashes(dir); + std::set const& files = this->GG->GetDirectoryContent(dir); + for(std::set::const_iterator fi = files.begin(); + fi != files.end(); ++fi) + { + std::string const& origName = *fi; +#if defined(_WIN32) || defined(__APPLE__) + std::string testName = cmSystemTools::LowerCase(origName); +#else + std::string const& testName = origName; +#endif + if(this->NameRegex.find(testName)) { - // Try the original library name as specified by the user. - if(tryOrig) + this->TestPath = path; + this->TestPath += origName; + if(!cmSystemTools::FileIsDirectory(this->TestPath.c_str())) { - tryPath = *p; - tryPath += name; - if(cmSystemTools::FileExists(tryPath.c_str(), true)) + // This is a matching file. Check if it is better than the + // best name found so far. Earlier prefixes are preferred, + // followed by earlier suffixes. For OpenBSD, shared library + // version extensions are compared. + size_type prefix = this->GetPrefixIndex(this->NameRegex.match(1)); + size_type suffix = this->GetSuffixIndex(this->NameRegex.match(2)); + unsigned int major = 0; + unsigned int minor = 0; + if(this->OpenBSD) { - tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str()); - cmSystemTools::ConvertToUnixSlashes(tryPath); - return tryPath; + sscanf(this->NameRegex.match(3).c_str(), ".%u.%u", &major, &minor); + } + if(this->BestPath.empty() || prefix < this->BestPrefix || + (prefix == this->BestPrefix && suffix < this->BestSuffix) || + (prefix == this->BestPrefix && suffix == this->BestSuffix && + (major > this->BestMajor || + (major == this->BestMajor && minor > this->BestMinor)))) + { + this->BestPath = this->TestPath; + this->BestPrefix = prefix; + this->BestSuffix = suffix; + this->BestMajor = major; + this->BestMinor = minor; } } + } + } + + // Use the best candidate found in this directory, if any. + return !this->BestPath.empty(); +} - // Try various library naming conventions. - for(std::vector::iterator prefix = prefixes.begin(); - prefix != prefixes.end(); ++prefix) +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindNormalLibrary() +{ + // Search the entire path for each name. + cmFindLibraryHelper helper(this->Makefile); + for(std::vector::const_iterator ni = this->Names.begin(); + ni != this->Names.end() ; ++ni) + { + // Switch to searching for this name. + std::string const& name = *ni; + helper.SetName(name); + + // Search every directory. + for(std::vector::const_iterator + p = this->SearchPaths.begin(); + p != this->SearchPaths.end(); ++p) + { + if(helper.CheckDirectory(*p)) { - for(std::vector::iterator suffix = suffixes.begin(); - suffix != suffixes.end(); ++suffix) - { - tryPath = *p; - tryPath += *prefix; - tryPath += name; - tryPath += *suffix; - if(cmSystemTools::FileExists(tryPath.c_str()) - && !cmSystemTools::FileIsDirectory(tryPath.c_str())) - { - tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str()); - cmSystemTools::ConvertToUnixSlashes(tryPath); - return tryPath; - } - } + return helper.BestPath; } } } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 932ddd740..e4bede91f 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmFindPackageCommand.cxx,v $ Language: C++ - Date: $Date: 2008-09-12 14:56:20 $ - Version: $Revision: 1.36.2.4 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.36.2.8 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -64,6 +64,7 @@ cmFindPackageCommand::cmFindPackageCommand() this->NoModule = false; this->DebugMode = false; this->UseLib64Paths = false; + this->PolicyScope = true; this->VersionMajor = 0; this->VersionMinor = 0; this->VersionPatch = 0; @@ -77,7 +78,8 @@ cmFindPackageCommand::cmFindPackageCommand() this->VersionFoundCount = 0; this->CommandDocumentation = " find_package( [version] [EXACT] [QUIET]\n" - " [[REQUIRED|COMPONENTS] [components...]])\n" + " [[REQUIRED|COMPONENTS] [components...]]\n" + " [NO_POLICY_SCOPE])\n" "Finds and loads settings from an external project. " "_FOUND will be set to indicate whether the package was found. " "When the package is found package-specific information is provided " @@ -91,6 +93,9 @@ cmFindPackageCommand::cmFindPackageCommand() "The [version] argument requests a version with which the package found " "should be compatible (format is major[.minor[.patch[.tweak]]]). " "The EXACT option requests that the version be matched exactly. " + "If no [version] is given to a recursive invocation inside a " + "find-module, the [version] and EXACT arguments are forwarded " + "automatically from the outer call. " "Version support is currently provided only on a package-by-package " "basis (details below).\n" "User code should generally look for packages using the above simple " @@ -113,6 +118,7 @@ cmFindPackageCommand::cmFindPackageCommand() "The complete Config mode command signature is:\n" " find_package( [version] [EXACT] [QUIET]\n" " [[REQUIRED|COMPONENTS] [components...]] [NO_MODULE]\n" + " [NO_POLICY_SCOPE]\n" " [NAMES name1 [name2 ...]]\n" " [CONFIGS config1 [config2 ...]]\n" " [HINTS path1 [path2 ... ]]\n" @@ -152,8 +158,7 @@ cmFindPackageCommand::cmFindPackageCommand() "argument is specified. If REQUIRED is specified and the package " "is not found a fatal error is generated and the configure step stops " "executing. If _DIR has been set to a directory not containing " - "a configuration file a fatal error is always generated because user " - "intervention is required." + "a configuration file CMake will ignore it and search from scratch." "\n" "When the [version] argument is given Config mode will only find a " "version of the package that claims compatibility with the requested " @@ -185,6 +190,7 @@ cmFindPackageCommand::cmFindPackageCommand() " PACKAGE_VERSION = full provided version string\n" " PACKAGE_VERSION_EXACT = true if version is exact match\n" " PACKAGE_VERSION_COMPATIBLE = true if version is compatible\n" + " PACKAGE_VERSION_UNSUITABLE = true if unsuitable as any version\n" "These variables are checked by the find_package command to determine " "whether the configuration file provides an acceptable version. " "They are not available after the find_package call returns. " @@ -218,6 +224,9 @@ cmFindPackageCommand::cmFindPackageCommand() "UNIX (U), or Apple (A) conventions.\n" " / (W)\n" " /(cmake|CMake)/ (W)\n" + " /*/ (W)\n" + " /*/(cmake|CMake)/ (W)\n" + " /(share|lib)/cmake/*/ (U)\n" " /(share|lib)/*/ (U)\n" " /(share|lib)/*/(cmake|CMake)/ (U)\n" "On systems supporting OS X Frameworks and Application Bundles " @@ -284,6 +293,11 @@ cmFindPackageCommand::cmFindPackageCommand() this->CommandDocumentation += this->GenericDocumentationMacPolicy; this->CommandDocumentation += this->GenericDocumentationRootPath; this->CommandDocumentation += this->GenericDocumentationPathsOrder; + this->CommandDocumentation += + "\n" + "See the cmake_policy() command documentation for discussion of the " + "NO_POLICY_SCOPE option." + ; } //---------------------------------------------------------------------------- @@ -400,6 +414,12 @@ bool cmFindPackageCommand this->Compatibility_1_6 = false; doing = DoingConfigs; } + else if(args[i] == "NO_POLICY_SCOPE") + { + this->PolicyScope = false; + this->Compatibility_1_6 = false; + doing = DoingNone; + } else if(args[i] == "NO_CMAKE_BUILDS_PATH") { this->NoBuilds = true; @@ -418,7 +438,7 @@ bool cmFindPackageCommand // Set a variable telling the find script this component // is required. std::string req_var = this->Name + "_FIND_REQUIRED_" + args[i]; - this->Makefile->AddDefinition(req_var.c_str(), "1"); + this->AddFindDefinition(req_var.c_str(), "1"); // Append to the list of required components. components += components_sep; @@ -468,6 +488,35 @@ bool cmFindPackageCommand } } + // Ignore EXACT with no version. + if(this->Version.empty() && this->VersionExact) + { + this->VersionExact = false; + this->Makefile->IssueMessage( + cmake::AUTHOR_WARNING, "Ignoring EXACT since no version is requested."); + } + + if(this->Version.empty()) + { + // Check whether we are recursing inside "Find.cmake" within + // another find_package() call. + std::string mod = this->Name; + mod += "_FIND_MODULE"; + if(this->Makefile->IsOn(mod.c_str())) + { + // Get version information from the outer call if necessary. + // Requested version string. + std::string ver = this->Name; + ver += "_FIND_VERSION"; + this->Version = this->Makefile->GetSafeDefinition(ver.c_str()); + + // Whether an exact version is required. + std::string exact = this->Name; + exact += "_FIND_VERSION_EXACT"; + this->VersionExact = this->Makefile->IsOn(exact.c_str()); + } + } + if(!this->Version.empty()) { // Try to parse the version number and store the results that were @@ -546,7 +595,7 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) { // Store the list of components. std::string components_var = this->Name + "_FIND_COMPONENTS"; - this->Makefile->AddDefinition(components_var.c_str(), components.c_str()); + this->AddFindDefinition(components_var.c_str(), components.c_str()); if(this->Quiet) { @@ -554,7 +603,7 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // quietly. std::string quietly = this->Name; quietly += "_FIND_QUIETLY"; - this->Makefile->AddDefinition(quietly.c_str(), "1"); + this->AddFindDefinition(quietly.c_str(), "1"); } if(this->Required) @@ -563,7 +612,7 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // a fatal error if the package is not found. std::string req = this->Name; req += "_FIND_REQUIRED"; - this->Makefile->AddDefinition(req.c_str(), "1"); + this->AddFindDefinition(req.c_str(), "1"); } if(!this->Version.empty()) @@ -572,27 +621,58 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // package has been requested. std::string ver = this->Name; ver += "_FIND_VERSION"; - this->Makefile->AddDefinition(ver.c_str(), this->Version.c_str()); + this->AddFindDefinition(ver.c_str(), this->Version.c_str()); char buf[64]; sprintf(buf, "%u", this->VersionMajor); - this->Makefile->AddDefinition((ver+"_MAJOR").c_str(), buf); + this->AddFindDefinition((ver+"_MAJOR").c_str(), buf); sprintf(buf, "%u", this->VersionMinor); - this->Makefile->AddDefinition((ver+"_MINOR").c_str(), buf); + this->AddFindDefinition((ver+"_MINOR").c_str(), buf); sprintf(buf, "%u", this->VersionPatch); - this->Makefile->AddDefinition((ver+"_PATCH").c_str(), buf); + this->AddFindDefinition((ver+"_PATCH").c_str(), buf); sprintf(buf, "%u", this->VersionTweak); - this->Makefile->AddDefinition((ver+"_TWEAK").c_str(), buf); + this->AddFindDefinition((ver+"_TWEAK").c_str(), buf); sprintf(buf, "%u", this->VersionCount); - this->Makefile->AddDefinition((ver+"_COUNT").c_str(), buf); + this->AddFindDefinition((ver+"_COUNT").c_str(), buf); // Tell the module whether an exact version has been requested. std::string exact = this->Name; exact += "_FIND_VERSION_EXACT"; - this->Makefile->AddDefinition(exact.c_str(), - this->VersionExact? "1":"0"); + this->AddFindDefinition(exact.c_str(), this->VersionExact? "1":"0"); } } +//---------------------------------------------------------------------------- +void cmFindPackageCommand::AddFindDefinition(const char* var, const char* val) +{ + if(const char* old = this->Makefile->GetDefinition(var)) + { + this->OriginalDefs[var].exists = true; + this->OriginalDefs[var].value = old; + } + else + { + this->OriginalDefs[var].exists = false; + } + this->Makefile->AddDefinition(var, val); +} + +//---------------------------------------------------------------------------- +void cmFindPackageCommand::RestoreFindDefinitions() +{ + for(std::map::iterator + i = this->OriginalDefs.begin(); i != this->OriginalDefs.end(); ++i) + { + OriginalDef const& od = i->second; + if(od.exists) + { + this->Makefile->AddDefinition(i->first.c_str(), od.value.c_str()); + } + else + { + this->Makefile->RemoveDefinition(i->first.c_str()); + } + } +} //---------------------------------------------------------------------------- bool cmFindPackageCommand::FindModule(bool& found) @@ -603,9 +683,15 @@ bool cmFindPackageCommand::FindModule(bool& found) std::string mfile = this->Makefile->GetModulesFile(module.c_str()); if ( mfile.size() ) { - // Load the module we found. + // Load the module we found, and set "_FIND_MODULE" to true + // while inside it. found = true; - return this->ReadListFile(mfile.c_str()); + std::string var = this->Name; + var += "_FIND_MODULE"; + this->Makefile->AddDefinition(var.c_str(), "1"); + bool result = this->ReadListFile(mfile.c_str(), DoPolicyScope); + this->Makefile->RemoveDefinition(var.c_str()); + return result; } return true; } @@ -637,17 +723,8 @@ bool cmFindPackageCommand::HandlePackageMode() } } - // Search for the config file if it is not already found. - if(cmSystemTools::IsOff(def)) - { - this->FindConfig(); - def = this->Makefile->GetDefinition(this->Variable.c_str()); - } - - // If the config file was found, load it. - std::string file; - bool result = true; - bool found = false; + // Try to load the config file if the directory is known + bool cachedDirectoryOk = false; if(!cmSystemTools::IsOff(def)) { // Get the directory from the variable value. @@ -660,38 +737,44 @@ bool cmFindPackageCommand::HandlePackageMode() dir = "/" + dir; dir = this->Makefile->GetCurrentDirectory() + dir; } - - // Find the configuration file. - if(this->FindConfigFileToLoad(dir, file)) + // The file location was cached. Look for the correct file. + std::string file; + if (this->FindConfigFile(dir, file)) { - // Set the version variables before loading the config file. - // It may override them. - this->StoreVersionFound(); + this->FileFound = file; + cachedDirectoryOk = true; + } + def = this->Makefile->GetDefinition(this->Variable.c_str()); + } - // Parse the configuration file. - if(this->ReadListFile(file.c_str())) - { - // The package has been found. - found = true; - } - else - { - // The configuration file is invalid. - result = false; - } + // Search for the config file if it is not already found. + if(cmSystemTools::IsOff(def) || !cachedDirectoryOk) + { + this->FindConfig(); + def = this->Makefile->GetDefinition(this->Variable.c_str()); + } + + // If the directory for the config file was found, try to read the file. + bool result = true; + bool found = false; + // in the following test FileFound should never be empty if def is valid + // but I don't want to put an assert() in there now, in case this still + // makes it into 2.6.3 + if(!cmSystemTools::IsOff(def) && (!this->FileFound.empty())) + { + // Set the version variables before loading the config file. + // It may override them. + this->StoreVersionFound(); + + // Parse the configuration file. + if(this->ReadListFile(this->FileFound.c_str(), DoPolicyScope)) + { + // The package has been found. + found = true; } else { - // The variable setting is wrong. - cmOStringStream e; - e << "cannot find package " << this->Name << " because " - << this->Variable << " is set to \"" << def << "\" " - << "which is not a directory containing a package configuration " - << "file (or it is not for the requested version). " - << "Please set the cache entry " << this->Variable << " " - << "to the correct directory, or delete it to ask CMake " - << "to search."; - this->SetError(e.str().c_str()); + // The configuration file is invalid. result = false; } } @@ -743,7 +826,7 @@ bool cmFindPackageCommand::HandlePackageMode() fileVar += "_CONFIG"; if(found) { - this->Makefile->AddDefinition(fileVar.c_str(), file.c_str()); + this->Makefile->AddDefinition(fileVar.c_str(), this->FileFound.c_str()); } else { @@ -894,9 +977,10 @@ bool cmFindPackageCommand::FindAppBundleConfig() } //---------------------------------------------------------------------------- -bool cmFindPackageCommand::ReadListFile(const char* f) +bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr) { - if(this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),f)) + if(this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), f, 0, + !this->PolicyScope || psr == NoPolicyScope)) { return true; } @@ -969,6 +1053,9 @@ void cmFindPackageCommand::AppendSuccessInformation() this->AppendToProperty("DISABLED_FEATURES"); } } + + // Restore original state of "_FIND_" variables we set. + this->RestoreFindDefinitions(); } //---------------------------------------------------------------------------- @@ -1168,24 +1255,6 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir, return false; } -//---------------------------------------------------------------------------- -bool cmFindPackageCommand::FindConfigFileToLoad(std::string const& dir, - std::string& file) -{ - if(this->FileFound.empty()) - { - // The file location was cached. Look for the correct file. - return this->FindConfigFile(dir, file); - } - else - { - // The file location was just found during this call. - // Use the file found without searching again. - file = this->FileFound; - return true; - } -} - //---------------------------------------------------------------------------- bool cmFindPackageCommand::CheckVersion(std::string const& config_file) { @@ -1223,10 +1292,14 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file) bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file) { // The version file will be loaded in an isolated scope. - this->Makefile->PushScope(); + cmMakefile::ScopePushPop varScope(this->Makefile); + cmMakefile::PolicyPushPop polScope(this->Makefile); + static_cast(varScope); + static_cast(polScope); // Clear the output variables. this->Makefile->RemoveDefinition("PACKAGE_VERSION"); + this->Makefile->RemoveDefinition("PACKAGE_VERSION_UNSUITABLE"); this->Makefile->RemoveDefinition("PACKAGE_VERSION_COMPATIBLE"); this->Makefile->RemoveDefinition("PACKAGE_VERSION_EXACT"); @@ -1246,17 +1319,23 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file) sprintf(buf, "%u", this->VersionCount); this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_COUNT", buf); - // Load the version check file. - bool found = false; - if(this->ReadListFile(version_file.c_str())) + // Load the version check file. Pass NoPolicyScope because we do + // our own policy push/pop independent of CMP0011. + bool suitable = false; + if(this->ReadListFile(version_file.c_str(), NoPolicyScope)) { // Check the output variables. - found = this->Makefile->IsOn("PACKAGE_VERSION_EXACT"); - if(!found && !this->VersionExact) + bool okay = this->Makefile->IsOn("PACKAGE_VERSION_EXACT"); + bool unsuitable = this->Makefile->IsOn("PACKAGE_VERSION_UNSUITABLE"); + if(!okay && !this->VersionExact) { - found = this->Makefile->IsOn("PACKAGE_VERSION_COMPATIBLE"); + okay = this->Makefile->IsOn("PACKAGE_VERSION_COMPATIBLE"); } - if(found || this->Version.empty()) + + // The package is suitable if the version is okay and not + // explicitly unsuitable. + suitable = !unsuitable && (okay || this->Version.empty()); + if(suitable) { // Get the version found. this->VersionFound = @@ -1283,11 +1362,8 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file) } } - // Restore the original scope. - this->Makefile->PopScope(); - - // Succeed if the version was found or no version was requested. - return found || this->Version.empty(); + // Succeed if the version is suitable. + return suitable; } //---------------------------------------------------------------------------- @@ -1701,6 +1777,31 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) } } + // PREFIX/(Foo|foo|FOO).*/ + { + cmFindPackageFileList lister(this); + lister + / cmFileListGeneratorFixed(prefix) + / cmFileListGeneratorProject(this->Names); + if(lister.Search()) + { + return true; + } + } + + // PREFIX/(Foo|foo|FOO).*/(cmake|CMake)/ + { + cmFindPackageFileList lister(this); + lister + / cmFileListGeneratorFixed(prefix) + / cmFileListGeneratorProject(this->Names) + / cmFileListGeneratorCaseInsensitive("cmake"); + if(lister.Search()) + { + return true; + } + } + // Construct list of common install locations (lib and share). std::vector common; if(this->UseLib64Paths) @@ -1710,6 +1811,20 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) common.push_back("lib"); common.push_back("share"); + // PREFIX/(share|lib)/cmake/(Foo|foo|FOO).*/ + { + cmFindPackageFileList lister(this); + lister + / cmFileListGeneratorFixed(prefix) + / cmFileListGeneratorEnumerate(common) + / cmFileListGeneratorFixed("cmake") + / cmFileListGeneratorProject(this->Names); + if(lister.Search()) + { + return true; + } + } + // PREFIX/(share|lib)/(Foo|foo|FOO).*/ { cmFindPackageFileList lister(this); @@ -1854,14 +1969,6 @@ bool cmFindPackageCommand::SearchAppBundlePrefix(std::string const& prefix_in) return false; } -// TODO: Version numbers? Perhaps have a listing component class that -// sorts by lexicographic and numerical ordering. Also try to match -// some command argument for the version. Alternatively provide an -// API that just returns a list of valid directories? Perhaps push a -// scope and try loading the target file just to get its version -// number? Could add a foo-version.cmake or FooVersion.cmake file -// in the projects that contains just version information. - // TODO: Debug cmsys::Glob double slash problem. // TODO: Add registry entries after cmake system search path? diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 75b2cc3ca..909d809c0 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmFindPackageCommand.h,v $ Language: C++ - Date: $Date: 2008-09-12 14:56:21 $ - Version: $Revision: 1.19.2.3 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.19.2.6 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -75,12 +75,15 @@ private: void AppendToProperty(const char* propertyName); void SetModuleVariables(const std::string& components); bool FindModule(bool& found); + void AddFindDefinition(const char* var, const char* val); + void RestoreFindDefinitions(); bool HandlePackageMode(); void FindConfig(); bool FindPrefixedConfig(); bool FindFrameworkConfig(); bool FindAppBundleConfig(); - bool ReadListFile(const char* f); + enum PolicyScopeRule { NoPolicyScope, DoPolicyScope }; + bool ReadListFile(const char* f, PolicyScopeRule psr); void StoreVersionFound(); void ComputePrefixes(); @@ -95,7 +98,6 @@ private: bool SearchDirectory(std::string const& dir); bool CheckDirectory(std::string const& dir); bool FindConfigFile(std::string const& dir, std::string& file); - bool FindConfigFileToLoad(std::string const& dir, std::string& file); bool CheckVersion(std::string const& config_file); bool CheckVersionFile(std::string const& version_file); bool SearchPrefix(std::string const& prefix); @@ -104,6 +106,9 @@ private: friend class cmFindPackageFileList; + struct OriginalDef { bool exists; std::string value; }; + std::map OriginalDefs; + std::string CommandDocumentation; cmStdString Name; cmStdString Variable; @@ -128,6 +133,7 @@ private: bool NoBuilds; bool DebugMode; bool UseLib64Paths; + bool PolicyScope; std::vector Names; std::vector Configs; }; diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index e2786928c..3bdf72da7 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmForEachCommand.cxx,v $ Language: C++ - Date: $Date: 2008-02-29 17:18:11 $ - Version: $Revision: 1.27 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.27.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -20,13 +20,6 @@ bool cmForEachFunctionBlocker:: IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmExecutionStatus &inStatus) { - // Prevent recusion and don't let this blocker block its own - // commands. - if (this->Executing) - { - return false; - } - if (!cmSystemTools::Strucmp(lff.Name.c_str(),"foreach")) { // record the number of nested foreach commands @@ -37,6 +30,11 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // if this is the endofreach for this statement if (!this->Depth) { + // Remove the function blocker for this scope or bail. + cmsys::auto_ptr + fb(mf.RemoveFunctionBlocker(this, lff)); + if(!fb.get()) { return false; } + // at end of for each execute recorded commands // store the old value std::string oldDef; @@ -44,7 +42,6 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, { oldDef = mf.GetDefinition(this->Args[0].c_str()); } - this->Executing = true; std::vector::const_iterator j = this->Args.begin(); ++j; @@ -65,21 +62,18 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, inStatus.SetReturnInvoked(true); // restore the variable to its prior value mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); - mf.RemoveFunctionBlocker(lff); return true; } if (status.GetBreakInvoked()) { // restore the variable to its prior value mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); - mf.RemoveFunctionBlocker(lff); return true; } } } // restore the variable to its prior value mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); - mf.RemoveFunctionBlocker(lff); return true; } else @@ -114,15 +108,6 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) return false; } -void cmForEachFunctionBlocker:: -ScopeEnded(cmMakefile &mf) -{ - cmSystemTools::Error("The end of a CMakeLists file was reached with a " - "FOREACH statement that was not closed properly. " - "Within the directory: ", - mf.GetCurrentDirectory()); -} - bool cmForEachCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index b051efc9a..a7f51dff1 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmForEachCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.19 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.19.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -29,17 +29,15 @@ class cmForEachFunctionBlocker : public cmFunctionBlocker { public: - cmForEachFunctionBlocker() {this->Executing = false; Depth = 0;} + cmForEachFunctionBlocker() {this->Depth = 0;} virtual ~cmForEachFunctionBlocker() {} virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); - virtual void ScopeEnded(cmMakefile &mf); std::vector Args; std::vector Functions; - bool Executing; private: int Depth; }; diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h index d16c0fe65..ecf744f9e 100644 --- a/Source/cmFunctionBlocker.h +++ b/Source/cmFunctionBlocker.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmFunctionBlocker.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.12 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.12.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -19,6 +19,7 @@ #include "cmStandardIncludes.h" #include "cmExecutionStatus.h" +#include "cmListFileCache.h" class cmMakefile; /** \class cmFunctionBlocker @@ -43,14 +44,15 @@ public: virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile&) {return false;} - /** - * When the end of a CMakeList file is reached this method is called. It - * is not called on the end of an INCLUDE cmake file, just at the end of a - * regular CMakeList file - */ - virtual void ScopeEnded(cmMakefile&) {} - virtual ~cmFunctionBlocker() {} + + /** Set/Get the context in which this blocker is created. */ + void SetStartingContext(cmListFileContext const& lfc) + { this->StartingContext = lfc; } + cmListFileContext const& GetStartingContext() + { return this->StartingContext; } +private: + cmListFileContext StartingContext; }; #endif diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index d18fd1a6c..b33e8840b 100755 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmFunctionCommand.cxx,v $ Language: C++ - Date: $Date: 2008-03-07 13:40:36 $ - Version: $Revision: 1.6 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.6.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -36,6 +36,7 @@ public: // we must copy when we clone newC->Args = this->Args; newC->Functions = this->Functions; + newC->Policies = this->Policies; return newC; } @@ -81,6 +82,7 @@ public: std::vector Args; std::vector Functions; + cmPolicies::PolicyMap Policies; }; @@ -104,7 +106,13 @@ bool cmFunctionHelperCommand::InvokeInitialPass } // we push a scope on the makefile - this->Makefile->PushScope(); + cmMakefile::LexicalPushPop lexScope(this->Makefile); + cmMakefile::ScopePushPop varScope(this->Makefile); + static_cast(varScope); + + // Push a weak policy scope which restores the policies recorded at + // function creation. + cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies); // set the value of argc cmOStringStream strStream; @@ -162,18 +170,18 @@ bool cmFunctionHelperCommand::InvokeInitialPass { // The error message should have already included the call stack // so we do not need to report an error here. + lexScope.Quiet(); + polScope.Quiet(); inStatus.SetNestedError(true); return false; } if (status.GetReturnInvoked()) { - this->Makefile->PopScope(); return true; } } // pop scope on the makefile - this->Makefile->PopScope(); return true; } @@ -205,6 +213,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmFunctionHelperCommand *f = new cmFunctionHelperCommand(); f->Args = this->Args; f->Functions = this->Functions; + mf.RecordPolicies(f->Policies); // Set the FilePath on the arguments to match the function since it is // not stored and the original values may be freed @@ -223,7 +232,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, mf.AddCommand(f); // remove the function blocker now that the function is defined - mf.RemoveFunctionBlocker(lff); + mf.RemoveFunctionBlocker(this, lff); return true; } else @@ -259,17 +268,6 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf) return false; } -void cmFunctionFunctionBlocker:: -ScopeEnded(cmMakefile &mf) -{ - // functions should end with an EndFunction - cmSystemTools::Error( - "The end of a CMakeLists file was reached with a FUNCTION statement that " - "was not closed properly. Within the directory: ", - mf.GetCurrentDirectory(), " with function ", - this->Args[0].c_str()); -} - bool cmFunctionCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index 022831141..0de654110 100755 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmFunctionCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.3 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.3.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -34,7 +34,6 @@ public: cmMakefile &mf, cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf); - virtual void ScopeEnded(cmMakefile &mf); std::vector Args; std::vector Functions; @@ -105,7 +104,11 @@ public: "will have the actual values of the arguments passed in. This " "facilitates creating functions with optional arguments. Additionally " "ARGV holds the list of all arguments given to the function and ARGN " - "holds the list of argument pass the last expected argument."; + "holds the list of argument pass the last expected argument." + "\n" + "See the cmake_policy() command documentation for the behavior of " + "policies inside functions." + ; } cmTypeMacro(cmFunctionCommand, cmCommand); diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index a609de439..363956687 100644 --- a/Source/cmGetTargetPropertyCommand.h +++ b/Source/cmGetTargetPropertyCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGetTargetPropertyCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.12 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.12.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -58,21 +58,7 @@ public: "stored in the variable VAR. If the property is not found, VAR " "will be set to \"NOTFOUND\". Use set_target_properties to set " "property values. Properties are usually used to control how " - "a target is built.\n" - "The read-only property \"_LOCATION\" provides the full " - "path to the file on disk that will be created for the target when " - "building under configuration " - "(in upper-case, such as \"DEBUG_LOCATION\"). " - "The read-only property \"LOCATION\" specifies " - "the full path to the file on disk that will be created for the " - "target. The path may contain a build-system-specific portion that " - "is replaced at build time with the configuration getting built " - "(such as \"$(ConfigurationName)\" in VS). " - "This is very useful for executable targets to get " - "the path to the executable file for use in a custom command.\n" - "The read-only property \"TYPE\" returns which type the specified " - "target has (EXECUTABLE, STATIC_LIBRARY, SHARED_LIBRARY, " - "MODULE_LIBRARY, UTILITY, INSTALL_FILES or INSTALL_PROGRAMS). " + "a target is built, but some query the target instead. " "This command can get properties for any target so far created. " "The targets do not need to be in the current CMakeLists.txt file."; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 44f9cfcde..4e77de0a5 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.227.2.7 $ + Date: $Date: 2008-11-11 21:52:22 $ + Version: $Revision: 1.227.2.9 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -731,6 +731,7 @@ void cmGlobalGenerator::Configure() this->LocalGeneratorToTargetMap.clear(); this->ProjectMap.clear(); this->RuleHashes.clear(); + this->DirectoryContentMap.clear(); // start with this directory cmLocalGenerator *lg = this->CreateLocalGenerator(); @@ -947,7 +948,8 @@ void cmGlobalGenerator::CheckLocalGenerators() for (cmTargets::const_iterator l = targets.begin(); l != targets.end(); l++) { - const cmTarget::LinkLibraryVectorType& libs=l->second.GetLinkLibraries(); + const cmTarget::LinkLibraryVectorType& libs = + l->second.GetOriginalLinkLibraries(); for(cmTarget::LinkLibraryVectorType::const_iterator lib = libs.begin(); lib != libs.end(); ++lib) { @@ -1557,6 +1559,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) const char* cmakeCommand = mf->GetRequiredDefinition("CMAKE_COMMAND"); // CPack + std::string workingDir = mf->GetStartOutputDirectory(); cmCustomCommandLines cpackCommandLines; std::vector depends; cmCustomCommandLine singleLine; @@ -1569,7 +1572,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("--config"); std::string configFile = mf->GetStartOutputDirectory();; configFile += "/CPackConfig.cmake"; - singleLine.push_back(configFile); + std::string relConfigFile = "./CPackConfig.cmake"; + singleLine.push_back(relConfigFile); cpackCommandLines.push_back(singleLine); if ( this->GetPreinstallTargetName() ) { @@ -1589,7 +1593,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[this->GetPackageTargetName()] = this->CreateGlobalTarget(this->GetPackageTargetName(), "Run CPack packaging tool...", - &cpackCommandLines, depends); + &cpackCommandLines, depends, + workingDir.c_str()); } // CPack source const char* packageSourceTargetName = this->GetPackageSourceTargetName(); @@ -1603,6 +1608,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("--config"); configFile = mf->GetStartOutputDirectory();; configFile += "/CPackSourceConfig.cmake"; + relConfigFile = "./CPackSourceConfig.cmake"; + singleLine.push_back(relConfigFile); if(cmSystemTools::FileExists(configFile.c_str())) { singleLine.push_back(configFile); @@ -1610,7 +1617,9 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[packageSourceTargetName] = this->CreateGlobalTarget(packageSourceTargetName, "Run CPack packaging tool for source...", - &cpackCommandLines, depends); + &cpackCommandLines, depends, + workingDir.c_str() + ); } } @@ -1635,7 +1644,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) cpackCommandLines.push_back(singleLine); (*targets)[this->GetTestTargetName()] = this->CreateGlobalTarget(this->GetTestTargetName(), - "Running tests...", &cpackCommandLines, depends); + "Running tests...", &cpackCommandLines, depends, 0); } //Edit Cache @@ -1658,7 +1667,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[editCacheTargetName] = this->CreateGlobalTarget( editCacheTargetName, "Running CMake cache editor...", - &cpackCommandLines, depends); + &cpackCommandLines, depends, 0); } else { @@ -1670,7 +1679,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) this->CreateGlobalTarget( editCacheTargetName, "Running interactive CMake command-line interface...", - &cpackCommandLines, depends); + &cpackCommandLines, depends, 0); } } @@ -1689,7 +1698,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[rebuildCacheTargetName] = this->CreateGlobalTarget( rebuildCacheTargetName, "Running CMake to regenerate build system...", - &cpackCommandLines, depends); + &cpackCommandLines, depends, 0); } //Install @@ -1722,7 +1731,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)["list_install_components"] = this->CreateGlobalTarget("list_install_components", ostr.str().c_str(), - &cpackCommandLines, depends); + &cpackCommandLines, depends, 0); } std::string cmd; cpackCommandLines.erase(cpackCommandLines.begin(), @@ -1771,7 +1780,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[this->GetInstallTargetName()] = this->CreateGlobalTarget( this->GetInstallTargetName(), "Install the project...", - &cpackCommandLines, depends); + &cpackCommandLines, depends, 0); // install_local if(const char* install_local = this->GetInstallLocalTargetName()) @@ -1787,7 +1796,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[install_local] = this->CreateGlobalTarget( install_local, "Installing only the local directory...", - &cpackCommandLines, depends); + &cpackCommandLines, depends, 0); } // install_strip @@ -1804,7 +1813,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[install_strip] = this->CreateGlobalTarget( install_strip, "Installing the project stripped...", - &cpackCommandLines, depends); + &cpackCommandLines, depends, 0); } } } @@ -1813,6 +1822,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( const char* name, const char* message, const cmCustomCommandLines* commandLines, std::vector depends, + const char* workingDirectory, bool depends_on_all /* = false */) { // Package @@ -1824,7 +1834,8 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( std::vector no_outputs; std::vector no_depends; // Store the custom command in the target. - cmCustomCommand cc(no_outputs, no_depends, *commandLines, 0, 0); + cmCustomCommand cc(no_outputs, no_depends, *commandLines, 0, + workingDirectory); target.GetPostBuildCommands().push_back(cc); target.SetProperty("EchoString", message); if ( depends_on_all ) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 97fd53466..b636fcade 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalGenerator.h,v $ Language: C++ - Date: $Date: 2008-07-17 14:14:25 $ - Version: $Revision: 1.107.2.5 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.107.2.6 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -213,12 +213,12 @@ public: configuration. This is valid during generation only. */ cmTargetManifest const& GetTargetManifest() { return this->TargetManifest; } - /** Get the content of a directory on disk including the target - files to be generated. This may be called only during the - generation step. It is intended for use only by - cmComputeLinkInformation. */ + /** Get the content of a directory. Directory listings are loaded + from disk at most once and cached. During the generation step + the content will include the target files to be built even if + they do not yet exist. */ std::set const& GetDirectoryContent(std::string const& dir, - bool needDisk); + bool needDisk = true); void AddTarget(cmTargets::value_type &v); @@ -280,7 +280,8 @@ protected: void CreateDefaultGlobalTargets(cmTargets* targets); cmTarget CreateGlobalTarget(const char* name, const char* message, const cmCustomCommandLines* commandLines, - std::vector depends, bool depends_on_all = false); + std::vector depends, const char* workingDir, + bool depends_on_all = false); bool NeedSymbolicMark; bool UseLinkScript; diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index e71d1aab4..fecbdc16e 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalMSYSMakefileGenerator.cxx,v $ Language: C++ - Date: $Date: 2007-10-22 16:48:39 $ - Version: $Revision: 1.14 $ + Date: $Date: 2008-12-31 15:14:29 $ + Version: $Revision: 1.14.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -78,7 +78,10 @@ void cmGlobalMSYSMakefileGenerator mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str()); mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str()); this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); - if(!mf->IsSet("CMAKE_AR") && !this->CMakeInstance->GetIsInTryCompile()) + + if(!mf->IsSet("CMAKE_AR") && + !this->CMakeInstance->GetIsInTryCompile() && + !(1==l.size() && l[0]=="NONE")) { cmSystemTools::Error ("CMAKE_AR was not found, please set to archive program. ", diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 73cc083c6..18d0156d7 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalNMakeMakefileGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-01-13 21:36:20 $ - Version: $Revision: 1.26 $ + Date: $Date: 2008-10-24 15:18:46 $ + Version: $Revision: 1.26.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -34,6 +34,19 @@ void cmGlobalNMakeMakefileGenerator // pick a default mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); + if(!(cmSystemTools::GetEnv("INCLUDE") && + cmSystemTools::GetEnv("LIB") && + cmSystemTools::GetEnv("LIBPATH")) + ) + { + std::string message = "To use the NMake generator, cmake must be run " + "from a shell that can use the compiler cl from the command line. " + "This environment does not contain INCLUDE, LIB, or LIBPATH, and " + "these must be set for the cl compiler to work. "; + mf->IssueMessage(cmake::WARNING, + message); + } + this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 0e6a59df5..54ca08be9 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalVisualStudio6Generator.cxx,v $ Language: C++ - Date: $Date: 2008-01-28 13:38:35 $ - Version: $Revision: 1.75 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.75.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -372,6 +372,23 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile() } } + +// Utility function to make a valid VS6 *.dsp filename out +// of a CMake target name: +// +std::string GetVS6TargetName(const std::string& targetName) +{ + std::string name(targetName); + + // Eliminate hyphens. VS6 cannot handle hyphens in *.dsp filenames... + // Replace them with underscores. + // + cmSystemTools::ReplaceString(name, "-", "_"); + + return name; +} + + // Write a dsp file into the DSW file, // Note, that dependencies from executables to // the libraries it uses are also done here @@ -402,7 +419,8 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, if(this->FindTarget(0, j->first.c_str())) { fout << "Begin Project Dependency\n"; - fout << "Project_Dep_Name " << j->first.c_str() << "\n"; + fout << "Project_Dep_Name " + << GetVS6TargetName(j->first.c_str()) << "\n"; fout << "End Project Dependency\n"; } } @@ -419,7 +437,7 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, { std::string depName = this->GetUtilityForTarget(target, i->c_str()); fout << "Begin Project Dependency\n"; - fout << "Project_Dep_Name " << depName << "\n"; + fout << "Project_Dep_Name " << GetVS6TargetName(depName) << "\n"; fout << "End Project Dependency\n"; } } @@ -451,7 +469,7 @@ void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout, for(;i!= end; ++i) { fout << "Begin Project Dependency\n"; - fout << "Project_Dep_Name " << *i << "\n"; + fout << "Project_Dep_Name " << GetVS6TargetName(*i) << "\n"; fout << "End Project Dependency\n"; } fout << "}}}\n\n"; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 45c76fdde..f97c7162d 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalVisualStudio71Generator.cxx,v $ Language: C++ - Date: $Date: 2008-05-01 16:35:39 $ - Version: $Revision: 1.48.2.1 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.48.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -115,7 +115,9 @@ void cmGlobalVisualStudio71Generator this->GetTargetSets(projectTargets, originalTargets, root, generators); - this->WriteTargetsToSolution(fout, root, projectTargets, originalTargets); + OrderedTargetDependSet orderedProjectTargets(projectTargets); + this->WriteTargetsToSolution(fout, root, orderedProjectTargets, + originalTargets); // Write out the configurations information for the solution fout << "Global\n"; // Write out the configurations for the solution @@ -123,7 +125,7 @@ void cmGlobalVisualStudio71Generator fout << "\tGlobalSection(" << this->ProjectConfigurationSectionName << ") = postSolution\n"; // Write out the configurations for all the targets in the project - this->WriteTargetConfigurations(fout, root, projectTargets); + this->WriteTargetConfigurations(fout, root, orderedProjectTargets); fout << "\tEndGlobalSection\n"; // Write the footer for the SLN file this->WriteSLNFooter(fout); @@ -155,7 +157,8 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, { // check to see if this is a fortran build const char* ext = ".vcproj"; - const char* project = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""; + const char* project = + "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""; if(this->TargetIsFortranOnly(t)) { ext = ".vfproj"; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 113e96304..7ac9466ee 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalVisualStudio7Generator.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.99.2.2 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.99.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -253,15 +253,7 @@ void cmGlobalVisualStudio7Generator::AddAllBuildDepends( cmTarget* t = const_cast(*ot); if(!this->IsExcluded(root, *t)) { - if (t->GetType() == cmTarget::UTILITY || - t->GetType() == cmTarget::GLOBAL_TARGET) - { - target->AddUtility(t->GetName()); - } - else - { - target->AddLinkLibrary(t->GetName(),cmTarget::GENERAL); - } + target->AddUtility(t->GetName()); } } } @@ -269,14 +261,14 @@ void cmGlobalVisualStudio7Generator::AddAllBuildDepends( void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( std::ostream& fout, cmLocalGenerator* root, - cmGlobalGenerator::TargetDependSet& projectTargets) + OrderedTargetDependSet const& projectTargets) { // loop over again and write out configurations for each target // in the solution - for(cmGlobalGenerator::TargetDependSet::iterator tt = + for(OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { - cmTarget* target = const_cast(*tt); + cmTarget* target = *tt; if (strncmp(target->GetName(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0) { cmCustomCommand cc = target->GetPostBuildCommands()[0]; @@ -304,16 +296,16 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( std::ostream& fout, cmLocalGenerator* root, - cmGlobalGenerator::TargetDependSet& projectTargets, + OrderedTargetDependSet const& projectTargets, cmGlobalGenerator::TargetDependSet& originalTargets ) { std::string rootdir = root->GetMakefile()->GetStartOutputDirectory(); rootdir += "/"; - for(cmGlobalGenerator::TargetDependSet::iterator tt = + for(OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { - cmTarget* target = const_cast(*tt); + cmTarget* target = *tt; cmMakefile* mf = target->GetMakefile(); // look for the all_build rule and add depends to all // of the original targets (none that were "pulled" into this project) @@ -370,13 +362,13 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( void cmGlobalVisualStudio7Generator::WriteTargetDepends( std::ostream& fout, - cmGlobalGenerator::TargetDependSet& projectTargets + OrderedTargetDependSet const& projectTargets ) { - for(cmGlobalGenerator::TargetDependSet::iterator tt = + for(OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { - cmTarget* target = const_cast(*tt); + cmTarget* target = *tt; cmMakefile* mf = target->GetMakefile(); if (strncmp(target->GetName(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0) { @@ -434,7 +426,9 @@ void cmGlobalVisualStudio7Generator this->GetTargetSets(projectTargets, originalTargets, root, generators); - this->WriteTargetsToSolution(fout, root, projectTargets, originalTargets); + OrderedTargetDependSet orderedProjectTargets(projectTargets); + this->WriteTargetsToSolution(fout, root, orderedProjectTargets, + originalTargets); // Write out the configurations information for the solution fout << "Global\n" << "\tGlobalSection(SolutionConfiguration) = preSolution\n"; @@ -449,12 +443,12 @@ void cmGlobalVisualStudio7Generator fout << "\tEndGlobalSection\n"; // Write out project(target) depends fout << "\tGlobalSection(ProjectDependencies) = postSolution\n"; - this->WriteTargetDepends(fout, projectTargets); + this->WriteTargetDepends(fout, orderedProjectTargets); fout << "\tEndGlobalSection\n"; // Write out the configurations for all the targets in the project fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n"; - this->WriteTargetConfigurations(fout, root, projectTargets); + this->WriteTargetConfigurations(fout, root, orderedProjectTargets); fout << "\tEndGlobalSection\n"; // Write the footer for the SLN file @@ -486,7 +480,8 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, { // check to see if this is a fortran build const char* ext = ".vcproj"; - const char* project = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""; + const char* project = + "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""; if(this->TargetIsFortranOnly(target)) { ext = ".vfproj"; @@ -729,6 +724,34 @@ bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project, return true; } +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio7Generator::TargetCompare +::operator()(cmTarget const* l, cmTarget const* r) +{ + // Make sure ALL_BUILD is first so it is the default active project. + if(strcmp(r->GetName(), "ALL_BUILD") == 0) + { + return false; + } + if(strcmp(l->GetName(), "ALL_BUILD") == 0) + { + return true; + } + return strcmp(l->GetName(), r->GetName()) < 0; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio7Generator::OrderedTargetDependSet +::OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const& targets) +{ + for(cmGlobalGenerator::TargetDependSet::const_iterator ti = + targets.begin(); ti != targets.end(); ++ti) + { + this->insert(*ti); + } +} + //---------------------------------------------------------------------------- static cmVS7FlagTable cmVS7ExtraFlagTable[] = { diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 5c3ff9021..aacf1b605 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalVisualStudio7Generator.h,v $ Language: C++ - Date: $Date: 2008-01-31 21:38:45 $ - Version: $Revision: 1.45 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.45.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -97,6 +97,11 @@ public: ///! What is the configurations directory variable called? virtual const char* GetCMakeCFGInitDirectory() { return "$(OutDir)"; } + struct TargetCompare + { + bool operator()(cmTarget const* l, cmTarget const* r); + }; + protected: static cmVS7FlagTable const* GetExtraFlagTableVS7(); virtual void OutputSLNFile(cmLocalGenerator* root, @@ -114,18 +119,24 @@ protected: virtual void WriteSLNHeader(std::ostream& fout); virtual void AddPlatformDefinitions(cmMakefile* mf); + class OrderedTargetDependSet: public std::multiset + { + public: + OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const&); + }; + virtual void WriteTargetsToSolution( std::ostream& fout, cmLocalGenerator* root, - cmGlobalGenerator::TargetDependSet& projectTargets, + OrderedTargetDependSet const& projectTargets, cmGlobalGenerator::TargetDependSet& originalTargets); virtual void WriteTargetDepends( std::ostream& fout, - cmGlobalGenerator::TargetDependSet& projectTargets); + OrderedTargetDependSet const& projectTargets); virtual void WriteTargetConfigurations( std::ostream& fout, cmLocalGenerator* root, - cmGlobalGenerator::TargetDependSet& projectTargets); + OrderedTargetDependSet const& projectTargets); void AddAllBuildDepends(cmLocalGenerator* root, cmTarget* target, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e04ed4dbe..933cc9303 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalXCodeGenerator.cxx,v $ Language: C++ -Date: $Date: 2008-09-12 14:56:21 $ -Version: $Revision: 1.186.2.8 $ +Date: $Date: 2009-02-04 16:44:17 $ +Version: $Revision: 1.186.2.10 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -281,6 +281,12 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, "echo", "Build all projects"); cmTarget* allbuild = mf->FindTarget("ALL_BUILD"); + // Refer to the main build configuration file for easy editing. + std::string listfile = mf->GetStartDirectory(); + listfile += "/"; + listfile += "CMakeLists.txt"; + allbuild->AddSource(listfile.c_str()); + // Add XCODE depend helper std::string dir = mf->GetCurrentOutputDirectory(); cmCustomCommandLine makecommand; @@ -333,6 +339,12 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, { allbuild->AddUtility(target.GetName()); } + + // Refer to the build configuration file for easy editing. + listfile = lg->GetMakefile()->GetStartDirectory(); + listfile += "/"; + listfile += "CMakeLists.txt"; + target.AddSource(listfile.c_str()); } } } @@ -459,27 +471,7 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, // Using a map and the full path guarantees that we will always get the same // fileRef object for any given full path. // - std::string fname = sf->GetFullPath(); - cmXCodeObject* fileRef = this->FileRefs[fname]; - if(!fileRef) - { - fileRef = this->CreateObject(cmXCodeObject::PBXFileReference); - std::string comment = fname; - comment += " in "; - //std::string gname = group->GetObject("name")->GetString(); - //comment += gname.substr(1, gname.size()-2); - fileRef->SetComment(fname.c_str()); - - this->FileRefs[fname] = fileRef; - } - - cmStdString key = GetGroupMapKey(cmtarget, sf); - cmXCodeObject* group = this->GroupMap[key]; - cmXCodeObject* children = group->GetObject("children"); - if (!children->HasObject(fileRef)) - { - children->AddObject(fileRef); - } + cmXCodeObject* fileRef = this->CreateXCodeFileReference(sf, cmtarget); cmXCodeObject* buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile); buildFile->SetComment(fileRef->GetComment()); @@ -525,6 +517,33 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, } buildFile->AddAttribute("settings", settings); + return buildFile; +} + +//---------------------------------------------------------------------------- +cmXCodeObject* +cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf, + cmTarget& cmtarget) +{ + std::string fname = sf->GetFullPath(); + cmXCodeObject* fileRef = this->FileRefs[fname]; + if(!fileRef) + { + fileRef = this->CreateObject(cmXCodeObject::PBXFileReference); + std::string comment = fname; + //comment += " in "; + //std::string gname = group->GetObject("name")->GetString(); + //comment += gname.substr(1, gname.size()-2); + fileRef->SetComment(fname.c_str()); + this->FileRefs[fname] = fileRef; + } + cmStdString key = GetGroupMapKey(cmtarget, sf); + cmXCodeObject* group = this->GroupMap[key]; + cmXCodeObject* children = group->GetObject("children"); + if (!children->HasObject(fileRef)) + { + children->AddObject(fileRef); + } fileRef->AddAttribute("fileEncoding", this->CreateString("4")); const char* lang = @@ -569,6 +588,10 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, { sourcecode += ".c.c"; } + else if(ext == "txt") + { + sourcecode += ".text"; + } //else // { // // Already specialized above or we leave sourcecode == "sourcecode" @@ -602,7 +625,7 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, fileRef->AddAttribute("sourceTree", this->CreateString("")); } - return buildFile; + return fileRef; } //---------------------------------------------------------------------------- @@ -1618,26 +1641,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, debugStr = "NO"; } - // Convert "XCODE_ATTRIBUTE_*" properties directly. - { - cmPropertyMap const& props = target.GetProperties(); - for(cmPropertyMap::const_iterator i = props.begin(); - i != props.end(); ++i) - { - if(i->first.find("XCODE_ATTRIBUTE_") == 0) - { - buildSettings->AddAttribute(i->first.substr(16).c_str(), - this->CreateString(i->second.GetValue())); - } - } - } - buildSettings->AddAttribute("GCC_GENERATE_DEBUGGING_SYMBOLS", this->CreateString(debugStr)); buildSettings->AddAttribute("GCC_OPTIMIZATION_LEVEL", this->CreateString(optLevel)); - buildSettings->AddAttribute("OPTIMIZATION_CFLAGS", - this->CreateString(oflagc.c_str())); buildSettings->AddAttribute("GCC_SYMBOLS_PRIVATE_EXTERN", this->CreateString("NO")); buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN", @@ -1730,6 +1737,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, buildSettings->AddAttribute("DYLIB_COMPATIBILITY_VERSION", this->CreateString(vso.str().c_str())); } + // put this last so it can override existing settings + // Convert "XCODE_ATTRIBUTE_*" properties directly. + { + cmPropertyMap const& props = target.GetProperties(); + for(cmPropertyMap::const_iterator i = props.begin(); + i != props.end(); ++i) + { + if(i->first.find("XCODE_ATTRIBUTE_") == 0) + { + buildSettings->AddAttribute(i->first.substr(16).c_str(), + this->CreateString(i->second.GetValue())); + } + } + } } //---------------------------------------------------------------------------- @@ -1786,6 +1807,21 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) target->AddAttribute("name", this->CreateString(productName.c_str())); target->AddAttribute("productName",this->CreateString(productName.c_str())); target->SetTarget(&cmtarget); + + // Add source files without build rules for editing convenience. + if(cmtarget.GetType() == cmTarget::UTILITY) + { + std::vector const& sources = cmtarget.GetSourceFiles(); + for(std::vector::const_iterator i = sources.begin(); + i != sources.end(); ++i) + { + if(!(*i)->GetPropertyAsBool("GENERATED")) + { + this->CreateXCodeFileReference(*i, cmtarget); + } + } + } + return target; } @@ -2047,72 +2083,14 @@ void cmGlobalXCodeGenerator } // Add dependencies on other CMake targets. - { - // Keep track of dependencies already listed. - std::set emitted; - - // A target should not depend on itself. - emitted.insert(cmtarget->GetName()); - - // Loop over all library dependencies. - const cmTarget::LinkLibraryVectorType& tlibs = - cmtarget->GetLinkLibraries(); - for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin(); - lib != tlibs.end(); ++lib) + TargetDependSet const& deps = this->GetTargetDirectDepends(*cmtarget); + for(TargetDependSet::const_iterator i = deps.begin(); i != deps.end(); ++i) { - // Don't emit the same library twice for this target. - if(emitted.insert(lib->first).second) + if(cmXCodeObject* dptarget = this->FindXCodeTarget(*i)) { - // Add this dependency. - cmTarget* t = this->FindTarget(this->CurrentProject.c_str(), - lib->first.c_str()); - cmXCodeObject* dptarget = this->FindXCodeTarget(t); - if(dptarget) - { - this->AddDependTarget(target, dptarget); - } + this->AddDependTarget(target, dptarget); } } - } - - // write utility dependencies. - for(std::set::const_iterator i - = cmtarget->GetUtilities().begin(); - i != cmtarget->GetUtilities().end(); ++i) - { - cmTarget* t = this->FindTarget(this->CurrentProject.c_str(), - i->c_str()); - // if the target is in this project then make target depend - // on it. It may not be in this project if this is a sub - // project from the top. - if(t) - { - cmXCodeObject* dptarget = this->FindXCodeTarget(t); - if(dptarget) - { - this->AddDependTarget(target, dptarget); - } - else - { - std::string m = "Error Utility: "; - m += i->c_str(); - m += "\n"; - m += "cmtarget "; - if(t) - { - m += t->GetName(); - } - m += "\n"; - m += "Is on the target "; - m += cmtarget->GetName(); - m += "\n"; - m += "But it has no xcode target created yet??\n"; - m += "Current project is "; - m += this->CurrentProject.c_str(); - cmSystemTools::Error(m.c_str()); - } - } - } // Skip link information for static libraries. if(cmtarget->GetType() == cmTarget::STATIC_LIBRARY) @@ -2242,8 +2220,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, // end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source // groups: // - if(cmtarget.GetType() == cmTarget::UTILITY || - cmtarget.GetType() == cmTarget::GLOBAL_TARGET) + if(cmtarget.GetType() == cmTarget::GLOBAL_TARGET) { continue; } @@ -2630,11 +2607,6 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( t->GetType() == cmTarget::MODULE_LIBRARY) { std::string tfull = t->GetFullPath(configName); - if(t->IsAppBundleOnApple()) - { - tfull += ".app/Contents/MacOS/"; - tfull += t->GetFullName(configName); - } makefileStream << "\\\n\t" << this->ConvertToRelativeForMake(tfull.c_str()); } @@ -2692,11 +2664,6 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( { // Create a rule for this target. std::string tfull = t->GetFullPath(configName); - if(t->IsAppBundleOnApple()) - { - tfull += ".app/Contents/MacOS/"; - tfull += t->GetFullName(configName); - } makefileStream << this->ConvertToRelativeForMake(tfull.c_str()) << ":"; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c2599d999..8ffb0ecbf 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalXCodeGenerator.h,v $ Language: C++ - Date: $Date: 2008-07-13 21:55:23 $ - Version: $Revision: 1.52.2.1 $ + Date: $Date: 2008-10-24 15:18:48 $ + Version: $Revision: 1.52.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -152,6 +152,8 @@ private: virtual void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); + cmXCodeObject* CreateXCodeFileReference(cmSourceFile* sf, + cmTarget& cmtarget); cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen, cmSourceFile* sf, cmTarget& cmtarget); diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index f6cc35d39..09cf4dd62 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmIfCommand.cxx,v $ Language: C++ - Date: $Date: 2008-09-12 14:56:21 $ - Version: $Revision: 1.84.2.3 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.84.2.5 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -21,17 +21,12 @@ #include #include +//========================================================================= bool cmIfFunctionBlocker:: -IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, +IsFunctionBlocked(const cmListFileFunction& lff, + cmMakefile &mf, cmExecutionStatus &inStatus) { - // Prevent recusion and don't let this blocker block its own - // commands. - if (this->Executing) - { - return false; - } - // we start by recording all the functions if (!cmSystemTools::Strucmp(lff.Name.c_str(),"if")) { @@ -43,8 +38,12 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // if this is the endif for this if statement, then start executing if (!this->ScopeDepth) { + // Remove the function blocker for this scope or bail. + cmsys::auto_ptr + fb(mf.RemoveFunctionBlocker(this, lff)); + if(!fb.get()) { return false; } + // execute the functions for the true parts of the if statement - this->Executing = true; cmExecutionStatus status; int scopeDepth = 0; for(unsigned int c = 0; c < this->Functions.size(); ++c) @@ -74,15 +73,19 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, } else { - char* errorString = 0; + // Place this call on the call stack. + cmMakefileCall stack_manager(&mf, this->Functions[c], status); + static_cast(stack_manager); + + std::string errorString; std::vector expandedArguments; mf.ExpandArguments(this->Functions[c].Arguments, expandedArguments); bool isTrue = - cmIfCommand::IsTrue(expandedArguments,&errorString,&mf); + cmIfCommand::IsTrue(expandedArguments,errorString,&mf); - if (errorString) + if (errorString.size()) { std::string err = "had incorrect arguments: "; unsigned int i; @@ -96,9 +99,9 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, err += "("; err += errorString; err += ")."; - cmSystemTools::Error(err.c_str()); - delete [] errorString; - return false; + mf.IssueMessage(cmake::FATAL_ERROR, err); + cmSystemTools::SetFatalErrorOccured(); + return true; } if (isTrue) @@ -117,18 +120,15 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, if (status.GetReturnInvoked()) { inStatus.SetReturnInvoked(true); - mf.RemoveFunctionBlocker(lff); return true; } if (status.GetBreakInvoked()) { inStatus.SetBreakInvoked(true); - mf.RemoveFunctionBlocker(lff); return true; } } } - mf.RemoveFunctionBlocker(lff); return true; } } @@ -140,6 +140,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, return true; } +//========================================================================= bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff, cmMakefile&) { @@ -157,36 +158,19 @@ bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff, return false; } -void cmIfFunctionBlocker:: -ScopeEnded(cmMakefile &mf) -{ - std::string errmsg = "The end of a CMakeLists file was reached with an " - "IF statement that was not closed properly.\nWithin the directory: "; - errmsg += mf.GetCurrentDirectory(); - errmsg += "\nThe arguments are: "; - for(std::vector::const_iterator j = this->Args.begin(); - j != this->Args.end(); ++j) - { - errmsg += (j->Quoted?"\"":""); - errmsg += j->Value; - errmsg += (j->Quoted?"\"":""); - errmsg += " "; - } - cmSystemTools::Message(errmsg.c_str(), "Warning"); -} - +//========================================================================= bool cmIfCommand ::InvokeInitialPass(const std::vector& args, cmExecutionStatus &) { - char* errorString = 0; + std::string errorString; std::vector expandedArguments; this->Makefile->ExpandArguments(args, expandedArguments); bool isTrue = - cmIfCommand::IsTrue(expandedArguments,&errorString,this->Makefile); + cmIfCommand::IsTrue(expandedArguments,errorString,this->Makefile); - if (errorString) + if (errorString.size()) { std::string err = "had incorrect arguments: "; unsigned int i; @@ -201,7 +185,7 @@ bool cmIfCommand err += errorString; err += ")."; this->SetError(err.c_str()); - delete [] errorString; + cmSystemTools::SetFatalErrorOccured(); return false; } @@ -221,6 +205,7 @@ bool cmIfCommand namespace { +//========================================================================= void IncrementArguments(std::list &newArgs, std::list::iterator &argP1, std::list::iterator &argP2) @@ -236,10 +221,56 @@ namespace } } + //========================================================================= + // helper function to reduce code duplication + void HandlePredicate(bool value, int &reducible, + std::list::iterator &arg, + std::list &newArgs, + std::list::iterator &argP1, + std::list::iterator &argP2) + { + if(value) + { + *arg = "1"; + } + else + { + *arg = "0"; + } + newArgs.erase(argP1); + argP1 = arg; + IncrementArguments(newArgs,argP1,argP2); + reducible = 1; + } + + //========================================================================= + // helper function to reduce code duplication + void HandleBinaryOp(bool value, int &reducible, + std::list::iterator &arg, + std::list &newArgs, + std::list::iterator &argP1, + std::list::iterator &argP2) + { + if(value) + { + *arg = "1"; + } + else + { + *arg = "0"; + } + newArgs.erase(argP2); + newArgs.erase(argP1); + argP1 = arg; + IncrementArguments(newArgs,argP1,argP2); + reducible = 1; + } + + //========================================================================= enum Op { OpLess, OpEqual, OpGreater }; bool HandleVersionCompare(Op op, const char* lhs_str, const char* rhs_str) { - // Parse out up to 4 components. + // Parse out up to 4 components. unsigned int lhs[4] = {0,0,0,0}; unsigned int rhs[4] = {0,0,0,0}; sscanf(lhs_str, "%u.%u.%u.%u", &lhs[0], &lhs[1], &lhs[2], &lhs[3]); @@ -262,68 +293,60 @@ namespace // lhs == rhs, so true if operation is EQUAL return op == OpEqual; } -} - - -// order of operations, -// IS_DIRECTORY EXISTS COMMAND DEFINED -// MATCHES LESS GREATER EQUAL STRLESS STRGREATER STREQUAL -// AND OR -// -// There is an issue on whether the arguments should be values of references, -// for example IF (FOO AND BAR) should that compare the strings FOO and BAR -// or should it really do IF (${FOO} AND ${BAR}) Currently IS_DIRECTORY -// EXISTS COMMAND and DEFINED all take values. EQUAL, LESS and GREATER can -// take numeric values or variable names. STRLESS and STRGREATER take -// variable names but if the variable name is not found it will use the name -// directly. AND OR take variables or the values 0 or 1. - - -bool cmIfCommand::IsTrue(const std::vector &args, - char **errorString, cmMakefile *makefile) -{ - // check for the different signatures - const char *def; - const char *def2; - const char* msg = "Unknown arguments specified"; - *errorString = new char[strlen(msg) + 1]; - strcpy(*errorString, msg); - - // handle empty invocation - if (args.size() < 1) - { - delete [] *errorString; - *errorString = 0; - return false; - } - // store the reduced args in this vector - std::list newArgs; + //========================================================================= + // level 0 processes parenthetical expressions + bool HandleLevel0(std::list &newArgs, + cmMakefile *makefile, + std::string &errorString) + { int reducible; - unsigned int i; - - // copy to the list structure - for(i = 0; i < args.size(); ++i) - { - newArgs.push_back(args[i]); - } - std::list::iterator argP1; - std::list::iterator argP2; - - // now loop through the arguments and see if we can reduce any of them - // we do this multiple times. Once for each level of precedence do { reducible = 0; std::list::iterator arg = newArgs.begin(); while (arg != newArgs.end()) { - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - // does a file exist - if (*arg == "EXISTS" && argP1 != newArgs.end()) + if (*arg == "(") { - if(cmSystemTools::FileExists((argP1)->c_str())) + // search for the closing paren for this opening one + std::list::iterator argClose; + argClose = arg; + argClose++; + unsigned int depth = 1; + while (argClose != newArgs.end() && depth) + { + if (*argClose == "(") + { + depth++; + } + if (*argClose == ")") + { + depth--; + } + argClose++; + } + if (depth) + { + errorString = "mismatched parenthesis in condition"; + return false; + } + // store the reduced args in this vector + std::vector newArgs2; + + // copy to the list structure + std::list::iterator argP1 = arg; + argP1++; + for(; argP1 != argClose; argP1++) + { + newArgs2.push_back(*argP1); + } + newArgs2.pop_back(); + // now recursively invoke IsTrue to handle the values inside the + // parenthetical expression + bool value = + cmIfCommand::IsTrue(newArgs2, errorString, makefile); + if(value) { *arg = "1"; } @@ -331,91 +354,77 @@ bool cmIfCommand::IsTrue(const std::vector &args, { *arg = "0"; } - newArgs.erase(argP1); argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + argP1++; + // remove the now evaluated parenthetical expression + newArgs.erase(argP1,argClose); + } + ++arg; + } + } + while (reducible); + return true; + } + + //========================================================================= + // level one handles most predicates except for NOT + bool HandleLevel1(std::list &newArgs, + cmMakefile *makefile, + std::string &) + { + int reducible; + do + { + reducible = 0; + std::list::iterator arg = newArgs.begin(); + std::list::iterator argP1; + std::list::iterator argP2; + while (arg != newArgs.end()) + { + argP1 = arg; + IncrementArguments(newArgs,argP1,argP2); + // does a file exist + if (*arg == "EXISTS" && argP1 != newArgs.end()) + { + HandlePredicate( + cmSystemTools::FileExists((argP1)->c_str()), + reducible, arg, newArgs, argP1, argP2); } // does a directory with this name exist if (*arg == "IS_DIRECTORY" && argP1 != newArgs.end()) { - if(cmSystemTools::FileIsDirectory((argP1)->c_str())) - { - *arg = "1"; - } - else - { - *arg = "0"; - } - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + HandlePredicate( + cmSystemTools::FileIsDirectory((argP1)->c_str()), + reducible, arg, newArgs, argP1, argP2); } // is the given path an absolute path ? if (*arg == "IS_ABSOLUTE" && argP1 != newArgs.end()) { - if(cmSystemTools::FileIsFullPath((argP1)->c_str())) - { - *arg = "1"; - } - else - { - *arg = "0"; - } - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; - } + HandlePredicate( + cmSystemTools::FileIsFullPath((argP1)->c_str()), + reducible, arg, newArgs, argP1, argP2); + } // does a command exist if (*arg == "COMMAND" && argP1 != newArgs.end()) { - if(makefile->CommandExists((argP1)->c_str())) - { - *arg = "1"; - } - else - { - *arg = "0"; - } - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; - } - // does a target exist - if (*arg == "TARGET" && argP1 != newArgs.end()) - { - if(makefile->FindTargetToUse((argP1)->c_str())) - { - *arg = "1"; - } - else - { - *arg = "0"; - } - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + HandlePredicate( + makefile->CommandExists((argP1)->c_str()), + reducible, arg, newArgs, argP1, argP2); } // does a policy exist if (*arg == "POLICY" && argP1 != newArgs.end()) { cmPolicies::PolicyID pid; - if(makefile->GetPolicies()->GetPolicyID((argP1)->c_str(), pid)) - { - *arg = "1"; - } - else - { - *arg = "0"; - } - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + HandlePredicate( + makefile->GetPolicies()->GetPolicyID((argP1)->c_str(), pid), + reducible, arg, newArgs, argP1, argP2); + } + // does a target exist + if (*arg == "TARGET" && argP1 != newArgs.end()) + { + HandlePredicate( + makefile->FindTargetToUse((argP1)->c_str())? true:false, + reducible, arg, newArgs, argP1, argP2); } // is a variable defined if (*arg == "DEFINED" && argP1 != newArgs.end()) @@ -432,32 +441,30 @@ bool cmIfCommand::IsTrue(const std::vector &args, { bdef = makefile->IsDefinitionSet((argP1)->c_str()); } - if(bdef) - { - *arg = "1"; - } - else - { - *arg = "0"; - } - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + HandlePredicate(bdef, reducible, arg, newArgs, argP1, argP2); } ++arg; } } while (reducible); + return true; + } - - // now loop through the arguments and see if we can reduce any of them - // we do this multiple times. Once for each level of precedence + //========================================================================= + // level two handles most binary operations except for AND OR + bool HandleLevel2(std::list &newArgs, + cmMakefile *makefile, + std::string &errorString) + { + int reducible; + const char *def; + const char *def2; do { reducible = 0; std::list::iterator arg = newArgs.begin(); - + std::list::iterator argP1; + std::list::iterator argP2; while (arg != newArgs.end()) { argP1 = arg; @@ -473,9 +480,7 @@ bool cmIfCommand::IsTrue(const std::vector &args, { cmOStringStream error; error << "Regular expression \"" << rex << "\" cannot compile"; - delete [] *errorString; - *errorString = new char[error.str().size() + 1]; - strcpy(*errorString, error.str().c_str()); + errorString = error.str(); return false; } if (regEntry.find(def)) @@ -511,49 +516,26 @@ bool cmIfCommand::IsTrue(const std::vector &args, def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile); double lhs; double rhs; + bool result; if(sscanf(def, "%lg", &lhs) != 1 || sscanf(def2, "%lg", &rhs) != 1) { - *arg = "0"; + result = false; } else if (*(argP1) == "LESS") { - if(lhs < rhs) - { - *arg = "1"; - } - else - { - *arg = "0"; - } + result = (lhs < rhs); } else if (*(argP1) == "GREATER") { - if(lhs > rhs) - { - *arg = "1"; - } - else - { - *arg = "0"; - } + result = (lhs > rhs); } else { - if(lhs == rhs) - { - *arg = "1"; - } - else - { - *arg = "0"; - } + result = (lhs == rhs); } - newArgs.erase(argP2); - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + HandleBinaryOp(result, + reducible, arg, newArgs, argP1, argP2); } if (argP1 != newArgs.end() && argP2 != newArgs.end() && @@ -564,7 +546,7 @@ bool cmIfCommand::IsTrue(const std::vector &args, def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile); int val = strcmp(def,def2); - int result; + bool result; if (*(argP1) == "STRLESS") { result = (val < 0); @@ -577,19 +559,8 @@ bool cmIfCommand::IsTrue(const std::vector &args, { result = (val == 0); } - if(result) - { - *arg = "1"; - } - else - { - *arg = "0"; - } - newArgs.erase(argP2); - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + HandleBinaryOp(result, + reducible, arg, newArgs, argP1, argP2); } if (argP1 != newArgs.end() && argP2 != newArgs.end() && @@ -608,19 +579,8 @@ bool cmIfCommand::IsTrue(const std::vector &args, op = OpGreater; } bool result = HandleVersionCompare(op, def, def2); - if(result) - { - *arg = "1"; - } - else - { - *arg = "0"; - } - newArgs.erase(argP2); - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + HandleBinaryOp(result, + reducible, arg, newArgs, argP1, argP2); } // is file A newer than file B @@ -631,33 +591,32 @@ bool cmIfCommand::IsTrue(const std::vector &args, bool success=cmSystemTools::FileTimeCompare(arg->c_str(), (argP2)->c_str(), &fileIsNewer); - if(success==false || fileIsNewer==1 || fileIsNewer==0) - { - *arg = "1"; - } - else - { - *arg = "0"; - } - newArgs.erase(argP2); - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + HandleBinaryOp( + (success==false || fileIsNewer==1 || fileIsNewer==0), + reducible, arg, newArgs, argP1, argP2); } ++arg; } } while (reducible); + return true; + } - - // now loop through the arguments and see if we can reduce any of them - // we do this multiple times. Once for each level of precedence + //========================================================================= + // level 3 handles NOT + bool HandleLevel3(std::list &newArgs, + cmMakefile *makefile, + std::string &) + { + int reducible; + const char *def; do { reducible = 0; std::list::iterator arg = newArgs.begin(); + std::list::iterator argP1; + std::list::iterator argP2; while (arg != newArgs.end()) { argP1 = arg; @@ -665,30 +624,31 @@ bool cmIfCommand::IsTrue(const std::vector &args, if (argP1 != newArgs.end() && *arg == "NOT") { def = cmIfCommand::GetVariableOrNumber((argP1)->c_str(), makefile); - if(!cmSystemTools::IsOff(def)) - { - *arg = "0"; - } - else - { - *arg = "1"; - } - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + HandlePredicate(cmSystemTools::IsOff(def), + reducible, arg, newArgs, argP1, argP2); } ++arg; } } while (reducible); + return true; + } - // now loop through the arguments and see if we can reduce any of them - // we do this multiple times. Once for each level of precedence + //========================================================================= + // level 4 handles AND OR + bool HandleLevel4(std::list &newArgs, + cmMakefile *makefile, + std::string &) + { + int reducible; + const char *def; + const char *def2; do { reducible = 0; std::list::iterator arg = newArgs.begin(); + std::list::iterator argP1; + std::list::iterator argP2; while (arg != newArgs.end()) { argP1 = arg; @@ -698,19 +658,9 @@ bool cmIfCommand::IsTrue(const std::vector &args, { def = cmIfCommand::GetVariableOrNumber(arg->c_str(), makefile); def2 = cmIfCommand::GetVariableOrNumber((argP2)->c_str(), makefile); - if(cmSystemTools::IsOff(def) || cmSystemTools::IsOff(def2)) - { - *arg = "0"; - } - else - { - *arg = "1"; - } - newArgs.erase(argP2); - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + HandleBinaryOp( + !(cmSystemTools::IsOff(def) || cmSystemTools::IsOff(def2)), + reducible, arg, newArgs, argP1, argP2); } if (argP1 != newArgs.end() && *(argP1) == "OR" && @@ -718,31 +668,83 @@ bool cmIfCommand::IsTrue(const std::vector &args, { def = cmIfCommand::GetVariableOrNumber(arg->c_str(), makefile); def2 = cmIfCommand::GetVariableOrNumber((argP2)->c_str(), makefile); - if(cmSystemTools::IsOff(def) && cmSystemTools::IsOff(def2)) - { - *arg = "0"; - } - else - { - *arg = "1"; - } - newArgs.erase(argP2); - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; + HandleBinaryOp( + !(cmSystemTools::IsOff(def) && cmSystemTools::IsOff(def2)), + reducible, arg, newArgs, argP1, argP2); } - ++arg; } } while (reducible); + return true; + } +} + + +//========================================================================= +// order of operations, +// 1. ( ) -- parenthetical groups +// 2. IS_DIRECTORY EXISTS COMMAND DEFINED etc predicates +// 3. MATCHES LESS GREATER EQUAL STRLESS STRGREATER STREQUAL etc binary ops +// 4. NOT +// 5. AND OR +// +// There is an issue on whether the arguments should be values of references, +// for example IF (FOO AND BAR) should that compare the strings FOO and BAR +// or should it really do IF (${FOO} AND ${BAR}) Currently IS_DIRECTORY +// EXISTS COMMAND and DEFINED all take values. EQUAL, LESS and GREATER can +// take numeric values or variable names. STRLESS and STRGREATER take +// variable names but if the variable name is not found it will use the name +// directly. AND OR take variables or the values 0 or 1. + + +bool cmIfCommand::IsTrue(const std::vector &args, + std::string &errorString, cmMakefile *makefile) +{ + const char *def; + errorString = ""; + + // handle empty invocation + if (args.size() < 1) + { + return false; + } + + // store the reduced args in this vector + std::list newArgs; + + // copy to the list structure + for(unsigned int i = 0; i < args.size(); ++i) + { + newArgs.push_back(args[i]); + } + + // now loop through the arguments and see if we can reduce any of them + // we do this multiple times. Once for each level of precedence + if (!HandleLevel0(newArgs, makefile, errorString)) // parens + { + return false; + } + if (!HandleLevel1(newArgs, makefile, errorString)) //predicates + { + return false; + } + if (!HandleLevel2(newArgs, makefile, errorString)) // binary ops + { + return false; + } + if (!HandleLevel3(newArgs, makefile, errorString)) // NOT + { + return false; + } + if (!HandleLevel4(newArgs, makefile, errorString)) // AND OR + { + return false; + } // now at the end there should only be one argument left if (newArgs.size() == 1) { - delete [] *errorString; - *errorString = 0; if (*newArgs.begin() == "0") { return false; @@ -757,10 +759,16 @@ bool cmIfCommand::IsTrue(const std::vector &args, return false; } } - + else + { + errorString = "Unknown arguments specified"; + return false; + } + return true; } +//========================================================================= const char* cmIfCommand::GetVariableOrString(const char* str, const cmMakefile* mf) { @@ -772,6 +780,7 @@ const char* cmIfCommand::GetVariableOrString(const char* str, return def; } +//========================================================================= const char* cmIfCommand::GetVariableOrNumber(const char* str, const cmMakefile* mf) { diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 28bc36b90..f8e574c30 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmIfCommand.h,v $ Language: C++ - Date: $Date: 2008-09-12 14:56:21 $ - Version: $Revision: 1.46.2.3 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.46.2.5 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -29,21 +29,19 @@ class cmIfFunctionBlocker : public cmFunctionBlocker { public: cmIfFunctionBlocker() { - this->HasRun = false; this->ScopeDepth = 0; this->Executing = false;} + this->HasRun = false; this->ScopeDepth = 0; } virtual ~cmIfFunctionBlocker() {} virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); - virtual void ScopeEnded(cmMakefile &mf); std::vector Args; std::vector Functions; bool IsBlocking; bool HasRun; unsigned int ScopeDepth; - bool Executing; }; /** \class cmIfCommand @@ -191,7 +189,7 @@ public: // arguments were valid, and if so, was the response true. If there is // an error, the errorString will be set. static bool IsTrue(const std::vector &args, - char** errorString, cmMakefile *mf); + std::string &errorString, cmMakefile *mf); // Get a definition from the makefile. If it doesn't exist, // return the original string. diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 3e7b24395..a51fb43af 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmIncludeCommand.cxx,v $ Language: C++ - Date: $Date: 2008-03-08 14:27:44 $ - Version: $Revision: 1.21 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.21.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -28,6 +28,7 @@ bool cmIncludeCommand return false; } bool optional = false; + bool noPolicyScope = false; std::string fname = args[0]; std::string resultVarName; @@ -60,6 +61,10 @@ bool cmIncludeCommand return false; } } + else if(args[i] == "NO_POLICY_SCOPE") + { + noPolicyScope = true; + } else if(i > 1) // compat.: in previous cmake versions the second // parameter was ignore if it wasn't "OPTIONAL" { @@ -84,7 +89,8 @@ bool cmIncludeCommand std::string fullFilePath; bool readit = this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(), - fname.c_str(), &fullFilePath ); + fname.c_str(), &fullFilePath, + noPolicyScope); // add the location of the included file if a result variable was given if (resultVarName.size()) diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h index 06b67b754..696eb0e42 100644 --- a/Source/cmIncludeCommand.h +++ b/Source/cmIncludeCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmIncludeCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.17 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.17.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -69,8 +69,8 @@ public: virtual const char* GetFullDocumentation() { return - " include(file1 [OPTIONAL] [RESULT_VARIABLE ])\n" - " include(module [OPTIONAL] [RESULT_VARIABLE ])\n" + " include( [OPTIONAL] [RESULT_VARIABLE ]\n" + " [NO_POLICY_SCOPE])\n" "Reads CMake listfile code from the given file. Commands in the file " "are processed immediately as if they were written in place of the " "include command. If OPTIONAL is present, then no error " @@ -78,7 +78,11 @@ public: "the variable will be set to the full filename which " "has been included or NOTFOUND if it failed.\n" "If a module is specified instead of a file, the file with name " - ".cmake is searched in the CMAKE_MODULE_PATH."; + ".cmake is searched in the CMAKE_MODULE_PATH." + "\n" + "See the cmake_policy() command documentation for discussion of the " + "NO_POLICY_SCOPE option." + ; } cmTypeMacro(cmIncludeCommand, cmCommand); diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index 3d98d84fb..46880c067 100644 --- a/Source/cmIncludeExternalMSProjectCommand.h +++ b/Source/cmIncludeExternalMSProjectCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmIncludeExternalMSProjectCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.8 $ + Date: $Date: 2008-12-02 12:07:37 $ + Version: $Revision: 1.8.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -66,7 +66,10 @@ public: " include_external_msproject(projectname location\n" " dep1 dep2 ...)\n" "Includes an external Microsoft project in the generated workspace " - "file. Currently does nothing on UNIX."; + "file. Currently does nothing on UNIX. This will create a " + "target named INCLUDE_EXTERNAL_MSPROJECT_[projectname]. This can " + "be used in the add_dependencies command to make things depend " + "on the external project."; } cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand); diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 1de7f849e..0f84ff1a2 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmInstallCommand.cxx,v $ Language: C++ - Date: $Date: 2008-07-13 21:55:23 $ - Version: $Revision: 1.45.2.3 $ + Date: $Date: 2008-10-24 15:18:48 $ + Version: $Revision: 1.45.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -607,8 +607,6 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) break; } -// if(target.GetProperty("ASSOCIATED_FILES"); - // These well-known sets of files are installed *automatically* for FRAMEWORK // SHARED library targets on the Mac as part of installing the FRAMEWORK. // For other target types or on other platforms, they are not installed @@ -708,7 +706,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) installsRuntime = installsRuntime || runtimeGenerator != 0; installsFramework = installsFramework || frameworkGenerator != 0; installsBundle = installsBundle || bundleGenerator != 0; - installsPrivateHeader = installsPrivateHeader || privateHeaderGenerator != 0; + installsPrivateHeader = installsPrivateHeader + || privateHeaderGenerator != 0; installsPublicHeader = installsPublicHeader || publicHeaderGenerator != 0; installsResource = installsResource || resourceGenerator; @@ -733,46 +732,48 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) } } - // Tell the global generator about any installation component names specified + // Tell the global generator about any installation component names + // specified if (installsArchive) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddInstallComponent(archiveArgs.GetComponent().c_str()); + this->Makefile->GetLocalGenerator()-> + GetGlobalGenerator() + ->AddInstallComponent(archiveArgs.GetComponent().c_str()); } if (installsLibrary) { this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddInstallComponent(libraryArgs.GetComponent().c_str()); + ->AddInstallComponent(libraryArgs.GetComponent().c_str()); } if (installsRuntime) { this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddInstallComponent(runtimeArgs.GetComponent().c_str()); + ->AddInstallComponent(runtimeArgs.GetComponent().c_str()); } if (installsFramework) { this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddInstallComponent(frameworkArgs.GetComponent().c_str()); + ->AddInstallComponent(frameworkArgs.GetComponent().c_str()); } if (installsBundle) { this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddInstallComponent(bundleArgs.GetComponent().c_str()); + ->AddInstallComponent(bundleArgs.GetComponent().c_str()); } if (installsPrivateHeader) { this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddInstallComponent(privateHeaderArgs.GetComponent().c_str()); + ->AddInstallComponent(privateHeaderArgs.GetComponent().c_str()); } if (installsPublicHeader) { this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddInstallComponent(publicHeaderArgs.GetComponent().c_str()); + ->AddInstallComponent(publicHeaderArgs.GetComponent().c_str()); } if (installsResource) { this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddInstallComponent(resourceArgs.GetComponent().c_str()); + ->AddInstallComponent(resourceArgs.GetComponent().c_str()); } return true; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 8b1e8e7c1..a23db286b 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmInstallExportGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-01-28 13:38:35 $ - Version: $Revision: 1.8 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.8.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -203,6 +203,30 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, Indent const& indent) { + // Remove old per-configuration export files if the main changes. + std::string installedDir = "$ENV{DESTDIR}"; + installedDir += this->GetInstallDestination(); + installedDir += "/"; + std::string installedFile = installedDir; + installedFile += this->FileName; + os << indent << "IF(EXISTS \"" << installedFile << "\")\n"; + Indent indentN = indent.Next(); + Indent indentNN = indentN.Next(); + Indent indentNNN = indentNN.Next(); + os << indentN << "FILE(DIFFERENT EXPORT_FILE_CHANGED FILES\n" + << indentN << " \"" << installedFile << "\"\n" + << indentN << " \"" << this->MainImportFile << "\")\n"; + os << indentN << "IF(EXPORT_FILE_CHANGED)\n"; + os << indentNN << "FILE(GLOB OLD_CONFIG_FILES \"" << installedDir + << this->EFGen->GetConfigImportFileGlob() << "\")\n"; + os << indentNN << "IF(OLD_CONFIG_FILES)\n"; + os << indentNNN << "MESSAGE(STATUS \"Old export file \\\"" << installedFile + << "\\\" will be replaced. Removing files [${OLD_CONFIG_FILES}].\")\n"; + os << indentNNN << "FILE(REMOVE ${OLD_CONFIG_FILES})\n"; + os << indentNN << "ENDIF(OLD_CONFIG_FILES)\n"; + os << indentN << "ENDIF(EXPORT_FILE_CHANGED)\n"; + os << indent << "ENDIF()\n"; + // Install the main export file. std::vector files; files.push_back(this->MainImportFile); diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index f97cf4c1d..eb36e78b3 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmInstallExportGenerator.h,v $ Language: C++ - Date: $Date: 2008-01-28 13:38:35 $ - Version: $Revision: 1.5 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.5.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -42,7 +42,6 @@ public: protected: typedef std::vector ExportSet; - typedef cmInstallGeneratorIndent Indent; virtual void GenerateScript(std::ostream& os); virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 9af993e01..2a01e7780 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmInstallFilesCommand.cxx,v $ Language: C++ - Date: $Date: 2008-07-13 21:55:24 $ - Version: $Revision: 1.29.2.1 $ + Date: $Date: 2009-02-04 22:04:49 $ + Version: $Revision: 1.29.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -125,6 +125,10 @@ void cmInstallFilesCommand::CreateInstallGenerator() const // the prefix. We skip the leading slash given by the user. std::string destination = this->Destination.substr(1); cmSystemTools::ConvertToUnixSlashes(destination); + if(destination.empty()) + { + destination = "."; + } // Use a file install generator. const char* no_permissions = ""; diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 53c98cf30..483758208 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmInstallGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-01-28 13:38:35 $ - Version: $Revision: 1.15 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.15.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -189,9 +189,9 @@ std::string cmInstallGenerator::CreateComponentTest(const char* component) { std::string result = "NOT CMAKE_INSTALL_COMPONENT OR " - "\"${CMAKE_INSTALL_COMPONENT}\" MATCHES \"^("; + "\"${CMAKE_INSTALL_COMPONENT}\" STREQUAL \""; result += component; - result += ")$\""; + result += "\""; return result; } diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index 02aedb813..5bfeebe0b 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmInstallProgramsCommand.cxx,v $ Language: C++ - Date: $Date: 2008-07-13 21:55:24 $ - Version: $Revision: 1.22.2.1 $ + Date: $Date: 2009-02-04 22:04:49 $ + Version: $Revision: 1.22.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -86,6 +86,10 @@ void cmInstallProgramsCommand::FinalPass() // the prefix. We skip the leading slash given by the user. std::string destination = this->Destination.substr(1); cmSystemTools::ConvertToUnixSlashes(destination); + if(destination.empty()) + { + destination = "."; + } // Use a file install generator. const char* no_permissions = ""; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 8aa60feb5..21fbb34a7 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmInstallTargetGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-05-29 13:15:30 $ - Version: $Revision: 1.62.2.3 $ + Date: $Date: 2008-12-02 12:07:39 $ + Version: $Revision: 1.62.2.5 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -57,16 +57,8 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os) cmSystemTools::Message(msg.str().c_str(), "Warning"); } - // Track indentation. - Indent indent; - - // Begin this block of installation. - std::string component_test = - this->CreateComponentTest(this->Component.c_str()); - os << indent << "IF(" << component_test << ")\n"; - // Compute the build tree directory from which to copy the target. - std::string fromDir; + std::string& fromDir = this->FromDir; if(this->Target->NeedRelinkBeforeInstall()) { fromDir = this->Target->GetMakefile()->GetStartOutputDirectory(); @@ -79,70 +71,62 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os) fromDir += "/"; } - // Generate a portion of the script for each configuration. + // Perform the main install script generation. + this->cmInstallGenerator::GenerateScript(os); +} + +//---------------------------------------------------------------------------- +void cmInstallTargetGenerator::GenerateScriptConfigs(std::ostream& os, + Indent const& indent) +{ if(this->ConfigurationTypes->empty()) { - this->GenerateScriptForConfig(os, fromDir.c_str(), - this->ConfigurationName, - indent.Next()); + // In a single-configuration generator, only the install rule's + // configuration test is important. If that passes, the target is + // installed regardless of for what configuration it was built. + this->cmInstallGenerator::GenerateScriptConfigs(os, indent); } else { + // In a multi-configuration generator, a separate rule is produced + // in a block for each configuration that is built. However, the + // list of configurations is restricted to those for which this + // install rule applies. for(std::vector::const_iterator i = this->ConfigurationTypes->begin(); i != this->ConfigurationTypes->end(); ++i) { - this->GenerateScriptForConfig(os, fromDir.c_str(), i->c_str(), - indent.Next()); + const char* config = i->c_str(); + if(this->InstallsForConfig(config)) + { + // Generate a per-configuration block. + std::string config_test = this->CreateConfigTest(config); + os << indent << "IF(" << config_test << ")\n"; + this->GenerateScriptForConfig(os, config, indent.Next()); + os << indent << "ENDIF(" << config_test << ")\n"; + } } } +} - // End this block of installation. - os << indent << "ENDIF(" << component_test << ")\n\n"; +//---------------------------------------------------------------------------- +void cmInstallTargetGenerator::GenerateScriptActions(std::ostream& os, + Indent const& indent) +{ + // This is reached for single-configuration generators only. + this->GenerateScriptForConfig(os, this->ConfigurationName, indent); } //---------------------------------------------------------------------------- void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, - const char* fromDir, const char* config, Indent const& indent) { // Compute the per-configuration directory containing the files. - std::string fromDirConfig = fromDir; + std::string fromDirConfig = this->FromDir; this->Target->GetMakefile()->GetLocalGenerator()->GetGlobalGenerator() ->AppendDirectoryForConfig("", config, "/", fromDirConfig); - if(config && *config) - { - // Skip this configuration for config-specific installation that - // does not match it. - if(!this->InstallsForConfig(config)) - { - return; - } - - // Generate a per-configuration block. - std::string config_test = this->CreateConfigTest(config); - os << indent << "IF(" << config_test << ")\n"; - this->GenerateScriptForConfigDir(os, fromDirConfig.c_str(), config, - indent.Next()); - os << indent << "ENDIF(" << config_test << ")\n"; - } - else - { - this->GenerateScriptForConfigDir(os, fromDirConfig.c_str(), config, - indent); - } -} - -//---------------------------------------------------------------------------- -void -cmInstallTargetGenerator -::GenerateScriptForConfigDir(std::ostream& os, - const char* fromDirConfig, - const char* config, - Indent const& indent) -{ // Compute the full path to the main installed file for this target. NameType nameType = this->ImportLibrary? NameImplib : NameNormal; std::string toInstallPath = this->GetInstallDestination(); @@ -505,10 +489,17 @@ cmInstallTargetGenerator for(std::set::const_iterator j = sharedLibs.begin(); j != sharedLibs.end(); ++j) { + cmTarget* tgt = *j; + + // The install_name of an imported target does not change. + if(tgt->IsImported()) + { + continue; + } + // If the build tree and install tree use different path // components of the install_name field then we need to create a // mapping to be applied after installation. - cmTarget* tgt = *j; std::string for_build = tgt->GetInstallNameDirForBuildTree(config); std::string for_install = tgt->GetInstallNameDirForInstallTree(config); if(for_build != for_install) diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 1530346f5..9cee1a9a0 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmInstallTargetGenerator.h,v $ Language: C++ - Date: $Date: 2008-07-13 21:55:24 $ - Version: $Revision: 1.24.2.2 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.24.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -64,16 +64,12 @@ public: bool IsImportLibrary() const { return this->ImportLibrary; } protected: - typedef cmInstallGeneratorIndent Indent; virtual void GenerateScript(std::ostream& os); + virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); + virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); void GenerateScriptForConfig(std::ostream& os, - const char* fromDir, const char* config, Indent const& indent); - void GenerateScriptForConfigDir(std::ostream& os, - const char* fromDirConfig, - const char* config, - Indent const& indent); void AddInstallNamePatchRule(std::ostream& os, Indent const& indent, const char* config, const std::string& toDestDirPath); @@ -96,6 +92,7 @@ protected: std::string FilePermissions; bool Optional; NamelinkModeType NamelinkMode; + std::string FromDir; }; #endif diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index d95882b00..bab6677db 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLinkDirectoriesCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.13 $ + Date: $Date: 2009-02-04 22:04:49 $ + Version: $Revision: 1.13.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -66,7 +66,12 @@ public: return " link_directories(directory1 directory2 ...)\n" "Specify the paths in which the linker should search for libraries. " - "The command will apply only to targets created after it is called."; + "The command will apply only to targets created after it is called. " + "For historical reasons, relative paths given to this command are " + "passed to the linker unchanged " + "(unlike many CMake commands which interpret them relative to the " + "current source directory)." + ; } cmTypeMacro(cmLinkDirectoriesCommand, cmCommand); diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 675dfd65b..2d155421a 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmListFileCache.cxx,v $ Language: C++ - Date: $Date: 2008-05-01 16:35:39 $ - Version: $Revision: 1.41.2.3 $ + Date: $Date: 2008-10-24 15:18:48 $ + Version: $Revision: 1.41.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -242,11 +242,26 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer, // Arguments. unsigned long lastLine = cmListFileLexer_GetCurrentLine(lexer); + unsigned long parenDepth = 0; while((token = cmListFileLexer_Scan(lexer))) { - if(token->type == cmListFileLexer_Token_ParenRight) + if(token->type == cmListFileLexer_Token_ParenLeft) { - return true; + parenDepth++; + cmListFileArgument a("(", + false, filename, token->line); + function.Arguments.push_back(a); + } + else if(token->type == cmListFileLexer_Token_ParenRight) + { + if (parenDepth == 0) + { + return true; + } + parenDepth--; + cmListFileArgument a(")", + false, filename, token->line); + function.Arguments.push_back(a); } else if(token->type == cmListFileLexer_Token_Identifier || token->type == cmListFileLexer_Token_ArgumentUnquoted) diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 0472eb081..014d0101c 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmListFileCache.h,v $ Language: C++ - Date: $Date: 2008-03-13 17:48:57 $ - Version: $Revision: 1.21 $ + Date: $Date: 2008-10-24 15:18:48 $ + Version: $Revision: 1.21.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -55,6 +55,7 @@ struct cmListFileContext std::string Name; std::string FilePath; long Line; + cmListFileContext(): Name(), FilePath(), Line(0) {} }; std::ostream& operator<<(std::ostream&, cmListFileContext const&); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2d4dd3952..cbddd006d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLocalGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.269.2.7 $ + Date: $Date: 2009-02-04 22:04:49 $ + Version: $Revision: 1.269.2.10 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -136,6 +136,7 @@ void cmLocalGenerator::Configure() this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } } + this->ObjectMaxPathViolations.clear(); } this->Configured = true; @@ -645,10 +646,10 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) !sf->GetPropertyAsBool("HEADER_FILE_ONLY") && !sf->GetPropertyAsBool("EXTERNAL_OBJECT")) { - std::string::size_type dir_len = 0; - dir_len += strlen(this->Makefile->GetCurrentOutputDirectory()); - dir_len += 1; - std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_len); + std::string dir_max; + dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max); if(!obj.empty()) { std::string ofname = this->Makefile->GetCurrentOutputDirectory(); @@ -1074,22 +1075,54 @@ cmLocalGenerator::ExpandRuleVariables(std::string& s, s = expandedInput; } - -std::string -cmLocalGenerator::ConvertToOutputForExisting(const char* p) +//---------------------------------------------------------------------------- +std::string +cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote, + std::string const& result) { - std::string ret = p; - if(this->WindowsShell && ret.find(' ') != ret.npos - && cmSystemTools::FileExists(p)) + // If this is a windows shell, the result has a space, and the path + // already exists, we can use a short-path to reference it without a + // space. + if(this->WindowsShell && result.find(' ') != result.npos && + cmSystemTools::FileExists(remote)) { - if(cmSystemTools::GetShortPath(p, ret)) + std::string tmp; + if(cmSystemTools::GetShortPath(remote, tmp)) { - return this->Convert(ret.c_str(), NONE, SHELL, true); + return this->Convert(tmp.c_str(), NONE, SHELL, true); } } - return this->Convert(p, START_OUTPUT, SHELL, true); + + // Otherwise, leave it unchanged. + return result; } +//---------------------------------------------------------------------------- +std::string +cmLocalGenerator::ConvertToOutputForExisting(const char* remote, + RelativeRoot local) +{ + // Perform standard conversion. + std::string result = this->Convert(remote, local, SHELL, true); + + // Consider short-path. + return this->ConvertToOutputForExistingCommon(remote, result); +} + +//---------------------------------------------------------------------------- +std::string +cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote, + const char* local) +{ + // Perform standard conversion. + std::string result = this->Convert(remote, local, SHELL, true); + + // Consider short-path. + const char* remotePath = this->GetRelativeRootPath(remote); + return this->ConvertToOutputForExistingCommon(remotePath, result); +} + +//---------------------------------------------------------------------------- const char* cmLocalGenerator::GetIncludeFlags(const char* lang) { if(!lang) @@ -1155,9 +1188,11 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang) frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir.c_str()); if(emitted.insert(frameworkDir).second) { - includeFlags - << "-F" - << this->ConvertToOutputForExisting(frameworkDir.c_str()) << " "; + includeFlags + << "-F" << this->Convert(frameworkDir.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL, true) + << " "; } continue; } @@ -1983,7 +2018,21 @@ cmLocalGenerator::ConvertToOptionallyRelativeOutputPath(const char* remote) } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::Convert(const char* source, +const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot) +{ + switch (relroot) + { + case HOME: return this->Makefile->GetHomeDirectory(); + case START: return this->Makefile->GetStartDirectory(); + case HOME_OUTPUT: return this->Makefile->GetHomeOutputDirectory(); + case START_OUTPUT: return this->Makefile->GetStartOutputDirectory(); + default: break; + } + return 0; +} + +//---------------------------------------------------------------------------- +std::string cmLocalGenerator::Convert(const char* source, RelativeRoot relative, OutputFormat output, bool optional) @@ -2031,7 +2080,15 @@ std::string cmLocalGenerator::Convert(const char* source, break; } } - // Now convert it to an output path. + return this->ConvertToOutputFormat(result.c_str(), output); +} + +//---------------------------------------------------------------------------- +std::string cmLocalGenerator::ConvertToOutputFormat(const char* source, + OutputFormat output) +{ + std::string result = source; + // Convert it to an output path. if (output == MAKEFILE) { result = cmSystemTools::ConvertToOutputPath(result.c_str()); @@ -2063,6 +2120,40 @@ std::string cmLocalGenerator::Convert(const char* source, return result; } +//---------------------------------------------------------------------------- +std::string cmLocalGenerator::Convert(RelativeRoot remote, + const char* local, + OutputFormat output, + bool optional) +{ + const char* remotePath = this->GetRelativeRootPath(remote); + if(local && (!optional || this->UseRelativePaths)) + { + std::vector components; + std::string result; + switch(remote) + { + case HOME: + case HOME_OUTPUT: + case START: + case START_OUTPUT: + cmSystemTools::SplitPath(local, components); + result = this->ConvertToRelativePath(components, remotePath); + break; + case FULL: + result = remotePath; + break; + case NONE: + break; + } + return this->ConvertToOutputFormat(result.c_str(), output); + } + else + { + return this->ConvertToOutputFormat(remotePath, output); + } +} + //---------------------------------------------------------------------------- std::string cmLocalGenerator::FindRelativePathTopSource() { @@ -2269,6 +2360,10 @@ cmLocalGenerator // We also skip over the leading slash given by the user. std::string destination = l->second.GetInstallPath().substr(1); cmSystemTools::ConvertToUnixSlashes(destination); + if(destination.empty()) + { + destination = "."; + } // Generate the proper install generator for this target type. switch(l->second.GetType()) @@ -2385,7 +2480,7 @@ bool cmLocalGeneratorCheckObjectName(std::string& objName, std::string& cmLocalGenerator ::CreateSafeUniqueObjectFileName(const char* sin, - std::string::size_type dir_len) + std::string const& dir_max) { // Look for an existing mapped name for this object file. std::map::iterator it = @@ -2446,9 +2541,28 @@ cmLocalGenerator } #if defined(CM_LG_ENCODE_OBJECT_NAMES) - cmLocalGeneratorCheckObjectName(ssin, dir_len, this->ObjectPathMax); + if(!cmLocalGeneratorCheckObjectName(ssin, dir_max.size(), + this->ObjectPathMax)) + { + // Warn if this is the first time the path has been seen. + if(this->ObjectMaxPathViolations.insert(dir_max).second) + { + cmOStringStream m; + m << "The object file directory\n" + << " " << dir_max << "\n" + << "has " << dir_max.size() << " characters. " + << "The maximum full path to an object file is " + << this->ObjectPathMax << " characters " + << "(see CMAKE_OBJECT_PATH_MAX). " + << "Object file\n" + << " " << ssin << "\n" + << "cannot be safely placed under this directory. " + << "The build may not work correctly."; + this->Makefile->IssueMessage(cmake::WARNING, m.str()); + } + } #else - (void)dir_len; + (void)dir_max; #endif // Insert the newly mapped object file name. @@ -2464,7 +2578,7 @@ cmLocalGenerator std::string cmLocalGenerator ::GetObjectFileNameWithoutTarget(const cmSourceFile& source, - std::string::size_type dir_len, + std::string const& dir_max, bool* hasSourceExtension) { // Construct the object file name using the full path to the source @@ -2552,7 +2666,7 @@ cmLocalGenerator } // Convert to a safe name. - return this->CreateSafeUniqueObjectFileName(objectName.c_str(), dir_len); + return this->CreateSafeUniqueObjectFileName(objectName.c_str(), dir_max); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index aa2db182e..f43a22203 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLocalGenerator.h,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.103.2.1 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.103.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -108,10 +108,18 @@ public: */ enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; enum OutputFormat { UNCHANGED, MAKEFILE, SHELL }; - std::string Convert(const char* source, - RelativeRoot relative, + std::string ConvertToOutputFormat(const char* source, OutputFormat output); + std::string Convert(const char* remote, RelativeRoot local, OutputFormat output = UNCHANGED, bool optional = false); + std::string Convert(RelativeRoot remote, const char* local, + OutputFormat output = UNCHANGED, + bool optional = false); + + /** + * Get path for the specified relative root. + */ + const char* GetRelativeRootPath(RelativeRoot relroot); /** * Convert the given path to an output path that is optionally @@ -162,7 +170,13 @@ public: std::string GetRealLocation(const char* inName, const char* config); ///! for existing files convert to output path and short path if spaces - std::string ConvertToOutputForExisting(const char* p); + std::string ConvertToOutputForExisting(const char* remote, + RelativeRoot local = START_OUTPUT); + + /** For existing path identified by RelativeRoot convert to output + path and short path if spaces. */ + std::string ConvertToOutputForExisting(RelativeRoot remote, + const char* local = 0); /** Called from command-line hook to clear dependencies. */ virtual void ClearDependencies(cmMakefile* /* mf */, @@ -326,10 +340,10 @@ protected: // Compute object file names. std::string GetObjectFileNameWithoutTarget(const cmSourceFile& source, - std::string::size_type dir_len, + std::string const& dir_max, bool* hasSourceExtension = 0); std::string& CreateSafeUniqueObjectFileName(const char* sin, - std::string::size_type dir_len); + std::string const& dir_max); void ConfigureRelativePaths(); std::string FindRelativePathTopSource(); @@ -356,6 +370,7 @@ protected: std::map LanguageToIncludeFlags; std::map UniqueObjectNamesMap; std::string::size_type ObjectPathMax; + std::set ObjectMaxPathViolations; bool WindowsShell; bool WindowsVSIDE; bool WatcomWMake; @@ -386,6 +401,9 @@ protected: unsigned int BackwardsCompatibility; bool BackwardsCompatibilityFinal; +private: + std::string ConvertToOutputForExistingCommon(const char* remote, + std::string const& result); }; #endif diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index bbf8e9236..9a283e1f7 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLocalUnixMakefileGenerator3.cxx,v $ Language: C++ - Date: $Date: 2008-05-15 19:39:55 $ - Version: $Revision: 1.240.2.6 $ + Date: $Date: 2009-01-13 18:03:52 $ + Version: $Revision: 1.240.2.8 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -358,10 +358,10 @@ cmLocalUnixMakefileGenerator3 commands.push_back( this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName.c_str()) ); - this->CreateCDCommand(commands, - this->Makefile->GetHomeOutputDirectory(), - this->Makefile->GetStartOutputDirectory()); } + this->CreateCDCommand(commands, + this->Makefile->GetHomeOutputDirectory(), + cmLocalGenerator::START_OUTPUT); // Write the rule to the makefile. std::vector no_depends; @@ -404,7 +404,7 @@ void cmLocalUnixMakefileGenerator3 (makefile2.c_str(),localName.c_str())); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), - this->Makefile->GetStartOutputDirectory()); + cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "Convenience name for target.", localName.c_str(), depends, commands, true); @@ -432,7 +432,7 @@ void cmLocalUnixMakefileGenerator3 (makefileName.c_str(), makeTargetName.c_str())); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), - this->Makefile->GetStartOutputDirectory()); + cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "fast build rule for target.", localName.c_str(), depends, commands, true); @@ -450,7 +450,7 @@ void cmLocalUnixMakefileGenerator3 (makefile2.c_str(), makeTargetName.c_str())); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), - this->Makefile->GetStartOutputDirectory()); + cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "Manual pre-install relink rule for target.", localName.c_str(), depends, commands, true); @@ -697,13 +697,13 @@ cmLocalUnixMakefileGenerator3 << " -E remove -f\n" << "\n"; - if(this->Makefile->GetDefinition("CMAKE_EDIT_COMMAND")) + if(const char* edit_cmd = + this->Makefile->GetDefinition("CMAKE_EDIT_COMMAND")) { makefileStream << "# The program to use to edit the cache.\n" << "CMAKE_EDIT_COMMAND = " - << (this->ConvertToOutputForExisting( - this->Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))) << "\n" + << this->Convert(edit_cmd,FULL,SHELL) << "\n" << "\n"; } @@ -835,7 +835,7 @@ void cmLocalUnixMakefileGenerator3 { this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), - this->Makefile->GetStartOutputDirectory()); + cmLocalGenerator::START_OUTPUT); } this->WriteMakeRule(makefileStream, "Special rule to run CMake to check the build system " @@ -953,12 +953,13 @@ cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3 ::AppendCustomCommands(std::vector& commands, - const std::vector& ccs) + const std::vector& ccs, + cmLocalGenerator::RelativeRoot relative) { for(std::vector::const_iterator i = ccs.begin(); i != ccs.end(); ++i) { - this->AppendCustomCommand(commands, *i, true); + this->AppendCustomCommand(commands, *i, true, relative); } } @@ -966,7 +967,8 @@ cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3 ::AppendCustomCommand(std::vector& commands, - const cmCustomCommand& cc, bool echo_comment) + const cmCustomCommand& cc, bool echo_comment, + cmLocalGenerator::RelativeRoot relative) { // Optionally create a command to display the custom command's // comment text. This is used for pre-build, pre-link, and @@ -1072,8 +1074,7 @@ cmLocalUnixMakefileGenerator3 } // Setup the proper working directory for the commands. - this->CreateCDCommand(commands1, dir, - this->Makefile->GetHomeOutputDirectory()); + this->CreateCDCommand(commands1, dir, relative); // push back the custom commands commands.insert(commands.end(), commands1.begin(), commands1.end()); @@ -1610,9 +1611,11 @@ void cmLocalUnixMakefileGenerator3 this->AppendCustomDepends(depends, glIt->second.GetPostBuildCommands()); this->AppendCustomCommands(commands, - glIt->second.GetPreBuildCommands()); + glIt->second.GetPreBuildCommands(), + cmLocalGenerator::START_OUTPUT); this->AppendCustomCommands(commands, - glIt->second.GetPostBuildCommands()); + glIt->second.GetPostBuildCommands(), + cmLocalGenerator::START_OUTPUT); std::string targetName = glIt->second.GetName(); this->WriteMakeRule(ruleFileStream, targetString.c_str(), targetName.c_str(), depends, commands, true); @@ -1674,7 +1677,7 @@ void cmLocalUnixMakefileGenerator3 recursiveTarget.c_str())); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), - this->Makefile->GetStartOutputDirectory()); + cmLocalGenerator::START_OUTPUT); { cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 @@ -1696,7 +1699,7 @@ void cmLocalUnixMakefileGenerator3 recursiveTarget.c_str())); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), - this->Makefile->GetStartOutputDirectory()); + cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "The main clean target", "clean", depends, commands, true); commands.clear(); @@ -1726,7 +1729,7 @@ void cmLocalUnixMakefileGenerator3 (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget.c_str())); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), - this->Makefile->GetStartOutputDirectory()); + cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.", "preinstall", depends, commands, true); depends.clear(); @@ -1747,7 +1750,7 @@ void cmLocalUnixMakefileGenerator3 commands.push_back(runRule); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), - this->Makefile->GetStartOutputDirectory()); + cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "clear depends", "depend", depends, commands, true); @@ -1925,12 +1928,12 @@ cmLocalUnixMakefileGenerator3 obj += "/"; // Get the object file name without the target directory. - std::string::size_type dir_len = 0; - dir_len += strlen(this->Makefile->GetCurrentOutputDirectory()); - dir_len += 1; - dir_len += obj.size(); + std::string dir_max; + dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + dir_max += obj; std::string objectName = - this->GetObjectFileNameWithoutTarget(source, dir_len, + this->GetObjectFileNameWithoutTarget(source, dir_max, hasSourceExtension); if(nameWithoutTargetDir) { @@ -2126,8 +2129,10 @@ cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt, //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3 ::CreateCDCommand(std::vector& commands, const char *tgtDir, - const char *retDir) + cmLocalGenerator::RelativeRoot relRetDir) { + const char* retDir = this->GetRelativeRootPath(relRetDir); + // do we need to cd? if (!strcmp(tgtDir,retDir)) { @@ -2140,18 +2145,12 @@ void cmLocalUnixMakefileGenerator3 // back because the shell keeps the working directory between // commands. std::string cmd = "cd "; - cmd += this->ConvertToOutputForExisting(tgtDir); + cmd += this->ConvertToOutputForExisting(tgtDir, relRetDir); commands.insert(commands.begin(),cmd); - - // Change back to the starting directory. Any trailing slash must be - // removed to avoid problems with Borland Make. - std::string back = retDir; - if(back.size() && back[back.size()-1] == '/') - { - back = back.substr(0, back.size()-1); - } + + // Change back to the starting directory. cmd = "cd "; - cmd += this->ConvertToOutputForExisting(back.c_str()); + cmd += this->ConvertToOutputForExisting(relRetDir, tgtDir); commands.push_back(cmd); } else @@ -2163,7 +2162,7 @@ void cmLocalUnixMakefileGenerator3 for (; i != commands.end(); ++i) { std::string cmd = "cd "; - cmd += this->ConvertToOutputForExisting(tgtDir); + cmd += this->ConvertToOutputForExisting(tgtDir, relRetDir); cmd += " && "; cmd += *i; *i = cmd; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index ec619929d..bc328b1dc 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLocalUnixMakefileGenerator3.h,v $ Language: C++ - Date: $Date: 2008-01-13 21:36:20 $ - Version: $Revision: 1.82 $ + Date: $Date: 2008-10-24 15:18:52 $ + Version: $Revision: 1.82.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -193,11 +193,15 @@ public: void AppendEcho(std::vector& commands, const char* text, EchoColor color = EchoNormal); + /** Get whether the makefile is to have color. */ + bool GetColorMakefile() const { return this->ColorMakefile; } + virtual std::string GetTargetDirectory(cmTarget const& target) const; // create a command that cds to the start dir then runs the commands void CreateCDCommand(std::vector& commands, - const char *targetDir, const char *returnDir); + const char *targetDir, + cmLocalGenerator::RelativeRoot returnDir); static std::string ConvertToQuotedOutputPath(const char* p); @@ -321,10 +325,14 @@ protected: void AppendCustomDepend(std::vector& depends, const cmCustomCommand& cc); void AppendCustomCommands(std::vector& commands, - const std::vector& ccs); + const std::vector& ccs, + cmLocalGenerator::RelativeRoot relative = + cmLocalGenerator::HOME_OUTPUT); void AppendCustomCommand(std::vector& commands, const cmCustomCommand& cc, - bool echo_comment=false); + bool echo_comment=false, + cmLocalGenerator::RelativeRoot relative = + cmLocalGenerator::HOME_OUTPUT); void AppendCleanCommand(std::vector& commands, const std::vector& files, cmTarget& target, const char* filename =0); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 4c4b1b2ad..135e86ded 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLocalVisualStudio6Generator.cxx,v $ Language: C++ - Date: $Date: 2008-09-12 14:56:21 $ - Version: $Revision: 1.141.2.3 $ + Date: $Date: 2009-01-13 18:03:53 $ + Version: $Revision: 1.141.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -63,7 +63,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() // Setup /I and /LIBPATH options for the resulting DSP file. VS 6 // truncates long include paths so make it as short as possible if - // the length threatents this problem. + // the length threatens this problem. unsigned int maxIncludeLength = 3000; bool useShortPath = false; for(int j=0; j < 2; ++j) @@ -167,17 +167,23 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() } } +// Utility function to make a valid VS6 *.dsp filename out +// of a CMake target name: +// +extern std::string GetVS6TargetName(const std::string& targetName); + void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, cmTarget &target) { // add to the list of projects - std::string pname = lname; + std::string pname = GetVS6TargetName(lname); + this->CreatedProjectNames.push_back(pname); // create the dsp.cmake file std::string fname; fname = this->Makefile->GetStartOutputDirectory(); fname += "/"; - fname += lname; + fname += pname; fname += ".dsp"; // save the name of the real dsp file std::string realDSP = fname; @@ -188,7 +194,7 @@ void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, cmSystemTools::Error("Error Writing ", fname.c_str()); cmSystemTools::ReportLastSystemError(""); } - this->WriteDSPFile(fout,lname,target); + this->WriteDSPFile(fout,pname.c_str(),target); fout.close(); // if the dsp file has changed, then write it. cmSystemTools::CopyFileIfDifferent(fname.c_str(), realDSP.c_str()); @@ -197,7 +203,7 @@ void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) { - std::string dspname = tgt.GetName(); + std::string dspname = GetVS6TargetName(tgt.GetName()); dspname += ".dsp.cmake"; const char* dsprule = this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"); @@ -287,10 +293,6 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, } } - // trace the visual studio dependencies - std::string name = libName; - name += ".dsp.cmake"; - // We may be modifying the source groups temporarily, so make a copy. std::vector sourceGroups = this->Makefile->GetSourceGroups(); @@ -370,27 +372,27 @@ void cmLocalVisualStudio6Generator this->WriteDSPBeginGroup(fout, name.c_str(), ""); } - // Compute the maximum length of a configuration name. - std::string::size_type config_len_max = 0; + // Compute the maximum length configuration name. + std::string config_max; for(std::vector::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { // Strip the subdirectory name out of the configuration name. std::string config = this->GetConfigName(*i); - if(config.size() > config_len_max) + if(config.size() > config_max.size()) { - config_len_max = config.size(); + config_max = config; } } - // Compute the maximum length of the full path to the intermediate + // Compute the maximum length full path to the intermediate // files directory for any configuration. This is used to construct // object file names that do not produce paths that are too long. - std::string::size_type dir_len = 0; - dir_len += strlen(this->Makefile->GetCurrentOutputDirectory()); - dir_len += 1; - dir_len += config_len_max; - dir_len += 1; + std::string dir_max; + dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + dir_max += config_max; + dir_max += "/"; // Loop through each source in the source group. for(std::vector::const_iterator sf = @@ -406,7 +408,7 @@ void cmLocalVisualStudio6Generator { objectNameDir = cmSystemTools::GetFilenamePath( - this->GetObjectFileNameWithoutTarget(*(*sf), dir_len)); + this->GetObjectFileNameWithoutTarget(*(*sf), dir_max)); } // Add per-source file flags. @@ -462,7 +464,8 @@ void cmLocalVisualStudio6Generator { cmSystemTools::ExpandListArgument(dependsValue, depends); } - if (source != libName || target.GetType() == cmTarget::UTILITY || + if (GetVS6TargetName(source) != libName || + target.GetType() == cmTarget::UTILITY || target.GetType() == cmTarget::GLOBAL_TARGET) { fout << "# Begin Source File\n\n"; @@ -758,11 +761,13 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, // reset this->Configurations this->Configurations.erase(this->Configurations.begin(), this->Configurations.end()); + // now add all the configurations possible + std::string vs6name = GetVS6TargetName(libName); std::string line; while(cmSystemTools::GetLineFromStream(fin, line)) { - cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName); + cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME", vs6name.c_str()); if (reg.find(line)) { this->Configurations.push_back(line.substr(reg.end())); @@ -1055,8 +1060,10 @@ void cmLocalVisualStudio6Generator if ((target.GetType() != cmTarget::SHARED_LIBRARY && target.GetType() != cmTarget::STATIC_LIBRARY && target.GetType() != cmTarget::MODULE_LIBRARY) || - (target.GetType()==cmTarget::SHARED_LIBRARY && libName != j->first) || - (target.GetType()==cmTarget::MODULE_LIBRARY && libName != j->first)) + (target.GetType()==cmTarget::SHARED_LIBRARY + && libName != GetVS6TargetName(j->first)) || + (target.GetType()==cmTarget::MODULE_LIBRARY + && libName != GetVS6TargetName(j->first))) { // Compute the proper name to use to link this library. std::string lib; @@ -1404,12 +1411,15 @@ void cmLocalVisualStudio6Generator targetImplibFlagMinSizeRel.c_str()); cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_RELWITHDEBINFO", targetImplibFlagRelWithDebInfo.c_str()); - cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName); + + std::string vs6name = GetVS6TargetName(libName); + cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME", vs6name.c_str()); + #ifdef CM_USE_OLD_VS6 - // because LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH + // because LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH // are already quoted in the template file, // we need to remove the quotes here, we still need - // to convert to output path for unix to win32 conversion + // to convert to output path for unix to win32 conversion cmSystemTools::ReplaceString (line, "LIBRARY_OUTPUT_PATH", removeQuotes(this->ConvertToOptionallyRelativeOutputPath @@ -1511,32 +1521,49 @@ void cmLocalVisualStudio6Generator } // Add per-target and per-configuration preprocessor definitions. - this->AppendDefines - (flags, this->Makefile->GetProperty("COMPILE_DEFINITIONS"), 0); - this->AppendDefines(flags, target.GetProperty("COMPILE_DEFINITIONS"), 0); - this->AppendDefines - (flagsDebug, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG"), 0); - this->AppendDefines(flagsDebug, - target.GetProperty("COMPILE_DEFINITIONS_DEBUG"), 0); - this->AppendDefines - (flagsRelease, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); - this->AppendDefines(flagsRelease, - target.GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); - this->AppendDefines - (flagsMinSize, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); - this->AppendDefines - (flagsMinSize, - target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); - this->AppendDefines - (flagsDebugRel, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); - this->AppendDefines - (flagsDebugRel, - target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); - + std::string defines = " "; + std::string debugDefines = " "; + std::string releaseDefines = " "; + std::string minsizeDefines = " "; + std::string debugrelDefines = " "; + + this->AppendDefines( + defines, + this->Makefile->GetProperty("COMPILE_DEFINITIONS"), 0); + this->AppendDefines( + debugDefines, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG"),0); + this->AppendDefines( + releaseDefines, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); + this->AppendDefines( + minsizeDefines, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); + this->AppendDefines( + debugrelDefines, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); + + this->AppendDefines( + defines, + target.GetProperty("COMPILE_DEFINITIONS"), 0); + this->AppendDefines( + debugDefines, + target.GetProperty("COMPILE_DEFINITIONS_DEBUG"), 0); + this->AppendDefines( + releaseDefines, + target.GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); + this->AppendDefines( + minsizeDefines, + target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); + this->AppendDefines( + debugrelDefines, + target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); + flags += defines; + flagsDebug += debugDefines; + flagsRelease += releaseDefines; + flagsMinSize += minsizeDefines; + flagsDebugRel += debugrelDefines; + // The template files have CXX FLAGS in them, that need to be replaced. // There are not separate CXX and C template files, so we use the same // variable names. The previous code sets up flags* variables to contain @@ -1550,6 +1577,17 @@ void cmLocalVisualStudio6Generator cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", flagsRelease.c_str()); cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); + + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZE", + minsizeDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG", + debugDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO", + debugrelDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE", + releaseDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS", defines.c_str()); + fout << line.c_str() << std::endl; } } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index c6bddbd17..c2f89df66 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLocalVisualStudio7Generator.cxx,v $ Language: C++ - Date: $Date: 2008-09-12 14:56:21 $ - Version: $Revision: 1.217.2.11 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.217.2.15 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -702,7 +702,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, modDir = "."; } fout << "\t\t\t\tModulePath=\"" - << this->ConvertToXMLOutputPath(modDir.c_str()) << "\\$(ConfigurationName)\"\n"; + << this->ConvertToXMLOutputPath(modDir.c_str()) + << "\\$(ConfigurationName)\"\n"; } targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); fout << "\t\t\t\tAdditionalIncludeDirectories=\""; @@ -1225,7 +1226,7 @@ public: cmTarget& target, cmSourceFile const& sf, std::vector* configs, - std::string::size_type dir_len); + std::string const& dir_max); std::map FileConfigMap; }; @@ -1234,12 +1235,12 @@ cmLocalVisualStudio7GeneratorFCInfo cmTarget& target, cmSourceFile const& sf, std::vector* configs, - std::string::size_type dir_len) + std::string const& dir_max) { std::string objectName; if(lg->NeedObjectName.find(&sf) != lg->NeedObjectName.end()) { - objectName = lg->GetObjectFileNameWithoutTarget(sf, dir_len); + objectName = lg->GetObjectFileNameWithoutTarget(sf, dir_max); } // Compute per-source, per-config information. @@ -1301,11 +1302,10 @@ cmLocalVisualStudio7GeneratorFCInfo needForceLang = true; lang = sourceLang; } - // If lang is set, the compiler will generate code automatically. // If HEADER_FILE_ONLY is set, we must suppress this generation in // the project file fc.ExcludedFromBuild = - (lang && sf.GetPropertyAsBool("HEADER_FILE_ONLY")); + (sf.GetPropertyAsBool("HEADER_FILE_ONLY")); if(fc.ExcludedFromBuild) { needfc = true; @@ -1357,27 +1357,27 @@ void cmLocalVisualStudio7Generator this->WriteVCProjBeginGroup(fout, name.c_str(), ""); } - // Compute the maximum length of a configuration name. - std::string::size_type config_len_max = 0; + // Compute the maximum length configuration name. + std::string config_max; for(std::vector::iterator i = configs->begin(); i != configs->end(); ++i) { - if(i->size() > config_len_max) + if(i->size() > config_max.size()) { - config_len_max = i->size(); + config_max = *i; } } - // Compute the maximum length of the full path to the intermediate + // Compute the maximum length full path to the intermediate // files directory for any configuration. This is used to construct // object file names that do not produce paths that are too long. - std::string::size_type dir_len = 0; - dir_len += strlen(this->Makefile->GetCurrentOutputDirectory()); - dir_len += 1; - dir_len += this->GetTargetDirectory(target).size(); - dir_len += 1; - dir_len += config_len_max; - dir_len += 1; + std::string dir_max; + dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + dir_max += this->GetTargetDirectory(target); + dir_max += "/"; + dir_max += config_max; + dir_max += "/"; // Loop through each source in the source group. std::string objectName; @@ -1385,7 +1385,7 @@ void cmLocalVisualStudio7Generator sourceFiles.begin(); sf != sourceFiles.end(); ++sf) { std::string source = (*sf)->GetFullPath(); - FCInfo fcinfo(this, target, *(*sf), configs, dir_len); + FCInfo fcinfo(this, target, *(*sf), configs, dir_max); if (source != libName || target.GetType() == cmTarget::UTILITY || target.GetType() == cmTarget::GLOBAL_TARGET ) @@ -1831,6 +1831,9 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, { keyword = "Win32Proj"; } + const char* vsProjectname = target.GetProperty("VS_SCC_PROJECTNAME"); + const char* vsLocalpath = target.GetProperty("VS_SCC_LOCALPATH"); + const char* vsProvider = target.GetProperty("VS_SCC_PROVIDER"); cmGlobalVisualStudio7Generator* gg = static_cast(this->GlobalGenerator); fout << "\tName=\"" << projLabel << "\"\n"; @@ -1838,9 +1841,15 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, { fout << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\"\n"; } - fout << "\tSccProjectName=\"\"\n" - << "\tSccLocalPath=\"\"\n" - << "\tKeyword=\"" << keyword << "\">\n" + // if we have all the required Source code control tags + // then add that to the project + if(vsProvider && vsLocalpath && vsProjectname) + { + fout << "\tSccProjectName=\"" << vsProjectname << "\"\n" + << "\tSccLocalPath=\"" << vsLocalpath << "\"\n" + << "\tSccProvider=\"" << vsProvider << "\"\n"; + } + fout << "\tKeyword=\"" << keyword << "\">\n" << "\t\n" << "\t\tPlatformName << "\"/>\n" << "\t\n"; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 7e4627e5d..302f0b072 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMacroCommand.cxx,v $ Language: C++ - Date: $Date: 2008-03-07 13:40:36 $ - Version: $Revision: 1.36 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.36.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -36,6 +36,7 @@ public: // we must copy when we clone newC->Args = this->Args; newC->Functions = this->Functions; + newC->Policies = this->Policies; return newC; } @@ -81,6 +82,7 @@ public: std::vector Args; std::vector Functions; + cmPolicies::PolicyMap Policies; }; @@ -107,6 +109,13 @@ bool cmMacroHelperCommand::InvokeInitialPass return false; } + // Enforce matching logical blocks inside the macro. + cmMakefile::LexicalPushPop lexScope(this->Makefile); + + // Push a weak policy scope which restores the policies recorded at + // macro creation. + cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies); + // set the value of argc cmOStringStream argcDefStream; argcDefStream << expandedArgs.size(); @@ -129,13 +138,6 @@ bool cmMacroHelperCommand::InvokeInitialPass newLFF.Name = this->Functions[c].Name; newLFF.FilePath = this->Functions[c].FilePath; newLFF.Line = this->Functions[c].Line; - const char* def = this->Makefile->GetDefinition - ("CMAKE_MACRO_REPORT_DEFINITION_LOCATION"); - bool macroReportLocation = false; - if(def && !cmSystemTools::IsOff(def)) - { - macroReportLocation = true; - } // for each argument of the current function for (std::vector::const_iterator k = @@ -212,28 +214,8 @@ bool cmMacroHelperCommand::InvokeInitialPass arg.Value = tmps; arg.Quoted = k->Quoted; - if(macroReportLocation) - { - // Report the location of the argument where the macro was - // defined. - arg.FilePath = k->FilePath; - arg.Line = k->Line; - } - else - { - // Report the location of the argument where the macro was - // invoked. - if (args.size()) - { - arg.FilePath = args[0].FilePath; - arg.Line = args[0].Line; - } - else - { - arg.FilePath = "Unknown"; - arg.Line = 0; - } - } + arg.FilePath = k->FilePath; + arg.Line = k->Line; newLFF.Arguments.push_back(arg); } cmExecutionStatus status; @@ -242,6 +224,8 @@ bool cmMacroHelperCommand::InvokeInitialPass { // The error message should have already included the call stack // so we do not need to report an error here. + lexScope.Quiet(); + polScope.Quiet(); inStatus.SetNestedError(true); return false; } @@ -287,13 +271,14 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmMacroHelperCommand *f = new cmMacroHelperCommand(); f->Args = this->Args; f->Functions = this->Functions; + mf.RecordPolicies(f->Policies); std::string newName = "_" + this->Args[0]; mf.GetCMakeInstance()->RenameCommand(this->Args[0].c_str(), newName.c_str()); mf.AddCommand(f); // remove the function blocker now that the macro is defined - mf.RemoveFunctionBlocker(lff); + mf.RemoveFunctionBlocker(this, lff); return true; } else @@ -329,17 +314,6 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf) return false; } -void cmMacroFunctionBlocker:: -ScopeEnded(cmMakefile &mf) -{ - // macros should end with an EndMacro - cmSystemTools::Error( - "The end of a CMakeLists file was reached with a MACRO statement that " - "was not closed properly. Within the directory: ", - mf.GetCurrentDirectory(), " with macro ", - this->Args[0].c_str()); -} - bool cmMacroCommand::InitialPass(std::vector const& args, cmExecutionStatus &) { diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index eac10e07d..d3106e026 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMacroCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.16 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.16.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -34,7 +34,6 @@ public: cmMakefile &mf, cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf); - virtual void ScopeEnded(cmMakefile &mf); std::vector Args; std::vector Functions; @@ -112,7 +111,11 @@ public: "are not variables in the usual CMake sense. They are string " "replacements much like the c preprocessor would do with a " "macro. If you want true CMake variables you should look at " - "the function command."; + "the function command." + "\n" + "See the cmake_policy() command documentation for the behavior of " + "policies inside macros." + ; } cmTypeMacro(cmMacroCommand, cmCommand); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 299293719..40eda7e84 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMakefile.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:17 $ - Version: $Revision: 1.463.2.8 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.463.2.12 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -83,7 +83,8 @@ cmMakefile::cmMakefile() this->AddSourceGroup("", "^.*$"); this->AddSourceGroup ("Source Files", - "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$"); + "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp" + "|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$"); this->AddSourceGroup("Header Files", "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$"); this->AddSourceGroup("CMake Rules", "\\.rule$"); @@ -119,6 +120,7 @@ cmMakefile::cmMakefile(const cmMakefile& mf) this->SourceFileExtensions = mf.SourceFileExtensions; this->HeaderFileExtensions = mf.HeaderFileExtensions; this->DefineFlags = mf.DefineFlags; + this->DefineFlagsOrig = mf.DefineFlagsOrig; #if defined(CMAKE_BUILD_WITH_CMAKE) this->SourceGroups = mf.SourceGroups; @@ -147,6 +149,9 @@ void cmMakefile::Initialize() // Enter a policy level for this directory. this->PushPolicy(); + // Protect the directory-level policies. + this->PushPolicyBarrier(); + // By default the check is not done. It is enabled by // cmListFileCache in the top level if necessary. this->CheckCMP0000 = false; @@ -203,7 +208,7 @@ cmMakefile::~cmMakefile() delete d->second; } } - std::list::iterator pos; + std::vector::iterator pos; for (pos = this->FunctionBlockers.begin(); pos != this->FunctionBlockers.end(); ++pos) { @@ -345,26 +350,6 @@ bool cmMakefile::GetBacktrace(cmListFileBacktrace& backtrace) const return true; } -//---------------------------------------------------------------------------- -// Helper class to make sure the call stack is valid. -class cmMakefileCall -{ -public: - cmMakefileCall(cmMakefile* mf, - cmListFileContext const& lfc, - cmExecutionStatus& status): Makefile(mf) - { - cmMakefile::CallStackEntry entry = {&lfc, &status}; - this->Makefile->CallStack.push_back(entry); - } - ~cmMakefileCall() - { - this->Makefile->CallStack.pop_back(); - } -private: - cmMakefile* Makefile; -}; - //---------------------------------------------------------------------------- bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, cmExecutionStatus &status) @@ -458,11 +443,136 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, return result; } +//---------------------------------------------------------------------------- +class cmMakefile::IncludeScope +{ +public: + IncludeScope(cmMakefile* mf, const char* fname, bool noPolicyScope); + ~IncludeScope(); + void Quiet() { this->ReportError = false; } +private: + cmMakefile* Makefile; + const char* File; + bool NoPolicyScope; + bool CheckCMP0011; + bool ReportError; + void EnforceCMP0011(); +}; + +//---------------------------------------------------------------------------- +cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, const char* fname, + bool noPolicyScope): + Makefile(mf), File(fname), NoPolicyScope(noPolicyScope), + CheckCMP0011(false), ReportError(true) +{ + if(!this->NoPolicyScope) + { + // Check CMP0011 to determine the policy scope type. + switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0011)) + { + case cmPolicies::WARN: + // We need to push a scope to detect whether the script sets + // any policies that would affect the includer and therefore + // requires a warning. We use a weak scope to simulate OLD + // behavior by allowing policy changes to affect the includer. + this->Makefile->PushPolicy(true); + this->CheckCMP0011 = true; + break; + case cmPolicies::OLD: + // OLD behavior is to not push a scope at all. + this->NoPolicyScope = true; + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + // We should never make this policy required, but we handle it + // here just in case. + this->CheckCMP0011 = true; + case cmPolicies::NEW: + // NEW behavior is to push a (strong) scope. + this->Makefile->PushPolicy(); + break; + } + } + + // The included file cannot pop our policy scope. + this->Makefile->PushPolicyBarrier(); +} + +//---------------------------------------------------------------------------- +cmMakefile::IncludeScope::~IncludeScope() +{ + // Enforce matching policy scopes inside the included file. + this->Makefile->PopPolicyBarrier(this->ReportError); + + if(!this->NoPolicyScope) + { + // If we need to enforce policy CMP0011 then the top entry is the + // one we pushed above. If the entry is empty, then the included + // script did not set any policies that might affect the includer so + // we do not need to enforce the policy. + if(this->CheckCMP0011 && this->Makefile->PolicyStack.back().empty()) + { + this->CheckCMP0011 = false; + } + + // Pop the scope we pushed for the script. + this->Makefile->PopPolicy(); + + // We enforce the policy after the script's policy stack entry has + // been removed. + if(this->CheckCMP0011) + { + this->EnforceCMP0011(); + } + } +} + +//---------------------------------------------------------------------------- +void cmMakefile::IncludeScope::EnforceCMP0011() +{ + // We check the setting of this policy again because the included + // script might actually set this policy for its includer. + cmPolicies* policies = this->Makefile->GetPolicies(); + switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0011)) + { + case cmPolicies::WARN: + // Warn because the user did not set this policy. + { + cmOStringStream w; + w << policies->GetPolicyWarning(cmPolicies::CMP0011) << "\n" + << "The included script\n " << this->File << "\n" + << "affects policy settings. " + << "CMake is implying the NO_POLICY_SCOPE option for compatibility, " + << "so the effects are applied to the including context."; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + { + cmOStringStream e; + e << policies->GetRequiredPolicyError(cmPolicies::CMP0011) << "\n" + << "The included script\n " << this->File << "\n" + << "affects policy settings, so it requires this policy to be set."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + } + break; + case cmPolicies::OLD: + case cmPolicies::NEW: + // The script set this policy. We assume the purpose of the + // script is to initialize policies for its includer, and since + // the policy is now set for later scripts, we do not warn. + break; + } +} + +//---------------------------------------------------------------------------- // Parse the given CMakeLists.txt file executing all commands // bool cmMakefile::ReadListFile(const char* filename_in, const char *external_in, - std::string* fullPath) + std::string* fullPath, + bool noPolicyScope) { std::string currentParentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); @@ -470,10 +580,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE"); this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in); - // used to watch for blockers going out of scope - // e.g. mismatched IF statement - std::set originalBlockers; - const char* external = 0; std::string external_abs; @@ -504,14 +610,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, } } - // loop over current function blockers and record them - for (std::list::iterator pos - = this->FunctionBlockers.begin(); - pos != this->FunctionBlockers.end(); ++pos) - { - originalBlockers.insert(*pos); - } - // Now read the input file const char *filenametoread= filename; @@ -558,43 +656,38 @@ bool cmMakefile::ReadListFile(const char* filename_in, } // add this list file to the list of dependencies this->ListFiles.push_back( filenametoread); - bool endScopeNicely = true; + + // Enforce balanced blocks (if/endif, function/endfunction, etc.). + { + LexicalPushPop lexScope(this); + IncludeScope incScope(this, filenametoread, noPolicyScope); + + // Run the parsed commands. const size_t numberFunctions = cacheFile.Functions.size(); for(size_t i =0; i < numberFunctions; ++i) { cmExecutionStatus status; this->ExecuteCommand(cacheFile.Functions[i],status); - if (status.GetReturnInvoked() || - cmSystemTools::GetFatalErrorOccured() ) + if(cmSystemTools::GetFatalErrorOccured()) { - // Exit early from processing this file. - endScopeNicely = false; + // Exit early due to error. + lexScope.Quiet(); + incScope.Quiet(); break; } - } - - // send scope ended to and function blockers - if (endScopeNicely) - { - // loop over all function blockers to see if any block this command - for (std::list::iterator pos - = this->FunctionBlockers.begin(); - pos != this->FunctionBlockers.end(); ++pos) + if(status.GetReturnInvoked()) { - // if this blocker was not in the original then send a - // scope ended message - if (originalBlockers.find(*pos) == originalBlockers.end()) - { - (*pos)->ScopeEnded(*this); - } + // Exit early due to return command. + break; } } + } // If this is the directory-level CMakeLists.txt file then perform // some extra checks. if(this->ListFileStack.size() == 1) { - this->EnforceDirectoryLevelRules(endScopeNicely); + this->EnforceDirectoryLevelRules(); } this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); @@ -607,19 +700,8 @@ bool cmMakefile::ReadListFile(const char* filename_in, } //---------------------------------------------------------------------------- -void cmMakefile::EnforceDirectoryLevelRules(bool endScopeNicely) +void cmMakefile::EnforceDirectoryLevelRules() { - // Enforce policy stack depth. - while(this->PolicyStack.size() > 1) - { - if(endScopeNicely) - { - this->IssueMessage(cmake::FATAL_ERROR, - "cmake_policy PUSH without matching POP"); - } - this->PopPolicy(false); - } - // Diagnose a violation of CMP0000 if necessary. if(this->CheckCMP0000) { @@ -981,12 +1063,13 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, } //---------------------------------------------------------------------------- -void cmMakefile::AddUtilityCommand(const char* utilityName, - bool excludeFromAll, - const char* workingDirectory, - const std::vector& depends, - const cmCustomCommandLines& commandLines, - bool escapeOldStyle, const char* comment) +cmTarget* +cmMakefile::AddUtilityCommand(const char* utilityName, + bool excludeFromAll, + const char* workingDirectory, + const std::vector& depends, + const cmCustomCommandLines& commandLines, + bool escapeOldStyle, const char* comment) { // Create a target instance for this utility. cmTarget* target = this->AddNewTarget(cmTarget::UTILITY, utilityName); @@ -1024,6 +1107,7 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, cmSystemTools::Error("Could not get source file entry for ", force.c_str()); } + return target; } void cmMakefile::AddDefineFlag(const char* flag) @@ -1334,6 +1418,7 @@ void cmMakefile::InitializeFromParent() // define flags this->DefineFlags = parent->DefineFlags; + this->DefineFlagsOrig = parent->DefineFlagsOrig; // Include transform property. There is no per-config version. { @@ -1556,7 +1641,8 @@ void cmMakefile::AddDefinition(const char* name, const char* value) void cmMakefile::AddCacheDefinition(const char* name, const char* value, const char* doc, - cmCacheManager::CacheEntryType type) + cmCacheManager::CacheEntryType type, + bool force) { const char* val = value; cmCacheManager::CacheIterator it = @@ -1564,7 +1650,12 @@ void cmMakefile::AddCacheDefinition(const char* name, const char* value, if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) && it.Initialized()) { - val = it.GetValue(); + // if this is not a force, then use the value from the cache + // if it is a force, then use the value being passed in + if(!force) + { + val = it.GetValue(); + } if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH ) { std::vector::size_type cc; @@ -1648,6 +1739,11 @@ void cmMakefile::RemoveDefinition(const char* name) #endif } +void cmMakefile::RemoveCacheDefinition(const char* name) +{ + this->GetCacheManager()->RemoveCacheEntry(name); +} + void cmMakefile::SetProjectName(const char* p) { this->ProjectName = p; @@ -2163,28 +2259,60 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source, parser.SetReplaceAtSyntax(replaceAt); parser.SetRemoveEmpty(removeEmpty); int res = parser.ParseString(source.c_str(), 0); - if ( res ) + const char* emsg = parser.GetError(); + if ( res && !emsg[0] ) { source = parser.GetResult(); } else { + // Construct the main error message. cmOStringStream error; - error << "Syntax error in cmake code at\n" - << (filename?filename:"(no filename given)") - << ":" << line << ":\n" - << parser.GetError() << ", when parsing string \"" - << source.c_str() << "\""; - if(this->NeedBackwardsCompatibility(2,0)) - { - cmSystemTools::Error(error.str().c_str()); - cmSystemTools::SetFatalErrorOccured(); - return source.c_str(); - } - else - { - cmSystemTools::Message(error.str().c_str()); + error << "Syntax error in cmake code "; + if(filename && line > 0) + { + // This filename and line number may be more specific than the + // command context because one command invocation can have + // arguments on multiple lines. + error << "at\n" + << " " << filename << ":" << line << "\n"; + } + error << "when parsing string\n" + << " " << source.c_str() << "\n"; + error << emsg; + + // If the parser failed ("res" is false) then this is a real + // argument parsing error, so the policy applies. Otherwise the + // parser reported an error message without failing because the + // helper implementation is unhappy, which has always reported an + // error. + cmake::MessageType mtype = cmake::FATAL_ERROR; + if(!res) + { + // This is a real argument parsing error. Use policy CMP0010 to + // decide whether it is an error. + switch(this->GetPolicyStatus(cmPolicies::CMP0010)) + { + case cmPolicies::WARN: + error << "\n" + << (this->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0010)); + case cmPolicies::OLD: + // OLD behavior is to just warn and continue. + mtype = cmake::AUTHOR_WARNING; + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + error << "\n" + << (this->GetPolicies() + ->GetRequiredPolicyError(cmPolicies::CMP0010)); + case cmPolicies::NEW: + // NEW behavior is to report the error. + cmSystemTools::SetFatalErrorOccured(); + break; + } } + this->IssueMessage(mtype, error.str()); } return source.c_str(); } @@ -2258,6 +2386,11 @@ void cmMakefile::AddDefaultDefinitions() this->AddDefinition("CMAKE_MAJOR_VERSION", temp); sprintf(temp, "%d", cmVersion::GetPatchVersion()); this->AddDefinition("CMAKE_PATCH_VERSION", temp); + sprintf(temp, "%u.%u.%u", + cmVersion::GetMajorVersion(), + cmVersion::GetMinorVersion(), + cmVersion::GetPatchVersion()); + this->AddDefinition("CMAKE_VERSION", temp); this->AddDefinition("CMAKE_FILES_DIRECTORY", cmake::GetCMakeFilesDirectory()); @@ -2314,7 +2447,7 @@ bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff, // loop over all function blockers to see if any block this command // evaluate in reverse, this is critical for balanced IF statements etc - std::list::reverse_iterator pos; + std::vector::reverse_iterator pos; for (pos = this->FunctionBlockers.rbegin(); pos != this->FunctionBlockers.rend(); ++pos) { @@ -2327,7 +2460,40 @@ bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff, return false; } -void cmMakefile::ExpandArguments( +//---------------------------------------------------------------------------- +void cmMakefile::PushFunctionBlockerBarrier() +{ + this->FunctionBlockerBarriers.push_back(this->FunctionBlockers.size()); +} + +//---------------------------------------------------------------------------- +void cmMakefile::PopFunctionBlockerBarrier(bool reportError) +{ + // Remove any extra entries pushed on the barrier. + FunctionBlockersType::size_type barrier = + this->FunctionBlockerBarriers.back(); + while(this->FunctionBlockers.size() > barrier) + { + cmsys::auto_ptr fb(this->FunctionBlockers.back()); + this->FunctionBlockers.pop_back(); + if(reportError) + { + // Report the context in which the unclosed block was opened. + cmListFileContext const& lfc = fb->GetStartingContext(); + cmOStringStream e; + e << "A logical block opening on the line\n" + << " " << lfc << "\n" + << "is not closed."; + this->IssueMessage(cmake::FATAL_ERROR, e.str()); + reportError = false; + } + } + + // Remove the barrier. + this->FunctionBlockerBarriers.pop_back(); +} + +bool cmMakefile::ExpandArguments( std::vector const& inArgs, std::vector& outArgs) { @@ -2353,25 +2519,73 @@ void cmMakefile::ExpandArguments( cmSystemTools::ExpandListArgument(value, outArgs); } } + return !cmSystemTools::GetFatalErrorOccured(); } -void cmMakefile::RemoveFunctionBlocker(const cmListFileFunction& lff) +//---------------------------------------------------------------------------- +void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb) { - // loop over all function blockers to see if any block this command - std::list::reverse_iterator pos; - for (pos = this->FunctionBlockers.rbegin(); - pos != this->FunctionBlockers.rend(); ++pos) + if(!this->CallStack.empty()) + { + // Record the context in which the blocker is created. + fb->SetStartingContext(*(this->CallStack.back().Context)); + } + + this->FunctionBlockers.push_back(fb); +} + +cmsys::auto_ptr +cmMakefile::RemoveFunctionBlocker(cmFunctionBlocker* fb, + const cmListFileFunction& lff) +{ + // Find the function blocker stack barrier for the current scope. + // We only remove a blocker whose index is not less than the barrier. + FunctionBlockersType::size_type barrier = 0; + if(!this->FunctionBlockerBarriers.empty()) + { + barrier = this->FunctionBlockerBarriers.back(); + } + + // Search for the function blocker whose scope this command ends. + for(FunctionBlockersType::size_type + i = this->FunctionBlockers.size(); i > barrier; --i) { - if ((*pos)->ShouldRemove(lff, *this)) + std::vector::iterator pos = + this->FunctionBlockers.begin() + (i - 1); + if (*pos == fb) { + // Warn if the arguments do not match, but always remove. + if(!(*pos)->ShouldRemove(lff, *this)) + { + cmListFileContext const& lfc = fb->GetStartingContext(); + cmOStringStream e; + e << "A logical block opening on the line\n" + << " " << lfc << "\n" + << "closes on the line\n" + << " " << lff << "\n" + << "with mis-matching arguments."; + this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + } cmFunctionBlocker* b = *pos; - this->FunctionBlockers.remove(b); - delete b; - break; + this->FunctionBlockers.erase(pos); + return cmsys::auto_ptr(b); } } - return; + return cmsys::auto_ptr(); +} + +//---------------------------------------------------------------------------- +cmMakefile::LexicalPushPop::LexicalPushPop(cmMakefile* mf): + Makefile(mf), ReportError(true) +{ + this->Makefile->PushFunctionBlockerBarrier(); +} + +//---------------------------------------------------------------------------- +cmMakefile::LexicalPushPop::~LexicalPushPop() +{ + this->Makefile->PopFunctionBlockerBarrier(this->ReportError); } void cmMakefile::SetHomeDirectory(const char* dir) @@ -2855,7 +3069,10 @@ void cmMakefile::SetProperty(const char* prop, const char* value) if ( propname == "INCLUDE_DIRECTORIES" ) { std::vector varArgsExpanded; - cmSystemTools::ExpandListArgument(value, varArgsExpanded); + if(value) + { + cmSystemTools::ExpandListArgument(value, varArgsExpanded); + } this->SetIncludeDirectories(varArgsExpanded); return; } @@ -2863,7 +3080,10 @@ void cmMakefile::SetProperty(const char* prop, const char* value) if ( propname == "LINK_DIRECTORIES" ) { std::vector varArgsExpanded; - cmSystemTools::ExpandListArgument(value, varArgsExpanded); + if(value) + { + cmSystemTools::ExpandListArgument(value, varArgsExpanded); + } this->SetLinkDirectories(varArgsExpanded); return; } @@ -3068,6 +3288,7 @@ cmTarget* cmMakefile::FindTarget(const char* name) return 0; } +//---------------------------------------------------------------------------- cmTest* cmMakefile::CreateTest(const char* testName) { if ( !testName ) @@ -3496,11 +3717,10 @@ cmPolicies::PolicyStatus cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) { // Is the policy set in our stack? - for(std::vector::reverse_iterator - psi = this->PolicyStack.rbegin(); + for(PolicyStackType::reverse_iterator psi = this->PolicyStack.rbegin(); psi != this->PolicyStack.rend(); ++psi) { - PolicyMap::const_iterator pse = psi->find(id); + PolicyStackEntry::const_iterator pse = psi->find(id); if(pse != psi->end()) { return pse->second; @@ -3547,8 +3767,14 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, return false; } - // Store the setting. - this->PolicyStack.back()[id] = status; + // Update the policy stack from the top to the top-most strong entry. + bool previous_was_weak = true; + for(PolicyStackType::reverse_iterator psi = this->PolicyStack.rbegin(); + previous_was_weak && psi != this->PolicyStack.rend(); ++psi) + { + (*psi)[id] = status; + previous_was_weak = psi->Weak; + } // Special hook for presenting compatibility variable as soon as // the user requests it. @@ -3572,26 +3798,67 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, return true; } -bool cmMakefile::PushPolicy() +//---------------------------------------------------------------------------- +cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m, bool weak, + cmPolicies::PolicyMap const& pm): + Makefile(m), ReportError(true) +{ + this->Makefile->PushPolicy(weak, pm); + this->Makefile->PushPolicyBarrier(); +} + +//---------------------------------------------------------------------------- +cmMakefile::PolicyPushPop::~PolicyPushPop() +{ + this->Makefile->PopPolicyBarrier(this->ReportError); + this->Makefile->PopPolicy(); +} + +//---------------------------------------------------------------------------- +void cmMakefile::PushPolicy(bool weak, cmPolicies::PolicyMap const& pm) { // Allocate a new stack entry. - this->PolicyStack.push_back(PolicyMap()); - return true; + this->PolicyStack.push_back(PolicyStackEntry(pm, weak)); } -bool cmMakefile::PopPolicy(bool reportError) +//---------------------------------------------------------------------------- +void cmMakefile::PopPolicy() { - if(this->PolicyStack.size() == 1) + if(this->PolicyStack.size() > this->PolicyBarriers.back()) + { + this->PolicyStack.pop_back(); + } + else + { + this->IssueMessage(cmake::FATAL_ERROR, + "cmake_policy POP without matching PUSH"); + } +} + +//---------------------------------------------------------------------------- +void cmMakefile::PushPolicyBarrier() +{ + this->PolicyBarriers.push_back(this->PolicyStack.size()); +} + +//---------------------------------------------------------------------------- +void cmMakefile::PopPolicyBarrier(bool reportError) +{ + // Remove any extra entries pushed on the barrier. + PolicyStackType::size_type barrier = this->PolicyBarriers.back(); + while(this->PolicyStack.size() > barrier) { if(reportError) { - cmSystemTools::Error("Attempt to pop the policy stack past " - "it's beginning."); + this->IssueMessage(cmake::FATAL_ERROR, + "cmake_policy PUSH without matching POP"); + reportError = false; } - return false; + this->PopPolicy(); } - this->PolicyStack.pop_back(); - return true; + + // Remove the barrier. + this->PolicyBarriers.pop_back(); } bool cmMakefile::SetPolicyVersion(const char *version) @@ -3608,3 +3875,15 @@ cmPolicies *cmMakefile::GetPolicies() } return this->GetCMakeInstance()->GetPolicies(); } + +//---------------------------------------------------------------------------- +void cmMakefile::RecordPolicies(cmPolicies::PolicyMap& pm) +{ + /* Record the setting of every policy. */ + typedef cmPolicies::PolicyID PolicyID; + for(PolicyID pid = cmPolicies::CMP0000; + pid != cmPolicies::CMPCOUNT; pid = PolicyID(pid+1)) + { + pm[pid] = this->GetPolicyStatus(pid); + } +} diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 475958714..9a22f15bf 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMakefile.h,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:18 $ - Version: $Revision: 1.230.2.4 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.230.2.8 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -31,6 +31,7 @@ #include "cmSourceGroup.h" #endif +#include #include class cmFunctionBlocker; @@ -43,6 +44,7 @@ class cmTest; class cmVariableWatch; class cmake; class cmMakefileCall; +class cmCMakePolicyCommand; /** \class cmMakefile * \brief Process the input CMakeLists.txt file. @@ -82,16 +84,33 @@ public: */ bool ReadListFile(const char* listfile, const char* external= 0, - std::string* fullPath= 0); + std::string* fullPath= 0, + bool noPolicyScope = true); /** * Add a function blocker to this makefile */ - void AddFunctionBlocker(cmFunctionBlocker *fb) - { this->FunctionBlockers.push_back(fb);} - void RemoveFunctionBlocker(cmFunctionBlocker *fb) - { this->FunctionBlockers.remove(fb);} - void RemoveFunctionBlocker(const cmListFileFunction& lff); + void AddFunctionBlocker(cmFunctionBlocker* fb); + + /** + * Remove the function blocker whose scope ends with the given command. + * This returns ownership of the function blocker object. + */ + cmsys::auto_ptr + RemoveFunctionBlocker(cmFunctionBlocker* fb, const cmListFileFunction& lff); + + /** Push/pop a lexical (function blocker) barrier automatically. */ + class LexicalPushPop + { + public: + LexicalPushPop(cmMakefile* mf); + ~LexicalPushPop(); + void Quiet() { this->ReportError = false; } + private: + cmMakefile* Makefile; + bool ReportError; + }; + friend class LexicalPushPop; /** * Try running cmake and building a file. This is used for dynalically @@ -200,12 +219,12 @@ public: const char* arg2=0, const char* arg3=0, const char* arg4=0); - void AddUtilityCommand(const char* utilityName, bool excludeFromAll, - const char* workingDirectory, - const std::vector& depends, - const cmCustomCommandLines& commandLines, - bool escapeOldStyle = true, - const char* comment = 0); + cmTarget* AddUtilityCommand(const char* utilityName, bool excludeFromAll, + const char* workingDirectory, + const std::vector& depends, + const cmCustomCommandLines& commandLines, + bool escapeOldStyle = true, + const char* comment = 0); /** * Add a link library to the build. @@ -264,7 +283,8 @@ public: ///! Add a definition to this makefile and the global cmake cache. void AddCacheDefinition(const char* name, const char* value, const char* doc, - cmCacheManager::CacheEntryType type); + cmCacheManager::CacheEntryType type, + bool force = false); /** * Add bool variable definition to the build. @@ -278,6 +298,8 @@ public: * for cache entries, and will only affect the current makefile. */ void RemoveDefinition(const char* name); + ///! Remove a definition from the cache. + void RemoveCacheDefinition(const char* name); /** * Specify the name of the project for this build. @@ -321,11 +343,25 @@ public: bool SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status); bool SetPolicy(const char *id, cmPolicies::PolicyStatus status); cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); - bool PushPolicy(); - bool PopPolicy(bool reportError = true); bool SetPolicyVersion(const char *version); + void RecordPolicies(cmPolicies::PolicyMap& pm); //@} + /** Helper class to push and pop policies automatically. */ + class PolicyPushPop + { + public: + PolicyPushPop(cmMakefile* m, + bool weak = false, + cmPolicies::PolicyMap const& pm = cmPolicies::PolicyMap()); + ~PolicyPushPop(); + void Quiet() { this->ReportError = false; } + private: + cmMakefile* Makefile; + bool ReportError; + }; + friend class PolicyPushPop; + /** * Get the Policies Instance */ @@ -700,7 +736,7 @@ public: * Expand the given list file arguments into the full set after * variable replacement and list expansion. */ - void ExpandArguments(std::vector const& inArgs, + bool ExpandArguments(std::vector const& inArgs, std::vector& outArgs); /** * Get the instance @@ -778,6 +814,16 @@ public: void PopScope(); void RaiseScope(const char *var, const char *value); + /** Helper class to push and pop scopes automatically. */ + class ScopePushPop + { + public: + ScopePushPop(cmMakefile* m): Makefile(m) { this->Makefile->PushScope(); } + ~ScopePushPop() { this->Makefile->PopScope(); } + private: + cmMakefile* Makefile; + }; + void IssueMessage(cmake::MessageType t, std::string const& text) const; @@ -858,7 +904,11 @@ private: const std::vector& v) const; void AddDefaultDefinitions(); - std::list FunctionBlockers; + typedef std::vector FunctionBlockersType; + FunctionBlockersType FunctionBlockers; + std::vector FunctionBlockerBarriers; + void PushFunctionBlockerBarrier(); + void PopFunctionBlockerBarrier(bool reportError = true); typedef std::map DataMapType; DataMapType DataMap; @@ -895,18 +945,55 @@ private: cmTarget* FindBasicTarget(const char* name); std::vector ImportedTargetsOwned; std::map ImportedTargets; - + + // Internal policy stack management. + void PushPolicy(bool weak = false, + cmPolicies::PolicyMap const& pm = cmPolicies::PolicyMap()); + void PopPolicy(); + void PushPolicyBarrier(); + void PopPolicyBarrier(bool reportError = true); + friend class cmCMakePolicyCommand; + class IncludeScope; + friend class IncludeScope; + // stack of policy settings - typedef std::map PolicyMap; - std::vector PolicyStack; + struct PolicyStackEntry: public cmPolicies::PolicyMap + { + typedef cmPolicies::PolicyMap derived; + PolicyStackEntry(bool w = false): derived(), Weak(w) {} + PolicyStackEntry(derived const& d, bool w = false): derived(d), Weak(w) {} + PolicyStackEntry(PolicyStackEntry const& r): derived(r), Weak(r.Weak) {} + bool Weak; + }; + typedef std::vector PolicyStackType; + PolicyStackType PolicyStack; + std::vector PolicyBarriers; cmPolicies::PolicyStatus GetPolicyStatusInternal(cmPolicies::PolicyID id); bool CheckCMP0000; // Enforce rules about CMakeLists.txt files. - void EnforceDirectoryLevelRules(bool endScopeNicely); + void EnforceDirectoryLevelRules(); }; +//---------------------------------------------------------------------------- +// Helper class to make sure the call stack is valid. +class cmMakefileCall +{ +public: + cmMakefileCall(cmMakefile* mf, + cmListFileContext const& lfc, + cmExecutionStatus& status): Makefile(mf) + { + cmMakefile::CallStackEntry entry = {&lfc, &status}; + this->Makefile->CallStack.push_back(entry); + } + ~cmMakefileCall() + { + this->Makefile->CallStack.pop_back(); + } +private: + cmMakefile* Makefile; +}; #endif diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index e8730f709..5ed4fa263 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMakefileExecutableTargetGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:18 $ - Version: $Revision: 1.46.2.2 $ + Date: $Date: 2008-10-24 15:18:52 $ + Version: $Revision: 1.46.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -353,36 +353,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Construct object file lists that may be needed to expand the // rule. - std::string variableName; - std::string variableNameExternal; - this->WriteObjectsVariable(variableName, variableNameExternal); std::string buildObjs; - if(useResponseFile) - { - std::string objects; - this->WriteObjectsString(objects); - std::string objects_rsp = - this->CreateResponseFile("objects.rsp", objects, depends); - buildObjs = "@"; - buildObjs += this->Convert(objects_rsp.c_str(), - cmLocalGenerator::NONE, - cmLocalGenerator::SHELL); - } - else if(useLinkScript) - { - this->WriteObjectsString(buildObjs); - } - else - { - buildObjs = "$("; - buildObjs += variableName; - buildObjs += ") $("; - buildObjs += variableNameExternal; - buildObjs += ")"; - } - std::string cleanObjs = "$("; - cleanObjs += variableName; - cleanObjs += ")"; + this->CreateObjectLists(useLinkScript, false, useResponseFile, + buildObjs, depends); cmLocalGenerator::RuleVariables vars; vars.Language = linkLanguage; @@ -440,7 +413,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) this->LocalGenerator->CreateCDCommand (commands1, this->Makefile->GetStartOutputDirectory(), - this->Makefile->GetHomeOutputDirectory()); + cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), commands1.begin(), commands1.end()); commands1.clear(); @@ -454,7 +427,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) commands1.push_back(symlink); this->LocalGenerator->CreateCDCommand(commands1, this->Makefile->GetStartOutputDirectory(), - this->Makefile->GetHomeOutputDirectory()); + cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), commands1.begin(), commands1.end()); commands1.clear(); } diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 936e04a64..b4705ba2a 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMakefileLibraryTargetGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:18 $ - Version: $Revision: 1.58.2.4 $ + Date: $Date: 2008-10-24 15:18:52 $ + Version: $Revision: 1.58.2.5 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -591,7 +591,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->LocalGenerator->CreateCDCommand (commands1, this->Makefile->GetStartOutputDirectory(), - this->Makefile->GetHomeOutputDirectory()); + cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), commands1.begin(), commands1.end()); commands1.clear(); } @@ -687,39 +687,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Construct object file lists that may be needed to expand the // rule. - std::string variableName; - std::string variableNameExternal; - this->WriteObjectsVariable(variableName, variableNameExternal); std::string buildObjs; - if(useResponseFile) - { - std::string objects; - this->WriteObjectsString(objects); - std::string objects_rsp = - this->CreateResponseFile("objects.rsp", objects, depends); - buildObjs = "@"; - buildObjs += this->Convert(objects_rsp.c_str(), - cmLocalGenerator::NONE, - cmLocalGenerator::SHELL); - } - else if(useLinkScript) - { - if(!useArchiveRules) - { - this->WriteObjectsString(buildObjs); - } - } - else - { - buildObjs = "$("; - buildObjs += variableName; - buildObjs += ") $("; - buildObjs += variableNameExternal; - buildObjs += ")"; - } - std::string cleanObjs = "$("; - cleanObjs += variableName; - cleanObjs += ")"; + this->CreateObjectLists(useLinkScript, useArchiveRules, useResponseFile, + buildObjs, depends); + cmLocalGenerator::RuleVariables vars; vars.TargetPDB = targetOutPathPDB.c_str(); @@ -872,7 +843,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->LocalGenerator->CreateCDCommand (commands1, this->Makefile->GetStartOutputDirectory(), - this->Makefile->GetHomeOutputDirectory()); + cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), commands1.begin(), commands1.end()); commands1.clear(); @@ -888,7 +859,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules commands1.push_back(symlink); this->LocalGenerator->CreateCDCommand(commands1, this->Makefile->GetStartOutputDirectory(), - this->Makefile->GetHomeOutputDirectory()); + cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), commands1.begin(), commands1.end()); commands1.clear(); } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 49d1f5e47..89d0fd40f 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMakefileTargetGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-06-13 12:55:17 $ - Version: $Revision: 1.93.2.6 $ + Date: $Date: 2008-10-24 15:18:52 $ + Version: $Revision: 1.93.2.7 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -567,7 +567,7 @@ cmMakefileTargetGenerator if(this->LocalGenerator->UseRelativePaths) { sourceFile = this->Convert(sourceFile.c_str(), - cmLocalGenerator::HOME_OUTPUT); + cmLocalGenerator::START_OUTPUT); } sourceFile = this->Convert(sourceFile.c_str(), cmLocalGenerator::NONE, @@ -614,7 +614,7 @@ cmMakefileTargetGenerator this->LocalGenerator->CreateCDCommand (compileCommands, this->Makefile->GetStartOutputDirectory(), - this->Makefile->GetHomeOutputDirectory()); + cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), compileCommands.begin(), compileCommands.end()); @@ -725,7 +725,7 @@ cmMakefileTargetGenerator this->LocalGenerator->CreateCDCommand (preprocessCommands, this->Makefile->GetStartOutputDirectory(), - this->Makefile->GetHomeOutputDirectory()); + cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), preprocessCommands.begin(), preprocessCommands.end()); @@ -781,7 +781,7 @@ cmMakefileTargetGenerator this->LocalGenerator->CreateCDCommand (assemblyCommands, this->Makefile->GetStartOutputDirectory(), - this->Makefile->GetHomeOutputDirectory()); + cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), assemblyCommands.begin(), assemblyCommands.end()); @@ -895,7 +895,7 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules() this->LocalGenerator->CreateCDCommand (commands, this->Makefile->GetStartOutputDirectory(), - this->Makefile->GetHomeOutputDirectory()); + cmLocalGenerator::HOME_OUTPUT); // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, @@ -948,16 +948,16 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "\n" << "# Targets to which this target links.\n" << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n"; - cmGlobalGenerator* gg = this->GlobalGenerator; std::set emitted; - cmTarget::LinkLibraryVectorType const& libs = - this->Target->GetLinkLibraries(); - for(cmTarget::LinkLibraryVectorType::const_iterator j = libs.begin(); - j != libs.end(); ++j) + const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); + if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) { - if(cmTarget const* linkee = gg->FindTarget(0, j->first.c_str())) + cmComputeLinkInformation::ItemVector const& items = cli->GetItems(); + for(cmComputeLinkInformation::ItemVector::const_iterator + i = items.begin(); i != items.end(); ++i) { - if(emitted.insert(linkee).second) + cmTarget const* linkee = i->Target; + if(linkee && !linkee->IsImported() && emitted.insert(linkee).second) { cmMakefile* mf = linkee->GetMakefile(); cmLocalGenerator* lg = mf->GetLocalGenerator(); @@ -1031,8 +1031,11 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " << this->Convert(this->InfoFileNameFull.c_str(), - cmLocalGenerator::FULL, cmLocalGenerator::SHELL) - << " --color=$(COLOR)"; + cmLocalGenerator::FULL, cmLocalGenerator::SHELL); + if(this->LocalGenerator->GetColorMakefile()) + { + depCmd << " --color=$(COLOR)"; + } commands.push_back(depCmd.str()); // Make sure all custom command outputs in this target are built. @@ -1452,7 +1455,9 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags() if(emitted.insert(*i).second) { flags += "-F"; - flags += this->LocalGenerator->ConvertToOutputForExisting(i->c_str()); + flags += this->Convert(i->c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL, true); flags += " "; } } @@ -1620,6 +1625,65 @@ cmMakefileTargetGenerator return responseFileName; } +//---------------------------------------------------------------------------- +void +cmMakefileTargetGenerator +::CreateObjectLists(bool useLinkScript, bool useArchiveRules, + bool useResponseFile, std::string& buildObjs, + std::vector& makefile_depends) +{ + std::string variableName; + std::string variableNameExternal; + this->WriteObjectsVariable(variableName, variableNameExternal); + if(useResponseFile) + { + // MSVC response files cannot exceed 128K. + std::string::size_type const responseFileLimit = 131000; + + // Construct the individual object list strings. + std::vector object_strings; + this->WriteObjectsStrings(object_strings, responseFileLimit); + + // Write a response file for each string. + const char* sep = ""; + for(unsigned int i = 0; i < object_strings.size(); ++i) + { + // Number the response files. + char rsp[32]; + sprintf(rsp, "objects%u.rsp", i+1); + + // Create this response file. + std::string objects_rsp = + this->CreateResponseFile(rsp, object_strings[i], makefile_depends); + + // Separate from previous response file references. + buildObjs += sep; + sep = " "; + + // Reference the response file. + buildObjs += "@"; + buildObjs += this->Convert(objects_rsp.c_str(), + cmLocalGenerator::NONE, + cmLocalGenerator::SHELL); + } + } + else if(useLinkScript) + { + if(!useArchiveRules) + { + this->WriteObjectsString(buildObjs); + } + } + else + { + buildObjs = "$("; + buildObjs += variableName; + buildObjs += ") $("; + buildObjs += variableNameExternal; + buildObjs += ")"; + } +} + //---------------------------------------------------------------------------- const char* cmMakefileTargetGenerator::GetFortranModuleDirectory() { diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index adf19b510..e7e9cd343 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMakefileTargetGenerator.h,v $ Language: C++ - Date: $Date: 2008-04-08 16:22:50 $ - Version: $Revision: 1.24.2.1 $ + Date: $Date: 2008-10-24 15:18:53 $ + Version: $Revision: 1.24.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -144,6 +144,11 @@ protected: std::string const& options, std::vector& makefile_depends); + /** Create lists of object files for linking and cleaning. */ + void CreateObjectLists(bool useLinkScript, bool useArchiveRules, + bool useResponseFile, std::string& buildObjs, + std::vector& makefile_depends); + virtual void CloseFileStreams(); void RemoveForbiddenFlags(const char* flagVar, const char* linkLang, std::string& linkFlags); diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 395503e3d..f49e3c665 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmOrderDirectories.cxx,v $ Language: C++ - Date: $Date: 2008-07-30 18:54:49 $ - Version: $Revision: 1.4.2.1 $ + Date: $Date: 2008-12-31 15:14:30 $ + Version: $Revision: 1.4.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -113,25 +113,22 @@ protected: bool cmOrderDirectoriesConstraint::FileMayConflict(std::string const& dir, std::string const& name) { - // Check if the file will be built by cmake. - std::set const& files = - (this->GlobalGenerator->GetDirectoryContent(dir, false)); - if(std::set::const_iterator(files.find(name)) != files.end()) - { - return true; - } - - // Check if the file exists on disk and is not a symlink back to the - // original file. + // Check if the file exists on disk. std::string file = dir; file += "/"; file += name; - if(cmSystemTools::FileExists(file.c_str(), true) && - !cmSystemTools::SameFile(this->FullPath.c_str(), file.c_str())) + if(cmSystemTools::FileExists(file.c_str(), true)) { - return true; + // The file conflicts only if it is not the same as the original + // file due to a symlink or hardlink. + return !cmSystemTools::SameFile(this->FullPath.c_str(), file.c_str()); } - return false; + + // Check if the file will be built by cmake. + std::set const& files = + (this->GlobalGenerator->GetDirectoryContent(dir, false)); + std::set::const_iterator fi = files.find(name); + return fi != files.end(); } //---------------------------------------------------------------------------- diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 230de107e..443954c31 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmOutputRequiredFilesCommand.cxx,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.16 $ + Date: $Date: 2008-10-24 15:18:54 $ + Version: $Revision: 1.16.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -199,6 +199,13 @@ bool cmOutputRequiredFilesCommand { // write them out FILE *fout = fopen(this->OutputFile.c_str(),"w"); + if(!fout) + { + std::string err = "Can not open output file: "; + err += this->OutputFile; + this->SetError(err.c_str()); + return false; + } std::set visited; this->ListDependencies(info,fout, &visited); fclose(fout); diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 5d8c71f8c..169814ac4 100755 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -323,6 +323,38 @@ cmPolicies::cmPolicies() "by default, but only if FOLLOW_SYMLINKS is given as an additional " "argument to the FILE command.", 2,6,2, cmPolicies::WARN); + + this->DefinePolicy( + CMP0010, "CMP0010", + "Bad variable reference syntax is an error.", + "In CMake 2.6.2 and below, incorrect variable reference syntax such as " + "a missing close-brace (\"${FOO\") was reported but did not stop " + "processing of CMake code. " + "This policy determines whether a bad variable reference is an error. " + "The OLD behavior for this policy is to warn about the error, leave " + "the string untouched, and continue. " + "The NEW behavior for this policy is to report an error.", + 2,6,3, cmPolicies::WARN); + + this->DefinePolicy( + CMP0011, "CMP0011", + "Included scripts do automatic cmake_policy PUSH and POP.", + "In CMake 2.6.2 and below, CMake Policy settings in scripts loaded by " + "the include() and find_package() commands would affect the includer. " + "Explicit invocations of cmake_policy(PUSH) and cmake_policy(POP) were " + "required to isolate policy changes and protect the includer. " + "While some scripts intend to affect the policies of their includer, " + "most do not. " + "In CMake 2.6.3 and above, include() and find_package() by default PUSH " + "and POP an entry on the policy stack around an included script, " + "but provide a NO_POLICY_SCOPE option to disable it. " + "This policy determines whether or not to imply NO_POLICY_SCOPE for " + "compatibility. " + "The OLD behavior for this policy is to imply NO_POLICY_SCOPE for " + "include() and find_package() commands. " + "The NEW behavior for this policy is to allow the commands to do their " + "default cmake_policy PUSH and POP.", + 2,6,3, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index f09eaf3c3..c70700056 100755 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmPolicies.h,v $ Language: C++ - Date: $Date: 2008-09-12 14:56:21 $ - Version: $Revision: 1.10.2.6 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.10.2.8 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -50,6 +50,8 @@ public: CMP0007, // list command handling of empty elements CMP0008, // Full-path libraries must be a valid library file name CMP0009, // GLOB_RECURSE should not follow symlinks by default + CMP0010, // Bad variable reference syntax is an error + CMP0011, // Strong policy scope for include and find_package // Always the last entry. Useful mostly to avoid adding a comma // the last policy when adding a new one. @@ -88,6 +90,9 @@ public: ///! Get docs for policies void GetDocumentation(std::vector& v); + /** Represent a set of policy values. */ + typedef std::map PolicyMap; + private: // might have to make these internal for VS6 not sure yet std::map Policies; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 033ea3418..9c15ea3ff 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmSetCommand.cxx,v $ Language: C++ - Date: $Date: 2008-03-13 17:52:49 $ - Version: $Revision: 1.33 $ + Date: $Date: 2009-01-13 18:03:53 $ + Version: $Revision: 1.33.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -171,7 +171,7 @@ bool cmSetCommand this->Makefile->AddCacheDefinition(variable, value.c_str(), docstring, - type); + type, force); } else { diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index 2b610de98..44a1808bf 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmSetTargetPropertiesCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.31 $ + Date: $Date: 2008-10-24 15:18:54 $ + Version: $Revision: 1.31.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -145,6 +145,9 @@ public: "the target in an IDE like visual studio. VS_KEYWORD can be set " "to change the visual studio keyword, for example QT integration " "works better if this is set to Qt4VSv1.0.\n" + "VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER can be set " + "to add support for source control bindings in a Visual Studio " + "project file.\n" "When a library is built CMake by default generates code to remove " "any existing library using all possible names. This is needed " "to support libraries that switch between STATIC and SHARED by " diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 3c5d3b19b..750954236 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmSourceFile.cxx,v $ Language: C++ - Date: $Date: 2008-05-29 13:15:31 $ - Version: $Revision: 1.47.2.3 $ + Date: $Date: 2008-10-24 15:18:54 $ + Version: $Revision: 1.47.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -507,10 +507,22 @@ void cmSourceFile::DefineProperties(cmake *cm) "or Resources directories."); cm->DefineProperty - ("OBJECT_DEPENDS", cmProperty::SOURCE_FILE, - "Additional dependencies.", - "Additional dependencies that should be checked as part of " - "building this source file."); + ("OBJECT_DEPENDS", cmProperty::SOURCE_FILE, + "Additional files on which a compiled object file depends.", + "Specifies a semicolon-separated list of full-paths to files on which " + "any object files compiled from this source file depend. " + "An object file will be recompiled if any of the named files is newer " + "than it.\n" + "This property need not be used to specify the dependency of a " + "source file on a generated header file that it includes. " + "Although the property was originally introduced for this purpose, it " + "is no longer necessary. " + "If the generated header file is created by a custom command in the " + "same target as the source file, the automatic dependency scanning " + "process will recognize the dependency. " + "If the generated header file is created by another target, an " + "inter-target dependency should be created with the add_dependencies " + "command (if one does not already exist due to linking relationships)."); cm->DefineProperty ("OBJECT_OUTPUTS", cmProperty::SOURCE_FILE, diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 1757060ba..98f5660c0 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmSystemTools.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:18 $ - Version: $Revision: 1.368.2.6 $ + Date: $Date: 2008-10-24 15:18:54 $ + Version: $Revision: 1.368.2.7 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -932,6 +932,7 @@ bool RunCommandViaPopen(const char* command, cmSystemTools::Stdout(buffer); } output += buffer; + buffer[0] = 0; fgets(buffer, BUFFER_SIZE, cpipe); } @@ -971,11 +972,13 @@ bool RunCommandViaPopen(const char* command, error << "SIGFPE"; break; #endif +#ifndef __HAIKU__ #ifdef SIGBUS case SIGBUS: error << "SIGBUS"; break; #endif +#endif #ifdef SIGSEGV case SIGSEGV: error << "SIGSEGV"; @@ -1698,7 +1701,7 @@ int cmSystemToolsGZStructOpen(void* call_data, const char *pathname, } // no fchmod on BeOS 5...do pathname instead. -#if defined(__BEOS__) && !defined(__ZETA__) +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) if ((oflags & O_CREAT) && chmod(pathname, mode)) { return -1; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 98917fe4b..25c00ad1e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmTarget.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:18 $ - Version: $Revision: 1.207.2.10 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.207.2.13 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -135,10 +135,19 @@ void cmTarget::DefineProperties(cmake *cm) cm->DefineProperty ("DEBUG_POSTFIX", cmProperty::TARGET, - "A postfix that will be applied to this target when build debug.", - "A property on a target that specifies a postfix to add to the " - "target name when built in debug mode. For example \"foo.dll\" " - "versus \"fooD.dll\". Ignored for Mac Frameworks and App Bundles."); + "See target property _POSTFIX.", + "This property is a special case of the more-general _POSTFIX " + "property for the DEBUG configuration."); + + cm->DefineProperty + ("_POSTFIX", cmProperty::TARGET, + "Postfix to append to the target file name for configuration .", + "When building with configuration the value of this property " + "is appended to the target file name built on disk. " + "For non-executable targets, this property is initialized by the value " + "of the variable CMAKE__POSTFIX if it is set when a target is " + "created. " + "This property is ignored on the Mac for Frameworks and App Bundles."); cm->DefineProperty ("EchoString", cmProperty::TARGET, @@ -376,22 +385,34 @@ void cmTarget::DefineProperties(cmake *cm) cm->DefineProperty ("LOCATION", cmProperty::TARGET, - "Deprecated. Use LOCATION_ or avoid altogether.", - "This property is provided for compatibility with CMake 2.4 and below. " + "Read-only location of a target on disk.", + "For an imported target, this read-only property returns the value of " + "the LOCATION_ property for an unspecified configuration " + " provided by the target.\n" + "For a non-imported target, this property is provided for compatibility " + "with CMake 2.4 and below. " "It was meant to get the location of an executable target's output file " "for use in add_custom_command. " + "The path may contain a build-system-specific portion that " + "is replaced at build time with the configuration getting built " + "(such as \"$(ConfigurationName)\" in VS). " "In CMake 2.6 and above add_custom_command automatically recognizes a " "target name in its COMMAND and DEPENDS options and computes the " - "target location. Therefore this property need not be used. " - "This property is not defined for IMPORTED targets because they " - "were not available in CMake 2.4 or below anyway."); + "target location. " + "Therefore this property is not needed for creating custom commands."); cm->DefineProperty ("LOCATION_", cmProperty::TARGET, "Read-only property providing a target location on disk.", "A read-only property that indicates where a target's main file is " "located on disk for the configuration . " - "The property is defined only for library and executable targets."); + "The property is defined only for library and executable targets. " + "An imported target may provide a set of configurations different " + "from that of the importing project. " + "By default CMake looks for an exact-match but otherwise uses an " + "arbitrary available configuration. " + "Use the MAP_IMPORTED_CONFIG_ property to map imported " + "configurations explicitly."); cm->DefineProperty ("LINK_INTERFACE_LIBRARIES", cmProperty::TARGET, @@ -527,6 +548,13 @@ void cmTarget::DefineProperties(cmake *cm) "A target property that can be set to override the suffix " "(such as \".so\") on a library name."); + cm->DefineProperty + ("TYPE", cmProperty::TARGET, + "The type of the target.", + "This read-only property can be used to test the type of the given " + "target. It will be one of STATIC_LIBRARY, MODULE_LIBRARY, " + "SHARED_LIBRARY, EXECUTABLE or one of the internal target types."); + cm->DefineProperty ("VERSION", cmProperty::TARGET, "What version number is this target.", @@ -655,6 +683,32 @@ void cmTarget::DefineProperties(cmake *cm) "The names returned are suitable for passing to the " "set_source_files_properties command."); + cm->DefineProperty + ("PROJECT_LABEL", cmProperty::TARGET, + "Change the name of a target in an IDE.", + "Can be used to change the name of the target in an IDE " + "like visual stuido. "); + cm->DefineProperty + ("VS_KEYWORD", cmProperty::TARGET, + "Visual Studio project keyword.", + "Can be set to change the visual studio keyword, for example " + "QT integration works better if this is set to Qt4VSv1.0. "); + cm->DefineProperty + ("VS_SCC_PROVIDER", cmProperty::TARGET, + "Visual Studio Source Code Control Provider.", + "Can be set to change the visual studio source code control " + "provider property."); + cm->DefineProperty + ("VS_SCC_LOCALPATH", cmProperty::TARGET, + "Visual Studio Source Code Control Provider.", + "Can be set to change the visual studio source code control " + "local path property."); + cm->DefineProperty + ("VS_SCC_PROJECTNAME", cmProperty::TARGET, + "Visual Studio Source Code Control Project.", + "Can be set to change the visual studio source code control " + "project name property."); + #if 0 cm->DefineProperty ("OBJECT_FILES", cmProperty::TARGET, @@ -1256,6 +1310,34 @@ const std::vector& cmTarget::GetLinkDirectories() return this->LinkDirectories; } +//---------------------------------------------------------------------------- +cmTarget::LinkLibraryType cmTarget::ComputeLinkType(const char* config) +{ + // No configuration is always optimized. + if(!(config && *config)) + { + return cmTarget::OPTIMIZED; + } + + // Get the list of configurations considered to be DEBUG. + std::vector const& debugConfigs = + this->Makefile->GetCMakeInstance()->GetDebugConfigs(); + + // Check if any entry in the list matches this configuration. + std::string configUpper = cmSystemTools::UpperCase(config); + for(std::vector::const_iterator i = debugConfigs.begin(); + i != debugConfigs.end(); ++i) + { + if(*i == configUpper) + { + return cmTarget::DEBUG; + } + } + + // The current configuration is not a debug configuration. + return cmTarget::OPTIMIZED; +} + //---------------------------------------------------------------------------- void cmTarget::ClearDependencyInformation( cmMakefile& mf, const char* target ) @@ -1850,6 +1932,11 @@ const char* cmTarget::NormalGetLocation(const char* config) this->Location += cfgid; this->Location += "/"; } + if(this->IsAppBundleOnApple()) + { + this->Location += this->GetFullName(config, false); + this->Location += ".app/Contents/MacOS/"; + } if(this->IsFrameworkOnApple()) { this->Location += this->GetFullName(config, false); @@ -1968,13 +2055,17 @@ const char *cmTarget::GetProperty(const char* prop, this->GetType() == cmTarget::MODULE_LIBRARY || this->GetType() == cmTarget::UNKNOWN_LIBRARY) { - if(!this->IsImported() && strcmp(prop,"LOCATION") == 0) + if(strcmp(prop,"LOCATION") == 0) { - // Set the LOCATION property of the target. Note that this + // Set the LOCATION property of the target. + // + // For an imported target this is the location of an arbitrary + // available configuration. + // + // For a non-imported target this is deprecated because it // cannot take into account the per-configuration name of the // target because the configuration type may not be known at - // CMake time. It is now deprecated as described in the - // documentation. + // CMake time. this->SetProperty("LOCATION", this->GetLocation(0)); } @@ -2360,6 +2451,11 @@ std::string cmTarget::NormalGetFullPath(const char* config, bool implib, std::string fpath = this->GetDirectory(config, implib); fpath += "/"; + if(this->IsAppBundleOnApple()) + { + fpath += this->GetFullName(config, false); + fpath += ".app/Contents/MacOS/"; + } if(this->IsFrameworkOnApple()) { fpath += this->GetFullName(config, false); @@ -3620,11 +3716,7 @@ cmTargetLinkInterface* cmTarget::ComputeLinkInterface(const char* config) } // Compute which library configuration to link. - cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED; - if(config && cmSystemTools::UpperCase(config) == "DEBUG") - { - linkType = cmTarget::DEBUG; - } + cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config); // Construct the list of libs linked for this configuration. cmTarget::LinkLibraryVectorType const& llibs = @@ -3672,9 +3764,6 @@ cmTargetLinkInterface* cmTarget::ComputeLinkInterface(const char* config) cmComputeLinkInformation* cmTarget::GetLinkInformation(const char* config) { - // Link information does not make sense for static libraries. - assert(this->GetType() != cmTarget::STATIC_LIBRARY); - // Lookup any existing information for this configuration. std::map::iterator i = this->LinkInformation.find(config?config:""); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 419adb1dd..144e41ea0 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmTarget.h,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:18 $ - Version: $Revision: 1.109.2.7 $ + Date: $Date: 2009-01-13 18:03:53 $ + Version: $Revision: 1.109.2.8 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -186,6 +186,9 @@ public: const LinkLibraryVectorType &GetOriginalLinkLibraries() const {return this->OriginalLinkLibraries;} + /** Compute the link type to use for the given configuration. */ + LinkLibraryType ComputeLinkType(const char* config); + /** * Clear the dependency information recorded for this target, if any. */ diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 96eb4c45e..5d85c976c 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmTargetLinkLibrariesCommand.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:18 $ - Version: $Revision: 1.25.2.1 $ + Date: $Date: 2009-01-13 18:03:53 $ + Version: $Revision: 1.25.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -188,28 +188,39 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, return; } + // Get the list of configurations considered to be DEBUG. + std::vector const& debugConfigs = + this->Makefile->GetCMakeInstance()->GetDebugConfigs(); + std::string prop; + // Include this library in the link interface for the target. - if(llt == cmTarget::DEBUG) + if(llt == cmTarget::DEBUG || llt == cmTarget::GENERAL) { - // Put in only the DEBUG configuration interface. - this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES_DEBUG", lib); + // Put in the DEBUG configuration interfaces. + for(std::vector::const_iterator i = debugConfigs.begin(); + i != debugConfigs.end(); ++i) + { + prop = "LINK_INTERFACE_LIBRARIES_"; + prop += *i; + this->Target->AppendProperty(prop.c_str(), lib); + } } - else if(llt == cmTarget::OPTIMIZED) + if(llt == cmTarget::OPTIMIZED || llt == cmTarget::GENERAL) { - // Put in only the non-DEBUG configuration interface. + // Put in the non-DEBUG configuration interfaces. this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES", lib); - // Make sure the DEBUG configuration interface exists so that this - // one will not be used as a fall-back. - if(!this->Target->GetProperty("LINK_INTERFACE_LIBRARIES_DEBUG")) + // Make sure the DEBUG configuration interfaces exist so that the + // general one will not be used as a fall-back. + for(std::vector::const_iterator i = debugConfigs.begin(); + i != debugConfigs.end(); ++i) { - this->Target->SetProperty("LINK_INTERFACE_LIBRARIES_DEBUG", ""); + prop = "LINK_INTERFACE_LIBRARIES_"; + prop += *i; + if(!this->Target->GetProperty(prop.c_str())) + { + this->Target->SetProperty(prop.c_str(), ""); + } } } - else - { - // Put in both the DEBUG and non-DEBUG configuration interfaces. - this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES", lib); - this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES_DEBUG", lib); - } } diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index e4161f620..3b30d1e7d 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmTargetLinkLibrariesCommand.h,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:18 $ - Version: $Revision: 1.15.2.1 $ + Date: $Date: 2009-01-13 18:03:53 $ + Version: $Revision: 1.15.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -74,7 +74,9 @@ public: "A \"debug\", \"optimized\", or \"general\" keyword indicates that " "the library immediately following it is to be used only for the " "corresponding build configuration. " - "The \"debug\" keyword corresponds to the Debug configuration. " + "The \"debug\" keyword corresponds to the Debug configuration " + "(or to configurations named in the DEBUG_CONFIGURATIONS global " + "property if it is set). " "The \"optimized\" keyword corresponds to all other configurations. " "The \"general\" keyword corresponds to all configurations, and is " "purely optional (assumed if omitted). " @@ -93,14 +95,16 @@ public: " target_link_libraries( LINK_INTERFACE_LIBRARIES\n" " [[debug|optimized|general] ] ...)\n" "The LINK_INTERFACE_LIBRARIES mode appends the libraries " - "to the LINK_INTERFACE_LIBRARIES and LINK_INTERFACE_LIBRARIES_DEBUG " + "to the LINK_INTERFACE_LIBRARIES and its per-configuration equivalent " "target properties instead of using them for linking. " "Libraries specified as \"debug\" are appended to the " - "the LINK_INTERFACE_LIBRARIES_DEBUG property. " + "the LINK_INTERFACE_LIBRARIES_DEBUG property (or to the properties " + "corresponding to configurations listed in the DEBUG_CONFIGURATIONS " + "global property if it is set). " "Libraries specified as \"optimized\" are appended to the " "the LINK_INTERFACE_LIBRARIES property. " "Libraries specified as \"general\" (or without any keyword) are " - "appended to both properties." + "treated as if specified for both \"debug\" and \"optimized\"." ; } diff --git a/Source/cmUnsetCommand.cxx b/Source/cmUnsetCommand.cxx new file mode 100644 index 000000000..aaaf37ad9 --- /dev/null +++ b/Source/cmUnsetCommand.cxx @@ -0,0 +1,64 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmUnsetCommand.cxx,v $ + Language: C++ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.1.2.2 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "cmUnsetCommand.h" + +// cmUnsetCommand +bool cmUnsetCommand::InitialPass(std::vector const& args, + cmExecutionStatus &) +{ + if(args.size() < 1 || args.size() > 2) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + + const char* variable = args[0].c_str(); + + // unset(ENV{VAR}) + if (!strncmp(variable,"ENV{",4) && strlen(variable) > 5) + { + // what is the variable name + char *envVarName = new char [strlen(variable)]; + strncpy(envVarName,variable+4,strlen(variable)-5); + envVarName[strlen(variable)-5] = '\0'; + +#ifdef CMAKE_BUILD_WITH_CMAKE + cmSystemTools::UnsetEnv(envVarName); +#endif + delete[] envVarName; + return true; + } + // unset(VAR) + else if (args.size() == 1) + { + this->Makefile->RemoveDefinition(variable); + return true; + } + // unset(VAR CACHE) + else if ((args.size() == 2) && (args[1] == "CACHE")) + { + this->Makefile->RemoveCacheDefinition(variable); + return true; + } + // ERROR: second argument isn't CACHE + else + { + this->SetError("called with an invalid second argument"); + return false; + } +} + diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h new file mode 100644 index 000000000..95129cb81 --- /dev/null +++ b/Source/cmUnsetCommand.h @@ -0,0 +1,84 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmUnsetCommand.h,v $ + Language: C++ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.1.2.2 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef cmUnsetCommand_h +#define cmUnsetCommand_h + +#include "cmCommand.h" + +/** \class cmUnsetCommand + * \brief Unset a CMAKE variable + * + * cmUnsetCommand unsets or removes a variable. + */ +class cmUnsetCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmUnsetCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); + + /** + * This determines if the command is invoked when in script mode. + */ + virtual bool IsScriptable() { return true; } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() {return "unset";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Unset a variable, cache variable, or environment variable."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + " unset( [CACHE])\n" + "Removes the specified variable causing it to become undefined. " + "If CACHE is present then the variable is removed from the cache " + "instead of the current scope.\n" + " can be an environment variable such as:\n" + " unset(ENV{LD_LIBRARY_PATH})\n" + "in which case the variable will be removed from the current " + "environment."; + } + + cmTypeMacro(cmUnsetCommand, cmCommand); +}; + + + +#endif diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index c8d8e4ee8..0b9257e4e 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmWhileCommand.cxx,v $ Language: C++ - Date: $Date: 2008-03-01 02:33:33 $ - Version: $Revision: 1.12 $ + Date: $Date: 2009-02-04 16:44:17 $ + Version: $Revision: 1.12.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -21,13 +21,6 @@ bool cmWhileFunctionBlocker:: IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmExecutionStatus &inStatus) { - // Prevent recusion and don't let this blocker block its own - // commands. - if (this->Executing) - { - return false; - } - // at end of for each execute recorded commands if (!cmSystemTools::Strucmp(lff.Name.c_str(),"while")) { @@ -39,14 +32,18 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // if this is the endwhile for this while loop then execute if (!this->Depth) { - char* errorString = 0; + // Remove the function blocker for this scope or bail. + cmsys::auto_ptr + fb(mf.RemoveFunctionBlocker(this, lff)); + if(!fb.get()) { return false; } + + std::string errorString; std::vector expandedArguments; mf.ExpandArguments(this->Args, expandedArguments); bool isTrue = - cmIfCommand::IsTrue(expandedArguments,&errorString,&mf); + cmIfCommand::IsTrue(expandedArguments,errorString,&mf); - this->Executing = true; while (isTrue) { // Invoke all the functions that were collected in the block. @@ -57,21 +54,18 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, if (status.GetReturnInvoked()) { inStatus.SetReturnInvoked(true); - mf.RemoveFunctionBlocker(lff); return true; } if (status.GetBreakInvoked()) { - mf.RemoveFunctionBlocker(lff); return true; } } expandedArguments.clear(); mf.ExpandArguments(this->Args, expandedArguments); isTrue = - cmIfCommand::IsTrue(expandedArguments,&errorString,&mf); + cmIfCommand::IsTrue(expandedArguments,errorString,&mf); } - mf.RemoveFunctionBlocker(lff); return true; } else @@ -104,15 +98,6 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& ) return false; } -void cmWhileFunctionBlocker:: -ScopeEnded(cmMakefile &mf) -{ - cmSystemTools::Error( - "The end of a CMakeLists file was reached with a WHILE statement that " - "was not closed properly. Within the directory: ", - mf.GetCurrentDirectory()); -} - bool cmWhileCommand ::InvokeInitialPass(const std::vector& args, cmExecutionStatus &) diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index 5021b2887..321c78894 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmWhileCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.9 $ + Date: $Date: 2009-02-04 16:44:18 $ + Version: $Revision: 1.9.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -29,17 +29,15 @@ class cmWhileFunctionBlocker : public cmFunctionBlocker { public: - cmWhileFunctionBlocker() {Executing = false; Depth=0;} + cmWhileFunctionBlocker() {this->Depth=0;} virtual ~cmWhileFunctionBlocker() {} virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); - virtual void ScopeEnded(cmMakefile &mf); std::vector Args; std::vector Functions; - bool Executing; private: int Depth; }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index cd8974b1a..f4cec5351 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmake.cxx,v $ Language: C++ - Date: $Date: 2008-09-04 21:10:45 $ - Version: $Revision: 1.375.2.13 $ + Date: $Date: 2009-01-13 18:03:53 $ + Version: $Revision: 1.375.2.16 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -1173,8 +1173,8 @@ int cmake::ExecuteCMakeCommand(std::vector& args) time(&time_start); clock_start = clock(); - - cmSystemTools::RunSingleCommand(command.c_str()); + int ret =0; + cmSystemTools::RunSingleCommand(command.c_str(), 0, &ret); clock_finish = clock(); time(&time_finish); @@ -1186,7 +1186,7 @@ int cmake::ExecuteCMakeCommand(std::vector& args) << static_cast(clock_finish - clock_start) / clocks_per_sec << " s. (clock)" << "\n"; - return 0; + return ret; } // Command to calculate the md5sum of a file @@ -3363,6 +3363,19 @@ void cmake::DefineProperties(cmake *cm) "Internal property", "Used to detect compiler changes, Do not set."); + cm->DefineProperty( + "DEBUG_CONFIGURATIONS", cmProperty::GLOBAL, + "Specify which configurations are for debugging.", + "The value must be a semi-colon separated list of configuration names. " + "Currently this property is used only by the target_link_libraries " + "command (see its documentation for details). " + "Additional uses may be defined in the future. " + "\n" + "This property must be set at the top level of the project and before " + "the first target_link_libraries command invocation. " + "If any entry in the list does not match a valid configuration for " + "the project the behavior is undefined."); + cm->DefineProperty( "GLOBAL_DEPENDS_DEBUG_MODE", cmProperty::GLOBAL, "Enable global target dependency graph debug mode.", @@ -3551,6 +3564,12 @@ void cmake::SetProperty(const char* prop, const char* value) return; } + // Special hook to invalidate cached value. + if(strcmp(prop, "DEBUG_CONFIGURATIONS") == 0) + { + this->DebugConfigs.clear(); + } + this->Properties.SetProperty(prop, value, cmProperty::GLOBAL); } @@ -3560,6 +3579,13 @@ void cmake::AppendProperty(const char* prop, const char* value) { return; } + + // Special hook to invalidate cached value. + if(strcmp(prop, "DEBUG_CONFIGURATIONS") == 0) + { + this->DebugConfigs.clear(); + } + this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL); } @@ -3937,7 +3963,8 @@ int cmake::VisualStudioLink(std::vector& args, int type) std::cout << "Visual Studio Incremental Link without manifests\n"; } } - return cmake::VisualStudioLinkNonIncremental(expandedArgs, type, hasManifest, verbose); + return cmake::VisualStudioLinkNonIncremental(expandedArgs, + type, hasManifest, verbose); } int cmake::ParseVisualStudioLinkCommand(std::vector& args, @@ -4270,3 +4297,28 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, cmSystemTools::Message(msg.str().c_str(), "Warning"); } } + +//---------------------------------------------------------------------------- +std::vector const& cmake::GetDebugConfigs() +{ + // Compute on-demand. + if(this->DebugConfigs.empty()) + { + if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS")) + { + // Expand the specified list and convert to upper-case. + cmSystemTools::ExpandListArgument(config_list, this->DebugConfigs); + for(std::vector::iterator i = this->DebugConfigs.begin(); + i != this->DebugConfigs.end(); ++i) + { + *i = cmSystemTools::UpperCase(*i); + } + } + // If no configurations were specified, use a default list. + if(this->DebugConfigs.empty()) + { + this->DebugConfigs.push_back("DEBUG"); + } + } + return this->DebugConfigs; +} diff --git a/Source/cmake.h b/Source/cmake.h index a1550c450..d3e8bdd84 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmake.h,v $ Language: C++ - Date: $Date: 2008-08-06 21:04:20 $ - Version: $Revision: 1.109.2.6 $ + Date: $Date: 2009-01-13 18:03:54 $ + Version: $Revision: 1.109.2.7 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -332,6 +332,10 @@ class cmake bool IsPropertyDefined(const char *name, cmProperty::ScopeType scope); bool IsPropertyChained(const char *name, cmProperty::ScopeType scope); + /** Get the list of configurations (in upper case) considered to be + debugging configurations.*/ + std::vector const& GetDebugConfigs(); + // record accesses of properties and variables void RecordPropertyAccess(const char *name, cmProperty::ScopeType scope); void ReportUndefinedPropertyAccesses(const char *filename); @@ -456,6 +460,7 @@ private: bool DebugTryCompile; cmFileTimeComparison* FileComparison; std::string GraphVizFile; + std::vector DebugConfigs; void UpdateConversionPathTable(); }; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 4f1751eac..dbe3e2f94 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmakemain.cxx,v $ Language: C++ - Date: $Date: 2008-09-03 13:43:18 $ - Version: $Revision: 1.80.2.3 $ + Date: $Date: 2008-10-24 15:18:55 $ + Version: $Revision: 1.80.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -68,7 +68,11 @@ static const char * cmDocumentationOptions[][3] = {"-E", "CMake command mode.", "For true platform independence, CMake provides a list of commands " "that can be used on all systems. Run with -E help for the usage " - "information."}, + "information. Commands availble are: chdir, copy, copy_if_different " + "copy_directory, compare_files, echo, echo_append, environment, " + "make_directory, md5sum, remove_directory, remove, tar, time, " + "touch, touch_nocreate, write_regv, delete_regv, comspec, " + "create_symlink."}, {"-i", "Run in wizard mode.", "Wizard mode runs cmake interactively without a GUI. The user is " "prompted to answer questions about the project configuration. " @@ -97,7 +101,11 @@ static const char * cmDocumentationOptions[][3] = "additional information such as the cache, log files etc."}, {"--debug-trycompile", "Do not delete the try compile directories..", "Do not delete the files and directories created for try_compile calls. " - "This is useful in debugging failed try_compiles."}, + "This is useful in debugging failed try_compiles. It may however " + "change the results of the try-compiles as old junk from a previous " + "try-compile may cause a different test to either pass or fail " + "incorrectly. This option is best used for one try-compile at a time, " + "and only when debugging." }, {"--debug-output", "Put cmake in a debug mode.", "Print extra stuff during the cmake run like stack traces with " "message(send_error ) calls."}, diff --git a/Source/kwsys/CTestConfig.cmake b/Source/kwsys/CTestConfig.cmake index 23a5bd172..e4e7b0da1 100644 --- a/Source/kwsys/CTestConfig.cmake +++ b/Source/kwsys/CTestConfig.cmake @@ -1,3 +1,7 @@ -SET (CTEST_PROJECT_NAME "kwsys") -SET (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -SET (CTEST_DART_SERVER_VERSION "2") +set (CTEST_PROJECT_NAME "kwsys") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx index 28fb208cb..6d0671d94 100644 --- a/Source/kwsys/DynamicLoader.cxx +++ b/Source/kwsys/DynamicLoader.cxx @@ -336,10 +336,13 @@ const char* DynamicLoader::LastError() // --------------------------------------------------------------- // 4. Implementation for BeOS -#ifdef __BEOS__ +#if defined __BEOS__ + #include // for strerror() + #include #include + #define DYNAMICLOADER_DEFINED 1 namespace KWSYS_NAMESPACE diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 02b703e45..0f9a749cf 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -63,6 +63,10 @@ do. #include /* DIR, dirent */ #include /* isspace */ +#ifdef __HAIKU__ +#undef __BEOS__ +#endif + #if defined(KWSYS_C_HAS_PTRDIFF_T) && KWSYS_C_HAS_PTRDIFF_T typedef ptrdiff_t kwsysProcess_ptrdiff_t; #else @@ -75,7 +79,7 @@ typedef ssize_t kwsysProcess_ssize_t; typedef int kwsysProcess_ssize_t; #endif -#if defined(__BEOS__) && !defined(__ZETA__) +#if defined(__BEOS__) && !defined(__ZETA__) /* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */ # include static inline void kwsysProcess_usleep(unsigned int msec) @@ -719,7 +723,8 @@ void kwsysProcess_Execute(kwsysProcess* cp) if(cp->WorkingDirectory) { int r; - if(!getcwd(cp->RealWorkingDirectory, cp->RealWorkingDirectoryLength)) + if(!getcwd(cp->RealWorkingDirectory, + (size_t)(cp->RealWorkingDirectoryLength))) { kwsysProcessCleanup(cp, 1); return; diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c index d9d0dca64..831f3f013 100644 --- a/Source/kwsys/System.c +++ b/Source/kwsys/System.c @@ -170,6 +170,12 @@ flag later when we understand applications of this better. static int kwsysSystem_Shell__ArgumentNeedsQuotes(const char* in, int isUnix, int flags) { + /* The empty string needs quotes. */ + if(!*in) + { + return 1; + } + /* Scan the string for characters that require quoting. */ { const char* c; diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 5eb16a96e..5b21c0158 100755 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -3,8 +3,8 @@ Program: BatchMake Module: $RCSfile: SystemInformation.cxx,v $ Language: C++ - Date: $Date: 2008-06-13 12:55:18 $ - Version: $Revision: 1.22.2.4 $ + Date: $Date: 2008-12-31 15:14:33 $ + Version: $Revision: 1.22.2.6 $ Copyright (c) 2005 Insight Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. @@ -13,6 +13,10 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifdef _WIN32 +# include // WSADATA, include before sys/types.h +#endif + #include "kwsysPrivate.h" #include KWSYS_HEADER(FundamentalType.h) #include KWSYS_HEADER(stl/string) @@ -2147,14 +2151,14 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() FILE *fd = fopen("/proc/cpuinfo", "r" ); if ( !fd ) { - kwsys_ios::cout << "Problem opening /proc/cpuinfo" << kwsys_stl::endl; + kwsys_ios::cout << "Problem opening /proc/cpuinfo" << kwsys_ios::endl; return 0; } size_t fileSize = 0; while(!feof(fd)) { - buffer += fgetc(fd); + buffer += static_cast(fgetc(fd)); fileSize++; } fclose( fd ); @@ -2279,7 +2283,7 @@ int SystemInformationImplementation::QueryMemory() int errorFlag = uname(&unameInfo); if( errorFlag!=0 ) { - kwsys_ios::cout << "Problem calling uname(): " << strerror(errno) << kwsys_stl::endl; + kwsys_ios::cout << "Problem calling uname(): " << strerror(errno) << kwsys_ios::endl; return 0; } @@ -2303,7 +2307,7 @@ int SystemInformationImplementation::QueryMemory() FILE *fd = fopen("/proc/meminfo", "r" ); if ( !fd ) { - kwsys_ios::cout << "Problem opening /proc/meminfo" << kwsys_stl::endl; + kwsys_ios::cout << "Problem opening /proc/meminfo" << kwsys_ios::endl; return 0; } @@ -2496,7 +2500,7 @@ unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void) #if USE_ASM_INSTRUCTIONS if (!this->IsHyperThreadingSupported()) { - return (unsigned char) 1; // HT not supported + return static_cast(1); // HT not supported } __asm { @@ -2505,7 +2509,7 @@ unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void) mov Regebx, ebx } #endif - return (unsigned char) ((Regebx & NUM_LOGICAL_BITS) >> 16); + return static_cast ((Regebx & NUM_LOGICAL_BITS) >> 16); } /** Works only for windows */ @@ -2561,7 +2565,7 @@ unsigned char SystemInformationImplementation::GetAPICId() #if USE_ASM_INSTRUCTIONS if (!this->IsHyperThreadingSupported()) { - return (unsigned char) -1; // HT not supported + return static_cast(-1); // HT not supported } // Logical processor = 1 __asm { @@ -2570,7 +2574,7 @@ unsigned char SystemInformationImplementation::GetAPICId() mov Regebx, ebx } #endif - return (unsigned char) ((Regebx & INITIAL_APIC_ID_BITS) >> 24); + return static_cast((Regebx & INITIAL_APIC_ID_BITS) >> 24); } /** Count the number of CPUs. Works only on windows. */ @@ -2723,7 +2727,7 @@ bool SystemInformationImplementation::ParseSysCtl() this->NumberOfLogicalCPU /= this->NumberOfPhysicalCPU; } - this->CPUSpeedInMHz = atoi(this->ExtractValueFromSysCtl("hw.cpufrequency:").c_str()); + this->CPUSpeedInMHz = static_cast(atoi(this->ExtractValueFromSysCtl("hw.cpufrequency:").c_str())); this->CPUSpeedInMHz /= 1000000; // Chip family @@ -2810,7 +2814,7 @@ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector< { // Should not get here. kwsys_ios::cerr << "Unexpected ending state after running " << args[0] - << kwsys_stl::endl; + << kwsys_ios::endl; } break; } kwsysProcess_Delete(gp); @@ -2893,7 +2897,7 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha bool SystemInformationImplementation::QuerySolarisInfo() { // Parse values - this->NumberOfPhysicalCPU = atoi(this->ParseValueFromKStat("-n systethis->misc -s ncpus").c_str()); + this->NumberOfPhysicalCPU = atoi(this->ParseValueFromKStat("-n syste_misc -s ncpus").c_str()); this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU; if(this->NumberOfPhysicalCPU!=0) @@ -2901,7 +2905,7 @@ bool SystemInformationImplementation::QuerySolarisInfo() this->NumberOfLogicalCPU /= this->NumberOfPhysicalCPU; } - this->CPUSpeedInMHz = atoi(this->ParseValueFromKStat("-s clock_MHz").c_str()); + this->CPUSpeedInMHz = static_cast(atoi(this->ParseValueFromKStat("-s clock_MHz").c_str())); // Chip family this->ChipID.Family = 0; @@ -2980,15 +2984,22 @@ bool SystemInformationImplementation::QueryOSInformation() { if (osvi.wProductType == VER_NT_WORKSTATION) { -// VER_SUITE_PERSONAL may not be defined -#ifdef VER_SUITE_PERSONAL - if (osvi.wSuiteMask & VER_SUITE_PERSONAL) + if (osvi.dwMajorVersion == 6) { - this->OSRelease += " Personal"; + this->OSRelease = "Vista"; } - else +// VER_SUITE_PERSONAL may not be defined +#ifdef VER_SUITE_PERSONAL + else { - this->OSRelease += " Professional"; + if (osvi.wSuiteMask & VER_SUITE_PERSONAL) + { + this->OSRelease += " Personal"; + } + else + { + this->OSRelease += " Professional"; + } } #endif } @@ -3015,7 +3026,7 @@ bool SystemInformationImplementation::QueryOSInformation() } } - sprintf (operatingSystem, "%s(Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); + sprintf (operatingSystem, "%s (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); this->OSVersion = operatingSystem; } else @@ -3095,7 +3106,7 @@ bool SystemInformationImplementation::QueryOSInformation() else { // Windows 2000 and everything else. - sprintf (operatingSystem,"%s(Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); + sprintf (operatingSystem,"%s (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); this->OSVersion = operatingSystem; } break; diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 077dfcd5a..d9336c75d 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -131,7 +131,12 @@ public: #define _chdir chdir #endif -#if defined(__BEOS__) && !defined(__ZETA__) +#if defined(__HAIKU__) +#include +#include +#endif + +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) #include #include @@ -1606,7 +1611,8 @@ kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path) } bool SystemTools::CopyFileIfDifferent(const char* source, - const char* destination) + const char* destination, + bool copyPermissions) { // special check for a destination that is a directory // FilesDiffer does not handle file to directory compare @@ -1619,7 +1625,8 @@ bool SystemTools::CopyFileIfDifferent(const char* source, new_destination += SystemTools::GetFilenameName(source_name); if(SystemTools::FilesDiffer(source, new_destination.c_str())) { - return SystemTools::CopyFileAlways(source, destination); + return SystemTools::CopyFileAlways(source, destination, + copyPermissions); } else { @@ -1632,7 +1639,7 @@ bool SystemTools::CopyFileIfDifferent(const char* source, // are different if(SystemTools::FilesDiffer(source, destination)) { - return SystemTools::CopyFileAlways(source, destination); + return SystemTools::CopyFileAlways(source, destination, copyPermissions); } // at this point the files must be the same so return true return true; @@ -1713,10 +1720,12 @@ bool SystemTools::FilesDiffer(const char* source, } +//---------------------------------------------------------------------------- /** * Copy a file named by "source" to the file named by "destination". */ -bool SystemTools::CopyFileAlways(const char* source, const char* destination) +bool SystemTools::CopyFileAlways(const char* source, const char* destination, + bool copyPermissions) { // If files are the same do not copy if ( SystemTools::SameFile(source, destination) ) @@ -1819,7 +1828,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination) { return false; } - if ( perms ) + if ( copyPermissions && perms ) { if ( !SystemTools::SetPermissions(destination, perm) ) { @@ -1831,15 +1840,15 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination) //---------------------------------------------------------------------------- bool SystemTools::CopyAFile(const char* source, const char* destination, - bool always) + bool always, bool copyPermissions) { if(always) { - return SystemTools::CopyFileAlways(source, destination); + return SystemTools::CopyFileAlways(source, destination, copyPermissions); } else { - return SystemTools::CopyFileIfDifferent(source, destination); + return SystemTools::CopyFileIfDifferent(source, destination, copyPermissions); } } @@ -1848,7 +1857,7 @@ bool SystemTools::CopyAFile(const char* source, const char* destination, * "destination". */ bool SystemTools::CopyADirectory(const char* source, const char* destination, - bool always) + bool always, bool copyPermissions) { Directory dir; dir.Load(source); @@ -1872,14 +1881,16 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination, fullDestPath += dir.GetFile(static_cast(fileNum)); if (!SystemTools::CopyADirectory(fullPath.c_str(), fullDestPath.c_str(), - always)) + always, + copyPermissions)) { return false; } } else { - if(!SystemTools::CopyAFile(fullPath.c_str(), destination, always)) + if(!SystemTools::CopyAFile(fullPath.c_str(), destination, always, + copyPermissions)) { return false; } @@ -3382,7 +3393,7 @@ kwsys_stl::string SystemTools::GetFilenameExtension(const kwsys_stl::string& fil /** * Return file extension of a full filename (dot included). - * Warning: this is the shortest extension (for example: .tar.gz) + * Warning: this is the shortest extension (for example: .gz of .tar.gz) */ kwsys_stl::string SystemTools::GetFilenameLastExtension(const kwsys_stl::string& filename) { @@ -4165,6 +4176,22 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() // Test for the specific product family. + if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0) + { +#if (_MSC_VER >= 1300) + if (osvi.wProductType == VER_NT_WORKSTATION) + { + res += "Microsoft Windows Vista"; + } + else + { + res += "Microsoft Windows Server 2008 family"; + } +#else + res += "Microsoft Windows Vista or Windows Server 2008"; +#endif + } + if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) { res += "Microsoft Windows Server 2003 family"; @@ -4198,13 +4225,16 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() { res += " Workstation 4.0"; } - else if (osvi.wSuiteMask & VER_SUITE_PERSONAL) - { - res += " Home Edition"; - } - else + else if (osvi.dwMajorVersion == 5) { - res += " Professional"; + if (osvi.wSuiteMask & VER_SUITE_PERSONAL) + { + res += " Home Edition"; + } + else + { + res += " Professional"; + } } } @@ -4248,7 +4278,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() } } - else // Windows NT 4.0 + else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0 { if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) { diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 986708f2a..c637bfc98 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -490,33 +490,42 @@ public: /** * Copy the source file to the destination file only - * if the two files differ. + * if the two files differ. If the "copyPermissions" + * argument is true, the permissions of the copy are + * set to be the same as the permissions of the + * original. */ static bool CopyFileIfDifferent(const char* source, - const char* destination); - + const char* destination, + bool copyPermissions = true); + /** * Compare the contents of two files. Return true if different */ static bool FilesDiffer(const char* source, const char* destination); - + /** * Return true if the two files are the same file */ static bool SameFile(const char* file1, const char* file2); /** - * Copy a file + * Copy a file. If the "copyPermissions" argument is true, the + * permissions of the copy are set to be the same as the permissions + * of the original. */ - static bool CopyFileAlways(const char* source, const char* destination); + static bool CopyFileAlways(const char* source, const char* destination, + bool copyPermissions = true); /** * Copy a file. If the "always" argument is true the file is always * copied. If it is false, the file is copied only if it is new or - * has changed. + * has changed. If the "copyPermissions" argument is true, the + * permissions of the copy are set to be the same as the permissions + * of the original. */ static bool CopyAFile(const char* source, const char* destination, - bool always = true); + bool always = true, bool copyPermissions = true); /** * Copy content directory to another directory with all files and @@ -525,7 +534,7 @@ public: * are new are copied. */ static bool CopyADirectory(const char* source, const char* destination, - bool always = true); + bool always = true, bool copyPermissions = true); /** * Remove a file diff --git a/Source/kwsys/testDynamicLoader.cxx b/Source/kwsys/testDynamicLoader.cxx index d3abc7702..c16959947 100644 --- a/Source/kwsys/testDynamicLoader.cxx +++ b/Source/kwsys/testDynamicLoader.cxx @@ -17,10 +17,14 @@ #include KWSYS_HEADER(ios/iostream) #include KWSYS_HEADER(stl/string) -#if defined(__BEOS__) +#if defined(__BEOS__) && !defined(__HAIKU__) #include /* disable_debugger() API. */ #endif +#if defined(__HAIKU__) +#include /* disable_debugger() API. */ +#endif + // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 @@ -94,7 +98,7 @@ int testDynamicLoader(int argc, char *argv[]) { #if defined(_WIN32) SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); -#elif defined(__BEOS__) +#elif defined(__BEOS__) || defined(__HAIKU__) disable_debugger(1); #endif int res = 0; diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c index df69ded4a..b38279dd5 100644 --- a/Source/kwsys/testProcess.c +++ b/Source/kwsys/testProcess.c @@ -34,7 +34,7 @@ # pragma warn -8060 /* possibly incorrect assignment */ #endif -#if defined(__BEOS__) && !defined(__ZETA__) +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) /* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */ # include static inline void testProcess_usleep(unsigned int msec) @@ -87,7 +87,7 @@ int test4(int argc, const char* argv[]) #if defined(_WIN32) /* Avoid error diagnostic popups since we are crashing on purpose. */ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); -#elif defined(__BEOS__) +#elif defined(__BEOS__) || defined(__HAIKU__) /* Avoid error diagnostic popups since we are crashing on purpose. */ disable_debugger(1); #endif @@ -457,7 +457,7 @@ int main(int argc, const char* argv[]) int values[8] = {0, 123, 1, 1, 0, 0, 0, 0}; int outputs[8] = {1, 1, 1, 1, 1, 0, 1, 1}; int delays[8] = {0, 0, 0, 0, 0, 1, 0, 0}; - double timeouts[8] = {10, 10, 10, 10, 30, 10, -1, 10}; + double timeouts[8] = {10, 10, 10, 30, 30, 10, -1, 10}; int polls[8] = {0, 0, 0, 0, 0, 0, 1, 0}; int repeat[8] = {2, 1, 1, 1, 1, 1, 1, 1}; int r; diff --git a/Templates/DLLHeader.dsptemplate b/Templates/DLLHeader.dsptemplate index dcc51eaef..e82c7de73 100644 --- a/Templates/DLLHeader.dsptemplate +++ b/Templates/DLLHeader.dsptemplate @@ -66,6 +66,8 @@ RSC=rc.exe # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_RELEASE BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -98,6 +100,8 @@ CMAKE_CUSTOM_RULE_CODE_RELEASE # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "_DEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_DEBUG BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -132,6 +136,8 @@ CMAKE_CUSTOM_RULE_CODE_DEBUG # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_MINSIZEREL BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -164,6 +170,8 @@ CMAKE_CUSTOM_RULE_CODE_MINSIZEREL # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_RELWITHDEBINFO BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo diff --git a/Templates/EXEHeader.dsptemplate b/Templates/EXEHeader.dsptemplate index d05fb4b01..d7b057c6d 100644 --- a/Templates/EXEHeader.dsptemplate +++ b/Templates/EXEHeader.dsptemplate @@ -63,6 +63,8 @@ RSC=rc.exe # ADD CPP CMAKE_CXX_FLAGS_RELEASE # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_RELEASE BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -95,6 +97,8 @@ CMAKE_CUSTOM_RULE_CODE_RELEASE # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "_DEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_DEBUG BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -124,6 +128,8 @@ CMAKE_CUSTOM_RULE_CODE_DEBUG # ADD CPP CMAKE_CXX_FLAGS_MINSIZEREL # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_MINSIZEREL BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -154,6 +160,8 @@ CMAKE_CUSTOM_RULE_CODE_MINSIZEREL # ADD CPP CMAKE_CXX_FLAGS_RELWITHDEBINFO # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_RELWITHDEBINFO BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo diff --git a/Templates/EXEWinHeader.dsptemplate b/Templates/EXEWinHeader.dsptemplate index 77e1116ea..bf8635abe 100644 --- a/Templates/EXEWinHeader.dsptemplate +++ b/Templates/EXEWinHeader.dsptemplate @@ -65,6 +65,8 @@ RSC=rc.exe # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_RELEASE BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -97,6 +99,8 @@ CMAKE_CUSTOM_RULE_CODE_RELEASE # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "_DEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_DEBUG BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -126,6 +130,8 @@ CMAKE_CUSTOM_RULE_CODE_DEBUG # ADD CPP CMAKE_CXX_FLAGS_MINSIZEREL # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_MINSIZEREL BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -158,6 +164,8 @@ CMAKE_CUSTOM_RULE_CODE_MINSIZEREL # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_RELWITHDEBINFO BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in index 41fccaeb1..9e5303004 100644 --- a/Templates/TestDriver.cxx.in +++ b/Templates/TestDriver.cxx.in @@ -29,7 +29,14 @@ functionMapEntry cmakeGeneratedFunctionMapEntries[] = { char* lowercase(const char *string) { char *new_string, *p; - new_string = (char *)malloc(sizeof(char) * (size_t)(strlen(string) + 1)); + +#ifdef __cplusplus + new_string = static_cast(malloc(sizeof(char) * + static_cast(strlen(string) + 1))); +#else + new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1))); +#endif + if (!new_string) { return 0; @@ -38,7 +45,12 @@ char* lowercase(const char *string) p = new_string; while (*p != 0) { - *p = (char)tolower(*p); +#ifdef __cplusplus + *p = static_cast(tolower(*p)); +#else + *p = (char)(tolower(*p)); +#endif + ++p; } return new_string; @@ -70,7 +82,11 @@ int main(int ac, char *av[]) printf("To run a test, enter the test number: "); fflush(stdout); testNum = 0; - scanf("%d", &testNum); + if( scanf("%d", &testNum) != 1 ) + { + printf("Couldn't parse that input as a number\n"); + return -1; + } if (testNum >= NumTests) { printf("%3d is an invalid test number.\n", testNum); diff --git a/Templates/staticLibHeader.dsptemplate b/Templates/staticLibHeader.dsptemplate index da0850a81..0bfb6c9e5 100644 --- a/Templates/staticLibHeader.dsptemplate +++ b/Templates/staticLibHeader.dsptemplate @@ -60,6 +60,8 @@ RSC=rc.exe # ADD CPP CMAKE_CXX_FLAGS_RELEASE # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_RELEASE BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -88,6 +90,8 @@ CMAKE_CUSTOM_RULE_CODE_RELEASE # ADD CPP CMAKE_CXX_FLAGS_DEBUG # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "_DEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_DEBUG BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -117,6 +121,8 @@ CMAKE_CUSTOM_RULE_CODE_DEBUG # ADD CPP CMAKE_CXX_FLAGS_MINSIZEREL # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_MINSIZEREL BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -145,6 +151,8 @@ CMAKE_CUSTOM_RULE_CODE_MINSIZEREL # ADD CPP CMAKE_CXX_FLAGS_RELWITHDEBINFO # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC COMPILE_DEFINITIONS +# ADD RSC COMPILE_DEFINITIONS_RELWITHDEBINFO BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index f2ff228fb..81d1f749f 100755 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -91,6 +91,8 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(SourceGroups SourceGroups) ADD_TEST_MACRO(Preprocess Preprocess) ADD_TEST_MACRO(ExportImport ExportImport) + ADD_TEST_MACRO(PolicyScope PolicyScope) + ADD_TEST_MACRO(Unset Unset) # test for correct sub-project generation # not implemented in VS6 or Xcode @@ -719,6 +721,60 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel ) ENDIF(APPLE AND CTEST_TEST_CPACK) + SET(CTEST_TEST_UPDATE 1) + IF(CTEST_TEST_UPDATE) + # Test CTest Update with Subversion + FIND_PACKAGE(Subversion QUIET) + IF(Subversion_FOUND) + GET_FILENAME_COMPONENT(_Subversion_BIN_DIR + ${Subversion_SVN_EXECUTABLE} PATH) + FIND_PROGRAM(Subversion_SVNADMIN_EXECUTABLE svnadmin + HINTS ${_Subversion_BIN_DIR} + ) + MARK_AS_ADVANCED(Subversion_SVNADMIN_EXECUTABLE) + IF(NOT Subversion_SVNADMIN_EXECUTABLE) + SET(Subversion_FOUND FALSE) + ENDIF(NOT Subversion_SVNADMIN_EXECUTABLE) + ENDIF(Subversion_FOUND) + IF(Subversion_FOUND) + SET(CTestUpdateSVN_DIR "CTest UpdateSVN") + CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateSVN.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake" @ONLY) + ADD_TEST(CTest.UpdateSVN ${CMAKE_CMAKE_COMMAND} + -P "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake" + ) + ENDIF(Subversion_FOUND) + + # Test CTest Update with CVS + IF(UNIX) + # The test is expected to work by default on UNIX-like systems. + SET(CTEST_TEST_UPDATE_CVS 1) + ELSE(UNIX) + # Special CVS configuration is needed for test to pass on Windows. + OPTION(CTEST_TEST_UPDATE_CVS + "Enable CTest.UpdateCVS test. Requires extra CVS setup on windows." + OFF) + MARK_AS_ADVANCED(CTEST_TEST_UPDATE_CVS) + ENDIF(UNIX) + IF(CTEST_TEST_UPDATE_CVS) + IF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) + FIND_PACKAGE(CVS QUIET) + ELSE(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) + FIND_PROGRAM(CVS_EXECUTABLE NAMES cvs) + SET(CVS_FOUND ${CVS_EXECUTABLE}) + ENDIF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) + ENDIF(CTEST_TEST_UPDATE_CVS) + IF(CTEST_TEST_UPDATE_CVS AND CVS_FOUND) + SET(CTestUpdateCVS_DIR "CTest UpdateCVS") + CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateCVS.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" @ONLY) + ADD_TEST(CTest.UpdateCVS ${CMAKE_CMAKE_COMMAND} + -P "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" + ) + ENDIF(CTEST_TEST_UPDATE_CVS AND CVS_FOUND) + + ENDIF(CTEST_TEST_UPDATE) + IF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS) CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES) diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in new file mode 100644 index 000000000..f1bfc3065 --- /dev/null +++ b/Tests/CTestUpdateCVS.cmake.in @@ -0,0 +1,114 @@ +# This script drives creation of a CVS repository and checks +# that CTest can update from it. + +#----------------------------------------------------------------------------- +# Test in a directory next to this script. +get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(TOP "${TOP}/@CTestUpdateCVS_DIR@") + +# Include code common to all update tests. +include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake") + +#----------------------------------------------------------------------------- +# Report CVS tools in use. +message("Using CVS tools:") +set(CVS "@CVS_EXECUTABLE@") +message(" cvs = ${CVS}") + +set(REPO ${TOP}/repo) +set(CVSCMD ${CVS} -d${REPO}) + +#----------------------------------------------------------------------------- +# Initialize the testing directory. +message("Creating test directory...") +init_testing() + +#----------------------------------------------------------------------------- +# Create the repository. +message("Creating repository...") +file(MAKE_DIRECTORY ${TOP}/repo) +run_child( + COMMAND ${CVSCMD} init + ) + +#----------------------------------------------------------------------------- +# Import initial content into the repository. +message("Importing content...") +create_content(import) + +# Import the content into the repository. +run_child( + WORKING_DIRECTORY ${TOP}/import + COMMAND ${CVSCMD} import -m "Initial content" Project vendor-tag release-tag + ) + +#----------------------------------------------------------------------------- +# Create a working tree. +message("Checking out revision 1...") +run_child( + WORKING_DIRECTORY ${TOP} + COMMAND ${CVSCMD} co -d user-source Project + ) +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${CVSCMD} tag Revision1 + ) + +#----------------------------------------------------------------------------- +# Make changes in the working tree. +message("Changing content...") +update_content(user-source files_added files_removed) +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${CVSCMD} add ${files_added} + ) +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${CVSCMD} rm ${files_removed} + ) + +#----------------------------------------------------------------------------- +# Commit the changes to the repository. +message("Committing revision 2...") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${CVSCMD} commit -m "Changed content" + ) + +#----------------------------------------------------------------------------- +# Go back to before the changes so we can test updating. +message("Backing up to revision 1...") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${CVSCMD} up -rRevision1 + ) + +#----------------------------------------------------------------------------- +# Test updating the user work directory with the command-line interface. +message("Running CTest Dashboard Command Line...") + +# Create the user build tree. +create_build_tree(user-source user-binary) +file(APPEND ${TOP}/user-binary/CTestConfiguration.ini + "# CVS command configuration +CVSCommand: ${CVS} +CVSUpdateOptions: -dAP +") + +# Run the dashboard command line interface. +run_dashboard_command_line(user-binary) + +#----------------------------------------------------------------------------- +# Test initial checkout and update with a dashboard script. +message("Running CTest Dashboard Script...") + +create_dashboard_script(dashboard.cmake + "# CVS command configuration +set(CTEST_CVS_COMMAND \"${CVS}\") +set(CTEST_CVS_UPDATE_OPTIONS -dAP) +set(CTEST_CHECKOUT_COMMAND + \"\\\"\${CTEST_CVS_COMMAND}\\\" -d \\\"${REPO}\\\" co -rRevision1 -d dash-source Project\") +") + +# Run the dashboard script with CTest. +run_dashboard_script(dashboard.cmake) diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake new file mode 100644 index 000000000..655a6cf6e --- /dev/null +++ b/Tests/CTestUpdateCommon.cmake @@ -0,0 +1,159 @@ +#----------------------------------------------------------------------------- +# Function to run a child process and report output only on error. +function(run_child) + execute_process(${ARGN} + RESULT_VARIABLE FAILED + OUTPUT_VARIABLE OUTPUT + ERROR_VARIABLE OUTPUT + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if(FAILED) + string(REGEX REPLACE "\n" "\n " OUTPUT "${OUTPUT}") + message(FATAL_ERROR "Child failed. Output is\n ${OUTPUT}\n") + endif(FAILED) +endfunction(run_child) + +#----------------------------------------------------------------------------- +# Function to find the Update.xml file and check for expected entries. +function(check_updates build) + # Find the Update.xml file for the given build tree + set(PATTERN ${TOP}/${build}/Testing/*/Update.xml) + file(GLOB UPDATE_XML_FILE RELATIVE ${TOP} ${PATTERN}) + string(REGEX REPLACE "//Update.xml$" "/Update.xml" + UPDATE_XML_FILE "${UPDATE_XML_FILE}" + ) + if(NOT UPDATE_XML_FILE) + message(FATAL_ERROR "Cannot find Update.xml with pattern\n ${PATTERN}") + endif(NOT UPDATE_XML_FILE) + message(" found ${UPDATE_XML_FILE}") + + # Read entries from the Update.xml file + file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_ENTRIES + REGEX "FullName" + LIMIT_INPUT 4096 + ) + + # Verify that expected entries exist + set(MISSING) + foreach(f ${ARGN}) + if(NOT "${UPDATE_XML_ENTRIES}" MATCHES "${f}") + list(APPEND MISSING ${f}) + endif() + endforeach(f) + + # Report the result + if(MISSING) + # List the missing entries + set(MSG "Update.xml is missing an entry for:\n") + foreach(f ${MISSING}) + set(MSG "${MSG} ${f}\n") + endforeach(f) + + # Provide the log file + file(GLOB UPDATE_LOG_FILE + ${TOP}/${build}/Testing/Temporary/LastUpdate*.log) + if(UPDATE_LOG_FILE) + file(READ ${UPDATE_LOG_FILE} UPDATE_LOG LIMIT 4096) + string(REGEX REPLACE "\n" "\n " UPDATE_LOG "${UPDATE_LOG}") + set(MSG "${MSG}Update log:\n ${UPDATE_LOG}") + else(UPDATE_LOG_FILE) + set(MSG "${MSG}No update log found!") + endif(UPDATE_LOG_FILE) + + # Display the error message + message(FATAL_ERROR "${MSG}") + else(MISSING) + # Success + message(" no entries missing from Update.xml") + endif(MISSING) +endfunction(check_updates) + +#----------------------------------------------------------------------------- +# Function to create initial content. +function(create_content dir) + file(MAKE_DIRECTORY ${TOP}/${dir}) + + # An example CTest project configuration file. + file(WRITE ${TOP}/${dir}/CTestConfig.cmake + "# CTest Configuration File +set(CTEST_PROJECT_NAME TestProject) +set(CTEST_NIGHTLY_START_TIME \"21:00:00 EDT\") +") + + # Some other files. + file(WRITE ${TOP}/${dir}/foo.txt "foo\n") + file(WRITE ${TOP}/${dir}/bar.txt "bar\n") +endfunction(create_content) + +#----------------------------------------------------------------------------- +# Function to update content. +function(update_content dir added_var removed_var) + file(APPEND ${TOP}/${dir}/foo.txt "foo line 2\n") + file(WRITE ${TOP}/${dir}/zot.txt "zot\n") + file(REMOVE ${TOP}/${dir}/bar.txt) + set(${added_var} zot.txt PARENT_SCOPE) + set(${removed_var} bar.txt PARENT_SCOPE) +endfunction(update_content) + +#----------------------------------------------------------------------------- +# Function to write CTestConfiguration.ini content. +function(create_build_tree src_dir bin_dir) + file(MAKE_DIRECTORY ${TOP}/${bin_dir}) + file(WRITE ${TOP}/${bin_dir}/CTestConfiguration.ini + "# CTest Configuration File +SourceDirectory: ${TOP}/${src_dir} +BuildDirectory: ${TOP}/${bin_dir} +Site: test.site +BuildName: user-test +") +endfunction(create_build_tree) + +#----------------------------------------------------------------------------- +# Function to write the dashboard test script. +function(create_dashboard_script name custom_text) + # Write the dashboard script. + file(WRITE ${TOP}/dashboard.cmake + "# CTest Dashboard Script +set(CTEST_DASHBOARD_ROOT \"${TOP}\") +set(CTEST_SITE test.site) +set(CTEST_BUILD_NAME dash-test) +set(CTEST_SOURCE_DIRECTORY \${CTEST_DASHBOARD_ROOT}/dash-source) +set(CTEST_BINARY_DIRECTORY \${CTEST_DASHBOARD_ROOT}/dash-binary) +${custom_text} +# Start a dashboard and run the update step +ctest_start(Experimental) +ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY}) +") +endfunction(create_dashboard_script) + +#----------------------------------------------------------------------------- +# Function to run the dashboard through the command line +function(run_dashboard_command_line bin_dir) + run_child( + WORKING_DIRECTORY ${TOP}/${bin_dir} + COMMAND ${CMAKE_CTEST_COMMAND} -M Experimental -T Start -T Update + ) + + # Verify the updates reported by CTest. + check_updates(${bin_dir} foo.txt bar.txt zot.txt) +endfunction(run_dashboard_command_line) + +#----------------------------------------------------------------------------- +# Function to run the dashboard through a script +function(run_dashboard_script name) + run_child( + WORKING_DIRECTORY ${TOP} + COMMAND ${CMAKE_CTEST_COMMAND} -S ${name} -V + ) + + # Verify the updates reported by CTest. + check_updates(dash-binary foo.txt bar.txt zot.txt) +endfunction(run_dashboard_script) + +#----------------------------------------------------------------------------- +# Function to initialize the testing directory. +function(init_testing) + file(REMOVE_RECURSE ${TOP}) + file(MAKE_DIRECTORY ${TOP}) +endfunction(init_testing) diff --git a/Tests/CTestUpdateSVN.cmake.in b/Tests/CTestUpdateSVN.cmake.in new file mode 100644 index 000000000..48df4218b --- /dev/null +++ b/Tests/CTestUpdateSVN.cmake.in @@ -0,0 +1,116 @@ +# This script drives creation of a Subversion repository and checks +# that CTest can update from it. + +#----------------------------------------------------------------------------- +# Test in a directory next to this script. +get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(TOP "${TOP}/@CTestUpdateSVN_DIR@") + +# Include code common to all update tests. +include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake") + +#----------------------------------------------------------------------------- +# Report subversion tools in use. +message("Using subversion tools:") +set(SVN "@Subversion_SVN_EXECUTABLE@") +set(SVNADMIN "@Subversion_SVNADMIN_EXECUTABLE@") +message(" svn = ${SVN}") +message(" svnadmin = ${SVNADMIN}") + +# Isolate svn test operations from the user configuration. +file(MAKE_DIRECTORY ${TOP}/config) +set(SVNCMD ${SVN} --config-dir ${TOP}/config) +set(SVNUSER --username testauthor --non-interactive) + +#----------------------------------------------------------------------------- +# Initialize the testing directory. +message("Creating test directory...") +init_testing() + +#----------------------------------------------------------------------------- +# Create the repository. +message("Creating repository...") +file(MAKE_DIRECTORY ${TOP}/repo) +run_child( + COMMAND ${SVNADMIN} create --config-dir ${TOP}/config ${TOP}/repo + ) +set(REPO file:///${TOP}/repo/trunk) + +#----------------------------------------------------------------------------- +# Import initial content into the repository. +message("Importing content...") +create_content(import) + +# Import the content into the repository. +run_child( + WORKING_DIRECTORY ${TOP}/import + COMMAND ${SVNCMD} import ${SVNUSER} -m "Initial content" . "${REPO}" + ) + +#----------------------------------------------------------------------------- +# Create a working tree. +message("Checking out revision 1...") +run_child( + WORKING_DIRECTORY ${TOP} + COMMAND ${SVNCMD} co ${SVNUSER} ${REPO} user-source + ) + +#----------------------------------------------------------------------------- +# Make changes in the working tree. +message("Changing content...") +update_content(user-source files_added files_removed) +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${SVNCMD} add ${files_added} + ) +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${SVNCMD} rm ${files_removed} + ) + +#----------------------------------------------------------------------------- +# Commit the changes to the repository. +message("Committing revision 2...") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${SVNCMD} commit -m "Changed content" + ) + +#----------------------------------------------------------------------------- +# Go back to before the changes so we can test updating. +message("Backing up to revision 1...") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${SVNCMD} up -r1 + ) + +#----------------------------------------------------------------------------- +# Test updating the user work directory with the command-line interface. +message("Running CTest Dashboard Command Line...") + +# Create the user build tree. +create_build_tree(user-source user-binary) +file(APPEND ${TOP}/user-binary/CTestConfiguration.ini + "# SVN command configuration +SVNCommand: ${SVN} +SVNUpdateOptions: --config-dir \"${TOP}/config\" +") + +# Run the dashboard command line interface. +run_dashboard_command_line(user-binary) + +#----------------------------------------------------------------------------- +# Test initial checkout and update with a dashboard script. +message("Running CTest Dashboard Script...") + +create_dashboard_script(dashboard.cmake + "# Subversion command configuration +set(CTEST_SVN_COMMAND \"${SVN}\") +set(CTEST_SVN_UPDATE_OPTIONS + \"--config-dir \\\"\${CTEST_DASHBOARD_ROOT}/config\\\"\") +set(CTEST_CHECKOUT_COMMAND + \"\\\"\${CTEST_SVN_COMMAND}\\\" co -r1 \\\"${REPO}\\\" dash-source\") +") + +# Run the dashboard script with CTest. +run_dashboard_script(dashboard.cmake) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index d77e89602..b2ed25c6b 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -341,6 +341,12 @@ if (NOT ELSEIF_RESULT EQUAL 2) set (ELSEIF_RESULT 0) endif (NOT ELSEIF_RESULT EQUAL 2) +# test handling of parenthetical groups in conditionals +if (2 GREATER 1 AND (4 LESS 3 OR 5 LESS 6) AND NOT (7 GREATER 8)) + set(CONDITIONAL_PARENTHESES 1) +endif() + + # # Configure file # (plug vars to #define so that they can be tested) diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 95e77b640..0ecd8fe2e 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -369,6 +369,12 @@ int main() cmFailed("ELSEIF did not work"); #endif +#ifdef CONDITIONAL_PARENTHESES + cmPassed("CONDITIONAL_PARENTHESES did work"); +#else + cmFailed("CONDITIONAL_PARENTHESES did not work"); +#endif + if(file2() != 1) { cmFailed("Call to file2 function from library failed."); diff --git a/Tests/Complex/cmTestConfigure.h.in b/Tests/Complex/cmTestConfigure.h.in index 80342036a..d7952da1e 100644 --- a/Tests/Complex/cmTestConfigure.h.in +++ b/Tests/Complex/cmTestConfigure.h.in @@ -81,3 +81,7 @@ // test elseif #cmakedefine ELSEIF_RESULT + +// test parenthesis in conditionals +#cmakedefine CONDITIONAL_PARENTHESES + diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index d77e89602..b2ed25c6b 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -341,6 +341,12 @@ if (NOT ELSEIF_RESULT EQUAL 2) set (ELSEIF_RESULT 0) endif (NOT ELSEIF_RESULT EQUAL 2) +# test handling of parenthetical groups in conditionals +if (2 GREATER 1 AND (4 LESS 3 OR 5 LESS 6) AND NOT (7 GREATER 8)) + set(CONDITIONAL_PARENTHESES 1) +endif() + + # # Configure file # (plug vars to #define so that they can be tested) diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 95e77b640..0ecd8fe2e 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -369,6 +369,12 @@ int main() cmFailed("ELSEIF did not work"); #endif +#ifdef CONDITIONAL_PARENTHESES + cmPassed("CONDITIONAL_PARENTHESES did work"); +#else + cmFailed("CONDITIONAL_PARENTHESES did not work"); +#endif + if(file2() != 1) { cmFailed("Call to file2 function from library failed."); diff --git a/Tests/ComplexOneConfig/cmTestConfigure.h.in b/Tests/ComplexOneConfig/cmTestConfigure.h.in index 80342036a..d7952da1e 100644 --- a/Tests/ComplexOneConfig/cmTestConfigure.h.in +++ b/Tests/ComplexOneConfig/cmTestConfigure.h.in @@ -81,3 +81,7 @@ // test elseif #cmakedefine ELSEIF_RESULT + +// test parenthesis in conditionals +#cmakedefine CONDITIONAL_PARENTHESES + diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt index d77e89602..b2ed25c6b 100644 --- a/Tests/ComplexRelativePaths/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/CMakeLists.txt @@ -341,6 +341,12 @@ if (NOT ELSEIF_RESULT EQUAL 2) set (ELSEIF_RESULT 0) endif (NOT ELSEIF_RESULT EQUAL 2) +# test handling of parenthetical groups in conditionals +if (2 GREATER 1 AND (4 LESS 3 OR 5 LESS 6) AND NOT (7 GREATER 8)) + set(CONDITIONAL_PARENTHESES 1) +endif() + + # # Configure file # (plug vars to #define so that they can be tested) diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index 95e77b640..0ecd8fe2e 100644 --- a/Tests/ComplexRelativePaths/Executable/complex.cxx +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -369,6 +369,12 @@ int main() cmFailed("ELSEIF did not work"); #endif +#ifdef CONDITIONAL_PARENTHESES + cmPassed("CONDITIONAL_PARENTHESES did work"); +#else + cmFailed("CONDITIONAL_PARENTHESES did not work"); +#endif + if(file2() != 1) { cmFailed("Call to file2 function from library failed."); diff --git a/Tests/ComplexRelativePaths/cmTestConfigure.h.in b/Tests/ComplexRelativePaths/cmTestConfigure.h.in index 80342036a..d7952da1e 100644 --- a/Tests/ComplexRelativePaths/cmTestConfigure.h.in +++ b/Tests/ComplexRelativePaths/cmTestConfigure.h.in @@ -81,3 +81,7 @@ // test elseif #cmakedefine ELSEIF_RESULT + +// test parenthesis in conditionals +#cmakedefine CONDITIONAL_PARENTHESES + diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index b8410e183..ffe05237e 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -100,6 +100,7 @@ ADD_CUSTOM_TARGET(TDocument ALL ${PROJECT_BINARY_DIR}/doc2.h DEPENDS ${PROJECT_BINARY_DIR}/doc1.h doc1.txt COMMENT "Running top-level TDocument commands" + SOURCES doc1.tex ) # Setup a pre- and post-build pair that will fail if not run in the @@ -345,7 +346,7 @@ ENDIF(NOT MINGW) # | < > << >> &> 2>&1 1>&2 # to allow custom commands to perform redirection. -FOREACH(arg ${CHECK_ARGS}) +FOREACH(arg ${CHECK_ARGS} "") SET(ARG "${arg}") STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ARG "${ARG}") STRING(REGEX REPLACE "\"" "\\\\\"" ARG "${ARG}") @@ -366,7 +367,7 @@ ADD_CUSTOM_COMMAND( COMMAND ${CMAKE_COMMAND} -DMARK_FILE=${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt -P ${CMAKE_CURRENT_SOURCE_DIR}/check_mark.cmake COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/check_command_line - ${CHECK_ARGS} + ${CHECK_ARGS} "" VERBATIM COMMENT "Checking custom command line escapes (single'quote)" ) @@ -376,7 +377,7 @@ ADD_CUSTOM_TARGET(do_check_command_line ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/command_line_check COMMAND ${CMAKE_COMMAND} -E echo "Checking custom target command escapes" COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/check_command_line - ${CHECK_ARGS} + ${CHECK_ARGS} "" VERBATIM COMMENT "Checking custom target command line escapes ($dollar-signs$)" ) diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 595530795..26687b1c3 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -6,6 +6,10 @@ if(CMAKE_ANSI_CFLAGS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") endif(CMAKE_ANSI_CFLAGS) +# Pretend that RelWithDebInfo should link to debug libraries to test +# the DEBUG_CONFIGURATIONS property. +set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS Debug RelWithDebInfo) + add_library(testExe1lib STATIC testExe1lib.c) # not exported add_executable(testExe1 testExe1.c) target_link_libraries(testExe1 testExe1lib) diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt index 1ac9d3a57..27f291028 100644 --- a/Tests/ExportImport/Import/CMakeLists.txt +++ b/Tests/ExportImport/Import/CMakeLists.txt @@ -32,7 +32,6 @@ add_executable(imp_testExe1 # Try linking to a library imported from the install tree. target_link_libraries(imp_testExe1 exp_testLib2 exp_testLib3 exp_testLib4) -set_property(TARGET imp_testExe1 PROPERTY COMPILE_DEFINITIONS_DEBUG EXE_DBG) # Try building a plugin to an executable imported from the install tree. add_library(imp_mod1 MODULE imp_mod1.c) @@ -58,8 +57,14 @@ add_executable(imp_testExe1b # Try linking to a library imported from the build tree. target_link_libraries(imp_testExe1b bld_testLib2 bld_testLib3 bld_testLib4) -set_property(TARGET imp_testExe1b PROPERTY COMPILE_DEFINITIONS_DEBUG EXE_DBG) # Try building a plugin to an executable imported from the build tree. add_library(imp_mod1b MODULE imp_mod1.c) target_link_libraries(imp_mod1b bld_testExe2) + +# Export/CMakeLists.txt pretends the RelWithDebInfo (as well as Debug) +# configuration should link to debug libs. +foreach(c DEBUG RELWITHDEBINFO) + set_property(TARGET imp_testExe1 PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG) + set_property(TARGET imp_testExe1b PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG) +endforeach(c) diff --git a/Tests/FindPackageTest/Baz 1.1/BazConfig.cmake b/Tests/FindPackageTest/Baz 1.1/BazConfig.cmake new file mode 100644 index 000000000..deffa5729 --- /dev/null +++ b/Tests/FindPackageTest/Baz 1.1/BazConfig.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake b/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake new file mode 100644 index 000000000..321fa118e --- /dev/null +++ b/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake @@ -0,0 +1,8 @@ +SET(PACKAGE_VERSION 1.1) +IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) + SET(PACKAGE_VERSION_COMPATIBLE 1) + IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) + SET(PACKAGE_VERSION_EXACT 1) + ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) +ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) + diff --git a/Tests/FindPackageTest/Baz 1.2/CMake/BazConfig.cmake b/Tests/FindPackageTest/Baz 1.2/CMake/BazConfig.cmake new file mode 100644 index 000000000..deffa5729 --- /dev/null +++ b/Tests/FindPackageTest/Baz 1.2/CMake/BazConfig.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake b/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake new file mode 100644 index 000000000..4576809f5 --- /dev/null +++ b/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake @@ -0,0 +1,8 @@ +SET(PACKAGE_VERSION 1.2) +IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) + SET(PACKAGE_VERSION_COMPATIBLE 1) + IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2) + SET(PACKAGE_VERSION_EXACT 1) + ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2) +ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) + diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 1703fe7af..f82f4a196 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -36,8 +36,9 @@ FIND_PACKAGE(VersionTestD 1.2.3.4) # For purposes of the test wipe out previous find results. SET(PACKAGES foo Foo Bar TFramework Tframework TApp Tapp Special - VersionedA VersionedB + VersionedA VersionedB VersionedC VersionedD VersionedE wibbleA wibbleB + RecursiveA RecursiveB RecursiveC ) FOREACH(p ${PACKAGES}) SET(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) @@ -48,6 +49,9 @@ ENDFOREACH(p) SET(CMAKE_FIND_FRAMEWORK LAST) SET(CMAKE_FIND_APPBUNDLE FIRST) +# Set the wrong answer for a find to make sure it re-finds. +set(VersionedA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-4.0) + # Look for packages with new-style signatures. FIND_PACKAGE(foo NO_MODULE) FIND_PACKAGE(Foo CONFIGS FooConfig.cmake) @@ -59,12 +63,20 @@ FIND_PACKAGE(Tapp CONFIGS tapp-config.cmake) FIND_PACKAGE(Special NAMES Suffix SuffixTest PATH_SUFFIXES test) FIND_PACKAGE(VersionedA 2 NAMES zot) FIND_PACKAGE(VersionedB 3.1 EXACT NAMES zot) +FIND_PACKAGE(VersionedC 4.0 EXACT NAMES zot) +FIND_PACKAGE(VersionedD 1.1 EXACT NAMES Baz) +FIND_PACKAGE(VersionedE 1.2 EXACT NAMES Baz) # HINTS should override the system but PATHS should not LIST(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A") FIND_PACKAGE(wibbleA NAMES wibble PATHS B) FIND_PACKAGE(wibbleB NAMES wibble HINTS B) +# Look for package with recursive find-modules. +FIND_PACKAGE(RecursiveA) +FIND_PACKAGE(RecursiveB 2) +FIND_PACKAGE(RecursiveC 3.1 EXACT) + # Expected locations at which packages should be found. SET(foo_EXPECTED "lib/foo-1.2/foo-config.cmake") SET(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake") @@ -80,8 +92,14 @@ SET(Tapp_EXPECTED "TApp.app/Contents/Resources/cmake/tapp-config.cmake") SET(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake") SET(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake") +SET(VersionedC_EXPECTED "lib/cmake/zot-4.0/zot-config.cmake") +SET(VersionedD_EXPECTED "Baz 1.1/BazConfig.cmake") +SET(VersionedE_EXPECTED "Baz 1.2/CMake/BazConfig.cmake") SET(wibbleA_EXPECTED "A/wibble-config.cmake") SET(wibbleB_EXPECTED "B/wibble-config.cmake") +SET(RecursiveA_EXPECTED "lib/RecursiveA/recursivea-config.cmake") +SET(RecursiveB_EXPECTED "lib/zot-2.0/zot-config.cmake") +SET(RecursiveC_EXPECTED "lib/zot-3.1/zot-config.cmake") # Check the results. FOREACH(p ${PACKAGES}) diff --git a/Tests/FindPackageTest/FindRecursiveA.cmake b/Tests/FindPackageTest/FindRecursiveA.cmake new file mode 100644 index 000000000..3af7e99a3 --- /dev/null +++ b/Tests/FindPackageTest/FindRecursiveA.cmake @@ -0,0 +1 @@ +FIND_PACKAGE(RecursiveA NO_MODULE) diff --git a/Tests/FindPackageTest/FindRecursiveB.cmake b/Tests/FindPackageTest/FindRecursiveB.cmake new file mode 100644 index 000000000..c609ab127 --- /dev/null +++ b/Tests/FindPackageTest/FindRecursiveB.cmake @@ -0,0 +1 @@ +FIND_PACKAGE(RecursiveB NAMES zot) diff --git a/Tests/FindPackageTest/FindRecursiveC.cmake b/Tests/FindPackageTest/FindRecursiveC.cmake new file mode 100644 index 000000000..018cc7302 --- /dev/null +++ b/Tests/FindPackageTest/FindRecursiveC.cmake @@ -0,0 +1 @@ +FIND_PACKAGE(RecursiveC NAMES zot) diff --git a/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake b/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake new file mode 100644 index 000000000..deffa5729 --- /dev/null +++ b/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake new file mode 100644 index 000000000..606945f2d --- /dev/null +++ b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake @@ -0,0 +1,8 @@ +SET(PACKAGE_VERSION 4.0) +IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4) + SET(PACKAGE_VERSION_COMPATIBLE 1) + IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0) + SET(PACKAGE_VERSION_EXACT 1) + ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0) +ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4) + diff --git a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake new file mode 100644 index 000000000..deffa5729 --- /dev/null +++ b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/lib/zot/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot/zot-config-version.cmake new file mode 100644 index 000000000..2a6be8640 --- /dev/null +++ b/Tests/FindPackageTest/lib/zot/zot-config-version.cmake @@ -0,0 +1,10 @@ +# This version should never, ever be used. +SET(PACKAGE_VERSION_UNSUITABLE 1) +SET(PACKAGE_VERSION 3.1) +IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) + SET(PACKAGE_VERSION_COMPATIBLE 1) + IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) + SET(PACKAGE_VERSION_EXACT 1) + ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) +ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) + diff --git a/Tests/FindPackageTest/lib/zot/zot-config.cmake b/Tests/FindPackageTest/lib/zot/zot-config.cmake new file mode 100644 index 000000000..442b8a4ec --- /dev/null +++ b/Tests/FindPackageTest/lib/zot/zot-config.cmake @@ -0,0 +1,2 @@ +# Test config file that is unsuitable. +MESSAGE(FATAL_ERROR "Unsuitable version of zot was found") diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index ca7d89a4d..e8515c400 100755 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -1,44 +1,146 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(testf Fortran) -SET(CMAKE_VERBOSE_MAKEFILE 1) -MESSAGE("ENV_FLAGS = $ENV{FFLAGS}") -MESSAGE("CMAKE_Fortran_COMPILER_INIT = ${CMAKE_Fortran_COMPILER_INIT}") -MESSAGE("CMAKE_Fortran_COMPILER_FULLPATH = ${CMAKE_Fortran_COMPILER_FULLPATH}") -MESSAGE("CMAKE_Fortran_COMPILER = ${CMAKE_Fortran_COMPILER}") -MESSAGE("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}") -ADD_EXECUTABLE(testf hello.f) +project(testf Fortran C) +message("CTEST_FULL_OUTPUT ") +set(CMAKE_VERBOSE_MAKEFILE 1) +message("ENV_FLAGS = $ENV{FFLAGS}") +message("CMAKE_Fortran_COMPILER_INIT = ${CMAKE_Fortran_COMPILER_INIT}") +message("CMAKE_Fortran_COMPILER_FULLPATH = ${CMAKE_Fortran_COMPILER_FULLPATH}") +message("CMAKE_Fortran_COMPILER = ${CMAKE_Fortran_COMPILER}") +message("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}") +add_executable(testf hello.f) -SET(TEST_MODULE_DEPENDS 0) -IF(CMAKE_Fortran_COMPILER_SUPPORTS_F90) - ADD_EXECUTABLE(test_module + +function(test_fortran_c_interface_module) + message(STATUS "Testing FortranCInterface module") + # test the C to Fortran interface module + include(FortranCInterface) + if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + if(FORTRAN_C_MODULE_MANGLING_FOUND) + set(srcs foo.f) + set(FORTRAN_FUNCTIONS test_mod:sub) + else(FORTRAN_C_MODULE_MANGLING_FOUND) + if(CMAKE_Fortran_COMPILER_ID MATCHES "SunPro|MIPSpro") + message("${CMAKE_Fortran_COMPILER_ID} compilers do not support" + " linking Fortran module procedures from C") + else() + message("This will fail, but let the user see the error") + set(srcs foo.f) + set(FORTRAN_FUNCTIONS test_mod:sub) + endif() + endif(FORTRAN_C_MODULE_MANGLING_FOUND) + endif() + set(FORTRAN_FUNCTIONS ${FORTRAN_FUNCTIONS} my_sub mysub ) + set(srcs ${srcs} mysub.f foo.c) + create_fortran_c_interface("F_" FORTRAN_FUNCTIONS + "${testf_BINARY_DIR}/foo.h") + include_directories("${testf_BINARY_DIR}") + + # if the name mangling is not found for a F90 compiler + # print out some diagnostic stuff for the dashboard + if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + if(NOT FORTRAN_C_MODULE_MANGLING_FOUND) + file(GLOB_RECURSE O_OBJFILES + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckFortranLink/*.o" + "*.o" ) + file(GLOB_RECURSE OBJ_OBJFILES + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckFortranLink/*.obj") + find_program(DUMPBIN dumpbin) + find_program(NM nm) + foreach(ofile ${O_OBJFILES} ${OBJ_OBJFILES}) + if(DEPENDS) + execute_process(COMMAND ${DUMPBIN} /symbols "${ofile}" + OUTPUT_VARIABLE out) + message("symbols in ${ofile}:\n${out}") + endif() + if(NM) + execute_process(COMMAND ${NM} "${ofile}" OUTPUT_VARIABLE out) + message("symbols in ${ofile}:\n${out}") + endif() + endforeach() + endif() + endif() + message("Fortran = ${CMAKE_Fortran_COMPILER_ID}") + message("C = ${CMAKE_C_COMPILER_ID}") + add_executable(foo ${srcs}) + if(NOT ("$ENV{EXTRA_FORTRAN_C_LIBS}" STREQUAL "")) + message(STATUS + "linking in extra C to Fortran libs $ENV{EXTRA_FORTRAN_C_LIBS}") + target_link_libraries(foo $ENV{EXTRA_FORTRAN_C_LIBS}) + endif() + # print out some stuff to help debug on machines via cdash + file(READ "${testf_BINARY_DIR}/foo.h" fooh) + message("foo.h contents:\n${fooh}") +endfunction() + +# if the id's match or the compilers are compatible, then +# call the test_fortran_c_interface_module function +if(("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel") + AND + ("${CMAKE_C_COMPILER_ID}" MATCHES "MSVC") + ) + set(COMPATABLE_COMPILERS TRUE) +endif() +if(COMPATABLE_COMPILERS + OR ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_C_COMPILER_ID}" )) + test_fortran_c_interface_module() +else() + message("Fortran does not match c compiler") + message("Fortran = ${CMAKE_Fortran_COMPILER_ID}") + message("C = ${CMAKE_C_COMPILER_ID}") + # hack to make g77 work after CL has been enabled + # as a languge, cmake needs language specific versions + # of these variables.... + if(WIN32 AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + set(CMAKE_CREATE_CONSOLE_EXE ) + set(CMAKE_LIBRARY_PATH_FLAG "-L") + set(CMAKE_LINK_LIBRARY_FLAG "-l") + set(CMAKE_LINK_LIBRARY_SUFFIX ) + endif() + # gnu and sunpro do not use the same flags here... + # however if LDFLAGS is used to set -m64 it causes odd stuf + # with the fortran build + if( ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") + AND ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "SunPro")) + set(CMAKE_EXE_LINKER_FLAGS "") + set(CMAKE_Fortran_FLAGS "") + endif() + +endif() + + + + +set(TEST_MODULE_DEPENDS 0) +if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + add_executable(test_module test_module_main.f90 test_module_implementation.f90 test_module_interface.f90) - ADD_EXECUTABLE(test_use_in_comment_fixedform + add_executable(test_use_in_comment_fixedform test_use_in_comment_fixedform.f) - ADD_EXECUTABLE(test_use_in_comment_freeform + add_executable(test_use_in_comment_freeform test_use_in_comment_freeform.f90) - ADD_EXECUTABLE(test_in_interface + add_executable(test_in_interface in_interface/main.f90 in_interface/module.f90) - ADD_DEFINITIONS(-DFOO -DBAR=1) - ADD_EXECUTABLE(test_preprocess test_preprocess.F90) + add_definitions(-DFOO -DBAR=1) + add_executable(test_preprocess test_preprocess.F90) - SET(TEST_MODULE_DEPENDS 1) -ENDIF(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + set(TEST_MODULE_DEPENDS 1) +endif(CMAKE_Fortran_COMPILER_SUPPORTS_F90) -IF(TEST_MODULE_DEPENDS) +if(TEST_MODULE_DEPENDS) # Build the external project separately using a custom target. # Make sure it uses the same build configuration as this test. - IF(CMAKE_CONFIGURATION_TYPES) - SET(External_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") - ELSE(CMAKE_CONFIGURATION_TYPES) - SET(External_CONFIG_TYPE) - ENDIF(CMAKE_CONFIGURATION_TYPES) - ADD_CUSTOM_COMMAND( + if(CMAKE_CONFIGURATION_TYPES) + set(External_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") + else(CMAKE_CONFIGURATION_TYPES) + set(External_CONFIG_TYPE) + endif(CMAKE_CONFIGURATION_TYPES) + add_custom_command( OUTPUT ${testf_BINARY_DIR}/ExternalProject COMMAND ${CMAKE_CTEST_COMMAND} ARGS ${External_CONFIG_TYPE} @@ -57,15 +159,15 @@ IF(TEST_MODULE_DEPENDS) -DCMAKE_Fortran_FLAGS_MINSIZEREL:STRING=${CMAKE_Fortran_FLAGS_MINSIZEREL} -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_Fortran_FLAGS_RELWITHDEBINFO} ) - ADD_CUSTOM_TARGET(ExternalTarget ALL DEPENDS ${testf_BINARY_DIR}/ExternalProject) + add_custom_target(ExternalTarget ALL DEPENDS ${testf_BINARY_DIR}/ExternalProject) # Test module output directory if available. - IF(CMAKE_Fortran_MODDIR_FLAG) - SET(Library_MODDIR "${testf_BINARY_DIR}/Library/modules") - ELSE(CMAKE_Fortran_MODDIR_FLAG) - SET(Library_MODDIR "${testf_BINARY_DIR}/Library") - ENDIF(CMAKE_Fortran_MODDIR_FLAG) + if(CMAKE_Fortran_MODDIR_FLAG) + set(Library_MODDIR "${testf_BINARY_DIR}/Library/modules") + else(CMAKE_Fortran_MODDIR_FLAG) + set(Library_MODDIR "${testf_BINARY_DIR}/Library") + endif(CMAKE_Fortran_MODDIR_FLAG) - ADD_SUBDIRECTORY(Library) - ADD_SUBDIRECTORY(Executable) -ENDIF(TEST_MODULE_DEPENDS) + add_subdirectory(Library) + add_subdirectory(Executable) +endif(TEST_MODULE_DEPENDS) diff --git a/Tests/Fortran/foo.c b/Tests/Fortran/foo.c new file mode 100755 index 000000000..f03aec17a --- /dev/null +++ b/Tests/Fortran/foo.c @@ -0,0 +1,11 @@ +#include "foo.h" +extern F_test_mod_sub(); +extern F_mysub(); +int main() +{ + F_mysub(); + F_my_sub(); +#ifdef F_test_mod_sub + F_test_mod_sub(); +#endif +} diff --git a/Tests/Fortran/foo.f b/Tests/Fortran/foo.f new file mode 100755 index 000000000..dbbb3a4e9 --- /dev/null +++ b/Tests/Fortran/foo.f @@ -0,0 +1,9 @@ + module test_mod + interface dummy + module procedure sub + end interface + contains + subroutine sub + end subroutine + + end module test_mod diff --git a/Tests/Fortran/mysub.f b/Tests/Fortran/mysub.f new file mode 100755 index 000000000..36b415530 --- /dev/null +++ b/Tests/Fortran/mysub.f @@ -0,0 +1,4 @@ + subroutine mysub + end subroutine + subroutine my_sub + end subroutine diff --git a/Tests/PolicyScope/Bar.cmake b/Tests/PolicyScope/Bar.cmake new file mode 100644 index 000000000..cf1904c48 --- /dev/null +++ b/Tests/PolicyScope/Bar.cmake @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 2.6.3) + +# Make sure a policy set differently by our includer is now correct. +cmake_policy(GET CMP0003 cmp) +check(CMP0003 "NEW" "${cmp}") + +# Test allowing the top-level file to not have cmake_minimum_required. +cmake_policy(SET CMP0000 OLD) diff --git a/Tests/PolicyScope/CMakeLists.txt b/Tests/PolicyScope/CMakeLists.txt new file mode 100644 index 000000000..89a89ee49 --- /dev/null +++ b/Tests/PolicyScope/CMakeLists.txt @@ -0,0 +1,86 @@ +project(PolicyScope C) +# No cmake_minimum_required(VERSION), it's in FindFoo. + +#----------------------------------------------------------------------------- +# Helper function to report results. +function(check msg lhs rhs) + if(NOT "${lhs}" STREQUAL "${rhs}") + message(FATAL_ERROR "${msg}: expected [${lhs}], got [${rhs}]") + endif() +endfunction(check) + +#----------------------------------------------------------------------------- +# Test using a development framework that sets policies for us. + +# Policy CMP0011 should not be set at this point. +cmake_policy(GET CMP0011 cmp) +check(CMP0011 "" "${cmp}") + +# Put the test modules in the search path. +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +# The included file should set policies for us. +find_package(Foo) + +# Check policies set by the package. +cmake_policy(GET CMP0003 cmp) +check(CMP0003 "OLD" "${cmp}") +cmake_policy(GET CMP0002 cmp) +check(CMP0002 "NEW" "${cmp}") +cmake_policy(GET CMP0011 cmp) +check(CMP0011 "NEW" "${cmp}") + +# Make sure an included file cannot change policies. +include(Bar) +cmake_policy(GET CMP0003 cmp) +check(CMP0003 "OLD" "${cmp}") + +# Allow the included file to change policies. +include(Bar NO_POLICY_SCOPE) +cmake_policy(GET CMP0003 cmp) +check(CMP0003 "NEW" "${cmp}") + +#----------------------------------------------------------------------------- +# Test function and macro policy recording. + +# Create the functions in an isolated scope in which we change policies. +cmake_policy(PUSH) +if(1) + # Change CMP0002 + cmake_policy(SET CMP0002 OLD) + function(func1) + # CMP0002 should be changed when this function is invoked + cmake_policy(GET CMP0002 cmp) + check(CMP0002 "OLD" "${cmp}") + endfunction(func1) + + # Unset CMP0002 + cmake_policy(VERSION 2.4) + macro(macro1) + # CMP0002 should be unset when this macro is invoked + cmake_policy(GET CMP0002 cmp) + check(CMP0002 "" "${cmp}") + + # Setting the policy should work here and also in the caller. + cmake_policy(SET CMP0002 OLD) + cmake_policy(GET CMP0002 cmp) + check(CMP0002 "OLD" "${cmp}") + endmacro(macro1) +endif(1) +cmake_policy(POP) + +# CMP0002 should still be NEW in this context. +cmake_policy(GET CMP0002 cmp) +check(CMP0002 "NEW" "${cmp}") + +# Check the recorded policies +func1() +macro1() + +# The macro should have changed CMP0002. +cmake_policy(GET CMP0002 cmp) +check(CMP0002 "OLD" "${cmp}") + +#----------------------------------------------------------------------------- +# Dummy executable so the project can build and run. +add_executable(PolicyScope main.c) diff --git a/Tests/PolicyScope/FindFoo.cmake b/Tests/PolicyScope/FindFoo.cmake new file mode 100644 index 000000000..5b441e20e --- /dev/null +++ b/Tests/PolicyScope/FindFoo.cmake @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 2.6.3) +cmake_policy(SET CMP0003 OLD) diff --git a/Tests/PolicyScope/main.c b/Tests/PolicyScope/main.c new file mode 100644 index 000000000..f8b643afb --- /dev/null +++ b/Tests/PolicyScope/main.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt index 8c5f3fac6..f1598d72b 100644 --- a/Tests/StringFileTest/CMakeLists.txt +++ b/Tests/StringFileTest/CMakeLists.txt @@ -132,6 +132,13 @@ IF(NOT result) MESSAGE(SEND_ERROR "Unquoted $(VAR) syntax is broken.") ENDIF(NOT result) +# Obscure environment variable name +SET("ENV{x+(y)}" "Obscure environment variable value") +MESSAGE("Output: [$ENV{x+(y)}]") +IF(NOT "$ENV{x+(y)}" STREQUAL "Obscure environment variable value") + MESSAGE(SEND_ERROR "Environment variable \"ENV{x+(y)}\" does not work.") +ENDIF() + # Make directories test FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Includes" diff --git a/Tests/Unset/CMakeLists.txt b/Tests/Unset/CMakeLists.txt new file mode 100644 index 000000000..bacb6d21f --- /dev/null +++ b/Tests/Unset/CMakeLists.txt @@ -0,0 +1,55 @@ +cmake_minimum_required(VERSION 2.6) +project(Unset C) + +# Local variable +set(x 42) +if(NOT x EQUAL 42) + message(FATAL_ERROR "x!=42") +endif(NOT x EQUAL 42) + +if(NOT DEFINED x) + message(FATAL_ERROR "x should be defined!") +endif(NOT DEFINED x) + +unset(x) +if(DEFINED x) + message(FATAL_ERROR "x should be undefined now!") +endif(DEFINED x) + +# Local variable test unset via set() +set(x 43) +if(NOT x EQUAL 43) + message(FATAL_ERROR "x!=43") +endif(NOT x EQUAL 43) +set(x) +if(DEFINED x) + message(FATAL_ERROR "x should be undefined now!") +endif(DEFINED x) + +# Cache variable +set(BAR "test" CACHE STRING "documentation") +if(NOT DEFINED BAR) + message(FATAL_ERROR "BAR not defined") +endif(NOT DEFINED BAR) + +# Test interaction of cache entries with variables. +set(BAR "test-var") +if(NOT "$CACHE{BAR}" STREQUAL "test") + message(FATAL_ERROR "\$CACHE{BAR} changed by variable BAR") +endif(NOT "$CACHE{BAR}" STREQUAL "test") +if(NOT "${BAR}" STREQUAL "test-var") + message(FATAL_ERROR "\${BAR} not separate from \$CACHE{BAR}") +endif(NOT "${BAR}" STREQUAL "test-var") +unset(BAR) +if(NOT "${BAR}" STREQUAL "test") + message(FATAL_ERROR "\${BAR} does not fall through to \$CACHE{BAR}") +endif(NOT "${BAR}" STREQUAL "test") + +# Test unsetting of CACHE entry. +unset(BAR CACHE) +if(DEFINED BAR) + message(FATAL_ERROR "BAR still defined") +endif(DEFINED BAR) + + +add_executable(Unset unset.c) diff --git a/Tests/Unset/unset.c b/Tests/Unset/unset.c new file mode 100644 index 000000000..f8b643afb --- /dev/null +++ b/Tests/Unset/unset.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Utilities/cmcurl/CMake/CurlTests.c b/Utilities/cmcurl/CMake/CurlTests.c index c5ba7c28f..d74a4f016 100644 --- a/Utilities/cmcurl/CMake/CurlTests.c +++ b/Utilities/cmcurl/CMake/CurlTests.c @@ -38,7 +38,7 @@ main () # define PLATFORM_AIX_V3 #endif -#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__) +#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || (defined(__BEOS__) && !defined(__HAIKU__)) #error "O_NONBLOCK does not work on this platform" #endif int socket; diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index d2f319de2..a04b08cdf 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -153,7 +153,10 @@ MACRO(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) ENDMACRO(CHECK_LIBRARY_EXISTS_CONCAT) # Check for all needed libraries -CHECK_LIBRARY_EXISTS_CONCAT("dl" dlopen HAVE_LIBDL) +# use the cmake defined dl libs as dl is should not be used +# on HPUX, but rather dld this avoids a warning +SET(CURL_LIBS ${CURL_LIBS} ${CMAKE_DL_LIBS}) +#CHECK_LIBRARY_EXISTS_CONCAT("dl" dlopen HAVE_LIBDL) #CHECK_LIBRARY_EXISTS_CONCAT("ucb" gethostname HAVE_LIBUCB) CHECK_LIBRARY_EXISTS_CONCAT("socket" connect HAVE_LIBSOCKET) CHECK_LIBRARY_EXISTS("c" gethostbyname "" NOT_NEED_LIBNSL) @@ -165,6 +168,8 @@ IF(BEOS) CHECK_LIBRARY_EXISTS_CONCAT("bnetapi" closesocket HAVE_LIBBNETAPI) ENDIF(BEOS) +CHECK_LIBRARY_EXISTS_CONCAT("network" recv HAVE_LIBNETWORK) + IF(NOT NOT_NEED_LIBNSL) CHECK_LIBRARY_EXISTS_CONCAT("nsl" gethostbyname HAVE_LIBNSL) ENDIF(NOT NOT_NEED_LIBNSL) diff --git a/Utilities/cmcurl/Testing/curltest.c b/Utilities/cmcurl/Testing/curltest.c index c21774a08..67c142f17 100644 --- a/Utilities/cmcurl/Testing/curltest.c +++ b/Utilities/cmcurl/Testing/curltest.c @@ -137,7 +137,8 @@ int main(/*int argc, char **argv*/) retVal += GetWebFile(); /* Do not check the output of FTP socks5 cannot handle FTP yet */ - GetFtpFile(); + /* GetFtpFile(); */ + /* do not test ftp right now because we don't enable that port */ curl_global_cleanup(); return retVal; } diff --git a/Utilities/cmcurl/curl/curl.h b/Utilities/cmcurl/curl/curl.h index d63371453..6bdcfc6a6 100644 --- a/Utilities/cmcurl/curl/curl.h +++ b/Utilities/cmcurl/curl/curl.h @@ -20,7 +20,7 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id: curl.h,v 1.3 2007-03-16 22:44:39 king Exp $ + * $Id: curl.h,v 1.3.12.1 2008-11-04 20:16:45 hoffman Exp $ ***************************************************************************/ /* If you have problems, all libcurl docs and details are found here: @@ -1133,7 +1133,7 @@ typedef enum { } #endif -#ifdef __BEOS__ +#if defined __BEOS__ || defined __HAIKU__ #include #endif diff --git a/Utilities/cmcurl/select.c b/Utilities/cmcurl/select.c index 3c7290b83..05b7c05e2 100644 --- a/Utilities/cmcurl/select.c +++ b/Utilities/cmcurl/select.c @@ -18,7 +18,7 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id: select.c,v 1.2 2007-03-15 19:22:13 andy Exp $ + * $Id: select.c,v 1.2.12.1 2008-11-04 20:16:45 hoffman Exp $ ***************************************************************************/ #include "setup.h" @@ -39,7 +39,7 @@ #error "We can't compile without select() support!" #endif -#ifdef __BEOS__ +#if defined(__BEOS__) && !defined(__HAIKU__) /* BeOS has FD_SET defined in socket.h */ #include #endif diff --git a/Utilities/cmtar/util.c b/Utilities/cmtar/util.c index 550fb93df..31f7fc878 100644 --- a/Utilities/cmtar/util.c +++ b/Utilities/cmtar/util.c @@ -110,6 +110,13 @@ mkdirhier(char *path) if (dst[0] != '\0') strcat(dst, "/"); strcat(dst, dirp); + +#if defined(_WIN32) + /* On some Windows machine, trying to mkdir("C:") would fail miserably */ + if (dst[strlen(dst) - 1] == ':') + continue; +#endif + if ( #if defined(_WIN32) && !defined(__CYGWIN__) mkdir(dst) == -1 diff --git a/Utilities/cmzlib/zconf.h b/Utilities/cmzlib/zconf.h index 904f9a122..0a722227b 100644 --- a/Utilities/cmzlib/zconf.h +++ b/Utilities/cmzlib/zconf.h @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: zconf.h,v 1.3 2007-09-11 15:22:29 david.cole Exp $ */ +/* @(#) $Id: zconf.h,v 1.3.2.1 2008-11-04 20:16:46 hoffman Exp $ */ #ifndef ZCONF_H #define ZCONF_H @@ -237,7 +237,7 @@ # endif #endif -#if defined (__BEOS__) +#if defined (__BEOS__) && !defined (__HAIKU__) # ifdef ZLIB_DLL # ifdef ZLIB_INTERNAL # define ZEXPORT __declspec(dllexport) diff --git a/Utilities/cmzlib/zutil.h b/Utilities/cmzlib/zutil.h index 68f4de1a0..cd881a93d 100644 --- a/Utilities/cmzlib/zutil.h +++ b/Utilities/cmzlib/zutil.h @@ -8,7 +8,7 @@ subject to change. Applications should only use zlib.h. */ -/* @(#) $Id: zutil.h,v 1.2 2007-09-11 15:22:29 david.cole Exp $ */ +/* @(#) $Id: zutil.h,v 1.2.2.1 2008-11-04 20:16:46 hoffman Exp $ */ #ifndef ZUTIL_H #define ZUTIL_H @@ -147,7 +147,13 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # define OS_CODE 0x0f #endif -#if defined(_BEOS_) || defined(RISCOS) +/* Haiku defines both __HAIKU__ and __BEOS__ (for now) */ +/* many BeOS workarounds are no longer needed in Haiku */ +#if defined(__HAIKU__) && defined(__BEOS__) +#undef __BEOS__ +#endif + +#if defined(_BEOS_) || defined(RISCOS) # define fdopen(fd,mode) NULL /* No fdopen() */ #endif diff --git a/bootstrap b/bootstrap index 5da59a763..14e9e2a9c 100755 --- a/bootstrap +++ b/bootstrap @@ -5,8 +5,8 @@ # Program: CMake - Cross-Platform Makefile Generator # Module: $RCSfile: bootstrap,v $ # Language: Bourne Shell -# Date: $Date: 2008-03-07 21:26:29 $ -# Version: $Revision: 1.113 $ +# Date: $Date: 2008-10-24 15:18:44 $ +# Version: $Revision: 1.113.2.1 $ # # Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. # See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -73,6 +73,13 @@ else cmake_system_beos=false fi +# Determine whether this is Haiku +if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then + cmake_system_haiku=true +else + cmake_system_haiku=false +fi + # Choose the generator to use for bootstrapping. if ${cmake_system_mingw}; then # Bootstrapping from an MSYS prompt. @@ -603,6 +610,11 @@ if ${cmake_system_beos}; then cmake_ld_flags="${LDFLAGS} -lroot -lbe" fi +# Add Haiku toolkits... +if ${cmake_system_haiku}; then + cmake_ld_flags="${LDFLAGS} -lroot -lbe" +fi + # Test C compiler cmake_c_compiler= @@ -1129,7 +1141,7 @@ fi # Just to be safe, let us store compiler and flags to the header file -cmake_bootstrap_version='$Revision: 1.113 $' +cmake_bootstrap_version='$Revision: 1.113.2.1 $' cmake_compiler_settings_comment="/* * Generated by ${cmake_source_dir}/bootstrap * Version: ${cmake_bootstrap_version}