summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt18
-rw-r--r--CTestCustom.cmake.in17
-rw-r--r--Help/command/ctest_read_custom_files.rst3
-rw-r--r--Help/command/ctest_test.rst3
-rw-r--r--Help/command/find_program.rst7
-rw-r--r--Help/command/get_filename_component.rst39
-rw-r--r--Help/command/install.rst8
-rw-r--r--Help/command/string.rst303
-rw-r--r--Help/command/try_compile.rst3
-rw-r--r--Help/manual/cmake-commands.7.rst2
-rw-r--r--Help/manual/cmake-developer.7.rst6
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst19
-rw-r--r--Help/manual/ctest.1.rst6
-rw-r--r--Help/policy/CMP0065.rst27
-rw-r--r--Help/prop_sf/OBJECT_DEPENDS.rst13
-rw-r--r--Help/prop_tgt/ENABLE_EXPORTS.rst5
-rw-r--r--Help/prop_tgt/NO_SONAME.rst6
-rw-r--r--Help/release/dev/CPack-updates.rst11
-rw-r--r--Help/release/dev/ExternalProject_stash_save_all.rst5
-rw-r--r--Help/release/dev/FindHDF5-updates.rst6
-rw-r--r--Help/release/dev/FindOpenSSL-static-libs.rst5
-rw-r--r--Help/release/dev/FindProtobuf-python-extension.rst6
-rw-r--r--Help/release/dev/FindZLIB-per-config.rst5
-rw-r--r--Help/release/dev/FindwxWidgets-updates.rst4
-rw-r--r--Help/release/dev/Threads-CXX.rst6
-rw-r--r--Help/release/dev/cpack-deb-checksum-on-symlinks.rts4
-rw-r--r--Help/release/dev/cpack-deb-component-dependencies.rst12
-rw-r--r--Help/release/dev/cpack-deb-fakeroot-removal.rts4
-rw-r--r--Help/release/dev/cpack-package-empty-dirs.rts4
-rw-r--r--Help/release/dev/ctest-custom-output-size.rst7
-rw-r--r--Help/release/dev/find_program-NAMES_PER_DIR.rst6
-rw-r--r--Help/release/dev/get-filename-component-base-dir.rst6
-rw-r--r--Help/release/dev/install-directory-dest-genex.rst5
-rw-r--r--Help/release/dev/install-files-dest-genex.rst5
-rw-r--r--Help/release/dev/java-updates.rst3
-rw-r--r--Help/release/dev/mingw-compile-features-C.rst5
-rw-r--r--Help/release/dev/modules-no-soname.rst7
-rw-r--r--Help/release/dev/ms-manifest-files.rst7
-rw-r--r--Help/release/dev/pkg-config-variable-function.rst6
-rw-r--r--Help/release/dev/restrict-shlib-link-flags-to-enable-exports.rst6
-rw-r--r--Help/variable/CMAKE_ENABLE_EXPORTS.rst22
-rw-r--r--Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst7
-rw-r--r--Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst7
-rw-r--r--Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst7
-rw-r--r--Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst7
-rw-r--r--Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst7
-rw-r--r--Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst8
-rw-r--r--Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst8
-rw-r--r--Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst8
-rw-r--r--Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst8
-rw-r--r--Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst7
-rw-r--r--Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst6
-rw-r--r--Help/variable/CTEST_CUSTOM_POST_TEST.rst6
-rw-r--r--Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst7
-rw-r--r--Help/variable/CTEST_CUSTOM_PRE_TEST.rst6
-rw-r--r--Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst7
-rw-r--r--Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst7
-rw-r--r--Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst7
-rw-r--r--Help/variable/CTEST_CUSTOM_XXX.txt2
-rw-r--r--Help/variable/CTEST_EXTRA_COVERAGE_GLOB.rst7
-rw-r--r--Modules/BasicConfigVersion-AnyNewerVersion.cmake.in8
-rw-r--r--Modules/BasicConfigVersion-ExactVersion.cmake.in10
-rw-r--r--Modules/BasicConfigVersion-SameMajorVersion.cmake.in10
-rw-r--r--Modules/CMakeCCompiler.cmake.in9
-rw-r--r--Modules/CMakeCCompilerId.c.in11
-rw-r--r--Modules/CMakeCInformation.cmake2
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in9
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in10
-rw-r--r--Modules/CMakeCXXInformation.cmake2
-rw-r--r--Modules/CMakeClDeps.cmake34
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake8
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake8
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake70
-rw-r--r--Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake4
-rw-r--r--Modules/CMakeFortranInformation.cmake2
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake2
-rw-r--r--Modules/CMakeTestSwiftCompiler.cmake52
-rw-r--r--Modules/CPack.cmake133
-rw-r--r--Modules/CPackDeb.cmake115
-rw-r--r--Modules/CTestCoverageCollectGCOV.cmake2
-rw-r--r--Modules/CheckForPthreads.c2
-rw-r--r--Modules/CheckFunctionExists.c3
-rw-r--r--Modules/CheckFunctionExists.cmake14
-rw-r--r--Modules/CheckLibraryExists.cmake13
-rw-r--r--Modules/CheckSymbolExists.cmake10
-rw-r--r--Modules/Compiler/AppleClang-C.cmake7
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake8
-rw-r--r--Modules/Compiler/Clang-C.cmake11
-rw-r--r--Modules/Compiler/Clang-CXX.cmake9
-rw-r--r--Modules/Compiler/GNU-C.cmake16
-rw-r--r--Modules/Compiler/GNU-CXX.cmake7
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake9
-rw-r--r--Modules/CompilerId/main.swift.in2
-rw-r--r--Modules/ExternalProject.cmake24
-rw-r--r--Modules/FindCUDA.cmake5
-rw-r--r--Modules/FindHDF5.cmake32
-rw-r--r--Modules/FindJNI.cmake14
-rw-r--r--Modules/FindOpenSSL.cmake35
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake2
-rw-r--r--Modules/FindPkgConfig.cmake30
-rw-r--r--Modules/FindProtobuf.cmake67
-rw-r--r--Modules/FindPythonInterp.cmake2
-rw-r--r--Modules/FindPythonLibs.cmake86
-rw-r--r--Modules/FindThreads.cmake27
-rw-r--r--Modules/FindZLIB.cmake45
-rw-r--r--Modules/FindwxWidgets.cmake39
-rw-r--r--Modules/GenerateExportHeader.cmake2
-rw-r--r--Modules/Internal/FeatureTesting.cmake2
-rw-r--r--Modules/Platform/Darwin.cmake2
-rw-r--r--Modules/Platform/GHS-MULTI-Initialize.cmake36
-rw-r--r--Modules/Platform/HP-UX.cmake8
-rw-r--r--Modules/Platform/Windows-GNU.cmake2
-rw-r--r--Modules/Platform/Windows-MSVC.cmake4
-rw-r--r--Modules/UseJava.cmake157
-rw-r--r--Modules/UseSWIG.cmake10
-rw-r--r--Modules/UseVTK40.cmake29
-rw-r--r--Modules/UseVTKBuildSettings40.cmake38
-rw-r--r--Modules/UseVTKConfig40.cmake409
-rw-r--r--Source/CMakeLists.txt19
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx2
-rw-r--r--Source/CPack/OSXScriptLauncher.cxx11
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXAccessControlList.cxx2
-rw-r--r--Source/CPack/WiX/cmWIXPatch.cxx2
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.cxx2
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx320
-rw-r--r--Source/CPack/cmCPackGenerator.cxx10
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx3
-rw-r--r--Source/CPack/cpack.cxx10
-rw-r--r--Source/CTest/cmCTestBZR.cxx1
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx2
-rw-r--r--Source/CTest/cmCTestGIT.cxx2
-rw-r--r--Source/CTest/cmCTestLaunch.cxx5
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx16
-rw-r--r--Source/CTest/cmCTestP4.cxx2
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx46
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx7
-rw-r--r--Source/CTest/cmCTestTestHandler.h5
-rw-r--r--Source/CTest/cmParseJacocoCoverage.cxx139
-rw-r--r--Source/Checks/cm_c11_thread_local.c2
-rw-r--r--Source/Checks/cm_c11_thread_local.cmake33
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx8
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx17
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx25
-rw-r--r--Source/CursesDialog/cmCursesWidget.cxx2
-rw-r--r--Source/QtDialog/CMakeLists.txt18
-rw-r--r--Source/bindexplib.cxx19
-rw-r--r--Source/cmArchiveWrite.cxx74
-rw-r--r--Source/cmArchiveWrite.h95
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx4
-rw-r--r--Source/cmCPluginAPI.cxx4
-rw-r--r--Source/cmCTest.cxx53
-rw-r--r--Source/cmCallVisualStudioMacro.cxx2
-rw-r--r--Source/cmCommonTargetGenerator.cxx17
-rw-r--r--Source/cmCommonTargetGenerator.h1
-rw-r--r--Source/cmComputeLinkDepends.cxx30
-rw-r--r--Source/cmComputeLinkDepends.h2
-rw-r--r--Source/cmComputeLinkInformation.cxx12
-rw-r--r--Source/cmComputeTargetDepends.cxx7
-rw-r--r--Source/cmCoreTryCompile.cxx16
-rw-r--r--Source/cmCryptoHash.cxx2
-rw-r--r--Source/cmDefinitions.cxx14
-rw-r--r--Source/cmDefinitions.h17
-rw-r--r--Source/cmExportFileGenerator.cxx10
-rw-r--r--Source/cmExportInstallFileGenerator.cxx4
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx2
-rw-r--r--Source/cmExtraKateGenerator.cxx1
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx1
-rw-r--r--Source/cmFindBase.cxx6
-rw-r--r--Source/cmFindLibraryCommand.cxx12
-rw-r--r--Source/cmFindPackageCommand.cxx7
-rw-r--r--Source/cmFindProgramCommand.cxx153
-rw-r--r--Source/cmFindProgramCommand.h10
-rw-r--r--Source/cmGeneratedFileStream.h4
-rw-r--r--Source/cmGeneratorExpressionNode.cxx4
-rw-r--r--Source/cmGeneratorTarget.cxx1371
-rw-r--r--Source/cmGeneratorTarget.h89
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx20
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx32
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx4
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h3
-rw-r--r--Source/cmGlobalGenerator.cxx290
-rw-r--r--Source/cmGlobalGenerator.h25
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx5
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h3
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx6
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx5
-rw-r--r--Source/cmGlobalNinjaGenerator.h14
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx98
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h9
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx13
-rw-r--r--Source/cmGlobalVisualStudio14Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx9
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx13
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx30
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h12
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx36
-rw-r--r--Source/cmGlobalXCodeGenerator.h3
-rw-r--r--Source/cmGraphVizWriter.cxx5
-rw-r--r--Source/cmInstallCommand.cxx4
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx47
-rw-r--r--Source/cmInstallDirectoryGenerator.h11
-rw-r--r--Source/cmInstallExportGenerator.cxx13
-rw-r--r--Source/cmInstallExportGenerator.h8
-rw-r--r--Source/cmInstallFilesCommand.cxx2
-rw-r--r--Source/cmInstallFilesGenerator.cxx40
-rw-r--r--Source/cmInstallFilesGenerator.h15
-rw-r--r--Source/cmInstallProgramsCommand.cxx2
-rw-r--r--Source/cmLinkItem.h62
-rw-r--r--Source/cmLinkedTree.h7
-rw-r--r--Source/cmLocalCommonGenerator.cxx5
-rw-r--r--Source/cmLocalCommonGenerator.h4
-rw-r--r--Source/cmLocalGenerator.cxx143
-rw-r--r--Source/cmLocalGenerator.h19
-rw-r--r--Source/cmLocalGhsMultiGenerator.cxx5
-rw-r--r--Source/cmLocalGhsMultiGenerator.h3
-rw-r--r--Source/cmLocalNinjaGenerator.cxx5
-rw-r--r--Source/cmLocalNinjaGenerator.h3
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx9
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h4
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx8
-rw-r--r--Source/cmLocalVisualStudio10Generator.h4
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx25
-rw-r--r--Source/cmLocalVisualStudio6Generator.h4
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx57
-rw-r--r--Source/cmLocalVisualStudio7Generator.h4
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx10
-rw-r--r--Source/cmLocalVisualStudioGenerator.h4
-rw-r--r--Source/cmLocalXCodeGenerator.cxx5
-rw-r--r--Source/cmLocalXCodeGenerator.h4
-rw-r--r--Source/cmMakefile.cxx348
-rw-r--r--Source/cmMakefile.h24
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileTargetGenerator.cxx11
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx10
-rw-r--r--Source/cmNinjaTargetGenerator.cxx11
-rw-r--r--Source/cmPolicies.h6
-rw-r--r--Source/cmProjectCommand.cxx2
-rw-r--r--Source/cmQtAutoGenerators.cxx26
-rw-r--r--Source/cmStandardIncludes.h8
-rw-r--r--Source/cmState.cxx352
-rw-r--r--Source/cmState.h46
-rw-r--r--Source/cmSystemTools.cxx153
-rw-r--r--Source/cmSystemTools.h6
-rw-r--r--Source/cmTarget.cxx1372
-rw-r--r--Source/cmTarget.h112
-rw-r--r--Source/cmTestGenerator.cxx19
-rw-r--r--Source/cmTestGenerator.h4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx59
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h1
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx6
-rw-r--r--Source/cmXCode21Object.cxx2
-rw-r--r--Source/cmXMLSafe.cxx8
-rw-r--r--Source/cmXMLSafe.h8
-rw-r--r--Source/cmake.cxx22
-rw-r--r--Source/cmake.h2
-rw-r--r--Source/cmake.version.manifest18
-rw-r--r--Source/cmcmd.cxx421
-rw-r--r--Source/cmcmd.h14
-rw-r--r--Source/ctest.cxx4
-rw-r--r--Source/kwsys/CMakeEmptyInputFile.in1
-rw-r--r--Source/kwsys/CMakeLists.txt202
-rw-r--r--Source/kwsys/CommandLineArguments.cxx103
-rw-r--r--Source/kwsys/CommandLineArguments.hxx.in56
-rw-r--r--Source/kwsys/Configure.hxx.in144
-rw-r--r--Source/kwsys/Directory.cxx21
-rw-r--r--Source/kwsys/Directory.hxx.in16
-rw-r--r--Source/kwsys/DynamicLoader.cxx28
-rw-r--r--Source/kwsys/DynamicLoader.hxx.in18
-rw-r--r--Source/kwsys/Encoding.hxx.in22
-rw-r--r--Source/kwsys/EncodingCXX.cxx16
-rw-r--r--Source/kwsys/FStream.hxx.in6
-rw-r--r--Source/kwsys/Glob.cxx93
-rw-r--r--Source/kwsys/Glob.hxx.in44
-rw-r--r--Source/kwsys/IOStream.cxx88
-rw-r--r--Source/kwsys/IOStream.hxx.in32
-rw-r--r--Source/kwsys/RegularExpression.hxx.in60
-rw-r--r--Source/kwsys/String.hxx.in10
-rw-r--r--Source/kwsys/SystemInformation.cxx344
-rw-r--r--Source/kwsys/SystemInformation.hxx.in35
-rw-r--r--Source/kwsys/SystemTools.cxx957
-rw-r--r--Source/kwsys/SystemTools.hxx.in453
-rw-r--r--Source/kwsys/hash_fun.hxx.in46
-rw-r--r--Source/kwsys/hash_map.hxx.in124
-rw-r--r--Source/kwsys/hash_set.hxx.in122
-rw-r--r--Source/kwsys/hashtable.hxx.in387
-rw-r--r--Source/kwsys/kwsysPlatformTestsCXX.cxx274
-rw-r--r--Source/kwsys/kwsys_cstddef.hxx.in35
-rw-r--r--Source/kwsys/kwsys_ios_fstream.h.in46
-rw-r--r--Source/kwsys/kwsys_ios_iosfwd.h.in49
-rw-r--r--Source/kwsys/kwsys_ios_iostream.h.in99
-rw-r--r--Source/kwsys/kwsys_ios_sstream.h.in199
-rw-r--r--Source/kwsys/kwsys_stl.hxx.in49
-rw-r--r--Source/kwsys/kwsys_stl_string.hxx.in123
-rw-r--r--Source/kwsys/testCommandLineArguments.cxx70
-rw-r--r--Source/kwsys/testCommandLineArguments1.cxx34
-rw-r--r--Source/kwsys/testDynamicLoader.cxx27
-rw-r--r--Source/kwsys/testEncoding.cxx3
-rw-r--r--Source/kwsys/testFStream.cxx21
-rw-r--r--Source/kwsys/testHashSTL.cxx10
-rw-r--r--Source/kwsys/testIOS.cxx73
-rw-r--r--Source/kwsys/testProcess.c28
-rw-r--r--Source/kwsys/testSystemInformation.cxx22
-rw-r--r--Source/kwsys/testSystemTools.cxx449
-rw-r--r--Tests/CMakeLib/testVisualStudioSlnParser.cxx60
-rw-r--r--Tests/CMakeLib/testXMLParser.cxx4
-rw-r--r--Tests/CMakeLists.txt63
-rw-r--r--Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in7
-rw-r--r--Tests/CPackComponentsDEB/CMakeLists.txt37
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake12
-rw-r--r--Tests/CTestCoverageCollectGCOV/test.cmake.in6
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt11
-rw-r--r--Tests/ExportImport/Export/testLibNoSONAME.c7
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt44
-rw-r--r--Tests/ExportImport/Import/A/check_lib_nosoname.cmake7
-rw-r--r--Tests/ExportImport/Import/A/check_lib_soname.cmake7
-rw-r--r--Tests/FindGTK2/CMakeLists.txt3
-rw-r--r--Tests/FindThreads/C-only/CMakeLists.txt10
-rw-r--r--Tests/FindThreads/CMakeLists.txt11
-rw-r--r--Tests/FindThreads/CXX-only/CMakeLists.txt13
-rw-r--r--Tests/JavaJavah/B.cpp10
-rw-r--r--Tests/JavaJavah/B.java19
-rw-r--r--Tests/JavaJavah/CMakeLists.txt20
-rw-r--r--Tests/JavaJavah/HelloWorld2.java10
-rw-r--r--Tests/MSManifest/CMakeLists.txt5
-rw-r--r--Tests/MSManifest/Subdir/CMakeLists.txt9
-rw-r--r--Tests/MSManifest/Subdir/check.cmake6
-rw-r--r--Tests/MSManifest/Subdir/main.c1
-rw-r--r--Tests/MSManifest/Subdir/test.manifest.in4
-rw-r--r--Tests/Module/GenerateExportHeader/CMakeLists.txt4
-rw-r--r--Tests/Plugin/CMakeLists.txt9
-rw-r--r--Tests/Plugin/PluginTest/CMakeLists.txt17
-rw-r--r--Tests/Plugin/check_mod_soname.cmake17
-rw-r--r--Tests/Plugin/src/example_exe.cxx20
-rw-r--r--Tests/RunCMake/BuildDepends/C-Exe-Manifest.cmake19
-rw-r--r--Tests/RunCMake/BuildDepends/C-Exe-Manifest.step1.cmake6
-rw-r--r--Tests/RunCMake/BuildDepends/C-Exe-Manifest.step2.cmake6
-rw-r--r--Tests/RunCMake/BuildDepends/C-Exe.cmake12
-rw-r--r--Tests/RunCMake/BuildDepends/C-Exe.step1.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/C-Exe.step2.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake34
-rw-r--r--Tests/RunCMake/BuildDepends/check.cmake37
-rw-r--r--Tests/RunCMake/BuildDepends/main.c1
-rw-r--r--Tests/RunCMake/CMP0026/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0026/clear-cached-information.cmake14
-rw-r--r--Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0064/CMP0064-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0065/BuildTargetInSubProject.cmake15
-rw-r--r--Tests/RunCMake/CMP0065/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0065/NEWBad.cmake4
-rw-r--r--Tests/RunCMake/CMP0065/NEWGood.cmake4
-rw-r--r--Tests/RunCMake/CMP0065/OLDBad1.cmake4
-rw-r--r--Tests/RunCMake/CMP0065/OLDBad2.cmake4
-rw-r--r--Tests/RunCMake/CMP0065/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/CMP0065/WARN-OFF.cmake3
-rw-r--r--Tests/RunCMake/CMP0065/WARN-ON-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0065/WARN-ON.cmake3
-rw-r--r--Tests/RunCMake/CMP0065/subproject/CMakeLists.txt22
-rw-r--r--Tests/RunCMake/CMP0065/subproject/main.c7
-rw-r--r--Tests/RunCMake/CMakeLists.txt11
-rw-r--r--Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake5
-rw-r--r--Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake2
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake6
-rw-r--r--Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake33
-rw-r--r--Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake16
-rw-r--r--Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake1
-rw-r--r--Tests/RunCMake/CPack/DEB/Helpers.cmake15
-rw-r--r--Tests/RunCMake/CPack/DEB_EXTRA.cmake28
-rw-r--r--Tests/RunCMake/CPack/EMPTY_DIR.cmake4
-rw-r--r--Tests/RunCMake/CPack/README.txt4
-rw-r--r--Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake7
-rw-r--r--Tests/RunCMake/CPackConfig/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/CPackConfig/Default-check.cmake7
-rw-r--r--Tests/RunCMake/CPackConfig/Default.cmake3
-rw-r--r--Tests/RunCMake/CPackConfig/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/CPackConfig/Simple-check.cmake3
-rw-r--r--Tests/RunCMake/CPackConfig/Simple.cmake1
-rw-r--r--Tests/RunCMake/CPackConfig/Special-check.cmake5
-rw-r--r--Tests/RunCMake/CPackConfig/Special.cmake3
-rw-r--r--Tests/RunCMake/CPackConfig/Verbatim-check.cmake10
-rw-r--r--Tests/RunCMake/CPackConfig/Verbatim.cmake5
-rw-r--r--Tests/RunCMake/CPackConfig/check.cmake10
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake17
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake17
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt1
-rw-r--r--Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt1
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake9
-rw-r--r--Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt4
-rw-r--r--Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake3
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion.cmake1
-rw-r--r--Tests/RunCMake/LinkStatic/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/LinkStatic/LINK_SEARCH_STATIC.cmake (renamed from Tests/RunCMake/set_property/LINK_SEARCH_STATIC.cmake)2
-rw-r--r--Tests/RunCMake/LinkStatic/LinkStatic.c (renamed from Tests/RunCMake/set_property/LinkStatic.c)0
-rw-r--r--Tests/RunCMake/LinkStatic/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/RunCMake.cmake8
-rw-r--r--Tests/RunCMake/Swift/Enable-stdout.txt1
-rw-r--r--Tests/RunCMake/Swift/Enable.cmake1
-rw-r--r--Tests/RunCMake/Swift/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake52
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeBundles.cmake45
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeInstallIOS-install-stdout.txt2
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake12
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeTbdStub-stdout.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeTbdStub.cmake2
-rw-r--r--Tests/RunCMake/XcodeProject/foo.cpp1
-rw-r--r--Tests/RunCMake/XcodeProject/main.m3
-rw-r--r--Tests/RunCMake/XcodeProject/osx.cmake18
-rw-r--r--Tests/RunCMake/ctest_test/CMakeLists.txt.in1
-rw-r--r--Tests/RunCMake/ctest_test/RunCMakeTest.cmake15
-rw-r--r--Tests/RunCMake/ctest_test/TestOutputSize-check.cmake17
-rwxr-xr-xTests/RunCMake/find_program/A/testA1
-rwxr-xr-xTests/RunCMake/find_program/A/testAandB1
-rwxr-xr-xTests/RunCMake/find_program/B/testAandB1
-rwxr-xr-xTests/RunCMake/find_program/B/testB1
-rw-r--r--Tests/RunCMake/find_program/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/find_program/DirsPerName-stdout.txt1
-rw-r--r--Tests/RunCMake/find_program/DirsPerName.cmake6
-rw-r--r--Tests/RunCMake/find_program/EnvAndHints-stdout.txt1
-rw-r--r--Tests/RunCMake/find_program/EnvAndHints.cmake8
-rw-r--r--Tests/RunCMake/find_program/NamesPerDir-stdout.txt1
-rw-r--r--Tests/RunCMake/find_program/NamesPerDir.cmake6
-rw-r--r--Tests/RunCMake/find_program/RunCMakeTest.cmake10
-rwxr-xr-xTests/RunCMake/find_program/Win/testCom.com0
-rwxr-xr-xTests/RunCMake/find_program/Win/testCom.exe0
-rwxr-xr-xTests/RunCMake/find_program/Win/testExe.exe0
-rw-r--r--Tests/RunCMake/find_program/WindowsCom-stdout.txt1
-rw-r--r--Tests/RunCMake/find_program/WindowsCom.cmake6
-rw-r--r--Tests/RunCMake/find_program/WindowsExe-stdout.txt1
-rw-r--r--Tests/RunCMake/find_program/WindowsExe.cmake6
-rw-r--r--Tests/RunCMake/get_filename_component/KnownComponents.cmake33
-rw-r--r--Tests/RunCMake/include_directories/DirectoryBefore-stdout.txt1
-rw-r--r--Tests/RunCMake/include_directories/DirectoryBefore.cmake4
-rw-r--r--Tests/RunCMake/include_directories/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-result.txt1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-stderr.txt6
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DESTINATION-bad.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt1
-rw-r--r--Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt6
-rw-r--r--Tests/RunCMake/install/FILES-DESTINATION-bad.cmake1
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt2
-rw-r--r--Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake3
-rw-r--r--Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt1
-rw-r--r--Tests/RunCMake/set_property/COMPILE_FEATURES.cmake2
-rw-r--r--Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt2
-rw-r--r--Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake3
-rw-r--r--Tests/RunCMake/set_property/Common.cmake28
-rw-r--r--Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt2
-rw-r--r--Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake3
-rw-r--r--Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt1
-rw-r--r--Tests/RunCMake/set_property/LINK_LIBRARIES.cmake9
-rw-r--r--Tests/RunCMake/set_property/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/set_property/SOURCES-stdout.txt1
-rw-r--r--Tests/RunCMake/set_property/SOURCES.cmake2
-rw-r--r--Tests/RunCMake/set_property/USER_PROP-stdout.txt2
-rw-r--r--Tests/RunCMake/set_property/USER_PROP.cmake3
-rw-r--r--Tests/SimpleInstall/CMakeLists.txt10
-rw-r--r--Tests/SimpleInstallS2/CMakeLists.txt10
-rw-r--r--Tests/SwiftMix/SwiftMain.swift10
-rw-r--r--Tests/SwiftOnly/main.swift2
-rw-r--r--Tests/iOSNavApp/CMakeLists.txt1
-rw-r--r--Utilities/Release/create-cmake-release.cmake1
-rw-r--r--Utilities/Release/dash2win64_cygwin.cmake1
-rw-r--r--Utilities/Release/dash2win64_release.cmake1
-rw-r--r--Utilities/Release/dashmacmini2_release.cmake2
-rw-r--r--Utilities/Release/dashmacmini5_release.cmake2
-rw-r--r--Utilities/Release/linux64_release.cmake1
-rw-r--r--Utilities/Release/magrathea_release.cmake1
-rwxr-xr-xUtilities/Release/release_cmake.sh.in12
-rw-r--r--Utilities/cmcurl/CMakeLists.txt8
-rw-r--r--Utilities/cmjsoncpp/src/lib_json/json_writer.cpp4
-rwxr-xr-xbootstrap270
501 files changed, 8792 insertions, 7485 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 36244dd..94d138c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,7 +38,12 @@ endif()
# Use most-recent available language dialects with GNU and Clang
if(NOT DEFINED CMAKE_C_STANDARD AND NOT CMake_NO_C_STANDARD)
- set(CMAKE_C_STANDARD 11)
+ include(${CMake_SOURCE_DIR}/Source/Checks/cm_c11_thread_local.cmake)
+ if(NOT CMake_C11_THREAD_LOCAL_BROKEN)
+ set(CMAKE_C_STANDARD 11)
+ else()
+ set(CMAKE_C_STANDARD 99)
+ endif()
endif()
if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD)
include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx14_cstdio.cmake)
@@ -144,17 +149,6 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
endmacro()
-
-
-
-if(NOT CMake_TEST_EXTERNAL_CMAKE)
- set(CMAKE_BUILD_ON_VISUAL_STUDIO 0)
- if(WIN32 AND NOT UNIX AND NOT MINGW)
- set(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
- endif()
-endif()
-
-
#-----------------------------------------------------------------------
# a macro to determine the generator and ctest executable to use
# for testing. Simply to improve readability of the main script.
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index f29ac70..2adf317 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -1,9 +1,7 @@
-set(CTEST_CUSTOM_ERROR_MATCH
- ${CTEST_CUSTOM_ERROR_MATCH}
+list(APPEND CTEST_CUSTOM_ERROR_MATCH
"ERROR:")
-set(CTEST_CUSTOM_WARNING_EXCEPTION
- ${CTEST_CUSTOM_WARNING_EXCEPTION}
+list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"xtree.[0-9]+. : warning C4702: unreachable code"
"warning LNK4221"
"warning LNK4204" # Occurs by race condition with objects in small libs
@@ -32,6 +30,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.*CRYPT32.dll.*discarded by /OPT:REF"
"LINK : warning LNK4089: all references to.*PSAPI.DLL.*discarded by /OPT:REF"
"LINK : warning LNK4089: all references to.*RPCRT4.dll.*discarded by /OPT:REF"
"LINK : warning LNK4089: all references to.*SHELL32.dll.*discarded by /OPT:REF"
@@ -83,22 +82,18 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
)
if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode")
- set(CTEST_CUSTOM_COVERAGE_EXCLUDE
- ${CTEST_CUSTOM_COVERAGE_EXCLUDE}
+ list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
"XCode"
)
endif ()
if(NOT "@CMAKE_GENERATOR@" MATCHES "KDevelop")
- set(CTEST_CUSTOM_COVERAGE_EXCLUDE
- ${CTEST_CUSTOM_COVERAGE_EXCLUDE}
+ list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
"Kdevelop"
)
endif ()
-set(CTEST_CUSTOM_COVERAGE_EXCLUDE
- ${CTEST_CUSTOM_COVERAGE_EXCLUDE}
-
+list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
# Exclude kwsys files from coverage results. They are reported
# (with better coverage results) on kwsys dashboards...
"/Source/(cm|kw)sys/"
diff --git a/Help/command/ctest_read_custom_files.rst b/Help/command/ctest_read_custom_files.rst
index 0bc57cd..cf8e17a 100644
--- a/Help/command/ctest_read_custom_files.rst
+++ b/Help/command/ctest_read_custom_files.rst
@@ -9,3 +9,6 @@ read CTestCustom files.
Read all the CTestCustom.ctest or CTestCustom.cmake files from the
given directory.
+
+By default, invoking :manual:`ctest(1)` without a script will read custom
+files from the binary directory.
diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst
index 162db69..412e323 100644
--- a/Help/command/ctest_test.rst
+++ b/Help/command/ctest_test.rst
@@ -85,3 +85,6 @@ The options are:
been printed to the console. Output from the underlying test command is not
affected. Summary info detailing the percentage of passing tests is also
unaffected by the ``QUIET`` option.
+
+See also the :variable:`CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE`
+and :variable:`CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE` variables.
diff --git a/Help/command/find_program.rst b/Help/command/find_program.rst
index 2a5ce9a..d3430c0 100644
--- a/Help/command/find_program.rst
+++ b/Help/command/find_program.rst
@@ -2,7 +2,7 @@ find_program
------------
.. |FIND_XXX| replace:: find_program
-.. |NAMES| replace:: NAMES name1 [name2 ...]
+.. |NAMES| replace:: NAMES name1 [name2 ...] [NAMES_PER_DIR]
.. |SEARCH_XXX| replace:: program
.. |SEARCH_XXX_DESC| replace:: program
.. |prefix_XXX_SUBDIR| replace:: ``<prefix>/[s]bin``
@@ -26,3 +26,8 @@ find_program
:variable:`CMAKE_FIND_ROOT_PATH_MODE_PROGRAM`
.. include:: FIND_XXX.txt
+
+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.
diff --git a/Help/command/get_filename_component.rst b/Help/command/get_filename_component.rst
index 60488da..14c8cf2 100644
--- a/Help/command/get_filename_component.rst
+++ b/Help/command/get_filename_component.rst
@@ -3,6 +3,8 @@ get_filename_component
Get a specific component of a full filename.
+------------------------------------------------------------------------------
+
::
get_filename_component(<VAR> <FileName> <COMP> [CACHE])
@@ -15,23 +17,48 @@ Set ``<VAR>`` to a component of ``<FileName>``, where ``<COMP>`` is one of:
NAME = File name without directory
EXT = File name longest extension (.b.c from d/a.b.c)
NAME_WE = File name without directory or longest extension
- ABSOLUTE = Full path to file
- REALPATH = Full path to existing file with symlinks resolved
PATH = Legacy alias for DIRECTORY (use for CMake <= 2.8.11)
-Paths are returned with forward slashes and have no trailing slahes.
+Paths are returned with forward slashes and have no trailing slashes.
The longest file extension is always considered. If the optional
``CACHE`` argument is specified, the result variable is added to the
cache.
+------------------------------------------------------------------------------
+
+::
+
+ get_filename_component(<VAR> <FileName>
+ <COMP> [BASE_DIR <BASE_DIR>]
+ [CACHE])
+
+Set ``<VAR>`` to the absolute path of ``<FileName>``, where ``<COMP>`` is one
+of:
+
+::
+
+ ABSOLUTE = Full path to file
+ REALPATH = Full path to existing file with symlinks resolved
+
+If the provided ``<FileName>`` is a relative path, it is evaluated relative
+to the given base directory ``<BASE_DIR>``. If no base directory is
+provided, the default base directory will be
+:variable:`CMAKE_CURRENT_SOURCE_DIR`.
+
+Paths are returned with forward slashes and have no trailing slahes. If the
+optional ``CACHE`` argument is specified, the result variable is added to the
+cache.
+
+------------------------------------------------------------------------------
+
::
- get_filename_component(<VAR> FileName
+ get_filename_component(<VAR> <FileName>
PROGRAM [PROGRAM_ARGS <ARG_VAR>]
[CACHE])
-The program in ``FileName`` will be found in the system search path or
+The program in ``<FileName>`` will be found in the system search path or
left as a full path. If ``PROGRAM_ARGS`` is present with ``PROGRAM``, then
-any command-line arguments present in the ``FileName`` string are split
+any command-line arguments present in the ``<FileName>`` string are split
from the program name and stored in ``<ARG_VAR>``. This is used to
separate a program name from its arguments in a command line string.
diff --git a/Help/command/install.rst b/Help/command/install.rst
index c99ed73..423899e 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -192,6 +192,10 @@ The list of ``files...`` given to ``FILES`` or ``PROGRAMS`` may use
However, if any item begins in a generator expression it must evaluate
to a full path.
+The install destination given to the files install ``DESTINATION`` may
+use "generator expressions" with the syntax ``$<...>``. See the
+:manual:`cmake-generator-expressions(7)` manual for available expressions.
+
Installing Directories
^^^^^^^^^^^^^^^^^^^^^^
@@ -267,6 +271,10 @@ will install the ``icons`` directory to ``share/myproj/icons`` and the
file permissions, the scripts will be given specific permissions, and any
``CVS`` directories will be excluded.
+The install destination given to the directory install ``DESTINATION`` may
+use "generator expressions" with the syntax ``$<...>``. See the
+:manual:`cmake-generator-expressions(7)` manual for available expressions.
+
Custom Installation Logic
^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Help/command/string.rst b/Help/command/string.rst
index 20f8094..0361c74 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -1,102 +1,84 @@
string
------
+.. only:: html
+
+ .. contents::
+
String operations.
+Search and Replace
+^^^^^^^^^^^^^^^^^^
+
+FIND
+""""
+
::
- string(REGEX MATCH <regular_expression>
- <output variable> <input> [<input>...])
- string(REGEX MATCHALL <regular_expression>
- <output variable> <input> [<input>...])
- string(REGEX REPLACE <regular_expression>
- <replace_expression> <output variable>
- <input> [<input>...])
- string(REPLACE <match_string>
- <replace_string> <output variable>
- <input> [<input>...])
- string(APPEND <string variable> [<input>...])
- string(CONCAT <output variable> [<input>...])
- string(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512>
- <output variable> <input>)
- string(COMPARE EQUAL <string1> <string2> <output variable>)
- string(COMPARE NOTEQUAL <string1> <string2> <output variable>)
- string(COMPARE LESS <string1> <string2> <output variable>)
- string(COMPARE GREATER <string1> <string2> <output variable>)
- string(ASCII <number> [<number> ...] <output variable>)
- string(CONFIGURE <string1> <output variable>
- [@ONLY] [ESCAPE_QUOTES])
- string(TOUPPER <string1> <output variable>)
- string(TOLOWER <string1> <output variable>)
- string(LENGTH <string> <output variable>)
- string(SUBSTRING <string> <begin> <length> <output variable>)
- string(STRIP <string> <output variable>)
- string(RANDOM [LENGTH <length>] [ALPHABET <alphabet>]
- [RANDOM_SEED <seed>] <output variable>)
string(FIND <string> <substring> <output variable> [REVERSE])
- string(TIMESTAMP <output variable> [<format string>] [UTC])
- string(MAKE_C_IDENTIFIER <input string> <output variable>)
- string(GENEX_STRIP <input string> <output variable>)
- string(UUID <output variable> NAMESPACE <namespace> NAME <name>
- TYPE <MD5|SHA1> [UPPER])
-``REGEX MATCH`` will match the regular expression once and store the match
-in the output variable.
+Return the position where the given substring was found in
+the supplied string. If the ``REVERSE`` flag was used, the command will
+search for the position of the last occurrence of the specified
+substring. If the substring is not found, a position of -1 is returned.
-``REGEX MATCHALL`` will match the regular expression as many times as
-possible and store the matches in the output variable as a list.
+REPLACE
+"""""""
-``REGEX REPLACE`` will match the regular expression as many times as
-possible and substitute the replacement expression for the match in
-the output. The replace expression may refer to paren-delimited
-subexpressions of the match using \1, \2, ..., \9. Note that two
-backslashes (\\1) are required in CMake code to get a backslash
-through argument parsing.
+::
-``REPLACE`` will replace all occurrences of ``match_string`` in the input
+ string(REPLACE <match_string>
+ <replace_string> <output variable>
+ <input> [<input>...])
+
+Replace all occurrences of ``match_string`` in the input
with ``replace_string`` and store the result in the output.
-``APPEND`` will append all the input arguments to the string.
+Regular Expressions
+^^^^^^^^^^^^^^^^^^^
-``CONCAT`` will concatenate all the input arguments together and store
-the result in the named output variable.
+REGEX MATCH
+"""""""""""
-``MD5``, ``SHA1``, ``SHA224``, ``SHA256``, ``SHA384``, and ``SHA512`` will
-compute a cryptographic hash of the input string.
+::
-``COMPARE EQUAL``/``COMPARE NOTEQUAL``/``COMPARE LESS/GREATER`` will
-compare the strings and store true or false in the output variable.
+ string(REGEX MATCH <regular_expression>
+ <output variable> <input> [<input>...])
-``ASCII`` will convert all numbers into corresponding ASCII characters.
+Match the regular expression once and store the match in the output variable.
+All ``<input>`` arguments are concatenated before matching.
-``CONFIGURE`` will transform a string like :command:`configure_file`
-transforms a file.
+REGEX MATCHALL
+""""""""""""""
-``TOUPPER``/``TOLOWER`` will convert string to upper/lower characters.
+::
-``LENGTH`` will return a given string's length.
+ string(REGEX MATCHALL <regular_expression>
+ <output variable> <input> [<input>...])
-``SUBSTRING`` will return a substring of a given string. If length is -1
-the remainder of the string starting at begin will be returned.
-If string is shorter than length then end of string is used instead.
+Match the regular expression as many times as possible and store the matches
+in the output variable as a list.
+All ``<input>`` arguments are concatenated before matching.
-.. note::
- CMake 3.1 and below reported an error if length pointed past
- the end of string.
+REGEX REPLACE
+"""""""""""""
-``STRIP`` will return a substring of a given string with leading and
-trailing spaces removed.
+::
-``RANDOM`` will return a random string of given length consisting of
-characters from the given alphabet. Default length is 5 characters
-and default alphabet is all numbers and upper and lower case letters.
-If an integer ``RANDOM_SEED`` is given, its value will be used to seed the
-random number generator.
+ string(REGEX REPLACE <regular_expression>
+ <replace_expression> <output variable>
+ <input> [<input>...])
-``FIND`` will return the position where the given substring was found in
-the supplied string. If the ``REVERSE`` flag was used, the command will
-search for the position of the last occurrence of the specified
-substring. If the substring is not found, a position of -1 is returned.
+Match the regular expression as many times as possible and substitute the
+replacement expression for the match in the output.
+All ``<input>`` arguments are concatenated before matching.
+
+The replace expression may refer to paren-delimited subexpressions of the
+match using ``\1``, ``\2``, ..., ``\9``. Note that two backslashes (``\\1``)
+are required in CMake code to get a backslash through argument parsing.
+
+Regex Specification
+"""""""""""""""""""
The following characters have special meaning in regular expressions:
@@ -123,10 +105,159 @@ The following characters have special meaning in regular expressions:
``*``, ``+`` and ``?`` have higher precedence than concatenation. ``|``
has lower precedence than concatenation. This means that the regular
-expression "^ab+d$" matches "abbd" but not "ababd", and the regular
-expression "^(ab|cd)$" matches "ab" but not "abd".
+expression ``^ab+d$`` matches ``abbd`` but not ``ababd``, and the regular
+expression ``^(ab|cd)$`` matches ``ab`` but not ``abd``.
+
+Manipulation
+^^^^^^^^^^^^
+
+APPEND
+""""""
+
+::
+
+ string(APPEND <string variable> [<input>...])
+
+Append all the input arguments to the string.
+
+CONCAT
+""""""
+
+::
+
+ string(CONCAT <output variable> [<input>...])
+
+Concatenate all the input arguments together and store
+the result in the named output variable.
+
+TOLOWER
+"""""""
+
+::
+
+ string(TOLOWER <string1> <output variable>)
+
+Convert string to lower characters.
+
+TOUPPER
+"""""""
-``TIMESTAMP`` will write a string representation of the current date
+::
+
+ string(TOUPPER <string1> <output variable>)
+
+Convert string to upper characters.
+
+LENGTH
+""""""
+
+::
+
+ string(LENGTH <string> <output variable>)
+
+Store in an output variable a given string's length.
+
+SUBSTRING
+"""""""""
+
+::
+
+ string(SUBSTRING <string> <begin> <length> <output variable>)
+
+Store in an output variable a substring of a given string. If length is
+``-1`` the remainder of the string starting at begin will be returned.
+If string is shorter than length then end of string is used instead.
+
+.. note::
+ CMake 3.1 and below reported an error if length pointed past
+ the end of string.
+
+STRIP
+"""""
+
+::
+
+ string(STRIP <string> <output variable>)
+
+Store in an output variable a substring of a given string with leading and
+trailing spaces removed.
+
+GENEX_STRIP
+"""""""""""
+
+::
+
+ string(GENEX_STRIP <input string> <output variable>)
+
+Strip any :manual:`generator expressions <cmake-generator-expressions(7)>`
+from the ``input string`` and store the result in the ``output variable``.
+
+Comparison
+^^^^^^^^^^
+
+::
+
+ string(COMPARE EQUAL <string1> <string2> <output variable>)
+ string(COMPARE NOTEQUAL <string1> <string2> <output variable>)
+ string(COMPARE LESS <string1> <string2> <output variable>)
+ string(COMPARE GREATER <string1> <string2> <output variable>)
+
+Compare the strings and store true or false in the output variable.
+
+Hashing
+^^^^^^^
+
+::
+
+ string(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512>
+ <output variable> <input>)
+
+Compute a cryptographic hash of the input string.
+
+Generation
+^^^^^^^^^^
+
+ASCII
+"""""
+
+::
+
+ string(ASCII <number> [<number> ...] <output variable>)
+
+Convert all numbers into corresponding ASCII characters.
+
+CONFIGURE
+"""""""""
+
+::
+
+ string(CONFIGURE <string1> <output variable>
+ [@ONLY] [ESCAPE_QUOTES])
+
+Transform a string like :command:`configure_file` transforms a file.
+
+RANDOM
+""""""
+
+::
+
+ string(RANDOM [LENGTH <length>] [ALPHABET <alphabet>]
+ [RANDOM_SEED <seed>] <output variable>)
+
+Return a random string of given length consisting of
+characters from the given alphabet. Default length is 5 characters
+and default alphabet is all numbers and upper and lower case letters.
+If an integer ``RANDOM_SEED`` is given, its value will be used to seed the
+random number generator.
+
+TIMESTAMP
+"""""""""
+
+::
+
+ string(TIMESTAMP <output variable> [<format string>] [UTC])
+
+Write a string representation of the current date
and/or time to the output variable.
Should the command be unable to obtain a timestamp the output variable
@@ -163,14 +294,22 @@ If no explicit ``<format string>`` is given it will default to:
%Y-%m-%dT%H:%M:%S for local time.
%Y-%m-%dT%H:%M:%SZ for UTC.
-``MAKE_C_IDENTIFIER`` will write a string which can be used as an
-identifier in C.
-``GENEX_STRIP`` will strip any
-:manual:`generator expressions <cmake-generator-expressions(7)>` from the
-``input string`` and store the result in the ``output variable``.
+::
+
+ string(MAKE_C_IDENTIFIER <input string> <output variable>)
+
+Write a string which can be used as an identifier in C.
+
+UUID
+""""
+
+::
+
+ string(UUID <output variable> NAMESPACE <namespace> NAME <name>
+ TYPE <MD5|SHA1> [UPPER])
-``UUID`` creates a univerally unique identifier (aka GUID) as per RFC4122
+Create a univerally unique identifier (aka GUID) as per RFC4122
based on the hash of the combined values of ``<namespace>``
(which itself has to be a valid UUID) and ``<name>``.
The hash algorithm can be either ``MD5`` (Version 3 UUID) or
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 1ed24df..28dae80 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -100,6 +100,7 @@ If set, the following variables are passed in to the generated
try_compile CMakeLists.txt to initialize compile target properties with
default values:
+* :variable:`CMAKE_ENABLE_EXPORTS`
* :variable:`CMAKE_LINK_SEARCH_START_STATIC`
* :variable:`CMAKE_LINK_SEARCH_END_STATIC`
* :variable:`CMAKE_POSITION_INDEPENDENT_CODE`
@@ -107,5 +108,7 @@ default values:
If :policy:`CMP0056` is set to ``NEW``, then
:variable:`CMAKE_EXE_LINKER_FLAGS` is passed in as well.
+The current setting of :policy:`CMP0065` is set in the generated project.
+
Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose
a build configuration.
diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst
index c916f77..5b92b51 100644
--- a/Help/manual/cmake-commands.7.rst
+++ b/Help/manual/cmake-commands.7.rst
@@ -71,7 +71,6 @@ These commands may be used freely in CMake projects.
/command/link_libraries
/command/list
/command/load_cache
- /command/load_command
/command/macro
/command/mark_as_advanced
/command/math
@@ -119,6 +118,7 @@ versions of CMake. Do not use them in new code.
/command/install_files
/command/install_programs
/command/install_targets
+ /command/load_command
/command/make_directory
/command/output_required_files
/command/remove
diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst
index 90a081d..a335384 100644
--- a/Help/manual/cmake-developer.7.rst
+++ b/Help/manual/cmake-developer.7.rst
@@ -52,9 +52,9 @@ When adding the first supported feature to a particular CompilerId, it is
necessary to list support for all features known to cmake (See
:variable:`CMAKE_C_COMPILE_FEATURES` and
:variable:`CMAKE_CXX_COMPILE_FEATURES` as appropriate), where available for
-the compiler. Furthermore, set ``CMAKE_<LANG>_STANDARD_DEFAULT`` to the
-default language standard level the compiler uses, or to the empty string
-if the compiler has no notion of standard levels (such as ``MSVC``).
+the compiler. Ensure that the ``CMAKE_<LANG>_STANDARD_DEFAULT`` is set to
+the computed internal variable ``CMAKE_<LANG>_STANDARD_COMPUTED_DEFAULT``
+for compiler versions which should be supported.
It is sensible to record the features for the most recent version of a
particular CompilerId first, and then work backwards. It is sensible to
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 590f10d..ae5354f 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -122,3 +122,4 @@ All Policies
/policy/CMP0062
/policy/CMP0063
/policy/CMP0064
+ /policy/CMP0065
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index e0dbdeb..635db00 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -245,6 +245,7 @@ Variables that Control the Build
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
/variable/CMAKE_CONFIG_POSTFIX
/variable/CMAKE_DEBUG_POSTFIX
+ /variable/CMAKE_ENABLE_EXPORTS
/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG
/variable/CMAKE_EXE_LINKER_FLAGS
/variable/CMAKE_Fortran_FORMAT
@@ -374,6 +375,23 @@ Variables for CTest
/variable/CTEST_COVERAGE_COMMAND
/variable/CTEST_COVERAGE_EXTRA_FLAGS
/variable/CTEST_CURL_OPTIONS
+ /variable/CTEST_CUSTOM_COVERAGE_EXCLUDE
+ /variable/CTEST_CUSTOM_ERROR_EXCEPTION
+ /variable/CTEST_CUSTOM_ERROR_MATCH
+ /variable/CTEST_CUSTOM_ERROR_POST_CONTEXT
+ /variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT
+ /variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE
+ /variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS
+ /variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS
+ /variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE
+ /variable/CTEST_CUSTOM_MEMCHECK_IGNORE
+ /variable/CTEST_CUSTOM_POST_MEMCHECK
+ /variable/CTEST_CUSTOM_POST_TEST
+ /variable/CTEST_CUSTOM_PRE_MEMCHECK
+ /variable/CTEST_CUSTOM_PRE_TEST
+ /variable/CTEST_CUSTOM_TEST_IGNORE
+ /variable/CTEST_CUSTOM_WARNING_EXCEPTION
+ /variable/CTEST_CUSTOM_WARNING_MATCH
/variable/CTEST_CVS_CHECKOUT
/variable/CTEST_CVS_COMMAND
/variable/CTEST_CVS_UPDATE_OPTIONS
@@ -383,6 +401,7 @@ Variables for CTest
/variable/CTEST_DROP_SITE_CDASH
/variable/CTEST_DROP_SITE_PASSWORD
/variable/CTEST_DROP_SITE_USER
+ /variable/CTEST_EXTRA_COVERAGE_GLOB
/variable/CTEST_GIT_COMMAND
/variable/CTEST_GIT_UPDATE_CUSTOM
/variable/CTEST_GIT_UPDATE_OPTIONS
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index 50c856a..2fdf7f3 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -302,6 +302,12 @@ Options
``--test-command``
The test to run with the --build-and-test option.
+``--test-output-size-passed <size>``
+ Limit the output for passed tests to <size> bytes.
+
+``--test-output-size-failed <size>``
+ Limit the output for failed tests to <size> bytes.
+
``--test-timeout``
The time limit in seconds, internal use only.
diff --git a/Help/policy/CMP0065.rst b/Help/policy/CMP0065.rst
new file mode 100644
index 0000000..2ed775d
--- /dev/null
+++ b/Help/policy/CMP0065.rst
@@ -0,0 +1,27 @@
+CMP0065
+-------
+
+Do not add flags to export symbols from executables without
+the :prop_tgt:`ENABLE_EXPORTS` target property.
+
+CMake 3.3 and below, for historical reasons, always linked executables
+on some platforms with flags like ``-rdynamic`` to export symbols from
+the executables for use by any plugins they may load via ``dlopen``.
+CMake 3.4 and above prefer to do this only for executables that are
+explicitly marked with the :prop_tgt:`ENABLE_EXPORTS` target property.
+
+The ``OLD`` behavior of this policy is to always use the additional link
+flags when linking executables regardless of the value of the
+:prop_tgt:`ENABLE_EXPORTS` target property.
+
+The ``NEW`` behavior of this policy is to only use the additional link
+flags when linking executables if the :prop_tgt:`ENABLE_EXPORTS` target
+property is set to ``True``.
+
+This policy was introduced in CMake version 3.4. Unlike most policies,
+CMake version |release| does *not* warn by default when this policy
+is not set and simply uses OLD behavior. See documentation of the
+:variable:`CMAKE_POLICY_WARNING_CMP0065 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
+variable to control the warning.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_sf/OBJECT_DEPENDS.rst b/Help/prop_sf/OBJECT_DEPENDS.rst
index 18022de..1d24960 100644
--- a/Help/prop_sf/OBJECT_DEPENDS.rst
+++ b/Help/prop_sf/OBJECT_DEPENDS.rst
@@ -3,9 +3,12 @@ OBJECT_DEPENDS
Additional files on which a compiled object file depends.
-Specifies a semicolon-separated list of full-paths to files on which
-any object files compiled from this source file depend. An object
-file will be recompiled if any of the named files is newer than it.
+Specifies a :ref:`;-list <CMake Language Lists>` of full-paths to
+files on which any object files compiled from this source file depend.
+On :ref:`Makefile Generators` and the :generator:`Ninja` generator an
+object file will be recompiled if any of the named files is newer than it.
+:ref:`Visual Studio Generators` and the :generator:`Xcode` generator
+cannot implement such compilation dependencies.
This property need not be used to specify the dependency of a source
file on a generated header file that it includes. Although the
@@ -14,5 +17,5 @@ necessary. If the generated header file is created by a custom
command in the same target as the source file, the automatic
dependency scanning process will recognize the dependency. If the
generated header file is created by another target, an inter-target
-dependency should be created with the add_dependencies command (if one
-does not already exist due to linking relationships).
+dependency should be created with the :command:`add_dependencies`
+command (if one does not already exist due to linking relationships).
diff --git a/Help/prop_tgt/ENABLE_EXPORTS.rst b/Help/prop_tgt/ENABLE_EXPORTS.rst
index 283f5a8..dfd4af7 100644
--- a/Help/prop_tgt/ENABLE_EXPORTS.rst
+++ b/Help/prop_tgt/ENABLE_EXPORTS.rst
@@ -7,7 +7,7 @@ Normally an executable does not export any symbols because it is the
final program. It is possible for an executable to export symbols to
be used by loadable modules. When this property is set to true CMake
will allow other targets to "link" to the executable with the
-TARGET_LINK_LIBRARIES command. On all platforms a target-level
+:command:`TARGET_LINK_LIBRARIES` command. On all platforms a target-level
dependency on the executable is created for targets that link to it.
For DLL platforms an import library will be created for the exported
symbols and then used for linking. All Windows-based systems
@@ -17,3 +17,6 @@ module will "link" to the executable using a flag like
"-bundle_loader". For other non-DLL platforms the link rule is simply
ignored since the dynamic loader will automatically bind symbols when
the module is loaded.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_ENABLE_EXPORTS` if it is set when a target is created.
diff --git a/Help/prop_tgt/NO_SONAME.rst b/Help/prop_tgt/NO_SONAME.rst
index fc668b5..ee45ed8 100644
--- a/Help/prop_tgt/NO_SONAME.rst
+++ b/Help/prop_tgt/NO_SONAME.rst
@@ -1,11 +1,11 @@
NO_SONAME
---------
-Whether to set "soname" when linking a shared library or module.
+Whether to set "soname" when linking a shared library.
-Enable this boolean property if a generated shared library or module
+Enable this boolean property if a generated shared library
should not have "soname" set. Default is to set "soname" on all
-shared libraries and modules as long as the platform supports it.
+shared libraries as long as the platform supports it.
Generally, use this property only for leaf private libraries or
plugins. If you use it on normal shared libraries which other targets
link against, on some platforms a linker will insert a full path to
diff --git a/Help/release/dev/CPack-updates.rst b/Help/release/dev/CPack-updates.rst
new file mode 100644
index 0000000..ea0780f
--- /dev/null
+++ b/Help/release/dev/CPack-updates.rst
@@ -0,0 +1,11 @@
+CPack-updates
+-------------
+
+* The :module:`CPack` module no longer mangles settings with CMake-special
+ characters when they're used as defaults for other settings. The macro
+ ``cpack_set_if_not_set``, which was responsible for this, is now deprecated.
+
+* The :module:`CPack` module gained a new setting, ``CPACK_VERBATIM_VARIABLES``,
+ which can be used to ensure the cpack program receives the settings' values
+ exactly as they were set, even if they contain CMake-special characters.
+ For compatibility, it's off by default.
diff --git a/Help/release/dev/ExternalProject_stash_save_all.rst b/Help/release/dev/ExternalProject_stash_save_all.rst
new file mode 100644
index 0000000..e00ed44
--- /dev/null
+++ b/Help/release/dev/ExternalProject_stash_save_all.rst
@@ -0,0 +1,5 @@
+ExternalProject_stash_save_all
+------------------------------
+
+* Use "git stash save --all" only if supported. The --all option for git-stash
+ wasn't introduced until git version 1.7.6.
diff --git a/Help/release/dev/FindHDF5-updates.rst b/Help/release/dev/FindHDF5-updates.rst
new file mode 100644
index 0000000..a9297bb
--- /dev/null
+++ b/Help/release/dev/FindHDF5-updates.rst
@@ -0,0 +1,6 @@
+FindHDF5-updates
+----------------
+
+* The :module:`FindHDF5` module learend a new ``HDF5_PREFER_PARALLEL``
+ option allowing users to specify that a parallel HDF5 tool is
+ preferred if both are available.
diff --git a/Help/release/dev/FindOpenSSL-static-libs.rst b/Help/release/dev/FindOpenSSL-static-libs.rst
new file mode 100644
index 0000000..69ec6f2
--- /dev/null
+++ b/Help/release/dev/FindOpenSSL-static-libs.rst
@@ -0,0 +1,5 @@
+FindOpenSSL-static-libs
+-----------------------
+
+* The :module:`FindOpenSSL` module learned a new ``OPENSSL_USE_STATIC_LIBS``
+ option to search only for static libraries.
diff --git a/Help/release/dev/FindProtobuf-python-extension.rst b/Help/release/dev/FindProtobuf-python-extension.rst
new file mode 100644
index 0000000..95463bf
--- /dev/null
+++ b/Help/release/dev/FindProtobuf-python-extension.rst
@@ -0,0 +1,6 @@
+FindProtobuf-python-extension
+-----------------------------
+
+* The :module:`FindProtobuf` module gained a new
+ :command:`protobuf_generate_python` function to generate python
+ sources from ``.proto`` files.
diff --git a/Help/release/dev/FindZLIB-per-config.rst b/Help/release/dev/FindZLIB-per-config.rst
new file mode 100644
index 0000000..97fd6ef
--- /dev/null
+++ b/Help/release/dev/FindZLIB-per-config.rst
@@ -0,0 +1,5 @@
+FindZLIB-per-config
+-------------------
+
+* The :module:`FindZLIB` module learned to search separately for
+ debug and release variants.
diff --git a/Help/release/dev/FindwxWidgets-updates.rst b/Help/release/dev/FindwxWidgets-updates.rst
new file mode 100644
index 0000000..aa470f2
--- /dev/null
+++ b/Help/release/dev/FindwxWidgets-updates.rst
@@ -0,0 +1,4 @@
+FindwxWidgets-updates
+---------------------
+
+* The :module:`FindwxWidgets` module learned to support version requests.
diff --git a/Help/release/dev/Threads-CXX.rst b/Help/release/dev/Threads-CXX.rst
new file mode 100644
index 0000000..2e34a01
--- /dev/null
+++ b/Help/release/dev/Threads-CXX.rst
@@ -0,0 +1,6 @@
+Threads-CXX
+------------
+
+* The :module:`CheckFunctionExists`, :module:`CheckLibraryExists`,
+ :module:`CheckSymbolExists`, and :module:`FindThreads` modules learned to
+ work in environments where only CXX is enabled.
diff --git a/Help/release/dev/cpack-deb-checksum-on-symlinks.rts b/Help/release/dev/cpack-deb-checksum-on-symlinks.rts
new file mode 100644
index 0000000..9bfeded
--- /dev/null
+++ b/Help/release/dev/cpack-deb-checksum-on-symlinks.rts
@@ -0,0 +1,4 @@
+cpack-deb-checksum-on-symlinks
+------------------------------
+
+* The :module:`CPackDeb` module now correctly excludes symlinks during package checksum calculation.
diff --git a/Help/release/dev/cpack-deb-component-dependencies.rst b/Help/release/dev/cpack-deb-component-dependencies.rst
new file mode 100644
index 0000000..2714222
--- /dev/null
+++ b/Help/release/dev/cpack-deb-component-dependencies.rst
@@ -0,0 +1,12 @@
+cpack-deb-component-dependencies
+--------------------------------
+
+* The :module:`CPackDeb` module learned to set package dependencies
+ per component. See :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS`,
+ :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES`,
+ :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS`,
+ :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS`,
+ :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES`,
+ :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES`,
+ :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS` and
+ :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS`.
diff --git a/Help/release/dev/cpack-deb-fakeroot-removal.rts b/Help/release/dev/cpack-deb-fakeroot-removal.rts
new file mode 100644
index 0000000..e0b97d1
--- /dev/null
+++ b/Help/release/dev/cpack-deb-fakeroot-removal.rts
@@ -0,0 +1,4 @@
+cpack-deb-fakeroot-removal
+--------------------------
+
+* :module:`CPackDeb` no longer uses fakeroot and system tar program for packaging.
diff --git a/Help/release/dev/cpack-package-empty-dirs.rts b/Help/release/dev/cpack-package-empty-dirs.rts
new file mode 100644
index 0000000..1f56e1a
--- /dev/null
+++ b/Help/release/dev/cpack-package-empty-dirs.rts
@@ -0,0 +1,4 @@
+cpack-package-empty-dirs
+------------------------
+
+* The :module:`CPack` module learned to package empty directories.
diff --git a/Help/release/dev/ctest-custom-output-size.rst b/Help/release/dev/ctest-custom-output-size.rst
new file mode 100644
index 0000000..8098b93
--- /dev/null
+++ b/Help/release/dev/ctest-custom-output-size.rst
@@ -0,0 +1,7 @@
+ctest-custom-output-size
+------------------------
+
+* :manual:`ctest(1)` learned options
+ ``--test-output-size-passed`` and ``--test-output-size-failed``
+ to customize the limit on test output size submitted when
+ running as a :ref:`Dashboard Client`.
diff --git a/Help/release/dev/find_program-NAMES_PER_DIR.rst b/Help/release/dev/find_program-NAMES_PER_DIR.rst
new file mode 100644
index 0000000..04cd170
--- /dev/null
+++ b/Help/release/dev/find_program-NAMES_PER_DIR.rst
@@ -0,0 +1,6 @@
+find_program-NAMES_PER_DIR
+--------------------------
+
+* The :command:`find_program` command learned a ``NAMES_PER_DIR``
+ option to consdier all given ``NAMES`` in each directory before
+ moving on to the next directory.
diff --git a/Help/release/dev/get-filename-component-base-dir.rst b/Help/release/dev/get-filename-component-base-dir.rst
new file mode 100644
index 0000000..c0df759
--- /dev/null
+++ b/Help/release/dev/get-filename-component-base-dir.rst
@@ -0,0 +1,6 @@
+get-filename-component-base-dir
+-------------------------------
+
+* The :command:`get_filename_component` command learned a new ``BASE_DIR``
+ subcommand. This is used to specify a base directory when calculating an
+ absolute path from a relative path.
diff --git a/Help/release/dev/install-directory-dest-genex.rst b/Help/release/dev/install-directory-dest-genex.rst
new file mode 100644
index 0000000..2b83bbd
--- /dev/null
+++ b/Help/release/dev/install-directory-dest-genex.rst
@@ -0,0 +1,5 @@
+install-directory-dest-genex
+----------------------------
+
+* The :command:`install(DIRECTORY)` command ``DESTINATION`` option learned to
+ support :manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/release/dev/install-files-dest-genex.rst b/Help/release/dev/install-files-dest-genex.rst
new file mode 100644
index 0000000..b7aa8b3
--- /dev/null
+++ b/Help/release/dev/install-files-dest-genex.rst
@@ -0,0 +1,5 @@
+install-files-dest-genex
+------------------------
+
+* The :command:`install(FILES)` command ``DESTINATION`` option learned to
+ support :manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/release/dev/java-updates.rst b/Help/release/dev/java-updates.rst
index b777807..8fd4ed6 100644
--- a/Help/release/dev/java-updates.rst
+++ b/Help/release/dev/java-updates.rst
@@ -11,3 +11,6 @@ java-updates
* The :module:`UseJava` module ``install_jar`` function learned
new ``DESTINATION`` and ``COMPONENT`` options to specify
the corresponding :command:`install` command options.
+
+* The :module:`UseJava` module gained a new ``create_javah``
+ function to create C headers from Java classes.
diff --git a/Help/release/dev/mingw-compile-features-C.rst b/Help/release/dev/mingw-compile-features-C.rst
new file mode 100644
index 0000000..b3f99f1
--- /dev/null
+++ b/Help/release/dev/mingw-compile-features-C.rst
@@ -0,0 +1,5 @@
+mingw-compile-features-C
+------------------------
+
+* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
+ is now aware of features supported by GNU C compilers on Windows.
diff --git a/Help/release/dev/modules-no-soname.rst b/Help/release/dev/modules-no-soname.rst
new file mode 100644
index 0000000..8fe74f8
--- /dev/null
+++ b/Help/release/dev/modules-no-soname.rst
@@ -0,0 +1,7 @@
+modules-no-soname
+-----------------
+
+* The ``SONAME`` field is no longer set for ``MODULE`` libraries
+ created with the :command:`add_library` command. ``MODULE``
+ libraries are meant for explicit dynamic loading at runtime.
+ They cannot be linked so ``SONAME`` is not useful.
diff --git a/Help/release/dev/ms-manifest-files.rst b/Help/release/dev/ms-manifest-files.rst
new file mode 100644
index 0000000..94fbe83
--- /dev/null
+++ b/Help/release/dev/ms-manifest-files.rst
@@ -0,0 +1,7 @@
+ms-manifest-files
+-----------------
+
+* CMake learned to honor ``*.manifest`` source files with MSVC tools.
+ Manifest files named as sources of ``.exe`` and ``.dll`` targets
+ will be merged with linker-generated manifests and embedded in the
+ binary.
diff --git a/Help/release/dev/pkg-config-variable-function.rst b/Help/release/dev/pkg-config-variable-function.rst
new file mode 100644
index 0000000..e181d13
--- /dev/null
+++ b/Help/release/dev/pkg-config-variable-function.rst
@@ -0,0 +1,6 @@
+pkg-config-variable-function
+----------------------------
+
+* The :module:`FindPkgConfig` learned a new :command:`pkg_get_variable`
+ command which may be used to query for arbitrary variables from a package
+ (such as for related tools or data and plugin install paths).
diff --git a/Help/release/dev/restrict-shlib-link-flags-to-enable-exports.rst b/Help/release/dev/restrict-shlib-link-flags-to-enable-exports.rst
new file mode 100644
index 0000000..f8ce044
--- /dev/null
+++ b/Help/release/dev/restrict-shlib-link-flags-to-enable-exports.rst
@@ -0,0 +1,6 @@
+restrict-shlib-link-flags-to-enable-exports
+-------------------------------------------
+
+* CMake no longer links executables with flags to export symbols
+ unless the :prop_tgt:`ENABLE_EXPORTS` target property is set.
+ See policy :policy:`CMP0065`.
diff --git a/Help/variable/CMAKE_ENABLE_EXPORTS.rst b/Help/variable/CMAKE_ENABLE_EXPORTS.rst
new file mode 100644
index 0000000..1f9ba6f
--- /dev/null
+++ b/Help/variable/CMAKE_ENABLE_EXPORTS.rst
@@ -0,0 +1,22 @@
+CMAKE_ENABLE_EXPORTS
+--------------------
+
+Specify whether an executable exports symbols for loadable modules.
+
+Normally an executable does not export any symbols because it is the
+final program. It is possible for an executable to export symbols to
+be used by loadable modules. When this property is set to true CMake
+will allow other targets to "link" to the executable with the
+:command:`TARGET_LINK_LIBRARIES` command. On all platforms a target-level
+dependency on the executable is created for targets that link to it.
+For DLL platforms an import library will be created for the exported
+symbols and then used for linking. All Windows-based systems
+including Cygwin are DLL platforms. For non-DLL platforms that
+require all symbols to be resolved at link time, such as Mac OS X, the
+module will "link" to the executable using a flag like
+"-bundle_loader". For other non-DLL platforms the link rule is simply
+ignored since the dynamic loader will automatically bind symbols when
+the module is loaded.
+
+This variable is used to initialize the target property
+:prop_tgt:`ENABLE_EXPORTS` for executable targets.
diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
index 8de0d56..582f9e4 100644
--- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
+++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
@@ -13,6 +13,8 @@ warn by default:
policy :policy:`CMP0056`.
* ``CMAKE_POLICY_WARNING_CMP0060`` controls the warning for
policy :policy:`CMP0060`.
+* ``CMAKE_POLICY_WARNING_CMP0065`` controls the warning for
+ policy :policy:`CMP0065`.
This variable should not be set by a project in CMake code. Project
developers running CMake may set this variable in their cache to
diff --git a/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst b/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst
new file mode 100644
index 0000000..d5893c9
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst
@@ -0,0 +1,7 @@
+CTEST_CUSTOM_COVERAGE_EXCLUDE
+-----------------------------
+
+A list of regular expressions which will be used to exclude files by their
+path from coverage output by the :command:`ctest_coverage` command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst b/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst
new file mode 100644
index 0000000..cd65ae3
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst
@@ -0,0 +1,7 @@
+CTEST_CUSTOM_ERROR_EXCEPTION
+----------------------------
+
+A list of regular expressions which will be used to exclude when detecting
+error messages in build outputs by the :command:`ctest_test` command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst b/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst
new file mode 100644
index 0000000..558f5e5
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst
@@ -0,0 +1,7 @@
+CTEST_CUSTOM_ERROR_MATCH
+------------------------
+
+A list of regular expressions which will be used to detect error messages in
+build outputs by the :command:`ctest_test` command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst b/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst
new file mode 100644
index 0000000..614859b
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst
@@ -0,0 +1,7 @@
+CTEST_CUSTOM_ERROR_POST_CONTEXT
+-------------------------------
+
+The number of lines to include as context which follow an error message by the
+:command:`ctest_test` command. The default is 10.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst b/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst
new file mode 100644
index 0000000..74dc47a
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst
@@ -0,0 +1,7 @@
+CTEST_CUSTOM_ERROR_PRE_CONTEXT
+------------------------------
+
+The number of lines to include as context which precede an error message by
+the :command:`ctest_test` command. The default is 10.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst
new file mode 100644
index 0000000..5aeae88
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst
@@ -0,0 +1,8 @@
+CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE
+--------------------------------------------
+
+When saving a failing test's output, this is the maximum size, in bytes, that
+will be collected by the :command:`ctest_test` command. Defaults to 307200
+(300 KiB).
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst
new file mode 100644
index 0000000..920cb04
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst
@@ -0,0 +1,8 @@
+CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS
+-------------------------------------
+
+The maximum number of errors in a single build step which will be detected.
+After this, the :command:`ctest_test` command will truncate the output.
+Defaults to 50.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst
new file mode 100644
index 0000000..a1f1cc1
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst
@@ -0,0 +1,8 @@
+CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS
+---------------------------------------
+
+The maximum number of warnings in a single build step which will be detected.
+After this, the :command:`ctest_test` command will truncate the output.
+Defaults to 50.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst
new file mode 100644
index 0000000..1fbb8c5
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst
@@ -0,0 +1,8 @@
+CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE
+--------------------------------------------
+
+When saving a passing test's output, this is the maximum size, in bytes, that
+will be collected by the :command:`ctest_test` command. Defaults to 1024
+(1 KiB).
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst b/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst
new file mode 100644
index 0000000..578576c
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst
@@ -0,0 +1,7 @@
+CTEST_CUSTOM_MEMCHECK_IGNORE
+----------------------------
+
+A list of regular expressions to use to exclude tests during the
+:command:`ctest_memcheck` command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst b/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst
new file mode 100644
index 0000000..40291fe
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst
@@ -0,0 +1,6 @@
+CTEST_CUSTOM_POST_MEMCHECK
+--------------------------
+
+A list of commands to run at the end of the :command:`ctest_memcheck` command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_POST_TEST.rst b/Help/variable/CTEST_CUSTOM_POST_TEST.rst
new file mode 100644
index 0000000..791292c
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_POST_TEST.rst
@@ -0,0 +1,6 @@
+CTEST_CUSTOM_POST_TEST
+----------------------
+
+A list of commands to run at the end of the :command:`ctest_test` command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst b/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst
new file mode 100644
index 0000000..00de8aa
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst
@@ -0,0 +1,7 @@
+CTEST_CUSTOM_PRE_MEMCHECK
+-------------------------
+
+A list of commands to run at the start of the :command:`ctest_memcheck`
+command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_PRE_TEST.rst b/Help/variable/CTEST_CUSTOM_PRE_TEST.rst
new file mode 100644
index 0000000..6af7152
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_PRE_TEST.rst
@@ -0,0 +1,6 @@
+CTEST_CUSTOM_PRE_TEST
+----------------------
+
+A list of commands to run at the start of the :command:`ctest_test` command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst b/Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst
new file mode 100644
index 0000000..6114e60
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst
@@ -0,0 +1,7 @@
+CTEST_CUSTOM_TEST_IGNORE
+------------------------
+
+A list of regular expressions to use to exclude tests during the
+:command:`ctest_test` command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst b/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst
new file mode 100644
index 0000000..36fa37d
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst
@@ -0,0 +1,7 @@
+CTEST_CUSTOM_WARNING_EXCEPTION
+------------------------------
+
+A list of regular expressions which will be used to exclude when detecting
+warning messages in build outputs by the :command:`ctest_test` command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst b/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst
new file mode 100644
index 0000000..a35be96
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst
@@ -0,0 +1,7 @@
+CTEST_CUSTOM_WARNING_MATCH
+--------------------------
+
+A list of regular expressions which will be used to detect warning messages in
+build outputs by the :command:`ctest_test` command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_XXX.txt b/Help/variable/CTEST_CUSTOM_XXX.txt
new file mode 100644
index 0000000..02d1547
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_XXX.txt
@@ -0,0 +1,2 @@
+It is initialized by :manual:`ctest(1)`, but may be edited in a ``CTestCustom``
+file. See :command:`ctest_read_custom_files` documentation.
diff --git a/Help/variable/CTEST_EXTRA_COVERAGE_GLOB.rst b/Help/variable/CTEST_EXTRA_COVERAGE_GLOB.rst
new file mode 100644
index 0000000..286f7df
--- /dev/null
+++ b/Help/variable/CTEST_EXTRA_COVERAGE_GLOB.rst
@@ -0,0 +1,7 @@
+CTEST_EXTRA_COVERAGE_GLOB
+-------------------------
+
+A list of regular expressions which will be used to find files which should be
+covered by the :command:`ctest_coverage` command.
+
+.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in
index b1c4fdf..bc78016 100644
--- a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in
+++ b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in
@@ -9,22 +9,22 @@
set(PACKAGE_VERSION "@CVF_VERSION@")
-if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
- if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+ if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
-if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
-if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
diff --git a/Modules/BasicConfigVersion-ExactVersion.cmake.in b/Modules/BasicConfigVersion-ExactVersion.cmake.in
index 9fd0136..de4a23a 100644
--- a/Modules/BasicConfigVersion-ExactVersion.cmake.in
+++ b/Modules/BasicConfigVersion-ExactVersion.cmake.in
@@ -17,30 +17,30 @@ else()
set(CVF_VERSION_NO_TWEAK "@CVF_VERSION@")
endif()
-if("${PACKAGE_FIND_VERSION}" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
+if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
else()
set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}")
endif()
-if("${REQUESTED_VERSION_NO_TWEAK}" STREQUAL "${CVF_VERSION_NO_TWEAK}")
+if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
-if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
-if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
-if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
diff --git a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in
index 4acd9bb..a32245d 100644
--- a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in
+++ b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in
@@ -11,7 +11,7 @@
set(PACKAGE_VERSION "@CVF_VERSION@")
-if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
@@ -21,25 +21,25 @@ else()
set(CVF_VERSION_MAJOR "@CVF_VERSION@")
endif()
- if("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "${CVF_VERSION_MAJOR}")
+ if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
- if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+ if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
-if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
-if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index 86cd894..c72e338 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -2,6 +2,7 @@ set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@")
+set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@")
set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@")
set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@")
@@ -52,12 +53,14 @@ if(CMAKE_C_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@")
endif()
+set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "@CMAKE_C_CL_SHOWINCLUDES_PREFIX@")
+if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
+ set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
+endif()
+
@CMAKE_C_SYSROOT_FLAG_CODE@
@CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
-
-@SET_CMAKE_CMCLDEPS_EXECUTABLE@
-@SET_CMAKE_CL_SHOWINCLUDES_PREFIX@
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 09ae509..b224007 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -24,6 +24,17 @@ char const* qnxnto = "INFO" ":" "qnxnto[]";
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
+const char* info_language_dialect_default = "INFO" ":" "dialect_default["
+#if !defined(__STDC_VERSION__)
+ "90"
+#elif __STDC_VERSION__ >= 201000L
+ "11"
+#elif __STDC_VERSION__ >= 199901L
+ "99"
+#else
+#endif
+"]";
+
/*--------------------------------------------------------------------------*/
#ifdef ID_VOID_MAIN
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index 7bcbb19..d2417aa 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -175,7 +175,7 @@ endif()
# Create a static archive incrementally for large object file counts.
# If CMAKE_C_CREATE_STATIC_LIBRARY is set it will override these.
if(NOT DEFINED CMAKE_C_ARCHIVE_CREATE)
- set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_C_ARCHIVE_APPEND)
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index af79a31..52e44f6 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -2,6 +2,7 @@ set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@")
+set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@")
set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@")
set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@")
@@ -53,12 +54,14 @@ if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
endif()
+set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "@CMAKE_CXX_CL_SHOWINCLUDES_PREFIX@")
+if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
+ set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
+endif()
+
@CMAKE_CXX_SYSROOT_FLAG_CODE@
@CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
-
-@SET_CMAKE_CMCLDEPS_EXECUTABLE@
-@SET_CMAKE_CL_SHOWINCLUDES_PREFIX@
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index cc3ab49..d467507 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -23,6 +23,16 @@ char const* qnxnto = "INFO" ":" "qnxnto[]";
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@
+const char* info_language_dialect_default = "INFO" ":" "dialect_default["
+#if __cplusplus >= 201402L
+ "14"
+#elif __cplusplus >= 201103L
+ "11"
+#else
+ "98"
+#endif
+"]";
+
/*--------------------------------------------------------------------------*/
int main(int argc, char* argv[])
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 1aac9d3..091627b 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -266,7 +266,7 @@ endif()
# Create a static archive incrementally for large object file counts.
# If CMAKE_CXX_CREATE_STATIC_LIBRARY is set it will override these.
if(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE)
- set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND)
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
diff --git a/Modules/CMakeClDeps.cmake b/Modules/CMakeClDeps.cmake
deleted file mode 100644
index b46e7c2..0000000
--- a/Modules/CMakeClDeps.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-
-#=============================================================================
-# Copyright 2012 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-#
-# When using Ninja cl.exe is wrapped by cmcldeps to extract the included
-# headers for dependency tracking.
-#
-# cmcldeps path is set, and cmcldeps needs to know the localized string
-# in front of each include path, so it can remove it.
-#
-
-if(CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_C_COMPILER AND CMAKE_COMMAND)
- string(REPLACE "cmake.exe" "cmcldeps.exe" CMAKE_CMCLDEPS_EXECUTABLE ${CMAKE_COMMAND})
- set(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes)
- file(WRITE ${showdir}/foo.h "\n")
- file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n")
- execute_process(COMMAND ${CMAKE_C_COMPILER} /nologo /showIncludes ${showdir}/main.c
- WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE outLine)
- string(REGEX MATCH "\n([^:]*:[^:]*:[ \t]*)" tmp "${outLine}")
- set(localizedPrefix "${CMAKE_MATCH_1}")
- set(SET_CMAKE_CMCLDEPS_EXECUTABLE "set(CMAKE_CMCLDEPS_EXECUTABLE \"${CMAKE_CMCLDEPS_EXECUTABLE}\")")
- set(SET_CMAKE_CL_SHOWINCLUDES_PREFIX "set(CMAKE_CL_SHOWINCLUDES_PREFIX \"${localizedPrefix}\")")
-endif()
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 492c3ea..4b0d278 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -96,6 +96,7 @@ if(NOT CMAKE_C_COMPILER_ID_RUN)
# Try to identify the compiler.
set(CMAKE_C_COMPILER_ID)
+ set(CMAKE_C_PLATFORM_ID)
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
CMAKE_C_COMPILER_ID_PLATFORM_CONTENT)
@@ -117,12 +118,12 @@ if(NOT CMAKE_C_COMPILER_ID_RUN)
CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c)
# Set old compiler and platform id variables.
- if(CMAKE_C_COMPILER_ID MATCHES "GNU")
+ if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(CMAKE_COMPILER_IS_GNUCC 1)
endif()
- if("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")
+ if(CMAKE_C_PLATFORM_ID MATCHES "MinGW")
set(CMAKE_COMPILER_IS_MINGW 1)
- elseif("${CMAKE_C_PLATFORM_ID}" MATCHES "Cygwin")
+ elseif(CMAKE_C_PLATFORM_ID MATCHES "Cygwin")
set(CMAKE_COMPILER_IS_CYGWIN 1)
endif()
endif()
@@ -172,7 +173,6 @@ endif ()
include(CMakeFindBinUtils)
if(MSVC_C_ARCHITECTURE_ID)
- include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake)
set(SET_MSVC_C_ARCHITECTURE_ID
"set(MSVC_C_ARCHITECTURE_ID ${MSVC_C_ARCHITECTURE_ID})")
endif()
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 2032015..680356d 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -91,6 +91,7 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN)
# Try to identify the compiler.
set(CMAKE_CXX_COMPILER_ID)
+ set(CMAKE_CXX_PLATFORM_ID)
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT)
@@ -112,12 +113,12 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN)
CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp)
# Set old compiler and platform id variables.
- if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_COMPILER_IS_GNUCXX 1)
endif()
- if("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")
+ if(CMAKE_CXX_PLATFORM_ID MATCHES "MinGW")
set(CMAKE_COMPILER_IS_MINGW 1)
- elseif("${CMAKE_CXX_PLATFORM_ID}" MATCHES "Cygwin")
+ elseif(CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin")
set(CMAKE_COMPILER_IS_CYGWIN 1)
endif()
endif()
@@ -170,7 +171,6 @@ endif ()
include(CMakeFindBinUtils)
if(MSVC_CXX_ARCHITECTURE_ID)
- include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake)
set(SET_MSVC_CXX_ARCHITECTURE_ID
"set(MSVC_CXX_ARCHITECTURE_ID ${MSVC_CXX_ARCHITECTURE_ID})")
endif()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index c699315..df6daf3 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -75,6 +75,12 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format")
endif()
+ if(CMAKE_GENERATOR STREQUAL "Ninja" AND MSVC_${lang}_ARCHITECTURE_ID)
+ CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX(${lang})
+ else()
+ set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "")
+ endif()
+
# Display the final identification result.
if(CMAKE_${lang}_COMPILER_ID)
if(CMAKE_${lang}_COMPILER_VERSION)
@@ -99,9 +105,11 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE)
set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
PARENT_SCOPE)
+ set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX}" PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
+ set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE)
endfunction()
include(CMakeCompilerIdDetection)
@@ -313,29 +321,17 @@ Id flags: ${testflags}
endif()
endif()
else()
- if(COMMAND EXECUTE_PROCESS)
- execute_process(
- COMMAND "${CMAKE_${lang}_COMPILER}"
- ${CMAKE_${lang}_COMPILER_ID_ARG1}
- ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
- ${testflags}
- "${src}"
- WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
- OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
- ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
- RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
- )
- else()
- exec_program(
- "${CMAKE_${lang}_COMPILER}" ${CMAKE_${lang}_COMPILER_ID_DIR}
- ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1}
- ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
- ${testflags}
- \"${src}\"
- OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
- RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT
- )
- endif()
+ execute_process(
+ COMMAND "${CMAKE_${lang}_COMPILER}"
+ ${CMAKE_${lang}_COMPILER_ID_ARG1}
+ ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
+ ${testflags}
+ "${src}"
+ WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
+ OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
+ ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
+ RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
+ )
endif()
# Check the result of compilation.
@@ -487,6 +483,9 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
if("${info}" MATCHES "INFO:qnxnto\\[\\]")
set(COMPILER_QNXNTO 1)
endif()
+ if("${info}" MATCHES "INFO:dialect_default\\[([^]\"]*)\\]")
+ set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_MATCH_1}")
+ endif()
endforeach()
# Construct compiler version from components if needed.
@@ -590,6 +589,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE)
set(COMPILER_QNXNTO "${COMPILER_QNXNTO}" PARENT_SCOPE)
+ set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE)
endfunction()
#-----------------------------------------------------------------------------
@@ -645,3 +645,27 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
endif()
endforeach()
endfunction()
+
+function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang)
+ # Run this MSVC-compatible compiler to detect what the /showIncludes
+ # option displays. We can use a C source even with the C++ compiler
+ # because MSVC-compatible compilers handle both and show the same output.
+ set(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes)
+ file(WRITE ${showdir}/foo.h "\n")
+ file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n")
+ execute_process(
+ COMMAND "${CMAKE_${lang}_COMPILER}"
+ ${CMAKE_${lang}_COMPILER_ID_ARG1}
+ ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
+ /nologo /showIncludes /c main.c
+ WORKING_DIRECTORY ${showdir}
+ OUTPUT_VARIABLE out
+ ERROR_VARIABLE err
+ RESULT_VARIABLE res
+ )
+ if(res EQUAL 0 AND "${out}" MATCHES "\n([^:]*:[^:]*:[ \t]*)")
+ set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_1}" PARENT_SCOPE)
+ else()
+ set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "" PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
index 064e650..3bfb876 100644
--- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
+++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
@@ -101,6 +101,8 @@ if (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS)
_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs _defines)
set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories")
set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "C compiler system defined macros")
+ elseif ("${CMAKE_C_COMPILER_ID}" MATCHES MSVC)
+ set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "$ENV{INCLUDE}" CACHE INTERNAL "C compiler system include directories")
endif ()
endif ()
@@ -110,6 +112,8 @@ if (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS)
_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c++ _dirs _defines)
set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories")
set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "CXX compiler system defined macros")
+ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES MSVC)
+ set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "$ENV{INCLUDE}" CACHE INTERNAL "CXX compiler system include directories")
endif ()
endif ()
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index 835ffcf..79393d3 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -194,7 +194,7 @@ endif()
# Create a static archive incrementally for large object file counts.
# If CMAKE_Fortran_CREATE_STATIC_LIBRARY is set it will override these.
if(NOT DEFINED CMAKE_Fortran_ARCHIVE_CREATE)
- set(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
if(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND)
set(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index 8abc465..59092bd 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -31,7 +31,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
# Construct a regex to match linker lines. It must match both the
# whole line and just the command (argv[0]).
set(linker_regex "^( *|.*[/\\])(${linker}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)")
- set(linker_exclude_regex "collect2 version ")
+ set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=")
set(log "${log} link line regex: [${linker_regex}]\n")
string(REGEX REPLACE "\r?\n" ";" output_lines "${text}")
foreach(line IN LISTS output_lines)
diff --git a/Modules/CMakeTestSwiftCompiler.cmake b/Modules/CMakeTestSwiftCompiler.cmake
index 9186426..89849fb 100644
--- a/Modules/CMakeTestSwiftCompiler.cmake
+++ b/Modules/CMakeTestSwiftCompiler.cmake
@@ -12,4 +12,54 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-set(CMAKE_Swift_COMPILER_WORKS 1)
+if(CMAKE_Swift_COMPILER_FORCED)
+ # The compiler configuration was forced by the user.
+ # Assume the user has configured all compiler information.
+ set(CMAKE_Swift_COMPILER_WORKS TRUE)
+ return()
+endif()
+
+include(CMakeTestCompilerCommon)
+
+# Remove any cached result from an older CMake version.
+# We now store this in CMakeSwiftCompiler.cmake.
+unset(CMAKE_Swift_COMPILER_WORKS CACHE)
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that that selected C++ compiler can actually compile
+# and link the most basic of programs. If not, a fatal error
+# is set and cmake stops processing commands and will not generate
+# any makefiles or projects.
+if(NOT CMAKE_Swift_COMPILER_WORKS)
+ PrintTestCompilerStatus("Swift" "")
+ file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift
+ "import Foundation\n"
+ "print(\"CMake\")\n")
+ try_compile(CMAKE_Swift_COMPILER_WORKS ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift
+ OUTPUT_VARIABLE __CMAKE_Swift_COMPILER_OUTPUT)
+ # Move result from cache to normal variable.
+ set(CMAKE_Swift_COMPILER_WORKS ${CMAKE_Swift_COMPILER_WORKS})
+ unset(CMAKE_Swift_COMPILER_WORKS CACHE)
+ set(Swift_TEST_WAS_RUN 1)
+endif()
+
+if(NOT CMAKE_Swift_COMPILER_WORKS)
+ PrintTestCompilerStatus("Swift" " -- broken")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the Swift compiler works failed with "
+ "the following output:\n${__CMAKE_Swift_COMPILER_OUTPUT}\n\n")
+ message(FATAL_ERROR "The Swift compiler \"${CMAKE_Swift_COMPILER}\" "
+ "is not able to compile a simple test program.\nIt fails "
+ "with the following output:\n ${__CMAKE_Swift_COMPILER_OUTPUT}\n\n"
+ "CMake will not be able to correctly generate this project.")
+else()
+ if(Swift_TEST_WAS_RUN)
+ PrintTestCompilerStatus("Swift" " -- works")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the Swift compiler works passed with "
+ "the following output:\n${__CMAKE_Swift_COMPILER_OUTPUT}\n\n")
+ endif()
+endif()
+
+unset(__CMAKE_Swift_COMPILER_OUTPUT)
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index e223286..5756001 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -182,6 +182,17 @@
# will be a boolean variable which enables stripping of all files (a list
# of files evaluates to TRUE in CMake, so this change is compatible).
#
+# .. variable:: CPACK_VERBATIM_VARIABLES
+#
+# If set to TRUE, values of variables prefixed with CPACK_ will be escaped
+# before being written to the configuration files, so that the cpack program
+# receives them exactly as they were specified. If not, characters like quotes
+# and backslashes can cause parsing errors or alter the value received by the
+# cpack program. Defaults to FALSE for backwards compatibility.
+#
+# * Mandatory : NO
+# * Default : FALSE
+#
# The following CPack variables are specific to source packages, and
# will not affect binary packages:
#
@@ -299,49 +310,68 @@ endif()
include(CPackComponent)
# Macro for setting values if a user did not overwrite them
+# Mangles CMake-special characters. Only kept for backwards compatibility.
macro(cpack_set_if_not_set name value)
- if(NOT DEFINED "${name}")
- set(${name} "${value}")
- endif()
+ message(DEPRECATION "cpack_set_if_not_set is obsolete; do not use.")
+ _cpack_set_default("${name}" "${value}")
endmacro()
-# cpack_encode_variables - Macro to encode variables for the configuration file
+# cpack_encode_variables - Function to encode variables for the configuration file
# find any variable that starts with CPACK and create a variable
# _CPACK_OTHER_VARIABLES_ that contains SET commands for
# each cpack variable. _CPACK_OTHER_VARIABLES_ is then
# used as an @ replacment in configure_file for the CPackConfig.
-macro(cpack_encode_variables)
- set(_CPACK_OTHER_VARIABLES_)
+function(cpack_encode_variables)
+ set(commands "")
get_cmake_property(res VARIABLES)
foreach(var ${res})
if(var MATCHES "^CPACK")
- set(_CPACK_OTHER_VARIABLES_
- "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")")
+ if(CPACK_VERBATIM_VARIABLES)
+ _cpack_escape_for_cmake(value "${${var}}")
+ else()
+ set(value "${${var}}")
endif()
+
+ set(commands "${commands}\nSET(${var} \"${value}\")")
+ endif()
endforeach()
-endmacro()
+
+ set(_CPACK_OTHER_VARIABLES_ "${commands}" PARENT_SCOPE)
+endfunction()
+
+# Internal use functions
+function(_cpack_set_default name value)
+ if(NOT DEFINED "${name}")
+ set("${name}" "${value}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(_cpack_escape_for_cmake var value)
+ string(REGEX REPLACE "([\\\$\"])" "\\\\\\1" escaped "${value}")
+ set("${var}" "${escaped}" PARENT_SCOPE)
+endfunction()
# Set the package name
-cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
-cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MAJOR "0")
-cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MINOR "1")
-cpack_set_if_not_set(CPACK_PACKAGE_VERSION_PATCH "1")
-cpack_set_if_not_set(CPACK_PACKAGE_VERSION
+_cpack_set_default(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
+_cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0")
+_cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "1")
+_cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "1")
+_cpack_set_default(CPACK_PACKAGE_VERSION
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
-cpack_set_if_not_set(CPACK_PACKAGE_VENDOR "Humanity")
-cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
+_cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity")
+_cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"${CMAKE_PROJECT_NAME} built using CMake")
-cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_FILE
+_cpack_set_default(CPACK_PACKAGE_DESCRIPTION_FILE
"${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
-cpack_set_if_not_set(CPACK_RESOURCE_FILE_LICENSE
+_cpack_set_default(CPACK_RESOURCE_FILE_LICENSE
"${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
-cpack_set_if_not_set(CPACK_RESOURCE_FILE_README
+_cpack_set_default(CPACK_RESOURCE_FILE_README
"${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
-cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME
+_cpack_set_default(CPACK_RESOURCE_FILE_WELCOME
"${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt")
-cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
+_cpack_set_default(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
if(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL)
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
@@ -359,7 +389,7 @@ if(__cpack_system_name MATCHES "Windows")
set(__cpack_system_name win32)
endif()
endif()
-cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}")
+_cpack_set_default(CPACK_SYSTEM_NAME "${__cpack_system_name}")
# Root dir: default value should be the string literal "$PROGRAMFILES"
# for backwards compatibility. Projects may set this value to anything.
@@ -369,17 +399,17 @@ if("x${__cpack_system_name}" STREQUAL "xwin64")
else()
set(__cpack_root_default "$PROGRAMFILES")
endif()
-cpack_set_if_not_set(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")
+_cpack_set_default(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")
# <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
-cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME
+_cpack_set_default(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
-cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY
+_cpack_set_default(CPACK_PACKAGE_INSTALL_DIRECTORY
"${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
-cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
+_cpack_set_default(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
"${CPACK_PACKAGE_INSTALL_DIRECTORY}")
-cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
-cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true")
+_cpack_set_default(CPACK_PACKAGE_DEFAULT_LOCATION "/")
+_cpack_set_default(CPACK_PACKAGE_RELOCATABLE "true")
# always force to exactly "true" or "false" for CPack.Info.plist.in:
if(CPACK_PACKAGE_RELOCATABLE)
@@ -519,10 +549,10 @@ mark_as_advanced(
)
# Set some other variables
-cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
+_cpack_set_default(CPACK_INSTALL_CMAKE_PROJECTS
"${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
-cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
-cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
+_cpack_set_default(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
+_cpack_set_default(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
# if the user has set CPACK_NSIS_DISPLAY_NAME remember it
if(DEFINED CPACK_NSIS_DISPLAY_NAME)
set(CPACK_NSIS_DISPLAY_NAME_SET TRUE)
@@ -531,34 +561,32 @@ endif()
# explicitly, then use that as the default
# value of CPACK_NSIS_PACKAGE_NAME instead
# of CPACK_PACKAGE_INSTALL_DIRECTORY
-cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+_cpack_set_default(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
if(CPACK_NSIS_DISPLAY_NAME_SET)
- string(REPLACE "\\" "\\\\"
- _NSIS_DISPLAY_NAME_TMP "${CPACK_NSIS_DISPLAY_NAME}")
- cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${_NSIS_DISPLAY_NAME_TMP}")
+ _cpack_set_default(CPACK_NSIS_PACKAGE_NAME "${CPACK_NSIS_DISPLAY_NAME}")
else()
- cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+ _cpack_set_default(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
endif()
-cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE
+_cpack_set_default(CPACK_OUTPUT_CONFIG_FILE
"${CMAKE_BINARY_DIR}/CPackConfig.cmake")
-cpack_set_if_not_set(CPACK_SOURCE_OUTPUT_CONFIG_FILE
+_cpack_set_default(CPACK_SOURCE_OUTPUT_CONFIG_FILE
"${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")
-cpack_set_if_not_set(CPACK_SET_DESTDIR OFF)
-cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+_cpack_set_default(CPACK_SET_DESTDIR OFF)
+_cpack_set_default(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
-cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
-cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
+_cpack_set_default(CPACK_NSIS_INSTALLER_ICON_CODE "")
+_cpack_set_default(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
# WiX specific variables
-cpack_set_if_not_set(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
+_cpack_set_default(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
# set sysroot so SDK tools can be used
if(CMAKE_OSX_SYSROOT)
- cpack_set_if_not_set(CPACK_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}")
+ _cpack_set_default(CPACK_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}")
endif()
if(DEFINED CPACK_COMPONENTS_ALL)
@@ -598,13 +626,20 @@ cpack_encode_variables()
configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY)
# Generate source file
-cpack_set_if_not_set(CPACK_SOURCE_INSTALLED_DIRECTORIES
+_cpack_set_default(CPACK_SOURCE_INSTALLED_DIRECTORIES
"${CMAKE_SOURCE_DIR};/")
-cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source")
-cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME
+_cpack_set_default(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source")
+_cpack_set_default(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")
-cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES
- "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#")
+
+set(__cpack_source_ignore_files_default
+ "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#")
+if(NOT CPACK_VERBATIM_VARIABLES)
+ _cpack_escape_for_cmake(__cpack_source_ignore_files_default
+ "${__cpack_source_ignore_files_default}")
+endif()
+_cpack_set_default(CPACK_SOURCE_IGNORE_FILES "${__cpack_source_ignore_files_default}")
+
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")
set(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}")
set(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}")
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 75e9966..93d51c3 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -78,6 +78,7 @@
#
# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)")
#
+#
# .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER
#
# The Debian package maintainer
@@ -164,6 +165,7 @@
# * Default : -
#
# .. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS
#
# Sets the `Pre-Depends` field of the Debian package.
# Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it
@@ -172,11 +174,16 @@
# pre-dependency.
#
# * Mandatory : NO
-# * Default : -
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based
+# installations.
#
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
#
# .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES
#
# Sets the `Enhances` field of the Debian package.
# Similar to :variable:`Suggests <CPACK_DEBIAN_PACKAGE_SUGGESTS>` but works
@@ -184,11 +191,16 @@
# functionality of another package.
#
# * Mandatory : NO
-# * Default : -
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based
+# installations.
#
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
#
# .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS
#
# Sets the `Breaks` field of the Debian package.
# When a binary package (P) declares that it breaks other packages (B),
@@ -199,12 +211,17 @@
# packages (B) cannot be reconfigured again.
#
# * Mandatory : NO
-# * Default : -
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based
+# installations.
#
# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks
#
#
# .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS
#
# Sets the `Conflicts` field of the Debian package.
# When one binary package declares a conflict with another using a `Conflicts`
@@ -212,7 +229,11 @@
# the same time.
#
# * Mandatory : NO
-# * Default : -
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based
+# installations.
#
# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts
#
@@ -225,48 +246,68 @@
# time.
#
# .. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES
#
# Sets the `Provides` field of the Debian package.
# A virtual package is one which appears in the `Provides` control field of
# another package.
#
# * Mandatory : NO
-# * Default : -
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based
+# installations.
#
# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual
#
#
# .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES
#
# Sets the `Replaces` field of the Debian package.
# Packages can declare in their control file that they should overwrite
# files in certain other packages, or completely replace other packages.
#
# * Mandatory : NO
-# * Default : -
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based
+# installations.
#
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
#
#
# .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS
#
# Sets the `Recommends` field of the Debian package.
# Allows packages to declare a strong, but not absolute, dependency on other
# packages.
#
# * Mandatory : NO
-# * Default : -
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based
+# installations.
#
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
#
#
# .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS
#
# Sets the `Suggests` field of the Debian package.
# Allows packages to declare a suggested package install grouping.
#
# * Mandatory : NO
-# * Default : -
+# * Default :
+#
+# - An empty string for non-component based installations
+# - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based
+# installations.
#
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
#
@@ -285,6 +326,34 @@
#
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
+#
+# .. note::
+#
+# The original permissions of the files will be used in the final
+# package unless the variable
+# :variable:`CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION` is set.
+# In particular, the scripts should have the proper executable
+# flag prior to the generation of the package.
+#
+# .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION
+# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_STRICT_PERMISSION
+#
+# This variable indicates if the Debian policy on control files should be
+# strictly followed.
+#
+# * Mandatory : NO
+# * Default : FALSE
+#
+# Usage::
+#
+# set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
+#
+# .. note::
+#
+# This overrides the permissions on the original files, following the rules
+# set by Debian policy
+# https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners
+#
#=============================================================================
@@ -321,11 +390,6 @@ function(cpack_deb_prepare_package_vars)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
endif()
- find_program(FAKEROOT_EXECUTABLE fakeroot)
- if(FAKEROOT_EXECUTABLE)
- set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE})
- endif()
-
set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}")
# per component automatic discover: some of the component might not have
@@ -496,18 +560,21 @@ function(cpack_deb_prepare_package_vars)
# You should set: DEBIAN_PACKAGE_DEPENDS
# TODO: automate 'objdump -p | grep NEEDED'
- # if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_DEPENDS
+ # if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_${dependency_type_}
# automatic dependency discovery will be performed afterwards.
if(CPACK_DEB_PACKAGE_COMPONENT)
- set(_component_depends_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_DEPENDS")
+ foreach(dependency_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES)
+ set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${dependency_type_}")
- # if set, overrides the global dependency
- if(DEFINED ${_component_depends_var})
- set(CPACK_DEBIAN_PACKAGE_DEPENDS "${${_component_depends_var}}")
- if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message("CPackDeb Debug: component '${_local_component_name}' dependencies set to '${CPACK_DEBIAN_PACKAGE_DEPENDS}'")
+ # if set, overrides the global dependency
+ if(DEFINED ${_component_var})
+ set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${${_component_var}}")
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ message("CPackDeb Debug: component '${_local_component_name}' ${dependency_type_}"
+ "dependencies set to '${CPACK_DEBIAN_PACKAGE_${dependency_}}'")
+ endif()
endif()
- endif()
+ endforeach()
endif()
# at this point, the CPACK_DEBIAN_PACKAGE_DEPENDS is properly set
@@ -591,7 +658,7 @@ function(cpack_deb_prepare_package_vars)
# Are we packaging components ?
if(CPACK_DEB_PACKAGE_COMPONENT)
# override values with per component version if set
- foreach(VAR_NAME_ "PACKAGE_CONTROL_EXTRA")
+ foreach(VAR_NAME_ "PACKAGE_CONTROL_EXTRA" "PACKAGE_CONTROL_STRICT_PERMISSION")
if(CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_})
set(CPACK_DEBIAN_${VAR_NAME_} "${CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}}")
endif()
@@ -613,6 +680,7 @@ function(cpack_deb_prepare_package_vars)
message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
+ message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION = ${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}")
endif()
# For debian source packages:
@@ -638,7 +706,6 @@ function(cpack_deb_prepare_package_vars)
set(GEN_CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_DEBIAN_PACKAGE_MAINTAINER}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE)
- set(GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE "${CPACK_DEBIAN_FAKEROOT_EXECUTABLE}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_COMPRESSION_TYPE "${CPACK_DEBIAN_COMPRESSION_TYPE}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_RECOMMENDS "${CPACK_DEBIAN_PACKAGE_RECOMMENDS}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_SUGGESTS "${CPACK_DEBIAN_PACKAGE_SUGGESTS}" PARENT_SCOPE)
@@ -650,6 +717,8 @@ function(cpack_deb_prepare_package_vars)
set(GEN_CPACK_DEBIAN_PACKAGE_PROVIDES "${CPACK_DEBIAN_PACKAGE_PROVIDES}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_REPLACES "${CPACK_DEBIAN_PACKAGE_REPLACES}" PARENT_SCOPE)
set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION
+ "${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}" PARENT_SCOPE)
set(GEN_WDIR "${WDIR}" PARENT_SCOPE)
endfunction()
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index 6c74cf3..ef3aa76 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -161,7 +161,7 @@ function(ctest_coverage_collect_gcov)
message(STATUS "Could not determine source file corresponding to: ${gcov_file}")
endif()
- foreach(exclude_entry ${CTEST_CUSTOM_COVERAGE_EXCLUDE})
+ foreach(exclude_entry IN LISTS CTEST_CUSTOM_COVERAGE_EXCLUDE)
if(source_file MATCHES "${exclude_entry}")
set(is_excluded true)
diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c
index 7250fbf..2732957 100644
--- a/Modules/CheckForPthreads.c
+++ b/Modules/CheckForPthreads.c
@@ -31,7 +31,7 @@ void* runner(void* args)
int cc;
for ( cc = 0; cc < 10; cc ++ )
{
- printf("%d CC: %d\n", (int)args, cc);
+ printf("%p CC: %d\n", args, cc);
}
res ++;
return 0;
diff --git a/Modules/CheckFunctionExists.c b/Modules/CheckFunctionExists.c
index 607b3e8..fd29618 100644
--- a/Modules/CheckFunctionExists.c
+++ b/Modules/CheckFunctionExists.c
@@ -1,5 +1,8 @@
#ifdef CHECK_FUNCTION_EXISTS
+#ifdef __cplusplus
+extern "C"
+#endif
char CHECK_FUNCTION_EXISTS();
#ifdef __CLASSIC_C__
int main(){
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index d277c32..5dd3751 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -57,14 +57,26 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
else()
set(CHECK_FUNCTION_EXISTS_ADD_INCLUDES)
endif()
+
+ if(CMAKE_C_COMPILER_LOADED)
+ set(_cfe_source ${CMAKE_ROOT}/Modules/CheckFunctionExists.c)
+ elseif(CMAKE_CXX_COMPILER_LOADED)
+ set(_cfe_source ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckFunctionExists/CheckFunctionExists.cxx)
+ configure_file(${CMAKE_ROOT}/Modules/CheckFunctionExists.c "${_cfe_source}" COPYONLY)
+ else()
+ message(FATAL_ERROR "CHECK_FUNCTION_EXISTS needs either C or CXX language enabled")
+ endif()
+
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
- ${CMAKE_ROOT}/Modules/CheckFunctionExists.c
+ ${_cfe_source}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
"${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
+ unset(_cfe_source)
+
if(${VARIABLE})
set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}")
if(NOT CMAKE_REQUIRED_QUIET)
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index 95c595a..6b53823 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -53,15 +53,26 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
set(CHECK_LIBRARY_EXISTS_LIBRARIES
${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES})
endif()
+
+ if(CMAKE_C_COMPILER_LOADED)
+ set(_cle_source ${CMAKE_ROOT}/Modules/CheckFunctionExists.c)
+ elseif(CMAKE_CXX_COMPILER_LOADED)
+ set(_cle_source ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckLibraryExists/CheckFunctionExists.cxx)
+ configure_file(${CMAKE_ROOT}/Modules/CheckFunctionExists.c "${_cle_source}" COPYONLY)
+ else()
+ message(FATAL_ERROR "CHECK_FUNCTION_EXISTS needs either C or CXX language enabled")
+ endif()
+
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
- ${CMAKE_ROOT}/Modules/CheckFunctionExists.c
+ ${_cle_source}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
LINK_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION}
-DLINK_DIRECTORIES:STRING=${LOCATION}
OUTPUT_VARIABLE OUTPUT)
+ unset(_cle_source)
if(${VARIABLE})
if(NOT CMAKE_REQUIRED_QUIET)
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index 79c5ba7..c4dff3f 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -44,10 +44,14 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-
-
macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
- _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ if(CMAKE_C_COMPILER_LOADED)
+ _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ elseif(CMAKE_CXX_COMPILER_LOADED)
+ _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ else()
+ message(FATAL_ERROR "CHECK_SYMBOL_EXISTS needs either C or CXX language enabled")
+ endif()
endmacro()
macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index 10454f6..5908c26 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -13,7 +13,12 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
- set(CMAKE_C_STANDARD_DEFAULT 99)
+ if (NOT CMAKE_C_COMPILER_FORCED)
+ if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
+ endif()
endif()
macro(cmake_record_c_compile_features)
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index 1ba8a77..c4e342b 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -23,9 +23,15 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
- set(CMAKE_CXX_STANDARD_DEFAULT 98)
+ if (NOT CMAKE_CXX_COMPILER_FORCED)
+ if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
+ endif()
endif()
+
macro(cmake_record_cxx_compile_features)
macro(_get_appleclang_features std_version list)
record_compiler_features(CXX "${std_version}" ${list})
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index 548d0a5..a2e81c1 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -17,10 +17,13 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
endif()
-if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6)
- set(CMAKE_C_STANDARD_DEFAULT 11)
-elseif(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- set(CMAKE_C_STANDARD_DEFAULT 99)
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
+ if (NOT CMAKE_C_COMPILER_FORCED)
+ if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
+ endif()
endif()
macro(cmake_record_c_compile_features)
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 84b2c74..055a8ee 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -31,8 +31,13 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
endif()
-if(UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
- set(CMAKE_CXX_STANDARD_DEFAULT 98)
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+ if (NOT CMAKE_CXX_COMPILER_FORCED)
+ if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
+ endif()
endif()
macro(cmake_record_cxx_compile_features)
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 89704e6..d979fb7 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -22,22 +22,26 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
endif()
-if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
- set(CMAKE_C_STANDARD_DEFAULT 11)
-elseif(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
- set(CMAKE_C_STANDARD_DEFAULT 90)
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+ if (NOT CMAKE_C_COMPILER_FORCED)
+ if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
+ endif()
endif()
+
macro(cmake_record_c_compile_features)
macro(_get_gcc_features std_version list)
record_compiler_features(C "${std_version}" ${list})
endmacro()
set(_result 0)
- if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
_get_gcc_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
endif()
- if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
if (_result EQUAL 0)
_get_gcc_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
endif()
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index 2dc02f0..a7e71c3 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -35,7 +35,12 @@ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
- set(CMAKE_CXX_STANDARD_DEFAULT 98)
+ if (NOT CMAKE_CXX_COMPILER_FORCED)
+ if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
+ endif()
endif()
macro(cmake_record_cxx_compile_features)
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index e0c02d9..50d68ee 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -36,8 +36,13 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
endif()
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
- set(CMAKE_CXX_STANDARD_DEFAULT 98)
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
+ if (NOT CMAKE_CXX_COMPILER_FORCED)
+ if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
+ endif()
+ set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
+ endif()
endif()
macro(cmake_record_cxx_compile_features)
diff --git a/Modules/CompilerId/main.swift.in b/Modules/CompilerId/main.swift.in
index 962e857..13f0ba0 100644
--- a/Modules/CompilerId/main.swift.in
+++ b/Modules/CompilerId/main.swift.in
@@ -1 +1 @@
-println("CMakeSwiftCompilerId")
+print("CMakeSwiftCompilerId")
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 0fbf7c3..90ceedf 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -646,6 +646,11 @@ endfunction()
function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_submodules git_repository work_dir)
+ if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.6)
+ set(git_stash_save_options --all --quiet)
+ else()
+ set(git_stash_save_options --quiet)
+ endif()
file(WRITE ${script_filename}
"if(\"${git_tag}\" STREQUAL \"\")
message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
@@ -724,7 +729,7 @@ if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\"
# perform git pull --rebase
if(need_stash)
execute_process(
- COMMAND \"${git_EXECUTABLE}\" stash save --all --quiet
+ COMMAND \"${git_EXECUTABLE}\" stash save ${git_stash_save_options}
WORKING_DIRECTORY \"${work_dir}\"
RESULT_VARIABLE error_code
)
@@ -1631,20 +1636,6 @@ function(_ep_add_mkdir_command name)
endfunction()
-function(_ep_get_git_version git_EXECUTABLE git_version_var)
- if(git_EXECUTABLE)
- execute_process(
- COMMAND "${git_EXECUTABLE}" --version
- OUTPUT_VARIABLE ov
- ERROR_VARIABLE ev
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- string(REGEX REPLACE "^git version (.+)$" "\\1" version "${ov}")
- set(${git_version_var} "${version}" PARENT_SCOPE)
- endif()
-endfunction()
-
-
function(_ep_is_dir_empty dir empty_var)
file(GLOB gr "${dir}/*")
if("${gr}" STREQUAL "")
@@ -1747,8 +1738,7 @@ function(_ep_add_download_command name)
# The git submodule update '--recursive' flag requires git >= v1.6.5
#
- _ep_get_git_version("${GIT_EXECUTABLE}" git_version)
- if(git_version VERSION_LESS 1.6.5)
+ if(GIT_VERSION_STRING VERSION_LESS 1.6.5)
message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': git_version='${git_version}'")
endif()
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index f4b0783..1fc582f 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1584,9 +1584,8 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
# we work around that issue by compiling the intermediate link object as a
# pre-link custom command in that situation.
set(do_obj_build_rule TRUE)
- if (MSVC_VERSION GREATER 1599)
- # VS 2010 and 2012 have this problem. If future versions fix this issue,
- # it should still work, it just won't be as nice as the other method.
+ if (MSVC_VERSION GREATER 1599 AND MSVC_VERSION LESS 1800)
+ # VS 2010 and 2012 have this problem.
set(do_obj_build_rule FALSE)
endif()
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 3bd6f1e..37bca83 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -31,6 +31,12 @@
# Find module will then look in this path when searching for HDF5
# executables, paths, and libraries.
#
+# Both the serial and parallel HDF5 wrappers are considered and the first
+# directory to contain either one will be used. In the event that both appear
+# in the same directory the serial version is preferentially selected. This
+# behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to
+# true.
+#
# In addition to finding the includes and libraries required to compile
# an HDF5 client application, this module also makes an effort to find
# tools that come with the HDF5 distribution that may be useful for
@@ -103,28 +109,43 @@ else()
endforeach()
endif()
+# Determine whether to search for serial or parallel executable first
+if(HDF5_PREFER_PARALLEL)
+ set(HDF5_C_COMPILER_NAMES h5pcc h5cc)
+ set(HDF5_CXX_COMPILER_NAMES h5pc++ h5c++)
+ set(HDF5_Fortran_COMPILER_NAMES h5pfc h5fc)
+else()
+ set(HDF5_C_COMPILER_NAMES h5cc h5pcc)
+ set(HDF5_CXX_COMPILER_NAMES h5c++ h5pc++)
+ set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc)
+endif()
+
# try to find the HDF5 wrapper compilers
find_program( HDF5_C_COMPILER_EXECUTABLE
- NAMES h5cc h5pcc
+ NAMES ${HDF5_C_COMPILER_NAMES} NAMES_PER_DIR
HINTS ENV HDF5_ROOT
PATH_SUFFIXES bin Bin
DOC "HDF5 Wrapper compiler. Used only to detect HDF5 compile flags." )
mark_as_advanced( HDF5_C_COMPILER_EXECUTABLE )
find_program( HDF5_CXX_COMPILER_EXECUTABLE
- NAMES h5c++ h5pc++
+ NAMES ${HDF5_CXX_COMPILER_NAMES} NAMES_PER_DIR
HINTS ENV HDF5_ROOT
PATH_SUFFIXES bin Bin
DOC "HDF5 C++ Wrapper compiler. Used only to detect HDF5 compile flags." )
mark_as_advanced( HDF5_CXX_COMPILER_EXECUTABLE )
find_program( HDF5_Fortran_COMPILER_EXECUTABLE
- NAMES h5fc h5pfc
+ NAMES ${HDF5_Fortran_COMPILER_NAMES} NAMES_PER_DIR
HINTS ENV HDF5_ROOT
PATH_SUFFIXES bin Bin
DOC "HDF5 Fortran Wrapper compiler. Used only to detect HDF5 compile flags." )
mark_as_advanced( HDF5_Fortran_COMPILER_EXECUTABLE )
+unset(HDF5_C_COMPILER_NAMES)
+unset(HDF5_CXX_COMPILER_NAMES)
+unset(HDF5_Fortran_COMPILER_NAMES)
+
find_program( HDF5_DIFF_EXECUTABLE
NAMES h5diff
HINTS ENV HDF5_ROOT
@@ -225,6 +246,8 @@ if( NOT HDF5_FOUND )
_HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE )
_HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE )
_HDF5_invoke_compiler( Fortran HDF5_Fortran_COMPILE_LINE HDF5_Fortran_RETURN_VALUE )
+ set(HDF5_HL_COMPILE_LINE ${HDF5_C_COMPILE_LINE})
+ set(HDF5_Fortran_HL_COMPILE_LINE ${HDF5_Fortran_COMPILE_LINE})
# seed the initial lists of libraries to find with items we know we need
set( HDF5_C_LIBRARY_NAMES_INIT hdf5 )
@@ -232,7 +255,7 @@ if( NOT HDF5_FOUND )
set( HDF5_CXX_LIBRARY_NAMES_INIT hdf5_cpp ${HDF5_C_LIBRARY_NAMES_INIT} )
set( HDF5_Fortran_LIBRARY_NAMES_INIT hdf5_fortran
${HDF5_C_LIBRARY_NAMES_INIT} )
- set( HDF5_Fortran_HL_LIBRARY_NAMES_INIT hdf5hl_fortran
+ set( HDF5_Fortran_HL_LIBRARY_NAMES_INIT hdf5hl_fortran hdf5_hl
${HDF5_Fortran_LIBRARY_NAMES_INIT} )
foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} )
@@ -376,4 +399,3 @@ find_package_handle_standard_args( HDF5
REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS
VERSION_VAR HDF5_VERSION
)
-
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index d248fe1..cbe21d7 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -42,7 +42,11 @@ macro(java_append_library_directories _var)
# 1.6.0_18 + icedtea patches. However, it would be much better to base the
# guess on the first part of the GNU config.guess platform triplet.
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "x86_64-linux-gnux32")
+ set(_java_libarch "x32" "amd64" "i386")
+ else()
set(_java_libarch "amd64" "i386")
+ endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
set(_java_libarch "i386")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
@@ -53,7 +57,7 @@ macro(java_append_library_directories _var)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
# mips* machines are bi-endian mostly so processor does not tell
# endianess of the underlying system.
- set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb")
+ set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
set(_java_libarch "ppc64" "ppc64le")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
@@ -152,6 +156,9 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
/usr/local/jre-1.7.0/lib/{libarch}
/usr/local/jdk-1.6.0/jre/lib/{libarch}
/usr/local/jre-1.6.0/lib/{libarch}
+ # SuSE specific paths for default JVM
+ /usr/lib64/jvm/java/jre/lib/{libarch}
+ /usr/lib64/jvm/jre/lib/{libarch}
)
set(JAVA_JVM_LIBRARY_DIRECTORIES)
@@ -160,6 +167,9 @@ foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES})
"${dir}"
"${dir}/client"
"${dir}/server"
+ # IBM SDK, Java Technology Edition, specific paths
+ "${dir}/j9vm"
+ "${dir}/default"
)
endforeach()
@@ -189,6 +199,8 @@ list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES
# OpenBSD specific path for default JVM
/usr/local/jdk-1.7.0/include
/usr/local/jdk-1.6.0/include
+ # SuSE specific paths for default JVM
+ /usr/lib64/jvm/java/include
)
foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 434ef58..d75e8ab 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -36,6 +36,7 @@
# ^^^^^
#
# Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation.
+# Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries.
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -57,6 +58,16 @@ if (UNIX)
pkg_check_modules(_OPENSSL QUIET openssl)
endif ()
+# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
+if(OPENSSL_USE_STATIC_LIBS)
+ set(_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ if(WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ else()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
+ endif()
+endif()
+
if (WIN32)
# http://www.slproweb.com/products/Win32OpenSSL.html
set(_OPENSSL_ROOT_HINTS
@@ -113,12 +124,21 @@ if(WIN32 AND NOT CYGWIN)
# We are using the libraries located in the VC subdir instead of the parent directory eventhough :
# libeay32MD.lib is identical to ../libeay32.lib, and
# ssleay32MD.lib is identical to ../ssleay32.lib
+ # enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static
- set(_OPENSSL_PATH_SUFFIXES
- "lib"
- "VC"
- "lib/VC"
- )
+ if(OPENSSL_USE_STATIC_LIBS)
+ set(_OPENSSL_PATH_SUFFIXES
+ "lib"
+ "VC/static"
+ "lib/VC/static"
+ )
+ else()
+ set(_OPENSSL_PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+ endif ()
find_library(LIB_EAY_DEBUG
NAMES
@@ -414,3 +434,8 @@ if(OPENSSL_FOUND)
endif()
endif()
endif()
+
+# Restore the original find library ordering
+if(OPENSSL_USE_STATIC_LIBS)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+endif()
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index 1be38af..fe2dbea 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -42,7 +42,7 @@ valid filepaths.
(recommended). Not valid in the full signature.
``FOUND_VAR <result-var>``
- Obselete. Specifies either ``<PackageName>_FOUND`` or
+ Obsolete. Specifies either ``<PackageName>_FOUND`` or
``<PACKAGENAME>_FOUND`` as the result variable. This exists only
for compatibility with older versions of CMake and is now ignored.
Result variables of both names are always set for compatibility.
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index ae6903e..e822b9c 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -70,14 +70,14 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist}
OUTPUT_VARIABLE _pkgconfig_invoke_result
- RESULT_VARIABLE _pkgconfig_failed)
+ RESULT_VARIABLE _pkgconfig_failed
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
if (_pkgconfig_failed)
set(_pkgconfig_${_varname} "")
_pkgconfig_unset(${_prefix}_${_varname})
else()
string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
- string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
if (NOT ${_regexp} STREQUAL "")
string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
@@ -91,6 +91,26 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
endif()
endmacro()
+#[========================================[.rst:
+.. command:: pkg_get_variable
+
+ Retrieves the value of a variable from a package::
+
+ pkg_get_variable(<RESULT> <MODULE> <VARIABLE>)
+
+ For example:
+
+ .. code-block:: cmake
+
+ pkg_get_variable(GI_GIRDIR gobject-introspection-1.0 girdir)
+#]========================================]
+function (pkg_get_variable result pkg variable)
+ _pkgconfig_invoke("${pkg}" "prefix" "result" "" "--variable=${variable}")
+ set("${result}"
+ "${prefix_result}"
+ PARENT_SCOPE)
+endfunction ()
+
# Invokes pkgconfig two times; once without '--static' and once with
# '--static'
macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
@@ -356,9 +376,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
endif()
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion )
- _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix )
- _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir )
- _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir )
+ pkg_get_variable("${_pkg_check_prefix}_PREFIX" ${_pkg_check_modules_pkg} "prefix")
+ pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir")
+ pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir")
if (NOT ${_is_silent})
message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 335c408..4a68cd1 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -57,17 +57,18 @@
# include_directories(${PROTOBUF_INCLUDE_DIRS})
# include_directories(${CMAKE_CURRENT_BINARY_DIR})
# protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS foo.proto)
+# protobuf_generate_python(PROTO_PY foo.proto)
# add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS})
# target_link_libraries(bar ${PROTOBUF_LIBRARIES})
#
# .. note::
-# The PROTOBUF_GENERATE_CPP macro and add_executable() or
-# add_library() calls only work properly within the same
-# directory.
+# The ``protobuf_generate_cpp`` and ``protobuf_generate_python``
+# functions and :command:`add_executable` or :command:`add_library`
+# calls only work properly within the same directory.
#
# .. command:: protobuf_generate_cpp
#
-# Add custom commands to process ``.proto`` files::
+# Add custom commands to process ``.proto`` files to C++::
#
# protobuf_generate_cpp (<SRCS> <HDRS> [<ARGN>...])
#
@@ -77,6 +78,17 @@
# Variable to define with autogenerated header files
# ``ARGN``
# ``.proto`` files
+#
+# .. command:: protobuf_generate_python
+#
+# Add custom commands to process ``.proto`` files to Python::
+#
+# protobuf_generate_python (<PY> [<ARGN>...])
+#
+# ``PY``
+# Variable to define with autogenerated Python files
+# ``ARGN``
+# ``.proto`` filess
#=============================================================================
# Copyright 2009 Kitware, Inc.
@@ -147,6 +159,53 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
set(${HDRS} ${${HDRS}} PARENT_SCOPE)
endfunction()
+function(PROTOBUF_GENERATE_PYTHON SRCS)
+ if(NOT ARGN)
+ message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files")
+ return()
+ endif()
+
+ if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
+ # Create an include path for each file specified
+ foreach(FIL ${ARGN})
+ get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
+ get_filename_component(ABS_PATH ${ABS_FIL} PATH)
+ list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
+ if(${_contains_already} EQUAL -1)
+ list(APPEND _protobuf_include_path -I ${ABS_PATH})
+ endif()
+ endforeach()
+ else()
+ set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
+ endif()
+
+ if(DEFINED PROTOBUF_IMPORT_DIRS)
+ foreach(DIR ${PROTOBUF_IMPORT_DIRS})
+ get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
+ list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
+ if(${_contains_already} EQUAL -1)
+ list(APPEND _protobuf_include_path -I ${ABS_PATH})
+ endif()
+ endforeach()
+ endif()
+
+ set(${SRCS})
+ foreach(FIL ${ARGN})
+ get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
+ get_filename_component(FIL_WE ${FIL} NAME_WE)
+
+ list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py")
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py"
+ COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
+ DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE}
+ COMMENT "Running Python protocol buffer compiler on ${FIL}"
+ VERBATIM )
+ endforeach()
+
+ set(${SRCS} ${${SRCS}} PARENT_SCOPE)
+endfunction()
+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_PROTOBUF_ARCH_DIR x64/)
endif()
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 8784e18..879192e 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -51,7 +51,7 @@ unset(_Python_NAMES)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
-set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0)
+set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonInterp_FIND_VERSION)
if(PythonInterp_FIND_VERSION_COUNT GREATER 1)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index b80d3ce..68e1228 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -49,6 +49,25 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+# Use the executable's path as a hint
+set(_Python_LIBRARY_PATH_HINT)
+if(PYTHON_EXECUTABLE)
+ if(WIN32)
+ get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH)
+ if(_Python_PREFIX)
+ set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/libs)
+ endif()
+ unset(_Python_PREFIX)
+ else()
+ get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH)
+ get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH)
+ if(_Python_PREFIX)
+ set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/lib)
+ endif()
+ unset(_Python_PREFIX)
+ endif()
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake)
# Search for the python framework on Apple.
CMAKE_FIND_FRAMEWORKS(Python)
@@ -64,7 +83,7 @@ set(CMAKE_FIND_FRAMEWORK LAST)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
-set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0)
+set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonLibs_FIND_VERSION)
if(PythonLibs_FIND_VERSION_COUNT GREATER 1)
@@ -112,6 +131,7 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
if(WIN32)
find_library(PYTHON_DEBUG_LIBRARY
NAMES python${_CURRENT_VERSION_NO_DOTS}_d python
+ HINTS ${_Python_LIBRARY_PATH_HINT}
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
@@ -134,6 +154,8 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
python${_CURRENT_VERSION}m
python${_CURRENT_VERSION}u
python${_CURRENT_VERSION}
+ HINTS
+ ${_Python_LIBRARY_PATH_HINT}
PATHS
${PYTHON_FRAMEWORK_LIBRARIES}
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
@@ -150,33 +172,42 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
PATH_SUFFIXES python${_CURRENT_VERSION}/config
)
- # For backward compatibility, honour value of PYTHON_INCLUDE_PATH, if
- # PYTHON_INCLUDE_DIR is not set.
- if(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR)
- set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH
- "Path to where Python.h is found" FORCE)
- endif()
+ # Don't search for include dir until library location is known
+ if(PYTHON_LIBRARY)
- set(PYTHON_FRAMEWORK_INCLUDES)
- if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR)
- foreach(dir ${Python_FRAMEWORKS})
- list(APPEND PYTHON_FRAMEWORK_INCLUDES
- ${dir}/Versions/${_CURRENT_VERSION}/include/python${_CURRENT_VERSION})
- endforeach()
- endif()
+ # Use the library's install prefix as a hint
+ set(_Python_INCLUDE_PATH_HINT)
+ get_filename_component(_Python_PREFIX ${PYTHON_LIBRARY} PATH)
+ get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH)
+ if(_Python_PREFIX)
+ set(_Python_INCLUDE_PATH_HINT ${_Python_PREFIX}/include)
+ endif()
+ unset(_Python_PREFIX)
+
+ # Add framework directories to the search paths
+ set(PYTHON_FRAMEWORK_INCLUDES)
+ if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR)
+ foreach(dir ${Python_FRAMEWORKS})
+ list(APPEND PYTHON_FRAMEWORK_INCLUDES
+ ${dir}/Versions/${_CURRENT_VERSION}/include)
+ endforeach()
+ endif()
- find_path(PYTHON_INCLUDE_DIR
- NAMES Python.h
- PATHS
- ${PYTHON_FRAMEWORK_INCLUDES}
- [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
- PATH_SUFFIXES
- python${_CURRENT_VERSION}mu
- python${_CURRENT_VERSION}m
- python${_CURRENT_VERSION}u
- python${_CURRENT_VERSION}
- )
+ find_path(PYTHON_INCLUDE_DIR
+ NAMES Python.h
+ HINTS
+ ${_Python_INCLUDE_PATH_HINT}
+ PATHS
+ ${PYTHON_FRAMEWORK_INCLUDES}
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
+ PATH_SUFFIXES
+ python${_CURRENT_VERSION}mu
+ python${_CURRENT_VERSION}m
+ python${_CURRENT_VERSION}u
+ python${_CURRENT_VERSION}
+ )
+ endif()
# For backward compatibility, set PYTHON_INCLUDE_PATH.
set(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}")
@@ -194,6 +225,9 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
endif()
endforeach()
+unset(_Python_INCLUDE_PATH_HINT)
+unset(_Python_LIBRARY_PATH_HINT)
+
mark_as_advanced(
PYTHON_DEBUG_LIBRARY
PYTHON_LIBRARY
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index a0bc4d1..c607923 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -39,7 +39,7 @@
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
-# Copyright 2011-2014 Rolf Eike Beer <eike@sf-mail.de>
+# Copyright 2011-2015 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -51,15 +51,23 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-include (CheckIncludeFiles)
include (CheckLibraryExists)
include (CheckSymbolExists)
set(Threads_FOUND FALSE)
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
set(CMAKE_REQUIRED_QUIET ${Threads_FIND_QUIETLY})
+if(CMAKE_C_COMPILER_LOADED)
+ include (CheckIncludeFile)
+elseif(CMAKE_CXX_COMPILER_LOADED)
+ include (CheckIncludeFileCXX)
+else()
+ message(FATAL_ERROR "FindThreads only works if either C or CXX language is enabled")
+endif()
+
# Do we have sproc?
if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
+ include (CheckIncludeFiles)
CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H)
endif()
@@ -83,11 +91,18 @@ macro(_check_pthreads_flag)
# If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
if(NOT DEFINED THREADS_HAVE_PTHREAD_ARG)
message(STATUS "Check if compiler accepts -pthread")
+ if(CMAKE_C_COMPILER_LOADED)
+ set(_threads_src ${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c)
+ elseif(CMAKE_CXX_COMPILER_LOADED)
+ set(_threads_src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindThreads/CheckForPthreads.cxx)
+ configure_file(${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c "${_threads_src}" COPYONLY)
+ endif()
try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
${CMAKE_BINARY_DIR}
- ${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c
+ ${_threads_src}
CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread
COMPILE_OUTPUT_VARIABLE OUTPUT)
+ unset(_threads_src)
if(THREADS_HAVE_PTHREAD_ARG)
if(THREADS_PTHREAD_ARG STREQUAL "2")
@@ -120,7 +135,11 @@ if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD)
set(CMAKE_USE_SPROC_INIT 1)
else()
# Do we have pthreads?
- CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H)
+ if(CMAKE_C_COMPILER_LOADED)
+ CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H)
+ else()
+ CHECK_INCLUDE_FILE_CXX("pthread.h" CMAKE_HAVE_PTHREAD_H)
+ endif()
if(CMAKE_HAVE_PTHREAD_H)
#
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index d4a27d5..a57f450 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -74,14 +74,28 @@ set(_ZLIB_SEARCH_NORMAL
)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
-set(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1)
+set(ZLIB_NAMES z zlib zdll zlib1)
+set(ZLIB_NAMES_DEBUG zlibd zlibd1)
# Try each search configuration.
foreach(search ${_ZLIB_SEARCHES})
- find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
- find_library(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib)
+ find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
endforeach()
+# Allow ZLIB_LIBRARY to be set manually, as the location of the zlib library
+if(NOT ZLIB_LIBRARY)
+ foreach(search ${_ZLIB_SEARCHES})
+ find_library(ZLIB_LIBRARY_RELEASE NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib)
+ find_library(ZLIB_LIBRARY_DEBUG NAMES ${ZLIB_NAMES_DEBUG} ${${search}} PATH_SUFFIXES lib)
+ endforeach()
+
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(ZLIB)
+endif()
+
+unset(ZLIB_NAMES)
+unset(ZLIB_NAMES_DEBUG)
+
mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
@@ -112,12 +126,33 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D
if(ZLIB_FOUND)
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
- set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
+
+ if(NOT ZLIB_LIBRARIES)
+ set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
+ endif()
if(NOT TARGET ZLIB::ZLIB)
add_library(ZLIB::ZLIB UNKNOWN IMPORTED)
set_target_properties(ZLIB::ZLIB PROPERTIES
- IMPORTED_LOCATION "${ZLIB_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}")
+
+ if(ZLIB_LIBRARY_RELEASE)
+ set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(ZLIB::ZLIB PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${ZLIB_LIBRARY_RELEASE}")
+ endif()
+
+ if(ZLIB_LIBRARY_DEBUG)
+ set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(ZLIB::ZLIB PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${ZLIB_LIBRARY_DEBUG}")
+ endif()
+
+ if(NOT ZLIB_LIBRARY_RELEASE AND NOT ZLIB_LIBRARY_DEBUG)
+ set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
+ IMPORTED_LOCATION "${ZLIB_LIBRARY}")
+ endif()
endif()
endif()
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 9a70678..54a74f6 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -302,6 +302,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Find wxWidgets multilib base libraries.
find_library(WX_base${_DBG}
NAMES
+ wxbase31${_UCD}${_DBG}
wxbase30${_UCD}${_DBG}
wxbase29${_UCD}${_DBG}
wxbase28${_UCD}${_DBG}
@@ -315,6 +316,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
foreach(LIB net odbc xml)
find_library(WX_${LIB}${_DBG}
NAMES
+ wxbase31${_UCD}${_DBG}_${LIB}
wxbase30${_UCD}${_DBG}_${LIB}
wxbase29${_UCD}${_DBG}_${LIB}
wxbase28${_UCD}${_DBG}_${LIB}
@@ -330,6 +332,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Find wxWidgets monolithic library.
find_library(WX_mono${_DBG}
NAMES
+ wxmsw${_UNV}31${_UCD}${_DBG}
wxmsw${_UNV}30${_UCD}${_DBG}
wxmsw${_UNV}29${_UCD}${_DBG}
wxmsw${_UNV}28${_UCD}${_DBG}
@@ -346,6 +349,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
stc ribbon propgrid webview)
find_library(WX_${LIB}${_DBG}
NAMES
+ wxmsw${_UNV}31${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}30${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}29${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}28${_UCD}${_DBG}_${LIB}
@@ -386,7 +390,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Clear wxWidgets multilib libraries.
foreach(LIB core adv aui html media xrc dbgrid gl qa richtext
- stc ribbon propgrid)
+ webview stc ribbon propgrid)
WX_CLEAR_LIB(WX_${LIB}${_DBG})
endforeach()
endmacro()
@@ -741,7 +745,7 @@ else()
#-----------------------------------------------------------------
# Support cross-compiling, only search in the target platform.
find_program(wxWidgets_CONFIG_EXECUTABLE
- NAMES wx-config wx-config-3.0 wx-config-2.9 wx-config-2.8
+ NAMES wx-config wx-config-3.1 wx-config-3.0 wx-config-2.9 wx-config-2.8
DOC "Location of wxWidgets library configuration provider binary (wx-config)."
ONLY_CMAKE_FIND_ROOT_PATH
)
@@ -857,6 +861,28 @@ else()
endif()
endif()
+# Check if a specfic version was requested by find_package().
+if(wxWidgets_FOUND)
+ find_file(_filename wx/version.h PATHS ${wxWidgets_INCLUDE_DIRS} NO_DEFAULT_PATH)
+ dbg_msg("_filename: ${_filename}")
+
+ if(NOT _filename)
+ message(FATAL_ERROR "wxWidgets wx/version.h file not found in ${wxWidgets_INCLUDE_DIRS}.")
+ endif()
+
+ file(READ ${_filename} _wx_version_h)
+
+ string(REGEX REPLACE "^(.*\n)?#define +wxMAJOR_VERSION +([0-9]+).*"
+ "\\2" wxWidgets_VERSION_MAJOR "${_wx_version_h}" )
+ string(REGEX REPLACE "^(.*\n)?#define +wxMINOR_VERSION +([0-9]+).*"
+ "\\2" wxWidgets_VERSION_MINOR "${_wx_version_h}" )
+ string(REGEX REPLACE "^(.*\n)?#define +wxRELEASE_NUMBER +([0-9]+).*"
+ "\\2" wxWidgets_VERSION_PATCH "${_wx_version_h}" )
+ set(wxWidgets_VERSION_STRING
+ "${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}" )
+ dbg_msg("wxWidgets_VERSION_STRING: ${wxWidgets_VERSION_STRING}")
+endif()
+
# Debug output:
DBG_MSG("wxWidgets_FOUND : ${wxWidgets_FOUND}")
DBG_MSG("wxWidgets_INCLUDE_DIRS : ${wxWidgets_INCLUDE_DIRS}")
@@ -867,10 +893,13 @@ DBG_MSG("wxWidgets_USE_FILE : ${wxWidgets_USE_FILE}")
#=====================================================================
#=====================================================================
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(wxWidgets DEFAULT_MSG wxWidgets_FOUND)
-# Maintain consistency with all other variables.
-set(wxWidgets_FOUND ${WXWIDGETS_FOUND})
+
+find_package_handle_standard_args(wxWidgets
+ REQUIRED_VARS wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS
+ VERSION_VAR wxWidgets_VERSION_STRING
+ )
#=====================================================================
# Macros for use in wxWidgets apps.
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index aab29ea..8205425 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -268,7 +268,7 @@ macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY)
get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
if(NOT ${type} STREQUAL "STATIC_LIBRARY")
- if(WIN32)
+ if(WIN32 OR CYGWIN)
set(DEFINE_EXPORT "__declspec(dllexport)")
set(DEFINE_IMPORT "__declspec(dllimport)")
elseif(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY)
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index abd9a26..86b89b2 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -5,7 +5,7 @@ macro(record_compiler_features lang compile_flags feature_list)
string(TOLOWER ${lang} lang_lc)
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" "
- const char features[] = {\"\"\n")
+ const char features[] = {\"\\n\"\n")
get_property(known_features GLOBAL PROPERTY CMAKE_${lang}_KNOWN_FEATURES)
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 4e4810a..bb085ac 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -53,7 +53,7 @@ set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_
set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
-set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a")
# hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree
# (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache
diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake
index 342ad21..9eb7a8a 100644
--- a/Modules/Platform/GHS-MULTI-Initialize.cmake
+++ b/Modules/Platform/GHS-MULTI-Initialize.cmake
@@ -13,13 +13,35 @@
# License text for the above reference.)
#Setup Greenhills MULTI specific compilation information
-find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122
- "C:/ghs/int1122"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104
- "C:/ghs/int1104"
- DOC "Path to integrity directory"
- )
+
+if (NOT GHS_INT_DIRECTORY)
+ #Assume the C:/ghs/int#### directory that is latest is prefered
+ set(GHS_EXPECTED_ROOT "C:/ghs")
+ if (EXISTS ${GHS_EXPECTED_ROOT})
+ FILE(GLOB GHS_CANDIDATE_INT_DIRS RELATIVE
+ ${GHS_EXPECTED_ROOT} ${GHS_EXPECTED_ROOT}/*)
+ string(REGEX MATCHALL "int[0-9][0-9][0-9][0-9]" GHS_CANDIDATE_INT_DIRS
+ ${GHS_CANDIDATE_INT_DIRS})
+ if (GHS_CANDIDATE_INT_DIRS)
+ list(SORT GHS_CANDIDATE_INT_DIRS)
+ list(GET GHS_CANDIDATE_INT_DIRS -1 GHS_INT_DIRECTORY)
+ string(CONCAT GHS_INT_DIRECTORY ${GHS_EXPECTED_ROOT} "/"
+ ${GHS_INT_DIRECTORY})
+ endif ()
+ endif ()
+
+ #Try to look for known registry values
+ if (NOT GHS_INT_DIRECTORY)
+ find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104
+ )
+ endif ()
+
+ set(GHS_INT_DIRECTORY ${GHS_INT_DIRECTORY} CACHE PATH
+ "Path to integrity directory")
+endif ()
+
set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory")
set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation")
set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name")
diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake
index 581301b..88932ad 100644
--- a/Modules/Platform/HP-UX.cmake
+++ b/Modules/Platform/HP-UX.cmake
@@ -1,9 +1,11 @@
set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib)
-set(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so
+if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "ia64")
+ set(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a")
+ set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so")
+endif()
set(CMAKE_DL_LIBS "dld")
-set(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a")
-set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so")
# The HP linker needs to find transitive shared library dependencies
# in the -L path. Therefore the runtime path must be added to the
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index b97409c..d8a423e 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -65,7 +65,7 @@ macro(__windows_compiler_gnu lang)
if(MSYS OR MINGW)
# Create archiving rules to support large object file lists for static libraries.
- set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 94470c3..8594596 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -274,8 +274,8 @@ set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZER
macro(__windows_compiler_msvc lang)
if(NOT MSVC_VERSION LESS 1400)
# for 2005 make sure the manifest is put in the dll with mt
- set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll ")
- set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ")
+ set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ")
+ set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ")
endif()
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
"${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index c61591d..dced6ec 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -309,6 +309,65 @@
#
#
# if you don't set the INSTALLPATH.
+#
+# ::
+#
+# create_javah(TARGET <target>
+# GENERATED_FILES <VAR>
+# CLASSES <class>...
+# [CLASSPATH <classpath>...]
+# [DEPENDS <depend>...]
+# [OUTPUT_NAME <path>|OUTPUT_DIR <path>]
+# )
+#
+# Create C header files from java classes. These files provide the connective glue
+# that allow your Java and C code to interact.
+#
+# There are two main signatures for create_javah. The first signature
+# returns generated files throught variable specified by GENERATED_FILES option:
+#
+# ::
+#
+# Example:
+# Create_javah(GENERATED_FILES files_headers
+# CLASSES org.cmake.HelloWorld
+# CLASSPATH hello.jar
+# )
+#
+#
+#
+# The second signature for create_javah creates a target which encapsulates
+# header files generation.
+#
+# ::
+#
+# Example:
+# Create_javah(TARGET target_headers
+# CLASSES org.cmake.HelloWorld
+# CLASSPATH hello.jar
+# )
+#
+#
+#
+# Both signatures share same options.
+#
+# ``CLASSES <class>...``
+# Specifies Java classes used to generate headers.
+#
+# ``CLASSPATH <classpath>...``
+# Specifies various paths to look up classes. Here .class files, jar files or targets
+# created by command add_jar can be used.
+#
+# ``DEPENDS <depend>...``
+# Targets on which the javah target depends
+#
+# ``OUTPUT_NAME <path>``
+# Concatenates the resulting header files for all the classes listed by option CLASSES
+# into <path>. Same behavior as option '-o' of javah tool.
+#
+# ``OUTPUT_DIR <path>``
+# Sets the directory where the header files will be generated. Same behavior as option
+# '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory.
#=============================================================================
# Copyright 2013 OpenGamma Ltd. <graham@opengamma.com>
@@ -1131,3 +1190,101 @@ function(create_javadoc _target)
DESTINATION ${_javadoc_installpath}
)
endfunction()
+
+function (create_javah)
+ cmake_parse_arguments(_create_javah
+ ""
+ "TARGET;GENERATED_FILES;OUTPUT_NAME;OUTPUT_DIR"
+ "CLASSES;CLASSPATH;DEPENDS"
+ ${ARGN})
+
+ # ckeck parameters
+ if (NOT _create_javah_TARGET AND NOT _create_javah_GENERATED_FILES)
+ message (FATAL_ERROR "create_javah: TARGET or GENERATED_FILES must be specified.")
+ endif()
+ if (_create_javah_OUTPUT_NAME AND _create_javah_OUTPUT_DIR)
+ message (FATAL_ERROR "create_javah: OUTPUT_NAME and OUTPUT_DIR are mutually exclusive.")
+ endif()
+
+ if (NOT _create_javah_CLASSES)
+ message (FATAL_ERROR "create_javah: CLASSES is a required parameter.")
+ endif()
+
+ set (_output_files)
+ if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+ set(_classpath_sep ";")
+ else ()
+ set(_classpath_sep ":")
+ endif()
+
+ # handle javah options
+ set (_javah_options)
+
+ if (_create_javah_CLASSPATH)
+ # CLASSPATH can specify directories, jar files or targets created with add_jar command
+ set (_classpath)
+ foreach (_path IN LISTS _create_javah_CLASSPATH)
+ if (TARGET ${_path})
+ get_target_property (_jar_path ${_path} JAR_FILE)
+ if (_jar_path)
+ list (APPEND _classpath "${_jar_path}")
+ list (APPEND _create_javah_DEPENDS "${_path}")
+ else()
+ message(SEND_ERROR "create_javah: CLASSPATH target ${_path} is not a jar.")
+ endif()
+ elseif (EXISTS "${_path}")
+ list (APPEND _classpath "${_path}")
+ if (NOT IS_DIRECTORY "${_path}")
+ list (APPEND _create_javah_DEPENDS "${_path}")
+ endif()
+ else()
+ message(SEND_ERROR "create_javah: CLASSPATH entry ${_path} does not exist.")
+ endif()
+ endforeach()
+ string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}")
+ list (APPEND _javah_options -classpath ${_classpath})
+ endif()
+
+ if (_create_javah_OUTPUT_DIR)
+ list (APPEND _javah_options -d "${_create_javah_OUTPUT_DIR}")
+ endif()
+
+ if (_create_javah_OUTPUT_NAME)
+ list (APPEND _javah_options -o "${_create_javah_OUTPUT_NAME}")
+ set (_output_files "${_create_javah_OUTPUT_NAME}")
+
+ get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_NAME}" DIRECTORY)
+ get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_DIR}" ABSOLUTE)
+ endif()
+
+ if (NOT _create_javah_OUTPUT_DIR)
+ set (_create_javah_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+ endif()
+
+ if (NOT _create_javah_OUTPUT_NAME)
+ # compute output names
+ foreach (_class IN LISTS _create_javah_CLASSES)
+ string (REPLACE "." "_" _c_header "${_class}")
+ set (_c_header "${_create_javah_OUTPUT_DIR}/${_c_header}.h")
+ list (APPEND _output_files "${_c_header}")
+ endforeach()
+ endif()
+
+ # finalize custom command arguments
+ if (_create_javah_DEPENDS)
+ list (INSERT _create_javah_DEPENDS 0 DEPENDS)
+ endif()
+
+ add_custom_command (OUTPUT ${_output_files}
+ COMMAND "${Java_JAVAH_EXECUTABLE}" ${_javah_options} -jni ${_create_javah_CLASSES}
+ ${_create_javah_DEPENDS}
+ WORKING_DIRECTORY ${_create_javah_OUTPUT_DIR}
+ COMMENT "Building C header files from classes...")
+
+ if (_create_javah_TARGET)
+ add_custom_target (${_create_javah_TARGET} ALL DEPENDS ${_output_files})
+ endif()
+ if (_create_javah_GENERATED_FILES)
+ set (${_create_javah_GENERATED_FILES} ${_output_files} PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 96b0b35..d757f65 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -153,10 +153,12 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
else()
set(swig_outdir ${CMAKE_CURRENT_BINARY_DIR})
endif()
- SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
- swig_extra_generated_files
- "${swig_outdir}"
- "${swig_source_file_fullname}")
+ if (NOT SWIG_MODULE_${name}_NOPROXY)
+ SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
+ swig_extra_generated_files
+ "${swig_outdir}"
+ "${swig_source_file_fullname}")
+ endif()
set(swig_generated_file_fullname
"${swig_outdir}/${swig_source_file_name_we}")
# add the language into the name of the file (i.e. TCL_wrap)
diff --git a/Modules/UseVTK40.cmake b/Modules/UseVTK40.cmake
deleted file mode 100644
index d6bdaaa..0000000
--- a/Modules/UseVTK40.cmake
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-
-#=============================================================================
-# Copyright 2002-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# This is an implementation detail for using VTK 4.0 with the
-# FindVTK.cmake module. Do not include directly by name. This should
-# be included only when FindVTK.cmake sets the VTK_USE_FILE variable
-# to point here.
-
-# Add compiler flags needed to use VTK.
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VTK_REQUIRED_C_FLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VTK_REQUIRED_CXX_FLAGS}")
-
-# Add include directories needed to use VTK.
-include_directories(${VTK_INCLUDE_DIRS})
-
-# Add link directories needed to use VTK.
-link_directories(${VTK_LIBRARY_DIRS})
diff --git a/Modules/UseVTKBuildSettings40.cmake b/Modules/UseVTKBuildSettings40.cmake
deleted file mode 100644
index 474f67c..0000000
--- a/Modules/UseVTKBuildSettings40.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-
-#=============================================================================
-# Copyright 2002-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# Implementation detail for FindVTK.cmake to let it provide a
-# VTK_BUILD_SETTINGS_FILE for VTK 4.0.
-
-set(CMAKE_BUILD_SETTING_CMAKE_MAJOR_VERSION "${VTK40_CMAKE_MAJOR_VERSION}")
-set(CMAKE_BUILD_SETTING_CMAKE_MINOR_VERSION "${VTK40_CMAKE_MINOR_VERSION}")
-set(CMAKE_BUILD_SETTING_PROJECT_NAME "VTK")
-
-set(CMAKE_BUILD_SETTING_C_COMPILER "${VTK40_CMAKE_C_COMPILER}")
-set(CMAKE_BUILD_SETTING_C_FLAGS "${VTK40_CMAKE_C_FLAGS}")
-set(CMAKE_BUILD_SETTING_C_FLAGS_DEBUG "${VTK40_CMAKE_C_FLAGS_DEBUG}")
-set(CMAKE_BUILD_SETTING_C_FLAGS_RELEASE "${VTK40_CMAKE_C_FLAGS_RELEASE}")
-set(CMAKE_BUILD_SETTING_C_FLAGS_MINSIZEREL "${VTK40_CMAKE_C_FLAGS_MINSIZEREL}")
-set(CMAKE_BUILD_SETTING_C_FLAGS_RELWITHDEBINFO "${VTK40_CMAKE_C_FLAGS_RELWITHDEBINFO}")
-
-set(CMAKE_BUILD_SETTING_CXX_COMPILER "${VTK40_CMAKE_CXX_COMPILER}")
-set(CMAKE_BUILD_SETTING_CXX_FLAGS "${VTK40_CMAKE_CXX_FLAGS}")
-set(CMAKE_BUILD_SETTING_CXX_FLAGS_DEBUG "${VTK40_CMAKE_CXX_FLAGS_DEBUG}")
-set(CMAKE_BUILD_SETTING_CXX_FLAGS_RELEASE "${VTK40_CMAKE_CXX_FLAGS_RELEASE}")
-set(CMAKE_BUILD_SETTING_CXX_FLAGS_MINSIZEREL "${VTK40_CMAKE_CXX_FLAGS_MINSIZEREL}")
-set(CMAKE_BUILD_SETTING_CXX_FLAGS_RELWITHDEBINFO "${VTK40_CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
-
-set(CMAKE_BUILD_SETTING_BUILD_TYPE "${VTK40_CMAKE_BUILD_TYPE}")
-set(CMAKE_BUILD_SETTING_BUILD_TOOL "${VTK40_CMAKE_BUILD_TOOL}")
diff --git a/Modules/UseVTKConfig40.cmake b/Modules/UseVTKConfig40.cmake
deleted file mode 100644
index c5022e4..0000000
--- a/Modules/UseVTKConfig40.cmake
+++ /dev/null
@@ -1,409 +0,0 @@
-#
-
-#=============================================================================
-# Copyright 2002-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# This is an implementation detail for using VTK 4.0 with the
-# FindVTK.cmake module. Do not include directly.
-
-# Hard-code the version number since it isn't provided by VTK 4.0.
-set(VTK_MAJOR_VERSION 4)
-set(VTK_MINOR_VERSION 0)
-set(VTK_BUILD_VERSION 2)
-
-# Provide a new UseVTK file that doesn't do a full LOAD_CACHE.
-set(VTK_USE_FILE ${CMAKE_ROOT}/Modules/UseVTK40.cmake)
-
-# Provide a build settings file.
-set(VTK_BUILD_SETTINGS_FILE ${CMAKE_ROOT}/Modules/UseVTKBuildSettings40.cmake)
-
-# There are no CMake extensions for VTK 4.0.
-set(VTK_CMAKE_EXTENSIONS_DIR "")
-
-# grep "VTK40_" UseVTKConfig40.cmake |sed 's/.*VTK40_\([A-Za-z0-9_]*\).*/ \1/'
-load_cache(${VTK_DIR} READ_WITH_PREFIX VTK40_
- BUILD_SHARED_LIBS
- CMAKE_BUILD_TOOL
- CMAKE_BUILD_TYPE
- CMAKE_CACHE_MAJOR_VERSION
- CMAKE_CACHE_MINOR_VERSION
- CMAKE_CXX_COMPILER
- CMAKE_CXX_FLAGS
- CMAKE_CXX_FLAGS_DEBUG
- CMAKE_CXX_FLAGS_MINSIZEREL
- CMAKE_CXX_FLAGS_RELEASE
- CMAKE_CXX_FLAGS_RELWITHDEBINFO
- CMAKE_C_COMPILER
- CMAKE_C_FLAGS
- CMAKE_C_FLAGS_DEBUG
- CMAKE_C_FLAGS_MINSIZEREL
- CMAKE_C_FLAGS_RELEASE
- CMAKE_C_FLAGS_RELWITHDEBINFO
- CMAKE_INSTALL_PREFIX
- CMAKE_Xutil_INCLUDE_PATH
- EXECUTABLE_OUTPUT_PATH
- JAVA_INCLUDE_PATH2
- LIBRARY_OUTPUT_PATH
- MPIRUN
- MPI_INCLUDE_PATH
- MPI_POSTFLAGS
- MPI_PREFLAGS
- OPENGL_INCLUDE_DIR
- OSMESA_INCLUDE_PATH
- PYTHON_INCLUDE_PATH
- TCL_INCLUDE_PATH
- VLI_INCLUDE_PATH_FOR_VG500
- VLI_INCLUDE_PATH_FOR_VP1000
- VTK_BINARY_DIR
- VTK_DEBUG_LEAKS
- VTK_HAVE_VG500
- VTK_HAVE_VP1000
- VTK_MANGLE_MESA
- VTK_OPENGL_HAS_OSMESA
- VTK_PARSE_JAVA_EXE
- VTK_SOURCE_DIR
- VTK_USE_64BIT_IDS
- VTK_USE_ANSI_STDLIB
- VTK_USE_HYBRID
- VTK_USE_MATROX_IMAGING
- VTK_USE_MPI
- VTK_USE_PARALLEL
- VTK_USE_PATENTED
- VTK_USE_RENDERING
- VTK_USE_VIDEO_FOR_WINDOWS
- VTK_USE_VOLUMEPRO
- VTK_USE_X
- VTK_WRAP_JAVA
- VTK_WRAP_JAVA_EXE
- VTK_WRAP_PYTHON
- VTK_WRAP_PYTHON_EXE
- VTK_WRAP_TCL
- VTK_WRAP_TCL_EXE
- vtkCommonJava_LIB_DEPENDS
- vtkCommonPython_LIB_DEPENDS
- vtkCommonTCL_LIB_DEPENDS
- vtkCommon_LIB_DEPENDS
- vtkFilteringJava_LIB_DEPENDS
- vtkFilteringPython_LIB_DEPENDS
- vtkFilteringTCL_LIB_DEPENDS
- vtkFiltering_LIB_DEPENDS
- vtkGraphicsJava_LIB_DEPENDS
- vtkGraphicsPython_LIB_DEPENDS
- vtkGraphicsTCL_LIB_DEPENDS
- vtkGraphics_LIB_DEPENDS
- vtkHybridJava_LIB_DEPENDS
- vtkHybridPython_LIB_DEPENDS
- vtkHybridTCL_LIB_DEPENDS
- vtkHybrid_LIB_DEPENDS
- vtkIOJava_LIB_DEPENDS
- vtkIOPython_LIB_DEPENDS
- vtkIOTCL_LIB_DEPENDS
- vtkIO_LIB_DEPENDS
- vtkImagingJava_LIB_DEPENDS
- vtkImagingPython_LIB_DEPENDS
- vtkImagingTCL_LIB_DEPENDS
- vtkImaging_LIB_DEPENDS
- vtkParallelJava_LIB_DEPENDS
- vtkParallelPython_LIB_DEPENDS
- vtkParallelTCL_LIB_DEPENDS
- vtkParallel_LIB_DEPENDS
- vtkPatentedJava_LIB_DEPENDS
- vtkPatentedPython_LIB_DEPENDS
- vtkPatentedTCL_LIB_DEPENDS
- vtkPatented_LIB_DEPENDS
- vtkRenderingJava_LIB_DEPENDS
- vtkRenderingPythonTkWidgets_LIB_DEPENDS
- vtkRenderingPython_LIB_DEPENDS
- vtkRenderingTCL_LIB_DEPENDS
- vtkRendering_LIB_DEPENDS
- vtkjpeg_LIB_DEPENDS
- vtkpng_LIB_DEPENDS
- vtkzlib_LIB_DEPENDS
-)
-
-# Copy needed settings from the VTK 4.0 cache.
-set(VTK_BUILD_SHARED ${VTK40_BUILD_SHARED_LIBS})
-set(VTK_DEBUG_LEAKS ${VTK40_VTK_DEBUG_LEAKS})
-set(VTK_HAVE_VG500 ${VTK40_VTK_HAVE_VG500})
-set(VTK_HAVE_VP1000 ${VTK40_VTK_HAVE_VP1000})
-set(VTK_USE_MANGLED_MESA ${VTK40_VTK_MANGLE_MESA})
-set(VTK_MPIRUN_EXE ${VTK40_MPIRUN})
-set(VTK_MPI_POSTFLAGS ${VTK40_MPI_POSTFLAGS})
-set(VTK_MPI_PREFLAGS ${VTK40_MPI_PREFLAGS})
-set(VTK_OPENGL_HAS_OSMESA ${VTK40_VTK_OPENGL_HAS_OSMESA})
-set(VTK_USE_64BIT_IDS ${VTK40_VTK_USE_64BIT_IDS})
-set(VTK_USE_ANSI_STDLIB ${VTK40_VTK_USE_ANSI_STDLIB})
-set(VTK_USE_HYBRID ${VTK40_VTK_USE_HYBRID})
-set(VTK_USE_MATROX_IMAGING ${VTK40_VTK_USE_MATROX_IMAGING})
-set(VTK_USE_MPI ${VTK40_VTK_USE_MPI})
-set(VTK_USE_PARALLEL ${VTK40_VTK_USE_PARALLEL})
-set(VTK_USE_PATENTED ${VTK40_VTK_USE_PATENTED})
-set(VTK_USE_RENDERING ${VTK40_VTK_USE_RENDERING})
-set(VTK_USE_VIDEO_FOR_WINDOWS ${VTK40_VTK_USE_VIDEO_FOR_WINDOWS})
-set(VTK_USE_VOLUMEPRO ${VTK40_VTK_USE_VOLUMEPRO})
-set(VTK_USE_X ${VTK40_VTK_USE_X})
-set(VTK_WRAP_JAVA ${VTK40_VTK_WRAP_JAVA})
-set(VTK_WRAP_PYTHON ${VTK40_VTK_WRAP_PYTHON})
-set(VTK_WRAP_TCL ${VTK40_VTK_WRAP_TCL})
-
-# Create the list of available kits.
-set(VTK_KITS COMMON FILTERING GRAPHICS IMAGING IO)
-if(VTK_USE_RENDERING)
- set(VTK_KITS ${VTK_KITS} RENDERING)
-endif()
-if(VTK_USE_HYBRID)
- set(VTK_KITS ${VTK_KITS} HYBRID)
-endif()
-if(VTK_USE_PARALLEL)
- set(VTK_KITS ${VTK_KITS} PARALLEL)
-endif()
-if(VTK_USE_PATENTED)
- set(VTK_KITS ${VTK_KITS} PATENTED)
-endif()
-
-# Create the list of available languages.
-set(VTK_LANGUAGES "")
-if(VTK_WRAP_TCL)
- set(VTK_LANGUAGES ${VTK_LANGUAGES} TCL)
-endif()
-if(VTK_WRAP_PYTHON)
- set(VTK_LANGUAGES ${VTK_LANGUAGES} PYTHON)
-endif()
-if(VTK_WRAP_JAVA)
- set(VTK_LANGUAGES ${VTK_LANGUAGES} JAVA)
-endif()
-
-# Include directories for other projects installed on the system and
-# used by VTK.
-set(VTK_INCLUDE_DIRS_SYS "")
-if(VTK_USE_RENDERING)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_OPENGL_INCLUDE_PATH} ${VTK40_OPENGL_INCLUDE_DIR})
- if(VTK_USE_X)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_CMAKE_Xlib_INCLUDE_PATH} ${VTK40_CMAKE_Xutil_INCLUDE_PATH})
- endif()
-endif()
-
-if(VTK_OPENGL_HAS_OSMESA)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_OSMESA_INCLUDE_PATH})
-endif()
-
-if(VTK_USE_MPI)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_MPI_INCLUDE_PATH})
-endif()
-
-if(VTK_WRAP_TCL)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_TCL_INCLUDE_PATH})
-endif()
-
-if(VTK_WRAP_PYTHON)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_PYTHON_INCLUDE_PATH})
-endif()
-
-if(VTK_WRAP_JAVA)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_JAVA_INCLUDE_PATH} ${VTK40_JAVA_INCLUDE_PATH2})
-endif()
-
-if(VTK_HAVE_VG500)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_VLI_INCLUDE_PATH_FOR_VG500})
-endif()
-
-if(VTK_HAVE_VP1000)
- set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS}
- ${VTK40_VLI_INCLUDE_PATH_FOR_VP1000})
-endif()
-
-# See if this is a build tree or install tree.
-if(EXISTS ${VTK_DIR}/Common)
- # This is a VTK 4.0 build tree.
-
- set(VTK_LIBRARY_DIRS ${VTK40_LIBRARY_OUTPUT_PATH})
-
- # Determine the include directories needed.
- set(VTK_INCLUDE_DIRS ${VTK40_VTK_BINARY_DIR})
- if(VTK_USE_PARALLEL)
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Parallel)
- endif()
- if(VTK_USE_HYBRID)
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Hybrid)
- endif()
- if(VTK_USE_PATENTED)
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Patented)
- endif()
- if(VTK_USE_RENDERING)
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Rendering)
- endif()
-
- # These directories are always needed.
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS}
- ${VTK40_VTK_SOURCE_DIR}/IO
- ${VTK40_VTK_SOURCE_DIR}/Imaging
- ${VTK40_VTK_SOURCE_DIR}/Graphics
- ${VTK40_VTK_SOURCE_DIR}/Filtering
- ${VTK40_VTK_SOURCE_DIR}/Common)
-
- # Give access to a few utilities.
- set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS}
- ${VTK40_VTK_BINARY_DIR}/Utilities/png
- ${VTK40_VTK_SOURCE_DIR}/Utilities/png
- ${VTK40_VTK_BINARY_DIR}/Utilities/zlib
- ${VTK40_VTK_SOURCE_DIR}/Utilities/zlib)
-
- # Executable locations.
- if(VTK_WRAP_TCL)
- set(VTK_TCL_EXE ${VTK40_EXECUTABLE_OUTPUT_PATH}/vtk)
- set(VTK_WRAP_TCL_EXE ${VTK40_VTK_WRAP_TCL_EXE})
- set(VTK_TCL_HOME ${VTK40_VTK_SOURCE_DIR}/Wrapping/Tcl)
- endif()
- if(VTK_WRAP_PYTHON)
- set(VTK_WRAP_PYTHON_EXE ${VTK40_VTK_WRAP_PYTHON_EXE})
- endif()
- if(VTK_WRAP_JAVA)
- set(VTK_PARSE_JAVA_EXE ${VTK40_VTK_PARSE_JAVA_EXE})
- set(VTK_WRAP_JAVA_EXE ${VTK40_VTK_WRAP_JAVA_EXE})
- endif()
-
-else()
- # This is a VTK 4.0 install tree.
-
- set(VTK_INCLUDE_DIRS ${VTK_DIR})
- set(VTK_LIBRARY_DIRS ${VTK40_CMAKE_INSTALL_PREFIX}/lib/vtk)
-
- # Executable locations.
- if(VTK_WRAP_TCL)
- set(VTK_TCL_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtk)
- set(VTK_WRAP_TCL_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapTcl)
- set(VTK_TCL_HOME ${VTK40_CMAKE_INSTALL_PREFIX}/lib/vtk/tcl)
- endif()
- if(VTK_WRAP_PYTHON)
- set(VTK_WRAP_PYTHON_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapPython)
- endif()
- if(VTK_WRAP_JAVA)
- set(VTK_PARSE_JAVA_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkParseJava)
- set(VTK_WRAP_JAVA_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapJava)
- endif()
-endif()
-
-# Add the system include directories last.
-set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK_INCLUDE_DIRS_SYS})
-
-# Find the required C and C++ compiler flags.
-if(CMAKE_COMPILER_IS_GNUCXX)
- if(WIN32)
- # The platform is gcc on cygwin.
- set(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mwin32")
- set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mwin32")
- endif()
-else()
- if(CMAKE_ANSI_CFLAGS)
- set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
- endif()
- if(CMAKE_SYSTEM MATCHES "OSF1-V")
- set(VTK_REQUIRED_CXX_FLAGS
- "${VTK_REQUIRED_CXX_FLAGS} -timplicit_local -no_implicit_include")
- endif()
-endif()
-
-if(VTK_USE_X)
- if(CMAKE_X_CFLAGS)
- set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_X_CFLAGS}")
- set(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} ${CMAKE_X_CFLAGS}")
- endif()
-endif()
-
-# Copy library dependencies.
-set(vtkCommonJava_LIB_DEPENDS "${VTK40_vtkCommonJava_LIB_DEPENDS}")
-set(vtkCommonPython_LIB_DEPENDS "${VTK40_vtkCommonPython_LIB_DEPENDS}")
-set(vtkCommonTCL_LIB_DEPENDS "${VTK40_vtkCommonTCL_LIB_DEPENDS}")
-set(vtkCommon_LIB_DEPENDS "${VTK40_vtkCommon_LIB_DEPENDS}")
-set(vtkFilteringJava_LIB_DEPENDS "${VTK40_vtkFilteringJava_LIB_DEPENDS}")
-set(vtkFilteringPython_LIB_DEPENDS "${VTK40_vtkFilteringPython_LIB_DEPENDS}")
-set(vtkFilteringTCL_LIB_DEPENDS "${VTK40_vtkFilteringTCL_LIB_DEPENDS}")
-set(vtkFiltering_LIB_DEPENDS "${VTK40_vtkFiltering_LIB_DEPENDS}")
-set(vtkGraphicsJava_LIB_DEPENDS "${VTK40_vtkGraphicsJava_LIB_DEPENDS}")
-set(vtkGraphicsPython_LIB_DEPENDS "${VTK40_vtkGraphicsPython_LIB_DEPENDS}")
-set(vtkGraphicsTCL_LIB_DEPENDS "${VTK40_vtkGraphicsTCL_LIB_DEPENDS}")
-set(vtkGraphics_LIB_DEPENDS "${VTK40_vtkGraphics_LIB_DEPENDS}")
-set(vtkHybridJava_LIB_DEPENDS "${VTK40_vtkHybridJava_LIB_DEPENDS}")
-set(vtkHybridPython_LIB_DEPENDS "${VTK40_vtkHybridPython_LIB_DEPENDS}")
-set(vtkHybridTCL_LIB_DEPENDS "${VTK40_vtkHybridTCL_LIB_DEPENDS}")
-set(vtkHybrid_LIB_DEPENDS "${VTK40_vtkHybrid_LIB_DEPENDS}")
-set(vtkIOJava_LIB_DEPENDS "${VTK40_vtkIOJava_LIB_DEPENDS}")
-set(vtkIOPython_LIB_DEPENDS "${VTK40_vtkIOPython_LIB_DEPENDS}")
-set(vtkIOTCL_LIB_DEPENDS "${VTK40_vtkIOTCL_LIB_DEPENDS}")
-set(vtkIO_LIB_DEPENDS "${VTK40_vtkIO_LIB_DEPENDS}")
-set(vtkImagingJava_LIB_DEPENDS "${VTK40_vtkImagingJava_LIB_DEPENDS}")
-set(vtkImagingPython_LIB_DEPENDS "${VTK40_vtkImagingPython_LIB_DEPENDS}")
-set(vtkImagingTCL_LIB_DEPENDS "${VTK40_vtkImagingTCL_LIB_DEPENDS}")
-set(vtkImaging_LIB_DEPENDS "${VTK40_vtkImaging_LIB_DEPENDS}")
-set(vtkParallelJava_LIB_DEPENDS "${VTK40_vtkParallelJava_LIB_DEPENDS}")
-set(vtkParallelPython_LIB_DEPENDS "${VTK40_vtkParallelPython_LIB_DEPENDS}")
-set(vtkParallelTCL_LIB_DEPENDS "${VTK40_vtkParallelTCL_LIB_DEPENDS}")
-set(vtkParallel_LIB_DEPENDS "${VTK40_vtkParallel_LIB_DEPENDS}")
-set(vtkPatentedJava_LIB_DEPENDS "${VTK40_vtkPatentedJava_LIB_DEPENDS}")
-set(vtkPatentedPython_LIB_DEPENDS "${VTK40_vtkPatentedPython_LIB_DEPENDS}")
-set(vtkPatentedTCL_LIB_DEPENDS "${VTK40_vtkPatentedTCL_LIB_DEPENDS}")
-set(vtkPatented_LIB_DEPENDS "${VTK40_vtkPatented_LIB_DEPENDS}")
-set(vtkRenderingJava_LIB_DEPENDS "${VTK40_vtkRenderingJava_LIB_DEPENDS}")
-set(vtkRenderingPythonTkWidgets_LIB_DEPENDS "${VTK40_vtkRenderingPythonTkWidgets_LIB_DEPENDS}")
-set(vtkRenderingPython_LIB_DEPENDS "${VTK40_vtkRenderingPython_LIB_DEPENDS}")
-set(vtkRenderingTCL_LIB_DEPENDS "${VTK40_vtkRenderingTCL_LIB_DEPENDS}")
-set(vtkRendering_LIB_DEPENDS "${VTK40_vtkRendering_LIB_DEPENDS}")
-set(vtkjpeg_LIB_DEPENDS "${VTK40_vtkjpeg_LIB_DEPENDS}")
-set(vtkpng_LIB_DEPENDS "${VTK40_vtkpng_LIB_DEPENDS}")
-set(vtkzlib_LIB_DEPENDS "${VTK40_vtkzlib_LIB_DEPENDS}")
-
-# List of VTK configuration variables set above.
-# grep "^[ ]*set(VTK" UseVTKConfig40.cmake |sed 's/[ ]*set(\([^ ]*\) .*/ \1/'
-set(VTK_SETTINGS
- VTK_BUILD_SHARED
- VTK_BUILD_VERSION
- VTK_DEBUG_LEAKS
- VTK_HAVE_VG500
- VTK_HAVE_VP1000
- VTK_INCLUDE_DIRS
- VTK_KITS
- VTK_LANGUAGES
- VTK_LIBRARY_DIRS
- VTK_MAJOR_VERSION
- VTK_MANGLE_MESA
- VTK_MINOR_VERSION
- VTK_MPIRUN_EXE
- VTK_MPI_POSTFLAGS
- VTK_MPI_PREFLAGS
- VTK_OPENGL_HAS_OSMESA
- VTK_PARSE_JAVA_EXE
- VTK_TCL_EXE
- VTK_TCL_HOME
- VTK_USE_64BIT_IDS
- VTK_USE_ANSI_STDLIB
- VTK_USE_HYBRID
- VTK_USE_MATROX_IMAGING
- VTK_USE_MPI
- VTK_USE_PARALLEL
- VTK_USE_PATENTED
- VTK_USE_RENDERING
- VTK_USE_VIDEO_FOR_WINDOWS
- VTK_USE_VOLUMEPRO
- VTK_USE_X
- VTK_WRAP_JAVA
- VTK_WRAP_JAVA_EXE
- VTK_WRAP_PYTHON
- VTK_WRAP_PYTHON_EXE
- VTK_WRAP_TCL
- VTK_WRAP_TCL_EXE
-)
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 428b364..e2a7ff2 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -502,6 +502,10 @@ if (WIN32)
cmGhsMultiGpj.cxx
cmGhsMultiGpj.h
)
+
+ # Add a manifest file to executables on Windows to allow for
+ # GetVersion to work properly on Windows 8 and above.
+ set(MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake.version.manifest)
endif()
endif ()
@@ -531,7 +535,7 @@ set(SRCS ${SRCS}
if(WIN32 AND NOT CYGWIN)
set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501)
- add_executable(cmcldeps cmcldeps.cxx)
+ add_executable(cmcldeps cmcldeps.cxx ${MANIFEST_FILE})
target_link_libraries(cmcldeps CMakeLib)
install(TARGETS cmcldeps DESTINATION bin)
endif()
@@ -556,9 +560,10 @@ if(APPLE)
target_link_libraries(CMakeLib "-framework CoreFoundation")
endif()
-if(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW)
- # We need the rpcrt4 library for at least the VS7-VC10 generators.
- target_link_libraries(CMakeLib rpcrt4)
+if(WIN32 AND NOT UNIX)
+ # We need the rpcrt4 library on Windows.
+ # We need the crypt32 library on Windows for crypto/cert APIs.
+ target_link_libraries(CMakeLib rpcrt4 crypt32)
endif()
#
@@ -719,15 +724,15 @@ if(APPLE)
endif()
# Build CMake executable
-add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h)
+add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h ${MANIFEST_FILE})
target_link_libraries(cmake CMakeLib)
# Build CTest executable
-add_executable(ctest ctest.cxx)
+add_executable(ctest ctest.cxx ${MANIFEST_FILE})
target_link_libraries(ctest CTestLib)
# Build CPack executable
-add_executable(cpack CPack/cpack.cxx)
+add_executable(cpack CPack/cpack.cxx ${MANIFEST_FILE})
target_link_libraries(cpack CPackLib)
# Curses GUI
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index f0a7cbd..b042c4a 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 3)
-set(CMake_VERSION_PATCH 20150819)
+set(CMake_VERSION_PATCH 20150925)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index 09e123c..43d34ee 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -191,7 +191,7 @@ int cmCPackIFWGenerator::PackageFiles()
}
}
// TODO: set correct name for multipackages
- if (this->packageFileNames.size() > 0)
+ if (!this->packageFileNames.empty())
{
ifwCmd += " " + packageFileNames[0];
}
diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx
index 1d7afbd..c271517 100644
--- a/Source/CPack/OSXScriptLauncher.cxx
+++ b/Source/CPack/OSXScriptLauncher.cxx
@@ -11,17 +11,18 @@
============================================================================*/
#include <cmsys/SystemTools.hxx>
#include <cmsys/Process.h>
-#include <cmsys/ios/iostream>
#include <cmsys/FStream.hxx>
+#include <iostream>
+
#include <CoreFoundation/CoreFoundation.h>
// For the PATH_MAX constant
#include <sys/syslimits.h>
#define DebugError(x) \
- ofs << x << cmsys_ios::endl; \
- cmsys_ios::cout << x << cmsys_ios::endl
+ ofs << x << std::endl; \
+ std::cout << x << std::endl
int main(int argc, char* argv[])
{
@@ -77,7 +78,7 @@ int main(int argc, char* argv[])
std::string scriptDirectory = cmsys::SystemTools::GetFilenamePath(
fullScriptPath);
- ofs << fullScriptPath.c_str() << cmsys_ios::endl;
+ ofs << fullScriptPath.c_str() << std::endl;
std::vector<const char*> args;
args.push_back(fullScriptPath.c_str());
int cc;
@@ -109,7 +110,7 @@ int main(int argc, char* argv[])
data[i] = ' ';
}
}
- cmsys_ios::cout.write(data, length);
+ std::cout.write(data, length);
}
cmsysProcess_WaitForExit(cp, 0);
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index b3eb7b2..6f25e50 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -217,7 +217,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
{
std::string defaultRef = "WixUI_InstallDir";
- if(this->Components.size())
+ if(!this->Components.empty())
{
defaultRef = "WixUI_FeatureTree";
}
@@ -1005,7 +1005,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
shortcut.workingDirectoryId = directoryId;
shortcuts.insert(cmWIXShortcuts::START_MENU, id, shortcut);
- if(desktopExecutables.size() &&
+ if(!desktopExecutables.empty() &&
std::find(desktopExecutables.begin(),
desktopExecutables.end(),
executableName)
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx
index aeec968..fc0d3d3 100644
--- a/Source/CPack/WiX/cmWIXAccessControlList.cxx
+++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx
@@ -71,7 +71,7 @@ void cmWIXAccessControlList::CreatePermissionElement(
this->SourceWriter.BeginElement("Permission");
this->SourceWriter.AddAttribute("User", user);
- if(domain.size())
+ if(!domain.empty())
{
this->SourceWriter.AddAttribute("Domain", domain);
}
diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx
index b5202e0..5a8dc63 100644
--- a/Source/CPack/WiX/cmWIXPatch.cxx
+++ b/Source/CPack/WiX/cmWIXPatch.cxx
@@ -79,7 +79,7 @@ bool cmWIXPatch::CheckForUnappliedFragments()
fragmentList += "'";
}
- if(fragmentList.size())
+ if(!fragmentList.empty())
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Some XML patch fragments did not have matching IDs: " <<
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx
index 219fca8..8d38e9b 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx
@@ -128,7 +128,7 @@ void cmWIXSourceWriter::AddAttribute(
void cmWIXSourceWriter::AddAttributeUnlessEmpty(
std::string const& key, std::string const& value)
{
- if(value.size())
+ if(!value.empty())
{
AddAttribute(key, value);
}
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 5049a3f..93c94e2 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -15,6 +15,7 @@
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
+#include "cmArchiveWrite.h"
#include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx>
@@ -94,6 +95,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel,
std::string findExpr(this->GetOption("GEN_WDIR"));
findExpr += "/*";
gl.RecurseOn();
+ gl.SetRecurseListDirs(true);
if ( !gl.FindFiles(findExpr) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -221,6 +223,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne()
std::string findExpr(this->GetOption("GEN_WDIR"));
findExpr += "/*";
gl.RecurseOn();
+ gl.SetRecurseListDirs(true);
if ( !gl.FindFiles(findExpr) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -388,9 +391,9 @@ int cmCPackDebGenerator::createDeb()
{
std::string dirName = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
dirName += '/';
- for (std::vector<std::string>::const_iterator fileIt =
- packageFiles.begin();
- fileIt != packageFiles.end(); ++ fileIt )
+ for (std::vector<std::string>::const_iterator fileIt =
+ packageFiles.begin();
+ fileIt != packageFiles.end(); ++ fileIt )
{
totalSize += cmSystemTools::FileLength(*fileIt);
}
@@ -401,8 +404,9 @@ int cmCPackDebGenerator::createDeb()
out << std::endl;
}
- std::string cmd(this->GetOption("GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE"));
+ const std::string strGenWDIR(this->GetOption("GEN_WDIR"));
+ cmArchiveWrite::Compress tar_compression_type = cmArchiveWrite::CompressGZip;
const char* debian_compression_type =
this->GetOption("GEN_CPACK_DEBIAN_COMPRESSION_TYPE");
if(!debian_compression_type)
@@ -410,108 +414,136 @@ int cmCPackDebGenerator::createDeb()
debian_compression_type = "gzip";
}
- std::string cmake_tar = " ", compression_modifier = "a", compression_suffix;
+ std::string compression_suffix;
if(!strcmp(debian_compression_type, "lzma")) {
compression_suffix = ".lzma";
+ tar_compression_type = cmArchiveWrite::CompressLZMA;
} else if(!strcmp(debian_compression_type, "xz")) {
compression_suffix = ".xz";
+ tar_compression_type = cmArchiveWrite::CompressXZ;
} else if(!strcmp(debian_compression_type, "bzip2")) {
compression_suffix = ".bz2";
- compression_modifier = "j";
- cmake_tar += "\"" + cmSystemTools::GetCMakeCommand() + "\" -E ";
+ tar_compression_type = cmArchiveWrite::CompressBZip2;
} else if(!strcmp(debian_compression_type, "gzip")) {
compression_suffix = ".gz";
- compression_modifier = "z";
- cmake_tar += "\"" + cmSystemTools::GetCMakeCommand() + "\" -E ";
+ tar_compression_type = cmArchiveWrite::CompressGZip;
} else if(!strcmp(debian_compression_type, "none")) {
compression_suffix = "";
- compression_modifier = "";
- cmake_tar += "\"" + cmSystemTools::GetCMakeCommand() + "\" -E ";
+ tar_compression_type = cmArchiveWrite::CompressNone;
} else {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error unrecognized compression type: "
<< debian_compression_type << std::endl);
}
- cmd += cmake_tar + "tar c" + compression_modifier + "f data.tar"
- + compression_suffix;
- // now add all directories which have to be compressed
- // collect all top level install dirs for that
- // e.g. /opt/bin/foo, /usr/bin/bar and /usr/bin/baz would give /usr and /opt
- size_t topLevelLength = std::string(this->GetOption("GEN_WDIR")).length();
- cmCPackLogger(cmCPackLog::LOG_DEBUG, "WDIR: \""
- << this->GetOption("GEN_WDIR")
- << "\", length = " << topLevelLength
+ std::string filename_data_tar = strGenWDIR
+ + "/data.tar" + compression_suffix;
+
+ // atomic file generation for data.tar
+ {
+ cmGeneratedFileStream fileStream_data_tar;
+ fileStream_data_tar.Open(filename_data_tar.c_str(), false, true);
+ if(!fileStream_data_tar)
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Error opening the file \"" << filename_data_tar << "\" for writing"
<< std::endl);
- std::set<std::string> installDirs;
+ return 0;
+ }
+ cmArchiveWrite data_tar(fileStream_data_tar, tar_compression_type, "paxr");
+
+ // uid/gid should be the one of the root user, and this root user has
+ // always uid/gid equal to 0.
+ data_tar.SetUIDAndGID(0u, 0u);
+ data_tar.SetUNAMEAndGNAME("root", "root");
+
+ // now add all directories which have to be compressed
+ // collect all top level install dirs for that
+ // e.g. /opt/bin/foo, /usr/bin/bar and /usr/bin/baz would
+ // give /usr and /opt
+ size_t topLevelLength = strGenWDIR.length();
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "WDIR: \""
+ << strGenWDIR
+ << "\", length = " << topLevelLength
+ << std::endl);
+ std::set<std::string> orderedFiles;
+
+ // we have to reconstruct the parent folders as well
+
for (std::vector<std::string>::const_iterator fileIt =
- packageFiles.begin();
- fileIt != packageFiles.end(); ++ fileIt )
- {
- cmCPackLogger(cmCPackLog::LOG_DEBUG, "FILEIT: \"" << *fileIt << "\""
- << std::endl);
- std::string::size_type slashPos = fileIt->find('/', topLevelLength+1);
- std::string relativeDir = fileIt->substr(topLevelLength,
- slashPos - topLevelLength);
- cmCPackLogger(cmCPackLog::LOG_DEBUG, "RELATIVEDIR: \"" << relativeDir
- << "\"" << std::endl);
- if (installDirs.find(relativeDir) == installDirs.end())
+ packageFiles.begin();
+ fileIt != packageFiles.end(); ++ fileIt )
{
- installDirs.insert(relativeDir);
- cmd += " .";
- cmd += relativeDir;
+ std::string currentPath = *fileIt;
+ while(currentPath != strGenWDIR)
+ {
+ // the last one IS strGenWDIR, but we do not want this one:
+ // XXX/application/usr/bin/myprogram with GEN_WDIR=XXX/application
+ // should not add XXX/application
+ orderedFiles.insert(currentPath);
+ currentPath = cmSystemTools::CollapseCombinedPath(currentPath, "..");
+ }
}
- }
- std::string output;
- int retval = -1;
- int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output,
- &retval, this->GetOption("GEN_WDIR"), this->GeneratorVerbose, 0);
- if ( !res || retval )
- {
- std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
- tmpFile += "/Deb.log";
- cmGeneratedFileStream ofs(tmpFile.c_str());
- ofs << "# Run command: " << cmd << std::endl
- << "# Working directory: " << toplevel << std::endl
- << "# Output:" << std::endl
- << output << std::endl;
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: "
- << cmd << std::endl
- << "Please check " << tmpFile << " for errors" << std::endl);
- return 0;
- }
+ for (std::set<std::string>::const_iterator fileIt =
+ orderedFiles.begin();
+ fileIt != orderedFiles.end(); ++ fileIt )
+ {
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "FILEIT: \"" << *fileIt << "\""
+ << std::endl);
+ std::string::size_type slashPos = fileIt->find('/', topLevelLength+1);
+ std::string relativeDir = fileIt->substr(topLevelLength,
+ slashPos - topLevelLength);
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "RELATIVEDIR: \"" << relativeDir
+ << "\"" << std::endl);
+
+ // do not recurse because the loop will do it
+ if(!data_tar.Add(*fileIt, topLevelLength, ".", false))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem adding file to tar:" << std::endl
+ << "#top level directory: "
+ << strGenWDIR << std::endl
+ << "#file: " << *fileIt << std::endl
+ << "#error:" << data_tar.GetError() << std::endl);
+ return 0;
+ }
+ }
+ } // scope for file generation
- std::string md5filename;
- md5filename = this->GetOption("GEN_WDIR");
- md5filename += "/md5sums";
- { // the scope is needed for cmGeneratedFileStream
+ std::string md5filename = strGenWDIR + "/md5sums";
+ {
+ // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(md5filename.c_str());
- std::vector<std::string>::const_iterator fileIt;
-// std::string topLevelWithTrailingSlash = toplevel;
+
std::string topLevelWithTrailingSlash =
this->GetOption("CPACK_TEMPORARY_DIRECTORY");
topLevelWithTrailingSlash += '/';
- for ( fileIt = packageFiles.begin();
- fileIt != packageFiles.end(); ++ fileIt )
+ for (std::vector<std::string>::const_iterator fileIt =
+ packageFiles.begin();
+ fileIt != packageFiles.end(); ++ fileIt )
{
- cmd = "\"";
- cmd += cmSystemTools::GetCMakeCommand();
- cmd += "\" -E md5sum \"";
- cmd += *fileIt;
- cmd += "\"";
- //std::string output;
- //int retVal = -1;
- res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output,
- &retval, toplevel.c_str(), this->GeneratorVerbose, 0);
- if ( !res || retval )
+ // hash only regular files
+ if( cmSystemTools::FileIsDirectory(*fileIt)
+ || cmSystemTools::FileIsSymlink(*fileIt))
+ {
+ continue;
+ }
+
+ char md5sum[33];
+ if(!cmSystemTools::ComputeFileMD5(*fileIt, md5sum))
{
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running cmake -E md5sum "
- << cmd << std::endl);
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem computing the md5 of "
+ << *fileIt << std::endl);
}
+
+ md5sum[32] = 0;
+
+ std::string output(md5sum);
+ output += " " + *fileIt + "\n";
// debian md5sums entries are like this:
// 014f3604694729f3bf19263bac599765 usr/bin/ccmake
// thus strip the full path (with the trailing slash)
@@ -521,70 +553,116 @@ int cmCPackDebGenerator::createDeb()
}
// each line contains a eol.
// Do not end the md5sum file with yet another (invalid)
- }
+ }
- // set md5sum file permissins to RW-R--R-- so that deb lintian doesn't warn
- // about it
- cmSystemTools::SetPermissions(md5filename.c_str(),
- S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
- cmd = this->GetOption("GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE");
- cmd += cmake_tar + "tar czf control.tar.gz ./control ./md5sums";
+
+ std::string filename_control_tar = strGenWDIR + "/control.tar.gz";
+ // atomic file generation for control.tar
+ {
+ cmGeneratedFileStream fileStream_control_tar;
+ fileStream_control_tar.Open(filename_control_tar.c_str(), false, true);
+ if(!fileStream_control_tar)
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Error opening the file \"" << filename_control_tar
+ << "\" for writing" << std::endl);
+ return 0;
+ }
+ cmArchiveWrite control_tar(fileStream_control_tar,
+ tar_compression_type,
+ "paxr");
+
+ // sets permissions and uid/gid for the files
+ control_tar.SetUIDAndGID(0u, 0u);
+ control_tar.SetUNAMEAndGNAME("root", "root");
+
+ /* permissions are set according to
+ https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners
+ and
+ https://lintian.debian.org/tags/control-file-has-bad-permissions.html
+ */
+ const mode_t permission644 = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
+ const mode_t permissionExecute = S_IXUSR | S_IXGRP | S_IXOTH;
+ const mode_t permission755 = permission644 | permissionExecute;
+
+ // for md5sum and control (that we have generated here), we use 644
+ // (RW-R--R--)
+ // so that deb lintian doesn't warn about it
+ control_tar.SetPermissions(permission644);
+
+ // adds control and md5sums
+ if( !control_tar.Add(md5filename, strGenWDIR.length(), ".")
+ || !control_tar.Add(strGenWDIR + "/control", strGenWDIR.length(), "."))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Error adding file to tar:" << std::endl
+ << "#top level directory: "
+ << strGenWDIR << std::endl
+ << "#file: \"control\" or \"md5sums\"" << std::endl
+ << "#error:" << control_tar.GetError() << std::endl);
+ return 0;
+ }
+
+ // for the other files, we use
+ // -either the original permission on the files
+ // -either a permission strictly defined by the Debian policies
const char* controlExtra =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA");
- if( controlExtra )
- {
- std::vector<std::string> controlExtraList;
- cmSystemTools::ExpandListArgument(controlExtra, controlExtraList);
- for(std::vector<std::string>::iterator i =
- controlExtraList.begin(); i != controlExtraList.end(); ++i)
+ if( controlExtra )
{
- std::string filenamename =
- cmsys::SystemTools::GetFilenameName(*i);
- std::string localcopy = this->GetOption("GEN_WDIR");
- localcopy += "/";
- localcopy += filenamename;
- // if we can copy the file, it means it does exist, let's add it:
- if( cmsys::SystemTools::CopyFileIfDifferent(
- *i, localcopy) )
+ // permissions are now controlled by the original file permissions
+
+ const bool permissionStrictPolicy =
+ this->IsSet("GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION");
+
+ static const char* strictFiles[] = {
+ "config", "postinst", "postrm", "preinst", "prerm"
+ };
+ std::set<std::string> setStrictFiles(
+ strictFiles,
+ strictFiles + sizeof(strictFiles)/sizeof(strictFiles[0]));
+
+ // default
+ control_tar.ClearPermissions();
+
+ std::vector<std::string> controlExtraList;
+ cmSystemTools::ExpandListArgument(controlExtra, controlExtraList);
+ for(std::vector<std::string>::iterator i = controlExtraList.begin();
+ i != controlExtraList.end(); ++i)
{
- // debian is picky and need relative to ./ path in the tar.*
- cmd += " ./";
- cmd += filenamename;
+ std::string filenamename =
+ cmsys::SystemTools::GetFilenameName(*i);
+ std::string localcopy = strGenWDIR + "/" + filenamename;
+
+ if(permissionStrictPolicy)
+ {
+ control_tar.SetPermissions(setStrictFiles.count(filenamename) ?
+ permission755 : permission644);
+ }
+
+ // if we can copy the file, it means it does exist, let's add it:
+ if( cmsys::SystemTools::CopyFileIfDifferent(*i, localcopy) )
+ {
+ control_tar.Add(localcopy, strGenWDIR.length(), ".");
+ }
}
}
- }
- res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output,
- &retval, this->GetOption("GEN_WDIR"), this->GeneratorVerbose, 0);
+ }
- if ( !res || retval )
- {
- std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
- tmpFile += "/Deb.log";
- cmGeneratedFileStream ofs(tmpFile.c_str());
- ofs << "# Run command: " << cmd << std::endl
- << "# Working directory: " << toplevel << std::endl
- << "# Output:" << std::endl
- << output << std::endl;
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: "
- << cmd << std::endl
- << "Please check " << tmpFile << " for errors" << std::endl);
- return 0;
- }
// ar -r your-package-name.deb debian-binary control.tar.* data.tar.*
// since debian packages require BSD ar (most Linux distros and even
// FreeBSD and NetBSD ship GNU ar) we use a copy of OpenBSD ar here.
std::vector<std::string> arFiles;
- std::string topLevelString = this->GetOption("GEN_WDIR");
- topLevelString += "/";
+ std::string topLevelString = strGenWDIR + "/";
arFiles.push_back(topLevelString + "debian-binary");
arFiles.push_back(topLevelString + "control.tar.gz");
arFiles.push_back(topLevelString + "data.tar" + compression_suffix);
- std::string outputFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
- outputFileName += "/";
- outputFileName += this->GetOption("CPACK_OUTPUT_FILE_NAME");
- res = ar_append(outputFileName.c_str(), arFiles);
+ std::string outputFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
+ outputFileName += "/";
+ outputFileName += this->GetOption("CPACK_OUTPUT_FILE_NAME");
+ int res = ar_append(outputFileName.c_str(), arFiles);
if ( res!=0 )
{
std::string tmpFile = this->GetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME");
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index bf4df60..04b1976 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -367,6 +367,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Install directory: " << top << std::endl);
gl.RecurseOn();
+ gl.SetRecurseListDirs(true);
if ( !gl.FindFiles(findExpr) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -716,8 +717,10 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm.AddCMakePaths();
cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
- cmMakefile *mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(
+ new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(
+ gg.CreateLocalGenerator(mf.get()));
std::string realInstallDirectory = tempInstallDirectory;
if ( !installSubDirectory.empty() && installSubDirectory != "/" )
{
@@ -867,6 +870,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cmsys::Glob glB;
findExpr += "/*";
glB.RecurseOn();
+ glB.SetRecurseListDirs(true);
glB.FindFiles(findExpr);
filesBefore = glB.GetFiles();
std::sort(filesBefore.begin(),filesBefore.end());
@@ -906,6 +910,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
{
cmsys::Glob glA;
glA.RecurseOn();
+ glA.SetRecurseListDirs(true);
glA.FindFiles(findExpr);
std::vector<std::string> filesAfter = glA.GetFiles();
std::sort(filesAfter.begin(),filesAfter.end());
@@ -1072,6 +1077,7 @@ int cmCPackGenerator::DoPackage()
std::string findExpr = tempDirectory;
findExpr += "/*";
gl.RecurseOn();
+ gl.SetRecurseListDirs(true);
gl.SetRecurseThroughSymlinks(false);
if ( !gl.FindFiles(findExpr) )
{
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 2de2bc4..6cdda28 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -49,7 +49,7 @@ int cmCPackNSISGenerator::PackageFiles()
// TODO: Fix nsis to force out file name
std::string nsisInFileName = this->FindTemplate("NSIS.template.in");
- if ( nsisInFileName.size() == 0 )
+ if (nsisInFileName.empty())
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPack error: Could not find NSIS installer template file."
@@ -58,7 +58,7 @@ int cmCPackNSISGenerator::PackageFiles()
}
std::string nsisInInstallOptions
= this->FindTemplate("NSIS.InstallOptions.ini.in");
- if ( nsisInInstallOptions.size() == 0 )
+ if (nsisInInstallOptions.empty())
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPack error: Could not find NSIS installer options file."
@@ -536,7 +536,7 @@ int cmCPackNSISGenerator::InitializeInternal()
<< ".lnk\"" << std::endl;
// see if CPACK_CREATE_DESKTOP_LINK_ExeName is on
// if so add a desktop link
- if(cpackPackageDesktopLinksVector.size() &&
+ if(!cpackPackageDesktopLinksVector.empty() &&
std::find(cpackPackageDesktopLinksVector.begin(),
cpackPackageDesktopLinksVector.end(),
execName)
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index e5da5cf..109dcb7 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -19,7 +19,6 @@
#include "cmMakefile.h"
#include "cmCPackLog.h"
-#include <cmsys/ios/sstream>
#include <cmsys/FStream.hxx>
#include <sys/types.h>
#include <sys/stat.h>
@@ -85,7 +84,7 @@ int cmCPackSTGZGenerator::PackageFiles()
int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
{
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Writing header" << std::endl);
- cmsys_ios::ostringstream str;
+ std::ostringstream str;
int counter = 0;
std::string inLicFile = this->GetOption("CPACK_RESOURCE_FILE_LICENSE");
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index c2fe763..cb9cbc4 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -202,8 +202,10 @@ int main (int argc, char const* const* argv)
cminst.SetHomeOutputDirectory("");
cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg(&cminst);
- cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.MakeLocalGenerator());
- cmMakefile* globalMF = cmlg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> globalMF(
+ new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> cmlg(
+ cmgg.CreateLocalGenerator(globalMF.get()));
#if defined(__CYGWIN__)
globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");
#endif
@@ -357,8 +359,8 @@ int main (int argc, char const* const* argv)
++it )
{
const char* gen = it->c_str();
- cmMakefile::ScopePushPop raii(globalMF);
- cmMakefile* mf = globalMF;
+ cmMakefile::ScopePushPop raii(globalMF.get());
+ cmMakefile* mf = globalMF.get();
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Specified generator: " << gen << std::endl);
if ( parsed && !mf->GetDefinition("CPACK_PACKAGE_NAME") )
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx
index 3014a93..587b583 100644
--- a/Source/CTest/cmCTestBZR.cxx
+++ b/Source/CTest/cmCTestBZR.cxx
@@ -14,7 +14,6 @@
#include "cmCTest.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
-#include "cmXMLSafe.h"
#include <cmsys/RegularExpression.hxx>
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 65599e0..20807c8 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -27,8 +27,6 @@
#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
#include <cmsys/Glob.hxx>
-#include <cmsys/stl/iterator>
-#include <cmsys/stl/algorithm>
#include <cmsys/FStream.hxx>
#include <stdlib.h>
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 6b84bab..bbb3b9d 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -14,10 +14,8 @@
#include "cmCTest.h"
#include "cmSystemTools.h"
#include "cmAlgorithms.h"
-#include "cmXMLSafe.h"
#include <cmsys/RegularExpression.hxx>
-#include <cmsys/ios/sstream>
#include <cmsys/Process.h>
#include <cmsys/FStream.hxx>
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 0f588c5..fb0cce6 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -738,8 +738,9 @@ void cmCTestLaunch::LoadConfig()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
- cmMakefile* mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(
+ gg.CreateLocalGenerator(mf.get()));
std::string fname = this->LogDir;
fname += "CTestLaunchConfig.cmake";
if(cmSystemTools::FileExists(fname.c_str()) &&
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 8f26716..acf527a 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -80,8 +80,8 @@ public:
int i = 0;
for(; atts[i] != 0; i+=2)
{
- ostr << " " << cmXMLSafe(atts[i])
- << " - " << cmXMLSafe(atts[i+1]) << "\n";
+ ostr << " " << atts[i]
+ << " - " << atts[i+1] << "\n";
}
ostr << "\n";
this->Log += ostr.str();
@@ -856,7 +856,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
defects++;
ostr << "<b>" << this->ResultStrings[idx] << "</b> ";
}
- ostr << cmXMLSafe(*i) << std::endl;
+ ostr << *i << std::endl;
}
log = ostr.str();
if(defects)
@@ -908,7 +908,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
results[failure] ++;
defects ++;
}
- ostr << cmXMLSafe(*i) << std::endl;
+ ostr << *i << std::endl;
}
log = ostr.str();
@@ -1056,7 +1056,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
defects ++;
}
totalOutputSize += lines[cc].size();
- ostr << cmXMLSafe(lines[cc]) << std::endl;
+ ostr << lines[cc] << std::endl;
}
else
{
@@ -1070,11 +1070,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
nonValGrindOutput.begin(); i != nonValGrindOutput.end(); ++i)
{
totalOutputSize += lines[*i].size();
- cmCTestOptionalLog(this->CTest, DEBUG, "before xml safe "
- << lines[*i] << std::endl, this->Quiet);
- cmCTestOptionalLog(this->CTest, DEBUG, "after xml safe "
- << cmXMLSafe(lines[*i]) << std::endl, this->Quiet);
- ostr << cmXMLSafe(lines[*i]) << std::endl;
+ ostr << lines[*i] << std::endl;
if(!unlimitedOutput && totalOutputSize >
static_cast<size_t>(this->CustomMaximumFailedTestOutputSize))
{
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 31002a6..5e0c54a 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -13,10 +13,8 @@
#include "cmCTest.h"
#include "cmSystemTools.h"
-#include "cmXMLSafe.h"
#include <cmsys/RegularExpression.hxx>
-#include <cmsys/ios/sstream>
#include <cmsys/Process.h>
#include <sys/types.h>
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 047bd98..c1ba279 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -125,42 +125,25 @@ void cmCTestScriptHandler::Initialize()
// what time in seconds did this script start running
this->ScriptStartTime = 0;
+ delete this->Makefile;
this->Makefile = 0;
- if (this->LocalGenerator)
- {
- delete this->LocalGenerator;
- }
+
+ delete this->LocalGenerator;
this->LocalGenerator = 0;
- if (this->GlobalGenerator)
- {
- delete this->GlobalGenerator;
- }
+
+ delete this->GlobalGenerator;
this->GlobalGenerator = 0;
- if (this->CMake)
- {
- delete this->CMake;
- }
+
+ delete this->CMake;
}
//----------------------------------------------------------------------
cmCTestScriptHandler::~cmCTestScriptHandler()
{
- // local generator owns the makefile
- this->Makefile = 0;
- if (this->LocalGenerator)
- {
- delete this->LocalGenerator;
- }
- this->LocalGenerator = 0;
- if (this->GlobalGenerator)
- {
- delete this->GlobalGenerator;
- }
- this->GlobalGenerator = 0;
- if (this->CMake)
- {
- delete this->CMake;
- }
+ delete this->Makefile;
+ delete this->LocalGenerator;
+ delete this->GlobalGenerator;
+ delete this->CMake;
}
@@ -334,6 +317,7 @@ void cmCTestScriptHandler::CreateCMake()
delete this->CMake;
delete this->GlobalGenerator;
delete this->LocalGenerator;
+ delete this->Makefile;
}
this->CMake = new cmake;
this->CMake->SetHomeDirectory("");
@@ -341,8 +325,10 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->AddCMakePaths();
this->GlobalGenerator = new cmGlobalGenerator(this->CMake);
- this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator();
- this->Makefile = this->LocalGenerator->GetMakefile();
+ cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot();
+ this->Makefile = new cmMakefile(this->GlobalGenerator, snapshot);
+ this->LocalGenerator =
+ this->GlobalGenerator->CreateLocalGenerator(this->Makefile);
this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index c8a0d27..f9678e7 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1592,8 +1592,9 @@ void cmCTestTestHandler::GetListOfTests()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
- cmMakefile *mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(
+ gg.CreateLocalGenerator(mf.get()));
mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
this->CTest->GetConfigType().c_str());
@@ -2091,7 +2092,7 @@ bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length)
}
current = next;
}
- else // Bad byte will be handled by cmXMLSafe.
+ else // Bad byte will be handled by cmXMLWriter.
{
++current;
}
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 14067d5..c635430 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -65,6 +65,11 @@ public:
void SetMaxIndex(int n) {this->MaxIndex = n;}
int GetMaxIndex() {return this->MaxIndex;}
+ void SetTestOutputSizePassed(int n)
+ { this->CustomMaximumPassedTestOutputSize = n; }
+ void SetTestOutputSizeFailed(int n)
+ { this->CustomMaximumFailedTestOutputSize = n; }
+
///! pass the -I argument down
void SetTestsToRunInformation(const char*);
diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx
index 31ad9fe..47e3b32 100644
--- a/Source/CTest/cmParseJacocoCoverage.cxx
+++ b/Source/CTest/cmParseJacocoCoverage.cxx
@@ -15,11 +15,9 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser
XMLParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont)
: CTest(ctest), Coverage(cont)
{
+ this->FilePath = "";
+ this->PackagePath = "";
this->PackageName = "";
- this->ModuleName = "";
- this->FileName = "";
- this->CurFileName = "";
- this->FilePaths.push_back(this->Coverage.SourceDir);
}
virtual ~XMLParser()
@@ -38,58 +36,46 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser
if(name == "package")
{
this->PackageName = atts[1];
- std::string FilePath = this->Coverage.SourceDir +
- "/" + this->ModuleName + "/src/main/java/" +
- this->PackageName;
- this->FilePaths.push_back(FilePath);
- FilePath = this->Coverage.SourceDir +
- "/src/main/java/" + this->PackageName;
- this->FilePaths.push_back(FilePath);
+ this->PackagePath = "";
}
else if(name == "sourcefile")
{
- this->FileName = atts[1];
- cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- "Reading file: " << this->FileName << std::endl,
- this->Coverage.Quiet);
- for(size_t i=0;i < FilePaths.size();i++)
- {
- std::string finalpath = FilePaths[i] + "/" + this->FileName;
- if(cmSystemTools::FileExists(finalpath.c_str()))
- {
- this->CurFileName = finalpath;
- break;
- }
- }
- cmsys::ifstream fin(this->CurFileName.c_str());
- if(this->CurFileName == "" || !fin )
+ std::string fileName = atts[1];
+
+ if (this->PackagePath == "")
{
- this->CurFileName = this->Coverage.BinaryDir + "/" +
- this->FileName;
- fin.open(this->CurFileName.c_str());
- if (!fin)
+ if(!this->FindPackagePath(fileName))
{
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Jacoco Coverage: Error opening " << this->CurFileName
- << std::endl);
- this->Coverage.Error++;
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find file: "
+ << this->PackageName << "/" << fileName << std::endl);
+ this->Coverage.Error++;
+ return;
}
}
- std::string line;
- FileLinesType& curFileLines =
- this->Coverage.TotalCoverage[this->CurFileName];
- if(fin)
- {
- curFileLines.push_back(-1);
- }
- while(cmSystemTools::GetLineFromStream(fin, line))
+
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Reading file: " << fileName << std::endl,
+ this->Coverage.Quiet);
+
+ this->FilePath = this->PackagePath + "/" + fileName;
+ cmsys::ifstream fin(this->FilePath.c_str());
+ if (!fin)
{
- curFileLines.push_back(-1);
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Jacoco Coverage: Error opening " << this->FilePath
+ << std::endl);
+ }
+ std::string line;
+ FileLinesType& curFileLines =
+ this->Coverage.TotalCoverage[this->FilePath];
+ if(fin)
+ {
+ curFileLines.push_back(-1);
+ }
+ while(cmSystemTools::GetLineFromStream(fin, line))
+ {
+ curFileLines.push_back(-1);
}
- }
- else if(name == "report")
- {
- this->ModuleName=atts[1];
}
else if(name == "line")
{
@@ -109,7 +95,7 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser
if (ci > -1 && nr > 0)
{
FileLinesType& curFileLines=
- this->Coverage.TotalCoverage[this->CurFileName];
+ this->Coverage.TotalCoverage[this->FilePath];
if(!curFileLines.empty())
{
curFileLines[nr-1] = ci;
@@ -121,12 +107,61 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser
}
}
+ virtual bool FindPackagePath(const std::string fileName)
+ {
+ // Search for the source file in the source directory.
+ if (this->PackagePathFound(fileName, this->Coverage.SourceDir))
+ {
+ return true;
+ }
+
+ // If not found there, check the binary directory.
+ if (this->PackagePathFound(fileName, this->Coverage.BinaryDir))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ virtual bool PackagePathFound(const std::string fileName,
+ const std::string baseDir)
+ {
+ // Search for the file in the baseDir and its subdirectories.
+ std::string packageGlob = baseDir;
+ packageGlob += "/";
+ packageGlob += fileName;
+ cmsys::Glob gl;
+ gl.RecurseOn();
+ gl.RecurseThroughSymlinksOn();
+ gl.FindFiles(packageGlob);
+ std::vector<std::string> const& files = gl.GetFiles();
+ if (files.size() == 0)
+ {
+ return false;
+ }
+
+ // Check if any of the locations found match our package.
+ for(std::vector<std::string>::const_iterator fi = files.begin();
+ fi != files.end(); ++fi)
+ {
+ std::string dir = cmsys::SystemTools::GetParentDirectory(*fi);
+ if (cmsys::SystemTools::StringEndsWith(dir, this->PackageName.c_str()))
+ {
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Found package directory for " << fileName <<
+ ": " << dir << std::endl,
+ this->Coverage.Quiet);
+ this->PackagePath = dir;
+ return true;
+ }
+ }
+ return false;
+ }
+
private:
+ std::string FilePath;
+ std::string PackagePath;
std::string PackageName;
- std::string FileName;
- std::string ModuleName;
- std::string CurFileName;
- std::vector<std::string> FilePaths;
typedef cmCTestCoverageHandlerContainer::SingleFileCoverageVector
FileLinesType;
cmCTest* CTest;
diff --git a/Source/Checks/cm_c11_thread_local.c b/Source/Checks/cm_c11_thread_local.c
new file mode 100644
index 0000000..ab780f2
--- /dev/null
+++ b/Source/Checks/cm_c11_thread_local.c
@@ -0,0 +1,2 @@
+_Thread_local int i = 42;
+int main(void) { return 0; }
diff --git a/Source/Checks/cm_c11_thread_local.cmake b/Source/Checks/cm_c11_thread_local.cmake
new file mode 100644
index 0000000..6b8d10b
--- /dev/null
+++ b/Source/Checks/cm_c11_thread_local.cmake
@@ -0,0 +1,33 @@
+set(CMake_C11_THREAD_LOCAL_BROKEN 0)
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_C11_STANDARD_COMPILE_OPTION)
+ if(NOT DEFINED CMake_C11_THREAD_LOCAL_WORKS)
+ message(STATUS "Checking if compiler supports C11 _Thread_local")
+ try_compile(CMake_C11_THREAD_LOCAL_WORKS
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_LIST_DIR}/cm_c11_thread_local.c
+ CMAKE_FLAGS -DCMAKE_C_STANDARD=11
+ OUTPUT_VARIABLE OUTPUT
+ )
+ if(CMake_C11_THREAD_LOCAL_WORKS AND "${OUTPUT}" MATCHES "error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'")
+ set_property(CACHE CMake_C11_THREAD_LOCAL_WORKS PROPERTY VALUE 0)
+ endif()
+ if(CMake_C11_THREAD_LOCAL_WORKS)
+ message(STATUS "Checking if compiler supports C11 _Thread_local - yes")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if compiler supports C11 _Thread_local passed with the following output:\n"
+ "${OUTPUT}\n"
+ "\n"
+ )
+ else()
+ message(STATUS "Checking if compiler supports C11 _Thread_local - no")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if compiler supports C11 _Thread_local failed with the following output:\n"
+ "${OUTPUT}\n"
+ "\n"
+ )
+ endif()
+ endif()
+ if(NOT CMake_C11_THREAD_LOCAL_WORKS)
+ set(CMake_C11_THREAD_LOCAL_BROKEN 1)
+ endif()
+endif()
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 67e4aab..6144ddc 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -80,12 +80,13 @@ void cmCursesLongMessageForm::UpdateStatusBar()
sprintf(version+sideSpace, "%s", vertmp);
version[width] = '\0';
+ char fmt_s[] = "%s";
curses_move(y-4,0);
attron(A_STANDOUT);
- printw(bar);
+ printw(fmt_s, bar);
attroff(A_STANDOUT);
curses_move(y-3,0);
- printw(version);
+ printw(fmt_s, version);
pos_form_cursor(this->Form);
}
@@ -101,8 +102,9 @@ void cmCursesLongMessageForm::PrintKeys()
char firstLine[512];
sprintf(firstLine, "Press [e] to exit help");
+ char fmt_s[] = "%s";
curses_move(y-2,0);
- printw(firstLine);
+ printw(fmt_s, firstLine);
pos_form_cursor(this->Form);
}
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index be17a9f..a2fc2c0 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -451,24 +451,25 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
}
curses_move(y-4,0);
+ char fmt_s[] = "%s";
char fmt[512] = "Press [enter] to edit option";
if ( process )
{
strcpy(fmt, " ");
}
- printw(fmt);
+ printw(fmt_s, fmt);
curses_move(y-3,0);
- printw(firstLine);
+ printw(fmt_s, firstLine);
curses_move(y-2,0);
- printw(secondLine);
+ printw(fmt_s, secondLine);
curses_move(y-1,0);
- printw(thirdLine);
+ printw(fmt_s, thirdLine);
if (cw)
{
sprintf(firstLine, "Page %d of %d", cw->GetPage(), this->NumberOfPages);
curses_move(0,65-static_cast<unsigned int>(strlen(firstLine))-1);
- printw(firstLine);
+ printw(fmt_s, firstLine);
}
// }
@@ -612,13 +613,13 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
version[width] = '\0';
// Now print both lines
+ char fmt_s[] = "%s";
curses_move(y-5,0);
attron(A_STANDOUT);
- char format[] = "%s";
- printw(format, bar);
+ printw(fmt_s, bar);
attroff(A_STANDOUT);
curses_move(y-4,0);
- printw(version);
+ printw(fmt_s, version);
pos_form_cursor(this->Form);
}
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index acf262f..6eb15c1 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -168,17 +168,16 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
else if ( key == 127 ||
key == KEY_BACKSPACE )
{
- if ( form->curcol > 0 )
- {
+ FIELD *cur = current_field(form);
form_driver(form, REQ_DEL_PREV);
- }
+ if (current_field(form) != cur)
+ {
+ set_current_field(form, cur);
+ }
}
else if ( key == ctrl('d') ||key == KEY_DC )
{
- if ( form->curcol >= 0 )
- {
- form_driver(form, REQ_DEL_CHAR);
- }
+ form_driver(form, REQ_DEL_CHAR);
}
else
{
@@ -221,6 +220,7 @@ bool cmCursesStringWidget::PrintKeys()
}
if (this->InEdit)
{
+ char fmt_s[] = "%s";
char firstLine[512];
// Clean the toolbar
for(int i=0; i<512; i++)
@@ -229,17 +229,16 @@ bool cmCursesStringWidget::PrintKeys()
}
firstLine[511] = '\0';
curses_move(y-4,0);
- printw(firstLine);
+ printw(fmt_s, firstLine);
curses_move(y-3,0);
- printw(firstLine);
+ printw(fmt_s, firstLine);
curses_move(y-2,0);
- printw(firstLine);
+ printw(fmt_s, firstLine);
curses_move(y-1,0);
- printw(firstLine);
+ printw(fmt_s, firstLine);
- sprintf(firstLine, "Editing option, press [enter] to leave edit.");
curses_move(y-3,0);
- printw(firstLine);
+ printw(fmt_s, "Editing option, press [enter] to leave edit.");
return true;
}
else
diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx
index e5363f4..a12e4c2 100644
--- a/Source/CursesDialog/cmCursesWidget.cxx
+++ b/Source/CursesDialog/cmCursesWidget.cxx
@@ -49,7 +49,7 @@ void cmCursesWidget::Move(int x, int y, bool isNewPage)
void cmCursesWidget::SetValue(const std::string& value)
{
this->Value = value;
- set_field_buffer(this->Field, 0, value.c_str());
+ set_field_buffer(this->Field, 0, const_cast<char *>(value.c_str()));
}
const char* cmCursesWidget::GetValue()
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index ad6a7fb..66fd18b 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -78,9 +78,12 @@ if (Qt5Widgets_FOUND)
endif()
endif()
- if(WIN32 AND TARGET Qt5::Core)
+ if(TARGET Qt5::Core)
get_property(_Qt5_Core_LOCATION TARGET Qt5::Core PROPERTY LOCATION)
get_filename_component(Qt_BIN_DIR "${_Qt5_Core_LOCATION}" PATH)
+ if(APPLE)
+ get_filename_component(Qt_BIN_DIR "${Qt_BIN_DIR}" PATH)
+ endif()
endif()
else()
set(QT_MIN_VERSION "4.4.0")
@@ -94,12 +97,6 @@ else()
set(CMake_QT_LIBRARIES ${QT_LIBRARIES})
- if(WIN32 AND EXISTS "${QT_QMAKE_EXECUTABLE}")
- get_filename_component(_Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH)
- if(EXISTS "${_Qt_BIN_DIR}/QtCore4.dll")
- set(Qt_BIN_DIR ${_Qt_BIN_DIR})
- endif()
- endif()
endif()
set(SRCS
@@ -155,11 +152,8 @@ endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS})
+add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${MANIFEST_FILE})
target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${CMake_QT_LIBRARIES})
-if(Qt_BIN_DIR)
- set_property(TARGET cmake-gui PROPERTY Qt_BIN_DIR ${Qt_BIN_DIR})
-endif()
if(APPLE)
file(STRINGS "${CMake_SOURCE_DIR}/Copyright.txt" copyright_line
@@ -223,7 +217,7 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
install(CODE "
include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\")
set(BU_CHMOD_BUNDLE_ITEMS ON)
- fixup_bundle(\"${fixup_exe}\" \"${QT_PLUGINS}\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\")
+ fixup_bundle(\"${fixup_exe}\" \"${QT_PLUGINS}\" \"${Qt_BIN_DIR};${QT_LIBRARY_DIR};${QT_BINARY_DIR}\")
" ${COMPONENT})
endif()
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 11e3f34..dc4db63 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -173,7 +173,7 @@ public:
*/
DumpSymbols(ObjectHeaderType* ih,
- FILE* fout) {
+ FILE* fout, bool is64) {
this->ObjectImageHeader = ih;
this->SymbolTable = (SymbolTableType*)
((DWORD_PTR)this->ObjectImageHeader
@@ -183,6 +183,7 @@ public:
GetSectionHeaderOffset(this->ObjectImageHeader);
this->ImportFlag = true;
this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols;
+ this->Is64Bit = is64;
}
/*
@@ -287,7 +288,14 @@ public:
symbol.erase(posAt);
}
}
- if (symbol[0] == '_') symbol.erase(0,1);
+ // For 64 bit builds we don't need to remove _
+ if(!this->Is64Bit)
+ {
+ if (symbol[0] == '_')
+ {
+ symbol.erase(0,1);
+ }
+ }
if (this->ImportFlag) {
this->ImportFlag = false;
fprintf(this->FileOut,"EXPORTS \n");
@@ -355,6 +363,7 @@ private:
PIMAGE_SECTION_HEADER SectionHeaders;
ObjectHeaderType* ObjectImageHeader;
SymbolTableType* SymbolTable;
+ bool Is64Bit;
};
bool
@@ -406,7 +415,8 @@ DumpFile(const char* filename, FILE *fout)
* and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0;
*/
DumpSymbols<IMAGE_FILE_HEADER, IMAGE_SYMBOL>
- symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, fout);
+ symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, fout,
+ (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64));
symbolDumper.DumpObjFile();
} else {
// check for /bigobj format
@@ -414,7 +424,8 @@ DumpFile(const char* filename, FILE *fout)
(cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase;
if(h->Sig1 == 0x0 && h->Sig2 == 0xffff) {
DumpSymbols<cmANON_OBJECT_HEADER_BIGOBJ, cmIMAGE_SYMBOL_EX>
- symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, fout);
+ symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, fout,
+ (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64));
symbolDumper.DumpObjFile();
} else {
printf("unrecognized file format in '%s'\n", filename);
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 44d0d4e..7946950 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -13,7 +13,6 @@
#include "cmSystemTools.h"
#include "cmLocale.h"
-#include <cmsys/ios/iostream>
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
#include <cm_libarchive.h>
@@ -67,7 +66,7 @@ struct cmArchiveWrite::Callback
{
cmArchiveWrite* self = static_cast<cmArchiveWrite*>(cd);
if(self->Stream.write(static_cast<const char*>(b),
- static_cast<cmsys_ios::streamsize>(n)))
+ static_cast<std::streamsize>(n)))
{
return static_cast<__LA_SSIZE_T>(n);
}
@@ -90,49 +89,49 @@ cmArchiveWrite::cmArchiveWrite(
switch (c)
{
case CompressNone:
- if(archive_write_set_compression_none(this->Archive) != ARCHIVE_OK)
+ if(archive_write_add_filter_none(this->Archive) != ARCHIVE_OK)
{
- this->Error = "archive_write_set_compression_none: ";
+ this->Error = "archive_write_add_filter_none: ";
this->Error += cm_archive_error_string(this->Archive);
return;
}
break;
case CompressCompress:
- if(archive_write_set_compression_compress(this->Archive) != ARCHIVE_OK)
+ if(archive_write_add_filter_compress(this->Archive) != ARCHIVE_OK)
{
- this->Error = "archive_write_set_compression_compress: ";
+ this->Error = "archive_write_add_filter_compress: ";
this->Error += cm_archive_error_string(this->Archive);
return;
}
break;
case CompressGZip:
- if(archive_write_set_compression_gzip(this->Archive) != ARCHIVE_OK)
+ if(archive_write_add_filter_gzip(this->Archive) != ARCHIVE_OK)
{
- this->Error = "archive_write_set_compression_gzip: ";
+ this->Error = "archive_write_add_filter_gzip: ";
this->Error += cm_archive_error_string(this->Archive);
return;
}
break;
case CompressBZip2:
- if(archive_write_set_compression_bzip2(this->Archive) != ARCHIVE_OK)
+ if(archive_write_add_filter_bzip2(this->Archive) != ARCHIVE_OK)
{
- this->Error = "archive_write_set_compression_bzip2: ";
+ this->Error = "archive_write_add_filter_bzip2: ";
this->Error += cm_archive_error_string(this->Archive);
return;
}
break;
case CompressLZMA:
- if(archive_write_set_compression_lzma(this->Archive) != ARCHIVE_OK)
+ if(archive_write_add_filter_lzma(this->Archive) != ARCHIVE_OK)
{
- this->Error = "archive_write_set_compression_lzma: ";
+ this->Error = "archive_write_add_filter_lzma: ";
this->Error += cm_archive_error_string(this->Archive);
return;
}
break;
case CompressXZ:
- if(archive_write_set_compression_xz(this->Archive) != ARCHIVE_OK)
+ if(archive_write_add_filter_xz(this->Archive) != ARCHIVE_OK)
{
- this->Error = "archive_write_set_compression_xz: ";
+ this->Error = "archive_write_add_filter_xz: ";
this->Error += cm_archive_error_string(this->Archive);
return;
}
@@ -177,12 +176,15 @@ cmArchiveWrite::cmArchiveWrite(
//----------------------------------------------------------------------------
cmArchiveWrite::~cmArchiveWrite()
{
- archive_read_finish(this->Disk);
- archive_write_finish(this->Archive);
+ archive_read_free(this->Disk);
+ archive_write_free(this->Archive);
}
//----------------------------------------------------------------------------
-bool cmArchiveWrite::Add(std::string path, size_t skip, const char* prefix)
+bool cmArchiveWrite::Add(std::string path,
+ size_t skip,
+ const char* prefix,
+ bool recursive)
{
if(this->Okay())
{
@@ -190,20 +192,21 @@ bool cmArchiveWrite::Add(std::string path, size_t skip, const char* prefix)
{
path.erase(path.size()-1);
}
- this->AddPath(path.c_str(), skip, prefix);
+ this->AddPath(path.c_str(), skip, prefix, recursive);
}
return this->Okay();
}
//----------------------------------------------------------------------------
bool cmArchiveWrite::AddPath(const char* path,
- size_t skip, const char* prefix)
+ size_t skip, const char* prefix,
+ bool recursive)
{
if(!this->AddFile(path, skip, prefix))
{
return false;
}
- if(!cmSystemTools::FileIsDirectory(path) ||
+ if((!cmSystemTools::FileIsDirectory(path) || !recursive) ||
cmSystemTools::FileIsSymlink(path))
{
return true;
@@ -279,6 +282,33 @@ bool cmArchiveWrite::AddFile(const char* file,
}
archive_entry_set_mtime(e, t, 0);
}
+
+ // manages the uid/guid of the entry (if any)
+ if (this->Uid.IsSet() && this->Gid.IsSet())
+ {
+ archive_entry_set_uid(e, this->Uid.Get());
+ archive_entry_set_gid(e, this->Gid.Get());
+ }
+
+ if (this->Uname.size() && this->Gname.size())
+ {
+ archive_entry_set_uname(e, this->Uname.c_str());
+ archive_entry_set_gname(e, this->Gname.c_str());
+ }
+
+
+ // manages the permissions
+ if (this->Permissions.IsSet())
+ {
+ archive_entry_set_perm(e, this->Permissions.Get());
+ }
+
+ if (this->PermissionsMask.IsSet())
+ {
+ mode_t perm = archive_entry_perm(e);
+ archive_entry_set_perm(e, perm & this->PermissionsMask.Get());
+ }
+
// Clear acl and xattr fields not useful for distribution.
archive_entry_acl_clear(e);
archive_entry_xattr_clear(e);
@@ -313,7 +343,7 @@ bool cmArchiveWrite::AddFile(const char* file,
//----------------------------------------------------------------------------
bool cmArchiveWrite::AddData(const char* file, size_t size)
{
- cmsys::ifstream fin(file, std::ios::in | cmsys_ios_binary);
+ cmsys::ifstream fin(file, std::ios::in | std::ios::binary);
if(!fin)
{
this->Error = "Error opening \"";
@@ -327,7 +357,7 @@ bool cmArchiveWrite::AddData(const char* file, size_t size)
size_t nleft = size;
while(nleft > 0)
{
- typedef cmsys_ios::streamsize ssize_type;
+ typedef std::streamsize ssize_type;
size_t const nnext = nleft > sizeof(buffer)? sizeof(buffer) : nleft;
ssize_type const nnext_s = static_cast<ssize_type>(nnext);
fin.read(buffer, nnext_s);
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index e6f515d..8dbbb83 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -18,6 +18,22 @@
# error "cmArchiveWrite not allowed during bootstrap build!"
#endif
+template<typename T>
+class cmArchiveWriteOptional
+{
+public:
+ cmArchiveWriteOptional() {this->Clear();}
+ explicit cmArchiveWriteOptional(T val) {this->Set(val);}
+
+ void Set(T val) {this->IsValueSet = true; this->Value=val;}
+ void Clear() {this->IsValueSet = false;}
+ bool IsSet() const {return this->IsValueSet;}
+ T Get() const {return Value;}
+private:
+ T Value;
+ bool IsValueSet;
+};
+
/** \class cmArchiveWrite
* \brief Wrapper around libarchive for writing.
*
@@ -52,7 +68,10 @@ public:
* skip. The remaining part of the input path is appended to the
* "prefix" value to construct the final name in the archive.
*/
- bool Add(std::string path, size_t skip = 0, const char* prefix = 0);
+ bool Add(std::string path,
+ size_t skip = 0,
+ const char* prefix = 0,
+ bool recursive = true);
/** Returns true if there has been no error. */
operator safe_bool() const
@@ -69,9 +88,65 @@ public:
void SetVerbose(bool v) { this->Verbose = v; }
void SetMTime(std::string const& t) { this->MTime = t; }
+
+ //! Sets the permissions of the added files/folders
+ void SetPermissions(mode_t permissions_)
+ {
+ this->Permissions.Set(permissions_);
+ }
+
+ //! Clears permissions - default is used instead
+ void ClearPermissions() { this->Permissions.Clear(); }
+
+ //! Sets the permissions mask of files/folders
+ //!
+ //! The permissions will be copied from the existing file
+ //! or folder. The mask will then be applied to unset
+ //! some of them
+ void SetPermissionsMask(mode_t permissionsMask_)
+ {
+ this->PermissionsMask.Set(permissionsMask_);
+ }
+
+ //! Clears permissions mask - default is used instead
+ void ClearPermissionsMask()
+ {
+ this->PermissionsMask.Clear();
+ }
+
+ //! Sets UID and GID to be used in the tar file
+ void SetUIDAndGID(int uid_, int gid_)
+ {
+ this->Uid.Set(uid_);
+ this->Gid.Set(gid_);
+ }
+
+ //! Clears UID and GID to be used in the tar file - default is used instead
+ void ClearUIDAndGID()
+ {
+ this->Uid.Clear();
+ this->Gid.Clear();
+ }
+
+ //! Sets UNAME and GNAME to be used in the tar file
+ void SetUNAMEAndGNAME(const std::string& uname_, const std::string& gname_)
+ {
+ this->Uname = uname_;
+ this->Gname = gname_;
+ }
+
+ //! Clears UNAME and GNAME to be used in the tar file
+ //! default is used instead
+ void ClearUNAMEAndGNAME()
+ {
+ this->Uname = "";
+ this->Gname = "";
+ }
+
private:
bool Okay() const { return this->Error.empty(); }
- bool AddPath(const char* path, size_t skip, const char* prefix);
+ bool AddPath(const char* path, size_t skip, const char* prefix,
+ bool recursive = true);
bool AddFile(const char* file, size_t skip, const char* prefix);
bool AddData(const char* file, size_t size);
@@ -87,6 +162,22 @@ private:
std::string Format;
std::string Error;
std::string MTime;
+
+ //! UID of the user in the tar file
+ cmArchiveWriteOptional<int> Uid;
+
+ //! GUID of the user in the tar file
+ cmArchiveWriteOptional<int> Gid;
+
+ //! UNAME/GNAME of the user (does not override UID/GID)
+ //!@{
+ std::string Uname;
+ std::string Gname;
+ //!@}
+
+ //! Permissions on files/folders
+ cmArchiveWriteOptional<mode_t> Permissions;
+ cmArchiveWriteOptional<mode_t> PermissionsMask;
};
#endif
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 5234538..6ff7c0d 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -11,8 +11,6 @@
============================================================================*/
#include "cmCMakeHostSystemInformationCommand.h"
-#include <cmsys/ios/sstream>
-
// cmCMakeHostSystemInformation
bool cmCMakeHostSystemInformationCommand
::InitialPass(std::vector<std::string> const &args, cmExecutionStatus &)
@@ -107,7 +105,7 @@ bool cmCMakeHostSystemInformationCommand
std::string cmCMakeHostSystemInformationCommand
::ValueToString(size_t value) const
{
- cmsys_ios::stringstream tmp;
+ std::stringstream tmp;
tmp << value;
return tmp.str();
}
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 591a2cd..7da334e 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -115,7 +115,9 @@ void CCONV cmAddCacheDefinition(void *arg, const char* name,
const char* CCONV cmGetProjectName(void *arg)
{
cmMakefile *mf = static_cast<cmMakefile *>(arg);
- return mf->GetProjectName();
+ static std::string name;
+ name = mf->GetProjectName();
+ return name.c_str();
}
const char* CCONV cmGetHomeDirectory(void *arg)
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index b976469..6e55d89 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -22,7 +22,6 @@
#include <cmsys/FStream.hxx>
#include "cmDynamicLoader.h"
#include "cmGeneratedFileStream.h"
-#include "cmXMLSafe.h"
#include "cmVersionMacros.h"
#include "cmCTestCommand.h"
#include "cmCTestStartCommand.h"
@@ -156,7 +155,7 @@ std::string cmCTest::CurrentTime()
strftime(current_time, 1000, "%a %b %d %H:%M:%S %Z %Y", t);
}
cmCTestLog(this, DEBUG, " Current_Time: " << current_time << std::endl);
- return cmXMLSafe(cmCTest::CleanString(current_time)).str();
+ return cmCTest::CleanString(current_time);
}
//----------------------------------------------------------------------
@@ -520,9 +519,10 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
- cmMakefile *mf = lg->GetMakefile();
- if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) )
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
+ if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(),
+ mf.get()) )
{
cmCTestOptionalLog(this, DEBUG,
"Cannot find custom configuration file tree" << std::endl, quiet);
@@ -1497,8 +1497,6 @@ std::string cmCTest::SafeBuildIdField(const std::string& value)
cmSystemTools::ReplaceString(safevalue, replace, "");
}
}
-
- safevalue = cmXMLSafe(safevalue).str();
}
if (safevalue == "")
@@ -2167,7 +2165,46 @@ bool cmCTest::HandleCommandLineArguments(size_t &i,
{
this->OutputTestOutputOnTestFailure = true;
}
-
+ if (this->CheckArgument(arg, "--test-output-size-passed") &&
+ i < args.size() - 1)
+ {
+ i++;
+ long outputSize;
+ if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize))
+ {
+ if (cmCTestTestHandler *pCTestTestHandler =
+ static_cast<cmCTestTestHandler*>(this->TestingHandlers["test"]))
+ {
+ pCTestTestHandler->SetTestOutputSizePassed(int(outputSize));
+ }
+ }
+ else
+ {
+ cmCTestLog(this, WARNING,
+ "Invalid value for '--test-output-size-passed': " <<
+ args[i] << "\n");
+ }
+ }
+ if (this->CheckArgument(arg, "--test-output-size-failed") &&
+ i < args.size() - 1)
+ {
+ i++;
+ long outputSize;
+ if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize))
+ {
+ if (cmCTestTestHandler *pCTestTestHandler =
+ static_cast<cmCTestTestHandler*>(this->TestingHandlers["test"]))
+ {
+ pCTestTestHandler->SetTestOutputSizeFailed(int(outputSize));
+ }
+ }
+ else
+ {
+ cmCTestLog(this, WARNING,
+ "Invalid value for '--test-output-size-failed': " <<
+ args[i] << "\n");
+ }
+ }
if(this->CheckArgument(arg, "-N", "--show-only"))
{
this->ShowOnly = true;
diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx
index c211111..0e04838 100644
--- a/Source/cmCallVisualStudioMacro.cxx
+++ b/Source/cmCallVisualStudioMacro.cxx
@@ -498,7 +498,7 @@ int cmCallVisualStudioMacro::CallMacro(
}
}
- if(0 == instances.size())
+ if(instances.empty())
{
// no instances to call
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 4840e89..252e231 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -412,3 +412,20 @@ cmCommonTargetGenerator::GetLinkedTargetDirectories() const
}
return dirs;
}
+
+std::string cmCommonTargetGenerator::GetManifests()
+{
+ std::vector<cmSourceFile const*> manifest_srcs;
+ this->GeneratorTarget->GetManifests(manifest_srcs, this->ConfigName);
+
+ std::vector<std::string> manifests;
+ for (std::vector<cmSourceFile const*>::iterator mi = manifest_srcs.begin();
+ mi != manifest_srcs.end(); ++mi)
+ {
+ manifests.push_back(this->Convert((*mi)->GetFullPath(),
+ this->WorkingDirectory,
+ cmOutputConverter::SHELL));
+ }
+
+ return cmJoin(manifests, " ");
+}
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 0a49e12..a4b2c10 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -88,6 +88,7 @@ protected:
ByLanguageMap DefinesByLanguage;
std::string GetIncludes(std::string const& l);
ByLanguageMap IncludesByLanguage;
+ std::string GetManifests();
std::vector<std::string> GetLinkedTargetDirectories() const;
};
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 8ba8847..1b5c9f4 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -12,14 +12,13 @@
#include "cmComputeLinkDepends.h"
#include "cmComputeComponentGraph.h"
+#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmTarget.h"
#include "cmake.h"
#include "cmAlgorithms.h"
-#include <cmsys/stl/algorithm>
-
#include <assert.h>
/*
@@ -179,7 +178,8 @@ cmComputeLinkDepends
// Store context information.
this->Target = target;
this->Makefile = this->Target->Target->GetMakefile();
- this->GlobalGenerator = this->Makefile->GetGlobalGenerator();
+ this->GlobalGenerator =
+ this->Target->GetLocalGenerator()->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
// The configuration being linked.
@@ -362,9 +362,11 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
// Follow the item's dependencies.
if(entry.Target)
{
+ cmGeneratorTarget* gtgt =
+ this->GlobalGenerator->GetGeneratorTarget(entry.Target);
// Follow the target dependencies.
- if(cmTarget::LinkInterface const* iface =
- entry.Target->GetLinkInterface(this->Config, this->Target->Target))
+ if(cmLinkInterface const* iface =
+ gtgt->GetLinkInterface(this->Config, this->Target->Target))
{
const bool isIface =
entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY;
@@ -398,7 +400,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
//----------------------------------------------------------------------------
void
cmComputeLinkDepends
-::FollowSharedDeps(int depender_index, cmTarget::LinkInterface const* iface,
+::FollowSharedDeps(int depender_index, cmLinkInterface const* iface,
bool follow_interface)
{
// Follow dependencies if we have not followed them already.
@@ -461,8 +463,10 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
// Target items may have their own dependencies.
if(entry.Target)
{
- if(cmTarget::LinkInterface const* iface =
- entry.Target->GetLinkInterface(this->Config, this->Target->Target))
+ cmGeneratorTarget* gtgt =
+ this->GlobalGenerator->GetGeneratorTarget(entry.Target);
+ if(cmLinkInterface const* iface =
+ gtgt->GetLinkInterface(this->Config, this->Target->Target))
{
// Follow public and private dependencies transitively.
this->FollowSharedDeps(index, iface, true);
@@ -552,8 +556,8 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index,
void cmComputeLinkDepends::AddDirectLinkEntries()
{
// Add direct link dependencies in this configuration.
- cmTarget::LinkImplementation const* impl =
- this->Target->Target->GetLinkImplementation(this->Config);
+ cmLinkImplementation const* impl =
+ this->Target->GetLinkImplementation(this->Config);
this->AddLinkEntries(-1, impl->Libraries);
for(std::vector<cmLinkItem>::const_iterator
wi = impl->WrongConfigLibraries.begin();
@@ -932,8 +936,10 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
{
if(cmTarget const* target = this->EntryList[*ni].Target)
{
- if(cmTarget::LinkInterface const* iface =
- target->GetLinkInterface(this->Config, this->Target->Target))
+ cmGeneratorTarget* gtgt =
+ this->GlobalGenerator->GetGeneratorTarget(target);
+ if(cmLinkInterface const* iface =
+ gtgt->GetLinkInterface(this->Config, this->Target->Target))
{
if(iface->Multiplicity > count)
{
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index b925a4f..2cbb430 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -102,7 +102,7 @@ private:
std::queue<SharedDepEntry> SharedDepQueue;
std::set<int> SharedDepFollowed;
void FollowSharedDeps(int depender_index,
- cmTarget::LinkInterface const* iface,
+ cmLinkInterface const* iface,
bool follow_interface = false);
void QueueSharedDependencies(int depender_index,
std::vector<cmLinkItem> const& deps);
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 6ba0eed..d35b566 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -522,10 +522,9 @@ bool cmComputeLinkInformation::Compute()
// libraries are found.
const char* lss =
this->Target->Target->GetProperty("LINK_SEARCH_END_STATIC");
- if(lss)
+ if(cmSystemTools::IsOn(lss))
{
- this->SetCurrentLinkType(
- cmSystemTools::IsOn(lss) ? LinkStatic : LinkShared);
+ this->SetCurrentLinkType(LinkStatic);
}
else
{
@@ -769,7 +768,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
std::string lib;
if(tgt)
{
- gtgt = tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt);
+ gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary);
this->AddLibraryRuntimeInfo(lib, tgt);
@@ -863,8 +862,7 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
const char* lss =
this->Target->Target->GetProperty("LINK_SEARCH_START_STATIC");
this->StartLinkType = cmSystemTools::IsOn(lss)? LinkStatic : LinkShared;
- this->CurrentLinkType = LinkUnknown;
- this->SetCurrentLinkType(this->StartLinkType);
+ this->CurrentLinkType = this->StartLinkType;
}
//----------------------------------------------------------------------------
@@ -1925,7 +1923,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
(outputRuntime && this->Target->Target->HaveInstallTreeRPATH() &&
linking_for_install);
bool use_build_rpath =
- (outputRuntime && this->Target->Target->HaveBuildTreeRPATH(this->Config) &&
+ (outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) &&
!linking_for_install);
bool use_link_rpath =
outputRuntime && linking_for_install &&
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index c4a03a0..9e37c35 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -252,8 +252,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
}
}
- cmTarget::LinkImplementation const* impl =
- depender->Target->GetLinkImplementation(*it);
+ cmLinkImplementation const* impl = depender->GetLinkImplementation(*it);
// A target should not depend on itself.
emitted.insert(depender->GetName());
@@ -296,8 +295,8 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
std::set<std::string> &emitted)
{
cmGeneratorTarget const* depender = this->Targets[depender_index];
- if(cmTarget::LinkInterface const* iface =
- dependee->Target->GetLinkInterface(config,
+ if(cmLinkInterface const* iface =
+ dependee->GetLinkInterface(config,
depender->Target))
{
for(std::vector<cmLinkItem>::const_iterator
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 9411555..3d9c4bf 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -29,7 +29,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
const char* sourceDirectory = argv[2].c_str();
const char* projectName = 0;
std::string targetName;
- std::vector<std::string> cmakeFlags;
+ std::vector<std::string> cmakeFlags(1, "CMAKE_FLAGS"); // fake argv[0]
std::vector<std::string> compileDefs;
std::string outputVariable;
std::string copyFile;
@@ -53,10 +53,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if(argv[i] == "CMAKE_FLAGS")
{
doing = DoingCMakeFlags;
- // CMAKE_FLAGS is the first argument because we need an argv[0] that
- // is not used, so it matches regular command line parsing which has
- // the program name as arg 0
- cmakeFlags.push_back(argv[i]);
}
else if(argv[i] == "COMPILE_DEFINITIONS")
{
@@ -481,6 +477,16 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
fprintf(fout, "set(CMAKE_LINK_SEARCH_END_STATIC \"%s\")\n", lssDef);
}
+ /* Set the appropriate policy information for ENABLE_EXPORTS */
+ fprintf(fout, "cmake_policy(SET CMP0065 %s)\n",
+ this->Makefile->GetPolicyStatus(cmPolicies::CMP0065) ==
+ cmPolicies::NEW ? "NEW" : "OLD");
+ if(const char *ee = this->Makefile->GetDefinition(
+ "CMAKE_ENABLE_EXPORTS"))
+ {
+ fprintf(fout, "set(CMAKE_ENABLE_EXPORTS %s)\n", ee);
+ }
+
/* Put the executable at a known location (for COPY_FILE). */
fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
this->BinaryDirectory.c_str());
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index 74e17b6..6616218 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -46,7 +46,7 @@ std::string cmCryptoHash::HashString(const std::string& input)
//----------------------------------------------------------------------------
std::string cmCryptoHash::HashFile(const std::string& file)
{
- cmsys::ifstream fin(file.c_str(), std::ios::in | cmsys_ios_binary);
+ cmsys::ifstream fin(file.c_str(), std::ios::in | std::ios::binary);
if(!fin)
{
return "";
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 2dab169..b06fb5c 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -56,9 +56,9 @@ void cmDefinitions::Raise(const std::string& key,
}
bool cmDefinitions::HasKey(const std::string& key,
- StackConstIter begin, StackConstIter end)
+ StackIter begin, StackIter end)
{
- for (StackConstIter it = begin; it != end; ++it)
+ for (StackIter it = begin; it != end; ++it)
{
MapType::const_iterator i = it->Map.find(key);
if (i != it->Map.end())
@@ -94,12 +94,12 @@ std::vector<std::string> cmDefinitions::UnusedKeys() const
}
//----------------------------------------------------------------------------
-cmDefinitions cmDefinitions::MakeClosure(StackConstIter begin,
- StackConstIter end)
+cmDefinitions cmDefinitions::MakeClosure(StackIter begin,
+ StackIter end)
{
cmDefinitions closure;
std::set<std::string> undefined;
- for (StackConstIter it = begin; it != end; ++it)
+ for (StackIter it = begin; it != end; ++it)
{
// Consider local definitions.
for(MapType::const_iterator mi = it->Map.begin();
@@ -125,12 +125,12 @@ cmDefinitions cmDefinitions::MakeClosure(StackConstIter begin,
//----------------------------------------------------------------------------
std::vector<std::string>
-cmDefinitions::ClosureKeys(StackConstIter begin, StackConstIter end)
+cmDefinitions::ClosureKeys(StackIter begin, StackIter end)
{
std::set<std::string> bound;
std::vector<std::string> defined;
- for (StackConstIter it = begin; it != end; ++it)
+ for (StackIter it = begin; it != end; ++it)
{
defined.reserve(defined.size() + it->Map.size());
for(MapType::const_iterator mi = it->Map.begin();
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 5fdcaab..411867c 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -13,6 +13,9 @@
#define cmDefinitions_h
#include "cmStandardIncludes.h"
+
+#include "cmLinkedTree.h"
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
#include <unordered_map>
@@ -32,26 +35,26 @@
*/
class cmDefinitions
{
- typedef std::list<cmDefinitions>::reverse_iterator StackIter;
- typedef std::list<cmDefinitions>::const_reverse_iterator StackConstIter;
+ typedef cmLinkedTree<cmDefinitions>::iterator StackIter;
public:
static const char* Get(const std::string& key,
StackIter begin, StackIter end);
- static void Raise(const std::string& key, StackIter begin, StackIter end);
+ static void Raise(const std::string& key,
+ StackIter begin, StackIter end);
static bool HasKey(const std::string& key,
- StackConstIter begin, StackConstIter end);
+ StackIter begin, StackIter end);
/** Set (or unset if null) a value associated with a key. */
void Set(const std::string& key, const char* value);
std::vector<std::string> UnusedKeys() const;
- static std::vector<std::string> ClosureKeys(StackConstIter begin,
- StackConstIter end);
+ static std::vector<std::string> ClosureKeys(StackIter begin,
+ StackIter end);
- static cmDefinitions MakeClosure(StackConstIter begin, StackConstIter end);
+ static cmDefinitions MakeClosure(StackIter begin, StackIter end);
private:
// String with existence boolean.
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index cae60b7..9a7d73f 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -796,9 +796,8 @@ cmExportFileGenerator
std::vector<std::string>& missingTargets)
{
// Add the transitive link dependencies for this configuration.
- cmTarget::LinkInterface const* iface = target->Target->GetLinkInterface(
- config,
- target->Target);
+ cmLinkInterface const* iface = target->GetLinkInterface(config,
+ target->Target);
if (!iface)
{
return;
@@ -909,9 +908,8 @@ cmExportFileGenerator
}
// Add the transitive link dependencies for this configuration.
- if(cmTarget::LinkInterface const* iface =
- target->Target
- ->GetLinkInterface(config, target->Target))
+ if(cmLinkInterface const* iface =
+ target->GetLinkInterface(config, target->Target))
{
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_INTERFACE_LANGUAGES",
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index d55be11..7ffab0c 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -72,8 +72,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
// Set an _IMPORT_PREFIX variable for import location properties
// to reference if they are relative to the install prefix.
- std::string installPrefix =
- this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
+ std::string installPrefix = this->IEGen->GetLocalGenerator()
+ ->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
std::string const& expDest = this->IEGen->GetDestination();
if(cmSystemTools::FileIsFullPath(expDest))
{
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 933a256..dfd51c7 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -609,7 +609,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
// the compilerdefines for this target
std::vector<std::string> cdefs;
- target->GetCompileDefinitions(cdefs, buildType, "C");
+ gtgt->GetCompileDefinitions(cdefs, buildType, "C");
// Expand the list.
for(std::vector<std::string>::const_iterator di = cdefs.begin();
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index 578e7d3..f83b5cf 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -19,7 +19,6 @@
#include "cmGeneratedFileStream.h"
#include "cmTarget.h"
#include "cmSystemTools.h"
-#include "cmXMLSafe.h"
#include <cmsys/SystemTools.hxx>
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 4e721d4..163a75b 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -21,7 +21,6 @@
#include "cmSourceFile.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
-#include "cmXMLSafe.h"
#include <cmsys/SystemTools.hxx>
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 7959ffe..fa9b381 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -207,6 +207,10 @@ void cmFindBase::ExpandPaths()
{
this->FillCMakeEnvironmentPath();
}
+ }
+ this->FillUserHintsPath();
+ if(!this->NoDefaultPath)
+ {
if(!this->NoSystemEnvironmentPath)
{
this->FillSystemEnvironmentPath();
@@ -216,8 +220,6 @@ void cmFindBase::ExpandPaths()
this->FillCMakeSystemVariablePath();
}
}
-
- this->FillUserHintsPath();
this->FillUserGuessPath();
}
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 0a66732..e7696af 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -11,7 +11,6 @@
============================================================================*/
#include "cmFindLibraryCommand.h"
#include <cmsys/Directory.hxx>
-#include <cmsys/stl/algorithm>
cmFindLibraryCommand::cmFindLibraryCommand()
{
@@ -204,6 +203,7 @@ struct cmFindLibraryHelper
}
bool HasValidSuffix(std::string const& name);
void AddName(std::string const& name);
+ void SetName(std::string const& name);
bool CheckDirectory(std::string const& path);
bool CheckDirectoryForName(std::string const& path, Name& name);
};
@@ -323,6 +323,13 @@ void cmFindLibraryHelper::AddName(std::string const& name)
}
//----------------------------------------------------------------------------
+void cmFindLibraryHelper::SetName(std::string const& name)
+{
+ this->Names.clear();
+ this->AddName(name);
+}
+
+//----------------------------------------------------------------------------
bool cmFindLibraryHelper::CheckDirectory(std::string const& path)
{
for(std::vector<Name>::iterator i = this->Names.begin();
@@ -460,8 +467,7 @@ std::string cmFindLibraryCommand::FindNormalLibraryDirsPerName()
ni != this->Names.end() ; ++ni)
{
// Switch to searching for this name.
- std::string const& name = *ni;
- helper.AddName(name);
+ helper.SetName(*ni);
// Search every directory.
for(std::vector<std::string>::const_iterator
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 68a6558..64176e7 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1133,6 +1133,10 @@ void cmFindPackageCommand::ComputePrefixes()
{
this->FillPrefixesCMakeEnvironment();
}
+ }
+ this->FillPrefixesUserHints();
+ if(!this->NoDefaultPath)
+ {
if(!this->NoSystemEnvironmentPath)
{
this->FillPrefixesSystemEnvironment();
@@ -1150,7 +1154,6 @@ void cmFindPackageCommand::ComputePrefixes()
this->FillPrefixesSystemRegistry();
}
}
- this->FillPrefixesUserHints();
this->FillPrefixesUserGuess();
this->ComputeFinalPaths();
@@ -1378,7 +1381,7 @@ void cmFindPackageCommand::LoadPackageRegistryDir(std::string const& dir,
cmFindPackageCommandHoldFile holdFile(fname.c_str());
// Load the file.
- cmsys::ifstream fin(fname.c_str(), std::ios::in | cmsys_ios_binary);
+ cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
std::string fentry;
if(fin && cmSystemTools::GetLineFromStream(fin, fentry) &&
this->CheckPackageRegistryEntry(fentry, outPaths))
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index fbd9fd3..e64ed87 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -16,6 +16,80 @@
#include <CoreFoundation/CoreFoundation.h>
#endif
+//----------------------------------------------------------------------------
+struct cmFindProgramHelper
+{
+ cmFindProgramHelper()
+ {
+#if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
+ // Consider platform-specific extensions.
+ this->Extensions.push_back(".com");
+ this->Extensions.push_back(".exe");
+#endif
+ // Consider original name with no extensions.
+ this->Extensions.push_back("");
+ }
+
+ // List of valid extensions.
+ std::vector<std::string> Extensions;
+
+ // Keep track of the best program file found so far.
+ std::string BestPath;
+
+ // Current names under consideration.
+ std::vector<std::string> Names;
+
+ // Current full path under consideration.
+ std::string TestPath;
+
+ void AddName(std::string const& name)
+ {
+ this->Names.push_back(name);
+ }
+ void SetName(std::string const& name)
+ {
+ this->Names.clear();
+ this->AddName(name);
+ }
+ bool CheckDirectory(std::string const& path)
+ {
+ for (std::vector<std::string>::iterator i = this->Names.begin();
+ i != this->Names.end(); ++i)
+ {
+ if (this->CheckDirectoryForName(path, *i))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ bool CheckDirectoryForName(std::string const& path, std::string const& name)
+ {
+ for (std::vector<std::string>::iterator ext = this->Extensions.begin();
+ ext != this->Extensions.end(); ++ext)
+ {
+ this->TestPath = path;
+ this->TestPath += name;
+ if (!ext->empty() && cmSystemTools::StringEndsWith(name, ext->c_str()))
+ {
+ continue;
+ }
+ this->TestPath += *ext;
+ if (cmSystemTools::FileExists(this->TestPath, true))
+ {
+ this->BestPath = cmSystemTools::CollapseFullPath(this->TestPath);
+ return true;
+ }
+ }
+ return false;
+ }
+};
+
+cmFindProgramCommand::cmFindProgramCommand()
+{
+ this->NamesPerDirAllowed = true;
+}
+
// cmFindProgramCommand
bool cmFindProgramCommand
::InitialPass(std::vector<std::string> const& argsIn, cmExecutionStatus &)
@@ -41,7 +115,7 @@ bool cmFindProgramCommand
return true;
}
- std::string result = FindProgram(this->Names);
+ std::string result = FindProgram();
if(result != "")
{
// Save the value in the cache
@@ -59,31 +133,92 @@ bool cmFindProgramCommand
return true;
}
-std::string cmFindProgramCommand::FindProgram(std::vector<std::string> names)
+std::string cmFindProgramCommand::FindProgram()
{
std::string program = "";
if(this->SearchAppBundleFirst || this->SearchAppBundleOnly)
{
- program = FindAppBundle(names);
+ program = FindAppBundle();
}
if(program.empty() && !this->SearchAppBundleOnly)
{
- program = cmSystemTools::FindProgram(names, this->SearchPaths, true);
+ program = this->FindNormalProgram();
}
if(program.empty() && this->SearchAppBundleLast)
{
- program = this->FindAppBundle(names);
+ program = this->FindAppBundle();
}
return program;
}
-std::string cmFindProgramCommand
-::FindAppBundle(std::vector<std::string> names)
+//----------------------------------------------------------------------------
+std::string cmFindProgramCommand::FindNormalProgram()
+{
+ if(this->NamesPerDir)
+ {
+ return this->FindNormalProgramNamesPerDir();
+ }
+ else
+ {
+ return this->FindNormalProgramDirsPerName();
+ }
+}
+
+//----------------------------------------------------------------------------
+std::string cmFindProgramCommand::FindNormalProgramNamesPerDir()
+{
+ // Search for all names in each directory.
+ cmFindProgramHelper helper;
+ 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 program.
+ return "";
+}
+
+//----------------------------------------------------------------------------
+std::string cmFindProgramCommand::FindNormalProgramDirsPerName()
+{
+ // Search the entire path for each name.
+ cmFindProgramHelper helper;
+ for (std::vector<std::string>::const_iterator ni = this->Names.begin();
+ ni != this->Names.end() ; ++ni)
+ {
+ // Switch to searching for this name.
+ helper.SetName(*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 program.
+ return "";
+}
+
+std::string cmFindProgramCommand::FindAppBundle()
{
- for(std::vector<std::string>::const_iterator name = names.begin();
- name != names.end() ; ++name)
+ for(std::vector<std::string>::const_iterator name = this->Names.begin();
+ name != this->Names.end() ; ++name)
{
std::string appName = *name + std::string(".app");
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 70f758f..f88186b 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -25,6 +25,7 @@
class cmFindProgramCommand : public cmFindBase
{
public:
+ cmFindProgramCommand();
/**
* This is a virtual constructor for the command.
*/
@@ -52,11 +53,12 @@ public:
cmTypeMacro(cmFindProgramCommand, cmFindBase);
-protected:
- std::string FindProgram(std::vector<std::string> names);
-
private:
- std::string FindAppBundle(std::vector<std::string> names);
+ std::string FindProgram();
+ std::string FindNormalProgram();
+ std::string FindNormalProgramDirsPerName();
+ std::string FindNormalProgramNamesPerDir();
+ std::string FindAppBundle();
std::string GetBundleExecutable(std::string bundlePath);
};
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index 2aa6beb..8df3e1a 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -56,10 +56,10 @@ protected:
// Whether the real file stream was valid when it was closed.
bool Okay;
- // Whether the destionation file is compressed
+ // Whether the destination file is compressed
bool Compress;
- // Whether the destionation file is compressed
+ // Whether the destination file is compressed
bool CompressExtraExtension;
};
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 03bc83a..31b6766 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1108,8 +1108,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if(isInterfaceProperty)
{
- if(cmTarget::LinkInterfaceLibraries const* iface =
- target->GetLinkInterfaceLibraries(context->Config, headTarget, true))
+ if(cmLinkInterfaceLibraries const* iface =
+ gtgt->GetLinkInterfaceLibraries(context->Config, headTarget, true))
{
linkedTargetsContent =
getLinkedTargetsContent(iface->Libraries, target,
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 299c112..555c437 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -34,6 +34,18 @@
#define UNORDERED_SET std::set
#endif
+class cmGeneratorTarget::TargetPropertyEntry {
+ static cmLinkImplItem NoLinkImplItem;
+public:
+ TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
+ cmLinkImplItem const& item = NoLinkImplItem)
+ : ge(cge), LinkImplItem(item)
+ {}
+ const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
+ cmLinkImplItem const& LinkImplItem;
+};
+cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem;
+
//----------------------------------------------------------------------------
void reportBadObjLib(std::vector<cmSourceFile*> const& badObjLib,
cmGeneratorTarget const* target, cmake *cm)
@@ -63,6 +75,7 @@ struct IDLSourcesTag {};
struct ResxTag {};
struct ModuleDefinitionFileTag {};
struct AppManifestTag{};
+struct ManifestsTag{};
struct CertificatesTag{};
struct XamlTag{};
@@ -204,6 +217,10 @@ struct TagVisitor
{
DoAccept<IsSameTag<Tag, AppManifestTag>::Result>::Do(this->Data, sf);
}
+ else if (ext == "manifest")
+ {
+ DoAccept<IsSameTag<Tag, ManifestsTag>::Result>::Do(this->Data, sf);
+ }
else if (ext == "pfx")
{
DoAccept<IsSameTag<Tag, CertificatesTag>::Result>::Do(this->Data, sf);
@@ -227,18 +244,64 @@ struct TagVisitor
}
};
+void CreatePropertyGeneratorExpressions(
+ cmStringRange const& entries,
+ cmBacktraceRange const& backtraces,
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*>& items,
+ bool evaluateForBuildsystem = false)
+{
+ std::vector<cmListFileBacktrace>::const_iterator btIt = backtraces.begin();
+ for (std::vector<std::string>::const_iterator it = entries.begin();
+ it != entries.end(); ++it, ++btIt)
+ {
+ cmGeneratorExpression ge(*btIt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it);
+ cge->SetEvaluateForBuildsystem(evaluateForBuildsystem);
+ items.push_back(new cmGeneratorTarget::TargetPropertyEntry(cge));
+ }
+}
+
//----------------------------------------------------------------------------
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
: Target(t),
- SourceFileFlagsConstructed(false)
+ SourceFileFlagsConstructed(false),
+ PolicyWarnedCMP0022(false),
+ DebugIncludesDone(false),
+ DebugCompileOptionsDone(false),
+ DebugCompileFeaturesDone(false),
+ DebugCompileDefinitionsDone(false)
{
this->Makefile = this->Target->GetMakefile();
this->LocalGenerator = lg;
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
+
+ CreatePropertyGeneratorExpressions(
+ t->GetIncludeDirectoriesEntries(),
+ t->GetIncludeDirectoriesBacktraces(),
+ this->IncludeDirectoriesEntries);
+
+ CreatePropertyGeneratorExpressions(
+ t->GetCompileOptionsEntries(),
+ t->GetCompileOptionsBacktraces(),
+ this->CompileOptionsEntries);
+
+ CreatePropertyGeneratorExpressions(
+ t->GetCompileFeaturesEntries(),
+ t->GetCompileFeaturesBacktraces(),
+ this->CompileFeaturesEntries);
+
+ CreatePropertyGeneratorExpressions(
+ t->GetCompileDefinitionsEntries(),
+ t->GetCompileDefinitionsBacktraces(),
+ this->CompileDefinitionsEntries);
}
cmGeneratorTarget::~cmGeneratorTarget()
{
+ cmDeleteAll(this->IncludeDirectoriesEntries);
+ cmDeleteAll(this->CompileOptionsEntries);
+ cmDeleteAll(this->CompileFeaturesEntries);
+ cmDeleteAll(this->CompileDefinitionsEntries);
cmDeleteAll(this->LinkInformation);
this->LinkInformation.clear();
}
@@ -270,48 +333,71 @@ const char *cmGeneratorTarget::GetProperty(const std::string& prop) const
std::string cmGeneratorTarget::GetOutputName(const std::string& config,
bool implib) const
{
- std::vector<std::string> props;
- std::string type = this->Target->GetOutputTargetType(implib);
- std::string configUpper = cmSystemTools::UpperCase(config);
- if(!type.empty() && !configUpper.empty())
- {
- // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG>
- props.push_back(type + "_OUTPUT_NAME_" + configUpper);
- }
- if(!type.empty())
+ // Lookup/compute/cache the output name for this configuration.
+ OutputNameKey key(config, implib);
+ cmGeneratorTarget::OutputNameMapType::iterator i =
+ this->OutputNameMap.find(key);
+ if(i == this->OutputNameMap.end())
{
- // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME
- props.push_back(type + "_OUTPUT_NAME");
- }
- if(!configUpper.empty())
- {
- // OUTPUT_NAME_<CONFIG>
- props.push_back("OUTPUT_NAME_" + configUpper);
- // <CONFIG>_OUTPUT_NAME
- props.push_back(configUpper + "_OUTPUT_NAME");
- }
- // OUTPUT_NAME
- props.push_back("OUTPUT_NAME");
+ // Add empty name in map to detect potential recursion.
+ OutputNameMapType::value_type entry(key, "");
+ i = this->OutputNameMap.insert(entry).first;
- std::string outName;
- for(std::vector<std::string>::const_iterator i = props.begin();
- i != props.end(); ++i)
- {
- if (const char* outNameProp = this->Target->GetProperty(*i))
+ // Compute output name.
+ std::vector<std::string> props;
+ std::string type = this->Target->GetOutputTargetType(implib);
+ std::string configUpper = cmSystemTools::UpperCase(config);
+ if(!type.empty() && !configUpper.empty())
{
- outName = outNameProp;
- break;
+ // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG>
+ props.push_back(type + "_OUTPUT_NAME_" + configUpper);
}
- }
+ if(!type.empty())
+ {
+ // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME
+ props.push_back(type + "_OUTPUT_NAME");
+ }
+ if(!configUpper.empty())
+ {
+ // OUTPUT_NAME_<CONFIG>
+ props.push_back("OUTPUT_NAME_" + configUpper);
+ // <CONFIG>_OUTPUT_NAME
+ props.push_back(configUpper + "_OUTPUT_NAME");
+ }
+ // OUTPUT_NAME
+ props.push_back("OUTPUT_NAME");
- if (outName.empty())
+ std::string outName;
+ for(std::vector<std::string>::const_iterator it = props.begin();
+ it != props.end(); ++it)
+ {
+ if (const char* outNameProp = this->Target->GetProperty(*it))
+ {
+ outName = outNameProp;
+ break;
+ }
+ }
+
+ if(outName.empty())
+ {
+ outName = this->GetName();
+ }
+
+ // Now evaluate genex and update the previously-prepared map entry.
+ cmGeneratorExpression ge;
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
+ i->second = cge->Evaluate(this->Makefile, config);
+ }
+ else if(i->second.empty())
{
- outName = this->GetName();
+ // An empty map entry indicates we have been called recursively
+ // from the above block.
+ this->Makefile->GetCMakeInstance()->IssueMessage(
+ cmake::FATAL_ERROR,
+ "Target '" + this->GetName() + "' OUTPUT_NAME depends on itself.",
+ this->Target->GetBacktrace());
}
-
- cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
- return cge->Evaluate(this->Makefile, config);
+ return i->second;
}
//----------------------------------------------------------------------------
@@ -545,6 +631,15 @@ cmGeneratorTarget
//----------------------------------------------------------------------------
void
cmGeneratorTarget
+::GetManifests(std::vector<cmSourceFile const*>& data,
+ const std::string& config) const
+{
+ IMPLEMENT_VISIT(Manifests);
+}
+
+//----------------------------------------------------------------------------
+void
+cmGeneratorTarget
::GetCertificates(std::vector<cmSourceFile const*>& data,
const std::string& config) const
{
@@ -761,8 +856,7 @@ bool cmGeneratorTarget::HasSOName(const std::string& config) const
{
// soname is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
- return ((this->GetType() == cmTarget::SHARED_LIBRARY ||
- this->GetType() == cmTarget::MODULE_LIBRARY) &&
+ return ((this->GetType() == cmTarget::SHARED_LIBRARY) &&
!this->GetPropertyAsBool("NO_SONAME") &&
this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config)));
}
@@ -829,7 +923,7 @@ cmGeneratorTarget::NeedRelinkBeforeInstall(const std::string& config) const
// If either a build or install tree rpath is set then the rpath
// will likely change between the build tree and install tree and
// this target must be relinked.
- return this->Target->HaveBuildTreeRPATH(config)
+ return this->HaveBuildTreeRPATH(config)
|| this->Target->HaveInstallTreeRPATH();
}
@@ -951,9 +1045,13 @@ cmGeneratorTarget::GetAppBundleDirectory(const std::string& config,
bool contentOnly) const
{
std::string fpath = this->GetFullName(config, false);
- fpath += ".app/Contents";
- if(!contentOnly)
- fpath += "/MacOS";
+ fpath += ".app";
+ if(!this->Makefile->PlatformIsAppleIos())
+ {
+ fpath += "/Contents";
+ if(!contentOnly)
+ fpath += "/MacOS";
+ }
return fpath;
}
@@ -985,9 +1083,12 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config,
}
}
fpath += ext;
- fpath += "/Contents";
- if(!contentOnly)
- fpath += "/MacOS";
+ if(!this->Makefile->PlatformIsAppleIos())
+ {
+ fpath += "/Contents";
+ if(!contentOnly)
+ fpath += "/MacOS";
+ }
return fpath;
}
@@ -999,7 +1100,7 @@ cmGeneratorTarget::GetFrameworkDirectory(const std::string& config,
std::string fpath;
fpath += this->GetOutputName(config, false);
fpath += ".framework";
- if(!rootDir)
+ if(!rootDir && !this->Makefile->PlatformIsAppleIos())
{
fpath += "/Versions/";
fpath += this->Target->GetFrameworkVersion();
@@ -1143,9 +1244,11 @@ public:
{
return;
}
-
- cmTarget::LinkInterface const* iface =
- item.Target->GetLinkInterface(this->Config, this->HeadTarget);
+ cmGeneratorTarget* gtgt =
+ this->Target->GetLocalGenerator()->GetGlobalGenerator()
+ ->GetGeneratorTarget(item.Target);
+ cmLinkInterface const* iface =
+ gtgt->GetLinkInterface(this->Config, this->HeadTarget);
if(!iface) { return; }
for(std::vector<std::string>::const_iterator
@@ -1199,7 +1302,7 @@ public:
: Preference(0), Target(target)
{
this->Makefile = this->Target->Makefile;
- this->GG = this->Makefile->GetGlobalGenerator();
+ this->GG = this->Target->GetLocalGenerator()->GetGlobalGenerator();
}
void Consider(const char* lang)
{
@@ -1246,8 +1349,8 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
{
// Get languages built in this target.
UNORDERED_SET<std::string> languages;
- cmTarget::LinkImplementation const* impl =
- this->Target->GetLinkImplementation(config);
+ cmLinkImplementation const* impl =
+ this->GetLinkImplementation(config);
assert(impl);
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
li != impl->Languages.end(); ++li)
@@ -1374,7 +1477,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
msg += this->GetName();
msg += " which has type ";
msg += cmTarget::GetTargetTypeName(this->Target->GetType());
- this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, msg);
+ this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
return 0;
}
@@ -1476,20 +1579,22 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string> &result,
void processILibs(const std::string& config,
cmTarget const* headTarget,
cmLinkItem const& item,
+ cmGlobalGenerator* gg,
std::vector<cmTarget const*>& tgts,
std::set<cmTarget const*>& emitted)
{
if (item.Target && emitted.insert(item.Target).second)
{
tgts.push_back(item.Target);
- if(cmTarget::LinkInterfaceLibraries const* iface =
- item.Target->GetLinkInterfaceLibraries(config, headTarget, true))
+ cmGeneratorTarget* gt = gg->GetGeneratorTarget(item.Target);
+ if(cmLinkInterfaceLibraries const* iface =
+ gt->GetLinkInterfaceLibraries(config, headTarget, true))
{
for(std::vector<cmLinkItem>::const_iterator
it = iface->Libraries.begin();
it != iface->Libraries.end(); ++it)
{
- processILibs(config, headTarget, *it, tgts, emitted);
+ processILibs(config, headTarget, *it, gg, tgts, emitted);
}
}
}
@@ -1514,7 +1619,9 @@ cmGeneratorTarget::GetLinkImplementationClosure(
it = impl->Libraries.begin();
it != impl->Libraries.end(); ++it)
{
- processILibs(config, this->Target, *it, tgts , emitted);
+ processILibs(config, this->Target, *it,
+ this->LocalGenerator->GetGlobalGenerator(),
+ tgts , emitted);
}
}
return tgts;
@@ -1928,17 +2035,540 @@ cmGeneratorTarget::GetCreateRuleVariable(std::string const& lang,
}
return "";
}
+//----------------------------------------------------------------------------
+static void processIncludeDirectories(cmGeneratorTarget const* tgt,
+ const std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries,
+ std::vector<std::string> &includes,
+ UNORDERED_SET<std::string> &uniqueIncludes,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ const std::string& config, bool debugIncludes,
+ const std::string& language)
+{
+ cmMakefile *mf = tgt->Target->GetMakefile();
+
+ for (std::vector<cmGeneratorTarget::TargetPropertyEntry*>::const_iterator
+ it = entries.begin(), end = entries.end(); it != end; ++it)
+ {
+ cmLinkImplItem const& item = (*it)->LinkImplItem;
+ std::string const& targetName = item;
+ bool const fromImported = item.Target && item.Target->IsImported();
+ bool const checkCMP0027 = item.FromGenex;
+ std::vector<std::string> entryIncludes;
+ cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
+ config,
+ false,
+ tgt->Target,
+ dagChecker, language),
+ entryIncludes);
+
+ std::string usedIncludes;
+ for(std::vector<std::string>::iterator
+ li = entryIncludes.begin(); li != entryIncludes.end(); ++li)
+ {
+ if (fromImported
+ && !cmSystemTools::FileExists(li->c_str()))
+ {
+ std::ostringstream e;
+ cmake::MessageType messageType = cmake::FATAL_ERROR;
+ if (checkCMP0027)
+ {
+ switch(tgt->Target->GetPolicyStatusCMP0027())
+ {
+ case cmPolicies::WARN:
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0027) << "\n";
+ case cmPolicies::OLD:
+ messageType = cmake::AUTHOR_WARNING;
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::NEW:
+ break;
+ }
+ }
+ e << "Imported target \"" << targetName << "\" includes "
+ "non-existent path\n \"" << *li << "\"\nin its "
+ "INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n"
+ "* The path was deleted, renamed, or moved to another "
+ "location.\n"
+ "* An install or uninstall procedure did not complete "
+ "successfully.\n"
+ "* The installation package was faulty and references files it "
+ "does not provide.\n";
+ tgt->GetLocalGenerator()->IssueMessage(messageType, e.str());
+ return;
+ }
+
+ if (!cmSystemTools::FileIsFullPath(li->c_str()))
+ {
+ std::ostringstream e;
+ bool noMessage = false;
+ cmake::MessageType messageType = cmake::FATAL_ERROR;
+ if (!targetName.empty())
+ {
+ e << "Target \"" << targetName << "\" contains relative "
+ "path in its INTERFACE_INCLUDE_DIRECTORIES:\n"
+ " \"" << *li << "\"";
+ }
+ else
+ {
+ switch(tgt->Target->GetPolicyStatusCMP0021())
+ {
+ case cmPolicies::WARN:
+ {
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0021) << "\n";
+ messageType = cmake::AUTHOR_WARNING;
+ }
+ break;
+ case cmPolicies::OLD:
+ noMessage = true;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ // Issue the fatal message.
+ break;
+ }
+ e << "Found relative path while evaluating include directories of "
+ "\"" << tgt->GetName() << "\":\n \"" << *li << "\"\n";
+ }
+ if (!noMessage)
+ {
+ tgt->GetLocalGenerator()->IssueMessage(messageType, e.str());
+ if (messageType == cmake::FATAL_ERROR)
+ {
+ return;
+ }
+ }
+ }
+
+ if (!cmSystemTools::IsOff(li->c_str()))
+ {
+ cmSystemTools::ConvertToUnixSlashes(*li);
+ }
+ std::string inc = *li;
+
+ if(uniqueIncludes.insert(inc).second)
+ {
+ includes.push_back(inc);
+ if (debugIncludes)
+ {
+ usedIncludes += " * " + inc + "\n";
+ }
+ }
+ }
+ if (!usedIncludes.empty())
+ {
+ mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
+ std::string("Used includes for target ")
+ + tgt->GetName() + ":\n"
+ + usedIncludes, (*it)->ge->GetBacktrace());
+ }
+ }
+}
+
+
+//----------------------------------------------------------------------------
+static void AddInterfaceEntries(
+ cmGeneratorTarget const* thisTarget, std::string const& config,
+ std::string const& prop,
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries)
+{
+ if(cmLinkImplementationLibraries const* impl =
+ thisTarget->Target->GetLinkImplementationLibraries(config))
+ {
+ for (std::vector<cmLinkImplItem>::const_iterator
+ it = impl->Libraries.begin(), end = impl->Libraries.end();
+ it != end; ++it)
+ {
+ if(it->Target)
+ {
+ std::string genex =
+ "$<TARGET_PROPERTY:" + *it + "," + prop + ">";
+ cmGeneratorExpression ge(it->Backtrace);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
+ cge->SetEvaluateForBuildsystem(true);
+ entries.push_back(
+ new cmGeneratorTarget::TargetPropertyEntry(cge, *it));
+ }
+ }
+ }
+}
//----------------------------------------------------------------------------
std::vector<std::string>
cmGeneratorTarget::GetIncludeDirectories(const std::string& config,
const std::string& lang) const
{
- return this->Target->GetIncludeDirectories(config, lang);
+ std::vector<std::string> includes;
+ UNORDERED_SET<std::string> uniqueIncludes;
+
+ cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
+ "INCLUDE_DIRECTORIES", 0, 0);
+
+ std::vector<std::string> debugProperties;
+ const char *debugProp =
+ this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+ if (debugProp)
+ {
+ cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ }
+
+ bool debugIncludes = !this->DebugIncludesDone
+ && std::find(debugProperties.begin(),
+ debugProperties.end(),
+ "INCLUDE_DIRECTORIES")
+ != debugProperties.end();
+
+ if (this->GlobalGenerator->GetConfigureDoneCMP0026())
+ {
+ this->DebugIncludesDone = true;
+ }
+
+ processIncludeDirectories(this,
+ this->IncludeDirectoriesEntries,
+ includes,
+ uniqueIncludes,
+ &dagChecker,
+ config,
+ debugIncludes,
+ lang);
+
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*>
+ linkInterfaceIncludeDirectoriesEntries;
+ AddInterfaceEntries(
+ this, config, "INTERFACE_INCLUDE_DIRECTORIES",
+ linkInterfaceIncludeDirectoriesEntries);
+
+ if(this->Makefile->IsOn("APPLE"))
+ {
+ cmLinkImplementationLibraries const* impl =
+ this->Target->GetLinkImplementationLibraries(config);
+ for(std::vector<cmLinkImplItem>::const_iterator
+ it = impl->Libraries.begin();
+ it != impl->Libraries.end(); ++it)
+ {
+ std::string libDir = cmSystemTools::CollapseFullPath(*it);
+
+ static cmsys::RegularExpression
+ frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$");
+ if(!frameworkCheck.find(libDir))
+ {
+ continue;
+ }
+
+ libDir = frameworkCheck.match(1);
+
+ cmGeneratorExpression ge;
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(libDir.c_str());
+ linkInterfaceIncludeDirectoriesEntries
+ .push_back(new cmGeneratorTarget::TargetPropertyEntry(cge));
+ }
+ }
+
+ processIncludeDirectories(this,
+ linkInterfaceIncludeDirectoriesEntries,
+ includes,
+ uniqueIncludes,
+ &dagChecker,
+ config,
+ debugIncludes,
+ lang);
+
+ cmDeleteAll(linkInterfaceIncludeDirectoriesEntries);
+
+ return includes;
+}
+
+//----------------------------------------------------------------------------
+static void processCompileOptionsInternal(cmGeneratorTarget const* tgt,
+ const std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries,
+ std::vector<std::string> &options,
+ UNORDERED_SET<std::string> &uniqueOptions,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ const std::string& config, bool debugOptions, const char *logName,
+ std::string const& language)
+{
+ cmMakefile *mf = tgt->Target->GetMakefile();
+
+ for (std::vector<cmGeneratorTarget::TargetPropertyEntry*>::const_iterator
+ it = entries.begin(), end = entries.end(); it != end; ++it)
+ {
+ std::vector<std::string> entryOptions;
+ cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
+ config,
+ false,
+ tgt->Target,
+ dagChecker,
+ language),
+ entryOptions);
+ std::string usedOptions;
+ for(std::vector<std::string>::iterator
+ li = entryOptions.begin(); li != entryOptions.end(); ++li)
+ {
+ std::string const& opt = *li;
+
+ if(uniqueOptions.insert(opt).second)
+ {
+ options.push_back(opt);
+ if (debugOptions)
+ {
+ usedOptions += " * " + opt + "\n";
+ }
+ }
+ }
+ if (!usedOptions.empty())
+ {
+ mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
+ std::string("Used compile ") + logName
+ + std::string(" for target ")
+ + tgt->GetName() + ":\n"
+ + usedOptions, (*it)->ge->GetBacktrace());
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+static void processCompileOptions(cmGeneratorTarget const* tgt,
+ const std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries,
+ std::vector<std::string> &options,
+ UNORDERED_SET<std::string> &uniqueOptions,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ const std::string& config, bool debugOptions,
+ std::string const& language)
+{
+ processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
+ dagChecker, config, debugOptions, "options",
+ language);
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetCompileOptions(std::vector<std::string> &result,
+ const std::string& config,
+ const std::string& language) const
+{
+ UNORDERED_SET<std::string> uniqueOptions;
+
+ cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
+ "COMPILE_OPTIONS", 0, 0);
+
+ std::vector<std::string> debugProperties;
+ const char *debugProp =
+ this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+ if (debugProp)
+ {
+ cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ }
+
+ bool debugOptions = !this->DebugCompileOptionsDone
+ && std::find(debugProperties.begin(),
+ debugProperties.end(),
+ "COMPILE_OPTIONS")
+ != debugProperties.end();
+
+ if (this->GlobalGenerator->GetConfigureDoneCMP0026())
+ {
+ this->DebugCompileOptionsDone = true;
+ }
+
+ processCompileOptions(this,
+ this->CompileOptionsEntries,
+ result,
+ uniqueOptions,
+ &dagChecker,
+ config,
+ debugOptions,
+ language);
+
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*>
+ linkInterfaceCompileOptionsEntries;
+
+ AddInterfaceEntries(
+ this, config, "INTERFACE_COMPILE_OPTIONS",
+ linkInterfaceCompileOptionsEntries);
+
+ processCompileOptions(this,
+ linkInterfaceCompileOptionsEntries,
+ result,
+ uniqueOptions,
+ &dagChecker,
+ config,
+ debugOptions,
+ language);
+
+ cmDeleteAll(linkInterfaceCompileOptionsEntries);
+}
+
+//----------------------------------------------------------------------------
+static void processCompileFeatures(cmGeneratorTarget const* tgt,
+ const std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries,
+ std::vector<std::string> &options,
+ UNORDERED_SET<std::string> &uniqueOptions,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ const std::string& config, bool debugOptions)
+{
+ processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
+ dagChecker, config, debugOptions, "features",
+ std::string());
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string> &result,
+ const std::string& config) const
+{
+ UNORDERED_SET<std::string> uniqueFeatures;
+
+ cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
+ "COMPILE_FEATURES",
+ 0, 0);
+
+ std::vector<std::string> debugProperties;
+ const char *debugProp =
+ this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+ if (debugProp)
+ {
+ cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ }
+
+ bool debugFeatures = !this->DebugCompileFeaturesDone
+ && std::find(debugProperties.begin(),
+ debugProperties.end(),
+ "COMPILE_FEATURES")
+ != debugProperties.end();
+
+ if (this->GlobalGenerator->GetConfigureDoneCMP0026())
+ {
+ this->DebugCompileFeaturesDone = true;
+ }
+
+ processCompileFeatures(this,
+ this->CompileFeaturesEntries,
+ result,
+ uniqueFeatures,
+ &dagChecker,
+ config,
+ debugFeatures);
+
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*>
+ linkInterfaceCompileFeaturesEntries;
+ AddInterfaceEntries(
+ this, config, "INTERFACE_COMPILE_FEATURES",
+ linkInterfaceCompileFeaturesEntries);
+
+ processCompileFeatures(this,
+ linkInterfaceCompileFeaturesEntries,
+ result,
+ uniqueFeatures,
+ &dagChecker,
+ config,
+ debugFeatures);
+
+ cmDeleteAll(linkInterfaceCompileFeaturesEntries);
+}
+
+//----------------------------------------------------------------------------
+static void processCompileDefinitions(cmGeneratorTarget const* tgt,
+ const std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries,
+ std::vector<std::string> &options,
+ UNORDERED_SET<std::string> &uniqueOptions,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ const std::string& config, bool debugOptions,
+ std::string const& language)
+{
+ processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
+ dagChecker, config, debugOptions,
+ "definitions", language);
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetCompileDefinitions(std::vector<std::string> &list,
+ const std::string& config,
+ const std::string& language) const
+{
+ UNORDERED_SET<std::string> uniqueOptions;
+
+ cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
+ "COMPILE_DEFINITIONS", 0, 0);
+
+ std::vector<std::string> debugProperties;
+ const char *debugProp =
+ this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+ if (debugProp)
+ {
+ cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ }
+
+ bool debugDefines = !this->DebugCompileDefinitionsDone
+ && std::find(debugProperties.begin(),
+ debugProperties.end(),
+ "COMPILE_DEFINITIONS")
+ != debugProperties.end();
+
+ if (this->GlobalGenerator->GetConfigureDoneCMP0026())
+ {
+ this->DebugCompileDefinitionsDone = true;
+ }
+
+ processCompileDefinitions(this,
+ this->CompileDefinitionsEntries,
+ list,
+ uniqueOptions,
+ &dagChecker,
+ config,
+ debugDefines,
+ language);
+
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*>
+ linkInterfaceCompileDefinitionsEntries;
+ AddInterfaceEntries(
+ this, config, "INTERFACE_COMPILE_DEFINITIONS",
+ linkInterfaceCompileDefinitionsEntries);
+ if (!config.empty())
+ {
+ std::string configPropName = "COMPILE_DEFINITIONS_"
+ + cmSystemTools::UpperCase(config);
+ const char *configProp = this->Target->GetProperty(configPropName);
+ if (configProp)
+ {
+ switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043))
+ {
+ case cmPolicies::WARN:
+ {
+ std::ostringstream e;
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0043);
+ this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING,
+ e.str());
+ }
+ case cmPolicies::OLD:
+ {
+ cmGeneratorExpression ge;
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(configProp);
+ linkInterfaceCompileDefinitionsEntries
+ .push_back(new cmGeneratorTarget::TargetPropertyEntry(cge));
+ }
+ break;
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ break;
+ }
+ }
+ }
+
+ processCompileDefinitions(this,
+ linkInterfaceCompileDefinitionsEntries,
+ list,
+ uniqueOptions,
+ &dagChecker,
+ config,
+ debugDefines,
+ language);
+
+ cmDeleteAll(linkInterfaceCompileDefinitionsEntries);
}
//----------------------------------------------------------------------------
-void cmGeneratorTarget::GenerateTargetManifest(
+void cmGeneratorTarget::ComputeTargetManifest(
const std::string& config) const
{
if (this->Target->IsImported())
@@ -2064,7 +2694,7 @@ cmGeneratorTarget::NormalGetRealName(const std::string& config) const
{
std::string msg = "NormalGetRealName called on imported target: ";
msg += this->GetName();
- this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, msg);
+ this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
}
if(this->GetType() == cmTarget::EXECUTABLE)
@@ -2146,9 +2776,12 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
if(this->Target->IsFrameworkOnApple())
{
realName = prefix;
- realName += "Versions/";
- realName += this->Target->GetFrameworkVersion();
- realName += "/";
+ if(!this->Makefile->PlatformIsAppleIos())
+ {
+ realName += "Versions/";
+ realName += this->Target->GetFrameworkVersion();
+ realName += "/";
+ }
realName += base;
soName = realName;
}
@@ -3304,7 +3937,7 @@ cmGeneratorTarget::ReportPropertyOrigin(const std::string &p,
p)
!= debugProperties.end();
- if (this->Target->GetMakefile()->IsConfigured())
+ if (this->GlobalGenerator->GetConfigureDoneCMP0026())
{
this->DebugCompatiblePropertiesDone[p] = true;
}
@@ -3322,3 +3955,613 @@ cmGeneratorTarget::ReportPropertyOrigin(const std::string &p,
this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG, areport);
}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::LookupLinkItems(std::vector<std::string> const& names,
+ std::vector<cmLinkItem>& items) const
+{
+ for(std::vector<std::string>::const_iterator i = names.begin();
+ i != names.end(); ++i)
+ {
+ std::string name = this->Target->CheckCMP0004(*i);
+ if(name == this->GetName() || name.empty())
+ {
+ continue;
+ }
+ items.push_back(cmLinkItem(name, this->Target->FindTargetToLink(name)));
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::ExpandLinkItems(std::string const& prop,
+ std::string const& value,
+ std::string const& config,
+ cmTarget const* headTarget,
+ bool usage_requirements_only,
+ std::vector<cmLinkItem>& items,
+ bool& hadHeadSensitiveCondition) const
+{
+ cmGeneratorExpression ge;
+ cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0);
+ // The $<LINK_ONLY> expression may be in a link interface to specify private
+ // link dependencies that are otherwise excluded from usage requirements.
+ if(usage_requirements_only)
+ {
+ dagChecker.SetTransitivePropertiesOnly();
+ }
+ std::vector<std::string> libs;
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
+ cmSystemTools::ExpandListArgument(cge->Evaluate(
+ this->Makefile,
+ config,
+ false,
+ headTarget,
+ this->Target, &dagChecker), libs);
+ this->LookupLinkItems(libs, items);
+ hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();
+}
+
+//----------------------------------------------------------------------------
+cmLinkInterface const*
+cmGeneratorTarget::GetLinkInterface(const std::string& config,
+ cmTarget const* head) const
+{
+ // Imported targets have their own link interface.
+ if(this->IsImported())
+ {
+ return this->GetImportLinkInterface(config, head, false);
+ }
+
+ // Link interfaces are not supported for executables that do not
+ // export symbols.
+ if(this->GetType() == cmTarget::EXECUTABLE &&
+ !this->Target->IsExecutableWithExports())
+ {
+ return 0;
+ }
+
+ // Lookup any existing link interface for this configuration.
+ cmHeadToLinkInterfaceMap& hm =
+ this->GetHeadToLinkInterfaceMap(config);
+
+ // If the link interface does not depend on the head target
+ // then return the one we computed first.
+ if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
+ {
+ return &hm.begin()->second;
+ }
+
+ cmOptionalLinkInterface& iface = hm[head];
+ if(!iface.LibrariesDone)
+ {
+ iface.LibrariesDone = true;
+ this->ComputeLinkInterfaceLibraries(
+ config, iface, head, false);
+ }
+ if(!iface.AllDone)
+ {
+ iface.AllDone = true;
+ if(iface.Exists)
+ {
+ this->ComputeLinkInterface(config, iface, head);
+ }
+ }
+
+ return iface.Exists? &iface : 0;
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::ComputeLinkInterface(const std::string& config,
+ cmOptionalLinkInterface &iface,
+ cmTarget const* headTarget) const
+{
+ if(iface.ExplicitLibraries)
+ {
+ if(this->GetType() == cmTarget::SHARED_LIBRARY
+ || this->GetType() == cmTarget::STATIC_LIBRARY
+ || this->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ // Shared libraries may have runtime implementation dependencies
+ // on other shared libraries that are not in the interface.
+ UNORDERED_SET<std::string> emitted;
+ for(std::vector<cmLinkItem>::const_iterator
+ li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li)
+ {
+ emitted.insert(*li);
+ }
+ if (this->GetType() != cmTarget::INTERFACE_LIBRARY)
+ {
+ cmLinkImplementation const* impl =
+ this->GetLinkImplementation(config);
+ for(std::vector<cmLinkImplItem>::const_iterator
+ li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
+ {
+ if(emitted.insert(*li).second)
+ {
+ if(li->Target)
+ {
+ // This is a runtime dependency on another shared library.
+ if(li->Target->GetType() == cmTarget::SHARED_LIBRARY)
+ {
+ iface.SharedDeps.push_back(*li);
+ }
+ }
+ else
+ {
+ // TODO: Recognize shared library file names. Perhaps this
+ // should be moved to cmComputeLinkInformation, but that creates
+ // a chicken-and-egg problem since this list is needed for its
+ // construction.
+ }
+ }
+ }
+ }
+ }
+ }
+ else if (this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || this->Target->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+ {
+ // The link implementation is the default link interface.
+ cmLinkImplementationLibraries const*
+ impl = this->Target->GetLinkImplementationLibrariesInternal(config,
+ headTarget);
+ iface.ImplementationIsInterface = true;
+ iface.WrongConfigLibraries = impl->WrongConfigLibraries;
+ }
+
+ if(this->Target->LinkLanguagePropagatesToDependents())
+ {
+ // Targets using this archive need its language runtime libraries.
+ if(cmLinkImplementation const* impl =
+ this->GetLinkImplementation(config))
+ {
+ iface.Languages = impl->Languages;
+ }
+ }
+
+ if(this->GetType() == cmTarget::STATIC_LIBRARY)
+ {
+ // Construct the property name suffix for this configuration.
+ std::string suffix = "_";
+ if(!config.empty())
+ {
+ suffix += cmSystemTools::UpperCase(config);
+ }
+ else
+ {
+ suffix += "NOCONFIG";
+ }
+
+ // How many repetitions are needed if this library has cyclic
+ // dependencies?
+ std::string propName = "LINK_INTERFACE_MULTIPLICITY";
+ propName += suffix;
+ if(const char* config_reps = this->GetProperty(propName))
+ {
+ sscanf(config_reps, "%u", &iface.Multiplicity);
+ }
+ else if(const char* reps =
+ this->GetProperty("LINK_INTERFACE_MULTIPLICITY"))
+ {
+ sscanf(reps, "%u", &iface.Multiplicity);
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+const cmLinkInterfaceLibraries *
+cmGeneratorTarget::GetLinkInterfaceLibraries(const std::string& config,
+ cmTarget const* head,
+ bool usage_requirements_only) const
+{
+ // Imported targets have their own link interface.
+ if(this->IsImported())
+ {
+ return this->GetImportLinkInterface(config, head,
+ usage_requirements_only);
+ }
+
+ // Link interfaces are not supported for executables that do not
+ // export symbols.
+ if(this->GetType() == cmTarget::EXECUTABLE &&
+ !this->Target->IsExecutableWithExports())
+ {
+ return 0;
+ }
+
+ // Lookup any existing link interface for this configuration.
+ std::string CONFIG = cmSystemTools::UpperCase(config);
+ cmHeadToLinkInterfaceMap& hm =
+ (usage_requirements_only ?
+ this->GetHeadToLinkInterfaceUsageRequirementsMap(config) :
+ this->GetHeadToLinkInterfaceMap(config));
+
+ // If the link interface does not depend on the head target
+ // then return the one we computed first.
+ if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
+ {
+ return &hm.begin()->second;
+ }
+
+ cmOptionalLinkInterface& iface = hm[head];
+ if(!iface.LibrariesDone)
+ {
+ iface.LibrariesDone = true;
+ this->ComputeLinkInterfaceLibraries(
+ config, iface, head, usage_requirements_only);
+ }
+
+ return iface.Exists? &iface : 0;
+}
+
+//----------------------------------------------------------------------------
+void
+cmGeneratorTarget::ComputeLinkInterfaceLibraries(
+ const std::string& config,
+ cmOptionalLinkInterface& iface,
+ cmTarget const* headTarget,
+ bool usage_requirements_only) const
+{
+ // Construct the property name suffix for this configuration.
+ std::string suffix = "_";
+ if(!config.empty())
+ {
+ suffix += cmSystemTools::UpperCase(config);
+ }
+ else
+ {
+ suffix += "NOCONFIG";
+ }
+
+ // An explicit list of interface libraries may be set for shared
+ // libraries and executables that export symbols.
+ const char* explicitLibraries = 0;
+ std::string linkIfaceProp;
+ if(this->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
+ this->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN)
+ {
+ // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
+ linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
+ explicitLibraries = this->GetProperty(linkIfaceProp);
+ }
+ else if(this->GetType() == cmTarget::SHARED_LIBRARY ||
+ this->Target->IsExecutableWithExports())
+ {
+ // CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
+ // shared lib or executable.
+
+ // Lookup the per-configuration property.
+ linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
+ linkIfaceProp += suffix;
+ explicitLibraries = this->GetProperty(linkIfaceProp);
+
+ // If not set, try the generic property.
+ if(!explicitLibraries)
+ {
+ linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
+ explicitLibraries = this->GetProperty(linkIfaceProp);
+ }
+ }
+
+ if(explicitLibraries &&
+ this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
+ !this->PolicyWarnedCMP0022)
+ {
+ // Compare the explicitly set old link interface properties to the
+ // preferred new link interface property one and warn if different.
+ const char* newExplicitLibraries =
+ this->GetProperty("INTERFACE_LINK_LIBRARIES");
+ if (newExplicitLibraries
+ && strcmp(newExplicitLibraries, explicitLibraries) != 0)
+ {
+ std::ostringstream w;
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
+ "Target \"" << this->GetName() << "\" has an "
+ "INTERFACE_LINK_LIBRARIES property which differs from its " <<
+ linkIfaceProp << " properties."
+ "\n"
+ "INTERFACE_LINK_LIBRARIES:\n"
+ " " << newExplicitLibraries << "\n" <<
+ linkIfaceProp << ":\n"
+ " " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n";
+ this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ this->PolicyWarnedCMP0022 = true;
+ }
+ }
+
+ // There is no implicit link interface for executables or modules
+ // so if none was explicitly set then there is no link interface.
+ if(!explicitLibraries &&
+ (this->GetType() == cmTarget::EXECUTABLE ||
+ (this->GetType() == cmTarget::MODULE_LIBRARY)))
+ {
+ return;
+ }
+ iface.Exists = true;
+ iface.ExplicitLibraries = explicitLibraries;
+
+ if(explicitLibraries)
+ {
+ // The interface libraries have been explicitly set.
+ this->ExpandLinkItems(linkIfaceProp, explicitLibraries,
+ config,
+ headTarget, usage_requirements_only,
+ iface.Libraries,
+ iface.HadHeadSensitiveCondition);
+ }
+ else if (this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || this->Target->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+ // If CMP0022 is NEW then the plain tll signature sets the
+ // INTERFACE_LINK_LIBRARIES, so if we get here then the project
+ // cleared the property explicitly and we should not fall back
+ // to the link implementation.
+ {
+ // The link implementation is the default link interface.
+ cmLinkImplementationLibraries const* impl =
+ this->Target->GetLinkImplementationLibrariesInternal(config,
+ headTarget);
+ iface.Libraries.insert(iface.Libraries.end(),
+ impl->Libraries.begin(), impl->Libraries.end());
+ if(this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
+ !this->PolicyWarnedCMP0022 && !usage_requirements_only)
+ {
+ // Compare the link implementation fallback link interface to the
+ // preferred new link interface property and warn if different.
+ std::vector<cmLinkItem> ifaceLibs;
+ static const std::string newProp = "INTERFACE_LINK_LIBRARIES";
+ if(const char* newExplicitLibraries = this->GetProperty(newProp))
+ {
+ bool hadHeadSensitiveConditionDummy = false;
+ this->ExpandLinkItems(newProp, newExplicitLibraries, config,
+ headTarget, usage_requirements_only,
+ ifaceLibs, hadHeadSensitiveConditionDummy);
+ }
+ if (ifaceLibs != iface.Libraries)
+ {
+ std::string oldLibraries = cmJoin(impl->Libraries, ";");
+ std::string newLibraries = cmJoin(ifaceLibs, ";");
+ if(oldLibraries.empty())
+ { oldLibraries = "(empty)"; }
+ if(newLibraries.empty())
+ { newLibraries = "(empty)"; }
+
+ std::ostringstream w;
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
+ "Target \"" << this->GetName() << "\" has an "
+ "INTERFACE_LINK_LIBRARIES property. "
+ "This should be preferred as the source of the link interface "
+ "for this library but because CMP0022 is not set CMake is "
+ "ignoring the property and using the link implementation "
+ "as the link interface instead."
+ "\n"
+ "INTERFACE_LINK_LIBRARIES:\n"
+ " " << newLibraries << "\n"
+ "Link implementation:\n"
+ " " << oldLibraries << "\n";
+ this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ this->PolicyWarnedCMP0022 = true;
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+const cmLinkInterface *
+cmGeneratorTarget::GetImportLinkInterface(const std::string& config,
+ cmTarget const* headTarget,
+ bool usage_requirements_only) const
+{
+ cmTarget::ImportInfo const* info = this->Target->GetImportInfo(config);
+ if(!info)
+ {
+ return 0;
+ }
+
+ std::string CONFIG = cmSystemTools::UpperCase(config);
+ cmHeadToLinkInterfaceMap& hm =
+ (usage_requirements_only ?
+ this->GetHeadToLinkInterfaceUsageRequirementsMap(config) :
+ this->GetHeadToLinkInterfaceMap(config));
+
+ // If the link interface does not depend on the head target
+ // then return the one we computed first.
+ if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
+ {
+ return &hm.begin()->second;
+ }
+
+ cmOptionalLinkInterface& iface = hm[headTarget];
+ if(!iface.AllDone)
+ {
+ iface.AllDone = true;
+ iface.Multiplicity = info->Multiplicity;
+ cmSystemTools::ExpandListArgument(info->Languages, iface.Languages);
+ this->ExpandLinkItems(info->LibrariesProp, info->Libraries,
+ config,
+ headTarget, usage_requirements_only,
+ iface.Libraries,
+ iface.HadHeadSensitiveCondition);
+ std::vector<std::string> deps;
+ cmSystemTools::ExpandListArgument(info->SharedDeps, deps);
+ this->LookupLinkItems(deps, iface.SharedDeps);
+ }
+
+ return &iface;
+}
+
+cmHeadToLinkInterfaceMap&
+cmGeneratorTarget::GetHeadToLinkInterfaceMap(const std::string &config) const
+{
+ std::string CONFIG = cmSystemTools::UpperCase(config);
+ return this->LinkInterfaceMap[CONFIG];
+}
+
+cmHeadToLinkInterfaceMap&
+cmGeneratorTarget::GetHeadToLinkInterfaceUsageRequirementsMap(
+ const std::string &config) const
+{
+ std::string CONFIG = cmSystemTools::UpperCase(config);
+ return this->LinkInterfaceUsageRequirementsOnlyMap[CONFIG];
+}
+
+//----------------------------------------------------------------------------
+const cmLinkImplementation *
+cmGeneratorTarget::GetLinkImplementation(const std::string& config) const
+{
+ // There is no link implementation for imported targets.
+ if(this->Target->IsImported())
+ {
+ return 0;
+ }
+
+ cmOptionalLinkImplementation& impl = this->Target->GetLinkImplMap(config);
+ if(!impl.LibrariesDone)
+ {
+ impl.LibrariesDone = true;
+ this->Target->ComputeLinkImplementationLibraries(config, impl,
+ this->Target);
+ }
+ if(!impl.LanguagesDone)
+ {
+ impl.LanguagesDone = true;
+ this->ComputeLinkImplementationLanguages(config, impl);
+ }
+ return &impl;
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::GetConfigCommonSourceFiles(
+ std::vector<cmSourceFile*>& files) const
+{
+ std::vector<std::string> configs;
+ this->Makefile->GetConfigurations(configs);
+ if (configs.empty())
+ {
+ configs.push_back("");
+ }
+
+ std::vector<std::string>::const_iterator it = configs.begin();
+ const std::string& firstConfig = *it;
+ this->Target->GetSourceFiles(files, firstConfig);
+
+ for ( ; it != configs.end(); ++it)
+ {
+ std::vector<cmSourceFile*> configFiles;
+ this->Target->GetSourceFiles(configFiles, *it);
+ if (configFiles != files)
+ {
+ std::string firstConfigFiles;
+ const char* sep = "";
+ for (std::vector<cmSourceFile*>::const_iterator fi = files.begin();
+ fi != files.end(); ++fi)
+ {
+ firstConfigFiles += sep;
+ firstConfigFiles += (*fi)->GetFullPath();
+ sep = "\n ";
+ }
+
+ std::string thisConfigFiles;
+ sep = "";
+ for (std::vector<cmSourceFile*>::const_iterator fi = configFiles.begin();
+ fi != configFiles.end(); ++fi)
+ {
+ thisConfigFiles += sep;
+ thisConfigFiles += (*fi)->GetFullPath();
+ sep = "\n ";
+ }
+ std::ostringstream e;
+ e << "Target \"" << this->GetName()
+ << "\" has source files which vary by "
+ "configuration. This is not supported by the \""
+ << this->GlobalGenerator->GetName()
+ << "\" generator.\n"
+ "Config \"" << firstConfig << "\":\n"
+ " " << firstConfigFiles << "\n"
+ "Config \"" << *it << "\":\n"
+ " " << thisConfigFiles << "\n";
+ this->LocalGenerator->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
+ }
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages,
+ const std::string& config) const
+{
+ std::vector<cmSourceFile*> sourceFiles;
+ this->GetSourceFiles(sourceFiles, config);
+ for(std::vector<cmSourceFile*>::const_iterator
+ i = sourceFiles.begin(); i != sourceFiles.end(); ++i)
+ {
+ const std::string& lang = (*i)->GetLanguage();
+ if(!lang.empty())
+ {
+ languages.insert(lang);
+ }
+ }
+
+ std::vector<cmGeneratorTarget*> objectLibraries;
+ std::vector<cmSourceFile const*> externalObjects;
+ if (!this->GlobalGenerator->GetConfigureDoneCMP0026())
+ {
+ std::vector<cmTarget*> objectTargets;
+ this->Target->GetObjectLibrariesCMP0026(objectTargets);
+ objectLibraries.reserve(objectTargets.size());
+ for (std::vector<cmTarget*>::const_iterator it = objectTargets.begin();
+ it != objectTargets.end(); ++it)
+ {
+ objectLibraries.push_back(this->GlobalGenerator
+ ->GetGeneratorTarget(*it));
+ }
+ }
+ else
+ {
+ this->GetExternalObjects(externalObjects, config);
+ for(std::vector<cmSourceFile const*>::const_iterator
+ i = externalObjects.begin(); i != externalObjects.end(); ++i)
+ {
+ std::string objLib = (*i)->GetObjectLibrary();
+ if (cmTarget* tgt = this->Makefile->FindTargetToUse(objLib))
+ {
+ objectLibraries.push_back(this->GlobalGenerator
+ ->GetGeneratorTarget(tgt));
+ }
+ }
+ }
+ for(std::vector<cmGeneratorTarget*>::const_iterator
+ i = objectLibraries.begin(); i != objectLibraries.end(); ++i)
+ {
+ (*i)->GetLanguages(languages, config);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmGeneratorTarget::ComputeLinkImplementationLanguages(
+ const std::string& config,
+ cmOptionalLinkImplementation& impl) const
+{
+ // This target needs runtime libraries for its source languages.
+ std::set<std::string> languages;
+ // Get languages used in our source files.
+ this->GetLanguages(languages, config);
+ // Copy the set of langauges to the link implementation.
+ impl.Languages.insert(impl.Languages.begin(),
+ languages.begin(), languages.end());
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::HaveBuildTreeRPATH(const std::string& config) const
+{
+ if (this->Target->GetPropertyAsBool("SKIP_BUILD_RPATH"))
+ {
+ return false;
+ }
+ if(cmLinkImplementationLibraries const* impl =
+ this->Target->GetLinkImplementationLibraries(config))
+ {
+ return !impl->Libraries.empty();
+ }
+ return false;
+}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 68e7a8a..916f281 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -12,7 +12,7 @@
#ifndef cmGeneratorTarget_h
#define cmGeneratorTarget_h
-#include "cmStandardIncludes.h"
+#include "cmLinkItem.h"
class cmCustomCommand;
class cmGlobalGenerator;
@@ -71,6 +71,8 @@ public:
const std::string& config) const;
void GetAppManifest(std::vector<cmSourceFile const*>&,
const std::string& config) const;
+ void GetManifests(std::vector<cmSourceFile const*>&,
+ const std::string& config) const;
void GetCertificates(std::vector<cmSourceFile const*>&,
const std::string& config) const;
void GetXamlSources(std::vector<cmSourceFile const*>&,
@@ -106,6 +108,21 @@ public:
const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p,
const std::string& config) const;
+ cmLinkInterface const* GetLinkInterface(const std::string& config,
+ cmTarget const* headTarget) const;
+ void ComputeLinkInterface(const std::string& config,
+ cmOptionalLinkInterface& iface,
+ cmTarget const* head) const;
+
+ cmLinkInterfaceLibraries const*
+ GetLinkInterfaceLibraries(const std::string& config,
+ cmTarget const* headTarget,
+ bool usage_requirements_only) const;
+
+ void ComputeLinkInterfaceLibraries(const std::string& config,
+ cmOptionalLinkInterface &iface,
+ cmTarget const* head,
+ bool usage_requirements_only) const;
/** Get the full path to the target according to the settings in its
makefile and the configuration type. */
@@ -183,6 +200,25 @@ public:
LinkClosure const* GetLinkClosure(const std::string& config) const;
void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
+ cmLinkImplementation const*
+ GetLinkImplementation(const std::string& config) const;
+
+ void ComputeLinkImplementationLanguages(const std::string& config,
+ cmOptionalLinkImplementation& impl
+ ) const;
+
+ // Compute the set of languages compiled by the target. This is
+ // computed every time it is called because the languages can change
+ // when source file properties are changed and we do not have enough
+ // information to forward these property changes to the targets
+ // until we have per-target object file properties.
+ void GetLanguages(std::set<std::string>& languages,
+ std::string const& config) const;
+
+ bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const;
+
+ bool HaveBuildTreeRPATH(const std::string& config) const;
+
/** Full path with trailing slash to the top-level directory
holding object files for this target. Includes the build
time config name placeholder if needed for the generator. */
@@ -202,11 +238,22 @@ public:
std::vector<std::string> GetIncludeDirectories(
const std::string& config, const std::string& lang) const;
+ void GetCompileOptions(std::vector<std::string> &result,
+ const std::string& config,
+ const std::string& language) const;
+
+ void GetCompileFeatures(std::vector<std::string> &features,
+ const std::string& config) const;
+
+ void GetCompileDefinitions(std::vector<std::string> &result,
+ const std::string& config,
+ const std::string& language) const;
+
bool IsSystemIncludeDirectory(const std::string& dir,
const std::string& config) const;
/** Add the target output files to the global generator manifest. */
- void GenerateTargetManifest(const std::string& config) const;
+ void ComputeTargetManifest(const std::string& config) const;
/**
* Trace through the source files in this target and add al source files
@@ -317,6 +364,8 @@ public:
const std::string &report,
const std::string &compatibilityType) const;
+ class TargetPropertyEntry;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
@@ -375,6 +424,42 @@ private:
};
mutable std::map<std::string, LinkImplClosure> LinkImplClosureMap;
+ typedef std::map<std::string, cmHeadToLinkInterfaceMap>
+ LinkInterfaceMapType;
+ mutable LinkInterfaceMapType LinkInterfaceMap;
+ mutable LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap;
+
+ cmHeadToLinkInterfaceMap&
+ GetHeadToLinkInterfaceMap(std::string const& config) const;
+ cmHeadToLinkInterfaceMap& GetHeadToLinkInterfaceUsageRequirementsMap(
+ std::string const& config) const;
+
+ cmLinkInterface const*
+ GetImportLinkInterface(const std::string& config, cmTarget const* head,
+ bool usage_requirements_only) const;
+
+ std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
+ std::vector<TargetPropertyEntry*> CompileOptionsEntries;
+ std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
+ std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
+
+ void ExpandLinkItems(std::string const& prop, std::string const& value,
+ std::string const& config, cmTarget const* headTarget,
+ bool usage_requirements_only,
+ std::vector<cmLinkItem>& items,
+ bool& hadHeadSensitiveCondition) const;
+ void LookupLinkItems(std::vector<std::string> const& names,
+ std::vector<cmLinkItem>& items) const;
+
+ typedef std::pair<std::string, bool> OutputNameKey;
+ typedef std::map<OutputNameKey, std::string> OutputNameMapType;
+ mutable OutputNameMapType OutputNameMap;
+ mutable bool PolicyWarnedCMP0022;
+ mutable bool DebugIncludesDone;
+ mutable bool DebugCompileOptionsDone;
+ mutable bool DebugCompileFeaturesDone;
+ mutable bool DebugCompileDefinitionsDone;
+
public:
std::vector<cmTarget const*> const&
GetLinkImplementationClosure(const std::string& config) const;
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 13a9afb..0f56c8e 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -93,11 +93,23 @@ bool cmGetFilenameComponentCommand
else if (args[2] == "ABSOLUTE" ||
args[2] == "REALPATH")
{
+ // If the path given is relative, evaluate it relative to the
+ // current source directory unless the user passes a different
+ // base directory.
+ std::string baseDir = this->Makefile->GetCurrentSourceDirectory();
+ for(unsigned int i=3; i < args.size(); ++i)
+ {
+ if(args[i] == "BASE_DIR")
+ {
+ ++i;
+ if(i < args.size())
+ {
+ baseDir = args[i];
+ }
+ }
+ }
// Collapse the path to its simplest form.
- // If the path given is relative evaluate it relative to the
- // current source directory.
- result = cmSystemTools::CollapseFullPath(
- filename, this->Makefile->GetCurrentSourceDirectory());
+ result = cmSystemTools::CollapseFullPath(filename, baseDir);
if(args[2] == "REALPATH")
{
// Resolve symlinks if possible
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 1e57c33..cae5c2f 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -151,10 +151,6 @@ void cmGhsMultiTargetGenerator::Generate()
this->WriteTargetLinkLibraries();
}
this->WriteCustomCommands();
- if (this->DynamicDownload)
- {
- *this->GetFolderBuildStreams() << " " << this->DDOption << std::endl;
- }
this->WriteSources(objectSources);
}
@@ -230,9 +226,11 @@ void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string &config,
}
if (this->IsTargetGroup())
{
- *this->GetFolderBuildStreams() << " -non_shared" << std::endl;
- *this->GetFolderBuildStreams() << " -o \"" << outputDir
- << outputFilename << ".elf\""
+ *this->GetFolderBuildStreams()
+ << " {optgroup=GhsCommonOptions} -o \"" << outputDir
+ << outputFilename << ".elf\"" << std::endl;
+ *this->GetFolderBuildStreams() << " :extraOutputFile=\"" << outputDir
+ << outputFilename << ".elf.ael\""
<< std::endl;
}
else
@@ -330,7 +328,8 @@ void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
const std::string &config, const std::string &language)
{
std::vector<std::string> compileDefinitions;
- this->Target->GetCompileDefinitions(compileDefinitions, config, language);
+ this->GeneratorTarget->GetCompileDefinitions(compileDefinitions,
+ config, language);
for (std::vector<std::string>::const_iterator cdI =
compileDefinitions.begin();
cdI != compileDefinitions.end(); ++cdI)
@@ -343,7 +342,7 @@ void cmGhsMultiTargetGenerator::WriteIncludes(const std::string &config,
const std::string &language)
{
std::vector<std::string> includes =
- this->Target->GetIncludeDirectories(config, language);
+ this->GeneratorTarget->GetIncludeDirectories(config, language);
for (std::vector<std::string>::const_iterator includes_i = includes.begin();
includes_i != includes.end(); ++includes_i)
{
@@ -453,14 +452,17 @@ void cmGhsMultiTargetGenerator::WriteSources(
this->Makefile->GetHomeOutputDirectory(), sgPath,
GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath);
- if ((*si)->GetExtension() == ".int")
+ std::string fullSourcePath((*si)->GetFullPath());
+ if ((*si)->GetExtension() == "int" || (*si)->GetExtension() == "bsp")
{
- *this->FolderBuildStreams[sgPath] << "\"" << (*si)->GetFullPath() << "\""
- << std::endl;
+ *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl;
}
else
{
- *this->FolderBuildStreams[sgPath] << (*si)->GetFullPath() << std::endl;
+ //WORKAROUND: GHS MULTI needs the path to use backslashes without quotes
+ // to open files in search as of version 6.1.6
+ cmsys::SystemTools::ReplaceString(fullSourcePath, "/", "\\");
+ *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl;
}
if ("ld" != (*si)->GetExtension() && "int" != (*si)->GetExtension() &&
@@ -558,7 +560,7 @@ bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const &config,
{
bool output;
std::vector<std::string> options;
- this->Target->GetCompileOptions(options, config, language);
+ this->GeneratorTarget->GetCompileOptions(options, config, language);
output =
options.end() == std::find(options.begin(), options.end(), "-kernel");
return output;
@@ -587,7 +589,7 @@ bool cmGhsMultiTargetGenerator::DetermineIfDynamicDownload(
{
std::vector<std::string> options;
bool output = false;
- this->Target->GetCompileOptions(options, config, language);
+ this->GeneratorTarget->GetCompileOptions(options, config, language);
for (std::vector<std::string>::const_iterator options_i = options.begin();
options_i != options.end(); ++options_i)
{
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 87665a0..40e8d29 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -44,10 +44,10 @@ void cmGlobalBorlandMakefileGenerator
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(
- cmLocalGenerator* parent, cmState::Snapshot snapshot)
+ cmMakefile *mf)
{
cmLocalUnixMakefileGenerator3* lg =
- new cmLocalUnixMakefileGenerator3(this, parent, snapshot);
+ new cmLocalUnixMakefileGenerator3(this, mf);
lg->SetMakefileVariableSize(32);
lg->SetMakeCommandEscapeTargetTwice(true);
lg->SetBorlandMakeCurlyHack(true);
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index 2ec510d..b59c86d 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -36,8 +36,7 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cda26cd..3589e82 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -14,20 +14,6 @@
#if defined(_MSC_VER) && _MSC_VER >= 1800
# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
#endif
-typedef struct {
- ULONG dwOSVersionInfoSize;
- ULONG dwMajorVersion;
- ULONG dwMinorVersion;
- ULONG dwBuildNumber;
- ULONG dwPlatformId;
- WCHAR szCSDVersion[128];
- USHORT wServicePackMajor;
- USHORT wServicePackMinor;
- USHORT wSuiteMask;
- UCHAR wProductType;
- UCHAR wReserved;
-} CMRTL_OSVERSIONINFOEXW;
-
#endif
#include "cmGlobalGenerator.h"
@@ -86,6 +72,8 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
this->ExtraGenerator = 0;
this->CurrentMakefile = 0;
this->TryCompileOuterMakefile = 0;
+
+ this->ConfigureDoneCMP0026 = false;
}
cmGlobalGenerator::~cmGlobalGenerator()
@@ -446,45 +434,26 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
if (!mf->GetDefinition("CMAKE_SYSTEM"))
{
#if defined(_WIN32) && !defined(__CYGWIN__)
- CMRTL_OSVERSIONINFOEXW osviex;
+ /* Windows version number data. */
+ OSVERSIONINFOEXW osviex;
ZeroMemory(&osviex, sizeof(osviex));
osviex.dwOSVersionInfoSize = sizeof(osviex);
- typedef LONG (FAR WINAPI *cmRtlGetVersion)(CMRTL_OSVERSIONINFOEXW*);
- cmRtlGetVersion rtlGetVersion = reinterpret_cast<cmRtlGetVersion>(
- GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlGetVersion"));
- if (rtlGetVersion && rtlGetVersion(&osviex) == 0)
- {
- std::ostringstream windowsVersionString;
- windowsVersionString << osviex.dwMajorVersion << "."
- << osviex.dwMinorVersion << "."
- << osviex.dwBuildNumber;
- windowsVersionString.str();
- mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
- windowsVersionString.str().c_str());
- }
- else
- {
- // RtlGetVersion failed, so use the deprecated GetVersionEx function.
- /* Windows version number data. */
- OSVERSIONINFO osvi;
- ZeroMemory(&osvi, sizeof(osvi));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (push)
# pragma warning (disable:4996)
#endif
- GetVersionEx (&osvi);
+ GetVersionExW((OSVERSIONINFOW*)&osviex);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (pop)
#endif
- std::ostringstream windowsVersionString;
- windowsVersionString << osvi.dwMajorVersion << "."
- << osvi.dwMinorVersion;
- windowsVersionString.str();
- mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
- windowsVersionString.str().c_str());
- }
+ std::ostringstream windowsVersionString;
+ windowsVersionString << osviex.dwMajorVersion << "."
+ << osviex.dwMinorVersion << "."
+ << osviex.dwBuildNumber;
+ windowsVersionString.str();
+ mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
+ windowsVersionString.str().c_str());
#endif
// Read the DetermineSystem file
std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");
@@ -1122,28 +1091,58 @@ void cmGlobalGenerator::ClearEnabledLanguages()
return this->CMakeInstance->GetState()->ClearEnabledLanguages();
}
+void cmGlobalGenerator::CreateLocalGenerators()
+{
+ cmDeleteAll(this->LocalGenerators);
+ this->LocalGenerators.clear();
+ this->LocalGenerators.reserve(this->Makefiles.size());
+ for (std::vector<cmMakefile*>::const_iterator it = this->Makefiles.begin();
+ it != this->Makefiles.end(); ++it)
+ {
+ this->LocalGenerators.push_back(this->CreateLocalGenerator(*it));
+ }
+}
+
void cmGlobalGenerator::Configure()
{
this->FirstTimeProgress = 0.0f;
this->ClearGeneratorMembers();
- // start with this directory
- cmLocalGenerator *lg = this->MakeLocalGenerator();
- this->Makefiles.push_back(lg->GetMakefile());
- this->LocalGenerators.push_back(lg);
+ cmMakefile* dirMf =
+ new cmMakefile(this, this->GetCMakeInstance()->GetCurrentSnapshot());
+ this->Makefiles.push_back(dirMf);
// set the Start directories
- lg->GetMakefile()->SetCurrentSourceDirectory
+ dirMf->SetCurrentSourceDirectory
(this->CMakeInstance->GetHomeDirectory());
- lg->GetMakefile()->SetCurrentBinaryDirectory
+ dirMf->SetCurrentBinaryDirectory
(this->CMakeInstance->GetHomeOutputDirectory());
this->BinaryDirectories.insert(
this->CMakeInstance->GetHomeOutputDirectory());
// now do it
- lg->GetMakefile()->Configure();
- lg->GetMakefile()->EnforceDirectoryLevelRules();
+ this->ConfigureDoneCMP0026 = false;
+ dirMf->Configure();
+ dirMf->EnforceDirectoryLevelRules();
+
+ this->ConfigureDoneCMP0026 = true;
+
+ // Put a copy of each global target in every directory.
+ cmTargets globalTargets;
+ this->CreateDefaultGlobalTargets(&globalTargets);
+
+ for (unsigned int i = 0; i < this->Makefiles.size(); ++i)
+ {
+ cmMakefile* mf = this->Makefiles[i];
+ cmTargets* targets = &(mf->GetTargets());
+ cmTargets::iterator tit;
+ for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
+ {
+ (*targets)[tit->first] = tit->second;
+ (*targets)[tit->first].SetMakefile(mf);
+ }
+ }
// update the cache entry for the number of local generators, this is used
// for progress
@@ -1155,11 +1154,7 @@ void cmGlobalGenerator::Configure()
// check for link libraries and include directories containing "NOTFOUND"
// and for infinite loops
- this->CheckLocalGenerators();
-
- // at this point this->LocalGenerators has been filled,
- // so create the map from project name to vector of local generators
- this->FillProjectMap();
+ this->CheckTargetProperties();
if ( this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE)
{
@@ -1186,29 +1181,11 @@ void cmGlobalGenerator::Configure()
}
this->CMakeInstance->UpdateProgress(msg.str().c_str(), -1);
}
-
- unsigned int i;
-
- // Put a copy of each global target in every directory.
- cmTargets globalTargets;
- this->CreateDefaultGlobalTargets(&globalTargets);
-
- for (i = 0; i < this->Makefiles.size(); ++i)
- {
- cmMakefile* mf = this->Makefiles[i];
- cmTargets* targets = &(mf->GetTargets());
- cmTargets::iterator tit;
- for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
- {
- (*targets)[tit->first] = tit->second;
- (*targets)[tit->first].SetMakefile(mf);
- }
- }
-
}
void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes)
{
+ this->CreateLocalGenerators();
cmDeleteAll(this->GeneratorTargets);
this->GeneratorTargets.clear();
this->CreateGeneratorTargets(targetTypes);
@@ -1267,6 +1244,10 @@ bool cmGlobalGenerator::Compute()
this->CreateGenerationObjects();
+ // at this point this->LocalGenerators has been filled,
+ // so create the map from project name to vector of local generators
+ this->FillProjectMap();
+
#ifdef CMAKE_BUILD_WITH_CMAKE
// Iterate through all targets and set up automoc for those which have
// the AUTOMOC, AUTOUIC or AUTORCC property set
@@ -1276,11 +1257,6 @@ bool cmGlobalGenerator::Compute()
unsigned int i;
- for (i = 0; i < this->LocalGenerators.size(); ++i)
- {
- this->LocalGenerators[i]->ComputeObjectMaxPath();
- }
-
// Add generator specific helper commands
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
@@ -1327,11 +1303,9 @@ void cmGlobalGenerator::Generate()
// Compute the manifest of main targets generated.
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
- this->LocalGenerators[i]->GenerateTargetManifest();
+ this->LocalGenerators[i]->ComputeTargetManifest();
}
- this->ProcessEvaluationFiles();
-
// Compute the inter-target dependencies.
if(!this->ComputeTargetDepends())
{
@@ -1340,7 +1314,9 @@ void cmGlobalGenerator::Generate()
// Create a map from local generator to the complete set of targets
// it builds by default.
- this->FillLocalGeneratorToTargetMap();
+ this->InitializeProgressMarks();
+
+ this->ProcessEvaluationFiles();
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
@@ -1550,7 +1526,6 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
ti != targets.end(); ++ti)
{
cmTarget* t = &ti->second;
- t->Compute();
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
this->GeneratorTargets[t] = gt;
generatorTargets[t] = gt;
@@ -1601,6 +1576,7 @@ void cmGlobalGenerator::ClearGeneratorMembers()
cmDeleteAll(this->BuildExportSets);
this->BuildExportSets.clear();
+ cmDeleteAll(this->Makefiles);
this->Makefiles.clear();
cmDeleteAll(this->LocalGenerators);
@@ -1610,7 +1586,6 @@ void cmGlobalGenerator::ClearGeneratorMembers()
this->TargetDependencies.clear();
this->TotalTargets.clear();
this->ImportedTargets.clear();
- this->LocalGeneratorToTargetMap.clear();
this->ProjectMap.clear();
this->RuleHashes.clear();
this->DirectoryContentMap.clear();
@@ -1636,7 +1611,7 @@ void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
{
}
-void cmGlobalGenerator::CheckLocalGenerators()
+void cmGlobalGenerator::CheckTargetProperties()
{
std::map<std::string, std::string> notFoundMap;
// std::set<std::string> notFoundMap;
@@ -1671,8 +1646,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
text += "\n linked by target \"";
text += l->second.GetName();
text += "\" in directory ";
- text+=this->LocalGenerators[i]->GetMakefile()
- ->GetCurrentSourceDirectory();
+ text+=this->Makefiles[i]->GetCurrentSourceDirectory();
notFoundMap[varName] = text;
}
}
@@ -1968,12 +1942,6 @@ void cmGlobalGenerator::AddMakefile(cmMakefile *mf)
this->CMakeInstance->UpdateProgress("Configuring", prog);
}
-//----------------------------------------------------------------------------
-void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
-{
- this->LocalGenerators.push_back(lg);
-}
-
void cmGlobalGenerator::AddInstallComponent(const char* component)
{
if(component && *component)
@@ -1987,23 +1955,10 @@ void cmGlobalGenerator::EnableInstallTarget()
this->InstallTargetEnabled = true;
}
-cmLocalGenerator *
-cmGlobalGenerator::MakeLocalGenerator(cmState::Snapshot snapshot,
- cmLocalGenerator *parent)
-{
- if (!snapshot.IsValid())
- {
- snapshot = this->CMakeInstance->GetCurrentSnapshot();
- }
-
- return this->CreateLocalGenerator(parent, snapshot);
-}
-
cmLocalGenerator*
-cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmGlobalGenerator::CreateLocalGenerator(cmMakefile* mf)
{
- return new cmLocalGenerator(this, parent, snapshot);
+ return new cmLocalGenerator(this, mf);
}
void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
@@ -2042,24 +1997,37 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen)
}
}
-bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
- cmLocalGenerator* gen) const
+bool cmGlobalGenerator::IsExcluded(cmState::Snapshot const& rootSnp,
+ cmState::Snapshot const& snp_) const
{
- if(!gen || gen == root)
+ cmState::Snapshot snp = snp_;
+ while (snp.IsValid())
{
- // No directory excludes itself.
- return false;
- }
+ if(snp == rootSnp)
+ {
+ // No directory excludes itself.
+ return false;
+ }
- if(gen->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
- {
- // This directory is excluded from its parent.
- return true;
+ if(snp.GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+ {
+ // This directory is excluded from its parent.
+ return true;
+ }
+ snp = snp.GetBuildsystemDirectoryParent();
}
+ return false;
+}
- // This directory is included in its parent. Check whether the
- // parent is excluded.
- return this->IsExcluded(root, gen->GetParent());
+bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
+ cmLocalGenerator* gen) const
+{
+ assert(gen);
+
+ cmState::Snapshot rootSnp = root->GetStateSnapshot();
+ cmState::Snapshot snp = gen->GetStateSnapshot();
+
+ return this->IsExcluded(rootSnp, snp);
}
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
@@ -2071,12 +2039,9 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
// This target is excluded from its directory.
return true;
}
- else
- {
- // This target is included in its directory. Check whether the
- // directory is excluded.
- return this->IsExcluded(root, target->GetLocalGenerator());
- }
+ // This target is included in its directory. Check whether the
+ // directory is excluded.
+ return this->IsExcluded(root, target->GetLocalGenerator());
}
void
@@ -2103,62 +2068,19 @@ void cmGlobalGenerator::FillProjectMap()
for(i = 0; i < this->LocalGenerators.size(); ++i)
{
// for each local generator add all projects
- cmLocalGenerator *lg = this->LocalGenerators[i];
+ cmState::Snapshot snp = this->LocalGenerators[i]->GetStateSnapshot();
std::string name;
do
{
- if (name != lg->GetMakefile()->GetProjectName())
+ std::string snpProjName = snp.GetProjectName();
+ if (name != snpProjName)
{
- name = lg->GetMakefile()->GetProjectName();
+ name = snpProjName;
this->ProjectMap[name].push_back(this->LocalGenerators[i]);
}
- lg = lg->GetParent();
- }
- while (lg);
- }
-}
-
-
-// Build a map that contains a the set of targets used by each local
-// generator directory level.
-void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
-{
- this->LocalGeneratorToTargetMap.clear();
- // Loop over all targets in all local generators.
- for(std::vector<cmLocalGenerator*>::const_iterator
- lgi = this->LocalGenerators.begin();
- lgi != this->LocalGenerators.end(); ++lgi)
- {
- cmLocalGenerator* lg = *lgi;
- cmMakefile* mf = lg->GetMakefile();
- cmTargets const& targets = mf->GetTargets();
- for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
- {
- cmTarget const& target = t->second;
-
- cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
-
- // Consider the directory containing the target and all its
- // parents until something excludes the target.
- for(cmLocalGenerator* clg = lg; clg && !this->IsExcluded(clg, gt);
- clg = clg->GetParent())
- {
- // This local generator includes the target.
- std::set<cmGeneratorTarget const*>& targetSet =
- this->LocalGeneratorToTargetMap[clg];
- targetSet.insert(gt);
-
- // Add dependencies of the included target. An excluded
- // target may still be included if it is a dependency of a
- // non-excluded target.
- TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(gt);
- for(TargetDependSet::const_iterator ti = tgtdeps.begin();
- ti != tgtdeps.end(); ++ti)
- {
- targetSet.insert(*ti);
- }
- }
+ snp = snp.GetBuildsystemDirectoryParent();
}
+ while (snp.IsValid());
}
}
@@ -2472,7 +2394,17 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' )
{
std::string cfgArg = "-DBUILD_TYPE=";
- cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR");
+ bool iosPlatform = mf->PlatformIsAppleIos();
+ if(iosPlatform)
+ {
+ cfgArg += "$(CONFIGURATION)";
+ singleLine.push_back(cfgArg);
+ cfgArg = "-DEFFECTIVE_PLATFORM_NAME=$(EFFECTIVE_PLATFORM_NAME)";
+ }
+ else
+ {
+ cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR");
+ }
singleLine.push_back(cfgArg);
}
singleLine.push_back("-P");
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index a13bede..83cbc3f 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -56,9 +56,8 @@ public:
cmGlobalGenerator(cmake* cm);
virtual ~cmGlobalGenerator();
- cmLocalGenerator* MakeLocalGenerator(
- cmState::Snapshot snapshot = cmState::Snapshot(),
- cmLocalGenerator* parent = 0);
+ virtual cmLocalGenerator*
+ CreateLocalGenerator(cmMakefile* mf);
///! Get the name for this generator
virtual std::string GetName() const { return "Generic"; }
@@ -187,7 +186,6 @@ public:
{this->CurrentMakefile = mf;}
void AddMakefile(cmMakefile *mf);
- void AddLocalGenerator(cmLocalGenerator *lg);
///! Set an generator for an "external makefile based project"
void SetExternalMakefileProjectGenerator(
@@ -242,7 +240,7 @@ public:
#if defined(_WIN32) && !defined(__CYGWIN__)
/** Is this the Visual Studio 6 generator? */
- virtual bool IsForVS6() const { return false; }
+ bool IsForVS6() const { return this->GetName() == "Visual Studio 6"; }
#endif
///! Find a target by name by searching the local generators.
@@ -364,6 +362,8 @@ public:
cmFileLockPool& GetFileLockPool() { return FileLockPool; }
#endif
+ bool GetConfigureDoneCMP0026() const { return this->ConfigureDoneCMP0026; }
+
std::string MakeSilentFlag;
protected:
typedef std::vector<cmLocalGenerator*> GeneratorVector;
@@ -395,10 +395,12 @@ protected:
// Fill the ProjectMap, this must be called after LocalGenerators
// has been populated.
void FillProjectMap();
- void CheckLocalGenerators();
+ void CheckTargetProperties();
+ bool IsExcluded(cmState::Snapshot const& root,
+ cmState::Snapshot const& snp) const;
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const;
- void FillLocalGeneratorToTargetMap();
+ virtual void InitializeProgressMarks() {}
void CreateDefaultGlobalTargets(cmTargets* targets);
cmTarget CreateGlobalTarget(const std::string& name, const char* message,
const cmCustomCommandLines* commandLines,
@@ -413,8 +415,6 @@ protected:
cmMakefile* CurrentMakefile;
// map from project name to vector of local generators in that project
std::map<std::string, std::vector<cmLocalGenerator*> > ProjectMap;
- std::map<cmLocalGenerator*, std::set<cmGeneratorTarget const*> >
- LocalGeneratorToTargetMap;
// Set of named installation components requested by the project.
std::set<std::string> InstallComponents;
@@ -441,10 +441,6 @@ protected:
virtual bool UseFolderProperty();
private:
- ///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
-
cmMakefile* TryCompileOuterMakefile;
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator
@@ -469,6 +465,8 @@ private:
virtual void ForceLinkerLanguages();
+ void CreateLocalGenerators();
+
void CheckCompilerIdCompatibility(cmMakefile* mf,
std::string const& lang) const;
@@ -525,6 +523,7 @@ protected:
bool ForceUnixPaths;
bool ToolSupportsColor;
bool InstallTargetEnabled;
+ bool ConfigureDoneCMP0026;
};
#endif
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index f764418..6dde1e3 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -33,10 +33,9 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
}
cmLocalGenerator *
-cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmMakefile* mf)
{
- return new cmLocalGhsMultiGenerator(this, parent, snapshot);
+ return new cmLocalGhsMultiGenerator(this, mf);
}
void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry)
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index f1a3ed7..8f88d4f 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -31,8 +31,7 @@ public:
{ return new cmGlobalGeneratorSimpleFactory<cmGlobalGhsMultiGenerator>(); }
///! create the correct local generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/// @return the name of this generator.
static std::string GetActualName() { return "Green Hills MULTI"; }
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index a84923b..9a6f3ba 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -62,19 +62,19 @@ void cmGlobalMSYSMakefileGenerator
locations.push_back("c:/mingw/bin");
std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
std::string gcc = "gcc.exe";
- if(tgcc.size())
+ if(!tgcc.empty())
{
gcc = tgcc;
}
std::string tgxx = cmSystemTools::FindProgram("g++", locations);
std::string gxx = "g++.exe";
- if(tgxx.size())
+ if(!tgxx.empty())
{
gxx = tgxx;
}
std::string trc = cmSystemTools::FindProgram("windres", locations);
std::string rc = "windres.exe";
- if(trc.size())
+ if(!trc.empty())
{
rc = trc;
}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index b92ad32..120bb03 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -528,10 +528,9 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
// Virtual public methods.
cmLocalGenerator*
-cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmGlobalNinjaGenerator::CreateLocalGenerator(cmMakefile* mf)
{
- return new cmLocalNinjaGenerator(this, parent, snapshot);
+ return new cmLocalNinjaGenerator(this, mf);
}
void cmGlobalNinjaGenerator
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index f103801..d204a50 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -162,33 +162,24 @@ public:
public:
cmGlobalNinjaGenerator(cmake* cm);
- /// Convenience method for creating an instance of this class.
static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>(); }
- /// Destructor.
virtual ~cmGlobalNinjaGenerator() { }
- /// Overloaded methods. @see cmGlobalGenerator::CreateLocalGenerator()
- virtual cmLocalGenerator* CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf);
- /// Overloaded methods. @see cmGlobalGenerator::GetName().
virtual std::string GetName() const {
return cmGlobalNinjaGenerator::GetActualName(); }
- /// @return the name of this generator.
static std::string GetActualName() { return "Ninja"; }
- /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation()
static void GetDocumentation(cmDocumentationEntry& entry);
- /// Overloaded methods. @see cmGlobalGenerator::EnableLanguage()
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile* mf,
bool optional);
- /// Overloaded methods. @see cmGlobalGenerator::GenerateBuildCommand()
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const std::string& makeProgram,
@@ -307,11 +298,8 @@ public:
protected:
- /// Overloaded methods. @see cmGlobalGenerator::Generate()
virtual void Generate();
- /// Overloaded methods.
- /// @see cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS()
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; }
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 76d059ee..0064713 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -59,11 +59,10 @@ void cmGlobalUnixMakefileGenerator3
}
///! Create a local generator appropriate to this Global Generator
-cmLocalGenerator *
-cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmLocalGenerator* cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(
+ cmMakefile* mf)
{
- return new cmLocalUnixMakefileGenerator3(this, parent, snapshot);
+ return new cmLocalUnixMakefileGenerator3(this, mf);
}
//----------------------------------------------------------------------------
@@ -495,12 +494,12 @@ cmGlobalUnixMakefileGenerator3
// The directory-level rule should depend on the directory-level
// rules of the subdirectories.
- for(std::vector<cmLocalGenerator*>::iterator sdi =
- lg->GetChildren().begin(); sdi != lg->GetChildren().end(); ++sdi)
+ std::vector<cmState::Snapshot> children
+ = lg->GetMakefile()->GetStateSnapshot().GetChildren();
+ for(std::vector<cmState::Snapshot>::const_iterator
+ ci = children.begin(); ci != children.end(); ++ci)
{
- cmLocalUnixMakefileGenerator3* slg =
- static_cast<cmLocalUnixMakefileGenerator3*>(*sdi);
- std::string subdir = slg->GetMakefile()->GetCurrentBinaryDirectory();
+ std::string subdir = ci->GetDirectory().GetCurrentBinary();
subdir += "/";
subdir += pass;
depends.push_back(subdir);
@@ -578,20 +577,19 @@ void cmGlobalUnixMakefileGenerator3
makeOptions.begin(), makeOptions.end());
if (!targetName.empty())
{
- cmLocalUnixMakefileGenerator3 *lg;
- if (!this->LocalGenerators.empty())
+ cmMakefile* mf;
+ if (!this->Makefiles.empty())
{
- lg = static_cast<cmLocalUnixMakefileGenerator3 *>
- (this->LocalGenerators[0]);
+ mf = this->Makefiles[0];
}
else
{
- lg = static_cast<cmLocalUnixMakefileGenerator3 *>
- (this->MakeLocalGenerator());
+ cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
+ mf = new cmMakefile(this, snapshot);
// set the Start directories
- lg->GetMakefile()->SetCurrentSourceDirectory
+ mf->SetCurrentSourceDirectory
(this->CMakeInstance->GetHomeDirectory());
- lg->GetMakefile()->SetCurrentBinaryDirectory
+ mf->SetCurrentBinaryDirectory
(this->CMakeInstance->GetHomeOutputDirectory());
}
@@ -600,12 +598,13 @@ void cmGlobalUnixMakefileGenerator3
{
tname += "/fast";
}
- tname = lg->Convert(tname,cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter conv(mf->GetStateSnapshot());
+ tname = conv.Convert(tname,cmOutputConverter::HOME_OUTPUT);
cmSystemTools::ConvertToOutputSlashes(tname);
makeCommand.push_back(tname);
- if (this->LocalGenerators.empty())
+ if (this->Makefiles.empty())
{
- delete lg;
+ delete mf;
}
}
}
@@ -917,6 +916,60 @@ cmGlobalUnixMakefileGenerator3
}
}
+// Build a map that contains a the set of targets used by each local
+// generator directory level.
+void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
+{
+ this->DirectoryTargetsMap.clear();
+ // Loop over all targets in all local generators.
+ for(std::vector<cmLocalGenerator*>::const_iterator
+ lgi = this->LocalGenerators.begin();
+ lgi != this->LocalGenerators.end(); ++lgi)
+ {
+ cmLocalGenerator* lg = *lgi;
+ cmMakefile* mf = lg->GetMakefile();
+ cmTargets const& targets = mf->GetTargets();
+ for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
+ {
+ cmTarget const& target = t->second;
+
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
+
+ cmLocalGenerator* tlg = gt->GetLocalGenerator();
+
+ if(gt->GetType() == cmTarget::INTERFACE_LIBRARY
+ || gt->Target->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+ {
+ continue;
+ }
+
+ cmState::Snapshot csnp = lg->GetStateSnapshot();
+ cmState::Snapshot tsnp = tlg->GetStateSnapshot();
+
+ // Consider the directory containing the target and all its
+ // parents until something excludes the target.
+ for( ; csnp.IsValid() && !this->IsExcluded(csnp, tsnp);
+ csnp = csnp.GetBuildsystemDirectoryParent())
+ {
+ // This local generator includes the target.
+ std::set<cmGeneratorTarget const*>& targetSet =
+ this->DirectoryTargetsMap[csnp];
+ targetSet.insert(gt);
+
+ // Add dependencies of the included target. An excluded
+ // target may still be included if it is a dependency of a
+ // non-excluded target.
+ TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(gt);
+ for(TargetDependSet::const_iterator ti = tgtdeps.begin();
+ ti != tgtdeps.end(); ++ti)
+ {
+ targetSet.insert(*ti);
+ }
+ }
+ }
+ }
+}
+
//----------------------------------------------------------------------------
size_t
cmGlobalUnixMakefileGenerator3
@@ -949,7 +1002,7 @@ cmGlobalUnixMakefileGenerator3
size_t count = 0;
std::set<cmGeneratorTarget const*> emitted;
std::set<cmGeneratorTarget const*> const& targets
- = this->LocalGeneratorToTargetMap[lg];
+ = this->DirectoryTargetsMap[lg->GetStateSnapshot()];
for(std::set<cmGeneratorTarget const*>::const_iterator t = targets.begin();
t != targets.end(); ++t)
{
@@ -1091,7 +1144,8 @@ bool cmGlobalUnixMakefileGenerator3
::NeedRequiresStep(cmTarget const& target)
{
std::set<std::string> languages;
- target.GetLanguages(languages,
+ cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&target);
+ gtgt->GetLanguages(languages,
target.GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index fc53fa8..5f39c79 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -67,9 +67,7 @@ public:
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
- ///! Create a local generator appropriate to this Global Generator3
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library
@@ -206,6 +204,11 @@ protected:
private:
virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; }
virtual std::string GetEditCacheCommand() const;
+
+ std::map<cmState::Snapshot,
+ std::set<cmGeneratorTarget const*>,
+ cmState::Snapshot::StrictWeakOrder> DirectoryTargetsMap;
+ virtual void InitializeProgressMarks();
};
#endif
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 8ec4fd9..44d632d 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -306,11 +306,10 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
}
///! Create a local generator appropriate to this Global Generator
-cmLocalGenerator *
-cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator(
+ cmMakefile* mf)
{
- return new cmLocalVisualStudio10Generator(this, parent, snapshot);
+ return new cmLocalVisualStudio10Generator(this, mf);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 3d34a3f..8de7b09 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -48,8 +48,7 @@ public:
virtual bool Compute();
///! create the correct local generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index b50f4c9..9499d80 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -34,9 +34,12 @@ protected:
virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
+ // Used to verify that the Desktop toolset for the current generator is
+ // installed on the machine.
+ virtual bool IsWindowsDesktopToolsetInstalled() const;
+
// These aren't virtual because we need to check if the selected version
// of the toolset is installed
- bool IsWindowsDesktopToolsetInstalled() const;
bool IsWindowsPhoneToolsetInstalled() const;
bool IsWindowsStoreToolsetInstalled() const;
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index bce9e0c..a7939aa 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -38,9 +38,12 @@ protected:
virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
+ // Used to verify that the Desktop toolset for the current generator is
+ // installed on the machine.
+ virtual bool IsWindowsDesktopToolsetInstalled() const;
+
// These aren't virtual because we need to check if the selected version
// of the toolset is installed
- bool IsWindowsDesktopToolsetInstalled() const;
bool IsWindowsPhoneToolsetInstalled() const;
bool IsWindowsStoreToolsetInstalled() const;
virtual const char* GetIDEVersion() { return "12.0"; }
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 2cf55d4..d73eedf 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -124,3 +124,16 @@ void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout)
fout << "# Visual Studio 14\n";
}
}
+
+//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio14Generator::IsWindowsDesktopToolsetInstalled() const
+{
+ const char desktop10Key[] =
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "VisualStudio\\14.0\\VC\\Runtimes";
+
+ std::vector<std::string> vc14;
+ return cmSystemTools::GetRegistrySubKeys(desktop10Key,
+ vc14, cmSystemTools::KeyWOW64_32);
+}
diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h
index aa817be..02c6274 100644
--- a/Source/cmGlobalVisualStudio14Generator.h
+++ b/Source/cmGlobalVisualStudio14Generator.h
@@ -31,6 +31,11 @@ public:
virtual const char* GetToolsVersion() { return "14.0"; }
protected:
virtual const char* GetIDEVersion() { return "14.0"; }
+
+ // Used to verify that the Desktop toolset for the current generator is
+ // installed on the machine.
+ virtual bool IsWindowsDesktopToolsetInstalled() const;
+
private:
class Factory;
};
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 65a15ee..14de698 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -173,10 +173,9 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
-cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmMakefile* mf)
{
- return new cmLocalVisualStudio6Generator(this, parent, snapshot);
+ return new cmLocalVisualStudio6Generator(this, mf);
}
@@ -218,7 +217,7 @@ void cmGlobalVisualStudio6Generator
TargetDependSet projectTargets;
TargetDependSet originalTargets;
this->GetTargetSets(projectTargets, originalTargets, root, generators);
- OrderedTargetDependSet orderedProjectTargets(projectTargets);
+ OrderedTargetDependSet orderedProjectTargets(projectTargets, "ALL_BUILD");
for(OrderedTargetDependSet::const_iterator
tt = orderedProjectTargets.begin();
@@ -255,7 +254,7 @@ void cmGlobalVisualStudio6Generator
::OutputDSWFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
- if(generators.size() == 0)
+ if(generators.empty())
{
return;
}
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 2460158..e9b24ea 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -39,8 +39,7 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library
@@ -85,8 +84,6 @@ public:
virtual void FindMakeProgram(cmMakefile*);
- virtual bool IsForVS6() const { return true; }
-
protected:
virtual void Generate();
virtual const char* GetIDEVersion() { return "6.0"; }
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 1ab4c9c..b913afc 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -94,7 +94,7 @@ void cmGlobalVisualStudio71Generator
TargetDependSet projectTargets;
TargetDependSet originalTargets;
this->GetTargetSets(projectTargets, originalTargets, root, generators);
- OrderedTargetDependSet orderedProjectTargets(projectTargets);
+ OrderedTargetDependSet orderedProjectTargets(projectTargets, "ALL_BUILD");
this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
@@ -212,7 +212,7 @@ cmGlobalVisualStudio71Generator
{
const char* name = di->c_str();
std::string guid = this->GetGUID(name);
- if(guid.size() == 0)
+ if(guid.empty())
{
std::string m = "Target: ";
m += target.GetName();
@@ -250,7 +250,7 @@ void cmGlobalVisualStudio71Generator
std::set<std::string>::const_iterator it;
for(it = depends.begin(); it != depends.end(); ++it)
{
- if(it->size() > 0)
+ if(!it->empty())
{
fout << "\t\t{"
<< this->GetGUID(it->c_str())
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index f8d882c..05da022 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -279,12 +279,11 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
}
///! Create a local generator appropriate to this Global Generator
-cmLocalGenerator *
-cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator(
+ cmMakefile* mf)
{
cmLocalVisualStudio7Generator *lg =
- new cmLocalVisualStudio7Generator(this, parent, snapshot);
+ new cmLocalVisualStudio7Generator(this, mf);
return lg;
}
@@ -359,7 +358,7 @@ void cmGlobalVisualStudio7Generator
::OutputSLNFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
- if(generators.size() == 0)
+ if(generators.empty())
{
return;
}
@@ -569,7 +568,7 @@ void cmGlobalVisualStudio7Generator
TargetDependSet projectTargets;
TargetDependSet originalTargets;
this->GetTargetSets(projectTargets, originalTargets, root, generators);
- OrderedTargetDependSet orderedProjectTargets(projectTargets);
+ OrderedTargetDependSet orderedProjectTargets(projectTargets, "ALL_BUILD");
this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
@@ -736,7 +735,7 @@ cmGlobalVisualStudio7Generator
{
const char* name = di->c_str();
std::string guid = this->GetGUID(name);
- if(guid.size() == 0)
+ if(guid.empty())
{
std::string m = "Target: ";
m += target.GetName();
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 931ac9c..35575d1 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -43,8 +43,7 @@ public:
std::string const& GetPlatformName() const;
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 51dcab0..70c00e9 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -254,7 +254,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
no_working_directory, no_depends,
noCommandLines);
- tgt->Compute();
+
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
mf->AddGeneratorTarget(tgt, gt);
@@ -449,7 +449,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends(
{
cmGeneratorTarget* gt = this->GetGeneratorTarget(&t);
TargetDependSet const& unordered = this->GetTargetDirectDepends(gt);
- OrderedTargetDependSet depends(unordered);
+ OrderedTargetDependSet depends(unordered, std::string());
for(OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
{
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index c38a35a..e7cc8ff 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -81,7 +81,7 @@ bool cmGlobalVisualStudioGenerator::Compute()
{
std::vector<cmLocalGenerator*>& gen = it->second;
// add the ALL_BUILD to the first local generator of each project
- if(gen.size())
+ if(!gen.empty())
{
// Use no actual command lines so that the target itself is not
// considered always out of date.
@@ -90,7 +90,7 @@ bool cmGlobalVisualStudioGenerator::Compute()
AddUtilityCommand("ALL_BUILD", true, no_working_dir,
no_depends, no_commands, false,
"Build all projects");
- allBuild->Compute();
+
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt);
@@ -265,7 +265,7 @@ cmGlobalVisualStudioGenerator
{
std::vector<std::string> filenames;
this->GetFilesReplacedDuringGenerate(filenames);
- if (filenames.size() > 0)
+ if (!filenames.empty())
{
// Convert vector to semi-colon delimited string of filenames:
std::string projects;
@@ -836,17 +836,19 @@ void RegisterVisualStudioMacros(const std::string& macrosFile,
bool
cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target)
{
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
+
// check to see if this is a fortran build
std::set<std::string> languages;
{
// Issue diagnostic if the source files depend on the config.
std::vector<cmSourceFile*> sources;
- if (!target.GetConfigCommonSourceFiles(sources))
+ if (!gt->GetConfigCommonSourceFiles(sources))
{
return false;
}
}
- target.GetLanguages(languages, "");
+ gt->GetLanguages(languages, "");
if(languages.size() == 1)
{
if(*languages.begin() == "Fortran")
@@ -862,28 +864,34 @@ bool
cmGlobalVisualStudioGenerator::TargetCompare
::operator()(cmGeneratorTarget const* l, cmGeneratorTarget const* r) const
{
- // Make sure ALL_BUILD is first so it is the default active project.
- if(r->GetName() == "ALL_BUILD")
+ // Make sure a given named target is ordered first,
+ // e.g. to set ALL_BUILD as the default active project.
+ // When the empty string is named this is a no-op.
+ if (r->GetName() == this->First)
{
return false;
}
- if(l->GetName() == "ALL_BUILD")
+ if (l->GetName() == this->First)
{
return true;
}
- return strcmp(l->GetName().c_str(), r->GetName().c_str()) < 0;
+ return l->GetName() < r->GetName();
}
//----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::OrderedTargetDependSet
-::OrderedTargetDependSet(TargetDependSet const& targets)
+::OrderedTargetDependSet(TargetDependSet const& targets,
+ std::string const& first):
+ derived(TargetCompare(first))
{
this->insert(targets.begin(), targets.end());
}
//----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::OrderedTargetDependSet
-::OrderedTargetDependSet(TargetSet const& targets)
+::OrderedTargetDependSet(TargetSet const& targets,
+ std::string const& first):
+ derived(TargetCompare(first))
{
for (TargetSet::const_iterator it = targets.begin();
it != targets.end(); ++it)
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 64440ad..c940eb3 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -89,8 +89,11 @@ public:
virtual bool TargetsWindowsCE() const { return false; }
class TargetSet: public std::set<cmTarget const*> {};
- struct TargetCompare
+ class TargetCompare
{
+ std::string First;
+ public:
+ TargetCompare(std::string const& first): First(first) {}
bool operator()(cmGeneratorTarget const* l,
cmGeneratorTarget const* r) const;
};
@@ -151,11 +154,14 @@ class cmGlobalVisualStudioGenerator::OrderedTargetDependSet:
public std::multiset<cmTargetDepend,
cmGlobalVisualStudioGenerator::TargetCompare>
{
+ typedef std::multiset<cmTargetDepend,
+ cmGlobalVisualStudioGenerator::TargetCompare>
+ derived;
public:
typedef cmGlobalGenerator::TargetDependSet TargetDependSet;
typedef cmGlobalVisualStudioGenerator::TargetSet TargetSet;
- OrderedTargetDependSet(TargetDependSet const&);
- OrderedTargetDependSet(TargetSet const&);
+ OrderedTargetDependSet(TargetDependSet const&, std::string const& first);
+ OrderedTargetDependSet(TargetSet const&, std::string const& first);
};
#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 39933cb..33babec 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -371,10 +371,9 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
//----------------------------------------------------------------------------
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
-cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmGlobalXCodeGenerator::CreateLocalGenerator(cmMakefile* mf)
{
- return new cmLocalXCodeGenerator(this, parent, snapshot);
+ return new cmLocalXCodeGenerator(this, mf);
}
//----------------------------------------------------------------------------
@@ -463,7 +462,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmTarget* allbuild = mf->AddUtilityCommand("ALL_BUILD", true, no_depends,
no_working_directory,
"echo", "Build all projects");
- allbuild->Compute();
+
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
mf->AddGeneratorTarget(allbuild, allBuildGt);
@@ -498,7 +497,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
true, no_depends,
no_working_directory,
"make", "-f", file.c_str());
- check->Compute();
+
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
mf->AddGeneratorTarget(check, checkGt);
}
@@ -772,7 +771,7 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
sf->GetProperty("COMPILE_DEFINITIONS"), true);
if (!flagsBuild.IsEmpty())
{
- if (flags.size())
+ if (!flags.empty())
{
flags += ' ';
}
@@ -1124,7 +1123,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
// organize the sources
std::vector<cmSourceFile*> classes;
- if (!cmtarget.GetConfigCommonSourceFiles(classes))
+ if (!gtgt->GetConfigCommonSourceFiles(classes))
{
return false;
}
@@ -1383,8 +1382,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
if(llang.empty()) { return; }
// If the language is compiled as a source trust Xcode to link with it.
- cmTarget::LinkImplementation const* impl =
- cmtarget.GetLinkImplementation("NOCONFIG");
+ cmLinkImplementation const* impl =
+ gtgt->GetLinkImplementation("NOCONFIG");
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
li != impl->Languages.end(); ++li)
{
@@ -1505,7 +1504,8 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
}
std::vector<cmSourceFile*> classes;
- if (!cmtarget.GetConfigCommonSourceFiles(classes))
+ cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
+ if (!gtgt->GetConfigCommonSourceFiles(classes))
{
return;
}
@@ -1805,7 +1805,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// Compute the compilation flags for each language.
std::set<std::string> languages;
- target.GetLanguages(languages, configName);
+ cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
+ gtgt->GetLanguages(languages, configName);
std::map<std::string, std::string> cflags;
for (std::set<std::string>::iterator li = languages.begin();
li != languages.end(); ++li)
@@ -1827,7 +1828,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
AddCompileOptions(flags, &target, lang, configName);
}
- cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
std::string llang = gtgt->GetLinkerLanguage(configName);
if(binary && llang.empty())
{
@@ -1855,7 +1855,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->AppendDefines(ppDefs, exportMacro);
}
std::vector<std::string> targetDefines;
- target.GetCompileDefinitions(targetDefines, configName, "C");
+ gtgt->GetCompileDefinitions(targetDefines, configName, "C");
this->AppendDefines(ppDefs, targetDefines);
buildSettings->AddAttribute
("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList());
@@ -1874,7 +1874,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
extraLinkOptionsVar = "CMAKE_MODULE_LINKER_FLAGS";
}
- if(extraLinkOptionsVar.size())
+ if(!extraLinkOptionsVar.empty())
{
this->CurrentLocalGenerator
->AddConfigVariableFlags(extraLinkOptions,
@@ -2557,7 +2557,8 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
if(cmtarget.GetType() == cmTarget::UTILITY)
{
std::vector<cmSourceFile*> sources;
- if (!cmtarget.GetConfigCommonSourceFiles(sources))
+ cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
+ if (!gtgt->GetConfigCommonSourceFiles(sources))
{
return 0;
}
@@ -2614,7 +2615,7 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
config->SetComment(configVector[i].c_str());
config->AddAttribute("buildSettings", buildSettings);
}
- if(configVector.size())
+ if(!configVector.empty())
{
configlist->AddAttribute("defaultConfigurationName",
this->CreateString(configVector[0].c_str()));
@@ -3085,7 +3086,8 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
}
std::vector<cmSourceFile*> classes;
- if (!cmtarget.GetConfigCommonSourceFiles(classes))
+ cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
+ if (!gtgt->GetConfigCommonSourceFiles(classes))
{
return false;
}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index ee8bf2c..102c036 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -41,8 +41,7 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile *mf);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index fa29b4f..2023697 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -68,8 +68,9 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator ggi(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(ggi.MakeLocalGenerator());
- cmMakefile *mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(
+ new cmMakefile(&ggi, cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator(mf.get()));
const char* inFileName = settingsFileName;
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index f548f5d..333c2ff 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -42,7 +42,7 @@ static cmInstallFilesGenerator* CreateInstallFilesGenerator(
{
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(mf);
- return new cmInstallFilesGenerator(mf,
+ return new cmInstallFilesGenerator(
absFiles, args.GetDestination().c_str(),
programs, args.GetPermissions().c_str(),
args.GetConfigurations(), args.GetComponent().c_str(),
@@ -1406,7 +1406,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
ica.GetDestination().c_str(),
ica.GetPermissions().c_str(), ica.GetConfigurations(),
ica.GetComponent().c_str(), message, fname.c_str(),
- name_space.GetCString(), exportOld.IsEnabled(), this->Makefile);
+ name_space.GetCString(), exportOld.IsEnabled());
this->Makefile->AddInstallGenerator(exportGenerator);
return true;
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 7593380..78cb5f0 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -12,6 +12,8 @@
#include "cmInstallDirectoryGenerator.h"
#include "cmTarget.h"
+#include "cmGeneratorExpression.h"
+#include "cmLocalGenerator.h"
//----------------------------------------------------------------------------
cmInstallDirectoryGenerator
@@ -25,10 +27,16 @@ cmInstallDirectoryGenerator
const char* literal_args,
bool optional):
cmInstallGenerator(dest, configurations, component, message),
+ LocalGenerator(0),
Directories(dirs),
FilePermissions(file_permissions), DirPermissions(dir_permissions),
LiteralArguments(literal_args), Optional(optional)
{
+ // We need per-config actions if destination have generator expressions.
+ if(cmGeneratorExpression::Find(Destination) != std::string::npos)
+ {
+ this->ActionsPerConfig = true;
+ }
}
//----------------------------------------------------------------------------
@@ -37,15 +45,43 @@ cmInstallDirectoryGenerator
{
}
+void cmInstallDirectoryGenerator::Compute(cmLocalGenerator* lg)
+{
+ LocalGenerator = lg;
+}
+
//----------------------------------------------------------------------------
void
cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
Indent const& indent)
{
+ if(this->ActionsPerConfig)
+ {
+ this->cmInstallGenerator::GenerateScriptActions(os, indent);
+ }
+ else
+ {
+ this->AddDirectoryInstallRule(os, "", indent);
+ }
+}
+
+void cmInstallDirectoryGenerator::GenerateScriptForConfig(
+ std::ostream& os,
+ const std::string& config,
+ Indent const& indent)
+{
+ this->AddDirectoryInstallRule(os, config, indent);
+}
+
+void cmInstallDirectoryGenerator::AddDirectoryInstallRule(
+ std::ostream& os,
+ const std::string& config,
+ Indent const& indent)
+{
// Write code to install the directories.
const char* no_rename = 0;
this->AddInstallRule(os,
- this->Destination,
+ this->GetDestination(config),
cmInstallType_DIRECTORY,
this->Directories,
this->Optional,
@@ -54,3 +90,12 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
no_rename, this->LiteralArguments.c_str(),
indent);
}
+
+//----------------------------------------------------------------------------
+std::string
+cmInstallDirectoryGenerator::GetDestination(std::string const& config) const
+{
+ cmGeneratorExpression ge;
+ return ge.Parse(this->Destination)
+ ->Evaluate(this->LocalGenerator->GetMakefile(), config);
+}
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
index 165ab91..04107e1 100644
--- a/Source/cmInstallDirectoryGenerator.h
+++ b/Source/cmInstallDirectoryGenerator.h
@@ -31,8 +31,19 @@ public:
bool optional = false);
virtual ~cmInstallDirectoryGenerator();
+ void Compute(cmLocalGenerator* lg);
+
+ std::string GetDestination(std::string const& config) const;
+
protected:
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
+ virtual void GenerateScriptForConfig(std::ostream& os,
+ const std::string& config,
+ Indent const& indent);
+ void AddDirectoryInstallRule(std::ostream& os,
+ const std::string& config,
+ Indent const& indent);
+ cmLocalGenerator* LocalGenerator;
std::vector<std::string> Directories;
std::string FilePermissions;
std::string DirPermissions;
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 7f6aa4d..97b9405 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -34,15 +34,14 @@ cmInstallExportGenerator::cmInstallExportGenerator(
const char* component,
MessageLevel message,
const char* filename, const char* name_space,
- bool exportOld,
- cmMakefile* mf)
+ bool exportOld)
:cmInstallGenerator(destination, configurations, component, message)
,ExportSet(exportSet)
,FilePermissions(file_permissions)
,FileName(filename)
,Namespace(name_space)
,ExportOld(exportOld)
- ,Makefile(mf)
+ ,LocalGenerator(0)
{
this->EFGen = new cmExportInstallFileGenerator(this);
exportSet->AddInstallation(this);
@@ -54,12 +53,18 @@ cmInstallExportGenerator::~cmInstallExportGenerator()
delete this->EFGen;
}
+void cmInstallExportGenerator::Compute(cmLocalGenerator* lg)
+{
+ this->LocalGenerator = lg;
+}
+
//----------------------------------------------------------------------------
void cmInstallExportGenerator::ComputeTempDir()
{
// Choose a temporary directory in which to generate the import
// files to be installed.
- this->TempDir = this->Makefile->GetCurrentBinaryDirectory();
+ this->TempDir =
+ this->LocalGenerator->GetMakefile()->GetCurrentBinaryDirectory();
this->TempDir += cmake::GetCMakeFilesDirectory();
this->TempDir += "/Export";
if(this->Destination.empty())
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index 3e078f2..885ed05 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -32,12 +32,14 @@ public:
const char* component,
MessageLevel message,
const char* filename, const char* name_space,
- bool exportOld, cmMakefile* mf);
+ bool exportOld);
~cmInstallExportGenerator();
cmExportSet* GetExportSet() {return this->ExportSet;}
- cmMakefile* GetMakefile() const { return this->Makefile; }
+ void Compute(cmLocalGenerator* lg);
+
+ cmLocalGenerator* GetLocalGenerator() const { return this->LocalGenerator; }
const std::string& GetNamespace() const { return this->Namespace; }
@@ -57,7 +59,7 @@ protected:
std::string FileName;
std::string Namespace;
bool ExportOld;
- cmMakefile* Makefile;
+ cmLocalGenerator* LocalGenerator;
std::string TempDir;
std::string MainImportFile;
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 508c373..68557bd 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -128,7 +128,7 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(this->Makefile);
this->Makefile->AddInstallGenerator(
- new cmInstallFilesGenerator(this->Makefile, this->Files,
+ new cmInstallFilesGenerator(this->Files,
destination.c_str(), false,
no_permissions, no_configurations,
no_component.c_str(), message, no_rename));
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index ff2c6e5..e2c16c8 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -14,11 +14,11 @@
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
+#include "cmLocalGenerator.h"
//----------------------------------------------------------------------------
cmInstallFilesGenerator
-::cmInstallFilesGenerator(cmMakefile* mf,
- std::vector<std::string> const& files,
+::cmInstallFilesGenerator(std::vector<std::string> const& files,
const char* dest, bool programs,
const char* file_permissions,
std::vector<std::string> const& configurations,
@@ -27,13 +27,19 @@ cmInstallFilesGenerator
const char* rename,
bool optional):
cmInstallGenerator(dest, configurations, component, message),
- Makefile(mf),
+ LocalGenerator(0),
Files(files),
FilePermissions(file_permissions),
Rename(rename),
Programs(programs),
Optional(optional)
{
+ // We need per-config actions if the destination has generator expressions.
+ if(cmGeneratorExpression::Find(Destination) != std::string::npos)
+ {
+ this->ActionsPerConfig = true;
+ }
+
// We need per-config actions if any files have generator expressions.
for(std::vector<std::string>::const_iterator i = files.begin();
!this->ActionsPerConfig && i != files.end(); ++i)
@@ -51,15 +57,31 @@ cmInstallFilesGenerator
{
}
+void cmInstallFilesGenerator::Compute(cmLocalGenerator* lg)
+{
+ this->LocalGenerator = lg;
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmInstallFilesGenerator::GetDestination(std::string const& config) const
+{
+ cmGeneratorExpression ge;
+ return ge.Parse(this->Destination)
+ ->Evaluate(this->LocalGenerator->GetMakefile(), config);
+}
+
//----------------------------------------------------------------------------
void cmInstallFilesGenerator::AddFilesInstallRule(
- std::ostream& os, Indent const& indent,
+ std::ostream& os,
+ const std::string config,
+ Indent const& indent,
std::vector<std::string> const& files)
{
// Write code to install the files.
const char* no_dir_permissions = 0;
this->AddInstallRule(os,
- this->Destination,
+ this->GetDestination(config),
(this->Programs
? cmInstallType_PROGRAMS
: cmInstallType_FILES),
@@ -79,7 +101,7 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os,
}
else
{
- this->AddFilesInstallRule(os, indent, this->Files);
+ this->AddFilesInstallRule(os, "", indent, this->Files);
}
}
@@ -94,8 +116,8 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os,
i != this->Files.end(); ++i)
{
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i);
- cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, config),
- files);
+ cmSystemTools::ExpandListArgument(cge->Evaluate(
+ this->LocalGenerator->GetMakefile(), config), files);
}
- this->AddFilesInstallRule(os, indent, files);
+ this->AddFilesInstallRule(os, config, indent, files);
}
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index bf482d6..bfe4039 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -14,16 +14,13 @@
#include "cmInstallGenerator.h"
-class cmMakefile;
-
/** \class cmInstallFilesGenerator
* \brief Generate file installation rules.
*/
class cmInstallFilesGenerator: public cmInstallGenerator
{
public:
- cmInstallFilesGenerator(cmMakefile* mf,
- std::vector<std::string> const& files,
+ cmInstallFilesGenerator(std::vector<std::string> const& files,
const char* dest, bool programs,
const char* file_permissions,
std::vector<std::string> const& configurations,
@@ -33,15 +30,21 @@ public:
bool optional = false);
virtual ~cmInstallFilesGenerator();
+ void Compute(cmLocalGenerator* lg);
+
+ std::string GetDestination(std::string const& config) const;
+
protected:
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
virtual void GenerateScriptForConfig(std::ostream& os,
const std::string& config,
Indent const& indent);
- void AddFilesInstallRule(std::ostream& os, Indent const& indent,
+ void AddFilesInstallRule(std::ostream& os,
+ const std::string config,
+ Indent const& indent,
std::vector<std::string> const& files);
- cmMakefile* Makefile;
+ cmLocalGenerator* LocalGenerator;
std::vector<std::string> Files;
std::string FilePermissions;
std::string Rename;
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index be8096c..e6fbe88 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -91,7 +91,7 @@ void cmInstallProgramsCommand::FinalPass()
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(this->Makefile);
this->Makefile->AddInstallGenerator(
- new cmInstallFilesGenerator(this->Makefile, this->Files,
+ new cmInstallFilesGenerator(this->Files,
destination.c_str(), true,
no_permissions, no_configurations,
no_component.c_str(), message, no_rename));
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index a5427de..10dd465 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -56,4 +56,66 @@ struct cmLinkImplementationLibraries
std::vector<cmLinkItem> WrongConfigLibraries;
};
+struct cmLinkInterfaceLibraries
+{
+ // Libraries listed in the interface.
+ std::vector<cmLinkItem> Libraries;
+};
+
+struct cmLinkInterface: public cmLinkInterfaceLibraries
+{
+ // Languages whose runtime libraries must be linked.
+ std::vector<std::string> Languages;
+
+ // Shared library dependencies needed for linking on some platforms.
+ std::vector<cmLinkItem> SharedDeps;
+
+ // Number of repetitions of a strongly connected component of two
+ // or more static libraries.
+ int Multiplicity;
+
+ // Libraries listed for other configurations.
+ // Needed only for OLD behavior of CMP0003.
+ std::vector<cmLinkItem> WrongConfigLibraries;
+
+ bool ImplementationIsInterface;
+
+ cmLinkInterface(): Multiplicity(0), ImplementationIsInterface(false) {}
+};
+
+struct cmOptionalLinkInterface: public cmLinkInterface
+{
+ cmOptionalLinkInterface():
+ LibrariesDone(false), AllDone(false),
+ Exists(false), HadHeadSensitiveCondition(false),
+ ExplicitLibraries(0) {}
+ bool LibrariesDone;
+ bool AllDone;
+ bool Exists;
+ bool HadHeadSensitiveCondition;
+ const char* ExplicitLibraries;
+};
+
+struct cmHeadToLinkInterfaceMap:
+ public std::map<cmTarget const*, cmOptionalLinkInterface>
+{
+};
+
+struct cmLinkImplementation: public cmLinkImplementationLibraries
+{
+ // Languages whose runtime libraries must be linked.
+ std::vector<std::string> Languages;
+};
+
+// Cache link implementation computation from each configuration.
+struct cmOptionalLinkImplementation: public cmLinkImplementation
+{
+ cmOptionalLinkImplementation():
+ LibrariesDone(false), LanguagesDone(false),
+ HadHeadSensitiveCondition(false) {}
+ bool LibrariesDone;
+ bool LanguagesDone;
+ bool HadHeadSensitiveCondition;
+};
+
#endif
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
index 3bcb940..721a246 100644
--- a/Source/cmLinkedTree.h
+++ b/Source/cmLinkedTree.h
@@ -128,6 +128,13 @@ public:
}
return this->Position <= this->Tree->Data.size();
}
+
+ bool StrictWeakOrdered(iterator other) const
+ {
+ assert(this->Tree);
+ assert(this->Tree == other.Tree);
+ return this->Position < other.Position;
+ }
};
iterator Root() const
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 4583446..5a18e2f 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -14,9 +14,8 @@
#include "cmMakefile.h"
cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot):
- cmLocalGenerator(gg, parent, snapshot)
+ cmMakefile* mf):
+ cmLocalGenerator(gg, mf)
{
}
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index af94cda..6b4b1cd 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -22,9 +22,7 @@ class cmCommonTargetGenerator;
class cmLocalCommonGenerator: public cmLocalGenerator
{
public:
- cmLocalCommonGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
~cmLocalCommonGenerator();
std::string const& GetConfigName() { return this->ConfigName; }
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a831d88..f4de0f2 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -43,28 +43,23 @@
#endif
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmOutputConverter(snapshot), StateSnapshot(snapshot)
+ cmMakefile* makefile)
+ : cmOutputConverter(makefile->GetStateSnapshot()),
+ StateSnapshot(makefile->GetStateSnapshot())
{
- assert(snapshot.IsValid());
this->GlobalGenerator = gg;
- this->Parent = parent;
- if (parent)
- {
- parent->AddChild(this);
- }
- this->Makefile = new cmMakefile(this);
+ this->Makefile = makefile;
this->EmitUniversalBinaryFlags = true;
this->BackwardsCompatibility = 0;
this->BackwardsCompatibilityFinal = false;
+
+ this->ComputeObjectMaxPath();
}
cmLocalGenerator::~cmLocalGenerator()
{
- delete this->Makefile;
}
void cmLocalGenerator::IssueMessage(cmake::MessageType t,
@@ -196,20 +191,19 @@ void cmLocalGenerator::GenerateTestFiles()
for(std::vector<cmTestGenerator*>::const_iterator gi = testers.begin();
gi != testers.end(); ++gi)
{
+ (*gi)->Compute(this);
(*gi)->Generate(fout, config, configurationTypes);
}
- if (!this->Children.empty())
+ size_t i;
+ std::vector<cmState::Snapshot> children
+ = this->Makefile->GetStateSnapshot().GetChildren();
+ for(i = 0; i < children.size(); ++i)
{
- size_t i;
- for(i = 0; i < this->Children.size(); ++i)
- {
- // TODO: Use add_subdirectory instead?
- fout << "subdirs(";
- std::string outP =
- this->Children[i]->GetMakefile()->GetCurrentBinaryDirectory();
- fout << this->Convert(outP,START_OUTPUT);
- fout << ")" << std::endl;
- }
+ // TODO: Use add_subdirectory instead?
+ fout << "subdirs(";
+ std::string outP = children[i].GetDirectory().GetCurrentBinary();
+ fout << this->Convert(outP,START_OUTPUT);
+ fout << ")" << std::endl;
}
}
@@ -415,16 +409,18 @@ void cmLocalGenerator::GenerateInstallRules()
this->GenerateTargetInstallRules(fout, config, configurationTypes);
// Include install scripts from subdirectories.
- if(!this->Children.empty())
+ std::vector<cmState::Snapshot> children
+ = this->Makefile->GetStateSnapshot().GetChildren();
+ if(!children.empty())
{
fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
fout << " # Include the install script for each subdirectory.\n";
- for(std::vector<cmLocalGenerator*>::const_iterator
- ci = this->Children.begin(); ci != this->Children.end(); ++ci)
+ for(std::vector<cmState::Snapshot>::const_iterator
+ ci = children.begin(); ci != children.end(); ++ci)
{
- if(!(*ci)->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+ if(!ci->GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
- std::string odir = (*ci)->GetMakefile()->GetCurrentBinaryDirectory();
+ std::string odir = ci->GetDirectory().GetCurrentBinary();
cmSystemTools::ConvertToUnixSlashes(odir);
fout << " include(\"" << odir
<< "/cmake_install.cmake\")" << std::endl;
@@ -453,7 +449,7 @@ void cmLocalGenerator::GenerateInstallRules()
}
//----------------------------------------------------------------------------
-void cmLocalGenerator::GenerateTargetManifest()
+void cmLocalGenerator::ComputeTargetManifest()
{
// Collect the set of configuration types.
std::vector<std::string> configNames;
@@ -481,7 +477,7 @@ void cmLocalGenerator::GenerateTargetManifest()
ci != configNames.end(); ++ci)
{
const char* config = ci->c_str();
- target.GenerateTargetManifest(config);
+ target.ComputeTargetManifest(config);
}
}
}
@@ -493,7 +489,7 @@ cmState* cmLocalGenerator::GetState() const
cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const
{
- return this->StateSnapshot;
+ return this->Makefile->GetStateSnapshot();
}
// List of variables that are replaced when
@@ -531,6 +527,13 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
return replaceValues.LinkFlags;
}
}
+ if(replaceValues.Manifests)
+ {
+ if(variable == "MANIFESTS")
+ {
+ return replaceValues.Manifests;
+ }
+ }
if(replaceValues.Flags)
{
if(variable == "FLAGS")
@@ -1082,7 +1085,8 @@ void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
const std::string& lang)
{
std::vector<std::string> targetDefines;
- target->GetCompileDefinitions(targetDefines, config, lang);
+ cmGeneratorTarget* gtgt = this->GlobalGenerator->GetGeneratorTarget(target);
+ gtgt->GetCompileDefinitions(targetDefines, config, lang);
this->AppendDefines(defines, targetDefines);
}
@@ -1093,6 +1097,10 @@ void cmLocalGenerator::AddCompileOptions(
)
{
std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX";
+
+ cmGeneratorTarget* gtgt =
+ this->GlobalGenerator->GetGeneratorTarget(target);
+
if(const char* langFlagRegexStr =
this->Makefile->GetDefinition(langFlagRegexVar))
{
@@ -1103,7 +1111,7 @@ void cmLocalGenerator::AddCompileOptions(
{
cmSystemTools::ParseWindowsCommandLine(targetFlags, opts);
}
- target->GetCompileOptions(opts, config, lang);
+ gtgt->GetCompileOptions(opts, config, lang);
for(std::vector<std::string>::const_iterator i = opts.begin();
i != opts.end(); ++i)
{
@@ -1124,7 +1132,7 @@ void cmLocalGenerator::AddCompileOptions(
this->AppendFlags(flags, targetFlags);
}
std::vector<std::string> opts;
- target->GetCompileOptions(opts, config, lang);
+ gtgt->GetCompileOptions(opts, config, lang);
for(std::vector<std::string>::const_iterator i = opts.begin();
i != opts.end(); ++i)
{
@@ -1133,7 +1141,7 @@ void cmLocalGenerator::AddCompileOptions(
}
}
std::vector<std::string> features;
- target->GetCompileFeatures(features, config);
+ gtgt->GetCompileFeatures(features, config);
for(std::vector<std::string>::const_iterator it = features.begin();
it != features.end(); ++it)
{
@@ -1534,13 +1542,47 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
this->Makefile->GetSafeDefinition("CMAKE_LIBRARY_PATH_TERMINATOR");
// Flags to link an executable to shared libraries.
- std::string linkFlagsVar = "CMAKE_SHARED_LIBRARY_LINK_";
- linkFlagsVar += linkLanguage;
- linkFlagsVar += "_FLAGS";
if( tgt.GetType() == cmTarget::EXECUTABLE )
{
- linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar);
- linkLibs += " ";
+ bool add_shlib_flags = false;
+ switch(tgt.Target->GetPolicyStatusCMP0065())
+ {
+ case cmPolicies::WARN:
+ if(!tgt.GetPropertyAsBool("ENABLE_EXPORTS") &&
+ this->Makefile->PolicyOptionalWarningEnabled(
+ "CMAKE_POLICY_WARNING_CMP0065"))
+ {
+ std::ostringstream w;
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0065) << "\n"
+ "For compatibility with older versions of CMake, "
+ "additional flags may be added to export symbols on all "
+ "executables regardless of thier ENABLE_EXPORTS property.";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ }
+ case cmPolicies::OLD:
+ // OLD behavior is to always add the flags
+ add_shlib_flags = true;
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0065)
+ );
+ case cmPolicies::NEW:
+ // NEW behavior is to only add the flags if ENABLE_EXPORTS is on
+ add_shlib_flags = tgt.GetPropertyAsBool("ENABLE_EXPORTS");
+ break;
+ }
+
+ if(add_shlib_flags)
+ {
+ std::string linkFlagsVar = "CMAKE_SHARED_LIBRARY_LINK_";
+ linkFlagsVar += linkLanguage;
+ linkFlagsVar += "_FLAGS";
+ linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar);
+ linkLibs += " ";
+ }
}
// Append the framework search path flags.
@@ -2367,25 +2409,22 @@ void cmLocalGenerator::AppendFeatureOptions(
const char* cmLocalGenerator::GetFeature(const std::string& feature,
const std::string& config)
{
+ std::string featureName = feature;
// TODO: Define accumulation policy for features (prepend, append, replace).
// Currently we always replace.
if(!config.empty())
{
- std::string featureConfig = feature;
- featureConfig += "_";
- featureConfig += cmSystemTools::UpperCase(config);
- if(const char* value = this->Makefile->GetProperty(featureConfig))
+ featureName += "_";
+ featureName += cmSystemTools::UpperCase(config);
+ }
+ cmState::Snapshot snp = this->StateSnapshot;
+ while(snp.IsValid())
+ {
+ if(const char* value = snp.GetDirectory().GetProperty(featureName))
{
return value;
}
- }
- if(const char* value = this->Makefile->GetProperty(feature))
- {
- return value;
- }
- if(cmLocalGenerator* parent = this->GetParent())
- {
- return parent->GetFeature(feature, config);
+ snp = snp.GetBuildsystemDirectoryParent();
}
return 0;
}
@@ -2847,7 +2886,7 @@ cmIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility()
}
}
this->BackwardsCompatibility = CMake_VERSION_ENCODE(major, minor, patch);
- this->BackwardsCompatibilityFinal = this->Makefile->IsConfigured();
+ this->BackwardsCompatibilityFinal = true;
}
return this->BackwardsCompatibility;
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 1c18788..6ea414a 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -36,8 +36,7 @@ class cmCustomCommandGenerator;
class cmLocalGenerator : public cmOutputConverter
{
public:
- cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile);
virtual ~cmLocalGenerator();
/**
@@ -67,7 +66,7 @@ public:
/**
* Generate a manifest of target files that will be built.
*/
- void GenerateTargetManifest();
+ void ComputeTargetManifest();
///! Get the makefile for this generator
cmMakefile *GetMakefile() {
@@ -86,14 +85,6 @@ public:
cmState* GetState() const;
cmState::Snapshot GetStateSnapshot() const;
- ///! set/get the parent generator
- cmLocalGenerator* GetParent() const {return this->Parent;}
-
- ///! set/get the children
- void AddChild(cmLocalGenerator* g) { this->Children.push_back(g); }
- std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; }
-
-
void AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
const std::string&lang, const std::string& config);
@@ -228,6 +219,7 @@ public:
const char* TargetSOName;
const char* TargetInstallNameDir;
const char* LinkFlags;
+ const char* Manifests;
const char* LanguageCompileFlags;
const char* Defines;
const char* Includes;
@@ -308,7 +300,6 @@ public:
void CreateEvaluationFileOutputs(const std::string& config);
void ProcessEvaluationFiles(std::vector<std::string>& generatedFiles);
- void ComputeObjectMaxPath();
protected:
///! put all the libraries for a target on into the given stream
void OutputLinkLibraries(std::string& linkLibraries,
@@ -348,8 +339,6 @@ protected:
cmMakefile *Makefile;
cmState::Snapshot StateSnapshot;
cmGlobalGenerator *GlobalGenerator;
- cmLocalGenerator* Parent;
- std::vector<cmLocalGenerator*> Children;
std::map<std::string, std::string> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax;
std::set<std::string> ObjectMaxPathViolations;
@@ -370,6 +359,8 @@ private:
bool GetShouldUseOldFlags(bool shared, const std::string &lang) const;
void AddPositionIndependentFlags(std::string& flags, std::string const& l,
int targetType);
+
+ void ComputeObjectMaxPath();
};
#endif
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index 8e498dd..bac989f 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -17,9 +17,8 @@
#include "cmGeneratedFileStream.h"
cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmLocalGenerator(gg, parent, snapshot)
+ cmMakefile* mf)
+ : cmLocalGenerator(gg, mf)
{
}
diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h
index f52ef39..b6a9a33 100644
--- a/Source/cmLocalGhsMultiGenerator.h
+++ b/Source/cmLocalGhsMultiGenerator.h
@@ -25,8 +25,7 @@ class cmGeneratedFileStream;
class cmLocalGhsMultiGenerator : public cmLocalGenerator
{
public:
- cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalGhsMultiGenerator();
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index cfca418..7525bf2 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -23,9 +23,8 @@
#include <assert.h>
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmLocalCommonGenerator(gg, parent, snapshot)
+ cmMakefile* mf)
+ : cmLocalCommonGenerator(gg, mf)
, HomeRelativeOutputPath("")
{
this->TargetImplib = "$TARGET_IMPLIB";
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index d10be0c..8d3d49c 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -31,8 +31,7 @@ class cmake;
class cmLocalNinjaGenerator : public cmLocalCommonGenerator
{
public:
- cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalNinjaGenerator();
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index ce370bc..b131a63 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -80,9 +80,8 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
//----------------------------------------------------------------------------
cmLocalUnixMakefileGenerator3::
-cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmLocalCommonGenerator(gg, parent, snapshot)
+cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf)
+ : cmLocalCommonGenerator(gg, mf)
{
this->MakefileVariableSize = 0;
this->ColorMakefile = false;
@@ -1257,7 +1256,9 @@ cmLocalUnixMakefileGenerator3
{
// Get the set of source languages in the target.
std::set<std::string> languages;
- target.GetLanguages(languages,
+ cmGeneratorTarget *gtgt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
+ gtgt->GetLanguages(languages,
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
fout << "\n"
<< "# Per-language clean rules from dependency scanning.\n"
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 01ac01b..98f15e6 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -34,9 +34,7 @@ class cmSourceFile;
class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator
{
public:
- cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalUnixMakefileGenerator3();
virtual void ComputeHomeRelativeOutputPath();
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 9ded83a..b043b00 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -33,7 +33,7 @@ class cmVS10XMLParser : public cmXMLParser
virtual void StartElement(const std::string& name, const char**)
{
// once the GUID is found do nothing
- if(this->GUID.size())
+ if(!this->GUID.empty())
{
return;
}
@@ -62,10 +62,8 @@ class cmVS10XMLParser : public cmXMLParser
//----------------------------------------------------------------------------
cmLocalVisualStudio10Generator
-::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot):
- cmLocalVisualStudio7Generator(gg, parent, snapshot)
+::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf):
+ cmLocalVisualStudio7Generator(gg, mf)
{
}
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index c588aaf..e187590 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -25,9 +25,7 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudio10Generator();
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 29e1034..cc94cd4 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -24,10 +24,8 @@
#include <cmsys/FStream.hxx>
cmLocalVisualStudio6Generator
-::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot):
- cmLocalVisualStudioGenerator(gg, parent, snapshot)
+::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmMakefile* mf):
+ cmLocalVisualStudioGenerator(gg, mf)
{
}
@@ -305,9 +303,12 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
// We may be modifying the source groups temporarily, so make a copy.
std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
+
// get the classes from the source lists then add them to the groups
std::vector<cmSourceFile*> classes;
- if (!target.GetConfigCommonSourceFiles(classes))
+ if (!gt->GetConfigCommonSourceFiles(classes))
{
return;
}
@@ -984,11 +985,11 @@ void cmLocalVisualStudio6Generator
std::string libMultiLineDebugOptions;
std::string libMultiLineOptimizedOptions;
- if(libPath.size())
+ if(!libPath.empty())
{
std::string lpath =
this->ConvertToOutputFormat(libPath.c_str(), SHELL);
- if(lpath.size() == 0)
+ if(lpath.empty())
{
lpath = ".";
}
@@ -1017,11 +1018,11 @@ void cmLocalVisualStudio6Generator
libMultiLineOptionsForDebug += " \n";
}
}
- if(exePath.size())
+ if(!exePath.empty())
{
std::string lpath =
this->ConvertToOutputFormat(exePath.c_str(), SHELL);
- if(lpath.size() == 0)
+ if(lpath.empty())
{
lpath = ".";
}
@@ -1062,7 +1063,7 @@ void cmLocalVisualStudio6Generator
}
std::string lpath =
this->ConvertToOutputFormat(path.c_str(), SHELL);
- if(lpath.size() == 0)
+ if(lpath.empty())
{
lpath = ".";
}
@@ -1452,7 +1453,7 @@ void cmLocalVisualStudio6Generator
#ifdef CM_USE_OLD_VS6
// Compute link information for the target.
- if(extraLinkOptions.size())
+ if(!extraLinkOptions.empty())
{
libOptions += " ";
libOptions += extraLinkOptions;
@@ -1543,7 +1544,7 @@ void cmLocalVisualStudio6Generator
std::string line;
std::string libnameExports;
- if(exportSymbol.size())
+ if(!exportSymbol.empty())
{
libnameExports = "/D \"";
libnameExports += exportSymbol;
diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h
index a44e61d..828d252 100644
--- a/Source/cmLocalVisualStudio6Generator.h
+++ b/Source/cmLocalVisualStudio6Generator.h
@@ -29,9 +29,7 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudio6Generator();
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index a38a061..a4bce8a 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -53,10 +53,8 @@ static void cmConvertToWindowsSlash(std::string& s)
//----------------------------------------------------------------------------
cmLocalVisualStudio7Generator
-::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot):
- cmLocalVisualStudioGenerator(gg, parent, snapshot)
+::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf):
+ cmLocalVisualStudioGenerator(gg, mf)
{
this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);
}
@@ -763,7 +761,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.Parse(defineFlags.c_str());
targetOptions.ParseFinish();
std::vector<std::string> targetDefines;
- target.GetCompileDefinitions(targetDefines, configName, "CXX");
+ gt->GetCompileDefinitions(targetDefines, configName, "CXX");
targetOptions.AddDefines(targetDefines);
targetOptions.SetVerboseMakefile(
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
@@ -974,25 +972,43 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
fout << "\t\t\t\tProxyFileName=\"$(InputName)_p.c\"/>\n";
// end of <Tool Name=VCMIDLTool
- // Check if we need the FAT32 workaround.
+ // Add manifest tool settings.
if(targetBuilds && this->GetVersion() >= cmGlobalVisualStudioGenerator::VS8)
{
+ const char* manifestTool = "VCManifestTool";
+ if (this->FortranProject)
+ {
+ manifestTool = "VFManifestTool";
+ }
+ fout <<
+ "\t\t\t<Tool\n"
+ "\t\t\t\tName=\"" << manifestTool << "\"";
+
+ std::vector<cmSourceFile const*> manifest_srcs;
+ gt->GetManifests(manifest_srcs, configName);
+ if (!manifest_srcs.empty())
+ {
+ fout << "\n\t\t\t\tAdditionalManifestFiles=\"";
+ for (std::vector<cmSourceFile const*>::const_iterator
+ mi = manifest_srcs.begin(); mi != manifest_srcs.end(); ++mi)
+ {
+ std::string m = (*mi)->GetFullPath();
+ fout << this->ConvertToXMLOutputPath(m.c_str()) << ";";
+ }
+ fout << "\"";
+ }
+
+ // Check if we need the FAT32 workaround.
// Check the filesystem type where the target will be written.
- if(cmLVS6G_IsFAT(target.GetDirectory(configName).c_str()))
+ if (cmLVS6G_IsFAT(target.GetDirectory(configName).c_str()))
{
// Add a flag telling the manifest tool to use a workaround
// for FAT32 file systems, which can cause an empty manifest
// to be embedded into the resulting executable. See CMake
// bug #2617.
- const char* manifestTool = "VCManifestTool";
- if(this->FortranProject)
- {
- manifestTool = "VFManifestTool";
- }
- fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << manifestTool << "\"\n"
- << "\t\t\t\tUseFAT32Workaround=\"true\"\n"
- << "\t\t\t/>\n";
+ fout << "\n\t\t\t\tUseFAT32Workaround=\"true\"";
}
+ fout << "/>\n";
}
this->OutputTargetRules(fout, configName, target, libName);
@@ -1469,10 +1485,13 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
// We may be modifying the source groups temporarily, so make a copy.
std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
+
// get the classes from the source lists then add them to the groups
this->ModuleDefinitionFile = "";
std::vector<cmSourceFile*> classes;
- if (!target.GetConfigCommonSourceFiles(classes))
+ if (!gt->GetConfigCommonSourceFiles(classes))
{
return;
}
@@ -1514,8 +1533,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
{
// VS >= 8 support per-config source locations so we
// list object library content as external objects.
- cmGeneratorTarget* gt =
- this->GlobalGenerator->GetGeneratorTarget(&target);
std::vector<std::string> objs;
gt->UseObjectLibraries(objs, "");
if(!objs.empty())
@@ -2283,7 +2300,7 @@ public:
virtual void StartElement(const std::string& name, const char** atts)
{
// once the GUID is found do nothing
- if(this->GUID.size())
+ if(!this->GUID.empty())
{
return;
}
@@ -2331,7 +2348,7 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
cmVS7XMLParser parser;
parser.ParseFile(path);
// if we can not find a GUID then we will generate one later
- if(parser.GUID.size() == 0)
+ if(parser.GUID.empty())
{
return;
}
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 43f3af9..bc05a06 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -35,9 +35,7 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudio7Generator();
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index ca72939..c0072de 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -19,10 +19,8 @@
//----------------------------------------------------------------------------
cmLocalVisualStudioGenerator
-::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmLocalGenerator(gg, parent, snapshot)
+::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf)
+ : cmLocalGenerator(gg, mf)
{
}
@@ -57,7 +55,7 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
cmSourceFile const* sf = si->first;
std::string objectNameLower = cmSystemTools::LowerCase(
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()));
- objectNameLower += ".obj";
+ objectNameLower += this->GlobalGenerator->GetLanguageOutputExtension(*sf);
counts[objectNameLower] += 1;
}
@@ -70,7 +68,7 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
cmSourceFile const* sf = si->first;
std::string objectName =
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
- objectName += ".obj";
+ objectName += this->GlobalGenerator->GetLanguageOutputExtension(*sf);
if(counts[cmSystemTools::LowerCase(objectName)] > 1)
{
const_cast<cmGeneratorTarget*>(gt)->AddExplicitObjectName(sf);
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index d414651..071bfb3 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -31,9 +31,7 @@ class cmCustomCommandGenerator;
class cmLocalVisualStudioGenerator : public cmLocalGenerator
{
public:
- cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudioGenerator();
/** Construct a script from the given list of command lines. */
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 804dd7d..b19112d 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -16,9 +16,8 @@
//----------------------------------------------------------------------------
cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmLocalGenerator(gg, parent, snapshot)
+ cmMakefile* mf)
+ : cmLocalGenerator(gg, mf)
{
// the global generator does this, so do not
// put these flags into the language flags
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index 26fff9c..6d0926f 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -24,8 +24,8 @@ class cmLocalXCodeGenerator : public cmLocalGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalXCodeGenerator(cmGlobalGenerator* gg,
+ cmMakefile* mf);
virtual ~cmLocalXCodeGenerator();
virtual std::string GetTargetDirectory(cmTarget const& target) const;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 85bc493..6480667 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -16,7 +16,6 @@
#include "cmSourceFileLocation.h"
#include "cmSystemTools.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmCommands.h"
#include "cmState.h"
#include "cmOutputConverter.h"
@@ -31,7 +30,6 @@
#endif
#include "cmInstallGenerator.h"
#include "cmTestGenerator.h"
-#include "cmDefinitions.h"
#include "cmAlgorithms.h"
#include "cmake.h"
#include <stdlib.h> // required for atoi
@@ -44,105 +42,13 @@
#include <ctype.h> // for isspace
#include <assert.h>
-class cmMakefile::Internals
-{
-public:
- std::list<cmDefinitions> VarStack;
- bool IsSourceFileTryCompile;
-
- void PushDefinitions()
- {
- this->VarStack.push_back(cmDefinitions());
- }
-
- void InitializeDefinitions(cmMakefile* parent)
- {
- this->VarStack.back() =
- cmDefinitions::MakeClosure(parent->Internal->VarStack.rbegin(),
- parent->Internal->VarStack.rend());
- }
-
- const char* GetDefinition(std::string const& name)
- {
- return cmDefinitions::Get(name, this->VarStack.rbegin(),
- this->VarStack.rend());
- }
-
- bool IsInitialized(std::string const& name)
- {
- return cmDefinitions::HasKey(name, this->VarStack.rbegin(),
- this->VarStack.rend());
- }
-
- void SetDefinition(std::string const& name, std::string const& value)
- {
- this->VarStack.back().Set(name, value.c_str());
- }
-
- void RemoveDefinition(std::string const& name)
- {
- this->VarStack.back().Set(name, 0);
- }
-
- std::vector<std::string> UnusedKeys() const
- {
- return this->VarStack.back().UnusedKeys();
- }
-
- std::vector<std::string> ClosureKeys() const
- {
- return cmDefinitions::ClosureKeys(this->VarStack.rbegin(),
- this->VarStack.rend());
- }
-
- void PopDefinitions()
- {
- this->VarStack.pop_back();
- }
-
- bool RaiseScope(std::string const& var, const char* varDef, cmMakefile* mf)
- {
- std::list<cmDefinitions>::reverse_iterator it = this->VarStack.rbegin();
- assert(it != this->VarStack.rend());
- ++it;
- if(it == this->VarStack.rend())
- {
- cmLocalGenerator* plg = mf->LocalGenerator->GetParent();
- if(!plg)
- {
- return false;
- }
- // Update the definition in the parent directory top scope. This
- // directory's scope was initialized by the closure of the parent
- // scope, so we do not need to localize the definition first.
- cmMakefile* parent = plg->GetMakefile();
- if (varDef)
- {
- parent->AddDefinition(var, varDef);
- }
- else
- {
- parent->RemoveDefinition(var);
- }
- return true;
- }
- // First localize the definition in the current scope.
- cmDefinitions::Raise(var, this->VarStack.rbegin(), this->VarStack.rend());
-
- // Now update the definition in the parent scope.
- it->Set(var, varDef);
- return true;
- }
-};
-
// default is not to be building executables
-cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
- : Internal(new Internals),
- LocalGenerator(localGenerator),
- StateSnapshot(localGenerator->GetStateSnapshot())
+cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
+ cmState::Snapshot const& snapshot)
+ : GlobalGenerator(globalGenerator),
+ StateSnapshot(snapshot)
{
- this->Internal->PushDefinitions();
- this->Internal->IsSourceFileTryCompile = false;
+ this->IsSourceFileTryCompile = false;
// Initialize these first since AddDefaultDefinitions calls AddDefinition
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
@@ -1567,9 +1473,6 @@ void cmMakefile::AddLinkLibrary(const std::string& lib)
void cmMakefile::InitializeFromParent(cmMakefile* parent)
{
- // Initialize definitions with the closure of the parent scope.
- this->Internal->InitializeDefinitions(parent);
-
this->StateSnapshot.InitializeFromParent();
this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
@@ -1615,7 +1518,7 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
parent->GetProperty("LINK_DIRECTORIES"));
// the initial project name
- this->ProjectName = parent->ProjectName;
+ this->SetProjectName(parent->GetProjectName());
// Copy include regular expressions.
this->ComplainFileRegularExpression = parent->ComplainFileRegularExpression;
@@ -1634,8 +1537,6 @@ void cmMakefile::PushFunctionScope(std::string const& fileName,
fileName);
assert(this->StateSnapshot.IsValid());
- this->Internal->PushDefinitions();
-
this->PushLoopBlockBarrier();
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -1662,8 +1563,6 @@ void cmMakefile::PopFunctionScope(bool reportError)
this->PopLoopBlockBarrier();
this->CheckForUnusedVariables();
-
- this->Internal->PopDefinitions();
}
void cmMakefile::PushMacroScope(std::string const& fileName,
@@ -1854,13 +1753,8 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
this->ContextStack.back()->Name,
this->ContextStack.back()->Line);
- // create a new local generator and set its parent
- cmLocalGenerator *lg2 = this->GetGlobalGenerator()
- ->MakeLocalGenerator(newSnapshot, this->LocalGenerator);
- this->GetGlobalGenerator()->AddMakefile(lg2->GetMakefile());
- this->GetGlobalGenerator()->AddLocalGenerator(lg2);
-
- cmMakefile* subMf = lg2->GetMakefile();
+ cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot);
+ this->GetGlobalGenerator()->AddMakefile(subMf);
// set the subdirs start dirs
subMf->SetCurrentSourceDirectory(srcPath);
@@ -1967,7 +1861,7 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value)
{
this->LogUnused("changing definition", name);
}
- this->Internal->SetDefinition(name, value);
+ this->StateSnapshot.SetDefinition(name, value);
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
@@ -2030,7 +1924,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
this->GetState()->AddCacheEntry(name, haveVal ? val.c_str() : 0,
doc, type);
// if there was a definition then remove it
- this->Internal->RemoveDefinition(name);
+ this->StateSnapshot.RemoveDefinition(name);
}
@@ -2040,7 +1934,9 @@ void cmMakefile::AddDefinition(const std::string& name, bool value)
{
this->LogUnused("changing definition", name);
}
- this->Internal->SetDefinition(name, value ? "ON" : "OFF");
+
+ this->StateSnapshot.SetDefinition(name, value ? "ON" : "OFF");
+
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if ( vv )
@@ -2057,7 +1953,7 @@ void cmMakefile::CheckForUnusedVariables() const
{
return;
}
- const std::vector<std::string>& unused = this->Internal->UnusedKeys();
+ const std::vector<std::string>& unused = this->StateSnapshot.UnusedKeys();
std::vector<std::string>::const_iterator it = unused.begin();
for (; it != unused.end(); ++it)
{
@@ -2067,12 +1963,12 @@ void cmMakefile::CheckForUnusedVariables() const
void cmMakefile::MarkVariableAsUsed(const std::string& var)
{
- this->Internal->GetDefinition(var);
+ this->StateSnapshot.GetDefinition(var);
}
bool cmMakefile::VariableInitialized(const std::string& var) const
{
- return this->Internal->IsInitialized(var);
+ return this->StateSnapshot.IsInitialized(var);
}
void cmMakefile::LogUnused(const char* reason,
@@ -2120,7 +2016,7 @@ void cmMakefile::RemoveDefinition(const std::string& name)
{
this->LogUnused("unsetting", name);
}
- this->Internal->RemoveDefinition(name);
+ this->StateSnapshot.RemoveDefinition(name);
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if ( vv )
@@ -2136,11 +2032,15 @@ void cmMakefile::RemoveCacheDefinition(const std::string& name)
this->GetState()->RemoveCacheEntry(name);
}
-void cmMakefile::SetProjectName(const char* p)
+void cmMakefile::SetProjectName(std::string const& p)
{
- this->ProjectName = p;
+ this->StateSnapshot.SetProjectName(p);
}
+std::string cmMakefile::GetProjectName() const
+{
+ return this->StateSnapshot.GetProjectName();
+}
void cmMakefile::AddGlobalLinkInformation(const std::string& name,
cmTarget& target)
@@ -2171,7 +2071,8 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name,
if(std::find(this->LinkDirectories.begin(),
this->LinkDirectories.end(), newdir)
== this->LinkDirectories.end())
- {target.AddLinkDirectory(*j);
+ {
+ target.AddLinkDirectory(*j);
}
}
}
@@ -2428,7 +2329,8 @@ void cmMakefile::ExpandVariablesCMP0019()
l != this->Targets.end(); ++l)
{
cmTarget &t = l->second;
- if (t.GetType() == cmTarget::INTERFACE_LIBRARY)
+ if (t.GetType() == cmTarget::INTERFACE_LIBRARY
+ || t.GetType() == cmTarget::GLOBAL_TARGET)
{
continue;
}
@@ -2529,6 +2431,18 @@ bool cmMakefile::PlatformIs64Bit() const
return false;
}
+bool cmMakefile::PlatformIsAppleIos() const
+{
+ std::string sdkRoot;
+ sdkRoot = this->GetSafeDefinition("CMAKE_OSX_SYSROOT");
+ sdkRoot = cmSystemTools::LowerCase(sdkRoot);
+
+ return sdkRoot.find("iphoneos") == 0 ||
+ sdkRoot.find("/iphoneos") != std::string::npos ||
+ sdkRoot.find("iphonesimulator") == 0 ||
+ sdkRoot.find("/iphonesimulator") != std::string::npos;
+}
+
const char* cmMakefile::GetSONameFlag(const std::string& language) const
{
std::string name = "CMAKE_SHARED_LIBRARY_SONAME";
@@ -2586,7 +2500,7 @@ const char* cmMakefile::GetRequiredDefinition(const std::string& name) const
bool cmMakefile::IsDefinitionSet(const std::string& name) const
{
- const char* def = this->Internal->GetDefinition(name);
+ const char* def = this->StateSnapshot.GetDefinition(name);
if(!def)
{
def = this->GetState()->GetInitializedCacheValue(name);
@@ -2607,7 +2521,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
const char* cmMakefile::GetDefinition(const std::string& name) const
{
- const char* def = this->Internal->GetDefinition(name);
+ const char* def = this->StateSnapshot.GetDefinition(name);
if(!def)
{
def = this->GetState()->GetInitializedCacheValue(name);
@@ -2643,7 +2557,7 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const
std::vector<std::string> cmMakefile::GetDefinitions() const
{
- std::vector<std::string> res = this->Internal->ClosureKeys();
+ std::vector<std::string> res = this->StateSnapshot.ClosureKeys();
std::vector<std::string> cacheKeys = this->GetState()->GetCacheEntryKeys();
res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
std::sort(res.begin(), res.end());
@@ -3696,7 +3610,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
const std::vector<std::string> *cmakeArgs,
std::string& output)
{
- this->Internal->IsSourceFileTryCompile = fast;
+ this->IsSourceFileTryCompile = fast;
// does the binary directory exist ? If not create it...
if (!cmSystemTools::FileIsDirectory(bindir))
{
@@ -3721,7 +3635,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
"Internal CMake error, TryCompile bad GlobalGenerator");
// return to the original directory
cmSystemTools::ChangeDirectory(cwd);
- this->Internal->IsSourceFileTryCompile = false;
+ this->IsSourceFileTryCompile = false;
return 1;
}
cm.SetGlobalGenerator(gg);
@@ -3792,7 +3706,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
"Internal CMake error, TryCompile configure of cmake failed");
// return to the original directory
cmSystemTools::ChangeDirectory(cwd);
- this->Internal->IsSourceFileTryCompile = false;
+ this->IsSourceFileTryCompile = false;
return 1;
}
@@ -3802,7 +3716,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
"Internal CMake error, TryCompile generation of cmake failed");
// return to the original directory
cmSystemTools::ChangeDirectory(cwd);
- this->Internal->IsSourceFileTryCompile = false;
+ this->IsSourceFileTryCompile = false;
return 1;
}
@@ -3815,23 +3729,23 @@ int cmMakefile::TryCompile(const std::string& srcdir,
this);
cmSystemTools::ChangeDirectory(cwd);
- this->Internal->IsSourceFileTryCompile = false;
+ this->IsSourceFileTryCompile = false;
return ret;
}
bool cmMakefile::GetIsSourceFileTryCompile() const
{
- return this->Internal->IsSourceFileTryCompile;
+ return this->IsSourceFileTryCompile;
}
cmake *cmMakefile::GetCMakeInstance() const
{
- return this->GetGlobalGenerator()->GetCMakeInstance();
+ return this->GlobalGenerator->GetCMakeInstance();
}
cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const
{
- return this->LocalGenerator->GetGlobalGenerator();
+ return this->GlobalGenerator;
}
#ifdef CMAKE_BUILD_WITH_CMAKE
@@ -4155,148 +4069,28 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
void cmMakefile::SetProperty(const std::string& prop, const char* value)
{
- if (prop == "INCLUDE_DIRECTORIES")
- {
- if (!value)
- {
- this->StateSnapshot.GetDirectory().ClearIncludeDirectories();
- return;
- }
- cmListFileBacktrace lfbt = this->GetBacktrace();
- this->StateSnapshot.GetDirectory().SetIncludeDirectories(value, lfbt);
- return;
- }
- if (prop == "COMPILE_OPTIONS")
- {
- if (!value)
- {
- this->StateSnapshot.GetDirectory().ClearCompileOptions();
- return;
- }
- cmListFileBacktrace lfbt = this->GetBacktrace();
- this->StateSnapshot.GetDirectory().SetCompileOptions(value, lfbt);
- return;
- }
- if (prop == "COMPILE_DEFINITIONS")
- {
- if (!value)
- {
- this->StateSnapshot.GetDirectory().ClearCompileDefinitions();
- return;
- }
- cmListFileBacktrace lfbt = this->GetBacktrace();
- this->StateSnapshot.GetDirectory().SetCompileDefinitions(value, lfbt);
- return;
- }
-
- this->Properties.SetProperty(prop, value);
+ cmListFileBacktrace lfbt = this->GetBacktrace();
+ this->StateSnapshot.GetDirectory().SetProperty(prop, value, lfbt);
}
void cmMakefile::AppendProperty(const std::string& prop,
const char* value,
bool asString)
{
- if (prop == "INCLUDE_DIRECTORIES")
- {
- cmListFileBacktrace lfbt = this->GetBacktrace();
- this->StateSnapshot.GetDirectory().AppendIncludeDirectoriesEntry(value,
- lfbt);
- return;
- }
- if (prop == "COMPILE_OPTIONS")
- {
- cmListFileBacktrace lfbt = this->GetBacktrace();
- this->StateSnapshot.GetDirectory().AppendCompileOptionsEntry(value, lfbt);
- return;
- }
- if (prop == "COMPILE_DEFINITIONS")
- {
- cmListFileBacktrace lfbt = this->GetBacktrace();
- this->StateSnapshot.GetDirectory().AppendCompileDefinitionsEntry(value,
- lfbt);
- return;
- }
-
- this->Properties.AppendProperty(prop, value, asString);
+ cmListFileBacktrace lfbt = this->GetBacktrace();
+ this->StateSnapshot.GetDirectory().AppendProperty(prop, value,
+ asString, lfbt);
}
const char *cmMakefile::GetProperty(const std::string& prop) const
{
- const bool chain = this->GetState()->
- IsPropertyChained(prop, cmProperty::DIRECTORY);
- return this->GetProperty(prop, chain);
+ return this->StateSnapshot.GetDirectory().GetProperty(prop);
}
const char *cmMakefile::GetProperty(const std::string& prop,
bool chain) const
{
- // watch for specific properties
- static std::string output;
- output = "";
- if (prop == "PARENT_DIRECTORY")
- {
- cmState::Snapshot parent =
- this->StateSnapshot.GetBuildsystemDirectoryParent();
- if(parent.IsValid())
- {
- return parent.GetDirectory().GetCurrentSource();
- }
- return "";
- }
- else if (prop == "LISTFILE_STACK")
- {
- std::vector<std::string> listFiles;
- cmState::Snapshot snp = this->StateSnapshot;
- while (snp.IsValid())
- {
- listFiles.push_back(snp.GetExecutionListFile());
- snp = snp.GetCallStackParent();
- }
- std::reverse(listFiles.begin(), listFiles.end());
- output = cmJoin(listFiles, ";");
- return output.c_str();
- }
- else if ( prop == "CACHE_VARIABLES" )
- {
- output = cmJoin(this->GetState()->GetCacheEntryKeys(), ";");
- return output.c_str();
- }
- else if (prop == "VARIABLES")
- {
- output = cmJoin(this->GetDefinitions(), ";");
- return output.c_str();
- }
- else if (prop == "INCLUDE_DIRECTORIES")
- {
- output = cmJoin(this->StateSnapshot.GetDirectory()
- .GetIncludeDirectoriesEntries(), ";");
- return output.c_str();
- }
- else if (prop == "COMPILE_OPTIONS")
- {
- output = cmJoin(this->StateSnapshot.GetDirectory()
- .GetCompileOptionsEntries(), ";");
- return output.c_str();
- }
- else if (prop == "COMPILE_DEFINITIONS")
- {
- output = cmJoin(this->StateSnapshot.GetDirectory()
- .GetCompileDefinitionsEntries(), ";");
- return output.c_str();
- }
-
- const char *retVal = this->Properties.GetPropertyValue(prop);
- if (!retVal && chain)
- {
- if(this->LocalGenerator->GetParent())
- {
- return this->LocalGenerator->GetParent()->GetMakefile()->
- GetProperty(prop, chain);
- }
- return this->GetState()->GetGlobalProperty(prop);
- }
-
- return retVal;
+ return this->StateSnapshot.GetDirectory().GetProperty(prop, chain);
}
bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
@@ -4306,14 +4100,7 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
std::vector<std::string> cmMakefile::GetPropertyKeys() const
{
- std::vector<std::string> keys;
- keys.reserve(this->Properties.size());
- for(cmPropertyMap::const_iterator it = this->Properties.begin();
- it != this->Properties.end(); ++it)
- {
- keys.push_back(it->first);
- }
- return keys;
+ return this->StateSnapshot.GetDirectory().GetPropertyKeys();
}
cmTarget* cmMakefile::FindTarget(const std::string& name,
@@ -4422,8 +4209,17 @@ std::string cmMakefile::FormatListFileStack() const
void cmMakefile::PushScope()
{
- this->Internal->PushDefinitions();
-
+ std::string commandName;
+ long line = 0;
+ if (!this->ContextStack.empty())
+ {
+ commandName = this->ContextStack.back()->Name;
+ line = this->ContextStack.back()->Line;
+ }
+ this->StateSnapshot = this->GetState()->CreateVariableScopeSnapshot(
+ this->StateSnapshot,
+ commandName,
+ line);
this->PushLoopBlockBarrier();
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -4441,7 +4237,9 @@ void cmMakefile::PopScope()
this->CheckForUnusedVariables();
- this->Internal->PopDefinitions();
+ this->StateSnapshot =
+ this->GetState()->Pop(this->StateSnapshot);
+ assert(this->StateSnapshot.IsValid());
}
void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
@@ -4451,7 +4249,7 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
return;
}
- if (!this->Internal->RaiseScope(var, varDef, this))
+ if (!this->StateSnapshot.RaiseScope(var, varDef))
{
std::ostringstream m;
m << "Cannot set \"" << var << "\": current scope has no parent.";
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 1c4da00..3cf20a6 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -14,7 +14,6 @@
#include "cmExecutionStatus.h"
#include "cmListFileCache.h"
-#include "cmPropertyMap.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmNewLineStyle.h"
@@ -43,7 +42,6 @@
class cmFunctionBlocker;
class cmCommand;
class cmInstallGenerator;
-class cmLocalGenerator;
class cmMakeDepend;
class cmSourceFile;
class cmTest;
@@ -63,8 +61,6 @@ class cmGeneratorExpressionEvaluationFile;
*/
class cmMakefile
{
- class Internals;
- cmsys::auto_ptr<Internals> Internal;
public:
/* Mark a variable as used */
void MarkVariableAsUsed(const std::string& var);
@@ -74,7 +70,8 @@ public:
/**
* Construct an empty makefile.
*/
- cmMakefile(cmLocalGenerator* localGenerator);
+ cmMakefile(cmGlobalGenerator* globalGenerator,
+ const cmState::Snapshot& snapshot);
/**
* Destructor.
@@ -275,15 +272,12 @@ public:
/**
* Specify the name of the project for this build.
*/
- void SetProjectName(const char*);
+ void SetProjectName(std::string const& name);
/**
* Get the name of the project for this build.
*/
- const char* GetProjectName() const
- {
- return this->ProjectName.c_str();
- }
+ std::string GetProjectName() const;
/** Get the configurations to be generated. */
std::string GetConfigurations(std::vector<std::string>& configs,
@@ -490,6 +484,9 @@ public:
/** Return whether the target platform is 64-bit. */
bool PlatformIs64Bit() const;
+ /** Return whether the target platform is Apple iOS. */
+ bool PlatformIsAppleIos() const;
+
/** Retrieve soname flag for the specified language if supported */
const char* GetSONameFlag(const std::string& language) const;
@@ -811,8 +808,6 @@ protected:
mutable std::set<cmListFileContext> CMP0054ReportedIds;
- std::string ProjectName; // project name
-
// libraries, classes, and executables
mutable cmTargets Targets;
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -861,7 +856,7 @@ protected:
#endif
std::vector<cmCommand*> FinalPassCommands;
- cmLocalGenerator* LocalGenerator;
+ cmGlobalGenerator* GlobalGenerator;
bool IsFunctionBlocked(const cmListFileFunction& lff,
cmExecutionStatus &status);
@@ -900,8 +895,6 @@ private:
std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
- cmPropertyMap Properties;
-
std::vector<cmCommandContext const*> ContextStack;
std::vector<cmExecutionStatus*> ExecutionStatusStack;
friend class cmMakefileCall;
@@ -996,6 +989,7 @@ private:
bool CheckSystemVars;
bool CheckCMP0000;
bool Configured;
+ bool IsSourceFileTryCompile;
mutable bool SuppressWatches;
};
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index ccb0974..90f679e 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -353,6 +353,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
useResponseFileForObjects, buildObjs, depends,
useWatcomQuote);
+ std::string manifests = this->GetManifests();
+
cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_LINK";
vars.CMTarget = this->Target;
@@ -391,6 +393,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.LinkLibraries = linkLibs.c_str();
vars.Flags = flags.c_str();
vars.LinkFlags = linkFlags.c_str();
+ vars.Manifests = manifests.c_str();
+
// Expand placeholders in the commands.
this->LocalGenerator->TargetImplib = targetOutPathImport;
for(std::vector<std::string>::iterator i = real_link_commands.begin();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 2f995e8..cd387a0 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -616,6 +616,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
}
}
+ std::string manifests = this->GetManifests();
+
cmLocalGenerator::RuleVariables vars;
vars.TargetPDB = targetOutPathPDB.c_str();
@@ -660,6 +662,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
}
vars.LinkFlags = linkFlags.c_str();
+ vars.Manifests = manifests.c_str();
+
// Compute the directory portion of the install_name setting.
std::string install_name_dir;
if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 0b3df90..b278087 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -276,7 +276,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
{
// write language flags for target
std::set<std::string> languages;
- this->Target->GetLanguages(languages,
+ this->GeneratorTarget->GetLanguages(languages,
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
// put the compiler in the rules.make file so that if it changes
// things rebuild
@@ -1493,6 +1493,15 @@ void cmMakefileTargetGenerator
depends.push_back(this->ModuleDefinitionFile);
}
+ // Add a dependency on user-specified manifest files, if any.
+ std::vector<cmSourceFile const*> manifest_srcs;
+ this->GeneratorTarget->GetManifests(manifest_srcs, this->ConfigName);
+ for (std::vector<cmSourceFile const*>::iterator mi = manifest_srcs.begin();
+ mi != manifest_srcs.end(); ++mi)
+ {
+ depends.push_back((*mi)->GetFullPath());
+ }
+
// Add user-specified dependencies.
if(const char* linkDepends =
this->Target->GetProperty("LINK_DEPENDS"))
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index b855bea..7e7e600 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -237,6 +237,7 @@ cmNinjaNormalTargetGenerator
vars.Flags = "$FLAGS";
vars.LinkFlags = "$LINK_FLAGS";
+ vars.Manifests = "$MANIFESTS";
std::string langFlags;
if (targetType != cmTarget::EXECUTABLE)
@@ -509,6 +510,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["LINK_FLAGS"] = cmGlobalNinjaGenerator
::EncodeLiteral(vars["LINK_FLAGS"]);
+ vars["MANIFESTS"] = this->GetManifests();
+
vars["LINK_PATH"] = frameworkPath + linkPath;
// Compute architecture specific link flags. Yes, these go into a different
@@ -579,11 +582,12 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["TARGET_PDB"] = base + suffix + dbg_suffix;
}
+ const std::string objPath = GetTarget()->GetSupportDirectory();
+ vars["OBJECT_DIR"] = ConvertToNinjaPath(objPath);
+ EnsureDirectoryExists(objPath);
+
if (this->GetGlobalGenerator()->IsGCCOnWindows())
{
- const std::string objPath = GetTarget()->GetSupportDirectory();
- vars["OBJECT_DIR"] = ConvertToNinjaPath(objPath);
- EnsureDirectoryExists(objPath);
// ar.exe can't handle backslashes in rsp files (implicitly used by gcc)
std::string& linkLibraries = vars["LINK_LIBRARIES"];
std::replace(linkLibraries.begin(), linkLibraries.end(), '\\', '/');
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 81fdde2..f46c5b9 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -209,6 +209,15 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
result.push_back(this->ConvertToNinjaPath(this->ModuleDefinitionFile));
}
+ // Add a dependency on user-specified manifest files, if any.
+ std::vector<cmSourceFile const*> manifest_srcs;
+ this->GeneratorTarget->GetManifests(manifest_srcs, this->ConfigName);
+ for (std::vector<cmSourceFile const*>::iterator mi = manifest_srcs.begin();
+ mi != manifest_srcs.end(); ++mi)
+ {
+ result.push_back(this->ConvertToNinjaPath((*mi)->GetFullPath()));
+ }
+
// Add user-specified dependencies.
if (const char* linkDepends = this->Target->GetProperty("LINK_DEPENDS"))
{
@@ -362,7 +371,7 @@ cmNinjaTargetGenerator
mf->GetSafeDefinition("CMAKE_C_COMPILER") :
mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
cldeps = "\"";
- cldeps += mf->GetSafeDefinition("CMAKE_CMCLDEPS_EXECUTABLE");
+ cldeps += cmSystemTools::GetCMClDepsCommand();
cldeps += "\" " + lang + " $in \"$DEP_FILE\" $out \"";
cldeps += mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX");
cldeps += "\" \"" + cl + "\" ";
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index a791b89..283f277 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -220,7 +220,11 @@ class cmPolicy;
3, 3, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0064, \
"Support new TEST if() operator.", \
- 3, 3, 0, cmPolicies::WARN)
+ 3, 4, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0065, \
+ "Do not add flags to export symbols from executables without " \
+ "the ENABLE_EXPORTS target property.", \
+ 3, 4, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 46d7e01..7123125 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -20,7 +20,7 @@ bool cmProjectCommand
this->SetError("PROJECT called with incorrect number of arguments");
return false;
}
- this->Makefile->SetProjectName(args[0].c_str());
+ this->Makefile->SetProjectName(args[0]);
std::string bindir = args[0];
bindir += "_BINARY_DIR";
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 4eb9b13..becfeba 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -26,7 +26,6 @@
#include <sys/stat.h>
#include <cmsys/Terminal.h>
-#include <cmsys/ios/sstream>
#include <cmsys/FStream.hxx>
#include <assert.h>
@@ -122,7 +121,7 @@ static void copyTargetProperty(cmTarget* destinationTarget,
static std::string ReadAll(const std::string& filename)
{
cmsys::ifstream file(filename.c_str());
- cmsys_ios::stringstream stream;
+ std::stringstream stream;
stream << file.rdbuf();
file.close();
return stream.str();
@@ -404,7 +403,9 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
)
{
std::vector<cmSourceFile*> srcFiles;
- target->GetConfigCommonSourceFiles(srcFiles);
+ cmGeneratorTarget* gtgt =
+ lg->GetGlobalGenerator()->GetGeneratorTarget(target);
+ gtgt->GetConfigCommonSourceFiles(srcFiles);
for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
fileIt != srcFiles.end();
++fileIt)
@@ -475,8 +476,6 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
/*byproducts=*/rcc_output, depends,
commandLines, false, autogenComment.c_str());
- autogenTarget->Compute();
-
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
makefile->AddGeneratorTarget(autogenTarget, gt);
@@ -664,7 +663,10 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target)
const char* sepHeaders = "";
std::vector<cmSourceFile*> srcFiles;
- target->GetConfigCommonSourceFiles(srcFiles);
+ cmGeneratorTarget *gtgt = target->GetMakefile()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ gtgt->GetConfigCommonSourceFiles(srcFiles);
const char *skipMocSep = "";
const char *skipUicSep = "";
@@ -1049,7 +1051,10 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
cmMakefile *makefile = target->GetMakefile();
std::vector<cmSourceFile*> srcFiles;
- target->GetConfigCommonSourceFiles(srcFiles);
+ cmGeneratorTarget *gtgt = target->GetMakefile()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ gtgt->GetConfigCommonSourceFiles(srcFiles);
std::string qrcInputs;
const char* qrcInputsSep = "";
@@ -1212,7 +1217,9 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
cm.SetHomeDirectory(targetDirectory);
cmGlobalGenerator gg(&cm);
- cmLocalGenerator* lg = gg.MakeLocalGenerator();
+ cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, snapshot));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);
lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory);
gg.SetCurrentMakefile(lg->GetMakefile());
@@ -1229,7 +1236,6 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
this->WriteOldMocDefinitionsFile(targetDirectory);
- delete lg;
return success;
}
@@ -1640,7 +1646,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
this->GenerateQrc();
}
- cmsys_ios::stringstream outStream;
+ std::stringstream outStream;
outStream << "/* This file is autogenerated, do not edit*/\n";
bool automocCppChanged = false;
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index a9796b9..468a589 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -33,14 +33,6 @@
// Provide fixed-size integer types.
#include <cmIML/INT.h>
-// Include stream compatibility layer from KWSys.
-// This is needed to work with large file support
-// on some platforms whose stream operators do not
-// support the large integer types.
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-# include <cmsys/IOStream.hxx>
-#endif
-
#include <fstream>
#include <iostream>
#include <iomanip>
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index f425861..ce9ff32 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -15,11 +15,13 @@
#include "cmCacheManager.h"
#include "cmCommand.h"
#include "cmAlgorithms.h"
+#include "cmDefinitions.h"
#include <assert.h>
struct cmState::SnapshotDataType
{
+ cmState::PositionType ScopeParent;
cmState::PositionType DirectoryParent;
cmLinkedTree<cmState::PolicyStackEntry>::iterator Policies;
cmLinkedTree<cmState::PolicyStackEntry>::iterator PolicyRoot;
@@ -28,6 +30,9 @@ struct cmState::SnapshotDataType
cmLinkedTree<std::string>::iterator ExecutionListFile;
cmLinkedTree<cmState::BuildsystemDirectoryStateType>::iterator
BuildSystemDirectory;
+ cmLinkedTree<cmDefinitions>::iterator Vars;
+ cmLinkedTree<cmDefinitions>::iterator Root;
+ cmLinkedTree<cmDefinitions>::iterator Parent;
std::string EntryPointCommand;
long EntryPointLine;
std::vector<std::string>::size_type IncludeDirectoryPosition;
@@ -69,6 +74,12 @@ struct cmState::BuildsystemDirectoryStateType
std::vector<std::string> CompileOptions;
std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
+
+ std::string ProjectName;
+
+ cmPropertyMap Properties;
+
+ std::vector<cmState::Snapshot> Children;
};
cmState::cmState(cmake* cm)
@@ -266,6 +277,8 @@ cmState::Snapshot cmState::Reset()
it->CompileOptions.clear();
it->CompileOptionsBacktraces.clear();
it->DirectoryEnd = pos;
+ it->Properties.clear();
+ it->Children.clear();
}
this->PolicyStack.Clear();
@@ -274,6 +287,10 @@ cmState::Snapshot cmState::Reset()
pos->PolicyScope = this->PolicyStack.Root();
assert(pos->Policies.IsValid());
assert(pos->PolicyRoot.IsValid());
+ this->VarTree.Clear();
+ pos->Vars = this->VarTree.Extend(this->VarTree.Root());
+ pos->Parent = this->VarTree.Root();
+ pos->Root = this->VarTree.Root();
this->DefineProperty
("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
@@ -736,7 +753,8 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
{
PositionType pos = this->SnapshotData.Extend(this->SnapshotData.Root());
pos->DirectoryParent = this->SnapshotData.Root();
- pos->SnapshotType = BuildsystemDirectoryType;
+ pos->ScopeParent = this->SnapshotData.Root();
+ pos->SnapshotType = BaseType;
pos->BuildSystemDirectory =
this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root());
pos->ExecutionListFile =
@@ -750,6 +768,10 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
pos->PolicyScope = this->PolicyStack.Root();
assert(pos->Policies.IsValid());
assert(pos->PolicyRoot.IsValid());
+ pos->Vars = this->VarTree.Extend(this->VarTree.Root());
+ assert(pos->Vars.IsValid());
+ pos->Parent = this->VarTree.Root();
+ pos->Root = this->VarTree.Root();
return cmState::Snapshot(this, pos);
}
@@ -763,6 +785,7 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
pos->EntryPointLine = entryPointLine;
pos->EntryPointCommand = entryPointCommand;
pos->DirectoryParent = originSnapshot.Position;
+ pos->ScopeParent = originSnapshot.Position;
pos->SnapshotType = BuildsystemDirectoryType;
pos->BuildSystemDirectory =
this->BuildsystemDirectory.Extend(
@@ -776,7 +799,15 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
pos->PolicyScope = originSnapshot.Position->Policies;
assert(pos->Policies.IsValid());
assert(pos->PolicyRoot.IsValid());
- return cmState::Snapshot(this, pos);
+
+ cmLinkedTree<cmDefinitions>::iterator origin =
+ originSnapshot.Position->Vars;
+ pos->Parent = origin;
+ pos->Root = origin;
+ pos->Vars = this->VarTree.Extend(origin);
+ cmState::Snapshot snapshot = cmState::Snapshot(this, pos);
+ originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot);
+ return snapshot;
}
cmState::Snapshot
@@ -787,6 +818,7 @@ cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot,
{
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
*originSnapshot.Position);
+ pos->ScopeParent = originSnapshot.Position;
pos->EntryPointLine = entryPointLine;
pos->EntryPointCommand = entryPointCommand;
pos->SnapshotType = FunctionCallType;
@@ -794,6 +826,11 @@ cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot,
originSnapshot.Position->ExecutionListFile, fileName);
pos->BuildSystemDirectory->DirectoryEnd = pos;
pos->PolicyScope = originSnapshot.Position->Policies;
+ assert(originSnapshot.Position->Vars.IsValid());
+ cmLinkedTree<cmDefinitions>::iterator origin =
+ originSnapshot.Position->Vars;
+ pos->Parent = origin;
+ pos->Vars = this->VarTree.Extend(origin);
return cmState::Snapshot(this, pos);
}
@@ -811,6 +848,7 @@ cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot,
pos->SnapshotType = MacroCallType;
pos->ExecutionListFile = this->ExecutionListFiles.Extend(
originSnapshot.Position->ExecutionListFile, fileName);
+ assert(originSnapshot.Position->Vars.IsValid());
pos->BuildSystemDirectory->DirectoryEnd = pos;
pos->PolicyScope = originSnapshot.Position->Policies;
return cmState::Snapshot(this, pos);
@@ -829,12 +867,34 @@ cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot,
pos->SnapshotType = CallStackType;
pos->ExecutionListFile = this->ExecutionListFiles.Extend(
originSnapshot.Position->ExecutionListFile, fileName);
+ assert(originSnapshot.Position->Vars.IsValid());
pos->BuildSystemDirectory->DirectoryEnd = pos;
pos->PolicyScope = originSnapshot.Position->Policies;
return cmState::Snapshot(this, pos);
}
cmState::Snapshot
+cmState::CreateVariableScopeSnapshot(cmState::Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine)
+{
+ PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
+ *originSnapshot.Position);
+ pos->ScopeParent = originSnapshot.Position;
+ pos->EntryPointLine = entryPointLine;
+ pos->EntryPointCommand = entryPointCommand;
+ pos->SnapshotType = VariableScopeType;
+ assert(originSnapshot.Position->Vars.IsValid());
+
+ cmLinkedTree<cmDefinitions>::iterator origin =
+ originSnapshot.Position->Vars;
+ pos->Parent = origin;
+ pos->Vars = this->VarTree.Extend(origin);
+ assert(pos->Vars.IsValid());
+ return cmState::Snapshot(this, pos);
+}
+
+cmState::Snapshot
cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot,
const std::string& entryPointCommand,
long entryPointLine,
@@ -885,6 +945,11 @@ cmState::Snapshot::Snapshot(cmState* state)
{
}
+std::vector<cmState::Snapshot> cmState::Snapshot::GetChildren()
+{
+ return this->Position->BuildSystemDirectory->Children;
+}
+
cmState::Snapshot::Snapshot(cmState* state, PositionType position)
: State(state),
Position(position)
@@ -1002,7 +1067,8 @@ cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const
PositionType parentPos = this->Position->DirectoryParent;
if (parentPos != this->State->SnapshotData.Root())
{
- snapshot = Snapshot(this->State, parentPos);
+ snapshot = Snapshot(this->State,
+ parentPos->BuildSystemDirectory->DirectoryEnd);
}
return snapshot;
@@ -1019,7 +1085,8 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
{
++parentPos;
}
- if (parentPos->SnapshotType == cmState::BuildsystemDirectoryType)
+ if (parentPos->SnapshotType == cmState::BuildsystemDirectoryType
+ || parentPos->SnapshotType == cmState::BaseType)
{
return snapshot;
}
@@ -1121,6 +1188,72 @@ bool cmState::Snapshot::HasDefinedPolicyCMP0011()
return !this->Position->Policies->IsEmpty();
}
+const char* cmState::Snapshot::GetDefinition(std::string const& name) const
+{
+ assert(this->Position->Vars.IsValid());
+ return cmDefinitions::Get(name, this->Position->Vars,
+ this->Position->Root);
+}
+
+bool cmState::Snapshot::IsInitialized(std::string const& name) const
+{
+ return cmDefinitions::HasKey(name, this->Position->Vars,
+ this->Position->Root);
+}
+
+void cmState::Snapshot::SetDefinition(std::string const& name,
+ std::string const& value)
+{
+ this->Position->Vars->Set(name, value.c_str());
+}
+
+void cmState::Snapshot::RemoveDefinition(std::string const& name)
+{
+ this->Position->Vars->Set(name, 0);
+}
+
+std::vector<std::string> cmState::Snapshot::UnusedKeys() const
+{
+ return this->Position->Vars->UnusedKeys();
+}
+
+std::vector<std::string> cmState::Snapshot::ClosureKeys() const
+{
+ return cmDefinitions::ClosureKeys(this->Position->Vars,
+ this->Position->Root);
+}
+
+bool cmState::Snapshot::RaiseScope(std::string const& var, const char* varDef)
+{
+ if(this->Position->ScopeParent == this->Position->DirectoryParent)
+ {
+ Snapshot parentDir = this->GetBuildsystemDirectoryParent();
+ if(!parentDir.IsValid())
+ {
+ return false;
+ }
+ // Update the definition in the parent directory top scope. This
+ // directory's scope was initialized by the closure of the parent
+ // scope, so we do not need to localize the definition first.
+ if (varDef)
+ {
+ parentDir.SetDefinition(var, varDef);
+ }
+ else
+ {
+ parentDir.RemoveDefinition(var);
+ }
+ return true;
+ }
+ // First localize the definition in the current scope.
+ cmDefinitions::Raise(var, this->Position->Vars,
+ this->Position->Root);
+
+ // Now update the definition in the parent scope.
+ this->Position->Parent->Set(var, varDef);
+ return true;
+}
+
static const std::string cmPropertySentinal = std::string();
template<typename T, typename U, typename V>
@@ -1157,6 +1290,11 @@ void InitializeContentFromParent(T& parentContent,
void cmState::Snapshot::InitializeFromParent()
{
PositionType parent = this->Position->DirectoryParent;
+ assert(this->Position->Vars.IsValid());
+ assert(parent->Vars.IsValid());
+
+ *this->Position->Vars =
+ cmDefinitions::MakeClosure(parent->Vars, parent->Root);
InitializeContentFromParent(parent->BuildSystemDirectory->IncludeDirectories,
this->Position->BuildSystemDirectory->IncludeDirectories,
@@ -1187,6 +1325,16 @@ cmState::Directory cmState::Snapshot::GetDirectory() const
return Directory(this->Position->BuildSystemDirectory, *this);
}
+void cmState::Snapshot::SetProjectName(const std::string& name)
+{
+ this->Position->BuildSystemDirectory->ProjectName = name;
+}
+
+std::string cmState::Snapshot::GetProjectName() const
+{
+ return this->Position->BuildSystemDirectory->ProjectName;
+}
+
cmState::Directory::Directory(
cmLinkedTree<BuildsystemDirectoryStateType>::iterator iter,
const cmState::Snapshot& snapshot)
@@ -1229,11 +1377,16 @@ cmBacktraceRange GetPropertyBacktraces(T const& content,
template <typename T, typename U, typename V>
void AppendEntry(T& content, U& backtraces, V& endContentPosition,
- const std::string& vec, const cmListFileBacktrace& lfbt)
+ const std::string& value, const cmListFileBacktrace& lfbt)
{
+ if (value.empty())
+ {
+ return;
+ }
+
assert(endContentPosition == content.size());
- content.push_back(vec);
+ content.push_back(value);
backtraces.push_back(lfbt);
endContentPosition = content.size();
@@ -1296,22 +1449,21 @@ void cmState::Directory::PrependIncludeDirectoriesEntry(
this->DirectoryState->IncludeDirectories.begin()
+ this->Snapshot_.Position->IncludeDirectoryPosition;
- std::vector<std::string>::const_reverse_iterator rend =
+ std::vector<std::string>::reverse_iterator rend =
this->DirectoryState->IncludeDirectories.rend();
std::vector<std::string>::reverse_iterator rbegin =
cmMakeReverseIterator(entryEnd);
- std::vector<std::string>::const_reverse_iterator crbegin = rbegin;
- crbegin = std::find(crbegin, rend, cmPropertySentinal);
+ rbegin = std::find(rbegin, rend, cmPropertySentinal);
- std::vector<std::string>::const_iterator entryIt = crbegin.base();
- std::vector<std::string>::const_iterator entryBegin =
+ std::vector<std::string>::iterator entryIt = rbegin.base();
+ std::vector<std::string>::iterator entryBegin =
this->DirectoryState->IncludeDirectories.begin();
std::vector<cmListFileBacktrace>::iterator btIt =
this->DirectoryState->IncludeDirectoryBacktraces.begin()
+ std::distance(entryBegin, entryIt);
- this->DirectoryState->IncludeDirectories.insert(rbegin.base(), vec);
+ this->DirectoryState->IncludeDirectories.insert(entryIt, vec);
this->DirectoryState->IncludeDirectoryBacktraces.insert(btIt, lfbt);
this->Snapshot_.Position->IncludeDirectoryPosition =
@@ -1411,3 +1563,179 @@ void cmState::Directory::ClearCompileOptions()
this->DirectoryState->CompileOptionsBacktraces,
this->Snapshot_.Position->CompileOptionsPosition);
}
+
+bool cmState::Snapshot::StrictWeakOrder::operator()(
+ const cmState::Snapshot& lhs, const cmState::Snapshot& rhs) const
+{
+ return lhs.Position.StrictWeakOrdered(rhs.Position);
+}
+
+void cmState::Directory::SetProperty(const std::string& prop,
+ const char* value,
+ cmListFileBacktrace lfbt)
+{
+ if (prop == "INCLUDE_DIRECTORIES")
+ {
+ if (!value)
+ {
+ this->ClearIncludeDirectories();
+ return;
+ }
+ this->SetIncludeDirectories(value, lfbt);
+ return;
+ }
+ if (prop == "COMPILE_OPTIONS")
+ {
+ if (!value)
+ {
+ this->ClearCompileOptions();
+ return;
+ }
+ this->SetCompileOptions(value, lfbt);
+ return;
+ }
+ if (prop == "COMPILE_DEFINITIONS")
+ {
+ if (!value)
+ {
+ this->ClearCompileDefinitions();
+ return;
+ }
+ this->SetCompileDefinitions(value, lfbt);
+ return;
+ }
+
+ this->DirectoryState->Properties.SetProperty(prop, value);
+}
+
+void cmState::Directory::AppendProperty(const std::string& prop,
+ const char* value,
+ bool asString,
+ cmListFileBacktrace lfbt)
+{
+ if (prop == "INCLUDE_DIRECTORIES")
+ {
+ this->AppendIncludeDirectoriesEntry(value, lfbt);
+ return;
+ }
+ if (prop == "COMPILE_OPTIONS")
+ {
+ this->AppendCompileOptionsEntry(value, lfbt);
+ return;
+ }
+ if (prop == "COMPILE_DEFINITIONS")
+ {
+ this->AppendCompileDefinitionsEntry(value, lfbt);
+ return;
+ }
+
+ this->DirectoryState->Properties.AppendProperty(prop, value, asString);
+}
+
+const char*cmState::Directory::GetProperty(const std::string& prop) const
+{
+ const bool chain = this->Snapshot_.State->
+ IsPropertyChained(prop, cmProperty::DIRECTORY);
+ return this->GetProperty(prop, chain);
+}
+
+const char*
+cmState::Directory::GetProperty(const std::string& prop, bool chain) const
+{
+ static std::string output;
+ output = "";
+ if (prop == "PARENT_DIRECTORY")
+ {
+ cmState::Snapshot parent =
+ this->Snapshot_.GetBuildsystemDirectoryParent();
+ if(parent.IsValid())
+ {
+ return parent.GetDirectory().GetCurrentSource();
+ }
+ return "";
+ }
+ else if (prop == "LISTFILE_STACK")
+ {
+ std::vector<std::string> listFiles;
+ cmState::Snapshot snp = this->Snapshot_;
+ while (snp.IsValid())
+ {
+ listFiles.push_back(snp.GetExecutionListFile());
+ snp = snp.GetCallStackParent();
+ }
+ std::reverse(listFiles.begin(), listFiles.end());
+ output = cmJoin(listFiles, ";");
+ return output.c_str();
+ }
+ else if ( prop == "CACHE_VARIABLES" )
+ {
+ output = cmJoin(this->Snapshot_.State->GetCacheEntryKeys(), ";");
+ return output.c_str();
+ }
+ else if (prop == "VARIABLES")
+ {
+ std::vector<std::string> res = this->Snapshot_.ClosureKeys();
+ std::vector<std::string> cacheKeys =
+ this->Snapshot_.State->GetCacheEntryKeys();
+ res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
+ std::sort(res.begin(), res.end());
+ output = cmJoin(res, ";");
+ return output.c_str();
+ }
+ else if (prop == "INCLUDE_DIRECTORIES")
+ {
+ output = cmJoin(this->GetIncludeDirectoriesEntries(), ";");
+ return output.c_str();
+ }
+ else if (prop == "COMPILE_OPTIONS")
+ {
+ output = cmJoin(this->GetCompileOptionsEntries(), ";");
+ return output.c_str();
+ }
+ else if (prop == "COMPILE_DEFINITIONS")
+ {
+ output = cmJoin(this->GetCompileDefinitionsEntries(), ";");
+ return output.c_str();
+ }
+
+ const char *retVal = this->DirectoryState->Properties.GetPropertyValue(prop);
+ if (!retVal && chain)
+ {
+ Snapshot parentSnapshot = this->Snapshot_.GetBuildsystemDirectoryParent();
+ if (parentSnapshot.IsValid())
+ {
+ return parentSnapshot.GetDirectory().GetProperty(prop, chain);
+ }
+ return this->Snapshot_.State->GetGlobalProperty(prop);
+ }
+
+ return retVal;
+}
+
+bool cmState::Directory::GetPropertyAsBool(const std::string& prop) const
+{
+ return cmSystemTools::IsOn(this->GetProperty(prop));
+}
+
+std::vector<std::string> cmState::Directory::GetPropertyKeys() const
+{
+ std::vector<std::string> keys;
+ keys.reserve(this->DirectoryState->Properties.size());
+ for(cmPropertyMap::const_iterator it =
+ this->DirectoryState->Properties.begin();
+ it != this->DirectoryState->Properties.end(); ++it)
+ {
+ keys.push_back(it->first);
+ }
+ return keys;
+}
+
+bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs)
+{
+ return lhs.Position == rhs.Position;
+}
+
+bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs)
+{
+ return lhs.Position != rhs.Position;
+}
diff --git a/Source/cmState.h b/Source/cmState.h
index 07aa2a5..99e537c 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -21,6 +21,8 @@
class cmake;
class cmCommand;
+class cmDefinitions;
+class cmListFileBacktrace;
class cmState
{
@@ -35,12 +37,14 @@ public:
enum SnapshotType
{
+ BaseType,
BuildsystemDirectoryType,
FunctionCallType,
MacroCallType,
CallStackType,
InlineListFileType,
- PolicyScopeType
+ PolicyScopeType,
+ VariableScopeType
};
class Directory;
@@ -50,9 +54,19 @@ public:
Snapshot(cmState* state = 0);
Snapshot(cmState* state, PositionType position);
+ const char* GetDefinition(std::string const& name) const;
+ bool IsInitialized(std::string const& name) const;
+ void SetDefinition(std::string const& name, std::string const& value);
+ void RemoveDefinition(std::string const& name);
+ std::vector<std::string> UnusedKeys() const;
+ std::vector<std::string> ClosureKeys() const;
+ bool RaiseScope(std::string const& var, const char* varDef);
+
void SetListFile(std::string const& listfile);
std::string GetExecutionListFile() const;
+
+ std::vector<Snapshot> GetChildren();
std::string GetEntryPointCommand() const;
long GetEntryPointLine() const;
@@ -74,9 +88,23 @@ public:
Directory GetDirectory() const;
+ void SetProjectName(std::string const& name);
+ std::string GetProjectName() const;
+
+ struct StrictWeakOrder
+ {
+ bool operator()(const cmState::Snapshot& lhs,
+ const cmState::Snapshot& rhs) const;
+ };
+
private:
+ friend bool operator==(const cmState::Snapshot& lhs,
+ const cmState::Snapshot& rhs);
+ friend bool operator!=(const cmState::Snapshot& lhs,
+ const cmState::Snapshot& rhs);
friend class cmState;
friend class Directory;
+ friend struct StrictWeakOrder;
cmState* State;
cmState::PositionType Position;
};
@@ -127,6 +155,15 @@ public:
cmListFileBacktrace const& lfbt);
void ClearCompileOptions();
+ void SetProperty(const std::string& prop, const char *value,
+ cmListFileBacktrace lfbt);
+ void AppendProperty(const std::string& prop, const char *value,
+ bool asString, cmListFileBacktrace lfbt);
+ const char *GetProperty(const std::string& prop) const;
+ const char *GetProperty(const std::string& prop, bool chain) const;
+ bool GetPropertyAsBool(const std::string& prop) const;
+ std::vector<std::string> GetPropertyKeys() const;
+
private:
void ComputeRelativePathTopSource();
void ComputeRelativePathTopBinary();
@@ -154,6 +191,9 @@ public:
std::string const& entryPointCommand,
long entryPointLine,
std::string const& fileName);
+ Snapshot CreateVariableScopeSnapshot(Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine);
Snapshot CreateInlineListFileSnapshot(Snapshot originSnapshot,
const std::string& entryPointCommand,
long entryPointLine,
@@ -268,6 +308,7 @@ private:
cmLinkedTree<PolicyStackEntry> PolicyStack;
cmLinkedTree<SnapshotDataType> SnapshotData;
+ cmLinkedTree<cmDefinitions> VarTree;
std::vector<std::string> SourceDirectoryComponents;
std::vector<std::string> BinaryDirectoryComponents;
@@ -282,4 +323,7 @@ private:
bool MSYSShell;
};
+bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs);
+bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs);
+
#endif
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index a117238..c24b5ea 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -30,7 +30,6 @@
# include "cmLocale.h"
# include <cm_libarchive.h>
#endif
-#include <cmsys/stl/algorithm>
#include <cmsys/FStream.hxx>
#include <cmsys/Terminal.h>
@@ -69,6 +68,11 @@
# include "cmMachO.h"
#endif
+static bool cm_isspace(char c)
+{
+ return ((c & 0x80) == 0) && isspace(c);
+}
+
class cmSystemToolsFileTime
{
public:
@@ -229,13 +233,13 @@ std::string cmSystemTools::HelpFileName(std::string name)
std::string cmSystemTools::TrimWhitespace(const std::string& s)
{
std::string::const_iterator start = s.begin();
- while(start != s.end() && *start <= ' ')
+ while (start != s.end() && cm_isspace(*start))
++start;
if (start == s.end())
return "";
std::string::const_iterator stop = s.end()-1;
- while(*stop <= ' ')
+ while (cm_isspace(*stop))
--stop;
return std::string(start, stop+1);
}
@@ -497,7 +501,7 @@ void cmSystemTools::ParseWindowsCommandLine(const char* command,
{
arg.append(backslashes, '\\');
backslashes = 0;
- if(((*c & 0x80) == 0 ) && isspace(*c))
+ if (cm_isspace(*c))
{
if(in_quotes)
{
@@ -891,12 +895,33 @@ std::string cmSystemTools::FileExistsInParentDirectories(const char* fname,
bool cmSystemTools::cmCopyFile(const char* source, const char* destination)
{
+ // FIXME remove if statement once kwsys SystemTools get support for
+ // source is directory handling in CopyFileAlways function
+ if(cmSystemTools::FileIsDirectory(source))
+ {
+ return Superclass::MakeDirectory(destination);
+ }
+
return Superclass::CopyFileAlways(source, destination);
}
bool cmSystemTools::CopyFileIfDifferent(const char* source,
const char* destination)
{
+ // FIXME remove if statement once kwsys SystemTools get support for
+ // source is directory handling in CopyFileIfDifferent function
+ if(cmSystemTools::FileIsDirectory(source))
+ {
+ if(SystemTools::FileExists(destination))
+ {
+ return true;
+ }
+ else
+ {
+ return Superclass::MakeDirectory(destination);
+ }
+ }
+
return Superclass::CopyFileIfDifferent(source, destination);
}
@@ -1013,6 +1038,95 @@ std::string cmSystemTools::ComputeStringMD5(const std::string& input)
#endif
}
+//----------------------------------------------------------------------------
+std::string cmSystemTools::ComputeCertificateThumbprint(
+ const std::string& source)
+{
+ std::string thumbprint;
+
+#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32)
+ BYTE* certData = NULL;
+ CRYPT_INTEGER_BLOB cryptBlob;
+ HCERTSTORE certStore = NULL;
+ PCCERT_CONTEXT certContext = NULL;
+
+ HANDLE certFile =
+ CreateFileW(cmsys::Encoding::ToWide(source.c_str()).c_str(),
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+
+ if (certFile != INVALID_HANDLE_VALUE && certFile != NULL)
+ {
+ DWORD fileSize = GetFileSize(certFile, NULL);
+ if (fileSize != INVALID_FILE_SIZE)
+ {
+ certData = new BYTE[fileSize];
+ if (certData != NULL)
+ {
+ DWORD dwRead = 0;
+ if (ReadFile(certFile, certData, fileSize, &dwRead, NULL))
+ {
+ cryptBlob.cbData = fileSize;
+ cryptBlob.pbData = certData;
+
+ // Verify that this is a valid cert
+ if (PFXIsPFXBlob(&cryptBlob))
+ {
+ // Open the certificate as a store
+ certStore = PFXImportCertStore(
+ &cryptBlob, NULL, CRYPT_EXPORTABLE);
+ if (certStore != NULL)
+ {
+ // There should only be 1 cert.
+ certContext = CertEnumCertificatesInStore(certStore,
+ certContext);
+ if (certContext != NULL)
+ {
+ // The hash is 20 bytes
+ BYTE hashData[20];
+ DWORD hashLength = 20;
+
+ // Buffer to print the hash. Each byte takes 2 chars +
+ // terminating character
+ char hashPrint[41];
+ char *pHashPrint = hashPrint;
+ // Get the hash property from the certificate
+ if (CertGetCertificateContextProperty(certContext,
+ CERT_HASH_PROP_ID, hashData, &hashLength))
+ {
+ for (DWORD i = 0; i < hashLength; i++)
+ {
+ // Convert each byte to hexadecimal
+ sprintf(pHashPrint, "%02X", hashData[i]);
+ pHashPrint += 2;
+ }
+ *pHashPrint = '\0';
+ thumbprint = hashPrint;
+ }
+ CertFreeCertificateContext(certContext);
+ }
+ CertCloseStore(certStore, 0);
+ }
+ }
+ }
+ delete[] certData;
+ }
+ }
+ CloseHandle(certFile);
+ }
+#else
+ (void)source;
+ cmSystemTools::Message("ComputeCertificateThumbprint is not implemented",
+ "Error");
+#endif
+
+ return thumbprint;
+}
+
void cmSystemTools::Glob(const std::string& directory,
const std::string& regexp,
std::vector<std::string>& files)
@@ -1321,15 +1435,6 @@ std::string cmSystemTools::ConvertToRunCommandPath(const char* path)
#endif
}
-bool cmSystemTools::StringEndsWith(const char* str1, const char* str2)
-{
- if ( !str1 || !str2 || strlen(str1) < strlen(str2) )
- {
- return 0;
- }
- return !strncmp(str1 + (strlen(str1)-strlen(str2)), str2, strlen(str2));
-}
-
// compute the relative path from here to there
std::string cmSystemTools::RelativePath(const char* local, const char* remote)
{
@@ -1482,7 +1587,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- cmsys::ofstream fout(outFileName, std::ios::out | cmsys_ios_binary);
+ cmsys::ofstream fout(outFileName, std::ios::out | std::ios::binary);
if(!fout)
{
std::string e = "Cannot open output file \"";
@@ -1705,7 +1810,7 @@ bool extract_tar(const char* outFileName, bool verbose,
static_cast<void>(localeRAII);
struct archive* a = archive_read_new();
struct archive *ext = archive_write_disk_new();
- archive_read_support_compression_all(a);
+ archive_read_support_filter_all(a);
archive_read_support_format_all(a);
struct archive_entry *entry;
int r = cm_archive_read_open_file(a, outFileName, 10240);
@@ -1792,7 +1897,7 @@ bool extract_tar(const char* outFileName, bool verbose,
}
archive_write_free(ext);
archive_read_close(a);
- archive_read_finish(a);
+ archive_read_free(a);
return r == ARCHIVE_EOF || r == ARCHIVE_OK;
}
}
@@ -2132,6 +2237,7 @@ static std::string cmSystemToolsCTestCommand;
static std::string cmSystemToolsCPackCommand;
static std::string cmSystemToolsCMakeCursesCommand;
static std::string cmSystemToolsCMakeGUICommand;
+static std::string cmSystemToolsCMClDepsCommand;
static std::string cmSystemToolsCMakeRoot;
void cmSystemTools::FindCMakeResources(const char* argv0)
{
@@ -2224,6 +2330,13 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
{
cmSystemToolsCMakeCursesCommand = "";
}
+ cmSystemToolsCMClDepsCommand = exe_dir;
+ cmSystemToolsCMClDepsCommand += "/cmcldeps";
+ cmSystemToolsCMClDepsCommand += cmSystemTools::GetExecutableExtension();
+ if(!cmSystemTools::FileExists(cmSystemToolsCMClDepsCommand.c_str()))
+ {
+ cmSystemToolsCMClDepsCommand = "";
+ }
#ifdef CMAKE_BUILD_WITH_CMAKE
// Install tree has "<prefix>/bin/cmake" and "<prefix><CMAKE_DATA_DIR>".
@@ -2291,6 +2404,12 @@ std::string const& cmSystemTools::GetCMakeGUICommand()
}
//----------------------------------------------------------------------------
+std::string const& cmSystemTools::GetCMClDepsCommand()
+{
+ return cmSystemToolsCMClDepsCommand;
+}
+
+//----------------------------------------------------------------------------
std::string const& cmSystemTools::GetCMakeRoot()
{
return cmSystemToolsCMakeRoot;
@@ -2315,7 +2434,7 @@ void cmSystemTools::MakefileColorEcho(int color, const char* message,
assumeTTY = 0;
}
- if(enabled)
+ if(enabled && color != cmsysTerminal_Color_Normal)
{
// Print with color. Delay the newline until later so that
// all color restore sequences appear before it.
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index fb58307..e88170a 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -194,6 +194,9 @@ public:
/** Compute the md5sum of a string. */
static std::string ComputeStringMD5(const std::string& input);
+ ///! Get the SHA thumbprint for a certificate file
+ static std::string ComputeCertificateThumbprint(const std::string& source);
+
/**
* Run a single executable command
*
@@ -333,8 +336,6 @@ public:
// be used when RunCommand is called from cmake, because the
// running cmake needs paths to be in its format
static std::string ConvertToRunCommandPath(const char* path);
- //! Check if the first string ends with the second one.
- static bool StringEndsWith(const char* str1, const char* str2);
/** compute the relative path from local to remote. local must
be a directory. remote can be a file or a directory.
@@ -425,6 +426,7 @@ public:
static std::string const& GetCMakeCommand();
static std::string const& GetCMakeGUICommand();
static std::string const& GetCMakeCursesCommand();
+ static std::string const& GetCMClDepsCommand();
static std::string const& GetCMakeRoot();
/** Echo a message in color using KWSys's Terminal cprintf. */
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 49b3239..bb44956 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -77,13 +77,11 @@ public:
cmTargetInternals()
: Backtrace()
{
- this->PolicyWarnedCMP0022 = false;
this->UtilityItemsDone = false;
}
cmTargetInternals(cmTargetInternals const&)
: Backtrace()
{
- this->PolicyWarnedCMP0022 = false;
this->UtilityItemsDone = false;
}
~cmTargetInternals();
@@ -91,64 +89,14 @@ public:
// The backtrace when the target was created.
cmListFileBacktrace Backtrace;
- // Cache link interface computation from each configuration.
- struct OptionalLinkInterface: public cmTarget::LinkInterface
- {
- OptionalLinkInterface():
- LibrariesDone(false), AllDone(false),
- Exists(false), HadHeadSensitiveCondition(false),
- ExplicitLibraries(0) {}
- bool LibrariesDone;
- bool AllDone;
- bool Exists;
- bool HadHeadSensitiveCondition;
- const char* ExplicitLibraries;
- };
- void ComputeLinkInterface(cmTarget const* thisTarget,
- const std::string& config,
- OptionalLinkInterface& iface,
- cmTarget const* head) const;
- void ComputeLinkInterfaceLibraries(cmTarget const* thisTarget,
- const std::string& config,
- OptionalLinkInterface& iface,
- cmTarget const* head,
- bool usage_requirements_only);
-
- struct HeadToLinkInterfaceMap:
- public std::map<cmTarget const*, OptionalLinkInterface> {};
- typedef std::map<std::string, HeadToLinkInterfaceMap>
- LinkInterfaceMapType;
- LinkInterfaceMapType LinkInterfaceMap;
- LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap;
- bool PolicyWarnedCMP0022;
-
typedef std::map<std::string, cmTarget::OutputInfo> OutputInfoMapType;
OutputInfoMapType OutputInfoMap;
typedef std::map<std::string, cmTarget::ImportInfo> ImportInfoMapType;
ImportInfoMapType ImportInfoMap;
- // Cache link implementation computation from each configuration.
- struct OptionalLinkImplementation: public cmTarget::LinkImplementation
- {
- OptionalLinkImplementation():
- LibrariesDone(false), LanguagesDone(false),
- HadHeadSensitiveCondition(false) {}
- bool LibrariesDone;
- bool LanguagesDone;
- bool HadHeadSensitiveCondition;
- };
- void ComputeLinkImplementationLibraries(cmTarget const* thisTarget,
- const std::string& config,
- OptionalLinkImplementation& impl,
- cmTarget const* head) const;
- void ComputeLinkImplementationLanguages(cmTarget const* thisTarget,
- const std::string& config,
- OptionalLinkImplementation& impl
- ) const;
-
struct HeadToLinkImplementationMap:
- public std::map<cmTarget const*, OptionalLinkImplementation> {};
+ public std::map<cmTarget const*, cmOptionalLinkImplementation> {};
typedef std::map<std::string,
HeadToLinkImplementationMap> LinkImplMapType;
LinkImplMapType LinkImplMap;
@@ -172,16 +120,12 @@ public:
};
std::vector<std::string> IncludeDirectoriesEntries;
std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces;
- std::vector<TargetPropertyEntry*> IncludeDirectoriesItems;
std::vector<std::string> CompileOptionsEntries;
std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
- std::vector<TargetPropertyEntry*> CompileOptionsItems;
std::vector<std::string> CompileFeaturesEntries;
std::vector<cmListFileBacktrace> CompileFeaturesBacktraces;
- std::vector<TargetPropertyEntry*> CompileFeaturesItems;
std::vector<std::string> CompileDefinitionsEntries;
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
- std::vector<TargetPropertyEntry*> CompileDefinitionsItems;
std::vector<TargetPropertyEntry*> SourceEntries;
std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
@@ -210,10 +154,6 @@ cmTarget::cmTarget()
this->IsApple = false;
this->IsImportedTarget = false;
this->BuildInterfaceIncludesAppended = false;
- this->DebugIncludesDone = false;
- this->DebugCompileOptionsDone = false;
- this->DebugCompileFeaturesDone = false;
- this->DebugCompileDefinitionsDone = false;
this->DebugSourcesDone = false;
this->LinkImplementationLanguageIsContextDependent = true;
}
@@ -407,6 +347,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
{
this->SetPropertyDefault("ANDROID_GUI", 0);
this->SetPropertyDefault("CROSSCOMPILING_EMULATOR", 0);
+ this->SetPropertyDefault("ENABLE_EXPORTS", 0);
}
if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY
|| this->TargetTypeValue == cmTarget::MODULE_LIBRARY)
@@ -456,29 +397,6 @@ void CreatePropertyGeneratorExpressions(
}
}
-void cmTarget::Compute()
-{
- CreatePropertyGeneratorExpressions(
- this->Internal->IncludeDirectoriesEntries,
- this->Internal->IncludeDirectoriesBacktraces,
- this->Internal->IncludeDirectoriesItems);
-
- CreatePropertyGeneratorExpressions(
- this->Internal->CompileOptionsEntries,
- this->Internal->CompileOptionsBacktraces,
- this->Internal->CompileOptionsItems);
-
- CreatePropertyGeneratorExpressions(
- this->Internal->CompileFeaturesEntries,
- this->Internal->CompileFeaturesBacktraces,
- this->Internal->CompileFeaturesItems);
-
- CreatePropertyGeneratorExpressions(
- this->Internal->CompileDefinitionsEntries,
- this->Internal->CompileDefinitionsBacktraces,
- this->Internal->CompileDefinitionsItems);
-}
-
//----------------------------------------------------------------------------
void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile)
{
@@ -538,8 +456,6 @@ void cmTarget::ClearLinkMaps()
{
this->LinkImplementationLanguageIsContextDependent = true;
this->Internal->LinkImplMap.clear();
- this->Internal->LinkInterfaceMap.clear();
- this->Internal->LinkInterfaceUsageRequirementsOnlyMap.clear();
this->Internal->SourceFilesMap.clear();
}
@@ -721,7 +637,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
{
assert(this->GetType() != INTERFACE_LIBRARY);
- if (!this->Makefile->IsConfigured())
+ if (!this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026())
{
// At configure-time, this method can be called as part of getting the
// LOCATION property or to export() a file to be include()d. However
@@ -767,7 +683,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
"SOURCES")
!= debugProperties.end();
- if (this->Makefile->IsConfigured())
+ if (this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026())
{
this->DebugSourcesDone = true;
}
@@ -810,62 +726,6 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
}
//----------------------------------------------------------------------------
-bool
-cmTarget::GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const
-{
- std::vector<std::string> configs;
- this->Makefile->GetConfigurations(configs);
- if (configs.empty())
- {
- configs.push_back("");
- }
-
- std::vector<std::string>::const_iterator it = configs.begin();
- const std::string& firstConfig = *it;
- this->GetSourceFiles(files, firstConfig);
-
- for ( ; it != configs.end(); ++it)
- {
- std::vector<cmSourceFile*> configFiles;
- this->GetSourceFiles(configFiles, *it);
- if (configFiles != files)
- {
- std::string firstConfigFiles;
- const char* sep = "";
- for (std::vector<cmSourceFile*>::const_iterator fi = files.begin();
- fi != files.end(); ++fi)
- {
- firstConfigFiles += sep;
- firstConfigFiles += (*fi)->GetFullPath();
- sep = "\n ";
- }
-
- std::string thisConfigFiles;
- sep = "";
- for (std::vector<cmSourceFile*>::const_iterator fi = configFiles.begin();
- fi != configFiles.end(); ++fi)
- {
- thisConfigFiles += sep;
- thisConfigFiles += (*fi)->GetFullPath();
- sep = "\n ";
- }
- std::ostringstream e;
- e << "Target \"" << this->Name << "\" has source files which vary by "
- "configuration. This is not supported by the \""
- << this->Makefile->GetGlobalGenerator()->GetName()
- << "\" generator.\n"
- "Config \"" << firstConfig << "\":\n"
- " " << firstConfigFiles << "\n"
- "Config \"" << *it << "\":\n"
- " " << thisConfigFiles << "\n";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
- return false;
- }
- }
- return true;
-}
-
-//----------------------------------------------------------------------------
void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
const std::string& config) const
{
@@ -1354,6 +1214,46 @@ cmTarget::AddSystemIncludeDirectories(const std::set<std::string> &incs)
this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
}
+cmStringRange cmTarget::GetIncludeDirectoriesEntries() const
+{
+ return cmMakeRange(this->Internal->IncludeDirectoriesEntries);
+}
+
+cmBacktraceRange cmTarget::GetIncludeDirectoriesBacktraces() const
+{
+ return cmMakeRange(this->Internal->IncludeDirectoriesBacktraces);
+}
+
+cmStringRange cmTarget::GetCompileOptionsEntries() const
+{
+ return cmMakeRange(this->Internal->CompileOptionsEntries);
+}
+
+cmBacktraceRange cmTarget::GetCompileOptionsBacktraces() const
+{
+ return cmMakeRange(this->Internal->CompileOptionsBacktraces);
+}
+
+cmStringRange cmTarget::GetCompileFeaturesEntries() const
+{
+ return cmMakeRange(this->Internal->CompileFeaturesEntries);
+}
+
+cmBacktraceRange cmTarget::GetCompileFeaturesBacktraces() const
+{
+ return cmMakeRange(this->Internal->CompileFeaturesBacktraces);
+}
+
+cmStringRange cmTarget::GetCompileDefinitionsEntries() const
+{
+ return cmMakeRange(this->Internal->CompileDefinitionsEntries);
+}
+
+cmBacktraceRange cmTarget::GetCompileDefinitionsBacktraces() const
+{
+ return cmMakeRange(this->Internal->CompileDefinitionsBacktraces);
+}
+
#if defined(_WIN32) && !defined(__CYGWIN__)
//----------------------------------------------------------------------------
void
@@ -1702,33 +1602,45 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
{
this->Internal->IncludeDirectoriesEntries.clear();
this->Internal->IncludeDirectoriesBacktraces.clear();
- this->Internal->IncludeDirectoriesEntries.push_back(value);
- cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
+ if (value)
+ {
+ this->Internal->IncludeDirectoriesEntries.push_back(value);
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
+ }
}
else if(prop == "COMPILE_OPTIONS")
{
this->Internal->CompileOptionsEntries.clear();
this->Internal->CompileOptionsBacktraces.clear();
- this->Internal->CompileOptionsEntries.push_back(value);
- cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->CompileOptionsBacktraces.push_back(lfbt);
+ if (value)
+ {
+ this->Internal->CompileOptionsEntries.push_back(value);
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ this->Internal->CompileOptionsBacktraces.push_back(lfbt);
+ }
}
else if(prop == "COMPILE_FEATURES")
{
this->Internal->CompileFeaturesEntries.clear();
this->Internal->CompileFeaturesBacktraces.clear();
- this->Internal->CompileFeaturesEntries.push_back(value);
- cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
+ if (value)
+ {
+ this->Internal->CompileFeaturesEntries.push_back(value);
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
+ }
}
else if(prop == "COMPILE_DEFINITIONS")
{
this->Internal->CompileDefinitionsEntries.clear();
this->Internal->CompileDefinitionsBacktraces.clear();
- this->Internal->CompileDefinitionsEntries.push_back(value);
- cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
+ if (value)
+ {
+ this->Internal->CompileDefinitionsEntries.push_back(value);
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
+ }
}
else if(prop == "EXPORT_NAME" && this->IsImported())
{
@@ -1760,6 +1672,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Internal->SourceFilesMap.clear();
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
+ cmDeleteAll(this->Internal->SourceEntries);
this->Internal->SourceEntries.clear();
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->SourceEntries.push_back(
@@ -1794,27 +1707,39 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
}
else if(prop == "INCLUDE_DIRECTORIES")
{
- this->Internal->IncludeDirectoriesEntries.push_back(value);
- cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
+ if (value && *value)
+ {
+ this->Internal->IncludeDirectoriesEntries.push_back(value);
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
+ }
}
else if(prop == "COMPILE_OPTIONS")
{
- this->Internal->CompileOptionsEntries.push_back(value);
- cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->CompileOptionsBacktraces.push_back(lfbt);
+ if (value && *value)
+ {
+ this->Internal->CompileOptionsEntries.push_back(value);
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ this->Internal->CompileOptionsBacktraces.push_back(lfbt);
+ }
}
else if(prop == "COMPILE_FEATURES")
{
- this->Internal->CompileFeaturesEntries.push_back(value);
- cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
+ if (value && *value)
+ {
+ this->Internal->CompileFeaturesEntries.push_back(value);
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
+ }
}
else if(prop == "COMPILE_DEFINITIONS")
{
- this->Internal->CompileDefinitionsEntries.push_back(value);
- cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
+ if (value && *value)
+ {
+ this->Internal->CompileDefinitionsEntries.push_back(value);
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
+ }
}
else if(prop == "EXPORT_NAME" && this->IsImported())
{
@@ -1825,7 +1750,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
}
else if (prop == "LINK_LIBRARIES")
{
- if (value)
+ if (value && *value)
{
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmValueWithOrigin entry(value, lfbt);
@@ -1842,12 +1767,12 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
- this->Internal->SourceFilesMap.clear();
- cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- cmGeneratorExpression ge(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
- this->Internal->SourceEntries.push_back(
- new cmTargetInternals::TargetPropertyEntry(cge));
+ this->Internal->SourceFilesMap.clear();
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
+ this->Internal->SourceEntries.push_back(
+ new cmTargetInternals::TargetPropertyEntry(cge));
}
else
{
@@ -1951,510 +1876,6 @@ void cmTarget::InsertCompileDefinition(std::string const& entry,
}
//----------------------------------------------------------------------------
-static void processIncludeDirectories(cmTarget const* tgt,
- const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
- std::vector<std::string> &includes,
- UNORDERED_SET<std::string> &uniqueIncludes,
- cmGeneratorExpressionDAGChecker *dagChecker,
- const std::string& config, bool debugIncludes,
- const std::string& language)
-{
- cmMakefile *mf = tgt->GetMakefile();
-
- for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
- it = entries.begin(), end = entries.end(); it != end; ++it)
- {
- cmLinkImplItem const& item = (*it)->LinkImplItem;
- std::string const& targetName = item;
- bool const fromImported = item.Target && item.Target->IsImported();
- bool const checkCMP0027 = item.FromGenex;
- std::vector<std::string> entryIncludes;
- cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
- config,
- false,
- tgt,
- dagChecker, language),
- entryIncludes);
-
- std::string usedIncludes;
- for(std::vector<std::string>::iterator
- li = entryIncludes.begin(); li != entryIncludes.end(); ++li)
- {
- if (fromImported
- && !cmSystemTools::FileExists(li->c_str()))
- {
- std::ostringstream e;
- cmake::MessageType messageType = cmake::FATAL_ERROR;
- if (checkCMP0027)
- {
- switch(tgt->GetPolicyStatusCMP0027())
- {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0027) << "\n";
- case cmPolicies::OLD:
- messageType = cmake::AUTHOR_WARNING;
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- break;
- }
- }
- e << "Imported target \"" << targetName << "\" includes "
- "non-existent path\n \"" << *li << "\"\nin its "
- "INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n"
- "* The path was deleted, renamed, or moved to another "
- "location.\n"
- "* An install or uninstall procedure did not complete "
- "successfully.\n"
- "* The installation package was faulty and references files it "
- "does not provide.\n";
- tgt->GetMakefile()->IssueMessage(messageType, e.str());
- return;
- }
-
- if (!cmSystemTools::FileIsFullPath(li->c_str()))
- {
- std::ostringstream e;
- bool noMessage = false;
- cmake::MessageType messageType = cmake::FATAL_ERROR;
- if (!targetName.empty())
- {
- e << "Target \"" << targetName << "\" contains relative "
- "path in its INTERFACE_INCLUDE_DIRECTORIES:\n"
- " \"" << *li << "\"";
- }
- else
- {
- switch(tgt->GetPolicyStatusCMP0021())
- {
- case cmPolicies::WARN:
- {
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0021) << "\n";
- messageType = cmake::AUTHOR_WARNING;
- }
- break;
- case cmPolicies::OLD:
- noMessage = true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // Issue the fatal message.
- break;
- }
- e << "Found relative path while evaluating include directories of "
- "\"" << tgt->GetName() << "\":\n \"" << *li << "\"\n";
- }
- if (!noMessage)
- {
- tgt->GetMakefile()->IssueMessage(messageType, e.str());
- if (messageType == cmake::FATAL_ERROR)
- {
- return;
- }
- }
- }
-
- if (!cmSystemTools::IsOff(li->c_str()))
- {
- cmSystemTools::ConvertToUnixSlashes(*li);
- }
- std::string inc = *li;
-
- if(uniqueIncludes.insert(inc).second)
- {
- includes.push_back(inc);
- if (debugIncludes)
- {
- usedIncludes += " * " + inc + "\n";
- }
- }
- }
- if (!usedIncludes.empty())
- {
- mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
- std::string("Used includes for target ")
- + tgt->GetName() + ":\n"
- + usedIncludes, (*it)->ge->GetBacktrace());
- }
- }
-}
-
-//----------------------------------------------------------------------------
-std::vector<std::string>
-cmTarget::GetIncludeDirectories(const std::string& config,
- const std::string& language) const
-{
- std::vector<std::string> includes;
- UNORDERED_SET<std::string> uniqueIncludes;
-
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "INCLUDE_DIRECTORIES", 0, 0);
-
- std::vector<std::string> debugProperties;
- const char *debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp)
- {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
- }
-
- bool debugIncludes = !this->DebugIncludesDone
- && std::find(debugProperties.begin(),
- debugProperties.end(),
- "INCLUDE_DIRECTORIES")
- != debugProperties.end();
-
- if (this->Makefile->IsConfigured())
- {
- this->DebugIncludesDone = true;
- }
-
- processIncludeDirectories(this,
- this->Internal->IncludeDirectoriesItems,
- includes,
- uniqueIncludes,
- &dagChecker,
- config,
- debugIncludes,
- language);
-
- std::vector<cmTargetInternals::TargetPropertyEntry*>
- linkInterfaceIncludeDirectoriesEntries;
- this->Internal->AddInterfaceEntries(
- this, config, "INTERFACE_INCLUDE_DIRECTORIES",
- linkInterfaceIncludeDirectoriesEntries);
-
- if(this->Makefile->IsOn("APPLE"))
- {
- cmLinkImplementationLibraries const* impl =
- this->GetLinkImplementationLibraries(config);
- for(std::vector<cmLinkImplItem>::const_iterator
- it = impl->Libraries.begin();
- it != impl->Libraries.end(); ++it)
- {
- std::string libDir = cmSystemTools::CollapseFullPath(*it);
-
- static cmsys::RegularExpression
- frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$");
- if(!frameworkCheck.find(libDir))
- {
- continue;
- }
-
- libDir = frameworkCheck.match(1);
-
- cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(libDir.c_str());
- linkInterfaceIncludeDirectoriesEntries
- .push_back(new cmTargetInternals::TargetPropertyEntry(cge));
- }
- }
-
- processIncludeDirectories(this,
- linkInterfaceIncludeDirectoriesEntries,
- includes,
- uniqueIncludes,
- &dagChecker,
- config,
- debugIncludes,
- language);
-
- cmDeleteAll(linkInterfaceIncludeDirectoriesEntries);
-
- return includes;
-}
-
-//----------------------------------------------------------------------------
-static void processCompileOptionsInternal(cmTarget const* tgt,
- const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
- std::vector<std::string> &options,
- UNORDERED_SET<std::string> &uniqueOptions,
- cmGeneratorExpressionDAGChecker *dagChecker,
- const std::string& config, bool debugOptions, const char *logName,
- std::string const& language)
-{
- cmMakefile *mf = tgt->GetMakefile();
-
- for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
- it = entries.begin(), end = entries.end(); it != end; ++it)
- {
- std::vector<std::string> entryOptions;
- cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
- config,
- false,
- tgt,
- dagChecker,
- language),
- entryOptions);
- std::string usedOptions;
- for(std::vector<std::string>::iterator
- li = entryOptions.begin(); li != entryOptions.end(); ++li)
- {
- std::string const& opt = *li;
-
- if(uniqueOptions.insert(opt).second)
- {
- options.push_back(opt);
- if (debugOptions)
- {
- usedOptions += " * " + opt + "\n";
- }
- }
- }
- if (!usedOptions.empty())
- {
- mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
- std::string("Used compile ") + logName
- + std::string(" for target ")
- + tgt->GetName() + ":\n"
- + usedOptions, (*it)->ge->GetBacktrace());
- }
- }
-}
-
-//----------------------------------------------------------------------------
-static void processCompileOptions(cmTarget const* tgt,
- const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
- std::vector<std::string> &options,
- UNORDERED_SET<std::string> &uniqueOptions,
- cmGeneratorExpressionDAGChecker *dagChecker,
- const std::string& config, bool debugOptions,
- std::string const& language)
-{
- processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
- dagChecker, config, debugOptions, "options",
- language);
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::GetCompileOptions(std::vector<std::string> &result,
- const std::string& config,
- const std::string& language) const
-{
- UNORDERED_SET<std::string> uniqueOptions;
-
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "COMPILE_OPTIONS", 0, 0);
-
- std::vector<std::string> debugProperties;
- const char *debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp)
- {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
- }
-
- bool debugOptions = !this->DebugCompileOptionsDone
- && std::find(debugProperties.begin(),
- debugProperties.end(),
- "COMPILE_OPTIONS")
- != debugProperties.end();
-
- if (this->Makefile->IsConfigured())
- {
- this->DebugCompileOptionsDone = true;
- }
-
- processCompileOptions(this,
- this->Internal->CompileOptionsItems,
- result,
- uniqueOptions,
- &dagChecker,
- config,
- debugOptions,
- language);
-
- std::vector<cmTargetInternals::TargetPropertyEntry*>
- linkInterfaceCompileOptionsEntries;
-
- this->Internal->AddInterfaceEntries(
- this, config, "INTERFACE_COMPILE_OPTIONS",
- linkInterfaceCompileOptionsEntries);
-
- processCompileOptions(this,
- linkInterfaceCompileOptionsEntries,
- result,
- uniqueOptions,
- &dagChecker,
- config,
- debugOptions,
- language);
-
- cmDeleteAll(linkInterfaceCompileOptionsEntries);
-}
-
-//----------------------------------------------------------------------------
-static void processCompileDefinitions(cmTarget const* tgt,
- const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
- std::vector<std::string> &options,
- UNORDERED_SET<std::string> &uniqueOptions,
- cmGeneratorExpressionDAGChecker *dagChecker,
- const std::string& config, bool debugOptions,
- std::string const& language)
-{
- processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
- dagChecker, config, debugOptions,
- "definitions", language);
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
- const std::string& config,
- const std::string& language) const
-{
- UNORDERED_SET<std::string> uniqueOptions;
-
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "COMPILE_DEFINITIONS", 0, 0);
-
- std::vector<std::string> debugProperties;
- const char *debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp)
- {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
- }
-
- bool debugDefines = !this->DebugCompileDefinitionsDone
- && std::find(debugProperties.begin(),
- debugProperties.end(),
- "COMPILE_DEFINITIONS")
- != debugProperties.end();
-
- if (this->Makefile->IsConfigured())
- {
- this->DebugCompileDefinitionsDone = true;
- }
-
- processCompileDefinitions(this,
- this->Internal->CompileDefinitionsItems,
- list,
- uniqueOptions,
- &dagChecker,
- config,
- debugDefines,
- language);
-
- std::vector<cmTargetInternals::TargetPropertyEntry*>
- linkInterfaceCompileDefinitionsEntries;
- this->Internal->AddInterfaceEntries(
- this, config, "INTERFACE_COMPILE_DEFINITIONS",
- linkInterfaceCompileDefinitionsEntries);
- if (!config.empty())
- {
- std::string configPropName = "COMPILE_DEFINITIONS_"
- + cmSystemTools::UpperCase(config);
- const char *configProp = this->GetProperty(configPropName);
- if (configProp)
- {
- switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043))
- {
- case cmPolicies::WARN:
- {
- std::ostringstream e;
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0043);
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
- e.str());
- }
- case cmPolicies::OLD:
- {
- cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(configProp);
- linkInterfaceCompileDefinitionsEntries
- .push_back(new cmTargetInternals::TargetPropertyEntry(cge));
- }
- break;
- case cmPolicies::NEW:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- break;
- }
- }
- }
-
- processCompileDefinitions(this,
- linkInterfaceCompileDefinitionsEntries,
- list,
- uniqueOptions,
- &dagChecker,
- config,
- debugDefines,
- language);
-
- cmDeleteAll(linkInterfaceCompileDefinitionsEntries);
-}
-
-//----------------------------------------------------------------------------
-static void processCompileFeatures(cmTarget const* tgt,
- const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
- std::vector<std::string> &options,
- UNORDERED_SET<std::string> &uniqueOptions,
- cmGeneratorExpressionDAGChecker *dagChecker,
- const std::string& config, bool debugOptions)
-{
- processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
- dagChecker, config, debugOptions, "features",
- std::string());
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::GetCompileFeatures(std::vector<std::string> &result,
- const std::string& config) const
-{
- UNORDERED_SET<std::string> uniqueFeatures;
-
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "COMPILE_FEATURES",
- 0, 0);
-
- std::vector<std::string> debugProperties;
- const char *debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp)
- {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
- }
-
- bool debugFeatures = !this->DebugCompileFeaturesDone
- && std::find(debugProperties.begin(),
- debugProperties.end(),
- "COMPILE_FEATURES")
- != debugProperties.end();
-
- if (this->Makefile->IsConfigured())
- {
- this->DebugCompileFeaturesDone = true;
- }
-
- processCompileFeatures(this,
- this->Internal->CompileFeaturesItems,
- result,
- uniqueFeatures,
- &dagChecker,
- config,
- debugFeatures);
-
- std::vector<cmTargetInternals::TargetPropertyEntry*>
- linkInterfaceCompileFeaturesEntries;
- this->Internal->AddInterfaceEntries(
- this, config, "INTERFACE_COMPILE_FEATURES",
- linkInterfaceCompileFeaturesEntries);
-
- processCompileFeatures(this,
- linkInterfaceCompileFeaturesEntries,
- result,
- uniqueFeatures,
- &dagChecker,
- config,
- debugFeatures);
-
- cmDeleteAll(linkInterfaceCompileFeaturesEntries);
-}
-
-//----------------------------------------------------------------------------
void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop)
{
// Wipe out maps caching information affected by this property.
@@ -3096,51 +2517,6 @@ bool cmTarget::GetPropertyAsBool(const std::string& prop) const
}
//----------------------------------------------------------------------------
-void cmTarget::ExpandLinkItems(std::string const& prop,
- std::string const& value,
- std::string const& config,
- cmTarget const* headTarget,
- bool usage_requirements_only,
- std::vector<cmLinkItem>& items,
- bool& hadHeadSensitiveCondition) const
-{
- cmGeneratorExpression ge;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0);
- // The $<LINK_ONLY> expression may be in a link interface to specify private
- // link dependencies that are otherwise excluded from usage requirements.
- if(usage_requirements_only)
- {
- dagChecker.SetTransitivePropertiesOnly();
- }
- std::vector<std::string> libs;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
- cmSystemTools::ExpandListArgument(cge->Evaluate(
- this->Makefile,
- config,
- false,
- headTarget,
- this, &dagChecker), libs);
- this->LookupLinkItems(libs, items);
- hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::LookupLinkItems(std::vector<std::string> const& names,
- std::vector<cmLinkItem>& items) const
-{
- for(std::vector<std::string>::const_iterator i = names.begin();
- i != names.end(); ++i)
- {
- std::string name = this->CheckCMP0004(*i);
- if(name == this->GetName() || name.empty())
- {
- continue;
- }
- items.push_back(cmLinkItem(name, this->FindTargetToLink(name)));
- }
-}
-
-//----------------------------------------------------------------------------
const char* cmTarget::GetSuffixVariableInternal(bool implib) const
{
switch(this->GetType())
@@ -3404,21 +2780,6 @@ void cmTarget::SetPropertyDefault(const std::string& property,
}
//----------------------------------------------------------------------------
-bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const
-{
- if (this->GetPropertyAsBool("SKIP_BUILD_RPATH"))
- {
- return false;
- }
- if(cmLinkImplementationLibraries const* impl =
- this->GetLinkImplementationLibraries(config))
- {
- return !impl->Libraries.empty();
- }
- return false;
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::HaveInstallTreeRPATH() const
{
const char* install_rpath = this->GetProperty("INSTALL_RPATH");
@@ -3566,10 +2927,9 @@ bool cmTarget::ComputeOutputDir(const std::string& config,
// The generator may add the configuration's subdirectory.
if(!conf.empty())
{
- const char *platforms = this->Makefile->GetDefinition(
- "CMAKE_XCODE_EFFECTIVE_PLATFORMS");
+ bool iosPlatform = this->Makefile->PlatformIsAppleIos();
std::string suffix =
- usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : "";
+ usesDefaultOutputDir && iosPlatform ? "${EFFECTIVE_PLATFORM_NAME}" : "";
this->Makefile->GetGlobalGenerator()->
AppendDirectoryForConfig("/", conf, suffix, out);
}
@@ -3740,50 +3100,6 @@ cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const
}
//----------------------------------------------------------------------------
-void cmTarget::GetLanguages(std::set<std::string>& languages,
- const std::string& config) const
-{
- std::vector<cmSourceFile*> sourceFiles;
- this->GetSourceFiles(sourceFiles, config);
- for(std::vector<cmSourceFile*>::const_iterator
- i = sourceFiles.begin(); i != sourceFiles.end(); ++i)
- {
- const std::string& lang = (*i)->GetLanguage();
- if(!lang.empty())
- {
- languages.insert(lang);
- }
- }
-
- std::vector<cmTarget*> objectLibraries;
- std::vector<cmSourceFile const*> externalObjects;
- if (!this->Makefile->IsConfigured())
- {
- this->GetObjectLibrariesCMP0026(objectLibraries);
- }
- else
- {
- cmGeneratorTarget* gt = this->Makefile->GetGlobalGenerator()
- ->GetGeneratorTarget(this);
- gt->GetExternalObjects(externalObjects, config);
- for(std::vector<cmSourceFile const*>::const_iterator
- i = externalObjects.begin(); i != externalObjects.end(); ++i)
- {
- std::string objLib = (*i)->GetObjectLibrary();
- if (cmTarget* tgt = this->Makefile->FindTargetToUse(objLib))
- {
- objectLibraries.push_back(tgt);
- }
- }
- }
- for(std::vector<cmTarget*>::const_iterator
- i = objectLibraries.begin(); i != objectLibraries.end(); ++i)
- {
- (*i)->GetLanguages(languages, config);
- }
-}
-
-//----------------------------------------------------------------------------
cmTarget::ImportInfo const*
cmTarget::GetImportInfo(const std::string& config) const
{
@@ -4133,393 +3449,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
}
//----------------------------------------------------------------------------
-cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
- const std::string& config,
- cmTarget const* head) const
-{
- // Imported targets have their own link interface.
- if(this->IsImported())
- {
- return this->GetImportLinkInterface(config, head, false);
- }
-
- // Link interfaces are not supported for executables that do not
- // export symbols.
- if(this->GetType() == cmTarget::EXECUTABLE &&
- !this->IsExecutableWithExports())
- {
- return 0;
- }
-
- // Lookup any existing link interface for this configuration.
- std::string CONFIG = cmSystemTools::UpperCase(config);
- cmTargetInternals::HeadToLinkInterfaceMap& hm =
- this->Internal->LinkInterfaceMap[CONFIG];
-
- // If the link interface does not depend on the head target
- // then return the one we computed first.
- if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
- {
- return &hm.begin()->second;
- }
-
- cmTargetInternals::OptionalLinkInterface& iface = hm[head];
- if(!iface.LibrariesDone)
- {
- iface.LibrariesDone = true;
- this->Internal->ComputeLinkInterfaceLibraries(
- this, config, iface, head, false);
- }
- if(!iface.AllDone)
- {
- iface.AllDone = true;
- if(iface.Exists)
- {
- this->Internal->ComputeLinkInterface(this, config, iface, head);
- }
- }
-
- return iface.Exists? &iface : 0;
-}
-
-//----------------------------------------------------------------------------
-cmTarget::LinkInterfaceLibraries const*
-cmTarget::GetLinkInterfaceLibraries(const std::string& config,
- cmTarget const* head,
- bool usage_requirements_only) const
-{
- // Imported targets have their own link interface.
- if(this->IsImported())
- {
- return this->GetImportLinkInterface(config, head, usage_requirements_only);
- }
-
- // Link interfaces are not supported for executables that do not
- // export symbols.
- if(this->GetType() == cmTarget::EXECUTABLE &&
- !this->IsExecutableWithExports())
- {
- return 0;
- }
-
- // Lookup any existing link interface for this configuration.
- std::string CONFIG = cmSystemTools::UpperCase(config);
- cmTargetInternals::HeadToLinkInterfaceMap& hm =
- (usage_requirements_only ?
- this->Internal->LinkInterfaceUsageRequirementsOnlyMap[CONFIG] :
- this->Internal->LinkInterfaceMap[CONFIG]);
-
- // If the link interface does not depend on the head target
- // then return the one we computed first.
- if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
- {
- return &hm.begin()->second;
- }
-
- cmTargetInternals::OptionalLinkInterface& iface = hm[head];
- if(!iface.LibrariesDone)
- {
- iface.LibrariesDone = true;
- this->Internal->ComputeLinkInterfaceLibraries(
- this, config, iface, head, usage_requirements_only);
- }
-
- return iface.Exists? &iface : 0;
-}
-
-//----------------------------------------------------------------------------
-cmTarget::LinkInterface const*
-cmTarget::GetImportLinkInterface(const std::string& config,
- cmTarget const* headTarget,
- bool usage_requirements_only) const
-{
- cmTarget::ImportInfo const* info = this->GetImportInfo(config);
- if(!info)
- {
- return 0;
- }
-
- std::string CONFIG = cmSystemTools::UpperCase(config);
- cmTargetInternals::HeadToLinkInterfaceMap& hm =
- (usage_requirements_only ?
- this->Internal->LinkInterfaceUsageRequirementsOnlyMap[CONFIG] :
- this->Internal->LinkInterfaceMap[CONFIG]);
-
- // If the link interface does not depend on the head target
- // then return the one we computed first.
- if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
- {
- return &hm.begin()->second;
- }
-
- cmTargetInternals::OptionalLinkInterface& iface = hm[headTarget];
- if(!iface.AllDone)
- {
- iface.AllDone = true;
- iface.Multiplicity = info->Multiplicity;
- cmSystemTools::ExpandListArgument(info->Languages, iface.Languages);
- this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
- headTarget, usage_requirements_only,
- iface.Libraries,
- iface.HadHeadSensitiveCondition);
- std::vector<std::string> deps;
- cmSystemTools::ExpandListArgument(info->SharedDeps, deps);
- this->LookupLinkItems(deps, iface.SharedDeps);
- }
-
- return &iface;
-}
-
-//----------------------------------------------------------------------------
-void
-cmTargetInternals::ComputeLinkInterfaceLibraries(
- cmTarget const* thisTarget,
- const std::string& config,
- OptionalLinkInterface& iface,
- cmTarget const* headTarget,
- bool usage_requirements_only)
-{
- // Construct the property name suffix for this configuration.
- std::string suffix = "_";
- if(!config.empty())
- {
- suffix += cmSystemTools::UpperCase(config);
- }
- else
- {
- suffix += "NOCONFIG";
- }
-
- // An explicit list of interface libraries may be set for shared
- // libraries and executables that export symbols.
- const char* explicitLibraries = 0;
- std::string linkIfaceProp;
- if(thisTarget->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
- thisTarget->GetPolicyStatusCMP0022() != cmPolicies::WARN)
- {
- // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
- linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
- explicitLibraries = thisTarget->GetProperty(linkIfaceProp);
- }
- else if(thisTarget->GetType() == cmTarget::SHARED_LIBRARY ||
- thisTarget->IsExecutableWithExports())
- {
- // CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
- // shared lib or executable.
-
- // Lookup the per-configuration property.
- linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
- linkIfaceProp += suffix;
- explicitLibraries = thisTarget->GetProperty(linkIfaceProp);
-
- // If not set, try the generic property.
- if(!explicitLibraries)
- {
- linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
- explicitLibraries = thisTarget->GetProperty(linkIfaceProp);
- }
- }
-
- if(explicitLibraries &&
- thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
- !this->PolicyWarnedCMP0022)
- {
- // Compare the explicitly set old link interface properties to the
- // preferred new link interface property one and warn if different.
- const char* newExplicitLibraries =
- thisTarget->GetProperty("INTERFACE_LINK_LIBRARIES");
- if (newExplicitLibraries
- && strcmp(newExplicitLibraries, explicitLibraries) != 0)
- {
- std::ostringstream w;
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
- "Target \"" << thisTarget->GetName() << "\" has an "
- "INTERFACE_LINK_LIBRARIES property which differs from its " <<
- linkIfaceProp << " properties."
- "\n"
- "INTERFACE_LINK_LIBRARIES:\n"
- " " << newExplicitLibraries << "\n" <<
- linkIfaceProp << ":\n"
- " " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n";
- thisTarget->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
- this->PolicyWarnedCMP0022 = true;
- }
- }
-
- // There is no implicit link interface for executables or modules
- // so if none was explicitly set then there is no link interface.
- if(!explicitLibraries &&
- (thisTarget->GetType() == cmTarget::EXECUTABLE ||
- (thisTarget->GetType() == cmTarget::MODULE_LIBRARY)))
- {
- return;
- }
- iface.Exists = true;
- iface.ExplicitLibraries = explicitLibraries;
-
- if(explicitLibraries)
- {
- // The interface libraries have been explicitly set.
- thisTarget->ExpandLinkItems(linkIfaceProp, explicitLibraries, config,
- headTarget, usage_requirements_only,
- iface.Libraries,
- iface.HadHeadSensitiveCondition);
- }
- else if (thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN
- || thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD)
- // If CMP0022 is NEW then the plain tll signature sets the
- // INTERFACE_LINK_LIBRARIES, so if we get here then the project
- // cleared the property explicitly and we should not fall back
- // to the link implementation.
- {
- // The link implementation is the default link interface.
- cmLinkImplementationLibraries const* impl =
- thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget);
- iface.Libraries.insert(iface.Libraries.end(),
- impl->Libraries.begin(), impl->Libraries.end());
- if(thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
- !this->PolicyWarnedCMP0022 && !usage_requirements_only)
- {
- // Compare the link implementation fallback link interface to the
- // preferred new link interface property and warn if different.
- std::vector<cmLinkItem> ifaceLibs;
- static const std::string newProp = "INTERFACE_LINK_LIBRARIES";
- if(const char* newExplicitLibraries = thisTarget->GetProperty(newProp))
- {
- bool hadHeadSensitiveConditionDummy = false;
- thisTarget->ExpandLinkItems(newProp, newExplicitLibraries, config,
- headTarget, usage_requirements_only,
- ifaceLibs, hadHeadSensitiveConditionDummy);
- }
- if (ifaceLibs != iface.Libraries)
- {
- std::string oldLibraries = cmJoin(impl->Libraries, ";");
- std::string newLibraries = cmJoin(ifaceLibs, ";");
- if(oldLibraries.empty())
- { oldLibraries = "(empty)"; }
- if(newLibraries.empty())
- { newLibraries = "(empty)"; }
-
- std::ostringstream w;
- w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
- "Target \"" << thisTarget->GetName() << "\" has an "
- "INTERFACE_LINK_LIBRARIES property. "
- "This should be preferred as the source of the link interface "
- "for this library but because CMP0022 is not set CMake is "
- "ignoring the property and using the link implementation "
- "as the link interface instead."
- "\n"
- "INTERFACE_LINK_LIBRARIES:\n"
- " " << newLibraries << "\n"
- "Link implementation:\n"
- " " << oldLibraries << "\n";
- thisTarget->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
- this->PolicyWarnedCMP0022 = true;
- }
- }
- }
-}
-
-//----------------------------------------------------------------------------
-void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
- const std::string& config,
- OptionalLinkInterface& iface,
- cmTarget const* headTarget) const
-{
- if(iface.ExplicitLibraries)
- {
- if(thisTarget->GetType() == cmTarget::SHARED_LIBRARY
- || thisTarget->GetType() == cmTarget::STATIC_LIBRARY
- || thisTarget->GetType() == cmTarget::INTERFACE_LIBRARY)
- {
- // Shared libraries may have runtime implementation dependencies
- // on other shared libraries that are not in the interface.
- UNORDERED_SET<std::string> emitted;
- for(std::vector<cmLinkItem>::const_iterator
- li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li)
- {
- emitted.insert(*li);
- }
- if (thisTarget->GetType() != cmTarget::INTERFACE_LIBRARY)
- {
- cmTarget::LinkImplementation const* impl =
- thisTarget->GetLinkImplementation(config);
- for(std::vector<cmLinkImplItem>::const_iterator
- li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
- {
- if(emitted.insert(*li).second)
- {
- if(li->Target)
- {
- // This is a runtime dependency on another shared library.
- if(li->Target->GetType() == cmTarget::SHARED_LIBRARY)
- {
- iface.SharedDeps.push_back(*li);
- }
- }
- else
- {
- // TODO: Recognize shared library file names. Perhaps this
- // should be moved to cmComputeLinkInformation, but that creates
- // a chicken-and-egg problem since this list is needed for its
- // construction.
- }
- }
- }
- }
- }
- }
- else if (thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN
- || thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD)
- {
- // The link implementation is the default link interface.
- cmLinkImplementationLibraries const*
- impl = thisTarget->GetLinkImplementationLibrariesInternal(config,
- headTarget);
- iface.ImplementationIsInterface = true;
- iface.WrongConfigLibraries = impl->WrongConfigLibraries;
- }
-
- if(thisTarget->LinkLanguagePropagatesToDependents())
- {
- // Targets using this archive need its language runtime libraries.
- if(cmTarget::LinkImplementation const* impl =
- thisTarget->GetLinkImplementation(config))
- {
- iface.Languages = impl->Languages;
- }
- }
-
- if(thisTarget->GetType() == cmTarget::STATIC_LIBRARY)
- {
- // Construct the property name suffix for this configuration.
- std::string suffix = "_";
- if(!config.empty())
- {
- suffix += cmSystemTools::UpperCase(config);
- }
- else
- {
- suffix += "NOCONFIG";
- }
-
- // How many repetitions are needed if this library has cyclic
- // dependencies?
- std::string propName = "LINK_INTERFACE_MULTIPLICITY";
- propName += suffix;
- if(const char* config_reps = thisTarget->GetProperty(propName))
- {
- sscanf(config_reps, "%u", &iface.Multiplicity);
- }
- else if(const char* reps =
- thisTarget->GetProperty("LINK_INTERFACE_MULTIPLICITY"))
- {
- sscanf(reps, "%u", &iface.Multiplicity);
- }
- }
-}
-
-//----------------------------------------------------------------------------
void cmTargetInternals::AddInterfaceEntries(
cmTarget const* thisTarget, std::string const& config,
std::string const& prop, std::vector<TargetPropertyEntry*>& entries)
@@ -4545,32 +3474,12 @@ void cmTargetInternals::AddInterfaceEntries(
}
}
-//----------------------------------------------------------------------------
-cmTarget::LinkImplementation const*
-cmTarget::GetLinkImplementation(const std::string& config) const
+cmOptionalLinkImplementation&
+cmTarget::GetLinkImplMap(std::string const& config) const
{
- // There is no link implementation for imported targets.
- if(this->IsImported())
- {
- return 0;
- }
-
// Populate the link implementation for this configuration.
std::string CONFIG = cmSystemTools::UpperCase(config);
- cmTargetInternals::OptionalLinkImplementation&
- impl = this->Internal->LinkImplMap[CONFIG][this];
- if(!impl.LibrariesDone)
- {
- impl.LibrariesDone = true;
- this->Internal
- ->ComputeLinkImplementationLibraries(this, config, impl, this);
- }
- if(!impl.LanguagesDone)
- {
- impl.LanguagesDone = true;
- this->Internal->ComputeLinkImplementationLanguages(this, config, impl);
- }
- return &impl;
+ return Internal->LinkImplMap[CONFIG][this];
}
//----------------------------------------------------------------------------
@@ -4603,39 +3512,36 @@ cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config,
return &hm.begin()->second;
}
- cmTargetInternals::OptionalLinkImplementation& impl = hm[head];
+ cmOptionalLinkImplementation& impl = hm[head];
if(!impl.LibrariesDone)
{
impl.LibrariesDone = true;
- this->Internal
- ->ComputeLinkImplementationLibraries(this, config, impl, head);
+ this->ComputeLinkImplementationLibraries(config, impl, head);
}
return &impl;
}
//----------------------------------------------------------------------------
-void
-cmTargetInternals::ComputeLinkImplementationLibraries(
- cmTarget const* thisTarget,
+void cmTarget::ComputeLinkImplementationLibraries(
const std::string& config,
- OptionalLinkImplementation& impl,
+ cmOptionalLinkImplementation& impl,
cmTarget const* head) const
{
// Collect libraries directly linked in this configuration.
for (std::vector<cmValueWithOrigin>::const_iterator
- le = this->LinkImplementationPropertyEntries.begin(),
- end = this->LinkImplementationPropertyEntries.end();
+ le = this->Internal->LinkImplementationPropertyEntries.begin(),
+ end = this->Internal->LinkImplementationPropertyEntries.end();
le != end; ++le)
{
std::vector<std::string> llibs;
cmGeneratorExpressionDAGChecker dagChecker(
- thisTarget->GetName(),
+ this->GetName(),
"LINK_LIBRARIES", 0, 0);
cmGeneratorExpression ge(le->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge =
ge.Parse(le->Value);
std::string const evaluated =
- cge->Evaluate(thisTarget->Makefile, config, false, head, &dagChecker);
+ cge->Evaluate(this->Makefile, config, false, head, &dagChecker);
cmSystemTools::ExpandListArgument(evaluated, llibs);
if(cge->GetHadHeadSensitiveCondition())
{
@@ -4646,15 +3552,15 @@ cmTargetInternals::ComputeLinkImplementationLibraries(
li != llibs.end(); ++li)
{
// Skip entries that resolve to the target itself or are empty.
- std::string name = thisTarget->CheckCMP0004(*li);
- if(name == thisTarget->GetName() || name.empty())
+ std::string name = this->CheckCMP0004(*li);
+ if(name == this->GetName() || name.empty())
{
- if(name == thisTarget->GetName())
+ if(name == this->GetName())
{
bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR;
std::ostringstream e;
- switch(thisTarget->GetPolicyStatusCMP0038())
+ switch(this->GetPolicyStatusCMP0038())
{
case cmPolicies::WARN:
{
@@ -4673,9 +3579,9 @@ cmTargetInternals::ComputeLinkImplementationLibraries(
if(!noMessage)
{
- e << "Target \"" << thisTarget->GetName() << "\" links to itself.";
- thisTarget->Makefile->GetCMakeInstance()->IssueMessage(
- messageType, e.str(), thisTarget->GetBacktrace());
+ e << "Target \"" << this->GetName() << "\" links to itself.";
+ this->Makefile->GetCMakeInstance()->IssueMessage(
+ messageType, e.str(), this->GetBacktrace());
if (messageType == cmake::FATAL_ERROR)
{
return;
@@ -4687,7 +3593,7 @@ cmTargetInternals::ComputeLinkImplementationLibraries(
// The entry is meant for this configuration.
impl.Libraries.push_back(
- cmLinkImplItem(name, thisTarget->FindTargetToLink(name),
+ cmLinkImplItem(name, this->FindTargetToLink(name),
le->Backtrace, evaluated != le->Value));
}
@@ -4695,51 +3601,35 @@ cmTargetInternals::ComputeLinkImplementationLibraries(
for (std::set<std::string>::const_iterator it = seenProps.begin();
it != seenProps.end(); ++it)
{
- if (!thisTarget->GetProperty(*it))
+ if (!this->GetProperty(*it))
{
- thisTarget->LinkImplicitNullProperties.insert(*it);
+ this->LinkImplicitNullProperties.insert(*it);
}
}
- cge->GetMaxLanguageStandard(thisTarget, thisTarget->MaxLanguageStandards);
+ cge->GetMaxLanguageStandard(this, this->MaxLanguageStandards);
}
- cmTarget::LinkLibraryType linkType = thisTarget->ComputeLinkType(config);
+ cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config);
cmTarget::LinkLibraryVectorType const& oldllibs =
- thisTarget->GetOriginalLinkLibraries();
+ this->GetOriginalLinkLibraries();
for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
li != oldllibs.end(); ++li)
{
if(li->second != cmTarget::GENERAL && li->second != linkType)
{
- std::string name = thisTarget->CheckCMP0004(li->first);
- if(name == thisTarget->GetName() || name.empty())
+ std::string name = this->CheckCMP0004(li->first);
+ if(name == this->GetName() || name.empty())
{
continue;
}
// Support OLD behavior for CMP0003.
impl.WrongConfigLibraries.push_back(
- cmLinkItem(name, thisTarget->FindTargetToLink(name)));
+ cmLinkItem(name, this->FindTargetToLink(name)));
}
}
}
//----------------------------------------------------------------------------
-void
-cmTargetInternals::ComputeLinkImplementationLanguages(
- cmTarget const* thisTarget,
- const std::string& config,
- OptionalLinkImplementation& impl) const
-{
- // This target needs runtime libraries for its source languages.
- std::set<std::string> languages;
- // Get languages used in our source files.
- thisTarget->GetLanguages(languages, config);
- // Copy the set of langauges to the link implementation.
- impl.Languages.insert(impl.Languages.begin(),
- languages.begin(), languages.end());
-}
-
-//----------------------------------------------------------------------------
cmTarget const* cmTarget::FindTargetToLink(std::string const& name) const
{
cmTarget const* tgt = this->Makefile->FindTargetToUse(name);
@@ -4846,10 +3736,6 @@ cmTargetInternalPointer
//----------------------------------------------------------------------------
cmTargetInternalPointer::~cmTargetInternalPointer()
{
- cmDeleteAll(this->Pointer->IncludeDirectoriesItems);
- cmDeleteAll(this->Pointer->CompileOptionsItems);
- cmDeleteAll(this->Pointer->CompileFeaturesItems);
- cmDeleteAll(this->Pointer->CompileDefinitionsItems);
cmDeleteAll(this->Pointer->SourceEntries);
delete this->Pointer;
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 2007b40..3e71dbd 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -41,7 +41,8 @@
F(CMP0046) \
F(CMP0052) \
F(CMP0060) \
- F(CMP0063)
+ F(CMP0063) \
+ F(CMP0065)
class cmake;
class cmMakefile;
@@ -132,15 +133,11 @@ public:
void AddPostBuildCommand(cmCustomCommand const &cmd)
{this->PostBuildCommands.push_back(cmd);}
- void Compute();
-
/**
* Get the list of the source files used by this target
*/
void GetSourceFiles(std::vector<cmSourceFile*> &files,
const std::string& config) const;
- bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const;
-
/**
* Add sources to the target.
*/
@@ -233,54 +230,16 @@ public:
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;
- /** The link interface specifies transitive library dependencies and
- other information needed by targets that link to this target. */
- struct LinkInterfaceLibraries
- {
- // Libraries listed in the interface.
- std::vector<cmLinkItem> Libraries;
- };
- struct LinkInterface: public LinkInterfaceLibraries
- {
- // Languages whose runtime libraries must be linked.
- std::vector<std::string> Languages;
-
- // Shared library dependencies needed for linking on some platforms.
- std::vector<cmLinkItem> SharedDeps;
-
- // Number of repetitions of a strongly connected component of two
- // or more static libraries.
- int Multiplicity;
-
- // Libraries listed for other configurations.
- // Needed only for OLD behavior of CMP0003.
- std::vector<cmLinkItem> WrongConfigLibraries;
-
- bool ImplementationIsInterface;
-
- LinkInterface(): Multiplicity(0), ImplementationIsInterface(false) {}
- };
-
- /** Get the link interface for the given configuration. Returns 0
- if the target cannot be linked. */
- LinkInterface const* GetLinkInterface(const std::string& config,
- cmTarget const* headTarget) const;
- LinkInterfaceLibraries const*
- GetLinkInterfaceLibraries(const std::string& config,
- cmTarget const* headTarget,
- bool usage_requirements_only) const;
-
- struct LinkImplementation: public cmLinkImplementationLibraries
- {
- // Languages whose runtime libraries must be linked.
- std::vector<std::string> Languages;
- };
- LinkImplementation const*
- GetLinkImplementation(const std::string& config) const;
-
cmLinkImplementationLibraries const*
GetLinkImplementationLibraries(const std::string& config) const;
+ void ComputeLinkImplementationLibraries(const std::string& config,
+ cmOptionalLinkImplementation& impl,
+ cmTarget const* head) const;
+
+ cmOptionalLinkImplementation&
+ GetLinkImplMap(std::string const& config) const;
+
cmTarget const* FindTargetToLink(std::string const& name) const;
/** Strip off leading and trailing whitespace from an item named in
@@ -331,7 +290,6 @@ public:
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
const char* newExt = 0) const;
- bool HaveBuildTreeRPATH(const std::string& config) const;
bool HaveInstallTreeRPATH() const;
// Get the properties
@@ -346,18 +304,6 @@ public:
If no macro should be defined null is returned. */
const char* GetExportMacro() const;
- void GetCompileDefinitions(std::vector<std::string> &result,
- const std::string& config,
- const std::string& language) const;
-
- // Compute the set of languages compiled by the target. This is
- // computed every time it is called because the languages can change
- // when source file properties are changed and we do not have enough
- // information to forward these property changes to the targets
- // until we have per-target object file properties.
- void GetLanguages(std::set<std::string>& languages,
- std::string const& config) const;
-
/** Return whether this target is an executable with symbol exports
enabled. */
bool IsExecutableWithExports() const;
@@ -401,9 +347,6 @@ public:
/** @return whether this target have a well defined output file name. */
bool HaveWellDefinedOutputFiles() const;
- std::vector<std::string> GetIncludeDirectories(
- const std::string& config,
- const std::string& language) const;
void InsertInclude(std::string const& entry,
cmListFileBacktrace const& bt,
bool before = false);
@@ -415,12 +358,6 @@ public:
void AppendBuildInterfaceIncludes();
- void GetCompileOptions(std::vector<std::string> &result,
- const std::string& config,
- const std::string& language) const;
- void GetCompileFeatures(std::vector<std::string> &features,
- const std::string& config) const;
-
bool IsNullImpliedByLinkLibraries(const std::string &p) const;
std::string GetDebugGeneratorExpressions(const std::string &value,
@@ -439,6 +376,18 @@ public:
return this->MaxLanguageStandards;
}
+ cmStringRange GetIncludeDirectoriesEntries() const;
+ cmBacktraceRange GetIncludeDirectoriesBacktraces() const;
+
+ cmStringRange GetCompileOptionsEntries() const;
+ cmBacktraceRange GetCompileOptionsBacktraces() const;
+
+ cmStringRange GetCompileFeaturesEntries() const;
+ cmBacktraceRange GetCompileFeaturesBacktraces() const;
+
+ cmStringRange GetCompileDefinitionsEntries() const;
+ cmBacktraceRange GetCompileDefinitionsBacktraces() const;
+
#if defined(_WIN32) && !defined(__CYGWIN__)
const LinkLibraryVectorType &GetLinkLibrariesForVS6() const {
return this->LinkLibrariesForVS6;}
@@ -553,11 +502,7 @@ private:
bool IsApple;
bool IsImportedTarget;
bool BuildInterfaceIncludesAppended;
- mutable bool DebugIncludesDone;
- mutable bool DebugCompileOptionsDone;
- mutable bool DebugCompileDefinitionsDone;
mutable bool DebugSourcesDone;
- mutable bool DebugCompileFeaturesDone;
mutable bool LinkImplementationLanguageIsContextDependent;
#if defined(_WIN32) && !defined(__CYGWIN__)
bool LinkLibrariesForVS6Analyzed;
@@ -591,31 +536,16 @@ private:
void ComputeImportInfo(std::string const& desired_config,
ImportInfo& info) const;
-
- LinkInterface const*
- GetImportLinkInterface(const std::string& config, cmTarget const* head,
- bool usage_requirements_only) const;
-
cmLinkImplementationLibraries const*
GetLinkImplementationLibrariesInternal(const std::string& config,
cmTarget const* head) const;
- void ExpandLinkItems(std::string const& prop, std::string const& value,
- std::string const& config, cmTarget const* headTarget,
- bool usage_requirements_only,
- std::vector<cmLinkItem>& items,
- bool& hadHeadSensitiveCondition) const;
- void LookupLinkItems(std::vector<std::string> const& names,
- std::vector<cmLinkItem>& items) const;
-
std::string ProcessSourceItemCMP0049(const std::string& s);
void ClearLinkMaps();
void MaybeInvalidatePropertyCache(const std::string& prop);
- void ProcessSourceExpression(std::string const& expr);
-
// Internal representation details.
friend class cmTargetInternals;
friend class cmGeneratorTarget;
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 1815ade..9d85f5a 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -14,6 +14,7 @@
#include "cmGeneratorExpression.h"
#include "cmOutputConverter.h"
#include "cmMakefile.h"
+#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTest.h"
@@ -27,6 +28,7 @@ cmTestGenerator
{
this->ActionsPerConfig = !test->GetOldStyle();
this->TestGenerated = false;
+ this->LG = 0;
}
//----------------------------------------------------------------------------
@@ -35,6 +37,11 @@ cmTestGenerator
{
}
+void cmTestGenerator::Compute(cmLocalGenerator* lg)
+{
+ this->LG = lg;
+}
+
//----------------------------------------------------------------------------
void cmTestGenerator::GenerateScriptConfigs(std::ostream& os,
Indent const& indent)
@@ -81,8 +88,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// Check whether the command executable is a target whose name is to
// be translated.
std::string exe = command[0];
- cmMakefile* mf = this->Test->GetMakefile();
- cmGeneratorTarget* target = mf->FindGeneratorTargetToUse(exe);
+ cmGeneratorTarget* target =
+ this->LG->GetMakefile()->FindGeneratorTargetToUse(exe);
if(target && target->GetType() == cmTarget::EXECUTABLE)
{
// Use the target file on disk.
@@ -110,7 +117,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
else
{
// Use the command name given.
- exe = ge.Parse(exe.c_str())->Evaluate(mf, config);
+ exe = ge.Parse(exe.c_str())->Evaluate(this->LG->GetMakefile(), config);
cmSystemTools::ConvertToUnixSlashes(exe);
}
@@ -120,7 +127,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
ci != command.end(); ++ci)
{
os << " " << cmOutputConverter::EscapeForCMake(
- ge.Parse(*ci)->Evaluate(mf, config));
+ ge.Parse(*ci)->Evaluate(
+ this->LG->GetMakefile(), config));
}
// Finish the test command.
@@ -137,7 +145,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
{
os << " " << i->first
<< " " << cmOutputConverter::EscapeForCMake(
- ge.Parse(i->second.GetValue())->Evaluate(mf, config));
+ ge.Parse(i->second.GetValue())->Evaluate(this->LG->GetMakefile(),
+ config));
}
os << ")" << std::endl;
}
diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h
index 5446553..de8ab78 100644
--- a/Source/cmTestGenerator.h
+++ b/Source/cmTestGenerator.h
@@ -15,6 +15,7 @@
#include "cmScriptGenerator.h"
class cmTest;
+class cmLocalGenerator;
/** \class cmTestGenerator
* \brief Support class for generating install scripts.
@@ -28,6 +29,8 @@ public:
configurations = std::vector<std::string>());
virtual ~cmTestGenerator();
+ void Compute(cmLocalGenerator* lg);
+
protected:
virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
@@ -38,6 +41,7 @@ protected:
virtual bool NeedsScriptNoConfig() const;
void GenerateOldStyle(std::ostream& os, Indent const& indent);
+ cmLocalGenerator* LG;
cmTest* Test;
bool TestGenerated;
};
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 80b8591..92403e3 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -965,7 +965,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::vector<cmSourceGroup> sourceGroups =
this->Makefile->GetSourceGroups();
std::vector<cmSourceFile*> classes;
- if (!this->Target->GetConfigCommonSourceFiles(classes))
+ if (!this->GeneratorTarget->GetConfigCommonSourceFiles(classes))
{
return;
}
@@ -1656,7 +1656,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
// for the first time we need a new line if there is something
// produced here.
const char* firstString = ">\n";
- if(objectName.size())
+ if(!objectName.empty())
{
(*this->BuildFileStream ) << firstString;
firstString = "";
@@ -1675,7 +1675,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
defPropName += configUpper;
if(const char* ccdefs = sf.GetProperty(defPropName.c_str()))
{
- if(configDefines.size())
+ if(!configDefines.empty())
{
configDefines += ";";
}
@@ -1934,7 +1934,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.Parse(flags.c_str());
clOptions.Parse(defineFlags.c_str());
std::vector<std::string> targetDefines;
- this->Target->GetCompileDefinitions(targetDefines,
+ this->GeneratorTarget->GetCompileDefinitions(targetDefines,
configName.c_str(), "CXX");
clOptions.AddDefines(targetDefines);
if(this->MSTools)
@@ -2203,6 +2203,33 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
}
}
+void cmVisualStudio10TargetGenerator::WriteManifestOptions(
+ std::string const& config)
+{
+ if (this->Target->GetType() != cmTarget::EXECUTABLE &&
+ this->Target->GetType() != cmTarget::SHARED_LIBRARY &&
+ this->Target->GetType() != cmTarget::MODULE_LIBRARY)
+ {
+ return;
+ }
+
+ std::vector<cmSourceFile const*> manifest_srcs;
+ this->GeneratorTarget->GetManifests(manifest_srcs, config);
+ if (!manifest_srcs.empty())
+ {
+ this->WriteString("<Manifest>\n", 2);
+ this->WriteString("<AdditionalManifestFiles>", 3);
+ for (std::vector<cmSourceFile const*>::const_iterator
+ mi = manifest_srcs.begin(); mi != manifest_srcs.end(); ++mi)
+ {
+ std::string m = this->ConvertPath((*mi)->GetFullPath(), false);
+ this->ConvertToWindowsSlash(m);
+ (*this->BuildFileStream) << m << ";";
+ }
+ (*this->BuildFileStream) << "</AdditionalManifestFiles>\n";
+ this->WriteString("</Manifest>\n", 2);
+ }
+}
//----------------------------------------------------------------------------
void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
@@ -2422,7 +2449,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
libs = this->Makefile->GetSafeDefinition(standardLibsVar.c_str());
// Remove trailing spaces from libs
std::string::size_type pos = libs.size()-1;
- if(libs.size() != 0)
+ if(!libs.empty())
{
while(libs[pos] == ' ')
{
@@ -2740,6 +2767,8 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
this->WriteLinkOptions(*i);
// output lib flags <Lib></Lib>
this->WriteLibOptions(*i);
+ // output manifest flags <Manifest></Manifest>
+ this->WriteManifestOptions(*i);
if(this->NsightTegra &&
this->Target->GetType() == cmTarget::EXECUTABLE &&
this->Target->GetPropertyAsBool("ANDROID_GUI"))
@@ -2783,7 +2812,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
std::vector<cmCustomCommand> const& commands,
std::string const& configName)
{
- if(commands.size() == 0)
+ if(commands.empty())
{
return;
}
@@ -2820,7 +2849,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
= this->GlobalGenerator->GetTargetDirectDepends(this->GeneratorTarget);
typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet
OrderedTargetDependSet;
- OrderedTargetDependSet depends(unordered);
+ OrderedTargetDependSet depends(unordered, CMAKE_CHECK_BUILD_SYSTEM_TARGET);
this->WriteString("<ItemGroup>\n", 1);
for( OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
@@ -2893,7 +2922,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
(*this->BuildFileStream) << cmVS10EscapeXML(artifactDir) <<
"\\</AppxPackageArtifactsDir>\n";
this->WriteString("<ProjectPriFullPath>"
- "$(TargetDir)resources.pri</ProjectPriFullPath>", 2);
+ "$(TargetDir)resources.pri</ProjectPriFullPath>\n", 2);
// If we are missing files and we don't have a certificate and
// aren't targeting WP8.0, add a default certificate
@@ -2911,6 +2940,13 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
this->WriteString("<", 2);
(*this->BuildFileStream) << "PackageCertificateKeyFile>"
<< pfxFile << "</PackageCertificateKeyFile>\n";
+ std::string thumb = cmSystemTools::ComputeCertificateThumbprint(pfxFile);
+ if (!thumb.empty())
+ {
+ this->WriteString("<PackageCertificateThumbprint>", 2);
+ (*this->BuildFileStream) << thumb
+ << "</PackageCertificateThumbprint>\n";
+ }
this->WriteString("</PropertyGroup>\n", 1);
}
else if(!pfxFile.empty())
@@ -2919,6 +2955,13 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
this->WriteString("<", 2);
(*this->BuildFileStream) << "PackageCertificateKeyFile>"
<< pfxFile << "</PackageCertificateKeyFile>\n";
+ std::string thumb = cmSystemTools::ComputeCertificateThumbprint(pfxFile);
+ if (!thumb.empty())
+ {
+ this->WriteString("<PackageCertificateThumbprint>", 2);
+ (*this->BuildFileStream) << thumb
+ << "</PackageCertificateThumbprint>\n";
+ }
this->WriteString("</PropertyGroup>\n", 1);
}
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 451f8b2..5fadb60 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -111,6 +111,7 @@ private:
void AddLibraries(cmComputeLinkInformation& cli,
std::vector<std::string>& libVec);
void WriteLibOptions(std::string const& config);
+ void WriteManifestOptions(std::string const& config);
void WriteEvents(std::string const& configName);
void WriteEvent(const char* name,
std::vector<cmCustomCommand> const& commands,
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index abd350e..bd4eb69 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -274,7 +274,7 @@ cmVisualStudioGeneratorOptions
{
// if there are configuration specific flags, then
// use the configuration specific tag for PreprocessorDefinitions
- if(this->Configuration.size())
+ if(!this->Configuration.empty())
{
fout << prefix;
this->TargetGenerator->WritePlatformConfigTag(
@@ -346,7 +346,7 @@ cmVisualStudioGeneratorOptions
m != this->FlagMap.end(); ++m)
{
fout << indent;
- if(this->Configuration.size())
+ if(!this->Configuration.empty())
{
this->TargetGenerator->WritePlatformConfigTag(
m->first.c_str(),
@@ -398,7 +398,7 @@ cmVisualStudioGeneratorOptions
if(this->Version >= cmGlobalVisualStudioGenerator::VS10)
{
fout << prefix;
- if(this->Configuration.size())
+ if(!this->Configuration.empty())
{
this->TargetGenerator->WritePlatformConfigTag(
"AdditionalOptions",
diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx
index f30f700..3973540 100644
--- a/Source/cmXCode21Object.cxx
+++ b/Source/cmXCode21Object.cxx
@@ -22,7 +22,7 @@ cmXCode21Object::cmXCode21Object(PBXType ptype, Type type)
//----------------------------------------------------------------------------
void cmXCode21Object::PrintComment(std::ostream& out)
{
- if(this->Comment.size() == 0)
+ if(this->Comment.empty())
{
cmXCodeObject* n = this->GetObject("name");
if(n)
diff --git a/Source/cmXMLSafe.cxx b/Source/cmXMLSafe.cxx
index 99f5625..4ad05ca 100644
--- a/Source/cmXMLSafe.cxx
+++ b/Source/cmXMLSafe.cxx
@@ -13,8 +13,8 @@
#include "cm_utf8.h"
-#include <cmsys/ios/iostream>
-#include <cmsys/ios/sstream>
+#include <iostream>
+#include <sstream>
#include <string.h>
#include <stdio.h>
@@ -45,13 +45,13 @@ cmXMLSafe& cmXMLSafe::Quotes(bool b)
//----------------------------------------------------------------------------
std::string cmXMLSafe::str()
{
- cmsys_ios::ostringstream ss;
+ std::ostringstream ss;
ss << *this;
return ss.str();
}
//----------------------------------------------------------------------------
-cmsys_ios::ostream& operator<<(cmsys_ios::ostream& os, cmXMLSafe const& self)
+std::ostream& operator<<(std::ostream& os, cmXMLSafe const& self)
{
char const* first = self.Data;
char const* last = self.Data + self.Size;
diff --git a/Source/cmXMLSafe.h b/Source/cmXMLSafe.h
index c23a90c..ead2e01 100644
--- a/Source/cmXMLSafe.h
+++ b/Source/cmXMLSafe.h
@@ -12,8 +12,9 @@
#ifndef cmXMLSafe_h
#define cmXMLSafe_h
-#include <cmsys/stl/string>
-#include <cmsys/ios/iosfwd>
+#include <cmsys/Configure.hxx>
+#include <string>
+#include <iosfwd>
/** \class cmXMLSafe
* \brief Write strings to XML with proper escapes
@@ -37,8 +38,7 @@ private:
char const* Data;
unsigned long Size;
bool DoQuotes;
- friend cmsys_ios::ostream& operator<<(cmsys_ios::ostream&,
- cmXMLSafe const&);
+ friend std::ostream& operator<<(std::ostream&, cmXMLSafe const&);
};
#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index dbbe07d..386f6a5 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -135,7 +135,6 @@ cmake::cmake()
this->ClearBuildSystem = false;
this->FileComparison = new cmFileTimeComparison;
- this->Policies = new cmPolicies();
this->State = new cmState(this);
this->CurrentSnapshot = this->State->CreateBaseSnapshot();
@@ -173,7 +172,6 @@ cmake::cmake()
cmake::~cmake()
{
delete this->CacheManager;
- delete this->Policies;
delete this->State;
if (this->GlobalGenerator)
{
@@ -378,7 +376,9 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
std::string homeOutputDir = this->GetHomeOutputDirectory();
this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
- cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator());
+ cmState::Snapshot snapshot = this->GetCurrentSnapshot();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get()));
lg->GetMakefile()->SetCurrentBinaryDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
lg->GetMakefile()->SetCurrentSourceDirectory
@@ -418,9 +418,10 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
cmGlobalGenerator *gg = new cmGlobalGenerator(this);
this->SetGlobalGenerator(gg);
+ cmState::Snapshot snapshot = this->GetCurrentSnapshot();
// read in the list file to fill the cache
- cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator());
- cmMakefile* mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get()));
mf->SetCurrentBinaryDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
mf->SetCurrentSourceDirectory
@@ -1904,8 +1905,8 @@ int cmake::CheckBuildSystem()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
- cmMakefile* mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag())
{
@@ -1934,8 +1935,11 @@ int cmake::CheckBuildSystem()
ggd(this->CreateGlobalGenerator(genName));
if(ggd.get())
{
- cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator());
- lgd->ClearDependencies(mf, verbose);
+ cmsys::auto_ptr<cmMakefile> mfd(new cmMakefile(ggd.get(),
+ cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lgd(
+ ggd->CreateLocalGenerator(mfd.get()));
+ lgd->ClearDependencies(mfd.get(), verbose);
}
}
diff --git a/Source/cmake.h b/Source/cmake.h
index 20e49e3..9d28cba 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -27,7 +27,6 @@ class cmVariableWatch;
class cmFileTimeComparison;
class cmExternalMakefileProjectGenerator;
class cmDocumentationSection;
-class cmPolicies;
class cmTarget;
class cmGeneratedFileStream;
@@ -338,7 +337,6 @@ protected:
void AddExtraGenerator(const std::string& name,
CreateExtraGeneratorFunctionType newFunction);
- cmPolicies *Policies;
cmGlobalGenerator *GlobalGenerator;
cmCacheManager *CacheManager;
bool SuppressDevWarnings;
diff --git a/Source/cmake.version.manifest b/Source/cmake.version.manifest
new file mode 100644
index 0000000..e7010c9
--- /dev/null
+++ b/Source/cmake.version.manifest
@@ -0,0 +1,18 @@
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
+ manifestVersion="1.0"
+ xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!-- Windows Vista -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ <!-- Windows 7 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ <!-- Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <!-- Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <!-- Windows 10 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ </application>
+ </compatibility>
+</assembly>
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 7bee0ea..f44c77d 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -768,7 +768,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen))
{
cm.SetGlobalGenerator(ggd);
- cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator());
+ cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(ggd, snapshot));
+ cmsys::auto_ptr<cmLocalGenerator> lgd(
+ ggd->CreateLocalGenerator(mf.get()));
lgd->GetMakefile()->SetCurrentSourceDirectory(startDir);
lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir);
@@ -1352,6 +1355,35 @@ int cmcmd::WindowsCEEnvironment(const char* version, const std::string& name)
return -1;
}
+class cmVSLink
+{
+ int Type;
+ bool Verbose;
+ bool Incremental;
+ bool LinkGeneratesManifest;
+ std::vector<std::string> LinkCommand;
+ std::vector<std::string> UserManifests;
+ std::string LinkerManifestFile;
+ std::string ManifestFile;
+ std::string ManifestFileRC;
+ std::string ManifestFileRes;
+ std::string TargetFile;
+public:
+ cmVSLink(int type, bool verbose)
+ : Type(type)
+ , Verbose(verbose)
+ , Incremental(false)
+ , LinkGeneratesManifest(true)
+ {}
+ bool Parse(std::vector<std::string>::const_iterator argBeg,
+ std::vector<std::string>::const_iterator argEnd);
+ int Link();
+private:
+ int LinkIncremental();
+ int LinkNonIncremental();
+ int RunMT(std::string const& out, bool notify);
+};
+
// For visual studio 2005 and newer manifest files need to be embedded into
// exe and dll's. This code does that in such a way that incremental linking
// still works.
@@ -1361,11 +1393,7 @@ int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
{
return -1;
}
- bool verbose = false;
- if(cmSystemTools::GetEnv("VERBOSE"))
- {
- verbose = true;
- }
+ bool verbose = cmSystemTools::GetEnv("VERBOSE")? true:false;
std::vector<std::string> expandedArgs;
for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i)
@@ -1386,79 +1414,19 @@ int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
expandedArgs.push_back(*i);
}
}
- bool hasIncremental = false;
- bool hasManifest = true;
- for(std::vector<std::string>::iterator i = expandedArgs.begin();
- i != expandedArgs.end(); ++i)
- {
- if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL:YES") == 0)
- {
- hasIncremental = true;
- }
- if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL") == 0)
- {
- hasIncremental = true;
- }
- if(cmSystemTools::Strucmp(i->c_str(), "/MANIFEST:NO") == 0)
- {
- hasManifest = false;
- }
- }
- if(hasIncremental && hasManifest)
- {
- if(verbose)
- {
- std::cout << "Visual Studio Incremental Link with embedded manifests\n";
- }
- return cmcmd::VisualStudioLinkIncremental(expandedArgs, type, verbose);
- }
- if(verbose)
- {
- if(!hasIncremental)
- {
- std::cout << "Visual Studio Non-Incremental Link\n";
- }
- else
- {
- std::cout << "Visual Studio Incremental Link without manifests\n";
- }
- }
- return cmcmd::VisualStudioLinkNonIncremental(expandedArgs,
- type, hasManifest, verbose);
-}
-int cmcmd::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
- std::vector<std::string>& command,
- std::string& targetName)
-{
- std::vector<std::string>::iterator i = args.begin();
- i++; // skip -E
- i++; // skip vs_link_dll or vs_link_exe
- command.push_back(*i);
- i++; // move past link command
- for(; i != args.end(); ++i)
- {
- command.push_back(*i);
- if(i->find("/Fe") == 0)
- {
- targetName = i->substr(3);
- }
- if(i->find("/out:") == 0)
- {
- targetName = i->substr(5);
- }
- }
- if(targetName.empty() || command.empty())
+ cmVSLink vsLink(type, verbose);
+ if (!vsLink.Parse(expandedArgs.begin()+2, expandedArgs.end()))
{
return -1;
}
- return 0;
+ return vsLink.Link();
}
-bool cmcmd::RunCommand(const char* comment,
+static bool RunCommand(const char* comment,
std::vector<std::string>& command,
bool verbose,
- int* retCodeOut)
+ int* retCodeOut = 0)
{
if(verbose)
{
@@ -1500,8 +1468,134 @@ bool cmcmd::RunCommand(const char* comment,
return retCode == 0;
}
-int cmcmd::VisualStudioLinkIncremental(std::vector<std::string>& args,
- int type, bool verbose)
+bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg,
+ std::vector<std::string>::const_iterator argEnd)
+{
+ // Parse our own arguments.
+ std::string intDir;
+ std::vector<std::string>::const_iterator arg = argBeg;
+ while (arg != argEnd && cmHasLiteralPrefix(*arg, "-"))
+ {
+ if (*arg == "--")
+ {
+ ++arg;
+ break;
+ }
+ else if (*arg == "--manifests")
+ {
+ for (++arg; arg != argEnd && !cmHasLiteralPrefix(*arg, "-"); ++arg)
+ {
+ this->UserManifests.push_back(*arg);
+ }
+ }
+ else if (cmHasLiteralPrefix(*arg, "--intdir="))
+ {
+ intDir = arg->substr(9);
+ ++arg;
+ }
+ else
+ {
+ std::cerr << "unknown argument '" << *arg << "'\n";
+ return false;
+ }
+ }
+ if (intDir.empty())
+ {
+ return false;
+ }
+
+ // The rest of the arguments form the link command.
+ if (arg == argEnd)
+ {
+ return false;
+ }
+ this->LinkCommand.insert(this->LinkCommand.begin(), arg, argEnd);
+
+ // Parse the link command to extract information we need.
+ for (; arg != argEnd; ++arg)
+ {
+ if (cmSystemTools::Strucmp(arg->c_str(), "/INCREMENTAL:YES") == 0)
+ {
+ this->Incremental = true;
+ }
+ else if (cmSystemTools::Strucmp(arg->c_str(), "/INCREMENTAL") == 0)
+ {
+ this->Incremental = true;
+ }
+ else if (cmSystemTools::Strucmp(arg->c_str(), "/MANIFEST:NO") == 0)
+ {
+ this->LinkGeneratesManifest = false;
+ }
+ else if (cmHasLiteralPrefix(*arg, "/Fe"))
+ {
+ this->TargetFile = arg->substr(3);
+ }
+ else if (cmHasLiteralPrefix(*arg, "/out:"))
+ {
+ this->TargetFile = arg->substr(5);
+ }
+ }
+
+ if (this->TargetFile.empty())
+ {
+ return false;
+ }
+
+ this->ManifestFile = intDir + "/embed.manifest";
+ this->LinkerManifestFile = intDir + "/intermediate.manifest";
+
+ if (this->Incremental)
+ {
+ // We will compile a resource containing the manifest and
+ // pass it to the link command.
+ this->ManifestFileRC = intDir + "/manifest.rc";
+ this->ManifestFileRes = intDir + "/manifest.res";
+ this->LinkCommand.push_back(this->ManifestFileRes);
+ }
+ else if (this->UserManifests.empty())
+ {
+ // Prior to support for user-specified manifests CMake placed the
+ // linker-generated manifest next to the binary (as if it were not to be
+ // embedded) when not linking incrementally. Preserve this behavior.
+ this->ManifestFile = this->TargetFile + ".manifest";
+ this->LinkerManifestFile = this->ManifestFile;
+ }
+
+ if (this->LinkGeneratesManifest)
+ {
+ this->LinkCommand.push_back("/MANIFEST");
+ this->LinkCommand.push_back("/MANIFESTFILE:" + this->LinkerManifestFile);
+ }
+
+ return true;
+}
+
+int cmVSLink::Link()
+{
+ if (this->Incremental &&
+ (this->LinkGeneratesManifest || !this->UserManifests.empty()))
+ {
+ if (this->Verbose)
+ {
+ std::cout << "Visual Studio Incremental Link with embedded manifests\n";
+ }
+ return LinkIncremental();
+ }
+ if (this->Verbose)
+ {
+ if (!this->Incremental)
+ {
+ std::cout << "Visual Studio Non-Incremental Link\n";
+ }
+ else
+ {
+ std::cout << "Visual Studio Incremental Link without manifests\n";
+ }
+ }
+ return LinkNonIncremental();
+}
+
+int cmVSLink::LinkIncremental()
{
// This follows the steps listed here:
// http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx
@@ -1525,161 +1619,118 @@ int cmcmd::VisualStudioLinkIncremental(std::vector<std::string>& args,
// 7. Finally, the Linker does another incremental link, but since the
// only thing that has changed is the *.res file that contains the
// manifest it is a short link.
- std::vector<std::string> linkCommand;
- std::string targetName;
- if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
- {
- return -1;
- }
- std::string manifestArg = "/MANIFESTFILE:";
- std::vector<std::string> rcCommand;
- rcCommand.push_back(cmSystemTools::FindProgram("rc.exe"));
- std::vector<std::string> mtCommand;
- mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
- std::string tempManifest;
- tempManifest = targetName;
- tempManifest += ".intermediate.manifest";
- std::string resourceInputFile = targetName;
- resourceInputFile += ".resource.txt";
- if(verbose)
+
+ // Create a resource file referencing the manifest.
+ std::string absManifestFile =
+ cmSystemTools::CollapseFullPath(this->ManifestFile);
+ if (this->Verbose)
{
- std::cout << "Create " << resourceInputFile << "\n";
+ std::cout << "Create " << this->ManifestFileRC << "\n";
}
- // Create input file for rc command
- cmsys::ofstream fout(resourceInputFile.c_str());
- if(!fout)
+ {
+ cmsys::ofstream fout(this->ManifestFileRC.c_str());
+ if (!fout)
{
return -1;
}
- std::string manifestFile = targetName;
- manifestFile += ".embed.manifest";
- std::string fullPath= cmSystemTools::CollapseFullPath(manifestFile);
- fout << type << " /* CREATEPROCESS_MANIFEST_RESOURCE_ID "
- "*/ 24 /* RT_MANIFEST */ " << "\"" << fullPath << "\"";
- fout.close();
- manifestArg += tempManifest;
- // add the manifest arg to the linkCommand
- linkCommand.push_back("/MANIFEST");
- linkCommand.push_back(manifestArg);
- // if manifestFile is not yet created, create an
- // empty one
- if(!cmSystemTools::FileExists(manifestFile.c_str()))
+ fout << this->Type << " /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ "
+ "24 /* RT_MANIFEST */ \"" << absManifestFile << "\"";
+ }
+
+ // If we have not previously generated a manifest file,
+ // generate an empty one so the resource compiler succeeds.
+ if (!cmSystemTools::FileExists(this->ManifestFile))
{
- if(verbose)
+ if (this->Verbose)
{
- std::cout << "Create empty: " << manifestFile << "\n";
+ std::cout << "Create empty: " << this->ManifestFile << "\n";
}
- cmsys::ofstream foutTmp(manifestFile.c_str());
+ cmsys::ofstream foutTmp(this->ManifestFile.c_str());
}
- std::string resourceFile = manifestFile;
- resourceFile += ".res";
- // add the resource file to the end of the link command
- linkCommand.push_back(resourceFile);
- std::string outputOpt = "/fo";
- outputOpt += resourceFile;
- rcCommand.push_back(outputOpt);
- rcCommand.push_back(resourceInputFile);
- // Run rc command to create resource
- if(!cmcmd::RunCommand("RC Pass 1", rcCommand, verbose))
- {
- return -1;
- }
- // Now run the link command to link and create manifest
- if(!cmcmd::RunCommand("LINK Pass 1", linkCommand, verbose))
+
+ // Compile the resource file.
+ std::vector<std::string> rcCommand;
+ rcCommand.push_back(cmSystemTools::FindProgram("rc.exe"));
+ rcCommand.push_back("/fo" + this->ManifestFileRes);
+ rcCommand.push_back(this->ManifestFileRC);
+ if (!RunCommand("RC Pass 1", rcCommand, this->Verbose))
{
return -1;
}
- // create mt command
- std::string outArg("/out:");
- outArg+= manifestFile;
- mtCommand.push_back("/nologo");
- mtCommand.push_back(outArg);
- mtCommand.push_back("/notify_update");
- mtCommand.push_back("/manifest");
- mtCommand.push_back(tempManifest);
- // now run mt.exe to create the final manifest file
- int mtRet =0;
- if(!cmcmd::RunCommand("MT", mtCommand, verbose, &mtRet))
+
+ // Run the link command (possibly generates intermediate manifest).
+ if (!RunCommand("LINK Pass 1", this->LinkCommand, this->Verbose))
{
return -1;
}
- // if mt returns 0, then the manifest was not changed and
- // we do not need to do another link step
- if(mtRet == 0)
- {
- return 0;
- }
- // check for magic mt return value if mt returns the magic number
- // 1090650113 then it means that it updated the manifest file and we need
- // to do the final link. If mt has any value other than 0 or 1090650113
- // then there was some problem with the command itself and there was an
- // error so return the error code back out of cmake so make can report it.
- // (when hosted on a posix system the value is 187)
- if(mtRet != 1090650113 && mtRet != 187)
+
+ // Run the manifest tool to create the final manifest.
+ int mtRet = this->RunMT("/out:" + this->ManifestFile, true);
+
+ // If mt returns 1090650113 (or 187 on a posix host) then it updated the
+ // manifest file so we need to embed it again. Otherwise we are done.
+ if (mtRet != 1090650113 && mtRet != 187)
{
return mtRet;
}
- // update the resource file with the new manifest from the mt command.
- if(!cmcmd::RunCommand("RC Pass 2", rcCommand, verbose))
+
+ // Compile the resource file again.
+ if (!RunCommand("RC Pass 2", rcCommand, this->Verbose))
{
return -1;
}
- // Run the final incremental link that will put the new manifest resource
- // into the file incrementally.
- if(!cmcmd::RunCommand("FINAL LINK", linkCommand, verbose))
+
+ // Link incrementally again to use the updated resource.
+ if (!RunCommand("FINAL LINK", this->LinkCommand, this->Verbose))
{
return -1;
}
return 0;
}
-int cmcmd::VisualStudioLinkNonIncremental(std::vector<std::string>& args,
- int type,
- bool hasManifest,
- bool verbose)
+int cmVSLink::LinkNonIncremental()
{
- std::vector<std::string> linkCommand;
- std::string targetName;
- if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
- {
- return -1;
- }
- // Run the link command as given
- if (hasManifest)
- {
- linkCommand.push_back("/MANIFEST");
- }
- if(!cmcmd::RunCommand("LINK", linkCommand, verbose))
+ // Run the link command (possibly generates intermediate manifest).
+ if (!RunCommand("LINK", this->LinkCommand, this->Verbose))
{
return -1;
}
- if(!hasManifest)
+
+ // If we have no manifest files we are done.
+ if (!this->LinkGeneratesManifest && this->UserManifests.empty())
{
return 0;
}
+
+ // Run the manifest tool to embed the final manifest in the binary.
+ std::string mtOut =
+ "/outputresource:" + this->TargetFile + (this->Type == 1? ";#1" : ";#2");
+ return this->RunMT(mtOut, false);
+}
+
+int cmVSLink::RunMT(std::string const& out, bool notify)
+{
std::vector<std::string> mtCommand;
mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
mtCommand.push_back("/nologo");
mtCommand.push_back("/manifest");
- std::string manifestFile = targetName;
- manifestFile += ".manifest";
- mtCommand.push_back(manifestFile);
- std::string outresource = "/outputresource:";
- outresource += targetName;
- outresource += ";#";
- if(type == 1)
+ if (this->LinkGeneratesManifest)
{
- outresource += "1";
+ mtCommand.push_back(this->LinkerManifestFile);
}
- else if(type == 2)
+ mtCommand.insert(mtCommand.end(),
+ this->UserManifests.begin(), this->UserManifests.end());
+ mtCommand.push_back(out);
+ if (notify)
{
- outresource += "2";
+ // Add an undocumented option that enables a special return
+ // code to notify us when the manifest is modified.
+ mtCommand.push_back("/notify_update");
}
- mtCommand.push_back(outresource);
- // Now use the mt tool to embed the manifest into the exe or dll
- if(!cmcmd::RunCommand("MT", mtCommand, verbose))
+ int mtRet = 0;
+ if (!RunCommand("MT", mtCommand, this->Verbose, &mtRet))
{
return -1;
}
- return 0;
+ return mtRet;
}
diff --git a/Source/cmcmd.h b/Source/cmcmd.h
index 2bfbae7..64b2406 100644
--- a/Source/cmcmd.h
+++ b/Source/cmcmd.h
@@ -35,20 +35,6 @@ protected:
static int WindowsCEEnvironment(const char* version,
const std::string& name);
static int VisualStudioLink(std::vector<std::string>& args, int type);
- static int VisualStudioLinkIncremental(std::vector<std::string>& args,
- int type,
- bool verbose);
- static int VisualStudioLinkNonIncremental(std::vector<std::string>& args,
- int type,
- bool hasManifest,
- bool verbose);
- static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
- std::vector<std::string>& command,
- std::string& targetName);
- static bool RunCommand(const char* comment,
- std::vector<std::string>& command,
- bool verbose,
- int* retCodeOut = 0);
};
#endif
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index afcbd61..7fa6aed 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -46,6 +46,10 @@ static const char * cmDocumentationOptions[][2] =
{"--debug", "Displaying more verbose internals of CTest."},
{"--output-on-failure", "Output anything outputted by the test program "
"if the test should fail."},
+ {"--test-output-size-passed <size>", "Limit the output for passed tests "
+ "to <size> bytes"},
+ {"--test-output-size-failed <size>", "Limit the output for failed tests "
+ "to <size> bytes"},
{"-F", "Enable failover."},
{"-j <jobs>, --parallel <jobs>", "Run the tests in parallel using the "
"given number of jobs."},
diff --git a/Source/kwsys/CMakeEmptyInputFile.in b/Source/kwsys/CMakeEmptyInputFile.in
deleted file mode 100644
index 40b7ea2..0000000
--- a/Source/kwsys/CMakeEmptyInputFile.in
+++ /dev/null
@@ -1 +0,0 @@
-@CMAKE_EMPTY_INPUT_FILE_CONTENT@
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 017d619..84010d8 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -35,15 +35,6 @@
# SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR})
# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
#
-# KWSYS_IOS_FORCE_OLD = Force use of old non-ANSI C++ streams even if
-# new streams are available. This may be used
-# by projects that cannot configure their
-# streams library.
-# Example:
-#
-# SET(KWSYS_IOS_FORCE_OLD 1)
-#
-#
# Optional settings to setup install rules are as follows:
#
# KWSYS_INSTALL_BIN_DIR = The installation target directories into
@@ -91,6 +82,7 @@ ENDIF()
IF(POLICY CMP0056)
CMAKE_POLICY(SET CMP0056 NEW)
ENDIF()
+SET(CMAKE_LEGACY_CYGWIN_WIN32 0)
#-----------------------------------------------------------------------------
# If a namespace is not specified, use "kwsys" and enable testing.
@@ -311,6 +303,15 @@ IF(NOT CMAKE_COMPILER_IS_GNUCXX)
ENDIF()
ENDIF()
ENDIF()
+IF(KWSYS_STANDALONE)
+ IF(CMAKE_CXX_COMPILER_ID STREQUAL SunPro)
+ IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
+ ELSE()
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4")
+ ENDIF()
+ ENDIF()
+ENDIF()
#-----------------------------------------------------------------------------
# Configure Large File Support.
@@ -341,105 +342,6 @@ ENDIF()
# capabilities and parent project's request. Enforce 0/1 as only
# possible values for configuration into Configure.hxx.
-KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAVE_STD
- "Checking whether STL classes are in std namespace" DIRECT)
-
-IF(KWSYS_IOS_FORCE_OLD)
- SET(KWSYS_IOS_USE_ANSI 0)
-ELSE()
- KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_ANSI
- "Checking whether ANSI stream headers are available" DIRECT)
-ENDIF()
-
-IF(KWSYS_IOS_USE_ANSI)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_STD
- "Checking whether ANSI streams are in std namespace" DIRECT)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_SSTREAM
- "Checking whether ANSI string stream is available" DIRECT)
-ELSE()
- SET(KWSYS_IOS_HAVE_STD 0)
- SET(KWSYS_IOS_USE_SSTREAM 0)
-ENDIF()
-
-IF(KWSYS_IOS_USE_SSTREAM)
- SET(KWSYS_IOS_USE_STRSTREAM_H 0)
- SET(KWSYS_IOS_USE_STRSTREA_H 0)
-ELSE()
- KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_STRSTREAM_H
- "Checking whether strstream.h is available" DIRECT)
- IF(KWSYS_IOS_USE_STRSTREAM_H)
- SET(KWSYS_IOS_USE_STRSTREA_H 0)
- ELSE()
- KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_STRSTREA_H
- "Checking whether strstrea.h is available" DIRECT)
- ENDIF()
-ENDIF()
-
-KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CSTDDEF
- "Checking whether header cstddef is available" DIRECT)
-
-SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
- -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD})
-KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_NEQ_CHAR
- "Checking whether stl string has operator!= for char*" DIRECT)
-KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ITERATOR_TRAITS
- "Checking whether stl has iterator_traits" DIRECT)
-IF(KWSYS_STL_HAS_ITERATOR_TRAITS)
- SET(KWSYS_STL_HAS_ITERATOR_CATEGORY 0)
- SET(KWSYS_STL_HAS___ITERATOR_CATEGORY 0)
-ELSE()
- KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ITERATOR_CATEGORY
- "Checking whether stl has old iterator_category" DIRECT)
- IF(KWSYS_STL_HAS_ITERATOR_CATEGORY)
- SET(KWSYS_STL_HAS___ITERATOR_CATEGORY 0)
- ELSE()
- KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS___ITERATOR_CATEGORY
- "Checking whether stl has internal __iterator_category" DIRECT)
- ENDIF()
-ENDIF()
-KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
- "Checking whether stl has standard template allocator" DIRECT)
-IF(KWSYS_STL_HAS_ALLOCATOR_TEMPLATE)
- SET(KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE 0)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_REBIND
- "Checking for rebind member of stl allocator" DIRECT)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
- "Checking for non-standard argument to stl allocator<>::max_size" DIRECT)
-ELSE()
- KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
- "Checking whether stl has old non-template allocator" DIRECT)
- SET(KWSYS_STL_HAS_ALLOCATOR_REBIND 0)
- SET(KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT 0)
-ENDIF()
-KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_OBJECTS
- "Checking whether stl containers support allocator objects." DIRECT)
-IF(KWSYS_IOS_USE_ANSI AND NOT WATCOM)
- # ANSI streams always have string operators.
- SET(KWSYS_STL_STRING_HAVE_OSTREAM 1)
- SET(KWSYS_STL_STRING_HAVE_ISTREAM 1)
-ELSE()
- # There may not be string operators for old streams.
- KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_OSTREAM
- "Checking whether stl string has ostream operator<<" DIRECT)
- KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_ISTREAM
- "Checking whether stl string has istream operator>>" DIRECT)
-ENDIF()
-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_HAVE_BINARY
- "Checking whether ios has binary openmode" DIRECT)
-SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
-
-KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
- "Checking whether \"<>\" is needed for template friends" INVERT)
-KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_MEMBER_TEMPLATES
- "Checking for member template support" DIRECT)
-KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_FULL_SPECIALIZATION
- "Checking for standard template specialization syntax" DIRECT)
-KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
- "Checking whether argument dependent lookup is supported" DIRECT)
-
IF(UNIX)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STAT_HAS_ST_MTIM
"Checking whether struct stat has st_mtim member" DIRECT)
@@ -548,9 +450,6 @@ ENDIF()
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)
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM_LONG_LONG
"Checking if istream supports long long" DIRECT)
@@ -569,7 +468,6 @@ IF(KWSYS_USE_IOStream)
SET(KWSYS_IOS_HAS_ISTREAM___INT64 0)
SET(KWSYS_IOS_HAS_OSTREAM___INT64 0)
ENDIF()
- SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
ENDIF()
IF(KWSYS_NAMESPACE MATCHES "^kwsys$")
@@ -822,84 +720,6 @@ IF(KWSYS_INSTALL_DOC_DIR)
ENDIF()
#-----------------------------------------------------------------------------
-# Create STL header wrappers to block warnings in the STL headers and
-# give standard names by which they may be included.
-SET(KWSYS_STL_HEADER_EXTRA_string 1)
-FOREACH(header
- algorithm
- deque
- exception
- functional
- iterator
- list
- map
- memory
- new
- numeric
- queue
- set
- stack
- stdexcept
- string
- utility
- vector
- )
- # Configure the header wrapper.
- SET(KWSYS_STL_HEADER "${header}")
- IF(KWSYS_STL_HEADER_EXTRA_${header})
- SET(KWSYS_STL_HEADER_EXTRA
- "#define ${KWSYS_NAMESPACE}_stl_${header}_including_hxx\n# include <${KWSYS_NAMESPACE}/stl/${header}.hxx>\n#undef ${KWSYS_NAMESPACE}_stl_${header}_including_hxx\n")
- CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_stl_${header}.hxx.in
- ${KWSYS_HEADER_DIR}/stl/${header}.hxx
- @ONLY IMMEDIATE)
- IF(KWSYS_INSTALL_INCLUDE_DIR)
- INSTALL(FILES ${KWSYS_HEADER_DIR}/stl/${header}.hxx
- DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}/stl
- ${KWSYS_INSTALL_INCLUDE_OPTIONS})
- ENDIF()
- ELSE()
- SET(KWSYS_STL_HEADER_EXTRA "")
- ENDIF()
- CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_stl.hxx.in
- ${KWSYS_HEADER_DIR}/stl/${header}
- @ONLY IMMEDIATE)
-
- # Create an install target for the header wrapper.
- IF(KWSYS_INSTALL_INCLUDE_DIR)
- INSTALL(FILES ${KWSYS_HEADER_DIR}/stl/${header}
- DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}/stl
- ${KWSYS_INSTALL_INCLUDE_OPTIONS})
- ENDIF()
-ENDFOREACH()
-
-# Provide cstddef header.
-CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_cstddef.hxx.in
- ${KWSYS_HEADER_DIR}/cstddef
- @ONLY IMMEDIATE)
-IF(KWSYS_INSTALL_INCLUDE_DIR)
- INSTALL(FILES ${KWSYS_HEADER_DIR}/cstddef
- DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}
- ${KWSYS_INSTALL_INCLUDE_OPTIONS})
-ENDIF()
-
-#-----------------------------------------------------------------------------
-# Create streams header wrappers to give standard names by which they
-# may be included.
-FOREACH(header iostream fstream sstream iosfwd)
- # Configure the header wrapper.
- CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_ios_${header}.h.in
- ${KWSYS_HEADER_DIR}/ios/${header}
- @ONLY IMMEDIATE)
-
- # Create an install target for the header wrapper.
- IF(KWSYS_INSTALL_INCLUDE_DIR)
- INSTALL(FILES ${KWSYS_HEADER_DIR}/ios/${header}
- DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}/ios
- ${KWSYS_INSTALL_INCLUDE_OPTIONS})
- ENDIF()
-ENDFOREACH()
-
-#-----------------------------------------------------------------------------
# Build a list of classes and headers we need to implement the
# selected components. Initialize with required components.
SET(KWSYS_CLASSES)
@@ -1071,7 +891,7 @@ IF(KWSYS_ENABLE_C AND KWSYS_C_SRCS)
# Apply user-defined target properties to the library.
IF(KWSYS_PROPERTIES_C)
- SET_TARGET_PROPERTIES(${KWSYS_NAMESPACE} PROPERTIES
+ SET_TARGET_PROPERTIES(${KWSYS_NAMESPACE}_c PROPERTIES
${KWSYS_PROPERTIES_C}
)
ENDIF()
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx
index 9fa9802..3636836 100644
--- a/Source/kwsys/CommandLineArguments.cxx
+++ b/Source/kwsys/CommandLineArguments.cxx
@@ -15,22 +15,19 @@
#include KWSYS_HEADER(Configure.hxx)
#include KWSYS_HEADER(String.hxx)
-#include KWSYS_HEADER(stl/vector)
-#include KWSYS_HEADER(stl/map)
-#include KWSYS_HEADER(stl/set)
-#include KWSYS_HEADER(ios/sstream)
-#include KWSYS_HEADER(ios/iostream)
-
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "CommandLineArguments.hxx.in"
# include "Configure.hxx.in"
-# include "kwsys_stl.hxx.in"
-# include "kwsys_ios_sstream.h.in"
-# include "kwsys_ios_iostream.h.in"
#endif
+#include <vector>
+#include <map>
+#include <set>
+#include <sstream>
+#include <iostream>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -45,7 +42,7 @@
#if 0
# define CommandLineArguments_DEBUG(x) \
- kwsys_ios::cout << __LINE__ << " CLA: " << x << kwsys_ios::endl
+ std::cout << __LINE__ << " CLA: " << x << std::endl
#else
# define CommandLineArguments_DEBUG(x)
#endif
@@ -67,11 +64,11 @@ struct CommandLineArgumentsCallbackStructure
};
class CommandLineArgumentsVectorOfStrings :
- public kwsys_stl::vector<kwsys::String> {};
+ public std::vector<kwsys::String> {};
class CommandLineArgumentsSetOfStrings :
- public kwsys_stl::set<kwsys::String> {};
+ public std::set<kwsys::String> {};
class CommandLineArgumentsMapOfStrucs :
- public kwsys_stl::map<kwsys::String,
+ public std::map<kwsys::String,
CommandLineArgumentsCallbackStructure> {};
class CommandLineArgumentsInternal
@@ -152,8 +149,8 @@ void CommandLineArguments::ProcessArgument(const char* arg)
//----------------------------------------------------------------------------
bool CommandLineArguments::GetMatchedArguments(
- kwsys_stl::vector<kwsys_stl::string>* matches,
- const kwsys_stl::string& arg)
+ std::vector<std::string>* matches,
+ const std::string& arg)
{
matches->clear();
CommandLineArguments::Internal::CallbacksMap::iterator it;
@@ -184,15 +181,15 @@ bool CommandLineArguments::GetMatchedArguments(
//----------------------------------------------------------------------------
int CommandLineArguments::Parse()
{
- kwsys_stl::vector<kwsys_stl::string>::size_type cc;
- kwsys_stl::vector<kwsys_stl::string> matches;
+ std::vector<std::string>::size_type cc;
+ std::vector<std::string> matches;
if ( this->StoreUnusedArgumentsFlag )
{
this->Internals->UnusedArguments.clear();
}
for ( cc = 0; cc < this->Internals->Argv.size(); cc ++ )
{
- const kwsys_stl::string& arg = this->Internals->Argv[cc];
+ const std::string& arg = this->Internals->Argv[cc];
CommandLineArguments_DEBUG("Process argument: " << arg);
this->Internals->LastArgument = cc;
if ( this->GetMatchedArguments(&matches, arg) )
@@ -214,7 +211,7 @@ int CommandLineArguments::Parse()
// additional value
CommandLineArgumentsCallbackStructure *cs
= &this->Internals->Callbacks[matches[maxidx]];
- const kwsys_stl::string& sarg = matches[maxidx];
+ const std::string& sarg = matches[maxidx];
if ( cs->Argument != sarg )
{
abort();
@@ -267,7 +264,7 @@ int CommandLineArguments::Parse()
CommandLineArguments_DEBUG("This is a multi argument: " << arg);
for (cc++; cc < this->Internals->Argv.size(); ++ cc )
{
- const kwsys_stl::string& marg = this->Internals->Argv[cc];
+ const std::string& marg = this->Internals->Argv[cc];
CommandLineArguments_DEBUG(" check multi argument value: " << marg);
if ( this->GetMatchedArguments(&matches, marg) )
{
@@ -288,7 +285,7 @@ int CommandLineArguments::Parse()
}
break;
default:
- kwsys_ios::cerr << "Got unknown argument type: \"" << cs->ArgumentType << "\"" << kwsys_ios::endl;
+ std::cerr << "Got unknown argument type: \"" << cs->ArgumentType << "\"" << std::endl;
this->Internals->LastArgument --;
return 0;
}
@@ -313,7 +310,7 @@ int CommandLineArguments::Parse()
}
else
{
- kwsys_ios::cerr << "Got unknown argument: \"" << arg << "\"" << kwsys_ios::endl;
+ std::cerr << "Got unknown argument: \"" << arg << "\"" << std::endl;
this->Internals->LastArgument --;
return 0;
}
@@ -430,13 +427,13 @@ CommandLineArgumentsAddArgumentMacro(BOOL, bool)
CommandLineArgumentsAddArgumentMacro(INT, int)
CommandLineArgumentsAddArgumentMacro(DOUBLE, double)
CommandLineArgumentsAddArgumentMacro(STRING, char*)
-CommandLineArgumentsAddArgumentMacro(STL_STRING, kwsys_stl::string)
+CommandLineArgumentsAddArgumentMacro(STL_STRING, std::string)
-CommandLineArgumentsAddArgumentMacro(VECTOR_BOOL, kwsys_stl::vector<bool>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_INT, kwsys_stl::vector<int>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE, kwsys_stl::vector<double>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_STRING, kwsys_stl::vector<char*>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_STL_STRING, kwsys_stl::vector<kwsys_stl::string>)
+CommandLineArgumentsAddArgumentMacro(VECTOR_BOOL, std::vector<bool>)
+CommandLineArgumentsAddArgumentMacro(VECTOR_INT, std::vector<int>)
+CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE, std::vector<double>)
+CommandLineArgumentsAddArgumentMacro(VECTOR_STRING, std::vector<char*>)
+CommandLineArgumentsAddArgumentMacro(VECTOR_STL_STRING, std::vector<std::string>)
//----------------------------------------------------------------------------
#define CommandLineArgumentsAddBooleanArgumentMacro(type, ctype) \
@@ -451,7 +448,7 @@ CommandLineArgumentsAddBooleanArgumentMacro(BOOL, bool)
CommandLineArgumentsAddBooleanArgumentMacro(INT, int)
CommandLineArgumentsAddBooleanArgumentMacro(DOUBLE, double)
CommandLineArgumentsAddBooleanArgumentMacro(STRING, char*)
-CommandLineArgumentsAddBooleanArgumentMacro(STL_STRING, kwsys_stl::string)
+CommandLineArgumentsAddBooleanArgumentMacro(STL_STRING, std::string)
//----------------------------------------------------------------------------
void CommandLineArguments::SetClientData(void* client_data)
@@ -518,12 +515,12 @@ unsigned int CommandLineArguments::GetLastArgument()
//----------------------------------------------------------------------------
void CommandLineArguments::GenerateHelp()
{
- kwsys_ios::ostringstream str;
+ std::ostringstream str;
// Collapse all arguments into the map of vectors of all arguments that do
// the same thing.
CommandLineArguments::Internal::CallbacksMap::iterator it;
- typedef kwsys_stl::map<CommandLineArguments::Internal::String,
+ typedef std::map<CommandLineArguments::Internal::String,
CommandLineArguments::Internal::SetOfStrings > MapArgs;
MapArgs mp;
MapArgs::iterator mpit, smpit;
@@ -604,7 +601,7 @@ void CommandLineArguments::GenerateHelp()
CommandLineArguments::Internal::SetOfStrings::iterator sit;
for ( sit = mpit->second.begin(); sit != mpit->second.end(); sit++ )
{
- str << kwsys_ios::endl;
+ str << std::endl;
char argument[100];
sprintf(argument, "%s", sit->c_str());
switch ( this->Internals->Callbacks[*sit].ArgumentType )
@@ -658,8 +655,8 @@ void CommandLineArguments::GenerateHelp()
skip = cc;
}
}
- str.write(ptr, static_cast<kwsys_ios::streamsize>(skip));
- str << kwsys_ios::endl;
+ str.write(ptr, static_cast<std::streamsize>(skip));
+ str << std::endl;
ptr += skip;
len -= skip;
cnt ++;
@@ -680,7 +677,7 @@ void CommandLineArguments::GenerateHelp()
//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(
- bool* variable, const kwsys_stl::string& value)
+ bool* variable, const std::string& value)
{
if ( value == "1" || value == "ON" || value == "on" || value == "On" ||
value == "TRUE" || value == "true" || value == "True" ||
@@ -696,7 +693,7 @@ void CommandLineArguments::PopulateVariable(
//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(
- int* variable, const kwsys_stl::string& value)
+ int* variable, const std::string& value)
{
char* res = 0;
*variable = static_cast<int>(strtol(value.c_str(), &res, 10));
@@ -708,7 +705,7 @@ void CommandLineArguments::PopulateVariable(
//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(
- double* variable, const kwsys_stl::string& value)
+ double* variable, const std::string& value)
{
char* res = 0;
*variable = strtod(value.c_str(), &res);
@@ -720,7 +717,7 @@ void CommandLineArguments::PopulateVariable(
//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(
- char** variable, const kwsys_stl::string& value)
+ char** variable, const std::string& value)
{
if ( *variable )
{
@@ -733,14 +730,14 @@ void CommandLineArguments::PopulateVariable(
//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(
- kwsys_stl::string* variable, const kwsys_stl::string& value)
+ std::string* variable, const std::string& value)
{
*variable = value;
}
//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(
- kwsys_stl::vector<bool>* variable, const kwsys_stl::string& value)
+ std::vector<bool>* variable, const std::string& value)
{
bool val = false;
if ( value == "1" || value == "ON" || value == "on" || value == "On" ||
@@ -754,7 +751,7 @@ void CommandLineArguments::PopulateVariable(
//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(
- kwsys_stl::vector<int>* variable, const kwsys_stl::string& value)
+ std::vector<int>* variable, const std::string& value)
{
char* res = 0;
variable->push_back(static_cast<int>(strtol(value.c_str(), &res, 10)));
@@ -766,7 +763,7 @@ void CommandLineArguments::PopulateVariable(
//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(
- kwsys_stl::vector<double>* variable, const kwsys_stl::string& value)
+ std::vector<double>* variable, const std::string& value)
{
char* res = 0;
variable->push_back(strtod(value.c_str(), &res));
@@ -778,7 +775,7 @@ void CommandLineArguments::PopulateVariable(
//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(
- kwsys_stl::vector<char*>* variable, const kwsys_stl::string& value)
+ std::vector<char*>* variable, const std::string& value)
{
char* var = new char[ value.size() + 1 ];
strcpy(var, value.c_str());
@@ -787,8 +784,8 @@ void CommandLineArguments::PopulateVariable(
//----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable(
- kwsys_stl::vector<kwsys_stl::string>* variable,
- const kwsys_stl::string& value)
+ std::vector<std::string>* variable,
+ const std::string& value)
{
variable->push_back(value);
}
@@ -809,7 +806,7 @@ bool CommandLineArguments::PopulateVariable(CommandLineArgumentsCallbackStructur
CommandLineArguments_DEBUG("Set argument: " << cs->Argument << " to " << value);
if ( cs->Variable )
{
- kwsys_stl::string var = "1";
+ std::string var = "1";
if ( value )
{
var = value;
@@ -826,28 +823,28 @@ bool CommandLineArguments::PopulateVariable(CommandLineArgumentsCallbackStructur
this->PopulateVariable(static_cast<char**>(cs->Variable), var);
break;
case CommandLineArguments::STL_STRING_TYPE:
- this->PopulateVariable(static_cast<kwsys_stl::string*>(cs->Variable), var);
+ this->PopulateVariable(static_cast<std::string*>(cs->Variable), var);
break;
case CommandLineArguments::BOOL_TYPE:
this->PopulateVariable(static_cast<bool*>(cs->Variable), var);
break;
case CommandLineArguments::VECTOR_BOOL_TYPE:
- this->PopulateVariable(static_cast<kwsys_stl::vector<bool>*>(cs->Variable), var);
+ this->PopulateVariable(static_cast<std::vector<bool>*>(cs->Variable), var);
break;
case CommandLineArguments::VECTOR_INT_TYPE:
- this->PopulateVariable(static_cast<kwsys_stl::vector<int>*>(cs->Variable), var);
+ this->PopulateVariable(static_cast<std::vector<int>*>(cs->Variable), var);
break;
case CommandLineArguments::VECTOR_DOUBLE_TYPE:
- this->PopulateVariable(static_cast<kwsys_stl::vector<double>*>(cs->Variable), var);
+ this->PopulateVariable(static_cast<std::vector<double>*>(cs->Variable), var);
break;
case CommandLineArguments::VECTOR_STRING_TYPE:
- this->PopulateVariable(static_cast<kwsys_stl::vector<char*>*>(cs->Variable), var);
+ this->PopulateVariable(static_cast<std::vector<char*>*>(cs->Variable), var);
break;
case CommandLineArguments::VECTOR_STL_STRING_TYPE:
- this->PopulateVariable(static_cast<kwsys_stl::vector<kwsys_stl::string>*>(cs->Variable), var);
+ this->PopulateVariable(static_cast<std::vector<std::string>*>(cs->Variable), var);
break;
default:
- kwsys_ios::cerr << "Got unknown variable type: \"" << cs->VariableType << "\"" << kwsys_ios::endl;
+ std::cerr << "Got unknown variable type: \"" << cs->VariableType << "\"" << std::endl;
this->Internals->LastArgument --;
return 0;
}
diff --git a/Source/kwsys/CommandLineArguments.hxx.in b/Source/kwsys/CommandLineArguments.hxx.in
index cbf6ee3..e4f6d02 100644
--- a/Source/kwsys/CommandLineArguments.hxx.in
+++ b/Source/kwsys/CommandLineArguments.hxx.in
@@ -15,13 +15,8 @@
#include <@KWSYS_NAMESPACE@/Configure.h>
#include <@KWSYS_NAMESPACE@/Configure.hxx>
-#include <@KWSYS_NAMESPACE@/stl/string>
-#include <@KWSYS_NAMESPACE@/stl/vector>
-
-/* Define this macro temporarily to keep the code readable. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE@_stl
-#endif
+#include <string>
+#include <vector>
namespace @KWSYS_NAMESPACE@
{
@@ -64,7 +59,7 @@ struct CommandLineArgumentsCallbackStructure;
* "This is help string for --something");
* if ( !arg.Parse() )
* {
- * kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl;
+ * std::cerr << "Problem parsing arguments" << std::endl;
* res = 1;
* }
*
@@ -155,7 +150,7 @@ public:
void AddArgument(const char* argument, ArgumentTypeEnum type,
char** variable, const char* help);
void AddArgument(const char* argument, ArgumentTypeEnum type,
- kwsys_stl::string* variable, const char* help);
+ std::string* variable, const char* help);
/**
* Add handler for argument which is going to set the variable to the
@@ -163,15 +158,15 @@ public:
* appropriate type. This will handle the multi argument values.
*/
void AddArgument(const char* argument, ArgumentTypeEnum type,
- kwsys_stl::vector<bool>* variable, const char* help);
+ std::vector<bool>* variable, const char* help);
void AddArgument(const char* argument, ArgumentTypeEnum type,
- kwsys_stl::vector<int>* variable, const char* help);
+ std::vector<int>* variable, const char* help);
void AddArgument(const char* argument, ArgumentTypeEnum type,
- kwsys_stl::vector<double>* variable, const char* help);
+ std::vector<double>* variable, const char* help);
void AddArgument(const char* argument, ArgumentTypeEnum type,
- kwsys_stl::vector<char*>* variable, const char* help);
+ std::vector<char*>* variable, const char* help);
void AddArgument(const char* argument, ArgumentTypeEnum type,
- kwsys_stl::vector<kwsys_stl::string>* variable, const char* help);
+ std::vector<std::string>* variable, const char* help);
/**
* Add handler for boolean argument. The argument does not take any option
@@ -187,7 +182,7 @@ public:
void AddBooleanArgument(const char* argument,
char** variable, const char* help);
void AddBooleanArgument(const char* argument,
- kwsys_stl::string* variable, const char* help);
+ std::string* variable, const char* help);
/**
* Set the callbacks for error handling.
@@ -243,28 +238,28 @@ protected:
void AddArgument(const char* argument, ArgumentTypeEnum type,
VariableTypeEnum vtype, void* variable, const char* help);
- bool GetMatchedArguments(kwsys_stl::vector<kwsys_stl::string>* matches,
- const kwsys_stl::string& arg);
+ bool GetMatchedArguments(std::vector<std::string>* matches,
+ const std::string& arg);
//! Populate individual variables
bool PopulateVariable(CommandLineArgumentsCallbackStructure* cs,
const char* value);
//! Populate individual variables of type ...
- void PopulateVariable(bool* variable, const kwsys_stl::string& value);
- void PopulateVariable(int* variable, const kwsys_stl::string& value);
- void PopulateVariable(double* variable, const kwsys_stl::string& value);
- void PopulateVariable(char** variable, const kwsys_stl::string& value);
- void PopulateVariable(kwsys_stl::string* variable, const kwsys_stl::string& value);
- void PopulateVariable(kwsys_stl::vector<bool>* variable, const kwsys_stl::string& value);
- void PopulateVariable(kwsys_stl::vector<int>* variable, const kwsys_stl::string& value);
- void PopulateVariable(kwsys_stl::vector<double>* variable, const kwsys_stl::string& value);
- void PopulateVariable(kwsys_stl::vector<char*>* variable, const kwsys_stl::string& value);
- void PopulateVariable(kwsys_stl::vector<kwsys_stl::string>* variable, const kwsys_stl::string& value);
+ void PopulateVariable(bool* variable, const std::string& value);
+ void PopulateVariable(int* variable, const std::string& value);
+ void PopulateVariable(double* variable, const std::string& value);
+ void PopulateVariable(char** variable, const std::string& value);
+ void PopulateVariable(std::string* variable, const std::string& value);
+ void PopulateVariable(std::vector<bool>* variable, const std::string& value);
+ void PopulateVariable(std::vector<int>* variable, const std::string& value);
+ void PopulateVariable(std::vector<double>* variable, const std::string& value);
+ void PopulateVariable(std::vector<char*>* variable, const std::string& value);
+ void PopulateVariable(std::vector<std::string>* variable, const std::string& value);
typedef CommandLineArgumentsInternal Internal;
Internal* Internals;
- kwsys_stl::string Help;
+ std::string Help;
unsigned int LineLength;
@@ -273,11 +268,6 @@ protected:
} // namespace @KWSYS_NAMESPACE@
-/* Undefine temporary macro. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
#endif
diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in
index 8f5ace2..3faf862 100644
--- a/Source/kwsys/Configure.hxx.in
+++ b/Source/kwsys/Configure.hxx.in
@@ -15,125 +15,9 @@
/* Include C configuration. */
#include <@KWSYS_NAMESPACE@/Configure.h>
-/* Whether ANSI C++ stream headers are to be used. */
-#define @KWSYS_NAMESPACE@_IOS_USE_ANSI @KWSYS_IOS_USE_ANSI@
-
-/* Whether ANSI C++ streams are in std namespace. */
-#define @KWSYS_NAMESPACE@_IOS_HAVE_STD @KWSYS_IOS_HAVE_STD@
-
-/* Whether ANSI C++ <sstream> header is to be used. */
-#define @KWSYS_NAMESPACE@_IOS_USE_SSTREAM @KWSYS_IOS_USE_SSTREAM@
-
-/* Whether old C++ <strstream.h> header is to be used. */
-#define @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H @KWSYS_IOS_USE_STRSTREAM_H@
-
-/* Whether old C++ <strstrea.h> header is to be used. */
-#define @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H @KWSYS_IOS_USE_STRSTREA_H@
-
-/* Whether C++ streams support the ios::binary openmode. */
-#define @KWSYS_NAMESPACE@_IOS_HAVE_BINARY @KWSYS_IOS_HAVE_BINARY@
-
-/* Whether STL is in std namespace. */
-#define @KWSYS_NAMESPACE@_STL_HAVE_STD @KWSYS_STL_HAVE_STD@
-
/* Whether wstring is available. */
#define @KWSYS_NAMESPACE@_STL_HAS_WSTRING @KWSYS_STL_HAS_WSTRING@
-/* Whether the STL string has operator<< for ostream. */
-#define @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM @KWSYS_STL_STRING_HAVE_OSTREAM@
-
-/* Whether the STL string has operator>> for istream. */
-#define @KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM @KWSYS_STL_STRING_HAVE_ISTREAM@
-
-/* Whether the STL string has operator!= for char*. */
-#define @KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR @KWSYS_STL_STRING_HAVE_NEQ_CHAR@
-
-/* Define the stl namespace macro. */
-#if @KWSYS_NAMESPACE@_STL_HAVE_STD
-# define @KWSYS_NAMESPACE@_stl std
-#else
-# define @KWSYS_NAMESPACE@_stl
-#endif
-
-/* Define the ios namespace macro. */
-#if @KWSYS_NAMESPACE@_IOS_HAVE_STD
-# define @KWSYS_NAMESPACE@_ios_namespace std
-#else
-# define @KWSYS_NAMESPACE@_ios_namespace
-#endif
-#if @KWSYS_NAMESPACE@_IOS_USE_SSTREAM
-# define @KWSYS_NAMESPACE@_ios @KWSYS_NAMESPACE@_ios_namespace
-#else
-# define @KWSYS_NAMESPACE@_ios @KWSYS_NAMESPACE@_ios
-#endif
-
-/* Define the ios::binary openmode macro. */
-#if @KWSYS_NAMESPACE@_IOS_HAVE_BINARY
-# define @KWSYS_NAMESPACE@_ios_binary @KWSYS_NAMESPACE@_ios::ios::binary
-#else
-# define @KWSYS_NAMESPACE@_ios_binary 0
-#endif
-
-/* Whether the cstddef header is available. */
-#define @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF @KWSYS_CXX_HAS_CSTDDEF@
-
-/* Whether the compiler supports null template arguments. */
-#define @KWSYS_NAMESPACE@_CXX_HAS_NULL_TEMPLATE_ARGS @KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@
-
-/* Define the null template arguments macro. */
-#if @KWSYS_NAMESPACE@_CXX_HAS_NULL_TEMPLATE_ARGS
-# define @KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS <>
-#else
-# define @KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS
-#endif
-
-/* Whether the compiler supports member templates. */
-#define @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES @KWSYS_CXX_HAS_MEMBER_TEMPLATES@
-
-/* Whether the compiler supports argument dependent lookup. */
-#define @KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@
-
-/* Whether the compiler supports standard full specialization syntax. */
-#define @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION @KWSYS_CXX_HAS_FULL_SPECIALIZATION@
-
-/* Define the specialization definition macro. */
-#if @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION
-# define @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
-#else
-# define @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-#endif
-
-/* Define typename keyword macro for use in declarations. */
-#if defined(_MSC_VER) && _MSC_VER < 1300
-# define @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME
-#else
-# define @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME typename
-#endif
-
-/* Whether the stl has iterator_traits. */
-#define @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS @KWSYS_STL_HAS_ITERATOR_TRAITS@
-
-/* Whether the stl has iterator_category. */
-#define @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_CATEGORY @KWSYS_STL_HAS_ITERATOR_CATEGORY@
-
-/* Whether the stl has __iterator_category. */
-#define @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY @KWSYS_STL_HAS___ITERATOR_CATEGORY@
-
-/* Whether the stl allocator is the standard template. */
-#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE @KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@
-
-/* Whether the stl allocator is not a template. */
-#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE @KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@
-
-/* Whether the stl allocator has rebind. */
-#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND @KWSYS_STL_HAS_ALLOCATOR_REBIND@
-
-/* Whether the stl allocator has a size argument for max_size. */
-#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@
-
-/* Whether the stl containers support allocator objects. */
-#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS @KWSYS_STL_HAS_ALLOCATOR_OBJECTS@
-
/* Whether struct stat has the st_mtim member for high resolution times. */
#define @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM @KWSYS_STAT_HAS_ST_MTIM@
@@ -141,38 +25,10 @@
access to the macros without a configured namespace. */
#if defined(KWSYS_NAMESPACE)
# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE@_stl
-# define kwsys_ios @KWSYS_NAMESPACE@_ios
# define kwsys @KWSYS_NAMESPACE@
-# define kwsys_ios_binary @KWSYS_NAMESPACE@_ios_binary
# endif
# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define KWSYS_STL_HAVE_STD @KWSYS_NAMESPACE@_STL_HAVE_STD
-# define KWSYS_IOS_HAVE_STD @KWSYS_NAMESPACE@_IOS_HAVE_STD
-# define KWSYS_IOS_USE_ANSI @KWSYS_NAMESPACE@_IOS_USE_ANSI
-# define KWSYS_IOS_USE_SSTREAM @KWSYS_NAMESPACE@_IOS_USE_SSTREAM
-# define KWSYS_IOS_USE_STRSTREAM_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H
-# define KWSYS_IOS_USE_STRSTREA_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H
-# define KWSYS_IOS_HAVE_BINARY @KWSYS_NAMESPACE@_IOS_HAVE_BINARY
# define KWSYS_STAT_HAS_ST_MTIM @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM
-# define KWSYS_CXX_HAS_CSTDDEF @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF
-# define KWSYS_STL_STRING_HAVE_OSTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM
-# define KWSYS_STL_STRING_HAVE_ISTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM
-# define KWSYS_STL_STRING_HAVE_NEQ_CHAR @KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR
-# define KWSYS_CXX_NULL_TEMPLATE_ARGS @KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS
-# define KWSYS_CXX_HAS_MEMBER_TEMPLATES @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
-# define KWSYS_CXX_HAS_FULL_SPECIALIZATION @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION
-# define KWSYS_CXX_DEFINE_SPECIALIZATION @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-# define KWSYS_CXX_DECL_TYPENAME @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME
-# define KWSYS_STL_HAS_ALLOCATOR_REBIND @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND
-# define KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
-# define KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
-# define KWSYS_STL_HAS_ITERATOR_TRAITS @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS
-# define KWSYS_STL_HAS_ITERATOR_CATEGORY @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_CATEGORY
-# define KWSYS_STL_HAS___ITERATOR_CATEGORY @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY
-# define KWSYS_STL_HAS_ALLOCATOR_TEMPLATE @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE
-# define KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE
-# define KWSYS_STL_HAS_ALLOCATOR_OBJECTS @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS
# define KWSYS_STL_HAS_WSTRING @KWSYS_NAMESPACE@_STL_HAS_WSTRING
#endif
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index 58cea63..c549792 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -16,20 +16,17 @@
#include KWSYS_HEADER(Encoding.hxx)
-#include KWSYS_HEADER(stl/string)
-#include KWSYS_HEADER(stl/vector)
-
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "Directory.hxx.in"
# include "Configure.hxx.in"
# include "Encoding.hxx.in"
-# include "kwsys_stl.hxx.in"
-# include "kwsys_stl_string.hxx.in"
-# include "kwsys_stl_vector.hxx.in"
#endif
+#include <string>
+#include <vector>
+
namespace KWSYS_NAMESPACE
{
@@ -38,10 +35,10 @@ class DirectoryInternals
{
public:
// Array of Files
- kwsys_stl::vector<kwsys_stl::string> Files;
+ std::vector<std::string> Files;
// Path to Open'ed directory
- kwsys_stl::string Path;
+ std::string Path;
};
//----------------------------------------------------------------------------
@@ -103,7 +100,7 @@ void Directory::Clear()
namespace KWSYS_NAMESPACE
{
-bool Directory::Load(const kwsys_stl::string& name)
+bool Directory::Load(const std::string& name)
{
this->Clear();
#if _MSC_VER < 1300
@@ -153,7 +150,7 @@ bool Directory::Load(const kwsys_stl::string& name)
return _findclose(srchHandle) != -1;
}
-unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& name)
+unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
{
#if _MSC_VER < 1300
long srchHandle;
@@ -220,7 +217,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na
namespace KWSYS_NAMESPACE
{
-bool Directory::Load(const kwsys_stl::string& name)
+bool Directory::Load(const std::string& name)
{
this->Clear();
@@ -240,7 +237,7 @@ bool Directory::Load(const kwsys_stl::string& name)
return 1;
}
-unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& name)
+unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
{
DIR* dir = opendir(name.c_str());
diff --git a/Source/kwsys/Directory.hxx.in b/Source/kwsys/Directory.hxx.in
index 1bcf90e..e68f337 100644
--- a/Source/kwsys/Directory.hxx.in
+++ b/Source/kwsys/Directory.hxx.in
@@ -13,12 +13,7 @@
#define @KWSYS_NAMESPACE@_Directory_hxx
#include <@KWSYS_NAMESPACE@/Configure.h>
-#include <@KWSYS_NAMESPACE@/stl/string>
-
-/* Define these macros temporarily to keep the code readable. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE@_stl
-#endif
+#include <string>
namespace @KWSYS_NAMESPACE@
{
@@ -44,7 +39,7 @@ public:
* in that directory. 0 is returned if the directory can not be
* opened, 1 if it is opened.
*/
- bool Load(const kwsys_stl::string&);
+ bool Load(const std::string&);
/**
* Return the number of files in the current directory.
@@ -55,7 +50,7 @@ public:
* Return the number of files in the specified directory.
* A higher performance static method.
*/
- static unsigned long GetNumberOfFilesInDirectory(const kwsys_stl::string&);
+ static unsigned long GetNumberOfFilesInDirectory(const std::string&);
/**
* Return the file at the given index, the indexing is 0 based
@@ -83,9 +78,4 @@ private:
} // namespace @KWSYS_NAMESPACE@
-/* Undefine temporary macros. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
#endif
diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx
index a776f97..1941d96 100644
--- a/Source/kwsys/DynamicLoader.cxx
+++ b/Source/kwsys/DynamicLoader.cxx
@@ -40,7 +40,7 @@ namespace KWSYS_NAMESPACE
{
//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{
return shl_load(libname.c_str(), BIND_DEFERRED | DYNAMIC_PATH, 0L);
}
@@ -57,7 +57,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer
-DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
+DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const std::string& sym)
{
void* addr;
int status;
@@ -115,7 +115,7 @@ namespace KWSYS_NAMESPACE
{
//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{
NSObjectFileImageReturnCode rc;
NSObjectFileImage image = 0;
@@ -146,7 +146,7 @@ int DynamicLoader::CloseLibrary( DynamicLoader::LibraryHandle lib)
//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
+ DynamicLoader::LibraryHandle lib, const std::string& sym)
{
void *result=0;
// Need to prepend symbols with '_' on Apple-gcc compilers
@@ -187,7 +187,7 @@ namespace KWSYS_NAMESPACE
{
//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname)
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname)
{
DynamicLoader::LibraryHandle lh;
int length = MultiByteToWideChar(CP_UTF8, 0, libname.c_str(), -1, NULL, 0);
@@ -207,7 +207,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
+ DynamicLoader::LibraryHandle lib, const std::string& sym)
{
// TODO: The calling convention affects the name of the symbol. We
// should have a tool to help get the symbol with the desired
@@ -302,7 +302,7 @@ namespace KWSYS_NAMESPACE
static image_id last_dynamic_err = B_OK;
//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{
// image_id's are integers, errors are negative. Add one just in case we
// get a valid image_id of zero (is that even possible?).
@@ -340,7 +340,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
+ DynamicLoader::LibraryHandle lib, const std::string& sym)
{
// Hack to cast pointer-to-data to pointer-to-function.
union
@@ -393,7 +393,7 @@ namespace KWSYS_NAMESPACE
{
//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{
return 0;
}
@@ -411,7 +411,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
+ DynamicLoader::LibraryHandle lib, const std::string& sym)
{
return 0;
}
@@ -437,7 +437,7 @@ namespace KWSYS_NAMESPACE
{
//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{
char *name = (char *)calloc(1, libname.size() + 1);
dld_init(program_invocation_name);
@@ -456,7 +456,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
+ DynamicLoader::LibraryHandle lib, const std::string& sym)
{
// Hack to cast pointer-to-data to pointer-to-function.
union
@@ -489,7 +489,7 @@ namespace KWSYS_NAMESPACE
{
//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{
return dlopen(libname.c_str(), RTLD_LAZY);
}
@@ -508,7 +508,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
- DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
+ DynamicLoader::LibraryHandle lib, const std::string& sym)
{
// Hack to cast pointer-to-data to pointer-to-function.
union
diff --git a/Source/kwsys/DynamicLoader.hxx.in b/Source/kwsys/DynamicLoader.hxx.in
index 75811ab..1e4a912 100644
--- a/Source/kwsys/DynamicLoader.hxx.in
+++ b/Source/kwsys/DynamicLoader.hxx.in
@@ -12,8 +12,8 @@
#ifndef @KWSYS_NAMESPACE@_DynamicLoader_hxx
#define @KWSYS_NAMESPACE@_DynamicLoader_hxx
-#include <@KWSYS_NAMESPACE@/Configure.h>
-#include <@KWSYS_NAMESPACE@/stl/string>
+#include <@KWSYS_NAMESPACE@/Configure.hxx>
+#include <string>
#if defined(__hpux)
#include <dl.h>
@@ -28,11 +28,6 @@
#include <be/kernel/image.h>
#endif
-/* Define these macros temporarily to keep the code readable. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE@_stl
-#endif
-
namespace @KWSYS_NAMESPACE@
{
/** \class DynamicLoader
@@ -83,14 +78,14 @@ public:
/** Load a dynamic library into the current process.
* The returned LibraryHandle can be used to access the symbols in the
* library. */
- static LibraryHandle OpenLibrary(const kwsys_stl::string&);
+ static LibraryHandle OpenLibrary(const std::string&);
/** Attempt to detach a dynamic library from the
* process. A value of true is returned if it is sucessful. */
static int CloseLibrary(LibraryHandle);
/** Find the address of the symbol in the given library. */
- static SymbolPointer GetSymbolAddress(LibraryHandle, const kwsys_stl::string&);
+ static SymbolPointer GetSymbolAddress(LibraryHandle, const std::string&);
/** Return the default module prefix for the current platform. */
static const char* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; }
@@ -104,9 +99,4 @@ public:
} // namespace @KWSYS_NAMESPACE@
-/* Undefine temporary macros. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
#endif
diff --git a/Source/kwsys/Encoding.hxx.in b/Source/kwsys/Encoding.hxx.in
index aba4175..87b1c21 100644
--- a/Source/kwsys/Encoding.hxx.in
+++ b/Source/kwsys/Encoding.hxx.in
@@ -13,13 +13,8 @@
#define @KWSYS_NAMESPACE@_Encoding_hxx
#include <@KWSYS_NAMESPACE@/Configure.hxx>
-#include <@KWSYS_NAMESPACE@/stl/string>
-#include <@KWSYS_NAMESPACE@/stl/vector>
-
-/* Define these macros temporarily to keep the code readable. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE@_stl
-#endif
+#include <string>
+#include <vector>
namespace @KWSYS_NAMESPACE@
{
@@ -65,23 +60,18 @@ public:
// Convert a narrow string to a wide string.
// On Windows, UTF-8 is assumed, and on other platforms,
// the current locale is assumed.
- static kwsys_stl::wstring ToWide(const kwsys_stl::string& str);
- static kwsys_stl::wstring ToWide(const char* str);
+ static std::wstring ToWide(const std::string& str);
+ static std::wstring ToWide(const char* str);
// Convert a wide string to a narrow string.
// On Windows, UTF-8 is assumed, and on other platforms,
// the current locale is assumed.
- static kwsys_stl::string ToNarrow(const kwsys_stl::wstring& str);
- static kwsys_stl::string ToNarrow(const wchar_t* str);
+ static std::string ToNarrow(const std::wstring& str);
+ static std::string ToNarrow(const wchar_t* str);
#endif // @KWSYS_NAMESPACE@_STL_HAS_WSTRING
}; // class Encoding
} // namespace @KWSYS_NAMESPACE@
-/* Undefine temporary macros. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
#endif
diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx
index 251a56d..7d9b3e4 100644
--- a/Source/kwsys/EncodingCXX.cxx
+++ b/Source/kwsys/EncodingCXX.cxx
@@ -19,7 +19,6 @@
#include "kwsysPrivate.h"
#include KWSYS_HEADER(Encoding.hxx)
#include KWSYS_HEADER(Encoding.h)
-#include KWSYS_HEADER(stl/vector)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
@@ -28,6 +27,7 @@
# include "Encoding.h.in"
#endif
+#include <vector>
#include <stdlib.h>
#include <string.h>
@@ -140,23 +140,23 @@ char const* const* Encoding::CommandLineArguments::argv() const
#if KWSYS_STL_HAS_WSTRING
-kwsys_stl::wstring Encoding::ToWide(const kwsys_stl::string& str)
+std::wstring Encoding::ToWide(const std::string& str)
{
return ToWide(str.c_str());
}
-kwsys_stl::string Encoding::ToNarrow(const kwsys_stl::wstring& str)
+std::string Encoding::ToNarrow(const std::wstring& str)
{
return ToNarrow(str.c_str());
}
-kwsys_stl::wstring Encoding::ToWide(const char* cstr)
+std::wstring Encoding::ToWide(const char* cstr)
{
- kwsys_stl::wstring wstr;
+ std::wstring wstr;
size_t length = kwsysEncoding_mbstowcs(0, cstr, 0) + 1;
if(length > 0)
{
- kwsys_stl::vector<wchar_t> wchars(length);
+ std::vector<wchar_t> wchars(length);
if(kwsysEncoding_mbstowcs(&wchars[0], cstr, length) > 0)
{
wstr = &wchars[0];
@@ -165,9 +165,9 @@ kwsys_stl::wstring Encoding::ToWide(const char* cstr)
return wstr;
}
-kwsys_stl::string Encoding::ToNarrow(const wchar_t* wcstr)
+std::string Encoding::ToNarrow(const wchar_t* wcstr)
{
- kwsys_stl::string str;
+ std::string str;
size_t length = kwsysEncoding_wcstombs(0, wcstr, 0) + 1;
if(length > 0)
{
diff --git a/Source/kwsys/FStream.hxx.in b/Source/kwsys/FStream.hxx.in
index 37055d6..681e4d8 100644
--- a/Source/kwsys/FStream.hxx.in
+++ b/Source/kwsys/FStream.hxx.in
@@ -12,8 +12,8 @@
#ifndef @KWSYS_NAMESPACE@_FStream_hxx
#define @KWSYS_NAMESPACE@_FStream_hxx
-#include <@KWSYS_NAMESPACE@/ios/fstream>
#include <@KWSYS_NAMESPACE@/Encoding.hxx>
+#include <fstream>
namespace @KWSYS_NAMESPACE@
{
@@ -167,8 +167,8 @@ class basic_ofstream : public std::basic_ostream<CharType,Traits>
# undef @KWSYS_NAMESPACE@_FStream_NOEXCEPT
#else
- using @KWSYS_NAMESPACE@_ios_namespace::ofstream;
- using @KWSYS_NAMESPACE@_ios_namespace::ifstream;
+ using std::ofstream;
+ using std::ifstream;
#endif
namespace FStream
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index 11bfd16..9d63459 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -17,9 +17,6 @@
#include KWSYS_HEADER(RegularExpression.hxx)
#include KWSYS_HEADER(SystemTools.hxx)
#include KWSYS_HEADER(Directory.hxx)
-#include KWSYS_HEADER(stl/string)
-#include KWSYS_HEADER(stl/vector)
-#include KWSYS_HEADER(stl/algorithm)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
@@ -29,12 +26,12 @@
# include "Configure.hxx.in"
# include "RegularExpression.hxx.in"
# include "SystemTools.hxx.in"
-# include "kwsys_stl.hxx.in"
-# include "kwsys_stl_string.hxx.in"
-# include "kwsys_stl_vector.hxx.in"
-# include "kwsys_stl_algorithm.hxx.in"
#endif
+#include <string>
+#include <vector>
+#include <algorithm>
+
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -54,8 +51,8 @@ namespace KWSYS_NAMESPACE
class GlobInternals
{
public:
- kwsys_stl::vector<kwsys_stl::string> Files;
- kwsys_stl::vector<kwsys::RegularExpression> Expressions;
+ std::vector<std::string> Files;
+ std::vector<kwsys::RegularExpression> Expressions;
};
//----------------------------------------------------------------------------
@@ -82,21 +79,21 @@ Glob::~Glob()
}
//----------------------------------------------------------------------------
-kwsys_stl::vector<kwsys_stl::string>& Glob::GetFiles()
+std::vector<std::string>& Glob::GetFiles()
{
return this->Internals->Files;
}
//----------------------------------------------------------------------------
-kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
+std::string Glob::PatternToRegex(const std::string& pattern,
bool require_whole_string,
bool preserve_case)
{
// Incrementally build the regular expression from the pattern.
- kwsys_stl::string regex = require_whole_string? "^" : "";
- kwsys_stl::string::const_iterator pattern_first = pattern.begin();
- kwsys_stl::string::const_iterator pattern_last = pattern.end();
- for(kwsys_stl::string::const_iterator i = pattern_first;
+ std::string regex = require_whole_string? "^" : "";
+ std::string::const_iterator pattern_first = pattern.begin();
+ std::string::const_iterator pattern_last = pattern.end();
+ for(std::string::const_iterator i = pattern_first;
i != pattern_last; ++i)
{
int c = *i;
@@ -120,8 +117,8 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
{
// Parse out the bracket expression. It begins just after the
// opening character.
- kwsys_stl::string::const_iterator bracket_first = i+1;
- kwsys_stl::string::const_iterator bracket_last = bracket_first;
+ std::string::const_iterator bracket_first = i+1;
+ std::string::const_iterator bracket_last = bracket_first;
// The first character may be complementation '!' or '^'.
if(bracket_last != pattern_last &&
@@ -153,7 +150,7 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
else
{
// Convert the bracket string to its regex equivalent.
- kwsys_stl::string::const_iterator k = bracket_first;
+ std::string::const_iterator k = bracket_first;
// Open the regex block.
regex += "[";
@@ -221,8 +218,8 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
}
//----------------------------------------------------------------------------
-bool Glob::RecurseDirectory(kwsys_stl::string::size_type start,
- const kwsys_stl::string& dir, GlobMessages* messages)
+bool Glob::RecurseDirectory(std::string::size_type start,
+ const std::string& dir, GlobMessages* messages)
{
kwsys::Directory d;
if ( !d.Load(dir) )
@@ -230,8 +227,8 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start,
return true;
}
unsigned long cc;
- kwsys_stl::string realname;
- kwsys_stl::string fname;
+ std::string realname;
+ std::string fname;
for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
{
fname = d.GetFile(cc);
@@ -262,8 +259,8 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start,
if (isSymLink)
{
++this->FollowedSymlinkCount;
- kwsys_stl::string realPathErrorMessage;
- kwsys_stl::string canonicalPath(SystemTools::GetRealPath(dir,
+ std::string realPathErrorMessage;
+ std::string canonicalPath(SystemTools::GetRealPath(dir,
&realPathErrorMessage));
if(!realPathErrorMessage.empty())
@@ -277,7 +274,7 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start,
return false;
}
- if(kwsys_stl::find(this->VisitedSymlinks.begin(),
+ if(std::find(this->VisitedSymlinks.begin(),
this->VisitedSymlinks.end(),
canonicalPath) == this->VisitedSymlinks.end())
{
@@ -299,9 +296,9 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start,
// else we have already visited this symlink - prevent cyclic recursion
else if(messages)
{
- kwsys_stl::string message;
- for(kwsys_stl::vector<kwsys_stl::string>::const_iterator
- pathIt = kwsys_stl::find(this->VisitedSymlinks.begin(),
+ std::string message;
+ for(std::vector<std::string>::const_iterator
+ pathIt = std::find(this->VisitedSymlinks.begin(),
this->VisitedSymlinks.end(),
canonicalPath);
pathIt != this->VisitedSymlinks.end(); ++pathIt)
@@ -338,10 +335,10 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start,
}
//----------------------------------------------------------------------------
-void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
- const kwsys_stl::string& dir, GlobMessages* messages)
+void Glob::ProcessDirectory(std::string::size_type start,
+ const std::string& dir, GlobMessages* messages)
{
- //kwsys_ios::cout << "ProcessDirectory: " << dir << kwsys_ios::endl;
+ //std::cout << "ProcessDirectory: " << dir << std::endl;
bool last = ( start == this->Internals->Expressions.size()-1 );
if ( last && this->Recurse )
{
@@ -360,8 +357,8 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
return;
}
unsigned long cc;
- kwsys_stl::string realname;
- kwsys_stl::string fname;
+ std::string realname;
+ std::string fname;
for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
{
fname = d.GetFile(cc);
@@ -384,10 +381,10 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
fname = kwsys::SystemTools::LowerCase(fname);
#endif
- //kwsys_ios::cout << "Look at file: " << fname << kwsys_ios::endl;
- //kwsys_ios::cout << "Match: "
- // << this->Internals->TextExpressions[start].c_str() << kwsys_ios::endl;
- //kwsys_ios::cout << "Real name: " << realname << kwsys_ios::endl;
+ //std::cout << "Look at file: " << fname << std::endl;
+ //std::cout << "Match: "
+ // << this->Internals->TextExpressions[start].c_str() << std::endl;
+ //std::cout << "Real name: " << realname << std::endl;
if( (!last && !kwsys::SystemTools::FileIsDirectory(realname))
|| (!this->ListDirs && last &&
@@ -411,11 +408,11 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
}
//----------------------------------------------------------------------------
-bool Glob::FindFiles(const kwsys_stl::string& inexpr, GlobMessages* messages)
+bool Glob::FindFiles(const std::string& inexpr, GlobMessages* messages)
{
- kwsys_stl::string cexpr;
- kwsys_stl::string::size_type cc;
- kwsys_stl::string expr = inexpr;
+ std::string cexpr;
+ std::string::size_type cc;
+ std::string expr = inexpr;
this->Internals->Expressions.clear();
this->Internals->Files.clear();
@@ -425,10 +422,10 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr, GlobMessages* messages)
expr = kwsys::SystemTools::GetCurrentWorkingDirectory();
expr += "/" + inexpr;
}
- kwsys_stl::string fexpr = expr;
+ std::string fexpr = expr;
- kwsys_stl::string::size_type skip = 0;
- kwsys_stl::string::size_type last_slash = 0;
+ std::string::size_type skip = 0;
+ std::string::size_type last_slash = 0;
for ( cc = 0; cc < expr.size(); cc ++ )
{
if ( cc > 0 && expr[cc] == '/' && expr[cc-1] != '\\' )
@@ -444,8 +441,8 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr, GlobMessages* messages)
}
if ( last_slash > 0 )
{
- //kwsys_ios::cout << "I can skip: " << fexpr.substr(0, last_slash)
- // << kwsys_ios::endl;
+ //std::cout << "I can skip: " << fexpr.substr(0, last_slash)
+ // << std::endl;
skip = last_slash;
}
if ( skip == 0 )
@@ -517,7 +514,7 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr, GlobMessages* messages)
}
//----------------------------------------------------------------------------
-void Glob::AddExpression(const kwsys_stl::string& expr)
+void Glob::AddExpression(const std::string& expr)
{
this->Internals->Expressions.push_back(
kwsys::RegularExpression(
@@ -546,7 +543,7 @@ const char* Glob::GetRelative()
}
//----------------------------------------------------------------------------
-void Glob::AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const kwsys_stl::string& file)
+void Glob::AddFile(std::vector<std::string>& files, const std::string& file)
{
if ( !this->Relative.empty() )
{
diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in
index 5239ccd..ffee9ca 100644
--- a/Source/kwsys/Glob.hxx.in
+++ b/Source/kwsys/Glob.hxx.in
@@ -15,13 +15,8 @@
#include <@KWSYS_NAMESPACE@/Configure.h>
#include <@KWSYS_NAMESPACE@/Configure.hxx>
-#include <@KWSYS_NAMESPACE@/stl/string>
-#include <@KWSYS_NAMESPACE@/stl/vector>
-
-/* Define this macro temporarily to keep the code readable. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE@_stl
-#endif
+#include <string>
+#include <vector>
namespace @KWSYS_NAMESPACE@
{
@@ -49,9 +44,9 @@ public:
struct Message
{
MessageType type;
- kwsys_stl::string content;
+ std::string content;
- Message(MessageType t, const kwsys_stl::string& c) :
+ Message(MessageType t, const std::string& c) :
type(t),
content(c)
{}
@@ -67,18 +62,18 @@ public:
}
};
- typedef kwsys_stl::vector<Message> GlobMessages;
- typedef kwsys_stl::vector<Message>::iterator GlobMessagesIterator;
+ typedef std::vector<Message> GlobMessages;
+ typedef std::vector<Message>::iterator GlobMessagesIterator;
public:
Glob();
~Glob();
//! Find all files that match the pattern.
- bool FindFiles(const kwsys_stl::string& inexpr,
+ bool FindFiles(const std::string& inexpr,
GlobMessages* messages = 0);
//! Return the list of files that matched.
- kwsys_stl::vector<kwsys_stl::string>& GetFiles();
+ std::vector<std::string>& GetFiles();
//! Set recurse to true to match subdirectories.
void RecurseOn() { this->SetRecurse(true); }
@@ -107,7 +102,7 @@ public:
string. This is on by default because patterns always match
whole strings, but may be disabled to support concatenating
expressions more easily (regex1|regex2|etc). */
- static kwsys_stl::string PatternToRegex(const kwsys_stl::string& pattern,
+ static std::string PatternToRegex(const std::string& pattern,
bool require_whole_string = true,
bool preserve_case = false);
@@ -122,28 +117,28 @@ public:
protected:
//! Process directory
- void ProcessDirectory(kwsys_stl::string::size_type start,
- const kwsys_stl::string& dir,
+ void ProcessDirectory(std::string::size_type start,
+ const std::string& dir,
GlobMessages* messages);
//! Process last directory, but only when recurse flags is on. That is
// effectively like saying: /path/to/file/**/file
- bool RecurseDirectory(kwsys_stl::string::size_type start,
- const kwsys_stl::string& dir,
+ bool RecurseDirectory(std::string::size_type start,
+ const std::string& dir,
GlobMessages* messages);
//! Add regular expression
- void AddExpression(const kwsys_stl::string& expr);
+ void AddExpression(const std::string& expr);
//! Add a file to the list
- void AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const kwsys_stl::string& file);
+ void AddFile(std::vector<std::string>& files, const std::string& file);
GlobInternals* Internals;
bool Recurse;
- kwsys_stl::string Relative;
+ std::string Relative;
bool RecurseThroughSymlinks;
unsigned int FollowedSymlinkCount;
- kwsys_stl::vector<kwsys_stl::string> VisitedSymlinks;
+ std::vector<std::string> VisitedSymlinks;
bool ListDirs;
bool RecurseListDirs;
@@ -154,9 +149,4 @@ private:
} // namespace @KWSYS_NAMESPACE@
-/* Undefine temporary macro. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
#endif
diff --git a/Source/kwsys/IOStream.cxx b/Source/kwsys/IOStream.cxx
index a31f8c8..81c6a73 100644
--- a/Source/kwsys/IOStream.cxx
+++ b/Source/kwsys/IOStream.cxx
@@ -12,25 +12,14 @@
#include "kwsysPrivate.h"
#include KWSYS_HEADER(Configure.hxx)
-// Configure the implementation for the current streams library.
-#if !KWSYS_IOS_USE_ANSI
-# define ios_base ios
-# if defined(__HP_aCC)
-# define protected public
-# include <iostream.h> // Hack access to some private stream methods.
-# undef protected
-# endif
-#endif
-
// Include the streams library.
-#include KWSYS_HEADER(ios/iostream)
+#include <iostream>
#include KWSYS_HEADER(IOStream.hxx)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "Configure.hxx.in"
-# include "kwsys_ios_iostream.hxx.in"
# include "IOStream.hxx.in"
#endif
@@ -50,7 +39,7 @@ namespace KWSYS_NAMESPACE
{
// Scan an input stream for an integer value.
-static int IOStreamScanStream(kwsys_ios::istream& is, char* buffer)
+static int IOStreamScanStream(std::istream& is, char* buffer)
{
// Prepare to write to buffer.
char* out = buffer;
@@ -64,10 +53,10 @@ static int IOStreamScanStream(kwsys_ios::istream& is, char* buffer)
// detect it from the input. A leading 0x means hex, and a leading
// 0 alone means octal.
int base = 0;
- int flags = is.flags() & kwsys_ios::ios_base::basefield;
- if(flags == kwsys_ios::ios_base::oct) { base = 8; }
- else if(flags == kwsys_ios::ios_base::dec) { base = 10; }
- else if(flags == kwsys_ios::ios_base::hex) { base = 16; }
+ int flags = is.flags() & std::ios_base::basefield;
+ if(flags == std::ios_base::oct) { base = 8; }
+ else if(flags == std::ios_base::dec) { base = 10; }
+ else if(flags == std::ios_base::hex) { base = 16; }
bool foundDigit = false;
bool foundNonZero = false;
if(is.peek() == '0')
@@ -134,24 +123,17 @@ static int IOStreamScanStream(kwsys_ios::istream& is, char* buffer)
// Read an integer value from an input stream.
template <class T>
-kwsys_ios::istream&
-IOStreamScanTemplate(kwsys_ios::istream& is, T& value, char type)
+std::istream&
+IOStreamScanTemplate(std::istream& is, T& value, char type)
{
- int state = kwsys_ios::ios_base::goodbit;
+ int state = std::ios_base::goodbit;
// Skip leading whitespace.
-# if KWSYS_IOS_USE_ANSI
- kwsys_ios::istream::sentry okay(is);
-# else
- is.eatwhite();
- kwsys_ios::istream& okay = is;
-# endif
+ std::istream::sentry okay(is);
if(okay)
{
-# if KWSYS_IOS_USE_ANSI
try {
-# endif
// Copy the string to a buffer and construct the format string.
char buffer[KWSYS_IOS_INT64_MAX_DIG];
# if defined(_MSC_VER)
@@ -174,52 +156,40 @@ IOStreamScanTemplate(kwsys_ios::istream& is, T& value, char type)
int success = (sscanf(buffer, format, &result) == 1)?1:0;
// Set flags for resulting state.
- if(is.peek() == EOF) { state |= kwsys_ios::ios_base::eofbit; }
- if(!success) { state |= kwsys_ios::ios_base::failbit; }
+ if(is.peek() == EOF) { state |= std::ios_base::eofbit; }
+ if(!success) { state |= std::ios_base::failbit; }
else { value = result; }
-# if KWSYS_IOS_USE_ANSI
- } catch(...) { state |= kwsys_ios::ios_base::badbit; }
-# endif
+ } catch(...) { state |= std::ios_base::badbit; }
}
-# if KWSYS_IOS_USE_ANSI
- is.setstate(kwsys_ios::ios_base::iostate(state));
-# else
- is.clear(state);
-# endif
+ is.setstate(std::ios_base::iostate(state));
return is;
}
// Print an integer value to an output stream.
template <class T>
-kwsys_ios::ostream&
-IOStreamPrintTemplate(kwsys_ios::ostream& os, T value, char type)
+std::ostream&
+IOStreamPrintTemplate(std::ostream& os, T value, char type)
{
-# if KWSYS_IOS_USE_ANSI
- kwsys_ios::ostream::sentry okay(os);
-# else
- kwsys_ios::ostream& okay = os;
-# endif
+ std::ostream::sentry okay(os);
if(okay)
{
-# if KWSYS_IOS_USE_ANSI
try {
-# endif
// Construct the format string.
char format[8];
char* f = format;
*f++ = '%';
- if(os.flags() & kwsys_ios::ios_base::showpos) { *f++ = '+'; }
- if(os.flags() & kwsys_ios::ios_base::showbase) { *f++ = '#'; }
+ if(os.flags() & std::ios_base::showpos) { *f++ = '+'; }
+ if(os.flags() & std::ios_base::showbase) { *f++ = '#'; }
# if defined(_MSC_VER)
*f++ = 'I'; *f++ = '6'; *f++ = '4';
# else
*f++ = 'l'; *f++ = 'l';
# endif
- long bflags = os.flags() & kwsys_ios::ios_base::basefield;
- if(bflags == kwsys_ios::ios_base::oct) { *f++ = 'o'; }
- else if(bflags != kwsys_ios::ios_base::hex) { *f++ = type; }
- else if(os.flags() & kwsys_ios::ios_base::uppercase) { *f++ = 'X'; }
+ long bflags = os.flags() & std::ios_base::basefield;
+ if(bflags == std::ios_base::oct) { *f++ = 'o'; }
+ else if(bflags != std::ios_base::hex) { *f++ = type; }
+ else if(os.flags() & std::ios_base::uppercase) { *f++ = 'X'; }
else { *f++ = 'x'; }
*f = '\0';
@@ -228,22 +198,20 @@ IOStreamPrintTemplate(kwsys_ios::ostream& os, T value, char type)
char buffer[2*KWSYS_IOS_INT64_MAX_DIG];
sprintf(buffer, format, value);
os << buffer;
-# if KWSYS_IOS_USE_ANSI
- } catch(...) { os.clear(os.rdstate() | kwsys_ios::ios_base::badbit); }
-# endif
+ } catch(...) { os.clear(os.rdstate() | std::ios_base::badbit); }
}
return os;
}
# if !KWSYS_IOS_HAS_ISTREAM_LONG_LONG
// Implement input stream operator for IOStreamSLL.
-kwsys_ios::istream& IOStreamScan(kwsys_ios::istream& is, IOStreamSLL& value)
+std::istream& IOStreamScan(std::istream& is, IOStreamSLL& value)
{
return IOStreamScanTemplate(is, value, 'd');
}
// Implement input stream operator for IOStreamULL.
-kwsys_ios::istream& IOStreamScan(kwsys_ios::istream& is, IOStreamULL& value)
+std::istream& IOStreamScan(std::istream& is, IOStreamULL& value)
{
return IOStreamScanTemplate(is, value, 'u');
}
@@ -251,13 +219,13 @@ kwsys_ios::istream& IOStreamScan(kwsys_ios::istream& is, IOStreamULL& value)
# if !KWSYS_IOS_HAS_OSTREAM_LONG_LONG
// Implement output stream operator for IOStreamSLL.
-kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream& os, IOStreamSLL value)
+std::ostream& IOStreamPrint(std::ostream& os, IOStreamSLL value)
{
return IOStreamPrintTemplate(os, value, 'd');
}
// Implement output stream operator for IOStreamULL.
-kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream& os, IOStreamULL value)
+std::ostream& IOStreamPrint(std::ostream& os, IOStreamULL value)
{
return IOStreamPrintTemplate(os, value, 'u');
}
diff --git a/Source/kwsys/IOStream.hxx.in b/Source/kwsys/IOStream.hxx.in
index 2eeedf2..c101909 100644
--- a/Source/kwsys/IOStream.hxx.in
+++ b/Source/kwsys/IOStream.hxx.in
@@ -12,12 +12,11 @@
#ifndef @KWSYS_NAMESPACE@_IOStream_hxx
#define @KWSYS_NAMESPACE@_IOStream_hxx
-#include <@KWSYS_NAMESPACE@/ios/iosfwd>
+#include <iosfwd>
/* Define these macros temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
-# define kwsys_ios @KWSYS_NAMESPACE@_ios
#endif
/* Whether istream supports long long. */
@@ -56,10 +55,8 @@
/* Input stream operator implementation functions. */
namespace @KWSYS_NAMESPACE@
{
-kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
- IOStreamSLL&);
-kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
- IOStreamULL&);
+kwsysEXPORT std::istream& IOStreamScan(std::istream&, IOStreamSLL&);
+kwsysEXPORT std::istream& IOStreamScan(std::istream&, IOStreamULL&);
}
/* Provide input stream operator for long long. */
@@ -67,8 +64,8 @@ kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
!defined(KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED)
# define KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED
# define @KWSYS_NAMESPACE@_IOS_ISTREAM_LONG_LONG_DEFINED
-inline kwsys_ios::istream&
-operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value)
+inline std::istream&
+operator>>(std::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value)
{
return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
}
@@ -79,8 +76,8 @@ operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value)
!defined(KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED)
# define KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
# define @KWSYS_NAMESPACE@_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
-inline kwsys_ios::istream&
-operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value)
+inline std::istream&
+operator>>(std::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value)
{
return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
}
@@ -92,10 +89,8 @@ operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value)
/* Output stream operator implementation functions. */
namespace @KWSYS_NAMESPACE@
{
-kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
- IOStreamSLL);
-kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
- IOStreamULL);
+kwsysEXPORT std::ostream& IOStreamPrint(std::ostream&, IOStreamSLL);
+kwsysEXPORT std::ostream& IOStreamPrint(std::ostream&, IOStreamULL);
}
/* Provide output stream operator for long long. */
@@ -103,8 +98,8 @@ kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
!defined(KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED)
# define KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED
# define @KWSYS_NAMESPACE@_IOS_OSTREAM_LONG_LONG_DEFINED
-inline kwsys_ios::ostream&
-operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value)
+inline std::ostream&
+operator<<(std::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value)
{
return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
}
@@ -115,8 +110,8 @@ operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value)
!defined(KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED)
# define KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
# define @KWSYS_NAMESPACE@_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
-inline kwsys_ios::ostream&
-operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value)
+inline std::ostream&
+operator<<(std::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value)
{
return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
}
@@ -127,7 +122,6 @@ operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value)
/* Undefine temporary macros. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsysEXPORT
-# undef kwsys_ios
#endif
/* If building a C++ file in kwsys itself, give the source file
diff --git a/Source/kwsys/RegularExpression.hxx.in b/Source/kwsys/RegularExpression.hxx.in
index 502fbe2..d0235d8 100644
--- a/Source/kwsys/RegularExpression.hxx.in
+++ b/Source/kwsys/RegularExpression.hxx.in
@@ -33,12 +33,7 @@
#include <@KWSYS_NAMESPACE@/Configure.h>
#include <@KWSYS_NAMESPACE@/Configure.hxx>
-#include <@KWSYS_NAMESPACE@/stl/string>
-
-/* Define this macro temporarily to keep the code readable. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE@_stl
-#endif
+#include <string>
/* Disable useless Borland warnings. KWSys tries not to force things
on its includers, but there is no choice here. */
@@ -207,7 +202,7 @@ public:
/**
* Instantiate RegularExpression with compiled string.
*/
- inline RegularExpression (kwsys_stl::string const&);
+ inline RegularExpression (std::string const&);
/**
* Destructor.
@@ -224,7 +219,7 @@ public:
* Compile a regular expression into internal code
* for later pattern matching.
*/
- inline bool compile (kwsys_stl::string const&);
+ inline bool compile (std::string const&);
/**
* Matches the regular expression to the given string.
@@ -236,17 +231,17 @@ public:
* Matches the regular expression to the given std string.
* Returns true if found, and sets start and end indexes accordingly.
*/
- inline bool find (kwsys_stl::string const&);
+ inline bool find (std::string const&);
/**
* Index to start of first find.
*/
- inline kwsys_stl::string::size_type start() const;
+ inline std::string::size_type start() const;
/**
* Index to end of first find.
*/
- inline kwsys_stl::string::size_type end() const;
+ inline std::string::size_type end() const;
/**
* Copy the given regular expression.
@@ -285,9 +280,9 @@ public:
* Destructor.
*/
// awf added
- kwsys_stl::string::size_type start(int n) const;
- kwsys_stl::string::size_type end(int n) const;
- kwsys_stl::string match(int n) const;
+ std::string::size_type start(int n) const;
+ std::string::size_type end(int n) const;
+ std::string match(int n) const;
enum { NSUBEXP = 10 };
private:
@@ -296,7 +291,7 @@ private:
char regstart; // Internal use only
char reganch; // Internal use only
const char* regmust; // Internal use only
- kwsys_stl::string::size_type regmlen; // Internal use only
+ std::string::size_type regmlen; // Internal use only
char* program;
int progsize;
const char* searchstring;
@@ -327,7 +322,7 @@ inline RegularExpression::RegularExpression (const char* s)
* Creates a regular expression from string s, and
* compiles s.
*/
-inline RegularExpression::RegularExpression (const kwsys_stl::string& s)
+inline RegularExpression::RegularExpression (const std::string& s)
{
this->program = 0;
this->compile(s);
@@ -347,7 +342,7 @@ inline RegularExpression::~RegularExpression ()
* Compile a regular expression into internal code
* for later pattern matching.
*/
-inline bool RegularExpression::compile (kwsys_stl::string const& s)
+inline bool RegularExpression::compile (std::string const& s)
{
return this->compile(s.c_str());
}
@@ -356,7 +351,7 @@ inline bool RegularExpression::compile (kwsys_stl::string const& s)
* Matches the regular expression to the given std string.
* Returns true if found, and sets start and end indexes accordingly.
*/
-inline bool RegularExpression::find (kwsys_stl::string const& s)
+inline bool RegularExpression::find (std::string const& s)
{
return this->find(s.c_str());
}
@@ -364,9 +359,9 @@ inline bool RegularExpression::find (kwsys_stl::string const& s)
/**
* Set the start position for the regular expression.
*/
-inline kwsys_stl::string::size_type RegularExpression::start () const
+inline std::string::size_type RegularExpression::start () const
{
- return static_cast<kwsys_stl::string::size_type>(
+ return static_cast<std::string::size_type>(
this->startp[0] - searchstring);
}
@@ -374,9 +369,9 @@ inline kwsys_stl::string::size_type RegularExpression::start () const
/**
* Returns the start/end index of the last item found.
*/
-inline kwsys_stl::string::size_type RegularExpression::end () const
+inline std::string::size_type RegularExpression::end () const
{
- return static_cast<kwsys_stl::string::size_type>(
+ return static_cast<std::string::size_type>(
this->endp[0] - searchstring);
}
@@ -410,9 +405,9 @@ inline void RegularExpression::set_invalid ()
/**
* Return start index of nth submatch. start(0) is the start of the full match.
*/
-inline kwsys_stl::string::size_type RegularExpression::start(int n) const
+inline std::string::size_type RegularExpression::start(int n) const
{
- return static_cast<kwsys_stl::string::size_type>(
+ return static_cast<std::string::size_type>(
this->startp[n] - searchstring);
}
@@ -420,34 +415,29 @@ inline kwsys_stl::string::size_type RegularExpression::start(int n) const
/**
* Return end index of nth submatch. end(0) is the end of the full match.
*/
-inline kwsys_stl::string::size_type RegularExpression::end(int n) const
+inline std::string::size_type RegularExpression::end(int n) const
{
- return static_cast<kwsys_stl::string::size_type>(
+ return static_cast<std::string::size_type>(
this->endp[n] - searchstring);
}
/**
* Return nth submatch as a string.
*/
-inline kwsys_stl::string RegularExpression::match(int n) const
+inline std::string RegularExpression::match(int n) const
{
if (this->startp[n]==0)
{
- return kwsys_stl::string("");
+ return std::string("");
}
else
{
- return kwsys_stl::string(this->startp[n],
- static_cast<kwsys_stl::string::size_type>(
+ return std::string(this->startp[n],
+ static_cast<std::string::size_type>(
this->endp[n] - this->startp[n]));
}
}
} // namespace @KWSYS_NAMESPACE@
-/* Undefine temporary macro. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
#endif
diff --git a/Source/kwsys/String.hxx.in b/Source/kwsys/String.hxx.in
index 4386c9e..2e9aedb 100644
--- a/Source/kwsys/String.hxx.in
+++ b/Source/kwsys/String.hxx.in
@@ -12,7 +12,7 @@
#ifndef @KWSYS_NAMESPACE@_String_hxx
#define @KWSYS_NAMESPACE@_String_hxx
-#include <@KWSYS_NAMESPACE@/stl/string>
+#include <string>
namespace @KWSYS_NAMESPACE@
{
@@ -25,10 +25,10 @@ namespace @KWSYS_NAMESPACE@
* simply a subclass of this type with the same interface so that the
* name is shorter in debugging symbols and error messages.
*/
-class String: public @KWSYS_NAMESPACE@_stl::string
+class String: public std::string
{
/** The original string type. */
- typedef @KWSYS_NAMESPACE@_stl::string stl_string;
+ typedef std::string stl_string;
public:
@@ -55,8 +55,8 @@ public:
#if defined(__WATCOMC__)
inline bool operator<(String const& l, String const& r)
{
- return (static_cast<@KWSYS_NAMESPACE@_stl::string const&>(l) <
- static_cast<@KWSYS_NAMESPACE@_stl::string const&>(r));
+ return (static_cast<std::string const&>(l) <
+ static_cast<std::string const&>(r));
}
#endif
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 6e81b0b..cddcc8d 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -35,14 +35,8 @@
// http://msdn.microsoft.com/en-us/library/ms683219(VS.85).aspx
#include "kwsysPrivate.h"
-#include KWSYS_HEADER(stl/string)
-#include KWSYS_HEADER(stl/vector)
-#include KWSYS_HEADER(ios/iosfwd)
#include KWSYS_HEADER(SystemInformation.hxx)
#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.
@@ -50,14 +44,14 @@
# include "SystemInformation.hxx.in"
# include "Process.h.in"
# include "Configure.hxx.in"
-# include "kwsys_stl.hxx.in"
-# include "kwsys_stl_vector.in"
-# include "kwsys_stl_iosfwd.in"
-# include "kwsys_ios_sstream.h.in"
-# include "kwsys_ios_iostream.h.in"
-# include "kwsys_ios_fstream.h.in"
#endif
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <string>
+#include <vector>
+
#if defined(_WIN32)
# include <windows.h>
# if defined(_MSC_VER) && _MSC_VER >= 1800
@@ -325,11 +319,11 @@ public:
const char * GetVendorString();
const char * GetVendorID();
- kwsys_stl::string GetTypeID();
- kwsys_stl::string GetFamilyID();
- kwsys_stl::string GetModelID();
- kwsys_stl::string GetModelName();
- kwsys_stl::string GetSteppingCode();
+ std::string GetTypeID();
+ std::string GetFamilyID();
+ std::string GetModelID();
+ std::string GetModelName();
+ std::string GetSteppingCode();
const char * GetExtendedProcessorName();
const char * GetProcessorSerialNumber();
int GetProcessorCacheSize();
@@ -341,7 +335,7 @@ public:
const char * GetOSName();
const char * GetHostname();
- int GetFullyQualifiedDomainName(kwsys_stl::string &fqdn);
+ int GetFullyQualifiedDomainName(std::string &fqdn);
const char * GetOSRelease();
const char * GetOSVersion();
const char * GetOSPlatform();
@@ -379,7 +373,7 @@ public:
// get current stack
static
- kwsys_stl::string GetProgramStack(int firstFrame, int wholePath);
+ std::string GetProgramStack(int firstFrame, int wholePath);
/** Run the different checks */
void RunCPUCheck();
@@ -395,10 +389,10 @@ public:
int Revision;
int ExtendedFamily;
int ExtendedModel;
- kwsys_stl::string ProcessorName;
- kwsys_stl::string Vendor;
- kwsys_stl::string SerialNumber;
- kwsys_stl::string ModelName;
+ std::string ProcessorName;
+ std::string Vendor;
+ std::string SerialNumber;
+ std::string ModelName;
} ID;
typedef struct tagCPUPowerManagement
@@ -480,7 +474,7 @@ protected:
// For Linux and Cygwin, /proc/cpuinfo formats are slightly different
bool RetreiveInformationFromCpuInfoFile();
- kwsys_stl::string ExtractValueFromCpuInfoFile(kwsys_stl::string buffer,
+ std::string ExtractValueFromCpuInfoFile(std::string buffer,
const char* word, size_t init=0);
bool QueryLinuxMemory();
@@ -489,20 +483,20 @@ protected:
static void Delay (unsigned int);
static void DelayOverhead (unsigned int);
- void FindManufacturer(const kwsys_stl::string &family = "");
+ void FindManufacturer(const std::string &family = "");
// For Mac
bool ParseSysCtl();
- 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;
+ int CallSwVers(const char *arg, std::string &ver);
+ void TrimNewline(std::string&);
+ std::string ExtractValueFromSysCtl(const char* word);
+ std::string SysCtlBuffer;
// For Solaris
bool QuerySolarisMemory();
bool QuerySolarisProcessor();
- kwsys_stl::string ParseValueFromKStat(const char* arguments);
- kwsys_stl::string RunProcess(kwsys_stl::vector<const char*> args);
+ std::string ParseValueFromKStat(const char* arguments);
+ std::string RunProcess(std::vector<const char*> args);
//For Haiku OS
bool QueryHaikuInfo();
@@ -540,11 +534,11 @@ protected:
// Operating System information
bool QueryOSInformation();
- kwsys_stl::string OSName;
- kwsys_stl::string Hostname;
- kwsys_stl::string OSRelease;
- kwsys_stl::string OSVersion;
- kwsys_stl::string OSPlatform;
+ std::string OSName;
+ std::string Hostname;
+ std::string OSRelease;
+ std::string OSVersion;
+ std::string OSPlatform;
};
@@ -568,27 +562,27 @@ const char * SystemInformation::GetVendorID()
return this->Implementation->GetVendorID();
}
-kwsys_stl::string SystemInformation::GetTypeID()
+std::string SystemInformation::GetTypeID()
{
return this->Implementation->GetTypeID();
}
-kwsys_stl::string SystemInformation::GetFamilyID()
+std::string SystemInformation::GetFamilyID()
{
return this->Implementation->GetFamilyID();
}
-kwsys_stl::string SystemInformation::GetModelID()
+std::string SystemInformation::GetModelID()
{
return this->Implementation->GetModelID();
}
-kwsys_stl::string SystemInformation::GetModelName()
+std::string SystemInformation::GetModelName()
{
return this->Implementation->GetModelName();
}
-kwsys_stl::string SystemInformation::GetSteppingCode()
+std::string SystemInformation::GetSteppingCode()
{
return this->Implementation->GetSteppingCode();
}
@@ -633,9 +627,9 @@ bool SystemInformation::DoesCPUSupportFeature(long int i)
return this->Implementation->DoesCPUSupportFeature(i);
}
-kwsys_stl::string SystemInformation::GetCPUDescription()
+std::string SystemInformation::GetCPUDescription()
{
- kwsys_ios::ostringstream oss;
+ std::ostringstream oss;
oss
<< this->GetNumberOfPhysicalCPU()
<< " core ";
@@ -654,9 +648,9 @@ kwsys_stl::string SystemInformation::GetCPUDescription()
}
// remove extra spaces
- kwsys_stl::string tmp=oss.str();
+ std::string tmp=oss.str();
size_t pos;
- while( (pos=tmp.find(" "))!=kwsys_stl::string::npos)
+ while( (pos=tmp.find(" "))!=std::string::npos)
{
tmp.replace(pos,2," ");
}
@@ -674,9 +668,9 @@ const char * SystemInformation::GetHostname()
return this->Implementation->GetHostname();
}
-kwsys_stl::string SystemInformation::GetFullyQualifiedDomainName()
+std::string SystemInformation::GetFullyQualifiedDomainName()
{
- kwsys_stl::string fqdn;
+ std::string fqdn;
this->Implementation->GetFullyQualifiedDomainName(fqdn);
return fqdn;
}
@@ -723,9 +717,9 @@ int SystemInformation::GetOSIsApple()
#endif
}
-kwsys_stl::string SystemInformation::GetOSDescription()
+std::string SystemInformation::GetOSDescription()
{
- kwsys_ios::ostringstream oss;
+ std::ostringstream oss;
oss
<< this->GetOSName()
<< " "
@@ -777,11 +771,11 @@ size_t SystemInformation::GetAvailablePhysicalMemory()
return this->Implementation->GetAvailablePhysicalMemory();
}
-kwsys_stl::string SystemInformation::GetMemoryDescription(
+std::string SystemInformation::GetMemoryDescription(
const char *hostLimitEnvVarName,
const char *procLimitEnvVarName)
{
- kwsys_ios::ostringstream oss;
+ std::ostringstream oss;
oss
<< "Host Total: "
<< iostreamLongLong(this->GetHostMemoryTotal())
@@ -842,7 +836,7 @@ void SystemInformation::SetStackTraceOnError(int enable)
SystemInformationImplementation::SetStackTraceOnError(enable);
}
-kwsys_stl::string SystemInformation::GetProgramStack(int firstFrame, int wholePath)
+std::string SystemInformation::GetProgramStack(int firstFrame, int wholePath)
{
return SystemInformationImplementation::GetProgramStack(firstFrame, wholePath);
}
@@ -926,7 +920,7 @@ namespace {
#if defined(__linux) || defined(__APPLE__)
int LoadLines(
FILE *file,
- kwsys_stl::vector<kwsys_stl::string> &lines)
+ std::vector<std::string> &lines)
{
// Load each line in the given file into a the vector.
int nRead=0;
@@ -963,7 +957,7 @@ int LoadLines(
// *****************************************************************************
int LoadLines(
const char *fileName,
- kwsys_stl::vector<kwsys_stl::string> &lines)
+ std::vector<std::string> &lines)
{
FILE *file=fopen(fileName,"r");
if (file==0)
@@ -979,18 +973,18 @@ int LoadLines(
// ****************************************************************************
template<typename T>
int NameValue(
- kwsys_stl::vector<kwsys_stl::string> &lines,
- kwsys_stl::string name, T &value)
+ std::vector<std::string> &lines,
+ std::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)
+ if (at==std::string::npos)
{
continue;
}
- kwsys_ios::istringstream is(lines[i].substr(at+name.size()));
+ std::istringstream is(lines[i].substr(at+name.size()));
is >> value;
return 0;
}
@@ -1006,7 +1000,7 @@ int GetFieldsFromFile(
const char **fieldNames,
T *values)
{
- kwsys_stl::vector<kwsys_stl::string> fields;
+ std::vector<std::string> fields;
if (!LoadLines(fileName,fields))
{
return -1;
@@ -1056,7 +1050,7 @@ int GetFieldsFromCommand(
{
return -1;
}
- kwsys_stl::vector<kwsys_stl::string> fields;
+ std::vector<std::string> fields;
int nl=LoadLines(file,fields);
pclose(file);
if (nl==0)
@@ -1085,10 +1079,10 @@ void StacktraceSignalHandler(
void * /*sigContext*/)
{
#if defined(__linux) || defined(__APPLE__)
- kwsys_ios::ostringstream oss;
+ std::ostringstream oss;
oss
- << kwsys_ios::endl
- << "=========================================================" << kwsys_ios::endl
+ << std::endl
+ << "=========================================================" << std::endl
<< "Process id " << getpid() << " ";
switch (sigNo)
{
@@ -1281,11 +1275,11 @@ void StacktraceSignalHandler(
break;
}
oss
- << kwsys_ios::endl
- << "Program Stack:" << kwsys_ios::endl
+ << std::endl
+ << "Program Stack:" << std::endl
<< SystemInformationImplementation::GetProgramStack(2,0)
- << "=========================================================" << kwsys_ios::endl;
- kwsys_ios::cerr << oss.str() << kwsys_ios::endl;
+ << "=========================================================" << std::endl;
+ std::cerr << oss.str() << std::endl;
// restore the previously registered handlers
// and abort
@@ -1330,7 +1324,7 @@ public:
void SetBinary(const char *binary)
{ this->Binary=safes(binary); }
- kwsys_stl::string GetBinary() const;
+ std::string GetBinary() const;
// Description:
// Set the name of the function that the symbol is found in.
@@ -1338,7 +1332,7 @@ public:
void SetFunction(const char *function)
{ this->Function=this->Demangle(function); }
- kwsys_stl::string GetFunction() const
+ std::string GetFunction() const
{ return this->Function; }
// Description:
@@ -1347,7 +1341,7 @@ public:
void SetSourceFile(const char *sourcefile)
{ this->SourceFile=safes(sourcefile); }
- kwsys_stl::string GetSourceFile() const
+ std::string GetSourceFile() const
{ return this->GetFileName(this->SourceFile); }
// Description:
@@ -1365,31 +1359,31 @@ private:
void *GetRealAddress() const
{ return (void*)((char*)this->Address-(char*)this->BinaryBaseAddress); }
- kwsys_stl::string GetFileName(const kwsys_stl::string &path) const;
- kwsys_stl::string Demangle(const char *symbol) const;
+ std::string GetFileName(const std::string &path) const;
+ std::string Demangle(const char *symbol) const;
private:
- kwsys_stl::string Binary;
+ std::string Binary;
void *BinaryBaseAddress;
void *Address;
- kwsys_stl::string SourceFile;
- kwsys_stl::string Function;
+ std::string SourceFile;
+ std::string Function;
long LineNumber;
int ReportPath;
};
// --------------------------------------------------------------------------
-kwsys_ios::ostream &operator<<(
- kwsys_ios::ostream &os,
+std::ostream &operator<<(
+ std::ostream &os,
const SymbolProperties &sp)
{
#if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP)
os
- << kwsys_ios::hex << sp.GetAddress() << " : "
+ << std::hex << sp.GetAddress() << " : "
<< sp.GetFunction()
<< " [(" << sp.GetBinary() << ") "
<< sp.GetSourceFile() << ":"
- << kwsys_ios::dec << sp.GetLineNumber() << "]";
+ << std::dec << sp.GetLineNumber() << "]";
#elif defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
void *addr = sp.GetAddress();
char **syminfo = backtrace_symbols(&addr,1);
@@ -1422,28 +1416,28 @@ SymbolProperties::SymbolProperties()
}
// --------------------------------------------------------------------------
-kwsys_stl::string SymbolProperties::GetFileName(const kwsys_stl::string &path) const
+std::string SymbolProperties::GetFileName(const std::string &path) const
{
- kwsys_stl::string file(path);
+ std::string file(path);
if (!this->ReportPath)
{
size_t at = file.rfind("/");
- if (at!=kwsys_stl::string::npos)
+ if (at!=std::string::npos)
{
- file = file.substr(at+1,kwsys_stl::string::npos);
+ file = file.substr(at+1,std::string::npos);
}
}
return file;
}
// --------------------------------------------------------------------------
-kwsys_stl::string SymbolProperties::GetBinary() const
+std::string SymbolProperties::GetBinary() const
{
// only linux has proc fs
#if defined(__linux__)
if (this->Binary=="/proc/self/exe")
{
- kwsys_stl::string binary;
+ std::string binary;
char buf[1024]={'\0'};
ssize_t ll=0;
if ((ll=readlink("/proc/self/exe",buf,1024))>0)
@@ -1462,9 +1456,9 @@ kwsys_stl::string SymbolProperties::GetBinary() const
}
// --------------------------------------------------------------------------
-kwsys_stl::string SymbolProperties::Demangle(const char *symbol) const
+std::string SymbolProperties::Demangle(const char *symbol) const
{
- kwsys_stl::string result = safes(symbol);
+ std::string result = safes(symbol);
#if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE)
int status = 0;
size_t bufferLen = 1024;
@@ -1729,7 +1723,7 @@ const char* SystemInformationImplementation::GetHostname()
/** Get the FQDN */
int SystemInformationImplementation::GetFullyQualifiedDomainName(
- kwsys_stl::string &fqdn)
+ std::string &fqdn)
{
// in the event of absolute failure return localhost.
fqdn="localhost";
@@ -1820,8 +1814,8 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
continue;
}
- kwsys_stl::string candidate=host;
- if ((candidate.find(base)!=kwsys_stl::string::npos) && baseSize<candidate.size())
+ std::string candidate=host;
+ if ((candidate.find(base)!=std::string::npos) && baseSize<candidate.size())
{
// success, stop now.
ierr=0;
@@ -1897,39 +1891,39 @@ const char * SystemInformationImplementation::GetVendorID()
}
/** Return the type ID of the CPU */
-kwsys_stl::string SystemInformationImplementation::GetTypeID()
+std::string SystemInformationImplementation::GetTypeID()
{
- kwsys_ios::ostringstream str;
+ std::ostringstream str;
str << this->ChipID.Type;
return str.str();
}
/** Return the family of the CPU present */
-kwsys_stl::string SystemInformationImplementation::GetFamilyID()
+std::string SystemInformationImplementation::GetFamilyID()
{
- kwsys_ios::ostringstream str;
+ std::ostringstream str;
str << this->ChipID.Family;
return str.str();
}
// Return the model of CPU present */
-kwsys_stl::string SystemInformationImplementation::GetModelID()
+std::string SystemInformationImplementation::GetModelID()
{
- kwsys_ios::ostringstream str;
+ std::ostringstream str;
str << this->ChipID.Model;
return str.str();
}
// Return the model name of CPU present */
-kwsys_stl::string SystemInformationImplementation::GetModelName()
+std::string SystemInformationImplementation::GetModelName()
{
return this->ChipID.ModelName;
}
/** Return the stepping code of the CPU present. */
-kwsys_stl::string SystemInformationImplementation::GetSteppingCode()
+std::string SystemInformationImplementation::GetSteppingCode()
{
- kwsys_ios::ostringstream str;
+ std::ostringstream str;
str << this->ChipID.Revision;
return str.str();
}
@@ -2180,7 +2174,7 @@ bool SystemInformationImplementation::RetrieveCPUFeatures()
/** Find the manufacturer given the vendor id */
-void SystemInformationImplementation::FindManufacturer(const kwsys_stl::string& family)
+void SystemInformationImplementation::FindManufacturer(const std::string& family)
{
if (this->ChipID.Vendor == "GenuineIntel") this->ChipManufacturer = Intel; // Intel Corp.
else if (this->ChipID.Vendor == "UMC UMC UMC ") this->ChipManufacturer = UMC; // United Microelectronics Corp.
@@ -2799,11 +2793,11 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement()
#if USE_CPUID
// Used only in USE_CPUID implementation below.
-static void SystemInformationStripLeadingSpace(kwsys_stl::string& str)
+static void SystemInformationStripLeadingSpace(std::string& str)
{
// Because some manufacturers have leading white space - we have to post-process the name.
- kwsys_stl::string::size_type pos = str.find_first_not_of(" ");
- if(pos != kwsys_stl::string::npos)
+ std::string::size_type pos = str.find_first_not_of(" ");
+ if(pos != std::string::npos)
{
str = str.substr(pos);
}
@@ -3148,7 +3142,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
/** Extract a value from the CPUInfo file */
-kwsys_stl::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(kwsys_stl::string buffer,const char* word,size_t init)
+std::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(std::string buffer,const char* word,size_t init)
{
size_t pos = buffer.find(word,init);
if(pos != buffer.npos)
@@ -3180,12 +3174,12 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
{
this->NumberOfLogicalCPU = 0;
this->NumberOfPhysicalCPU = 0;
- kwsys_stl::string buffer;
+ std::string buffer;
FILE *fd = fopen("/proc/cpuinfo", "r" );
if ( !fd )
{
- kwsys_ios::cout << "Problem opening /proc/cpuinfo" << kwsys_ios::endl;
+ std::cout << "Problem opening /proc/cpuinfo" << std::endl;
return false;
}
@@ -3209,7 +3203,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
#ifdef __linux
// Find the largest physical id.
int maxId = -1;
- kwsys_stl::string idc =
+ std::string idc =
this->ExtractValueFromCpuInfoFile(buffer,"physical id");
while(this->CurrentPositionInFile != buffer.npos)
{
@@ -3224,7 +3218,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
// Physical ids returned by Linux don't distinguish cores.
// We want to record the total number of cores in this->NumberOfPhysicalCPU
// (checking only the first proc)
- kwsys_stl::string cores =
+ std::string cores =
this->ExtractValueFromCpuInfoFile(buffer,"cpu cores");
int numberOfCoresPerCPU=atoi(cores.c_str());
if (maxId > 0)
@@ -3242,7 +3236,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
#else // __CYGWIN__
// does not have "physical id" entries, neither "cpu cores"
// this has to be fixed for hyper-threading.
- kwsys_stl::string cpucount =
+ std::string cpucount =
this->ExtractValueFromCpuInfoFile(buffer,"cpu count");
this->NumberOfPhysicalCPU=
this->NumberOfLogicalCPU = atoi(cpucount.c_str());
@@ -3258,7 +3252,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
this->NumberOfLogicalCPU/this->NumberOfPhysicalCPU;
// CPU speed (checking only the first processor)
- kwsys_stl::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz");
+ std::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz");
if(!CPUSpeed.empty())
{
this->CPUSpeedInMHz = static_cast<float>(atof(CPUSpeed.c_str()));
@@ -3274,7 +3268,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
#endif
// Chip family
- kwsys_stl::string familyStr =
+ std::string familyStr =
this->ExtractValueFromCpuInfoFile(buffer,"cpu family");
if(familyStr.empty())
{
@@ -3304,7 +3298,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
{
// Some platforms (e.g. PA-RISC) tell us their CPU name here.
// Note: x86 does not.
- kwsys_stl::string cpuname = this->ExtractValueFromCpuInfoFile(buffer,"cpu");
+ std::string cpuname = this->ExtractValueFromCpuInfoFile(buffer,"cpu");
if(!cpuname.empty())
{
this->ChipID.ProcessorName = cpuname;
@@ -3312,7 +3306,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
}
// Chip revision
- kwsys_stl::string cpurev = this->ExtractValueFromCpuInfoFile(buffer,"stepping");
+ std::string cpurev = this->ExtractValueFromCpuInfoFile(buffer,"stepping");
if(cpurev.empty())
{
cpurev = this->ExtractValueFromCpuInfoFile(buffer,"CPU revision");
@@ -3325,7 +3319,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
// L1 Cache size
// Different architectures may show different names for the caches.
// Sum up everything we find.
- kwsys_stl::vector<const char*> cachename;
+ std::vector<const char*> cachename;
cachename.clear();
cachename.push_back("cache size"); // e.g. x86
@@ -3335,7 +3329,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
this->Features.L1CacheSize = 0;
for (size_t index = 0; index < cachename.size(); index ++)
{
- kwsys_stl::string cacheSize = this->ExtractValueFromCpuInfoFile(buffer,cachename[index]);
+ std::string cacheSize = this->ExtractValueFromCpuInfoFile(buffer,cachename[index]);
if (!cacheSize.empty())
{
pos = cacheSize.find(" KB");
@@ -3348,48 +3342,48 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
}
// processor feature flags (probably x86 specific)
- kwsys_stl::string cpuflags = this->ExtractValueFromCpuInfoFile(buffer,"flags");
+ std::string cpuflags = this->ExtractValueFromCpuInfoFile(buffer,"flags");
if(!cpurev.empty())
{
// now we can match every flags as space + flag + space
cpuflags = " " + cpuflags + " ";
- if ((cpuflags.find(" fpu ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" fpu ")!=std::string::npos))
{
this->Features.HasFPU = true;
}
- if ((cpuflags.find(" tsc ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" tsc ")!=std::string::npos))
{
this->Features.HasTSC = true;
}
- if ((cpuflags.find(" mmx ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" mmx ")!=std::string::npos))
{
this->Features.HasMMX = true;
}
- if ((cpuflags.find(" sse ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" sse ")!=std::string::npos))
{
this->Features.HasSSE = true;
}
- if ((cpuflags.find(" sse2 ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" sse2 ")!=std::string::npos))
{
this->Features.HasSSE2 = true;
}
- if ((cpuflags.find(" apic ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" apic ")!=std::string::npos))
{
this->Features.HasAPIC = true;
}
- if ((cpuflags.find(" cmov ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" cmov ")!=std::string::npos))
{
this->Features.HasCMOV = true;
}
- if ((cpuflags.find(" mtrr ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" mtrr ")!=std::string::npos))
{
this->Features.HasMTRR = true;
}
- if ((cpuflags.find(" acpi ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" acpi ")!=std::string::npos))
{
this->Features.HasACPI = true;
}
- if ((cpuflags.find(" 3dnow ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" 3dnow ")!=std::string::npos))
{
this->Features.ExtendedFeatures.Has3DNow = true;
}
@@ -3645,7 +3639,7 @@ SystemInformationImplementation::GetProcMemoryUsed()
#elif defined(__APPLE__)
SystemInformation::LongLong memUsed=0;
pid_t pid=getpid();
- kwsys_ios::ostringstream oss;
+ std::ostringstream oss;
oss << "ps -o rss= -p " << pid;
FILE *file=popen(oss.str().c_str(),"r");
if (file==0)
@@ -3670,7 +3664,7 @@ SystemInformationImplementation::GetProcMemoryUsed()
{
return -2;
}
- kwsys_ios::istringstream iss(oss.str());
+ std::istringstream iss(oss.str());
iss >> memUsed;
return memUsed;
#else
@@ -3729,11 +3723,11 @@ SystemInformationImplementation::GetProcessId()
return current program stack in a string
demangle cxx symbols if possible.
*/
-kwsys_stl::string SystemInformationImplementation::GetProgramStack(
+std::string SystemInformationImplementation::GetProgramStack(
int firstFrame,
int wholePath)
{
- kwsys_stl::string programStack = ""
+ std::string programStack = ""
#if !defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
"WARNING: The stack could not be examined "
"because backtrace is not supported.\n"
@@ -3752,7 +3746,7 @@ kwsys_stl::string SystemInformationImplementation::GetProgramStack(
#endif
;
- kwsys_ios::ostringstream oss;
+ std::ostringstream oss;
#if defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
void *stackSymbols[256];
int nFrames=backtrace(stackSymbols,256);
@@ -3761,7 +3755,7 @@ kwsys_stl::string SystemInformationImplementation::GetProgramStack(
SymbolProperties symProps;
symProps.SetReportPath(wholePath);
symProps.Initialize(stackSymbols[i]);
- oss << symProps << kwsys_ios::endl;
+ oss << symProps << std::endl;
}
#else
(void)firstFrame;
@@ -3892,7 +3886,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
int errorFlag = uname(&unameInfo);
if( errorFlag!=0 )
{
- kwsys_ios::cout << "Problem calling uname(): " << strerror(errno) << kwsys_ios::endl;
+ std::cout << "Problem calling uname(): " << strerror(errno) << std::endl;
return false;
}
@@ -3916,7 +3910,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
FILE *fd = fopen("/proc/meminfo", "r" );
if ( !fd )
{
- kwsys_ios::cout << "Problem opening /proc/meminfo" << kwsys_ios::endl;
+ std::cout << "Problem opening /proc/meminfo" << std::endl;
return false;
}
@@ -3954,7 +3948,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
}
else
{
- kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl;
+ std::cout << "Problem parsing /proc/meminfo" << std::endl;
fclose(fd);
return false;
}
@@ -3987,7 +3981,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
}
else
{
- kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl;
+ std::cout << "Problem parsing /proc/meminfo" << std::endl;
fclose(fd);
return false;
}
@@ -4464,8 +4458,8 @@ bool SystemInformationImplementation::ParseSysCtl()
::memset(retBuf, 0, 128);
len = 32;
err = sysctlbyname("hw.machine", &retBuf, &len, NULL, 0);
- kwsys_stl::string machineBuf(retBuf);
- if (machineBuf.find_first_of("Power") != kwsys_stl::string::npos)
+ std::string machineBuf(retBuf);
+ if (machineBuf.find_first_of("Power") != std::string::npos)
{
this->ChipID.Vendor = "IBM";
len = sizeof(this->ChipID.Family);
@@ -4527,41 +4521,41 @@ bool SystemInformationImplementation::ParseSysCtl()
{
// now we can match every flags as space + flag + space
buf[len + 1] = ' ';
- kwsys_stl::string cpuflags(buf, len + 2);
+ std::string cpuflags(buf, len + 2);
- if ((cpuflags.find(" FPU ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" FPU ")!=std::string::npos))
{
this->Features.HasFPU = true;
}
- if ((cpuflags.find(" TSC ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" TSC ")!=std::string::npos))
{
this->Features.HasTSC = true;
}
- if ((cpuflags.find(" MMX ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" MMX ")!=std::string::npos))
{
this->Features.HasMMX = true;
}
- if ((cpuflags.find(" SSE ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" SSE ")!=std::string::npos))
{
this->Features.HasSSE = true;
}
- if ((cpuflags.find(" SSE2 ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" SSE2 ")!=std::string::npos))
{
this->Features.HasSSE2 = true;
}
- if ((cpuflags.find(" APIC ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" APIC ")!=std::string::npos))
{
this->Features.HasAPIC = true;
}
- if ((cpuflags.find(" CMOV ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" CMOV ")!=std::string::npos))
{
this->Features.HasCMOV = true;
}
- if ((cpuflags.find(" MTRR ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" MTRR ")!=std::string::npos))
{
this->Features.HasMTRR = true;
}
- if ((cpuflags.find(" ACPI ")!=kwsys_stl::string::npos))
+ if ((cpuflags.find(" ACPI ")!=std::string::npos))
{
this->Features.HasACPI = true;
}
@@ -4595,7 +4589,7 @@ bool SystemInformationImplementation::ParseSysCtl()
/** Extract a value from sysctl command */
-kwsys_stl::string SystemInformationImplementation::ExtractValueFromSysCtl(const char* word)
+std::string SystemInformationImplementation::ExtractValueFromSysCtl(const char* word)
{
size_t pos = this->SysCtlBuffer.find(word);
if(pos != this->SysCtlBuffer.npos)
@@ -4612,9 +4606,9 @@ kwsys_stl::string SystemInformationImplementation::ExtractValueFromSysCtl(const
/** Run a given process */
-kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector<const char*> args)
+std::string SystemInformationImplementation::RunProcess(std::vector<const char*> args)
{
- kwsys_stl::string buffer = "";
+ std::string buffer = "";
// Run the application
kwsysProcess* gp = kwsysProcess_New();
@@ -4644,12 +4638,12 @@ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector<
} break;
case kwsysProcess_State_Error:
{
- kwsys_ios::cerr << "Error: Could not run " << args[0] << ":\n";
- kwsys_ios::cerr << kwsysProcess_GetErrorString(gp) << "\n";
+ std::cerr << "Error: Could not run " << args[0] << ":\n";
+ std::cerr << kwsysProcess_GetErrorString(gp) << "\n";
} break;
case kwsysProcess_State_Exception:
{
- kwsys_ios::cerr << "Error: " << args[0]
+ std::cerr << "Error: " << args[0]
<< " terminated with an exception: "
<< kwsysProcess_GetExceptionString(gp) << "\n";
} break;
@@ -4659,27 +4653,27 @@ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector<
case kwsysProcess_State_Killed:
{
// Should not get here.
- kwsys_ios::cerr << "Unexpected ending state after running " << args[0]
- << kwsys_ios::endl;
+ std::cerr << "Unexpected ending state after running " << args[0]
+ << std::endl;
} break;
}
kwsysProcess_Delete(gp);
if(result)
{
- kwsys_ios::cerr << "Error " << args[0] << " returned :" << result << "\n";
+ std::cerr << "Error " << args[0] << " returned :" << result << "\n";
}
return buffer;
}
-kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const char* arguments)
+std::string SystemInformationImplementation::ParseValueFromKStat(const char* arguments)
{
- kwsys_stl::vector<const char*> args;
+ std::vector<const char*> args;
args.clear();
args.push_back("kstat");
args.push_back("-p");
- kwsys_stl::string command = arguments;
+ std::string command = arguments;
size_t start = command.npos;
size_t pos = command.find(' ',0);
while(pos!=command.npos)
@@ -4701,7 +4695,7 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha
if(!inQuotes)
{
- kwsys_stl::string arg = command.substr(start+1,pos-start-1);
+ std::string arg = command.substr(start+1,pos-start-1);
// Remove the quotes if any
size_t quotes = arg.find('"');
@@ -4715,14 +4709,14 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha
}
pos = command.find(' ',pos+1);
}
- kwsys_stl::string lastArg = command.substr(start+1,command.size()-start-1);
+ std::string lastArg = command.substr(start+1,command.size()-start-1);
args.push_back(lastArg.c_str());
args.push_back(0);
- kwsys_stl::string buffer = this->RunProcess(args);
+ std::string buffer = this->RunProcess(args);
- kwsys_stl::string value = "";
+ std::string value = "";
for(size_t i=buffer.size()-1;i>0;i--)
{
if(buffer[i] == ' ' || buffer[i] == '\t')
@@ -4731,7 +4725,7 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha
}
if(buffer[i] != '\n' && buffer[i] != '\r')
{
- kwsys_stl::string val = value;
+ std::string val = value;
value = buffer[i];
value += val;
}
@@ -4885,8 +4879,8 @@ bool SystemInformationImplementation::QueryHaikuInfo()
bool SystemInformationImplementation::QueryQNXMemory()
{
#if defined(__QNX__)
- kwsys_stl::string buffer;
- kwsys_stl::vector<const char*> args;
+ std::string buffer;
+ std::vector<const char*> args;
args.clear();
args.push_back("showmem");
@@ -4943,8 +4937,8 @@ bool SystemInformationImplementation::QueryQNXProcessor()
#if defined(__QNX__)
// the output on my QNX 6.4.1 looks like this:
// Processor1: 686 Pentium II Stepping 3 2175MHz FPU
- kwsys_stl::string buffer;
- kwsys_stl::vector<const char*> args;
+ std::string buffer;
+ std::vector<const char*> args;
args.clear();
args.push_back("pidin");
@@ -5440,10 +5434,10 @@ bool SystemInformationImplementation::QueryOSInformation()
int SystemInformationImplementation::CallSwVers(
const char *arg,
- kwsys_stl::string &ver)
+ std::string &ver)
{
#ifdef __APPLE__
- kwsys_stl::vector<const char*> args;
+ std::vector<const char*> args;
args.push_back("sw_vers");
args.push_back(arg);
args.push_back(0);
@@ -5457,18 +5451,18 @@ int SystemInformationImplementation::CallSwVers(
return 0;
}
-void SystemInformationImplementation::TrimNewline(kwsys_stl::string& output)
+void SystemInformationImplementation::TrimNewline(std::string& output)
{
// remove \r
- kwsys_stl::string::size_type pos=0;
- while((pos = output.find("\r", pos)) != kwsys_stl::string::npos)
+ std::string::size_type pos=0;
+ while((pos = output.find("\r", pos)) != std::string::npos)
{
output.erase(pos);
}
// remove \n
pos = 0;
- while((pos = output.find("\n", pos)) != kwsys_stl::string::npos)
+ while((pos = output.find("\n", pos)) != std::string::npos)
{
output.erase(pos);
}
diff --git a/Source/kwsys/SystemInformation.hxx.in b/Source/kwsys/SystemInformation.hxx.in
index 4acdc4f..7c45388 100644
--- a/Source/kwsys/SystemInformation.hxx.in
+++ b/Source/kwsys/SystemInformation.hxx.in
@@ -12,14 +12,9 @@
#ifndef @KWSYS_NAMESPACE@_SystemInformation_h
#define @KWSYS_NAMESPACE@_SystemInformation_h
-
-/* Define these macros temporarily to keep the code readable. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE@_stl
-# define kwsys_ios @KWSYS_NAMESPACE@_ios
-#endif
-#include <@KWSYS_NAMESPACE@/stl/string>
+#include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <stddef.h> /* size_t */
+#include <string>
namespace @KWSYS_NAMESPACE@
{
@@ -45,11 +40,11 @@ public:
const char * GetVendorString();
const char * GetVendorID();
- kwsys_stl::string GetTypeID();
- kwsys_stl::string GetFamilyID();
- kwsys_stl::string GetModelID();
- kwsys_stl::string GetModelName();
- kwsys_stl::string GetSteppingCode();
+ std::string GetTypeID();
+ std::string GetFamilyID();
+ std::string GetModelID();
+ std::string GetModelName();
+ std::string GetSteppingCode();
const char * GetExtendedProcessorName();
const char * GetProcessorSerialNumber();
int GetProcessorCacheSize();
@@ -61,10 +56,10 @@ public:
// returns an informative general description of the cpu
// on this system.
- kwsys_stl::string GetCPUDescription();
+ std::string GetCPUDescription();
const char * GetHostname();
- kwsys_stl::string GetFullyQualifiedDomainName();
+ std::string GetFullyQualifiedDomainName();
const char * GetOSName();
const char * GetOSRelease();
@@ -77,7 +72,7 @@ public:
// returns an informative general description of the os
// on this system.
- kwsys_stl::string GetOSDescription();
+ std::string GetOSDescription();
bool Is64Bits();
@@ -98,7 +93,7 @@ public:
// 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(
+ std::string GetMemoryDescription(
const char *hostLimitEnvVarName=NULL,
const char *procLimitEnvVarName=NULL);
@@ -144,7 +139,7 @@ public:
// order to produce an informative stack trace the application
// should be dynamically linked and compiled with debug symbols.
static
- kwsys_stl::string GetProgramStack(int firstFrame, int wholePath);
+ std::string GetProgramStack(int firstFrame, int wholePath);
/** Run the different checks */
void RunCPUCheck();
@@ -154,10 +149,4 @@ public:
} // namespace @KWSYS_NAMESPACE@
-/* Undefine temporary macros. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# undef kwsys_stl
-# undef kwsys_ios
-#endif
-
#endif
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 0714344..3857e41 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -31,11 +31,10 @@
#include KWSYS_HEADER(FStream.hxx)
#include KWSYS_HEADER(Encoding.hxx)
-#include KWSYS_HEADER(ios/iostream)
-#include KWSYS_HEADER(ios/fstream)
-#include KWSYS_HEADER(ios/sstream)
-
-#include KWSYS_HEADER(stl/set)
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <set>
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
@@ -44,9 +43,6 @@
# include "Directory.hxx.in"
# include "FStream.hxx.in"
# include "Encoding.hxx.in"
-# include "kwsys_ios_iostream.h.in"
-# include "kwsys_ios_fstream.h.in"
-# include "kwsys_ios_sstream.h.in"
#endif
#ifdef _MSC_VER
@@ -68,6 +64,10 @@
#include <sys/stat.h>
#include <time.h>
+#ifdef _MSC_VER
+# define umask _umask // Note this is still umask on Borland
+#endif
+
// support for realpath call
#ifndef _WIN32
#include <sys/time.h>
@@ -216,12 +216,12 @@ static time_t windows_filetime_to_posix_time(const FILETIME& ft)
#ifdef KWSYS_WINDOWS_DIRS
#include <wctype.h>
-inline int Mkdir(const kwsys_stl::string& dir)
+inline int Mkdir(const std::string& dir)
{
return _wmkdir(
KWSYS_NAMESPACE::SystemTools::ConvertToWindowsExtendedPath(dir).c_str());
}
-inline int Rmdir(const kwsys_stl::string& dir)
+inline int Rmdir(const std::string& dir)
{
return _wrmdir(
KWSYS_NAMESPACE::SystemTools::ConvertToWindowsExtendedPath(dir).c_str());
@@ -242,7 +242,7 @@ inline const char* Getcwd(char* buf, unsigned int len)
}
return 0;
}
-inline int Chdir(const kwsys_stl::string& dir)
+inline int Chdir(const std::string& dir)
{
#if defined(__BORLANDC__)
return chdir(dir.c_str());
@@ -250,11 +250,11 @@ inline int Chdir(const kwsys_stl::string& dir)
return _wchdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str());
#endif
}
-inline void Realpath(const kwsys_stl::string& path,
- kwsys_stl::string& resolved_path,
- kwsys_stl::string* errorMessage = 0)
+inline void Realpath(const std::string& path,
+ std::string& resolved_path,
+ std::string* errorMessage = 0)
{
- kwsys_stl::wstring tmp = KWSYS_NAMESPACE::Encoding::ToWide(path);
+ std::wstring tmp = KWSYS_NAMESPACE::Encoding::ToWide(path);
wchar_t *ptemp;
wchar_t fullpath[MAX_PATH];
DWORD bufferLen = GetFullPathNameW(tmp.c_str(),
@@ -299,11 +299,11 @@ inline void Realpath(const kwsys_stl::string& path,
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
-inline int Mkdir(const kwsys_stl::string& dir)
+inline int Mkdir(const std::string& dir)
{
return mkdir(dir.c_str(), 00777);
}
-inline int Rmdir(const kwsys_stl::string& dir)
+inline int Rmdir(const std::string& dir)
{
return rmdir(dir.c_str());
}
@@ -312,13 +312,13 @@ inline const char* Getcwd(char* buf, unsigned int len)
return getcwd(buf, len);
}
-inline int Chdir(const kwsys_stl::string& dir)
+inline int Chdir(const std::string& dir)
{
return chdir(dir.c_str());
}
-inline void Realpath(const kwsys_stl::string& path,
- kwsys_stl::string& resolved_path,
- kwsys_stl::string* errorMessage = 0)
+inline void Realpath(const std::string& path,
+ std::string& resolved_path,
+ std::string* errorMessage = 0)
{
char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH];
@@ -381,14 +381,14 @@ double SystemTools::GetTime(void)
}
class SystemToolsTranslationMap :
- public kwsys_stl::map<kwsys_stl::string,kwsys_stl::string>
+ public std::map<std::string,std::string>
{
};
#ifdef _WIN32
struct SystemToolsPathCaseCmp
{
- bool operator()(kwsys_stl::string const& l, kwsys_stl::string const& r) const
+ bool operator()(std::string const& l, std::string const& r) const
{
# ifdef _MSC_VER
return _stricmp(l.c_str(), r.c_str()) < 0;
@@ -401,12 +401,12 @@ struct SystemToolsPathCaseCmp
};
class SystemToolsPathCaseMap:
- public kwsys_stl::map<kwsys_stl::string, kwsys_stl::string,
+ public std::map<std::string, std::string,
SystemToolsPathCaseCmp> {};
#endif
// adds the elements of the env variable path to the arg passed in
-void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char* env)
+void SystemTools::GetPath(std::vector<std::string>& path, const char* env)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
const char pathSep = ';';
@@ -423,19 +423,19 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char
return;
}
- kwsys_stl::string pathEnv = cpathEnv;
+ std::string pathEnv = cpathEnv;
// A hack to make the below algorithm work.
if(!pathEnv.empty() && *pathEnv.rbegin() != pathSep)
{
pathEnv += pathSep;
}
- kwsys_stl::string::size_type start =0;
+ std::string::size_type start =0;
bool done = false;
while(!done)
{
- kwsys_stl::string::size_type endpos = pathEnv.find(pathSep, start);
- if(endpos != kwsys_stl::string::npos)
+ std::string::size_type endpos = pathEnv.find(pathSep, start);
+ if(endpos != std::string::npos)
{
path.push_back(pathEnv.substr(start, endpos-start));
start = endpos+1;
@@ -445,7 +445,7 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char
done = true;
}
}
- for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
+ for(std::vector<std::string>::iterator i = path.begin();
i != path.end(); ++i)
{
SystemTools::ConvertToUnixSlashes(*i);
@@ -457,12 +457,12 @@ const char* SystemTools::GetEnv(const char* key)
return getenv(key);
}
-const char* SystemTools::GetEnv(const kwsys_stl::string& key)
+const char* SystemTools::GetEnv(const std::string& key)
{
return SystemTools::GetEnv(key.c_str());
}
-bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result)
+bool SystemTools::GetEnv(const char* key, std::string& result)
{
const char* v = getenv(key);
if(v)
@@ -476,7 +476,7 @@ bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result)
}
}
-bool SystemTools::GetEnv(const kwsys_stl::string& key, kwsys_stl::string& result)
+bool SystemTools::GetEnv(const std::string& key, std::string& result)
{
return SystemTools::GetEnv(key.c_str(), result);
}
@@ -492,7 +492,7 @@ bool SystemTools::GetEnv(const kwsys_stl::string& key, kwsys_stl::string& result
#if KWSYS_CXX_HAS_UNSETENV
/* unsetenv("A") removes A from the environment.
On older platforms it returns void instead of int. */
-static int kwsysUnPutEnv(const kwsys_stl::string& env)
+static int kwsysUnPutEnv(const std::string& env)
{
size_t pos = env.find('=');
if(pos != env.npos)
@@ -509,7 +509,7 @@ static int kwsysUnPutEnv(const kwsys_stl::string& env)
#elif defined(KWSYS_PUTENV_EMPTY) || defined(KWSYS_PUTENV_NAME)
/* putenv("A=") or putenv("A") removes A from the environment. */
-static int kwsysUnPutEnv(const kwsys_stl::string& env)
+static int kwsysUnPutEnv(const std::string& env)
{
int err = 0;
size_t pos = env.find('=');
@@ -554,7 +554,7 @@ static int kwsysUnPutEnv(const kwsys_stl::string& env)
#else
/* Manipulate the "environ" global directly. */
-static int kwsysUnPutEnv(const kwsys_stl::string& env)
+static int kwsysUnPutEnv(const std::string& env)
{
size_t pos = env.find('=');
size_t const len = pos == env.npos ? env.size() : pos;
@@ -587,7 +587,7 @@ static int kwsysUnPutEnv(const kwsys_stl::string& env)
/* setenv("A", "B", 1) will set A=B in the environment and makes its
own copies of the strings. */
-bool SystemTools::PutEnv(const kwsys_stl::string& env)
+bool SystemTools::PutEnv(const std::string& env)
{
size_t pos = env.find('=');
if(pos != env.npos)
@@ -601,7 +601,7 @@ bool SystemTools::PutEnv(const kwsys_stl::string& env)
}
}
-bool SystemTools::UnPutEnv(const kwsys_stl::string& env)
+bool SystemTools::UnPutEnv(const std::string& env)
{
return kwsysUnPutEnv(env) == 0;
}
@@ -639,7 +639,7 @@ struct kwsysEnvCompare
}
};
-class kwsysEnv: public kwsys_stl::set<const char*, kwsysEnvCompare>
+class kwsysEnv: public std::set<const char*, kwsysEnvCompare>
{
class Free
{
@@ -649,7 +649,7 @@ class kwsysEnv: public kwsys_stl::set<const char*, kwsysEnvCompare>
~Free() { free(const_cast<char*>(this->Env)); }
};
public:
- typedef kwsys_stl::set<const char*, kwsysEnvCompare> derived;
+ typedef std::set<const char*, kwsysEnvCompare> derived;
~kwsysEnv()
{
for(derived::iterator i = this->begin(); i != this->end(); ++i)
@@ -687,12 +687,12 @@ public:
static kwsysEnv kwsysEnvInstance;
-bool SystemTools::PutEnv(const kwsys_stl::string& env)
+bool SystemTools::PutEnv(const std::string& env)
{
return kwsysEnvInstance.Put(env.c_str());
}
-bool SystemTools::UnPutEnv(const kwsys_stl::string& env)
+bool SystemTools::UnPutEnv(const std::string& env)
{
return kwsysEnvInstance.UnPut(env.c_str());
}
@@ -710,7 +710,7 @@ const char* SystemTools::GetExecutableExtension()
#endif
}
-FILE* SystemTools::Fopen(const kwsys_stl::string& file, const char* mode)
+FILE* SystemTools::Fopen(const std::string& file, const char* mode)
{
#ifdef _WIN32
return _wfopen(SystemTools::ConvertToWindowsExtendedPath(file).c_str(),
@@ -726,10 +726,10 @@ bool SystemTools::MakeDirectory(const char* path)
{
return false;
}
- return SystemTools::MakeDirectory(kwsys_stl::string(path));
+ return SystemTools::MakeDirectory(std::string(path));
}
-bool SystemTools::MakeDirectory(const kwsys_stl::string& path)
+bool SystemTools::MakeDirectory(const std::string& path)
{
if(SystemTools::FileExists(path))
{
@@ -739,12 +739,12 @@ bool SystemTools::MakeDirectory(const kwsys_stl::string& path)
{
return false;
}
- kwsys_stl::string dir = path;
+ std::string dir = path;
SystemTools::ConvertToUnixSlashes(dir);
- kwsys_stl::string::size_type pos = 0;
- kwsys_stl::string topdir;
- while((pos = dir.find('/', pos)) != kwsys_stl::string::npos)
+ std::string::size_type pos = 0;
+ std::string topdir;
+ while((pos = dir.find('/', pos)) != std::string::npos)
{
topdir = dir.substr(0, pos);
Mkdir(topdir);
@@ -772,9 +772,9 @@ bool SystemTools::MakeDirectory(const kwsys_stl::string& path)
// replace replace with with as many times as it shows up in source.
// write the result into source.
-void SystemTools::ReplaceString(kwsys_stl::string& source,
- const kwsys_stl::string& replace,
- const kwsys_stl::string& with)
+void SystemTools::ReplaceString(std::string& source,
+ const std::string& replace,
+ const std::string& with)
{
// do while hangs if replaceSize is 0
if (replace.empty())
@@ -785,7 +785,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source,
SystemTools::ReplaceString(source, replace.c_str(), replace.size(), with);
}
-void SystemTools::ReplaceString(kwsys_stl::string& source,
+void SystemTools::ReplaceString(std::string& source,
const char* replace,
const char* with)
{
@@ -798,10 +798,10 @@ void SystemTools::ReplaceString(kwsys_stl::string& source,
SystemTools::ReplaceString(source, replace, strlen(replace), with ? with : "");
}
-void SystemTools::ReplaceString(kwsys_stl::string& source,
+void SystemTools::ReplaceString(std::string& source,
const char* replace,
size_t replaceSize,
- const kwsys_stl::string& with)
+ const std::string& with)
{
const char *src = source.c_str();
char *searchPos = const_cast<char *>(strstr(src,replace));
@@ -844,21 +844,21 @@ void SystemTools::ReplaceString(kwsys_stl::string& source,
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
-static bool SystemToolsParseRegistryKey(const kwsys_stl::string& key,
+static bool SystemToolsParseRegistryKey(const std::string& key,
HKEY& primaryKey,
- kwsys_stl::string& second,
- kwsys_stl::string& valuename)
+ std::string& second,
+ std::string& valuename)
{
- kwsys_stl::string primary = key;
+ std::string primary = key;
size_t start = primary.find('\\');
- if (start == kwsys_stl::string::npos)
+ if (start == std::string::npos)
{
return false;
}
size_t valuenamepos = primary.find(';');
- if (valuenamepos != kwsys_stl::string::npos)
+ if (valuenamepos != std::string::npos)
{
valuename = primary.substr(valuenamepos+1);
}
@@ -915,13 +915,13 @@ static DWORD SystemToolsMakeRegistryMode(DWORD mode,
#if defined(_WIN32) && !defined(__CYGWIN__)
bool
-SystemTools::GetRegistrySubKeys(const kwsys_stl::string& key,
- kwsys_stl::vector<kwsys_stl::string>& subkeys,
+SystemTools::GetRegistrySubKeys(const std::string& key,
+ std::vector<std::string>& subkeys,
KeyWOW64 view)
{
HKEY primaryKey = HKEY_CURRENT_USER;
- kwsys_stl::string second;
- kwsys_stl::string valuename;
+ std::string second;
+ std::string valuename;
if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename))
{
return false;
@@ -954,8 +954,8 @@ SystemTools::GetRegistrySubKeys(const kwsys_stl::string& key,
return true;
}
#else
-bool SystemTools::GetRegistrySubKeys(const kwsys_stl::string&,
- kwsys_stl::vector<kwsys_stl::string>&,
+bool SystemTools::GetRegistrySubKeys(const std::string&,
+ std::vector<std::string>&,
KeyWOW64)
{
return false;
@@ -970,13 +970,13 @@ bool SystemTools::GetRegistrySubKeys(const kwsys_stl::string&,
// => will return the data of the "Root" value of the key
#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::ReadRegistryValue(const kwsys_stl::string& key, kwsys_stl::string &value,
+bool SystemTools::ReadRegistryValue(const std::string& key, std::string &value,
KeyWOW64 view)
{
bool valueset = false;
HKEY primaryKey = HKEY_CURRENT_USER;
- kwsys_stl::string second;
- kwsys_stl::string valuename;
+ std::string second;
+ std::string valuename;
if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename))
{
return false;
@@ -1027,7 +1027,7 @@ bool SystemTools::ReadRegistryValue(const kwsys_stl::string& key, kwsys_stl::str
return valueset;
}
#else
-bool SystemTools::ReadRegistryValue(const kwsys_stl::string&, kwsys_stl::string &,
+bool SystemTools::ReadRegistryValue(const std::string&, std::string &,
KeyWOW64)
{
return false;
@@ -1043,13 +1043,13 @@ bool SystemTools::ReadRegistryValue(const kwsys_stl::string&, kwsys_stl::string
// => will set the data of the "Root" value of the key
#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::WriteRegistryValue(const kwsys_stl::string& key,
- const kwsys_stl::string& value,
+bool SystemTools::WriteRegistryValue(const std::string& key,
+ const std::string& value,
KeyWOW64 view)
{
HKEY primaryKey = HKEY_CURRENT_USER;
- kwsys_stl::string second;
- kwsys_stl::string valuename;
+ std::string second;
+ std::string valuename;
if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename))
{
return false;
@@ -1084,7 +1084,7 @@ bool SystemTools::WriteRegistryValue(const kwsys_stl::string& key,
return false;
}
#else
-bool SystemTools::WriteRegistryValue(const kwsys_stl::string&, const kwsys_stl::string&, KeyWOW64)
+bool SystemTools::WriteRegistryValue(const std::string&, const std::string&, KeyWOW64)
{
return false;
}
@@ -1098,11 +1098,11 @@ bool SystemTools::WriteRegistryValue(const kwsys_stl::string&, const kwsys_stl::
// => will delete the data of the "Root" value of the key
#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::DeleteRegistryValue(const kwsys_stl::string& key, KeyWOW64 view)
+bool SystemTools::DeleteRegistryValue(const std::string& key, KeyWOW64 view)
{
HKEY primaryKey = HKEY_CURRENT_USER;
- kwsys_stl::string second;
- kwsys_stl::string valuename;
+ std::string second;
+ std::string valuename;
if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename))
{
return false;
@@ -1129,13 +1129,13 @@ bool SystemTools::DeleteRegistryValue(const kwsys_stl::string& key, KeyWOW64 vie
return false;
}
#else
-bool SystemTools::DeleteRegistryValue(const kwsys_stl::string&, KeyWOW64)
+bool SystemTools::DeleteRegistryValue(const std::string&, KeyWOW64)
{
return false;
}
#endif
-bool SystemTools::SameFile(const kwsys_stl::string& file1, const kwsys_stl::string& file2)
+bool SystemTools::SameFile(const std::string& file1, const std::string& file2)
{
#ifdef _WIN32
HANDLE hFile1, hFile2;
@@ -1203,11 +1203,11 @@ bool SystemTools::FileExists(const char* filename)
{
return false;
}
- return SystemTools::FileExists(kwsys_stl::string(filename));
+ return SystemTools::FileExists(std::string(filename));
}
//----------------------------------------------------------------------------
-bool SystemTools::FileExists(const kwsys_stl::string& filename)
+bool SystemTools::FileExists(const std::string& filename)
{
if(filename.empty())
{
@@ -1233,17 +1233,15 @@ bool SystemTools::FileExists(const kwsys_stl::string& filename)
//----------------------------------------------------------------------------
bool SystemTools::FileExists(const char* filename, bool isFile)
{
- if(SystemTools::FileExists(filename))
+ if(!filename)
{
- // If isFile is set return not FileIsDirectory,
- // so this will only be true if it is a file
- return !isFile || !SystemTools::FileIsDirectory(filename);
+ return false;
}
- return false;
+ return SystemTools::FileExists(std::string(filename), isFile);
}
//----------------------------------------------------------------------------
-bool SystemTools::FileExists(const kwsys_stl::string& filename, bool isFile)
+bool SystemTools::FileExists(const std::string& filename, bool isFile)
{
if(SystemTools::FileExists(filename))
{
@@ -1255,6 +1253,43 @@ bool SystemTools::FileExists(const kwsys_stl::string& filename, bool isFile)
}
//----------------------------------------------------------------------------
+bool SystemTools::TestFileAccess(const char* filename,
+ TestFilePermissions permissions)
+{
+ if(!filename)
+ {
+ return false;
+ }
+ return SystemTools::TestFileAccess(std::string(filename),
+ permissions);
+}
+
+//----------------------------------------------------------------------------
+bool SystemTools::TestFileAccess(const std::string& filename,
+ TestFilePermissions permissions)
+{
+ if(filename.empty())
+ {
+ return false;
+ }
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ // If execute set, change to read permission (all files on Windows
+ // are executable if they are readable). The CRT will always fail
+ // if you pass an execute bit.
+ if(permissions & TEST_FILE_EXECUTE)
+ {
+ permissions &= ~TEST_FILE_EXECUTE;
+ permissions |= TEST_FILE_READ;
+ }
+ return _waccess(
+ SystemTools::ConvertToWindowsExtendedPath(filename).c_str(),
+ permissions) == 0;
+#else
+ return access(filename.c_str(), permissions) == 0;
+#endif
+}
+
+//----------------------------------------------------------------------------
#ifdef __CYGWIN__
bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path)
{
@@ -1278,7 +1313,7 @@ bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path)
}
#endif
-bool SystemTools::Touch(const kwsys_stl::string& filename, bool create)
+bool SystemTools::Touch(const std::string& filename, bool create)
{
if (!SystemTools::FileExists(filename))
{
@@ -1354,8 +1389,8 @@ bool SystemTools::Touch(const kwsys_stl::string& filename, bool create)
return true;
}
-bool SystemTools::FileTimeCompare(const kwsys_stl::string& f1,
- const kwsys_stl::string& f2,
+bool SystemTools::FileTimeCompare(const std::string& f1,
+ const std::string& f2,
int* result)
{
// Default to same time.
@@ -1427,26 +1462,26 @@ bool SystemTools::FileTimeCompare(const kwsys_stl::string& f1,
// Return a capitalized string (i.e the first letter is uppercased, all other
// are lowercased)
-kwsys_stl::string SystemTools::Capitalized(const kwsys_stl::string& s)
+std::string SystemTools::Capitalized(const std::string& s)
{
- kwsys_stl::string n;
+ std::string n;
if(s.empty())
{
return n;
}
n.resize(s.size());
- n[0] = static_cast<kwsys_stl::string::value_type>(toupper(s[0]));
+ n[0] = static_cast<std::string::value_type>(toupper(s[0]));
for (size_t i = 1; i < s.size(); i++)
{
- n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i]));
+ n[i] = static_cast<std::string::value_type>(tolower(s[i]));
}
return n;
}
// Return capitalized words
-kwsys_stl::string SystemTools::CapitalizedWords(const kwsys_stl::string& s)
+std::string SystemTools::CapitalizedWords(const std::string& s)
{
- kwsys_stl::string n(s);
+ std::string n(s);
for (size_t i = 0; i < s.size(); i++)
{
#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG)
@@ -1458,16 +1493,16 @@ kwsys_stl::string SystemTools::CapitalizedWords(const kwsys_stl::string& s)
if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1])))
#endif
{
- n[i] = static_cast<kwsys_stl::string::value_type>(toupper(s[i]));
+ n[i] = static_cast<std::string::value_type>(toupper(s[i]));
}
}
return n;
}
// Return uncapitalized words
-kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s)
+std::string SystemTools::UnCapitalizedWords(const std::string& s)
{
- kwsys_stl::string n(s);
+ std::string n(s);
for (size_t i = 0; i < s.size(); i++)
{
#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG)
@@ -1479,17 +1514,17 @@ kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s)
if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1])))
#endif
{
- n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i]));
+ n[i] = static_cast<std::string::value_type>(tolower(s[i]));
}
}
return n;
}
// only works for words with at least two letters
-kwsys_stl::string SystemTools::AddSpaceBetweenCapitalizedWords(
- const kwsys_stl::string& s)
+std::string SystemTools::AddSpaceBetweenCapitalizedWords(
+ const std::string& s)
{
- kwsys_stl::string n;
+ std::string n;
if (!s.empty())
{
n.reserve(s.size());
@@ -1556,25 +1591,25 @@ char* SystemTools::AppendStrings(
}
// Return a lower case string
-kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s)
+std::string SystemTools::LowerCase(const std::string& s)
{
- kwsys_stl::string n;
+ std::string n;
n.resize(s.size());
for (size_t i = 0; i < s.size(); i++)
{
- n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i]));
+ n[i] = static_cast<std::string::value_type>(tolower(s[i]));
}
return n;
}
// Return a lower case string
-kwsys_stl::string SystemTools::UpperCase(const kwsys_stl::string& s)
+std::string SystemTools::UpperCase(const std::string& s)
{
- kwsys_stl::string n;
+ std::string n;
n.resize(s.size());
for (size_t i = 0; i < s.size(); i++)
{
- n[i] = static_cast<kwsys_stl::string::value_type>(toupper(s[i]));
+ n[i] = static_cast<std::string::value_type>(toupper(s[i]));
}
return n;
}
@@ -1680,7 +1715,7 @@ bool SystemTools::StringStartsWith(const char* str1, const char* str2)
}
// Returns if string starts with another string
-bool SystemTools::StringStartsWith(const kwsys_stl::string& str1, const char* str2)
+bool SystemTools::StringStartsWith(const std::string& str1, const char* str2)
{
if (!str2)
{
@@ -1702,7 +1737,7 @@ bool SystemTools::StringEndsWith(const char* str1, const char* str2)
}
// Returns if string ends with another string
-bool SystemTools::StringEndsWith(const kwsys_stl::string& str1, const char* str2)
+bool SystemTools::StringEndsWith(const std::string& str1, const char* str2)
{
if (!str2)
{
@@ -1748,7 +1783,7 @@ char* SystemTools::DuplicateString(const char* str)
}
// Return a cropped string
-kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s,
+std::string SystemTools::CropString(const std::string& s,
size_t max_len)
{
if (!s.size() || max_len == 0 || max_len >= s.size())
@@ -1756,13 +1791,13 @@ kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s,
return s;
}
- kwsys_stl::string n;
+ std::string n;
n.reserve(max_len);
size_t middle = max_len / 2;
n += s.substr(0, middle);
- n += s.substr(s.size() - (max_len - middle), kwsys_stl::string::npos);
+ n += s.substr(s.size() - (max_len - middle), std::string::npos);
if (max_len > 2)
{
@@ -1781,10 +1816,10 @@ kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s,
}
//----------------------------------------------------------------------------
-kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const kwsys_stl::string& p, char sep, bool isPath)
+std::vector<kwsys::String> SystemTools::SplitString(const std::string& p, char sep, bool isPath)
{
- kwsys_stl::string path = p;
- kwsys_stl::vector<kwsys::String> paths;
+ std::string path = p;
+ std::vector<kwsys::String> paths;
if(path.empty())
{
return paths;
@@ -1794,9 +1829,9 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const kwsys_stl::strin
path.erase(path.begin());
paths.push_back("/");
}
- kwsys_stl::string::size_type pos1 = 0;
- kwsys_stl::string::size_type pos2 = path.find(sep, pos1+1);
- while(pos2 != kwsys_stl::string::npos)
+ std::string::size_type pos1 = 0;
+ std::string::size_type pos2 = path.find(sep, pos1+1);
+ while(pos2 != std::string::npos)
{
paths.push_back(path.substr(pos1, pos2-pos1));
pos1 = pos2+1;
@@ -1876,12 +1911,12 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
return static_cast<int>(length);
}
-kwsys_stl::string SystemTools::EscapeChars(
+std::string SystemTools::EscapeChars(
const char *str,
const char *chars_to_escape,
char escape_char)
{
- kwsys_stl::string n;
+ std::string n;
if (str)
{
if (!chars_to_escape || !*chars_to_escape)
@@ -1912,17 +1947,17 @@ kwsys_stl::string SystemTools::EscapeChars(
}
#ifdef __VMS
-static void ConvertVMSToUnix(kwsys_stl::string& path)
+static void ConvertVMSToUnix(std::string& path)
{
- kwsys_stl::string::size_type rootEnd = path.find(":[");
- kwsys_stl::string::size_type pathEnd = path.find("]");
+ std::string::size_type rootEnd = path.find(":[");
+ std::string::size_type pathEnd = path.find("]");
if(rootEnd != path.npos)
{
- kwsys_stl::string root = path.substr(0, rootEnd);
- kwsys_stl::string pathPart = path.substr(rootEnd+2, pathEnd - rootEnd-2);
+ std::string root = path.substr(0, rootEnd);
+ std::string pathPart = path.substr(rootEnd+2, pathEnd - rootEnd-2);
const char* pathCString = pathPart.c_str();
const char* pos0 = pathCString;
- for (kwsys_stl::string::size_type pos = 0; *pos0; ++ pos )
+ for (std::string::size_type pos = 0; *pos0; ++ pos )
{
if ( *pos0 == '.' )
{
@@ -1936,7 +1971,7 @@ static void ConvertVMSToUnix(kwsys_stl::string& path)
#endif
// convert windows slashes to unix slashes
-void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
+void SystemTools::ConvertToUnixSlashes(std::string& path)
{
const char* pathCString = path.c_str();
bool hasDoubleSlash = false;
@@ -1945,7 +1980,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
#else
const char* pos0 = pathCString;
const char* pos1 = pathCString+1;
- for (kwsys_stl::string::size_type pos = 0; *pos0; ++ pos )
+ for (std::string::size_type pos = 0; *pos0; ++ pos )
{
// make sure we don't convert an escaped space to a unix slash
if ( *pos0 == '\\' && *pos1 != ' ' )
@@ -1993,8 +2028,8 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
#ifdef HAVE_GETPWNAM
else if(pathCString[0] == '~')
{
- kwsys_stl::string::size_type idx = path.find_first_of("/\0");
- kwsys_stl::string user = path.substr(1, idx-1);
+ std::string::size_type idx = path.find_first_of("/\0");
+ std::string user = path.substr(1, idx-1);
passwd* pw = getpwnam(user.c_str());
if(pw)
{
@@ -2019,10 +2054,10 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
#ifdef _WIN32
// Convert local paths to UNC style paths
-kwsys_stl::wstring
-SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source)
+std::wstring
+SystemTools::ConvertToWindowsExtendedPath(const std::string &source)
{
- kwsys_stl::wstring wsource = Encoding::ToWide(source);
+ std::wstring wsource = Encoding::ToWide(source);
// Resolve any relative paths
DWORD wfull_len;
@@ -2030,7 +2065,7 @@ SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source)
/* The +3 is a workaround for a bug in some versions of GetFullPathNameW that
* won't return a large enough buffer size if the input is too small */
wfull_len = GetFullPathNameW(wsource.c_str(), 0, NULL, NULL) + 3;
- kwsys_stl::vector<wchar_t> wfull(wfull_len);
+ std::vector<wchar_t> wfull(wfull_len);
GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], NULL);
/* This should get the correct size without any extra padding from the
@@ -2039,7 +2074,7 @@ SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source)
if(wfull_len >= 2 && isalpha(wfull[0]) && wfull[1] == L':')
{ /* C:\Foo\bar\FooBar.txt */
- return L"\\\\?\\" + kwsys_stl::wstring(&wfull[0]);
+ return L"\\\\?\\" + std::wstring(&wfull[0]);
}
else if(wfull_len >= 2 && wfull[0] == L'\\' && wfull[1] == L'\\')
{ /* Starts with \\ */
@@ -2048,31 +2083,31 @@ SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source)
if(wfull_len >= 8 && wfull[4] == L'U' && wfull[5] == L'N' &&
wfull[6] == L'C' && wfull[7] == L'\\')
{ /* \\?\UNC\Foo\bar\FooBar.txt */
- return kwsys_stl::wstring(&wfull[0]);
+ return std::wstring(&wfull[0]);
}
else if(wfull_len >= 6 && isalpha(wfull[4]) && wfull[5] == L':')
{ /* \\?\C:\Foo\bar\FooBar.txt */
- return kwsys_stl::wstring(&wfull[0]);
+ return std::wstring(&wfull[0]);
}
else if(wfull_len >= 5)
{ /* \\?\Foo\bar\FooBar.txt */
- return L"\\\\?\\UNC\\" + kwsys_stl::wstring(&wfull[4]);
+ return L"\\\\?\\UNC\\" + std::wstring(&wfull[4]);
}
}
else if(wfull_len >= 4 && wfull[2] == L'.' && wfull[3] == L'\\')
{ /* Starts with \\.\ a device name */
if(wfull_len >= 6 && isalpha(wfull[4]) && wfull[5] == L':')
{ /* \\.\C:\Foo\bar\FooBar.txt */
- return L"\\\\?\\" + kwsys_stl::wstring(&wfull[4]);
+ return L"\\\\?\\" + std::wstring(&wfull[4]);
}
else if(wfull_len >= 5)
{ /* \\.\Foo\bar\ Device name is left unchanged */
- return kwsys_stl::wstring(&wfull[0]);
+ return std::wstring(&wfull[0]);
}
}
else if(wfull_len >= 3)
{ /* \\Foo\bar\FooBar.txt */
- return L"\\\\?\\UNC\\" + kwsys_stl::wstring(&wfull[2]);
+ return L"\\\\?\\UNC\\" + std::wstring(&wfull[2]);
}
}
@@ -2083,20 +2118,20 @@ SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source)
#endif
// change // to /, and escape any spaces in the path
-kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const kwsys_stl::string& path)
+std::string SystemTools::ConvertToUnixOutputPath(const std::string& path)
{
- kwsys_stl::string ret = path;
+ std::string ret = path;
// remove // except at the beginning might be a cygwin drive
- kwsys_stl::string::size_type pos=1;
- while((pos = ret.find("//", pos)) != kwsys_stl::string::npos)
+ std::string::size_type pos=1;
+ while((pos = ret.find("//", pos)) != std::string::npos)
{
ret.erase(pos, 1);
}
// escape spaces and () in the path
- if(ret.find_first_of(" ") != kwsys_stl::string::npos)
+ if(ret.find_first_of(" ") != std::string::npos)
{
- kwsys_stl::string result = "";
+ std::string result = "";
char lastch = 1;
for(const char* ch = ret.c_str(); *ch != '\0'; ++ch)
{
@@ -2113,7 +2148,7 @@ kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const kwsys_stl::string&
return ret;
}
-kwsys_stl::string SystemTools::ConvertToOutputPath(const kwsys_stl::string& path)
+std::string SystemTools::ConvertToOutputPath(const std::string& path)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
return SystemTools::ConvertToWindowsOutputPath(path);
@@ -2123,16 +2158,16 @@ kwsys_stl::string SystemTools::ConvertToOutputPath(const kwsys_stl::string& path
}
// remove double slashes not at the start
-kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const kwsys_stl::string& path)
+std::string SystemTools::ConvertToWindowsOutputPath(const std::string& path)
{
- kwsys_stl::string ret;
+ std::string ret;
// make it big enough for all of path and double quotes
ret.reserve(path.size()+3);
// put path into the string
ret = path;
- kwsys_stl::string::size_type pos = 0;
+ std::string::size_type pos = 0;
// first convert all of the slashes
- while((pos = ret.find('/', pos)) != kwsys_stl::string::npos)
+ while((pos = ret.find('/', pos)) != std::string::npos)
{
ret[pos] = '\\';
pos++;
@@ -2154,33 +2189,33 @@ kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const kwsys_stl::strin
return ret;
}
}
- while((pos = ret.find("\\\\", pos)) != kwsys_stl::string::npos)
+ while((pos = ret.find("\\\\", pos)) != std::string::npos)
{
ret.erase(pos, 1);
}
// now double quote the path if it has spaces in it
// and is not already double quoted
- if(ret.find(' ') != kwsys_stl::string::npos
+ if(ret.find(' ') != std::string::npos
&& ret[0] != '\"')
{
- ret.insert(static_cast<kwsys_stl::string::size_type>(0),
- static_cast<kwsys_stl::string::size_type>(1), '\"');
+ ret.insert(static_cast<std::string::size_type>(0),
+ static_cast<std::string::size_type>(1), '\"');
ret.append(1, '\"');
}
return ret;
}
-bool SystemTools::CopyFileIfDifferent(const kwsys_stl::string& source,
- const kwsys_stl::string& destination)
+bool SystemTools::CopyFileIfDifferent(const std::string& source,
+ const std::string& destination)
{
// special check for a destination that is a directory
// FilesDiffer does not handle file to directory compare
if(SystemTools::FileIsDirectory(destination))
{
- kwsys_stl::string new_destination = destination;
+ std::string new_destination = destination;
SystemTools::ConvertToUnixSlashes(new_destination);
new_destination += '/';
- kwsys_stl::string source_name = source;
+ std::string source_name = source;
new_destination += SystemTools::GetFilenameName(source_name);
if(SystemTools::FilesDiffer(source, new_destination))
{
@@ -2205,8 +2240,8 @@ bool SystemTools::CopyFileIfDifferent(const kwsys_stl::string& source,
#define KWSYS_ST_BUFFER 4096
-bool SystemTools::FilesDiffer(const kwsys_stl::string& source,
- const kwsys_stl::string& destination)
+bool SystemTools::FilesDiffer(const std::string& source,
+ const std::string& destination)
{
#if defined(_WIN32)
@@ -2269,11 +2304,11 @@ bool SystemTools::FilesDiffer(const kwsys_stl::string& source,
#if defined(_WIN32)
kwsys::ifstream finSource(source.c_str(),
- (kwsys_ios::ios::binary |
- kwsys_ios::ios::in));
+ (std::ios::binary |
+ std::ios::in));
kwsys::ifstream finDestination(destination.c_str(),
- (kwsys_ios::ios::binary |
- kwsys_ios::ios::in));
+ (std::ios::binary |
+ std::ios::in));
#else
kwsys::ifstream finSource(source.c_str());
kwsys::ifstream finDestination(destination.c_str());
@@ -2289,13 +2324,13 @@ bool SystemTools::FilesDiffer(const kwsys_stl::string& source,
while(nleft > 0)
{
// Read a block from each file.
- kwsys_ios::streamsize nnext = (nleft > KWSYS_ST_BUFFER)? KWSYS_ST_BUFFER : static_cast<kwsys_ios::streamsize>(nleft);
+ std::streamsize nnext = (nleft > KWSYS_ST_BUFFER)? KWSYS_ST_BUFFER : static_cast<std::streamsize>(nleft);
finSource.read(source_buf, nnext);
finDestination.read(dest_buf, nnext);
// If either failed to read assume they are different.
- if(static_cast<kwsys_ios::streamsize>(finSource.gcount()) != nnext ||
- static_cast<kwsys_ios::streamsize>(finDestination.gcount()) != nnext)
+ if(static_cast<std::streamsize>(finSource.gcount()) != nnext ||
+ static_cast<std::streamsize>(finDestination.gcount()) != nnext)
{
return true;
}
@@ -2321,7 +2356,7 @@ bool SystemTools::FilesDiffer(const kwsys_stl::string& source,
/**
* Copy a file named by "source" to the file named by "destination".
*/
-bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_stl::string& destination)
+bool SystemTools::CopyFileAlways(const std::string& source, const std::string& destination)
{
// If files are the same do not copy
if ( SystemTools::SameFile(source, destination) )
@@ -2337,15 +2372,15 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st
// If destination is a directory, try to create a file with the same
// name as the source in that directory.
- kwsys_stl::string real_destination = destination;
- kwsys_stl::string destination_dir;
+ std::string real_destination = destination;
+ std::string destination_dir;
if(SystemTools::FileExists(destination) &&
SystemTools::FileIsDirectory(destination))
{
destination_dir = real_destination;
SystemTools::ConvertToUnixSlashes(real_destination);
real_destination += '/';
- kwsys_stl::string source_name = source;
+ std::string source_name = source;
real_destination += SystemTools::GetFilenameName(source_name);
}
else
@@ -2361,10 +2396,10 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st
#if defined(_WIN32)
kwsys::ifstream fin(Encoding::ToNarrow(
SystemTools::ConvertToWindowsExtendedPath(source)).c_str(),
- kwsys_ios::ios::in | kwsys_ios_binary);
+ std::ios::in | std::ios::binary);
#else
kwsys::ifstream fin(source.c_str(),
- kwsys_ios::ios::in | kwsys_ios_binary);
+ std::ios::in | std::ios::binary);
#endif
if(!fin)
{
@@ -2380,10 +2415,10 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st
#if defined(_WIN32)
kwsys::ofstream fout(Encoding::ToNarrow(
SystemTools::ConvertToWindowsExtendedPath(real_destination)).c_str(),
- kwsys_ios::ios::out | kwsys_ios::ios::trunc | kwsys_ios_binary);
+ std::ios::out | std::ios::trunc | std::ios::binary);
#else
kwsys::ofstream fout(real_destination.c_str(),
- kwsys_ios::ios::out | kwsys_ios::ios::trunc | kwsys_ios_binary);
+ std::ios::out | std::ios::trunc | std::ios::binary);
#endif
if(!fout)
{
@@ -2431,7 +2466,7 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st
}
//----------------------------------------------------------------------------
-bool SystemTools::CopyAFile(const kwsys_stl::string& source, const kwsys_stl::string& destination,
+bool SystemTools::CopyAFile(const std::string& source, const std::string& destination,
bool always)
{
if(always)
@@ -2448,7 +2483,7 @@ bool SystemTools::CopyAFile(const kwsys_stl::string& source, const kwsys_stl::st
* Copy a directory content from "source" directory to the directory named by
* "destination".
*/
-bool SystemTools::CopyADirectory(const kwsys_stl::string& source, const kwsys_stl::string& destination,
+bool SystemTools::CopyADirectory(const std::string& source, const std::string& destination,
bool always)
{
Directory dir;
@@ -2468,12 +2503,12 @@ bool SystemTools::CopyADirectory(const kwsys_stl::string& source, const kwsys_st
if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") &&
strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".."))
{
- kwsys_stl::string fullPath = source;
+ std::string fullPath = source;
fullPath += "/";
fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
if(SystemTools::FileIsDirectory(fullPath))
{
- kwsys_stl::string fullDestPath = destination;
+ std::string fullDestPath = destination;
fullDestPath += "/";
fullDestPath += dir.GetFile(static_cast<unsigned long>(fileNum));
if (!SystemTools::CopyADirectory(fullPath,
@@ -2498,7 +2533,7 @@ bool SystemTools::CopyADirectory(const kwsys_stl::string& source, const kwsys_st
// return size of file; also returns zero if no file exists
-unsigned long SystemTools::FileLength(const kwsys_stl::string& filename)
+unsigned long SystemTools::FileLength(const std::string& filename)
{
unsigned long length = 0;
#ifdef _WIN32
@@ -2538,7 +2573,7 @@ int SystemTools::Strucmp(const char *s1, const char *s2)
}
// return file's modified time
-long int SystemTools::ModifiedTime(const kwsys_stl::string& filename)
+long int SystemTools::ModifiedTime(const std::string& filename)
{
long int mt = 0;
#ifdef _WIN32
@@ -2561,7 +2596,7 @@ long int SystemTools::ModifiedTime(const kwsys_stl::string& filename)
}
// return file's creation time
-long int SystemTools::CreationTime(const kwsys_stl::string& filename)
+long int SystemTools::CreationTime(const std::string& filename)
{
long int ct = 0;
#ifdef _WIN32
@@ -2685,16 +2720,16 @@ bool SystemTools::ConvertTimeStampMacroString(const char *str, time_t *tmt)
return true;
}
-kwsys_stl::string SystemTools::GetLastSystemError()
+std::string SystemTools::GetLastSystemError()
{
int e = errno;
return strerror(e);
}
-bool SystemTools::RemoveFile(const kwsys_stl::string& source)
+bool SystemTools::RemoveFile(const std::string& source)
{
#ifdef _WIN32
- kwsys_stl::wstring const& ws =
+ std::wstring const& ws =
SystemTools::ConvertToWindowsExtendedPath(source);
if (DeleteFileW(ws.c_str()))
{
@@ -2733,7 +2768,7 @@ bool SystemTools::RemoveFile(const kwsys_stl::string& source)
#endif
}
-bool SystemTools::RemoveADirectory(const kwsys_stl::string& source)
+bool SystemTools::RemoveADirectory(const std::string& source)
{
// Add write permission to the directory so we can modify its
// content to remove files and directories from it.
@@ -2761,7 +2796,7 @@ bool SystemTools::RemoveADirectory(const kwsys_stl::string& source)
if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") &&
strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".."))
{
- kwsys_stl::string fullPath = source;
+ std::string fullPath = source;
fullPath += "/";
fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
if(SystemTools::FileIsDirectory(fullPath) &&
@@ -2797,13 +2832,13 @@ size_t SystemTools::GetMaximumFilePathLength()
* the system search path. Returns the full path to the file if it is
* found. Otherwise, the empty string is returned.
*/
-kwsys_stl::string SystemTools
-::FindName(const kwsys_stl::string& name,
- const kwsys_stl::vector<kwsys_stl::string>& userPaths,
+std::string SystemTools
+::FindName(const std::string& name,
+ const std::vector<std::string>& userPaths,
bool no_system_path)
{
// Add the system search path to our path first
- kwsys_stl::vector<kwsys_stl::string> path;
+ std::vector<std::string> path;
if (!no_system_path)
{
SystemTools::GetPath(path, "CMAKE_FILE_PATH");
@@ -2811,7 +2846,7 @@ kwsys_stl::string SystemTools
}
// now add the additional paths
{
- for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin();
+ for(std::vector<std::string>::const_iterator i = userPaths.begin();
i != userPaths.end(); ++i)
{
path.push_back(*i);
@@ -2819,10 +2854,10 @@ kwsys_stl::string SystemTools
}
// Add a trailing slash to all paths to aid the search process.
{
- for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
+ for(std::vector<std::string>::iterator i = path.begin();
i != path.end(); ++i)
{
- kwsys_stl::string& p = *i;
+ std::string& p = *i;
if(p.empty() || *p.rbegin() != '/')
{
p += "/";
@@ -2830,8 +2865,8 @@ kwsys_stl::string SystemTools
}
}
// now look for the file
- kwsys_stl::string tryPath;
- for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
+ std::string tryPath;
+ for(std::vector<std::string>::const_iterator p = path.begin();
p != path.end(); ++p)
{
tryPath = *p;
@@ -2850,12 +2885,12 @@ kwsys_stl::string SystemTools
* the system search path. Returns the full path to the file if it is
* found. Otherwise, the empty string is returned.
*/
-kwsys_stl::string SystemTools
-::FindFile(const kwsys_stl::string& name,
- const kwsys_stl::vector<kwsys_stl::string>& userPaths,
+std::string SystemTools
+::FindFile(const std::string& name,
+ const std::vector<std::string>& userPaths,
bool no_system_path)
{
- kwsys_stl::string tryPath = SystemTools::FindName(name, userPaths, no_system_path);
+ std::string tryPath = SystemTools::FindName(name, userPaths, no_system_path);
if(!tryPath.empty() && !SystemTools::FileIsDirectory(tryPath))
{
return SystemTools::CollapseFullPath(tryPath);
@@ -2869,12 +2904,12 @@ kwsys_stl::string SystemTools
* the system search path. Returns the full path to the directory if it is
* found. Otherwise, the empty string is returned.
*/
-kwsys_stl::string SystemTools
-::FindDirectory(const kwsys_stl::string& name,
- const kwsys_stl::vector<kwsys_stl::string>& userPaths,
+std::string SystemTools
+::FindDirectory(const std::string& name,
+ const std::vector<std::string>& userPaths,
bool no_system_path)
{
- kwsys_stl::string tryPath = SystemTools::FindName(name, userPaths, no_system_path);
+ std::string tryPath = SystemTools::FindName(name, userPaths, no_system_path);
if(!tryPath.empty() && SystemTools::FileIsDirectory(tryPath))
{
return SystemTools::CollapseFullPath(tryPath);
@@ -2888,24 +2923,24 @@ kwsys_stl::string SystemTools
* the system search path. Returns the full path to the executable if it is
* found. Otherwise, the empty string is returned.
*/
-kwsys_stl::string SystemTools::FindProgram(
+std::string SystemTools::FindProgram(
const char* nameIn,
- const kwsys_stl::vector<kwsys_stl::string>& userPaths,
+ const std::vector<std::string>& userPaths,
bool no_system_path)
{
if(!nameIn || !*nameIn)
{
return "";
}
- return SystemTools::FindProgram(kwsys_stl::string(nameIn), userPaths, no_system_path);
+ return SystemTools::FindProgram(std::string(nameIn), userPaths, no_system_path);
}
-kwsys_stl::string SystemTools::FindProgram(
- const kwsys_stl::string& name,
- const kwsys_stl::vector<kwsys_stl::string>& userPaths,
+std::string SystemTools::FindProgram(
+ const std::string& name,
+ const std::vector<std::string>& userPaths,
bool no_system_path)
{
- kwsys_stl::vector<kwsys_stl::string> extensions;
+ std::vector<std::string> extensions;
#if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
bool hasExtension = false;
// check to see if the name already has a .xxx at
@@ -2921,10 +2956,10 @@ kwsys_stl::string SystemTools::FindProgram(
extensions.push_back(".exe");
}
#endif
- kwsys_stl::string tryPath;
+ std::string tryPath;
// first try with extensions if the os supports them
- for(kwsys_stl::vector<kwsys_stl::string>::iterator i =
+ for(std::vector<std::string>::iterator i =
extensions.begin(); i != extensions.end(); ++i)
{
tryPath = name;
@@ -2943,7 +2978,7 @@ kwsys_stl::string SystemTools::FindProgram(
return SystemTools::CollapseFullPath(tryPath);
}
// now construct the path
- kwsys_stl::vector<kwsys_stl::string> path;
+ std::vector<std::string> path;
// Add the system search path to our path.
if (!no_system_path)
{
@@ -2951,7 +2986,7 @@ kwsys_stl::string SystemTools::FindProgram(
}
// now add the additional paths
{
- for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i =
+ for(std::vector<std::string>::const_iterator i =
userPaths.begin(); i != userPaths.end(); ++i)
{
path.push_back(*i);
@@ -2959,10 +2994,10 @@ kwsys_stl::string SystemTools::FindProgram(
}
// Add a trailing slash to all paths to aid the search process.
{
- for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
+ for(std::vector<std::string>::iterator i = path.begin();
i != path.end(); ++i)
{
- kwsys_stl::string& p = *i;
+ std::string& p = *i;
if(p.empty() || *p.rbegin() != '/')
{
p += "/";
@@ -2970,7 +3005,7 @@ kwsys_stl::string SystemTools::FindProgram(
}
}
// Try each path
- for(kwsys_stl::vector<kwsys_stl::string>::iterator p = path.begin();
+ for(std::vector<std::string>::iterator p = path.begin();
p != path.end(); ++p)
{
#ifdef _WIN32
@@ -2978,7 +3013,7 @@ kwsys_stl::string SystemTools::FindProgram(
SystemTools::ReplaceString(*p, "\"", "");
#endif
// first try with extensions
- for(kwsys_stl::vector<kwsys_stl::string>::iterator ext
+ for(std::vector<std::string>::iterator ext
= extensions.begin(); ext != extensions.end(); ++ext)
{
tryPath = *p;
@@ -3003,16 +3038,16 @@ kwsys_stl::string SystemTools::FindProgram(
return "";
}
-kwsys_stl::string SystemTools::FindProgram(
- const kwsys_stl::vector<kwsys_stl::string>& names,
- const kwsys_stl::vector<kwsys_stl::string>& path,
+std::string SystemTools::FindProgram(
+ const std::vector<std::string>& names,
+ const std::vector<std::string>& path,
bool noSystemPath)
{
- for(kwsys_stl::vector<kwsys_stl::string>::const_iterator it = names.begin();
+ for(std::vector<std::string>::const_iterator it = names.begin();
it != names.end() ; ++it)
{
// Try to find the program.
- kwsys_stl::string result = SystemTools::FindProgram(*it,
+ std::string result = SystemTools::FindProgram(*it,
path,
noSystemPath);
if ( !result.empty() )
@@ -3028,9 +3063,9 @@ kwsys_stl::string SystemTools::FindProgram(
* the system search path. Returns the full path to the library if it is
* found. Otherwise, the empty string is returned.
*/
-kwsys_stl::string SystemTools
-::FindLibrary(const kwsys_stl::string& name,
- const kwsys_stl::vector<kwsys_stl::string>& userPaths)
+std::string SystemTools
+::FindLibrary(const std::string& name,
+ const std::vector<std::string>& userPaths)
{
// See if the executable exists as written.
if(SystemTools::FileExists(name) &&
@@ -3040,11 +3075,11 @@ kwsys_stl::string SystemTools
}
// Add the system search path to our path.
- kwsys_stl::vector<kwsys_stl::string> path;
+ std::vector<std::string> path;
SystemTools::GetPath(path);
// now add the additional paths
{
- for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin();
+ for(std::vector<std::string>::const_iterator i = userPaths.begin();
i != userPaths.end(); ++i)
{
path.push_back(*i);
@@ -3052,18 +3087,18 @@ kwsys_stl::string SystemTools
}
// Add a trailing slash to all paths to aid the search process.
{
- for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
+ for(std::vector<std::string>::iterator i = path.begin();
i != path.end(); ++i)
{
- kwsys_stl::string& p = *i;
+ std::string& p = *i;
if(p.empty() || *p.rbegin() != '/')
{
p += "/";
}
}
}
- kwsys_stl::string tryPath;
- for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
+ std::string tryPath;
+ for(std::vector<std::string>::const_iterator p = path.begin();
p != path.end(); ++p)
{
#if defined(__APPLE__)
@@ -3138,15 +3173,15 @@ kwsys_stl::string SystemTools
return "";
}
-kwsys_stl::string SystemTools::GetRealPath(const kwsys_stl::string& path,
- kwsys_stl::string* errorMessage)
+std::string SystemTools::GetRealPath(const std::string& path,
+ std::string* errorMessage)
{
- kwsys_stl::string ret;
+ std::string ret;
Realpath(path, ret, errorMessage);
return ret;
}
-bool SystemTools::FileIsDirectory(const kwsys_stl::string& inName)
+bool SystemTools::FileIsDirectory(const std::string& inName)
{
if (inName.empty())
{
@@ -3195,7 +3230,7 @@ bool SystemTools::FileIsDirectory(const kwsys_stl::string& inName)
}
}
-bool SystemTools::FileIsSymlink(const kwsys_stl::string& name)
+bool SystemTools::FileIsSymlink(const std::string& name)
{
#if defined( _WIN32 )
DWORD attr = GetFileAttributesW(
@@ -3222,25 +3257,25 @@ bool SystemTools::FileIsSymlink(const kwsys_stl::string& name)
}
#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::CreateSymlink(const kwsys_stl::string&, const kwsys_stl::string&)
+bool SystemTools::CreateSymlink(const std::string&, const std::string&)
{
return false;
}
#else
-bool SystemTools::CreateSymlink(const kwsys_stl::string& origName, const kwsys_stl::string& newName)
+bool SystemTools::CreateSymlink(const std::string& origName, const std::string& newName)
{
return symlink(origName.c_str(), newName.c_str()) >= 0;
}
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::ReadSymlink(const kwsys_stl::string&, kwsys_stl::string&)
+bool SystemTools::ReadSymlink(const std::string&, std::string&)
{
return false;
}
#else
-bool SystemTools::ReadSymlink(const kwsys_stl::string& newName,
- kwsys_stl::string& origName)
+bool SystemTools::ReadSymlink(const std::string& newName,
+ std::string& origName)
{
char buf[KWSYS_SYSTEMTOOLS_MAXPATH+1];
int count =
@@ -3259,16 +3294,16 @@ bool SystemTools::ReadSymlink(const kwsys_stl::string& newName,
}
#endif
-int SystemTools::ChangeDirectory(const kwsys_stl::string& dir)
+int SystemTools::ChangeDirectory(const std::string& dir)
{
return Chdir(dir);
}
-kwsys_stl::string SystemTools::GetCurrentWorkingDirectory(bool collapse)
+std::string SystemTools::GetCurrentWorkingDirectory(bool collapse)
{
char buf[2048];
const char* cwd = Getcwd(buf, 2048);
- kwsys_stl::string path;
+ std::string path;
if ( cwd )
{
path = cwd;
@@ -3280,16 +3315,16 @@ kwsys_stl::string SystemTools::GetCurrentWorkingDirectory(bool collapse)
return path;
}
-kwsys_stl::string SystemTools::GetProgramPath(const kwsys_stl::string& in_name)
+std::string SystemTools::GetProgramPath(const std::string& in_name)
{
- kwsys_stl::string dir, file;
+ std::string dir, file;
SystemTools::SplitProgramPath(in_name, dir, file);
return dir;
}
-bool SystemTools::SplitProgramPath(const kwsys_stl::string& in_name,
- kwsys_stl::string& dir,
- kwsys_stl::string& file,
+bool SystemTools::SplitProgramPath(const std::string& in_name,
+ std::string& dir,
+ std::string& file,
bool)
{
dir = in_name;
@@ -3298,8 +3333,8 @@ bool SystemTools::SplitProgramPath(const kwsys_stl::string& in_name,
if(!SystemTools::FileIsDirectory(dir))
{
- kwsys_stl::string::size_type slashPos = dir.rfind("/");
- if(slashPos != kwsys_stl::string::npos)
+ std::string::size_type slashPos = dir.rfind("/");
+ if(slashPos != std::string::npos)
{
file = dir.substr(slashPos+1);
dir = dir.substr(0, slashPos);
@@ -3312,7 +3347,7 @@ bool SystemTools::SplitProgramPath(const kwsys_stl::string& in_name,
}
if(!(dir.empty()) && !SystemTools::FileIsDirectory(dir))
{
- kwsys_stl::string oldDir = in_name;
+ std::string oldDir = in_name;
SystemTools::ConvertToUnixSlashes(oldDir);
dir = in_name;
return false;
@@ -3321,14 +3356,14 @@ bool SystemTools::SplitProgramPath(const kwsys_stl::string& in_name,
}
bool SystemTools::FindProgramPath(const char* argv0,
- kwsys_stl::string& pathOut,
- kwsys_stl::string& errorMsg,
+ std::string& pathOut,
+ std::string& errorMsg,
const char* exeName,
const char* buildDir,
const char* installPrefix )
{
- kwsys_stl::vector<kwsys_stl::string> failures;
- kwsys_stl::string self = argv0 ? argv0 : "";
+ std::vector<std::string> failures;
+ std::string self = argv0 ? argv0 : "";
failures.push_back(self);
SystemTools::ConvertToUnixSlashes(self);
self = SystemTools::FindProgram(self);
@@ -3336,7 +3371,7 @@ bool SystemTools::FindProgramPath(const char* argv0,
{
if(buildDir)
{
- kwsys_stl::string intdir = ".";
+ std::string intdir = ".";
#ifdef CMAKE_INTDIR
intdir = CMAKE_INTDIR;
#endif
@@ -3361,7 +3396,7 @@ bool SystemTools::FindProgramPath(const char* argv0,
if(!SystemTools::FileExists(self))
{
failures.push_back(self);
- kwsys_ios::ostringstream msg;
+ std::ostringstream msg;
msg << "Can not find the command line program ";
if (exeName)
{
@@ -3373,7 +3408,7 @@ bool SystemTools::FindProgramPath(const char* argv0,
msg << " argv[0] = \"" << argv0 << "\"\n";
}
msg << " Attempted paths:\n";
- kwsys_stl::vector<kwsys_stl::string>::iterator i;
+ std::vector<std::string>::iterator i;
for(i=failures.begin(); i != failures.end(); ++i)
{
msg << " \"" << *i << "\"\n";
@@ -3386,15 +3421,15 @@ bool SystemTools::FindProgramPath(const char* argv0,
}
-kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_relative)
+std::string SystemTools::CollapseFullPath(const std::string& in_relative)
{
return SystemTools::CollapseFullPath(in_relative, 0);
}
-void SystemTools::AddTranslationPath(const kwsys_stl::string& a, const kwsys_stl::string& b)
+void SystemTools::AddTranslationPath(const std::string& a, const std::string& b)
{
- kwsys_stl::string path_a = a;
- kwsys_stl::string path_b = b;
+ std::string path_a = a;
+ std::string path_b = b;
SystemTools::ConvertToUnixSlashes(path_a);
SystemTools::ConvertToUnixSlashes(path_b);
// First check this is a directory path, since we don't want the table to
@@ -3405,7 +3440,7 @@ void SystemTools::AddTranslationPath(const kwsys_stl::string& a, const kwsys_stl
// Ken--the following code is incorrect. .. can be in a valid path
// for example /home/martink/MyHubba...Hubba/Src
if( SystemTools::FileIsFullPath(path_b) && path_b.find("..")
- == kwsys_stl::string::npos )
+ == std::string::npos )
{
// Before inserting make sure path ends with '/'
if(!path_a.empty() && *path_a.rbegin() != '/')
@@ -3425,14 +3460,14 @@ void SystemTools::AddTranslationPath(const kwsys_stl::string& a, const kwsys_stl
}
}
-void SystemTools::AddKeepPath(const kwsys_stl::string& dir)
+void SystemTools::AddKeepPath(const std::string& dir)
{
- kwsys_stl::string cdir;
+ std::string cdir;
Realpath(SystemTools::CollapseFullPath(dir).c_str(), cdir);
SystemTools::AddTranslationPath(cdir, dir);
}
-void SystemTools::CheckTranslationPath(kwsys_stl::string & path)
+void SystemTools::CheckTranslationPath(std::string & path)
{
// Do not translate paths that are too short to have meaningful
// translations.
@@ -3448,7 +3483,7 @@ void SystemTools::CheckTranslationPath(kwsys_stl::string & path)
// In case a file was specified we still have to go through this:
// Now convert any path found in the table back to the one desired:
- kwsys_stl::map<kwsys_stl::string,kwsys_stl::string>::const_iterator it;
+ std::map<std::string,std::string>::const_iterator it;
for(it = SystemTools::TranslationMap->begin();
it != SystemTools::TranslationMap->end();
++it )
@@ -3466,13 +3501,13 @@ void SystemTools::CheckTranslationPath(kwsys_stl::string & path)
static void
SystemToolsAppendComponents(
- kwsys_stl::vector<kwsys_stl::string>& out_components,
- kwsys_stl::vector<kwsys_stl::string>::const_iterator first,
- kwsys_stl::vector<kwsys_stl::string>::const_iterator last)
+ std::vector<std::string>& out_components,
+ std::vector<std::string>::const_iterator first,
+ std::vector<std::string>::const_iterator last)
{
- static const kwsys_stl::string up = "..";
- static const kwsys_stl::string cur = ".";
- for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = first;
+ static const std::string up = "..";
+ static const std::string cur = ".";
+ for(std::vector<std::string>::const_iterator i = first;
i != last; ++i)
{
if(*i == up)
@@ -3489,20 +3524,20 @@ SystemToolsAppendComponents(
}
}
-kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path,
+std::string SystemTools::CollapseFullPath(const std::string& in_path,
const char* in_base)
{
// Collect the output path components.
- kwsys_stl::vector<kwsys_stl::string> out_components;
+ std::vector<std::string> out_components;
// Split the input path components.
- kwsys_stl::vector<kwsys_stl::string> path_components;
+ std::vector<std::string> path_components;
SystemTools::SplitPath(in_path, path_components);
// If the input path is relative, start with a base path.
if(path_components[0].length() == 0)
{
- kwsys_stl::vector<kwsys_stl::string> base_components;
+ std::vector<std::string> base_components;
if(in_base)
{
// Use the given base path.
@@ -3535,7 +3570,7 @@ kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path
path_components.end());
// Transform the path back to a string.
- kwsys_stl::string newPath = SystemTools::JoinPath(out_components);
+ std::string newPath = SystemTools::JoinPath(out_components);
// Update the translation table with this potentially new path. I am not
// sure why this line is here, it seems really questionable, but yet I
@@ -3560,20 +3595,20 @@ kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path
return newPath;
}
-kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path,
- const kwsys_stl::string& in_base)
+std::string SystemTools::CollapseFullPath(const std::string& in_path,
+ const std::string& in_base)
{
// Collect the output path components.
- kwsys_stl::vector<kwsys_stl::string> out_components;
+ std::vector<std::string> out_components;
// Split the input path components.
- kwsys_stl::vector<kwsys_stl::string> path_components;
+ std::vector<std::string> path_components;
SystemTools::SplitPath(in_path, path_components);
// If the input path is relative, start with a base path.
if(path_components[0].length() == 0)
{
- kwsys_stl::vector<kwsys_stl::string> base_components;
+ std::vector<std::string> base_components;
// Use the given base path.
SystemTools::SplitPath(in_base, base_components);
@@ -3590,7 +3625,7 @@ kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path
path_components.end());
// Transform the path back to a string.
- kwsys_stl::string newPath = SystemTools::JoinPath(out_components);
+ std::string newPath = SystemTools::JoinPath(out_components);
// Update the translation table with this potentially new path. I am not
// sure why this line is here, it seems really questionable, but yet I
@@ -3616,7 +3651,7 @@ kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path
}
// compute the relative path from here to there
-kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, const kwsys_stl::string& remote)
+std::string SystemTools::RelativePath(const std::string& local, const std::string& remote)
{
if(!SystemTools::FileIsFullPath(local))
{
@@ -3627,14 +3662,14 @@ kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, cons
return "";
}
- kwsys_stl::string l = SystemTools::CollapseFullPath(local);
- kwsys_stl::string r = SystemTools::CollapseFullPath(remote);
+ std::string l = SystemTools::CollapseFullPath(local);
+ std::string r = SystemTools::CollapseFullPath(remote);
// split up both paths into arrays of strings using / as a separator
- kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(l, '/', true);
- kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(r, '/', true);
- kwsys_stl::vector<kwsys::String> commonPath; // store shared parts of path in this array
- kwsys_stl::vector<kwsys::String> finalPath; // store the final relative path here
+ std::vector<kwsys::String> localSplit = SystemTools::SplitString(l, '/', true);
+ std::vector<kwsys::String> remoteSplit = SystemTools::SplitString(r, '/', true);
+ std::vector<kwsys::String> commonPath; // store shared parts of path in this array
+ std::vector<kwsys::String> finalPath; // store the final relative path here
// count up how many matching directory names there are from the start
unsigned int sameCount = 0;
while(
@@ -3679,7 +3714,7 @@ kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, cons
}
// for each entry that is not common in the remote path add it
// to the final path.
- for(kwsys_stl::vector<String>::iterator vit = remoteSplit.begin();
+ for(std::vector<String>::iterator vit = remoteSplit.begin();
vit != remoteSplit.end(); ++vit)
{
if(!vit->empty())
@@ -3687,10 +3722,10 @@ kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, cons
finalPath.push_back(*vit);
}
}
- kwsys_stl::string relativePath; // result string
+ std::string relativePath; // result string
// now turn the array of directories into a unix path by puttint /
// between each entry that does not already have one
- for(kwsys_stl::vector<String>::iterator vit1 = finalPath.begin();
+ for(std::vector<String>::iterator vit1 = finalPath.begin();
vit1 != finalPath.end(); ++vit1)
{
if(!relativePath.empty() && *relativePath.rbegin() != '/')
@@ -3703,10 +3738,10 @@ kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, cons
}
#ifdef _WIN32
-static int GetCasePathName(const kwsys_stl::string & pathIn,
- kwsys_stl::string & casePath)
+static int GetCasePathName(const std::string & pathIn,
+ std::string & casePath)
{
- kwsys_stl::vector<kwsys_stl::string> path_components;
+ std::vector<std::string> path_components;
SystemTools::SplitPath(pathIn, path_components);
if(path_components[0].empty()) // First component always exists.
{
@@ -3716,7 +3751,7 @@ static int GetCasePathName(const kwsys_stl::string & pathIn,
}
// Start with root component.
- kwsys_stl::vector<kwsys_stl::string>::size_type idx = 0;
+ std::vector<std::string>::size_type idx = 0;
casePath = path_components[idx++];
// make sure drive letter is always upper case
if(casePath.size() > 1 && casePath[1] == ':')
@@ -3740,14 +3775,14 @@ static int GetCasePathName(const kwsys_stl::string & pathIn,
{
casePath += sep;
sep = "/";
- kwsys_stl::string test_str = casePath;
+ std::string test_str = casePath;
test_str += path_components[idx];
// If path component contains wildcards, we skip matching
// because these filenames are not allowed on windows,
// and we do not want to match a different file.
- if(path_components[idx].find('*') != kwsys_stl::string::npos ||
- path_components[idx].find('?') != kwsys_stl::string::npos)
+ if(path_components[idx].find('*') != std::string::npos ||
+ path_components[idx].find('?') != std::string::npos)
{
casePath = "";
return 0;
@@ -3773,7 +3808,7 @@ static int GetCasePathName(const kwsys_stl::string & pathIn,
//----------------------------------------------------------------------------
-kwsys_stl::string SystemTools::GetActualCaseForPath(const kwsys_stl::string& p)
+std::string SystemTools::GetActualCaseForPath(const std::string& p)
{
#ifndef _WIN32
return p;
@@ -3786,7 +3821,7 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const kwsys_stl::string& p)
{
return i->second;
}
- kwsys_stl::string casePath;
+ std::string casePath;
int len = GetCasePathName(p, casePath);
if(len == 0 || len > MAX_PATH+1)
{
@@ -3799,7 +3834,7 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const kwsys_stl::string& p)
//----------------------------------------------------------------------------
const char* SystemTools::SplitPathRootComponent(const std::string& p,
- kwsys_stl::string* root)
+ std::string* root)
{
// Identify the root component.
const char* c = p.c_str();
@@ -3885,7 +3920,7 @@ const char* SystemTools::SplitPathRootComponent(const std::string& p,
//----------------------------------------------------------------------------
void SystemTools::SplitPath(const std::string& p,
- kwsys_stl::vector<kwsys_stl::string>& components,
+ std::vector<std::string>& components,
bool expand_home_dir)
{
const char* c;
@@ -3893,13 +3928,13 @@ void SystemTools::SplitPath(const std::string& p,
// Identify the root component.
{
- kwsys_stl::string root;
+ std::string root;
c = SystemTools::SplitPathRootComponent(p, &root);
// Expand home directory references if requested.
if(expand_home_dir && !root.empty() && root[0] == '~')
{
- kwsys_stl::string homedir;
+ std::string homedir;
root = root.substr(0, root.size()-1);
if(root.size() == 1)
{
@@ -3945,7 +3980,7 @@ void SystemTools::SplitPath(const std::string& p,
if(*last == '/' || *last == '\\')
{
// End of a component. Save it.
- components.push_back(kwsys_stl::string(first, last));
+ components.push_back(std::string(first, last));
first = last+1;
}
}
@@ -3953,27 +3988,27 @@ void SystemTools::SplitPath(const std::string& p,
// Save the last component unless there were no components.
if(last != c)
{
- components.push_back(kwsys_stl::string(first, last));
+ components.push_back(std::string(first, last));
}
}
//----------------------------------------------------------------------------
-kwsys_stl::string
-SystemTools::JoinPath(const kwsys_stl::vector<kwsys_stl::string>& components)
+std::string
+SystemTools::JoinPath(const std::vector<std::string>& components)
{
return SystemTools::JoinPath(components.begin(), components.end());
}
//----------------------------------------------------------------------------
-kwsys_stl::string
+std::string
SystemTools
-::JoinPath(kwsys_stl::vector<kwsys_stl::string>::const_iterator first,
- kwsys_stl::vector<kwsys_stl::string>::const_iterator last)
+::JoinPath(std::vector<std::string>::const_iterator first,
+ std::vector<std::string>::const_iterator last)
{
// Construct result in a single string.
- kwsys_stl::string result;
+ std::string result;
size_t len = 0;
- kwsys_stl::vector<kwsys_stl::string>::const_iterator i;
+ std::vector<std::string>::const_iterator i;
for(i = first; i != last; ++i)
{
len += 1 + i->size();
@@ -4002,7 +4037,7 @@ SystemTools
}
//----------------------------------------------------------------------------
-bool SystemTools::ComparePath(const kwsys_stl::string& c1, const kwsys_stl::string& c2)
+bool SystemTools::ComparePath(const std::string& c1, const std::string& c2)
{
#if defined(_WIN32) || defined(__APPLE__)
# ifdef _MSC_VER
@@ -4018,14 +4053,14 @@ bool SystemTools::ComparePath(const kwsys_stl::string& c1, const kwsys_stl::stri
}
//----------------------------------------------------------------------------
-bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector<kwsys_stl::string>& lines, char separator)
+bool SystemTools::Split(const std::string& str, std::vector<std::string>& lines, char separator)
{
- kwsys_stl::string data(str);
- kwsys_stl::string::size_type lpos = 0;
+ std::string data(str);
+ std::string::size_type lpos = 0;
while(lpos < data.length())
{
- kwsys_stl::string::size_type rpos = data.find_first_of(separator, lpos);
- if(rpos == kwsys_stl::string::npos)
+ std::string::size_type rpos = data.find_first_of(separator, lpos);
+ if(rpos == std::string::npos)
{
// Line ends at end of string without a newline.
lines.push_back(data.substr(lpos));
@@ -4042,14 +4077,14 @@ bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector<kwsys_st
}
//----------------------------------------------------------------------------
-bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector<kwsys_stl::string>& lines)
+bool SystemTools::Split(const std::string& str, std::vector<std::string>& lines)
{
- kwsys_stl::string data(str);
- kwsys_stl::string::size_type lpos = 0;
+ std::string data(str);
+ std::string::size_type lpos = 0;
while(lpos < data.length())
{
- kwsys_stl::string::size_type rpos = data.find_first_of("\n", lpos);
- if(rpos == kwsys_stl::string::npos)
+ std::string::size_type rpos = data.find_first_of("\n", lpos);
+ if(rpos == std::string::npos)
{
// Line ends at end of string without a newline.
lines.push_back(data.substr(lpos));
@@ -4074,15 +4109,15 @@ bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector<kwsys_st
* Return path of a full filename (no trailing slashes).
* Warning: returned path is converted to Unix slashes format.
*/
-kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename)
+std::string SystemTools::GetFilenamePath(const std::string& filename)
{
- kwsys_stl::string fn = filename;
+ std::string fn = filename;
SystemTools::ConvertToUnixSlashes(fn);
- kwsys_stl::string::size_type slash_pos = fn.rfind("/");
- if(slash_pos != kwsys_stl::string::npos)
+ std::string::size_type slash_pos = fn.rfind("/");
+ if(slash_pos != std::string::npos)
{
- kwsys_stl::string ret = fn.substr(0, slash_pos);
+ std::string ret = fn.substr(0, slash_pos);
if(ret.size() == 2 && ret[1] == ':')
{
return ret + '/';
@@ -4103,14 +4138,14 @@ kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename
/**
* Return file name of a full filename (i.e. file name without path).
*/
-kwsys_stl::string SystemTools::GetFilenameName(const kwsys_stl::string& filename)
+std::string SystemTools::GetFilenameName(const std::string& filename)
{
#if defined(_WIN32)
- kwsys_stl::string::size_type slash_pos = filename.find_last_of("/\\");
+ std::string::size_type slash_pos = filename.find_last_of("/\\");
#else
- kwsys_stl::string::size_type slash_pos = filename.rfind('/');
+ std::string::size_type slash_pos = filename.rfind('/');
#endif
- if(slash_pos != kwsys_stl::string::npos)
+ if(slash_pos != std::string::npos)
{
return filename.substr(slash_pos + 1);
}
@@ -4125,11 +4160,11 @@ kwsys_stl::string SystemTools::GetFilenameName(const kwsys_stl::string& filename
* Return file extension of a full filename (dot included).
* Warning: this is the longest extension (for example: .tar.gz)
*/
-kwsys_stl::string SystemTools::GetFilenameExtension(const kwsys_stl::string& filename)
+std::string SystemTools::GetFilenameExtension(const std::string& filename)
{
- kwsys_stl::string name = SystemTools::GetFilenameName(filename);
- kwsys_stl::string::size_type dot_pos = name.find('.');
- if(dot_pos != kwsys_stl::string::npos)
+ std::string name = SystemTools::GetFilenameName(filename);
+ std::string::size_type dot_pos = name.find('.');
+ if(dot_pos != std::string::npos)
{
return name.substr(dot_pos);
}
@@ -4143,11 +4178,11 @@ kwsys_stl::string SystemTools::GetFilenameExtension(const kwsys_stl::string& fil
* Return file extension of a full filename (dot included).
* Warning: this is the shortest extension (for example: .gz of .tar.gz)
*/
-kwsys_stl::string SystemTools::GetFilenameLastExtension(const kwsys_stl::string& filename)
+std::string SystemTools::GetFilenameLastExtension(const std::string& filename)
{
- kwsys_stl::string name = SystemTools::GetFilenameName(filename);
- kwsys_stl::string::size_type dot_pos = name.rfind('.');
- if(dot_pos != kwsys_stl::string::npos)
+ std::string name = SystemTools::GetFilenameName(filename);
+ std::string::size_type dot_pos = name.rfind('.');
+ if(dot_pos != std::string::npos)
{
return name.substr(dot_pos);
}
@@ -4161,11 +4196,11 @@ kwsys_stl::string SystemTools::GetFilenameLastExtension(const kwsys_stl::string&
* Return file name without extension of a full filename (i.e. without path).
* Warning: it considers the longest extension (for example: .tar.gz)
*/
-kwsys_stl::string SystemTools::GetFilenameWithoutExtension(const kwsys_stl::string& filename)
+std::string SystemTools::GetFilenameWithoutExtension(const std::string& filename)
{
- kwsys_stl::string name = SystemTools::GetFilenameName(filename);
- kwsys_stl::string::size_type dot_pos = name.find('.');
- if(dot_pos != kwsys_stl::string::npos)
+ std::string name = SystemTools::GetFilenameName(filename);
+ std::string::size_type dot_pos = name.find('.');
+ if(dot_pos != std::string::npos)
{
return name.substr(0, dot_pos);
}
@@ -4181,12 +4216,12 @@ kwsys_stl::string SystemTools::GetFilenameWithoutExtension(const kwsys_stl::stri
* Warning: it considers the last extension (for example: removes .gz
* from .tar.gz)
*/
-kwsys_stl::string
-SystemTools::GetFilenameWithoutLastExtension(const kwsys_stl::string& filename)
+std::string
+SystemTools::GetFilenameWithoutLastExtension(const std::string& filename)
{
- kwsys_stl::string name = SystemTools::GetFilenameName(filename);
- kwsys_stl::string::size_type dot_pos = name.rfind('.');
- if(dot_pos != kwsys_stl::string::npos)
+ std::string name = SystemTools::GetFilenameName(filename);
+ std::string::size_type dot_pos = name.rfind('.');
+ if(dot_pos != std::string::npos)
{
return name.substr(0, dot_pos);
}
@@ -4295,7 +4330,7 @@ SystemTools::DetectFileType(const char *filename,
bool SystemTools::LocateFileInDir(const char *filename,
const char *dir,
- kwsys_stl::string& filename_found,
+ std::string& filename_found,
int try_filename_dirs)
{
if (!filename || !dir)
@@ -4305,12 +4340,12 @@ bool SystemTools::LocateFileInDir(const char *filename,
// Get the basename of 'filename'
- kwsys_stl::string filename_base = SystemTools::GetFilenameName(filename);
+ std::string filename_base = SystemTools::GetFilenameName(filename);
// Check if 'dir' is really a directory
// If win32 and matches something like C:, accept it as a dir
- kwsys_stl::string real_dir;
+ std::string real_dir;
if (!SystemTools::FileIsDirectory(dir))
{
#if defined( _WIN32 )
@@ -4334,7 +4369,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
int need_slash =
(dir_len && dir[dir_len - 1] != '/' && dir[dir_len - 1] != '\\');
- kwsys_stl::string temp = dir;
+ std::string temp = dir;
if (need_slash)
{
temp += "/";
@@ -4354,9 +4389,9 @@ bool SystemTools::LocateFileInDir(const char *filename,
else if (try_filename_dirs)
{
- kwsys_stl::string filename_dir(filename);
- kwsys_stl::string filename_dir_base;
- kwsys_stl::string filename_dir_bases;
+ std::string filename_dir(filename);
+ std::string filename_dir_base;
+ std::string filename_dir_bases;
do
{
filename_dir = SystemTools::GetFilenamePath(filename_dir);
@@ -4390,7 +4425,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
return res;
}
-bool SystemTools::FileIsFullPath(const kwsys_stl::string& in_name)
+bool SystemTools::FileIsFullPath(const std::string& in_name)
{
return SystemTools::FileIsFullPath(in_name.c_str(), in_name.size());
}
@@ -4439,7 +4474,7 @@ bool SystemTools::FileIsFullPath(const char* in_name, size_t len)
return false;
}
-bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& shortPath)
+bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
const int size = int(path.size()) +1; // size of return
@@ -4457,8 +4492,8 @@ bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string&
strcpy(tempPath,path.c_str());
}
- kwsys_stl::wstring wtempPath = Encoding::ToWide(tempPath);
- kwsys_stl::vector<wchar_t> buffer(wtempPath.size()+1);
+ std::wstring wtempPath = Encoding::ToWide(tempPath);
+ std::vector<wchar_t> buffer(wtempPath.size()+1);
buffer[0] = 0;
ret = GetShortPathNameW(wtempPath.c_str(),
&buffer[0], static_cast<DWORD>(wtempPath.size()));
@@ -4480,8 +4515,8 @@ bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string&
#endif
}
-void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path,
- kwsys_stl::string& program, kwsys_stl::string& args)
+void SystemTools::SplitProgramFromArgs(const std::string& path,
+ std::string& program, std::string& args)
{
// see if this is a full path to a program
// if so then set program to path and args to nothing
@@ -4493,8 +4528,8 @@ void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path,
}
// Try to find the program in the path, note the program
// may have spaces in its name so we have to look for it
- kwsys_stl::vector<kwsys_stl::string> e;
- kwsys_stl::string findProg = SystemTools::FindProgram(path, e);
+ std::vector<std::string> e;
+ std::string findProg = SystemTools::FindProgram(path, e);
if(!findProg.empty())
{
program = findProg;
@@ -4504,17 +4539,17 @@ void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path,
// Now try and peel off space separated chunks from the end of the string
// so the largest path possible is found allowing for spaces in the path
- kwsys_stl::string dir = path;
- kwsys_stl::string::size_type spacePos = dir.rfind(' ');
- while(spacePos != kwsys_stl::string::npos)
+ std::string dir = path;
+ std::string::size_type spacePos = dir.rfind(' ');
+ while(spacePos != std::string::npos)
{
- kwsys_stl::string tryProg = dir.substr(0, spacePos);
+ std::string tryProg = dir.substr(0, spacePos);
// See if the file exists
if(SystemTools::FileExists(tryProg))
{
program = tryProg;
// remove trailing spaces from program
- kwsys_stl::string::size_type pos = program.size()-1;
+ std::string::size_type pos = program.size()-1;
while(program[pos] == ' ')
{
program.erase(pos);
@@ -4529,7 +4564,7 @@ void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path,
{
program = findProg;
// remove trailing spaces from program
- kwsys_stl::string::size_type pos = program.size()-1;
+ std::string::size_type pos = program.size()-1;
while(program[pos] == ' ')
{
program.erase(pos);
@@ -4547,29 +4582,29 @@ void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path,
args = "";
}
-kwsys_stl::string SystemTools::GetCurrentDateTime(const char* format)
+std::string SystemTools::GetCurrentDateTime(const char* format)
{
char buf[1024];
time_t t;
time(&t);
strftime(buf, sizeof(buf), format, localtime(&t));
- return kwsys_stl::string(buf);
+ return std::string(buf);
}
-kwsys_stl::string SystemTools::MakeCidentifier(const kwsys_stl::string& s)
+std::string SystemTools::MakeCidentifier(const std::string& s)
{
- kwsys_stl::string str(s);
+ std::string str(s);
if (str.find_first_of("0123456789") == 0)
{
str = "_" + str;
}
- kwsys_stl::string permited_chars("_"
+ std::string permited_chars("_"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789");
- kwsys_stl::string::size_type pos = 0;
- while ((pos = str.find_first_not_of(permited_chars, pos)) != kwsys_stl::string::npos)
+ std::string::size_type pos = 0;
+ while ((pos = str.find_first_not_of(permited_chars, pos)) != std::string::npos)
{
str[pos] = '_';
}
@@ -4579,8 +4614,8 @@ kwsys_stl::string SystemTools::MakeCidentifier(const kwsys_stl::string& s)
// Due to a buggy stream library on the HP and another on Mac OS X, we
// need this very carefully written version of getline. Returns true
// if any data were read before the end-of-file was reached.
-bool SystemTools::GetLineFromStream(kwsys_ios::istream& is,
- kwsys_stl::string& line,
+bool SystemTools::GetLineFromStream(std::istream& is,
+ std::string& line,
bool* has_newline /* = 0 */,
long sizeLimit /* = -1 */)
{
@@ -4611,7 +4646,7 @@ bool SystemTools::GetLineFromStream(kwsys_ios::istream& is,
// been reached. Clear the fail bit just before reading.
while(!haveNewline &&
leftToRead != 0 &&
- (is.clear(is.rdstate() & ~kwsys_ios::ios::failbit),
+ (is.clear(is.rdstate() & ~std::ios::failbit),
is.getline(buffer, bufferSize), is.gcount() > 0))
{
// We have read at least one byte.
@@ -4696,10 +4731,10 @@ bool SystemTools::GetPermissions(const char* file, mode_t& mode)
{
return false;
}
- return SystemTools::GetPermissions(kwsys_stl::string(file), mode);
+ return SystemTools::GetPermissions(std::string(file), mode);
}
-bool SystemTools::GetPermissions(const kwsys_stl::string& file, mode_t& mode)
+bool SystemTools::GetPermissions(const std::string& file, mode_t& mode)
{
#if defined(_WIN32)
DWORD attr = GetFileAttributesW(
@@ -4745,21 +4780,35 @@ bool SystemTools::GetPermissions(const kwsys_stl::string& file, mode_t& mode)
return true;
}
-bool SystemTools::SetPermissions(const char* file, mode_t mode)
+bool SystemTools::SetPermissions(const char* file,
+ mode_t mode,
+ bool honor_umask)
{
if ( !file )
{
return false;
}
- return SystemTools::SetPermissions(kwsys_stl::string(file), mode);
+ return SystemTools::SetPermissions(
+ std::string(file), mode, honor_umask);
}
-bool SystemTools::SetPermissions(const kwsys_stl::string& file, mode_t mode)
+bool SystemTools::SetPermissions(const std::string& file,
+ mode_t mode,
+ bool honor_umask)
{
- if ( !SystemTools::FileExists(file) )
+ // TEMPORARY / TODO: After FileExists calls lstat() instead of
+ // access(), change this call to FileExists instead of
+ // TestFileAccess so that we don't follow symlinks.
+ if ( !SystemTools::TestFileAccess(file, TEST_FILE_OK) )
{
return false;
}
+ if (honor_umask)
+ {
+ mode_t currentMask = umask(0);
+ umask(currentMask);
+ mode &= ~currentMask;
+ }
#ifdef _WIN32
if ( _wchmod(SystemTools::ConvertToWindowsExtendedPath(file).c_str(),
mode) < 0 )
@@ -4773,19 +4822,19 @@ bool SystemTools::SetPermissions(const kwsys_stl::string& file, mode_t mode)
return true;
}
-kwsys_stl::string SystemTools::GetParentDirectory(const kwsys_stl::string& fileOrDir)
+std::string SystemTools::GetParentDirectory(const std::string& fileOrDir)
{
return SystemTools::GetFilenamePath(fileOrDir);
}
-bool SystemTools::IsSubDirectory(const kwsys_stl::string& cSubdir, const kwsys_stl::string& cDir)
+bool SystemTools::IsSubDirectory(const std::string& cSubdir, const std::string& cDir)
{
if(cDir.empty())
{
return false;
}
- kwsys_stl::string subdir = cSubdir;
- kwsys_stl::string dir = cDir;
+ std::string subdir = cSubdir;
+ std::string dir = cDir;
SystemTools::ConvertToUnixSlashes(subdir);
SystemTools::ConvertToUnixSlashes(dir);
if(subdir.size() > dir.size() && subdir[dir.size()] == '/')
@@ -4820,9 +4869,9 @@ void SystemTools::Delay(unsigned int msec)
#endif
}
-kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
+std::string SystemTools::GetOperatingSystemNameAndVersion()
{
- kwsys_stl::string res;
+ std::string res;
#ifdef _WIN32
char buffer[256];
@@ -4830,11 +4879,8 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
OSVERSIONINFOEXA osvi;
BOOL bOsVersionInfoEx;
- // Try calling GetVersionEx using the OSVERSIONINFOEX structure.
- // If that fails, try using the OSVERSIONINFO structure.
-
- ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXA));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
+ ZeroMemory(&osvi, sizeof(osvi));
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (push)
@@ -4844,14 +4890,10 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
# pragma warning (disable:4996)
# endif
#endif
- bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osvi);
+ bOsVersionInfoEx = GetVersionExA((OSVERSIONINFOA *)&osvi);
if (!bOsVersionInfoEx)
{
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if (!GetVersionEx((OSVERSIONINFO *)&osvi))
- {
- return 0;
- }
+ return 0;
}
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (pop)
@@ -4864,10 +4906,56 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
case VER_PLATFORM_WIN32_NT:
// Test for the specific product family.
+ if (osvi.dwMajorVersion == 10 && osvi.dwMinorVersion == 0)
+ {
+ if (osvi.wProductType == VER_NT_WORKSTATION)
+ {
+ res += "Microsoft Windows 10";
+ }
+ else
+ {
+ res += "Microsoft Windows Server 2016 family";
+ }
+ }
+
+ if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 3)
+ {
+ if (osvi.wProductType == VER_NT_WORKSTATION)
+ {
+ res += "Microsoft Windows 8.1";
+ }
+ else
+ {
+ res += "Microsoft Windows Server 2012 R2 family";
+ }
+ }
+
+ if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2)
+ {
+ if (osvi.wProductType == VER_NT_WORKSTATION)
+ {
+ res += "Microsoft Windows 8";
+ }
+ else
+ {
+ res += "Microsoft Windows Server 2012 family";
+ }
+ }
+
+ if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)
+ {
+ if (osvi.wProductType == VER_NT_WORKSTATION)
+ {
+ res += "Microsoft Windows 7";
+ }
+ else
+ {
+ res += "Microsoft Windows Server 2008 R2 family";
+ }
+ }
if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
{
-#if (_MSC_VER >= 1300)
if (osvi.wProductType == VER_NT_WORKSTATION)
{
res += "Microsoft Windows Vista";
@@ -4876,9 +4964,6 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
{
res += "Microsoft Windows Server 2008 family";
}
-#else
- res += "Microsoft Windows Vista or Windows Server 2008";
-#endif
}
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
@@ -4907,7 +4992,6 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
{
// Test for the workstation type.
-#if (_MSC_VER >= 1300)
if (osvi.wProductType == VER_NT_WORKSTATION)
{
if (osvi.dwMajorVersion == 4)
@@ -4979,7 +5063,6 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
}
}
}
-#endif // Visual Studio 7 and up
}
// Test for specific product on Windows NT 4.0 SP5 and earlier
@@ -5117,9 +5200,9 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
}
// ----------------------------------------------------------------------
-bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
- kwsys_stl::string& protocol,
- kwsys_stl::string& dataglom )
+bool SystemTools::ParseURLProtocol( const std::string& URL,
+ std::string& protocol,
+ std::string& dataglom )
{
// match 0 entire url
// match 1 protocol
@@ -5135,13 +5218,13 @@ bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
}
// ----------------------------------------------------------------------
-bool SystemTools::ParseURL( const kwsys_stl::string& URL,
- kwsys_stl::string& protocol,
- kwsys_stl::string& username,
- kwsys_stl::string& password,
- kwsys_stl::string& hostname,
- kwsys_stl::string& dataport,
- kwsys_stl::string& database )
+bool SystemTools::ParseURL( const std::string& URL,
+ std::string& protocol,
+ std::string& username,
+ std::string& password,
+ std::string& hostname,
+ std::string& dataport,
+ std::string& database )
{
kwsys::RegularExpression urlRe( VTK_URL_REGEX );
if ( ! urlRe.find( URL ) ) return false;
@@ -5246,13 +5329,13 @@ void SystemTools::ClassInitialize()
// The current working directory may be a logical path. Find
// the shortest logical path that still produces the correct
// physical path.
- kwsys_stl::string cwd_changed;
- kwsys_stl::string pwd_changed;
+ std::string cwd_changed;
+ std::string pwd_changed;
// Test progressively shorter logical-to-physical mappings.
- kwsys_stl::string pwd_str = pwd;
- kwsys_stl::string cwd_str = cwd;
- kwsys_stl::string pwd_path;
+ std::string pwd_str = pwd;
+ std::string cwd_str = cwd;
+ std::string pwd_path;
Realpath(pwd, pwd_path);
while(cwd_str == pwd_path && cwd_str != pwd_str)
{
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 7899141..d2d1d40 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -12,21 +12,25 @@
#ifndef @KWSYS_NAMESPACE@_SystemTools_hxx
#define @KWSYS_NAMESPACE@_SystemTools_hxx
-#include <@KWSYS_NAMESPACE@/ios/iosfwd>
-#include <@KWSYS_NAMESPACE@/stl/string>
-#include <@KWSYS_NAMESPACE@/stl/vector>
-#include <@KWSYS_NAMESPACE@/stl/map>
+#include <@KWSYS_NAMESPACE@/Configure.hxx>
+
+#include <iosfwd>
+#include <string>
+#include <vector>
+#include <map>
-#include <@KWSYS_NAMESPACE@/Configure.h>
#include <@KWSYS_NAMESPACE@/String.hxx>
#include <sys/types.h>
+#if !defined(_WIN32) || defined(__CYGWIN__)
+# include <unistd.h> // For access permissions for use with access()
+#endif
// Required for va_list
#include <stdarg.h>
// Required for FILE*
#include <stdio.h>
-#if @KWSYS_NAMESPACE@_STL_HAVE_STD && !defined(va_list)
+#if !defined(va_list)
// Some compilers move va_list into the std namespace and there is no way to
// tell that this has been done. Playing with things being included before or
// after stdarg.h does not solve things because we do not have control over
@@ -44,12 +48,6 @@ namespace @KWSYS_NAMESPACE@
}
#endif // va_list
-/* Define these macros temporarily to keep the code readable. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE@_stl
-# define kwsys_ios @KWSYS_NAMESPACE@_ios
-#endif
-
namespace @KWSYS_NAMESPACE@
{
@@ -68,10 +66,28 @@ public:
};
// This instance will show up in any translation unit that uses
-// SystemTools. It will make sure SystemTools is initialized
+// SystemTools. It will make sure SystemTools is initialized
// before it is used and is the last static object destroyed.
static SystemToolsManager SystemToolsManagerInstance;
+// Flags for use with TestFileAccess. Use a typedef in case any operating
+// system in the future needs a special type. These are flags that may be
+// combined using the | operator.
+typedef int TestFilePermissions;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ // On Windows (VC and Borland), no system header defines these constants...
+ static const TestFilePermissions TEST_FILE_OK = 0;
+ static const TestFilePermissions TEST_FILE_READ = 4;
+ static const TestFilePermissions TEST_FILE_WRITE = 2;
+ static const TestFilePermissions TEST_FILE_EXECUTE = 1;
+#else
+ // Standard POSIX constants
+ static const TestFilePermissions TEST_FILE_OK = F_OK;
+ static const TestFilePermissions TEST_FILE_READ = R_OK;
+ static const TestFilePermissions TEST_FILE_WRITE = W_OK;
+ static const TestFilePermissions TEST_FILE_EXECUTE = X_OK;
+#endif
+
/** \class SystemTools
* \brief A collection of useful platform-independent system functions.
*/
@@ -91,9 +107,9 @@ public:
* then an underscore is prepended. Note that this can produce
* identifiers that the standard reserves (_[A-Z].* and __.*).
*/
- static kwsys_stl::string MakeCidentifier(const kwsys_stl::string& s);
+ static std::string MakeCidentifier(const std::string& s);
- static kwsys_stl::string MakeCindentifier(const kwsys_stl::string& s)
+ static std::string MakeCindentifier(const std::string& s)
{
return MakeCidentifier(s);
}
@@ -101,46 +117,46 @@ public:
/**
* Replace replace all occurences of the string in the source string.
*/
- static void ReplaceString(kwsys_stl::string& source,
+ static void ReplaceString(std::string& source,
const char* replace,
const char* with);
- static void ReplaceString(kwsys_stl::string& source,
- const kwsys_stl::string& replace,
- const kwsys_stl::string& with);
+ static void ReplaceString(std::string& source,
+ const std::string& replace,
+ const std::string& with);
/**
* Return a capitalized string (i.e the first letter is uppercased,
* all other are lowercased).
*/
- static kwsys_stl::string Capitalized(const kwsys_stl::string&);
-
+ static std::string Capitalized(const std::string&);
+
/**
* Return a 'capitalized words' string (i.e the first letter of each word
* is uppercased all other are left untouched though).
*/
- static kwsys_stl::string CapitalizedWords(const kwsys_stl::string&);
-
+ static std::string CapitalizedWords(const std::string&);
+
/**
* Return a 'uncapitalized words' string (i.e the first letter of each word
* is lowercased all other are left untouched though).
*/
- static kwsys_stl::string UnCapitalizedWords(const kwsys_stl::string&);
-
+ static std::string UnCapitalizedWords(const std::string&);
+
/**
* Return a lower case string
*/
- static kwsys_stl::string LowerCase(const kwsys_stl::string&);
-
+ static std::string LowerCase(const std::string&);
+
/**
* Return a lower case string
*/
- static kwsys_stl::string UpperCase(const kwsys_stl::string&);
-
+ static std::string UpperCase(const std::string&);
+
/**
* Count char in string
*/
static size_t CountChar(const char* str, char c);
-
+
/**
* Remove some characters from a string.
* Return a pointer to the new resulting string (allocated with 'new')
@@ -152,52 +168,52 @@ public:
* Return a pointer to the new resulting string (allocated with 'new')
*/
static char* RemoveCharsButUpperHex(const char* str);
-
+
/**
* Replace some characters by another character in a string (in-place)
* Return a pointer to string
*/
static char* ReplaceChars(char* str, const char *toreplace,char replacement);
-
+
/**
* Returns true if str1 starts (respectively ends) with str2
*/
static bool StringStartsWith(const char* str1, const char* str2);
- static bool StringStartsWith(const kwsys_stl::string& str1, const char* str2);
+ static bool StringStartsWith(const std::string& str1, const char* str2);
static bool StringEndsWith(const char* str1, const char* str2);
- static bool StringEndsWith(const kwsys_stl::string& str1, const char* str2);
+ static bool StringEndsWith(const std::string& str1, const char* str2);
/**
* Returns a pointer to the last occurence of str2 in str1
*/
static const char* FindLastString(const char* str1, const char* str2);
-
+
/**
* Make a duplicate of the string similar to the strdup C function
* but use new to create the 'new' string, so one can use
* 'delete' to remove it. Returns 0 if the input is empty.
*/
static char* DuplicateString(const char* str);
-
+
/**
* Return the string cropped to a given length by removing chars in the
* center of the string and replacing them with an ellipsis (...)
*/
- static kwsys_stl::string CropString(const kwsys_stl::string&,size_t max_len);
-
+ static std::string CropString(const std::string&,size_t max_len);
+
/** split a path by separator into an array of strings, default is /.
If isPath is true then the string is treated like a path and if
s starts with a / then the first element of the returned array will
be /, so /foo/bar will be [/, foo, bar]
- */
- static kwsys_stl::vector<String> SplitString(const kwsys_stl::string& s, char separator = '/',
+ */
+ static std::vector<String> SplitString(const std::string& s, char separator = '/',
bool isPath = false);
/**
* Perform a case-independent string comparison
*/
static int Strucmp(const char *s1, const char *s2);
- /**
+ /**
* Convert a string in __DATE__ or __TIMESTAMP__ format into a time_t.
* Return false on error, true on success
*/
@@ -208,16 +224,16 @@ public:
* Split a string on its newlines into multiple lines
* Return false only if the last line stored had no newline
*/
- static bool Split(const kwsys_stl::string& s, kwsys_stl::vector<kwsys_stl::string>& l);
- static bool Split(const kwsys_stl::string& s, kwsys_stl::vector<kwsys_stl::string>& l, char separator);
-
- /**
+ static bool Split(const std::string& s, std::vector<std::string>& l);
+ static bool Split(const std::string& s, std::vector<std::string>& l, char separator);
+
+ /**
* Return string with space added between capitalized words
* (i.e. EatMyShorts becomes Eat My Shorts )
- * (note that IEatShorts becomes IEat Shorts)
+ * (note that IEatShorts becomes IEat Shorts)
*/
- static kwsys_stl::string AddSpaceBetweenCapitalizedWords(
- const kwsys_stl::string&);
+ static std::string AddSpaceBetweenCapitalizedWords(
+ const std::string&);
/**
* Append two or more strings and produce new one.
@@ -244,7 +260,7 @@ public:
/**
* Escape specific characters in 'str'.
*/
- static kwsys_stl::string EscapeChars(
+ static std::string EscapeChars(
const char *str, const char *chars_to_escape, char escape_char = '\\');
/** -----------------------------------------------------------------
@@ -255,7 +271,7 @@ public:
/**
* Replace Windows file system slashes with Unix-style slashes.
*/
- static void ConvertToUnixSlashes(kwsys_stl::string& path);
+ static void ConvertToUnixSlashes(std::string& path);
#ifdef _WIN32
/**
@@ -265,20 +281,20 @@ public:
* will be prefixed with \\?\UNC\. All output will also be converted to
* absolute paths with Windows-style backslashes.
**/
- static kwsys_stl::wstring ConvertToWindowsExtendedPath(const kwsys_stl::string&);
+ static std::wstring ConvertToWindowsExtendedPath(const std::string&);
#endif
/**
* For windows this calls ConvertToWindowsOutputPath and for unix
* it calls ConvertToUnixOutputPath
*/
- static kwsys_stl::string ConvertToOutputPath(const kwsys_stl::string&);
+ static std::string ConvertToOutputPath(const std::string&);
/**
* Convert the path to a string that can be used in a unix makefile.
* double slashes are removed, and spaces are escaped.
*/
- static kwsys_stl::string ConvertToUnixOutputPath(const kwsys_stl::string&);
+ static std::string ConvertToUnixOutputPath(const std::string&);
/**
* Convert the path to string that can be used in a windows project or
@@ -286,18 +302,35 @@ public:
* the string, the slashes are converted to windows style backslashes, and
* if there are spaces in the string it is double quoted.
*/
- static kwsys_stl::string ConvertToWindowsOutputPath(const kwsys_stl::string&);
+ static std::string ConvertToWindowsOutputPath(const std::string&);
/**
* Return true if a file exists in the current directory.
- * If isFile = true, then make sure the file is a file and
+ * If isFile = true, then make sure the file is a file and
* not a directory. If isFile = false, then return true
- * if it is a file or a directory.
+ * if it is a file or a directory. Note that the file will
+ * also be checked for read access. (Currently, this check
+ * for read access is only done on POSIX systems.)
*/
static bool FileExists(const char* filename, bool isFile);
- static bool FileExists(const kwsys_stl::string& filename, bool isFile);
+ static bool FileExists(const std::string& filename, bool isFile);
static bool FileExists(const char* filename);
- static bool FileExists(const kwsys_stl::string& filename);
+ static bool FileExists(const std::string& filename);
+
+ /**
+ * Test if a file exists and can be accessed with the requested
+ * permissions. Symbolic links are followed. Returns true if
+ * the access test was successful.
+ *
+ * On POSIX systems (including Cygwin), this maps to the access
+ * function. On Windows systems, all existing files are
+ * considered readable, and writable files are considered to
+ * have the read-only file attribute cleared.
+ */
+ static bool TestFileAccess(const char* filename,
+ TestFilePermissions permissions);
+ static bool TestFileAccess(const std::string& filename,
+ TestFilePermissions permissions);
/**
* Converts Cygwin path to Win32 path. Uses dictionary container for
@@ -311,21 +344,21 @@ public:
/**
* Return file length
*/
- static unsigned long FileLength(const kwsys_stl::string& filename);
+ static unsigned long FileLength(const std::string& filename);
/**
Change the modification time or create a file
*/
- static bool Touch(const kwsys_stl::string& filename, bool create);
-
+ static bool Touch(const std::string& filename, bool create);
+
/**
* Compare file modification times.
* Return true for successful comparison and false for error.
* When true is returned, result has -1, 0, +1 for
* f1 older, same, or newer than f2.
*/
- static bool FileTimeCompare(const kwsys_stl::string& f1,
- const kwsys_stl::string& f2,
+ static bool FileTimeCompare(const std::string& f1,
+ const std::string& f2,
int* result);
/**
@@ -340,17 +373,17 @@ public:
* does not exist path is returned unchanged. This does nothing
* on unix but return path.
*/
- static kwsys_stl::string GetActualCaseForPath(const kwsys_stl::string& path);
+ static std::string GetActualCaseForPath(const std::string& path);
/**
* Given the path to a program executable, get the directory part of
* the path with the file stripped off. If there is no directory
* part, the empty string is returned.
*/
- static kwsys_stl::string GetProgramPath(const kwsys_stl::string&);
- static bool SplitProgramPath(const kwsys_stl::string& in_name,
- kwsys_stl::string& dir,
- kwsys_stl::string& file,
+ static std::string GetProgramPath(const std::string&);
+ static bool SplitProgramPath(const std::string& in_name,
+ std::string& dir,
+ std::string& file,
bool errorReport = true);
/**
@@ -360,14 +393,14 @@ public:
* to the running executable. If argv0 is not a full path,
* then this will try to find the full path. If the path is not
* found false is returned, if found true is returned. An error
- * message of the attempted paths is stored in errorMsg.
+ * message of the attempted paths is stored in errorMsg.
* exeName is the name of the executable.
* buildDir is a possibly null path to the build directory.
* installPrefix is a possibly null pointer to the install directory.
*/
static bool FindProgramPath(const char* argv0,
- kwsys_stl::string& pathOut,
- kwsys_stl::string& errorMsg,
+ std::string& pathOut,
+ std::string& errorMsg,
const char* exeName = 0,
const char* buildDir = 0,
const char* installPrefix = 0);
@@ -378,21 +411,21 @@ public:
* (which defaults to the current working directory). The full path
* is returned.
*/
- static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative);
- static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative,
+ static std::string CollapseFullPath(const std::string& in_relative);
+ static std::string CollapseFullPath(const std::string& in_relative,
const char* in_base);
- static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative,
- const kwsys_stl::string& in_base);
+ static std::string CollapseFullPath(const std::string& in_relative,
+ const std::string& in_base);
- /**
+ /**
* Get the real path for a given path, removing all symlinks. In
* the event of an error (non-existent path, permissions issue,
* etc.) the original path is returned if errorMessage pointer is
* NULL. Otherwise empty string is returned and errorMessage
* contains error description.
*/
- static kwsys_stl::string GetRealPath(const kwsys_stl::string& path,
- kwsys_stl::string* errorMessage = 0);
+ static std::string GetRealPath(const std::string& path,
+ std::string* errorMessage = 0);
/**
* Split a path name into its root component and the rest of the
@@ -410,7 +443,7 @@ public:
* given.
*/
static const char* SplitPathRootComponent(const std::string& p,
- kwsys_stl::string* root=0);
+ std::string* root=0);
/**
* Split a path name into its basic components. The first component
@@ -423,77 +456,77 @@ public:
* platform supports them.
*/
static void SplitPath(const std::string& p,
- kwsys_stl::vector<kwsys_stl::string>& components,
+ std::vector<std::string>& components,
bool expand_home_dir = true);
/**
* Join components of a path name into a single string. See
* SplitPath for the format of the components.
*/
- static kwsys_stl::string JoinPath(
- const kwsys_stl::vector<kwsys_stl::string>& components);
- static kwsys_stl::string JoinPath(
- kwsys_stl::vector<kwsys_stl::string>::const_iterator first,
- kwsys_stl::vector<kwsys_stl::string>::const_iterator last);
+ static std::string JoinPath(
+ const std::vector<std::string>& components);
+ static std::string JoinPath(
+ std::vector<std::string>::const_iterator first,
+ std::vector<std::string>::const_iterator last);
/**
* Compare a path or components of a path.
*/
- static bool ComparePath(const kwsys_stl::string& c1, const kwsys_stl::string& c2);
+ static bool ComparePath(const std::string& c1, const std::string& c2);
/**
* Return path of a full filename (no trailing slashes)
*/
- static kwsys_stl::string GetFilenamePath(const kwsys_stl::string&);
+ static std::string GetFilenamePath(const std::string&);
/**
* Return file name of a full filename (i.e. file name without path)
*/
- static kwsys_stl::string GetFilenameName(const kwsys_stl::string&);
+ static std::string GetFilenameName(const std::string&);
/**
* Split a program from its arguments and handle spaces in the paths
*/
static void SplitProgramFromArgs(
- const kwsys_stl::string& path,
- kwsys_stl::string& program, kwsys_stl::string& args);
+ const std::string& path,
+ std::string& program, std::string& args);
/**
* Return longest file extension of a full filename (dot included)
*/
- static kwsys_stl::string GetFilenameExtension(const kwsys_stl::string&);
+ static std::string GetFilenameExtension(const std::string&);
/**
* Return shortest file extension of a full filename (dot included)
*/
- static kwsys_stl::string GetFilenameLastExtension(
- const kwsys_stl::string& filename);
-
+ static std::string GetFilenameLastExtension(
+ const std::string& filename);
+
/**
* Return file name without extension of a full filename
*/
- static kwsys_stl::string GetFilenameWithoutExtension(
- const kwsys_stl::string&);
-
+ static std::string GetFilenameWithoutExtension(
+ const std::string&);
+
/**
* Return file name without its last (shortest) extension
*/
- static kwsys_stl::string GetFilenameWithoutLastExtension(
- const kwsys_stl::string&);
-
+ static std::string GetFilenameWithoutLastExtension(
+ const std::string&);
+
/**
* Return whether the path represents a full path (not relative)
*/
- static bool FileIsFullPath(const kwsys_stl::string&);
+ static bool FileIsFullPath(const std::string&);
static bool FileIsFullPath(const char*);
-
+
/**
* For windows return the short path for the given path,
* Unix just a pass through
*/
- static bool GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& result);
-
+ static bool GetShortPath(const std::string& path, std::string& result);
+
/**
* Read line from file. Make sure to get everything. Due to a buggy stream
* library on the HP and another on Mac OS X, we need this very carefully
@@ -501,20 +534,20 @@ public:
* end-of-file was reached. If the has_newline argument is specified, it will
* be true when the line read had a newline character.
*/
- static bool GetLineFromStream(kwsys_ios::istream& istr,
- kwsys_stl::string& line,
+ static bool GetLineFromStream(std::istream& istr,
+ std::string& line,
bool* has_newline=0,
long sizeLimit=-1);
/**
* Get the parent directory of the directory or file
*/
- static kwsys_stl::string GetParentDirectory(const kwsys_stl::string& fileOrDir);
+ static std::string GetParentDirectory(const std::string& fileOrDir);
/**
* Check if the given file or directory is in subdirectory of dir
*/
- static bool IsSubDirectory(const kwsys_stl::string& fileOrDir, const kwsys_stl::string& dir);
+ static bool IsSubDirectory(const std::string& fileOrDir, const std::string& dir);
/** -----------------------------------------------------------------
* File Manipulation Routines
@@ -524,44 +557,44 @@ public:
/**
* Open a file considering unicode.
*/
- static FILE* Fopen(const kwsys_stl::string& file, const char* mode);
+ static FILE* Fopen(const std::string& file, const char* mode);
/**
* Make a new directory if it is not there. This function
* can make a full path even if none of the directories existed
- * prior to calling this function.
+ * prior to calling this function.
*/
static bool MakeDirectory(const char* path);
- static bool MakeDirectory(const kwsys_stl::string& path);
+ static bool MakeDirectory(const std::string& path);
/**
* Copy the source file to the destination file only
* if the two files differ.
*/
- static bool CopyFileIfDifferent(const kwsys_stl::string& source,
- const kwsys_stl::string& destination);
+ static bool CopyFileIfDifferent(const std::string& source,
+ const std::string& destination);
/**
* Compare the contents of two files. Return true if different
*/
- static bool FilesDiffer(const kwsys_stl::string& source, const kwsys_stl::string& destination);
+ static bool FilesDiffer(const std::string& source, const std::string& destination);
/**
* Return true if the two files are the same file
*/
- static bool SameFile(const kwsys_stl::string& file1, const kwsys_stl::string& file2);
+ static bool SameFile(const std::string& file1, const std::string& file2);
/**
* Copy a file.
*/
- static bool CopyFileAlways(const kwsys_stl::string& source, const kwsys_stl::string& destination);
+ static bool CopyFileAlways(const std::string& source, const std::string& destination);
/**
* Copy a file. If the "always" argument is true the file is always
* copied. If it is false, the file is copied only if it is new or
* has changed.
*/
- static bool CopyAFile(const kwsys_stl::string& source, const kwsys_stl::string& destination,
+ static bool CopyAFile(const std::string& source, const std::string& destination,
bool always = true);
/**
@@ -570,18 +603,18 @@ public:
* always copied. If it is false, only files that have changed or
* are new are copied.
*/
- static bool CopyADirectory(const kwsys_stl::string& source, const kwsys_stl::string& destination,
+ static bool CopyADirectory(const std::string& source, const std::string& destination,
bool always = true);
-
+
/**
* Remove a file
*/
- static bool RemoveFile(const kwsys_stl::string& source);
-
+ static bool RemoveFile(const std::string& source);
+
/**
* Remove a directory
*/
- static bool RemoveADirectory(const kwsys_stl::string& source);
+ static bool RemoveADirectory(const std::string& source);
/**
* Get the maximum full file path length
@@ -591,57 +624,57 @@ public:
/**
* Find a file in the system PATH, with optional extra paths
*/
- static kwsys_stl::string FindFile(
- const kwsys_stl::string& name,
- const kwsys_stl::vector<kwsys_stl::string>& path =
- kwsys_stl::vector<kwsys_stl::string>(),
+ static std::string FindFile(
+ const std::string& name,
+ const std::vector<std::string>& path =
+ std::vector<std::string>(),
bool no_system_path = false);
/**
* Find a directory in the system PATH, with optional extra paths
*/
- static kwsys_stl::string FindDirectory(
- const kwsys_stl::string& name,
- const kwsys_stl::vector<kwsys_stl::string>& path =
- kwsys_stl::vector<kwsys_stl::string>(),
+ static std::string FindDirectory(
+ const std::string& name,
+ const std::vector<std::string>& path =
+ std::vector<std::string>(),
bool no_system_path = false);
/**
* Find an executable in the system PATH, with optional extra paths
*/
- static kwsys_stl::string FindProgram(
+ static std::string FindProgram(
const char* name,
- const kwsys_stl::vector<kwsys_stl::string>& path =
- kwsys_stl::vector<kwsys_stl::string>(),
+ const std::vector<std::string>& path =
+ std::vector<std::string>(),
bool no_system_path = false);
- static kwsys_stl::string FindProgram(
- const kwsys_stl::string& name,
- const kwsys_stl::vector<kwsys_stl::string>& path =
- kwsys_stl::vector<kwsys_stl::string>(),
+ static std::string FindProgram(
+ const std::string& name,
+ const std::vector<std::string>& path =
+ std::vector<std::string>(),
bool no_system_path = false);
- static kwsys_stl::string FindProgram(
- const kwsys_stl::vector<kwsys_stl::string>& names,
- const kwsys_stl::vector<kwsys_stl::string>& path =
- kwsys_stl::vector<kwsys_stl::string>(),
+ static std::string FindProgram(
+ const std::vector<std::string>& names,
+ const std::vector<std::string>& path =
+ std::vector<std::string>(),
bool no_system_path = false);
/**
* Find a library in the system PATH, with optional extra paths
*/
- static kwsys_stl::string FindLibrary(
- const kwsys_stl::string& name,
- const kwsys_stl::vector<kwsys_stl::string>& path);
-
+ static std::string FindLibrary(
+ const std::string& name,
+ const std::vector<std::string>& path);
+
/**
* Return true if the file is a directory
*/
- static bool FileIsDirectory(const kwsys_stl::string& name);
-
+ static bool FileIsDirectory(const std::string& name);
+
/**
* Return true if the file is a symlink
*/
- static bool FileIsSymlink(const kwsys_stl::string& name);
-
+ static bool FileIsSymlink(const std::string& name);
+
/**
* Return true if the file has a given signature (first set of bytes)
*/
@@ -657,28 +690,28 @@ public:
* The algorithm is simplistic, and should probably check for usual file
* extensions, 'magic' signature, unicode, etc.
*/
- enum FileTypeEnum
- {
+ enum FileTypeEnum
+ {
FileTypeUnknown,
FileTypeBinary,
FileTypeText
};
static SystemTools::FileTypeEnum DetectFileType(
- const char* filename,
- unsigned long length = 256,
+ const char* filename,
+ unsigned long length = 256,
double percent_bin = 0.05);
/**
* Create a symbolic link if the platform supports it. Returns whether
* creation succeded.
*/
- static bool CreateSymlink(const kwsys_stl::string& origName, const kwsys_stl::string& newName);
+ static bool CreateSymlink(const std::string& origName, const std::string& newName);
/**
* Read the contents of a symbolic link. Returns whether reading
* succeded.
*/
- static bool ReadSymlink(const kwsys_stl::string& newName, kwsys_stl::string& origName);
+ static bool ReadSymlink(const std::string& newName, std::string& origName);
/**
* Try to locate the file 'filename' in the directory 'dir'.
@@ -690,47 +723,55 @@ public:
* 'filename_found' is assigned the fully qualified name/path of the file
* if it is found (not touched otherwise).
* If 'try_filename_dirs' is true, try to find the file using the
- * components of its path, i.e. if we are looking for c:/foo/bar/bill.txt,
+ * components of its path, i.e. if we are looking for c:/foo/bar/bill.txt,
* first look for bill.txt in 'dir', then in 'dir'/bar, then in 'dir'/foo/bar
* etc.
* Return true if the file was found, false otherwise.
*/
- static bool LocateFileInDir(const char *filename,
- const char *dir,
- kwsys_stl::string& filename_found,
+ static bool LocateFileInDir(const char *filename,
+ const char *dir,
+ std::string& filename_found,
int try_filename_dirs = 0);
- /** compute the relative path from local to remote. local must
- be a directory. remote can be a file or a directory.
+ /** compute the relative path from local to remote. local must
+ be a directory. remote can be a file or a directory.
Both remote and local must be full paths. Basically, if
you are in directory local and you want to access the file in remote
what is the relative path to do that. For example:
/a/b/c/d to /a/b/c1/d1 -> ../../c1/d1
from /usr/src to /usr/src/test/blah/foo.cpp -> test/blah/foo.cpp
*/
- static kwsys_stl::string RelativePath(const kwsys_stl::string& local, const kwsys_stl::string& remote);
+ static std::string RelativePath(const std::string& local, const std::string& remote);
/**
* Return file's modified time
*/
- static long int ModifiedTime(const kwsys_stl::string& filename);
+ static long int ModifiedTime(const std::string& filename);
/**
* Return file's creation time (Win32: works only for NTFS, not FAT)
*/
- static long int CreationTime(const kwsys_stl::string& filename);
+ static long int CreationTime(const std::string& filename);
+ /**
+ * Visual C++ does not define mode_t (note that Borland does, however).
+ */
#if defined( _MSC_VER )
typedef unsigned short mode_t;
#endif
/**
- * Get and set permissions of the file.
+ * Get and set permissions of the file. If honor_umask is set, the umask
+ * is queried and applied to the given permissions. Returns false if
+ * failure.
+ *
+ * WARNING: A non-thread-safe method is currently used to get the umask
+ * if a honor_umask parameter is set to true.
*/
static bool GetPermissions(const char* file, mode_t& mode);
- static bool GetPermissions(const kwsys_stl::string& file, mode_t& mode);
- static bool SetPermissions(const char* file, mode_t mode);
- static bool SetPermissions(const kwsys_stl::string& file, mode_t mode);
+ static bool GetPermissions(const std::string& file, mode_t& mode);
+ static bool SetPermissions(const char* file, mode_t mode, bool honor_umask = false);
+ static bool SetPermissions(const std::string& file, mode_t mode, bool honor_umask = false);
/** -----------------------------------------------------------------
* Time Manipulation Routines
@@ -743,7 +784,7 @@ public:
/**
* Get current date/time
*/
- static kwsys_stl::string GetCurrentDateTime(const char* format);
+ static std::string GetCurrentDateTime(const char* format);
/** -----------------------------------------------------------------
* Registry Manipulation Routines
@@ -760,26 +801,26 @@ public:
/**
* Get a list of subkeys.
*/
- static bool GetRegistrySubKeys(const kwsys_stl::string& key,
- kwsys_stl::vector<kwsys_stl::string>& subkeys,
+ static bool GetRegistrySubKeys(const std::string& key,
+ std::vector<std::string>& subkeys,
KeyWOW64 view = KeyWOW64_Default);
/**
* Read a registry value
*/
- static bool ReadRegistryValue(const kwsys_stl::string& key, kwsys_stl::string &value,
+ static bool ReadRegistryValue(const std::string& key, std::string &value,
KeyWOW64 view = KeyWOW64_Default);
/**
* Write a registry value
*/
- static bool WriteRegistryValue(const kwsys_stl::string& key, const kwsys_stl::string& value,
+ static bool WriteRegistryValue(const std::string& key, const std::string& value,
KeyWOW64 view = KeyWOW64_Default);
/**
* Delete a registry value
*/
- static bool DeleteRegistryValue(const kwsys_stl::string& key,
+ static bool DeleteRegistryValue(const std::string& key,
KeyWOW64 view = KeyWOW64_Default);
/** -----------------------------------------------------------------
@@ -792,39 +833,39 @@ public:
* string vector passed in. If env is set then the value
* of env will be used instead of PATH.
*/
- static void GetPath(kwsys_stl::vector<kwsys_stl::string>& path,
+ static void GetPath(std::vector<std::string>& path,
const char* env=0);
/**
* Read an environment variable
*/
static const char* GetEnv(const char* key);
- static const char* GetEnv(const kwsys_stl::string& key);
- static bool GetEnv(const char* key, kwsys_stl::string& result);
- static bool GetEnv(const kwsys_stl::string& key, kwsys_stl::string& result);
+ static const char* GetEnv(const std::string& key);
+ static bool GetEnv(const char* key, std::string& result);
+ static bool GetEnv(const std::string& key, std::string& result);
/** Put a string into the environment
of the form var=value */
- static bool PutEnv(const kwsys_stl::string& env);
+ static bool PutEnv(const std::string& env);
/** Remove a string from the environment.
Input is of the form "var" or "var=value" (value is ignored). */
- static bool UnPutEnv(const kwsys_stl::string& env);
+ static bool UnPutEnv(const std::string& env);
/**
* Get current working directory CWD
*/
- static kwsys_stl::string GetCurrentWorkingDirectory(bool collapse =true);
+ static std::string GetCurrentWorkingDirectory(bool collapse =true);
/**
* Change directory to the directory specified
*/
- static int ChangeDirectory(const kwsys_stl::string& dir);
+ static int ChangeDirectory(const std::string& dir);
/**
* Get the result of strerror(errno)
*/
- static kwsys_stl::string GetLastSystemError();
+ static std::string GetLastSystemError();
/**
* When building DEBUG with MSVC, this enables a hook that prevents
@@ -843,18 +884,18 @@ public:
/**
* Add an entry in the path translation table.
*/
- static void AddTranslationPath(const kwsys_stl::string& dir, const kwsys_stl::string& refdir);
+ static void AddTranslationPath(const std::string& dir, const std::string& refdir);
/**
* If dir is different after CollapseFullPath is called,
* Then insert it into the path translation table
*/
- static void AddKeepPath(const kwsys_stl::string& dir);
+ static void AddKeepPath(const std::string& dir);
/**
* Update path by going through the Path Translation table;
*/
- static void CheckTranslationPath(kwsys_stl::string & path);
+ static void CheckTranslationPath(std::string & path);
/**
* Delay the execution for a specified amount of time specified
@@ -866,7 +907,7 @@ public:
* Get the operating system name and version
* This is implemented for Win32 only for the moment
*/
- static kwsys_stl::string GetOperatingSystemNameAndVersion();
+ static std::string GetOperatingSystemNameAndVersion();
/** -----------------------------------------------------------------
* URL Manipulation Routines
@@ -879,9 +920,9 @@ public:
* and fill protocol as appropriate.
* Return false if the URL does not have the required form, true otherwise.
*/
- static bool ParseURLProtocol( const kwsys_stl::string& URL,
- kwsys_stl::string& protocol,
- kwsys_stl::string& dataglom );
+ static bool ParseURLProtocol( const std::string& URL,
+ std::string& protocol,
+ std::string& dataglom );
/**
* Parse a string (a URL without protocol prefix) with the form:
@@ -890,13 +931,13 @@ public:
* when values are found.
* Return true if the string matches the format; false otherwise.
*/
- static bool ParseURL( const kwsys_stl::string& URL,
- kwsys_stl::string& protocol,
- kwsys_stl::string& username,
- kwsys_stl::string& password,
- kwsys_stl::string& hostname,
- kwsys_stl::string& dataport,
- kwsys_stl::string& datapath );
+ static bool ParseURL( const std::string& URL,
+ std::string& protocol,
+ std::string& username,
+ std::string& password,
+ std::string& hostname,
+ std::string& dataport,
+ std::string& datapath );
private:
/**
@@ -920,10 +961,10 @@ private:
/**
* Actual implementation of ReplaceString.
*/
- static void ReplaceString(kwsys_stl::string& source,
+ static void ReplaceString(std::string& source,
const char* replace,
size_t replaceSize,
- const kwsys_stl::string& with);
+ const std::string& with);
/**
* Actual implementation of FileIsFullPath.
@@ -934,10 +975,10 @@ private:
* Find a filename (file or directory) in the system PATH, with
* optional extra paths.
*/
- static kwsys_stl::string FindName(
- const kwsys_stl::string& name,
- const kwsys_stl::vector<kwsys_stl::string>& path =
- kwsys_stl::vector<kwsys_stl::string>(),
+ static std::string FindName(
+ const std::string& name,
+ const std::vector<std::string>& path =
+ std::vector<std::string>(),
bool no_system_path = false);
@@ -957,10 +998,4 @@ private:
} // namespace @KWSYS_NAMESPACE@
-/* Undefine temporary macros. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# undef kwsys_stl
-# undef kwsys_ios
-#endif
-
#endif
diff --git a/Source/kwsys/hash_fun.hxx.in b/Source/kwsys/hash_fun.hxx.in
index 6f787dd..4872b51 100644
--- a/Source/kwsys/hash_fun.hxx.in
+++ b/Source/kwsys/hash_fun.hxx.in
@@ -38,8 +38,8 @@
#define @KWSYS_NAMESPACE@_hash_fun_hxx
#include <@KWSYS_NAMESPACE@/Configure.hxx>
-#include <@KWSYS_NAMESPACE@/cstddef> // size_t
-#include <@KWSYS_NAMESPACE@/stl/string> // string
+#include <stddef.h> // size_t
+#include <string>
namespace @KWSYS_NAMESPACE@
{
@@ -55,90 +55,90 @@ inline size_t _stl_hash_string(const char* __s)
return size_t(__h);
}
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<char*> {
size_t operator()(const char* __s) const { return _stl_hash_string(__s); }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<const char*> {
size_t operator()(const char* __s) const { return _stl_hash_string(__s); }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
- struct hash<@KWSYS_NAMESPACE@_stl::string> {
- size_t operator()(const @KWSYS_NAMESPACE@_stl::string & __s) const { return _stl_hash_string(__s.c_str()); }
+template <>
+ struct hash<std::string> {
+ size_t operator()(const std::string & __s) const { return _stl_hash_string(__s.c_str()); }
};
#if !defined(__BORLANDC__)
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
- struct hash<const @KWSYS_NAMESPACE@_stl::string> {
- size_t operator()(const @KWSYS_NAMESPACE@_stl::string & __s) const { return _stl_hash_string(__s.c_str()); }
+template <>
+ struct hash<const std::string> {
+ size_t operator()(const std::string & __s) const { return _stl_hash_string(__s.c_str()); }
};
#endif
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<char> {
size_t operator()(char __x) const { return __x; }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<unsigned char> {
size_t operator()(unsigned char __x) const { return __x; }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<signed char> {
size_t operator()(unsigned char __x) const { return __x; }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<short> {
size_t operator()(short __x) const { return __x; }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<unsigned short> {
size_t operator()(unsigned short __x) const { return __x; }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<int> {
size_t operator()(int __x) const { return __x; }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<unsigned int> {
size_t operator()(unsigned int __x) const { return __x; }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<long> {
size_t operator()(long __x) const { return __x; }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<unsigned long> {
size_t operator()(unsigned long __x) const { return __x; }
};
// use long long or __int64
#if @KWSYS_USE_LONG_LONG@
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<long long> {
size_t operator()(long long __x) const { return __x; }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<unsigned long long> {
size_t operator()(unsigned long long __x) const { return __x; }
};
#elif @KWSYS_USE___INT64@
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<__int64> {
size_t operator()(__int64 __x) const { return __x; }
};
-@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+template <>
struct hash<unsigned __int64> {
size_t operator()(unsigned __int64 __x) const { return __x; }
};
diff --git a/Source/kwsys/hash_map.hxx.in b/Source/kwsys/hash_map.hxx.in
index 6d4379d..60c7086 100644
--- a/Source/kwsys/hash_map.hxx.in
+++ b/Source/kwsys/hash_map.hxx.in
@@ -39,7 +39,7 @@
#include <@KWSYS_NAMESPACE@/hashtable.hxx>
#include <@KWSYS_NAMESPACE@/hash_fun.hxx>
-#include <@KWSYS_NAMESPACE@/stl/functional> // equal_to
+#include <functional> // equal_to
#if defined(_MSC_VER)
# pragma warning (push)
@@ -58,9 +58,9 @@ namespace @KWSYS_NAMESPACE@
// select1st is an extension: it is not part of the standard.
template <class T1, class T2>
struct hash_select1st:
- public @KWSYS_NAMESPACE@_stl::unary_function<@KWSYS_NAMESPACE@_stl::pair<T1, T2>, T1>
+ public std::unary_function<std::pair<T1, T2>, T1>
{
- const T1& operator()(const @KWSYS_NAMESPACE@_stl::pair<T1, T2>& __x) const
+ const T1& operator()(const std::pair<T1, T2>& __x) const
{ return __x.first; }
};
@@ -68,8 +68,8 @@ struct hash_select1st:
template <class _Key, class _Tp,
class _HashFcn = hash<_Key>,
- class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Key>,
- class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) >
+ class _EqualKey = std::equal_to<_Key>,
+ class _Alloc = std::allocator<char> >
class hash_map;
template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
@@ -81,7 +81,7 @@ template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
class hash_map
{
private:
- typedef hashtable<@KWSYS_NAMESPACE@_stl::pair<const _Key,_Tp>,_Key,_HashFcn,
+ typedef hashtable<std::pair<const _Key,_Tp>,_Key,_HashFcn,
hash_select1st<const _Key,_Tp>,_EqualKey,_Alloc> _Ht;
_Ht _M_ht;
@@ -119,7 +119,6 @@ public:
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
-#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
@@ -140,48 +139,14 @@ public:
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
-#else
- hash_map(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
- hash_map(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#endif
-
public:
size_type size() const { return _M_ht.size(); }
size_type max_size() const { return _M_ht.max_size(); }
bool empty() const { return _M_ht.empty(); }
void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); }
- friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_map&,
- const hash_map&);
+ friend bool operator==<>(const hash_map&,
+ const hash_map&);
iterator begin() { return _M_ht.begin(); }
iterator end() { return _M_ht.end(); }
@@ -189,20 +154,12 @@ public:
const_iterator end() const { return _M_ht.end(); }
public:
- @KWSYS_NAMESPACE@_stl::pair<iterator,bool> insert(const value_type& __obj)
+ std::pair<iterator,bool> insert(const value_type& __obj)
{ return _M_ht.insert_unique(__obj); }
-#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_unique(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_unique(__f, __l); }
-#endif
- @KWSYS_NAMESPACE@_stl::pair<iterator,bool> insert_noresize(const value_type& __obj)
+ std::pair<iterator,bool> insert_noresize(const value_type& __obj)
{ return _M_ht.insert_unique_noresize(__obj); }
iterator find(const key_type& __key) { return _M_ht.find(__key); }
@@ -215,9 +172,9 @@ public:
size_type count(const key_type& __key) const { return _M_ht.count(__key); }
- @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key)
+ std::pair<iterator, iterator> equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); }
- @KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator>
+ std::pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
@@ -260,8 +217,8 @@ swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
template <class _Key, class _Tp,
class _HashFcn = hash<_Key>,
- class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Key>,
- class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) >
+ class _EqualKey = std::equal_to<_Key>,
+ class _Alloc = std::allocator<char> >
class hash_multimap;
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
@@ -274,7 +231,7 @@ template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
class hash_multimap
{
private:
- typedef hashtable<@KWSYS_NAMESPACE@_stl::pair<const _Key, _Tp>, _Key, _HashFcn,
+ typedef hashtable<std::pair<const _Key, _Tp>, _Key, _HashFcn,
hash_select1st<const _Key, _Tp>, _EqualKey, _Alloc>
_Ht;
_Ht _M_ht;
@@ -313,7 +270,6 @@ public:
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
-#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
@@ -334,48 +290,14 @@ public:
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
-#else
- hash_multimap(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
- hash_multimap(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#endif
-
public:
size_type size() const { return _M_ht.size(); }
size_type max_size() const { return _M_ht.max_size(); }
bool empty() const { return _M_ht.empty(); }
void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); }
- friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_multimap&,
- const hash_multimap&);
+ friend bool operator==<>(const hash_multimap&,
+ const hash_multimap&);
iterator begin() { return _M_ht.begin(); }
iterator end() { return _M_ht.end(); }
@@ -385,17 +307,9 @@ public:
public:
iterator insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); }
-#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_equal(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_equal(__f, __l); }
-#endif
iterator insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); }
@@ -405,9 +319,9 @@ public:
size_type count(const key_type& __key) const { return _M_ht.count(__key); }
- @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key)
+ std::pair<iterator, iterator> equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); }
- @KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator>
+ std::pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
diff --git a/Source/kwsys/hash_set.hxx.in b/Source/kwsys/hash_set.hxx.in
index 5ee01a5..c314979 100644
--- a/Source/kwsys/hash_set.hxx.in
+++ b/Source/kwsys/hash_set.hxx.in
@@ -39,7 +39,7 @@
#include <@KWSYS_NAMESPACE@/hashtable.hxx>
#include <@KWSYS_NAMESPACE@/hash_fun.hxx>
-#include <@KWSYS_NAMESPACE@/stl/functional> // equal_to
+#include <functional> // equal_to
#if defined(_MSC_VER)
# pragma warning (push)
@@ -57,7 +57,7 @@ namespace @KWSYS_NAMESPACE@
// identity is an extension: it is not part of the standard.
template <class _Tp>
-struct _Identity : public @KWSYS_NAMESPACE@_stl::unary_function<_Tp,_Tp>
+struct _Identity : public std::unary_function<_Tp,_Tp>
{
const _Tp& operator()(const _Tp& __x) const { return __x; }
};
@@ -66,8 +66,8 @@ struct _Identity : public @KWSYS_NAMESPACE@_stl::unary_function<_Tp,_Tp>
template <class _Value,
class _HashFcn = hash<_Value>,
- class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Value>,
- class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) >
+ class _EqualKey = std::equal_to<_Value>,
+ class _Alloc = std::allocator<char> >
class hash_set;
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
@@ -116,7 +116,6 @@ public:
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
-#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
@@ -136,40 +135,6 @@ public:
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
-#else
-
- hash_set(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
- hash_set(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#endif
public:
size_type size() const { return _M_ht.size(); }
@@ -177,43 +142,35 @@ public:
bool empty() const { return _M_ht.empty(); }
void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); }
- friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_set&,
- const hash_set&);
+ friend bool operator==<>(const hash_set&,
+ const hash_set&);
iterator begin() const { return _M_ht.begin(); }
iterator end() const { return _M_ht.end(); }
public:
- @KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert(const value_type& __obj)
+ std::pair<iterator, bool> insert(const value_type& __obj)
{
typedef typename _Ht::iterator _Ht_iterator;
- @KWSYS_NAMESPACE@_stl::pair<_Ht_iterator, bool> __p = _M_ht.insert_unique(__obj);
- return @KWSYS_NAMESPACE@_stl::pair<iterator,bool>(__p.first, __p.second);
+ std::pair<_Ht_iterator, bool> __p = _M_ht.insert_unique(__obj);
+ return std::pair<iterator,bool>(__p.first, __p.second);
}
-#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_unique(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- {_M_ht.insert_unique(__f, __l); }
-#endif
- @KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert_noresize(const value_type& __obj)
+ std::pair<iterator, bool> insert_noresize(const value_type& __obj)
{
typedef typename _Ht::iterator _Ht_iterator;
- @KWSYS_NAMESPACE@_stl::pair<_Ht_iterator, bool> __p =
+ std::pair<_Ht_iterator, bool> __p =
_M_ht.insert_unique_noresize(__obj);
- return @KWSYS_NAMESPACE@_stl::pair<iterator, bool>(__p.first, __p.second);
+ return std::pair<iterator, bool>(__p.first, __p.second);
}
iterator find(const key_type& __key) const { return _M_ht.find(__key); }
size_type count(const key_type& __key) const { return _M_ht.count(__key); }
- @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key) const
+ std::pair<iterator, iterator> equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
@@ -254,8 +211,8 @@ swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
template <class _Value,
class _HashFcn = hash<_Value>,
- class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Value>,
- class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) >
+ class _EqualKey = std::equal_to<_Value>,
+ class _Alloc = std::allocator<char> >
class hash_multiset;
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
@@ -305,7 +262,6 @@ public:
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
-#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
@@ -325,40 +281,6 @@ public:
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
-#else
-
- hash_multiset(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
- hash_multiset(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#endif
public:
size_type size() const { return _M_ht.size(); }
@@ -366,8 +288,8 @@ public:
bool empty() const { return _M_ht.empty(); }
void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); }
- friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_multiset&,
- const hash_multiset&);
+ friend bool operator==<>(const hash_multiset&,
+ const hash_multiset&);
iterator begin() const { return _M_ht.begin(); }
iterator end() const { return _M_ht.end(); }
@@ -375,17 +297,9 @@ public:
public:
iterator insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); }
-#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_equal(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_equal(__f, __l); }
-#endif
iterator insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); }
@@ -393,7 +307,7 @@ public:
size_type count(const key_type& __key) const { return _M_ht.count(__key); }
- @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key) const
+ std::pair<iterator, iterator> equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); }
size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in
index 7e7dc42..9a20226 100644
--- a/Source/kwsys/hashtable.hxx.in
+++ b/Source/kwsys/hashtable.hxx.in
@@ -44,13 +44,13 @@
#include <@KWSYS_NAMESPACE@/Configure.hxx>
-#include <@KWSYS_NAMESPACE@/cstddef> // size_t
-#include <@KWSYS_NAMESPACE@/stl/algorithm> // lower_bound
-#include <@KWSYS_NAMESPACE@/stl/functional> // unary_function
-#include <@KWSYS_NAMESPACE@/stl/iterator> // iterator_traits
-#include <@KWSYS_NAMESPACE@/stl/memory> // allocator
-#include <@KWSYS_NAMESPACE@/stl/utility> // pair
-#include <@KWSYS_NAMESPACE@/stl/vector> // vector
+#include <stddef.h> // size_t
+#include <algorithm> // lower_bound
+#include <functional> // unary_function
+#include <iterator> // iterator_traits
+#include <memory> // allocator
+#include <utility> // pair
+#include <vector> // vector
#if defined(_MSC_VER)
# pragma warning (push)
@@ -73,238 +73,9 @@
# endif
#endif
-#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE
-# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE@_stl::allocator< T >
-#elif @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE
-# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE@_stl::allocator
-#else
-# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE@_stl::alloc
-#endif
-
-#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS
-# define @KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a) _M_buckets(__a)
-# define @KWSYS_NAMESPACE@_HASH_BUCKETS_GET_ALLOCATOR(__b) , __b.get_allocator()
-#else
-# define @KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a) _M_buckets()
-# define @KWSYS_NAMESPACE@_HASH_BUCKETS_GET_ALLOCATOR(__b)
-#endif
-
namespace @KWSYS_NAMESPACE@
{
-//----------------------------------------------------------------------------
-// Define an allocator adaptor for platforms that do not provide an
-// allocator with the rebind member.
-#if !@KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND
-
-// Utility functions to convert item counts.
-inline size_t hash_sizeof(void*) { return sizeof(char); }
-inline size_t hash_sizeof(const void*) { return sizeof(char); }
-template <class TPtr> inline size_t hash_sizeof(TPtr p)
-{
- static_cast<void>(p);
- return sizeof(*p);
-}
-template <class POut, class PIn, class TSize>
-inline TSize hash_allocator_n(POut out, PIn in, TSize n)
-{
- return n*(hash_sizeof(out)/hash_sizeof(in) +
- (hash_sizeof(out)%hash_sizeof(in)>0));
-}
-
-// Define an allocation method to use the native allocator with
-// the proper signature. The following signatures of the allocate
-// method are used on various STL implementations:
-// pointer allocate(size_type, const void* hint)
-// pointer allocate(size_type)
-// static pointer allocate(size_type, const void* hint)
-// static pointer allocate(size_type)
-// Where pointer might be a real type or void*.
-// This set of overloads decodes the signature for a particular STL.
-// The extra three int/long arguments will favor certain signatures
-// over others in the case that multiple are present to avoid
-// ambiguity errors.
-template <class TAlloc, class PIn, class TSize, class THint, class POut>
-inline void hash_allocate(TAlloc* a, PIn (TAlloc::*allocate)(TSize, THint),
- TSize n_out, const void* hint, POut& out,
- int, int, int)
-{
- TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
- void* vout = (a->*allocate)(n_in, const_cast<THint>(hint));
- out = static_cast<POut>(vout);
-}
-
-template <class TAlloc, class PIn, class TSize, class POut>
-inline void hash_allocate(TAlloc* a, PIn (TAlloc::*allocate)(TSize),
- TSize n_out, const void*, POut& out,
- int, int, long)
-{
- TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
- void* vout = (a->*allocate)(n_in);
- out = static_cast<POut>(vout);
-}
-
-template <class PIn, class TSize, class THint, class POut>
-inline void hash_allocate(void*, PIn (*allocate)(TSize, THint),
- TSize n_out, const void* hint, POut& out,
- int, long, long)
-{
- TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
- void* vout = allocate(n_in, const_cast<THint>(hint));
- out = static_cast<POut>(vout);
-}
-
-template <class PIn, class TSize, class POut>
-inline void hash_allocate(void*, PIn (*allocate)(TSize),
- TSize n_out, const void*, POut& out,
- long, long, long)
-{
- TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
- void* vout = allocate(n_in);
- out = static_cast<POut>(vout);
-}
-
-// Define a deallocation method to use the native allocator with
-// the proper signature. The following signatures of the deallocate
-// method are used on various STL implementations:
-// void deallocate(pointer, size_type)
-// void deallocate(pointer)
-// static void deallocate(pointer, size_type)
-// static void deallocate(pointer)
-// Where pointer might be a real type or void*.
-// This set of overloads decodes the signature for a particular STL.
-// The extra three int/long arguments will favor certain signatures
-// over others in the case that multiple are present to avoid
-// ambiguity errors.
-template <class TAlloc, class PIn, class TSize, class PInReal, class POut>
-inline void hash_deallocate(TAlloc* a, void (TAlloc::*deallocate)(PIn, TSize),
- PInReal, POut p, TSize n_out, int, int, int)
-{
- TSize n_in = hash_allocator_n(POut(), PInReal(), n_out);
- void* vout = p;
- (a->*deallocate)(static_cast<PIn>(vout), n_in);
-}
-
-template <class TAlloc, class PIn, class TSize, class PInReal, class POut>
-inline void hash_deallocate(TAlloc* a, void (TAlloc::*deallocate)(PIn),
- PInReal, POut p, TSize, int, int, long)
-{
- void* vout = p;
- (a->*deallocate)(static_cast<PIn>(vout));
-}
-
-template <class PIn, class TSize, class PInReal, class POut>
-inline void hash_deallocate(void*, void (*deallocate)(PIn, TSize),
- PInReal, POut p, TSize n_out, int, long, long)
-{
- TSize n_in = hash_allocator_n(POut(), PInReal(), n_out);
- void* vout = p;
- deallocate(static_cast<PIn>(vout), n_in);
-}
-
-template <class PIn, class TSize, class PInReal, class POut>
-inline void hash_deallocate(void*, void (*deallocate)(PIn),
- PInReal, POut p, TSize, long, long, long)
-{
- void* vout = p;
- deallocate(static_cast<PIn>(vout));
-}
-
-// Use the same four overloads as hash_allocate to decode the type
-// really used for allocation. This is passed as PInReal to the
-// deallocate functions so that hash_allocator_n has the proper size.
-template <class TAlloc, class PIn, class TSize, class THint>
-inline PIn hash_allocate_type(PIn (TAlloc::*)(TSize, THint),
- int, int, int) { return 0; }
-template <class TAlloc, class PIn, class TSize>
-inline PIn hash_allocate_type(PIn (TAlloc::*)(TSize),
- int, int, long) { return 0; }
-template <class PIn, class TSize, class THint>
-inline PIn hash_allocate_type(PIn (*)(TSize, THint),
- int, long, long) { return 0; }
-template <class PIn, class TSize>
-inline PIn hash_allocate_type(PIn (*)(TSize),
- long, long, long) { return 0; }
-
-// Define the comparison operators in terms of a base type to avoid
-// needing templated versions.
-class hash_allocator_base {};
-inline bool operator==(const hash_allocator_base&,
- const hash_allocator_base&) throw() { return true; }
-inline bool operator!=(const hash_allocator_base&,
- const hash_allocator_base&) throw() { return false; }
-
-// Define the allocator template.
-template <class T, class Alloc>
-class hash_allocator: public hash_allocator_base
-{
-private:
- // Store the real allocator privately.
- typedef Alloc alloc_type;
- alloc_type alloc_;
-
-public:
- // Standard allocator interface.
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef T* pointer;
- typedef const T* const_pointer;
- typedef T& reference;
- typedef const T& const_reference;
- typedef T value_type;
-
- hash_allocator() throw(): alloc_() {}
- hash_allocator(const hash_allocator_base&) throw() : alloc_() {}
- hash_allocator(const hash_allocator& a) throw() : alloc_(a.alloc_) {}
- hash_allocator(const alloc_type& a) throw() : alloc_(a) {}
- ~hash_allocator() throw() {}
-# if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
- template <class U>
- struct rebind { typedef hash_allocator<U, alloc_type> other; };
-# endif
- pointer address(reference x) const { return &x; }
- const_pointer address(const_reference x) const { return &x; }
- typedef void* void_pointer;
- typedef const void* const_void_pointer;
- pointer allocate(size_type n=1, const_void_pointer hint = 0)
- {
- if(n)
- {
- pointer p;
- hash_allocate(&alloc_, &alloc_type::allocate, n, hint, p, 1, 1, 1);
- return p;
- }
- else
- {
- return 0;
- }
- }
- void deallocate(pointer p, size_type n=1)
- {
- if(n)
- {
- hash_deallocate(&alloc_, &alloc_type::deallocate,
- hash_allocate_type(&alloc_type::allocate, 1, 1, 1),
- p, n, 1, 1, 1);
- }
- }
-#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
- size_type max_size(size_type s) const throw()
- {
- return alloc_.max_size(s);
- }
-#else
- size_type max_size() const throw()
- {
- size_type n = alloc_.max_size() / sizeof(value_type);
- return n>0? n:1;
- }
-#endif
- void construct(pointer p, const value_type& val) { new (p) value_type(val); }
- void destroy(pointer p) { (void)p; p->~value_type(); }
-};
-#endif
-
template <class _Val>
struct _Hashtable_node
{
@@ -317,7 +88,7 @@ private:
template <class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey,
- class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) >
+ class _Alloc = std::allocator<char> >
class hashtable;
template <class _Val, class _Key, class _HashFcn,
@@ -341,7 +112,7 @@ struct _Hashtable_iterator {
const_iterator;
typedef _Hashtable_node<_Val> _Node;
- typedef @KWSYS_NAMESPACE@_stl::forward_iterator_tag iterator_category;
+ typedef std::forward_iterator_tag iterator_category;
typedef _Val value_type;
typedef ptrdiff_t difference_type;
typedef size_t size_type;
@@ -378,7 +149,7 @@ struct _Hashtable_const_iterator {
const_iterator;
typedef _Hashtable_node<_Val> _Node;
- typedef @KWSYS_NAMESPACE@_stl::forward_iterator_tag iterator_category;
+ typedef std::forward_iterator_tag iterator_category;
typedef _Val value_type;
typedef ptrdiff_t difference_type;
typedef size_t size_type;
@@ -427,7 +198,7 @@ static inline size_t _stl_next_prime(size_t __n)
{
const unsigned long* __first = get_stl_prime_list();
const unsigned long* __last = get_stl_prime_list() + (int)_stl_num_primes;
- const unsigned long* pos = @KWSYS_NAMESPACE@_stl::lower_bound(__first, __last, __n);
+ const unsigned long* pos = std::lower_bound(__first, __last, __n);
return pos == __last ? *(__last - 1) : *pos;
}
@@ -470,27 +241,13 @@ public:
private:
typedef _Hashtable_node<_Val> _Node;
-#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND
public:
typedef typename _Alloc::template rebind<_Val>::other allocator_type;
allocator_type get_allocator() const { return _M_node_allocator; }
private:
typedef typename _Alloc::template rebind<_Node>::other _M_node_allocator_type;
typedef typename _Alloc::template rebind<_Node*>::other _M_node_ptr_allocator_type;
- typedef @KWSYS_NAMESPACE@_stl::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type;
-#else
-public:
- typedef hash_allocator<_Val, _Alloc> allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-private:
- typedef hash_allocator<_Node, _Alloc> _M_node_allocator_type;
-# if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS
- typedef hash_allocator<_Node*, _Alloc> _M_node_ptr_allocator_type;
-# else
- typedef _Alloc _M_node_ptr_allocator_type;
-# endif
- typedef @KWSYS_NAMESPACE@_stl::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type;
-#endif
+ typedef std::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type;
private:
_M_node_allocator_type _M_node_allocator;
@@ -525,7 +282,7 @@ public:
_M_hash(__hf),
_M_equals(__eql),
_M_get_key(__ext),
- @KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a),
+ _M_buckets(__a),
_M_num_elements(0)
{
_M_initialize_buckets(__n);
@@ -539,7 +296,7 @@ public:
_M_hash(__hf),
_M_equals(__eql),
_M_get_key(_ExtractKey()),
- @KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a),
+ _M_buckets(__a),
_M_num_elements(0)
{
_M_initialize_buckets(__n);
@@ -550,7 +307,7 @@ public:
_M_hash(__ht._M_hash),
_M_equals(__ht._M_equals),
_M_get_key(__ht._M_get_key),
- @KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__ht.get_allocator()),
+ _M_buckets(__ht.get_allocator()),
_M_num_elements(0)
{
_M_copy_from(__ht);
@@ -576,11 +333,11 @@ public:
void swap(hashtable& __ht)
{
- @KWSYS_NAMESPACE@_stl::swap(_M_hash, __ht._M_hash);
- @KWSYS_NAMESPACE@_stl::swap(_M_equals, __ht._M_equals);
- @KWSYS_NAMESPACE@_stl::swap(_M_get_key, __ht._M_get_key);
+ std::swap(_M_hash, __ht._M_hash);
+ std::swap(_M_equals, __ht._M_equals);
+ std::swap(_M_get_key, __ht._M_get_key);
_M_buckets.swap(__ht._M_buckets);
- @KWSYS_NAMESPACE@_stl::swap(_M_num_elements, __ht._M_num_elements);
+ std::swap(_M_num_elements, __ht._M_num_elements);
}
iterator begin()
@@ -603,8 +360,8 @@ public:
const_iterator end() const { return const_iterator(0, this); }
- friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hashtable&,
- const hashtable&);
+ friend bool operator==<>(const hashtable&,
+ const hashtable&);
public:
@@ -621,7 +378,7 @@ public:
return __result;
}
- @KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert_unique(const value_type& __obj)
+ std::pair<iterator, bool> insert_unique(const value_type& __obj)
{
resize(_M_num_elements + 1);
return insert_unique_noresize(__obj);
@@ -633,38 +390,26 @@ public:
return insert_equal_noresize(__obj);
}
- @KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
+ std::pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
iterator insert_equal_noresize(const value_type& __obj);
-#if @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS
-# define @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(T,I) \
- typename @KWSYS_NAMESPACE@_stl::iterator_traits< T >::iterator_category()
-#elif @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_CATEGORY
-# define @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(T,I) \
- @KWSYS_NAMESPACE@_stl::iterator_category( I )
-#elif @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY
-# define @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(T,I) \
- @KWSYS_NAMESPACE@_stl::__iterator_category( I )
-#endif
-
-#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES && defined(@KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY)
template <class _InputIterator>
void insert_unique(_InputIterator __f, _InputIterator __l)
{
insert_unique(__f, __l,
- @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(_InputIterator, __f));
+ typename std::iterator_traits<_InputIterator>::iterator_category());
}
template <class _InputIterator>
void insert_equal(_InputIterator __f, _InputIterator __l)
{
insert_equal(__f, __l,
- @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(_InputIterator, __f));
+ typename std::iterator_traits<_InputIterator>::iterator_category());
}
template <class _InputIterator>
void insert_unique(_InputIterator __f, _InputIterator __l,
- @KWSYS_NAMESPACE@_stl::input_iterator_tag)
+ std::input_iterator_tag)
{
for ( ; __f != __l; ++__f)
insert_unique(*__f);
@@ -672,7 +417,7 @@ public:
template <class _InputIterator>
void insert_equal(_InputIterator __f, _InputIterator __l,
- @KWSYS_NAMESPACE@_stl::input_iterator_tag)
+ std::input_iterator_tag)
{
for ( ; __f != __l; ++__f)
insert_equal(*__f);
@@ -680,10 +425,10 @@ public:
template <class _ForwardIterator>
void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
- @KWSYS_NAMESPACE@_stl::forward_iterator_tag)
+ std::forward_iterator_tag)
{
size_type __n = 0;
- @KWSYS_NAMESPACE@_stl::distance(__f, __l, __n);
+ std::distance(__f, __l, __n);
resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f)
insert_unique_noresize(*__f);
@@ -691,51 +436,15 @@ public:
template <class _ForwardIterator>
void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
- @KWSYS_NAMESPACE@_stl::forward_iterator_tag)
+ std::forward_iterator_tag)
{
size_type __n = 0;
- @KWSYS_NAMESPACE@_stl::distance(__f, __l, __n);
+ std::distance(__f, __l, __n);
resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f)
insert_equal_noresize(*__f);
}
-#else
- void insert_unique(const value_type* __f, const value_type* __l)
- {
- size_type __n = __l - __f;
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_unique_noresize(*__f);
- }
-
- void insert_equal(const value_type* __f, const value_type* __l)
- {
- size_type __n = __l - __f;
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_equal_noresize(*__f);
- }
-
- void insert_unique(const_iterator __f, const_iterator __l)
- {
- size_type __n = 0;
- @KWSYS_NAMESPACE@_stl::distance(__f, __l, __n);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_unique_noresize(*__f);
- }
-
- void insert_equal(const_iterator __f, const_iterator __l)
- {
- size_type __n = 0;
- @KWSYS_NAMESPACE@_stl::distance(__f, __l, __n);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_equal_noresize(*__f);
- }
-#endif
-
reference find_or_insert(const value_type& __obj);
iterator find(const key_type& __key)
@@ -771,10 +480,10 @@ public:
return __result;
}
- @KWSYS_NAMESPACE@_stl::pair<iterator, iterator>
+ std::pair<iterator, iterator>
equal_range(const key_type& __key);
- @KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator>
+ std::pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const;
size_type erase(const key_type& __key);
@@ -936,7 +645,7 @@ inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool>
+std::pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool>
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
::insert_unique_noresize(const value_type& __obj)
{
@@ -945,13 +654,13 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
- return @KWSYS_NAMESPACE@_stl::pair<iterator, bool>(iterator(__cur, this), false);
+ return std::pair<iterator, bool>(iterator(__cur, this), false);
_Node* __tmp = _M_new_node(__obj);
__tmp->_M_next = __first;
_M_buckets[__n] = __tmp;
++_M_num_elements;
- return @KWSYS_NAMESPACE@_stl::pair<iterator, bool>(iterator(__tmp, this), true);
+ return std::pair<iterator, bool>(iterator(__tmp, this), true);
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
@@ -999,11 +708,11 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj)
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator,
- @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator>
+std::pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator,
+ typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator>
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key)
{
- typedef @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> _Pii;
+ typedef std::pair<iterator, iterator> _Pii;
const size_type __n = _M_bkt_num_key(__key);
for (_Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next)
@@ -1021,12 +730,12 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key)
}
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator,
- @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator>
+std::pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator,
+ typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator>
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
::equal_range(const key_type& __key) const
{
- typedef @KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator> _Pii;
+ typedef std::pair<const_iterator, const_iterator> _Pii;
const size_type __n = _M_bkt_num_key(__key);
for (const _Node* __first = _M_buckets[__n] ;
@@ -1164,8 +873,8 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
const size_type __n = _M_next_size(__num_elements_hint);
if (__n > __old_n) {
_M_buckets_type __tmp(
- __n, (_Node*)(0)
- @KWSYS_NAMESPACE@_HASH_BUCKETS_GET_ALLOCATOR(_M_buckets));
+ __n, (_Node*)(0),
+ _M_buckets.get_allocator());
try {
for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) {
_Node* __first = _M_buckets[__bucket];
@@ -1274,14 +983,6 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
} // namespace @KWSYS_NAMESPACE@
-// Normally the comparison operators should be found in the @KWSYS_NAMESPACE@
-// namespace by argument dependent lookup. For compilers that do not
-// support it we must bring them into the global namespace now.
-#if !@KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
-using @KWSYS_NAMESPACE@::operator==;
-using @KWSYS_NAMESPACE@::operator!=;
-#endif
-
// Undo warning suppression.
#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wdeprecated")
diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx
index 1596fe4..94579b3 100644
--- a/Source/kwsys/kwsysPlatformTestsCXX.cxx
+++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx
@@ -9,110 +9,11 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
-// Setup for tests that use result of stl namespace test.
-#if defined(KWSYS_STL_HAVE_STD)
-# if KWSYS_STL_HAVE_STD
-# define kwsys_stl std
-# else
-# define kwsys_stl
-# endif
-#endif
-
-// Setup for tests that use iostreams.
-#if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
-# if defined(_MSC_VER)
-# pragma warning (push,1)
-# endif
-# if KWSYS_IOS_USE_ANSI
-# include <iostream>
-# else
-# include <iostream.h>
-# endif
-# if defined(_MSC_VER)
-# pragma warning (pop)
-# endif
-# if KWSYS_IOS_HAVE_STD
-# define kwsys_ios std
-# else
-# define kwsys_ios
-# endif
-#endif
-
-#ifdef TEST_KWSYS_STL_HAVE_STD
-#include <list>
-void f(std ::list<int>*) {}
-int main() { return 0; }
-#endif
-
-#ifdef TEST_KWSYS_IOS_USE_ANSI
-#include <iosfwd>
-int main() { return 0; }
-#endif
-
-#ifdef TEST_KWSYS_IOS_HAVE_STD
-#include <iosfwd>
-void f(std ::ostream*) {}
-int main() { return 0; }
-#endif
-
-#ifdef TEST_KWSYS_IOS_USE_SSTREAM
-#include <sstream>
-#if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
-# error "GCC 2.96 stringstream is buggy"
-#endif
-int main()
-{
- std ::ostringstream ostr;
- ostr << "hello";
- if(ostr.str().size() == 5)
- {
- return 0;
- }
- return -1;
-}
-#endif
-
-#ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
-#include <strstream.h>
-int main() { return 0; }
-#endif
-
-#ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
-#include <strstrea.h>
-int main() { return 0; }
-#endif
-
-#ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
-# include <iostream.h>
-# include <string>
-void f(ostream& os, const kwsys_stl::string& s) { os << s; }
-int main() { return 0; }
-#endif
-
-#ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
-# include <iostream.h>
-# include <string>
-void f(istream& is, kwsys_stl::string& s) { is >> s; }
-int main() { return 0; }
-#endif
-
-#ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
-# include <string>
-bool f(const kwsys_stl::string& s) { return s != ""; }
-int main() { return 0; }
-#endif
-
#ifdef TEST_KWSYS_CXX_HAS_CSTDIO
#include <cstdio>
int main() { return 0; }
#endif
-#ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
-#include <cstddef>
-void f(size_t) {}
-int main() { return 0; }
-#endif
-
#ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
long long f(long long n) { return n; }
int main()
@@ -131,150 +32,6 @@ int main()
}
#endif
-#ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
-template <class T> class A;
-template <class T> int f(A<T>&);
-template <class T> class A
-{
-public:
- // "friend int f<>(A<T>&)" would conform
- friend int f(A<T>&);
-private:
- int x;
-};
-
-template <class T> int f(A<T>& a) { return a.x = 0; }
-template int f(A<int>&);
-
-int main()
-{
- A<int> a;
- return f(a);
-}
-#endif
-
-#ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
-template <class U>
-class A
-{
-public:
- U u;
- A(): u(0) {}
- template <class V> V m(V* p) { return *p = u; }
-};
-
-int main()
-{
- A<short> a;
- int s = 1;
- return a.m(&s);
-}
-#endif
-
-#ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
-template <class T> struct A {};
-template <> struct A<int*>
-{
- static int f() { return 0; }
-};
-int main() { return A<int*>::f(); }
-#endif
-
-#ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
-namespace N
-{
- class A {};
- int f(A*) { return 0; }
-}
-void f(void*);
-int main()
-{
- N::A* a = 0;
- return f(a);
-}
-#endif
-
-#ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
-#include <iterator>
-#include <list>
-void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
-int main() { return 0; }
-#endif
-
-#ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
-#include <iterator>
-#include <list>
-void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
-int main() { return 0; }
-#endif
-
-#ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
-#include <iterator>
-#include <list>
-void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
-int main() { return 0; }
-#endif
-
-#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
-#include <memory>
-template <class Alloc>
-void f(const Alloc&)
-{
- typedef typename Alloc::size_type alloc_size_type;
-}
-int main()
-{
- f(kwsys_stl::allocator<char>());
- return 0;
-}
-#endif
-
-#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
-#include <memory>
-void f(kwsys_stl::allocator::size_type const&) {}
-int main() { return 0; }
-#endif
-
-#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
-#include <memory>
-template <class T, class Alloc>
-void f(const T&, const Alloc&)
-{
- typedef typename Alloc::template rebind<T>::other alloc_type;
-}
-int main()
-{
- f(0, kwsys_stl::allocator<char>());
- return 0;
-}
-#endif
-
-#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
-#include <memory>
-void f(kwsys_stl::allocator<char> const& a)
-{
- a.max_size(sizeof(int));
-}
-int main()
-{
- f(kwsys_stl::allocator<char>());
- return 0;
-}
-#endif
-
-#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
-#include <vector>
-void f(kwsys_stl::vector<int> const& v1)
-{
- kwsys_stl::vector<int>(1, 1, v1.get_allocator());
-}
-int main()
-{
- f(kwsys_stl::vector<int>());
- return 0;
-}
-#endif
-
#ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
#include <sys/types.h>
#include <sys/stat.h>
@@ -323,62 +80,55 @@ int main()
}
#endif
-#ifdef TEST_KWSYS_IOS_HAVE_BINARY
-int test_binary(int, ...)
-{
- return 0;
-}
-int main()
-{
- return test_binary(1, kwsys_ios::ios::binary);
-}
-#endif
-
#ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
-int test_istream(kwsys_ios::istream& is, long long& x)
+# include <iostream>
+int test_istream(std::istream& is, long long& x)
{
return (is >> x)? 1:0;
}
int main()
{
long long x = 0;
- return test_istream(kwsys_ios::cin, x);
+ return test_istream(std::cin, x);
}
#endif
#ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
-int test_ostream(kwsys_ios::ostream& os, long long x)
+# include <iostream>
+int test_ostream(std::ostream& os, long long x)
{
return (os << x)? 1:0;
}
int main()
{
long long x = 0;
- return test_ostream(kwsys_ios::cout, x);
+ return test_ostream(std::cout, x);
}
#endif
#ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64
-int test_istream(kwsys_ios::istream& is, __int64& x)
+# include <iostream>
+int test_istream(std::istream& is, __int64& x)
{
return (is >> x)? 1:0;
}
int main()
{
__int64 x = 0;
- return test_istream(kwsys_ios::cin, x);
+ return test_istream(std::cin, x);
}
#endif
#ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64
-int test_ostream(kwsys_ios::ostream& os, __int64 x)
+# include <iostream>
+int test_ostream(std::ostream& os, __int64 x)
{
return (os << x)? 1:0;
}
int main()
{
__int64 x = 0;
- return test_ostream(kwsys_ios::cout, x);
+ return test_ostream(std::cout, x);
}
#endif
diff --git a/Source/kwsys/kwsys_cstddef.hxx.in b/Source/kwsys/kwsys_cstddef.hxx.in
deleted file mode 100644
index 925c030..0000000
--- a/Source/kwsys/kwsys_cstddef.hxx.in
+++ /dev/null
@@ -1,35 +0,0 @@
-/*============================================================================
- KWSys - Kitware System Library
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE@_cstddef
-#define @KWSYS_NAMESPACE@_cstddef
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-/* Avoid warnings in MSVC standard headers. */
-#ifdef _MSC_VER
-# pragma warning (push, 1)
-# pragma warning (disable: 4702)
-# pragma warning (disable: 4786)
-#endif
-
-/* Include the real header. */
-#if @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF
-# include <cstddef>
-#else
-# include <stddef.h>
-#endif
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-#endif
diff --git a/Source/kwsys/kwsys_ios_fstream.h.in b/Source/kwsys/kwsys_ios_fstream.h.in
deleted file mode 100644
index 4b1a8cf..0000000
--- a/Source/kwsys/kwsys_ios_fstream.h.in
+++ /dev/null
@@ -1,46 +0,0 @@
-/*============================================================================
- KWSys - Kitware System Library
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE@_ios_fstream
-#define @KWSYS_NAMESPACE@_ios_fstream
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#ifdef _MSC_VER
-# pragma warning (push, 1)
-# pragma warning (disable: 4702)
-# pragma warning (disable: 4995) /* Old streams are deprecated. */
-#endif
-
-#if @KWSYS_NAMESPACE@_IOS_USE_ANSI
-# include <fstream>
-#else
-# include <fstream.h>
-#endif
-
-#if !@KWSYS_NAMESPACE@_IOS_USE_SSTREAM
-namespace @KWSYS_NAMESPACE@_ios
-{
- using @KWSYS_NAMESPACE@_ios_namespace::ostream;
- using @KWSYS_NAMESPACE@_ios_namespace::istream;
- using @KWSYS_NAMESPACE@_ios_namespace::ofstream;
- using @KWSYS_NAMESPACE@_ios_namespace::ifstream;
- using @KWSYS_NAMESPACE@_ios_namespace::ios;
- using @KWSYS_NAMESPACE@_ios_namespace::endl;
- using @KWSYS_NAMESPACE@_ios_namespace::flush;
-}
-#endif
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-#endif
diff --git a/Source/kwsys/kwsys_ios_iosfwd.h.in b/Source/kwsys/kwsys_ios_iosfwd.h.in
deleted file mode 100644
index f4fafeb..0000000
--- a/Source/kwsys/kwsys_ios_iosfwd.h.in
+++ /dev/null
@@ -1,49 +0,0 @@
-/*============================================================================
- KWSys - Kitware System Library
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE@_ios_iosfwd
-#define @KWSYS_NAMESPACE@_ios_iosfwd
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#ifdef _MSC_VER
-#pragma warning (push, 1)
-#pragma warning (disable: 4702)
-#endif
-
-#if @KWSYS_NAMESPACE@_IOS_USE_ANSI
-# include <iosfwd>
-#else
-class fstream;
-class ifstream;
-class ios;
-class istream;
-class ofstream;
-class ostream;
-#endif
-
-#if !@KWSYS_NAMESPACE@_IOS_USE_SSTREAM
-namespace @KWSYS_NAMESPACE@_ios
-{
- using @KWSYS_NAMESPACE@_ios_namespace::fstream;
- using @KWSYS_NAMESPACE@_ios_namespace::ifstream;
- using @KWSYS_NAMESPACE@_ios_namespace::ios;
- using @KWSYS_NAMESPACE@_ios_namespace::istream;
- using @KWSYS_NAMESPACE@_ios_namespace::ofstream;
- using @KWSYS_NAMESPACE@_ios_namespace::ostream;
-}
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-#endif
diff --git a/Source/kwsys/kwsys_ios_iostream.h.in b/Source/kwsys/kwsys_ios_iostream.h.in
deleted file mode 100644
index 43fc4d5..0000000
--- a/Source/kwsys/kwsys_ios_iostream.h.in
+++ /dev/null
@@ -1,99 +0,0 @@
-/*============================================================================
- KWSys - Kitware System Library
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE@_ios_iostream
-#define @KWSYS_NAMESPACE@_ios_iostream
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#ifdef _MSC_VER
-# pragma warning (push, 1)
-# pragma warning (disable: 4702)
-# pragma warning (disable: 4995) /* Old streams are deprecated. */
-#endif
-
-#if @KWSYS_NAMESPACE@_IOS_USE_ANSI
-# include <iostream>
-#else
-# include <iostream.h>
-#endif
-
-// The HP implementation of iostream defines cin, cout, cerr, and clog
-// as macros in order to do thread-private streams.
-// See /opt/aCC/include/iostream/iostream.h for details.
-// This block redefines the macros in a safe way that is also compatible
-// with the HP definitions and the using declarations below.
-
-#if !@KWSYS_NAMESPACE@_IOS_USE_SSTREAM
-# if defined(__HP_aCC) && (defined(HP_THREAD_SAFE) || defined(_THREAD_SAFE))
-# if defined(cin) && !defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CIN)
-# define @KWSYS_NAMESPACE@_IOS_HP_HACK_CIN
-# undef cin
-# define cin __tcin.ref()
-# endif
-# if defined(cout) && !defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_COUT)
-# define @KWSYS_NAMESPACE@_IOS_HP_HACK_COUT
-# undef cout
-# define cout __tcout.ref()
-# endif
-# if defined(cerr) && !defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CERR)
-# define @KWSYS_NAMESPACE@_IOS_HP_HACK_CERR
-# undef cerr
-# define cerr __tcerr.ref()
-# endif
-# if defined(clog) && !defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CLOG)
-# define @KWSYS_NAMESPACE@_IOS_HP_HACK_CLOG
-# undef clog
-# define clog __tclog.ref()
-# endif
-# endif
-#endif
-
-// If using our own sstream emulation code, put the standard
-// streams in the same namespace.
-#if !@KWSYS_NAMESPACE@_IOS_USE_SSTREAM
-namespace @KWSYS_NAMESPACE@_ios
-{
- typedef int streamsize;
- typedef int streamoff;
- using @KWSYS_NAMESPACE@_ios_namespace::ostream;
- using @KWSYS_NAMESPACE@_ios_namespace::istream;
- using @KWSYS_NAMESPACE@_ios_namespace::ios;
- using @KWSYS_NAMESPACE@_ios_namespace::endl;
- using @KWSYS_NAMESPACE@_ios_namespace::flush;
-# if defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CIN)
- using @KWSYS_NAMESPACE@_ios_namespace::__tcin;
-# else
- using @KWSYS_NAMESPACE@_ios_namespace::cin;
-# endif
-# if defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_COUT)
- using @KWSYS_NAMESPACE@_ios_namespace::__tcout;
-# else
- using @KWSYS_NAMESPACE@_ios_namespace::cout;
-# endif
-# if defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CERR)
- using @KWSYS_NAMESPACE@_ios_namespace::__tcerr;
-# else
- using @KWSYS_NAMESPACE@_ios_namespace::cerr;
-# endif
-# if defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CLOG)
- using @KWSYS_NAMESPACE@_ios_namespace::__tclog;
-# else
- using @KWSYS_NAMESPACE@_ios_namespace::clog;
-# endif
-}
-#endif
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-#endif
diff --git a/Source/kwsys/kwsys_ios_sstream.h.in b/Source/kwsys/kwsys_ios_sstream.h.in
deleted file mode 100644
index 29d250c..0000000
--- a/Source/kwsys/kwsys_ios_sstream.h.in
+++ /dev/null
@@ -1,199 +0,0 @@
-/*============================================================================
- KWSys - Kitware System Library
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE@_ios_sstream
-#define @KWSYS_NAMESPACE@_ios_sstream
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-/* Define this macro temporarily to keep the code readable. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE@_stl
-#endif
-
-#if @KWSYS_NAMESPACE@_IOS_USE_SSTREAM
-# ifdef _MSC_VER
-# pragma warning (push, 1)
-# pragma warning (disable: 4702)
-# endif
-# include <sstream>
-# ifdef _MSC_VER
-# pragma warning(pop)
-# endif
-#else
-# ifdef _MSC_VER
-# pragma warning (push, 1)
-# pragma warning (disable: 4702)
-# pragma warning (disable: 4995) /* Old streams are deprecated. */
-# endif
-# if @KWSYS_NAMESPACE@_IOS_USE_ANSI
-# include <strstream>
-# elif @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H
-# include <strstream.h>
-# elif @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H
-# include <strstrea.h>
-# endif
-# if @KWSYS_NAMESPACE@_IOS_USE_ANSI
-# include <new> // Need placement operator new.
-# else
-# include <new.h> // Need placement operator new.
-# endif
-# ifdef _MSC_VER
-# pragma warning(pop)
-# endif
-
-// Only have old std strstream classes. Wrap them to look like new
-// ostringstream and istringstream classes.
-
-# include <@KWSYS_NAMESPACE@/stl/string>
-
-namespace @KWSYS_NAMESPACE@_ios
-{
-using @KWSYS_NAMESPACE@_ios_namespace::streambuf;
-using @KWSYS_NAMESPACE@_ios_namespace::ostream;
-using @KWSYS_NAMESPACE@_ios_namespace::istream;
-using @KWSYS_NAMESPACE@_ios_namespace::strstream;
-using @KWSYS_NAMESPACE@_ios_namespace::istrstream;
-using @KWSYS_NAMESPACE@_ios_namespace::ostrstream;
-using @KWSYS_NAMESPACE@_ios_namespace::ios;
-using @KWSYS_NAMESPACE@_ios_namespace::endl;
-using @KWSYS_NAMESPACE@_ios_namespace::ends;
-using @KWSYS_NAMESPACE@_ios_namespace::flush;
-
-class stringstream_cleanup
-{
-public:
- stringstream_cleanup(strstream& str): m_StrStream(str) {}
- ~stringstream_cleanup() { m_StrStream.rdbuf()->freeze(0); }
- static void IgnoreUnusedVariable(const stringstream_cleanup&) {}
-protected:
- strstream& m_StrStream;
-private:
- void operator=(stringstream_cleanup const&);
-};
-
-class stringstream: public strstream
-{
-public:
- typedef strstream Superclass;
- stringstream() {}
- stringstream(const kwsys_stl::string& s) { *this << s.c_str(); }
- kwsys_stl::string str()
- {
- stringstream_cleanup cleanup(*this);
- stringstream_cleanup::IgnoreUnusedVariable(cleanup);
-// Visual Studio 6 has a strstream::pcount, but this is not rdbuf()->pcount()
-#if (@KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H) && defined(_MSC_VER) && (_MSC_VER == 1200)
- int count = this->pcount();
-#elif defined(__WATCOMC__)
- int count = this->rdbuf()->out_waiting();
-#else
- int count = this->rdbuf()->pcount();
-#endif
- const char* ptr = this->Superclass::str();
- return kwsys_stl::string(ptr?ptr:"", count);
- }
- void str(const kwsys_stl::string& s)
- {
- this->~stringstream();
- new (this) stringstream(s);
- }
-private:
- stringstream(const stringstream&);
- void operator=(const stringstream&);
-};
-
-class ostringstream_cleanup
-{
-public:
- ostringstream_cleanup(ostrstream& ostr): m_OStrStream(ostr) {}
- ~ostringstream_cleanup() { m_OStrStream.rdbuf()->freeze(0); }
- static void IgnoreUnusedVariable(const ostringstream_cleanup&) {}
-protected:
- ostrstream& m_OStrStream;
-private:
- void operator=(ostringstream_cleanup const&);
-};
-
-class ostringstream: public ostrstream
-{
-public:
- typedef ostrstream Superclass;
- ostringstream() {}
- ostringstream(const kwsys_stl::string& s) { *this << s.c_str(); }
- kwsys_stl::string str()
- {
- ostringstream_cleanup cleanup(*this);
- ostringstream_cleanup::IgnoreUnusedVariable(cleanup);
- int count = this->pcount();
- const char* ptr = this->Superclass::str();
- return kwsys_stl::string(ptr?ptr:"", count);
- }
- void str(const kwsys_stl::string& s)
- {
- this->~ostringstream();
- new (this) ostringstream(s);
- }
-private:
- ostringstream(const ostringstream&);
- void operator=(const ostringstream&);
-};
-
-#if defined(_MSC_VER)
-# pragma warning (push)
-# pragma warning (disable: 4097) /* typedef-name used as synonym for class */
-#endif
-#if defined(__WATCOMC__)
-// W728: class modifiers for 'A' conflict with class modifiers for 'B'
-# pragma warning 728 10
-#endif
-
-class istringstream: private kwsys_stl::string, public istrstream
-{
-public:
- typedef kwsys_stl::string StdString;
- typedef istrstream IStrStream;
- istringstream(): StdString(),
- IStrStream(const_cast<char*>(StdString::c_str())) {}
- istringstream(const kwsys_stl::string& s):
- StdString(s), IStrStream(const_cast<char*>(StdString::c_str())) {}
- kwsys_stl::string str() const { return *this; }
- void str(const kwsys_stl::string& s)
- {
- this->~istringstream();
- new (this) istringstream(s);
- }
- void clear(int flags)
- {
- this->IStrStream::clear(flags);
- }
-private:
- istringstream(const istringstream&);
- void operator=(const istringstream&);
-};
-
-#if defined(__WATCOMC__)
-# pragma warning 728 9
-#endif
-#if defined(_MSC_VER)
-# pragma warning (pop)
-#endif
-
-} // namespace @KWSYS_NAMESPACE@_ios
-
-#endif
-
-/* Undefine temporary macro. */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
-#endif
diff --git a/Source/kwsys/kwsys_stl.hxx.in b/Source/kwsys/kwsys_stl.hxx.in
deleted file mode 100644
index 610e6d4..0000000
--- a/Source/kwsys/kwsys_stl.hxx.in
+++ /dev/null
@@ -1,49 +0,0 @@
-/*============================================================================
- KWSys - Kitware System Library
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE@_stl_@KWSYS_STL_HEADER@
-#define @KWSYS_NAMESPACE@_stl_@KWSYS_STL_HEADER@
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-/* Avoid warnings in MSVC standard headers. */
-#ifdef _MSC_VER
-# pragma warning (push, 1)
-# pragma warning (disable: 4702)
-# pragma warning (disable: 4786)
-#endif
-
-/* The HP standard library defines the functor "times" instead of
- "multiplies" as specified by C++98 20.3.2 for backward
- compatibility with earlier specifications. Defining this macro
- fixes this behavior. The name "times" also conflicts with the
- function declared in sys/times.h on that platform, so we must do
- this as a work-around anyway. */
-#if defined(__HP_aCC) && !defined(__HPACC_USING_MULTIPLIES_IN_FUNCTIONAL)
-# define __HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
-# define @KWSYS_NAMESPACE@_DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
-#endif
-
-/* Include the real header. */
-#include <@KWSYS_STL_HEADER@>
-
-/* Cleanup. */
-#if defined(@KWSYS_NAMESPACE@_DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL)
-# undef @KWSYS_NAMESPACE@_DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
-# undef __HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
-#endif
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-@KWSYS_STL_HEADER_EXTRA@
-#endif
diff --git a/Source/kwsys/kwsys_stl_string.hxx.in b/Source/kwsys/kwsys_stl_string.hxx.in
deleted file mode 100644
index cd312cb..0000000
--- a/Source/kwsys/kwsys_stl_string.hxx.in
+++ /dev/null
@@ -1,123 +0,0 @@
-/*============================================================================
- KWSys - Kitware System Library
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
-
-// This header is extra code for <@KWSYS_NAMESPACE@/stl/string>.
-#if !defined(@KWSYS_NAMESPACE@_stl_string_including_hxx)
-# error "The header <@KWSYS_NAMESPACE@/stl/string.hxx> may be included only by <@KWSYS_NAMESPACE@/stl/string>."
-#endif
-
-// Provide the istream operator for the stl string if it is not
-// provided by the system or another copy of kwsys. Allow user code
-// to block this definition by defining the macro
-// @KWSYS_NAMESPACE@_STL_STRING_NO_ISTREAM
-// to avoid conflicts with other libraries. User code can test for
-// this definition by checking the macro
-// @KWSYS_NAMESPACE@_STL_STRING_ISTREAM_DEFINED
-#if !@KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM && !defined(@KWSYS_NAMESPACE@_STL_STRING_NO_ISTREAM) && !defined(KWSYS_STL_STRING_ISTREAM_DEFINED)
-# define KWSYS_STL_STRING_ISTREAM_DEFINED
-# define @KWSYS_NAMESPACE@_STL_STRING_ISTREAM_DEFINED
-# include <ctype.h> // isspace
-# include <@KWSYS_NAMESPACE@/ios/iostream>
-# if defined(__WATCOMC__)
-namespace @KWSYS_NAMESPACE@
-{
-struct ios_istream_hack: public kwsys_ios::istream
-{ void eatwhite() { this->@KWSYS_NAMESPACE@_ios::istream::eatwhite(); } };
-}
-# endif
-inline @KWSYS_NAMESPACE@_ios::istream&
-operator>>(@KWSYS_NAMESPACE@_ios::istream& is,
- @KWSYS_NAMESPACE@_stl::string& s)
-{
- // Keep track of the resulting state.
- int state = @KWSYS_NAMESPACE@_ios::ios::goodbit;
-
- // Save the width setting and set it back to zero.
- size_t n = static_cast<size_t>(is.width(0));
-
- // Clear any old contents of the output string.
- s.erase();
-
- // Skip leading whitespace.
-#if defined(__WATCOMC__)
- static_cast<@KWSYS_NAMESPACE@::ios_istream_hack&>(is).eatwhite();
-#else
- is.eatwhite();
-#endif
- @KWSYS_NAMESPACE@_ios::istream& okay = is;
-
- if(okay)
- {
- // Select a maximum possible length.
- if(n == 0 || n >= s.max_size())
- {
- n = s.max_size();
- }
-
- // Read until a space is found or the maximum length is reached.
- bool success = false;
- for(int c = is.peek(); (--n > 0 && c != EOF && !isspace(c)); c = is.peek())
- {
- s += static_cast<char>(c);
- success = true;
- is.ignore();
- }
-
- // Set flags for resulting state.
- if(is.peek() == EOF) { state |= @KWSYS_NAMESPACE@_ios::ios::eofbit; }
- if(!success) { state |= @KWSYS_NAMESPACE@_ios::ios::failbit; }
- }
-
- // Set the final result state.
- is.clear(state);
- return is;
-}
-#endif
-
-// Provide the ostream operator for the stl string if it is not
-// provided by the system or another copy of kwsys. Allow user code
-// to block this definition by defining the macro
-// @KWSYS_NAMESPACE@_STL_STRING_NO_OSTREAM
-// to avoid conflicts with other libraries. User code can test for
-// this definition by checking the macro
-// @KWSYS_NAMESPACE@_STL_STRING_OSTREAM_DEFINED
-#if !@KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM && !defined(@KWSYS_NAMESPACE@_STL_STRING_NO_OSTREAM) && !defined(KWSYS_STL_STRING_OSTREAM_DEFINED)
-# define KWSYS_STL_STRING_OSTREAM_DEFINED
-# define @KWSYS_NAMESPACE@_STL_STRING_OSTREAM_DEFINED
-# include <@KWSYS_NAMESPACE@/ios/iostream>
-inline @KWSYS_NAMESPACE@_ios::ostream&
-operator<<(@KWSYS_NAMESPACE@_ios::ostream& os,
- @KWSYS_NAMESPACE@_stl::string const& s)
-{
- return os << s.c_str();
-}
-#endif
-
-// Provide the operator!= for the stl string and char* if it is not
-// provided by the system or another copy of kwsys. Allow user code
-// to block this definition by defining the macro
-// @KWSYS_NAMESPACE@_STL_STRING_NO_NEQ_CHAR
-// to avoid conflicts with other libraries. User code can test for
-// this definition by checking the macro
-// @KWSYS_NAMESPACE@_STL_STRING_NEQ_CHAR_DEFINED
-#if !@KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR && !defined(@KWSYS_NAMESPACE@_STL_STRING_NO_NEQ_CHAR) && !defined(KWSYS_STL_STRING_NEQ_CHAR_DEFINED)
-# define KWSYS_STL_STRING_NEQ_CHAR_DEFINED
-# define @KWSYS_NAMESPACE@_STL_STRING_NEQ_CHAR_DEFINED
-inline bool operator!=(@KWSYS_NAMESPACE@_stl::string const& s, const char* c)
-{
- return !(s == c);
-}
-inline bool operator!=(const char* c, @KWSYS_NAMESPACE@_stl::string const& s)
-{
- return !(s == c);
-}
-#endif
diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx
index 6a03c0f..525522d 100644
--- a/Source/kwsys/testCommandLineArguments.cxx
+++ b/Source/kwsys/testCommandLineArguments.cxx
@@ -11,16 +11,16 @@
============================================================================*/
#include "kwsysPrivate.h"
#include KWSYS_HEADER(CommandLineArguments.hxx)
-#include KWSYS_HEADER(ios/iostream)
-#include KWSYS_HEADER(stl/vector)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "CommandLineArguments.hxx.in"
-# include "kwsys_ios_iostream.h.in"
#endif
+#include <iostream>
+#include <vector>
+
#include <stddef.h> /* size_t */
#include <string.h> /* strcmp */
@@ -28,10 +28,10 @@ static void* random_ptr = reinterpret_cast<void*>(0x123);
static int argument(const char* arg, const char* value, void* call_data)
{
- kwsys_ios::cout << "Got argument: \"" << arg << "\" value: \"" << (value?value:"(null)") << "\"" << kwsys_ios::endl;
+ std::cout << "Got argument: \"" << arg << "\" value: \"" << (value?value:"(null)") << "\"" << std::endl;
if ( call_data != random_ptr )
{
- kwsys_ios::cerr << "Problem processing call_data" << kwsys_ios::endl;
+ std::cerr << "Problem processing call_data" << std::endl;
return 0;
}
return 1;
@@ -39,10 +39,10 @@ static int argument(const char* arg, const char* value, void* call_data)
static int unknown_argument(const char* argument, void* call_data)
{
- kwsys_ios::cout << "Got unknown argument: \"" << argument << "\"" << kwsys_ios::endl;
+ std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl;
if ( call_data != random_ptr )
{
- kwsys_ios::cerr << "Problem processing call_data" << kwsys_ios::endl;
+ std::cerr << "Problem processing call_data" << std::endl;
return 0;
}
return 1;
@@ -53,8 +53,8 @@ static bool CompareTwoItemsOnList(int i1, int i2) { return i1 == i2; }
static bool CompareTwoItemsOnList(double i1, double i2) { return i1 == i2; }
static bool CompareTwoItemsOnList(const char* i1,
const char* i2) { return strcmp(i1, i2) == 0; }
-static bool CompareTwoItemsOnList(const kwsys_stl::string& i1,
- const kwsys_stl::string& i2) { return i1 == i2; }
+static bool CompareTwoItemsOnList(const std::string& i1,
+ const std::string& i2) { return i1 == i2; }
int testCommandLineArguments(int argc, char* argv[])
{
@@ -74,26 +74,26 @@ int testCommandLineArguments(int argc, char* argv[])
int some_int_variable = 10;
double some_double_variable = 10.10;
char* some_string_variable = 0;
- kwsys_stl::string some_stl_string_variable = "";
+ std::string some_stl_string_variable = "";
bool some_bool_variable = false;
bool some_bool_variable1 = false;
bool bool_arg1 = false;
int bool_arg2 = 0;
- kwsys_stl::vector<int> numbers_argument;
+ std::vector<int> numbers_argument;
int valid_numbers[] = { 5, 1, 8, 3, 7, 1, 3, 9, 7, 1 };
- kwsys_stl::vector<double> doubles_argument;
+ std::vector<double> doubles_argument;
double valid_doubles[] = { 12.5, 1.31, 22 };
- kwsys_stl::vector<bool> bools_argument;
+ std::vector<bool> bools_argument;
bool valid_bools[] = { true, true, false };
- kwsys_stl::vector<char*> strings_argument;
+ std::vector<char*> strings_argument;
const char* valid_strings[] = { "andy", "bill", "brad", "ken" };
- kwsys_stl::vector<kwsys_stl::string> stl_strings_argument;
- kwsys_stl::string valid_stl_strings[] = { "ken", "brad", "bill", "andy" };
+ std::vector<std::string> stl_strings_argument;
+ std::string valid_stl_strings[] = { "ken", "brad", "bill", "andy" };
typedef kwsys::CommandLineArguments argT;
@@ -122,47 +122,47 @@ int testCommandLineArguments(int argc, char* argv[])
if ( !arg.Parse() )
{
- kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl;
+ std::cerr << "Problem parsing arguments" << std::endl;
res = 1;
}
- kwsys_ios::cout << "Help: " << arg.GetHelp() << kwsys_ios::endl;
+ std::cout << "Help: " << arg.GetHelp() << std::endl;
- kwsys_ios::cout << "Some int variable was set to: " << some_int_variable << kwsys_ios::endl;
- kwsys_ios::cout << "Some double variable was set to: " << some_double_variable << kwsys_ios::endl;
+ std::cout << "Some int variable was set to: " << some_int_variable << std::endl;
+ std::cout << "Some double variable was set to: " << some_double_variable << std::endl;
if ( some_string_variable && strcmp(some_string_variable, "test string with space") == 0)
{
- kwsys_ios::cout << "Some string variable was set to: " << some_string_variable << kwsys_ios::endl;
+ std::cout << "Some string variable was set to: " << some_string_variable << std::endl;
delete [] some_string_variable;
}
else
{
- kwsys_ios::cerr << "Problem setting string variable" << kwsys_ios::endl;
+ std::cerr << "Problem setting string variable" << std::endl;
res = 1;
}
size_t cc;
#define CompareTwoLists(list1, list_valid, lsize) \
if ( list1.size() != lsize ) \
{ \
- kwsys_ios::cerr << "Problem setting " #list1 ". Size is: " << list1.size() \
- << " should be: " << lsize << kwsys_ios::endl; \
+ std::cerr << "Problem setting " #list1 ". Size is: " << list1.size() \
+ << " should be: " << lsize << std::endl; \
res = 1; \
} \
else \
{ \
- kwsys_ios::cout << #list1 " argument set:"; \
+ std::cout << #list1 " argument set:"; \
for ( cc =0; cc < lsize; ++ cc ) \
{ \
- kwsys_ios::cout << " " << list1[cc]; \
+ std::cout << " " << list1[cc]; \
if ( !CompareTwoItemsOnList(list1[cc], list_valid[cc]) ) \
{ \
- kwsys_ios::cerr << "Problem setting " #list1 ". Value of " \
+ std::cerr << "Problem setting " #list1 ". Value of " \
<< cc << " is: [" << list1[cc] << "] <> [" \
- << list_valid[cc] << "]" << kwsys_ios::endl; \
+ << list_valid[cc] << "]" << std::endl; \
res = 1; \
break; \
} \
} \
- kwsys_ios::cout << kwsys_ios::endl; \
+ std::cout << std::endl; \
}
CompareTwoLists(numbers_argument, valid_numbers, 10);
@@ -171,12 +171,12 @@ int testCommandLineArguments(int argc, char* argv[])
CompareTwoLists(strings_argument, valid_strings, 4);
CompareTwoLists(stl_strings_argument, valid_stl_strings, 4);
- kwsys_ios::cout << "Some STL String variable was set to: " << some_stl_string_variable << kwsys_ios::endl;
- kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable << kwsys_ios::endl;
- kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable1 << kwsys_ios::endl;
- kwsys_ios::cout << "bool_arg1 variable was set to: " << bool_arg1 << kwsys_ios::endl;
- kwsys_ios::cout << "bool_arg2 variable was set to: " << bool_arg2 << kwsys_ios::endl;
- kwsys_ios::cout << kwsys_ios::endl;
+ std::cout << "Some STL String variable was set to: " << some_stl_string_variable << std::endl;
+ std::cout << "Some bool variable was set to: " << some_bool_variable << std::endl;
+ std::cout << "Some bool variable was set to: " << some_bool_variable1 << std::endl;
+ std::cout << "bool_arg1 variable was set to: " << bool_arg1 << std::endl;
+ std::cout << "bool_arg2 variable was set to: " << bool_arg2 << std::endl;
+ std::cout << std::endl;
for ( cc = 0; cc < strings_argument.size(); ++ cc )
{
diff --git a/Source/kwsys/testCommandLineArguments1.cxx b/Source/kwsys/testCommandLineArguments1.cxx
index b65c37f..6eb465d 100644
--- a/Source/kwsys/testCommandLineArguments1.cxx
+++ b/Source/kwsys/testCommandLineArguments1.cxx
@@ -11,16 +11,16 @@
============================================================================*/
#include "kwsysPrivate.h"
#include KWSYS_HEADER(CommandLineArguments.hxx)
-#include KWSYS_HEADER(ios/iostream)
-#include KWSYS_HEADER(stl/vector)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "CommandLineArguments.hxx.in"
-# include "kwsys_ios_iostream.h.in"
#endif
+#include <iostream>
+#include <vector>
+
#include <assert.h> /* assert */
#include <string.h> /* strcmp */
@@ -31,7 +31,7 @@ int testCommandLineArguments1(int argc, char* argv[])
int n = 0;
char* m = 0;
- kwsys_stl::string p;
+ std::string p;
int res = 0;
typedef kwsys::CommandLineArguments argT;
@@ -43,27 +43,27 @@ int testCommandLineArguments1(int argc, char* argv[])
if ( !arg.Parse() )
{
- kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl;
+ std::cerr << "Problem parsing arguments" << std::endl;
res = 1;
}
if ( n != 24 )
{
- kwsys_ios::cout << "Problem setting N. Value of N: " << n << kwsys_ios::endl;
+ std::cout << "Problem setting N. Value of N: " << n << std::endl;
res = 1;
}
if ( !m || strcmp(m, "test value") != 0 )
{
- kwsys_ios::cout << "Problem setting M. Value of M: " << m << kwsys_ios::endl;
+ std::cout << "Problem setting M. Value of M: " << m << std::endl;
res = 1;
}
if ( p != "1" )
{
- kwsys_ios::cout << "Problem setting P. Value of P: " << p << kwsys_ios::endl;
+ std::cout << "Problem setting P. Value of P: " << p << std::endl;
res = 1;
}
- kwsys_ios::cout << "Value of N: " << n << kwsys_ios::endl;
- kwsys_ios::cout << "Value of M: " << m << kwsys_ios::endl;
- kwsys_ios::cout << "Value of P: " << p << kwsys_ios::endl;
+ std::cout << "Value of N: " << n << std::endl;
+ std::cout << "Value of M: " << m << std::endl;
+ std::cout << "Value of P: " << p << std::endl;
if ( m )
{
delete [] m;
@@ -79,25 +79,25 @@ int testCommandLineArguments1(int argc, char* argv[])
};
if ( newArgc != 9 )
{
- kwsys_ios::cerr << "Bad number of unused arguments: " << newArgc << kwsys_ios::endl;
+ std::cerr << "Bad number of unused arguments: " << newArgc << std::endl;
res = 1;
}
for ( cc = 0; cc < newArgc; ++ cc )
{
assert(newArgv[cc]); /* Quiet Clang scan-build. */
- kwsys_ios::cout << "Unused argument[" << cc << "] = [" << newArgv[cc] << "]"
- << kwsys_ios::endl;
+ std::cout << "Unused argument[" << cc << "] = [" << newArgv[cc] << "]"
+ << std::endl;
if ( cc >= 9 )
{
- kwsys_ios::cerr << "Too many unused arguments: " << cc << kwsys_ios::endl;
+ std::cerr << "Too many unused arguments: " << cc << std::endl;
res = 1;
}
else if ( valid_unused_args[cc] &&
strcmp(valid_unused_args[cc], newArgv[cc]) != 0 )
{
- kwsys_ios::cerr << "Bad unused argument [" << cc << "] \""
+ std::cerr << "Bad unused argument [" << cc << "] \""
<< newArgv[cc] << "\" should be: \"" << valid_unused_args[cc] << "\""
- << kwsys_ios::endl;
+ << std::endl;
res = 1;
}
}
diff --git a/Source/kwsys/testDynamicLoader.cxx b/Source/kwsys/testDynamicLoader.cxx
index 58adb84..695a134 100644
--- a/Source/kwsys/testDynamicLoader.cxx
+++ b/Source/kwsys/testDynamicLoader.cxx
@@ -12,8 +12,6 @@
#include "kwsysPrivate.h"
#include KWSYS_HEADER(DynamicLoader.hxx)
-#include KWSYS_HEADER(ios/iostream)
-#include KWSYS_HEADER(stl/string)
#if defined(__BEOS__) || defined(__HAIKU__)
#include <be/kernel/OS.h> /* disable_debugger() API. */
@@ -23,18 +21,19 @@
// duplicate the above list of headers.
#if 0
# include "DynamicLoader.hxx.in"
-# include "kwsys_ios_iostream.h.in"
-# include "kwsys_stl_string.hxx.in"
#endif
+#include <string>
+#include <iostream>
+
// Include with <> instead of "" to avoid getting any in-source copy
// left on disk.
#include <testSystemTools.h>
-static kwsys_stl::string GetLibName(const char* lname)
+static std::string GetLibName(const char* lname)
{
// Construct proper name of lib
- kwsys_stl::string slname;
+ std::string slname;
slname = EXECUTABLE_OUTPUT_PATH;
#ifdef CMAKE_INTDIR
slname += "/";
@@ -56,30 +55,30 @@ static kwsys_stl::string GetLibName(const char* lname)
*/
int TestDynamicLoader(const char* libname, const char* symbol, int r1, int r2, int r3)
{
- kwsys_ios::cerr << "Testing: " << libname << kwsys_ios::endl;
+ std::cerr << "Testing: " << libname << std::endl;
kwsys::DynamicLoader::LibraryHandle l
= kwsys::DynamicLoader::OpenLibrary(libname);
// If result is incompatible with expectation just fails (xor):
if( (r1 && !l) || (!r1 && l) )
{
- kwsys_ios::cerr
- << kwsys::DynamicLoader::LastError() << kwsys_ios::endl;
+ std::cerr
+ << kwsys::DynamicLoader::LastError() << std::endl;
return 1;
}
kwsys::DynamicLoader::SymbolPointer f
= kwsys::DynamicLoader::GetSymbolAddress(l, symbol);
if( (r2 && !f) || (!r2 && f) )
{
- kwsys_ios::cerr
- << kwsys::DynamicLoader::LastError() << kwsys_ios::endl;
+ std::cerr
+ << kwsys::DynamicLoader::LastError() << std::endl;
return 1;
}
#ifndef __APPLE__
int s = kwsys::DynamicLoader::CloseLibrary(l);
if( (r3 && !s) || (!r3 && s) )
{
- kwsys_ios::cerr
- << kwsys::DynamicLoader::LastError() << kwsys_ios::endl;
+ std::cerr
+ << kwsys::DynamicLoader::LastError() << std::endl;
return 1;
}
#else
@@ -118,7 +117,7 @@ int testDynamicLoader(int argc, char *argv[])
res += TestDynamicLoader("libdl.so", "TestDynamicLoader",1,0,1);
#endif
// Now try on the generated library
- kwsys_stl::string libname = GetLibName(KWSYS_NAMESPACE_STRING "TestDynload");
+ std::string libname = GetLibName(KWSYS_NAMESPACE_STRING "TestDynload");
res += TestDynamicLoader(libname.c_str(), "dummy",1,0,1);
res += TestDynamicLoader(libname.c_str(), "TestDynamicLoaderSymbolPointer",1,1,1);
res += TestDynamicLoader(libname.c_str(), "_TestDynamicLoaderSymbolPointer",1,0,1);
diff --git a/Source/kwsys/testEncoding.cxx b/Source/kwsys/testEncoding.cxx
index 094588c..842b17d 100644
--- a/Source/kwsys/testEncoding.cxx
+++ b/Source/kwsys/testEncoding.cxx
@@ -17,8 +17,8 @@
#include KWSYS_HEADER(Encoding.hxx)
#include KWSYS_HEADER(Encoding.h)
-#include KWSYS_HEADER(ios/iostream)
+#include <iostream>
#include <locale.h>
#include <string.h>
#include <stdlib.h>
@@ -28,7 +28,6 @@
#if 0
# include "Encoding.hxx.in"
# include "Encoding.h.in"
-# include "kwsys_ios_iostream.h.in"
#endif
//----------------------------------------------------------------------------
diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx
index 9abfd4c..ac5220a 100644
--- a/Source/kwsys/testFStream.cxx
+++ b/Source/kwsys/testFStream.cxx
@@ -16,7 +16,6 @@
#endif
#include KWSYS_HEADER(FStream.hxx)
-#include KWSYS_HEADER(ios/iostream)
#include <string.h>
#ifdef __BORLANDC__
# include <mem.h> /* memcmp */
@@ -26,9 +25,9 @@
// duplicate the above list of headers.
#if 0
# include "FStream.hxx.in"
-# include "kwsys_ios_iostream.h.in"
#endif
+#include <iostream>
//----------------------------------------------------------------------------
static int testNoFile()
@@ -95,20 +94,20 @@ static int testBOM()
kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in);
if(bom != expected_bom[i])
{
- kwsys_ios::cout << "Unexpected BOM " << i << std::endl;
+ std::cout << "Unexpected BOM " << i << std::endl;
return 1;
}
char data[45];
in.read(data, file_data[i][0]);
if(!in.good())
{
- kwsys_ios::cout << "Unable to read data " << i << std::endl;
+ std::cout << "Unable to read data " << i << std::endl;
return 1;
}
if(memcmp(data, file_data[i]+1, file_data[i][0]) != 0)
{
- kwsys_ios::cout << "Incorrect read data " << i << std::endl;
+ std::cout << "Incorrect read data " << i << std::endl;
return 1;
}
@@ -125,20 +124,20 @@ static int testBOM()
kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in);
if(bom != kwsys::FStream::BOM_None)
{
- kwsys_ios::cout << "Unexpected BOM for none case" << std::endl;
+ std::cout << "Unexpected BOM for none case" << std::endl;
return 1;
}
char data[45];
in.read(data, file_data[0][0]);
if(!in.good())
{
- kwsys_ios::cout << "Unable to read data for none case" << std::endl;
+ std::cout << "Unable to read data for none case" << std::endl;
return 1;
}
if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0)
{
- kwsys_ios::cout << "Incorrect read data for none case" << std::endl;
+ std::cout << "Incorrect read data for none case" << std::endl;
return 1;
}
}
@@ -156,20 +155,20 @@ static int testBOM()
kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in);
if(bom != kwsys::FStream::BOM_UTF8)
{
- kwsys_ios::cout << "Unexpected BOM for utf-8 case" << std::endl;
+ std::cout << "Unexpected BOM for utf-8 case" << std::endl;
return 1;
}
char data[45];
in.read(data, file_data[0][0]);
if(!in.good())
{
- kwsys_ios::cout << "Unable to read data for utf-8 case" << std::endl;
+ std::cout << "Unable to read data for utf-8 case" << std::endl;
return 1;
}
if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0)
{
- kwsys_ios::cout << "Incorrect read data for utf-8 case" << std::endl;
+ std::cout << "Incorrect read data for utf-8 case" << std::endl;
return 1;
}
}
diff --git a/Source/kwsys/testHashSTL.cxx b/Source/kwsys/testHashSTL.cxx
index ac5cf74..ab1f83e 100644
--- a/Source/kwsys/testHashSTL.cxx
+++ b/Source/kwsys/testHashSTL.cxx
@@ -12,7 +12,6 @@
#include "kwsysPrivate.h"
#include KWSYS_HEADER(hash_map.hxx)
#include KWSYS_HEADER(hash_set.hxx)
-#include KWSYS_HEADER(ios/iostream)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
@@ -20,9 +19,10 @@
# include "hash_map.hxx.in"
# include "hash_set.hxx.in"
# include "hashtable.hxx.in"
-# include "kwsys_ios_iostream.h.in"
#endif
+#include <iostream>
+
#if defined(_MSC_VER)
# pragma warning (disable:4786)
#endif
@@ -44,8 +44,8 @@ static bool test_hash_map()
int sum = 0;
for(mtype::iterator mi = m.begin(); mi != m.end(); ++mi)
{
- kwsys_ios::cout << "Found entry [" << mi->first << "," << mi->second << "]"
- << kwsys_ios::endl;
+ std::cout << "Found entry [" << mi->first << "," << mi->second << "]"
+ << std::endl;
sum += mi->second;
}
return sum == 3;
@@ -60,7 +60,7 @@ static bool test_hash_set()
int sum = 0;
for(stype::iterator si = s.begin(); si != s.end(); ++si)
{
- kwsys_ios::cout << "Found entry [" << *si << "]" << kwsys_ios::endl;
+ std::cout << "Found entry [" << *si << "]" << std::endl;
sum += *si;
}
return sum == 3;
diff --git a/Source/kwsys/testIOS.cxx b/Source/kwsys/testIOS.cxx
index f0c7f1a..396a09d 100644
--- a/Source/kwsys/testIOS.cxx
+++ b/Source/kwsys/testIOS.cxx
@@ -10,158 +10,149 @@
See the License for more information.
============================================================================*/
#include "kwsysPrivate.h"
-#include KWSYS_HEADER(stl/vector)
-#include KWSYS_HEADER(ios/sstream)
-#include KWSYS_HEADER(ios/fstream)
-#include KWSYS_HEADER(ios/iostream)
-
-// Work-around CMake dependency scanning limitation. This must
-// duplicate the above list of headers.
-#if 0
-# include "kwsys_stl_string.hxx.in"
-# include "kwsys_stl_vector.h.in"
-# include "kwsys_ios_sstream.h.in"
-# include "kwsys_ios_fstream.h.in"
-# include "kwsys_ios_iostream.h.in"
-#endif
+#include KWSYS_HEADER(Configure.hxx)
+#include <sstream>
+#include <fstream>
+#include <iostream>
+#include <vector>
#include <string.h> /* strlen */
int testIOS(int, char*[])
{
- kwsys_ios::ostringstream ostr;
+ std::ostringstream ostr;
const char hello[] = "hello";
ostr << hello;
if(ostr.str() != hello)
{
- kwsys_ios::cerr << "failed to write hello to ostr" << kwsys_ios::endl;
+ std::cerr << "failed to write hello to ostr" << std::endl;
return 1;
}
const char world[] = "world";
- kwsys_ios::ostringstream ostr2;
+ std::ostringstream ostr2;
ostr2.write( hello, strlen(hello) ); /* I could do sizeof */
ostr2.put( '\0' );
ostr2.write( world, strlen(world) );
if(ostr2.str().size() != strlen(hello) + 1 + strlen(world) )
{
- kwsys_ios::cerr << "failed to write hello to ostr2" << kwsys_ios::endl;
+ std::cerr << "failed to write hello to ostr2" << std::endl;
return 1;
}
static const unsigned char array[] = { 0xff,0x4f,0xff,0x51,0x00,0x29,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x01,0x01,0xff,0x52,0x00,0x0c,0x00,0x00,0x00,0x01,0x00,0x05,0x04,0x04,0x00,0x01,0xff,0x5c,0x00,0x13,0x40,0x40,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0xff,0x64,0x00,0x2c,0x00,0x00,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x49,0x54,0x4b,0x2f,0x47,0x44,0x43,0x4d,0x2f,0x4f,0x70,0x65,0x6e,0x4a,0x50,0x45,0x47,0x20,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x31,0x2e,0x30,0xff,0x90,0x00,0x0a,0x00,0x00,0x00,0x00,0x06,0x2c,0x00,0x01,0xff,0x93,0xcf,0xb0,0x18,0x08,0x7f,0xc6,0x99,0xbf,0xff,0xc0,0xf8,0xc1,0xc1,0xf3,0x05,0x81,0xf2,0x83,0x0a,0xa5,0xff,0x10,0x90,0xbf,0x2f,0xff,0x04,0xa8,0x7f,0xc0,0xf8,0xc4,0xc1,0xf3,0x09,0x81,0xf3,0x0c,0x19,0x34 };
const size_t narray = sizeof(array); // 180
- kwsys_ios::stringstream strstr;
+ std::stringstream strstr;
strstr.write( (char*)array, narray );
//strstr.seekp( narray / 2 ); // set position of put pointer in mid string
if(strstr.str().size() != narray )
{
- kwsys_ios::cerr << "failed to write array to strstr" << kwsys_ios::endl;
+ std::cerr << "failed to write array to strstr" << std::endl;
return 1;
}
- kwsys_ios::istringstream istr(" 10 20 str ");
- kwsys_stl::string s;
+ std::istringstream istr(" 10 20 str ");
+ std::string s;
int x;
if(istr >> x)
{
if(x != 10)
{
- kwsys_ios::cerr << "x != 10" << kwsys_ios::endl;
+ std::cerr << "x != 10" << std::endl;
return 1;
}
}
else
{
- kwsys_ios::cerr << "Failed to read 10 from istr" << kwsys_ios::endl;
+ std::cerr << "Failed to read 10 from istr" << std::endl;
return 1;
}
if(istr >> x)
{
if(x != 20)
{
- kwsys_ios::cerr << "x != 20" << kwsys_ios::endl;
+ std::cerr << "x != 20" << std::endl;
return 1;
}
}
else
{
- kwsys_ios::cerr << "Failed to read 20 from istr" << kwsys_ios::endl;
+ std::cerr << "Failed to read 20 from istr" << std::endl;
return 1;
}
if(istr >> s)
{
if(s != "str")
{
- kwsys_ios::cerr << "s != \"str\"" << kwsys_ios::endl;
+ std::cerr << "s != \"str\"" << std::endl;
return 1;
}
}
else
{
- kwsys_ios::cerr << "Failed to read str from istr" << kwsys_ios::endl;
+ std::cerr << "Failed to read str from istr" << std::endl;
return 1;
}
if(istr >> s)
{
- kwsys_ios::cerr << "Able to read past end of stream" << kwsys_ios::endl;
+ std::cerr << "Able to read past end of stream" << std::endl;
return 1;
}
else
{
// Clear the failure.
- istr.clear(istr.rdstate() & ~kwsys_ios::ios::eofbit);
- istr.clear(istr.rdstate() & ~kwsys_ios::ios::failbit);
+ istr.clear(istr.rdstate() & ~std::ios::eofbit);
+ istr.clear(istr.rdstate() & ~std::ios::failbit);
}
istr.str("30");
if(istr >> x)
{
if(x != 30)
{
- kwsys_ios::cerr << "x != 30" << kwsys_ios::endl;
+ std::cerr << "x != 30" << std::endl;
return 1;
}
}
else
{
- kwsys_ios::cerr << "Failed to read 30 from istr" << kwsys_ios::endl;
+ std::cerr << "Failed to read 30 from istr" << std::endl;
return 1;
}
- kwsys_ios::stringstream sstr;
+ std::stringstream sstr;
sstr << "40 str2";
if(sstr >> x)
{
if(x != 40)
{
- kwsys_ios::cerr << "x != 40" << kwsys_ios::endl;
+ std::cerr << "x != 40" << std::endl;
return 1;
}
}
else
{
- kwsys_ios::cerr << "Failed to read 40 from sstr" << kwsys_ios::endl;
+ std::cerr << "Failed to read 40 from sstr" << std::endl;
return 1;
}
if(sstr >> s)
{
if(s != "str2")
{
- kwsys_ios::cerr << "s != \"str2\"" << kwsys_ios::endl;
+ std::cerr << "s != \"str2\"" << std::endl;
return 1;
}
}
else
{
- kwsys_ios::cerr << "Failed to read str2 from sstr" << kwsys_ios::endl;
+ std::cerr << "Failed to read str2 from sstr" << std::endl;
return 1;
}
// Just try to compile this.
if(x == 12345)
{
- kwsys_ios::ifstream fin("/does_not_exist",
- kwsys_ios::ios::in | kwsys_ios_binary);
+ std::ifstream fin("/does_not_exist",
+ std::ios::in | std::ios::binary);
}
- kwsys_ios::cout << "IOS tests passed" << kwsys_ios::endl;
+ std::cout << "IOS tests passed" << std::endl;
return 0;
}
diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c
index d0e20c1..8fd3382 100644
--- a/Source/kwsys/testProcess.c
+++ b/Source/kwsys/testProcess.c
@@ -21,6 +21,7 @@
#endif
#include <assert.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -74,6 +75,16 @@ int runChild(const char* cmd[], int state, int exception, int value,
static int test1(int argc, const char* argv[])
{
+ /* This is a very basic functional test of kwsysProcess. It is repeated
+ numerous times to verify that there are no resource leaks in kwsysProcess
+ that eventually lead to an error. Many versions of OS X will fail after
+ 256 leaked file handles, so 257 iterations seems to be a good test. On
+ the other hand, too many iterations will cause the test to time out -
+ especially if the test is instrumented with e.g. valgrind.
+
+ If you have problems with this test timing out on your system, or want to
+ run more than 257 iterations, you can change the number of iterations by
+ setting the KWSYS_TEST_PROCESS_1_COUNT environment variable. */
(void)argc; (void)argv;
fprintf(stdout, "Output on stdout from test returning 0.\n");
fprintf(stderr, "Output on stderr from test returning 0.\n");
@@ -557,6 +568,10 @@ int runChild(const char* cmd[], int state, int exception, int value,
result = runChild2(kp, cmd, state, exception, value, share,
output, delay, timeout, poll, disown, createNewGroup,
interruptDelay);
+ if(result)
+ {
+ break;
+ }
}
kwsysProcess_Delete(kp);
return result;
@@ -660,13 +675,24 @@ int main(int argc, const char* argv[])
int delays[10] = {0, 0, 0, 0, 0, 1, 0, 0, 0, 0};
double timeouts[10] = {10, 10, 10, 30, 30, 10, -1, 10, 6, 4};
int polls[10] = {0, 0, 0, 0, 0, 0, 1, 0, 0, 0};
- int repeat[10] = {2, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ int repeat[10] = {257, 1, 1, 1, 1, 1, 1, 1, 1, 1};
int createNewGroups[10] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1};
unsigned int interruptDelays[10] = {0, 0, 0, 0, 0, 0, 0, 0, 3, 2};
int r;
const char* cmd[4];
#ifdef _WIN32
char* argv0 = 0;
+#endif
+ char* test1IterationsStr = getenv("KWSYS_TEST_PROCESS_1_COUNT");
+ if(test1IterationsStr)
+ {
+ long int test1Iterations = strtol(test1IterationsStr, 0, 10);
+ if(test1Iterations > 10 && test1Iterations != LONG_MAX)
+ {
+ repeat[0] = (int)test1Iterations;
+ }
+ }
+#ifdef _WIN32
if(n == 0 && (argv0 = strdup(argv[0])))
{
/* Try converting to forward slashes to see if it works. */
diff --git a/Source/kwsys/testSystemInformation.cxx b/Source/kwsys/testSystemInformation.cxx
index fc8ea55..c96751a 100644
--- a/Source/kwsys/testSystemInformation.cxx
+++ b/Source/kwsys/testSystemInformation.cxx
@@ -11,15 +11,15 @@
============================================================================*/
#include "kwsysPrivate.h"
#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
# include "SystemInformation.hxx.in"
-# include "kwsys_ios_iostream.h.in"
#endif
+#include <iostream>
+
#if defined(KWSYS_USE_LONG_LONG)
# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
# define iostreamLongLong(x) (x)
@@ -36,18 +36,18 @@
# error "No Long Long"
#endif
-#define printMethod(info, m) kwsys_ios::cout << #m << ": " \
+#define printMethod(info, m) std::cout << #m << ": " \
<< info.m() << "\n"
-#define printMethod2(info, m, unit) kwsys_ios::cout << #m << ": " \
+#define printMethod2(info, m, unit) std::cout << #m << ": " \
<< info.m() << " " << unit << "\n"
-#define printMethod3(info, m, unit) kwsys_ios::cout << #m << ": " \
+#define printMethod3(info, m, unit) std::cout << #m << ": " \
<< iostreamLongLong(info.m) << " " << unit << "\n"
int testSystemInformation(int, char*[])
{
- kwsys_ios::cout << "CTEST_FULL_OUTPUT\n"; // avoid truncation
+ std::cout << "CTEST_FULL_OUTPUT\n"; // avoid truncation
kwsys::SystemInformation info;
info.RunCPUCheck();
@@ -93,16 +93,16 @@ int testSystemInformation(int, char*[])
{
if (info.DoesCPUSupportFeature(static_cast<long int>(1) << i))
{
- kwsys_ios::cout << "CPU feature " << i << "\n";
+ std::cout << "CPU feature " << i << "\n";
}
}
/* test stack trace
*/
- kwsys_ios::cout
- << "Program Stack:" << kwsys_ios::endl
- << kwsys::SystemInformation::GetProgramStack(0,0) << kwsys_ios::endl
- << kwsys_ios::endl;
+ std::cout
+ << "Program Stack:" << std::endl
+ << kwsys::SystemInformation::GetProgramStack(0,0) << std::endl
+ << std::endl;
/* test segv handler
info.SetStackTraceOnError(1);
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 7b5c025..e14d2fc 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -16,20 +16,30 @@
#endif
#include KWSYS_HEADER(SystemTools.hxx)
-#include KWSYS_HEADER(ios/iostream)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "SystemTools.hxx.in"
-# include "kwsys_ios_iostream.h.in"
#endif
// Include with <> instead of "" to avoid getting any in-source copy
// left on disk.
#include <testSystemTools.h>
+#include <iostream>
#include <string.h> /* strcmp */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+# include <io.h> /* _umask (MSVC) / umask (Borland) */
+# ifdef _MSC_VER
+# define umask _umask // Note this is still umask on Borland
+# endif
+#endif
+#include <sys/stat.h> /* umask (POSIX), _S_I* constants (Windows) */
+// Visual C++ does not define mode_t (note that Borland does, however).
+#if defined( _MSC_VER )
+typedef unsigned short mode_t;
+#endif
//----------------------------------------------------------------------------
static const char* toUnixPaths[][2] =
@@ -52,17 +62,17 @@ static const char* toUnixPaths[][2] =
{0, 0}
};
-static bool CheckConvertToUnixSlashes(kwsys_stl::string input,
- kwsys_stl::string output)
+static bool CheckConvertToUnixSlashes(std::string input,
+ std::string output)
{
- kwsys_stl::string result = input;
+ std::string result = input;
kwsys::SystemTools::ConvertToUnixSlashes(result);
if ( result != output )
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToUnixSlashes - input: " << input
<< " output: " << result << " expected: " << output
- << kwsys_ios::endl;
+ << std::endl;
return false;
}
return true;
@@ -76,19 +86,19 @@ static const char* checkEscapeChars[][4] =
{0, 0, 0, 0}
};
-static bool CheckEscapeChars(kwsys_stl::string input,
+static bool CheckEscapeChars(std::string input,
const char *chars_to_escape,
char escape_char,
- kwsys_stl::string output)
+ std::string output)
{
- kwsys_stl::string result = kwsys::SystemTools::EscapeChars(
+ std::string result = kwsys::SystemTools::EscapeChars(
input.c_str(), chars_to_escape, escape_char);
if (result != output)
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with CheckEscapeChars - input: " << input
<< " output: " << result << " expected: " << output
- << kwsys_ios::endl;
+ << std::endl;
return false;
}
return true;
@@ -98,100 +108,229 @@ static bool CheckEscapeChars(kwsys_stl::string input,
static bool CheckFileOperations()
{
bool res = true;
- const kwsys_stl::string testNonExistingFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+ const std::string testNonExistingFile(TEST_SYSTEMTOOLS_SOURCE_DIR
"/testSystemToolsNonExistingFile");
- const kwsys_stl::string testDotFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+ const std::string testDotFile(TEST_SYSTEMTOOLS_SOURCE_DIR
"/.");
- const kwsys_stl::string testBinFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+ const std::string testBinFile(TEST_SYSTEMTOOLS_SOURCE_DIR
"/testSystemTools.bin");
- const kwsys_stl::string testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+ const std::string testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR
"/testSystemTools.cxx");
- const kwsys_stl::string testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR
+ const std::string testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR
"/testSystemToolsNewDir");
- const kwsys_stl::string testNewFile(testNewDir + "/testNewFile.txt");
+ const std::string testNewFile(testNewDir + "/testNewFile.txt");
if (kwsys::SystemTools::DetectFileType(testNonExistingFile.c_str()) !=
kwsys::SystemTools::FileTypeUnknown)
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with DetectFileType - failed to detect type of: "
- << testNonExistingFile << kwsys_ios::endl;
+ << testNonExistingFile << std::endl;
res = false;
}
if (kwsys::SystemTools::DetectFileType(testDotFile.c_str()) !=
kwsys::SystemTools::FileTypeUnknown)
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with DetectFileType - failed to detect type of: "
- << testDotFile << kwsys_ios::endl;
+ << testDotFile << std::endl;
res = false;
}
if (kwsys::SystemTools::DetectFileType(testBinFile.c_str()) !=
kwsys::SystemTools::FileTypeBinary)
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with DetectFileType - failed to detect type of: "
- << testBinFile << kwsys_ios::endl;
+ << testBinFile << std::endl;
res = false;
}
if (kwsys::SystemTools::DetectFileType(testTxtFile.c_str()) !=
kwsys::SystemTools::FileTypeText)
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with DetectFileType - failed to detect type of: "
- << testTxtFile << kwsys_ios::endl;
+ << testTxtFile << std::endl;
res = false;
}
if (kwsys::SystemTools::FileLength(testBinFile) != 766)
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with FileLength - incorrect length for: "
- << testBinFile << kwsys_ios::endl;
+ << testBinFile << std::endl;
res = false;
}
if (!kwsys::SystemTools::MakeDirectory(testNewDir))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with MakeDirectory for: "
- << testNewDir << kwsys_ios::endl;
+ << testNewDir << std::endl;
res = false;
}
if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with Touch for: "
- << testNewFile << kwsys_ios::endl;
+ << testNewFile << std::endl;
+ res = false;
+ }
+
+ // Reset umask
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ // NOTE: Windows doesn't support toggling _S_IREAD.
+ mode_t fullMask = _S_IWRITE;
+#else
+ // On a normal POSIX platform, we can toggle all permissions.
+ mode_t fullMask = S_IRWXU | S_IRWXG | S_IRWXO;
+#endif
+ mode_t orig_umask = umask(fullMask);
+
+ // Test file permissions without umask
+ mode_t origPerm, thisPerm;
+ if (!kwsys::SystemTools::GetPermissions(testNewFile, origPerm))
+ {
+ std::cerr
+ << "Problem with GetPermissions (1) for: "
+ << testNewFile << std::endl;
+ res = false;
+ }
+
+ if (!kwsys::SystemTools::SetPermissions(testNewFile, 0))
+ {
+ std::cerr
+ << "Problem with SetPermissions (1) for: "
+ << testNewFile << std::endl;
+ res = false;
+ }
+
+ if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm))
+ {
+ std::cerr
+ << "Problem with GetPermissions (2) for: "
+ << testNewFile << std::endl;
+ res = false;
+ }
+
+ if ((thisPerm & fullMask) != 0)
+ {
+ std::cerr
+ << "SetPermissions failed to set permissions (1) for: "
+ << testNewFile << ": actual = " << thisPerm << "; expected = "
+ << 0 << std::endl;
+ res = false;
+ }
+
+ // While we're at it, check proper TestFileAccess functionality.
+ if (kwsys::SystemTools::TestFileAccess(testNewFile,
+ kwsys::TEST_FILE_WRITE))
+ {
+ std::cerr
+ << "TestFileAccess incorrectly indicated that this is a writable file:"
+ << testNewFile << std::endl;
+ res = false;
+ }
+
+ if (!kwsys::SystemTools::TestFileAccess(testNewFile,
+ kwsys::TEST_FILE_OK))
+ {
+ std::cerr
+ << "TestFileAccess incorrectly indicated that this file does not exist:"
+ << testNewFile << std::endl;
+ res = false;
+ }
+
+ // Test restoring/setting full permissions.
+ if (!kwsys::SystemTools::SetPermissions(testNewFile, fullMask))
+ {
+ std::cerr
+ << "Problem with SetPermissions (2) for: "
+ << testNewFile << std::endl;
+ res = false;
+ }
+
+ if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm))
+ {
+ std::cerr
+ << "Problem with GetPermissions (3) for: "
+ << testNewFile << std::endl;
+ res = false;
+ }
+
+ if ((thisPerm & fullMask) != fullMask)
+ {
+ std::cerr
+ << "SetPermissions failed to set permissions (2) for: "
+ << testNewFile << ": actual = " << thisPerm << "; expected = "
+ << fullMask << std::endl;
+ res = false;
+ }
+
+ // Test setting file permissions while honoring umask
+ if (!kwsys::SystemTools::SetPermissions(testNewFile, fullMask, true))
+ {
+ std::cerr
+ << "Problem with SetPermissions (3) for: "
+ << testNewFile << std::endl;
res = false;
}
+ if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm))
+ {
+ std::cerr
+ << "Problem with GetPermissions (4) for: "
+ << testNewFile << std::endl;
+ res = false;
+ }
+
+ if ((thisPerm & fullMask) != 0)
+ {
+ std::cerr
+ << "SetPermissions failed to honor umask for: "
+ << testNewFile << ": actual = " << thisPerm << "; expected = "
+ << 0 << std::endl;
+ res = false;
+ }
+
+ // Restore umask
+ umask(orig_umask);
+
+ // Restore file permissions
+ if (!kwsys::SystemTools::SetPermissions(testNewFile, origPerm))
+ {
+ std::cerr
+ << "Problem with SetPermissions (4) for: "
+ << testNewFile << std::endl;
+ res = false;
+ }
+
+ // Remove the test file
if (!kwsys::SystemTools::RemoveFile(testNewFile))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with RemoveFile: "
- << testNewFile << kwsys_ios::endl;
+ << testNewFile << std::endl;
res = false;
}
- kwsys_stl::string const testFileMissing(testNewDir + "/testMissingFile.txt");
+ std::string const testFileMissing(testNewDir + "/testMissingFile.txt");
if (!kwsys::SystemTools::RemoveFile(testFileMissing))
{
std::string const& msg = kwsys::SystemTools::GetLastSystemError();
- kwsys_ios::cerr <<
+ std::cerr <<
"RemoveFile(\"" << testFileMissing << "\") failed: " << msg << "\n";
res = false;
}
- kwsys_stl::string const testFileMissingDir(testNewDir + "/missing/file.txt");
+ std::string const testFileMissingDir(testNewDir + "/missing/file.txt");
if (!kwsys::SystemTools::RemoveFile(testFileMissingDir))
{
std::string const& msg = kwsys::SystemTools::GetLastSystemError();
- kwsys_ios::cerr <<
+ std::cerr <<
"RemoveFile(\"" << testFileMissingDir << "\") failed: " << msg << "\n";
res = false;
}
@@ -199,9 +338,9 @@ static bool CheckFileOperations()
kwsys::SystemTools::Touch(testNewFile.c_str(), true);
if (!kwsys::SystemTools::RemoveADirectory(testNewDir))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with RemoveADirectory for: "
- << testNewDir << kwsys_ios::endl;
+ << testNewDir << std::endl;
res = false;
}
@@ -209,14 +348,14 @@ static bool CheckFileOperations()
// Perform the same file and directory creation and deletion tests but
// with paths > 256 characters in length.
- const kwsys_stl::string testNewLongDir(
+ const std::string testNewLongDir(
TEST_SYSTEMTOOLS_BINARY_DIR "/"
"012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789"
"01234567890123");
- const kwsys_stl::string testNewLongFile(testNewLongDir + "/"
+ const std::string testNewLongFile(testNewLongDir + "/"
"012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789"
@@ -225,34 +364,34 @@ static bool CheckFileOperations()
if (!kwsys::SystemTools::MakeDirectory(testNewLongDir))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with MakeDirectory for: "
- << testNewLongDir << kwsys_ios::endl;
+ << testNewLongDir << std::endl;
res = false;
}
if (!kwsys::SystemTools::Touch(testNewLongFile.c_str(), true))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with Touch for: "
- << testNewLongFile << kwsys_ios::endl;
+ << testNewLongFile << std::endl;
res = false;
}
if (!kwsys::SystemTools::RemoveFile(testNewLongFile))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with RemoveFile: "
- << testNewLongFile << kwsys_ios::endl;
+ << testNewLongFile << std::endl;
res = false;
}
kwsys::SystemTools::Touch(testNewLongFile.c_str(), true);
if (!kwsys::SystemTools::RemoveADirectory(testNewLongDir))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with RemoveADirectory for: "
- << testNewLongDir << kwsys_ios::endl;
+ << testNewLongDir << std::endl;
res = false;
}
#endif
@@ -265,84 +404,84 @@ static bool CheckStringOperations()
{
bool res = true;
- kwsys_stl::string test = "mary had a little lamb.";
+ std::string test = "mary had a little lamb.";
if (kwsys::SystemTools::CapitalizedWords(test) != "Mary Had A Little Lamb.")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with CapitalizedWords "
- << '"' << test << '"' << kwsys_ios::endl;
- res = false;
+ << '"' << test << '"' << std::endl;
+ res = false;
}
test = "Mary Had A Little Lamb.";
- if (kwsys::SystemTools::UnCapitalizedWords(test) !=
+ if (kwsys::SystemTools::UnCapitalizedWords(test) !=
"mary had a little lamb.")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with UnCapitalizedWords "
- << '"' << test << '"' << kwsys_ios::endl;
- res = false;
+ << '"' << test << '"' << std::endl;
+ res = false;
}
test = "MaryHadTheLittleLamb.";
- if (kwsys::SystemTools::AddSpaceBetweenCapitalizedWords(test) !=
+ if (kwsys::SystemTools::AddSpaceBetweenCapitalizedWords(test) !=
"Mary Had The Little Lamb.")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with AddSpaceBetweenCapitalizedWords "
- << '"' << test << '"' << kwsys_ios::endl;
- res = false;
+ << '"' << test << '"' << std::endl;
+ res = false;
}
- char * cres =
+ char * cres =
kwsys::SystemTools::AppendStrings("Mary Had A"," Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb."))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with AppendStrings "
- << "\"Mary Had A\" \" Little Lamb.\"" << kwsys_ios::endl;
- res = false;
+ << "\"Mary Had A\" \" Little Lamb.\"" << std::endl;
+ res = false;
}
delete [] cres;
- cres =
+ cres =
kwsys::SystemTools::AppendStrings("Mary Had"," A ","Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb."))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with AppendStrings "
- << "\"Mary Had\" \" A \" \"Little Lamb.\"" << kwsys_ios::endl;
- res = false;
+ << "\"Mary Had\" \" A \" \"Little Lamb.\"" << std::endl;
+ res = false;
}
delete [] cres;
if (kwsys::SystemTools::CountChar("Mary Had A Little Lamb.",'a') != 3)
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with CountChar "
- << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
- res = false;
+ << "\"Mary Had A Little Lamb.\"" << std::endl;
+ res = false;
}
- cres =
+ cres =
kwsys::SystemTools::RemoveChars("Mary Had A Little Lamb.","aeiou");
if (strcmp(cres,"Mry Hd A Lttl Lmb."))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with RemoveChars "
- << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
- res = false;
+ << "\"Mary Had A Little Lamb.\"" << std::endl;
+ res = false;
}
delete [] cres;
- cres =
+ cres =
kwsys::SystemTools::RemoveCharsButUpperHex("Mary Had A Little Lamb.");
if (strcmp(cres,"A"))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with RemoveCharsButUpperHex "
- << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
- res = false;
+ << "\"Mary Had A Little Lamb.\"" << std::endl;
+ res = false;
}
delete [] cres;
@@ -351,59 +490,59 @@ static bool CheckStringOperations()
kwsys::SystemTools::ReplaceChars(cres2,"aeiou",'X');
if (strcmp(cres2,"MXry HXd A LXttlX LXmb."))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ReplaceChars "
- << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
- res = false;
+ << "\"Mary Had A Little Lamb.\"" << std::endl;
+ res = false;
}
delete [] cres2;
if (!kwsys::SystemTools::StringStartsWith("Mary Had A Little Lamb.",
"Mary "))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with StringStartsWith "
- << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
- res = false;
+ << "\"Mary Had A Little Lamb.\"" << std::endl;
+ res = false;
}
if (!kwsys::SystemTools::StringEndsWith("Mary Had A Little Lamb.",
" Lamb."))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with StringEndsWith "
- << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
- res = false;
+ << "\"Mary Had A Little Lamb.\"" << std::endl;
+ res = false;
}
cres = kwsys::SystemTools::DuplicateString("Mary Had A Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb."))
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with DuplicateString "
- << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
- res = false;
+ << "\"Mary Had A Little Lamb.\"" << std::endl;
+ res = false;
}
delete [] cres;
test = "Mary Had A Little Lamb.";
- if (kwsys::SystemTools::CropString(test,13) !=
+ if (kwsys::SystemTools::CropString(test,13) !=
"Mary ...Lamb.")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with CropString "
- << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
- res = false;
+ << "\"Mary Had A Little Lamb.\"" << std::endl;
+ res = false;
}
- kwsys_stl::vector<kwsys_stl::string> lines;
+ std::vector<std::string> lines;
kwsys::SystemTools::Split("Mary Had A Little Lamb.",lines,' ');
if (lines[0] != "Mary" || lines[1] != "Had" ||
lines[2] != "A" || lines[3] != "Little" || lines[4] != "Lamb.")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with Split "
- << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
+ << "\"Mary Had A Little Lamb.\"" << std::endl;
res = false;
}
@@ -412,10 +551,10 @@ static bool CheckStringOperations()
("L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") !=
L"\\\\?\\L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsExtendedPath "
<< "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\""
- << kwsys_ios::endl;
+ << std::endl;
res = false;
}
@@ -423,10 +562,10 @@ static bool CheckStringOperations()
("L:/Local Mojo/Hex Power Pack/Iffy Voodoo") !=
L"\\\\?\\L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsExtendedPath "
<< "\"L:/Local Mojo/Hex Power Pack/Iffy Voodoo\""
- << kwsys_ios::endl;
+ << std::endl;
res = false;
}
@@ -434,10 +573,10 @@ static bool CheckStringOperations()
("\\\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") !=
L"\\\\?\\UNC\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsExtendedPath "
<< "\"\\\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\""
- << kwsys_ios::endl;
+ << std::endl;
res = false;
}
@@ -445,106 +584,106 @@ static bool CheckStringOperations()
("//Foo/Local Mojo/Hex Power Pack/Iffy Voodoo") !=
L"\\\\?\\UNC\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsExtendedPath "
<< "\"//Foo/Local Mojo/Hex Power Pack/Iffy Voodoo\""
- << kwsys_ios::endl;
+ << std::endl;
res = false;
}
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("//") !=
L"//")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsExtendedPath "
<< "\"//\""
- << kwsys_ios::endl;
+ << std::endl;
res = false;
}
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\") !=
L"\\\\.\\")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsExtendedPath "
<< "\"\\\\.\\\""
- << kwsys_ios::endl;
+ << std::endl;
res = false;
}
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X") !=
L"\\\\.\\X")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsExtendedPath "
<< "\"\\\\.\\X\""
- << kwsys_ios::endl;
+ << std::endl;
res = false;
}
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:") !=
L"\\\\?\\X:")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsExtendedPath "
<< "\"\\\\.\\X:\""
- << kwsys_ios::endl;
+ << std::endl;
res = false;
}
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:\\") !=
L"\\\\?\\X:\\")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsExtendedPath "
<< "\"\\\\.\\X:\\\""
- << kwsys_ios::endl;
+ << std::endl;
res = false;
}
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("NUL") !=
L"\\\\.\\NUL")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsExtendedPath "
<< "\"NUL\""
- << kwsys_ios::endl;
+ << std::endl;
res = false;
}
#endif
if (kwsys::SystemTools::ConvertToWindowsOutputPath
- ("L://Local Mojo/Hex Power Pack/Iffy Voodoo") !=
+ ("L://Local Mojo/Hex Power Pack/Iffy Voodoo") !=
"\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsOutputPath "
<< "\"L://Local Mojo/Hex Power Pack/Iffy Voodoo\""
- << kwsys_ios::endl;
- res = false;
+ << std::endl;
+ res = false;
}
-
+
if (kwsys::SystemTools::ConvertToWindowsOutputPath
- ("//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo") !=
+ ("//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo") !=
"\"\\\\grayson\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToWindowsOutputPath "
<< "\"//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo\""
- << kwsys_ios::endl;
- res = false;
+ << std::endl;
+ res = false;
}
if (kwsys::SystemTools::ConvertToUnixOutputPath
- ("//Local Mojo/Hex Power Pack/Iffy Voodoo") !=
+ ("//Local Mojo/Hex Power Pack/Iffy Voodoo") !=
"//Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo")
{
- kwsys_ios::cerr
+ std::cerr
<< "Problem with ConvertToUnixOutputPath "
<< "\"//Local Mojo/Hex Power Pack/Iffy Voodoo\""
- << kwsys_ios::endl;
- res = false;
+ << std::endl;
+ res = false;
}
return res;
@@ -552,20 +691,20 @@ static bool CheckStringOperations()
//----------------------------------------------------------------------------
-static bool CheckPutEnv(const kwsys_stl::string& env, const char* name, const char* value)
+static bool CheckPutEnv(const std::string& env, const char* name, const char* value)
{
if(!kwsys::SystemTools::PutEnv(env))
{
- kwsys_ios::cerr << "PutEnv(\"" << env
- << "\") failed!" << kwsys_ios::endl;
+ std::cerr << "PutEnv(\"" << env
+ << "\") failed!" << std::endl;
return false;
}
const char* v = kwsys::SystemTools::GetEnv(name);
v = v? v : "(null)";
if(strcmp(v, value) != 0)
{
- kwsys_ios::cerr << "GetEnv(\"" << name << "\") returned \""
- << v << "\", not \"" << value << "\"!" << kwsys_ios::endl;
+ std::cerr << "GetEnv(\"" << name << "\") returned \""
+ << v << "\", not \"" << value << "\"!" << std::endl;
return false;
}
return true;
@@ -575,14 +714,14 @@ static bool CheckUnPutEnv(const char* env, const char* name)
{
if(!kwsys::SystemTools::UnPutEnv(env))
{
- kwsys_ios::cerr << "UnPutEnv(\"" << env << "\") failed!"
- << kwsys_ios::endl;
+ std::cerr << "UnPutEnv(\"" << env << "\") failed!"
+ << std::endl;
return false;
}
if(const char* v = kwsys::SystemTools::GetEnv(name))
{
- kwsys_ios::cerr << "GetEnv(\"" << name << "\") returned \""
- << v << "\", not (null)!" << kwsys_ios::endl;
+ std::cerr << "GetEnv(\"" << name << "\") returned \""
+ << v << "\", not (null)!" << std::endl;
return false;
}
return true;
@@ -604,15 +743,15 @@ static bool CheckEnvironmentOperations()
static bool CheckRelativePath(
- const kwsys_stl::string& local,
- const kwsys_stl::string& remote,
- const kwsys_stl::string& expected)
+ const std::string& local,
+ const std::string& remote,
+ const std::string& expected)
{
- kwsys_stl::string result = kwsys::SystemTools::RelativePath(local, remote);
+ std::string result = kwsys::SystemTools::RelativePath(local, remote);
if(expected != result)
{
- kwsys_ios::cerr << "RelativePath(" << local << ", " << remote
- << ") yielded " << result << " instead of " << expected << kwsys_ios::endl;
+ std::cerr << "RelativePath(" << local << ", " << remote
+ << ") yielded " << result << " instead of " << expected << std::endl;
return false;
}
return true;
@@ -630,14 +769,14 @@ static bool CheckRelativePaths()
}
static bool CheckCollapsePath(
- const kwsys_stl::string& path,
- const kwsys_stl::string& expected)
+ const std::string& path,
+ const std::string& expected)
{
- kwsys_stl::string result = kwsys::SystemTools::CollapseFullPath(path);
+ std::string result = kwsys::SystemTools::CollapseFullPath(path);
if(expected != result)
{
- kwsys_ios::cerr << "CollapseFullPath(" << path
- << ") yielded " << result << " instead of " << expected << kwsys_ios::endl;
+ std::cerr << "CollapseFullPath(" << path
+ << ") yielded " << result << " instead of " << expected << std::endl;
return false;
}
return true;
@@ -663,7 +802,7 @@ int testSystemTools(int, char*[])
}
// Special check for ~
- kwsys_stl::string output;
+ std::string output;
if(kwsys::SystemTools::GetEnv("HOME", output))
{
output += "/foo bar/lala";
@@ -672,7 +811,7 @@ int testSystemTools(int, char*[])
for (cc = 0; checkEscapeChars[cc][0]; cc ++ )
{
- res &= CheckEscapeChars(checkEscapeChars[cc][0], checkEscapeChars[cc][1],
+ res &= CheckEscapeChars(checkEscapeChars[cc][0], checkEscapeChars[cc][1],
*checkEscapeChars[cc][2], checkEscapeChars[cc][3]);
}
diff --git a/Tests/CMakeLib/testVisualStudioSlnParser.cxx b/Tests/CMakeLib/testVisualStudioSlnParser.cxx
index 5b62f23..5007ab8 100644
--- a/Tests/CMakeLib/testVisualStudioSlnParser.cxx
+++ b/Tests/CMakeLib/testVisualStudioSlnParser.cxx
@@ -3,7 +3,7 @@
#include "cmVisualStudioSlnData.h"
#include "cmVisualStudioSlnParser.h"
-#include <cmsys/ios/iostream>
+#include <iostream>
//----------------------------------------------------------------------------
static bool parsedRight(cmVisualStudioSlnParser& parser,
@@ -27,10 +27,10 @@ static bool parsedRight(cmVisualStudioSlnParser& parser,
return true;
}
}
- cmsys_ios::cerr << "cmVisualStudioSlnParser mis-parsed " << file
- << "." SLN_EXTENSION << "; expected result " << expected
- << ", got " << parser.GetParseResult()
- << cmsys_ios::endl;
+ std::cerr << "cmVisualStudioSlnParser mis-parsed " << file
+ << "." SLN_EXTENSION << "; expected result " << expected
+ << ", got " << parser.GetParseResult()
+ << std::endl;
return false;
}
@@ -42,8 +42,8 @@ int testVisualStudioSlnParser(int, char*[])
// Test clean parser
if (parser.GetParseResult() != cmVisualStudioSlnParser::ResultOK)
{
- cmsys_ios::cerr << "cmVisualStudioSlnParser initialisation failed"
- << cmsys_ios::endl;
+ std::cerr << "cmVisualStudioSlnParser initialisation failed"
+ << std::endl;
return 1;
}
@@ -73,38 +73,38 @@ int testVisualStudioSlnParser(int, char*[])
const size_t expectedProjectCount = sizeof(names) / sizeof(*names);
if (projects.size() != expectedProjectCount)
{
- cmsys_ios::cerr << "cmVisualStudioSlnParser returned bad number of "
- << "projects (" << projects.size() << " instead of "
- << expectedProjectCount << ')'
- << cmsys_ios::endl;
+ std::cerr << "cmVisualStudioSlnParser returned bad number of "
+ << "projects (" << projects.size() << " instead of "
+ << expectedProjectCount << ')'
+ << std::endl;
return 1;
}
for (size_t idx = 0; idx < expectedProjectCount; ++idx)
{
if (projects[idx].GetName() != names[idx])
{
- cmsys_ios::cerr << "cmVisualStudioSlnParser returned bad project #"
- << idx << "; expected \"" << names[idx] << "\", got \""
- << projects[idx].GetName() << '"'
- << cmsys_ios::endl;
+ std::cerr << "cmVisualStudioSlnParser returned bad project #"
+ << idx << "; expected \"" << names[idx] << "\", got \""
+ << projects[idx].GetName() << '"'
+ << std::endl;
return 1;
}
}
if (projects[0].GetRelativePath() != "Utilities\\3rdParty")
{
- cmsys_ios::cerr << "cmVisualStudioSlnParser returned bad relative path of "
- << "project 3rdParty; expected \"Utilities\\3rdParty\", "
- << "got \"" << projects[0].GetRelativePath() << '"'
- << cmsys_ios::endl;
+ std::cerr << "cmVisualStudioSlnParser returned bad relative path of "
+ << "project 3rdParty; expected \"Utilities\\3rdParty\", "
+ << "got \"" << projects[0].GetRelativePath() << '"'
+ << std::endl;
return 1;
}
if (projects[2].GetGUID() != "{59BCCCCD-3AD1-4491-B8F4-C5793AC007E2}")
{
- cmsys_ios::cerr << "cmVisualStudioSlnParser returned bad relative path of "
- << "project CMakeLib; expected "
- << "\"{59BCCCCD-3AD1-4491-B8F4-C5793AC007E2}\", "
- << "got \"" << projects[2].GetGUID() << '"'
- << cmsys_ios::endl;
+ std::cerr << "cmVisualStudioSlnParser returned bad relative path of "
+ << "project CMakeLib; expected "
+ << "\"{59BCCCCD-3AD1-4491-B8F4-C5793AC007E2}\", "
+ << "got \"" << projects[2].GetGUID() << '"'
+ << std::endl;
return 1;
}
}
@@ -119,9 +119,9 @@ int testVisualStudioSlnParser(int, char*[])
}
if (!parser.GetParseHadBOM())
{
- cmsys_ios::cerr << "cmVisualStudioSlnParser didn't find BOM in bom."
- << SLN_EXTENSION
- << cmsys_ios::endl;
+ std::cerr << "cmVisualStudioSlnParser didn't find BOM in bom."
+ << SLN_EXTENSION
+ << std::endl;
return 1;
}
@@ -131,9 +131,9 @@ int testVisualStudioSlnParser(int, char*[])
}
if (parser.GetParseHadBOM())
{
- cmsys_ios::cerr << "cmVisualStudioSlnParser found BOM in nobom."
- << SLN_EXTENSION
- << cmsys_ios::endl;
+ std::cerr << "cmVisualStudioSlnParser found BOM in nobom."
+ << SLN_EXTENSION
+ << std::endl;
return 1;
}
}
diff --git a/Tests/CMakeLib/testXMLParser.cxx b/Tests/CMakeLib/testXMLParser.cxx
index 54ed5dc..b5219e2 100644
--- a/Tests/CMakeLib/testXMLParser.cxx
+++ b/Tests/CMakeLib/testXMLParser.cxx
@@ -2,7 +2,7 @@
#include "cmXMLParser.h"
-#include <cmsys/ios/iostream>
+#include <iostream>
int testXMLParser(int, char*[])
{
@@ -10,7 +10,7 @@ int testXMLParser(int, char*[])
cmXMLParser parser;
if(!parser.ParseFile(SOURCE_DIR "/testXMLParser.xml"))
{
- cmsys_ios::cerr << "cmXMLParser failed!" << cmsys_ios::endl;
+ std::cerr << "cmXMLParser failed!" << std::endl;
return 1;
}
return 0;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 35b29bf..dc65a2e 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -213,6 +213,29 @@ if(BUILD_TESTING)
set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}")
endif()
endif()
+ if(CMAKE_OSX_SYSROOT)
+ execute_process(
+ COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version ProductName
+ OUTPUT_VARIABLE _stdout
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _stderr
+ RESULT_VARIABLE _failed
+ )
+ if(NOT _failed)
+ set(CMAKE_OSX_SDKPRODUCT "${_stdout}")
+ endif()
+
+ execute_process(
+ COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version SDKVersion
+ OUTPUT_VARIABLE _stdout
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _stderr
+ RESULT_VARIABLE _failed
+ )
+ if(NOT _failed)
+ set(CMAKE_OSX_SDKVERSION "${_stdout}")
+ endif()
+ endif()
endif()
# Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value,
@@ -253,15 +276,20 @@ if(BUILD_TESTING)
if(TEST_RESOURCES)
ADD_TEST_MACRO(VSResource VSResource)
endif()
+ ADD_TEST_MACRO(MSManifest MSManifest)
ADD_TEST_MACRO(Simple Simple)
ADD_TEST_MACRO(PreOrder PreOrder)
ADD_TEST_MACRO(MissingSourceFile MissingSourceFile)
set_tests_properties(MissingSourceFile PROPERTIES
PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c")
- if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1)
- if(CMAKE_GENERATOR STREQUAL "Xcode")
- ADD_TEST_MACRO(SwiftMix SwiftMix)
- ADD_TEST_MACRO(SwiftOnly SwiftOnly)
+ if(CMake_TEST_XCODE_VERSION AND CMAKE_OSX_SDKVERSION AND CMAKE_OSX_SDKPRODUCT)
+ if((NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1) AND
+ ((NOT CMAKE_OSX_SDKPRODUCT STREQUAL "Mac OS X") OR
+ (NOT CMAKE_OSX_SDKVERSION VERSION_LESS 10.10)))
+ if(CMAKE_GENERATOR STREQUAL "Xcode")
+ ADD_TEST_MACRO(SwiftMix SwiftMix)
+ ADD_TEST_MACRO(SwiftOnly SwiftOnly)
+ endif()
endif()
endif()
if(CMAKE_Fortran_COMPILER)
@@ -1337,6 +1365,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindOpenSSL)
endif()
+ add_subdirectory(FindThreads)
+
# Matlab module
if(CMake_TEST_FindMatlab)
ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>)
@@ -3036,6 +3066,31 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
--build-options ${build_options}
--test-command ${JAVA_RUNTIME} -classpath hello2.jar HelloWorld)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceList")
+
+ # For next test, java tool must have same architecture as toolchain
+ math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8")
+ execute_process(
+ COMMAND "${Java_JAVA_EXECUTABLE}" -d${_object_mode} -version
+ OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE _result
+ )
+ if(_result EQUAL 0)
+ if(CMAKE_CONFIGURATION_TYPES)
+ set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah/$<CONFIGURATION>)
+ else()
+ set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah)
+ endif()
+ add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/JavaJavah"
+ "${CMake_BINARY_DIR}/Tests/JavaJavah"
+ ${build_generator_args}
+ --build-project helloJavah
+ --build-two-config
+ --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/"
+ --build-options ${build_options}
+ --test-command ${JAVA_RUNTIME} -Djava.library.path=${JAVAH_LIBRARY_PATH} -classpath hello3.jar HelloWorld2)
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah")
+ endif()
endif()
endif()
endif()
diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
index 055b183..da614e9 100644
--- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
+++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
@@ -105,6 +105,13 @@ set(linux64_test2_libs "c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a")
set(linux64_test2_dirs "/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64")
list(APPEND platforms linux64_test2)
+# -specs=redhat-hardened-ld
+set(linux64_test3_text "COLLECT_GCC_OPTIONS='-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' '-v' '-O2' '-g' '-pipe' '-Wall' '-Werror=format-security' '-fexceptions' '-fstack-protector-strong' '--param' 'ssp-buffer-size=4' '-grecord-gcc-switches' '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' '-m64' '-mtune=generic' '-I' '/usr/lib64/gfortran/modules' '-o' 'a.out' '-rdynamic' '-shared-libgcc' '-march=x86-64' '-pie'
+ /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccNzxFD8.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lquadmath -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z now -pie -o a.out /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/crtbeginS.o -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1 -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../.. -z relro dummy.o -lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/5.1.1/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/crtn.o")
+set(linux64_test3_libs "gfortran;m;quadmath;m;c")
+set(linux64_test3_dirs "/usr/lib/gcc/x86_64-redhat-linux/5.1.1;/usr/lib64;/lib64;/usr/lib")
+list(APPEND platforms linux64_test3)
+
#-----------------------------------------------------------------------------
# Mac
diff --git a/Tests/CPackComponentsDEB/CMakeLists.txt b/Tests/CPackComponentsDEB/CMakeLists.txt
index 5c4eeab..093b23f 100644
--- a/Tests/CPackComponentsDEB/CMakeLists.txt
+++ b/Tests/CPackComponentsDEB/CMakeLists.txt
@@ -80,6 +80,43 @@ set(CPACK_COMPONENT_HEADERS_DESCRIPTION
# depend on the libraries component.
set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
+# creates preinst/prerm scripts with specific permissions. Those permissions
+# (especially executable) should be in the final archive
+find_program(CHMOD_PROG chmod)
+if(CHMOD_PROG)
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/preinst "echo default_preinst")
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/prerm "echo default_prerm")
+
+ # Those should have 755 permission normally. We mess it up to see if
+ # CPACK_DEBIAN_APPLICATIONS_PACKAGE_CONTROL_STRICT_PERMISSION is able to fix
+ # it.
+ execute_process(COMMAND ${CHMOD_PROG} 640 ${CMAKE_CURRENT_BINARY_DIR}/preinst)
+ execute_process(COMMAND ${CHMOD_PROG} 640 ${CMAKE_CURRENT_BINARY_DIR}/prerm)
+
+ set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_CONTROL_EXTRA
+ "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm")
+
+ set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
+endif()
+
+# creates a symbolic link and a directory. Those should not be hashed.
+# warning: relocation of the symlink is not supported (symlinks with relative
+# paths)
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink mylibapp symtest)
+install(FILES ${CPackComponentsDEB_BINARY_DIR}/symtest
+ DESTINATION bin
+ COMPONENT applications)
+
+if(EXISTS "./dirtest")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ./dirtest)
+endif()
+# NOTE: directory left empty on purpose
+execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ./dirtest)
+# NOTE: we should not add the trailing "/" to dirtest
+install(DIRECTORY ${CPackComponentsDEB_BINARY_DIR}/dirtest
+ DESTINATION bin/
+ COMPONENT applications)
+
# We may use the CPack specific config file in order
# to tailor CPack behavior on a CPack generator specific way
# (Behavior would be different for RPM or TGZ or DEB ...)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake
index 5460b1a..ff22f8f 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake
@@ -36,7 +36,7 @@ find_program(LINTIAN_EXECUTABLE lintian)
if(LINTIAN_EXECUTABLE)
set(lintian_output_errors_all "")
foreach(_f IN LISTS actual_output)
- set(STRINGS_TO_AVOID "E:([^\r\n]*)control-file-has-bad-permissions")
+ set(STRINGS_TO_AVOID "E:([^\r\n]*)control-file-has-bad-permissions" "E:([^\r\n]*)md5sums-lists-nonexistent-file")
lintian_check_specific_errors(lintian_output_errors
FILENAME "${_f}"
ERROR_REGEX_STRINGS "${STRINGS_TO_AVOID}")
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake
index b96669e..bf9f81d 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake
@@ -137,6 +137,8 @@ endfunction()
# This function runs dpkg-deb on a .deb and returns its output
+# the default behaviour it to run "--info" on the specified Debian package
+# ACTION is one of the option accepted by dpkg-deb
function(run_dpkgdeb dpkg_deb_output)
set(${dpkg_deb_output} "" PARENT_SCOPE)
@@ -144,7 +146,7 @@ function(run_dpkgdeb dpkg_deb_output)
if(DPKGDEB_EXECUTABLE)
set(options "")
- set(oneValueArgs "FILENAME")
+ set(oneValueArgs "FILENAME" "ACTION")
set(multiValueArgs "")
cmake_parse_arguments(run_dpkgdeb_deb "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
@@ -153,8 +155,12 @@ function(run_dpkgdeb dpkg_deb_output)
message(FATAL_ERROR "error: run_dpkgdeb needs FILENAME to be set")
endif()
- # run lintian
- execute_process(COMMAND ${DPKGDEB_EXECUTABLE} -I ${run_dpkgdeb_deb_FILENAME}
+ if(NOT run_dpkgdeb_deb_ACTION)
+ set(run_dpkgdeb_deb_ACTION "--info")
+ endif()
+
+ # run dpkg-deb
+ execute_process(COMMAND ${DPKGDEB_EXECUTABLE} ${run_dpkgdeb_deb_ACTION} ${run_dpkgdeb_deb_FILENAME}
WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
OUTPUT_VARIABLE DPKGDEB_OUTPUT
RESULT_VARIABLE DPKGDEB_RESULT
diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in
index 29f7e7f..b2e6d6d 100644
--- a/Tests/CTestCoverageCollectGCOV/test.cmake.in
+++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in
@@ -12,9 +12,9 @@ ctest_build()
ctest_test()
list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
- "/foo/something"
- "/3rdparty/"
- "/bar/somethingelse"
+ "/foo/something"
+ "/3rdparty/"
+ "/bar/somethingelse"
)
include(CTestCoverageCollectGCOV)
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 7fdfaa8..a3f1f81 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -29,14 +29,14 @@ add_custom_command(TARGET testLib1 POST_BUILD
$<TARGET_FILE:testLib1>.genex
)
install(FILES $<TARGET_FILE:testLib1>.genex
- DESTINATION lib
+ DESTINATION $<1:lib>$<0:/wrong>
)
set_property(TARGET testLib1 PROPERTY MY_FILES
${CMAKE_CURRENT_SOURCE_DIR}/testLib1file1.txt
${CMAKE_CURRENT_SOURCE_DIR}/testLib1file2.txt
)
install(FILES $<TARGET_PROPERTY:testLib1,MY_FILES>
- DESTINATION doc
+ DESTINATION $<1:doc>$<0:/wrong>
)
# Test library with empty link interface. Link it to an implementation
@@ -127,6 +127,9 @@ target_link_libraries(testLibCycleA testLibCycleB)
target_link_libraries(testLibCycleB testLibCycleA)
set_property(TARGET testLibCycleA PROPERTY LINK_INTERFACE_MULTIPLICITY 3)
+add_library(testLibNoSONAME SHARED testLibNoSONAME.c)
+set_property(TARGET testLibNoSONAME PROPERTY NO_SONAME 1)
+
# Test exporting dependent libraries into different exports
add_library(testLibRequired testLibRequired.c)
add_library(testLibDepends testLibDepends.c)
@@ -467,6 +470,7 @@ install(
testExe2lib testLib4lib testLib4libdbg testLib4libopt
testLib6 testLib7
testLibCycleA testLibCycleB
+ testLibNoSONAME
cmp0022NEW cmp0022OLD
systemlib
EXPORT exp
@@ -527,6 +531,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe4 testExe2lib
testLib4lib testLib4libdbg testLib4libopt
testLibCycleA testLibCycleB
+ testLibNoSONAME
testLibPerConfigDest
NAMESPACE bld_
APPEND FILE ExportBuildTree.cmake
@@ -546,5 +551,5 @@ install(
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include/abs
)
-install(DIRECTORY include/abs DESTINATION include)
+install(DIRECTORY include/abs DESTINATION $<1:include>$<0:/wrong>)
install(EXPORT expAbs NAMESPACE expAbs_ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/expAbs)
diff --git a/Tests/ExportImport/Export/testLibNoSONAME.c b/Tests/ExportImport/Export/testLibNoSONAME.c
new file mode 100644
index 0000000..2193e1f
--- /dev/null
+++ b/Tests/ExportImport/Export/testLibNoSONAME.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32) || defined(__CYGWIN__)
+# define testLibNoSONAME_EXPORT __declspec(dllexport)
+#else
+# define testLibNoSONAME_EXPORT
+#endif
+
+testLibNoSONAME_EXPORT int testLibNoSONAME(void) { return 0; }
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 0f56495..5ce9628 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -90,6 +90,50 @@ add_custom_target(check_testLib1_genex ALL
-P ${CMAKE_CURRENT_SOURCE_DIR}/check_testLib1_genex.cmake
)
+if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG AND
+ "${CMAKE_C_CREATE_SHARED_MODULE}" MATCHES "SONAME_FLAG")
+ foreach(ns exp bld)
+ get_property(configs TARGET ${ns}_testLib5 PROPERTY IMPORTED_CONFIGURATIONS)
+ foreach(c ${configs})
+ string(TOUPPER "${c}" CONFIG)
+ get_property(soname TARGET ${ns}_testLib5 PROPERTY IMPORTED_NO_SONAME_${CONFIG})
+ if(soname)
+ message(SEND_ERROR "${ns}_testLib5 has IMPORTED_NO_SONAME_${CONFIG} but should:\n ${soname}")
+ else()
+ message(STATUS "${ns}_testLib5 does not have IMPORTED_NO_SONAME_${CONFIG} as expected")
+ endif()
+ endforeach()
+
+ get_property(configs TARGET ${ns}_testLibNoSONAME PROPERTY IMPORTED_CONFIGURATIONS)
+ foreach(c ${configs})
+ string(TOUPPER "${c}" CONFIG)
+ get_property(soname TARGET ${ns}_testLibNoSONAME PROPERTY IMPORTED_NO_SONAME_${CONFIG})
+ if(soname)
+ message(STATUS "${ns}_testLibNoSONAME has IMPORTED_NO_SONAME_${CONFIG} as expected")
+ else()
+ message(SEND_ERROR "${ns}_testLibNoSONAME does not have IMPORTED_NO_SONAME_${CONFIG} but should")
+ endif()
+ endforeach()
+
+ # Parse the binary to check for SONAME if possible.
+ if("${CMAKE_EXECUTABLE_FORMAT}" MATCHES "ELF")
+ find_program(READELF_EXE readelf)
+ if(READELF_EXE)
+ add_custom_target(check_${ns}_testLib5_soname ALL COMMAND
+ ${CMAKE_COMMAND} -Dreadelf=${READELF_EXE}
+ -Dlib=$<TARGET_FILE:${ns}_testLib5>
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/check_lib_soname.cmake
+ )
+ add_custom_target(check_${ns}_testLibNoSONAME_soname ALL COMMAND
+ ${CMAKE_COMMAND} -Dreadelf=${READELF_EXE}
+ -Dlib=$<TARGET_FILE:${ns}_testLibNoSONAME>
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/check_lib_nosoname.cmake
+ )
+ endif()
+ endif()
+ endforeach()
+endif()
+
add_executable(cmp0022OLD_test cmp0022OLD_test_vs6_1.cpp)
target_link_libraries(cmp0022OLD_test bld_cmp0022OLD)
add_executable(cmp0022NEW_test cmp0022NEW_test_vs6_1.cpp)
diff --git a/Tests/ExportImport/Import/A/check_lib_nosoname.cmake b/Tests/ExportImport/Import/A/check_lib_nosoname.cmake
new file mode 100644
index 0000000..613391e
--- /dev/null
+++ b/Tests/ExportImport/Import/A/check_lib_nosoname.cmake
@@ -0,0 +1,7 @@
+execute_process(COMMAND ${readelf} -d ${lib} OUTPUT_FILE ${lib}.readelf.txt)
+file(STRINGS ${lib}.readelf.txt soname REGEX "SONAME")
+if(soname)
+ message(FATAL_ERROR "${lib} has soname but should not:\n ${soname}")
+else()
+ message(STATUS "${lib} has no soname as expected:\n ${soname}")
+endif()
diff --git a/Tests/ExportImport/Import/A/check_lib_soname.cmake b/Tests/ExportImport/Import/A/check_lib_soname.cmake
new file mode 100644
index 0000000..a3c4b54
--- /dev/null
+++ b/Tests/ExportImport/Import/A/check_lib_soname.cmake
@@ -0,0 +1,7 @@
+execute_process(COMMAND ${readelf} -d ${lib} OUTPUT_FILE ${lib}.readelf.txt)
+file(STRINGS ${lib}.readelf.txt soname REGEX "SONAME")
+if(soname)
+ message(STATUS "${lib} has soname as expected:\n ${soname}")
+else()
+ message(FATAL_ERROR "${lib} has no soname but should:\n ${soname}")
+endif()
diff --git a/Tests/FindGTK2/CMakeLists.txt b/Tests/FindGTK2/CMakeLists.txt
index 1c5987c..0105fae 100644
--- a/Tests/FindGTK2/CMakeLists.txt
+++ b/Tests/FindGTK2/CMakeLists.txt
@@ -9,6 +9,7 @@ if(GTK2_GTK_FOUND)
"${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtk"
${build_generator_args}
--build-target gtk-all-libs
+ --build-project gtk
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtk"
--force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
@@ -22,6 +23,7 @@ if(GTK2_GTKMM_FOUND)
"${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtkmm"
${build_generator_args}
--build-target gtkmm-all-libs
+ --build-project gtkmm
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtkmm"
--force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
@@ -310,6 +312,7 @@ if(TARGET GTK2::gtkmm)
"${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtkmm"
${build_generator_args}
--build-target gtkmm-target
+ --build-project gtkmm
--build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtkmm"
--force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
diff --git a/Tests/FindThreads/C-only/CMakeLists.txt b/Tests/FindThreads/C-only/CMakeLists.txt
new file mode 100644
index 0000000..ab4ca0d
--- /dev/null
+++ b/Tests/FindThreads/C-only/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
+project(FindThreads_C-only C)
+
+set(CMAKE_THREAD_PREFER_PTHREAD On)
+find_package(Threads REQUIRED)
+
+if (NOT WIN32)
+ add_executable(thr ${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/CheckForPthreads.c)
+ target_link_libraries(thr Threads::Threads)
+endif ()
diff --git a/Tests/FindThreads/CMakeLists.txt b/Tests/FindThreads/CMakeLists.txt
new file mode 100644
index 0000000..aa9499b
--- /dev/null
+++ b/Tests/FindThreads/CMakeLists.txt
@@ -0,0 +1,11 @@
+foreach (_lang IN ITEMS C CXX)
+ add_test(NAME FindThreads.${_lang}-only COMMAND ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindThreads/${_lang}-only"
+ "${CMake_BINARY_DIR}/Tests/FindThreads/${_lang}-only"
+ ${build_generator_args}
+ --build-project FindThreads_${_lang}-only
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V
+ )
+endforeach ()
diff --git a/Tests/FindThreads/CXX-only/CMakeLists.txt b/Tests/FindThreads/CXX-only/CMakeLists.txt
new file mode 100644
index 0000000..9993123
--- /dev/null
+++ b/Tests/FindThreads/CXX-only/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
+project(FindThreads_CXX-only CXX)
+
+set(CMAKE_THREAD_PREFER_PTHREAD On)
+find_package(Threads REQUIRED)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/CheckForPthreads.c
+ ${CMAKE_CURRENT_BINARY_DIR}/CheckForPthreads.cxx)
+
+if (NOT WIN32)
+ add_executable(thr ${CMAKE_CURRENT_BINARY_DIR}/CheckForPthreads.cxx)
+ target_link_libraries(thr Threads::Threads)
+endif ()
diff --git a/Tests/JavaJavah/B.cpp b/Tests/JavaJavah/B.cpp
new file mode 100644
index 0000000..2666757
--- /dev/null
+++ b/Tests/JavaJavah/B.cpp
@@ -0,0 +1,10 @@
+
+#include <jni.h>
+#include <stdio.h>
+
+#include "B.h"
+
+JNIEXPORT void JNICALL Java_B_printName(JNIEnv *, jobject)
+{
+ printf("B\n");
+}
diff --git a/Tests/JavaJavah/B.java b/Tests/JavaJavah/B.java
new file mode 100644
index 0000000..d731f39
--- /dev/null
+++ b/Tests/JavaJavah/B.java
@@ -0,0 +1,19 @@
+class B
+{
+ public B()
+ {
+ }
+
+ public native void printName();
+
+ static {
+ try {
+
+ System.loadLibrary("B");
+
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load.\n" + e);
+ System.exit(1);
+ }
+ }
+}
diff --git a/Tests/JavaJavah/CMakeLists.txt b/Tests/JavaJavah/CMakeLists.txt
new file mode 100644
index 0000000..83b0ad0
--- /dev/null
+++ b/Tests/JavaJavah/CMakeLists.txt
@@ -0,0 +1,20 @@
+project(helloJavah Java CXX)
+
+cmake_minimum_required (VERSION 2.6)
+set(CMAKE_VERBOSE_MAKEFILE 1)
+
+find_package(Java COMPONENTS Development)
+include (UseJava)
+
+# JNI support
+find_package(JNI)
+
+add_jar(hello3 B.java HelloWorld2.java)
+create_javah(TARGET B_javah CLASSES B CLASSPATH hello3)
+
+add_library(B SHARED B.cpp)
+add_dependencies(B B_javah)
+
+target_include_directories(B PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
+ ${JAVA_INCLUDE_PATH}
+ ${JAVA_INCLUDE_PATH2})
diff --git a/Tests/JavaJavah/HelloWorld2.java b/Tests/JavaJavah/HelloWorld2.java
new file mode 100644
index 0000000..faf7277
--- /dev/null
+++ b/Tests/JavaJavah/HelloWorld2.java
@@ -0,0 +1,10 @@
+class HelloWorld2
+{
+ public static void main(String args[])
+ {
+ B b;
+ b = new B();
+ b.printName();
+ System.out.println("Hello World!");
+ }
+}
diff --git a/Tests/MSManifest/CMakeLists.txt b/Tests/MSManifest/CMakeLists.txt
new file mode 100644
index 0000000..300cfa6
--- /dev/null
+++ b/Tests/MSManifest/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.3)
+project(MSManifest C)
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+add_subdirectory(Subdir)
diff --git a/Tests/MSManifest/Subdir/CMakeLists.txt b/Tests/MSManifest/Subdir/CMakeLists.txt
new file mode 100644
index 0000000..a47cf00
--- /dev/null
+++ b/Tests/MSManifest/Subdir/CMakeLists.txt
@@ -0,0 +1,9 @@
+configure_file(test.manifest.in test.manifest)
+add_executable(MSManifest main.c ${CMAKE_CURRENT_BINARY_DIR}/test.manifest)
+
+if(MSVC AND NOT MSVC_VERSION LESS 1400)
+ add_custom_command(TARGET MSManifest POST_BUILD VERBATIM
+ COMMAND ${CMAKE_COMMAND} -Dexe=$<TARGET_FILE:MSManifest>
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
+ )
+endif()
diff --git a/Tests/MSManifest/Subdir/check.cmake b/Tests/MSManifest/Subdir/check.cmake
new file mode 100644
index 0000000..b7b6841
--- /dev/null
+++ b/Tests/MSManifest/Subdir/check.cmake
@@ -0,0 +1,6 @@
+file(STRINGS "${exe}" content REGEX "name=\"Kitware.CMake.MSManifestTest\"")
+if(content)
+ message(STATUS "Expected manifest content found:\n ${content}")
+else()
+ message(FATAL_ERROR "Expected manifest content not found in\n ${exe}")
+endif()
diff --git a/Tests/MSManifest/Subdir/main.c b/Tests/MSManifest/Subdir/main.c
new file mode 100644
index 0000000..78f2de1
--- /dev/null
+++ b/Tests/MSManifest/Subdir/main.c
@@ -0,0 +1 @@
+int main(void) { return 0; }
diff --git a/Tests/MSManifest/Subdir/test.manifest.in b/Tests/MSManifest/Subdir/test.manifest.in
new file mode 100644
index 0000000..540961a
--- /dev/null
+++ b/Tests/MSManifest/Subdir/test.manifest.in
@@ -0,0 +1,4 @@
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity type="win32" version="1.0.0.0"
+ name="Kitware.CMake.MSManifestTest"/>
+</assembly>
diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt
index b52c44d..8cd25a4 100644
--- a/Tests/Module/GenerateExportHeader/CMakeLists.txt
+++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt
@@ -106,10 +106,10 @@ endif()
add_executable(GenerateExportHeader exportheader_test.cpp)
target_link_libraries(GenerateExportHeader ${link_libraries})
-if (WIN32)
+if (WIN32 OR CYGWIN)
if(MSVC AND COMPILER_HAS_DEPRECATED)
set(_platform Win32)
- elseif(MINGW AND COMPILER_HAS_DEPRECATED)
+ elseif((MINGW OR CYGWIN) AND COMPILER_HAS_DEPRECATED)
set(_platform MinGW)
else()
set(_platform WinEmpty)
diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt
index ecdece8..2b7bac1 100644
--- a/Tests/Plugin/CMakeLists.txt
+++ b/Tests/Plugin/CMakeLists.txt
@@ -52,13 +52,8 @@ target_link_libraries(example_mod_1 example_exe)
if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG AND
"${CMAKE_C_CREATE_SHARED_MODULE}" MATCHES "SONAME_FLAG")
- # Add a second plugin that should not have any soname.
- add_library(example_mod_2 MODULE src/example_mod_1.c)
- target_link_libraries(example_mod_2 example_exe)
- set_property(TARGET example_mod_2 PROPERTY NO_SONAME 1)
-
# Verify that targets export with proper IMPORTED SONAME properties.
- export(TARGETS example_mod_1 example_mod_2 NAMESPACE exp_
+ export(TARGETS example_mod_1 NAMESPACE exp_
FILE ${CMAKE_CURRENT_BINARY_DIR}/mods.cmake)
include(ExternalProject)
@@ -68,7 +63,7 @@ if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG AND
DOWNLOAD_COMMAND ""
INSTALL_COMMAND ""
)
- add_dependencies(PluginTest example_mod_1 example_mod_2)
+ add_dependencies(PluginTest example_mod_1)
endif()
# TODO:
diff --git a/Tests/Plugin/PluginTest/CMakeLists.txt b/Tests/Plugin/PluginTest/CMakeLists.txt
index 79ef8a9..5626dbc 100644
--- a/Tests/Plugin/PluginTest/CMakeLists.txt
+++ b/Tests/Plugin/PluginTest/CMakeLists.txt
@@ -6,17 +6,11 @@ include(${CMAKE_CURRENT_BINARY_DIR}/../mods.cmake)
get_property(configs TARGET exp_example_mod_1 PROPERTY IMPORTED_CONFIGURATIONS)
foreach(c ${configs})
string(TOUPPER "${c}" CONFIG)
- get_property(soname1 TARGET exp_example_mod_1 PROPERTY IMPORTED_SONAME_${CONFIG})
- get_property(soname2 TARGET exp_example_mod_2 PROPERTY IMPORTED_NO_SONAME_${CONFIG})
- if(soname1)
- message(STATUS "exp_example_mod_1 has IMPORTED_SONAME_${CONFIG} as expected: ${soname1}")
+ get_property(soname TARGET exp_example_mod_1 PROPERTY IMPORTED_NO_SONAME_${CONFIG})
+ if(soname)
+ message(STATUS "exp_example_mod_1 has IMPORTED_NO_SONAME_${CONFIG} as expected: ${soname}")
else()
- message(SEND_ERROR "exp_example_mod_1 does not have IMPORTED_SONAME_${CONFIG} but should")
- endif()
- if(soname2)
- message(STATUS "exp_example_mod_2 has IMPORTED_NO_SONAME_${CONFIG} as expected: ${soname2}")
- else()
- message(SEND_ERROR "exp_example_mod_2 does not have IMPORTED_NO_SONAME_${CONFIG} but should")
+ message(SEND_ERROR "exp_example_mod_1 does not have IMPORTED_NO_SONAME_${CONFIG} but should")
endif()
endforeach()
@@ -26,8 +20,7 @@ if("${CMAKE_EXECUTABLE_FORMAT}" MATCHES "ELF")
if(READELF_EXE)
add_custom_target(check_mod_soname ALL COMMAND
${CMAKE_COMMAND} -Dreadelf=${READELF_EXE}
- -Dmod1=$<TARGET_FILE:exp_example_mod_1>
- -Dmod2=$<TARGET_FILE:exp_example_mod_2>
+ -Dmod=$<TARGET_FILE:exp_example_mod_1>
-P ${CMAKE_CURRENT_SOURCE_DIR}/../check_mod_soname.cmake
)
endif()
diff --git a/Tests/Plugin/check_mod_soname.cmake b/Tests/Plugin/check_mod_soname.cmake
index 3737b45..eeededa 100644
--- a/Tests/Plugin/check_mod_soname.cmake
+++ b/Tests/Plugin/check_mod_soname.cmake
@@ -1,14 +1,7 @@
-execute_process(COMMAND ${readelf} -d ${mod1} OUTPUT_FILE ${mod1}.readelf.txt)
-execute_process(COMMAND ${readelf} -d ${mod2} OUTPUT_FILE ${mod2}.readelf.txt)
-file(STRINGS ${mod1}.readelf.txt soname1 REGEX "\\(SONAME\\)")
-file(STRINGS ${mod2}.readelf.txt soname2 REGEX "\\(SONAME\\)")
-if(soname1)
- message(STATUS "${mod1} has soname as expected: ${soname1}")
+execute_process(COMMAND ${readelf} -d ${mod} OUTPUT_FILE ${mod}.readelf.txt)
+file(STRINGS ${mod}.readelf.txt soname REGEX "SONAME")
+if(soname)
+ message(FATAL_ERROR "${mod} has soname but should not:\n ${soname}")
else()
- message(FATAL_ERROR "${mod1} has no soname but should:\n ${soname1}")
-endif()
-if(soname2)
- message(FATAL_ERROR "${mod2} has soname but should not:\n ${soname2}")
-else()
- message(STATUS "${mod2} has no soname as expected")
+ message(STATUS "${mod} has no soname as expected")
endif()
diff --git a/Tests/Plugin/src/example_exe.cxx b/Tests/Plugin/src/example_exe.cxx
index 309302e..12d9204 100644
--- a/Tests/Plugin/src/example_exe.cxx
+++ b/Tests/Plugin/src/example_exe.cxx
@@ -3,15 +3,15 @@
#include <example_exe.h>
#include <kwsys/DynamicLoader.hxx>
-#include <kwsys/ios/iostream>
-#include <kwsys/stl/string>
+#include <iostream>
+#include <string>
#include <stdio.h>
// Implement the ABI used by plugins.
extern "C" int example_exe_function()
{
- kwsys_ios::cout << "hello" << kwsys_ios::endl;
+ std::cout << "hello" << std::endl;
return 123;
}
@@ -23,7 +23,7 @@ extern "C" int example_exe_function()
int main()
{
- kwsys_stl::string libName = EXAMPLE_EXE_PLUGIN_DIR CONFIG_DIR "/";
+ std::string libName = EXAMPLE_EXE_PLUGIN_DIR CONFIG_DIR "/";
libName += kwsys::DynamicLoader::LibPrefix();
libName += "example_mod_1";
libName += kwsys::DynamicLoader::LibExtension();
@@ -31,17 +31,17 @@ int main()
kwsys::DynamicLoader::OpenLibrary(libName.c_str());
if(!handle)
{
- kwsys_ios::cerr << "Could not open plugin \""
- << libName << "\"!" << kwsys_ios::endl;
+ std::cerr << "Could not open plugin \""
+ << libName.c_str() << "\"!" << std::endl;
return 1;
}
kwsys::DynamicLoader::SymbolPointer sym =
kwsys::DynamicLoader::GetSymbolAddress(handle, "example_mod_1_function");
if(!sym)
{
- kwsys_ios::cerr
+ std::cerr
<< "Could not get plugin symbol \"example_mod_1_function\"!"
- << kwsys_ios::endl;
+ << std::endl;
return 1;
}
#ifdef __WATCOMC__
@@ -51,8 +51,8 @@ int main()
#endif
if(f(456) != (123+456))
{
- kwsys_ios::cerr << "Incorrect return value from plugin!"
- << kwsys_ios::endl;
+ std::cerr << "Incorrect return value from plugin!"
+ << std::endl;
return 1;
}
kwsys::DynamicLoader::CloseLibrary(handle);
diff --git a/Tests/RunCMake/BuildDepends/C-Exe-Manifest.cmake b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.cmake
new file mode 100644
index 0000000..ef33012
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.cmake
@@ -0,0 +1,19 @@
+enable_language(C)
+
+add_executable(main main.c ${CMAKE_CURRENT_BINARY_DIR}/test.manifest)
+
+if(MSVC AND NOT MSVC_VERSION LESS 1400)
+ set(EXTRA_CHECK [[
+file(STRINGS "$<TARGET_FILE:main>" content REGEX "name=\"Kitware.CMake.C-Exe-Manifest-step[0-9]\"")
+if(NOT "${content}" MATCHES "name=\"Kitware.CMake.C-Exe-Manifest-step${check_step}\"")
+ set(RunCMake_TEST_FAILED "Binary has no manifest with name=\"Kitware.CMake.C-Exe-Manifest-step${check_step}\":\n ${content}")
+endif()
+]])
+endif()
+
+file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT "
+set(check_pairs
+ \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/test.manifest\"
+ )
+${EXTRA_CHECK}
+")
diff --git a/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step1.cmake b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step1.cmake
new file mode 100644
index 0000000..c0b939d
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step1.cmake
@@ -0,0 +1,6 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/test.manifest" [[
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity type="win32" version="1.0.0.0"
+ name="Kitware.CMake.C-Exe-Manifest-step1"/>
+</assembly>
+]])
diff --git a/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step2.cmake b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step2.cmake
new file mode 100644
index 0000000..a75bf21
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/C-Exe-Manifest.step2.cmake
@@ -0,0 +1,6 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/test.manifest" [[
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity type="win32" version="1.0.0.0"
+ name="Kitware.CMake.C-Exe-Manifest-step2"/>
+</assembly>
+]])
diff --git a/Tests/RunCMake/BuildDepends/C-Exe.cmake b/Tests/RunCMake/BuildDepends/C-Exe.cmake
new file mode 100644
index 0000000..5057ca9
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/C-Exe.cmake
@@ -0,0 +1,12 @@
+enable_language(C)
+
+add_executable(main ${CMAKE_CURRENT_BINARY_DIR}/main.c)
+
+file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT "
+set(check_pairs
+ \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.c\"
+ )
+set(check_exes
+ \"$<TARGET_FILE:main>\"
+ )
+")
diff --git a/Tests/RunCMake/BuildDepends/C-Exe.step1.cmake b/Tests/RunCMake/BuildDepends/C-Exe.step1.cmake
new file mode 100644
index 0000000..08e2949
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/C-Exe.step1.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.c" [[
+int main(void) { return 1; }
+]])
diff --git a/Tests/RunCMake/BuildDepends/C-Exe.step2.cmake b/Tests/RunCMake/BuildDepends/C-Exe.step2.cmake
new file mode 100644
index 0000000..ee4530c
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/C-Exe.step2.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.c" [[
+int main(void) { return 2; }
+]])
diff --git a/Tests/RunCMake/BuildDepends/CMakeLists.txt b/Tests/RunCMake/BuildDepends/CMakeLists.txt
new file mode 100644
index 0000000..74b3ff8
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.3)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
new file mode 100644
index 0000000..8782ba9
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -0,0 +1,34 @@
+include(RunCMake)
+
+function(run_BuildDepends CASE)
+ # Use a single build tree for a few tests without cleaning.
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
+ set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
+ endif()
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ include(${RunCMake_SOURCE_DIR}/${CASE}.step1.cmake OPTIONAL)
+ run_cmake(${CASE})
+ set(RunCMake-check-file check.cmake)
+ set(check_step 1)
+ run_cmake_command(${CASE}-build1 ${CMAKE_COMMAND} --build . --config Debug)
+ if(run_BuildDepends_skip_step_2)
+ return()
+ endif()
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1.125) # handle 1s resolution
+ include(${RunCMake_SOURCE_DIR}/${CASE}.step2.cmake OPTIONAL)
+ set(check_step 2)
+ run_cmake_command(${CASE}-build2 ${CMAKE_COMMAND} --build . --config Debug)
+endfunction()
+
+run_BuildDepends(C-Exe)
+if(NOT RunCMake_GENERATOR MATCHES "Visual Studio [67]|Xcode")
+ if(RunCMake_GENERATOR MATCHES "Visual Studio 10")
+ # VS 10 forgets to re-link when a manifest changes
+ set(run_BuildDepends_skip_step_2 1)
+ endif()
+ run_BuildDepends(C-Exe-Manifest)
+ unset(run_BuildDepends_skip_step_2)
+endif()
diff --git a/Tests/RunCMake/BuildDepends/check.cmake b/Tests/RunCMake/BuildDepends/check.cmake
new file mode 100644
index 0000000..26a9eb6
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/check.cmake
@@ -0,0 +1,37 @@
+if(EXISTS ${RunCMake_TEST_BINARY_DIR}/check-debug.cmake)
+ include(${RunCMake_TEST_BINARY_DIR}/check-debug.cmake)
+ if(RunCMake_TEST_FAILED)
+ return()
+ endif()
+ foreach(exe IN LISTS check_exes)
+ execute_process(COMMAND ${exe} RESULT_VARIABLE res)
+ if(NOT res EQUAL ${check_step})
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}
+ '${exe}' returned '${res}' but expected '${check_step}'
+")
+ endif()
+ endforeach()
+ foreach(p IN LISTS check_pairs)
+ if("${p}" MATCHES "^(.*)\\|(.*)$")
+ set(lhs "${CMAKE_MATCH_1}")
+ set(rhs "${CMAKE_MATCH_2}")
+ if(NOT EXISTS "${lhs}")
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}
+ '${lhs}' missing
+")
+ elseif(NOT EXISTS "${rhs}")
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}
+ '${rhs}' missing
+")
+ elseif(NOT "${lhs}" IS_NEWER_THAN "${rhs}")
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}
+ '${lhs}' is not newer than '${rhs}'
+")
+ endif()
+ endif()
+ endforeach()
+else()
+ set(RunCMake_TEST_FAILED "
+ '${RunCMake_TEST_BINARY_DIR}/check-debug.cmake' missing
+")
+endif()
diff --git a/Tests/RunCMake/BuildDepends/main.c b/Tests/RunCMake/BuildDepends/main.c
new file mode 100644
index 0000000..78f2de1
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/main.c
@@ -0,0 +1 @@
+int main(void) { return 0; }
diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
index fc58ea5..6331717 100644
--- a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
@@ -11,3 +11,4 @@ run_cmake(CMP0026-LOCATION-CONFIG-OLD)
run_cmake(CMP0026-LOCATION-CONFIG-WARN)
run_cmake(ObjlibNotDefined)
run_cmake(LOCATION-and-TARGET_OBJECTS)
+run_cmake(clear-cached-information)
diff --git a/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt b/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt
new file mode 100644
index 0000000..c51e883
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+add_executable(Hello ${CMAKE_CURRENT_BINARY_DIR}/main.c)
diff --git a/Tests/RunCMake/CMP0026/clear-cached-information.cmake b/Tests/RunCMake/CMP0026/clear-cached-information.cmake
new file mode 100644
index 0000000..dd2dd72
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/clear-cached-information.cmake
@@ -0,0 +1,14 @@
+
+enable_language(C)
+
+cmake_policy(SET CMP0026 OLD)
+
+add_subdirectory(clear-cached-information-dir)
+
+# Critical: this needs to happen in root CMakeLists.txt and not inside
+# the subdir.
+get_target_property(mypath Hello LOCATION)
+# Now we create the file later, so you can see, ultimately no error should
+# happen e.g. during generate phase:
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c)
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c PROPERTIES GENERATED TRUE)
diff --git a/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt b/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt
new file mode 100644
index 0000000..71f1ab7
--- /dev/null
+++ b/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning \(dev\) at CMP0064-WARN.cmake:3 \(if\):
+ Policy CMP0064 is not set: Support new TEST if\(\) operator. Run "cmake
+ --help-policy CMP0064" for policy details. Use the cmake_policy command to
+ set the policy and suppress this warning.
+
+ TEST will be interpreted as an operator when the policy is set to NEW.
+ Since the policy is not set the OLD behavior will be used.
+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/CMP0064/CMP0064-WARN.cmake b/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake
index bffd3f3..8f26ec6 100644
--- a/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake
+++ b/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake
@@ -1,4 +1,4 @@
-cmake_policy(SET CMP0064 OLD)
+
if(TEST)
message(FATAL_ERROR "TEST was not recognized to be undefined")
diff --git a/Tests/RunCMake/CMP0065/BuildTargetInSubProject.cmake b/Tests/RunCMake/CMP0065/BuildTargetInSubProject.cmake
new file mode 100644
index 0000000..9339e46
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/BuildTargetInSubProject.cmake
@@ -0,0 +1,15 @@
+function(BuildTargetInSubProject P T E)
+ try_compile(RESULTVAR
+ ${CMAKE_CURRENT_BINARY_DIR}/subproject
+ ${CMAKE_CURRENT_SOURCE_DIR}/subproject
+ ${P} ${T} OUTPUT_VARIABLE O)
+ if(E AND RESULTVAR)
+ message(STATUS "${P} target ${T} succeeded as expected")
+ elseif(E AND NOT RESULTVAR)
+ message(FATAL_ERROR "${P} target ${T} failed but should have succeeded. Output:${O}")
+ elseif(NOT E AND NOT RESULTVAR)
+ message(STATUS "${P} target ${T} failed as expected")
+ elseif(NOT E AND RESULTVAR)
+ message(FATAL_ERROR "${P} target ${T} succeeded but should have failed. Output:${O}")
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CMP0065/CMakeLists.txt b/Tests/RunCMake/CMP0065/CMakeLists.txt
new file mode 100644
index 0000000..74b3ff8
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.3)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0065/NEWBad.cmake b/Tests/RunCMake/CMP0065/NEWBad.cmake
new file mode 100644
index 0000000..79d9adb
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/NEWBad.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+include(BuildTargetInSubProject.cmake)
+
+BuildTargetInSubProject(TestPolicyCMP0065 FooNEWBad FALSE)
diff --git a/Tests/RunCMake/CMP0065/NEWGood.cmake b/Tests/RunCMake/CMP0065/NEWGood.cmake
new file mode 100644
index 0000000..a5b5d04
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/NEWGood.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+include(BuildTargetInSubProject.cmake)
+
+BuildTargetInSubProject(TestPolicyCMP0065 FooNEWGood TRUE)
diff --git a/Tests/RunCMake/CMP0065/OLDBad1.cmake b/Tests/RunCMake/CMP0065/OLDBad1.cmake
new file mode 100644
index 0000000..6d780b4
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/OLDBad1.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+include(BuildTargetInSubProject.cmake)
+
+BuildTargetInSubProject(TestPolicyCMP0065 FooOLDBad1 FALSE)
diff --git a/Tests/RunCMake/CMP0065/OLDBad2.cmake b/Tests/RunCMake/CMP0065/OLDBad2.cmake
new file mode 100644
index 0000000..7196473
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/OLDBad2.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+include(BuildTargetInSubProject.cmake)
+
+BuildTargetInSubProject(TestPolicyCMP0065 FooOLDBad2 FALSE)
diff --git a/Tests/RunCMake/CMP0065/RunCMakeTest.cmake b/Tests/RunCMake/CMP0065/RunCMakeTest.cmake
new file mode 100644
index 0000000..254a4ec
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+include(RunCMake)
+
+run_cmake(OLDBad1)
+run_cmake(OLDBad2)
+run_cmake(NEWBad)
+run_cmake(NEWGood)
+run_cmake(WARN-OFF)
+run_cmake(WARN-ON)
diff --git a/Tests/RunCMake/CMP0065/WARN-OFF.cmake b/Tests/RunCMake/CMP0065/WARN-OFF.cmake
new file mode 100644
index 0000000..dbc9562
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/WARN-OFF.cmake
@@ -0,0 +1,3 @@
+
+enable_language(C)
+add_executable(main subproject/main.c)
diff --git a/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt b/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt
new file mode 100644
index 0000000..dda4fe5
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/WARN-ON-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ Policy CMP0065 is not set: Do not add flags to export symbols from
+ executables without the ENABLE_EXPORTS target property. Run "cmake
+ --help-policy CMP0065" for policy details. Use the cmake_policy command to
+ set the policy and suppress this warning.
+
+ For compatibility with older versions of CMake, additional flags may be
+ added to export symbols on all executables regardless of thier
+ ENABLE_EXPORTS property.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0065/WARN-ON.cmake b/Tests/RunCMake/CMP0065/WARN-ON.cmake
new file mode 100644
index 0000000..6ed4a41
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/WARN-ON.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_POLICY_WARNING_CMP0065 1)
+enable_language(C)
+add_executable(main subproject/main.c)
diff --git a/Tests/RunCMake/CMP0065/subproject/CMakeLists.txt b/Tests/RunCMake/CMP0065/subproject/CMakeLists.txt
new file mode 100644
index 0000000..bed5960
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/subproject/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 3.3)
+
+project(TestPolicyCMP0065 C)
+set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS BADFLAGS)
+
+#----------------------------------------------------------------------
+cmake_policy(SET CMP0065 OLD)
+add_executable(FooOLDBad1 main.c)
+
+#----------------------------------------------------------------------
+cmake_policy(SET CMP0065 OLD)
+add_executable(FooOLDBad2 main.c)
+set_target_properties(FooOLDBad2 PROPERTIES ENABLE_EXPORTS ON)
+
+#----------------------------------------------------------------------
+cmake_policy(SET CMP0065 NEW)
+add_executable(FooNEWGood main.c)
+
+#----------------------------------------------------------------------
+cmake_policy(SET CMP0065 NEW)
+add_executable(FooNEWBad main.c)
+set_target_properties(FooNEWBad PROPERTIES ENABLE_EXPORTS ON)
diff --git a/Tests/RunCMake/CMP0065/subproject/main.c b/Tests/RunCMake/CMP0065/subproject/main.c
new file mode 100644
index 0000000..98725db
--- /dev/null
+++ b/Tests/RunCMake/CMP0065/subproject/main.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+ printf("Hello World\n");
+ return 0;
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index c274d8f..f11d20c 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -104,6 +104,13 @@ add_RunCMake_test(CMP0057)
add_RunCMake_test(CMP0059)
add_RunCMake_test(CMP0060)
add_RunCMake_test(CMP0064)
+
+# The test for Policy 65 requires the use of the
+# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
+# generators ignore. The policy will have no effect on those generators.
+if(NOT CMAKE_GENERATOR MATCHES "Visual Studio|Xcode")
+ add_RunCMake_test(CMP0065)
+endif()
if(CMAKE_GENERATOR MATCHES "Make")
add_RunCMake_test(Make)
endif()
@@ -124,6 +131,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
)
endif()
+add_RunCMake_test(BuildDepends)
if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
add_RunCMake_test(CompilerChange)
endif()
@@ -139,6 +147,7 @@ add_RunCMake_test(GeneratorToolset)
add_RunCMake_test(GNUInstallDirs)
add_RunCMake_test(TargetPropertyGeneratorExpressions)
add_RunCMake_test(Languages)
+add_RunCMake_test(LinkStatic)
add_RunCMake_test(ObjectLibrary)
add_RunCMake_test(Swift)
add_RunCMake_test(TargetObjects)
@@ -183,6 +192,7 @@ add_RunCMake_test(find_file)
add_RunCMake_test(find_library)
add_RunCMake_test(find_package)
add_RunCMake_test(find_path)
+add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(get_filename_component)
add_RunCMake_test(get_property)
add_RunCMake_test(if)
@@ -239,6 +249,7 @@ add_RunCMake_test(CommandLine)
add_RunCMake_test(CommandLineTar)
add_RunCMake_test(install)
+add_RunCMake_test(CPackConfig)
add_RunCMake_test(CPackInstallProperties)
add_RunCMake_test(ExternalProject)
add_RunCMake_test(CTestCommandLine)
diff --git a/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake b/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake
new file mode 100644
index 0000000..7210e7d
--- /dev/null
+++ b/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake
@@ -0,0 +1,5 @@
+set(CPACK_COMPONENTS_ALL test)
+install(DIRECTORY DESTINATION empty
+ COMPONENT test)
+
+set(CPACK_PACKAGE_NAME "components_empty_dir")
diff --git a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake
new file mode 100644
index 0000000..5adca68
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake
@@ -0,0 +1,5 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_1 "components_empty_dir*.deb")
+set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$")
diff --git a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake
new file mode 100644
index 0000000..2720fe9
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake
@@ -0,0 +1,2 @@
+set(CPACK_PACKAGE_CONTACT "someone")
+set(CPACK_DEB_COMPONENT_INSTALL "ON")
diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake
index 78b6114..5f929ff 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake
@@ -1,11 +1,17 @@
set(foo_preinst "^echo default_preinst$")
+set(foo_preinst_permissions_regex "-rwxr-xr-x .*")
set(foo_prerm "^echo default_prerm$")
+set(foo_prerm_permissions_regex "-rwxr-xr-x .*")
verifyDebControl("${FOUND_FILE_1}" "foo" "preinst;prerm")
set(bar_preinst "^echo bar_preinst$")
+set(bar_prerm_permissions_regex "-rwx------ .*")
set(bar_prerm "^echo bar_prerm$")
+set(bar_prerm_permissions_regex "-rwx------ .*")
verifyDebControl("${FOUND_FILE_2}" "bar" "preinst;prerm")
set(bas_preinst "^echo default_preinst$")
+set(bas_prerm_permissions_regex "-rwxr-xr-x .*")
set(bas_prerm "^echo default_prerm$")
+set(bas_prerm_permissions_regex "-rwxr-xr-x .*")
verifyDebControl("${FOUND_FILE_3}" "bas" "preinst;prerm")
diff --git a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake
index 44c862d..ba39f2e 100644
--- a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake
@@ -1,4 +1,4 @@
-function(checkDepends_ FILE REGEX)
+function(checkDependencies_ FILE REGEX)
set(whitespaces_ "[\t\n\r ]*")
getPackageInfo("${FILE}" "FILE_INFO_")
@@ -7,9 +7,28 @@ function(checkDepends_ FILE REGEX)
endif()
endfunction()
-checkDepends_("${FOUND_FILE_1}" ".*Depends${whitespaces_}:${whitespaces_}depend-application, depend-application-b.*")
-# use wildcard as we are using dependency auto detection
-checkDepends_("${FOUND_FILE_2}" ".*Depends${whitespaces_}:${whitespaces_}.*depend-application, depend-application-b.*")
-checkDepends_("${FOUND_FILE_3}" ".*Depends${whitespaces_}:${whitespaces_}depend-headers.*")
-checkDepends_("${FOUND_FILE_4}" ".*Depends${whitespaces_}:${whitespaces_}depend-default, depend-default-b.*")
-checkDepends_("${FOUND_FILE_5}" ".*Depends${whitespaces_}:${whitespaces_}depend-default, depend-default-b.*")
+foreach(dependency_type_ DEPENDS CONFLICTS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS)
+ string(TOLOWER "${dependency_type_}" lower_dependency_type_)
+ string(SUBSTRING ${lower_dependency_type_} 1 -1 lower_dependency_type_tail_)
+ string(SUBSTRING ${dependency_type_} 0 1 dependency_type_head_)
+ set(dependency_type_name_ "${dependency_type_head_}${lower_dependency_type_tail_}")
+
+ checkDependencies_("${FOUND_FILE_1}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b.*")
+ checkDependencies_("${FOUND_FILE_2}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}.*${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b.*")
+ checkDependencies_("${FOUND_FILE_3}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-headers.*")
+ checkDependencies_("${FOUND_FILE_4}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b.*")
+ checkDependencies_("${FOUND_FILE_5}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b.*")
+endforeach()
+
+checkDependencies_("${FOUND_FILE_1}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
+checkDependencies_("${FOUND_FILE_2}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
+checkDependencies_("${FOUND_FILE_3}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
+checkDependencies_("${FOUND_FILE_4}" ".*Provides${whitespaces_}:${whitespaces_}provided-lib.*")
+checkDependencies_("${FOUND_FILE_5}" ".*Provides${whitespaces_}:${whitespaces_}provided-lib_auto.*, provided-lib_auto-b.*")
+
+# PREDEPENDS
+checkDependencies_("${FOUND_FILE_1}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-application, predepends-application-b.*")
+checkDependencies_("${FOUND_FILE_2}" ".*Pre-Depends${whitespaces_}:${whitespaces_}.*predepends-application, predepends-application-b.*")
+checkDependencies_("${FOUND_FILE_3}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-headers.*")
+checkDependencies_("${FOUND_FILE_4}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-default, predepends-default-b.*")
+checkDependencies_("${FOUND_FILE_5}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-default, predepends-default-b.*")
diff --git a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake
index 9e09428..96a9f14 100644
--- a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake
+++ b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake
@@ -7,9 +7,15 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS FALSE)
# to determine their dependencies and we can not be certain if there will be any
set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_SHLIBDEPS TRUE)
-set(CPACK_DEBIAN_PACKAGE_DEPENDS "depend-default, depend-default-b")
-set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_DEPENDS "depend-application, depend-application-b")
-set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_DEPENDS "depend-application, depend-application-b")
-set(CPACK_DEBIAN_HEADERS_PACKAGE_DEPENDS "depend-headers")
+foreach(dependency_type_ DEPENDS CONFLICTS PREDEPENDS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS)
+ string(TOLOWER "${dependency_type_}" lower_dependency_type_)
-# TODO add other dependency tests once CPackDeb supports them
+ set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b")
+ set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b")
+ set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b")
+ set(CPACK_DEBIAN_HEADERS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-headers")
+endforeach()
+
+set(CPACK_DEBIAN_PACKAGE_PROVIDES "provided-default, provided-default-b")
+set(CPACK_DEBIAN_LIBS_PACKAGE_PROVIDES "provided-lib")
+set(CPACK_DEBIAN_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b")
diff --git a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake
new file mode 100644
index 0000000..1552a36
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake
@@ -0,0 +1,5 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_1 "empty_dir*.deb")
+set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$")
diff --git a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake
new file mode 100644
index 0000000..8821ab9
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake
@@ -0,0 +1 @@
+set(CPACK_PACKAGE_CONTACT "someone")
diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake
index a204a3c..f490130 100644
--- a/Tests/RunCMake/CPack/DEB/Helpers.cmake
+++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake
@@ -14,7 +14,7 @@ function(verifyDebControl FILE PREFIX VERIFY_FILES)
ERROR_VARIABLE err_)
if(err_)
- message(FATAL_ERROR "Debian controll verification failed for file: "
+ message(FATAL_ERROR "Debian control verification failed for file: "
"'${FILE}'; error output: '${err_}'")
endif()
@@ -24,6 +24,19 @@ function(verifyDebControl FILE PREFIX VERIFY_FILES)
message(FATAL_ERROR "Unexpected content in for '${PREFIX}_${FILE_}'!"
" Content: '${content_}'")
endif()
+
+ execute_process(COMMAND ls -l "${CMAKE_CURRENT_BINARY_DIR}/control_${PREFIX}/${FILE_}"
+ OUTPUT_VARIABLE package_permissions_
+ ERROR_VARIABLE package_permissions_error_
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if(NOT package_permissions_error_)
+ if(NOT package_permissions_ MATCHES "${${PREFIX}_${FILE_}_permissions_regex}")
+ message(FATAL_ERROR "Unexpected file permissions for ${PREFIX}_${FILE_}: '${package_permissions_}'!")
+ endif()
+ else()
+ message(FATAL_ERROR "Listing file permissions failed (${package_permissions_error_})!")
+ endif()
endforeach()
endfunction()
diff --git a/Tests/RunCMake/CPack/DEB_EXTRA.cmake b/Tests/RunCMake/CPack/DEB_EXTRA.cmake
index 46d848d..3c291d5 100644
--- a/Tests/RunCMake/CPack/DEB_EXTRA.cmake
+++ b/Tests/RunCMake/CPack/DEB_EXTRA.cmake
@@ -2,14 +2,32 @@ install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo)
install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar)
install(FILES CMakeLists.txt DESTINATION bas COMPONENT bas)
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/preinst "echo default_preinst")
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/prerm "echo default_prerm")
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/preinst "echo default_preinst")
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/prerm "echo default_prerm")
+
+foreach(file_ preinst prerm)
+ file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tmp/${file_}
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
+ FILE_PERMISSIONS
+ OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE)
+endforeach()
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
- "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm")
+ "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm;${CMAKE_CURRENT_BINARY_DIR}/conffiles")
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/preinst "echo bar_preinst")
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/prerm "echo bar_prerm")
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar/preinst "echo bar_preinst")
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar/prerm "echo bar_prerm")
+foreach(file_ preinst prerm)
+ # not acceptable permissions for lintian but we need to check that
+ # permissions are preserved
+ file(COPY ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/${file_}
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bar
+ FILE_PERMISSIONS
+ OWNER_READ OWNER_WRITE OWNER_EXECUTE)
+endforeach()
set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA
"${CMAKE_CURRENT_BINARY_DIR}/bar/preinst;${CMAKE_CURRENT_BINARY_DIR}/bar/prerm")
diff --git a/Tests/RunCMake/CPack/EMPTY_DIR.cmake b/Tests/RunCMake/CPack/EMPTY_DIR.cmake
new file mode 100644
index 0000000..023ba17
--- /dev/null
+++ b/Tests/RunCMake/CPack/EMPTY_DIR.cmake
@@ -0,0 +1,4 @@
+install(DIRECTORY DESTINATION empty
+ COMPONENT test)
+
+set(CPACK_PACKAGE_NAME "empty_dir")
diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt
index 365c737..ea68304 100644
--- a/Tests/RunCMake/CPack/README.txt
+++ b/Tests/RunCMake/CPack/README.txt
@@ -32,14 +32,14 @@ different types of packages. This script is placed into CPack test root
directory even if it will be used for only one of the generators.
If test will be used for multiple generators but some of them require some
-generator speciffic commands then those commands should be added to a separate
+generator specific commands then those commands should be added to a separate
file that should be located in '<generator_name>/<test_name>-specifics.cmake'
in CPack test root directory.
CPack execution phase:
----------------------
-Only exececutes CPack for content that was generated during CMake execution
+Only executes CPack for content that was generated during CMake execution
phase.
Verification of generated files:
diff --git a/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake
new file mode 100644
index 0000000..d396276
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake
@@ -0,0 +1,5 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_1 "components_empty_dir*.rpm")
+set(EXPECTED_FILE_CONTENT_1 "^/usr/empty$")
diff --git a/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt
new file mode 100644
index 0000000..6ddca12
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt
@@ -0,0 +1 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/COMPONENTS_EMPTY_DIR-build/_CPack_Packages/.*/RPM/SPECS/components_empty_dir.spec$
diff --git a/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake
new file mode 100644
index 0000000..0c2977f
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake
@@ -0,0 +1,5 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_1 "empty_dir*.rpm")
+set(EXPECTED_FILE_CONTENT_1 "^/usr/empty$")
diff --git a/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt
new file mode 100644
index 0000000..1777aa0
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt
@@ -0,0 +1 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/EMPTY_DIR-build/_CPack_Packages/.*/RPM/SPECS/empty_dir.spec$
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 3e5714d..89673c2 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -8,3 +8,5 @@ run_cpack_test(MINIMAL "RPM;DEB" false)
run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false)
run_cpack_test(DEB_EXTRA "DEB" false)
run_cpack_test(DEPENDENCIES "RPM;DEB" true)
+run_cpack_test(EMPTY_DIR "RPM;DEB" true)
+run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB" true)
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
index 96efa9e..6eab531 100644
--- a/Tests/RunCMake/CPack/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -28,8 +28,9 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0)
if(NOT expected_content_list)
message(FATAL_ERROR
- "Unexpected file content for file No. '${file_no_}'!"
- " Content: '${PACKAGE_CONTENT}'"
+ "Unexpected file content for file No. '${file_no_}'!\n"
+ " Content: '${PACKAGE_CONTENT}'\n\n"
+ " Expected: '${EXPECTED_FILE_CONTENT_${file_no_}}'"
"${output_error_message}")
endif()
else()
@@ -56,7 +57,7 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0)
"${output_error_message}")
endif()
- # sanity check that we didn't accidentaly list wrong files with our regular
+ # sanity check that we didn't accidentally list wrong files with our regular
# expressions
foreach(expected_ IN LISTS allFoundFiles_)
list(FIND foundFiles_ "${expected_}" found_)
diff --git a/Tests/RunCMake/CPackConfig/CMakeLists.txt b/Tests/RunCMake/CPackConfig/CMakeLists.txt
new file mode 100644
index 0000000..9a9e7b4
--- /dev/null
+++ b/Tests/RunCMake/CPackConfig/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 3.3)
+
+project(${RunCMake_TEST})
+include(${RunCMake_TEST}.cmake)
+
+include(CPack)
diff --git a/Tests/RunCMake/CPackConfig/Default-check.cmake b/Tests/RunCMake/CPackConfig/Default-check.cmake
new file mode 100644
index 0000000..b67fe81
--- /dev/null
+++ b/Tests/RunCMake/CPackConfig/Default-check.cmake
@@ -0,0 +1,7 @@
+include(${RunCMake_SOURCE_DIR}/check.cmake)
+
+test_variable(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Foo\\Bar")
+test_variable(CPACK_NSIS_PACKAGE_NAME "Bar\\Foo")
+
+test_variable(CPACK_SOURCE_IGNORE_FILES
+ "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#")
diff --git a/Tests/RunCMake/CPackConfig/Default.cmake b/Tests/RunCMake/CPackConfig/Default.cmake
new file mode 100644
index 0000000..3b3beb3
--- /dev/null
+++ b/Tests/RunCMake/CPackConfig/Default.cmake
@@ -0,0 +1,3 @@
+# two levels of escaping to pass through CPackConfig.cmake
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "Foo\\\\Bar")
+set(CPACK_NSIS_DISPLAY_NAME "Bar\\\\Foo")
diff --git a/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake b/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake
new file mode 100644
index 0000000..16d2cf3
--- /dev/null
+++ b/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+
+run_cmake(Simple)
+run_cmake(Default)
+run_cmake(Special)
+run_cmake(Verbatim)
diff --git a/Tests/RunCMake/CPackConfig/Simple-check.cmake b/Tests/RunCMake/CPackConfig/Simple-check.cmake
new file mode 100644
index 0000000..6e0cf6f
--- /dev/null
+++ b/Tests/RunCMake/CPackConfig/Simple-check.cmake
@@ -0,0 +1,3 @@
+include(${RunCMake_SOURCE_DIR}/check.cmake)
+
+test_variable(CPACK_FOO "bar baz;quux")
diff --git a/Tests/RunCMake/CPackConfig/Simple.cmake b/Tests/RunCMake/CPackConfig/Simple.cmake
new file mode 100644
index 0000000..c9f6541
--- /dev/null
+++ b/Tests/RunCMake/CPackConfig/Simple.cmake
@@ -0,0 +1 @@
+set(CPACK_FOO "bar baz;quux")
diff --git a/Tests/RunCMake/CPackConfig/Special-check.cmake b/Tests/RunCMake/CPackConfig/Special-check.cmake
new file mode 100644
index 0000000..0624b79
--- /dev/null
+++ b/Tests/RunCMake/CPackConfig/Special-check.cmake
@@ -0,0 +1,5 @@
+include(${RunCMake_SOURCE_DIR}/check.cmake)
+
+test_variable(CPACK_BACKSLASH "\\")
+test_variable(CPACK_QUOTE "a;b;c")
+test_variable(CPACK_DOLLAR "ab")
diff --git a/Tests/RunCMake/CPackConfig/Special.cmake b/Tests/RunCMake/CPackConfig/Special.cmake
new file mode 100644
index 0000000..9442c93
--- /dev/null
+++ b/Tests/RunCMake/CPackConfig/Special.cmake
@@ -0,0 +1,3 @@
+set(CPACK_BACKSLASH "\\\\")
+set(CPACK_QUOTE "a\" b \"c")
+set(CPACK_DOLLAR "a\${NOTHING}b")
diff --git a/Tests/RunCMake/CPackConfig/Verbatim-check.cmake b/Tests/RunCMake/CPackConfig/Verbatim-check.cmake
new file mode 100644
index 0000000..958547d
--- /dev/null
+++ b/Tests/RunCMake/CPackConfig/Verbatim-check.cmake
@@ -0,0 +1,10 @@
+include(${RunCMake_SOURCE_DIR}/check.cmake)
+
+test_variable(CPACK_BACKSLASH "\\\\")
+test_variable(CPACK_QUOTE "a\" b \"c")
+test_variable(CPACK_DOLLAR "a\${NOTHING}b")
+
+# make sure the default for this is still set correctly with
+# CPACK_VERBATIM_VARIABLES on
+test_variable(CPACK_SOURCE_IGNORE_FILES
+ "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#")
diff --git a/Tests/RunCMake/CPackConfig/Verbatim.cmake b/Tests/RunCMake/CPackConfig/Verbatim.cmake
new file mode 100644
index 0000000..4d271c3
--- /dev/null
+++ b/Tests/RunCMake/CPackConfig/Verbatim.cmake
@@ -0,0 +1,5 @@
+set(CPACK_VERBATIM_VARIABLES YES)
+
+set(CPACK_BACKSLASH "\\\\")
+set(CPACK_QUOTE "a\" b \"c")
+set(CPACK_DOLLAR "a\${NOTHING}b")
diff --git a/Tests/RunCMake/CPackConfig/check.cmake b/Tests/RunCMake/CPackConfig/check.cmake
new file mode 100644
index 0000000..ca6229e
--- /dev/null
+++ b/Tests/RunCMake/CPackConfig/check.cmake
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION ${CMAKE_VERSION} FATAL_ERROR)
+
+function(test_variable NAME EXPECTED_VALUE)
+ if(NOT "${${NAME}}" STREQUAL "${EXPECTED_VALUE}")
+ message(FATAL_ERROR "${NAME}: variable mismatch; expected [${EXPECTED_VALUE}] actual [${${NAME}}]")
+ endif()
+endfunction()
+
+include(${RunCMake_TEST_BINARY_DIR}/CPackConfig.cmake)
+include(${RunCMake_TEST_BINARY_DIR}/CPackSourceConfig.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index dfc1e33..00895cc 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -108,3 +108,20 @@ run_TestLoad(test-load-invalid 'two')
run_TestLoad(test-load-pass 10)
unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING})
+
+function(run_TestOutputSize)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestOutputSize)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+ add_test(PassingTest \"${CMAKE_COMMAND}\" -E echo PassingTestOutput)
+ add_test(FailingTest \"${CMAKE_COMMAND}\" -E no_such_command)
+")
+ run_cmake_command(TestOutputSize
+ ${CMAKE_CTEST_COMMAND} -M Experimental -T Test
+ --test-output-size-passed 10
+ --test-output-size-failed 12
+ )
+endfunction()
+run_TestOutputSize()
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake
new file mode 100644
index 0000000..918d242
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake
@@ -0,0 +1,17 @@
+file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml")
+if(test_xml_file)
+ file(READ "${test_xml_file}" test_xml LIMIT 4096)
+ if("${test_xml}" MATCHES [[(<Test Status="passed">.*</Test>).*(<Test Status="failed">.*</Test>)]])
+ set(test_passed "${CMAKE_MATCH_1}")
+ set(test_failed "${CMAKE_MATCH_2}")
+ else()
+ set(RunCMake_TEST_FAILED "Test.xml does not contain a passed then failed test:\n ${test_xml}")
+ endif()
+ if(NOT "${test_passed}" MATCHES [[<Value>PassingTes\.\.\..*10 bytes]])
+ set(RunCMake_TEST_FAILED "Test.xml passed test output not truncated at 10 bytes:\n ${test_passed}")
+ elseif(NOT "${test_failed}" MATCHES [[<Value>CMake Error:\.\.\..*12 bytes]])
+ set(RunCMake_TEST_FAILED "Test.xml failed test output not truncated at 12 bytes:\n ${test_failed}")
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "Test.xml not found")
+endif()
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt
new file mode 100644
index 0000000..9c558e3
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt
@@ -0,0 +1 @@
+.
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt
new file mode 100644
index 0000000..ba4235d
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt
@@ -0,0 +1 @@
+Errors while running CTest
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index c1b2227..8dc627d 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -29,7 +29,7 @@ if (NOT CXX_FEATURES)
run_cmake(NoSupportedCxxFeatures)
run_cmake(NoSupportedCxxFeaturesGenex)
else()
- if(CXX_STANDARD_DEFAULT)
+ if(CXX_STANDARD_DEFAULT EQUAL 98)
run_cmake(LinkImplementationFeatureCycle)
endif()
run_cmake(LinkImplementationFeatureCycleSolved)
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt
new file mode 100644
index 0000000..5f211eb
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt
@@ -0,0 +1 @@
+-- g_ir_scanner: .*/g-ir-scanner
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake
new file mode 100644
index 0000000..c85efaa
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake
@@ -0,0 +1,9 @@
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(GOBJECT_INTROSPECTION QUIET gobject-introspection-1.0)
+
+if (GOBJECT_INTROSPECTION_FOUND)
+ pkg_get_variable(g_ir_scanner gobject-introspection-1.0 g_ir_scanner)
+ message(STATUS "g_ir_scanner: ${g_ir_scanner}")
+else ()
+ message(STATUS "g_ir_scanner: skipping test; gobject-introspection-1.0 not found /g-ir-scanner")
+endif ()
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index 29301d7..bb04aa2 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -9,3 +9,9 @@ if(APPLE)
run_cmake(FindPkgConfig_CMAKE_FRAMEWORK_PATH)
run_cmake(FindPkgConfig_CMAKE_APPBUNDLE_PATH)
endif()
+
+# We need a real pkg-config to run the test for get_variable.
+find_package(PkgConfig)
+if (PKG_CONFIG_FOUND)
+ run_cmake(FindPkgConfig_GET_VARIABLE)
+endif ()
diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-result.txt b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt
new file mode 100644
index 0000000..bf592e7
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at OUTPUT_NAME-recursion.cmake:[0-9]+ \(add_executable\):
+ Target 'empty1' OUTPUT_NAME depends on itself.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake
new file mode 100644
index 0000000..5cb8050
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_executable(empty1 empty.c)
+set_property(TARGET empty1 PROPERTY OUTPUT_NAME $<TARGET_FILE_NAME:empty1>)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 21fc851..0679024 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -26,6 +26,7 @@ run_cmake(COMPILE_LANGUAGE-add_library)
run_cmake(COMPILE_LANGUAGE-add_test)
run_cmake(COMPILE_LANGUAGE-unknown-lang)
run_cmake(TARGET_FILE-recursion)
+run_cmake(OUTPUT_NAME-recursion)
run_cmake(ImportedTarget-TARGET_PDB_FILE)
if(LINKER_SUPPORTS_PDB)
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion.cmake
index 7633be1..e780103 100644
--- a/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion.cmake
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion.cmake
@@ -1,3 +1,4 @@
enable_language(C)
add_executable(empty1 empty.c)
+set_property(TARGET empty1 PROPERTY OUTPUT_NAME $<TARGET_FILE_NAME:empty1>)
set_property(TARGET empty1 PROPERTY RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:empty1>)
diff --git a/Tests/RunCMake/LinkStatic/CMakeLists.txt b/Tests/RunCMake/LinkStatic/CMakeLists.txt
new file mode 100644
index 0000000..74b3ff8
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.3)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/set_property/LINK_SEARCH_STATIC.cmake b/Tests/RunCMake/LinkStatic/LINK_SEARCH_STATIC.cmake
index 70d2fee..6db5c85 100644
--- a/Tests/RunCMake/set_property/LINK_SEARCH_STATIC.cmake
+++ b/Tests/RunCMake/LinkStatic/LINK_SEARCH_STATIC.cmake
@@ -1,4 +1,4 @@
-project(LinkSearchStatic)
+enable_language(C)
set(CMAKE_LINK_SEARCH_START_STATIC ON)
add_executable(LinkSearchStartStaticInit1 LinkStatic.c)
diff --git a/Tests/RunCMake/set_property/LinkStatic.c b/Tests/RunCMake/LinkStatic/LinkStatic.c
index 3600977..3600977 100644
--- a/Tests/RunCMake/set_property/LinkStatic.c
+++ b/Tests/RunCMake/LinkStatic/LinkStatic.c
diff --git a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake
new file mode 100644
index 0000000..0d29492
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(LINK_SEARCH_STATIC)
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 46bc494..db9911d 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -102,7 +102,7 @@ function(run_cmake test)
endif()
foreach(o out err)
string(REGEX REPLACE "\r\n" "\n" actual_std${o} "${actual_std${o}}")
- string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage|[a-z]+\\([0-9]+\\) malloc:|Error kstat returned)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}")
+ string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage|[a-z]+\\([0-9]+\\) malloc:|Error kstat returned|[^\n]*from Time Machine by path|[^\n]*Bullseye Testing Technology)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}")
string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}")
set(expect_${o} "")
if(DEFINED expect_std${o})
@@ -115,7 +115,11 @@ function(run_cmake test)
endif()
endforeach()
unset(RunCMake_TEST_FAILED)
- include(${top_src}/${test}-check.cmake OPTIONAL)
+ if(RunCMake-check-file AND EXISTS ${top_src}/${RunCMake-check-file})
+ include(${top_src}/${RunCMake-check-file})
+ else()
+ include(${top_src}/${test}-check.cmake OPTIONAL)
+ endif()
if(RunCMake_TEST_FAILED)
set(msg "${RunCMake_TEST_FAILED}\n${msg}")
endif()
diff --git a/Tests/RunCMake/Swift/Enable-stdout.txt b/Tests/RunCMake/Swift/Enable-stdout.txt
deleted file mode 100644
index 39e133f..0000000
--- a/Tests/RunCMake/Swift/Enable-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
--- The Swift compiler identification is Apple
diff --git a/Tests/RunCMake/Swift/Enable.cmake b/Tests/RunCMake/Swift/Enable.cmake
deleted file mode 100644
index 19f297a..0000000
--- a/Tests/RunCMake/Swift/Enable.cmake
+++ /dev/null
@@ -1 +0,0 @@
-enable_language(Swift)
diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake
index 0a57121..4864295 100644
--- a/Tests/RunCMake/Swift/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake
@@ -3,8 +3,6 @@ include(RunCMake)
if(RunCMake_GENERATOR STREQUAL Xcode)
if(XCODE_BELOW_6_1)
run_cmake(XcodeTooOld)
- else()
- run_cmake(Enable)
endif()
else()
run_cmake(NotSupported)
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index d0aa995..57047fb 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -19,6 +19,7 @@
\* CMP0052
\* CMP0060
\* CMP0063
+ \* CMP0065
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index b7de614..8ab618b 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -7,3 +7,55 @@ run_cmake(XcodeObjectNeedsQuote)
if (NOT XCODE_VERSION VERSION_LESS 6)
run_cmake(XcodePlatformFrameworks)
endif()
+
+# Use a single build tree for a few tests without cleaning.
+
+if(NOT XCODE_VERSION VERSION_LESS 5)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeInstallIOS-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/ios_install")
+
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake(XcodeInstallIOS)
+ run_cmake_command(XcodeInstallIOS-install ${CMAKE_COMMAND} --build . --target install)
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+ unset(RunCMake_TEST_OPTIONS)
+
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesOSX-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_OPTIONS "-DTEST_IOS=OFF")
+
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake(XcodeBundles)
+ run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .)
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+ unset(RunCMake_TEST_OPTIONS)
+
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesIOS-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_OPTIONS "-DTEST_IOS=ON")
+
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake(XcodeBundles)
+ run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .)
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+ unset(RunCMake_TEST_OPTIONS)
+endif()
+
+if(NOT XCODE_VERSION VERSION_LESS 7)
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/osx.cmake")
+ run_cmake(XcodeTbdStub)
+ unset(RunCMake_TEST_OPTIONS)
+endif()
diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
new file mode 100644
index 0000000..2cbccfa
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
@@ -0,0 +1,45 @@
+# check if Xcode and CMake have the same understanding of Bundle layout
+
+cmake_minimum_required(VERSION 3.3)
+enable_language(C)
+
+if(TEST_IOS)
+ set(CMAKE_OSX_SYSROOT iphoneos)
+ set(CMAKE_OSX_ARCHITECTURES "armv7")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
+ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
+endif(TEST_IOS)
+
+# App Bundle
+
+add_executable(AppBundle MACOSX_BUNDLE main.m)
+
+add_custom_target(AppBundleTest ALL
+ COMMAND ${CMAKE_COMMAND} -E copy
+ "$<TARGET_FILE:AppBundle>" "$<TARGET_FILE:AppBundle>.old")
+
+add_dependencies(AppBundleTest AppBundle)
+
+# Framework (not supported for iOS on Xcode < 6)
+
+if(NOT TEST_IOS OR NOT XCODE_VERSION VERSION_LESS 6)
+ add_library(Framework SHARED main.c)
+ set_target_properties(Framework PROPERTIES FRAMEWORK TRUE)
+
+ add_custom_target(FrameworkTest ALL
+ COMMAND ${CMAKE_COMMAND} -E copy
+ "$<TARGET_FILE:Framework>" "$<TARGET_FILE:Framework>.old")
+
+ add_dependencies(FrameworkTest Framework)
+endif()
+
+# Bundle
+
+add_library(Bundle MODULE main.c)
+set_target_properties(Bundle PROPERTIES BUNDLE TRUE)
+
+add_custom_target(BundleTest ALL
+ COMMAND ${CMAKE_COMMAND} -E copy
+ "$<TARGET_FILE:Bundle>" "$<TARGET_FILE:Bundle>.old")
+
+add_dependencies(BundleTest Bundle)
diff --git a/Tests/RunCMake/XcodeProject/XcodeInstallIOS-install-stdout.txt b/Tests/RunCMake/XcodeProject/XcodeInstallIOS-install-stdout.txt
new file mode 100644
index 0000000..f2478be
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeInstallIOS-install-stdout.txt
@@ -0,0 +1,2 @@
+-- Install configuration: .*
+-- Installing: .*/ios_install/lib/libfoo.a
diff --git a/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake b/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake
new file mode 100644
index 0000000..a797410
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 2.8.5)
+
+project(XcodeInstallIOS)
+
+set(CMAKE_OSX_SYSROOT iphoneos)
+set(XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
+set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
+
+set(CMAKE_OSX_ARCHITECTURES "armv7;i386")
+
+add_library(foo STATIC foo.cpp)
+install(TARGETS foo ARCHIVE DESTINATION lib)
diff --git a/Tests/RunCMake/XcodeProject/XcodeTbdStub-stdout.txt b/Tests/RunCMake/XcodeProject/XcodeTbdStub-stdout.txt
new file mode 100644
index 0000000..9d9e143
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeTbdStub-stdout.txt
@@ -0,0 +1 @@
+.*/libz\.tbd.*
diff --git a/Tests/RunCMake/XcodeProject/XcodeTbdStub.cmake b/Tests/RunCMake/XcodeProject/XcodeTbdStub.cmake
new file mode 100644
index 0000000..e83d7f3
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeTbdStub.cmake
@@ -0,0 +1,2 @@
+cmake_minimum_required(VERSION 3.3)
+find_package(ZLIB REQUIRED)
diff --git a/Tests/RunCMake/XcodeProject/foo.cpp b/Tests/RunCMake/XcodeProject/foo.cpp
new file mode 100644
index 0000000..2fb55ee
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/foo.cpp
@@ -0,0 +1 @@
+void foo() { }
diff --git a/Tests/RunCMake/XcodeProject/main.m b/Tests/RunCMake/XcodeProject/main.m
new file mode 100644
index 0000000..6dc190a
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/main.m
@@ -0,0 +1,3 @@
+int main(int argc, const char * argv[]) {
+ return 1;
+}
diff --git a/Tests/RunCMake/XcodeProject/osx.cmake b/Tests/RunCMake/XcodeProject/osx.cmake
new file mode 100644
index 0000000..e021fcd
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/osx.cmake
@@ -0,0 +1,18 @@
+set(CMAKE_SYSTEM_NAME Darwin)
+set(CMAKE_SYSTEM_VERSION 1)
+set(UNIX True)
+set(APPLE True)
+
+find_program(XCRUN_EXECUTABLE xcrun)
+if(NOT XCRUN_EXECUTABLE)
+ message(FATAL_ERROR "xcrun not found")
+endif()
+
+execute_process(
+ COMMAND ${XCRUN_EXECUTABLE} --sdk macosx --show-sdk-path
+ OUTPUT_VARIABLE OSX_SDK_PATH
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+set(CMAKE_OSX_SYSROOT ${OSX_SDK_PATH} CACHE PATH "Sysroot used for OSX support")
+
+set(CMAKE_FIND_ROOT_PATH ${OSX_SDK_PATH} CACHE PATH "Find search path root")
diff --git a/Tests/RunCMake/ctest_test/CMakeLists.txt.in b/Tests/RunCMake/ctest_test/CMakeLists.txt.in
index cedf379..e61b556 100644
--- a/Tests/RunCMake/ctest_test/CMakeLists.txt.in
+++ b/Tests/RunCMake/ctest_test/CMakeLists.txt.in
@@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 3.1)
project(CTestTest@CASE_NAME@ NONE)
include(CTest)
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
+@CASE_CMAKELISTS_SUFFIX_CODE@
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
index 76dc143..e2f380c 100644
--- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
@@ -59,3 +59,18 @@ function(run_TestChangeId)
run_ctest(TestChangeId)
endfunction()
run_TestChangeId()
+
+function(run_TestOutputSize)
+ set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion)
+ set(CASE_TEST_PREFIX_CODE [[
+set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 10)
+set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 12)
+ ]])
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME PassingTest COMMAND ${CMAKE_COMMAND} -E echo PassingTestOutput)
+add_test(NAME FailingTest COMMAND ${CMAKE_COMMAND} -E no_such_command)
+ ]])
+
+ run_ctest(TestOutputSize)
+endfunction()
+run_TestOutputSize()
diff --git a/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake b/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake
new file mode 100644
index 0000000..918d242
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake
@@ -0,0 +1,17 @@
+file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml")
+if(test_xml_file)
+ file(READ "${test_xml_file}" test_xml LIMIT 4096)
+ if("${test_xml}" MATCHES [[(<Test Status="passed">.*</Test>).*(<Test Status="failed">.*</Test>)]])
+ set(test_passed "${CMAKE_MATCH_1}")
+ set(test_failed "${CMAKE_MATCH_2}")
+ else()
+ set(RunCMake_TEST_FAILED "Test.xml does not contain a passed then failed test:\n ${test_xml}")
+ endif()
+ if(NOT "${test_passed}" MATCHES [[<Value>PassingTes\.\.\..*10 bytes]])
+ set(RunCMake_TEST_FAILED "Test.xml passed test output not truncated at 10 bytes:\n ${test_passed}")
+ elseif(NOT "${test_failed}" MATCHES [[<Value>CMake Error:\.\.\..*12 bytes]])
+ set(RunCMake_TEST_FAILED "Test.xml failed test output not truncated at 12 bytes:\n ${test_failed}")
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "Test.xml not found")
+endif()
diff --git a/Tests/RunCMake/find_program/A/testA b/Tests/RunCMake/find_program/A/testA
new file mode 100755
index 0000000..1a24852
--- /dev/null
+++ b/Tests/RunCMake/find_program/A/testA
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/Tests/RunCMake/find_program/A/testAandB b/Tests/RunCMake/find_program/A/testAandB
new file mode 100755
index 0000000..1a24852
--- /dev/null
+++ b/Tests/RunCMake/find_program/A/testAandB
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/Tests/RunCMake/find_program/B/testAandB b/Tests/RunCMake/find_program/B/testAandB
new file mode 100755
index 0000000..1a24852
--- /dev/null
+++ b/Tests/RunCMake/find_program/B/testAandB
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/Tests/RunCMake/find_program/B/testB b/Tests/RunCMake/find_program/B/testB
new file mode 100755
index 0000000..1a24852
--- /dev/null
+++ b/Tests/RunCMake/find_program/B/testB
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/Tests/RunCMake/find_program/CMakeLists.txt b/Tests/RunCMake/find_program/CMakeLists.txt
new file mode 100644
index 0000000..74b3ff8
--- /dev/null
+++ b/Tests/RunCMake/find_program/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.3)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/find_program/DirsPerName-stdout.txt b/Tests/RunCMake/find_program/DirsPerName-stdout.txt
new file mode 100644
index 0000000..f763bb0
--- /dev/null
+++ b/Tests/RunCMake/find_program/DirsPerName-stdout.txt
@@ -0,0 +1 @@
+-- PROG='[^']*/Tests/RunCMake/find_program/B/testB'
diff --git a/Tests/RunCMake/find_program/DirsPerName.cmake b/Tests/RunCMake/find_program/DirsPerName.cmake
new file mode 100644
index 0000000..54db6dd
--- /dev/null
+++ b/Tests/RunCMake/find_program/DirsPerName.cmake
@@ -0,0 +1,6 @@
+find_program(PROG
+ NAMES testB testA
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG='${PROG}'")
diff --git a/Tests/RunCMake/find_program/EnvAndHints-stdout.txt b/Tests/RunCMake/find_program/EnvAndHints-stdout.txt
new file mode 100644
index 0000000..39329b2
--- /dev/null
+++ b/Tests/RunCMake/find_program/EnvAndHints-stdout.txt
@@ -0,0 +1 @@
+-- PROG='[^']*/Tests/RunCMake/find_program/A/testAandB'
diff --git a/Tests/RunCMake/find_program/EnvAndHints.cmake b/Tests/RunCMake/find_program/EnvAndHints.cmake
new file mode 100644
index 0000000..14ebd6e
--- /dev/null
+++ b/Tests/RunCMake/find_program/EnvAndHints.cmake
@@ -0,0 +1,8 @@
+set(ENV_PATH "$ENV{PATH}")
+set(ENV{PATH} ${CMAKE_CURRENT_SOURCE_DIR}/A)
+find_program(PROG
+ NAMES testAandB
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
+ )
+message(STATUS "PROG='${PROG}'")
+set(ENV{PATH} "${ENV_PATH}")
diff --git a/Tests/RunCMake/find_program/NamesPerDir-stdout.txt b/Tests/RunCMake/find_program/NamesPerDir-stdout.txt
new file mode 100644
index 0000000..964e259
--- /dev/null
+++ b/Tests/RunCMake/find_program/NamesPerDir-stdout.txt
@@ -0,0 +1 @@
+-- PROG='[^']*/Tests/RunCMake/find_program/A/testA'
diff --git a/Tests/RunCMake/find_program/NamesPerDir.cmake b/Tests/RunCMake/find_program/NamesPerDir.cmake
new file mode 100644
index 0000000..49ce49d
--- /dev/null
+++ b/Tests/RunCMake/find_program/NamesPerDir.cmake
@@ -0,0 +1,6 @@
+find_program(PROG
+ NAMES testB testA NAMES_PER_DIR
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG='${PROG}'")
diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake
new file mode 100644
index 0000000..89307c1
--- /dev/null
+++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake
@@ -0,0 +1,10 @@
+include(RunCMake)
+
+run_cmake(EnvAndHints)
+run_cmake(DirsPerName)
+run_cmake(NamesPerDir)
+
+if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN)$")
+ run_cmake(WindowsCom)
+ run_cmake(WindowsExe)
+endif()
diff --git a/Tests/RunCMake/find_program/Win/testCom.com b/Tests/RunCMake/find_program/Win/testCom.com
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_program/Win/testCom.com
diff --git a/Tests/RunCMake/find_program/Win/testCom.exe b/Tests/RunCMake/find_program/Win/testCom.exe
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_program/Win/testCom.exe
diff --git a/Tests/RunCMake/find_program/Win/testExe.exe b/Tests/RunCMake/find_program/Win/testExe.exe
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_program/Win/testExe.exe
diff --git a/Tests/RunCMake/find_program/WindowsCom-stdout.txt b/Tests/RunCMake/find_program/WindowsCom-stdout.txt
new file mode 100644
index 0000000..e386fce
--- /dev/null
+++ b/Tests/RunCMake/find_program/WindowsCom-stdout.txt
@@ -0,0 +1 @@
+-- PROG='[^']*/Tests/RunCMake/find_program/Win/testCom.com'
diff --git a/Tests/RunCMake/find_program/WindowsCom.cmake b/Tests/RunCMake/find_program/WindowsCom.cmake
new file mode 100644
index 0000000..b32d9e8
--- /dev/null
+++ b/Tests/RunCMake/find_program/WindowsCom.cmake
@@ -0,0 +1,6 @@
+find_program(PROG
+ NAMES testCom
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/Win
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG='${PROG}'")
diff --git a/Tests/RunCMake/find_program/WindowsExe-stdout.txt b/Tests/RunCMake/find_program/WindowsExe-stdout.txt
new file mode 100644
index 0000000..bdf48aa
--- /dev/null
+++ b/Tests/RunCMake/find_program/WindowsExe-stdout.txt
@@ -0,0 +1 @@
+-- PROG='[^']*/Tests/RunCMake/find_program/Win/testExe.exe'
diff --git a/Tests/RunCMake/find_program/WindowsExe.cmake b/Tests/RunCMake/find_program/WindowsExe.cmake
new file mode 100644
index 0000000..3a336ec
--- /dev/null
+++ b/Tests/RunCMake/find_program/WindowsExe.cmake
@@ -0,0 +1,6 @@
+find_program(PROG
+ NAMES testExe
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/Win
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG='${PROG}'")
diff --git a/Tests/RunCMake/get_filename_component/KnownComponents.cmake b/Tests/RunCMake/get_filename_component/KnownComponents.cmake
index 386109f..d822258 100644
--- a/Tests/RunCMake/get_filename_component/KnownComponents.cmake
+++ b/Tests/RunCMake/get_filename_component/KnownComponents.cmake
@@ -38,6 +38,39 @@ check("ABSOLUTE .. in windows root" "${test_absolute}" "c:/path/to/filename.ext.
list(APPEND non_cache_vars test_absolute)
+# Test finding absolute paths from various base directories.
+
+get_filename_component(test_abs_base "testdir1" ABSOLUTE)
+check("ABSOLUTE .. from default base" "${test_abs_base}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/testdir1")
+
+get_filename_component(test_abs_base "../testdir2" ABSOLUTE
+ BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dummydir")
+check("ABSOLUTE .. from dummy base to parent" "${test_abs_base}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/testdir2")
+
+get_filename_component(test_abs_base "testdir3" ABSOLUTE
+ BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dummydir")
+check("ABSOLUTE .. from dummy base to child" "${test_abs_base}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/dummydir/testdir3")
+
+list(APPEND non_cache_vars test_abs_base)
+
+# Test finding absolute paths with CACHE parameter. (Note that more
+# rigorous testing of the CACHE parameter comes later with PROGRAM).
+
+get_filename_component(test_abs_base_1 "testdir4" ABSOLUTE CACHE)
+check("ABSOLUTE CACHE 1" "${test_abs_base_1}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/testdir4")
+list(APPEND cache_vars test_abs_base_1)
+
+get_filename_component(test_abs_base_2 "testdir5" ABSOLUTE
+ BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dummydir"
+ CACHE)
+check("ABSOLUTE CACHE 2" "${test_abs_base_2}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/dummydir/testdir5")
+list(APPEND cache_vars test_abs_base_2)
+
# Test the PROGRAM component type.
get_filename_component(test_program_name "/ arg1 arg2" PROGRAM)
check("PROGRAM with no args output" "${test_program_name}" "/")
diff --git a/Tests/RunCMake/include_directories/DirectoryBefore-stdout.txt b/Tests/RunCMake/include_directories/DirectoryBefore-stdout.txt
new file mode 100644
index 0000000..e986082
--- /dev/null
+++ b/Tests/RunCMake/include_directories/DirectoryBefore-stdout.txt
@@ -0,0 +1 @@
+-- INCLUDE_DIRECTORIES: '[^;]*/Tests/RunCMake/include_directories/BeforeDir;[^;]*/Tests/RunCMake/include_directories/AfterDir'
diff --git a/Tests/RunCMake/include_directories/DirectoryBefore.cmake b/Tests/RunCMake/include_directories/DirectoryBefore.cmake
new file mode 100644
index 0000000..be3f663
--- /dev/null
+++ b/Tests/RunCMake/include_directories/DirectoryBefore.cmake
@@ -0,0 +1,4 @@
+include_directories(AfterDir)
+include_directories(BEFORE BeforeDir)
+get_property(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+message(STATUS "INCLUDE_DIRECTORIES: '${dirs}'")
diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
index 54d5e97..57e8274 100644
--- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake
+++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
@@ -5,6 +5,7 @@ set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/NotDefa
run_cmake(NotFoundContent)
run_cmake(DebugIncludes)
+run_cmake(DirectoryBefore)
run_cmake(TID-bad-target)
run_cmake(ImportedTarget)
run_cmake(CMP0021)
diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-result.txt b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-stderr.txt b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-stderr.txt
new file mode 100644
index 0000000..9844158
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<NOTAGENEX>
+
+ Expression did not evaluate to a known generator expression
diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad.cmake b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad.cmake
new file mode 100644
index 0000000..f050cdf
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad.cmake
@@ -0,0 +1 @@
+install(DIRECTORY dir DESTINATION $<NOTAGENEX>)
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt b/Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt b/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt
new file mode 100644
index 0000000..9844158
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<NOTAGENEX>
+
+ Expression did not evaluate to a known generator expression
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake b/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake
new file mode 100644
index 0000000..0fda078
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake
@@ -0,0 +1 @@
+install(FILES empty.c DESTINATION $<NOTAGENEX>)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index a5f5bd0..043bd1f 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -6,6 +6,8 @@ run_cmake(DIRECTORY-message-lazy)
run_cmake(SkipInstallRulesWarning)
run_cmake(SkipInstallRulesNoWarning1)
run_cmake(SkipInstallRulesNoWarning2)
+run_cmake(DIRECTORY-DESTINATION-bad)
+run_cmake(FILES-DESTINATION-bad)
run_cmake(TARGETS-DESTINATION-bad)
run_cmake(CMP0062-OLD)
run_cmake(CMP0062-NEW)
diff --git a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt
new file mode 100644
index 0000000..dd5bae1
--- /dev/null
+++ b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt
@@ -0,0 +1,2 @@
+-- Target COMPILE_DEFINITIONS is 'a;b;c;d;;e'
+-- Directory COMPILE_DEFINITIONS is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake
new file mode 100644
index 0000000..f0c63bf
--- /dev/null
+++ b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake
@@ -0,0 +1,3 @@
+include(Common.cmake)
+test_target_property(COMPILE_DEFINITIONS)
+test_directory_property(COMPILE_DEFINITIONS)
diff --git a/Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt b/Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt
new file mode 100644
index 0000000..bd5a992
--- /dev/null
+++ b/Tests/RunCMake/set_property/COMPILE_FEATURES-stdout.txt
@@ -0,0 +1 @@
+-- Target COMPILE_FEATURES is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/COMPILE_FEATURES.cmake b/Tests/RunCMake/set_property/COMPILE_FEATURES.cmake
new file mode 100644
index 0000000..1ab52ef
--- /dev/null
+++ b/Tests/RunCMake/set_property/COMPILE_FEATURES.cmake
@@ -0,0 +1,2 @@
+include(Common.cmake)
+test_target_property(COMPILE_FEATURES)
diff --git a/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt b/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt
new file mode 100644
index 0000000..1a20501
--- /dev/null
+++ b/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt
@@ -0,0 +1,2 @@
+-- Target COMPILE_OPTIONS is 'a;b;c;d;;e'
+-- Directory COMPILE_OPTIONS is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake b/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake
new file mode 100644
index 0000000..75f0535
--- /dev/null
+++ b/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake
@@ -0,0 +1,3 @@
+include(Common.cmake)
+test_target_property(COMPILE_OPTIONS)
+test_directory_property(COMPILE_OPTIONS)
diff --git a/Tests/RunCMake/set_property/Common.cmake b/Tests/RunCMake/set_property/Common.cmake
new file mode 100644
index 0000000..9d5e4f4
--- /dev/null
+++ b/Tests/RunCMake/set_property/Common.cmake
@@ -0,0 +1,28 @@
+macro(test_target_property PROP)
+ add_custom_target(CustomTarget)
+ set_property(TARGET CustomTarget PROPERTY ${PROP} x)
+ set_property(TARGET CustomTarget PROPERTY ${PROP})
+ set_property(TARGET CustomTarget APPEND PROPERTY ${PROP})
+ set_property(TARGET CustomTarget PROPERTY ${PROP} a)
+ set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} "")
+ set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} b c)
+ set_property(TARGET CustomTarget APPEND PROPERTY ${PROP})
+ set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} "d;;e")
+ get_property(val TARGET CustomTarget PROPERTY ${PROP})
+ message(STATUS "Target ${PROP} is '${val}'")
+ set_property(TARGET CustomTarget PROPERTY ${PROP})
+endmacro()
+
+macro(test_directory_property PROP)
+ set_property(DIRECTORY PROPERTY ${PROP} x)
+ set_property(DIRECTORY PROPERTY ${PROP})
+ set_property(DIRECTORY APPEND PROPERTY ${PROP})
+ set_property(DIRECTORY PROPERTY ${PROP} a)
+ set_property(DIRECTORY APPEND PROPERTY ${PROP} "")
+ set_property(DIRECTORY APPEND PROPERTY ${PROP} b c)
+ set_property(DIRECTORY APPEND PROPERTY ${PROP})
+ set_property(DIRECTORY APPEND PROPERTY ${PROP} "d;;e")
+ get_property(val DIRECTORY PROPERTY ${PROP})
+ message(STATUS "Directory ${PROP} is '${val}'")
+ set_property(DIRECTORY PROPERTY ${PROP})
+endmacro()
diff --git a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt
new file mode 100644
index 0000000..c957dd5
--- /dev/null
+++ b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt
@@ -0,0 +1,2 @@
+-- Target INCLUDE_DIRECTORIES is 'a;b;c;d;;e'
+-- Directory INCLUDE_DIRECTORIES is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake
new file mode 100644
index 0000000..c9a9151
--- /dev/null
+++ b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake
@@ -0,0 +1,3 @@
+include(Common.cmake)
+test_target_property(INCLUDE_DIRECTORIES)
+test_directory_property(INCLUDE_DIRECTORIES)
diff --git a/Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt b/Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt
new file mode 100644
index 0000000..9a3988e
--- /dev/null
+++ b/Tests/RunCMake/set_property/LINK_LIBRARIES-stdout.txt
@@ -0,0 +1 @@
+-- Target LINK_LIBRARIES is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake b/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake
index 994e874..5155f59 100644
--- a/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake
+++ b/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake
@@ -1,7 +1,2 @@
-add_custom_target(CustomTarget)
-set_property(TARGET CustomTarget PROPERTY LINK_LIBRARIES)
-set_property(TARGET CustomTarget APPEND PROPERTY LINK_LIBRARIES)
-get_property(val TARGET CustomTarget PROPERTY LINK_LIBRARIES)
-if (NOT "${val}" STREQUAL "")
- message(FATAL_ERROR "LINK_LIBRARIES value is '${val}' but should be ''")
-endif()
+include(Common.cmake)
+test_target_property(LINK_LIBRARIES)
diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake
index ada8804..37c7124 100644
--- a/Tests/RunCMake/set_property/RunCMakeTest.cmake
+++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake
@@ -1,4 +1,9 @@
include(RunCMake)
+run_cmake(COMPILE_DEFINITIONS)
+run_cmake(COMPILE_FEATURES)
+run_cmake(COMPILE_OPTIONS)
+run_cmake(INCLUDE_DIRECTORIES)
run_cmake(LINK_LIBRARIES)
-run_cmake(LINK_SEARCH_STATIC)
+run_cmake(SOURCES)
+run_cmake(USER_PROP)
diff --git a/Tests/RunCMake/set_property/SOURCES-stdout.txt b/Tests/RunCMake/set_property/SOURCES-stdout.txt
new file mode 100644
index 0000000..921d5b1
--- /dev/null
+++ b/Tests/RunCMake/set_property/SOURCES-stdout.txt
@@ -0,0 +1 @@
+-- Target SOURCES is 'a;b;c;d;e'
diff --git a/Tests/RunCMake/set_property/SOURCES.cmake b/Tests/RunCMake/set_property/SOURCES.cmake
new file mode 100644
index 0000000..820641e
--- /dev/null
+++ b/Tests/RunCMake/set_property/SOURCES.cmake
@@ -0,0 +1,2 @@
+include(Common.cmake)
+test_target_property(SOURCES)
diff --git a/Tests/RunCMake/set_property/USER_PROP-stdout.txt b/Tests/RunCMake/set_property/USER_PROP-stdout.txt
new file mode 100644
index 0000000..107cc87
--- /dev/null
+++ b/Tests/RunCMake/set_property/USER_PROP-stdout.txt
@@ -0,0 +1,2 @@
+-- Target USER_PROP is 'a;b;c;d;;e'
+-- Directory USER_PROP is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/USER_PROP.cmake b/Tests/RunCMake/set_property/USER_PROP.cmake
new file mode 100644
index 0000000..aa0aa83
--- /dev/null
+++ b/Tests/RunCMake/set_property/USER_PROP.cmake
@@ -0,0 +1,3 @@
+include(Common.cmake)
+test_target_property(USER_PROP)
+test_directory_property(USER_PROP)
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt
index cc3c3be..e365076 100644
--- a/Tests/SimpleInstall/CMakeLists.txt
+++ b/Tests/SimpleInstall/CMakeLists.txt
@@ -209,9 +209,9 @@ else()
ARCHIVE DESTINATION MyTest/lib/static
OPTIONAL # for coverage...target should always exist
)
- install(FILES lib1.h DESTINATION MyTest/include/foo)
+ install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>)
install(FILES lib2.h
- DESTINATION MyTest/include/foo
+ DESTINATION $<1:MyTest/include/foo>$<0:/wrong>
COMPONENT Development
PERMISSIONS OWNER_READ OWNER_WRITE
RENAME lib2renamed.h
@@ -252,7 +252,7 @@ else()
file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
install(
- DIRECTORY TestSubDir scripts/ DESTINATION MyTest/share
+ DIRECTORY TestSubDir scripts/ DESTINATION $<1:MyTest/share>$<0:/wrong>
FILE_PERMISSIONS OWNER_READ OWNER_WRITE
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
@@ -263,14 +263,14 @@ else()
# Alternate directory installation for coverage.
install(
- DIRECTORY scripts/ DESTINATION MyTest/share/alt
+ DIRECTORY scripts/ DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
COMPONENT Development
USE_SOURCE_PERMISSIONS
PATTERN "CVS" EXCLUDE
REGEX "\\.txt$" EXCLUDE
)
install(
- DIRECTORY TestSubDir DESTINATION MyTest/share/alt
+ DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
FILE_PERMISSIONS OWNER_READ OWNER_WRITE
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt
index cc3c3be..e365076 100644
--- a/Tests/SimpleInstallS2/CMakeLists.txt
+++ b/Tests/SimpleInstallS2/CMakeLists.txt
@@ -209,9 +209,9 @@ else()
ARCHIVE DESTINATION MyTest/lib/static
OPTIONAL # for coverage...target should always exist
)
- install(FILES lib1.h DESTINATION MyTest/include/foo)
+ install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>)
install(FILES lib2.h
- DESTINATION MyTest/include/foo
+ DESTINATION $<1:MyTest/include/foo>$<0:/wrong>
COMPONENT Development
PERMISSIONS OWNER_READ OWNER_WRITE
RENAME lib2renamed.h
@@ -252,7 +252,7 @@ else()
file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
install(
- DIRECTORY TestSubDir scripts/ DESTINATION MyTest/share
+ DIRECTORY TestSubDir scripts/ DESTINATION $<1:MyTest/share>$<0:/wrong>
FILE_PERMISSIONS OWNER_READ OWNER_WRITE
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
@@ -263,14 +263,14 @@ else()
# Alternate directory installation for coverage.
install(
- DIRECTORY scripts/ DESTINATION MyTest/share/alt
+ DIRECTORY scripts/ DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
COMPONENT Development
USE_SOURCE_PERMISSIONS
PATTERN "CVS" EXCLUDE
REGEX "\\.txt$" EXCLUDE
)
install(
- DIRECTORY TestSubDir DESTINATION MyTest/share/alt
+ DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
FILE_PERMISSIONS OWNER_READ OWNER_WRITE
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift
index 9af9883..3629ac8 100644
--- a/Tests/SwiftMix/SwiftMain.swift
+++ b/Tests/SwiftMix/SwiftMain.swift
@@ -1,9 +1,11 @@
-@objc class SwiftMainClass {
+import Foundation
+
+@objc class SwiftMainClass : NSObject {
class func SwiftMain(argc:Int, argv:UnsafePointer<UnsafePointer<CChar>>) -> Int32 {
- println("argc: \(argc)")
+ dump("argc: \(argc)")
for (var i = 0; i < argc; ++i) {
- var argi = String.fromCString(argv[i])
- println("arg[\(i)]: \(argi)");
+ let argi = String.fromCString(argv[i])
+ dump("arg[\(i)]: \(argi)");
}
return 0;
}
diff --git a/Tests/SwiftOnly/main.swift b/Tests/SwiftOnly/main.swift
index 67be986..28560d0 100644
--- a/Tests/SwiftOnly/main.swift
+++ b/Tests/SwiftOnly/main.swift
@@ -1 +1 @@
-println("SwiftOnly")
+dump("SwiftOnly")
diff --git a/Tests/iOSNavApp/CMakeLists.txt b/Tests/iOSNavApp/CMakeLists.txt
index 12c3ada..1fc33e0 100644
--- a/Tests/iOSNavApp/CMakeLists.txt
+++ b/Tests/iOSNavApp/CMakeLists.txt
@@ -3,7 +3,6 @@ project(NavApp3)
set(CMAKE_OSX_SYSROOT iphoneos4.3)
set(CMAKE_OSX_ARCHITECTURES "armv6;armv7;i386")
-set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake
index 4b93e6e..4cfa2ed 100644
--- a/Utilities/Release/create-cmake-release.cmake
+++ b/Utilities/Release/create-cmake-release.cmake
@@ -54,6 +54,7 @@ mkdir \${name}-build &&
cd \${name}-build &&
\"${CMAKE_COMMAND}\" ../\${name}-src/Utilities/Sphinx \\
-DCMAKE_INSTALL_PREFIX=\"\$inst/\" \\
+ -DCMAKE_DOC_DIR=doc/cmake \\
-DSPHINX_EXECUTABLE=\"${SPHINX_EXECUTABLE}\" \\
-DSPHINX_HTML=ON -DSPHINX_MAN=ON &&
make install &&
diff --git a/Utilities/Release/dash2win64_cygwin.cmake b/Utilities/Release/dash2win64_cygwin.cmake
index d15915a..c0cd761 100644
--- a/Utilities/Release/dash2win64_cygwin.cmake
+++ b/Utilities/Release/dash2win64_cygwin.cmake
@@ -1,5 +1,6 @@
set(CMAKE_RELEASE_DIRECTORY "c:/cygwin/home/dashboard/CMakeReleaseCygwin")
set(PROCESSORS 9)
+set(BOOTSTRAP_ARGS "")
set(MAKE_PROGRAM "make")
set(MAKE "${MAKE_PROGRAM} -j8")
set(HOST dash2win64)
diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash2win64_release.cmake
index 3ea895a..25acc17 100644
--- a/Utilities/Release/dash2win64_release.cmake
+++ b/Utilities/Release/dash2win64_release.cmake
@@ -8,6 +8,7 @@ set(CPACK_SOURCE_GENERATORS "ZIP")
set(MAKE_PROGRAM "make")
set(MAKE "${MAKE_PROGRAM} -j8")
set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release
+CMAKE_DOC_DIR:STRING=doc/cmake
CMAKE_USE_OPENSSL:BOOL=OFF
CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
CMAKE_Fortran_COMPILER:FILEPATH=FALSE
diff --git a/Utilities/Release/dashmacmini2_release.cmake b/Utilities/Release/dashmacmini2_release.cmake
index 01f5b8b..cd4c5a1 100644
--- a/Utilities/Release/dashmacmini2_release.cmake
+++ b/Utilities/Release/dashmacmini2_release.cmake
@@ -1,7 +1,7 @@
set(PROCESSORS 2)
set(CMAKE_RELEASE_DIRECTORY /Users/kitware/CMakeReleaseDirectory)
set(USER_OVERRIDE "set(CMAKE_CXX_LINK_EXECUTABLE \\\"gcc <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -shared-libgcc -lstdc++-static\\\")")
-set(INSTALL_PREFIX /)
+set(BOOTSTRAP_ARGS "--prefix=/ --docdir=doc/cmake")
set(HOST dashmacmini2)
set(MAKE_PROGRAM "make")
set(MAKE "${MAKE_PROGRAM} -j2")
diff --git a/Utilities/Release/dashmacmini5_release.cmake b/Utilities/Release/dashmacmini5_release.cmake
index be1dfa9..b147013 100644
--- a/Utilities/Release/dashmacmini5_release.cmake
+++ b/Utilities/Release/dashmacmini5_release.cmake
@@ -1,7 +1,7 @@
set(PROCESSORS 4)
set(CMAKE_RELEASE_DIRECTORY /Users/kitware/CMakeReleaseDirectory)
# set(USER_OVERRIDE "set(CMAKE_CXX_LINK_EXECUTABLE \\\"gcc <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -shared-libgcc -lstdc++-static\\\")")
-set(INSTALL_PREFIX /)
+set(BOOTSTRAP_ARGS "--prefix=/ --docdir=doc/cmake")
set(HOST dashmacmini5)
set(MAKE_PROGRAM "make")
set(MAKE "${MAKE_PROGRAM} -j5")
diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake
index 25da00a..81442e7 100644
--- a/Utilities/Release/linux64_release.cmake
+++ b/Utilities/Release/linux64_release.cmake
@@ -1,4 +1,5 @@
set(PROCESSORS 4)
+set(BOOTSTRAP_ARGS "--docdir=doc/cmake")
set(HOST linux64)
set(MAKE_PROGRAM "make")
set(CC /opt/gcc-4.9.2/bin/gcc)
diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake
index b031eb8..0634dda 100644
--- a/Utilities/Release/magrathea_release.cmake
+++ b/Utilities/Release/magrathea_release.cmake
@@ -1,4 +1,5 @@
set(PROCESSORS 1)
+set(BOOTSTRAP_ARGS "--docdir=doc/cmake")
set(HOST magrathea)
set(MAKE_PROGRAM "make")
set(CC gcc332s)
diff --git a/Utilities/Release/release_cmake.sh.in b/Utilities/Release/release_cmake.sh.in
index 76fdb3a..06e720f 100755
--- a/Utilities/Release/release_cmake.sh.in
+++ b/Utilities/Release/release_cmake.sh.in
@@ -116,15 +116,9 @@ if [ ! -z "@CONFIGURE_WITH_CMAKE@" ]; then
@CMAKE_CONFIGURE_PATH@ ../@CMAKE_CREATE_VERSION@
check_exit_value $? "Configure cmake" || exit 1
else
- if [ -z "@INSTALL_PREFIX@" ]; then
- echo "Run cmake bootstrap --parallel=@PROCESSORS@"
- ../@CMAKE_CREATE_VERSION@/bootstrap --parallel=@PROCESSORS@
- check_exit_value $? "Bootstrap cmake" || exit 1
- else
- echo "Run cmake bootstrap --prefix=@INSTALL_PREFIX@ --parallel=@PROCESSORS@"
- ../@CMAKE_CREATE_VERSION@/bootstrap --prefix=@INSTALL_PREFIX@ --parallel=@PROCESSORS@
- check_exit_value $? "Bootstrap cmake" || exit 1
- fi
+ echo "Run cmake bootstrap @BOOTSTRAP_ARGS@ --parallel=@PROCESSORS@"
+ ../@CMAKE_CREATE_VERSION@/bootstrap @BOOTSTRAP_ARGS@ --parallel=@PROCESSORS@
+ check_exit_value $? "Bootstrap cmake" || exit 1
fi
echo "Build cmake with @MAKE@"
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index d12c73f..39b70c0 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -43,6 +43,14 @@ if(WIN32)
set(HAVE_INET_PTON 0 CACHE INTERNAL "Do not use inet_pton")
endif()
+# Starting with OSX 10.11 there is an unrelated libnetwork library which will
+# be picked up during curl configuration. Linking against this library is
+# unnecessary and breaks backward compatibility of the resulting binaries
+# because libnetwork is unavailable on older OSX versions.
+if(APPLE)
+ set(HAVE_LIBNETWORK 0 CACHE INTERNAL "Do not use libnetwork")
+endif(APPLE)
+
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
"^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$")
diff --git a/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp b/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp
index b64cdb0..e3f4e53 100644
--- a/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp
+++ b/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp
@@ -24,7 +24,9 @@
// Solaris
#if defined(__sun)
# include <ieeefp.h>
-# define isfinite finite
+# if !defined(isfinite)
+# define isfinite finite
+# endif
#endif
// AIX
diff --git a/bootstrap b/bootstrap
index 7b9a582..31e9b89 100755
--- a/bootstrap
+++ b/bootstrap
@@ -373,12 +373,6 @@ KWSYS_FILES="\
SystemTools.hxx \
Terminal.h"
-KWSYS_IOS_FILES="
- fstream \
- iosfwd \
- iostream \
- sstream"
-
KWIML_FILES='
ABI.h
INT.h
@@ -498,30 +492,7 @@ cmake_kwsys_config_replace_string ()
s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
- s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
- s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
- s/@KWSYS_IOS_USE_SSTREAM@/${KWSYS_IOS_USE_SSTREAM}/g;
- s/@KWSYS_IOS_USE_STRSTREAM_H@/${KWSYS_IOS_USE_STRSTREAM_H}/g;
- s/@KWSYS_IOS_USE_STRSTREA_H@/${KWSYS_IOS_USE_STRSTREA_H}/g;
- s/@KWSYS_IOS_HAVE_BINARY@/${KWSYS_IOS_HAVE_BINARY}/g;
- s/@KWSYS_STL_HAVE_STD@/${KWSYS_STL_HAVE_STD}/g;
- s/@KWSYS_STL_STRING_HAVE_ISTREAM@/${KWSYS_STL_STRING_HAVE_ISTREAM}/g;
- s/@KWSYS_STL_STRING_HAVE_OSTREAM@/${KWSYS_STL_STRING_HAVE_OSTREAM}/g;
- s/@KWSYS_STL_STRING_HAVE_NEQ_CHAR@/${KWSYS_STL_STRING_HAVE_NEQ_CHAR}/g;
- s/@KWSYS_STL_HAS_ITERATOR_TRAITS@/${KWSYS_STL_HAS_ITERATOR_TRAITS}/g;
- s/@KWSYS_STL_HAS_ITERATOR_CATEGORY@/${KWSYS_STL_HAS_ITERATOR_CATEGORY}/g;
- s/@KWSYS_STL_HAS___ITERATOR_CATEGORY@/${KWSYS_STL_HAS___ITERATOR_CATEGORY}/g;
- s/@KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}/g;
- s/@KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE}/g;
- s/@KWSYS_STL_HAS_ALLOCATOR_REBIND@/${KWSYS_STL_HAS_ALLOCATOR_REBIND}/g;
- s/@KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@/${KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT}/g;
- s/@KWSYS_STL_HAS_ALLOCATOR_OBJECTS@/${KWSYS_STL_HAS_ALLOCATOR_OBJECTS}/g;
s/@KWSYS_STL_HAS_WSTRING@/${KWSYS_STL_HAS_WSTRING}/g;
- s/@KWSYS_CXX_HAS_CSTDDEF@/${KWSYS_CXX_HAS_CSTDDEF}/g;
- s/@KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@/${KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS}/g;
- s/@KWSYS_CXX_HAS_MEMBER_TEMPLATES@/${KWSYS_CXX_HAS_MEMBER_TEMPLATES}/g;
- s/@KWSYS_CXX_HAS_FULL_SPECIALIZATION@/${KWSYS_CXX_HAS_FULL_SPECIALIZATION}/g;
- s/@KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@/${KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP}/g;
s/@KWSYS_STAT_HAS_ST_MTIM@/${KWSYS_STAT_HAS_ST_MTIM}/g;}" >> "${OUTFILE}${_tmp}"
if [ -f "${OUTFILE}${_tmp}" ]; then
if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
@@ -1202,38 +1173,13 @@ KWSYS_NAME_IS_KWSYS=0
KWSYS_BUILD_SHARED=0
KWSYS_LFS_AVAILABLE=0
KWSYS_LFS_REQUESTED=0
-KWSYS_IOS_USE_STRSTREAM_H=0
-KWSYS_IOS_USE_STRSTREA_H=0
-KWSYS_IOS_HAVE_STD=0
-KWSYS_IOS_USE_SSTREAM=0
-KWSYS_IOS_USE_ANSI=0
-KWSYS_IOS_HAVE_BINARY=0
-KWSYS_STL_HAVE_STD=0
KWSYS_STAT_HAS_ST_MTIM=0
-KWSYS_STL_STRING_HAVE_NEQ_CHAR=0
-KWSYS_STL_HAS_ITERATOR_TRAITS=0
-KWSYS_STL_HAS_ITERATOR_CATEGORY=0
-KWSYS_STL_HAS___ITERATOR_CATEGORY=0
-KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=0
-KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=0
-KWSYS_STL_HAS_ALLOCATOR_REBIND=0
-KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=0
-KWSYS_STL_HAS_ALLOCATOR_OBJECTS=0
KWSYS_STL_HAS_WSTRING=0
KWSYS_CXX_HAS_SETENV=0
KWSYS_CXX_HAS_UNSETENV=0
KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0
KWSYS_CXX_HAS_UTIMENSAT=0
KWSYS_CXX_HAS_UTIMES=0
-KWSYS_CXX_HAS_CSTDDEF=0
-KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0
-KWSYS_CXX_HAS_MEMBER_TEMPLATES=0
-KWSYS_CXX_HAS_FULL_SPECIALIZATION=0
-KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=0
-
-# Hardcode these kwsys features. They work on all known UNIX compilers anyway.
-KWSYS_STL_STRING_HAVE_ISTREAM=1
-KWSYS_STL_STRING_HAVE_OSTREAM=1
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_SETENV" \
@@ -1263,151 +1209,7 @@ else
fi
if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_STL_HAVE_STD=1
- echo "${cmake_cxx_compiler} has STL in std:: namespace"
-else
- echo "${cmake_cxx_compiler} does not have STL in std:: namespace"
-fi
-
-if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_IOS_USE_ANSI=1
- echo "${cmake_cxx_compiler} has ANSI streams"
-else
- echo "${cmake_cxx_compiler} does not have ANSI streams"
-fi
-
-if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_IOS_HAVE_STD=1
- echo "${cmake_cxx_compiler} has streams in std:: namespace"
- else
- echo "${cmake_cxx_compiler} does not have streams in std:: namespace"
- fi
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_IOS_USE_SSTREAM=1
- echo "${cmake_cxx_compiler} has sstream"
- else
- echo "${cmake_cxx_compiler} does not have sstream"
- fi
-fi
-
-if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_IOS_USE_STRSTREAM_H=1
- echo "${cmake_cxx_compiler} has strstream.h"
- else
- echo "${cmake_cxx_compiler} does not have strstream.h"
- fi
- if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_IOS_USE_STRSTREA_H=1
- echo "${cmake_cxx_compiler} has strstrea.h"
- else
- echo "${cmake_cxx_compiler} does not have strstrea.h"
- fi
- fi
-fi
-
-if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_STL_STRING_HAVE_NEQ_CHAR=1
- echo "${cmake_cxx_compiler} has operator!=(string, char*)"
-else
- echo "${cmake_cxx_compiler} does not have operator!=(string, char*)"
-fi
-
-if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_TRAITS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_STL_HAS_ITERATOR_TRAITS=1
- echo "${cmake_cxx_compiler} has stl iterator_traits"
-else
- echo "${cmake_cxx_compiler} does not have stl iterator_traits"
-fi
-
-if [ "x${KWSYS_STL_HAS_ITERATOR_TRAITS}" = "x0" ]; then
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_STL_HAS_ITERATOR_CATEGORY=1
- echo "${cmake_cxx_compiler} has old iterator_category"
- else
- echo "${cmake_cxx_compiler} does not have old iterator_category"
- fi
- if [ "x${KWSYS_STL_HAS_ITERATOR_CATEGORY}" = "x0" ]; then
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS___ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_STL_HAS___ITERATOR_CATEGORY=1
- echo "${cmake_cxx_compiler} has old __iterator_category"
- else
- echo "${cmake_cxx_compiler} does not have old __iterator_category"
- fi
- fi
-fi
-
-if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=1
- echo "${cmake_cxx_compiler} has standard template allocator"
-else
- echo "${cmake_cxx_compiler} does not have standard template allocator"
-fi
-
-if [ "x${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}" = "x1" ]; then
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_STL_HAS_ALLOCATOR_REBIND=1
- echo "${cmake_cxx_compiler} has allocator<>::rebind<>"
- else
- echo "${cmake_cxx_compiler} does not have allocator<>::rebind<>"
- fi
-
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=1
- echo "${cmake_cxx_compiler} has non-standard allocator<>::max_size argument"
- else
- echo "${cmake_cxx_compiler} does not have non-standard allocator<>::max_size argument"
- fi
-else
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=1
- echo "${cmake_cxx_compiler} has old non-template allocator"
- else
- echo "${cmake_cxx_compiler} does not have old non-template allocator"
- fi
-fi
-
-if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_STL_HAS_ALLOCATOR_OBJECTS=1
- echo "${cmake_cxx_compiler} has stl containers supporting allocator objects"
-else
- echo "${cmake_cxx_compiler} does not have stl containers supporting allocator objects"
-fi
-
-if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_WSTRING -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
+ "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_WSTRING" \
"${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STL_HAS_WSTRING=1
echo "${cmake_cxx_compiler} has stl wstring"
@@ -1416,51 +1218,6 @@ else
fi
if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_CSTDDEF" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_CXX_HAS_CSTDDEF=1
- echo "${cmake_cxx_compiler} has header cstddef"
-else
- echo "${cmake_cxx_compiler} does not have header cstddef"
-fi
-
-if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- echo "${cmake_cxx_compiler} does not require template friends to use <>"
-else
- KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=1
- echo "${cmake_cxx_compiler} requires template friends to use <>"
-fi
-
-if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_CXX_HAS_MEMBER_TEMPLATES=1
- echo "${cmake_cxx_compiler} supports member templates"
-else
- echo "${cmake_cxx_compiler} does not support member templates"
-fi
-
-if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_CXX_HAS_FULL_SPECIALIZATION=1
- echo "${cmake_cxx_compiler} has standard template specialization syntax"
-else
- echo "${cmake_cxx_compiler} does not have standard template specialization syntax"
-fi
-
-if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=1
- echo "${cmake_cxx_compiler} has argument dependent lookup"
-else
- echo "${cmake_cxx_compiler} does not have argument dependent lookup"
-fi
-
-if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \
"${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STAT_HAS_ST_MTIM=1
@@ -1469,15 +1226,6 @@ else
echo "${cmake_cxx_compiler} does not have struct stat with st_mtim member"
fi
-if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_BINARY -DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI} -DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
- KWSYS_IOS_HAVE_BINARY=1
- echo "${cmake_cxx_compiler} has ios::binary openmode"
-else
- echo "${cmake_cxx_compiler} does not have ios::binary openmode"
-fi
-
# Just to be safe, let us store compiler and flags to the header file
cmake_bootstrap_version='$Revision$'
@@ -1549,22 +1297,6 @@ for a in ${KWSYS_FILES}; do
"${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
done
-for a in ${KWSYS_IOS_FILES}; do
- cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_ios_${a}.h.in" \
- "${cmake_bootstrap_dir}/cmsys/ios/${a}" KWSYS_NAMESPACE cmsys
-done
-
-cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_stl.hxx.in" \
- "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" KWSYS_STL_HEADER_EXTRA ""
-
-cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" \
- "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" KWSYS_NAMESPACE cmsys
-
-for a in string vector set map algorithm; do
- cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" \
- "${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
-done
-
for a in ${KWIML_FILES}; do
cmake_replace_string "${cmake_source_dir}/Utilities/KWIML/${a}.in" \
"${cmake_bootstrap_dir}/cmIML/${a}" KWIML cmIML