summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt23
-rw-r--r--CTestCustom.cmake.in1
-rw-r--r--ChangeLog.manual460
-rw-r--r--CompileFlags.cmake6
-rw-r--r--Modules/BundleUtilities.cmake2
-rw-r--r--Modules/CMakeAddNewLanguage.txt16
-rw-r--r--Modules/CMakeCCompilerId.c.in16
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in16
-rw-r--r--Modules/CMakeExpandImportedTargets.cmake2
-rw-r--r--Modules/CMakeFindEclipseCDT4.cmake2
-rw-r--r--Modules/CPackDeb.cmake6
-rw-r--r--Modules/CPackRPM.cmake6
-rw-r--r--Modules/Compiler/TI_DSP-ASM.cmake8
-rw-r--r--Modules/Compiler/TI_DSP-C.cmake10
-rw-r--r--Modules/Compiler/TI_DSP-CXX.cmake10
-rw-r--r--Modules/DeployQt4.cmake2
-rw-r--r--Modules/FeatureSummary.cmake2
-rw-r--r--Modules/FindBLAS.cmake4
-rw-r--r--Modules/FindBZip2.cmake2
-rw-r--r--Modules/FindBoost.cmake1561
-rw-r--r--Modules/FindCups.cmake2
-rw-r--r--Modules/FindCurses.cmake2
-rw-r--r--Modules/FindFLTK.cmake2
-rw-r--r--Modules/FindGIF.cmake4
-rw-r--r--Modules/FindGLU.cmake2
-rw-r--r--Modules/FindGnuplot.cmake2
-rw-r--r--Modules/FindHDF5.cmake2
-rw-r--r--Modules/FindIcotool.cmake56
-rw-r--r--Modules/FindKDE3.cmake2
-rw-r--r--Modules/FindLAPACK.cmake4
-rw-r--r--Modules/FindMPEG2.cmake2
-rw-r--r--Modules/FindMPI.cmake2
-rw-r--r--Modules/FindOpenGL.cmake2
-rw-r--r--Modules/FindOpenMP.cmake4
-rw-r--r--Modules/FindOpenSSL.cmake7
-rw-r--r--Modules/FindOpenSceneGraph.cmake2
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake4
-rw-r--r--Modules/FindPerl.cmake2
-rw-r--r--Modules/FindPerlLibs.cmake2
-rw-r--r--Modules/FindPythonLibs.cmake2
-rw-r--r--Modules/FindQt.cmake16
-rw-r--r--Modules/FindQt4.cmake4
-rw-r--r--Modules/FindSDL.cmake3
-rw-r--r--Modules/FindSelfPackers.cmake2
-rw-r--r--Modules/FindSquish.cmake159
-rw-r--r--Modules/FindTCL.cmake6
-rw-r--r--Modules/FindTclStub.cmake2
-rw-r--r--Modules/FindUnixCommands.cmake2
-rw-r--r--Modules/FindVTK.cmake4
-rw-r--r--Modules/FindWget.cmake2
-rw-r--r--Modules/FindX11.cmake6
-rw-r--r--Modules/Findosg.cmake2
-rw-r--r--Modules/FindosgAnimation.cmake2
-rw-r--r--Modules/FindosgDB.cmake2
-rw-r--r--Modules/FindosgFX.cmake2
-rw-r--r--Modules/FindosgGA.cmake2
-rw-r--r--Modules/FindosgIntrospection.cmake2
-rw-r--r--Modules/FindosgManipulator.cmake2
-rw-r--r--Modules/FindosgParticle.cmake2
-rw-r--r--Modules/FindosgPresentation.cmake2
-rw-r--r--Modules/FindosgProducer.cmake2
-rw-r--r--Modules/FindosgQt.cmake2
-rw-r--r--Modules/FindosgShadow.cmake2
-rw-r--r--Modules/FindosgSim.cmake2
-rw-r--r--Modules/FindosgTerrain.cmake2
-rw-r--r--Modules/FindosgText.cmake2
-rw-r--r--Modules/FindosgUtil.cmake2
-rw-r--r--Modules/FindosgViewer.cmake2
-rw-r--r--Modules/FindosgVolume.cmake2
-rw-r--r--Modules/FindosgWidget.cmake2
-rw-r--r--Modules/FindwxWindows.cmake2
-rw-r--r--Modules/Platform/Darwin.cmake18
-rw-r--r--Modules/Platform/FreeBSD.cmake24
-rw-r--r--Modules/Platform/NetBSD.cmake24
-rwxr-xr-xModules/Squish4RunTestCase.bat24
-rwxr-xr-xModules/Squish4RunTestCase.sh28
-rw-r--r--Modules/SquishTestScript.cmake52
-rw-r--r--Modules/TestForANSIStreamHeaders.cmake2
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/CPack/cmCPackComponentGroup.h4
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx12
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx17
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx26
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx126
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.h3
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx12
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx2
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx2
-rw-r--r--Source/cmAddCustomCommandCommand.h5
-rw-r--r--Source/cmCTest.cxx3
-rw-r--r--Source/cmCTest.h2
-rw-r--r--Source/cmConfigureFileCommand.h22
-rw-r--r--Source/cmDepends.cxx19
-rw-r--r--Source/cmDepends.h6
-rw-r--r--Source/cmDependsC.cxx243
-rw-r--r--Source/cmDependsC.h7
-rw-r--r--Source/cmDependsFortran.cxx52
-rw-r--r--Source/cmDependsFortran.h2
-rw-r--r--Source/cmDependsJava.cxx6
-rw-r--r--Source/cmDependsJava.h3
-rw-r--r--Source/cmDocumentation.cxx2
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx25
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h1
-rw-r--r--Source/cmFileCommand.cxx15
-rw-r--r--Source/cmFileCommand.h3
-rw-r--r--Source/cmFindBase.cxx15
-rw-r--r--Source/cmFindBase.h2
-rw-r--r--Source/cmFindLibraryCommand.cxx197
-rw-r--r--Source/cmFindLibraryCommand.h4
-rw-r--r--Source/cmFunctionCommand.h4
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx1
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx8
-rw-r--r--Source/cmIDEOptions.cxx11
-rw-r--r--Source/cmIDEOptions.h1
-rw-r--r--Source/cmIncludeDirectoryCommand.h5
-rw-r--r--Source/cmListCommand.cxx36
-rw-r--r--Source/cmLoadCommandCommand.cxx4
-rw-r--r--Source/cmLoadCommandCommand.h15
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx10
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h3
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx14
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx8
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx1
-rw-r--r--Source/cmMacroCommand.h8
-rw-r--r--Source/cmMathCommand.h4
-rw-r--r--Source/cmMessageCommand.h5
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx1
-rw-r--r--Source/cmPolicies.cxx2
-rw-r--r--Source/cmSourceFile.cxx2
-rw-r--r--Source/cmSourceGroupCommand.h2
-rw-r--r--Source/cmTarget.cxx11
-rw-r--r--Source/cmTarget.h2
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h4
-rw-r--r--Source/cmTryRunCommand.h2
-rw-r--r--Source/cmVS10LinkFlagTable.h6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx167
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h3
-rw-r--r--Source/cmWin32ProcessExecution.cxx56
-rw-r--r--Source/cmcldeps.cxx4
-rw-r--r--Source/cmw9xcom.cxx10
-rw-r--r--Source/kwsys/CMakeLists.txt105
-rw-r--r--Source/kwsys/CTestConfig.cmake11
-rw-r--r--Source/kwsys/Configure.h.in14
-rw-r--r--Source/kwsys/ProcessUNIX.c1
-rw-r--r--Source/kwsys/SystemInformation.cxx1671
-rw-r--r--Source/kwsys/SystemInformation.hxx.in87
-rw-r--r--Source/kwsys/SystemTools.cxx2
-rw-r--r--Source/kwsys/kwsysPlatformTestsCXX.cxx66
-rw-r--r--Source/kwsys/testSystemInformation.cxx34
-rw-r--r--Tests/BuildDepends/Project/CMakeLists.txt3
-rw-r--r--Tests/BuildDepends/Project/dep_custom2.cxx2
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/CMakeOnly/AllFindModules/CMakeLists.txt5
-rw-r--r--Tests/CMakeOnly/CMakeLists.txt19
-rw-r--r--Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt46
-rw-r--r--Tests/CMakeOnly/Test.cmake.in6
-rw-r--r--Tests/CMakeOnly/find_library/A/libtestA.a0
-rw-r--r--Tests/CMakeOnly/find_library/B/libtestB.a0
-rw-r--r--Tests/CMakeOnly/find_library/CMakeLists.txt49
-rw-r--r--Tests/CMakeTests/CheckCMakeTest.cmake53
-rw-r--r--Tests/CMakeTests/File-Glob-NoArg.cmake2
-rw-r--r--Tests/CMakeTests/FileTest.cmake.in11
-rw-r--r--Tests/CMakeTests/GetProperty-Doc-Properties.cmake10
-rw-r--r--Tests/CMakeTests/GetPropertyTest.cmake.in34
-rw-r--r--Tests/CMakeTests/List-Get-CMP0007-Warn.cmake6
-rw-r--r--Tests/CMakeTests/List-Get-Invalid-Index.cmake2
-rw-r--r--Tests/CMakeTests/List-Insert-Invalid-Index.cmake2
-rw-r--r--Tests/CMakeTests/List-Invalid-Subcommand.cmake1
-rw-r--r--Tests/CMakeTests/List-Length-Too-Many-Arguments.cmake1
-rw-r--r--Tests/CMakeTests/List-No-Arguments.cmake1
-rw-r--r--Tests/CMakeTests/List-Remove_At-Invalid-Index.cmake2
-rw-r--r--Tests/CMakeTests/List-Remove_At-Nonexistent-List.cmake2
-rw-r--r--Tests/CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake2
-rw-r--r--Tests/CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake1
-rw-r--r--Tests/CMakeTests/List-Remove_Item-Nonexistent-List.cmake2
-rw-r--r--Tests/CMakeTests/List-Reverse-Nonexistent-List.cmake2
-rw-r--r--Tests/CMakeTests/List-Reverse-Too-Many-Arguments.cmake1
-rw-r--r--Tests/CMakeTests/List-Sort-Nonexistent-List.cmake2
-rw-r--r--Tests/CMakeTests/List-Sort-Too-Many-Arguments.cmake1
-rw-r--r--Tests/CMakeTests/ListTest.cmake.in88
-rw-r--r--Tests/CMakeTests/Make_Directory-NoArg.cmake1
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt8
-rw-r--r--Tests/GeneratorExpression/check.cmake7
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt9
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadAND.cmake1
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt9
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadOR.cmake1
-rw-r--r--Tests/RunCMake/load_command/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/load_command/LoadCommandDeprecated-stderr.txt6
-rw-r--r--Tests/RunCMake/load_command/LoadCommandDeprecated.cmake1
-rw-r--r--Tests/RunCMake/load_command/RunCMakeTest.cmake3
-rwxr-xr-xUtilities/Git/pre-commit14
-rw-r--r--Utilities/KWIML/ABI.h.in4
-rwxr-xr-xbootstrap23
199 files changed, 4496 insertions, 1884 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea1c033..a67fb6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -585,6 +585,29 @@ option(CMAKE_STRICT
"Perform strict testing to record property and variable access. Can be used to report any undefined properties or variables" OFF)
mark_as_advanced(CMAKE_STRICT)
+if(NOT CMake_VERSION_IS_RELEASE)
+ if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND
+ NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2)
+ set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
+ -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security
+ -Wmissing-format-attribute -fno-common
+ )
+ set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
+ -Wshadow -Wpointer-arith -Wformat-security
+ )
+
+ foreach(FLAG_LANG C CXX)
+ foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST})
+ if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ")
+ set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}")
+ endif()
+ endforeach()
+ endforeach()
+
+ unset(C_FLAGS_LIST)
+ unset(CXX_FLAGS_LIST)
+ endif()
+endif()
# build the remaining subdirectories
add_subdirectory(Source)
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index 1e6224b..495d156 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -31,6 +31,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
"remark: .*LOOP WAS VECTORIZED"
"warning .980: wrong number of actual arguments to intrinsic function .std::basic_"
"LINK : warning LNK4089: all references to.*ADVAPI32.dll.*discarded by /OPT:REF"
+ "LINK : warning LNK4089: all references to.*PSAPI.DLL.*discarded by /OPT:REF"
"LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF"
"Warning: library was too large for page size.*"
"Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*"
diff --git a/ChangeLog.manual b/ChangeLog.manual
index cdab442..aa55348 100644
--- a/ChangeLog.manual
+++ b/ChangeLog.manual
@@ -1,3 +1,463 @@
+Changes in CMake 2.8.10.1 (since 2.8.10)
+----------------------------------------------
+Brad King (5):
+ Fix default PDB output directory (#13644)
+ Fix PathScale compiler id for Clang-based upstream
+ Update programmatically-reported copyright year (#13638)
+ FindSDL: Restore accidentally dropped search paths (#13651)
+ OS X: Fix default CMAKE_OSX_SYSROOT with deployment target
+
+Rolf Eike Beer (2):
+ FindOpenSSL: fix library selection on Windows (#13645)
+ FindOpenSSL: also find the non-MD debug libraries for MSVC
+
+Stephen Kelly (1):
+ GenEx: Use case insensitive comparison for $<CONFIG:...>
+
+Changes in CMake 2.8.10 (since 2.8.10-rc3)
+----------------------------------------------
+None
+
+Changes in CMake 2.8.10-rc3 (since 2.8.10-rc2)
+----------------------------------------------
+Rolf Eike Beer (2):
+ SelectLibraryConfigurations: add testcase
+ SelectLibraryConfigurations: fix for release and debug libs being the same
+
+Stephen Kelly (5):
+ BasicConfigVersion: Make docs refer to the macro, not the module name
+ Document LOCATION undefined behavior with use of LINKER_LANGUAGE.
+ GenEx: Add an accessor for imported targets in a makefile.
+ GenEx: Create cmGeneratorTargets for imported targets.
+ GexEx: Validate Target names and property names differently.
+
+Thomas Arcila (1):
+ SelectLibraryConfigurations: Fix foreach(x IN LISTS ...) syntax
+
+Changes in CMake 2.8.10-rc2 (since 2.8.10-rc1)
+----------------------------------------------
+Alex Neundorf (2):
+ Document CMAKE_FIND_PACKAGE_NAME
+ Automoc: fix #13572: issue with symbolic links
+
+Brad King (4):
+ cmCTestSVN: Fix compilation with Sun CC 5.1
+ if: Document that plain 'NOTFOUND' is a false constant
+ string: Clarify regex documentation of '-' behavior
+ FortranCInterface: Pass all flags to VERIFY project (#13579)
+
+David Cole (1):
+ NSIS: Fix incorrect uninstall registry key name (#13578)
+
+Eric NOULARD (3):
+ CPACK_XX_ON_ABSOLUTE_INSTALL_DESTINATION is now properly checked for ON/OFF
+ Document CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY and fix some typo.
+ Make CPACK_SET_DESTDIR work with archive generator + component-based packaging
+
+Jean-Christophe Fillion-Robin (1):
+ CTest: Ensure CTEST_USE_LAUNCHERS behaves nicely in Superbuild setup
+
+Pere Nubiola i Radigales (1):
+ Find PostgreSQL headers on Debian
+
+Peter Kümmel (4):
+ Ninja: also set OBJECT_DIR when compiling
+ Ninja: don't pollute current dir when using gui (#13495)
+ Ninja: implicit dependency for custom command files
+ Fix regression: write compile definitions if any
+
+Philip Lowman (4):
+ FindGTK2: Rollback lib64 changes which broke header file finding
+ FindGTK2: #12049 fix detection of header files on multiarch systems
+ FindGTK2: #12596 Missing paths for FindGTK2 on NetBSD
+ FindGTK2: Update local changelog
+
+Rolf Eike Beer (6):
+ CTest: fix usage of memory checker with spaces in path
+ CTest: fix pre and post test commands with spaces
+ CTest: add tests that simulate memcheck runs
+ CTest: improve memory checker type detection
+ CTest: add a test for CTEST_CUSTOM_MEMCHECK_IGNORE
+ CTest: add a check with a quoted memory checker
+
+Stephen Kelly (18):
+ GenEx: It is not an error to specify an empty parameter
+ GenEx: Return after error reported.
+ GenEx: Report actual target name not found, not "0" each time.
+ GenEx: Parse comma after colon tokens specially
+ GenEx: Validate target and property names.
+ GenEx: Ensure that the empty CONFIGURATION can be used conditionally.
+ GenEx: Add test for $<BOOL:> with empty parameter.
+ GenEx: Add tests for "0" and "1" expressions with literal commas.
+ GenEx: Don't use std::vector::at(int).
+ Attempt to fix the compile of cmake on Sun CC.
+ GenEx: Parse colon after arguments separator colon specially.
+ GenEx: Test the use of generator expressions to generate lists.
+ GenEx: Fix termination bugs in generator expression parser.
+ GenEx: Break if there are no more commas in the container
+ GenEx: Add some more asserts to verify code-sanity.
+ GenEx: Replace some failing tests with Borland and NMake makefiles.
+ GenEx: Fix reporting about not-found include directories and libraries.
+ Fix config-specific INCLUDE_DIRECTORIES in multi-config generators
+
+Changes in CMake 2.8.10-rc1 (since 2.8.9)
+-----------------------------------------
+Scripted Changes (3):
+ Remove trailing whitespace from most CMake and C/C++ code
+ Convert CMake-language commands to lower case
+ Remove CMake-language block-end command arguments
+
+Alex Neundorf (27):
+ Eclipse: add support for the 4.2 Juno release (#13367)
+ Eclipse: improve (fix ?) version detection on OSX
+ Eclipse: fix #13358: don't create bad linked resources
+ Eclipse: fix #13358: don't create bad linked resources
+ remove non-working KDE4 test
+ Eclipse on OSX: fix handling of framework include dirs (#13464)
+ Eclipse on OSX: improve handling of framework include dirs (#13367)
+ -fix line length
+ fix #13474: also rescan dependencies if the depender does not exist
+ -fix line length
+ -fix Java dependency scanning, broken in previous commit
+ error out if CTEST_USE_LAUNCHERS is TRUE but RULE_LAUNCH_* are not set
+ fix #13494: rerun automoc also if include dirs or moc options change
+ CMakeDetermineFortranCompiler: add support for cross-compiling (#13379)
+ Automoc: fix #13493, use target properties for include dirs
+ Automoc: do not use DEFINITIONS, but only COMPILE_DEFINITIONS
+ Automoc: also the makefile-COMPILE_DEFINITIONS
+ cmGlobalGenerator.h: some minor coding style fixes
+ Modules/readme.txt: fix typo
+ find_package: add support for a <package>_NOT_FOUND_MESSAGE variable
+ exports: store pointers to all installations of each export set
+ exports: accept a missing target if it is exported exactly once
+ exports: first try at error handling if a target is missing
+ exports: fix build with MSVC6
+ exports: move the handling of missing targets into subclasses
+ exports: define a CMAKE_FIND_PACKAGE_NAME var set by find_package()
+ exports: add a test for exporting dependent targets
+
+Andreas Mohr (1):
+ FindCURL: Find older MSVC prebuilts
+
+Andy Piper (1):
+ Do not include directories which are part of the package install prefix.
+
+Benjamin Eikel (21):
+ Initial version of find module
+ FindSDL: Add version support for FindSDL_net
+ FindSDL: Version support for FindSDL_image
+ FindSDL: Use prefix SDL_NET, because it matches the file name.
+ FindSDL: Use SDL_IMAGE prefix for varibales
+ FindSDL: Add "cmake_minimum_required" to "try_compile" project
+ FindSDL: Format the documentation
+ FindSDL: Version support for FindSDL_sound
+ FindSDL: Use same capitalization for FPHSA as file name
+ FindSDL: Pass SDL_SOUND_LIBRARY to FIND_PACKAGE_HANDLE_STANDARD_ARGS
+ FindSDL: Use SDL_MIXER prefix for variables
+ FindSDL: Add version support for FindSDL_mixer
+ FindSDL: Update documentation
+ FindSDL: Use SDL_TTF prefix for variables
+ FindSDL: Add version support for FindSDL_ttf
+ FindSDL: Update documentation
+ FindSDL: Format documentation
+ FindSDL: Add version support
+ FindSDL: Add my copyright tag to all FindSDL_* modules
+ FindSDL: Remove from find_... calls PATHS that are set by default
+ FindSDL: Stay compatible with old input variables
+
+Bill Hoffman (8):
+ Use OUTPUT_NORMAL instead of OUTPUT_MERGE for cmake -E chdir.
+ curl: Use find_package(OpenSSL)
+ curl: Make OpenSSL DLLs available to CMake on Windows
+ file(DOWNLOAD): Generalize EXPECTED_MD5 to EXPECTED_HASH
+ file(DOWNLOAD): Add options for SSL
+ Utilities/Release: Enable CMAKE_USE_OPENSSL in nightly binaries
+ Add SSL_VERIFYPEER and CAINFO file options to ExternalProject_Add.
+ Revert "Ninja: don't expand any rsp files"
+
+Brad King (83):
+ find_library: Add test covering lib->lib64 cases
+ find_library: Refactor lib->lib64 conversion
+ find_library: Simplify lib->lib<arch> expansion
+ find_library: Fix mixed lib->lib64 (non-)conversion cases (#13419)
+ CMakeDetermine(C|CXX)Compiler: Consider Clang compilers
+ Factor common code out of CMakeDetermine(ASM|C|CXX|Fortran)Compiler
+ Prefer generic system compilers by default for C, C++, and Fortran
+ Xcode: Fix object library references in multi-project trees (#13452)
+ Xcode: Run xcode-select to find Xcode version file (#13463)
+ Watcom: Simplify compiler version detection (#11866)
+ Remove trailing TAB from NSIS.template.in
+ Fix WarnUnusedUnusedViaUnset test pass/fail regex
+ CMakeVersion.bash: Update sed expression for lower-case 'set'
+ GetPrerequisites: Mark file_cmd as advanced cache entry
+ Add boolean generator expressions
+ Add $<CONFIG:...> boolean query generator expression
+ Recognize Clang ASM support (#13473)
+ Xcode: Set ASM source language in project file (#13472)
+ Tests/Assembler: Do not use assembler in universal binaries
+ Add FindHg module to find Mercurial
+ ExternalProject: Add Mercurial (hg) repository support
+ Qt4Macros: Fix recently broken resource file parsing
+ Tests/ObjectLibrary: Do not enable CXX in subdirectories
+ VS11: Rename 'Immersive' to 'WindowsAppContainer' (#12930)
+ VS: Disable precompiled headers unless enabled by project (#12930)
+ VS11: Generate flag tables from MSBuild V110 tool files
+ Detect Compaq compiler version with its id
+ Detect PathScale compiler version with its id
+ Detect TI compiler version with its id
+ Detect Comeau compiler version with its id
+ Detect SDCC compiler version with its id
+ Detect Cray compiler version with its id
+ Detect Analog VisualDSP++ compiler version with its id
+ Re-order C/C++/Fortran compiler determination logic
+ CMakeDetermineCompilerId: Prepare to detect IDE compiler id
+ Xcode: Detect the compiler id and tool location
+ VS10: Define CMAKE_VS_PLATFORM_TOOLSET variable
+ VS: Detect the compiler id and tool location
+ Cleanly enable a language in multiple subdirectories
+ Test variables CMAKE_(C|CXX|Fortran)_COMPILER(|_ID|_VERSION)
+ Document CMAKE_<LANG>_COMPILER_(ID|VERSION) values
+ Make platform information files specific to the CMake version
+ Move CMAKE_<LANG>_COMPILER_WORKS to compiler information files
+ Store ABI detection results in compiler information files
+ VS: Remove support for "free" version 2003 tools
+ VS: Simplify MSVC version reporting
+ Modernize MSVC compiler information files
+ VS: Fix MSVC_IDE definition recently broken by refactoring
+ add_library: Document POSITION_INDEPENDENT_CODE default (#13479)
+ magrathea: Tell cmELF about DT_RUNPATH (#13497)
+ Utilities/Release: Link AIX binary with large maxdata
+ Utilities/xml: Add .gitattributes to disable whitespace checks
+ Utilities/xml: Add docbook-4.5 DTD (#13508)
+ docbook: Fix formatter naming convention to avoid shadow
+ docbook: Fix Sun CC warning on ptr_fun(isalnum)
+ curl: Honor OPENSSL_NO_SSL2
+ if: Compare up to 8 components in VERSION tests
+ ExternalProject: Generalize URL_MD5 option to URL_HASH
+ Rename SSL terminology to TLS
+ file(DOWNLOAD): Make TLS options behave as documented
+ OS X: Add platform-specific Clang compiler info files (#13536)
+ VS11: Detect VS 2012 Express for default generator (#13348)
+ VS11: Add VS 2012 Express support (#13348)
+ file(DOWNLOAD): Add HTTP User-Agent string
+ ExternalProject: Add DOWNLOAD_NAME option
+ file(DOWNLOAD): Change EXPECTED_HASH to take ALGO=value
+ VS8: Remove '.NET' from generator description (#10158)
+ Clang: Split Compiler/Clang* modules out from GNU (#13550)
+ Clang: All versions know about -fPIE (#13550)
+ Xcode: Remove unused code reading CMAKE_OSX_SYSROOT_DEFAULT
+ OS X: Always generate -isysroot if any SDK is in use
+ OS X: Improve default CMAKE_OSX_SYSROOT selection
+ bootstrap: Suppress CMAKE_OSX_SYSROOT if CFLAGS have -isysroot
+ Tests/Assembler: Use CMAKE_OSX_SYSROOT to generate .s file
+ OS X: Allow CMAKE_OSX_SYSROOT to be a logical SDK name
+ OS X: Simplify selection of CMAKE_OSX_ARCHITECTURES
+ OS X: If CMAKE_OSX_SYSROOT is already set do not compute default
+ OS X: Further improve default CMAKE_OSX_SYSROOT selection
+ OS X: Teach deployment target sanity check about SDK names
+ OS X: Ignore MACOSX_DEPLOYMENT_TARGET during Xcode compiler id
+ Verify that PDB_(NAME|OUTPUT_DIRECTORY) are honored in test
+ Document that PDB_(NAME|OUTPUT_DIRECTORY) are ignored for VS 6
+ Run PDBDirectoryAndName test on MSVC and Intel
+
+Clinton Stimpson (8):
+ fphsa: clarify message about minimum required version found.
+ DeployQt4: Include DESTDIR for some cpack generators.
+ Add -DNDEBUG to RelWithDebInfo flags where where Release flags had it.
+ Fix regex for qt minor version.
+ FindQt4: Give precedence to QTDIR environment variable, if set.
+ FindQt4: Give precedence to QTDIR environment variable, if set.
+ Fix errors detecting Qt4 on Windows 8.
+ cmake-gui: Fix error status when interrupted.
+
+Daniel Pfeifer (8):
+ Simplify CMake.HTML documentation test command line
+ docbook: Remove table of contents
+ docbook: Factor out code to write valid DocBook IDs
+ docbook: Fix the DocBook section output
+ docbook: Cleanup formatter and generated DocBook
+ docbook: Add support for <abstract> at section level 1
+ docbook: Add CMake.DocBook test to validate xml (#13508)
+ docbook: Remove redundant docs that cause invalid DocBook
+
+David Cole (9):
+ Begin post-2.8.9 development
+ Release: Temporarily exclude ExternalProject test on cygwin
+ Add ability to run as a ctest -S script also
+ CMake: Clarify the documentation for if(f1 IS_NEWER_THAN f2)
+ Convert the CPACK_CYGWIN_PATCH_NUMBER variable to a cache variable
+ InstallRequiredSystemLibraries: Use correct file names (#13315)
+ ProcessorCount: Mark find_program vars as advanced (#13236)
+ FindQt4: Avoid "finding" non-existent library in a .framework
+ FindMPI: Set correct variables for calls to FPHSA
+
+Eric NOULARD (2):
+ Enhance DESTDIR documentation. Fixes #0012374.
+ Handles %attr(nnn,-,-) /path/to/file in CPACK_RPM_USER_FILELIST properly.
+
+James Bigler (3):
+ Replace -g3 with -g for CUDA 4.1 and 4.2 in addition to CUDA < 3.0.
+ Added CUDA_SOURCE_PROPERTY_FORMAT. Allows setting per file format (OBJ or PTX)
+ FindCUDA: Added CUDA_HOST_COMPILER variable.
+
+Marcin Wojdyr (1):
+ Remove CMake multiline block-end command arguments
+
+Nils Gladitz (1):
+ ctest_update: Tell svn not to prompt interactively (#13024)
+
+Patrick Gansterer (4):
+ VS: Cleanup AddPlatformDefinitions() of Visual Studio generators
+ Add additional architectures to CMakePlatformId.h.in
+ Add WindowsCE platform information files
+ VS: Remove duplicated implementations of CreateLocalGenerator()
+
+Peter Kuemmel (1):
+ Ninja: don't expand any rsp files
+
+Peter Kümmel (15):
+ Ninja: cmcldeps needs a compiler
+ Ninja: don't crash on returned 0 pointer
+ Ninja: prepare msvc pdb cleanup
+ Ninja:split out setting of msvc TARGET_PDB
+ Ninja: remove GetTargetPDB because it is used only once
+ Ninja: also detect /showInclude prefix for icl
+ Find mingw's windres also when Unix Makefiles are used
+ Ninja: don't suppress warning about compiler options
+ Ninja: suppress cmcldeps only for source file signature try_compiles
+ Ninja: filter target specific compile flags with language specific regex
+ Ninja: OBJECT_DEPENDS should set an implicit dependency
+ Ninja: don't confuse ninja's rsp files with nmake's
+ Ninja: move -LIBPATH behind -link option
+ Ninja: move <OBJECTS> in front of the first linker option
+ Ninja: add option to enforce usage of response files
+
+Philip Lowman (3):
+ FindOpenSceneGraph: CMake variable OSG_DIR influences detection now too
+ FindGTK2: Add GTK2_CAIROMMCONFIG_INCLUDE_DIR for cairommconfig.h
+ CMakeDetermineVSServicePack: Visual Studio 2012 added
+
+Rolf Eike Beer (25):
+ remove lib64 Unix paths if the respective lib path is also given
+ FindOpenSSL: find cross-compiled OpenSSL from MinGW (#13431)
+ FindOpenSSL: use SelectLibraryConfigurations
+ FindOpenSSL: let CMake handle environment variable HINTS
+ FindOpenSSL: cleanup path hints
+ FindOpenSSL: remove leftover comment
+ SelectLibraryConfiguration: generate correct output when input vars are lists
+ Fix typo direcotry -> directory (and similar) [#13444]
+ FindSelfPackers: fix typo (#13456)
+ CheckTypeSize: show in documentation how to get struct member size (#10579)
+ CheckTypeSize: add a test for size of struct members
+ FindX11: remove duplicates from X11 include path list (#13316)
+ FindX11: avoid calling list(REMOVE_DUPLICATES) on an empty list
+ list command: error on too many arguments
+ CMake.List test: explicitely test with lists containing only an empty string
+ use the find_* functions ENV parameter
+ use PATH_SUFFIXES to simplify find_* calls
+ do not escape spaces in regular expressions
+ read less from version headers into variables
+ FindFLEX: fix version extraction on Apple
+ FindGettext: remove code duplicating FPHSA checks
+ include FPHSA from current directory in all modules
+ FindOpenSceneGraph: simplify by using more features of FPHSA
+ FindSDL: add SDLMAIN_LIBRARY only once (#13262)
+ add documentation for all MSVCxxx version variables (#12567)
+
+Sergei Nikulov (1):
+ fix for discovering ft2build.h using FREETYPE_DIR environment var (#13502)
+
+Stephen Kelly (60):
+ Add new qt4_use_modules function.
+ Add missing whitespace to docs.
+ Fix some typos in the docs.
+ Remove incorrect doc string for link type enum
+ Remove duplicate 'of' from docs.
+ Fix unfortunate documentation error for PIC feature.
+ Don't duplicate -D defines sent to the compiler.
+ Fix CompileDefinitions test on Visual Studio.
+ Fix the test setting COMPILE_DEFINITIONS target property
+ Rename files from main.cpp to more meaningful names.
+ Fix casing of 'Qt' in docs, comments and user-visible strings.
+ Read entire Qt4 qrc file when parsing for depends info.
+ Add a return-after-error if an old Qt is found.
+ Use CMake platform variables instead of Qt ones.
+ Move variable setting down to where it relates to.
+ Remove an if which is always true.
+ Use add_subdirectory instead of the obsolete subdirs.
+ Replace two include_directories with a setting.
+ Compile with both Qt4 and Qt5.
+ Build with Qt5 if it is found.
+ cmGeneratorExpression: Re-write for multi-stage evaluation
+ cmGeneratorExpression: Port users to two-stage processing
+ Fix the regular expression validator for target names.
+ Handle colons as a special case in the generator expression parser.
+ Enable deprecated API when using Qt 5.
+ Add more forwarding API to cmGeneratorTarget.
+ Store cmGeneratorTargets with the makefile.
+ Move GenerateTargetManifest to cmGeneratorTarget.
+ Move GetLinkInformation to cmGeneratorTarget
+ Make cmLocalGenerator::AddArchitectureFlags take a cmGeneratorTarget.
+ Move GetCreateRuleVariable to cmGeneratorTarget.
+ Port cmLocalGenerator::GetTargetFlags to cmGeneratorTarget.
+ Move GetIncludeDirectories to cmGeneratorTarget.
+ Append the COMPILE_DEFINITIONS from the Makefile to all targets.
+ Add a wrapper for accessing config-specific compile-definitions.
+ Add convenience for getting a cmGeneratorTarget to use.
+ Fix compiler warning with initialization order.
+ Revert "Move GenerateTargetManifest to cmGeneratorTarget."
+ Use the cmGeneratorTarget for the include directories API.
+ Fix indentation in the code blocks generator.
+ Port remaining code to GetCompileDefinitions().
+ Add include guard for cmGeneratorExpression.
+ Don't prepend a path before generator expressions in include_directories.
+ Convert paths in INCLUDE_DIRECTORIES property to Unix slashes.
+ Add an AppendDefines std::string overload.
+ Return a std::string from GetCompileDefinitions.
+ Refactor GetCompileDefinitions a bit.
+ Extend the generator expression language with more logic.
+ Add a generator expression for target properties.
+ Add API to check that dependent target properties form a DAG.
+ Add a self-reference check for target properties.
+ Early return if there is no target.
+ Process generator expressions in the INCLUDE_DIRECTORIES property.
+ Process generator expressions in the COMPILE_DEFINITIONS target property.
+ Fix the layout of the generator expression documentation.
+ Fix punctuation in some variables documentation.
+ Document that generator expressions can be used in target properties.
+ Remove unused parameter marker and the unused parameter.
+ Fix minor typos.
+ Remove period at the end of the check message.
+
+Tom Schutter (2):
+ cmake-mode.el: Use more readable regex and case-fold-search
+ cmake-mode.el: add local keybindings
+
+Xavier Besseron (7):
+ cmCTestSVN: Add the new SVNInfo structure
+ cmCTestSVN: Extend Revision struct with SVN repo information
+ cmCTestSVN: Add the Repositories list and the RootInfo pointer
+ cmCTestSVN: Create the SVNInfo for the root repository
+ cmCTestSVN: Use the SVNInfo structure
+ cmCTestSVN: Add a LoadExternal() function and an ExternalParser class
+ cmCTestSVN: Load and process information from externals
+
+Yuchen Deng (1):
+ Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830)
+
+Yury G. Kudryashov (7):
+ exports: Move cmTargetExport to a dedicated header file
+ exports: Remove cmTargetExport constructor
+ exports: Rename cmGlobalGenerator::AddTargetToExport{s,}
+ exports: Create class cmExportSet
+ exports: Add cmExportSetMap class
+ exports: Hold an ExportSet pointer in cm*Export*Generator
+ exports: cmGlobalGenerator::ExportSets destructor will clear it
+
+Zack Galbreath (2):
+ Clean up documentation formatting so that it is rendered properly in HTML.
+ cmparseMSBuildXML: Include DisplayName in the output
+
Changes in CMake 2.8.9 (since 2.8.9-rc3)
----------------------------------------
None
diff --git a/CompileFlags.cmake b/CompileFlags.cmake
index b2044e4..20f5dec 100644
--- a/CompileFlags.cmake
+++ b/CompileFlags.cmake
@@ -62,3 +62,9 @@ endif ()
if (CMAKE_ANSI_CFLAGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
endif ()
+
+# avoid binutils problem with large binaries, e.g. when building CMake in debug mode
+# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230
+if (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR STREQUAL parisc)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unique=.text.*")
+endif ()
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 4557be6..0f6cd05 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -369,7 +369,7 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag)
# For frameworks, construct the name under the embedded path from the
# opening "${item_name}.framework/" to the closing "/${item_name}":
#
- string(REGEX REPLACE "^.*(${item_name}.framework/.*/${item_name}).*$" "${default_embedded_path}/\\1" embedded_item "${item}")
+ string(REGEX REPLACE "^.*(${item_name}.framework/.*/?${item_name}).*$" "${default_embedded_path}/\\1" embedded_item "${item}")
else()
# For other items, just use the same name as the original, but in the
# embedded path:
diff --git a/Modules/CMakeAddNewLanguage.txt b/Modules/CMakeAddNewLanguage.txt
index 6a30dd8..612e1a3 100644
--- a/Modules/CMakeAddNewLanguage.txt
+++ b/Modules/CMakeAddNewLanguage.txt
@@ -1,3 +1,19 @@
+This file provides a few notes to CMake developers about how to add
+support for a new language to CMake. It is also possible to place
+these files in CMAKE_MODULE_PATH within an outside project to add
+languages not supported by upstream CMake. However, this is not
+a fully supported use case.
+
+The implementation behind the scenes of project/enable_language,
+including the compiler/platform modules, is an *internal* API that
+does not make any compatibility guarantees. It is not covered in the
+official reference documentation that is versioned with the source code.
+Maintainers of external language support are responsible for porting
+it to each version of CMake as upstream changes are made. Since
+the API is internal we will not necessarily include notice of any
+changes in release notes.
+
+
CMakeDetermine(LANG)Compiler.cmake -> this should find the compiler for LANG and configure CMake(LANG)Compiler.cmake.in
CMake(LANG)Compiler.cmake.in -> used by CMakeDetermine(LANG)Compiler.cmake
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index c5bde9a..2d76c7a 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -20,6 +20,14 @@
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif
+#elif defined(__PATHCC__)
+# define COMPILER_ID "PathScale"
+# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
+# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
+# if defined(__PATHCC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
+# endif
+
#elif defined(__clang__)
# define COMPILER_ID "Clang"
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
@@ -95,14 +103,6 @@
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
# endif
-#elif defined(__PATHCC__)
-# define COMPILER_ID "PathScale"
-# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
-# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
-# if defined(__PATHCC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
-# endif
-
#elif defined(_CRAYC)
# define COMPILER_ID "Cray"
# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 2c8dd4b..5e70a41 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -25,6 +25,14 @@
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif
+#elif defined(__PATHCC__)
+# define COMPILER_ID "PathScale"
+# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
+# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
+# if defined(__PATHCC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
+# endif
+
#elif defined(__clang__)
# define COMPILER_ID "Clang"
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
@@ -100,14 +108,6 @@
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
# endif
-#elif defined(__PATHCC__)
-# define COMPILER_ID "PathScale"
-# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
-# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
-# if defined(__PATHCC_PATCHLEVEL__)
-# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
-# endif
-
#elif defined(_CRAYC)
# define COMPILER_ID "Cray"
# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index 14551d1..f5c009c 100644
--- a/Modules/CMakeExpandImportedTargets.cmake
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -30,7 +30,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(CMakeParseArguments)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake
index 37b72fa..ae17454 100644
--- a/Modules/CMakeFindEclipseCDT4.cmake
+++ b/Modules/CMakeFindEclipseCDT4.cmake
@@ -77,6 +77,8 @@ endif()
# This variable is used by the Eclipse generator and appended to the make invocation commands.
set(CMAKE_ECLIPSE_MAKE_ARGUMENTS "${_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j<some_number> to get parallel builds")
+set(CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES TRUE CACHE BOOL "If disabled, CMake will not generate linked resource to the subprojects and to the source files within targets")
+
# This variable is used by the Eclipse generator in out-of-source builds only.
set(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR")
mark_as_advanced(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT)
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 106b44c..75ff3be 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -385,15 +385,13 @@ endif()
# Are we packaging components ?
if(CPACK_DEB_PACKAGE_COMPONENT)
set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}")
- set(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "/${CPACK_DEB_PACKAGE_COMPONENT}")
- set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_DEB_PACKAGE_COMPONENT}")
string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
else()
set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "")
- set(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "")
- set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
endif()
+set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}")
+
# Print out some debug information if we were asked for that
if(CPACK_DEBIAN_PACKAGE_DEBUG)
message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 0cec897..34d0045 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -311,14 +311,12 @@ endif()
# Are we packaging components ?
if(CPACK_RPM_PACKAGE_COMPONENT)
set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
- set(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "/${CPACK_RPM_PACKAGE_COMPONENT}")
- set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_RPM_PACKAGE_COMPONENT}")
else()
set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "")
- set(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "")
- set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
endif()
+set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}")
+
#
# Use user-defined RPM specific variables value
# or generate reasonable default value from
diff --git a/Modules/Compiler/TI_DSP-ASM.cmake b/Modules/Compiler/TI_DSP-ASM.cmake
new file mode 100644
index 0000000..e097626
--- /dev/null
+++ b/Modules/Compiler/TI_DSP-ASM.cmake
@@ -0,0 +1,8 @@
+set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
+set(CMAKE_LINK_LIBRARY_FLAG "--library=")
+set(CMAKE_INCLUDE_FLAG_ASM "--include_path=")
+
+set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --compile_only --asm_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<OBJECT>")
+set(CMAKE_ASM_LINK_EXECUTABLE "<CMAKE_ASM_COMPILER> <OBJECTS> --run_linker --output_file=<TARGET> <CMAKE_ASM_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>")
+
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm;s;abs)
diff --git a/Modules/Compiler/TI_DSP-C.cmake b/Modules/Compiler/TI_DSP-C.cmake
new file mode 100644
index 0000000..b580994
--- /dev/null
+++ b/Modules/Compiler/TI_DSP-C.cmake
@@ -0,0 +1,10 @@
+set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
+set(CMAKE_LINK_LIBRARY_FLAG "--library=")
+set(CMAKE_INCLUDE_FLAG_C "--include_path=")
+
+set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> --compile_only --skip_assembler --c_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
+set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> --preproc_only --c_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
+
+set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> --compile_only --c_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<OBJECT>")
+set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -r <TARGET> <OBJECTS>")
+set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_C_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>")
diff --git a/Modules/Compiler/TI_DSP-CXX.cmake b/Modules/Compiler/TI_DSP-CXX.cmake
new file mode 100644
index 0000000..8cf5ac3
--- /dev/null
+++ b/Modules/Compiler/TI_DSP-CXX.cmake
@@ -0,0 +1,10 @@
+set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
+set(CMAKE_LINK_LIBRARY_FLAG "--library=")
+set(CMAKE_INCLUDE_FLAG_CXX "--include_path=")
+
+set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> --compile_only --skip_assembler --cpp_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
+set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> --preproc_only --cpp_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
+
+set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> --compile_only --cpp_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<OBJECT>")
+set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> -r <TARGET> <OBJECTS>")
+set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_CXX_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>")
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
index 309fce3..5f8a9fb 100644
--- a/Modules/DeployQt4.cmake
+++ b/Modules/DeployQt4.cmake
@@ -80,7 +80,7 @@
# The functions defined in this file depend on the fixup_bundle function
# (and others) found in BundleUtilities.cmake
-include(BundleUtilities)
+include("${CMAKE_CURRENT_LIST_DIR}/BundleUtilities.cmake")
set(DeployQt4_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
set(DeployQt4_apple_plugins_dir "PlugIns")
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index 41bce1e..5d98ac3 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -177,7 +177,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(CMakeParseArguments)
+include("${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake")
function(ADD_FEATURE_INFO _name _enabled _desc)
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index d9b3c61..f8a284d 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -40,8 +40,8 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(CheckFunctionExists)
-include(CheckFortranFunctionExists)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 8b9d235..9fb29d0 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -49,7 +49,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2
VERSION_VAR BZIP2_VERSION_STRING)
if (BZIP2_FOUND)
- include(CheckLibraryExists)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
endif ()
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 17aba1b..8d8b10c 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1,248 +1,141 @@
-# - Try to find Boost include dirs and libraries
-# Usage of this module as follows:
-#
-# NOTE: Take note of the Boost_ADDITIONAL_VERSIONS variable below.
-# Due to Boost naming conventions and limitations in CMake this find
-# module is NOT future safe with respect to Boost version numbers,
-# and may break.
-#
-# == Using Header-Only libraries from within Boost: ==
-#
-# find_package( Boost 1.36.0 )
-# if(Boost_FOUND)
-# include_directories(${Boost_INCLUDE_DIRS})
-# add_executable(foo foo.cc)
-# endif()
-#
-#
-# == Using actual libraries from within Boost: ==
-#
-# set(Boost_USE_STATIC_LIBS ON)
-# set(Boost_USE_MULTITHREADED ON)
-# set(Boost_USE_STATIC_RUNTIME OFF)
-# find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... )
-#
-# if(Boost_FOUND)
-# include_directories(${Boost_INCLUDE_DIRS})
-# add_executable(foo foo.cc)
-# target_link_libraries(foo ${Boost_LIBRARIES})
-# endif()
-#
-#
-# The components list needs to contain actual names of boost libraries only,
-# such as "date_time" for "libboost_date_time". If you're using parts of
-# Boost that contain header files only (e.g. foreach) you do not need to
-# specify COMPONENTS.
-#
-# You should provide a minimum version number that should be used. If you provide this
-# version number and specify the REQUIRED attribute, this module will fail if it
-# can't find the specified or a later version. If you specify a version number this is
-# automatically put into the considered list of version numbers and thus doesn't need
-# to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below).
-#
-# NOTE for Visual Studio Users:
-# Automatic linking is used on MSVC & Borland compilers by default when
-# #including things in Boost. It's important to note that setting
-# Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking,
-# should you need this feature. Automatic linking typically uses static
-# libraries with a few exceptions (Boost.Python is one).
-#
-# Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for
-# more details. Adding a target_link_libraries() as shown in the example
-# above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS
-# gets set to OFF. It is suggested you avoid automatic linking since it
-# will make your application less portable.
-#
-# =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============
-#
-# OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
-# boost version numbers that should be taken into account when searching
-# for Boost. Unfortunately boost puts the version number into the
-# actual filename for the libraries, so this variable will certainly be needed
-# in the future when new Boost versions are released.
-#
-# Currently this module searches for the following version numbers:
-# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1,
-# 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0,
-# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0,
-# 1.45, 1.45.0, 1.46, 1.46.0, 1.46.1, 1.47, 1.47.0, 1.48, 1.48.0,
-# 1.49, 1.49.0, 1.50, 1.50.0, 1.51, 1.51.0, 1.52, 1.52.0,
-# 1.53, 1.53.0, 1.54, 1.54.0, 1.55, 1.55.0, 1.56, 1.56.0
-#
-# NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should
-# add both 1.x and 1.x.0 as shown above. Official Boost include directories
-# omit the 3rd version number from include paths if it is 0 although not all
-# binary Boost releases do so.
-#
-# set(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0")
-#
-# ===================================== ============= ========================
-#
-# Variables used by this module, they can change the default behaviour and
-# need to be set before calling find_package:
-#
-# Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded
-# boost libraries. If not specified, defaults
-# to ON.
-#
-# Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static
-# boost libraries. Defaults to OFF.
-#
-# Boost_NO_SYSTEM_PATHS Set to TRUE to suppress searching in system
-# paths (or other locations outside of BOOST_ROOT
-# or BOOST_INCLUDEDIR). Useful when specifying
-# BOOST_ROOT. Defaults to OFF.
-# [Since CMake 2.8.3]
-#
-# Boost_NO_BOOST_CMAKE Do not do a find_package call in config mode
-# before searching for a regular boost install.
-# This will avoid finding boost-cmake installs.
-# Defaults to OFF.
-# [Since CMake 2.8.6]
-#
-# Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries
-# linked against a static C++ standard library
-# ('s' ABI tag). This option should be set to
-# ON or OFF because the default behavior
-# if not specified is platform dependent
-# for backwards compatibility.
-# [Since CMake 2.8.3]
-#
-# Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries
-# compiled against a special debug build of
-# Python ('y' ABI tag). Defaults to OFF.
-# [Since CMake 2.8.3]
-#
-# Boost_USE_STLPORT If enabled, searches for boost libraries
-# compiled against the STLPort standard
-# library ('p' ABI tag). Defaults to OFF.
-# [Since CMake 2.8.3]
-#
-# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
-# If enabled, searches for boost libraries
-# compiled against the deprecated STLPort
-# "native iostreams" feature ('n' ABI tag).
-# Defaults to OFF.
-# [Since CMake 2.8.3]
-#
-# Other Variables used by this module which you may want to set.
-#
-# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching
-# the boost include directory. Please see
-# the documentation above regarding this
-# annoying, but necessary variable :(
-#
-# Boost_DEBUG Set this to TRUE to enable debugging output
-# of FindBoost.cmake if you are having problems.
-# Please enable this before filing any bug
-# reports.
-#
-# Boost_DETAILED_FAILURE_MSG FindBoost doesn't output detailed information
-# about why it failed or how to fix the problem
-# unless this is set to TRUE or the REQUIRED
-# keyword is specified in find_package().
-# [Since CMake 2.8.0]
-#
-# Boost_COMPILER Set this to the compiler suffix used by Boost
-# (e.g. "-gcc43") if FindBoost has problems finding
-# the proper Boost installation
-#
-# Boost_THREADAPI When building boost.thread, sometimes the name of the
-# library contains an additional "pthread" or "win32"
-# string known as the threadapi. This can happen when
-# compiling against pthreads on Windows or win32 threads
-# on Cygwin. You may specify this variable and if set
-# when FindBoost searches for the Boost threading library
-# it will first try to match the threadapi you specify.
-# For Example: libboost_thread_win32-mgw45-mt-1_43.a
-# might be found if you specified "win32" here before
-# falling back on libboost_thread-mgw45-mt-1_43.a.
-# [Since CMake 2.8.3]
-#
-# Boost_REALPATH Resolves symbolic links for discovered boost libraries
-# to assist with packaging. For example, instead of
-# Boost_SYSTEM_LIBRARY_RELEASE being resolved to
-# "/usr/lib/libboost_system.so" it would be
-# "/usr/lib/libboost_system.so.1.42.0" instead.
-# This does not affect linking and should not be
-# enabled unless the user needs this information.
-# [Since CMake 2.8.3]
-#
-
-
-#
-# These last three variables are available also as environment variables:
-# Also, note they are completely UPPERCASE, except Boost_DIR.
-#
-# Boost_DIR or The preferred installation prefix for searching for
-# BOOST_ROOT or BOOSTROOT Boost. Set this if the module has problems finding
-# the proper Boost installation.
-#
-# Note that Boost_DIR behaves exactly as <package>_DIR
-# variables are documented to behave in find_package's
-# Config mode. That is, if it is set as a -D argument
-# to CMake, it must point to the location of the
-# BoostConfig.cmake or Boost-config.cmake file. If it
-# is set as an environment variable, it must point to
-# the root of the boost installation. BOOST_ROOT and
-# BOOSTROOT, on the other hand, will point to the root
-# in either case.
-#
-# To prevent falling back on the system paths, set
-# Boost_NO_SYSTEM_PATHS to true.
-#
-# To avoid finding boost-cmake installations, set
-# Boost_NO_BOOST_CMAKE to true.
-#
-# BOOST_INCLUDEDIR Set this to the include directory of Boost, if the
-# module has problems finding the proper Boost installation
-#
-# BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the
-# module has problems finding the proper Boost installation
-#
-# Variables defined by this module:
-#
-# Boost_FOUND System has Boost, this means the include dir was
-# found, as well as all the libraries specified in
-# the COMPONENTS list.
-#
-# Boost_INCLUDE_DIRS Boost include directories: not cached
-#
-# Boost_INCLUDE_DIR This is almost the same as above, but this one is
-# cached and may be modified by advanced users
-#
-# Boost_LIBRARIES Link to these to use the Boost libraries that you
-# specified: not cached
-#
-# Boost_LIBRARY_DIRS The path to where the Boost library files are.
-#
-# Boost_VERSION The version number of the boost libraries that
-# have been found, same as in version.hpp from Boost
-#
-# Boost_LIB_VERSION The version number in filename form as
-# it's appended to the library filenames
-#
-# Boost_MAJOR_VERSION major version number of boost
-# Boost_MINOR_VERSION minor version number of boost
-# Boost_SUBMINOR_VERSION subminor version number of boost
-#
-# Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call
-# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
-# to have diagnostic information about Boost's
-# automatic linking outputted during compilation time.
-#
-# For each component you specify in find_package(), the following (UPPER-CASE)
-# variables are set. You can use these variables if you would like to pick and
-# choose components for your targets instead of just using Boost_LIBRARIES.
-#
-# Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found.
-#
-# Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost
-# "component" (includes debug and optimized keywords
-# when needed).
+# - Find Boost include dirs and libraries
+# Use this module by invoking find_package with the form:
+# find_package(Boost
+# [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0
+# [REQUIRED] # Fail with error if Boost is not found
+# [COMPONENTS <libs>...] # Boost libraries by their canonical name
+# ) # e.g. "date_time" for "libboost_date_time"
+# This module finds headers and requested component libraries OR a CMake
+# package configuration file provided by a "Boost CMake" build. For the
+# latter case skip to the "Boost CMake" section below. For the former
+# case results are reported in variables:
+# Boost_FOUND - True if headers and requested libraries were found
+# Boost_INCLUDE_DIRS - Boost include directories
+# Boost_LIBRARY_DIRS - Link directories for Boost libraries
+# Boost_LIBRARIES - Boost component libraries to be linked
+# Boost_<C>_FOUND - True if component <C> was found (<C> is upper-case)
+# Boost_<C>_LIBRARY - Libraries to link for component <C> (may include
+# target_link_libraries debug/optimized keywords)
+# Boost_VERSION - BOOST_VERSION value from boost/version.hpp
+# Boost_LIB_VERSION - Version string appended to library filenames
+# Boost_MAJOR_VERSION - Boost major version number (X in X.y.z)
+# Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z)
+# Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z)
+# Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows)
+# - Pass to add_definitions() to have diagnostic
+# information about Boost's automatic linking
+# displayed during compilation
+#
+# This module reads hints about search locations from variables:
+# BOOST_ROOT - Preferred installation prefix
+# (or BOOSTROOT)
+# BOOST_INCLUDEDIR - Preferred include directory e.g. <prefix>/include
+# BOOST_LIBRARYDIR - Preferred library directory e.g. <prefix>/lib
+# Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not
+# specified by these hint variables. Default is OFF.
+# Boost_ADDITIONAL_VERSIONS
+# - List of Boost versions not known to this module
+# (Boost install locations may contain the version)
+# and saves search results persistently in CMake cache entries:
+# Boost_INCLUDE_DIR - Directory containing Boost headers
+# Boost_LIBRARY_DIR - Directory containing Boost libraries
+# Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant
+# Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant
+# Users may set the these hints or results as cache entries. Projects should
+# not read these entries directly but instead use the above result variables.
+# Note that some hint names start in upper-case "BOOST". One may specify
+# these as environment variables if they are not specified as CMake variables
+# or cache entries.
+#
+# This module first searches for the Boost header files using the above hint
+# variables (excluding BOOST_LIBRARYDIR) and saves the result in
+# Boost_INCLUDE_DIR. Then it searches for requested component libraries using
+# the above hints (excluding BOOST_INCLUDEDIR and Boost_ADDITIONAL_VERSIONS),
+# "lib" directories near Boost_INCLUDE_DIR, and the library name configuration
+# settings below. It saves the library directory in Boost_LIBRARY_DIR and
+# individual library locations in Boost_<C>_LIBRARY_DEBUG and
+# Boost_<C>_LIBRARY_RELEASE. When one changes settings used by previous
+# searches in the same build tree (excluding environment variables) this
+# module discards previous search results affected by the changes and searches
+# again.
+#
+# Boost libraries come in many variants encoded in their file name. Users or
+# projects may tell this module which variant to find by setting variables:
+# Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded
+# libraries ('mt' tag). Default is ON.
+# Boost_USE_STATIC_LIBS - Set to ON to force the use of the static
+# libraries. Default is OFF.
+# Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use
+# libraries linked statically to the C++ runtime
+# ('s' tag). Default is platform dependent.
+# Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a
+# debug Python build ('y' tag). Default is OFF.
+# Boost_USE_STLPORT - Set to ON to use libraries compiled with
+# STLPort ('p' tag). Default is OFF.
+# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
+# - Set to ON to use libraries compiled with
+# STLPort deprecated "native iostreams"
+# ('n' tag). Default is OFF.
+# Boost_COMPILER - Set to the compiler-specific library suffix
+# (e.g. "-gcc43"). Default is auto-computed
+# for the C++ compiler in use.
+# Boost_THREADAPI - Suffix for "thread" component library name,
+# such as "pthread" or "win32". Names with
+# and without this suffix will both be tried.
+# Other variables one may set to control this module are:
+# Boost_DEBUG - Set to ON to enable debug output from FindBoost.
+# Please enable this before filing any bug report.
+# Boost_DETAILED_FAILURE_MSG
+# - Set to ON to add detailed information to the
+# failure message even when the REQUIRED option
+# is not given to the find_package call.
+# Boost_REALPATH - Set to ON to resolve symlinks for discovered
+# libraries to assist with packaging. For example,
+# the "system" component library may be resolved to
+# "/usr/lib/libboost_system.so.1.42.0" instead of
+# "/usr/lib/libboost_system.so". This does not
+# affect linking and should not be enabled unless
+# the user needs this information.
+# On Visual Studio and Borland compilers Boost headers request automatic
+# linking to corresponding libraries. This requires matching libraries to be
+# linked explicitly or available in the link library search path. In this
+# case setting Boost_USE_STATIC_LIBS to OFF may not achieve dynamic linking.
+# Boost automatic linking typically requests static libraries with a few
+# exceptions (such as Boost.Python). Use
+# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
+# to ask Boost to report information about automatic linking requests.
+#
+# Example to find Boost headers only:
+# find_package(Boost 1.36.0)
+# if(Boost_FOUND)
+# include_directories(${Boost_INCLUDE_DIRS})
+# add_executable(foo foo.cc)
+# endif()
+# Example to find Boost headers and some libraries:
+# set(Boost_USE_STATIC_LIBS ON)
+# set(Boost_USE_MULTITHREADED ON)
+# set(Boost_USE_STATIC_RUNTIME OFF)
+# find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...)
+# if(Boost_FOUND)
+# include_directories(${Boost_INCLUDE_DIRS})
+# add_executable(foo foo.cc)
+# target_link_libraries(foo ${Boost_LIBRARIES})
+# endif()
+#
+# Boost CMake ----------------------------------------------------------
+#
+# If Boost was built using the boost-cmake project it provides a package
+# configuration file for use with find_package's Config mode. This module
+# looks for the package configuration file called BoostConfig.cmake or
+# boost-config.cmake and stores the result in cache entry "Boost_DIR". If
+# found, the package configuration file is loaded and this module returns with
+# no further action. See documentation of the Boost CMake package
+# configuration for details on what it provides.
+#
+# Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake.
#=============================================================================
-# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006-2012 Kitware, Inc.
# Copyright 2006-2008 Andreas Schneider <mail@cynapses.org>
# Copyright 2007 Wengo
# Copyright 2007 Mike Jackson
@@ -282,6 +175,7 @@ if (NOT Boost_NO_BOOST_CMAKE)
# Note that args are passed in the Boost_FIND_xxxxx variables, so there is no
# need to delegate them to this find_package call.
find_package(Boost QUIET NO_MODULE)
+ mark_as_advanced(Boost_DIR)
# If we found boost-cmake, then we're done. Print out what we found.
# Otherwise let the rest of the module try to find it.
@@ -349,29 +243,54 @@ macro(_Boost_ADJUST_LIB_VARS basename)
endif()
if(Boost_${basename}_LIBRARY)
- set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
-
- # Remove superfluous "debug" / "optimized" keywords from
- # Boost_LIBRARY_DIRS
- foreach(_boost_my_lib ${Boost_${basename}_LIBRARY})
- get_filename_component(_boost_my_lib_path "${_boost_my_lib}" PATH)
- list(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path})
- endforeach()
- list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
-
- set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
- set(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
+ set(Boost_${basename}_FOUND ON)
endif()
endif()
# Make variables changeble to the advanced user
mark_as_advanced(
- Boost_${basename}_LIBRARY
Boost_${basename}_LIBRARY_RELEASE
Boost_${basename}_LIBRARY_DEBUG
)
endmacro()
+macro(_Boost_CHANGE_DETECT changed_var)
+ set(${changed_var} 0)
+ foreach(v ${ARGN})
+ if(DEFINED _Boost_COMPONENTS_SEARCHED)
+ if(${v})
+ if(_${v}_LAST)
+ string(COMPARE NOTEQUAL "${${v}}" "${_${v}_LAST}" _${v}_CHANGED)
+ else()
+ set(_${v}_CHANGED 1)
+ endif()
+ elseif(_${v}_LAST)
+ set(_${v}_CHANGED 1)
+ endif()
+ if(_${v}_CHANGED)
+ set(${changed_var} 1)
+ endif()
+ else()
+ set(_${v}_CHANGED 0)
+ endif()
+ endforeach()
+endmacro()
+
+macro(_Boost_FIND_LIBRARY var)
+ find_library(${var} ${ARGN})
+
+ # If we found the first library save Boost_LIBRARY_DIR.
+ if(${var} AND NOT Boost_LIBRARY_DIR)
+ get_filename_component(_dir "${${var}}" PATH)
+ set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE)
+ endif()
+
+ # If Boost_LIBRARY_DIR is known then search only there.
+ if(Boost_LIBRARY_DIR)
+ set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH)
+ endif()
+endmacro()
+
#-------------------------------------------------------------------------------
#
@@ -391,17 +310,6 @@ function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
endfunction()
#
-# A convenience function for marking desired components
-# as found or not
-#
-function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no)
- foreach(COMPONENT ${Boost_FIND_COMPONENTS})
- string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
- set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE)
- endforeach()
-endfunction()
-
-#
# Take a list of libraries with "thread" in it
# and prepend duplicates with "thread_${Boost_THREADAPI}"
# at the front of the list
@@ -561,652 +469,679 @@ endif()
# Boost.
set(Boost_ERROR_REASON)
- if(Boost_DEBUG)
- # Output some of their choices
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
- endif()
-
- if(WIN32)
- # In windows, automatic linking is performed, so you do not have
- # to specify the libraries. If you are linking to a dynamic
- # runtime, then you can choose to link to either a static or a
- # dynamic Boost library, the default is to do a static link. You
- # can alter this for a specific library "whatever" by defining
- # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
- # linked dynamically. Alternatively you can force all Boost
- # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
-
- # This feature can be disabled for Boost library "whatever" by
- # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
- # BOOST_ALL_NO_LIB.
-
- # If you want to observe which libraries are being linked against
- # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
- # code to emit a #pragma message each time a library is selected
- # for linking.
- set(Boost_LIB_DIAGNOSTIC_DEFINITIONS
- "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
- endif()
+if(Boost_DEBUG)
+ # Output some of their choices
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
+endif()
- set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM
- C:/boost/include
- C:/boost
- "$ENV{ProgramFiles}/boost/include"
- "$ENV{ProgramFiles}/boost"
- /sw/local/include
- )
+if(WIN32)
+ # In windows, automatic linking is performed, so you do not have
+ # to specify the libraries. If you are linking to a dynamic
+ # runtime, then you can choose to link to either a static or a
+ # dynamic Boost library, the default is to do a static link. You
+ # can alter this for a specific library "whatever" by defining
+ # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
+ # linked dynamically. Alternatively you can force all Boost
+ # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
+
+ # This feature can be disabled for Boost library "whatever" by
+ # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
+ # BOOST_ALL_NO_LIB.
+
+ # If you want to observe which libraries are being linked against
+ # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
+ # code to emit a #pragma message each time a library is selected
+ # for linking.
+ set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC")
+endif()
- _Boost_CHECK_SPELLING(Boost_ROOT)
- _Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
- _Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
+_Boost_CHECK_SPELLING(Boost_ROOT)
+_Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
+_Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
- # If BOOST_ROOT was defined in the environment, use it.
- if (NOT BOOST_ROOT AND NOT $ENV{Boost_DIR} STREQUAL "")
- set(BOOST_ROOT $ENV{Boost_DIR})
+# Collect environment variable inputs as hints. Do not consider changes.
+foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR)
+ set(_env $ENV{${v}})
+ if(_env)
+ file(TO_CMAKE_PATH "${_env}" _ENV_${v})
+ else()
+ set(_ENV_${v} "")
endif()
+endforeach()
+if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT)
+ set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}")
+endif()
- # If BOOST_ROOT was defined in the environment, use it.
- if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
- set(BOOST_ROOT $ENV{BOOST_ROOT})
- endif()
+# Collect inputs and cached results. Detect changes since the last run.
+if(NOT BOOST_ROOT AND BOOSTROOT)
+ set(BOOST_ROOT "${BOOSTROOT}")
+endif()
+set(_Boost_VARS_DIR
+ BOOST_ROOT
+ Boost_NO_SYSTEM_PATHS
+ )
- # If BOOSTROOT was defined in the environment, use it.
- if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
- set(BOOST_ROOT $ENV{BOOSTROOT})
- endif()
+if(Boost_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_INCLUDEDIR was defined in the environment, use it.
- if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
- set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
- endif()
+# ------------------------------------------------------------------------
+# Search for Boost include DIR
+# ------------------------------------------------------------------------
- # If BOOST_LIBRARYDIR was defined in the environment, use it.
- if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
- set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
- endif()
+set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS)
+_Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC})
+# Clear Boost_INCLUDE_DIR if it did not change but other input affecting the
+# location did. We will find a new one based on the new inputs.
+if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED)
+ unset(Boost_INCLUDE_DIR CACHE)
+endif()
- if( BOOST_ROOT )
- file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
+if(NOT Boost_INCLUDE_DIR)
+ set(_boost_INCLUDE_SEARCH_DIRS "")
+ if(BOOST_INCLUDEDIR)
+ list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR})
+ elseif(_ENV_BOOST_INCLUDEDIR)
+ list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR})
endif()
- if(Boost_DEBUG)
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "Declared as CMake or Environmental Variables:")
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- " BOOST_ROOT = ${BOOST_ROOT}")
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
+ if( BOOST_ROOT )
+ list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT})
+ elseif( _ENV_BOOST_ROOT )
+ list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT})
endif()
if( Boost_NO_SYSTEM_PATHS)
- set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
+ list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH)
else()
- set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM})
- endif()
-
- if( BOOST_ROOT )
- set(_boost_INCLUDE_SEARCH_DIRS
- ${BOOST_ROOT}/include
- ${BOOST_ROOT}
- ${_boost_INCLUDE_SEARCH_DIRS})
- endif()
-
- # prepend BOOST_INCLUDEDIR to search path if specified
- if( BOOST_INCLUDEDIR )
- file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
- set(_boost_INCLUDE_SEARCH_DIRS
- ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
+ list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS
+ C:/boost/include
+ C:/boost
+ /sw/local/include
+ )
endif()
- # ------------------------------------------------------------------------
- # Search for Boost include DIR
- # ------------------------------------------------------------------------
# Try to find Boost by stepping backwards through the Boost versions
# we know about.
- if( NOT Boost_INCLUDE_DIR )
- # Build a list of path suffixes for each version.
- set(_boost_PATH_SUFFIXES)
- foreach(_boost_VER ${_boost_TEST_VERSIONS})
- # Add in a path suffix, based on the required version, ideally
- # we could read this from version.hpp, but for that to work we'd
- # need to know the include dir already
- set(_boost_BOOSTIFIED_VERSION)
-
- # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
- if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
- string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
- _boost_BOOSTIFIED_VERSION ${_boost_VER})
- elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
- string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
- _boost_BOOSTIFIED_VERSION ${_boost_VER})
- endif()
-
- list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
- list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
-
- endforeach()
-
- 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}")
+ # Build a list of path suffixes for each version.
+ set(_boost_PATH_SUFFIXES)
+ foreach(_boost_VER ${_boost_TEST_VERSIONS})
+ # Add in a path suffix, based on the required version, ideally
+ # we could read this from version.hpp, but for that to work we'd
+ # need to know the include dir already
+ set(_boost_BOOSTIFIED_VERSION)
+
+ # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
+ if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
+ _boost_BOOSTIFIED_VERSION ${_boost_VER})
+ elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
+ _boost_BOOSTIFIED_VERSION ${_boost_VER})
endif()
- # Look for a standard boost header file.
- find_path(Boost_INCLUDE_DIR
- NAMES boost/config.hpp
- HINTS ${_boost_INCLUDE_SEARCH_DIRS}
- PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
- ${_boost_FIND_OPTIONS}
+ list(APPEND _boost_PATH_SUFFIXES
+ "boost-${_boost_BOOSTIFIED_VERSION}"
+ "boost_${_boost_BOOSTIFIED_VERSION}"
+ "boost/boost-${_boost_BOOSTIFIED_VERSION}"
+ "boost/boost_${_boost_BOOSTIFIED_VERSION}"
)
- endif()
- # ------------------------------------------------------------------------
- # Extract version information from version.hpp
- # ------------------------------------------------------------------------
-
- if(Boost_INCLUDE_DIR)
- # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
- # Read the whole file:
- #
- set(BOOST_VERSION 0)
- set(BOOST_LIB_VERSION "")
- file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")
- if(Boost_DEBUG)
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
- endif()
+ endforeach()
- 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}")
- unset(_boost_VERSION_HPP_CONTENTS)
+ 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()
- set(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
- set(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")
+ # Look for a standard boost header file.
+ find_path(Boost_INCLUDE_DIR
+ NAMES boost/config.hpp
+ HINTS ${_boost_INCLUDE_SEARCH_DIRS}
+ PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
+ )
+endif()
- if(NOT "${Boost_VERSION}" STREQUAL "0")
- math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
- math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
- math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
+# ------------------------------------------------------------------------
+# Extract version information from version.hpp
+# ------------------------------------------------------------------------
- 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()
- 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()
- 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.")
+# Set Boost_FOUND based only on header location and version.
+# It will be updated below for component libraries.
+if(Boost_INCLUDE_DIR)
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
endif()
- # ------------------------------------------------------------------------
- # Suffix initialization and compiler suffix detection.
- # ------------------------------------------------------------------------
+ # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
+ set(Boost_VERSION 0)
+ set(Boost_LIB_VERSION "")
+ file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")
+ set(_Boost_VERSION_REGEX "([0-9]+)")
+ set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"")
+ foreach(v VERSION LIB_VERSION)
+ if("${_boost_VERSION_HPP_CONTENTS}" MATCHES ".*#define BOOST_${v} ${_Boost_${v}_REGEX}.*")
+ set(Boost_${v} "${CMAKE_MATCH_1}")
+ endif()
+ endforeach()
+ unset(_boost_VERSION_HPP_CONTENTS)
+
+ math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
+ math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
+ math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
- # Setting some more suffixes for the library
- set(Boost_LIB_PREFIX "")
- if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN)
- set(Boost_LIB_PREFIX "lib")
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
+ 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()
- 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}")
+ if(Boost_FIND_VERSION)
+ # Set Boost_FOUND based on requested version.
+ set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
+ if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}")
+ set(Boost_FOUND 0)
+ set(_Boost_VERSION_AGE "old")
+ elseif(Boost_FIND_VERSION_EXACT AND
+ NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}")
+ set(Boost_FOUND 0)
+ set(_Boost_VERSION_AGE "new")
+ else()
+ set(Boost_FOUND 1)
endif()
+ if(NOT Boost_FOUND)
+ # State that we found a version of Boost that is too new or too old.
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
+ if (Boost_FIND_VERSION_PATCH)
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
+ endif ()
+ if (NOT Boost_FIND_VERSION_EXACT)
+ set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
+ endif ()
+ set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
+ endif ()
else()
- # Attempt to guess the compiler suffix
- # NOTE: this is not perfect yet, if you experience any issues
- # please report them and use the Boost_COMPILER variable
- # to work around the problems.
- _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER)
- if(Boost_DEBUG)
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "guessed _boost_COMPILER = ${_boost_COMPILER}")
- endif()
+ # Caller will accept any Boost version.
+ set(Boost_FOUND 1)
endif()
+else()
+ set(Boost_FOUND 0)
+ 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()
- set (_boost_MULTITHREADED "-mt")
- if( NOT Boost_USE_MULTITHREADED )
- set (_boost_MULTITHREADED "")
+# ------------------------------------------------------------------------
+# Suffix initialization and compiler suffix detection.
+# ------------------------------------------------------------------------
+
+set(_Boost_VARS_NAME
+ Boost_COMPILER
+ Boost_THREADAPI
+ Boost_USE_DEBUG_PYTHON
+ Boost_USE_MULTITHREADED
+ Boost_USE_STATIC_LIBS
+ Boost_USE_STATIC_RUNTIME
+ Boost_USE_STLPORT
+ Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
+ )
+_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME})
+
+# Setting some more suffixes for the library
+set(Boost_LIB_PREFIX "")
+if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN)
+ set(Boost_LIB_PREFIX "lib")
+endif()
+
+if (Boost_COMPILER)
+ set(_boost_COMPILER ${Boost_COMPILER})
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
endif()
+else()
+ # Attempt to guess the compiler suffix
+ # NOTE: this is not perfect yet, if you experience any issues
+ # please report them and use the Boost_COMPILER variable
+ # to work around the problems.
+ _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER)
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
+ "guessed _boost_COMPILER = ${_boost_COMPILER}")
endif()
+endif()
- #======================
- # Systematically build up the Boost ABI tag
- # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
- set( _boost_RELEASE_ABI_TAG "-")
- set( _boost_DEBUG_ABI_TAG "-")
- # Key Use this library when:
- # s linking statically to the C++ standard library and
- # compiler runtime support libraries.
- if(Boost_USE_STATIC_RUNTIME)
- set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
- set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s")
- endif()
- # g using debug versions of the standard and runtime
- # support libraries
- if(WIN32)
- if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
- OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
- set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
- endif()
- endif()
- # y using special debug build of python
- if(Boost_USE_DEBUG_PYTHON)
- set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
- endif()
- # d using a debug version of your code
- set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
- # p using the STLport standard library rather than the
- # default one supplied with your compiler
- if(Boost_USE_STLPORT)
- set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
- set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p")
- endif()
- # n using the STLport deprecated "native iostreams" feature
- if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
- set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
- set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n")
- endif()
+set (_boost_MULTITHREADED "-mt")
+if( NOT Boost_USE_MULTITHREADED )
+ set (_boost_MULTITHREADED "")
+endif()
+if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
+endif()
- if(Boost_DEBUG)
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
+#======================
+# Systematically build up the Boost ABI tag
+# http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
+set( _boost_RELEASE_ABI_TAG "-")
+set( _boost_DEBUG_ABI_TAG "-")
+# Key Use this library when:
+# s linking statically to the C++ standard library and
+# compiler runtime support libraries.
+if(Boost_USE_STATIC_RUNTIME)
+ set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
+ set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s")
+endif()
+# g using debug versions of the standard and runtime
+# support libraries
+if(WIN32)
+ if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
+ OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
+ set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
endif()
+endif()
+# y using special debug build of python
+if(Boost_USE_DEBUG_PYTHON)
+ set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
+endif()
+# d using a debug version of your code
+set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
+# p using the STLport standard library rather than the
+# default one supplied with your compiler
+if(Boost_USE_STLPORT)
+ set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
+ set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p")
+endif()
+# n using the STLport deprecated "native iostreams" feature
+if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
+ set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
+ set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n")
+endif()
+
+if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
+endif()
+
+# ------------------------------------------------------------------------
+# Begin finding boost libraries
+# ------------------------------------------------------------------------
+set(_Boost_VARS_LIB BOOST_LIBRARYDIR Boost_LIBRARY_DIR)
+_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR ${_Boost_VARS_DIR} ${_Boost_VARS_LIB} Boost_INCLUDE_DIR)
+# Clear Boost_LIBRARY_DIR if it did not change but other input affecting the
+# location did. We will find a new one based on the new inputs.
+if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED)
+ unset(Boost_LIBRARY_DIR CACHE)
+endif()
- # ------------------------------------------------------------------------
- # Begin finding boost libraries
- # ------------------------------------------------------------------------
+if(Boost_LIBRARY_DIR)
+ set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH)
+else()
+ set(_boost_LIBRARY_SEARCH_DIRS "")
+ if(BOOST_LIBRARYDIR)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_LIBRARYDIR})
+ elseif(_ENV_BOOST_LIBRARYDIR)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_LIBRARYDIR})
+ endif()
if(BOOST_ROOT)
- set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
- ${BOOST_ROOT}/lib
- ${BOOST_ROOT}/stage/lib)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
+ elseif(_ENV_BOOST_ROOT)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
endif()
- set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
- ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}
+
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS
${Boost_INCLUDE_DIR}/lib
${Boost_INCLUDE_DIR}/../lib
${Boost_INCLUDE_DIR}/stage/lib
- )
- set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM
- C:/boost/lib
- C:/boost
- "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
- "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib"
- "$ENV{ProgramFiles}/boost/lib"
- "$ENV{ProgramFiles}/boost"
- /sw/local/lib
- )
- set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS})
+ )
if( Boost_NO_SYSTEM_PATHS )
- set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH)
else()
- list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM})
- endif()
-
- # prepend BOOST_LIBRARYDIR to search path if specified
- if( BOOST_LIBRARYDIR )
- file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
- set(_boost_LIBRARY_SEARCH_DIRS
- ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS})
+ list(APPEND _boost_LIBRARY_SEARCH_DIRS PATHS
+ C:/boost/lib
+ C:/boost
+ /sw/local/lib
+ )
endif()
+endif()
- if(Boost_DEBUG)
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
- endif()
+if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
+endif()
- # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
- if( Boost_USE_STATIC_LIBS )
- set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
- if(WIN32)
- set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
- else()
- set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
- endif()
+# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
+if( Boost_USE_STATIC_LIBS )
+ set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ if(WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ else()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
endif()
+endif()
- # We want to use the tag inline below without risking double dashes
- if(_boost_RELEASE_ABI_TAG)
- if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
- set(_boost_RELEASE_ABI_TAG "")
- endif()
+# We want to use the tag inline below without risking double dashes
+if(_boost_RELEASE_ABI_TAG)
+ if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
+ set(_boost_RELEASE_ABI_TAG "")
endif()
- if(_boost_DEBUG_ABI_TAG)
- if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
- set(_boost_DEBUG_ABI_TAG "")
- endif()
+endif()
+if(_boost_DEBUG_ABI_TAG)
+ if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
+ set(_boost_DEBUG_ABI_TAG "")
endif()
+endif()
- # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
- # on WIN32 was to:
- # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
- # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
- # We maintain this behavior since changing it could break people's builds.
- # To disable the ambiguous behavior, the user need only
- # set Boost_USE_STATIC_RUNTIME either ON or OFF.
- set(_boost_STATIC_RUNTIME_WORKAROUND false)
- if(WIN32 AND Boost_USE_STATIC_LIBS)
- if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
- set(_boost_STATIC_RUNTIME_WORKAROUND true)
- endif()
+# The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
+# on WIN32 was to:
+# 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
+# 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
+# We maintain this behavior since changing it could break people's builds.
+# To disable the ambiguous behavior, the user need only
+# set Boost_USE_STATIC_RUNTIME either ON or OFF.
+set(_boost_STATIC_RUNTIME_WORKAROUND false)
+if(WIN32 AND Boost_USE_STATIC_LIBS)
+ if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
+ set(_boost_STATIC_RUNTIME_WORKAROUND true)
endif()
+endif()
- # On versions < 1.35, remove the System library from the considered list
- # since it wasn't added until 1.35.
- if(Boost_VERSION AND Boost_FIND_COMPONENTS)
- if(Boost_VERSION LESS 103500)
- list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
- endif()
- endif()
+# On versions < 1.35, remove the System library from the considered list
+# since it wasn't added until 1.35.
+if(Boost_VERSION AND Boost_FIND_COMPONENTS)
+ if(Boost_VERSION LESS 103500)
+ list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
+ endif()
+endif()
- foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+# If the user changed any of our control inputs flush previous results.
+if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME)
+ foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
- set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" )
- set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" )
- set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND")
-
- set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
- set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)")
-
- #
- # Find RELEASE libraries
- #
- set(_boost_RELEASE_NAMES
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT} )
- if(_boost_STATIC_RUNTIME_WORKAROUND)
- set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
- list(APPEND _boost_RELEASE_NAMES
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
- endif()
- if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
- _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
- endif()
- if(Boost_DEBUG)
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
- endif()
- find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
- NAMES ${_boost_RELEASE_NAMES}
- HINTS ${_boost_LIBRARY_SEARCH_DIRS}
- ${_boost_FIND_OPTIONS}
- DOC "${_boost_docstring_release}"
- )
+ foreach(c DEBUG RELEASE)
+ set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c})
+ unset(${_var} CACHE)
+ set(${_var} "${_var}-NOTFOUND")
+ endforeach()
+ endforeach()
+ set(_Boost_COMPONENTS_SEARCHED "")
+endif()
- #
- # Find DEBUG libraries
- #
- set(_boost_DEBUG_NAMES
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
- ${Boost_LIB_PREFIX}boost_${COMPONENT} )
- if(_boost_STATIC_RUNTIME_WORKAROUND)
- set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
- list(APPEND _boost_DEBUG_NAMES
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
- ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
- endif()
- if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
- _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
- endif()
- if(Boost_DEBUG)
- message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
- "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
- endif()
- find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
- NAMES ${_boost_DEBUG_NAMES}
- HINTS ${_boost_LIBRARY_SEARCH_DIRS}
- ${_boost_FIND_OPTIONS}
- DOC "${_boost_docstring_debug}"
+foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+
+ set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
+ set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)")
+
+ #
+ # Find RELEASE libraries
+ #
+ set(_boost_RELEASE_NAMES
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT} )
+ if(_boost_STATIC_RUNTIME_WORKAROUND)
+ set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
+ list(APPEND _boost_RELEASE_NAMES
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
+ endif()
+ if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
+ _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
+ endif()
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
+ endif()
+ _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
+ NAMES ${_boost_RELEASE_NAMES}
+ HINTS ${_boost_LIBRARY_SEARCH_DIRS}
+ NAMES_PER_DIR
+ DOC "${_boost_docstring_release}"
)
- if(Boost_REALPATH)
- _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
- _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" )
- endif()
-
- _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
-
- endforeach()
+ #
+ # Find DEBUG libraries
+ #
+ set(_boost_DEBUG_NAMES
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT} )
+ if(_boost_STATIC_RUNTIME_WORKAROUND)
+ set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
+ list(APPEND _boost_DEBUG_NAMES
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
+ endif()
+ if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
+ _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
+ endif()
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
+ endif()
+ _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
+ NAMES ${_boost_DEBUG_NAMES}
+ HINTS ${_boost_LIBRARY_SEARCH_DIRS}
+ NAMES_PER_DIR
+ DOC "${_boost_docstring_debug}"
+ )
- # Restore the original find library ordering
- if( Boost_USE_STATIC_LIBS )
- set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+ if(Boost_REALPATH)
+ _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
+ _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" )
endif()
- # ------------------------------------------------------------------------
- # End finding boost libraries
- # ------------------------------------------------------------------------
+ _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
- # ------------------------------------------------------------------------
- # Begin long process of determining Boost_FOUND, starting with version
- # number checks, followed by
- # TODO: Ideally the version check logic should happen prior to searching
- # for libraries...
- # ------------------------------------------------------------------------
+endforeach()
- set(Boost_INCLUDE_DIRS
- ${Boost_INCLUDE_DIR}
- )
+# Restore the original find library ordering
+if( Boost_USE_STATIC_LIBS )
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+endif()
- set(Boost_FOUND FALSE)
- if(Boost_INCLUDE_DIR)
- set( Boost_FOUND TRUE )
+# ------------------------------------------------------------------------
+# End finding boost libraries
+# ------------------------------------------------------------------------
- if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
- set( Boost_FOUND FALSE )
- set(_Boost_VERSION_AGE "old")
- elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
- if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
- set( Boost_FOUND FALSE )
- set(_Boost_VERSION_AGE "old")
- elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
- if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
- set( Boost_FOUND FALSE )
- set(_Boost_VERSION_AGE "old")
- endif()
- endif()
- endif()
+set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
+set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR})
- if (NOT Boost_FOUND)
- _Boost_MARK_COMPONENTS_FOUND(OFF)
+# The above setting of Boost_FOUND was based only on the header files.
+# Update it for the requested component libraries.
+if(Boost_FOUND)
+ # The headers were found. Check for requested component libs.
+ set(_boost_CHECKED_COMPONENT FALSE)
+ set(_Boost_MISSING_COMPONENTS "")
+ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ string(TOUPPER ${COMPONENT} COMPONENT)
+ set(_boost_CHECKED_COMPONENT TRUE)
+ if(NOT Boost_${COMPONENT}_FOUND)
+ string(TOLOWER ${COMPONENT} COMPONENT)
+ list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
endif()
+ endforeach()
- if (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
- # If the user requested an exact version of Boost, check
- # that. We already know that the Boost version we have is >= the
- # requested version.
- set(_Boost_VERSION_AGE "new")
-
- # If the user didn't specify a patchlevel, it's 0.
- if (NOT Boost_FIND_VERSION_PATCH)
- set(Boost_FIND_VERSION_PATCH 0)
- endif ()
-
- # We'll set Boost_FOUND true again if we have an exact version match.
- set(Boost_FOUND FALSE)
- _Boost_MARK_COMPONENTS_FOUND(OFF)
- if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
- if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
- if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
- set( Boost_FOUND TRUE )
- _Boost_MARK_COMPONENTS_FOUND(ON)
- endif()
- endif()
- endif()
- endif ()
+ if(Boost_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
+ endif()
- if(NOT Boost_FOUND)
- # State that we found a version of Boost that is too new or too old.
+ if (_Boost_MISSING_COMPONENTS)
+ set(Boost_FOUND 0)
+ # We were unable to find some libraries, so generate a sensible
+ # error message that lists the libraries we were unable to find.
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
+ foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
- if (Boost_FIND_VERSION_PATCH)
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
- endif ()
- if (NOT Boost_FIND_VERSION_EXACT)
- set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
- endif ()
- set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
- endif ()
-
- # Always check for missing components
- set(_boost_CHECKED_COMPONENT FALSE)
- set(_Boost_MISSING_COMPONENTS "")
- foreach(COMPONENT ${Boost_FIND_COMPONENTS})
- string(TOUPPER ${COMPONENT} COMPONENT)
- set(_boost_CHECKED_COMPONENT TRUE)
- if(NOT Boost_${COMPONENT}_FOUND)
- string(TOLOWER ${COMPONENT} COMPONENT)
- list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
- set( Boost_FOUND FALSE)
- endif()
+ "${Boost_ERROR_REASON} boost_${COMPONENT}\n")
endforeach()
- 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.
+ list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
+ list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
+ if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
- foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON} boost_${COMPONENT}\n")
- endforeach()
-
- list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
- list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
- if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
- else ()
- set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
- endif ()
+ "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
+ else ()
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
endif ()
+ endif ()
- if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
- # Compatibility Code for backwards compatibility with CMake
- # 2.4's FindBoost module.
+ if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
+ # Compatibility Code for backwards compatibility with CMake
+ # 2.4's FindBoost module.
- # Look for the boost library path.
- # Note that the user may not have installed any libraries
- # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
- set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
+ # Look for the boost library path.
+ # Note that the user may not have installed any libraries
+ # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
+ set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
- if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
- get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
- endif()
+ if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
+ get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
+ endif()
- if("${_boost_LIB_DIR}" MATCHES "/include$")
- # Strip off the trailing "/include" in the path.
- get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
- endif()
+ if("${_boost_LIB_DIR}" MATCHES "/include$")
+ # Strip off the trailing "/include" in the path.
+ get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
+ endif()
- if(EXISTS "${_boost_LIB_DIR}/lib")
- set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
+ if(EXISTS "${_boost_LIB_DIR}/lib")
+ set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
+ else()
+ if(EXISTS "${_boost_LIB_DIR}/stage/lib")
+ set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
else()
- if(EXISTS "${_boost_LIB_DIR}/stage/lib")
- set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
- else()
- set(_boost_LIB_DIR "")
- endif()
- endif()
-
- if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
- set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
+ set(_boost_LIB_DIR "")
endif()
+ endif()
+ if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
+ set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR})
endif()
- else()
- set( Boost_FOUND FALSE)
endif()
+else()
+ # Boost headers were not found so no components were found.
+ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+ set(Boost_${UPPERCOMPONENT}_FOUND 0)
+ endforeach()
+endif()
- # ------------------------------------------------------------------------
- # Notification to end user about what was found
- # ------------------------------------------------------------------------
+# ------------------------------------------------------------------------
+# Notification to end user about what was found
+# ------------------------------------------------------------------------
- if(Boost_FOUND)
+set(Boost_LIBRARIES "")
+if(Boost_FOUND)
+ if(NOT Boost_FIND_QUIETLY)
+ message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
+ if(Boost_FIND_COMPONENTS)
+ message(STATUS "Found the following Boost libraries:")
+ endif()
+ endif()
+ foreach( COMPONENT ${Boost_FIND_COMPONENTS} )
+ string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
+ if( Boost_${UPPERCOMPONENT}_FOUND )
if(NOT Boost_FIND_QUIETLY)
- message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
- if(Boost_FIND_COMPONENTS)
- message(STATUS "Found the following Boost libraries:")
- endif()
+ message (STATUS " ${COMPONENT}")
endif()
- foreach( COMPONENT ${Boost_FIND_COMPONENTS} )
- string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
- if( Boost_${UPPERCOMPONENT}_FOUND )
- if(NOT Boost_FIND_QUIETLY)
- message (STATUS " ${COMPONENT}")
- endif()
- set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
- endif()
- endforeach()
+ list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY})
+ endif()
+ endforeach()
+else()
+ if(Boost_FIND_REQUIRED)
+ message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
else()
- if(Boost_FIND_REQUIRED)
- message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
- else()
- if(NOT Boost_FIND_QUIETLY)
- # we opt not to automatically output Boost_ERROR_REASON here as
- # it could be quite lengthy and somewhat imposing in its requests
- # Since Boost is not always a required dependency we'll leave this
- # up to the end-user.
- if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
- message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
- else()
- message(STATUS "Could NOT find Boost")
- endif()
+ if(NOT Boost_FIND_QUIETLY)
+ # we opt not to automatically output Boost_ERROR_REASON here as
+ # it could be quite lengthy and somewhat imposing in its requests
+ # Since Boost is not always a required dependency we'll leave this
+ # up to the end-user.
+ if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
+ message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
+ else()
+ message(STATUS "Could NOT find Boost")
endif()
endif()
endif()
+endif()
- # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view
- mark_as_advanced(Boost_INCLUDE_DIR
- Boost_INCLUDE_DIRS
- Boost_LIBRARY_DIRS
- )
+# Configure display of cache entries in GUI.
+foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB})
+ get_property(_type CACHE ${v} PROPERTY TYPE)
+ if(_type)
+ set_property(CACHE ${v} PROPERTY ADVANCED 1)
+ if("x${_type}" STREQUAL "xUNINITIALIZED")
+ if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS")
+ set_property(CACHE ${v} PROPERTY TYPE STRING)
+ else()
+ set_property(CACHE ${v} PROPERTY TYPE PATH)
+ endif()
+ endif()
+ endif()
+endforeach()
+
+# Record last used values of input variables so we can
+# detect on the next run if the user changed them.
+foreach(v
+ ${_Boost_VARS_INC} ${_Boost_VARS_LIB}
+ ${_Boost_VARS_DIR} ${_Boost_VARS_NAME}
+ )
+ if(DEFINED ${v})
+ set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.")
+ else()
+ unset(_${v}_LAST CACHE)
+ endif()
+endforeach()
+
+# Maintain a persistent list of components requested anywhere since
+# the last flush.
+set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}")
+list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS})
+list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED)
+list(SORT _Boost_COMPONENTS_SEARCHED)
+set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}"
+ CACHE INTERNAL "Components requested for this build tree.")
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
index f74366b..53ab031 100644
--- a/Modules/FindCups.cmake
+++ b/Modules/FindCups.cmake
@@ -28,7 +28,7 @@ find_path(CUPS_INCLUDE_DIR cups/cups.h )
find_library(CUPS_LIBRARIES NAMES cups )
if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
- include(CheckLibraryExists)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
# ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index 6acf421..09d1ba4 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -56,7 +56,7 @@ endif()
# prefix as the library was found, if still not found, try curses.h with the
# default search paths.
if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
- include(CheckLibraryExists)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake
index 24cfb87..92c14da 100644
--- a/Modules/FindFLTK.cmake
+++ b/Modules/FindFLTK.cmake
@@ -58,7 +58,7 @@ if(WIN32)
endif()
if(UNIX)
- include(FindX11)
+ include(${CMAKE_CURRENT_LIST_DIR}/FindX11.cmake)
find_library(FLTK_MATH_LIBRARY m)
set( FLTK_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} ${FLTK_MATH_LIBRARY})
endif()
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index 6a665ad..90ff737 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -58,8 +58,8 @@ set(GIF_LIBRARIES ${GIF_LIBRARY})
# one.
# http://giflib.sourcearchive.com/documentation/4.1.4/files.html
if(GIF_INCLUDE_DIR)
- include(CMakePushCheckState)
- include(CheckStructHasMember)
+ include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake)
CMAKE_PUSH_CHECK_STATE()
set(GIF_VERSION 3)
set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}")
diff --git a/Modules/FindGLU.cmake b/Modules/FindGLU.cmake
index d87945a..0d36fad 100644
--- a/Modules/FindGLU.cmake
+++ b/Modules/FindGLU.cmake
@@ -19,7 +19,7 @@
message(STATUS
"WARNING: you are using the obsolete 'GLU' package, please use 'OpenGL' instead")
-include(FindOpenGL)
+include(${CMAKE_CURRENT_LIST_DIR}/FindOpenGL.cmake)
if (OPENGL_GLU_FOUND)
set (GLU_LIBRARY ${OPENGL_LIBRARIES})
diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake
index 07af0bf..f2f9dd0 100644
--- a/Modules/FindGnuplot.cmake
+++ b/Modules/FindGnuplot.cmake
@@ -21,7 +21,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(FindCygwin)
+include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
find_program(GNUPLOT_EXECUTABLE
NAMES
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 33599be..8514164 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -60,7 +60,7 @@
# This module is maintained by Will Dicharry <wdicharry@stellarscience.com>.
-include(SelectLibraryConfigurations)
+include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
# List of the valid HDF5 components
diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake
new file mode 100644
index 0000000..8c10177
--- /dev/null
+++ b/Modules/FindIcotool.cmake
@@ -0,0 +1,56 @@
+# - Find icotool
+# This module looks for icotool. This module defines the
+# following values:
+# ICOTOOL_EXECUTABLE: the full path to the icotool tool.
+# ICOTOOL_FOUND: True if icotool has been found.
+# ICOTOOL_VERSION_STRING: the version of icotool found.
+#
+
+#=============================================================================
+# Copyright 2012 Aleksey Avdeev <solo@altlinux.ru>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+find_program(ICOTOOL_EXECUTABLE
+ icotool
+)
+
+if(ICOTOOL_EXECUTABLE)
+ execute_process(
+ COMMAND ${ICOTOOL_EXECUTABLE} --version
+ OUTPUT_VARIABLE _icotool_version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*")
+ set( ICOTOOL_VERSION_STRING
+ "${CMAKE_MATCH_1}"
+ )
+ else()
+ set( ICOTOOL_VERSION_STRING
+ ""
+ )
+ endif()
+ unset(_icotool_version)
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set ICOTOOL_FOUND to TRUE if
+# all listed variables are TRUE
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(
+ Icotool
+ REQUIRED_VARS ICOTOOL_EXECUTABLE
+ VERSION_VAR ICOTOOL_VERSION_STRING
+)
+
+mark_as_advanced(
+ ICOTOOL_EXECUTABLE
+)
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake
index a092116..70eccef 100644
--- a/Modules/FindKDE3.cmake
+++ b/Modules/FindKDE3.cmake
@@ -245,7 +245,7 @@ endif()
# KDE3Macros.cmake contains all the KDE specific macros
-include(KDE3Macros)
+include(${CMAKE_CURRENT_LIST_DIR}/KDE3Macros.cmake)
macro (KDE3_PRINT_RESULTS)
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 430e45f..3167850 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -40,9 +40,9 @@ set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
if (NOT _LANGUAGES_ MATCHES Fortran)
-include(CheckFunctionExists)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
else ()
-include(CheckFortranFunctionExists)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
endif ()
set(LAPACK_FOUND FALSE)
diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake
index 0290eca..fc01c4c 100644
--- a/Modules/FindMPEG2.cmake
+++ b/Modules/FindMPEG2.cmake
@@ -45,7 +45,7 @@ if(MPEG2_FOUND)
#some native mpeg2 installations will depend
#on libSDL, if found, add it in.
- include( FindSDL )
+ include(${CMAKE_CURRENT_LIST_DIR}/FindSDL.cmake)
if(SDL_FOUND)
set( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY})
endif()
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 4ce4de9..143d10a 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -78,7 +78,7 @@
# include this to handle the QUIETLY and REQUIRED arguments
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-include(GetPrerequisites)
+include(${CMAKE_CURRENT_LIST_DIR}/GetPrerequisites.cmake)
#
# This part detects MPI compilers, attempting to wade through the mess of compiler names in
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index a6f4503..4a393f2 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -103,7 +103,7 @@ else ()
if (OPENGL_gl_LIBRARY)
if(NOT X11_FOUND)
- include(FindX11)
+ include(${CMAKE_CURRENT_LIST_DIR}/FindX11.cmake)
endif()
if (X11_FOUND)
if (NOT APPLE)
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index ad15d8c..8c8ad55 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -95,7 +95,7 @@ if(CMAKE_C_COMPILER_LOADED)
unset(OpenMP_C_FLAG_CANDIDATES)
else()
_OPENMP_FLAG_CANDIDATES("C")
- include(CheckCSourceCompiles)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckCSourceCompiles.cmake)
endif()
foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
@@ -126,7 +126,7 @@ if(CMAKE_CXX_COMPILER_LOADED)
unset(OpenMP_CXX_FLAG_CANDIDATES)
else()
_OPENMP_FLAG_CANDIDATES("CXX")
- include(CheckCXXSourceCompiles)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSourceCompiles.cmake)
# use the same source for CXX as C for now
set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE})
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index e2cc427..224c88e 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -87,6 +87,7 @@ if(WIN32 AND NOT CYGWIN)
find_library(LIB_EAY_DEBUG
NAMES
libeay32MDd
+ libeay32d
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
"lib"
@@ -108,6 +109,7 @@ if(WIN32 AND NOT CYGWIN)
find_library(SSL_EAY_DEBUG
NAMES
ssleay32MDd
+ ssleay32d
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
"lib"
@@ -127,6 +129,11 @@ if(WIN32 AND NOT CYGWIN)
"lib/VC"
)
+ set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}")
+ set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}")
+ set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}")
+ set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}")
+
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(LIB_EAY)
select_library_configurations(SSL_EAY)
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 4a5aaba..7affca8 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -72,7 +72,7 @@
# Output variables of the form OPENSCENEGRAPH_FOO
#
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
set(_osg_modules_to_process)
foreach(_osg_component ${OpenSceneGraph_FIND_COMPONENTS})
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index 25d8df3..5549d14 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -88,8 +88,8 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(FindPackageMessage)
-include(CMakeParseArguments)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
# internal helper macro
macro(_FPHSA_FAILURE_MESSAGE _msg)
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake
index e908a65..5eaf207 100644
--- a/Modules/FindPerl.cmake
+++ b/Modules/FindPerl.cmake
@@ -18,7 +18,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(FindCygwin)
+include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
set(PERL_POSSIBLE_BIN_PATHS
${CYGWIN_INSTALL_PATH}/bin
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake
index e9313ad..492f047 100644
--- a/Modules/FindPerlLibs.cmake
+++ b/Modules/FindPerlLibs.cmake
@@ -38,7 +38,7 @@
# License text for the above reference.)
# find the perl executable
-include(FindPerl)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPerl.cmake)
if (PERL_EXECUTABLE)
### PERL_PREFIX
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 0a9a990..bffa9fb 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -32,7 +32,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(CMakeFindFrameworks)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake)
# Search for the python framework on Apple.
CMAKE_FIND_FRAMEWORKS(Python)
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake
index 13f18fe..541cc05 100644
--- a/Modules/FindQt.cmake
+++ b/Modules/FindQt.cmake
@@ -31,7 +31,7 @@
# License text for the above reference.)
# look for signs of qt3 installations
-file(GLOB GLOB_TEMP_VAR /usr/lib/qt-3*/bin/qmake)
+file(GLOB GLOB_TEMP_VAR /usr/lib*/qt-3*/bin/qmake /usr/lib*/qt3*/bin/qmake)
if(GLOB_TEMP_VAR)
set(QT3_INSTALLED TRUE)
endif()
@@ -56,6 +56,10 @@ if(GLOB_TEMP_VAR)
endif()
set(GLOB_TEMP_VAR)
+if (Qt_FIND_VERSION)
+ set(DESIRED_QT_VERSION "${Qt_FIND_VERSION}")
+endif ()
+
# now find qmake
find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin")
if(QT_QMAKE_EXECUTABLE_FINDQT)
@@ -113,15 +117,15 @@ if(QT3_QGLOBAL_H_FILE)
set(QT3_INSTALLED TRUE)
endif()
-if(QT3_INSTALLED AND QT4_INSTALLED )
+if(QT3_INSTALLED AND QT4_INSTALLED AND NOT DESIRED_QT_VERSION)
# force user to pick if we have both
set(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of Qt to use: 3 or 4")
else()
# if only one found then pick that one
- if(QT3_INSTALLED)
+ if(QT3_INSTALLED AND NOT DESIRED_QT_VERSION EQUAL 4)
set(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of Qt to use: 3 or 4")
endif()
- if(QT4_INSTALLED)
+ if(QT4_INSTALLED AND NOT DESIRED_QT_VERSION EQUAL 3)
set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of Qt to use: 3 or 4")
endif()
endif()
@@ -129,12 +133,12 @@ endif()
if(DESIRED_QT_VERSION MATCHES 3)
set(Qt3_FIND_REQUIRED ${Qt_FIND_REQUIRED})
set(Qt3_FIND_QUIETLY ${Qt_FIND_QUIETLY})
- include(FindQt3)
+ include(${CMAKE_CURRENT_LIST_DIR}/FindQt3.cmake)
endif()
if(DESIRED_QT_VERSION MATCHES 4)
set(Qt4_FIND_REQUIRED ${Qt_FIND_REQUIRED})
set(Qt4_FIND_QUIETLY ${Qt_FIND_QUIETLY})
- include(FindQt4)
+ include(${CMAKE_CURRENT_LIST_DIR}/FindQt4.cmake)
endif()
if(NOT QT3_INSTALLED AND NOT QT4_INSTALLED)
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index a84074b..b42247a 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -376,8 +376,8 @@ if(QT_QT_LIBRARY)
endif()
-include(CheckCXXSymbolExists)
-include(MacroAddFileDependencies)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSymbolExists.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/MacroAddFileDependencies.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
set(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index 9359323..f2e9f25 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -70,7 +70,7 @@
find_path(SDL_INCLUDE_DIR SDL.h
HINTS
ENV SDLDIR
- PATH_SUFFIXES SDL SDL12 SDL11
+ PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
)
# SDL-1.1 is the name used by FreeBSD ports...
@@ -79,6 +79,7 @@ find_library(SDL_LIBRARY_TEMP
NAMES SDL SDL-1.1
HINTS
ENV SDLDIR
+ PATH_SUFFIXES lib
)
if(NOT SDL_BUILDING_LIBRARY)
diff --git a/Modules/FindSelfPackers.cmake b/Modules/FindSelfPackers.cmake
index 7726dce..fd28642 100644
--- a/Modules/FindSelfPackers.cmake
+++ b/Modules/FindSelfPackers.cmake
@@ -18,7 +18,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(FindCygwin)
+include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
find_program(SELF_PACKER_FOR_EXECUTABLE
upx
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index a032496..b797805 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -1,9 +1,13 @@
#
# ---- Find Squish
-# This module can be used to find Squish (currently support is aimed at version 3).
+# This module can be used to find Squish. Currently Squish versions 3 and 4 are supported.
#
# ---- Variables and Macros
# SQUISH_FOUND If false, don't try to use Squish
+# SQUISH_VERSION The full version of Squish found
+# SQUISH_VERSION_MAJOR The major version of Squish found
+# SQUISH_VERSION_MINOR The minor version of Squish found
+# SQUISH_VERSION_PATCH The patch version of Squish found
#
# SQUISH_INSTALL_DIR The Squish installation directory (containing bin, lib, etc)
# SQUISH_SERVER_EXECUTABLE The squishserver executable
@@ -13,18 +17,52 @@
# 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)
+# It provides the function squish_v4_add_test() for adding a squish test to cmake using Squish 4.x:
+#
+# squish_v4_add_test(cmakeTestName AUT targetName SUITE suiteName TEST squishTestName
+# [SETTINGSGROUP group] [PRE_COMMAND command] [POST_COMMAND command] )
+#
+# The arguments have the following meaning:
+# cmakeTestName: this will be used as the first argument for add_test()
+# AUT targetName: the name of the cmake target which will be used as AUT, i.e. the
+# executable which will be tested.
+# SUITE suiteName: this is either the full path to the squish suite, or just the
+# last directory of the suite, i.e. the suite name. In this case
+# the CMakeLists.txt which calls squish_add_test() must be located
+# in the parent directory of the suite directory.
+# TEST squishTestName: the name of the squish test, i.e. the name of the subdirectory
+# of the test inside the suite directory.
+# SETTINGSGROUP group: if specified, the given settings group will be used for executing the test.
+# If not specified, the groupname will be "CTest_<username>"
+# PRE_COMMAND command: if specified, the given command will be executed before starting the squish test.
+# POST_COMMAND command: same as PRE_COMMAND, but after the squish test has been executed.
+#
+# ---- Typical Use
+# enable_testing()
+# find_package(Squish 4.0)
+# if (SQUISH_FOUND)
+# squish_v4_add_test(myTestName AUT myApp SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite TEST someSquishTest SETTINGSGROUP myGroup )
+# endif ()
+#
+#
+# For users of Squish version 3.x the macro squish_v3_add_test() is provided:
+# squish_v3_add_test(testName applicationUnderTest testCase envVars testWrapper)
+# Use this macro to add a test using Squish 3.x.
#
# ---- Typical Use
# enable_testing()
# find_package(Squish)
# if (SQUISH_FOUND)
-# SQUISH_ADD_TEST(myTestName myApplication testSuiteName testCaseName)
+# squish_v3_add_test(myTestName myApplication testCase envVars testWrapper)
# endif ()
#
+# macro SQUISH_ADD_TEST(testName applicationUnderTest testCase envVars testWrapper)
+# This is deprecated. Use SQUISH_V3_ADD_TEST() if you are using Squish 3.x instead.
+
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
+# Copyright 2012 Alexander Neundorf
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -36,6 +74,9 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+
+include(CMakeParseArguments)
+
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.")
@@ -74,21 +115,36 @@ if(SQUISH_INSTALL_DIR)
# 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}")
+ find_program(SQUISH_CLIENT_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishrunner${CMAKE_EXECUTABLE_SUFFIX} DOC "The ${SQUISH_CLIENT_EXECUTABLE_STRING}")
endif()
# 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}")
+ find_program(SQUISH_SERVER_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishserver${CMAKE_EXECUTABLE_SUFFIX} DOC "The ${SQUISH_SERVER_EXECUTABLE_STRING}")
endif()
else()
set(SQUISH_INSTALL_DIR_FOUND 0)
endif()
+
+set(SQUISH_VERSION)
+set(SQUISH_VERSION_MAJOR )
+set(SQUISH_VERSION_MINOR )
+set(SQUISH_VERSION_PATCH )
+
# record if executables are set
if(SQUISH_CLIENT_EXECUTABLE)
set(SQUISH_CLIENT_EXECUTABLE_FOUND 1)
+ execute_process(COMMAND "${SQUISH_CLIENT_EXECUTABLE}" --version
+ OUTPUT_VARIABLE _squishVersionOutput
+ ERROR_QUIET )
+ if("${_squishVersionOutput}" MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+).*$")
+ set(SQUISH_VERSION_MAJOR "${CMAKE_MATCH_1}")
+ set(SQUISH_VERSION_MINOR "${CMAKE_MATCH_2}")
+ set(SQUISH_VERSION_PATCH "${CMAKE_MATCH_3}")
+ set(SQUISH_VERSION "${SQUISH_VERSION_MAJOR}.${SQUISH_VERSION_MINOR}.${SQUISH_VERSION_PATCH}" )
+ endif()
else()
set(SQUISH_CLIENT_EXECUTABLE_FOUND 0)
endif()
@@ -100,16 +156,21 @@ else()
endif()
# 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)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Squish REQUIRED_VARS SQUISH_INSTALL_DIR SQUISH_CLIENT_EXECUTABLE SQUISH_SERVER_EXECUTABLE
+ VERSION_VAR SQUISH_VERSION )
+
+
+set(_SQUISH_MODULE_DIR "${CMAKE_CURRENT_LIST_DIR}")
+
+macro(SQUISH_V3_ADD_TEST testName testAUT testCase envVars testWraper)
+ if("${SQUISH_VERSION_MAJOR}" STREQUAL "4")
+ message(STATUS "Using squish_v3_add_test(), but SQUISH_VERSION_MAJOR is ${SQUISH_VERSION_MAJOR}.\nThis may not work.")
endif()
-endforeach()
-macro(SQUISH_ADD_TEST testName testAUT testCase envVars testWraper)
add_test(${testName}
${CMAKE_COMMAND} -V -VV
+ "-Dsquish_version:STRING=3"
"-Dsquish_aut:STRING=${testAUT}"
"-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}"
"-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}"
@@ -117,10 +178,84 @@ macro(SQUISH_ADD_TEST testName testAUT testCase envVars testWraper)
"-Dsquish_test_case:STRING=${testCase}"
"-Dsquish_env_vars:STRING=${envVars}"
"-Dsquish_wrapper:STRING=${testWraper}"
- -P "${CMAKE_ROOT}/Modules/SquishTestScript.cmake"
+ "-Dsquish_module_dir:STRING=${_SQUISH_MODULE_DIR}"
+ -P "${_SQUISH_MODULE_DIR}/SquishTestScript.cmake"
)
set_tests_properties(${testName}
PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED;ERROR;FATAL"
)
endmacro()
+
+macro(SQUISH_ADD_TEST)
+ message(STATUS "Using squish_add_test() is deprecated, use squish_v3_add_test() instead.")
+ squish_v3_add_test(${ARGV})
+endmacro()
+
+
+function(SQUISH_V4_ADD_TEST testName)
+
+ if(NOT "${SQUISH_VERSION_MAJOR}" STREQUAL "4")
+ message(STATUS "Using squish_v4_add_test(), but SQUISH_VERSION_MAJOR is ${SQUISH_VERSION_MAJOR}.\nThis may not work.")
+ endif()
+
+ set(oneValueArgs AUT SUITE TEST SETTINGSGROUP PRE_COMMAND POST_COMMAND)
+
+ cmake_parse_arguments(_SQUISH "" "${oneValueArgs}" "" ${ARGN} )
+
+ if(_SQUISH_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown keywords given to SQUISH_ADD_TEST(): \"${_SQUISH_UNPARSED_ARGUMENTS}\"")
+ endif()
+
+ if(NOT _SQUISH_AUT)
+ message(FATAL_ERROR "Required argument AUT not given for SQUISH_ADD_TEST()")
+ endif()
+
+ if(NOT _SQUISH_SUITE)
+ message(FATAL_ERROR "Required argument SUITE not given for SQUISH_ADD_TEST()")
+ endif()
+
+ if(NOT _SQUISH_TEST)
+ message(FATAL_ERROR "Required argument TEST not given for SQUISH_ADD_TEST()")
+ endif()
+
+ get_target_property(testAUTLocation ${_SQUISH_AUT} LOCATION)
+ get_filename_component(testAUTDir ${testAUTLocation} PATH)
+ get_filename_component(testAUTName ${testAUTLocation} NAME)
+
+ get_filename_component(absTestSuite "${_SQUISH_SUITE}" ABSOLUTE)
+ if(NOT EXISTS "${absTestSuite}")
+ message(FATAL_ERROR "Could not find squish test suite ${_SQUISH_SUITE} (checked ${absTestSuite})")
+ endif()
+
+ set(absTestCase "${absTestSuite}/${_SQUISH_TEST}")
+ if(NOT EXISTS "${absTestCase}")
+ message(FATAL_ERROR "Could not find squish testcase ${_SQUISH_TEST} (checked ${absTestCase})")
+ endif()
+
+ if(NOT _SQUISH_SETTINGSGROUP)
+ set(_SQUISH_SETTINGSGROUP "CTest_$ENV{LOGNAME}")
+ endif()
+
+ add_test(${testName}
+ ${CMAKE_COMMAND} -V -VV
+ "-Dsquish_version:STRING=4"
+ "-Dsquish_aut:STRING=${testAUTName}"
+ "-Dsquish_aut_dir:STRING=${testAUTDir}"
+ "-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}"
+ "-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}"
+ "-Dsquish_libqtdir:STRING=${QT_LIBRARY_DIR}"
+ "-Dsquish_test_suite:STRING=${absTestSuite}"
+ "-Dsquish_test_case:STRING=${_SQUISH_TEST}"
+ "-Dsquish_env_vars:STRING=${envVars}"
+ "-Dsquish_wrapper:STRING=${testWraper}"
+ "-Dsquish_module_dir:STRING=${_SQUISH_MODULE_DIR}"
+ "-Dsquish_settingsgroup:STRING=${_SQUISH_SETTINGSGROUP}"
+ "-Dsquish_pre_command:STRING=${_SQUISH_PRE_COMMAND}"
+ "-Dsquish_post_command:STRING=${_SQUISH_POST_COMMAND}"
+ -P "${_SQUISH_MODULE_DIR}/SquishTestScript.cmake"
+ )
+ set_tests_properties(${testName}
+ PROPERTIES FAIL_REGULAR_EXPRESSION "FAIL;FAILED;ERROR;FATAL"
+ )
+endfunction()
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index 0d20da5..2f84ae0 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -44,9 +44,9 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(CMakeFindFrameworks)
-include(FindTclsh)
-include(FindWish)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/FindTclsh.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/FindWish.cmake)
if(TCLSH_VERSION_STRING)
set(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}")
diff --git a/Modules/FindTclStub.cmake b/Modules/FindTclStub.cmake
index e66f7bc..8dda94a 100644
--- a/Modules/FindTclStub.cmake
+++ b/Modules/FindTclStub.cmake
@@ -34,7 +34,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(FindTCL)
+include(${CMAKE_CURRENT_LIST_DIR}/FindTCL.cmake)
get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake
index a69e3f1..87caadc 100644
--- a/Modules/FindUnixCommands.cmake
+++ b/Modules/FindUnixCommands.cmake
@@ -15,7 +15,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(FindCygwin)
+include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
find_program(BASH
bash
diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake
index fa090ff..0dede2d 100644
--- a/Modules/FindVTK.cmake
+++ b/Modules/FindVTK.cmake
@@ -62,7 +62,7 @@ set(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${
if(_VTK_40_ALLOW AND VTK_DIR)
if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
set(VTK_FOUND 1)
- include(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings.
+ include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings.
endif()
endif()
@@ -117,7 +117,7 @@ if(_VTK_40_ALLOW AND NOT VTK_DIR)
if(VTK_DIR)
if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
set(VTK_FOUND 1)
- include(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings.
+ include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings.
else()
# We found the wrong version. Pretend we did not find it.
set(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE)
diff --git a/Modules/FindWget.cmake b/Modules/FindWget.cmake
index a1dd47f..4da98b1 100644
--- a/Modules/FindWget.cmake
+++ b/Modules/FindWget.cmake
@@ -17,7 +17,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(FindCygwin)
+include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
find_program(WGET_EXECUTABLE
wget
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index e12dc0a..3cd3cef 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -336,8 +336,8 @@ if (UNIX)
endif ()
if(X11_FOUND)
- include(CheckFunctionExists)
- include(CheckLibraryExists)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
# Translated from an autoconf-generated configure script.
# See libs.m4 in autoconf's m4 directory.
@@ -417,7 +417,7 @@ if (UNIX)
# Build the final list of libraries.
set(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS})
- include(FindPackageMessage)
+ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
"[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
else ()
diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake
index fb7421e..bc1e48a 100644
--- a/Modules/Findosg.cmake
+++ b/Modules/Findosg.cmake
@@ -46,7 +46,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgUtil/SceneView>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSG osg/PositionAttitudeTransform)
OSG_FIND_LIBRARY(OSG osg)
diff --git a/Modules/FindosgAnimation.cmake b/Modules/FindosgAnimation.cmake
index 1c8eb50..121aefc 100644
--- a/Modules/FindosgAnimation.cmake
+++ b/Modules/FindosgAnimation.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgAnimation/Animation>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGANIMATION osgAnimation/Animation)
OSG_FIND_LIBRARY(OSGANIMATION osgAnimation)
diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake
index 76272aa..1ed94a1 100644
--- a/Modules/FindosgDB.cmake
+++ b/Modules/FindosgDB.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgDB/DatabasePager>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGDB osgDB/DatabasePager)
OSG_FIND_LIBRARY(OSGDB osgDB)
diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake
index 3314750..1f1d59f 100644
--- a/Modules/FindosgFX.cmake
+++ b/Modules/FindosgFX.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgFX/BumpMapping>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGFX osgFX/BumpMapping)
OSG_FIND_LIBRARY(OSGFX osgFX)
diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake
index fd9317d..e60f7f5 100644
--- a/Modules/FindosgGA.cmake
+++ b/Modules/FindosgGA.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgGA/FlightManipulator>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGGA osgGA/FlightManipulator)
OSG_FIND_LIBRARY(OSGGA osgGA)
diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake
index 2394c05..a430ad6 100644
--- a/Modules/FindosgIntrospection.cmake
+++ b/Modules/FindosgIntrospection.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgIntrospection/Reflection>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGINTROSPECTION osgIntrospection/Reflection)
OSG_FIND_LIBRARY(OSGINTROSPECTION osgIntrospection)
diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake
index 9e58570..32d6def 100644
--- a/Modules/FindosgManipulator.cmake
+++ b/Modules/FindosgManipulator.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgManipulator/TrackballDragger>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGMANIPULATOR osgManipulator/TrackballDragger)
OSG_FIND_LIBRARY(OSGMANIPULATOR osgManipulator)
diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake
index 2f93389..1a6ae0b 100644
--- a/Modules/FindosgParticle.cmake
+++ b/Modules/FindosgParticle.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgParticle/FireEffect>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGPARTICLE osgParticle/FireEffect)
OSG_FIND_LIBRARY(OSGPARTICLE osgParticle)
diff --git a/Modules/FindosgPresentation.cmake b/Modules/FindosgPresentation.cmake
index f89e25f..412502a 100644
--- a/Modules/FindosgPresentation.cmake
+++ b/Modules/FindosgPresentation.cmake
@@ -43,7 +43,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgPresentation/SlideEventHandler>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGPRESENTATION osgPresentation/SlideEventHandler)
OSG_FIND_LIBRARY(OSGPRESENTATION osgPresentation)
diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake
index 2c3800b..ea561a0 100644
--- a/Modules/FindosgProducer.cmake
+++ b/Modules/FindosgProducer.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgProducer/OsgSceneHandler>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGPRODUCER osgProducer/OsgSceneHandler)
OSG_FIND_LIBRARY(OSGPRODUCER osgProducer)
diff --git a/Modules/FindosgQt.cmake b/Modules/FindosgQt.cmake
index ddc9128..c7e8fee 100644
--- a/Modules/FindosgQt.cmake
+++ b/Modules/FindosgQt.cmake
@@ -43,7 +43,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgQt/GraphicsWindowQt>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGQT osgQt/GraphicsWindowQt)
OSG_FIND_LIBRARY(OSGQT osgQt)
diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake
index ca87b56..f3be0bf 100644
--- a/Modules/FindosgShadow.cmake
+++ b/Modules/FindosgShadow.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgShadow/ShadowTexture>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGSHADOW osgShadow/ShadowTexture)
OSG_FIND_LIBRARY(OSGSHADOW osgShadow)
diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake
index 2fc5105..19cd175 100644
--- a/Modules/FindosgSim.cmake
+++ b/Modules/FindosgSim.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgSim/ImpostorSprite>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGSIM osgSim/ImpostorSprite)
OSG_FIND_LIBRARY(OSGSIM osgSim)
diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake
index eafd8fb..4b7249e 100644
--- a/Modules/FindosgTerrain.cmake
+++ b/Modules/FindosgTerrain.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgTerrain/Terrain>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGTERRAIN osgTerrain/Terrain)
OSG_FIND_LIBRARY(OSGTERRAIN osgTerrain)
diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake
index 57655b1..41683c7 100644
--- a/Modules/FindosgText.cmake
+++ b/Modules/FindosgText.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgText/Text>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGTEXT osgText/Text)
OSG_FIND_LIBRARY(OSGTEXT osgText)
diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake
index eeabc34..85c1177 100644
--- a/Modules/FindosgUtil.cmake
+++ b/Modules/FindosgUtil.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgUtil/SceneView>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGUTIL osgUtil/SceneView)
OSG_FIND_LIBRARY(OSGUTIL osgUtil)
diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake
index 2afd761..d2252f4 100644
--- a/Modules/FindosgViewer.cmake
+++ b/Modules/FindosgViewer.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgViewer/Viewer>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGVIEWER osgViewer/Viewer)
OSG_FIND_LIBRARY(OSGVIEWER osgViewer)
diff --git a/Modules/FindosgVolume.cmake b/Modules/FindosgVolume.cmake
index 1fa6764..ae2d95c 100644
--- a/Modules/FindosgVolume.cmake
+++ b/Modules/FindosgVolume.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgVolume/Volume>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGVOLUME osgVolume/Volume)
OSG_FIND_LIBRARY(OSGVOLUME osgVolume)
diff --git a/Modules/FindosgWidget.cmake b/Modules/FindosgWidget.cmake
index 1a51e60..cb2e12f 100644
--- a/Modules/FindosgWidget.cmake
+++ b/Modules/FindosgWidget.cmake
@@ -42,7 +42,7 @@
# #include <osg/PositionAttitudeTransform>
# #include <osgWidget/Widget>
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH (OSGWIDGET osgWidget/Widget)
OSG_FIND_LIBRARY(OSGWIDGET osgWidget)
diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake
index 5030bcc..4179f7b 100644
--- a/Modules/FindwxWindows.cmake
+++ b/Modules/FindwxWindows.cmake
@@ -26,7 +26,7 @@
# HAVE_ISYSTEM - true required to replace -I by -isystem on g++
#
# For convenience include Use_wxWindows.cmake in your project's
-# CMakeLists.txt using include(Use_wxWindows).
+# CMakeLists.txt using include(${CMAKE_CURRENT_LIST_DIR}/Use_wxWindows.cmake).
#
# USAGE
# set(WXWINDOWS_USE_GL 1)
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index a401762..ed0b8af 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -107,6 +107,7 @@ elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND
# Use the value of SDKROOT from the environment.
set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}")
elseif("${CMAKE_GENERATOR}" MATCHES Xcode
+ OR CMAKE_OSX_DEPLOYMENT_TARGET
OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]"
OR NOT EXISTS "/usr/include/sys/types.h")
# Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory.
@@ -262,6 +263,23 @@ set(CMAKE_SYSTEM_FRAMEWORK_PATH
/Network/Library/Frameworks
/System/Library/Frameworks)
+# Warn about known system mis-configuration case.
+if(CMAKE_OSX_SYSROOT)
+ get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
+ if(NOT _IN_TC AND
+ NOT IS_SYMLINK "${CMAKE_OSX_SYSROOT}/Library/Frameworks"
+ AND IS_SYMLINK "${CMAKE_OSX_SYSROOT}/Library/Frameworks/Frameworks")
+ message(WARNING "The SDK Library/Frameworks path\n"
+ " ${CMAKE_OSX_SYSROOT}/Library/Frameworks\n"
+ "is not set up correctly on this system. "
+ "This is known to occur when installing Xcode 3.2.6:\n"
+ " http://bugs.python.org/issue14018\n"
+ "The problem may cause build errors that report missing system frameworks. "
+ "Fix your SDK symlinks to resolve this issue and avoid this warning."
+ )
+ endif()
+endif()
+
# default to searching for application bundles first
if(NOT DEFINED CMAKE_FIND_APPBUNDLE)
set(CMAKE_FIND_APPBUNDLE FIRST)
diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake
index cf18501..ce4d3ce 100644
--- a/Modules/Platform/FreeBSD.cmake
+++ b/Modules/Platform/FreeBSD.cmake
@@ -1,16 +1,14 @@
-if(EXISTS /usr/include/dlfcn.h)
- set(CMAKE_DL_LIBS "")
- set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
- set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
- set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
- set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
- set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
- set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
- set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
- set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
- set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
- set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
-endif()
+set(CMAKE_DL_LIBS "")
+set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
+set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
+set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
# Shared libraries with no builtin soname may not be linked safely by
# specifying the file path.
diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake
index 7318275..1004eb3 100644
--- a/Modules/Platform/NetBSD.cmake
+++ b/Modules/Platform/NetBSD.cmake
@@ -1,15 +1,13 @@
-if(EXISTS /usr/include/dlfcn.h)
- set(CMAKE_DL_LIBS "")
- set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
- set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
- set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
- set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
- set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
- set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
- set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
- set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
- set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
- set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
-endif()
+set(CMAKE_DL_LIBS "")
+set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
+set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
+set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
include(Platform/UnixPaths)
diff --git a/Modules/Squish4RunTestCase.bat b/Modules/Squish4RunTestCase.bat
new file mode 100755
index 0000000..ad1cc8c
--- /dev/null
+++ b/Modules/Squish4RunTestCase.bat
@@ -0,0 +1,24 @@
+set SQUISHSERVER=%1
+set SQUISHRUNNER=%2
+set TESTSUITE=%3
+set TESTCASE=%4
+set AUT=%5
+set AUTDIR=%6
+set SETTINGSGROUP=%7
+
+%SQUISHSERVER% --stop
+
+echo "Adding AUT... %SQUISHSERVER% --config addAUT %AUT% %AUTDIR%"
+%SQUISHSERVER% --config addAUT "%AUT%" "%AUTDIR%"
+
+echo "Starting the squish server... %SQUISHSERVER%"
+start /B %SQUISHSERVER%
+
+echo "Running the test case...%SQUISHRUNNER% --testsuite %TESTSUITE% --testcase %TESTCASE%"
+%SQUISHRUNNER% --testsuite "%TESTSUITE%" --testcase "%TESTCASE%"
+set returnValue=%ERRORLEVEL%
+
+echo "Stopping the squish server... %SQUISHSERVER% --stop"
+%SQUISHSERVER% --stop
+
+exit /B %returnValue%
diff --git a/Modules/Squish4RunTestCase.sh b/Modules/Squish4RunTestCase.sh
new file mode 100755
index 0000000..abd5deb
--- /dev/null
+++ b/Modules/Squish4RunTestCase.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+SQUISHSERVER=$1
+SQUISHRUNNER=$2
+TESTSUITE=$3
+TESTCASE=$4
+AUT=$5
+AUTDIR=$6
+SETTINGSGROUP=$7
+
+$SQUISHSERVER --stop > /dev/null 2>&1
+
+echo "Adding AUT... $SQUISHSERVER --settingsGroup $SETTINGSGROUP --config addAUT $AUT $AUTDIR"
+$SQUISHSERVER --settingsGroup "$SETTINGSGROUP" --config addAUT "$AUT" "$AUTDIR" || exit -1
+# sleep 1
+
+echo "Starting the squish server... $SQUISHSERVER --daemon"
+$SQUISHSERVER --daemon || exit -1
+# sleep 2
+
+echo "Running the test case...$SQUISHRUNNER --settingsGroup $SETTINGSGROUP --testsuite $TESTSUITE --testcase $TESTCASE"
+$SQUISHRUNNER --settingsGroup "$SETTINGSGROUP" --testsuite "$TESTSUITE" --testcase "$TESTCASE"
+returnValue=$?
+
+echo "Stopping the squish server... $SQUISHSERVER --stop"
+$SQUISHSERVER --stop
+
+exit $returnValue
diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake
index d565305..f794b3e 100644
--- a/Modules/SquishTestScript.cmake
+++ b/Modules/SquishTestScript.cmake
@@ -22,17 +22,22 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
-
# print out the variable that we are using
message(STATUS "squish_aut='${squish_aut}'")
+message(STATUS "squish_aut_dir='${squish_aut_dir}'")
+message(STATUS "squish_version='${squish_version}'")
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_suite='${squish_test_suite}'")
message(STATUS "squish_test_case='${squish_test_case}'")
message(STATUS "squish_wrapper='${squish_wrapper}'")
message(STATUS "squish_env_vars='${squish_env_vars}'")
+message(STATUS "squish_module_dir='${squish_module_dir}'")
+message(STATUS "squish_settingsgroup='${squish_settingsgroup}'")
+message(STATUS "squish_pre_command='${squish_pre_command}'")
+message(STATUS "squish_post_command='${squish_post_command}'")
# parse enviornment variables
foreach(i ${squish_env_vars})
@@ -48,25 +53,38 @@ if (QT4_INSTALLED)
set ( ENV{${SQUISH_LIBQTDIR}} ${squish_libqtdir} )
endif ()
+if(squish_pre_command)
+ message(STATUS "Executing pre command: ${squish_pre_command}")
+ execute_process(COMMAND "${squish_pre_command}")
+endif()
+
# 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 ()
+if("${squish_version}" STREQUAL "4")
+ if (WIN32)
+ execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir} ${squish_settingsgroup}
+ RESULT_VARIABLE test_rv )
+ elseif(UNIX)
+ execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir} ${squish_settingsgroup}
+ RESULT_VARIABLE test_rv )
+ endif ()
-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 ()
+else()
+
+ if (WIN32)
+ execute_process(COMMAND ${squish_module_dir}/SquishRunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
+ RESULT_VARIABLE test_rv )
+ elseif(UNIX)
+ execute_process(COMMAND ${squish_module_dir}/SquishRunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
+ RESULT_VARIABLE test_rv )
+ endif ()
+endif()
+
+if(squish_post_command)
+ message(STATUS "Executing post command: ${squish_post_command}")
+ execute_process(COMMAND "${squish_post_command}")
+endif()
# check for an error with running the test
if(NOT "${test_rv}" STREQUAL "0")
message(FATAL_ERROR "Error running Squish test")
endif()
-
-
-
diff --git a/Modules/TestForANSIStreamHeaders.cmake b/Modules/TestForANSIStreamHeaders.cmake
index 4aa4023..060b3a4 100644
--- a/Modules/TestForANSIStreamHeaders.cmake
+++ b/Modules/TestForANSIStreamHeaders.cmake
@@ -16,7 +16,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include(CheckIncludeFileCXX)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckIncludeFileCXX.cmake)
if(NOT CMAKE_NO_ANSI_STREAM_HEADERS)
CHECK_INCLUDE_FILE_CXX(iostream CMAKE_ANSI_STREAM_HEADERS)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 467a73e..714d4bd 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,6 +1,6 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
-set(CMake_VERSION_PATCH 9)
-set(CMake_VERSION_TWEAK 20121025)
+set(CMake_VERSION_PATCH 10)
+set(CMake_VERSION_TWEAK 20121113)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h
index 48d935c..abae372 100644
--- a/Source/CPack/cmCPackComponentGroup.h
+++ b/Source/CPack/cmCPackComponentGroup.h
@@ -42,7 +42,9 @@ public:
class cmCPackComponent
{
public:
- cmCPackComponent() : Group(0), TotalSize(0) { }
+ cmCPackComponent() : Group(0), IsRequired(true), IsHidden(false),
+ IsDisabledByDefault(false), IsDownloaded(false),
+ TotalSize(0) { }
/// The name of the component (used to reference the component).
std::string Name;
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 4bd5d5c..f99db58 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -76,6 +76,11 @@ int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel,
packageFileName.c_str());
// Tell CPackDeb.cmake the name of the component GROUP.
this->SetOption("CPACK_DEB_PACKAGE_COMPONENT",packageName.c_str());
+ // Tell CPackDeb.cmake the path where the component is.
+ std::string component_path = "/";
+ component_path += packageName;
+ this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH",
+ component_path.c_str());
if (!this->ReadListFile("CPackDeb.cmake"))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -198,8 +203,11 @@ int cmCPackDebGenerator::PackageComponentsAllInOne()
/* replace the TEMPORARY package file name */
this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME",
packageFileName.c_str());
- // Tell CPackDeb.cmake the name of the component GROUP.
- this->SetOption("CPACK_DEB_PACKAGE_COMPONENT",compInstDirName.c_str());
+ // Tell CPackDeb.cmake the path where the component is.
+ std::string component_path = "/";
+ component_path += compInstDirName;
+ this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH",
+ component_path.c_str());
if (!this->ReadListFile("CPackDeb.cmake"))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index 78cb1b6..d973c01 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -442,7 +442,22 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
line.replace(pos, 1, "\\\"");
pos = line.find('\"', pos+2);
}
- osf << " \"" << line << "\\n\"\n";
+ // break up long lines to avoid Rez errors
+ std::vector<std::string> lines;
+ const size_t max_line_length = 512;
+ for(size_t i=0; i<line.size(); i+= max_line_length)
+ {
+ int line_length = max_line_length;
+ if(i+max_line_length > line.size())
+ line_length = line.size()-i;
+ lines.push_back(line.substr(i, line_length));
+ }
+
+ for(size_t i=0; i<lines.size(); i++)
+ {
+ osf << " \"" << lines[i] << "\"\n";
+ }
+ osf << " \"\\n\"\n";
}
osf << "};\n";
osf << "\n";
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index b2e57a2..fdbae35 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -356,18 +356,30 @@ int cmCPackNSISGenerator::InitializeInternal()
<< std::endl);
std::vector<std::string> path;
std::string nsisPath;
- bool gotRegValue = true;
+ bool gotRegValue = false;
#ifdef _WIN32
- if ( !cmsys::SystemTools::ReadRegistryValue(
+ if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath,
+ cmsys::SystemTools::KeyWOW64_32) )
+ {
+ gotRegValue = true;
+ }
+ if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath) )
+ {
+ gotRegValue = true;
+ }
+ if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath,
cmsys::SystemTools::KeyWOW64_32) )
{
- if ( !cmsys::SystemTools::ReadRegistryValue(
- "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) )
- {
- gotRegValue = false;
- }
+ gotRegValue = true;
+ }
+ if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) )
+ {
+ gotRegValue = true;
}
if (gotRegValue)
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index edbe838..c617a3e 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -106,56 +106,101 @@ int cmCPackPackageMakerGenerator::PackageFiles()
resDir += "/en.lproj";
}
-
- // Create directory structure
- std::string preflightDirName = resDir + "/PreFlight";
- std::string postflightDirName = resDir + "/PostFlight";
const char* preflight = this->GetOption("CPACK_PREFLIGHT_SCRIPT");
const char* postflight = this->GetOption("CPACK_POSTFLIGHT_SCRIPT");
const char* postupgrade = this->GetOption("CPACK_POSTUPGRADE_SCRIPT");
- // if preflight or postflight scripts not there create directories
- // of the same name, I think this makes it work
- if(!preflight)
+
+ if(this->Components.empty())
{
- if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str()))
+ // Create directory structure
+ std::string preflightDirName = resDir + "/PreFlight";
+ std::string postflightDirName = resDir + "/PostFlight";
+ // if preflight or postflight scripts not there create directories
+ // of the same name, I think this makes it work
+ if(!preflight)
{
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Problem creating installer directory: "
- << preflightDirName.c_str() << std::endl);
- return 0;
+ if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str()))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem creating installer directory: "
+ << preflightDirName.c_str() << std::endl);
+ return 0;
+ }
+ }
+ if(!postflight)
+ {
+ if ( !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str()))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem creating installer directory: "
+ << postflightDirName.c_str() << std::endl);
+ return 0;
+ }
+ }
+ // if preflight, postflight, or postupgrade are set
+ // then copy them into the resource directory and make
+ // them executable
+ if(preflight)
+ {
+ this->CopyInstallScript(resDir.c_str(),
+ preflight,
+ "preflight");
+ }
+ if(postflight)
+ {
+ this->CopyInstallScript(resDir.c_str(),
+ postflight,
+ "postflight");
+ }
+ if(postupgrade)
+ {
+ this->CopyInstallScript(resDir.c_str(),
+ postupgrade,
+ "postupgrade");
}
}
- if(!postflight)
+ else if(postflight)
{
- if ( !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str()))
+ // create a postflight component to house the script
+ this->PostFlightComponent.Name = "PostFlight";
+ this->PostFlightComponent.DisplayName = "PostFlight";
+ this->PostFlightComponent.Description = "PostFlight";
+ this->PostFlightComponent.IsHidden = true;
+
+ // empty directory for pkg contents
+ std::string packageDir = toplevel + "/" + PostFlightComponent.Name;
+ if (!cmsys::SystemTools::MakeDirectory(packageDir.c_str()))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Problem creating installer directory: "
- << postflightDirName.c_str() << std::endl);
+ "Problem creating component packages directory: "
+ << packageDir.c_str() << std::endl);
return 0;
}
- }
- // if preflight, postflight, or postupgrade are set
- // then copy them into the resource directory and make
- // them executable
- if(preflight)
- {
- this->CopyInstallScript(resDir.c_str(),
- preflight,
- "preflight");
- }
- if(postflight)
- {
- this->CopyInstallScript(resDir.c_str(),
+
+ // create package
+ std::string packageFileDir = packageDirFileName + "/Contents/Packages/";
+ if (!cmsys::SystemTools::MakeDirectory(packageFileDir.c_str()))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem creating component PostFlight Packages directory: "
+ << packageFileDir.c_str() << std::endl);
+ return 0;
+ }
+ std::string packageFile = packageFileDir +
+ this->GetPackageName(PostFlightComponent);
+ if (!this->GenerateComponentPackage(packageFile.c_str(),
+ packageDir.c_str(),
+ PostFlightComponent))
+ {
+ return 0;
+ }
+
+ // copy postflight script into resource directory of .pkg
+ std::string resourceDir = packageFile + "/Contents/Resources";
+ this->CopyInstallScript(resourceDir.c_str(),
postflight,
"postflight");
}
- if(postupgrade)
- {
- this->CopyInstallScript(resDir.c_str(),
- postupgrade,
- "postupgrade");
- }
if (!this->Components.empty())
{
@@ -778,6 +823,11 @@ WriteDistributionFile(const char* metapackageFile)
<< std::endl;
}
}
+ if(!this->PostFlightComponent.Name.empty())
+ {
+ choiceOut << "<line choice=\"" << PostFlightComponent.Name
+ << "Choice\"></line>" << std::endl;
+ }
choiceOut << "</choices-outline>" << std::endl;
// Create the actual choices
@@ -792,6 +842,12 @@ WriteDistributionFile(const char* metapackageFile)
{
CreateChoice(compIt->second, choiceOut);
}
+
+ if(!this->PostFlightComponent.Name.empty())
+ {
+ CreateChoice(PostFlightComponent, choiceOut);
+ }
+
this->SetOption("CPACK_PACKAGEMAKER_CHOICES", choiceOut.str().c_str());
// Create the distribution.dist file in the metapackage to turn it
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h
index 101813f..ba3d968 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.h
+++ b/Source/CPack/cmCPackPackageMakerGenerator.h
@@ -112,6 +112,9 @@ protected:
// value.
std::string EscapeForXML(std::string str);
+ // The PostFlight component when creating a metapackage
+ cmCPackComponent PostFlightComponent;
+
double PackageMakerVersion;
double PackageCompatibilityVersion;
};
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index 13aa6d8..66a4194 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -77,6 +77,11 @@ int cmCPackRPMGenerator::PackageOnePack(std::string initialToplevel,
packageFileName.c_str());
// Tell CPackRPM.cmake the name of the component NAME.
this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",packageName.c_str());
+ // Tell CPackRPM.cmake the path where the component is.
+ std::string component_path = "/";
+ component_path += packageName;
+ this->SetOption("CPACK_RPM_PACKAGE_COMPONENT_PART_PATH",
+ component_path.c_str());
if (!this->ReadListFile("CPackRPM.cmake"))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -178,8 +183,11 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne()
/* replace the TEMPORARY package file name */
this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME",
packageFileName.c_str());
- // Tell CPackRPM.cmake the name of the component GROUP.
- this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",compInstDirName.c_str());
+ // Tell CPackRPM.cmake the path where the component is.
+ std::string component_path = "/";
+ component_path += compInstDirName;
+ this->SetOption("CPACK_RPM_PACKAGE_COMPONENT_PART_PATH",
+ component_path.c_str());
if (!this->ReadListFile("CPackRPM.cmake"))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 0da8aae..453e32c 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -121,7 +121,7 @@ bool cmCTestHandlerCommand
}
if ( this->Values[ct_SUBMIT_INDEX] )
{
- if ( this->CTest->GetDartVersion() <= 1 )
+ if(!this->CTest->GetDropSiteCDash() && this->CTest->GetDartVersion() <= 1)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Dart before version 2.0 does not support collecting submissions."
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index 5c7414f..bd1ff71 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -175,7 +175,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
}
else if ( key == ctrl('d') ||key == KEY_DC )
{
- if ( form->curcol > 0 )
+ if ( form->curcol >= 0 )
{
form_driver(form, REQ_DEL_CHAR);
}
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index c5252b7..1cc1e3a 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -68,7 +68,8 @@ public:
" [COMMAND command2 [ARGS] [args2...] ...]\n"
" [MAIN_DEPENDENCY depend]\n"
" [DEPENDS [depends...]]\n"
- " [IMPLICIT_DEPENDS <lang1> depend1 ...]\n"
+ " [IMPLICIT_DEPENDS <lang1> depend1\n"
+ " [<lang2> depend2] ...]\n"
" [WORKING_DIRECTORY dir]\n"
" [COMMENT comment] [VERBATIM] [APPEND])\n"
"This defines a command to generate specified OUTPUT file(s). "
@@ -142,6 +143,8 @@ public:
"dependencies of an input file. The language given specifies the "
"programming language whose corresponding dependency scanner should "
"be used. Currently only C and CXX language scanners are supported. "
+ "The language has to be specified for every file in the "
+ "IMPLICIT_DEPENDS list. "
"Dependencies discovered from the scanning are added to those of "
"the custom command at build time. Note that the IMPLICIT_DEPENDS "
"option is currently supported only for Makefile generators and "
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index a6d04b7..bb6f3f2 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -327,6 +327,7 @@ cmCTest::cmCTest()
this->OutputLogFileLastTag = -1;
this->SuppressUpdatingCTestConfiguration = false;
this->DartVersion = 1;
+ this->DropSiteCDash = false;
this->OutputTestOutputOnTestFailure = false;
this->ComputedCompressTestOutput = false;
this->ComputedCompressMemCheckOutput = false;
@@ -653,6 +654,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
= this->GetCTestConfiguration("SourceDirectory").c_str();
std::string bld_dir = this->GetCTestConfiguration("BuildDirectory").c_str();
this->DartVersion = 1;
+ this->DropSiteCDash = false;
for(Part p = PartStart; p != PartCount; p = Part(p+1))
{
this->Parts[p].SubmitFiles.clear();
@@ -719,6 +721,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
return false;
}
}
+ this->DropSiteCDash = mf->IsOn("CTEST_DROP_SITE_CDASH");
if ( !this->Initialize(bld_dir.c_str(), command) )
{
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index f2638fe..587a6db 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -384,6 +384,7 @@ public:
//! Get the version of dart server
int GetDartVersion() { return this->DartVersion; }
+ int GetDropSiteCDash() { return this->DropSiteCDash; }
//! Add file to be submitted
void AddSubmitFile(Part part, const char* name);
@@ -561,6 +562,7 @@ private:
bool Quiet;
int DartVersion;
+ bool DropSiteCDash;
std::vector<cmStdString> InitialCommandLineArguments;
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index 347174a..0393ecf 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -68,6 +68,9 @@ public:
"If <output> names an existing directory the input file is placed "
"in that directory with its original name. "
"\n"
+ "If the <input> file is modified the build system will re-run CMake "
+ "to re-configure the file and generate the build system again."
+ "\n"
"This command replaces any variables in the input file referenced as "
"${VAR} or @VAR@ with their values as determined by CMake. If a "
"variable is not defined, it will be replaced with nothing. "
@@ -76,13 +79,18 @@ public:
"will be C-style escaped. "
"The file will be configured with the current values of CMake "
"variables. If @ONLY is specified, only variables "
- "of the form @VAR@ will be replaces and ${VAR} will be ignored. "
- "This is useful for configuring scripts that use ${VAR}. "
- "Any occurrences of #cmakedefine VAR will be replaced with "
- "either #define VAR or /* #undef VAR */ depending on "
- "the setting of VAR in CMake. Any occurrences of #cmakedefine01 VAR "
- "will be replaced with either #define VAR 1 or #define VAR 0 "
- "depending on whether VAR evaluates to TRUE or FALSE in CMake.\n"
+ "of the form @VAR@ will be replaced and ${VAR} will be ignored. "
+ "This is useful for configuring scripts that use ${VAR}."
+ "\n"
+ "Input file lines of the form \"#cmakedefine VAR ...\" "
+ "will be replaced with either \"#define VAR ...\" or "
+ "\"/* #undef VAR */\" depending on whether VAR is set in CMake to "
+ "any value not considered a false constant by the if() command. "
+ "(Content of \"...\", if any, is processed as above.) "
+ "Input file lines of the form \"#cmakedefine01 VAR\" "
+ "will be replaced with either \"#define VAR 1\" or "
+ "\"#define VAR 0\" similarly."
+ "\n"
"With NEWLINE_STYLE the line ending could be adjusted: \n"
" 'UNIX' or 'LF' for \\n, 'DOS', 'WIN32' or 'CRLF' for \\r\\n.\n"
"COPYONLY must not be used with NEWLINE_STYLE.\n";
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 166a584..74a0ccb 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -50,6 +50,7 @@ bool cmDepends::Write(std::ostream &makeDepends,
std::vector<std::string> pairs;
cmSystemTools::ExpandListArgument(srcStr, pairs);
+ std::map<std::string, std::set<std::string> > dependencies;
for(std::vector<std::string>::iterator si = pairs.begin();
si != pairs.end();)
{
@@ -62,9 +63,14 @@ bool cmDepends::Write(std::ostream &makeDepends,
obj = this->LocalGenerator->Convert(obj.c_str(),
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE);
+ dependencies[obj].insert(src);
+ }
+ for(std::map<std::string, std::set<std::string> >::const_iterator
+ it = dependencies.begin(); it != dependencies.end(); ++it)
+ {
// Write the dependencies for this pair.
- if(!this->WriteDependencies(src.c_str(), obj.c_str(),
+ if(!this->WriteDependencies(it->second, it->first,
makeDepends, internalDepends))
{
return false;
@@ -134,8 +140,9 @@ void cmDepends::Clear(const char *file)
}
//----------------------------------------------------------------------------
-bool cmDepends::WriteDependencies(const char*, const char*,
- std::ostream&, std::ostream&)
+bool cmDepends::WriteDependencies(
+ const std::set<std::string>&, const std::string&,
+ std::ostream&, std::ostream&)
{
// This should be implemented by the subclass.
return false;
@@ -174,8 +181,10 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
// kdelibs/khtml this reduces the number of calls from 184k down to 92k,
// or the time for cmake -E cmake_depends from 0.3 s down to 0.21 s.
dependerExists = cmSystemTools::FileExists(this->Depender);
- DependencyVector tmp;
- validDeps[this->Depender] = tmp;
+ // If we erase validDeps[this->Depender] by overwriting it with an empty
+ // vector, we lose dependencies for dependers that have multiple
+ // entries. No need to initialize the entry, std::map will do so on first
+ // access.
currentDependencies = &validDeps[this->Depender];
continue;
}
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index f7dc881..d787edd 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -76,8 +76,10 @@ protected:
// Write dependencies for the target file to the given stream.
// Return true for success and false for failure.
- virtual bool WriteDependencies(const char *src, const char* obj,
- std::ostream& makeDepends, std::ostream& internalDepends);
+ virtual bool WriteDependencies(const std::set<std::string>& sources,
+ const std::string& obj,
+ std::ostream& makeDepends,
+ std::ostream& internalDepends);
// Check dependencies for the target file in the given stream.
// Return false if dependencies must be regenerated and true
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 44841a9..43b7b8a 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -98,176 +98,179 @@ cmDependsC::~cmDependsC()
}
//----------------------------------------------------------------------------
-bool cmDependsC::WriteDependencies(const char *src, const char *obj,
- std::ostream& makeDepends, std::ostream& internalDepends)
+bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
+ const std::string& obj,
+ std::ostream& makeDepends,
+ std::ostream& internalDepends)
{
// Make sure this is a scanning instance.
- if(!src || src[0] == '\0')
+ if(sources.empty() || sources.begin()->empty())
{
cmSystemTools::Error("Cannot scan dependencies without a source file.");
return false;
}
- if(!obj || obj[0] == '\0')
+ if(obj.empty())
{
cmSystemTools::Error("Cannot scan dependencies without an object file.");
return false;
}
+ std::set<cmStdString> dependencies;
+ bool haveDeps = false;
+
if (this->ValidDeps != 0)
{
std::map<std::string, DependencyVector>::const_iterator tmpIt =
this->ValidDeps->find(obj);
if (tmpIt!= this->ValidDeps->end())
{
- // Write the dependencies to the output stream. Makefile rules
- // written by the original local generator for this directory
- // convert the dependencies to paths relative to the home output
- // directory. We must do the same here.
- internalDepends << obj << std::endl;
for(DependencyVector::const_iterator i=tmpIt->second.begin();
i != tmpIt->second.end(); ++i)
{
- makeDepends << obj << ": " <<
- this->LocalGenerator->Convert(i->c_str(),
- cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKEFILE)
- << std::endl;
- internalDepends << " " << i->c_str() << std::endl;
+ dependencies.insert(*i);
}
- makeDepends << std::endl;
- return true;
+ haveDeps = true;
}
}
- // Walk the dependency graph starting with the source file.
- bool first = true;
- UnscannedEntry root;
- root.FileName = src;
- this->Unscanned.push(root);
- this->Encountered.clear();
- this->Encountered.insert(src);
- std::set<cmStdString> dependencies;
- std::set<cmStdString> scanned;
+ if (!haveDeps)
+ {
+ // Walk the dependency graph starting with the source file.
+ int srcFiles = (int)sources.size();
+ this->Encountered.clear();
+
+ for(std::set<std::string>::const_iterator srcIt = sources.begin();
+ srcIt != sources.end(); ++srcIt)
+ {
+ UnscannedEntry root;
+ root.FileName = *srcIt;
+ this->Unscanned.push(root);
+ this->Encountered.insert(*srcIt);
+ }
- // Use reserve to allocate enough memory for tempPathStr
- // so that during the loops no memory is allocated or freed
- std::string tempPathStr;
- tempPathStr.reserve(4*1024);
+ std::set<cmStdString> scanned;
- while(!this->Unscanned.empty())
- {
- // Get the next file to scan.
- UnscannedEntry current = this->Unscanned.front();
- this->Unscanned.pop();
+ // Use reserve to allocate enough memory for tempPathStr
+ // so that during the loops no memory is allocated or freed
+ std::string tempPathStr;
+ tempPathStr.reserve(4*1024);
- // If not a full path, find the file in the include path.
- std::string fullName;
- if(first || cmSystemTools::FileIsFullPath(current.FileName.c_str()))
+ while(!this->Unscanned.empty())
{
- if(cmSystemTools::FileExists(current.FileName.c_str(), true))
+ // Get the next file to scan.
+ UnscannedEntry current = this->Unscanned.front();
+ this->Unscanned.pop();
+
+ // If not a full path, find the file in the include path.
+ std::string fullName;
+ if((srcFiles>0)
+ || cmSystemTools::FileIsFullPath(current.FileName.c_str()))
{
- fullName = current.FileName;
+ if(cmSystemTools::FileExists(current.FileName.c_str(), true))
+ {
+ fullName = current.FileName;
+ }
}
- }
- else if(!current.QuotedLocation.empty() &&
- cmSystemTools::FileExists(current.QuotedLocation.c_str(), true))
- {
- // The include statement producing this entry was a double-quote
- // include and the included file is present in the directory of
- // the source containing the include statement.
- fullName = current.QuotedLocation;
- }
- else
- {
- std::map<cmStdString, cmStdString>::iterator
- headerLocationIt=this->HeaderLocationCache.find(current.FileName);
- if (headerLocationIt!=this->HeaderLocationCache.end())
+ else if(!current.QuotedLocation.empty() &&
+ cmSystemTools::FileExists(current.QuotedLocation.c_str(), true))
{
- fullName=headerLocationIt->second;
+ // The include statement producing this entry was a double-quote
+ // include and the included file is present in the directory of
+ // the source containing the include statement.
+ fullName = current.QuotedLocation;
}
- else for(std::vector<std::string>::const_iterator i =
- this->IncludePath.begin(); i != this->IncludePath.end(); ++i)
+ else
{
- // Construct the name of the file as if it were in the current
- // include directory. Avoid using a leading "./".
-
- tempPathStr = "";
- if((*i) == ".")
+ std::map<cmStdString, cmStdString>::iterator
+ headerLocationIt=this->HeaderLocationCache.find(current.FileName);
+ if (headerLocationIt!=this->HeaderLocationCache.end())
{
- tempPathStr += current.FileName;
+ fullName=headerLocationIt->second;
}
- else
+ else for(std::vector<std::string>::const_iterator i =
+ this->IncludePath.begin(); i != this->IncludePath.end(); ++i)
{
- tempPathStr += *i;
- tempPathStr+="/";
- tempPathStr+=current.FileName;
- }
+ // Construct the name of the file as if it were in the current
+ // include directory. Avoid using a leading "./".
- // Look for the file in this location.
- if(cmSystemTools::FileExists(tempPathStr.c_str(), true))
- {
- fullName = tempPathStr;
- HeaderLocationCache[current.FileName]=fullName;
- break;
+ tempPathStr = "";
+ if((*i) == ".")
+ {
+ tempPathStr += current.FileName;
+ }
+ else
+ {
+ tempPathStr += *i;
+ tempPathStr+="/";
+ tempPathStr+=current.FileName;
+ }
+
+ // Look for the file in this location.
+ if(cmSystemTools::FileExists(tempPathStr.c_str(), true))
+ {
+ fullName = tempPathStr;
+ HeaderLocationCache[current.FileName]=fullName;
+ break;
+ }
}
}
- }
-
- // Complain if the file cannot be found and matches the complain
- // regex.
- if(fullName.empty() &&
- this->IncludeRegexComplain.find(current.FileName.c_str()))
- {
- cmSystemTools::Error("Cannot find file \"",
- current.FileName.c_str(), "\".");
- return false;
- }
- // Scan the file if it was found and has not been scanned already.
- if(!fullName.empty() && (scanned.find(fullName) == scanned.end()))
- {
- // Record scanned files.
- scanned.insert(fullName);
+ // Complain if the file cannot be found and matches the complain
+ // regex.
+ if(fullName.empty() &&
+ this->IncludeRegexComplain.find(current.FileName.c_str()))
+ {
+ cmSystemTools::Error("Cannot find file \"",
+ current.FileName.c_str(), "\".");
+ return false;
+ }
- // Check whether this file is already in the cache
- std::map<cmStdString, cmIncludeLines*>::iterator fileIt=
- this->FileCache.find(fullName);
- if (fileIt!=this->FileCache.end())
+ // Scan the file if it was found and has not been scanned already.
+ if(!fullName.empty() && (scanned.find(fullName) == scanned.end()))
{
- fileIt->second->Used=true;
- dependencies.insert(fullName);
- for (std::vector<UnscannedEntry>::const_iterator incIt=
- fileIt->second->UnscannedEntries.begin();
- incIt!=fileIt->second->UnscannedEntries.end(); ++incIt)
+ // Record scanned files.
+ scanned.insert(fullName);
+
+ // Check whether this file is already in the cache
+ std::map<cmStdString, cmIncludeLines*>::iterator fileIt=
+ this->FileCache.find(fullName);
+ if (fileIt!=this->FileCache.end())
{
- if (this->Encountered.find(incIt->FileName) ==
- this->Encountered.end())
+ fileIt->second->Used=true;
+ dependencies.insert(fullName);
+ for (std::vector<UnscannedEntry>::const_iterator incIt=
+ fileIt->second->UnscannedEntries.begin();
+ incIt!=fileIt->second->UnscannedEntries.end(); ++incIt)
{
- this->Encountered.insert(incIt->FileName);
- this->Unscanned.push(*incIt);
+ if (this->Encountered.find(incIt->FileName) ==
+ this->Encountered.end())
+ {
+ this->Encountered.insert(incIt->FileName);
+ this->Unscanned.push(*incIt);
+ }
}
}
- }
- else
- {
-
- // Try to scan the file. Just leave it out if we cannot find
- // it.
- std::ifstream fin(fullName.c_str());
- if(fin)
+ else
{
- // Add this file as a dependency.
- dependencies.insert(fullName);
- // Scan this file for new dependencies. Pass the directory
- // containing the file to handle double-quote includes.
- std::string dir = cmSystemTools::GetFilenamePath(fullName);
- this->Scan(fin, dir.c_str(), fullName);
+ // Try to scan the file. Just leave it out if we cannot find
+ // it.
+ std::ifstream fin(fullName.c_str());
+ if(fin)
+ {
+ // Add this file as a dependency.
+ dependencies.insert(fullName);
+
+ // Scan this file for new dependencies. Pass the directory
+ // containing the file to handle double-quote includes.
+ std::string dir = cmSystemTools::GetFilenamePath(fullName);
+ this->Scan(fin, dir.c_str(), fullName);
+ }
}
}
- }
- first = false;
+ srcFiles--;
+ }
}
// Write the dependencies to the output stream. Makefile rules
@@ -275,7 +278,7 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj,
// convert the dependencies to paths relative to the home output
// directory. We must do the same here.
internalDepends << obj << std::endl;
- for(std::set<cmStdString>::iterator i=dependencies.begin();
+ for(std::set<cmStdString>::const_iterator i=dependencies.begin();
i != dependencies.end(); ++i)
{
makeDepends << obj << ": " <<
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index bd9a4b7..16dfad7 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -32,11 +32,9 @@ public:
virtual ~cmDependsC();
protected:
- typedef std::vector<char> t_CharBuffer;
-
// Implement writing/checking methods required by superclass.
- virtual bool WriteDependencies(const char *src,
- const char *file,
+ virtual bool WriteDependencies(const std::set<std::string>& sources,
+ const std::string& obj,
std::ostream& makeDepends,
std::ostream& internalDepends);
@@ -82,7 +80,6 @@ protected:
const std::map<std::string, DependencyVector>* ValidDeps;
std::set<cmStdString> Encountered;
std::queue<UnscannedEntry> Unscanned;
- t_CharBuffer Buffer;
std::map<cmStdString, cmIncludeLines *> FileCache;
std::map<cmStdString, cmStdString> HeaderLocationCache;
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 3e66058..e41e5ea 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -170,44 +170,50 @@ cmDependsFortran::~cmDependsFortran()
}
//----------------------------------------------------------------------------
-bool cmDependsFortran::WriteDependencies(const char *src, const char *obj,
- std::ostream&, std::ostream&)
+bool cmDependsFortran::WriteDependencies(
+ const std::set<std::string>& sources, const std::string& obj,
+ std::ostream&, std::ostream&)
{
// Make sure this is a scanning instance.
- if(!src || src[0] == '\0')
+ if(sources.empty() || sources.begin()->empty())
{
- cmSystemTools::Error("Cannot scan dependencies without an source file.");
+ cmSystemTools::Error("Cannot scan dependencies without a source file.");
return false;
}
- if(!obj || obj[0] == '\0')
+ if(obj.empty())
{
cmSystemTools::Error("Cannot scan dependencies without an object file.");
return false;
}
- // Get the information object for this source.
- cmDependsFortranSourceInfo& info =
- this->Internal->CreateObjectInfo(obj, src);
+ bool okay = true;
+ for(std::set<std::string>::const_iterator it = sources.begin();
+ it != sources.end(); ++it)
+ {
+ const std::string& src = *it;
+ // Get the information object for this source.
+ cmDependsFortranSourceInfo& info =
+ this->Internal->CreateObjectInfo(obj.c_str(), src.c_str());
- // Make a copy of the macros defined via ADD_DEFINITIONS
- std::set<std::string> ppDefines(this->PPDefinitions.begin(),
- this->PPDefinitions.end());
+ // Make a copy of the macros defined via ADD_DEFINITIONS
+ std::set<std::string> ppDefines(this->PPDefinitions.begin(),
+ this->PPDefinitions.end());
- // Create the parser object. The constructor takes ppMacro and info per
- // reference, so we may look into the resulting objects later.
- cmDependsFortranParser parser(this, ppDefines, info);
+ // Create the parser object. The constructor takes ppMacro and info per
+ // reference, so we may look into the resulting objects later.
+ cmDependsFortranParser parser(this, ppDefines, info);
- // Push on the starting file.
- cmDependsFortranParser_FilePush(&parser, src);
+ // Push on the starting file.
+ cmDependsFortranParser_FilePush(&parser, src.c_str());
- // Parse the translation unit.
- if(cmDependsFortran_yyparse(parser.Scanner) != 0)
- {
- // Failed to parse the file. Report failure to write dependencies.
- return false;
+ // Parse the translation unit.
+ if(cmDependsFortran_yyparse(parser.Scanner) != 0)
+ {
+ // Failed to parse the file. Report failure to write dependencies.
+ okay = false;
+ }
}
-
- return true;
+ return okay;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index cdfde6e..cb40796 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -66,7 +66,7 @@ protected:
// Implement writing/checking methods required by superclass.
virtual bool WriteDependencies(
- const char *src, const char *file,
+ const std::set<std::string>& sources, const std::string& file,
std::ostream& makeDepends, std::ostream& internalDepends);
// Actually write the depenencies to the streams.
diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx
index ba0e8fb..949d465 100644
--- a/Source/cmDependsJava.cxx
+++ b/Source/cmDependsJava.cxx
@@ -25,11 +25,11 @@ cmDependsJava::~cmDependsJava()
}
//----------------------------------------------------------------------------
-bool cmDependsJava::WriteDependencies(const char *src, const char *,
- std::ostream&, std::ostream&)
+bool cmDependsJava::WriteDependencies(const std::set<std::string>& sources,
+ const std::string&, std::ostream&, std::ostream&)
{
// Make sure this is a scanning instance.
- if(!src || src[0] == '\0')
+ if(sources.empty() || sources.begin()->empty())
{
cmSystemTools::Error("Cannot scan dependencies without an source file.");
return false;
diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h
index bf7e234..22af53f 100644
--- a/Source/cmDependsJava.h
+++ b/Source/cmDependsJava.h
@@ -29,7 +29,8 @@ public:
protected:
// Implement writing/checking methods required by superclass.
- virtual bool WriteDependencies(const char *src, const char *file,
+ virtual bool WriteDependencies(
+ const std::set<std::string>& sources, const std::string& file,
std::ostream& makeDepends, std::ostream& internalDepends);
virtual bool CheckDependencies(std::istream& internalDepends,
const char* internalDependsFileName,
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index c1360ef..debde3b 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -155,7 +155,7 @@ static const char *cmDocumentationStandardSeeAlso[][3] =
static const char *cmDocumentationCopyright[][3] =
{
{0,
- "Copyright 2000-2009 Kitware, Inc., Insight Software Consortium. "
+ "Copyright 2000-2012 Kitware, Inc., Insight Software Consortium. "
"All rights reserved.", 0},
{0,
"Redistribution and use in source and binary forms, with or without "
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 96b8a09..97ab086 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -38,6 +38,7 @@ cmExtraEclipseCDT4Generator
this->SupportedGlobalGenerators.push_back("Unix Makefiles");
this->SupportsVirtualFolders = true;
+ this->GenerateLinkedResources = true;
}
//----------------------------------------------------------------------------
@@ -83,6 +84,9 @@ void cmExtraEclipseCDT4Generator::Generate()
this->HomeDirectory = mf->GetHomeDirectory();
this->HomeOutputDirectory = mf->GetHomeOutputDirectory();
+ this->GenerateLinkedResources = mf->IsOn(
+ "CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES");
+
this->IsOutOfSourceBuild = (this->HomeDirectory!=this->HomeOutputDirectory);
this->GenerateSourceProject = (this->IsOutOfSourceBuild &&
@@ -501,6 +505,10 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
linkName2 += ti->first;
this->AppendLinkedResource(fout, linkName2, "virtual:/virtual",
VirtualFolder);
+ if (!this->GenerateLinkedResources)
+ {
+ break; // skip generating the linked resources to the source files
+ }
std::vector<cmSourceGroup> sourceGroups=makefile->GetSourceGroups();
// get the files from the source lists then add them to the groups
cmTarget* tgt = const_cast<cmTarget*>(&ti->second);
@@ -555,6 +563,11 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
cmGeneratedFileStream& fout, const std::string& baseDir)
{
+ if (!this->GenerateLinkedResources)
+ {
+ return;
+ }
+
// for each sub project create a linked resource to the source dir
// - only if it is an out-of-source build
this->AppendLinkedResource(fout, "[Subprojects]",
@@ -579,7 +592,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
this->GetEclipsePath(linkSourceDirectory),
LinkToFolder
);
- this->SrcLinkedResources.push_back(it->first);
+ // Don't add it to the srcLinkedResources, because listing multiple
+ // directories confuses the Eclipse indexer (#13596).
}
}
}
@@ -730,15 +744,16 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
/* I don't know what the pathentry kind="src" are good for, e.g. autocompletion
* works also without them. Done wrong, the indexer complains, see #12417
* and #12213.
+ * According to #13596, this entry at least limits the directories the
+ * indexer is searching for files. So now the "src" entry contains only
+ * the linked resource to CMAKE_SOURCE_DIR.
* The CDT documentation is very terse on that:
* "CDT_SOURCE: Entry kind constant describing a path entry identifying a
* folder containing source code to be compiled."
* Also on the cdt-dev list didn't bring any information:
* http://web.archiveorange.com/archive/v/B4NlJDNIpYoOS1SbxFNy
- * So I'm disabling them for now, hoping that somebody will report if something
- * is not workging anymore.
* Alex */
-#ifdef DO_CREATE_SRC_PATH_ENTRIES
+
for (std::vector<std::string>::const_iterator
it = this->SrcLinkedResources.begin();
it != this->SrcLinkedResources.end();
@@ -755,7 +770,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
excludeFromOut += this->EscapeForXML(*it) + "/|";
}
}
-#endif
+
excludeFromOut += "**/CMakeFiles/";
fout << "<pathentry excluding=\"" << excludeFromOut
<< "\" kind=\"out\" path=\"\"/>\n";
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index 37ce65e..31ad68d 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -109,6 +109,7 @@ private:
std::string HomeOutputDirectory;
bool IsOutOfSourceBuild;
bool GenerateSourceProject;
+ bool GenerateLinkedResources;
bool SupportsVirtualFolders;
};
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 8de24b3..b877f3c 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -22,6 +22,7 @@
#endif
#undef GetCurrentDirectory
+#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -705,11 +706,8 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
bool recurse)
{
- if ( args.size() < 2 )
- {
- this->SetError("GLOB requires at least a variable name");
- return false;
- }
+ // File commands has at least one argument
+ assert(args.size() > 1);
std::vector<std::string>::const_iterator i = args.begin();
@@ -843,11 +841,8 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
bool cmFileCommand::HandleMakeDirectoryCommand(
std::vector<std::string> const& args)
{
- if(args.size() < 2 )
- {
- this->SetError("called with incorrect number of arguments");
- return false;
- }
+ // File command has at least one argument
+ assert(args.size() > 1);
std::vector<std::string>::const_iterator i = args.begin();
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index b4aa903..a0862ec 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -89,7 +89,8 @@ public:
" [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n"
"WRITE will write a message into a file called 'filename'. It "
"overwrites the file if it already exists, and creates the file "
- "if it does not exist.\n"
+ "if it does not exist. (If the file is a build input, use "
+ "configure_file to update the file only when its content changes.)\n"
"APPEND will write a message into a file same as WRITE, except "
"it will append it to the end of the file\n"
"READ will read the content of a file and store it into the "
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index a54bf7c..1de3982 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -15,6 +15,8 @@ cmFindBase::cmFindBase()
{
this->AlreadyInCache = false;
this->AlreadyInCacheWithoutMetaInfo = false;
+ this->NamesPerDir = false;
+ this->NamesPerDirAllowed = false;
}
//----------------------------------------------------------------------------
@@ -213,6 +215,19 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
compatibility = false;
newStyle = true;
}
+ else if (args[j] == "NAMES_PER_DIR")
+ {
+ doing = DoingNone;
+ if(this->NamesPerDirAllowed)
+ {
+ this->NamesPerDir = true;
+ }
+ else
+ {
+ this->SetError("does not support NAMES_PER_DIR");
+ return false;
+ }
+ }
else if (args[j] == "NO_SYSTEM_PATH")
{
doing = DoingNone;
diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h
index eac1885..84b0330 100644
--- a/Source/cmFindBase.h
+++ b/Source/cmFindBase.h
@@ -49,6 +49,8 @@ protected:
cmStdString VariableDocumentation;
cmStdString VariableName;
std::vector<std::string> Names;
+ bool NamesPerDir;
+ bool NamesPerDirAllowed;
// CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM
cmStdString EnvironmentPath; // LIB,INCLUDE
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 0080e55..4af7e11 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -17,6 +17,7 @@
cmFindLibraryCommand::cmFindLibraryCommand()
{
this->EnvironmentPath = "LIB";
+ this->NamesPerDirAllowed = true;
}
//----------------------------------------------------------------------------
@@ -44,6 +45,9 @@ void cmFindLibraryCommand::GenerateDocumentation()
"SEARCH_XXX", "library");
cmSystemTools::ReplaceString(this->GenericDocumentation,
"XXX_SUBDIR", "lib");
+ cmSystemTools::ReplaceString(this->GenericDocumentation,
+ "NAMES name1 [name2 ...]",
+ "NAMES name1 [name2 ...] [NAMES_PER_DIR]");
cmSystemTools::ReplaceString(
this->GenericDocumentation,
"XXX_EXTRA_PREFIX_ENTRY",
@@ -53,6 +57,12 @@ void cmFindLibraryCommand::GenerateDocumentation()
"CMAKE_FIND_ROOT_PATH_MODE_LIBRARY");
this->GenericDocumentation +=
"\n"
+ "When more than one value is given to the NAMES option this command "
+ "by default will consider one name at a time and search every directory "
+ "for it. "
+ "The NAMES_PER_DIR option tells this command to consider one directory "
+ "at a time and search for all names in it."
+ "\n"
"If the library found is a framework, then VAR will be set to "
"the full path to the framework <fullPath>/A.framework. "
"When a full path to a framework is used as a library, "
@@ -220,18 +230,19 @@ struct cmFindLibraryHelper
// Keep track of the best library file found so far.
typedef std::vector<std::string>::size_type size_type;
std::string BestPath;
- size_type BestPrefix;
- size_type BestSuffix;
// Support for OpenBSD shared library naming: lib<name>.so.<major>.<minor>
bool OpenBSD;
- unsigned int BestMajor;
- unsigned int BestMinor;
- // Current name under consideration.
- cmsys::RegularExpression NameRegex;
- bool TryRawName;
- std::string RawName;
+ // Current names under consideration.
+ struct Name
+ {
+ bool TryRaw;
+ std::string Raw;
+ cmsys::RegularExpression Regex;
+ Name(): TryRaw(false) {}
+ };
+ std::vector<Name> Names;
// Current full path under consideration.
std::string TestPath;
@@ -249,8 +260,9 @@ struct cmFindLibraryHelper
suffix) - this->Suffixes.begin();
}
bool HasValidSuffix(std::string const& name);
- void SetName(std::string const& name);
+ void AddName(std::string const& name);
bool CheckDirectory(std::string const& path);
+ bool CheckDirectoryForName(std::string const& path, Name& name);
};
//----------------------------------------------------------------------------
@@ -273,14 +285,6 @@ cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf):
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;
}
//----------------------------------------------------------------------------
@@ -353,11 +357,13 @@ bool cmFindLibraryHelper::HasValidSuffix(std::string const& name)
}
//----------------------------------------------------------------------------
-void cmFindLibraryHelper::SetName(std::string const& name)
+void cmFindLibraryHelper::AddName(std::string const& name)
{
+ Name entry;
+
// Consider checking the raw name too.
- this->TryRawName = this->HasValidSuffix(name);
- this->RawName = name;
+ entry.TryRaw = this->HasValidSuffix(name);
+ entry.Raw = name;
// Build a regular expression to match library names.
std::string regex = "^";
@@ -369,21 +375,37 @@ void cmFindLibraryHelper::SetName(std::string const& name)
regex += "(\\.[0-9]+\\.[0-9]+)?";
}
regex += "$";
- this->NameRegex.compile(regex.c_str());
+ entry.Regex.compile(regex.c_str());
+ this->Names.push_back(entry);
}
//----------------------------------------------------------------------------
bool cmFindLibraryHelper::CheckDirectory(std::string const& path)
{
+ for(std::vector<Name>::iterator i = this->Names.begin();
+ i != this->Names.end(); ++i)
+ {
+ if(this->CheckDirectoryForName(path, *i))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
+bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
+ Name& name)
+{
// 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)
+ if(name.TryRaw)
{
this->TestPath = path;
- this->TestPath += this->RawName;
+ this->TestPath += name.Raw;
if(cmSystemTools::FileExists(this->TestPath.c_str(), true))
{
this->BestPath =
@@ -393,6 +415,12 @@ bool cmFindLibraryHelper::CheckDirectory(std::string const& path)
}
}
+ // No library file has yet been found.
+ size_type bestPrefix = this->Prefixes.size();
+ size_type bestSuffix = this->Suffixes.size();
+ unsigned int bestMajor = 0;
+ unsigned int bestMinor = 0;
+
// Search for a file matching the library name regex.
std::string dir = path;
cmSystemTools::ConvertToUnixSlashes(dir);
@@ -406,7 +434,7 @@ bool cmFindLibraryHelper::CheckDirectory(std::string const& path)
#else
std::string const& testName = origName;
#endif
- if(this->NameRegex.find(testName))
+ if(name.Regex.find(testName))
{
this->TestPath = path;
this->TestPath += origName;
@@ -416,25 +444,25 @@ bool cmFindLibraryHelper::CheckDirectory(std::string const& path)
// 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));
+ size_type prefix = this->GetPrefixIndex(name.Regex.match(1));
+ size_type suffix = this->GetSuffixIndex(name.Regex.match(2));
unsigned int major = 0;
unsigned int minor = 0;
if(this->OpenBSD)
{
- sscanf(this->NameRegex.match(3).c_str(), ".%u.%u", &major, &minor);
+ sscanf(name.Regex.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))))
+ if(this->BestPath.empty() || prefix < bestPrefix ||
+ (prefix == bestPrefix && suffix < bestSuffix) ||
+ (prefix == bestPrefix && suffix == bestSuffix &&
+ (major > bestMajor ||
+ (major == bestMajor && minor > bestMinor))))
{
this->BestPath = this->TestPath;
- this->BestPrefix = prefix;
- this->BestSuffix = suffix;
- this->BestMajor = major;
- this->BestMinor = minor;
+ bestPrefix = prefix;
+ bestSuffix = suffix;
+ bestMajor = major;
+ bestMinor = minor;
}
}
}
@@ -447,6 +475,42 @@ bool cmFindLibraryHelper::CheckDirectory(std::string const& path)
//----------------------------------------------------------------------------
std::string cmFindLibraryCommand::FindNormalLibrary()
{
+ if(this->NamesPerDir)
+ {
+ return this->FindNormalLibraryNamesPerDir();
+ }
+ else
+ {
+ return this->FindNormalLibraryDirsPerName();
+ }
+}
+
+//----------------------------------------------------------------------------
+std::string cmFindLibraryCommand::FindNormalLibraryNamesPerDir()
+{
+ // Search for all names in each directory.
+ cmFindLibraryHelper helper(this->Makefile);
+ for(std::vector<std::string>::const_iterator ni = this->Names.begin();
+ ni != this->Names.end() ; ++ni)
+ {
+ helper.AddName(*ni);
+ }
+ // Search every directory.
+ for(std::vector<std::string>::const_iterator
+ p = this->SearchPaths.begin(); p != this->SearchPaths.end(); ++p)
+ {
+ if(helper.CheckDirectory(*p))
+ {
+ return helper.BestPath;
+ }
+ }
+ // Couldn't find the library.
+ return "";
+}
+
+//----------------------------------------------------------------------------
+std::string cmFindLibraryCommand::FindNormalLibraryDirsPerName()
+{
// Search the entire path for each name.
cmFindLibraryHelper helper(this->Makefile);
for(std::vector<std::string>::const_iterator ni = this->Names.begin();
@@ -454,7 +518,7 @@ std::string cmFindLibraryCommand::FindNormalLibrary()
{
// Switch to searching for this name.
std::string const& name = *ni;
- helper.SetName(name);
+ helper.AddName(name);
// Search every directory.
for(std::vector<std::string>::const_iterator
@@ -474,19 +538,60 @@ std::string cmFindLibraryCommand::FindNormalLibrary()
//----------------------------------------------------------------------------
std::string cmFindLibraryCommand::FindFrameworkLibrary()
{
- // Search for a framework of each name in the entire search path.
+ if(this->NamesPerDir)
+ {
+ return this->FindFrameworkLibraryNamesPerDir();
+ }
+ else
+ {
+ return this->FindFrameworkLibraryDirsPerName();
+ }
+}
+
+//----------------------------------------------------------------------------
+std::string cmFindLibraryCommand::FindFrameworkLibraryNamesPerDir()
+{
+ std::string fwPath;
+ // Search for all names in each search path.
+ for(std::vector<std::string>::const_iterator di = this->SearchPaths.begin();
+ di != this->SearchPaths.end(); ++di)
+ {
+ for(std::vector<std::string>::const_iterator ni = this->Names.begin();
+ ni != this->Names.end() ; ++ni)
+ {
+ fwPath = *di;
+ fwPath += *ni;
+ fwPath += ".framework";
+ if(cmSystemTools::FileIsDirectory(fwPath.c_str()))
+ {
+ return cmSystemTools::CollapseFullPath(fwPath.c_str());
+ }
+ }
+ }
+
+ // No framework found.
+ return "";
+}
+
+//----------------------------------------------------------------------------
+std::string cmFindLibraryCommand::FindFrameworkLibraryDirsPerName()
+{
+ std::string fwPath;
+ // Search for each name in all search paths.
for(std::vector<std::string>::const_iterator ni = this->Names.begin();
ni != this->Names.end() ; ++ni)
{
- // Search the paths for a framework with this name.
- std::string fwName = *ni;
- fwName += ".framework";
- std::string fwPath = cmSystemTools::FindDirectory(fwName.c_str(),
- this->SearchPaths,
- true);
- if(!fwPath.empty())
+ for(std::vector<std::string>::const_iterator
+ di = this->SearchPaths.begin();
+ di != this->SearchPaths.end(); ++di)
{
- return fwPath;
+ fwPath = *di;
+ fwPath += *ni;
+ fwPath += ".framework";
+ if(cmSystemTools::FileIsDirectory(fwPath.c_str()))
+ {
+ return cmSystemTools::CollapseFullPath(fwPath.c_str());
+ }
}
}
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index 455348a..cd0fce8 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -70,7 +70,11 @@ protected:
virtual void GenerateDocumentation();
private:
std::string FindNormalLibrary();
+ std::string FindNormalLibraryNamesPerDir();
+ std::string FindNormalLibraryDirsPerName();
std::string FindFrameworkLibrary();
+ std::string FindFrameworkLibraryNamesPerDir();
+ std::string FindFrameworkLibraryDirsPerName();
};
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index 730a7a7..0a029dc 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -90,7 +90,9 @@ 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 past the last expected argument."
+ "holds the list of arguments past the last expected argument."
+ "\n"
+ "A function opens a new scope: see set(var PARENT_SCOPE) for details."
"\n"
"See the cmake_policy() command documentation for the behavior of "
"policies inside functions."
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index ee1b60a..2e123a4 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -16,6 +16,8 @@
#include "cmGeneratorExpressionDAGChecker.h"
#include "cmGeneratorExpression.h"
+#include <cmsys/String.h>
+
//----------------------------------------------------------------------------
#if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x510
static
@@ -253,7 +255,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
return parameters.front().empty() ? "1" : "0";
}
- return *parameters.begin() == context->Config ? "1" : "0";
+ return cmsysString_strcasecmp(parameters.begin()->c_str(),
+ context->Config) == 0 ? "1" : "0";
}
} configurationTestNode;
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index e8ca788..0ec4850 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -200,7 +200,6 @@ void cmGlobalVisualStudio6Generator
tt != orderedProjectTargets.end(); ++tt)
{
cmTarget* target = *tt;
- cmMakefile* mf = target->GetMakefile();
// Write the project into the DSW file
const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
if(expath)
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index b6eea5d..15ef738 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -268,6 +268,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
cmLocalGenerator* root,
OrderedTargetDependSet const& projectTargets)
{
+ VisualStudioFolders.clear();
+
for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index bca1754..a6ed2a6 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -204,7 +204,6 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget()
// overwritten by the CreateVCProjBuildRule.
// (this could be avoided with per-target source files)
const char* no_main_dependency = 0;
- const char* no_working_directory = 0;
if(cmSourceFile* file =
mf->AddCustomCommandToOutput(
stamps, listFiles,
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 0968b77..ea6757d 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -75,7 +75,6 @@ void cmGlobalVisualStudioGenerator::Generate()
#endif
// Now make all targets depend on the ALL_BUILD target
- cmTargets targets;
for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
i != gen.end(); ++i)
{
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 30d8f18..5b2ddd8 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -495,8 +495,12 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
(this->CurrentReRunCMakeMakefile.c_str());
makefileStream.SetCopyIfDifferent(true);
makefileStream << "# Generated by CMake, DO NOT EDIT\n";
- makefileStream << cmake::GetCMakeFilesDirectoryPostSlash();
- makefileStream << "cmake.check_cache: ";
+ std::string checkCache = mf->GetHomeOutputDirectory();
+ checkCache += "/";
+ checkCache += cmake::GetCMakeFilesDirectoryPostSlash();
+ checkCache += "cmake.check_cache";
+ makefileStream << this->ConvertToRelativeForMake(checkCache.c_str())
+ << ": ";
for(std::vector<std::string>::const_iterator i = lfiles.begin();
i != lfiles.end(); ++i)
{
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index d9c0e87..76a60cf 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -177,3 +177,14 @@ void cmIDEOptions::RemoveFlag(const char* flag)
{
this->FlagMap.erase(flag);
}
+
+//----------------------------------------------------------------------------
+const char* cmIDEOptions::GetFlag(const char* flag)
+{
+ std::map<cmStdString, cmStdString>::iterator i = this->FlagMap.find(flag);
+ if(i != this->FlagMap.end())
+ {
+ return i->second.c_str();
+ }
+ return 0;
+}
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index a5be8fb..e556bde 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -29,6 +29,7 @@ public:
void AddDefines(const char* defines);
void AddFlag(const char* flag, const char* value);
void RemoveFlag(const char* flag);
+ const char* GetFlag(const char* flag);
protected:
// create a map of xml tags to the values they should have in the output
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index 6751fc0..dd37b82 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -72,9 +72,12 @@ public:
"CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. "
"By using AFTER or BEFORE explicitly, you can select between "
"appending and prepending, independent of the default. "
+ "\n"
"If the SYSTEM option is given, the compiler will be told the "
"directories are meant as system include directories on some "
- "platforms.";
+ "platforms (signalling this setting might achieve effects such as "
+ "the compiler skipping warnings, or these fixed-install system files "
+ "not being considered in dependency calculations - see compiler docs).";
}
cmTypeMacro(cmIncludeDirectoryCommand, cmCommand);
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 7848424..df64695 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -15,13 +15,14 @@
#include <stdlib.h> // required for atoi
#include <ctype.h>
+#include <assert.h>
//----------------------------------------------------------------------------
bool cmListCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
- if(args.size() < 1)
+ if(args.size() < 2)
{
- this->SetError("must be called with at least one argument.");
+ this->SetError("must be called with at least two arguments.");
return false;
}
@@ -243,11 +244,7 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
//----------------------------------------------------------------------------
bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
{
- if(args.size() < 2)
- {
- this->SetError("sub-command APPEND requires at least one argument.");
- return false;
- }
+ assert(args.size() >= 2);
// Skip if nothing to append.
if(args.size() < 3)
@@ -424,12 +421,8 @@ bool cmListCommand
bool cmListCommand
::HandleReverseCommand(std::vector<std::string> const& args)
{
- if(args.size() < 2)
- {
- this->SetError("sub-command REVERSE requires a list as an argument.");
- return false;
- }
- else if(args.size() > 2)
+ assert(args.size() >= 2);
+ if(args.size() > 2)
{
this->SetError(
"sub-command REVERSE only takes one argument.");
@@ -463,13 +456,8 @@ bool cmListCommand
bool cmListCommand
::HandleRemoveDuplicatesCommand(std::vector<std::string> const& args)
{
- if(args.size() < 2)
- {
- this->SetError(
- "sub-command REMOVE_DUPLICATES requires a list as an argument.");
- return false;
- }
- else if(args.size() > 2)
+ assert(args.size() >= 2);
+ if(args.size() > 2)
{
this->SetError(
"sub-command REMOVE_DUPLICATES only takes one argument.");
@@ -513,12 +501,8 @@ bool cmListCommand
bool cmListCommand
::HandleSortCommand(std::vector<std::string> const& args)
{
- if(args.size() < 2)
- {
- this->SetError("sub-command SORT requires a list as an argument.");
- return false;
- }
- else if(args.size() > 2)
+ assert(args.size() >= 2);
+ if(args.size() > 2)
{
this->SetError(
"sub-command SORT only takes one argument.");
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index b2acf06..181b922 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -224,6 +224,10 @@ cmLoadedCommand::~cmLoadedCommand()
bool cmLoadCommandCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
+ this->Makefile->IssueMessage(
+ cmake::AUTHOR_WARNING,
+ "The \"load_command\" command will be removed in CMake 3.0. "
+ "See command documentation for details.");
if(args.size() < 1 )
{
return true;
diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h
index f0b34ee..bcd1831 100644
--- a/Source/cmLoadCommandCommand.h
+++ b/Source/cmLoadCommandCommand.h
@@ -47,7 +47,7 @@ public:
*/
virtual const char* GetTerseDocumentation() const
{
- return "Load a command into a running CMake.";
+ return "Deprecated. Use macro() or function() instead.";
}
/**
@@ -56,6 +56,13 @@ public:
virtual const char* GetFullDocumentation() const
{
return
+ "This command will be removed in CMake 3.0. "
+ "It works only when the target architecture matches the "
+ "running CMake binary. "
+ "Use macro() or function() to add commands. "
+ "Use execute_process() to run advanced computations "
+ "in external processes."
+ "\n"
" load_command(COMMAND_NAME <loc1> [loc2 ...])\n"
"The given locations are searched for a library whose name is "
"cmCOMMAND_NAME. If found, it is loaded as a module and the command "
@@ -67,6 +74,12 @@ public:
"Otherwise the variable will not be set.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged() const
+ {
+ return true;
+ }
+
cmTypeMacro(cmLoadCommandCommand, cmCommand);
};
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index db93529..820d25a 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1939,8 +1939,12 @@ void cmLocalUnixMakefileGenerator3
for(ImplicitDependFileMap::const_iterator pi = implicitPairs.begin();
pi != implicitPairs.end(); ++pi)
{
- cmakefileStream << " \"" << pi->second << "\" ";
- cmakefileStream << "\"" << pi->first << "\"\n";
+ for(cmDepends::DependencyVector::const_iterator di = pi->second.begin();
+ di != pi->second.end(); ++ di)
+ {
+ cmakefileStream << " \"" << *di << "\" ";
+ cmakefileStream << "\"" << pi->first << "\"\n";
+ }
}
cmakefileStream << " )\n";
@@ -2204,7 +2208,7 @@ cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt,
const char* obj,
const char* src)
{
- this->ImplicitDepends[tgt.GetName()][lang][obj] = src;
+ this->ImplicitDepends[tgt.GetName()][lang][obj].push_back(src);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index e374959..703369e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -209,7 +209,8 @@ public:
// File pairs for implicit dependency scanning. The key of the map
// is the depender and the value is the explicit dependee.
- struct ImplicitDependFileMap: public std::map<cmStdString, cmStdString> {};
+ struct ImplicitDependFileMap:
+ public std::map<cmStdString, cmDepends::DependencyVector> {};
struct ImplicitDependLanguageMap:
public std::map<cmStdString, ImplicitDependFileMap> {};
struct ImplicitDependTargetMap:
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index f15322b..9497e31 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -326,18 +326,18 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
{
cmSystemTools::ReplaceString(source, "$(IntDir)/", "");
#if defined(_WIN32) || defined(__CYGWIN__)
- std::ofstream fout(source.c_str(),
+ std::ofstream sourceFout(source.c_str(),
std::ios::binary | std::ios::out
| std::ios::trunc);
#else
- std::ofstream fout(source.c_str(),
+ std::ofstream sourceFout(source.c_str(),
std::ios::out | std::ios::trunc);
#endif
- if(fout)
+ if(sourceFout)
{
- fout.write("# generated from CMake",22);
- fout.flush();
- fout.close();
+ sourceFout.write("# generated from CMake",22);
+ sourceFout.flush();
+ sourceFout.close();
}
}
}
@@ -710,6 +710,8 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
switch(b)
{
+ case WIN32_EXECUTABLE:
+ break;
case STATIC_LIBRARY:
this->DSPHeaderTemplate = root;
this->DSPHeaderTemplate += "/staticLibHeader.dsptemplate";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index f9a2d32..d954a52 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -914,12 +914,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
// for FAT32 file systems, which can cause an empty manifest
// to be embedded into the resulting executable. See CMake
// bug #2617.
- const char* tool = "VCManifestTool";
+ const char* manifestTool = "VCManifestTool";
if(this->FortranProject)
{
- tool = "VFManifestTool";
+ manifestTool = "VFManifestTool";
}
- fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n"
+ fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << manifestTool << "\"\n"
<< "\t\t\t\tUseFAT32Workaround=\"true\"\n"
<< "\t\t\t/>\n";
}
@@ -1003,6 +1003,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
}
switch(target.GetType())
{
+ case cmTarget::UNKNOWN_LIBRARY:
+ break;
case cmTarget::OBJECT_LIBRARY:
{
std::string libpath = this->GetTargetDirectory(target);
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 4bcf4de..ef2bb1d 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -84,7 +84,6 @@ cmLocalVisualStudioGenerator
const char* newline_text)
{
bool useLocal = this->CustomCommandUseLocal();
- const cmCustomCommandLines& commandLines = cc.GetCommandLines();
const char* workingDirectory = cc.GetWorkingDirectory();
cmCustomCommandGenerator ccg(cc, configName, this->Makefile);
RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT;
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index f8c40c0..aedbb4d 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -92,12 +92,12 @@ public:
"facilitates creating macros with optional arguments. Additionally "
"${ARGV} holds the list of all arguments given to the macro and "
"${ARGN} "
- "holds the list of argument past the last expected argument. "
+ "holds the list of arguments past the last expected argument. "
"Note that the parameters to a macro and values such as ARGN "
"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."
+ "replacements much like the C preprocessor would do with a macro. "
+ "If you want true CMake variables and/or better CMake scope control "
+ "you should look at the function command."
"\n"
"See the cmake_policy() command documentation for the behavior of "
"policies inside macros."
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index 27c5b6a..dc0ceb3 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -58,11 +58,11 @@ public:
{
return
" math(EXPR <output variable> <math expression>)\n"
- "EXPR evaluates mathematical expression and return result in the "
+ "EXPR evaluates mathematical expression and returns result in the "
"output variable. Example mathematical expression is "
"'5 * ( 10 + 13 )'. Supported operators are "
"+ - * / % | & ^ ~ << >> * / %. They have the same meaning "
- " as they do in c code.";
+ " as they do in C code.";
}
cmTypeMacro(cmMathCommand, cmCommand);
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index 9f01eaf..fc61810 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -67,8 +67,9 @@ public:
" STATUS = Incidental information\n"
" WARNING = CMake Warning, continue processing\n"
" AUTHOR_WARNING = CMake Warning (dev), continue processing\n"
- " SEND_ERROR = CMake Error, continue but skip generation\n"
- " FATAL_ERROR = CMake Error, stop all processing\n"
+ " SEND_ERROR = CMake Error, continue processing,\n"
+ " but skip generation\n"
+ " FATAL_ERROR = CMake Error, stop processing and generation\n"
"The CMake command-line tool displays STATUS messages on stdout "
"and all other message types on stderr. "
"The CMake GUI displays all messages in its log area. "
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 6c54ced..853bc12 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -564,6 +564,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))-linkRuleLength-1000;
#else
+ (void)linkRuleLength;
commandLineLengthLimit = -1;
#endif
}
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 79af4d7..6aef502 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -457,7 +457,7 @@ cmPolicies::cmPolicies()
"This makes sure that the modules belonging to "
"CMake always get those files included which they expect, and against "
"which they were developed and tested. "
- "In call other cases, the files found in "
+ "In all other cases, the files found in "
"CMAKE_MODULE_PATH still take precedence over the ones in "
"the CMake module directory. "
"The OLD behaviour is to always prefer files from CMAKE_MODULE_PATH over "
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index cc3b6d6..1d4b0c8 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -458,7 +458,7 @@ void cmSourceFile::DefineProperties(cmake *cm)
"A property on a source file that indicates if the source file "
"is a header file with no associated implementation. This is "
"set automatically based on the file extension and is used by "
- "CMake to determine is certain dependency information should be "
+ "CMake to determine if certain dependency information should be "
"computed.");
cm->DefineProperty
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index 6c87b71..9f6b7e4 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -68,7 +68,7 @@ public:
"expression matches the file will be favored.\n"
"The name of the group may contain backslashes to specify subgroups:\n"
" source_group(outer\\\\inner ...)\n"
- "For backwards compatibility, this command is also supports the "
+ "For backwards compatibility, this command also supports the "
"format:\n"
" source_group(name regex)";
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 9cfcb63..a81fa3e 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2601,7 +2601,10 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config)
OutputInfo info;
this->ComputeOutputDir(config, false, info.OutDir);
this->ComputeOutputDir(config, true, info.ImpDir);
- this->ComputePDBOutputDir(config, info.PdbDir);
+ if(!this->ComputePDBOutputDir(config, info.PdbDir))
+ {
+ info.PdbDir = info.OutDir;
+ }
OutputInfoMapType::value_type entry(config_upper, info);
i = this->Internal->OutputInfoMap.insert(entry).first;
}
@@ -3957,7 +3960,7 @@ bool cmTarget::ComputeOutputDir(const char* config,
}
//----------------------------------------------------------------------------
-void cmTarget::ComputePDBOutputDir(const char* config, std::string& out)
+bool cmTarget::ComputePDBOutputDir(const char* config, std::string& out)
{
// Look for a target property defining the target output directory
// based on the target type.
@@ -3997,8 +4000,7 @@ void cmTarget::ComputePDBOutputDir(const char* config, std::string& out)
}
if(out.empty())
{
- // Default to the current output directory.
- out = ".";
+ return false;
}
// Convert the output path to a full path in case it is
@@ -4013,6 +4015,7 @@ void cmTarget::ComputePDBOutputDir(const char* config, std::string& out)
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
AppendDirectoryForConfig("/", config, "", out);
}
+ return true;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 558bfab..e442d25 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -577,7 +577,7 @@ private:
struct OutputInfo;
OutputInfo const* GetOutputInfo(const char* config);
bool ComputeOutputDir(const char* config, bool implib, std::string& out);
- void ComputePDBOutputDir(const char* config, std::string& out);
+ bool ComputePDBOutputDir(const char* config, std::string& out);
// Cache import information from properties for each configuration.
struct ImportInfo;
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index 63114d2..8e5823c 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -100,11 +100,11 @@ public:
"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 (or to the properties "
+ "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. "
+ "LINK_INTERFACE_LIBRARIES property. "
"Libraries specified as \"general\" (or without any keyword) are "
"treated as if specified for both \"debug\" and \"optimized\"."
"\n"
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index 7878729..13b9973 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -81,7 +81,7 @@ public:
"the executable, but it will not try to run the executable. Instead it "
"will create cache variables which must be filled by the user or by "
"presetting them in some CMake script file to the values the "
- "executable would have produced if it would have been run on its actual "
+ "executable would have produced if it had been run on its actual "
"target platform. These variables are RUN_RESULT_VAR (explanation see "
"above) and if RUN_OUTPUT_VARIABLE (or OUTPUT_VARIABLE) was used, an "
"additional cache variable "
diff --git a/Source/cmVS10LinkFlagTable.h b/Source/cmVS10LinkFlagTable.h
index c60e8eb..64febbb 100644
--- a/Source/cmVS10LinkFlagTable.h
+++ b/Source/cmVS10LinkFlagTable.h
@@ -182,8 +182,8 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] =
{"SupportUnloadOfDelayLoadedDLL", "DELAY:UNLOAD", "", "true", 0},
{"SupportNobindOfDelayLoadedDLL", "DELAY:NOBIND", "", "true", 0},
{"Profile", "PROFILE", "", "true", 0},
- {"DelaySign", "DELAYSIGN:NO", "", "false", 0},
- {"DelaySign", "DELAYSIGN", "", "true", 0},
+ {"LinkDelaySign", "DELAYSIGN:NO", "", "false", 0},
+ {"LinkDelaySign", "DELAYSIGN", "", "true", 0},
{"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK:NO", "", "false", 0},
{"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK", "", "true", 0},
{"ImageHasSafeExceptionHandlers", "SAFESEH:NO", "", "false", 0},
@@ -294,7 +294,7 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] =
{"MergeSections", "MERGE:",
"Merge Sections",
"", cmVS7FlagTable::UserValue},
- {"KeyFile", "KEYFILE:",
+ {"LinkKeyFile", "KEYFILE:",
"Key File",
"", cmVS7FlagTable::UserValue},
{"KeyContainer", "KEYCONTAINER:",
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 1e37ca5..d3b3950 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -109,6 +109,11 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
{
delete i->second;
}
+ for(OptionsMap::iterator i = this->LinkOptions.begin();
+ i != this->LinkOptions.end(); ++i)
+ {
+ delete i->second;
+ }
if(!this->BuildFileStream)
{
return;
@@ -181,6 +186,10 @@ void cmVisualStudio10TargetGenerator::Generate()
{
return;
}
+ if(!this->ComputeLinkOptions())
+ {
+ return;
+ }
}
cmMakefile* mf = this->Target->GetMakefile();
std::string path = mf->GetStartOutputDirectory();
@@ -395,6 +404,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
case cmTarget::UTILITY:
configType += "Utility";
break;
+ case cmTarget::GLOBAL_TARGET:
+ case cmTarget::UNKNOWN_LIBRARY:
+ break;
}
configType += "</ConfigurationType>\n";
this->WriteString(configType.c_str(), 2);
@@ -416,8 +428,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
mfcLine += useOfMfcValue + "</UseOfMfc>\n";
this->WriteString(mfcLine.c_str(), 2);
- if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
- this->ClOptions[*i]->UsingUnicode() ||
+ if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
+ this->ClOptions[*i]->UsingUnicode()) ||
this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
{
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
@@ -898,7 +910,6 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
cmSourceFile* source)
{
cmSourceFile& sf = *source;
- cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
std::string objectName;
if(this->GeneratorTarget->ExplicitObjectName.find(&sf)
@@ -1077,7 +1088,6 @@ void
cmVisualStudio10TargetGenerator::
OutputLinkIncremental(std::string const& configName)
{
- std::string CONFIG = cmSystemTools::UpperCase(configName);
// static libraries and things greater than modules do not need
// to set this option
if(this->Target->GetType() == cmTarget::STATIC_LIBRARY
@@ -1085,72 +1095,36 @@ OutputLinkIncremental(std::string const& configName)
{
return;
}
- const char* linkType = "SHARED";
- if(this->Target->GetType() == cmTarget::EXECUTABLE)
- {
- linkType = "EXE";
- }
+ Options& linkOptions = *(this->LinkOptions[configName]);
- // assume incremental linking
- const char* incremental = "true";
- const char* linkLanguage =
- this->Target->GetLinkerLanguage(configName.c_str());
- if(!linkLanguage)
- {
- cmSystemTools::Error
- ("CMake can not determine linker language for target:",
- this->Name.c_str());
- return;
- }
- std::string linkFlagVarBase = "CMAKE_";
- linkFlagVarBase += linkType;
- linkFlagVarBase += "_LINKER_FLAGS";
- std::string flags = this->
- Target->GetMakefile()->GetRequiredDefinition(linkFlagVarBase.c_str());
- std::string linkFlagVar = linkFlagVarBase + "_" + CONFIG;
- flags += this->
- Target->GetMakefile()->GetRequiredDefinition(linkFlagVar.c_str());
- if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0
- || strcmp(linkLanguage, "Fortran") == 0)
- {
- std::string baseFlagVar = "CMAKE_";
- baseFlagVar += linkLanguage;
- baseFlagVar += "_FLAGS";
- flags += this->
- Target->GetMakefile()->GetRequiredDefinition(baseFlagVar.c_str());
- std::string flagVar = baseFlagVar + std::string("_") + CONFIG;
- flags +=
- Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str());
- }
- const char* targetLinkFlags = this->Target->GetProperty("LINK_FLAGS");
- if(targetLinkFlags)
- {
- flags += " ";
- flags += targetLinkFlags;
- }
- std::string flagsProp = "LINK_FLAGS_";
- flagsProp += CONFIG;
- if(const char* flagsConfig = this->Target->GetProperty(flagsProp.c_str()))
- {
- flags += " ";
- flags += flagsConfig;
- }
- if(flags.find("INCREMENTAL:NO") != flags.npos)
- {
- incremental = "false";
- }
+ const char* incremental = linkOptions.GetFlag("LinkIncremental");
this->WritePlatformConfigTag("LinkIncremental", configName.c_str(), 3);
- *this->BuildFileStream << incremental
+ *this->BuildFileStream << (incremental?incremental:"true")
<< "</LinkIncremental>\n";
+ linkOptions.RemoveFlag("LinkIncremental");
- const char* manifest = "true";
- if(flags.find("MANIFEST:NO") != flags.npos)
- {
- manifest = "false";
- }
+ const char* manifest = linkOptions.GetFlag("GenerateManifest");
this->WritePlatformConfigTag("GenerateManifest", configName.c_str(), 3);
- *this->BuildFileStream << manifest
+ *this->BuildFileStream << (manifest?manifest:"true")
<< "</GenerateManifest>\n";
+ linkOptions.RemoveFlag("GenerateManifest");
+
+ // Some link options belong here. Use them now and remove them so that
+ // WriteLinkOptions does not use them.
+ const char* flags[] = {
+ "LinkDelaySign",
+ "LinkKeyFile",
+ 0};
+ for(const char** f = flags; *f; ++f)
+ {
+ const char* flag = *f;
+ if(const char* value = linkOptions.GetFlag(flag))
+ {
+ this->WritePlatformConfigTag(flag, configName.c_str(), 3);
+ *this->BuildFileStream << value << "</" << flag << ">\n";
+ linkOptions.RemoveFlag(flag);
+ }
+ }
}
//----------------------------------------------------------------------------
@@ -1343,18 +1317,36 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
}
}
+//----------------------------------------------------------------------------
+bool cmVisualStudio10TargetGenerator::ComputeLinkOptions()
+{
+ if(this->Target->GetType() == cmTarget::EXECUTABLE ||
+ this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
+ this->Target->GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ std::vector<std::string> const* configs =
+ this->GlobalGenerator->GetConfigurations();
+ for(std::vector<std::string>::const_iterator i = configs->begin();
+ i != configs->end(); ++i)
+ {
+ if(!this->ComputeLinkOptions(*i))
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+}
-void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
- config)
+//----------------------------------------------------------------------------
+bool
+cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
{
+ cmsys::auto_ptr<Options> pOptions(
+ new Options(this->LocalGenerator, Options::Linker,
+ cmVSGetLinkFlagTable(this->LocalGenerator), 0, this));
+ Options& linkOptions = *pOptions;
- // static libraries and things greater than modules do not need
- // to set this option
- if(this->Target->GetType() == cmTarget::STATIC_LIBRARY
- || this->Target->GetType() > cmTarget::MODULE_LIBRARY)
- {
- return;
- }
const char* linkLanguage =
this->Target->GetLinkerLanguage(config.c_str());
if(!linkLanguage)
@@ -1362,10 +1354,9 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
cmSystemTools::Error
("CMake can not determine linker language for target:",
this->Name.c_str());
- return;
+ return false;
}
- this->WriteString("<Link>\n", 2);
std::string CONFIG = cmSystemTools::UpperCase(config);
const char* linkType = "SHARED";
@@ -1387,7 +1378,6 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
flags += " ";
flags += stackVal;
}
- // assume incremental linking
std::string linkFlagVarBase = "CMAKE_";
linkFlagVarBase += linkType;
linkFlagVarBase += "_LINKER_FLAGS";
@@ -1411,10 +1401,6 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
flags += " ";
flags += flagsConfig;
}
- cmVisualStudioGeneratorOptions
- linkOptions(this->LocalGenerator,
- cmVisualStudioGeneratorOptions::Linker,
- cmVSGetLinkFlagTable(this->LocalGenerator), 0, this);
if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") )
{
flags += " /SUBSYSTEM:WINDOWS";
@@ -1423,8 +1409,6 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
{
flags += " /SUBSYSTEM:CONSOLE";
}
- cmSystemTools::ReplaceString(flags, "/INCREMENTAL:YES", "");
- cmSystemTools::ReplaceString(flags, "/INCREMENTAL:NO", "");
std::string standardLibsVar = "CMAKE_";
standardLibsVar += linkLanguage;
standardLibsVar += "_STANDARD_LIBRARIES";
@@ -1452,7 +1436,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
cmSystemTools::Error
("CMake can not compute cmComputeLinkInformation for target:",
this->Name.c_str());
- return;
+ return false;
}
// add the libraries for the target to libs string
cmComputeLinkInformation& cli = *pcli;
@@ -1521,7 +1505,22 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
this->GeneratorTarget->ModuleDefinitionFile.c_str());
}
- linkOptions.RemoveFlag("GenerateManifest");
+ this->LinkOptions[config] = pOptions.release();
+ return true;
+}
+
+//----------------------------------------------------------------------------
+void
+cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& config)
+{
+ if(this->Target->GetType() == cmTarget::STATIC_LIBRARY
+ || this->Target->GetType() > cmTarget::MODULE_LIBRARY)
+ {
+ return;
+ }
+ Options& linkOptions = *(this->LinkOptions[config]);
+ this->WriteString("<Link>\n", 2);
+
linkOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
linkOptions.OutputFlagMap(*this->BuildFileStream, " ");
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 308b9bd..55a850a 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -68,6 +68,8 @@ private:
std::vector<std::string> const & includes);
void WriteRCOptions(std::string const& config,
std::vector<std::string> const & includes);
+ bool ComputeLinkOptions();
+ bool ComputeLinkOptions(std::string const& config);
void WriteLinkOptions(std::string const& config);
void WriteMidlOptions(std::string const& config,
std::vector<std::string> const & includes);
@@ -95,6 +97,7 @@ private:
typedef cmVisualStudioGeneratorOptions Options;
typedef std::map<cmStdString, Options*> OptionsMap;
OptionsMap ClOptions;
+ OptionsMap LinkOptions;
std::string PathToVcxproj;
cmTarget* Target;
cmGeneratorTarget* GeneratorTarget;
diff --git a/Source/cmWin32ProcessExecution.cxx b/Source/cmWin32ProcessExecution.cxx
index 9a536c1..5752ab6 100644
--- a/Source/cmWin32ProcessExecution.cxx
+++ b/Source/cmWin32ProcessExecution.cxx
@@ -271,13 +271,6 @@ bool cmWin32ProcessExecution::Wait(int timeout)
return this->PrivateClose(timeout);
}
-/*
- * Internal dictionary mapping popen* file pointers to process handles,
- * for use when retrieving the process exit code. See _PyPclose() below
- * for more information on this dictionary's use.
- */
-static void *_PyPopenProcs = NULL;
-
static BOOL RealPopenCreateProcess(const char *cmdstring,
const char *path,
const char *szConsoleSpawn,
@@ -679,18 +672,6 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring,
}
}
- /*
- * Insert the files we've created into the process dictionary
- * all referencing the list with the process handle and the
- * initial number of files (see description below in _PyPclose).
- * Since if _PyPclose later tried to wait on a process when all
- * handles weren't closed, it could create a deadlock with the
- * child, we spend some energy here to try to ensure that we
- * either insert all file handles into the dictionary or none
- * at all. It's a little clumsy with the various popen modes
- * and variable number of files involved.
- */
-
/* Child is launched. Close the parents copy of those pipe
* handles that only the child should have open. You need to
* make sure that no handles to the write end of the output pipe
@@ -761,43 +742,6 @@ cmWin32ProcessExecution::~cmWin32ProcessExecution()
this->CloseHandles();
}
-/*
- * Wrapper for fclose() to use for popen* files, so we can retrieve the
- * exit code for the child process and return as a result of the close.
- *
- * This function uses the _PyPopenProcs dictionary in order to map the
- * input file pointer to information about the process that was
- * originally created by the popen* call that created the file pointer.
- * The dictionary uses the file pointer as a key (with one entry
- * inserted for each file returned by the original popen* call) and a
- * single list object as the value for all files from a single call.
- * The list object contains the Win32 process handle at [0], and a file
- * count at [1], which is initialized to the total number of file
- * handles using that list.
- *
- * This function closes whichever handle it is passed, and decrements
- * the file count in the dictionary for the process handle pointed to
- * by this file. On the last close (when the file count reaches zero),
- * this function will wait for the child process and then return its
- * exit code as the result of the close() operation. This permits the
- * files to be closed in any order - it is always the close() of the
- * final handle that will return the exit code.
- */
-
- /* RED_FLAG 31-Aug-2000 Tim
- * This is always called (today!) between a pair of
- * Py_BEGIN_ALLOW_THREADS/ Py_END_ALLOW_THREADS
- * macros. So the thread running this has no valid thread state, as
- * far as Python is concerned. However, this calls some Python API
- * functions that cannot be called safely without a valid thread
- * state, in particular PyDict_GetItem.
- * As a temporary hack (although it may last for years ...), we
- * *rely* on not having a valid thread state in this function, in
- * order to create our own "from scratch".
- * This will deadlock if _PyPclose is ever called by a thread
- * holding the global lock.
- */
-
bool cmWin32ProcessExecution::PrivateClose(int /* timeout */)
{
HANDLE hProcess = this->ProcessHandle;
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 34350bf..04dab59 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -237,12 +237,14 @@ int main() {
// needed to suppress filename output of msvc tools
std::string srcfilename;
+ {
std::string::size_type pos = srcfile.rfind("\\");
if (pos == std::string::npos) {
srcfilename = srcfile;
} else {
srcfilename = srcfile.substr(pos + 1);
}
+ }
std::string nol = " /nologo ";
std::string show = " /showIncludes ";
@@ -266,10 +268,12 @@ int main() {
// call cl in object dir so the .i is generated there
std::string objdir;
+ {
std::string::size_type pos = objfile.rfind("\\");
if (pos != std::string::npos) {
objdir = objfile.substr(0, pos);
}
+ }
// extract dependencies with cl.exe
int exit_code = process(srcfilename, dfile, objfile,
diff --git a/Source/cmw9xcom.cxx b/Source/cmw9xcom.cxx
index e6014b3..ab238d5 100644
--- a/Source/cmw9xcom.cxx
+++ b/Source/cmw9xcom.cxx
@@ -31,14 +31,14 @@ int main (int argc, char *argv[])
int cc;
for ( cc = 2; cc < argc; cc ++ )
{
- std::string arg = argv[cc];
- if ( (arg.find_first_of(" ") != arg.npos) &&
- (arg.find_first_of("\"") == arg.npos) )
+ std::string nextArg = argv[cc];
+ if ( (nextArg.find_first_of(" ") != nextArg.npos) &&
+ (nextArg.find_first_of("\"") == nextArg.npos) )
{
- arg = "\"" + arg + "\"";
+ nextArg = "\"" + nextArg + "\"";
}
command += " ";
- command += arg;
+ command += nextArg;
}
return cmWin32ProcessExecution::Windows9xHack(command.c_str());
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index a132357..777d76f 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -509,19 +509,28 @@ ENDIF(KWSYS_USE_FundamentalType)
IF(KWSYS_USE_IOStream)
# Determine whether iostreams support long long.
+ SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
+ -DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI}
+ -DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD})
IF(KWSYS_CXX_HAS_LONG_LONG)
- SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
- -DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI}
- -DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD})
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM_LONG_LONG
"Checking if istream supports long long" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_OSTREAM_LONG_LONG
"Checking if ostream supports long long" DIRECT)
- SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
ELSE()
SET(KWSYS_IOS_HAS_ISTREAM_LONG_LONG 0)
SET(KWSYS_IOS_HAS_OSTREAM_LONG_LONG 0)
ENDIF()
+ IF(KWSYS_CXX_HAS___INT64)
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM___INT64
+ "Checking if istream supports __int64" DIRECT)
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_OSTREAM___INT64
+ "Checking if ostream supports __int64" DIRECT)
+ ELSE()
+ SET(KWSYS_IOS_HAS_ISTREAM___INT64 0)
+ SET(KWSYS_IOS_HAS_OSTREAM___INT64 0)
+ ENDIF()
+ SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
ENDIF(KWSYS_USE_IOStream)
IF(KWSYS_NAMESPACE MATCHES "^kwsys$")
@@ -566,9 +575,76 @@ IF(KWSYS_USE_SystemTools)
ENDIF()
IF(KWSYS_USE_SystemInformation)
- SET_PROPERTY(SOURCE SystemInformation.cxx PROPERTY
- COMPILE_DEFINITIONS KWSYS_USE_LONG_LONG=${KWSYS_USE_LONG_LONG}
- KWSYS_USE___INT64=${KWSYS_USE___INT64})
+ IF(NOT CYGWIN)
+ INCLUDE(CheckIncludeFiles)
+ CHECK_INCLUDE_FILES("sys/types.h;ifaddrs.h" KWSYS_SYS_HAS_IFADDRS_H)
+ IF(KWSYS_SYS_HAS_IFADDRS_H)
+ SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_SYS_HAS_IFADDRS_H=1)
+ ENDIF()
+ ENDIF()
+ IF(WIN32)
+ INCLUDE(CheckSymbolExists)
+ SET(CMAKE_REQUIRED_LIBRARIES Psapi)
+ CHECK_SYMBOL_EXISTS(GetProcessMemoryInfo "windows.h;psapi.h" KWSYS_SYS_HAS_PSAPI)
+ UNSET(CMAKE_REQUIRED_LIBRARIES)
+ IF(KWSYS_SYS_HAS_PSAPI)
+ SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_SYS_HAS_PSAPI=1)
+ IF(MSVC70 OR MSVC71)
+ # Suppress LNK4089: all references to 'PSAPI.DLL' discarded by /OPT:REF
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /IGNORE:4089")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ IF(KWSYS_LFS_AVAILABLE AND NOT KWSYS_LFS_DISABLE)
+ SET(KWSYS_PLATFORM_CXX_TEST_DEFINES -DKWSYS_HAS_LFS=1)
+ ENDIF()
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_RLIMIT64
+ "Checking whether CXX compiler has rlimit64" DIRECT)
+ SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
+ IF(KWSYS_CXX_HAS_RLIMIT64)
+ SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_CXX_HAS_RLIMIT64=1)
+ ENDIF()
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ATOL
+ "Checking whether CXX compiler has atol" DIRECT)
+ IF(KWSYS_CXX_HAS_ATOL)
+ SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_CXX_HAS_ATOL=1)
+ ENDIF()
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ATOLL
+ "Checking whether CXX compiler has atoll" DIRECT)
+ IF(KWSYS_CXX_HAS_ATOLL)
+ SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_CXX_HAS_ATOLL=1)
+ ENDIF()
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS__ATOI64
+ "Checking whether CXX compiler has _atoi64" DIRECT)
+ IF(KWSYS_CXX_HAS__ATOI64)
+ SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_CXX_HAS__ATOI64=1)
+ ENDIF()
+ IF(KWSYS_USE___INT64)
+ SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_USE___INT64=1)
+ ENDIF()
+ IF(KWSYS_USE_LONG_LONG)
+ SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_USE_LONG_LONG=1)
+ ENDIF()
+ IF(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
+ SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_IOS_HAS_OSTREAM_LONG_LONG=1)
+ ENDIF()
+ IF(KWSYS_IOS_HAS_OSTREAM___INT64)
+ SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_IOS_HAS_OSTREAM___INT64=1)
+ ENDIF()
+ IF(KWSYS_BUILD_SHARED)
+ SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_BUILD_SHARED=1)
+ ENDIF()
ENDIF()
#-----------------------------------------------------------------------------
@@ -802,9 +878,12 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${CMAKE_DL_LIBS})
ENDIF(UNIX)
ENDIF(KWSYS_USE_DynamicLoader)
-
+
IF(KWSYS_USE_SystemInformation AND WIN32)
TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ws2_32)
+ IF(KWSYS_SYS_HAS_PSAPI)
+ TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} Psapi)
+ ENDIF()
ENDIF(KWSYS_USE_SystemInformation AND WIN32)
# Apply user-defined target properties to the library.
@@ -842,6 +921,16 @@ ENDIF(KWSYS_ENABLE_C AND KWSYS_C_SRCS)
# line to configure the namespace in the C and C++ source files.
ADD_DEFINITIONS("-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}")
+# Disable deprecation warnings for standard C functions.
+IF(MSVC OR (WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$"))
+ ADD_DEFINITIONS(
+ -D_CRT_NONSTDC_NO_DEPRECATE
+ -D_CRT_SECURE_NO_DEPRECATE
+ -D_CRT_SECURE_NO_WARNINGS
+ -D_SCL_SECURE_NO_DEPRECATE
+ )
+ENDIF()
+
IF(KWSYS_USE_String)
# Activate code in "String.c". See the comment in the source.
SET_SOURCE_FILES_PROPERTIES(String.c PROPERTIES
diff --git a/Source/kwsys/CTestConfig.cmake b/Source/kwsys/CTestConfig.cmake
index 9ab6ed8..d977b47 100644
--- a/Source/kwsys/CTestConfig.cmake
+++ b/Source/kwsys/CTestConfig.cmake
@@ -1,6 +1,6 @@
#=============================================================================
# KWSys - Kitware System Library
-# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+# Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -9,10 +9,9 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
-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_DROP_METHOD "http")
-set(CTEST_DROP_SITE "www.cdash.org")
-set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard")
+set(CTEST_DROP_SITE "open.cdash.org")
+set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard")
set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/Source/kwsys/Configure.h.in b/Source/kwsys/Configure.h.in
index 15986cf..70cf844 100644
--- a/Source/kwsys/Configure.h.in
+++ b/Source/kwsys/Configure.h.in
@@ -37,20 +37,6 @@
/* Whether kwsys namespace is "kwsys". */
#define @KWSYS_NAMESPACE@_NAME_IS_KWSYS @KWSYS_NAME_IS_KWSYS@
-/* If we are building a kwsys .c or .cxx file, suppress the Microsoft
- deprecation warnings. */
-#if defined(KWSYS_NAMESPACE)
-# ifndef _CRT_NONSTDC_NO_DEPRECATE
-# define _CRT_NONSTDC_NO_DEPRECATE
-# endif
-# ifndef _CRT_SECURE_NO_DEPRECATE
-# define _CRT_SECURE_NO_DEPRECATE
-# endif
-# ifndef _SCL_SECURE_NO_DEPRECATE
-# define _SCL_SECURE_NO_DEPRECATE
-# endif
-#endif
-
/* Whether Large File Support is requested. */
#define @KWSYS_NAMESPACE@_LFS_REQUESTED @KWSYS_LFS_REQUESTED@
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index 9c66a44..1992211 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -2732,6 +2732,7 @@ static void kwsysProcessesSignalHandler(int signum
kwsysProcess* cp = kwsysProcesses.Processes[i];
kwsysProcess_ssize_t status=
read(cp->PipeReadEnds[KWSYSPE_PIPE_SIGNAL], &buf, 1);
+ (void)status;
status=write(cp->SignalPipe, &buf, 1);
(void)status;
}
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index e1ee873..6d990a9 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -9,7 +9,12 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
-#ifdef _WIN32
+
+#if defined(_WIN32)
+# define NOMINMAX // use our min,max
+# if !defined(_WIN32_WINNT) && !(defined(_MSC_VER) && _MSC_VER < 1300)
+# define _WIN32_WINNT 0x0501
+# endif
# include <winsock.h> // WSADATA, include before sys/types.h
#endif
@@ -33,6 +38,7 @@
#include KWSYS_HEADER(Process.h)
#include KWSYS_HEADER(ios/iostream)
#include KWSYS_HEADER(ios/sstream)
+#include KWSYS_HEADER(ios/fstream)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
@@ -45,66 +51,142 @@
# include "kwsys_stl_iosfwd.in"
# include "kwsys_ios_sstream.h.in"
# include "kwsys_ios_iostream.h.in"
+# include "kwsys_ios_fstream.h.in"
#endif
-#ifndef WIN32
+#if defined(_WIN32)
+# include <windows.h>
+# include <errno.h>
+# if defined(KWSYS_SYS_HAS_PSAPI)
+# include <psapi.h>
+# endif
+# if !defined(siginfo_t)
+typedef int siginfo_t;
+# endif
+#else
+# include <sys/types.h>
+# include <sys/time.h>
# include <sys/utsname.h> // int uname(struct utsname *buf);
+# include <sys/resource.h> // getrlimit
+# include <unistd.h>
+# include <signal.h>
+# include <fcntl.h>
+# include <errno.h> // extern int errno;
#endif
-#ifdef _WIN32
-# include <windows.h>
+#ifdef __FreeBSD__
+# include <sys/sysctl.h>
+# include <fenv.h>
+# include <sys/socket.h>
+# include <netdb.h>
+# include <netinet/in.h>
+# if defined(KWSYS_SYS_HAS_IFADDRS_H)
+# include <ifaddrs.h>
+# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN
+# endif
#endif
#ifdef __APPLE__
-#include <sys/sysctl.h>
-#include <mach/vm_statistics.h>
-#include <mach/host_info.h>
-#include <mach/mach.h>
-#include <mach/mach_types.h>
+# include <sys/sysctl.h>
+# include <mach/vm_statistics.h>
+# include <mach/host_info.h>
+# include <mach/mach.h>
+# include <mach/mach_types.h>
+# include <fenv.h>
+# include <sys/socket.h>
+# include <netdb.h>
+# include <netinet/in.h>
+# if defined(KWSYS_SYS_HAS_IFADDRS_H)
+# include <ifaddrs.h>
+# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN
+# endif
+# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 >= 1050
+# include <execinfo.h>
+# define KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE
+# endif
#endif
#ifdef __linux
-# include <sys/types.h>
-# include <unistd.h>
-# include <fcntl.h>
-# include <ctype.h> // int isdigit(int c);
-# include <errno.h> // extern int errno;
-# include <sys/time.h>
+# include <fenv.h>
+# include <sys/socket.h>
+# include <netdb.h>
+# include <netinet/in.h>
+# if defined(KWSYS_SYS_HAS_IFADDRS_H)
+# include <ifaddrs.h>
+# if !defined(__LSB_VERSION__) /* LSB has no getifaddrs */
+# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN
+# endif
+# endif
+# if defined(__GNUG__)
+# include <execinfo.h>
+# if !(defined(__LSB_VERSION__) && __LSB_VERSION__ < 41)
+# define KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE
+# endif
+# endif
+# if defined(KWSYS_CXX_HAS_RLIMIT64)
+typedef struct rlimit64 ResourceLimitType;
+# define GetResourceLimit getrlimit64
+# else
+typedef struct rlimit ResourceLimitType;
+# define GetResourceLimit getrlimit
+# endif
#elif defined( __hpux )
# include <sys/param.h>
# include <sys/pstat.h>
#endif
#ifdef __HAIKU__
-#include <OS.h>
+# include <OS.h>
#endif
#include <memory.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <ctype.h> // int isdigit(int c);
+
+#if defined(KWSYS_USE_LONG_LONG)
+# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
+# define iostreamLongLong(x) (x)
+# else
+# define iostreamLongLong(x) ((long)x)
+# endif
+#elif defined(KWSYS_USE___INT64)
+# if defined(KWSYS_IOS_HAS_OSTREAM___INT64)
+# define iostreamLongLong(x) (x)
+# else
+# define iostreamLongLong(x) ((long)x)
+# endif
+#else
+# error "No Long Long"
+#endif
+#if defined(KWSYS_CXX_HAS_ATOLL)
+# define atoLongLong atoll
+#else
+# if defined(KWSYS_CXX_HAS__ATOI64)
+# define atoLongLong _atoi64
+# elif defined(KWSYS_CXX_HAS_ATOL)
+# define atoLongLong atol
+# else
+# define atoLongLong atoi
+# endif
+#endif
namespace KWSYS_NAMESPACE
{
+template<typename T>
+T min(T a, T b){ return a<b ? a : b; }
-// Create longlong
-#if KWSYS_USE_LONG_LONG
- typedef long long LongLong;
-#elif KWSYS_USE___INT64
- typedef __int64 LongLong;
-#else
-# error "No Long Long"
-#endif
-
+extern "C" { typedef void (*SigAction)(int,siginfo_t*,void*); }
// Define SystemInformationImplementation class
typedef void (*DELAY_FUNC)(unsigned int uiMS);
-
class SystemInformationImplementation
{
public:
+ typedef SystemInformation::LongLong LongLong;
SystemInformationImplementation ();
~SystemInformationImplementation ();
@@ -113,6 +195,7 @@ public:
kwsys_stl::string GetTypeID();
kwsys_stl::string GetFamilyID();
kwsys_stl::string GetModelID();
+ kwsys_stl::string GetModelName();
kwsys_stl::string GetSteppingCode();
const char * GetExtendedProcessorName();
const char * GetProcessorSerialNumber();
@@ -122,9 +205,10 @@ public:
int GetProcessorAPICID();
int GetProcessorCacheXSize(long int);
bool DoesCPUSupportFeature(long int);
-
+
const char * GetOSName();
const char * GetHostname();
+ int GetFullyQualifiedDomainName(kwsys_stl::string &fqdn);
const char * GetOSRelease();
const char * GetOSVersion();
const char * GetOSPlatform();
@@ -140,7 +224,23 @@ public:
size_t GetTotalVirtualMemory();
size_t GetAvailableVirtualMemory();
size_t GetTotalPhysicalMemory();
- size_t GetAvailablePhysicalMemory();
+ size_t GetAvailablePhysicalMemory();
+
+ LongLong GetProcessId();
+
+ // Retrieve memory information in kib
+ LongLong GetHostMemoryTotal();
+ LongLong GetHostMemoryAvailable(const char *envVarName);
+ LongLong GetHostMemoryUsed();
+
+ LongLong GetProcMemoryAvailable(
+ const char *hostLimitEnvVarName,
+ const char *procLimitEnvVarName);
+ LongLong GetProcMemoryUsed();
+
+ // enable/disable stack trace signal handler.
+ static
+ void SetStackTraceOnError(int enable);
/** Run the different checks */
void RunCPUCheck();
@@ -159,6 +259,7 @@ public:
kwsys_stl::string ProcessorName;
kwsys_stl::string Vendor;
kwsys_stl::string SerialNumber;
+ kwsys_stl::string ModelName;
} ID;
typedef struct tagCPUPowerManagement
@@ -249,7 +350,7 @@ protected:
// For Mac
bool ParseSysCtl();
- void CallSwVers();
+ int CallSwVers(const char *arg, kwsys_stl::string &ver);
void TrimNewline(kwsys_stl::string&);
kwsys_stl::string ExtractValueFromSysCtl(const char* word);
kwsys_stl::string SysCtlBuffer;
@@ -281,7 +382,7 @@ protected:
kwsys_stl::string Hostname;
kwsys_stl::string OSRelease;
kwsys_stl::string OSVersion;
- kwsys_stl::string OSPlatform;
+ kwsys_stl::string OSPlatform;
};
@@ -320,6 +421,11 @@ kwsys_stl::string SystemInformation::GetModelID()
return this->Implementation->GetModelID();
}
+kwsys_stl::string SystemInformation::GetModelName()
+{
+ return this->Implementation->GetModelName();
+}
+
kwsys_stl::string SystemInformation::GetSteppingCode()
{
return this->Implementation->GetSteppingCode();
@@ -365,6 +471,37 @@ bool SystemInformation::DoesCPUSupportFeature(long int i)
return this->Implementation->DoesCPUSupportFeature(i);
}
+kwsys_stl::string SystemInformation::GetCPUDescription()
+{
+ kwsys_ios::ostringstream oss;
+ oss
+ << this->GetNumberOfPhysicalCPU()
+ << " core ";
+ if (this->GetModelName().empty())
+ {
+ oss
+ << this->GetProcessorClockFrequency()
+ << " MHz "
+ << this->GetVendorString()
+ << " "
+ << this->GetExtendedProcessorName();
+ }
+ else
+ {
+ oss << this->GetModelName();
+ }
+
+ // remove extra spaces
+ kwsys_stl::string tmp=oss.str();
+ size_t pos;
+ while( (pos=tmp.find(" "))!=kwsys_stl::string::npos)
+ {
+ tmp.replace(pos,2," ");
+ }
+
+ return tmp;
+}
+
const char * SystemInformation::GetOSName()
{
return this->Implementation->GetOSName();
@@ -375,6 +512,13 @@ const char * SystemInformation::GetHostname()
return this->Implementation->GetHostname();
}
+kwsys_stl::string SystemInformation::GetFullyQualifiedDomainName()
+{
+ kwsys_stl::string fqdn;
+ this->Implementation->GetFullyQualifiedDomainName(fqdn);
+ return fqdn;
+}
+
const char * SystemInformation::GetOSRelease()
{
return this->Implementation->GetOSRelease();
@@ -390,6 +534,46 @@ const char * SystemInformation::GetOSPlatform()
return this->Implementation->GetOSPlatform();
}
+int SystemInformation::GetOSIsWindows()
+{
+#if defined(_WIN32)
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+int SystemInformation::GetOSIsLinux()
+{
+#if defined(__linux)
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+int SystemInformation::GetOSIsApple()
+{
+#if defined(__APPLE__)
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+kwsys_stl::string SystemInformation::GetOSDescription()
+{
+ kwsys_ios::ostringstream oss;
+ oss
+ << this->GetOSName()
+ << " "
+ << this->GetOSRelease()
+ << " "
+ << this->GetOSVersion();
+
+ return oss.str();
+}
+
bool SystemInformation::Is64Bits()
{
return this->Implementation->Is64Bits();
@@ -431,6 +615,66 @@ size_t SystemInformation::GetAvailablePhysicalMemory()
return this->Implementation->GetAvailablePhysicalMemory();
}
+kwsys_stl::string SystemInformation::GetMemoryDescription(
+ const char *hostLimitEnvVarName,
+ const char *procLimitEnvVarName)
+{
+ kwsys_ios::ostringstream oss;
+ oss
+ << "Host Total: "
+ << iostreamLongLong(this->GetHostMemoryTotal())
+ << " KiB, Host Available: "
+ << iostreamLongLong(this->GetHostMemoryAvailable(hostLimitEnvVarName))
+ << " KiB, Process Available: "
+ << iostreamLongLong(
+ this->GetProcMemoryAvailable(hostLimitEnvVarName,procLimitEnvVarName))
+ << " KiB";
+ return oss.str();
+}
+
+// host memory info in units of KiB.
+SystemInformation::LongLong SystemInformation::GetHostMemoryTotal()
+{
+ return this->Implementation->GetHostMemoryTotal();
+}
+
+SystemInformation::LongLong
+SystemInformation::GetHostMemoryAvailable(const char *hostLimitEnvVarName)
+{
+ return this->Implementation->GetHostMemoryAvailable(hostLimitEnvVarName);
+}
+
+SystemInformation::LongLong SystemInformation::GetHostMemoryUsed()
+{
+ return this->Implementation->GetHostMemoryUsed();
+}
+
+// process memory info in units of KiB.
+SystemInformation::LongLong
+SystemInformation::GetProcMemoryAvailable(
+ const char *hostLimitEnvVarName,
+ const char *procLimitEnvVarName)
+{
+ return this->Implementation->GetProcMemoryAvailable(
+ hostLimitEnvVarName,
+ procLimitEnvVarName);
+}
+
+SystemInformation::LongLong SystemInformation::GetProcMemoryUsed()
+{
+ return this->Implementation->GetProcMemoryUsed();
+}
+
+SystemInformation::LongLong SystemInformation::GetProcessId()
+{
+ return this->Implementation->GetProcessId();
+}
+
+void SystemInformation::SetStackTraceOnError(int enable)
+{
+ SystemInformationImplementation::SetStackTraceOnError(enable);
+}
+
/** Run the different checks */
void SystemInformation::RunCPUCheck()
{
@@ -501,22 +745,365 @@ void SystemInformation::RunMemoryCheck()
#define HT_CANNOT_DETECT 4
// EDX[28] Bit 28 is set if HT is supported
-#define HT_BIT 0x10000000
+#define HT_BIT 0x10000000
// EAX[11:8] Bit 8-11 contains family processor ID.
#define FAMILY_ID 0x0F00
-#define PENTIUM4_ID 0x0F00
+#define PENTIUM4_ID 0x0F00
// EAX[23:20] Bit 20-23 contains extended family processor ID
-#define EXT_FAMILY_ID 0x0F00000
+#define EXT_FAMILY_ID 0x0F00000
// EBX[23:16] Bit 16-23 in ebx contains the number of logical
-#define NUM_LOGICAL_BITS 0x00FF0000
-// processors per physical processor when execute cpuid with
+#define NUM_LOGICAL_BITS 0x00FF0000
+// processors per physical processor when execute cpuid with
// eax set to 1
-// EBX[31:24] Bits 24-31 (8 bits) return the 8-bit unique
-#define INITIAL_APIC_ID_BITS 0xFF000000
+// EBX[31:24] Bits 24-31 (8 bits) return the 8-bit unique
+#define INITIAL_APIC_ID_BITS 0xFF000000
// initial APIC ID for the processor this code is running on.
// Default value = 0xff if HT is not supported
+// Hide implementation details in an anonymous namespace.
+namespace {
+// *****************************************************************************
+#if defined(__linux) || defined(__APPLE__)
+int LoadLines(
+ FILE *file,
+ kwsys_stl::vector<kwsys_stl::string> &lines)
+{
+ // Load each line in the given file into a the vector.
+ int nRead=0;
+ const int bufSize=1024;
+ char buf[bufSize]={'\0'};
+ while (!feof(file) && !ferror(file))
+ {
+ errno=0;
+ if (fgets(buf,bufSize,file) == 0)
+ {
+ if (ferror(file) && (errno==EINTR))
+ {
+ clearerr(file);
+ }
+ continue;
+ }
+ lines.push_back(buf);
+ ++nRead;
+ }
+ if (ferror(file))
+ {
+ return 0;
+ }
+ return nRead;
+}
+
+# if defined(__linux)
+// *****************************************************************************
+int LoadLines(
+ const char *fileName,
+ kwsys_stl::vector<kwsys_stl::string> &lines)
+{
+ FILE *file=fopen(fileName,"r");
+ if (file==0)
+ {
+ return 0;
+ }
+ int nRead=LoadLines(file,lines);
+ fclose(file);
+ return nRead;
+}
+# endif
+
+// ****************************************************************************
+template<typename T>
+int NameValue(
+ kwsys_stl::vector<kwsys_stl::string> &lines,
+ kwsys_stl::string name, T &value)
+{
+ size_t nLines=lines.size();
+ for (size_t i=0; i<nLines; ++i)
+ {
+ size_t at=lines[i].find(name);
+ if (at==kwsys_stl::string::npos)
+ {
+ continue;
+ }
+ kwsys_ios::istringstream is(lines[i].substr(at+name.size()));
+ is >> value;
+ return 0;
+ }
+ return -1;
+}
+#endif
+
+#if defined(__linux)
+// ****************************************************************************
+template<typename T>
+int GetFieldsFromFile(
+ const char *fileName,
+ const char **fieldNames,
+ T *values)
+{
+ kwsys_stl::vector<kwsys_stl::string> fields;
+ if (!LoadLines(fileName,fields))
+ {
+ return -1;
+ }
+ int i=0;
+ while (fieldNames[i]!=NULL)
+ {
+ int ierr=NameValue(fields,fieldNames[i],values[i]);
+ if (ierr)
+ {
+ return -(i+2);
+ }
+ i+=1;
+ }
+ return 0;
+}
+
+// ****************************************************************************
+template<typename T>
+int GetFieldFromFile(
+ const char *fileName,
+ const char *fieldName,
+ T &value)
+{
+ const char *fieldNames[2]={fieldName,NULL};
+ T values[1]={T(0)};
+ int ierr=GetFieldsFromFile(fileName,fieldNames,values);
+ if (ierr)
+ {
+ return ierr;
+ }
+ value=values[0];
+ return 0;
+}
+#endif
+
+// ****************************************************************************
+#if defined(__APPLE__)
+template<typename T>
+int GetFieldsFromCommand(
+ const char *command,
+ const char **fieldNames,
+ T *values)
+{
+ FILE *file=popen(command,"r");
+ if (file==0)
+ {
+ return -1;
+ }
+ kwsys_stl::vector<kwsys_stl::string> fields;
+ int nl=LoadLines(file,fields);
+ pclose(file);
+ if (nl==0)
+ {
+ return -1;
+ }
+ int i=0;
+ while (fieldNames[i]!=NULL)
+ {
+ int ierr=NameValue(fields,fieldNames[i],values[i]);
+ if (ierr)
+ {
+ return -(i+2);
+ }
+ i+=1;
+ }
+ return 0;
+}
+#endif
+
+// ****************************************************************************
+#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
+void StacktraceSignalHandler(
+ int sigNo,
+ siginfo_t *sigInfo,
+ void * /*sigContext*/)
+{
+#if defined(__linux) || defined(__APPLE__)
+ kwsys_ios::ostringstream oss;
+ oss
+ << "=========================================================" << kwsys_ios::endl
+ << "Process id " << getpid() << " ";
+ switch (sigNo)
+ {
+ case SIGFPE:
+ oss << "Caught SIGFPE ";
+ switch (sigInfo->si_code)
+ {
+# if defined(FPE_INTDIV)
+ case FPE_INTDIV:
+ oss << "integer division by zero";
+ break;
+# endif
+
+# if defined(FPE_INTOVF)
+ case FPE_INTOVF:
+ oss << "integer overflow";
+ break;
+# endif
+
+ case FPE_FLTDIV:
+ oss << "floating point divide by zero";
+ break;
+
+ case FPE_FLTOVF:
+ oss << "floating point overflow";
+ break;
+
+ case FPE_FLTUND:
+ oss << "floating point underflow";
+ break;
+
+ case FPE_FLTRES:
+ oss << "floating point inexact result";
+ break;
+
+ case FPE_FLTINV:
+ oss << "floating point invalid operation";
+ break;
+
+#if defined(FPE_FLTSUB)
+ case FPE_FLTSUB:
+ oss << "floating point subscript out of range";
+ break;
+#endif
+
+ default:
+ oss << "code " << sigInfo->si_code;
+ break;
+ }
+ break;
+
+ case SIGSEGV:
+ oss << "Caught SIGSEGV ";
+ switch (sigInfo->si_code)
+ {
+ case SEGV_MAPERR:
+ oss << "address not mapped to object";
+ break;
+
+ case SEGV_ACCERR:
+ oss << "invalid permission for mapped object";
+ break;
+
+ default:
+ oss << "code " << sigInfo->si_code;
+ break;
+ }
+ break;
+
+ case SIGINT:
+ oss << "Caught SIGTERM";
+ break;
+
+ case SIGTERM:
+ oss << "Caught SIGTERM";
+ break;
+
+ case SIGBUS:
+ oss << "Caught SIGBUS type ";
+ switch (sigInfo->si_code)
+ {
+ case BUS_ADRALN:
+ oss << "invalid address alignment";
+ break;
+
+# if defined(BUS_ADRERR)
+ case BUS_ADRERR:
+ oss << "non-exestent physical address";
+ break;
+# endif
+
+# if defined(BUS_OBJERR)
+ case BUS_OBJERR:
+ oss << "object specific hardware error";
+ break;
+# endif
+
+ default:
+ oss << "code " << sigInfo->si_code;
+ break;
+ }
+ break;
+
+ case SIGILL:
+ oss << "Caught SIGILL ";
+ switch (sigInfo->si_code)
+ {
+ case ILL_ILLOPC:
+ oss << "illegal opcode";
+ break;
+
+# if defined(ILL_ILLOPN)
+ case ILL_ILLOPN:
+ oss << "illegal operand";
+ break;
+# endif
+
+# if defined(ILL_ILLADR)
+ case ILL_ILLADR:
+ oss << "illegal addressing mode.";
+ break;
+# endif
+
+ case ILL_ILLTRP:
+ oss << "illegal trap";
+
+ case ILL_PRVOPC:
+ oss << "privileged opcode";
+ break;
+
+# if defined(ILL_PRVREG)
+ case ILL_PRVREG:
+ oss << "privileged register";
+ break;
+# endif
+
+# if defined(ILL_COPROC)
+ case ILL_COPROC:
+ oss << "co-processor error";
+ break;
+# endif
+
+# if defined(ILL_BADSTK)
+ case ILL_BADSTK:
+ oss << "internal stack error";
+ break;
+# endif
+
+ default:
+ oss << "code " << sigInfo->si_code;
+ break;
+ }
+ break;
+
+ default:
+ oss << "Caught " << sigNo << " code " << sigInfo->si_code;
+ break;
+ }
+ oss << kwsys_ios::endl;
+#if defined(KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE)
+ oss << "Program Stack:" << kwsys_ios::endl;
+ void *stackSymbols[128];
+ int n=backtrace(stackSymbols,128);
+ char **stackText=backtrace_symbols(stackSymbols,n);
+ for (int i=0; i<n; ++i)
+ {
+ oss << " " << stackText[i] << kwsys_ios::endl;
+ }
+#endif
+ oss
+ << "=========================================================" << kwsys_ios::endl;
+ kwsys_ios::cerr << oss.str() << kwsys_ios::endl;
+ abort();
+#else
+ // avoid warning C4100
+ (void)sigNo;
+ (void)sigInfo;
+#endif
+}
+#endif
+} // anonymous namespace
SystemInformationImplementation::SystemInformationImplementation()
{
@@ -573,13 +1160,13 @@ void SystemInformationImplementation::RunCPUCheck()
if (supportsCPUID)
{
// Retrieve cache information.
- if (!RetrieveCPUCacheDetails())
+ if (!RetrieveCPUCacheDetails())
{
RetrieveClassicalCPUCacheDetails();
}
// Retrieve the extended CPU details.
- if (!RetrieveExtendedCPUIdentity())
+ if (!RetrieveExtendedCPUIdentity())
{
RetrieveClassicalCPUIdentity();
}
@@ -641,9 +1228,145 @@ const char * SystemInformationImplementation::GetOSName()
/** Get the hostname */
const char* SystemInformationImplementation::GetHostname()
{
+ if (this->Hostname.empty())
+ {
+ this->Hostname="localhost";
+#if defined(_WIN32)
+ WORD wVersionRequested;
+ WSADATA wsaData;
+ char name[255];
+ wVersionRequested = MAKEWORD(2,0);
+ if ( WSAStartup( wVersionRequested, &wsaData ) == 0 )
+ {
+ gethostname(name,sizeof(name));
+ WSACleanup( );
+ }
+ this->Hostname = name;
+#else
+ struct utsname unameInfo;
+ int errorFlag = uname(&unameInfo);
+ if(errorFlag == 0)
+ {
+ this->Hostname = unameInfo.nodename;
+ }
+#endif
+ }
return this->Hostname.c_str();
}
+/** Get the FQDN */
+int SystemInformationImplementation::GetFullyQualifiedDomainName(
+ kwsys_stl::string &fqdn)
+{
+ // in the event of absolute failure return localhost.
+ fqdn="localhost";
+
+#if defined(_WIN32)
+ int ierr;
+ // TODO - a more robust implementation for windows, see comments
+ // in unix implementation.
+ WSADATA wsaData;
+ WORD ver=MAKEWORD(2,0);
+ ierr=WSAStartup(ver,&wsaData);
+ if (ierr)
+ {
+ return -1;
+ }
+
+ char base[256]={'\0'};
+ ierr=gethostname(base,256);
+ if (ierr)
+ {
+ WSACleanup();
+ return -2;
+ }
+ fqdn=base;
+
+ HOSTENT *hent=gethostbyname(base);
+ if (hent)
+ {
+ fqdn=hent->h_name;
+ }
+
+ WSACleanup();
+ return 0;
+
+#elif defined(KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN)
+ // gethostname typical returns an alias for loopback interface
+ // we want the fully qualified domain name. Because there are
+ // any number of interfaces on this system we look for the
+ // first of these that contains the name returned by gethostname
+ // and is longer. failing that we return gethostname and indicate
+ // with a failure code. Return of a failure code is not necessarilly
+ // an indication of an error. for instance gethostname may return
+ // the fully qualified domain name, or there may not be one if the
+ // system lives on a private network such as in the case of a cluster
+ // node.
+
+ int ierr=0;
+ char base[NI_MAXHOST];
+ ierr=gethostname(base,NI_MAXHOST);
+ if (ierr)
+ {
+ return -1;
+ }
+ size_t baseSize=strlen(base);
+ fqdn=base;
+
+ struct ifaddrs *ifas;
+ struct ifaddrs *ifa;
+ ierr=getifaddrs(&ifas);
+ if (ierr)
+ {
+ return -2;
+ }
+
+ for (ifa=ifas; ifa!=NULL; ifa=ifa->ifa_next)
+ {
+ int fam = ifa->ifa_addr? ifa->ifa_addr->sa_family : -1;
+ if ((fam==AF_INET) || (fam==AF_INET6))
+ {
+ char host[NI_MAXHOST]={'\0'};
+
+ int addrlen
+ = (fam==AF_INET?sizeof(struct sockaddr_in):sizeof(struct sockaddr_in6));
+
+ ierr=getnameinfo(
+ ifa->ifa_addr,
+ addrlen,
+ host,
+ NI_MAXHOST,
+ NULL,
+ 0,
+ NI_NAMEREQD);
+ if (ierr)
+ {
+ // don't report the failure now since we may succeed on another
+ // interface. If all attempts fail then return the failure code.
+ ierr=-3;
+ continue;
+ }
+
+ kwsys_stl::string candidate=host;
+ if ((candidate.find(base)!=kwsys_stl::string::npos) && baseSize<candidate.size())
+ {
+ // success, stop now.
+ ierr=0;
+ fqdn=candidate;
+ break;
+ }
+ }
+ }
+ freeifaddrs(ifas);
+
+ return ierr;
+#else
+ /* TODO: Implement on more platforms. */
+ fqdn=this->GetHostname();
+ return -1;
+#endif
+}
+
/** Get the OS release */
const char* SystemInformationImplementation::GetOSRelease()
{
@@ -721,9 +1444,15 @@ kwsys_stl::string SystemInformationImplementation::GetModelID()
return str.str();
}
+// Return the model name of CPU present */
+kwsys_stl::string SystemInformationImplementation::GetModelName()
+{
+ return this->ChipID.ModelName;
+}
+
/** Return the stepping code of the CPU present. */
kwsys_stl::string SystemInformationImplementation::GetSteppingCode()
-{
+{
kwsys_ios::ostringstream str;
str << this->ChipID.Revision;
return str.str();
@@ -734,8 +1463,8 @@ const char * SystemInformationImplementation::GetExtendedProcessorName()
{
return this->ChipID.ProcessorName.c_str();
}
-
-/** Return the serial number of the processor
+
+/** Return the serial number of the processor
* in hexadecimal: xxxx-xxxx-xxxx-xxxx-xxxx-xxxx. */
const char * SystemInformationImplementation::GetProcessorSerialNumber()
{
@@ -870,7 +1599,7 @@ void SystemInformationImplementation::Delay(unsigned int uiMS)
QueryPerformanceCounter (&StartCounter);
do {
- // Get the ending position of the counter.
+ // Get the ending position of the counter.
QueryPerformanceCounter (&EndCounter);
} while (EndCounter.QuadPart - StartCounter.QuadPart < x);
#endif
@@ -893,7 +1622,7 @@ bool SystemInformationImplementation::DoesCPUSupportCPUID()
push ecx
push edx
#endif
- ; <<CPUID>>
+ ; <<CPUID>>
mov eax, 0
CPUID_INSTRUCTION
@@ -905,7 +1634,7 @@ bool SystemInformationImplementation::DoesCPUSupportCPUID()
#endif
}
}
- __except(1)
+ __except(1)
{
// Stop the class from trying to use CPUID again!
return false;
@@ -939,7 +1668,7 @@ bool SystemInformationImplementation::RetrieveCPUFeatures()
push ecx
push edx
#endif
- ; <<CPUID>>
+ ; <<CPUID>>
; eax = 1 --> eax: CPU ID - bits 31..16 - unused, bits 15..12 - type, bits 11..8 - family, bits 7..4 - model, bits 3..0 - mask revision
; ebx: 31..24 - default APIC ID, 23..16 - logical processsor ID, 15..8 - CFLUSH chunk size , 7..0 - brand ID
; edx: CPU feature flags
@@ -956,7 +1685,7 @@ bool SystemInformationImplementation::RetrieveCPUFeatures()
#endif
}
}
- __except(1)
+ __except(1)
{
return false;
}
@@ -977,39 +1706,39 @@ bool SystemInformationImplementation::RetrieveCPUFeatures()
// Retrieve extended SSE capabilities if SSE is available.
if (this->Features.HasSSE) {
-
+
// Attempt to __try some SSE FP instructions.
- __try
+ __try
{
// Perform: orps xmm0, xmm0
- _asm
+ _asm
{
_emit 0x0f
_emit 0x56
- _emit 0xc0
+ _emit 0xc0
}
// SSE FP capable processor.
this->Features.HasSSEFP = true;
- }
- __except(1)
+ }
+ __except(1)
{
// bad instruction - processor or OS cannot handle SSE FP.
this->Features.HasSSEFP = false;
}
- }
- else
+ }
+ else
{
// Set the advanced SSE capabilities to not available.
this->Features.HasSSEFP = false;
}
// Retrieve Intel specific extended features.
- if (this->ChipManufacturer == Intel)
+ if (this->ChipManufacturer == Intel)
{
this->Features.ExtendedFeatures.SupportsHyperthreading = ((localCPUFeatures & 0x10000000) != 0); // Intel specific: Hyperthreading --> Bit 28
this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical = (this->Features.ExtendedFeatures.SupportsHyperthreading) ? ((localCPUAdvanced & 0x00FF0000) >> 16) : 1;
-
+
if ((this->Features.ExtendedFeatures.SupportsHyperthreading) && (this->Features.HasAPIC))
{
// Retrieve APIC information if there is one present.
@@ -1054,9 +1783,9 @@ bool SystemInformationImplementation::RetrieveCPUIdentity()
int localCPUSignature;
// Use assembly to detect CPUID information...
- __try
+ __try
{
- _asm
+ _asm
{
#ifdef CPUID_AWARE_COMPILER
; we must push/pop the registers <<CPUID>> writes to, as the
@@ -1078,7 +1807,7 @@ bool SystemInformationImplementation::RetrieveCPUIdentity()
mov localCPUVendor[1 * TYPE int], edx
mov localCPUVendor[2 * TYPE int], ecx
- ; <<CPUID>>
+ ; <<CPUID>>
; eax = 1 --> eax: CPU ID - bits 31..16 - unused, bits 15..12 - type, bits 11..8 - family, bits 7..4 - model, bits 3..0 - mask revision
; ebx: 31..24 - default APIC ID, 23..16 - logical processsor ID, 15..8 - CFLUSH chunk size , 7..0 - brand ID
; edx: CPU feature flags
@@ -1094,7 +1823,7 @@ bool SystemInformationImplementation::RetrieveCPUIdentity()
#endif
}
}
- __except(1)
+ __except(1)
{
return false;
}
@@ -1133,12 +1862,12 @@ bool SystemInformationImplementation::RetrieveCPUCacheDetails()
int L2Cache[4] = { 0, 0, 0, 0 };
// Check to see if what we are about to do is supported...
- if (RetrieveCPUExtendedLevelSupport (0x80000005))
+ if (RetrieveCPUExtendedLevelSupport (0x80000005))
{
// Use assembly to retrieve the L1 cache information ...
- __try
+ __try
{
- _asm
+ _asm
{
#ifdef CPUID_AWARE_COMPILER
; we must push/pop the registers <<CPUID>> writes to, as the
@@ -1169,27 +1898,27 @@ bool SystemInformationImplementation::RetrieveCPUCacheDetails()
#endif
}
}
- __except(1)
+ __except(1)
{
return false;
}
// Save the L1 data cache size (in KB) from ecx: bits 31..24 as well as data cache size from edx: bits 31..24.
this->Features.L1CacheSize = ((L1Cache[2] & 0xFF000000) >> 24);
this->Features.L1CacheSize += ((L1Cache[3] & 0xFF000000) >> 24);
- }
- else
+ }
+ else
{
// Store -1 to indicate the cache could not be queried.
this->Features.L1CacheSize = -1;
}
// Check to see if what we are about to do is supported...
- if (RetrieveCPUExtendedLevelSupport (0x80000006))
+ if (RetrieveCPUExtendedLevelSupport (0x80000006))
{
// Use assembly to retrieve the L2 cache information ...
- __try
+ __try
{
- _asm
+ _asm
{
#ifdef CPUID_AWARE_COMPILER
; we must push/pop the registers <<CPUID>> writes to, as the
@@ -1220,19 +1949,19 @@ bool SystemInformationImplementation::RetrieveCPUCacheDetails()
#endif
}
}
- __except(1)
+ __except(1)
{
return false;
}
// Save the L2 unified cache size (in KB) from ecx: bits 31..16.
this->Features.L2CacheSize = ((L2Cache[2] & 0xFFFF0000) >> 16);
- }
+ }
else
{
// Store -1 to indicate the cache could not be queried.
this->Features.L2CacheSize = -1;
}
-
+
// Define L3 as being not present as we cannot test for it.
this->Features.L3CacheSize = -1;
@@ -1294,10 +2023,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUCacheDetails()
int bob = ((TLBCacheData[0] & 0x00FF0000) >> 16);
(void)bob;
// Process the returned TLB and cache information.
- for (int nCounter = 0; nCounter < TLBCACHE_INFO_UNITS; nCounter ++)
+ for (int nCounter = 0; nCounter < TLBCACHE_INFO_UNITS; nCounter ++)
{
// First of all - decide which unit we are dealing with.
- switch (nCounter)
+ switch (nCounter)
{
// eax: bits 8..15 : bits 16..23 : bits 24..31
case 0: TLBCacheUnit = ((TLBCacheData[0] & 0x0000FF00) >> 8); break;
@@ -1327,7 +2056,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUCacheDetails()
}
// Now process the resulting unit to see what it means....
- switch (TLBCacheUnit)
+ switch (TLBCacheUnit)
{
case 0x00: break;
case 0x01: STORE_TLBCACHE_INFO (TLBCode, 4); break;
@@ -1383,7 +2112,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUCacheDetails()
case 0x90: STORE_TLBCACHE_INFO (TLBCode, 262144); break; // <-- FIXME: IA-64 Only
case 0x96: STORE_TLBCACHE_INFO (TLBCode, 262144); break; // <-- FIXME: IA-64 Only
case 0x9b: STORE_TLBCACHE_INFO (TLBCode, 262144); break; // <-- FIXME: IA-64 Only
-
+
// Default case - an error has occured.
default: return false;
}
@@ -1394,47 +2123,47 @@ bool SystemInformationImplementation::RetrieveClassicalCPUCacheDetails()
} while ((TLBCacheData[0] & 0x000000FF) > TLBPassCounter);
// Ok - we now have the maximum TLB, L1, L2, and L3 sizes...
- if ((L1Code == -1) && (L1Data == -1) && (L1Trace == -1))
+ if ((L1Code == -1) && (L1Data == -1) && (L1Trace == -1))
{
this->Features.L1CacheSize = -1;
}
- else if ((L1Code == -1) && (L1Data == -1) && (L1Trace != -1))
+ else if ((L1Code == -1) && (L1Data == -1) && (L1Trace != -1))
{
this->Features.L1CacheSize = L1Trace;
}
- else if ((L1Code != -1) && (L1Data == -1))
+ else if ((L1Code != -1) && (L1Data == -1))
{
this->Features.L1CacheSize = L1Code;
}
- else if ((L1Code == -1) && (L1Data != -1))
+ else if ((L1Code == -1) && (L1Data != -1))
{
this->Features.L1CacheSize = L1Data;
}
- else if ((L1Code != -1) && (L1Data != -1))
+ else if ((L1Code != -1) && (L1Data != -1))
{
this->Features.L1CacheSize = L1Code + L1Data;
}
- else
+ else
{
this->Features.L1CacheSize = -1;
}
// Ok - we now have the maximum TLB, L1, L2, and L3 sizes...
- if (L2Unified == -1)
+ if (L2Unified == -1)
{
this->Features.L2CacheSize = -1;
}
- else
+ else
{
this->Features.L2CacheSize = L2Unified;
}
// Ok - we now have the maximum TLB, L1, L2, and L3 sizes...
- if (L3Unified == -1)
+ if (L3Unified == -1)
{
this->Features.L3CacheSize = -1;
}
- else
+ else
{
this->Features.L3CacheSize = L3Unified;
}
@@ -1526,19 +2255,19 @@ bool SystemInformationImplementation::RetrieveClassicalCPUClockSpeed()
// Attempt to get a starting tick count.
QueryPerformanceCounter (&liStart);
- __try
+ __try
{
- _asm
+ _asm
{
mov eax, 0x80000000
mov ebx, CLASSICAL_CPU_FREQ_LOOP
- Timer_Loop:
+ Timer_Loop:
bsf ecx,eax
dec ebx
jnz Timer_Loop
- }
+ }
}
- __except(1)
+ __except(1)
{
return false;
}
@@ -1551,22 +2280,22 @@ bool SystemInformationImplementation::RetrieveClassicalCPUClockSpeed()
dDifference = (((double) liEnd.QuadPart - (double) liStart.QuadPart) / (double) liCountsPerSecond.QuadPart);
// Calculate the clock speed.
- if (this->ChipID.Family == 3)
+ if (this->ChipID.Family == 3)
{
// 80386 processors.... Loop time is 115 cycles!
dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 115) / dDifference) / 1000000);
- }
- else if (this->ChipID.Family == 4)
+ }
+ else if (this->ChipID.Family == 4)
{
// 80486 processors.... Loop time is 47 cycles!
dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 47) / dDifference) / 1000000);
- }
- else if (this->ChipID.Family == 5)
+ }
+ else if (this->ChipID.Family == 5)
{
// Pentium processors.... Loop time is 43 cycles!
dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 43) / dDifference) / 1000000);
}
-
+
// Save the clock speed.
this->Features.CPUSpeed = (int) dFrequency;
@@ -1583,7 +2312,7 @@ bool SystemInformationImplementation::RetrieveCPUExtendedLevelSupport(int CPULev
{
int MaxCPUExtendedLevel = 0;
- // The extended CPUID is supported by various vendors starting with the following CPU models:
+ // The extended CPUID is supported by various vendors starting with the following CPU models:
//
// Manufacturer & Chip Name | Family Model Revision
//
@@ -1596,27 +2325,27 @@ bool SystemInformationImplementation::RetrieveCPUExtendedLevelSupport(int CPULev
//
// We check to see if a supported processor is present...
- if (this->ChipManufacturer == AMD)
+ if (this->ChipManufacturer == AMD)
{
if (this->ChipID.Family < 5) return false;
if ((this->ChipID.Family == 5) && (this->ChipID.Model < 6)) return false;
- }
- else if (this->ChipManufacturer == Cyrix)
+ }
+ else if (this->ChipManufacturer == Cyrix)
{
if (this->ChipID.Family < 5) return false;
if ((this->ChipID.Family == 5) && (this->ChipID.Model < 4)) return false;
if ((this->ChipID.Family == 6) && (this->ChipID.Model < 5)) return false;
- }
- else if (this->ChipManufacturer == IDT)
+ }
+ else if (this->ChipManufacturer == IDT)
{
if (this->ChipID.Family < 5) return false;
if ((this->ChipID.Family == 5) && (this->ChipID.Model < 8)) return false;
- }
- else if (this->ChipManufacturer == Transmeta)
+ }
+ else if (this->ChipManufacturer == Transmeta)
{
if (this->ChipID.Family < 5) return false;
- }
- else if (this->ChipManufacturer == Intel)
+ }
+ else if (this->ChipManufacturer == Intel)
{
if (this->ChipID.Family < 0xf)
{
@@ -1638,7 +2367,7 @@ bool SystemInformationImplementation::RetrieveCPUExtendedLevelSupport(int CPULev
push ecx
push edx
#endif
- ; <<CPUID>>
+ ; <<CPUID>>
; eax = 0x80000000 --> eax: maximum supported extended level
mov eax,0x80000000
CPUID_INSTRUCTION
@@ -1652,7 +2381,7 @@ bool SystemInformationImplementation::RetrieveCPUExtendedLevelSupport(int CPULev
#endif
}
}
- __except(1)
+ __except(1)
{
return false;
}
@@ -1677,7 +2406,7 @@ bool SystemInformationImplementation::RetrieveExtendedCPUFeatures()
{
// Check that we are not using an Intel processor as it does not support this.
- if (this->ChipManufacturer == Intel)
+ if (this->ChipManufacturer == Intel)
{
return false;
}
@@ -1692,9 +2421,9 @@ bool SystemInformationImplementation::RetrieveExtendedCPUFeatures()
int localCPUExtendedFeatures = 0;
// Use assembly to detect CPUID information...
- __try
+ __try
{
- _asm
+ _asm
{
#ifdef CPUID_AWARE_COMPILER
; we must push/pop the registers <<CPUID>> writes to, as the
@@ -1705,7 +2434,7 @@ bool SystemInformationImplementation::RetrieveExtendedCPUFeatures()
push ecx
push edx
#endif
- ; <<CPUID>>
+ ; <<CPUID>>
; eax = 0x80000001 --> eax: CPU ID - bits 31..16 - unused, bits 15..12 - type, bits 11..8 - family, bits 7..4 - model, bits 3..0 - mask revision
; ebx: 31..24 - default APIC ID, 23..16 - logical processsor ID, 15..8 - CFLUSH chunk size , 7..0 - brand ID
; edx: CPU feature flags
@@ -1721,7 +2450,7 @@ bool SystemInformationImplementation::RetrieveExtendedCPUFeatures()
#endif
}
}
- __except(1)
+ __except(1)
{
return false;
}
@@ -1731,15 +2460,15 @@ bool SystemInformationImplementation::RetrieveExtendedCPUFeatures()
this->Features.ExtendedFeatures.Has3DNowPlus = ((localCPUExtendedFeatures & 0x40000000) != 0); // 3DNow+ Present -- > Bit 30.
this->Features.ExtendedFeatures.HasSSEMMX = ((localCPUExtendedFeatures & 0x00400000) != 0); // SSE MMX Present --> Bit 22.
this->Features.ExtendedFeatures.SupportsMP = ((localCPUExtendedFeatures & 0x00080000) != 0); // MP Capable -- > Bit 19.
-
+
// Retrieve AMD specific extended features.
- if (this->ChipManufacturer == AMD)
+ if (this->ChipManufacturer == AMD)
{
this->Features.ExtendedFeatures.HasMMXPlus = ((localCPUExtendedFeatures & 0x00400000) != 0); // AMD specific: MMX-SSE --> Bit 22
}
// Retrieve Cyrix specific extended features.
- if (this->ChipManufacturer == Cyrix)
+ if (this->ChipManufacturer == Cyrix)
{
this->Features.ExtendedFeatures.HasMMXPlus = ((localCPUExtendedFeatures & 0x01000000) != 0); // Cyrix specific: Extended MMX --> Bit 24
}
@@ -1794,7 +2523,7 @@ bool SystemInformationImplementation::RetrieveProcessorSerialNumber()
#endif
}
}
- __except(1)
+ __except(1)
{
return false;
}
@@ -1851,12 +2580,12 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement()
push ecx
push edx
#endif
- ; <<CPUID>>
+ ; <<CPUID>>
; eax = 0x80000007 --> edx: get processor power management
mov eax,0x80000007
CPUID_INSTRUCTION
mov localCPUPowerManagement, edx
-
+
#ifdef CPUID_AWARE_COMPILER
pop edx
pop ecx
@@ -1865,7 +2594,7 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement()
#endif
}
}
- __except(1)
+ __except(1)
{
return false;
}
@@ -1918,7 +2647,7 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
push ecx
push edx
#endif
- ; <<CPUID>>
+ ; <<CPUID>>
; eax = 0x80000002 --> eax, ebx, ecx, edx: get processor name string (part 1)
mov eax,0x80000002
CPUID_INSTRUCTION
@@ -1927,7 +2656,7 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
mov CPUExtendedIdentity[2 * TYPE int], ecx
mov CPUExtendedIdentity[3 * TYPE int], edx
- ; <<CPUID>>
+ ; <<CPUID>>
; eax = 0x80000003 --> eax, ebx, ecx, edx: get processor name string (part 2)
mov eax,0x80000003
CPUID_INSTRUCTION
@@ -1936,7 +2665,7 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
mov CPUExtendedIdentity[6 * TYPE int], ecx
mov CPUExtendedIdentity[7 * TYPE int], edx
- ; <<CPUID>>
+ ; <<CPUID>>
; eax = 0x80000004 --> eax, ebx, ecx, edx: get processor name string (part 3)
mov eax,0x80000004
CPUID_INSTRUCTION
@@ -1953,7 +2682,7 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
#endif
}
}
- __except(1)
+ __except(1)
{
return false;
}
@@ -1974,6 +2703,7 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
memcpy (&(nbuf[44]), &(CPUExtendedIdentity[11]), sizeof (int));
nbuf[48] = '\0';
this->ChipID.ProcessorName = nbuf;
+ this->ChipID.ModelName = nbuf;
// Because some manufacturers have leading white space - we have to post-process the name.
SystemInformationStripLeadingSpace(this->ChipID.ProcessorName);
@@ -1988,13 +2718,13 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
{
// Start by decided which manufacturer we are using....
- switch (this->ChipManufacturer)
+ switch (this->ChipManufacturer)
{
case Intel:
// Check the family / model / revision to determine the CPU ID.
switch (this->ChipID.Family) {
case 3:
- this->ChipID.ProcessorName = "Newer i80386 family";
+ this->ChipID.ProcessorName = "Newer i80386 family";
break;
case 4:
switch (this->ChipID.Model) {
@@ -2011,7 +2741,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
}
break;
case 5:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 0: this->ChipID.ProcessorName = "P5 A-Step"; break;
case 1: this->ChipID.ProcessorName = "P5"; break;
@@ -2024,7 +2754,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
}
break;
case 6:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 0: this->ChipID.ProcessorName = "P6 A-Step"; break;
case 1: this->ChipID.ProcessorName = "P6"; break;
@@ -2044,10 +2774,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
break;
case 0xf:
// Check the extended family bits...
- switch (this->ChipID.ExtendedFamily)
+ switch (this->ChipID.ExtendedFamily)
{
case 0:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 0: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break;
case 1: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break;
@@ -2070,10 +2800,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
case AMD:
// Check the family / model / revision to determine the CPU ID.
- switch (this->ChipID.Family)
+ switch (this->ChipID.Family)
{
case 4:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 3: this->ChipID.ProcessorName = "80486DX2"; break;
case 7: this->ChipID.ProcessorName = "80486DX2 WriteBack"; break;
@@ -2085,7 +2815,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
}
break;
case 5:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 0: this->ChipID.ProcessorName = "SSA5 (PR75, PR90 = PR100)"; break;
case 1: this->ChipID.ProcessorName = "5k86 (PR120 = PR133)"; break;
@@ -2100,7 +2830,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
}
break;
case 6:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 1: this->ChipID.ProcessorName = "Athlon- (0.25 micron)"; break;
case 2: this->ChipID.ProcessorName = "Athlon- (0.18 micron)"; break;
@@ -2108,9 +2838,9 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
case 4: this->ChipID.ProcessorName = "Athlon- (Thunderbird core)"; break;
case 6: this->ChipID.ProcessorName = "Athlon- (Palomino core)"; break;
case 7: this->ChipID.ProcessorName = "Duron- (Morgan core)"; break;
- case 8:
+ case 8:
if (this->Features.ExtendedFeatures.SupportsMP)
- this->ChipID.ProcessorName = "Athlon - MP (Thoroughbred core)";
+ this->ChipID.ProcessorName = "Athlon - MP (Thoroughbred core)";
else this->ChipID.ProcessorName = "Athlon - XP (Thoroughbred core)";
break;
default: this->ChipID.ProcessorName = "Unknown K7 family"; return false;
@@ -2123,10 +2853,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
break;
case Transmeta:
- switch (this->ChipID.Family)
- {
+ switch (this->ChipID.Family)
+ {
case 5:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 4: this->ChipID.ProcessorName = "Crusoe TM3x00 and TM5x00"; break;
default: this->ChipID.ProcessorName = "Unknown Crusoe family"; return false;
@@ -2139,10 +2869,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
break;
case Rise:
- switch (this->ChipID.Family)
- {
+ switch (this->ChipID.Family)
+ {
case 5:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 0: this->ChipID.ProcessorName = "mP6 (0.25 micron)"; break;
case 2: this->ChipID.ProcessorName = "mP6 (0.18 micron)"; break;
@@ -2156,10 +2886,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
break;
case UMC:
- switch (this->ChipID.Family)
- {
+ switch (this->ChipID.Family)
+ {
case 4:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 1: this->ChipID.ProcessorName = "U5D"; break;
case 2: this->ChipID.ProcessorName = "U5S"; break;
@@ -2173,10 +2903,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
break;
case IDT:
- switch (this->ChipID.Family)
- {
+ switch (this->ChipID.Family)
+ {
case 5:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 4: this->ChipID.ProcessorName = "C6"; break;
case 8: this->ChipID.ProcessorName = "C2"; break;
@@ -2185,7 +2915,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
}
break;
case 6:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 6: this->ChipID.ProcessorName = "VIA Cyrix III - Samuel"; break;
default: this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false;
@@ -2198,10 +2928,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
break;
case Cyrix:
- switch (this->ChipID.Family)
- {
+ switch (this->ChipID.Family)
+ {
case 4:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 4: this->ChipID.ProcessorName = "MediaGX GX = GXm"; break;
case 9: this->ChipID.ProcessorName = "5x86"; break;
@@ -2209,7 +2939,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
}
break;
case 5:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 2: this->ChipID.ProcessorName = "Cx6x86"; break;
case 4: this->ChipID.ProcessorName = "MediaGX GXm"; break;
@@ -2217,7 +2947,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
}
break;
case 6:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 0: this->ChipID.ProcessorName = "6x86MX"; break;
case 5: this->ChipID.ProcessorName = "Cyrix M2 Core"; break;
@@ -2234,10 +2964,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
break;
case NexGen:
- switch (this->ChipID.Family)
- {
+ switch (this->ChipID.Family)
+ {
case 5:
- switch (this->ChipID.Model)
+ switch (this->ChipID.Model)
{
case 0: this->ChipID.ProcessorName = "Nx586 or Nx586FPU"; break;
default: this->ChipID.ProcessorName = "Unknown NexGen family"; return false;
@@ -2287,12 +3017,12 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
kwsys_stl::string buffer;
FILE *fd = fopen("/proc/cpuinfo", "r" );
- if ( !fd )
+ if ( !fd )
{
kwsys_ios::cout << "Problem opening /proc/cpuinfo" << kwsys_ios::endl;
return 0;
}
-
+
size_t fileSize = 0;
while(!feof(fd))
{
@@ -2336,13 +3066,13 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
#else // __CYGWIN__
// does not have "physical id" entries, neither "cpu cores"
- // this has to be fixed for hyper-threading.
+ // this has to be fixed for hyper-threading.
kwsys_stl::string cpucount =
this->ExtractValueFromCpuInfoFile(buffer,"cpu count");
this->NumberOfPhysicalCPU=
this->NumberOfLogicalCPU = atoi(cpucount.c_str());
#endif
- // gotta have one, and if this is 0 then we get a / by 0n
+ // gotta have one, and if this is 0 then we get a / by 0n
// beter to have a bad answer than a crash
if(this->NumberOfPhysicalCPU <= 0)
{
@@ -2358,15 +3088,18 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
// Chip family
this->ChipID.Family = atoi(this->ExtractValueFromCpuInfoFile(buffer,"cpu family").c_str());
-
+
// Chip Vendor
this->ChipID.Vendor = this->ExtractValueFromCpuInfoFile(buffer,"vendor_id");
this->FindManufacturer();
-
+
// Chip Model
this->ChipID.Model = atoi(this->ExtractValueFromCpuInfoFile(buffer,"model").c_str());
this->RetrieveClassicalCPUIdentity();
+ // Chip Model Name
+ this->ChipID.ModelName = this->ExtractValueFromCpuInfoFile(buffer,"model name").c_str();
+
// L1 Cache size
kwsys_stl::string cacheSize = this->ExtractValueFromCpuInfoFile(buffer,"cache size");
pos = cacheSize.find(" KB");
@@ -2378,6 +3111,333 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
return 1;
}
+/**
+Get total system RAM in units of KiB.
+*/
+SystemInformation::LongLong
+SystemInformationImplementation::GetHostMemoryTotal()
+{
+#if defined(_WIN32)
+# if defined(_MSC_VER) && _MSC_VER < 1300
+ MEMORYSTATUS stat;
+ stat.dwLength = sizeof(stat);
+ GlobalMemoryStatus(&stat);
+ return stat.dwTotalPhys/1024;
+# else
+ MEMORYSTATUSEX statex;
+ statex.dwLength=sizeof(statex);
+ GlobalMemoryStatusEx(&statex);
+ return statex.ullTotalPhys/1024;
+# endif
+#elif defined(__linux)
+ SystemInformation::LongLong memTotal=0;
+ int ierr=GetFieldFromFile("/proc/meminfo","MemTotal:",memTotal);
+ if (ierr)
+ {
+ return -1;
+ }
+ return memTotal;
+#elif defined(__APPLE__)
+ uint64_t mem;
+ size_t len = sizeof(mem);
+ int ierr=sysctlbyname("hw.memsize", &mem, &len, NULL, 0);
+ if (ierr)
+ {
+ return -1;
+ }
+ return mem/1024;
+#else
+ return 0;
+#endif
+}
+
+/**
+Get total system RAM in units of KiB. This may differ from the
+host total if a host-wide resource limit is applied.
+*/
+SystemInformation::LongLong
+SystemInformationImplementation::GetHostMemoryAvailable(const char *hostLimitEnvVarName)
+{
+ SystemInformation::LongLong memTotal=this->GetHostMemoryTotal();
+
+ // the following mechanism is provided for systems that
+ // apply resource limits across groups of processes.
+ // this is of use on certain SMP systems (eg. SGI UV)
+ // where the host has a large amount of ram but a given user's
+ // access to it is severly restricted. The system will
+ // apply a limit across a set of processes. Units are in KiB.
+ if (hostLimitEnvVarName)
+ {
+ const char *hostLimitEnvVarValue=getenv(hostLimitEnvVarName);
+ if (hostLimitEnvVarValue)
+ {
+ SystemInformation::LongLong hostLimit=atoLongLong(hostLimitEnvVarValue);
+ if (hostLimit>0)
+ {
+ memTotal=min(hostLimit,memTotal);
+ }
+ }
+ }
+
+ return memTotal;
+}
+
+/**
+Get total system RAM in units of KiB. This may differ from the
+host total if a per-process resource limit is applied.
+*/
+SystemInformation::LongLong
+SystemInformationImplementation::GetProcMemoryAvailable(
+ const char *hostLimitEnvVarName,
+ const char *procLimitEnvVarName)
+{
+ SystemInformation::LongLong memAvail
+ = this->GetHostMemoryAvailable(hostLimitEnvVarName);
+
+ // the following mechanism is provide for systems where rlimits
+ // are not employed. Units are in KiB.
+ if (procLimitEnvVarName)
+ {
+ const char *procLimitEnvVarValue=getenv(procLimitEnvVarName);
+ if (procLimitEnvVarValue)
+ {
+ SystemInformation::LongLong procLimit=atoLongLong(procLimitEnvVarValue);
+ if (procLimit>0)
+ {
+ memAvail=min(procLimit,memAvail);
+ }
+ }
+ }
+
+#if defined(__linux)
+ int ierr;
+ ResourceLimitType rlim;
+ ierr=GetResourceLimit(RLIMIT_DATA,&rlim);
+ if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY))
+ {
+ memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail);
+ }
+
+ ierr=GetResourceLimit(RLIMIT_AS,&rlim);
+ if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY))
+ {
+ memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail);
+ }
+#elif defined(__APPLE__)
+ struct rlimit rlim;
+ int ierr;
+ ierr=getrlimit(RLIMIT_DATA,&rlim);
+ if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY))
+ {
+ memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail);
+ }
+
+ ierr=getrlimit(RLIMIT_RSS,&rlim);
+ if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY))
+ {
+ memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail);
+ }
+#endif
+
+ return memAvail;
+}
+
+/**
+Get RAM used by all processes in the host, in units of KiB.
+*/
+SystemInformation::LongLong
+SystemInformationImplementation::GetHostMemoryUsed()
+{
+#if defined(_WIN32)
+# if defined(_MSC_VER) && _MSC_VER < 1300
+ MEMORYSTATUS stat;
+ stat.dwLength = sizeof(stat);
+ GlobalMemoryStatus(&stat);
+ return (stat.dwTotalPhys - stat.dwAvailPhys)/1024;
+# else
+ MEMORYSTATUSEX statex;
+ statex.dwLength=sizeof(statex);
+ GlobalMemoryStatusEx(&statex);
+ return (statex.ullTotalPhys - statex.ullAvailPhys)/1024;
+# endif
+#elif defined(__linux)
+ const char *names[3]={"MemTotal:","MemFree:",NULL};
+ SystemInformation::LongLong values[2]={SystemInformation::LongLong(0)};
+ int ierr=GetFieldsFromFile("/proc/meminfo",names,values);
+ if (ierr)
+ {
+ return ierr;
+ }
+ SystemInformation::LongLong &memTotal=values[0];
+ SystemInformation::LongLong &memFree=values[1];
+ return memTotal - memFree;
+#elif defined(__APPLE__)
+ SystemInformation::LongLong psz=getpagesize();
+ if (psz<1)
+ {
+ return -1;
+ }
+ const char *names[4]={"Pages active:","Pages inactive:","Pages wired down:",NULL};
+ SystemInformation::LongLong values[3]={SystemInformation::LongLong(0)};
+ int ierr=GetFieldsFromCommand("vm_stat", names, values);
+ if (ierr)
+ {
+ return -1;
+ }
+ SystemInformation::LongLong &vmActive=values[0];
+ SystemInformation::LongLong &vmInactive=values[1];
+ SystemInformation::LongLong &vmWired=values[2];
+ return ((vmActive+vmInactive+vmWired)*psz)/1024;
+#else
+ return 0;
+#endif
+}
+
+/**
+Get system RAM used by the process associated with the given
+process id in units of KiB.
+*/
+SystemInformation::LongLong
+SystemInformationImplementation::GetProcMemoryUsed()
+{
+#if defined(_WIN32) && defined(KWSYS_SYS_HAS_PSAPI)
+ long pid=GetCurrentProcessId();
+ HANDLE hProc;
+ hProc=OpenProcess(
+ PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,
+ false,
+ pid);
+ if (hProc==0)
+ {
+ return -1;
+ }
+ PROCESS_MEMORY_COUNTERS pmc;
+ int ok=GetProcessMemoryInfo(hProc,&pmc,sizeof(pmc));
+ CloseHandle(hProc);
+ if (!ok)
+ {
+ return -2;
+ }
+ return pmc.WorkingSetSize/1024;
+#elif defined(__linux)
+ SystemInformation::LongLong memUsed=0;
+ int ierr=GetFieldFromFile("/proc/self/status","VmRSS:",memUsed);
+ if (ierr)
+ {
+ return -1;
+ }
+ return memUsed;
+#elif defined(__APPLE__)
+ SystemInformation::LongLong memUsed=0;
+ pid_t pid=getpid();
+ kwsys_ios::ostringstream oss;
+ oss << "ps -o rss= -p " << pid;
+ FILE *file=popen(oss.str().c_str(),"r");
+ if (file==0)
+ {
+ return -1;
+ }
+ oss.str("");
+ while (!feof(file) && !ferror(file))
+ {
+ char buf[256]={'\0'};
+ errno=0;
+ size_t nRead=fread(buf,1,256,file);
+ if (ferror(file) && (errno==EINTR))
+ {
+ clearerr(file);
+ }
+ if (nRead) oss << buf;
+ }
+ int ierr=ferror(file);
+ pclose(file);
+ if (ierr)
+ {
+ return -2;
+ }
+ kwsys_ios::istringstream iss(oss.str());
+ iss >> memUsed;
+ return memUsed;
+#else
+ return 0;
+#endif
+}
+
+/**
+Get the process id of the running process.
+*/
+SystemInformation::LongLong
+SystemInformationImplementation::GetProcessId()
+{
+#if defined(_WIN32)
+ return GetCurrentProcessId();
+#elif defined(__linux) || defined(__APPLE__)
+ return getpid();
+#else
+ return -1;
+#endif
+}
+
+/**
+when set print stack trace in response to common signals.
+*/
+void SystemInformationImplementation::SetStackTraceOnError(int enable)
+{
+#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
+ static int saOrigValid=0;
+ static struct sigaction saSEGVOrig;
+ static struct sigaction saTERMOrig;
+ static struct sigaction saINTOrig;
+ static struct sigaction saILLOrig;
+ static struct sigaction saBUSOrig;
+ static struct sigaction saFPEOrig;
+
+ if (enable && !saOrigValid)
+ {
+ // save the current actions
+ sigaction(SIGSEGV,0,&saSEGVOrig);
+ sigaction(SIGTERM,0,&saTERMOrig);
+ sigaction(SIGINT,0,&saINTOrig);
+ sigaction(SIGILL,0,&saILLOrig);
+ sigaction(SIGBUS,0,&saBUSOrig);
+ sigaction(SIGFPE,0,&saFPEOrig);
+
+ // enable read, disable write
+ saOrigValid=1;
+
+ // install ours
+ struct sigaction sa;
+ sa.sa_sigaction=(SigAction)StacktraceSignalHandler;
+ sa.sa_flags=SA_SIGINFO|SA_RESTART;
+ sigemptyset(&sa.sa_mask);
+
+ sigaction(SIGSEGV,&sa,0);
+ sigaction(SIGTERM,&sa,0);
+ sigaction(SIGINT,&sa,0);
+ sigaction(SIGILL,&sa,0);
+ sigaction(SIGBUS,&sa,0);
+ sigaction(SIGFPE,&sa,0);
+ }
+ else
+ if (!enable && saOrigValid)
+ {
+ // restore previous actions
+ sigaction(SIGSEGV,&saSEGVOrig,0);
+ sigaction(SIGTERM,&saTERMOrig,0);
+ sigaction(SIGINT,&saINTOrig,0);
+ sigaction(SIGILL,&saILLOrig,0);
+ sigaction(SIGBUS,&saBUSOrig,0);
+ sigaction(SIGFPE,&saFPEOrig,0);
+
+ // enable write, disable read
+ saOrigValid=0;
+ }
+#else
+ // avoid warning C4100
+ (void)enable;
+#endif
+}
+
/** Query for the memory status */
int SystemInformationImplementation::QueryMemory()
{
@@ -2388,13 +3448,13 @@ int SystemInformationImplementation::QueryMemory()
#ifdef __CYGWIN__
return 0;
#elif defined(_WIN32)
-#if _MSC_VER < 1300
+# if defined(_MSC_VER) && _MSC_VER < 1300
MEMORYSTATUS ms;
unsigned long tv, tp, av, ap;
ms.dwLength = sizeof(ms);
GlobalMemoryStatus(&ms);
- #define MEM_VAL(value) dw##value
-#else
+# define MEM_VAL(value) dw##value
+# else
MEMORYSTATUSEX ms;
DWORDLONG tv, tp, av, ap;
ms.dwLength = sizeof(ms);
@@ -2402,8 +3462,8 @@ int SystemInformationImplementation::QueryMemory()
{
return 0;
}
-#define MEM_VAL(value) ull##value
-#endif
+# define MEM_VAL(value) ull##value
+# endif
tv = ms.MEM_VAL(TotalVirtual);
tp = ms.MEM_VAL(TotalPhys);
av = ms.MEM_VAL(AvailVirtual);
@@ -2418,12 +3478,12 @@ int SystemInformationImplementation::QueryMemory()
unsigned long tp=0;
unsigned long av=0;
unsigned long ap=0;
-
+
char buffer[1024]; // for reading lines
-
+
int linuxMajor = 0;
int linuxMinor = 0;
-
+
// Find the Linux kernel version first
struct utsname unameInfo;
int errorFlag = uname(&unameInfo);
@@ -2432,31 +3492,31 @@ int SystemInformationImplementation::QueryMemory()
kwsys_ios::cout << "Problem calling uname(): " << strerror(errno) << kwsys_ios::endl;
return 0;
}
-
+
if( unameInfo.release!=0 && strlen(unameInfo.release)>=3 )
{
// release looks like "2.6.3-15mdk-i686-up-4GB"
char majorChar=unameInfo.release[0];
char minorChar=unameInfo.release[2];
-
+
if( isdigit(majorChar) )
{
linuxMajor=majorChar-'0';
}
-
+
if( isdigit(minorChar) )
{
linuxMinor=minorChar-'0';
}
}
-
+
FILE *fd = fopen("/proc/meminfo", "r" );
- if ( !fd )
+ if ( !fd )
{
kwsys_ios::cout << "Problem opening /proc/meminfo" << kwsys_ios::endl;
return 0;
}
-
+
if( linuxMajor>=3 || ( (linuxMajor>=2) && (linuxMinor>=6) ) )
{
// new /proc/meminfo format since kernel 2.6.x
@@ -2499,7 +3559,7 @@ int SystemInformationImplementation::QueryMemory()
else
{
// /proc/meminfo format for kernel older than 2.6.x
-
+
unsigned long temp;
unsigned long cachedMem;
unsigned long buffersMem;
@@ -2537,7 +3597,7 @@ int SystemInformationImplementation::QueryMemory()
unsigned long ap=0;
struct pst_static pst;
struct pst_dynamic pdy;
-
+
unsigned long ps = 0;
if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) != -1)
{
@@ -2559,35 +3619,34 @@ int SystemInformationImplementation::QueryMemory()
#else
return 0;
#endif
-
-
}
/** */
-size_t SystemInformationImplementation::GetTotalVirtualMemory()
-{
- return this->TotalVirtualMemory;
+size_t SystemInformationImplementation::GetTotalVirtualMemory()
+{
+ return this->TotalVirtualMemory;
}
/** */
-size_t SystemInformationImplementation::GetAvailableVirtualMemory()
-{
- return this->AvailableVirtualMemory;
+size_t SystemInformationImplementation::GetAvailableVirtualMemory()
+{
+ return this->AvailableVirtualMemory;
}
-size_t SystemInformationImplementation::GetTotalPhysicalMemory()
-{
- return this->TotalPhysicalMemory;
+size_t SystemInformationImplementation::GetTotalPhysicalMemory()
+{
+ return this->TotalPhysicalMemory;
}
/** */
-size_t SystemInformationImplementation::GetAvailablePhysicalMemory()
-{
- return this->AvailablePhysicalMemory;
+size_t SystemInformationImplementation::GetAvailablePhysicalMemory()
+{
+ return this->AvailablePhysicalMemory;
}
/** Get Cycle differences */
-LongLong SystemInformationImplementation::GetCyclesDifference (DELAY_FUNC DelayFunction,
+SystemInformation::LongLong
+SystemInformationImplementation::GetCyclesDifference (DELAY_FUNC DelayFunction,
unsigned int uiParameter)
{
#if USE_ASM_INSTRUCTIONS
@@ -2619,7 +3678,7 @@ LongLong SystemInformationImplementation::GetCyclesDifference (DELAY_FUNC DelayF
mov eax1, esi ; eax2 = esi
}
}
- __except(1)
+ __except(1)
{
return -1;
}
@@ -2642,7 +3701,7 @@ void SystemInformationImplementation::DelayOverhead(unsigned int uiMS)
__int64 x;
// Get the frequency of the high performance counter.
- if(!QueryPerformanceFrequency (&Frequency))
+ if(!QueryPerformanceFrequency (&Frequency))
{
return;
}
@@ -2650,9 +3709,9 @@ void SystemInformationImplementation::DelayOverhead(unsigned int uiMS)
// Get the starting position of the counter.
QueryPerformanceCounter (&StartCounter);
-
+
do {
- // Get the ending position of the counter.
+ // Get the ending position of the counter.
QueryPerformanceCounter (&EndCounter);
} while (EndCounter.QuadPart - StartCounter.QuadPart == x);
#endif
@@ -2706,7 +3765,7 @@ unsigned int SystemInformationImplementation::IsHyperThreadingSupported()
mov VendorId, ebx
mov VendorId + 4, edx
mov VendorId + 8, ecx
-
+
mov eax, 1 // call cpuid with eax = 1
cpuid
mov Regeax, eax // eax contains family processor type
@@ -2743,7 +3802,7 @@ unsigned char SystemInformationImplementation::GetAPICId()
unsigned int Regebx = 0;
#if USE_ASM_INSTRUCTIONS
- if (!this->IsHyperThreadingSupported())
+ if (!this->IsHyperThreadingSupported())
{
return static_cast<unsigned char>(-1); // HT not supported
} // Logical processor = 1
@@ -2773,7 +3832,7 @@ int SystemInformationImplementation::CPUCount()
// Number of physical processors in a non-Intel system
// or in a 32-bit Intel system with Hyper-Threading technology disabled
- this->NumberOfPhysicalCPU = (unsigned char) info.dwNumberOfProcessors;
+ this->NumberOfPhysicalCPU = (unsigned char) info.dwNumberOfProcessors;
if (this->IsHyperThreadingSupported())
{
@@ -2789,7 +3848,7 @@ int SystemInformationImplementation::CPUCount()
DWORD_PTR dwSystemAffinity;
DWORD dwAffinityMask;
- // Calculate the appropriate shifts and mask based on the
+ // Calculate the appropriate shifts and mask based on the
// number of logical processors.
unsigned int i = 1;
unsigned char PHY_ID_MASK = 0xFF;
@@ -2801,7 +3860,7 @@ int SystemInformationImplementation::CPUCount()
PHY_ID_MASK <<= 1;
// PHY_ID_SHIFT++;
}
-
+
hCurrentProcessHandle = GetCurrentProcess();
GetProcessAffinityMask(hCurrentProcessHandle, &dwProcessAffinity,
&dwSystemAffinity);
@@ -2829,8 +3888,8 @@ int SystemInformationImplementation::CPUCount()
APIC_ID = GetAPICId();
LOG_ID = APIC_ID & ~PHY_ID_MASK;
-
- if (LOG_ID != 0)
+
+ if (LOG_ID != 0)
{
HT_Enabled = 1;
}
@@ -2840,7 +3899,7 @@ int SystemInformationImplementation::CPUCount()
}
// Reset the processor affinity
SetProcessAffinityMask(hCurrentProcessHandle, dwProcessAffinity);
-
+
if (this->NumberOfLogicalCPU == 1) // Normal P4 : HT is disabled in hardware
{
StatusFlag = HT_DISABLED;
@@ -2853,7 +3912,7 @@ int SystemInformationImplementation::CPUCount()
this->NumberOfPhysicalCPU /= (this->NumberOfLogicalCPU);
StatusFlag = HT_ENABLED;
}
- else
+ else
{
StatusFlag = HT_SUPPORTED_NOT_ENABLED;
}
@@ -2891,6 +3950,7 @@ unsigned int SystemInformationImplementation::GetNumberOfPhysicalCPU()
bool SystemInformationImplementation::ParseSysCtl()
{
#if defined(__APPLE__)
+ char retBuf[128];
int err = 0;
uint64_t value = 0;
size_t len = sizeof(value);
@@ -2901,9 +3961,10 @@ bool SystemInformationImplementation::ParseSysCtl()
this->AvailablePhysicalMemory = 0;
vm_statistics_data_t vmstat;
mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
- if ( host_statistics(mach_host_self(), HOST_VM_INFO,
+ if ( host_statistics(mach_host_self(), HOST_VM_INFO,
(host_info_t) &vmstat, &count) == KERN_SUCCESS )
{
+ len = sizeof(value);
err = sysctlbyname("hw.pagesize", &value, &len, NULL, 0);
int64_t available_memory = vmstat.free_count * value;
this->AvailablePhysicalMemory = static_cast< size_t >( available_memory / 1048576 );
@@ -2914,7 +3975,7 @@ bool SystemInformationImplementation::ParseSysCtl()
int mib[2] = { CTL_VM, VM_SWAPUSAGE };
size_t miblen = sizeof(mib) / sizeof(mib[0]);
struct xsw_usage swap;
- len = sizeof(struct xsw_usage);
+ len = sizeof(swap);
err = sysctl(mib, miblen, &swap, &len, NULL, 0);
if (err == 0)
{
@@ -2929,8 +3990,9 @@ bool SystemInformationImplementation::ParseSysCtl()
// CPU Info
len = sizeof(this->NumberOfPhysicalCPU);
sysctlbyname("hw.physicalcpu", &this->NumberOfPhysicalCPU, &len, NULL, 0);
+ len = sizeof(this->NumberOfLogicalCPU);
sysctlbyname("hw.logicalcpu", &this->NumberOfLogicalCPU, &len, NULL, 0);
- this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical =
+ this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical =
this->LogicalCPUPerPhysicalCPU();
len = sizeof(value);
@@ -2947,16 +4009,16 @@ bool SystemInformationImplementation::ParseSysCtl()
if (err != 0) // Go back to names we know but are less descriptive
{
this->ChipID.Family = 0;
- char retBuf[32];
- ::memset(retBuf, 0, 32);
+ ::memset(retBuf, 0, 128);
len = 32;
- err = sysctlbyname("hw.machine", &retBuf, &len, NULL, 0);
+ err = sysctlbyname("hw.machine", &retBuf, &len, NULL, 0);
kwsys_stl::string machineBuf(retBuf);
if (machineBuf.find_first_of("Power") != kwsys_stl::string::npos)
{
this->ChipID.Vendor = "IBM";
- len = 4;
+ len = sizeof(this->ChipID.Family);
err = sysctlbyname("hw.cputype", &this->ChipID.Family, &len, NULL, 0);
+ len = sizeof(this->ChipID.Model);
err = sysctlbyname("hw.cpusubtype", &this->ChipID.Model, &len, NULL, 0);
this->FindManufacturer();
}
@@ -2964,35 +4026,40 @@ bool SystemInformationImplementation::ParseSysCtl()
else // Should be an Intel Chip.
{
len = sizeof(this->ChipID.Family);
- err =
+ err =
sysctlbyname("machdep.cpu.family", &this->ChipID.Family, &len, NULL, 0);
-
- char retBuf[128];
+
::memset(retBuf, 0, 128);
len = 128;
err = sysctlbyname("machdep.cpu.vendor", retBuf, &len, NULL, 0);
// Chip Vendor
this->ChipID.Vendor = retBuf;
this->FindManufacturer();
-
- ::memset(retBuf, 0, 128);
- err =
- sysctlbyname("machdep.cpu.brand_string",
- retBuf, &len, NULL, 0);
- this->ChipID.ProcessorName = retBuf;
// Chip Model
len = sizeof(value);
err = sysctlbyname("machdep.cpu.model", &value, &len, NULL, 0);
this->ChipID.Model = static_cast< int >( value );
}
+
+ // brand string
+ ::memset(retBuf, 0, sizeof(retBuf));
+ len = sizeof(retBuf);
+ err = sysctlbyname("machdep.cpu.brand_string", retBuf, &len, NULL, 0);
+ if (!err)
+ {
+ this->ChipID.ProcessorName = retBuf;
+ this->ChipID.ModelName = retBuf;
+ }
+
// Cache size
len = sizeof(value);
err = sysctlbyname("hw.l1icachesize", &value, &len, NULL, 0);
this->Features.L1CacheSize = static_cast< int >( value );
+ len = sizeof(value);
err = sysctlbyname("hw.l2cachesize", &value, &len, NULL, 0);
this->Features.L2CacheSize = static_cast< int >( value );
-
+
return true;
#else
return false;
@@ -3019,7 +4086,7 @@ kwsys_stl::string SystemInformationImplementation::ExtractValueFromSysCtl(const
/** Run a given process */
kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector<const char*> args)
-{
+{
kwsys_stl::string buffer = "";
// Run the application
@@ -3085,7 +4152,7 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha
args.clear();
args.push_back("kstat");
args.push_back("-p");
-
+
kwsys_stl::string command = arguments;
size_t start = command.npos;
size_t pos = command.find(' ',0);
@@ -3105,7 +4172,7 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha
b0 = command.find('"',b1+1);
b1 = command.find('"',b0+1);
}
-
+
if(!inQuotes)
{
kwsys_stl::string arg = command.substr(start+1,pos-start-1);
@@ -3117,7 +4184,7 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha
arg.erase(quotes,1);
quotes = arg.find('"');
}
- args.push_back(arg.c_str());
+ args.push_back(arg.c_str());
start = pos;
}
pos = command.find(' ',pos+1);
@@ -3154,7 +4221,7 @@ bool SystemInformationImplementation::QuerySolarisInfo()
this->NumberOfPhysicalCPU = static_cast<unsigned int>(
atoi(this->ParseValueFromKStat("-n syste_misc -s ncpus").c_str()));
this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU;
-
+
if(this->NumberOfPhysicalCPU!=0)
{
this->NumberOfLogicalCPU /= this->NumberOfPhysicalCPU;
@@ -3163,19 +4230,19 @@ bool SystemInformationImplementation::QuerySolarisInfo()
this->CPUSpeedInMHz = static_cast<float>(atoi(this->ParseValueFromKStat("-s clock_MHz").c_str()));
// Chip family
- this->ChipID.Family = 0;
-
+ this->ChipID.Family = 0;
+
// Chip Vendor
this->ChipID.Vendor = "Sun";
this->FindManufacturer();
-
+
// Chip Model
this->ChipID.ProcessorName = this->ParseValueFromKStat("-s cpu_type");
this->ChipID.Model = 0;
// Cache size
- this->Features.L1CacheSize = 0;
- this->Features.L2CacheSize = 0;
+ this->Features.L1CacheSize = 0;
+ this->Features.L2CacheSize = 0;
char* tail;
unsigned long totalMemory =
@@ -3200,16 +4267,16 @@ bool SystemInformationImplementation::QueryHaikuInfo()
system_info info;
get_system_info(&info);
-
+
this->NumberOfPhysicalCPU = info.cpu_count;
this->CPUSpeedInMHz = info.cpu_clock_speed / 1000000.0F;
// Physical Memory
this->TotalPhysicalMemory = (info.max_pages * B_PAGE_SIZE) / (1024 * 1024) ;
- this->AvailablePhysicalMemory = this->TotalPhysicalMemory -
+ this->AvailablePhysicalMemory = this->TotalPhysicalMemory -
((info.used_pages * B_PAGE_SIZE) / (1024 * 1024));
-
+
// NOTE: get_system_info_etc is currently a private call so just set to 0
// until it becomes public
this->TotalVirtualMemory = 0;
@@ -3237,8 +4304,8 @@ bool SystemInformationImplementation::QueryHaikuInfo()
this->ChipID.Type = cpu_info.eax_1.type;
// Chip family
- this->ChipID.Family = cpu_info.eax_1.family;
-
+ this->ChipID.Family = cpu_info.eax_1.family;
+
// Chip Model
this->ChipID.Model = cpu_info.eax_1.model;
@@ -3365,16 +4432,16 @@ bool SystemInformationImplementation::QueryOSInformation()
ZeroMemory (&osvi, sizeof (OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi);
- if (!bOsVersionInfoEx)
+ if (!bOsVersionInfoEx)
{
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- if (!GetVersionEx ((OSVERSIONINFO *) &osvi))
+ if (!GetVersionEx ((OSVERSIONINFO *) &osvi))
{
return false;
}
}
- switch (osvi.dwPlatformId)
+ switch (osvi.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
// Test for the product.
@@ -3417,40 +4484,40 @@ bool SystemInformationImplementation::QueryOSInformation()
{
this->OSRelease += " Personal";
}
- else
+ else
{
this->OSRelease += " Professional";
}
}
#endif
- }
+ }
else if (osvi.wProductType == VER_NT_SERVER)
{
// Check for .NET Server instead of Windows XP.
- if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
+ if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
{
this->OSRelease = ".NET";
}
// Continue with the type detection.
- if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
+ if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
{
this->OSRelease += " DataCenter Server";
}
- else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
+ else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
{
this->OSRelease += " Advanced Server";
}
- else
+ else
{
this->OSRelease += " Server";
}
}
sprintf (operatingSystem, "%s (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF);
- this->OSVersion = operatingSystem;
+ this->OSVersion = operatingSystem;
}
- else
+ else
#endif // VER_NT_WORKSTATION
{
HKEY hKey;
@@ -3473,7 +4540,7 @@ bool SystemInformationImplementation::QueryOSInformation()
{
this->OSRelease += " Standard Server";
}
- else
+ else
{
this->OSRelease += " Server";
}
@@ -3485,7 +4552,7 @@ bool SystemInformationImplementation::QueryOSInformation()
{
this->OSRelease += " Enterprise Server";
}
- else
+ else
{
this->OSRelease += " Advanced Server";
}
@@ -3493,7 +4560,7 @@ bool SystemInformationImplementation::QueryOSInformation()
}
// Display version, service pack (if any), and build number.
- if (osvi.dwMajorVersion <= 4)
+ if (osvi.dwMajorVersion <= 4)
{
// NB: NT 4.0 and earlier.
sprintf (operatingSystem, "version %ld.%ld %s (Build %ld)",
@@ -3502,30 +4569,30 @@ bool SystemInformationImplementation::QueryOSInformation()
osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF);
this->OSVersion = operatingSystem;
- }
- else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
+ }
+ else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
{
// Windows XP and .NET server.
typedef BOOL (CALLBACK* LPFNPROC) (HANDLE, BOOL *);
- HINSTANCE hKernelDLL;
+ HINSTANCE hKernelDLL;
LPFNPROC DLLProc;
-
+
// Load the Kernel32 DLL.
hKernelDLL = LoadLibrary ("kernel32");
- if (hKernelDLL != NULL) {
+ if (hKernelDLL != NULL) {
// Only XP and .NET Server support IsWOW64Process so... Load dynamically!
- DLLProc = (LPFNPROC) GetProcAddress (hKernelDLL, "IsWow64Process");
-
+ DLLProc = (LPFNPROC) GetProcAddress (hKernelDLL, "IsWow64Process");
+
// If the function address is valid, call the function.
if (DLLProc != NULL) (DLLProc) (GetCurrentProcess (), &bIsWindows64Bit);
else bIsWindows64Bit = false;
-
+
// Free the DLL module.
- FreeLibrary (hKernelDLL);
- }
- }
- else
- {
+ FreeLibrary (hKernelDLL);
+ }
+ }
+ else
+ {
// Windows 2000 and everything else.
sprintf (operatingSystem,"%s (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF);
this->OSVersion = operatingSystem;
@@ -3534,32 +4601,32 @@ bool SystemInformationImplementation::QueryOSInformation()
case VER_PLATFORM_WIN32_WINDOWS:
// Test for the product.
- if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
+ if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
{
this->OSRelease = "95";
- if(osvi.szCSDVersion[1] == 'C')
+ if(osvi.szCSDVersion[1] == 'C')
{
this->OSRelease += "OSR 2.5";
}
- else if(osvi.szCSDVersion[1] == 'B')
+ else if(osvi.szCSDVersion[1] == 'B')
{
this->OSRelease += "OSR 2";
}
- }
+ }
- if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
+ if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
{
this->OSRelease = "98";
- if (osvi.szCSDVersion[1] == 'A' )
+ if (osvi.szCSDVersion[1] == 'A' )
{
this->OSRelease += "SE";
}
- }
+ }
- if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
+ if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
{
this->OSRelease = "Me";
- }
+ }
break;
case VER_PLATFORM_WIN32s:
@@ -3583,7 +4650,7 @@ bool SystemInformationImplementation::QueryOSInformation()
WSACleanup( );
}
this->Hostname = name;
-
+
const char* arch = getenv("PROCESSOR_ARCHITECTURE");
if(arch)
{
@@ -3604,51 +4671,41 @@ bool SystemInformationImplementation::QueryOSInformation()
}
#ifdef __APPLE__
- this->CallSwVers();
+ this->OSName="Unknown Apple OS";
+ this->OSRelease="Unknown product version";
+ this->OSVersion="Unknown build version";
+
+ this->CallSwVers("-productName",this->OSName);
+ this->CallSwVers("-productVersion",this->OSRelease);
+ this->CallSwVers("-buildVersion",this->OSVersion);
#endif
#endif
return true;
-
}
-
-void SystemInformationImplementation::CallSwVers()
+int SystemInformationImplementation::CallSwVers(
+ const char *arg,
+ kwsys_stl::string &ver)
{
#ifdef __APPLE__
- kwsys_stl::string output;
kwsys_stl::vector<const char*> args;
- args.clear();
-
- args.push_back("sw_vers");
- args.push_back("-productName");
- args.push_back(0);
- output = this->RunProcess(args);
- this->TrimNewline(output);
- this->OSName = output;
- args.clear();
-
args.push_back("sw_vers");
- args.push_back("-productVersion");
+ args.push_back(arg);
args.push_back(0);
- output = this->RunProcess(args);
- this->TrimNewline(output);
- this->OSRelease = output;
- args.clear();
-
- args.push_back("sw_vers");
- args.push_back("-buildVersion");
- args.push_back(0);
- output = this->RunProcess(args);
- this->TrimNewline(output);
- this->OSVersion = output;
+ ver = this->RunProcess(args);
+ this->TrimNewline(ver);
+#else
+ // avoid C4100
+ (void)arg;
+ (void)ver;
#endif
+ return 0;
}
-
void SystemInformationImplementation::TrimNewline(kwsys_stl::string& output)
-{
+{
// remove \r
kwsys_stl::string::size_type pos=0;
while((pos = output.find("\r", pos)) != kwsys_stl::string::npos)
diff --git a/Source/kwsys/SystemInformation.hxx.in b/Source/kwsys/SystemInformation.hxx.in
index b6ebe6a..8f4cb4e 100644
--- a/Source/kwsys/SystemInformation.hxx.in
+++ b/Source/kwsys/SystemInformation.hxx.in
@@ -24,14 +24,22 @@
namespace @KWSYS_NAMESPACE@
{
-
-// forward declare the implementation class
+// forward declare the implementation class
class SystemInformationImplementation;
-
-class @KWSYS_NAMESPACE@_EXPORT SystemInformation
-{
+class @KWSYS_NAMESPACE@_EXPORT SystemInformation
+{
+#if @KWSYS_USE_LONG_LONG@
+ typedef long long LongLong;
+#elif @KWSYS_USE___INT64@
+ typedef __int64 LongLong;
+#else
+# error "No Long Long"
+#endif
+ friend class SystemInformationImplementation;
+ SystemInformationImplementation* Implementation;
public:
+
SystemInformation ();
~SystemInformation ();
@@ -40,6 +48,7 @@ public:
kwsys_stl::string GetTypeID();
kwsys_stl::string GetFamilyID();
kwsys_stl::string GetModelID();
+ kwsys_stl::string GetModelName();
kwsys_stl::string GetSteppingCode();
const char * GetExtendedProcessorName();
const char * GetProcessorSerialNumber();
@@ -49,13 +58,27 @@ public:
int GetProcessorAPICID();
int GetProcessorCacheXSize(long int);
bool DoesCPUSupportFeature(long int);
-
- const char * GetOSName();
+
+ // returns an informative general description of the cpu
+ // on this system.
+ kwsys_stl::string GetCPUDescription();
+
const char * GetHostname();
+ kwsys_stl::string GetFullyQualifiedDomainName();
+
+ const char * GetOSName();
const char * GetOSRelease();
const char * GetOSVersion();
const char * GetOSPlatform();
+ int GetOSIsWindows();
+ int GetOSIsLinux();
+ int GetOSIsApple();
+
+ // returns an informative general description of the os
+ // on this system.
+ kwsys_stl::string GetOSDescription();
+
bool Is64Bits();
unsigned int GetNumberOfLogicalCPU(); // per physical cpu
@@ -63,20 +86,62 @@ public:
bool DoesCPUSupportCPUID();
+ // Retrieve id of the current running process
+ LongLong GetProcessId();
+
// Retrieve memory information in megabyte.
size_t GetTotalVirtualMemory();
size_t GetAvailableVirtualMemory();
size_t GetTotalPhysicalMemory();
- size_t GetAvailablePhysicalMemory();
+ size_t GetAvailablePhysicalMemory();
+
+ // returns an informative general description if the installed and
+ // available ram on this system. See the GetHostMmeoryTotal, and
+ // Get{Host,Proc}MemoryAvailable methods for more information.
+ kwsys_stl::string GetMemoryDescription(
+ const char *hostLimitEnvVarName=NULL,
+ const char *procLimitEnvVarName=NULL);
+
+ // Retrieve amount of physical memory installed on the system in KiB
+ // units.
+ LongLong GetHostMemoryTotal();
+
+ // Get total system RAM in units of KiB available colectivley to all
+ // processes in a process group. An example of a process group
+ // are the processes comprising an mpi program which is running in
+ // parallel. The amount of memory reported may differ from the host
+ // total if a host wide resource limit is applied. Such reource limits
+ // are reported to us via an applicaiton specified environment variable.
+ LongLong GetHostMemoryAvailable(const char *hostLimitEnvVarName=NULL);
+
+ // Get total system RAM in units of KiB available to this process.
+ // This may differ from the host available if a per-process resource
+ // limit is applied. per-process memory limits are applied on unix
+ // system via rlimit api. Resource limits that are not imposed via
+ // rlimit api may be reported to us via an application specified
+ // environment variable.
+ LongLong GetProcMemoryAvailable(
+ const char *hostLimitEnvVarName=NULL,
+ const char *procLimitEnvVarName=NULL);
+
+ // Get the system RAM used by all processes on the host, in units of KiB.
+ LongLong GetHostMemoryUsed();
+
+ // Get system RAM used by this process id in units of KiB.
+ LongLong GetProcMemoryUsed();
+
+ // enable/disable stack trace signal handler. In order to
+ // produce an informative stack trace the application should
+ // be dynamically linked and compiled with debug symbols.
+ static
+ void SetStackTraceOnError(int enable);
/** Run the different checks */
void RunCPUCheck();
void RunOSCheck();
void RunMemoryCheck();
-private:
- SystemInformationImplementation* Implementation;
-
};
+
} // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macros. */
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 66850e9..085d988 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -1665,7 +1665,7 @@ kwsys_stl::string SystemTools::EscapeChars(
kwsys_stl::string n;
if (str)
{
- if (!chars_to_escape | !*chars_to_escape)
+ if (!chars_to_escape || !*chars_to_escape)
{
n.append(str);
}
diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx
index 7b73d06..ae58703 100644
--- a/Source/kwsys/kwsysPlatformTestsCXX.cxx
+++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx
@@ -358,6 +358,30 @@ int main()
}
#endif
+#ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64
+int test_istream(kwsys_ios::istream& is, __int64& x)
+{
+ return (is >> x)? 1:0;
+}
+int main()
+{
+ __int64 x = 0;
+ return test_istream(kwsys_ios::cin, x);
+}
+#endif
+
+#ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64
+int test_ostream(kwsys_ios::ostream& os, __int64 x)
+{
+ return (os << x)? 1:0;
+}
+int main()
+{
+ __int64 x = 0;
+ return test_ostream(kwsys_ios::cout, x);
+}
+#endif
+
#ifdef TEST_KWSYS_CHAR_IS_SIGNED
/* Return 0 for char signed and 1 for char unsigned. */
int main()
@@ -428,6 +452,48 @@ int main()
}
#endif
+#ifdef TEST_KWSYS_CXX_HAS_RLIMIT64
+# if defined(KWSYS_HAS_LFS)
+# define _LARGEFILE_SOURCE
+# define _LARGEFILE64_SOURCE
+# define _LARGE_FILES
+# define _FILE_OFFSET_BITS 64
+# endif
+# include <sys/resource.h>
+int main()
+{
+ struct rlimit64 rlim;
+ return getrlimit64(0,&rlim);
+}
+#endif
+
+#ifdef TEST_KWSYS_CXX_HAS_ATOLL
+#include <stdlib.h>
+int main()
+{
+ const char *str="1024";
+ return static_cast<int>(atoll(str));
+}
+#endif
+
+#ifdef TEST_KWSYS_CXX_HAS_ATOL
+#include <stdlib.h>
+int main()
+{
+ const char *str="1024";
+ return static_cast<int>(atol(str));
+}
+#endif
+
+#ifdef TEST_KWSYS_CXX_HAS__ATOI64
+#include <stdlib.h>
+int main()
+{
+ const char *str="1024";
+ return static_cast<int>(_atoi64(str));
+}
+#endif
+
#ifdef TEST_KWSYS_CXX_TYPE_INFO
/* Collect fundamental type information and save it to a CMake script. */
diff --git a/Source/kwsys/testSystemInformation.cxx b/Source/kwsys/testSystemInformation.cxx
index b3afc9d..41fcf38 100644
--- a/Source/kwsys/testSystemInformation.cxx
+++ b/Source/kwsys/testSystemInformation.cxx
@@ -13,8 +13,6 @@
#include KWSYS_HEADER(SystemInformation.hxx)
#include KWSYS_HEADER(ios/iostream)
-
-
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
@@ -22,12 +20,31 @@
# include "kwsys_ios_iostream.h.in"
#endif
-#define printMethod(inof, m) kwsys_ios::cout << #m << ": " \
+#if defined(KWSYS_USE_LONG_LONG)
+# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
+# define iostreamLongLong(x) (x)
+# else
+# define iostreamLongLong(x) ((long)x)
+# endif
+#elif defined(KWSYS_USE___INT64)
+# if defined(KWSYS_IOS_HAS_OSTREAM___INT64)
+# define iostreamLongLong(x) (x)
+# else
+# define iostreamLongLong(x) ((long)x)
+# endif
+#else
+# error "No Long Long"
+#endif
+
+#define printMethod(info, m) kwsys_ios::cout << #m << ": " \
<< info.m() << "\n"
-#define printMethod2(inof, m, unit) kwsys_ios::cout << #m << ": " \
+#define printMethod2(info, m, unit) kwsys_ios::cout << #m << ": " \
<< info.m() << " " << unit << "\n"
+#define printMethod3(info, m, unit) kwsys_ios::cout << #m << ": " \
+<< iostreamLongLong(info.m) << " " << unit << "\n"
+
int testSystemInformation(int, char*[])
{
kwsys::SystemInformation info;
@@ -35,7 +52,11 @@ int testSystemInformation(int, char*[])
info.RunOSCheck();
info.RunMemoryCheck();
printMethod(info, GetOSName);
+ printMethod(info, GetOSIsLinux);
+ printMethod(info, GetOSIsApple);
+ printMethod(info, GetOSIsWindows);
printMethod(info, GetHostname);
+ printMethod(info, GetFullyQualifiedDomainName);
printMethod(info, GetOSRelease);
printMethod(info, GetOSVersion);
printMethod(info, GetOSPlatform);
@@ -58,6 +79,11 @@ int testSystemInformation(int, char*[])
printMethod2(info, GetAvailableVirtualMemory, "MB");
printMethod2(info, GetTotalPhysicalMemory, "MB");
printMethod2(info, GetAvailablePhysicalMemory, "MB");
+ printMethod3(info, GetHostMemoryTotal(), "KiB");
+ printMethod3(info, GetHostMemoryAvailable("KWSHL"), "KiB");
+ printMethod3(info, GetProcMemoryAvailable("KWSHL","KWSPL"), "KiB");
+ printMethod3(info, GetHostMemoryUsed(), "KiB");
+ printMethod3(info, GetProcMemoryUsed(), "KiB");
//int GetProcessorCacheXSize(long int);
// bool DoesCPUSupportFeature(long int);
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index f47335d..f8a3d15 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -64,7 +64,8 @@ if("${CMAKE_GENERATOR}" MATCHES "Make")
# Test the IMPLICIT_DEPENDS feature.
set(ZOT_DEPENDS IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep.cxx)
set(ZOT_CUSTOM_DEP
- IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep_custom.cxx)
+ IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep_custom.cxx
+ CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep_custom2.cxx )
else()
# No IMPLICIT_DEPENDS...just depend directly.
set(ZOT_DEPENDS DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx.in)
diff --git a/Tests/BuildDepends/Project/dep_custom2.cxx b/Tests/BuildDepends/Project/dep_custom2.cxx
new file mode 100644
index 0000000..ac9dee1
--- /dev/null
+++ b/Tests/BuildDepends/Project/dep_custom2.cxx
@@ -0,0 +1,2 @@
+#include <zot_custom.hxx.in>
+// some comment
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index b404333..bbf804b 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -556,6 +556,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-generator ${CMAKE_TEST_GENERATOR}
--build-project GeneratorExpression
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --build-options -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE}
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression")
diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
index 212c758..739593c 100644
--- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
+++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
@@ -70,8 +70,9 @@ endmacro()
# If any of these modules reported that it was found a version number should have been
# reported.
-foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG HSPELL
- JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL TIFF ZLIB)
+foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG
+ HSPELL ICOTOOL JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG
+ PostgreSQL TIFF ZLIB)
check_version_string(${VTEST} ${VTEST}_VERSION_STRING)
endforeach()
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt
index 51a630f..1b4ebc4 100644
--- a/Tests/CMakeOnly/CMakeLists.txt
+++ b/Tests/CMakeOnly/CMakeLists.txt
@@ -38,3 +38,22 @@ add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND}
-DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectInclude/include.cmake
-P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake
)
+
+include(${CMAKE_SOURCE_DIR}/Modules/CMakeParseArguments.cmake)
+
+function(add_major_test module)
+ cmake_parse_arguments(MAJOR_TEST "NOLANG" "VERSION_VAR" "VERSIONS" ${ARGN})
+ foreach (_version IN LISTS MAJOR_TEST_VERSIONS)
+ add_test(CMakeOnly.MajorVersionSelection-${module}_${_version}
+ ${CMAKE_CMAKE_COMMAND}
+ -DTEST=MajorVersionSelection-${module}_${_version}
+ -DTEST_SOURCE=MajorVersionSelection
+ "-DCMAKE_ARGS=-DMAJOR_TEST_MODULE=${module};-DMAJOR_TEST_VERSION=${_version};-DMAJOR_TEST_NO_LANGUAGES=${MAJOR_TEST_NOLANG};-DMAJOR_TEST_VERSION_VAR=${MAJOR_TEST_VERSION_VAR}"
+ -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake
+ )
+ endforeach ()
+endfunction()
+
+add_major_test(PythonLibs VERSIONS 2 3 VERSION_VAR PYTHONLIBS_VERSION_STRING)
+add_major_test(PythonInterp NOLANG VERSIONS 2 3 VERSION_VAR PYTHON_VERSION_STRING)
+add_major_test(Qt VERSIONS 3 4 VERSION_VAR QT_VERSION_STRING)
diff --git a/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt
new file mode 100644
index 0000000..74f5451
--- /dev/null
+++ b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt
@@ -0,0 +1,46 @@
+cmake_minimum_required(VERSION 2.8)
+
+if (NOT MAJOR_TEST_MODULE OR NOT MAJOR_TEST_VERSION)
+ message(FATAL_ERROR "test selection variables not set up")
+endif ()
+
+if (MAJOR_TEST_NO_LANGUAGES)
+ project(major_detect_${MAJOR_TEST_MODULE}_${MAJOR_TEST_VERSION} NONE)
+else ()
+ project(major_detect_${MAJOR_TEST_MODULE}_${MAJOR_TEST_VERSION})
+endif ()
+
+find_package(${MAJOR_TEST_MODULE} ${MAJOR_TEST_VERSION})
+
+if (MAJOR_TEST_VERSION_VAR)
+ set(VERSION_VAR "${MAJOR_TEST_VERSION_VAR}")
+else ()
+ set(VERSION_VAR "${MAJOR_TEST_MODULE}_VERSION_STRING")
+endif ()
+
+string(TOUPPER "${MAJOR_TEST_MODULE}" MODULE_UPPER)
+
+if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND "${VERSION_VAR}")
+ message(STATUS "${VERSION_VAR} is '${${VERSION_VAR}}'")
+ if ("${VERSION_VAR}" VERSION_LESS MAJOR_TEST_VERSION)
+ message(SEND_ERROR "Found version ${${VERSION_VAR}} is less than requested major version ${MAJOR_TEST_VERSION}")
+ endif ()
+ math(EXPR V_PLUS_ONE "${MAJOR_TEST_VERSION} + 1")
+ if ("${VERSION_VAR}" VERSION_GREATER V_PLUS_ONE)
+ message(SEND_ERROR "Found version ${${VERSION_VAR}} is greater than requested major version ${MAJOR_TEST_VERSION}")
+ endif ()
+endif ()
+
+if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND ${MAJOR_TEST_MODULE}_VERSION_MAJOR)
+ message(STATUS "${MAJOR_TEST_MODULE}_VERSION_MAJOR is '${${MAJOR_TEST_MODULE}_VERSION_MAJOR}'")
+ if (NOT ${MAJOR_TEST_VERSION} EQUAL ${MAJOR_TEST_MODULE}_VERSION_MAJOR)
+ message(SEND_ERROR "We requested major version ${MAJOR_TEST_VERSION} but ${MAJOR_TEST_MODULE} set ${MAJOR_TEST_MODULE}_VERSION_MAJOR to ${${MAJOR_TEST_MODULE}_VERSION_MAJOR}")
+ endif ()
+endif ()
+
+if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND ${MODULE_UPPER}_VERSION_MAJOR)
+ message(STATUS "${MODULE_UPPER}_VERSION_MAJOR is '${${MODULE_UPPER}_VERSION_MAJOR}'")
+ if (NOT ${MAJOR_TEST_VERSION} EQUAL ${MODULE_UPPER}_VERSION_MAJOR)
+ message(SEND_ERROR "We requested major version ${MAJOR_TEST_VERSION} but ${MAJOR_TEST_MODULE} set ${MODULE_UPPER}_VERSION_MAJOR to ${${MODULE_UPPER}_VERSION_MAJOR}")
+ endif ()
+endif ()
diff --git a/Tests/CMakeOnly/Test.cmake.in b/Tests/CMakeOnly/Test.cmake.in
index 42af068..f76db1d 100644
--- a/Tests/CMakeOnly/Test.cmake.in
+++ b/Tests/CMakeOnly/Test.cmake.in
@@ -1,4 +1,8 @@
-set(source_dir "@CMAKE_CURRENT_SOURCE_DIR@/${TEST}")
+if (NOT TEST_SOURCE)
+ set(TEST_SOURCE "${TEST}")
+endif ()
+
+set(source_dir "@CMAKE_CURRENT_SOURCE_DIR@/${TEST_SOURCE}")
set(binary_dir "@CMAKE_CURRENT_BINARY_DIR@/${TEST}-build")
file(REMOVE_RECURSE "${binary_dir}")
file(MAKE_DIRECTORY "${binary_dir}")
diff --git a/Tests/CMakeOnly/find_library/A/libtestA.a b/Tests/CMakeOnly/find_library/A/libtestA.a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_library/A/libtestA.a
diff --git a/Tests/CMakeOnly/find_library/B/libtestB.a b/Tests/CMakeOnly/find_library/B/libtestB.a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_library/B/libtestB.a
diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt
index 08f9331..2d4ecaf 100644
--- a/Tests/CMakeOnly/find_library/CMakeLists.txt
+++ b/Tests/CMakeOnly/find_library/CMakeLists.txt
@@ -3,34 +3,34 @@ project(FindLibraryTest NONE)
set(CMAKE_FIND_DEBUG_MODE 1)
-macro(test_find_library expected)
- get_filename_component(dir ${expected} PATH)
- get_filename_component(name ${expected} NAME)
- string(REGEX REPLACE "lib/?64" "lib" dir "${dir}")
+macro(test_find_library desc expected)
unset(LIB CACHE)
- find_library(LIB
- NAMES ${name}
- PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}
- NO_DEFAULT_PATH
- )
+ find_library(LIB ${ARGN} NO_DEFAULT_PATH)
if(LIB)
# Convert to relative path for comparison to expected location.
file(RELATIVE_PATH REL_LIB "${CMAKE_CURRENT_SOURCE_DIR}" "${LIB}")
- # Debugging output.
- if(CMAKE_FIND_DEBUG_MODE)
- message(STATUS "Library ${expected} searched as ${dir}, found as [${REL_LIB}].")
- endif()
-
# Check and report failure.
if(NOT "${REL_LIB}" STREQUAL "${expected}")
- message(SEND_ERROR "Library ${l} should have been [${expected}] but was [${REL_LIB}]")
+ message(SEND_ERROR "Library ${expected} found as [${REL_LIB}]${desc}")
+ elseif(CMAKE_FIND_DEBUG_MODE)
+ message(STATUS "Library ${expected} found as [${REL_LIB}]${desc}")
endif()
else()
- message(SEND_ERROR "Library ${expected} searched as ${dir}, NOT FOUND!")
+ message(SEND_ERROR "Library ${expected} NOT FOUND${desc}")
endif()
endmacro()
+macro(test_find_library_subst expected)
+ get_filename_component(dir ${expected} PATH)
+ get_filename_component(name ${expected} NAME)
+ string(REGEX REPLACE "lib/?64" "lib" dir "${dir}")
+ test_find_library(", searched as ${dir}" "${expected}"
+ NAMES ${name}
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}
+ )
+endmacro()
+
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
@@ -44,7 +44,7 @@ foreach(lib
lib/libtest3.a
lib/libtest3.a
)
- test_find_library(${lib})
+ test_find_library_subst(${lib})
endforeach()
set(CMAKE_SIZEOF_VOID_P 8)
@@ -57,5 +57,18 @@ foreach(lib64
lib64/A/libtest1.a
lib64/libtest1.a
)
- test_find_library(${lib64})
+ test_find_library_subst(${lib64})
endforeach()
+
+test_find_library("" A/libtestA.a
+ NAMES testA testB
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
+ )
+test_find_library("" B/libtestB.a
+ NAMES testB testA
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
+ )
+test_find_library("" A/libtestA.a
+ NAMES testB testA NAMES_PER_DIR
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
+ )
diff --git a/Tests/CMakeTests/CheckCMakeTest.cmake b/Tests/CMakeTests/CheckCMakeTest.cmake
index db92905..7be7b30 100644
--- a/Tests/CMakeTests/CheckCMakeTest.cmake
+++ b/Tests/CMakeTests/CheckCMakeTest.cmake
@@ -1,30 +1,35 @@
get_filename_component(CMakeTests_SRC_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+function(check_cmake_test_single prefix test testfile)
+ message(STATUS "Test ${prefix}-${test}...")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -P "${testfile}"
+ WORKING_DIRECTORY "${CMakeTests_BIN_DIR}"
+ OUTPUT_VARIABLE stdout
+ ERROR_VARIABLE stderr
+ RESULT_VARIABLE result
+ )
+ string(REGEX REPLACE "\n" "\n out> " out " out> ${stdout}")
+ string(REGEX REPLACE "\n" "\n err> " err " err> ${stderr}")
+ if(NOT "${result}" STREQUAL "${${test}-RESULT}")
+ message(FATAL_ERROR
+ "Test ${test} result is [${result}], not [${${test}-RESULT}].\n"
+ "Test ${test} output:\n"
+ "${out}\n"
+ "${err}")
+ endif()
+ if(${test}-STDERR AND NOT "${err}" MATCHES "${${test}-STDERR}")
+ message(FATAL_ERROR
+ "Test ${test} stderr does not match\n ${${test}-STDERR}\n"
+ "Test ${test} output:\n"
+ "${out}\n"
+ "${err}")
+ endif()
+endfunction()
+
function(check_cmake_test prefix)
get_filename_component(CMakeTests_BIN_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
foreach(test ${ARGN})
- message(STATUS "Test ${prefix}-${test}...")
- execute_process(
- COMMAND ${CMAKE_COMMAND} -P "${CMakeTests_SRC_DIR}/${prefix}-${test}.cmake"
- WORKING_DIRECTORY "${CMakeTests_BIN_DIR}"
- OUTPUT_VARIABLE stdout
- ERROR_VARIABLE stderr
- RESULT_VARIABLE result
- )
- string(REGEX REPLACE "\n" "\n out> " out " out> ${stdout}")
- string(REGEX REPLACE "\n" "\n err> " err " err> ${stderr}")
- if(NOT "${result}" STREQUAL "${${test}-RESULT}")
- message(FATAL_ERROR
- "Test ${test} result is [${result}], not [${${test}-RESULT}].\n"
- "Test ${test} output:\n"
- "${out}\n"
- "${err}")
- endif()
- if(${test}-STDERR AND NOT "${err}" MATCHES "${${test}-STDERR}")
- message(FATAL_ERROR
- "Test ${test} stderr does not match\n ${${test}-STDERR}\n"
- "Test ${test} output:\n"
- "${out}\n"
- "${err}")
- endif()
+ check_cmake_test_single("${prefix}" "${test}" "${CMakeTests_SRC_DIR}/${prefix}-${test}.cmake")
endforeach()
endfunction()
diff --git a/Tests/CMakeTests/File-Glob-NoArg.cmake b/Tests/CMakeTests/File-Glob-NoArg.cmake
new file mode 100644
index 0000000..486f366
--- /dev/null
+++ b/Tests/CMakeTests/File-Glob-NoArg.cmake
@@ -0,0 +1,2 @@
+# Checking that the call without arguments get caught by the file global protection.
+file(GLOB)
diff --git a/Tests/CMakeTests/FileTest.cmake.in b/Tests/CMakeTests/FileTest.cmake.in
index 3c3d85d..960d3c1 100644
--- a/Tests/CMakeTests/FileTest.cmake.in
+++ b/Tests/CMakeTests/FileTest.cmake.in
@@ -12,6 +12,10 @@ set(Copy-NoDest-RESULT 1)
set(Copy-NoDest-STDERR "given no DESTINATION")
set(Copy-NoFile-RESULT 1)
set(Copy-NoFile-STDERR "COPY cannot find.*/does_not_exist\\.txt")
+set(Glob-NoArg-RESULT 1)
+set(Glob-NoArg-STDERR "file must be called with at least two arguments")
+set(Make_Directory-NoArg-RESULT 1)
+set(Make-Directory-NoArg-STDERR "file must be called with at least two arguments")
set(MD5-NoFile-RESULT 1)
set(MD5-NoFile-STDERR "file MD5 failed to read file")
set(MD5-BadArg1-RESULT 1)
@@ -42,6 +46,8 @@ check_cmake_test(File
Copy-LateArg
Copy-NoDest
Copy-NoFile
+ Glob-NoArg
+ Make_Directory-NoArg
MD5-NoFile
MD5-BadArg1
MD5-BadArg2
@@ -54,6 +60,11 @@ check_cmake_test(File
SHA512-Works
)
+file(GLOB hum)
+if (NOT hum STREQUAL "")
+ message(FATAL_ERROR "file(GLOB hum) did not return an empty string.")
+endif()
+
# Also execute each test listed in FileTestScript.cmake:
#
set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/FileTestScript.cmake")
diff --git a/Tests/CMakeTests/GetProperty-Doc-Properties.cmake b/Tests/CMakeTests/GetProperty-Doc-Properties.cmake
deleted file mode 100644
index 6c2c362..0000000
--- a/Tests/CMakeTests/GetProperty-Doc-Properties.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-get_property(FOO_BRIEF GLOBAL PROPERTY FOO BRIEF_DOCS)
-get_property(FOO_FULL GLOBAL PROPERTY FOO FULL_DOCS)
-
-if (NOT FOO_BRIEF STREQUAL "NOTFOUND")
- message(SEND_ERROR "property FOO has BRIEF_DOCS set to '${FOO_BRIEF}'")
-endif ()
-
-if (NOT FOO_FULL STREQUAL "NOTFOUND")
- message(SEND_ERROR "property FOO has FULL_DOCS set to '${FOO_FULL}'")
-endif ()
diff --git a/Tests/CMakeTests/GetPropertyTest.cmake.in b/Tests/CMakeTests/GetPropertyTest.cmake.in
index ab96e5b..306ab72 100644
--- a/Tests/CMakeTests/GetPropertyTest.cmake.in
+++ b/Tests/CMakeTests/GetPropertyTest.cmake.in
@@ -1,5 +1,33 @@
include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
+get_property(FOO_BRIEF GLOBAL PROPERTY FOO BRIEF_DOCS)
+get_property(FOO_FULL GLOBAL PROPERTY FOO FULL_DOCS)
+
+if (NOT FOO_BRIEF STREQUAL "NOTFOUND")
+ message(SEND_ERROR "property FOO has BRIEF_DOCS set to '${FOO_BRIEF}'")
+endif ()
+
+if (NOT FOO_FULL STREQUAL "NOTFOUND")
+ message(SEND_ERROR "property FOO has FULL_DOCS set to '${FOO_FULL}'")
+endif ()
+
+get_property(test_brief GLOBAL PROPERTY ENABLED_FEATURES BRIEF_DOCS)
+get_property(test_full GLOBAL PROPERTY ENABLED_FEATURES FULL_DOCS)
+
+if(test_brief STREQUAL "NOTFOUND")
+ message(SEND_ERROR "property ENABLED_FEATURES has no BRIEF_DOCS")
+endif()
+
+if(test_full STREQUAL "NOTFOUND")
+ message(SEND_ERROR "property ENABLED_FEATURES has no FULL_DOCS")
+endif()
+
+set(test_var alpha)
+get_property(result VARIABLE PROPERTY test_var)
+if(NOT result STREQUAL "alpha")
+ message(SEND_ERROR "bad value of VARIABLE PROPERTY test_var: got '${result}' instead of 'alpha'")
+endif()
+
set(Missing-Argument-RESULT 1)
set(Missing-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Missing-Argument.cmake:1 \\(get_property\\):.*get_property called with incorrect number of arguments.*")
@@ -28,12 +56,6 @@ check_cmake_test(GetProperty
No-Property
)
-set(Doc-Properties-RESULT 0)
-
-check_cmake_test(GetProperty
- Doc-Properties
-)
-
set(Global-Name-RESULT 1)
set(Global-Name-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Global-Name.cmake:1 \\(get_property\\):.*get_property given name for GLOBAL scope\\..*")
diff --git a/Tests/CMakeTests/List-Get-CMP0007-Warn.cmake b/Tests/CMakeTests/List-Get-CMP0007-Warn.cmake
new file mode 100644
index 0000000..0a9264f
--- /dev/null
+++ b/Tests/CMakeTests/List-Get-CMP0007-Warn.cmake
@@ -0,0 +1,6 @@
+set(thelist "" NEW OLD)
+
+list(GET thelist 1 thevalue)
+if (NOT thevalue STREQUAL "OLD")
+ message(SEND_ERROR "returned element '${thevalue}', but expected 'OLD'")
+endif()
diff --git a/Tests/CMakeTests/List-Get-Invalid-Index.cmake b/Tests/CMakeTests/List-Get-Invalid-Index.cmake
new file mode 100644
index 0000000..178295a
--- /dev/null
+++ b/Tests/CMakeTests/List-Get-Invalid-Index.cmake
@@ -0,0 +1,2 @@
+set(mylist alpha bravo charlie)
+list(GET mylist 3 result)
diff --git a/Tests/CMakeTests/List-Insert-Invalid-Index.cmake b/Tests/CMakeTests/List-Insert-Invalid-Index.cmake
new file mode 100644
index 0000000..4103d97
--- /dev/null
+++ b/Tests/CMakeTests/List-Insert-Invalid-Index.cmake
@@ -0,0 +1,2 @@
+set(mylist alpha bravo charlie)
+list(INSERT mylist 3 delta)
diff --git a/Tests/CMakeTests/List-Invalid-Subcommand.cmake b/Tests/CMakeTests/List-Invalid-Subcommand.cmake
new file mode 100644
index 0000000..f35a118
--- /dev/null
+++ b/Tests/CMakeTests/List-Invalid-Subcommand.cmake
@@ -0,0 +1 @@
+list(NO_SUCH_SUBCOMMAND mylist)
diff --git a/Tests/CMakeTests/List-Length-Too-Many-Arguments.cmake b/Tests/CMakeTests/List-Length-Too-Many-Arguments.cmake
new file mode 100644
index 0000000..327db6a
--- /dev/null
+++ b/Tests/CMakeTests/List-Length-Too-Many-Arguments.cmake
@@ -0,0 +1 @@
+list(LENGTH mylist result one_too_many)
diff --git a/Tests/CMakeTests/List-No-Arguments.cmake b/Tests/CMakeTests/List-No-Arguments.cmake
new file mode 100644
index 0000000..7916aaa
--- /dev/null
+++ b/Tests/CMakeTests/List-No-Arguments.cmake
@@ -0,0 +1 @@
+list()
diff --git a/Tests/CMakeTests/List-Remove_At-Invalid-Index.cmake b/Tests/CMakeTests/List-Remove_At-Invalid-Index.cmake
new file mode 100644
index 0000000..d4f3921
--- /dev/null
+++ b/Tests/CMakeTests/List-Remove_At-Invalid-Index.cmake
@@ -0,0 +1,2 @@
+set(mylist alpha bravo charlie)
+list(REMOVE_AT mylist 3)
diff --git a/Tests/CMakeTests/List-Remove_At-Nonexistent-List.cmake b/Tests/CMakeTests/List-Remove_At-Nonexistent-List.cmake
new file mode 100644
index 0000000..5266c7f
--- /dev/null
+++ b/Tests/CMakeTests/List-Remove_At-Nonexistent-List.cmake
@@ -0,0 +1,2 @@
+unset(nosuchlist)
+list(REMOVE_AT nosuchlist 0)
diff --git a/Tests/CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake b/Tests/CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake
new file mode 100644
index 0000000..218f227
--- /dev/null
+++ b/Tests/CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake
@@ -0,0 +1,2 @@
+unset(nosuchlist)
+list(REMOVE_DUPLICATES nosuchlist)
diff --git a/Tests/CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake b/Tests/CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake
new file mode 100644
index 0000000..b5eb46e
--- /dev/null
+++ b/Tests/CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake
@@ -0,0 +1 @@
+list(REMOVE_DUPLICATES mylist one_too_many)
diff --git a/Tests/CMakeTests/List-Remove_Item-Nonexistent-List.cmake b/Tests/CMakeTests/List-Remove_Item-Nonexistent-List.cmake
new file mode 100644
index 0000000..079e7fb
--- /dev/null
+++ b/Tests/CMakeTests/List-Remove_Item-Nonexistent-List.cmake
@@ -0,0 +1,2 @@
+unset(nosuchlist)
+list(REMOVE_ITEM nosuchlist alpha)
diff --git a/Tests/CMakeTests/List-Reverse-Nonexistent-List.cmake b/Tests/CMakeTests/List-Reverse-Nonexistent-List.cmake
new file mode 100644
index 0000000..977e2cc
--- /dev/null
+++ b/Tests/CMakeTests/List-Reverse-Nonexistent-List.cmake
@@ -0,0 +1,2 @@
+unset(nosuchlist)
+list(REVERSE nosuchlist)
diff --git a/Tests/CMakeTests/List-Reverse-Too-Many-Arguments.cmake b/Tests/CMakeTests/List-Reverse-Too-Many-Arguments.cmake
new file mode 100644
index 0000000..3a554a0
--- /dev/null
+++ b/Tests/CMakeTests/List-Reverse-Too-Many-Arguments.cmake
@@ -0,0 +1 @@
+list(REVERSE mylist one_too_many)
diff --git a/Tests/CMakeTests/List-Sort-Nonexistent-List.cmake b/Tests/CMakeTests/List-Sort-Nonexistent-List.cmake
new file mode 100644
index 0000000..8f48e10
--- /dev/null
+++ b/Tests/CMakeTests/List-Sort-Nonexistent-List.cmake
@@ -0,0 +1,2 @@
+unset(nosuchlist)
+list(SORT nosuchlist)
diff --git a/Tests/CMakeTests/List-Sort-Too-Many-Arguments.cmake b/Tests/CMakeTests/List-Sort-Too-Many-Arguments.cmake
new file mode 100644
index 0000000..81b195d
--- /dev/null
+++ b/Tests/CMakeTests/List-Sort-Too-Many-Arguments.cmake
@@ -0,0 +1 @@
+list(SORT mylist one_too_many)
diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in
index a167503..f0ed70f 100644
--- a/Tests/CMakeTests/ListTest.cmake.in
+++ b/Tests/CMakeTests/ListTest.cmake.in
@@ -1,3 +1,5 @@
+include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
+
macro(TEST command expected)
if("x${result}" STREQUAL "x${expected}")
#message("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"")
@@ -97,3 +99,89 @@ TEST("REVERSE empty result" "")
list(SORT result)
TEST("SORT empty result" "")
+
+set(No-Arguments-RESULT 1)
+set(No-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-No-Arguments.cmake:1 \\(list\\):.*list must be called with at least two arguments.*")
+
+# these trigger top-level condition
+foreach(cmd IN ITEMS Append Find Get Insert Length Reverse Remove_At Remove_Duplicates Remove_Item Sort)
+ set(${cmd}-No-Arguments-RESULT 1)
+ set(${cmd}-No-Arguments-STDERR ".*CMake Error at List-${cmd}-No-Arguments.cmake:1 \\(list\\):.*list must be called with at least two arguments.*")
+ string(TOUPPER ${cmd} cmd_upper)
+ set(_test_file_name "${CMAKE_CURRENT_BINARY_DIR}/List-${cmd}-No-Arguments.cmake")
+ file(WRITE "${_test_file_name}" "list(${cmd_upper})\n")
+ check_cmake_test_single(List "${cmd}-No-Arguments" "${_test_file_name}")
+endforeach()
+
+set(Get-List-Only-STDERR "at least three")
+set(Find-List-Only-STDERR "three")
+set(Insert-List-Only-STDERR "at least three")
+set(Length-List-Only-STDERR "two")
+set(Remove_At-List-Only-STDERR "at least two")
+set(Remove_Item-List-Only-STDERR "two or more")
+
+foreach(cmd IN ITEMS Find Get Insert Length Remove_At Remove_Item)
+ string(TOUPPER ${cmd} cmd_upper)
+ set(${cmd}-List-Only-RESULT 1)
+ set(${cmd}-List-Only-STDERR ".*CMake Error at List-${cmd}-List-Only.cmake:1 \\(list\\):.*list sub-command ${cmd_upper} requires ${${cmd}-List-Only-STDERR} arguments.*")
+ set(_test_file_name "${CMAKE_CURRENT_BINARY_DIR}/List-${cmd}-List-Only.cmake")
+ file(WRITE "${_test_file_name}" "list(${cmd_upper} mylist)\n")
+ check_cmake_test_single(List "${cmd}-List-Only" "${_test_file_name}")
+endforeach()
+
+set(Length-Too-Many-Arguments-RESULT 1)
+set(Length-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Length-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command LENGTH requires two arguments.*")
+
+set(Reverse-Too-Many-Arguments-RESULT 1)
+set(Reverse-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Reverse-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REVERSE only takes one argument.*")
+
+set(Remove_Duplicates-Too-Many-Arguments-RESULT 1)
+set(Remove_Duplicates-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Remove_Duplicates-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REMOVE_DUPLICATES only takes one argument.*")
+
+set(Sort-Too-Many-Arguments-RESULT 1)
+set(Sort-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Sort-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command SORT only takes one argument.*")
+
+set(Invalid-Subcommand-RESULT 1)
+set(Invalid-Subcommand-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Invalid-Subcommand.cmake:1 \\(list\\):.*list does not recognize sub-command NO_SUCH_SUBCOMMAND.*")
+
+foreach(cmd Get Insert Remove_At)
+ set(${cmd}-Invalid-Index-RESULT 1)
+ set(${cmd}-Invalid-Index-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-${cmd}-Invalid-Index.cmake:2 \\(list\\):.*list index: 3 out of range \\(-3, 2\\).*")
+endforeach()
+
+foreach(cmd Remove_Item Reverse Remove_Duplicates Sort Remove_At)
+ string(TOUPPER ${cmd} Cmd)
+ set(${cmd}-Nonexistent-List-RESULT 1)
+ set(${cmd}-Nonexistent-List-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-${cmd}-Nonexistent-List.cmake:2 \\(list\\):.*sub-command ${Cmd} requires list to be present.*")
+endforeach()
+
+set(Get-CMP0007-Warn-RESULT 0)
+set(Get-CMP0007-Warn-STDERR ".*CMake Warning \\(dev\\) at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Get-CMP0007-Warn.cmake:3 \\(list\\):.*Policy CMP0007 is not set:.*")
+
+check_cmake_test(List
+ No-Arguments
+ Length-Too-Many-Arguments
+ Reverse-Too-Many-Arguments
+ Remove_Duplicates-Too-Many-Arguments
+ Sort-Too-Many-Arguments
+ Invalid-Subcommand
+ Get-Invalid-Index
+ Insert-Invalid-Index
+ Remove_Item-Nonexistent-List
+ Reverse-Nonexistent-List
+ Remove_Duplicates-Nonexistent-List
+ Sort-Nonexistent-List
+ Remove_At-Nonexistent-List
+ Remove_At-Invalid-Index
+ Get-CMP0007-Warn
+)
+
+set(thelist "" NEW OLD)
+
+foreach (_pol ${thelist})
+ cmake_policy(SET CMP0007 ${_pol})
+ list(GET thelist 1 thevalue)
+ if (NOT thevalue STREQUAL _pol)
+ message(SEND_ERROR "returned element '${thevalue}', but expected '${_pol}'")
+ endif()
+endforeach (_pol)
diff --git a/Tests/CMakeTests/Make_Directory-NoArg.cmake b/Tests/CMakeTests/Make_Directory-NoArg.cmake
new file mode 100644
index 0000000..25b6f89
--- /dev/null
+++ b/Tests/CMakeTests/Make_Directory-NoArg.cmake
@@ -0,0 +1 @@
+file(MAKE_DIRECTORY)
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 891fa11..3a92d81 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -14,8 +14,15 @@ add_custom_target(check ALL
-Dtest_and_1=$<AND:1>
-Dtest_and_1_0=$<AND:1,0>
-Dtest_and_1_1=$<AND:1,1>
+ # Ordinarily, the 'invalidcontent' would cause an error, but
+ # the '0' makes the AND abort early.
+ -Dtest_and_0_invalidcontent=$<AND:0,invalidcontent>
-Dtest_config_0=$<CONFIG:$<CONFIGURATION>x>
-Dtest_config_1=$<CONFIG:$<CONFIGURATION>>
+ -Dtest_config_debug=$<CONFIG:Debug>$<CONFIG:DEBUG>$<CONFIG:DeBuG>
+ -Dtest_config_release=$<CONFIG:Release>$<CONFIG:RELEASE>$<CONFIG:ReLeAsE>
+ -Dtest_config_relwithdebinfo=$<CONFIG:RelWithDebInfo>$<CONFIG:RELWITHDEBINFO>$<CONFIG:relwithdebinfo>
+ -Dtest_config_minsizerel=$<CONFIG:MinSizeRel>$<CONFIG:MINSIZEREL>$<CONFIG:minsizerel>
-Dtest_not_0=$<NOT:0>
-Dtest_not_1=$<NOT:1>
-Dtest_or_0=$<OR:0>
@@ -24,6 +31,7 @@ add_custom_target(check ALL
-Dtest_or_1=$<OR:1>
-Dtest_or_1_0=$<OR:1,0>
-Dtest_or_1_1=$<OR:1,1>
+ -Dtest_or_1_invalidcontent=$<OR:1,invalidcontent>
-Dtest_bool_notfound=$<BOOL:NOTFOUND>
-Dtest_bool_foo_notfound=$<BOOL:Foo-NOTFOUND>
-Dtest_bool_true=$<BOOL:True>
diff --git a/Tests/GeneratorExpression/check.cmake b/Tests/GeneratorExpression/check.cmake
index 8ffa481..af436de 100644
--- a/Tests/GeneratorExpression/check.cmake
+++ b/Tests/GeneratorExpression/check.cmake
@@ -15,8 +15,14 @@ check(test_and_0_1 "0")
check(test_and_1 "1")
check(test_and_1_0 "0")
check(test_and_1_1 "1")
+check(test_and_0_invalidcontent "0")
check(test_config_0 "0")
check(test_config_1 "1")
+foreach(c debug release relwithdebinfo minsizerel)
+ if(NOT "${test_config_${c}}" MATCHES "^(0+|1+)$")
+ message(SEND_ERROR "test_config_${c} is \"${test_config_${c}}\", not all 0 or all 1")
+ endif()
+endforeach()
check(test_not_0 "1")
check(test_not_1 "0")
check(test_or_0 "0")
@@ -25,6 +31,7 @@ check(test_or_0_1 "1")
check(test_or_1 "1")
check(test_or_1_0 "1")
check(test_or_1_1 "1")
+check(test_or_1_invalidcontent "1")
check(test_bool_notfound "0")
check(test_bool_foo_notfound "0")
check(test_bool_true "1")
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 8c67625..360ad78 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -55,6 +55,7 @@ add_RunCMake_test(find_package)
add_RunCMake_test(include)
add_RunCMake_test(include_directories)
add_RunCMake_test(list)
+add_RunCMake_test(load_command)
if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
add_RunCMake_test(include_external_msproject)
diff --git a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt
index 36302db..0e48ba4 100644
--- a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt
+++ b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt
@@ -41,4 +41,13 @@ CMake Error at BadAND.cmake:1 \(add_custom_target\):
Parameters to \$<AND> must resolve to either '0' or '1'.
Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at BadAND.cmake:1 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<AND:1,nothing>
+
+ Parameters to \$<AND> must resolve to either '0' or '1'.
+Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/GeneratorExpression/BadAND.cmake b/Tests/RunCMake/GeneratorExpression/BadAND.cmake
index 265e414..8a7993f 100644
--- a/Tests/RunCMake/GeneratorExpression/BadAND.cmake
+++ b/Tests/RunCMake/GeneratorExpression/BadAND.cmake
@@ -4,4 +4,5 @@ add_custom_target(check ALL COMMAND check
$<AND:,>
$<AND:01>
$<AND:nothing>
+ $<AND:1,nothing>
VERBATIM)
diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt
index d4ccab7..eb26328 100644
--- a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt
+++ b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt
@@ -41,4 +41,13 @@ CMake Error at BadOR.cmake:1 \(add_custom_target\):
Parameters to \$<OR> must resolve to either '0' or '1'.
Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at BadOR.cmake:1 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<OR:0,nothing>
+
+ Parameters to \$<OR> must resolve to either '0' or '1'.
+Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/GeneratorExpression/BadOR.cmake b/Tests/RunCMake/GeneratorExpression/BadOR.cmake
index 0813400..c0309da 100644
--- a/Tests/RunCMake/GeneratorExpression/BadOR.cmake
+++ b/Tests/RunCMake/GeneratorExpression/BadOR.cmake
@@ -4,4 +4,5 @@ add_custom_target(check ALL COMMAND check
$<OR:,>
$<OR:01>
$<OR:nothing>
+ $<OR:0,nothing>
VERBATIM)
diff --git a/Tests/RunCMake/load_command/CMakeLists.txt b/Tests/RunCMake/load_command/CMakeLists.txt
new file mode 100644
index 0000000..e8db6b0
--- /dev/null
+++ b/Tests/RunCMake/load_command/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/load_command/LoadCommandDeprecated-stderr.txt b/Tests/RunCMake/load_command/LoadCommandDeprecated-stderr.txt
new file mode 100644
index 0000000..7d374b2
--- /dev/null
+++ b/Tests/RunCMake/load_command/LoadCommandDeprecated-stderr.txt
@@ -0,0 +1,6 @@
+CMake Warning \(dev\) at LoadCommandDeprecated.cmake:1 \(load_command\):
+ The "load_command" command will be removed in CMake 3.0. See command
+ documentation for details.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/load_command/LoadCommandDeprecated.cmake b/Tests/RunCMake/load_command/LoadCommandDeprecated.cmake
new file mode 100644
index 0000000..9e9b1f4
--- /dev/null
+++ b/Tests/RunCMake/load_command/LoadCommandDeprecated.cmake
@@ -0,0 +1 @@
+load_command()
diff --git a/Tests/RunCMake/load_command/RunCMakeTest.cmake b/Tests/RunCMake/load_command/RunCMakeTest.cmake
new file mode 100644
index 0000000..9a0f98d
--- /dev/null
+++ b/Tests/RunCMake/load_command/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(LoadCommandDeprecated)
diff --git a/Utilities/Git/pre-commit b/Utilities/Git/pre-commit
index d308a81..a35d111 100755
--- a/Utilities/Git/pre-commit
+++ b/Utilities/Git/pre-commit
@@ -47,18 +47,16 @@ if test -z "$HOOKS_ALLOW_KWSYS"; then
'"$(echo "$files" | sed 's/^/ /')"'
-cannot be committed through Git. KWSys is kept in a CVS repository
-shared by several projects. A robot replays changes committed there
-into the Source/kwsys directory in CMake. Please send changes to
-this directory separately. Run
+should not be made directly in CMake. KWSys is kept in its own Git
+repository and shared by several projects. Please visit
- git reset HEAD -- Source/kwsys
+ http://public.kitware.com/Wiki/KWSys/Git
-to unstage these changes and then
+to contribute changes directly to KWSys. Run
- git diff -- Source/kwsys > kwsys.patch
+ git reset HEAD -- Source/kwsys
-to construct the patch. Alternatively, set environment variable
+to unstage these changes. Alternatively, set environment variable
HOOKS_ALLOW_KWSYS=1
diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in
index 060a520..f93ddba 100644
--- a/Utilities/KWIML/ABI.h.in
+++ b/Utilities/KWIML/ABI.h.in
@@ -414,6 +414,10 @@ suppression macro @KWIML@_ABI_NO_VERIFY was defined.
#elif defined(__SYSC_ZARCH__)
# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+/* VAX */
+#elif defined(__vax__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
/* Unknown CPU */
#elif !defined(@KWIML@_ABI_NO_ERROR_ENDIAN)
# error "Byte order of target CPU unknown."
diff --git a/bootstrap b/bootstrap
index 713f01f..0e6d16c 100755
--- a/bootstrap
+++ b/bootstrap
@@ -93,6 +93,19 @@ else
cmake_system_openvms=false
fi
+# Determine whether this is Linux
+if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then
+ cmake_system_linux=true
+ # find out if it is a HP PA-RISC machine
+ if uname -m | grep parisc >/dev/null 2>&1; then
+ cmake_machine_parisc=true
+ else
+ cmake_machine_parisc=false
+ fi
+else
+ cmake_system_linux=false
+fi
+
# Choose the generator to use for bootstrapping.
if ${cmake_system_mingw}; then
# Bootstrapping from an MSYS prompt.
@@ -357,7 +370,7 @@ Directory and file names:
# Display CMake bootstrap usage
cmake_version_display()
{
- echo "CMake ${cmake_version}, Copyright 2000-2011 Kitware, Inc."
+ echo "CMake ${cmake_version}, Copyright 2000-2012 Kitware, Inc."
}
# Display CMake bootstrap error, display the log file and exit
@@ -678,6 +691,14 @@ if ${cmake_system_haiku}; then
cmake_ld_flags="${LDFLAGS} -lroot -lbe"
fi
+if ${cmake_system_linux}; then
+ # avoid binutils problem with large binaries, e.g. when building CMake in debug mode
+ # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230
+ if ${cmake_machine_parisc}; then
+ cmake_ld_flags="${LDFLAGS} -Wl,--unique=.text.*"
+ fi
+fi
+
#-----------------------------------------------------------------------------
# Detect known toolchains on some platforms.
cmake_toolchains=''