summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auxiliary/bash-completion/cmake9
-rw-r--r--Auxiliary/bash-completion/cpack20
-rw-r--r--Auxiliary/bash-completion/ctest26
-rw-r--r--CTestCustom.cmake.in4
-rw-r--r--Help/command/ctest_update.rst4
-rw-r--r--Help/command/file.rst5
-rw-r--r--Help/command/try_compile.rst4
-rw-r--r--Help/manual/cmake-variables.7.rst5
-rw-r--r--Help/manual/ctest.1.rst5
-rw-r--r--Help/prop_dir/VS_STARTUP_PROJECT.rst8
-rw-r--r--Help/prop_tgt/CXX_EXTENSIONS.rst3
-rw-r--r--Help/prop_tgt/CXX_STANDARD.rst2
-rw-r--r--Help/prop_tgt/C_EXTENSIONS.rst3
-rw-r--r--Help/prop_tgt/C_STANDARD.rst2
-rw-r--r--Help/prop_tgt/FRAMEWORK.rst4
-rw-r--r--Help/prop_tgt/SOVERSION.rst25
-rw-r--r--Help/prop_tgt/VERSION.rst27
-rw-r--r--Help/release/3.6.rst310
-rw-r--r--Help/release/dev/0-sample-topic.rst7
-rw-r--r--Help/release/dev/CMakePushCheckState-CMAKE_EXTRA_INCLUDE_FILES.rst5
-rw-r--r--Help/release/dev/ExternalProject-git-clone-shallow.rst5
-rw-r--r--Help/release/dev/ExternalProject-git-recursive-init.rst7
-rw-r--r--Help/release/dev/FindGTest-depends.rst6
-rw-r--r--Help/release/dev/FindPkgConfig-targets.rst5
-rw-r--r--Help/release/dev/FindProtobuf-variable-case.rst7
-rw-r--r--Help/release/dev/FindProtobuf-version.rst6
-rw-r--r--Help/release/dev/InstallRequiredSystemLibraries-Windows-UCRT.rst6
-rw-r--r--Help/release/dev/add-FindLTTngUST.rst5
-rw-r--r--Help/release/dev/add-bruce-c.rst4
-rw-r--r--Help/release/dev/automoc-diagnostics.rst6
-rw-r--r--Help/release/dev/clang-tidy.rst7
-rw-r--r--Help/release/dev/cmake-depend-in-project-only.rst6
-rw-r--r--Help/release/dev/cmake-host-solaris.rst5
-rw-r--r--Help/release/dev/cpack-deb-autodep-ORIGIN-RPATH.rst6
-rw-r--r--Help/release/dev/cpack-deb-imporvements.rst27
-rw-r--r--Help/release/dev/cpack-rpm-adding-dist-to-release-tag.rst7
-rw-r--r--Help/release/dev/cpack-rpm-default-user-and-group.rst9
-rw-r--r--Help/release/dev/cpack-rpm-different-package-names.rst9
-rw-r--r--Help/release/dev/cpack-rpm-external-symlink-handling.rst5
-rw-r--r--Help/release/dev/cpack-rpm-upper-cased-components.rst15
-rw-r--r--Help/release/dev/ctest-run-submodule-sync.rst9
-rw-r--r--Help/release/dev/custom-command-CROSSCOMPILING_EMULATOR.rst6
-rw-r--r--Help/release/dev/cygwin-clang.rst4
-rw-r--r--Help/release/dev/deprecate-CMakeForceCompiler.rst5
-rw-r--r--Help/release/dev/enable-ssl-automatically.rst8
-rw-r--r--Help/release/dev/ep-tls-verify-git.rst5
-rw-r--r--Help/release/dev/error-multiple-targets.rst6
-rw-r--r--Help/release/dev/external-project-no-extract.rst6
-rw-r--r--Help/release/dev/find-blas-lapack-OpenBLAS.rst5
-rw-r--r--Help/release/dev/find-command-prefix-from-PATH-windows-only.rst12
-rw-r--r--Help/release/dev/fix-bison-flex-command-escaping.rst12
-rw-r--r--Help/release/dev/install-EXCLUDE_FROM_ALL.rst5
-rw-r--r--Help/release/dev/intel-compiler-features.rst6
-rw-r--r--Help/release/dev/list-FILTER-command.rst5
-rw-r--r--Help/release/dev/ninja-depfile-system-headers.rst5
-rw-r--r--Help/release/dev/ninja-directory-targets.rst7
-rw-r--r--Help/release/dev/remove-vs6-generator.rst4
-rw-r--r--Help/release/dev/remove-vs7.0-generator.rst5
-rw-r--r--Help/release/dev/timeout_after_match.rst6
-rw-r--r--Help/release/dev/try_compile-config-flags.rst7
-rw-r--r--Help/release/dev/try_compile-target-type.rst8
-rw-r--r--Help/release/dev/unix-timestamps.rst6
-rw-r--r--Help/release/dev/update-osx-release.rst5
-rw-r--r--Help/release/dev/vs-clang-cl.rst5
-rw-r--r--Help/release/dev/vs-remote-directory.rst7
-rw-r--r--Help/release/dev/vs-startup-project.rst6
-rw-r--r--Help/release/dev/vs-vcxproj-ConfigurationType.rst6
-rw-r--r--Help/release/dev/vs71-deprecate.rst5
-rw-r--r--Help/release/index.rst3
-rw-r--r--Help/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES.rst14
-rw-r--r--Help/variable/CMAKE_LANG_STANDARD_LIBRARIES.rst12
-rw-r--r--Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst27
-rw-r--r--Help/variable/CMAKE_STANDARD_LIBRARIES.rst7
-rw-r--r--Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst26
-rw-r--r--Modules/CPackDMG.cmake7
-rw-r--r--Modules/CPackDeb.cmake175
-rw-r--r--Modules/CPackIFW.cmake132
-rw-r--r--Modules/CPackRPM.cmake207
-rw-r--r--Modules/Compiler/GHS-C.cmake1
-rw-r--r--Modules/Compiler/GHS-CXX.cmake1
-rw-r--r--Modules/Compiler/TI-C.cmake2
-rw-r--r--Modules/ExternalProject-download.cmake.in161
-rw-r--r--Modules/ExternalProject-verify.cmake.in48
-rw-r--r--Modules/ExternalProject.cmake160
-rw-r--r--Modules/FindCUDA.cmake22
-rw-r--r--Modules/FindHDF5.cmake40
-rw-r--r--Modules/FindLibArchive.cmake9
-rw-r--r--Modules/FindMatlab.cmake1
-rw-r--r--Modules/FindPkgConfig.cmake8
-rw-r--r--Modules/FindQt4.cmake2
-rw-r--r--Modules/GetPrerequisites.cmake9
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake4
-rw-r--r--Modules/Platform/AIX.cmake4
-rw-r--r--Modules/Platform/Darwin-Initialize.cmake10
-rw-r--r--Modules/Platform/HP-UX.cmake4
-rw-r--r--Modules/Platform/SunOS-PathScale-C.cmake2
-rw-r--r--Modules/Platform/SunOS-PathScale-CXX.cmake2
-rw-r--r--Modules/Platform/SunOS-PathScale-Fortran.cmake2
-rw-r--r--Modules/Platform/SunOS-PathScale.cmake31
-rw-r--r--Modules/Platform/Windows-MSVC.cmake2
-rw-r--r--Modules/UseJava.cmake2
-rw-r--r--Packaging/CMakeDMGSetup.scpt19
-rw-r--r--README.rst2
-rw-r--r--Source/.gitattributes3
-rw-r--r--Source/CMakeLists.txt1
-rw-r--r--Source/CMakeVersion.cmake6
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx62
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h9
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx78
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h13
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx17
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.h3
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx341
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.h105
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx12
-rw-r--r--Source/CPack/cmCPackDebGenerator.h3
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx24
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx10
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx8
-rw-r--r--Source/CPack/cmCPackRPMGenerator.h3
-rw-r--r--Source/CPack/cpack.cxx6
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx2
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx9
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h2
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx2
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx22
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx2
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h2
-rw-r--r--Source/CTest/cmCTestRunTest.cxx4
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx9
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx7
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx4
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx2
-rw-r--r--Source/CTest/cmCTestUploadCommand.cxx7
-rw-r--r--Source/CTest/cmParseBlanketJSCoverage.cxx6
-rw-r--r--Source/CTest/cmParseBlanketJSCoverage.h2
-rw-r--r--Source/CTest/cmParseDelphiCoverage.cxx6
-rw-r--r--Source/CTest/cmParseDelphiCoverage.h2
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx2
-rw-r--r--Source/CTest/cmParseJacocoCoverage.cxx8
-rw-r--r--Source/CTest/cmParseJacocoCoverage.h2
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx2
-rw-r--r--Source/QtDialog/CMakeSetup.cxx34
-rw-r--r--Source/cmAlgorithms.h15
-rw-r--r--Source/cmBuildNameCommand.cxx12
-rw-r--r--Source/cmCTest.cxx16
-rw-r--r--Source/cmCTest.h12
-rw-r--r--Source/cmCommonTargetGenerator.cxx18
-rw-r--r--Source/cmCommonTargetGenerator.h4
-rw-r--r--Source/cmCoreTryCompile.cxx151
-rw-r--r--Source/cmCreateTestSourceList.cxx6
-rw-r--r--Source/cmDependsC.cxx10
-rw-r--r--Source/cmDependsFortran.cxx42
-rw-r--r--Source/cmExportFileGenerator.cxx8
-rw-r--r--Source/cmExternalMakefileProjectGenerator.cxx5
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx18
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx8
-rw-r--r--Source/cmFileCommand.cxx1
-rw-r--r--Source/cmGeneratorExpression.cxx4
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx4
-rw-r--r--Source/cmGeneratorTarget.cxx14
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx26
-rw-r--r--Source/cmGlobalGenerator.cxx24
-rw-r--r--Source/cmGlobalGenerator.h4
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx4
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx113
-rw-r--r--Source/cmGlobalNinjaGenerator.h11
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx28
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
-rw-r--r--Source/cmInstallExportGenerator.cxx4
-rw-r--r--Source/cmInstallFilesGenerator.cxx2
-rw-r--r--Source/cmInstallFilesGenerator.h2
-rw-r--r--Source/cmListFileLexer.c2020
-rw-r--r--Source/cmListFileLexer.in.l273
-rw-r--r--Source/cmLocalGenerator.cxx19
-rw-r--r--Source/cmLocalGenerator.h12
-rw-r--r--Source/cmLocalNinjaGenerator.cxx41
-rw-r--r--Source/cmLocalNinjaGenerator.h12
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx127
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h12
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx41
-rw-r--r--Source/cmMakefile.cxx4
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx60
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx91
-rw-r--r--Source/cmMakefileTargetGenerator.cxx138
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx4
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx25
-rw-r--r--Source/cmNinjaTargetGenerator.cxx36
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx6
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx2
-rw-r--r--Source/cmQtAutoGenerators.cxx2
-rw-r--r--Source/cmSearchPath.h2
-rw-r--r--Source/cmSeparateArgumentsCommand.cxx2
-rw-r--r--Source/cmSourceFileLocation.h2
-rw-r--r--Source/cmSourceGroup.cxx2
-rw-r--r--Source/cmSourceGroup.h2
-rw-r--r--Source/cmState.cxx12
-rw-r--r--Source/cmState.h4
-rw-r--r--Source/cmSystemTools.cxx48
-rw-r--r--Source/cmTarget.cxx12
-rw-r--r--Source/cmVS14CLFlagTable.h1
-rw-r--r--Source/cmVariableWatch.cxx6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx6
-rw-r--r--Source/cmVisualStudioWCEPlatformParser.cxx4
-rw-r--r--Source/cmake.cxx4
-rw-r--r--Source/cmcmd.cxx5
-rw-r--r--Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in2
-rw-r--r--Tests/CMakeLib/testGeneratedFileStream.cxx16
-rw-r--r--Tests/CMakeLib/testRST.cxx2
-rw-r--r--Tests/CMakeLists.txt3
-rw-r--r--Tests/CPackComponentsDEB/CMakeLists.txt2
-rw-r--r--Tests/CPackComponentsDEB/MyLibCPackConfig-components-depend1.cmake.in1
-rw-r--r--Tests/CPackComponentsDEB/MyLibCPackConfig-components-depend2.cmake.in1
-rw-r--r--Tests/CPackComponentsForAll/CMakeLists.txt3
-rw-r--r--Tests/ExternalProjectUpdate/CMakeLists.txt12
-rw-r--r--Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt7
-rw-r--r--Tests/GhsMultiDuplicateSourceFilenames/main.c4
-rw-r--r--Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c5
-rw-r--r--Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c5
-rw-r--r--Tests/IncludeDirectories/CMakeLists.txt1
-rw-r--r--Tests/IncludeDirectories/StandardIncludeDirectories/CMakeLists.txt5
-rw-r--r--Tests/IncludeDirectories/StandardIncludeDirectories/StdDir/StdIncDir.h0
-rw-r--r--Tests/IncludeDirectories/StandardIncludeDirectories/main.c5
-rw-r--r--Tests/RunCMake/CPack/CUSTOM_NAMES.cmake (renamed from Tests/RunCMake/CPack/RPM_CUSTOM_NAMES.cmake)4
-rw-r--r--Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake1
-rw-r--r--Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-ExpectedFiles.cmake9
-rw-r--r--Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-specifics.cmake6
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake13
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake3
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake7
-rw-r--r--Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake10
-rw-r--r--Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake2
-rw-r--r--Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake1
-rw-r--r--Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake1
-rw-r--r--Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake1
-rw-r--r--Tests/RunCMake/CPack/DEB_EXTRA.cmake1
-rw-r--r--Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake1
-rw-r--r--Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake1
-rw-r--r--Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-ExpectedFiles.cmake (renamed from Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-ExpectedFiles.cmake)0
-rw-r--r--Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-specifics.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-stderr.txt3
-rw-r--r--Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-stderr.txt3
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt10
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake3
-rw-r--r--Tests/RunCMake/Ninja/CheckNoPrefixSubDir.cmake7
-rw-r--r--Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake8
-rw-r--r--Tests/RunCMake/Ninja/CheckOutput.cmake23
-rw-r--r--Tests/RunCMake/Ninja/CustomCommandWorkingDirectory.cmake13
-rw-r--r--Tests/RunCMake/Ninja/Executable.cmake5
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake165
-rw-r--r--Tests/RunCMake/Ninja/SharedLib.cmake8
-rw-r--r--Tests/RunCMake/Ninja/StaticLib.cmake9
-rw-r--r--Tests/RunCMake/Ninja/SubDirPrefix.cmake8
-rw-r--r--Tests/RunCMake/Ninja/SubDirPrefix/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/Ninja/SubDirPrefix/greeting.c9
-rw-r--r--Tests/RunCMake/Ninja/SubDirPrefix/greeting.h4
-rw-r--r--Tests/RunCMake/Ninja/TwoLibs.cmake17
-rw-r--r--Tests/RunCMake/Ninja/greeting.c9
-rw-r--r--Tests/RunCMake/Ninja/greeting.h4
-rw-r--r--Tests/RunCMake/Ninja/greeting2.c6
-rw-r--r--Tests/RunCMake/Ninja/greeting2.h1
-rw-r--r--Tests/RunCMake/Ninja/hello.c7
-rw-r--r--Tests/RunCMake/Ninja/hello_sub_greeting.c7
-rw-r--r--Tests/RunCMake/Ninja/hello_with_greeting.c7
-rw-r--r--Tests/RunCMake/Ninja/hello_with_two_greetings.c9
-rw-r--r--Tests/RunCMake/file/GLOB.cmake3
-rw-r--r--Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake3
-rw-r--r--Tests/RunCMake/file/GLOB_RECURSE.cmake3
-rw-r--r--Tests/RunCMake/try_compile/CompileFlags.cmake17
-rw-r--r--Tests/RunCMake/try_compile/PlatformVariables.cmake23
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/try_compile/src.c3
-rw-r--r--Tests/VSResourceNinjaForceRSP/CMakeLists.txt7
-rw-r--r--Tests/VSResourceNinjaForceRSP/lib.cpp4
-rw-r--r--Tests/VSResourceNinjaForceRSP/main.cpp6
-rw-r--r--Tests/VSResourceNinjaForceRSP/test.rc4
-rw-r--r--Utilities/Release/upload_release.cmake2
-rw-r--r--Utilities/cmexpat/lib/expat.h3
-rw-r--r--Utilities/cmexpat/lib/expat_external.h14
-rw-r--r--Utilities/cmexpat/lib/internal.h22
-rw-r--r--Utilities/cmexpat/lib/xmlparse.c46
-rw-r--r--Utilities/cmexpat/lib/xmlrole.c220
-rw-r--r--Utilities/cmexpat/lib/xmltok.c191
-rw-r--r--Utilities/cmexpat/lib/xmltok.h10
-rw-r--r--Utilities/cmexpat/lib/xmltok_impl.c222
-rw-r--r--Utilities/cmlibarchive/CMakeLists.txt1
-rw-r--r--Utilities/cmlibarchive/build/version2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive.h4
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_entry.h2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_entry_xattr.c9
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_ppmd7.c5
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c3
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c5
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c4
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c18
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c13
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c14
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_filter.31
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c22
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c18
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_options.32
-rw-r--r--Utilities/cmlibarchive/libarchive/libarchive-formats.51
-rw-r--r--Utilities/cmlibarchive/libarchive/libarchive_changes.32
-rw-r--r--Utilities/cmliblzma/liblzma/simple/x86.c2
310 files changed, 4856 insertions, 3008 deletions
diff --git a/Auxiliary/bash-completion/cmake b/Auxiliary/bash-completion/cmake
index 557f243..6061129 100644
--- a/Auxiliary/bash-completion/cmake
+++ b/Auxiliary/bash-completion/cmake
@@ -121,14 +121,19 @@ _cmake()
grep -v "^cmake version " )' -- "$cur" ) )
return
;;
+ --help-manual)
+ COMPREPLY=( $( compgen -W '$( cmake --help-manual-list 2>/dev/null|
+ grep -v "^cmake version " | sed -e "s/([0-9])$//" )' -- "$cur" ) )
+ return
+ ;;
--help-module)
COMPREPLY=( $( compgen -W '$( cmake --help-module-list 2>/dev/null|
grep -v "^cmake version " )' -- "$cur" ) )
return
;;
--help-policy)
- COMPREPLY=( $( compgen -W '$( cmake --help-policies 2>/dev/null |
- grep "^ CMP" 2>/dev/null )' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( cmake --help-policy-list 2>/dev/null |
+ grep -v "^cmake version " )' -- "$cur" ) )
return
;;
--help-property)
diff --git a/Auxiliary/bash-completion/cpack b/Auxiliary/bash-completion/cpack
index 05e0e93..cf5751f 100644
--- a/Auxiliary/bash-completion/cpack
+++ b/Auxiliary/bash-completion/cpack
@@ -48,6 +48,26 @@ _cpack()
grep -v "^cpack version " )' -- "$cur" ) )
return
;;
+ --help-manual)
+ COMPREPLY=( $( compgen -W '$( cpack --help-manual-list 2>/dev/null|
+ grep -v "^cpack version " | sed -e "s/([0-9])$//" )' -- "$cur" ) )
+ return
+ ;;
+ --help-module)
+ COMPREPLY=( $( compgen -W '$( cpack --help-module-list 2>/dev/null|
+ grep -v "^cpack version " )' -- "$cur" ) )
+ return
+ ;;
+ --help-policy)
+ COMPREPLY=( $( compgen -W '$( cpack --help-policy-list 2>/dev/null |
+ grep -v "^cpack version " )' -- "$cur" ) )
+ return
+ ;;
+ --help-property)
+ COMPREPLY=( $( compgen -W '$( cpack --help-property-list \
+ 2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) )
+ return
+ ;;
--help-variable)
COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) )
diff --git a/Auxiliary/bash-completion/ctest b/Auxiliary/bash-completion/ctest
index 387672a..49343bb 100644
--- a/Auxiliary/bash-completion/ctest
+++ b/Auxiliary/bash-completion/ctest
@@ -72,11 +72,37 @@ _ctest()
COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) )
return
;;
+
--help-command)
COMPREPLY=( $( compgen -W '$( ctest --help-command-list 2>/dev/null|
grep -v "^ctest version " )' -- "$cur" ) )
return
;;
+ --help-manual)
+ COMPREPLY=( $( compgen -W '$( ctest --help-manual-list 2>/dev/null|
+ grep -v "^ctest version " | sed -e "s/([0-9])$//" )' -- "$cur" ) )
+ return
+ ;;
+ --help-module)
+ COMPREPLY=( $( compgen -W '$( ctest --help-module-list 2>/dev/null|
+ grep -v "^ctest version " )' -- "$cur" ) )
+ return
+ ;;
+ --help-policy)
+ COMPREPLY=( $( compgen -W '$( ctest --help-policy-list 2>/dev/null |
+ grep -v "^ctest version " )' -- "$cur" ) )
+ return
+ ;;
+ --help-property)
+ COMPREPLY=( $( compgen -W '$( ctest --help-property-list \
+ 2>/dev/null | grep -v "^ctest version " )' -- "$cur" ) )
+ return
+ ;;
+ --help-variable)
+ COMPREPLY=( $( compgen -W '$( ctest --help-variable-list \
+ 2>/dev/null | grep -v "^ctest version " )' -- "$cur" ) )
+ return
+ ;;
esac
if [[ "$cur" == -* ]]; then
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index abef692..a39049b 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -53,7 +53,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"[Qq]t([Cc]ore|[Gg]ui|[Ww]idgets).*warning.*conversion.*may alter its value"
"warning:.*is.*very unsafe.*consider using.*"
"warning:.*is.*misused, please use.*"
- "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element"
+ "cmake.version.manifest.*manifest authoring warning.*Unrecognized Element"
"cc-3968 CC: WARNING File.*" # "implicit" truncation by static_cast
"ld: warning: directory not found for option .-(F|L)"
"ld: warning .*/libgcc.a archive's cputype"
@@ -62,6 +62,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"warning.*This version of Mac OS X is unsupported"
"clang.*: warning: argument unused during compilation: .-g"
"note: in expansion of macro" # diagnostic context note
+ "cm(StringCommand|CTestTestHandler)\\.cxx.*warning.*rand.*may return deterministic values"
"cm(StringCommand|CTestTestHandler)\\.cxx.*warning.*rand.*isn.*t random" # we do not do crypto
"cm(StringCommand|CTestTestHandler)\\.cxx.*warning.*srand.*seed choices are.*poor" # we do not do crypto
@@ -80,6 +81,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"index.c.*warning: Access to field.*results in a dereference of a null pointer.*loaded from variable.*"
"cm_sha2.*warning: Value stored to.*is never read"
"testProcess.*warning: Dereference of null pointer .loaded from variable .invalidAddress.."
+ "liblzma/simple/x86.c:[0-9]+:[0-9]+: warning: The result of the '<<' expression is undefined"
)
if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode")
diff --git a/Help/command/ctest_update.rst b/Help/command/ctest_update.rst
index 74af1f7..b205bca 100644
--- a/Help/command/ctest_update.rst
+++ b/Help/command/ctest_update.rst
@@ -25,3 +25,7 @@ The options are:
have otherwise printed to the console. CTest will still report
the new revision of the repository and any conflicting files
that were found.
+
+The update always follows the version control branch currently checked
+out in the source directory. See the :ref:`CTest Update Step`
+documentation for more information.
diff --git a/Help/command/file.rst b/Help/command/file.rst
index 96ac6c7..256d16d 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -103,8 +103,9 @@ Generate a list of files that match the ``<globbing-expressions>`` and
store it into the ``<variable>``. Globbing expressions are similar to
regular expressions, but much simpler. If ``RELATIVE`` flag is
specified, the results will be returned as relative paths to the given
-path. No specific order of results is defined. If order is important then
-sort the list explicitly (e.g. using the :command:`list(SORT)` command).
+path. No specific order of results is defined other than that it is
+deterministic. If order is important then sort the list explicitly
+(e.g. using the :command:`list(SORT)` command).
By default ``GLOB`` lists directories - directories are omited in result if
``LIST_DIRECTORIES`` is set to false.
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 78b1bc7..7830deb 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -115,3 +115,7 @@ a build configuration.
Set the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable to specify
the type of target used for the source file signature.
+
+Set the :variable:`CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` variable to specify
+variables that must be propagated into the test project. This variable is
+meant for use only in toolchain files.
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 181fbbc..85b8eae 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -68,7 +68,6 @@ Variables that Provide Information
/variable/CMAKE_SKIP_INSTALL_RULES
/variable/CMAKE_SKIP_RPATH
/variable/CMAKE_SOURCE_DIR
- /variable/CMAKE_STANDARD_LIBRARIES
/variable/CMAKE_STATIC_LIBRARY_PREFIX
/variable/CMAKE_STATIC_LIBRARY_SUFFIX
/variable/CMAKE_TOOLCHAIN_FILE
@@ -281,6 +280,7 @@ Variables that Control the Build
/variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG
/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG
/variable/CMAKE_MODULE_LINKER_FLAGS
+ /variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX
/variable/CMAKE_NO_BUILTIN_CHRPATH
/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED
/variable/CMAKE_OSX_ARCHITECTURES
@@ -298,6 +298,7 @@ Variables that Control the Build
/variable/CMAKE_STATIC_LINKER_FLAGS_CONFIG
/variable/CMAKE_STATIC_LINKER_FLAGS
/variable/CMAKE_TRY_COMPILE_CONFIGURATION
+ /variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
/variable/CMAKE_TRY_COMPILE_TARGET_TYPE
/variable/CMAKE_USE_RELATIVE_PATHS
/variable/CMAKE_VISIBILITY_INLINES_HIDDEN
@@ -365,6 +366,8 @@ Variables for Languages
/variable/CMAKE_LANG_SIMULATE_VERSION
/variable/CMAKE_LANG_SIZEOF_DATA_PTR
/variable/CMAKE_LANG_SOURCE_FILE_EXTENSIONS
+ /variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES
+ /variable/CMAKE_LANG_STANDARD_LIBRARIES
/variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG
Variables for CTest
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index 1179f56..e797333 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -589,6 +589,11 @@ Configuration settings to specify the version control tool include:
* `CTest Script`_ variable: :variable:`CTEST_GIT_COMMAND`
* :module:`CTest` module variable: ``GITCOMMAND``
+ The source tree is updated by ``git fetch`` followed by
+ ``git reset --hard`` to the ``FETCH_HEAD``. The result is the same
+ as ``git pull`` except that any local moficiations are overwritten.
+ Use ``GITUpdateCustom`` to specify a different approach.
+
``GITInitSubmodules``
If set, CTest will update the repository's submodules before updating.
diff --git a/Help/prop_dir/VS_STARTUP_PROJECT.rst b/Help/prop_dir/VS_STARTUP_PROJECT.rst
index edd4832..04441b6 100644
--- a/Help/prop_dir/VS_STARTUP_PROJECT.rst
+++ b/Help/prop_dir/VS_STARTUP_PROJECT.rst
@@ -3,10 +3,16 @@ VS_STARTUP_PROJECT
Specify the default startup project in a Visual Studio solution.
+The :ref:`Visual Studio Generators` create a ``.sln`` file for each directory
+whose ``CMakeLists.txt`` file calls the :command:`project` command. Set this
+property in the same directory as a :command:`project` command call (e.g. in
+the top-level ``CMakeLists.txt`` file) to specify the default startup project
+for the correpsonding solution file.
+
The property must be set to the name of an existing target. This
will cause that project to be listed first in the generated solution
file causing Visual Studio to make it the startup project if the
solution has never been opened before.
-If this property is not specified, then the "ALL_BUILD" project
+If this property is not specified, then the ``ALL_BUILD`` project
will be the default.
diff --git a/Help/prop_tgt/CXX_EXTENSIONS.rst b/Help/prop_tgt/CXX_EXTENSIONS.rst
index 0f547e2..280bb3a 100644
--- a/Help/prop_tgt/CXX_EXTENSIONS.rst
+++ b/Help/prop_tgt/CXX_EXTENSIONS.rst
@@ -6,7 +6,8 @@ Boolean specifying whether compiler specific extensions are requested.
This property specifies whether compiler specific extensions should be
used. For some compilers, this results in adding a flag such
as ``-std=gnu++11`` instead of ``-std=c++11`` to the compile line. This
-property is ``ON`` by default.
+property is ``ON`` by default. The basic C++ standard level is
+controlled by the :prop_tgt:`CXX_STANDARD` target property.
See the :manual:`cmake-compile-features(7)` manual for information on
compile features and a list of supported compilers.
diff --git a/Help/prop_tgt/CXX_STANDARD.rst b/Help/prop_tgt/CXX_STANDARD.rst
index edc9ba5..5b186c1 100644
--- a/Help/prop_tgt/CXX_STANDARD.rst
+++ b/Help/prop_tgt/CXX_STANDARD.rst
@@ -22,6 +22,8 @@ with a compiler which does not support ``-std=gnu++11`` or an equivalent
flag will not result in an error or warning, but will instead add the
``-std=gnu++98`` flag if supported. This "decay" behavior may be controlled
with the :prop_tgt:`CXX_STANDARD_REQUIRED` target property.
+Additionally, the :prop_tgt:`CXX_EXTENSIONS` target property may be used to
+control whether compiler-specific extensions are enabled on a per-target basis.
See the :manual:`cmake-compile-features(7)` manual for information on
compile features and a list of supported compilers.
diff --git a/Help/prop_tgt/C_EXTENSIONS.rst b/Help/prop_tgt/C_EXTENSIONS.rst
index fce67f4..05b14ce 100644
--- a/Help/prop_tgt/C_EXTENSIONS.rst
+++ b/Help/prop_tgt/C_EXTENSIONS.rst
@@ -6,7 +6,8 @@ Boolean specifying whether compiler specific extensions are requested.
This property specifies whether compiler specific extensions should be
used. For some compilers, this results in adding a flag such
as ``-std=gnu11`` instead of ``-std=c11`` to the compile line. This
-property is ``ON`` by default.
+property is ``ON`` by default. The basic C standard level is
+controlled by the :prop_tgt:`C_STANDARD` target property.
See the :manual:`cmake-compile-features(7)` manual for information on
compile features and a list of supported compilers.
diff --git a/Help/prop_tgt/C_STANDARD.rst b/Help/prop_tgt/C_STANDARD.rst
index 5e36821..815a686 100644
--- a/Help/prop_tgt/C_STANDARD.rst
+++ b/Help/prop_tgt/C_STANDARD.rst
@@ -22,6 +22,8 @@ with a compiler which does not support ``-std=gnu11`` or an equivalent
flag will not result in an error or warning, but will instead add the
``-std=gnu99`` or ``-std=gnu90`` flag if supported. This "decay" behavior may
be controlled with the :prop_tgt:`C_STANDARD_REQUIRED` target property.
+Additionally, the :prop_tgt:`C_EXTENSIONS` target property may be used to
+control whether compiler-specific extensions are enabled on a per-target basis.
See the :manual:`cmake-compile-features(7)` manual for information on
compile features and a list of supported compilers.
diff --git a/Help/prop_tgt/FRAMEWORK.rst b/Help/prop_tgt/FRAMEWORK.rst
index 6c212c3..8120c36 100644
--- a/Help/prop_tgt/FRAMEWORK.rst
+++ b/Help/prop_tgt/FRAMEWORK.rst
@@ -26,6 +26,10 @@ Example of creation ``dynamicFramework``:
FRAMEWORK_VERSION C
MACOSX_FRAMEWORK_IDENTIFIER com.cmake.dynamicFramework
MACOSX_FRAMEWORK_INFO_PLIST Info.plist
+ # "current version" in semantic format in Mach-O binary file
+ VERSION 16.4.0
+ # "compatibility version" in semantic format in Mach-O binary file
+ SOVERSION 1.0.0
PUBLIC_HEADER dynamicFramework.h
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
)
diff --git a/Help/prop_tgt/SOVERSION.rst b/Help/prop_tgt/SOVERSION.rst
index 672ff23..82b6b97 100644
--- a/Help/prop_tgt/SOVERSION.rst
+++ b/Help/prop_tgt/SOVERSION.rst
@@ -3,12 +3,25 @@ SOVERSION
What version number is this target.
-For shared libraries VERSION and SOVERSION can be used to specify the
-build version and API version respectively. When building or
+For shared libraries :prop_tgt:`VERSION` and ``SOVERSION`` can be used to
+specify the build version and API version respectively. When building or
installing appropriate symlinks are created if the platform supports
symlinks and the linker supports so-names. If only one of both is
specified the missing is assumed to have the same version number.
-SOVERSION is ignored if NO_SONAME property is set. For shared
-libraries and executables on Windows the VERSION attribute is parsed
-to extract a "major.minor" version number. These numbers are used as
-the image version of the binary.
+``SOVERSION`` is ignored if :prop_tgt:`NO_SONAME` property is set.
+
+Windows Versions
+^^^^^^^^^^^^^^^^
+
+For shared libraries and executables on Windows the :prop_tgt:`VERSION`
+attribute is parsed to extract a ``<major>.<minor>`` version number.
+These numbers are used as the image version of the binary.
+
+Mach-O Versions
+^^^^^^^^^^^^^^^
+
+For shared libraries and executables on Mach-O systems (e.g. OS X, iOS),
+the ``SOVERSION`` property corresponds to *compatibility version* and
+:prop_tgt:`VERSION` to *current version*. See the :prop_tgt:`FRAMEWORK` target
+property for an example. Versions of Mach-O binaries may be checked with the
+``otool -L <binary>`` command.
diff --git a/Help/prop_tgt/VERSION.rst b/Help/prop_tgt/VERSION.rst
index 87f6c49..66e7bde 100644
--- a/Help/prop_tgt/VERSION.rst
+++ b/Help/prop_tgt/VERSION.rst
@@ -3,14 +3,27 @@ VERSION
What version number is this target.
-For shared libraries VERSION and SOVERSION can be used to specify the
-build version and API version respectively. When building or
+For shared libraries ``VERSION`` and :prop_tgt:`SOVERSION` can be used
+to specify the build version and API version respectively. When building or
installing appropriate symlinks are created if the platform supports
symlinks and the linker supports so-names. If only one of both is
specified the missing is assumed to have the same version number. For
-executables VERSION can be used to specify the build version. When
+executables ``VERSION`` can be used to specify the build version. When
building or installing appropriate symlinks are created if the
-platform supports symlinks. For shared libraries and executables on
-Windows the VERSION attribute is parsed to extract a "major.minor"
-version number. These numbers are used as the image version of the
-binary.
+platform supports symlinks.
+
+Windows Versions
+^^^^^^^^^^^^^^^^
+
+For shared libraries and executables on Windows the ``VERSION``
+attribute is parsed to extract a ``<major>.<minor>`` version number.
+These numbers are used as the image version of the binary.
+
+Mach-O Versions
+^^^^^^^^^^^^^^^
+
+For shared libraries and executables on Mach-O systems (e.g. OS X, iOS),
+the :prop_tgt:`SOVERSION` property correspond to *compatibility version* and
+``VERSION`` to *current version*. See the :prop_tgt:`FRAMEWORK` target
+property for an example. Versions of Mach-O binaries may be checked with the
+``otool -L <binary>`` command.
diff --git a/Help/release/3.6.rst b/Help/release/3.6.rst
new file mode 100644
index 0000000..771c9dd
--- /dev/null
+++ b/Help/release/3.6.rst
@@ -0,0 +1,310 @@
+CMake 3.6 Release Notes
+***********************
+
+.. only:: html
+
+ .. contents::
+
+Changes made since CMake 3.5 include the following.
+
+New Features
+============
+
+Generators
+----------
+
+* The :generator:`Ninja` generator learned to produce phony targets
+ of the form ``sub/dir/all`` to drive the build of a subdirectory.
+ This is equivalent to ``cd sub/dir; make all`` with
+ :ref:`Makefile Generators`.
+
+* The :generator:`Ninja` generator now includes system header files in build
+ dependencies to ensure correct re-builds when system packages are updated.
+
+* The :generator:`Visual Studio 14 2015` generator learned to support the
+ Clang/C2 toolsets, e.g. with the ``-T v140_clang_3_7`` option.
+ This feature is experimental.
+
+Commands
+--------
+
+* The :command:`add_custom_command` and :command:`add_custom_target` commands
+ learned how to use the :prop_tgt:`CROSSCOMPILING_EMULATOR` executable
+ target property.
+
+* The :command:`install` command learned a new ``EXCLUDE_FROM_ALL`` option
+ to leave installation rules out of the default installation.
+
+* The :command:`list` command gained a ``FILTER`` sub-command to filter
+ list elements by regular expression.
+
+* The :command:`string(TIMESTAMP)` and :command:`file(TIMESTAMP)`
+ commands gained support for the ``%s`` placeholder. This is
+ the number of seconds since the UNIX Epoch.
+
+Variables
+---------
+
+* A :variable:`CMAKE_DEPENDS_IN_PROJECT_ONLY` variable was introduced
+ to tell :ref:`Makefile Generators` to limit dependency scanning only
+ to files in the project source and build trees.
+
+* A new :variable:`CMAKE_HOST_SOLARIS` variable was introduced to
+ indicate when CMake is running on an Oracle Solaris host.
+
+* A :variable:`CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES` variable was
+ added for use by toolchain files to specify system include directories
+ to be appended to all compiler command lines.
+
+* The :variable:`CMAKE_<LANG>_STANDARD_LIBRARIES` variable is now documented.
+ It is intended for use by toolchain files to specify system libraries to be
+ added to all linker command lines.
+
+* A :variable:`CMAKE_NINJA_OUTPUT_PATH_PREFIX` variable was introduced
+ to tell the :generator:`Ninja` generator to configure the generated
+ ``build.ninja`` file for use as a ``subninja``.
+
+* A :variable:`CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` variable was
+ added for use by toolchain files to specify platform-specific
+ variables that must be propagated by the :command:`try_compile`
+ command into test projects.
+
+* A :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable was added
+ to optionally tell the :command:`try_compile` command to build
+ a static library instead of an executable. This is useful for
+ cross-compiling toolchains that cannot link binaries without
+ custom flags or scripts.
+
+Properties
+----------
+
+* A :prop_tgt:`DEPLOYMENT_REMOTE_DIRECTORY` target property was introduced
+ to tell the :generator:`Visual Studio 9 2008` and
+ :generator:`Visual Studio 8 2005` generators to generate the "remote
+ directory" for WinCE project deployment and debugger settings.
+
+* A :prop_tgt:`<LANG>_CLANG_TIDY` target property and supporting
+ :variable:`CMAKE_<LANG>_CLANG_TIDY` variable were introduced to tell the
+ :ref:`Makefile Generators` and the :generator:`Ninja` generator to run
+ ``clang-tidy`` along with the compiler for ``C`` and ``CXX`` languages.
+
+* A :prop_test:`TIMEOUT_AFTER_MATCH` test property was introduced to
+ optionally tell CTest to enforce a secondary timeout after matching
+ certain output from a test.
+
+* A :prop_tgt:`VS_CONFIGURATION_TYPE` target property was introduced
+ to specify a custom project file type for :ref:`Visual Studio Generators`
+ supporting VS 2010 and above.
+
+* A :prop_dir:`VS_STARTUP_PROJECT` directory property was introduced
+ to specify for :ref:`Visual Studio Generators` the default startup
+ project for generated solutions (``.sln`` files).
+
+Modules
+-------
+
+* The :module:`CMakePushCheckState` module now pushes/pops/resets the variable
+ ``CMAKE_EXTRA_INCLUDE_FILE`` used in :module:`CheckTypeSize`.
+
+* The :module:`ExternalProject` module leared the ``GIT_SHALLOW 1``
+ option to perform a shallow clone of a Git repository.
+
+* The :module:`ExternalProject` module learned to initialize Git submodules
+ recursively and also to initialize new submodules on updates. Use the
+ ``GIT_SUBMODULES`` option to restrict which submodules are initalized and
+ updated.
+
+* The :module:`ExternalProject` module leared the ``DOWNLOAD_NO_EXTRACT 1``
+ argument to skip extracting the file that is downloaded (e.g., for
+ self-extracting shell installers or ``.msi`` files).
+
+* The :module:`ExternalProject` module now uses ``TLS_VERIFY`` when fetching
+ from git repositories.
+
+* The :module:`FindBLAS` and :module:`FindLAPACK` modules learned to
+ support `OpenBLAS <http://www.openblas.net>`__.
+
+* The :module:`FindCUDA` module learned to find the ``cublas_device`` library.
+
+* The :module:`FindGTest` module ``gtest_add_tests`` function now causes
+ CMake to automatically re-run when test sources change so that they
+ can be re-scanned.
+
+* The :module:`FindLTTngUST` module was introduced to find the LTTng-UST
+ library.
+
+* The :module:`FindPkgConfig` module learned to optionally create imported
+ targets for the libraries it has found.
+
+* The :module:`FindProtobuf` module learned to provide a ``Protobuf_VERSION``
+ variable and check the version number requested in a :command:`find_package`
+ call.
+
+* The :module:`InstallRequiredSystemLibraries` module learned a new
+ ``CMAKE_INSTALL_UCRT_LIBRARIES`` option to enable app-local deployment
+ of the Windows Universal CRT libraries with Visual Studio 2015.
+
+Platforms
+---------
+
+* The Clang compiler is now supported on CYGWIN.
+
+* Support was added for the Bruce C Compiler with compiler id ``Bruce``.
+
+CTest
+-----
+
+* The :command:`ctest_update` command now looks at the
+ :variable:`CTEST_GIT_INIT_SUBMODULES` variable to determine whether
+ submodules should be updated or not before updating.
+
+* The :command:`ctest_update` command will now synchronize submodules on an
+ update. Updates which add submodules or change a submodule's URL will now be
+ pulled properly.
+
+CPack
+-----
+
+* The :module:`CPackDeb` module learned how to handle ``$ORIGIN``
+ in ``CMAKE_INSTALL_RPATH`` when :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS`
+ is used for dependency auto detection.
+
+* The :module:`CPackDeb` module learned how to generate ``DEBIAN/shlibs``
+ contorl file when package contains shared libraries.
+
+* The :module:`CPackDeb` module learned how to generate ``DEBIAN/postinst`` and
+ ``DEBIAN/postrm`` files if the package installs libraries in
+ ldconfig-controlled locations (e.g. ``/lib/``, ``/usr/lib/``).
+
+* The :module:`CPackDeb` module learned how to generate dependencies between
+ Debian packages if multi-component setup is used and
+ :variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables are set.
+ For backward compatibility this feature is disabled by default.
+ See :variable:`CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS`.
+
+* The :module:`CPackDeb` module learned how to set custom package file names
+ including how to generate properly-named Debian packages::
+
+ <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
+
+ For backward compatibility this feature is disabled by default. See
+ :variable:`CPACK_DEBIAN_FILE_NAME` and
+ :variable:`CPACK_DEBIAN_<COMPONENT>_FILE_NAME`.
+
+* The :module:`CPackDeb` module learned how to set the package release number
+ (``DebianRevisionNumber`` in package file name when used in combination with
+ ``DEB-DEFAULT`` value set by :variable:`CPACK_DEBIAN_FILE_NAME`). See
+ :variable:`CPACK_DEBIAN_PACKAGE_RELEASE`.
+
+* The :module:`CPackDeb` module learned how to set the package architecture
+ per-component. See :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE`.
+
+* The :module:`CPackDMG` module learned a new option to tell the CPack
+ ``DragNDrop`` generaor to skip the ``/Applications`` symlink.
+ See the :variable:`CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK` variable.
+
+* The :module:`CPackIFW` module gained a new
+ :command:`cpack_ifw_update_repository` command to update a QtIFW-specific
+ repository from a remote repository.
+
+* The :module:`CPackRPM` module learned how to set RPM ``dist`` tag as part of
+ RPM ``Release:`` tag when enabled (mandatory on some Linux distributions for
+ e.g. on Fedora).
+ See :variable:`CPACK_RPM_PACKAGE_RELEASE_DIST`.
+
+* The :module:`CPackRPM` module learned how to set default values for owning
+ user/group and file/directory permissions of package content.
+ See :variable:`CPACK_RPM_DEFAULT_USER`, :variable:`CPACK_RPM_DEFAULT_GROUP`,
+ :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`,
+ :variable:`CPACK_RPM_DEFAULT_DIR_PERMISSIONS` and their per component
+ counterparts.
+
+* The :module:`CPackRPM` module learned how to set user defined package file
+ names, how to specify that rpmbuild should decide on file name format as
+ well as handling of multiple rpm packages generated by a single user defined
+ spec file.
+ See :variable:`CPACK_RPM_PACKAGE_NAME` and
+ :variable:`CPACK_RPM_<component>_PACKAGE_NAME`.
+
+* The :module:`CPackRPM` module learned how to correctly handle symlinks
+ that are pointing outside generated packages.
+
+Other
+-----
+
+* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
+ is now aware of features supported by Intel C++ compilers versions 12.1
+ through 16.0 on UNIX platforms.
+
+Deprecated and Removed Features
+===============================
+
+* The :module:`CMakeForceCompiler` module and its macros are now deprecated.
+ See module documentation for an explanation.
+
+* The :command:`find_library`, :command:`find_path`, and :command:`find_file`
+ commands no longer search in installation prefixes derived from the ``PATH``
+ environment variable on non-Windows platforms. This behavior was added in
+ CMake 3.3 to support Windows hosts but has proven problematic on UNIX hosts.
+ Users that keep some ``<prefix>/bin`` directories in the ``PATH`` just for
+ their tools do not necessarily want any supporting ``<prefix>/lib``
+ directories searched. One may set the ``CMAKE_PREFIX_PATH`` environment
+ variable with a :ref:`;-list <CMake Language Lists>` of prefixes that are
+ to be searched.
+
+* The :generator:`Visual Studio 7 .NET 2003` generator is now
+ deprecated and will be removed in a future version of CMake.
+
+* The :generator:`Visual Studio 7` generator (for VS .NET 2002) has been
+ removed. It had been deprecated since CMake 3.3.
+
+* The :generator:`Visual Studio 6` generator has been removed.
+ It had been deprecated since CMake 3.3.
+
+Other Changes
+=============
+
+* The precompiled OS X binary provided on ``cmake.org`` now requires
+ OS X 10.7 or newer.
+
+* On Linux and FreeBSD platforms, when building CMake itself from source and
+ not using a system-provided libcurl, OpenSSL is now used by default if it is
+ found on the system. This enables SSL/TLS support for commands supporting
+ network communication via ``https``, such as :command:`file(DOWNLOAD)`,
+ :command:`file(UPLOAD)`, and :command:`ctest_submit`.
+
+* The :manual:`cmake(1)` ``--build`` command-line tool now rejects multiple
+ ``--target`` options with an error instead of silently ignoring all but the
+ last one.
+
+* :prop_tgt:`AUTOMOC` now diagnoses name collisions when multiple source
+ files in different directories use ``#include <moc_foo.cpp>`` with the
+ same name (because the generated ``moc_foo.cpp`` files would collide).
+
+* The :module:`FindBISON` module ``BISON_TARGET`` macro now supports
+ special characters by passing the ``VERBATIM`` option to internal
+ :command:`add_custom_command` calls. This may break clients that
+ added escaping manually to work around the bug.
+
+* The :module:`FindFLEX` module ``FLEX_TARGET`` macro now supports
+ special characters by passing the ``VERBATIM`` option to internal
+ :command:`add_custom_command` calls. This may break clients that
+ added escaping manually to work around the bug.
+
+* The :module:`FindProtobuf` module input and output variables were all renamed
+ from ``PROTOBUF_`` to ``Protobuf_`` for consistency with other find modules.
+ Input variables of the old case will be honored if provided, and output
+ variables of the old case are always provided.
+
+* The :module:`CPackRPM` module now supports upper cased component
+ names in per component CPackRPM specific variables.
+ E.g. component named ``foo`` now expects component specific
+ variable to be ``CPACK_RPM_FOO_PACKAGE_NAME`` while before
+ it expected ``CPACK_RPM_foo_PACKAGE_NAME``.
+ Upper cased component name part in variables is compatible
+ with convention used for other CPack variables.
+ For back compatibility old format of variables is still valid
+ and preferred if both versions of variable are set, but the
+ preferred future use is upper cased component names in variables.
+ New variables that will be added to CPackRPM in later versions
+ will only support upper cased component variable format.
diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst
deleted file mode 100644
index e4cc01e..0000000
--- a/Help/release/dev/0-sample-topic.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-0-sample-topic
---------------
-
-* This is a sample release note for the change in a topic.
- Developers should add similar notes for each topic branch
- making a noteworthy change. Each document should be named
- and titled to match the topic name to avoid merge conflicts.
diff --git a/Help/release/dev/CMakePushCheckState-CMAKE_EXTRA_INCLUDE_FILES.rst b/Help/release/dev/CMakePushCheckState-CMAKE_EXTRA_INCLUDE_FILES.rst
deleted file mode 100644
index a4e9a14..0000000
--- a/Help/release/dev/CMakePushCheckState-CMAKE_EXTRA_INCLUDE_FILES.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-CMakePushCheckState-CMAKE_EXTRA_INCLUDE_FILE
---------------------------------------------
-
-* The :module:`CMakePushCheckState` module now pushes/pops/resets the variable
- ``CMAKE_EXTRA_INCLUDE_FILE`` used in :module:`CheckTypeSize`.
diff --git a/Help/release/dev/ExternalProject-git-clone-shallow.rst b/Help/release/dev/ExternalProject-git-clone-shallow.rst
deleted file mode 100644
index f06fe34..0000000
--- a/Help/release/dev/ExternalProject-git-clone-shallow.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-ExternalProject-git-clone-shallow
----------------------------------
-
-* The :module:`ExternalProject` module leared the ``GIT_SHALLOW 1``
- option to perform a shallow clone of a Git repository.
diff --git a/Help/release/dev/ExternalProject-git-recursive-init.rst b/Help/release/dev/ExternalProject-git-recursive-init.rst
deleted file mode 100644
index 1ebcced..0000000
--- a/Help/release/dev/ExternalProject-git-recursive-init.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-ExternalProject-git-recursive-init
-----------------------------------
-
-* The :module:`ExternalProject` module learned to initialize Git submodules
- recursively and also to initialize new submodules on updates. Use the
- ``GIT_SUBMODULES`` option to restrict which submodules are initalized and
- updated.
diff --git a/Help/release/dev/FindGTest-depends.rst b/Help/release/dev/FindGTest-depends.rst
deleted file mode 100644
index 33c1489..0000000
--- a/Help/release/dev/FindGTest-depends.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-FindGTest-depends
------------------
-
-* The :module:`FindGTest` module ``gtest_add_tests`` function now causes
- CMake to automatically re-run when test sources change so that they
- can be re-scanned.
diff --git a/Help/release/dev/FindPkgConfig-targets.rst b/Help/release/dev/FindPkgConfig-targets.rst
deleted file mode 100644
index b18cb7b..0000000
--- a/Help/release/dev/FindPkgConfig-targets.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-FindPkgConfig-targets
----------------------
-
-* The :module:`FindPkgConfig` module learned to optionally create imported
- targets for the libraries it has found.
diff --git a/Help/release/dev/FindProtobuf-variable-case.rst b/Help/release/dev/FindProtobuf-variable-case.rst
deleted file mode 100644
index 0df00e7..0000000
--- a/Help/release/dev/FindProtobuf-variable-case.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-FindProtobuf-variable-case
---------------------------
-
-* The :module:`FindProtobuf` module input and output variables were all renamed
- from ``PROTOBUF_`` to ``Protobuf_`` for consistency with other find modules.
- Input variables of the old case will be honored if provided, and output
- variables of the old case are always provided.
diff --git a/Help/release/dev/FindProtobuf-version.rst b/Help/release/dev/FindProtobuf-version.rst
deleted file mode 100644
index 40c2ff5..0000000
--- a/Help/release/dev/FindProtobuf-version.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-FindProtobuf-version
---------------------
-
-* The :module:`FindProtobuf` module learned to provide a ``Protobuf_VERSION``
- variable and check the version number requested in a :command:`find_package`
- call.
diff --git a/Help/release/dev/InstallRequiredSystemLibraries-Windows-UCRT.rst b/Help/release/dev/InstallRequiredSystemLibraries-Windows-UCRT.rst
deleted file mode 100644
index e52531d..0000000
--- a/Help/release/dev/InstallRequiredSystemLibraries-Windows-UCRT.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-InstallRequiredSystemLibraries-Windows-UCRT
--------------------------------------------
-
-* The :module:`InstallRequiredSystemLibraries` module learned a new
- ``CMAKE_INSTALL_UCRT_LIBRARIES`` option to enable app-local deployment
- of the Windows Universal CRT libraries with Visual Studio 2015.
diff --git a/Help/release/dev/add-FindLTTngUST.rst b/Help/release/dev/add-FindLTTngUST.rst
deleted file mode 100644
index a156cc8..0000000
--- a/Help/release/dev/add-FindLTTngUST.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-add-FindLTTngUST
-----------------
-
-* The :module:`FindLTTngUST` module was introduced to find the LTTng-UST
- library.
diff --git a/Help/release/dev/add-bruce-c.rst b/Help/release/dev/add-bruce-c.rst
deleted file mode 100644
index 9e47900..0000000
--- a/Help/release/dev/add-bruce-c.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-add-bruce-c
------------
-
-* Support was added for the Bruce C Compiler with compiler id ``Bruce``.
diff --git a/Help/release/dev/automoc-diagnostics.rst b/Help/release/dev/automoc-diagnostics.rst
deleted file mode 100644
index d89f2e1..0000000
--- a/Help/release/dev/automoc-diagnostics.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-automoc-diagnostics
--------------------
-
-* :prop_tgt:`AUTOMOC` now diagnoses name collisions when multiple source
- files in different directories use ``#include <moc_foo.cpp>`` with the
- same name (because the generated ``moc_foo.cpp`` files would collide).
diff --git a/Help/release/dev/clang-tidy.rst b/Help/release/dev/clang-tidy.rst
deleted file mode 100644
index 030a7c9..0000000
--- a/Help/release/dev/clang-tidy.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-clang-tidy
-----------
-
-* A :prop_tgt:`<LANG>_CLANG_TIDY` target property and supporting
- :variable:`CMAKE_<LANG>_CLANG_TIDY` variable were introduced to tell the
- :ref:`Makefile Generators` and the :generator:`Ninja` generator to run
- ``clang-tidy`` along with the compiler for ``C`` and ``CXX`` languages.
diff --git a/Help/release/dev/cmake-depend-in-project-only.rst b/Help/release/dev/cmake-depend-in-project-only.rst
deleted file mode 100644
index 8553e80..0000000
--- a/Help/release/dev/cmake-depend-in-project-only.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-cmake-depend-in-project-only
-----------------------------
-
-* The :ref:`Makefile Generators` learned to optionally limit dependency
- scanning only to files in the project source and build trees.
- See the :variable:`CMAKE_DEPENDS_IN_PROJECT_ONLY` variable.
diff --git a/Help/release/dev/cmake-host-solaris.rst b/Help/release/dev/cmake-host-solaris.rst
deleted file mode 100644
index da7ab89..0000000
--- a/Help/release/dev/cmake-host-solaris.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake-host-solaris
-------------------
-
-* A new :variable:`CMAKE_HOST_SOLARIS` variable was introduced to
- indicate when CMake is running on an Oracle Solaris host.
diff --git a/Help/release/dev/cpack-deb-autodep-ORIGIN-RPATH.rst b/Help/release/dev/cpack-deb-autodep-ORIGIN-RPATH.rst
deleted file mode 100644
index b0d6196..0000000
--- a/Help/release/dev/cpack-deb-autodep-ORIGIN-RPATH.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-cpack-deb-autodep-ORIGIN-RPATH
---------------------------------
-
-* The "CPackDeb" module learned how to handle ``$ORIGIN``
- in ``CMAKE_INSTALL_RPATH`` when :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS`
- is used for dependency auto detection.
diff --git a/Help/release/dev/cpack-deb-imporvements.rst b/Help/release/dev/cpack-deb-imporvements.rst
deleted file mode 100644
index 4fd35b8..0000000
--- a/Help/release/dev/cpack-deb-imporvements.rst
+++ /dev/null
@@ -1,27 +0,0 @@
-cpack-deb-imporvements
-----------------------
-
-* The :module:`CPackDeb` module learned how to generate ``DEBIAN/shlibs``
- contorl file when package contains shared libraries.
-
-* The :module:`CPackDeb` module learned how to generate ``DEBIAN/postinst`` and
- ``DEBIAN/postrm`` files if the package installs libraries in
- ldconfig-controlled locations (e.g. ``/lib/``, ``/usr/lib/``).
-
-* The :module:`CPackDeb` module learned how to generate dependencies between
- Debian packages if multi-component setup is used and
- :variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables are set.
- This breaks compatibility with previous versions.
-
-* The :module:`CPackDeb` module learned how to set the package release number
- (``DebianRevisionNumber`` in package file name). See
- :variable:`CPACK_DEBIAN_PACKAGE_RELEASE`.
-
-* The :module:`CPackDeb` module now generates properly-named Debian packages::
-
- <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
-
- This breaks compatibility with previous versions.
-
-* The :module:`CPackDeb` module learned how to set the package architecture
- per-component. See :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE`.
diff --git a/Help/release/dev/cpack-rpm-adding-dist-to-release-tag.rst b/Help/release/dev/cpack-rpm-adding-dist-to-release-tag.rst
deleted file mode 100644
index 42599a9..0000000
--- a/Help/release/dev/cpack-rpm-adding-dist-to-release-tag.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-cpack-rpm-adding-dist-to-release-tag
-------------------------------------
-
-* The :module:`CPackRPM` module learned how to set RPM ``dist`` tag as part of
- RPM ``Release:`` tag when enabled (mandatory on some Linux distributions for
- e.g. on Fedora).
- See :variable:`CPACK_RPM_PACKAGE_RELEASE_DIST`.
diff --git a/Help/release/dev/cpack-rpm-default-user-and-group.rst b/Help/release/dev/cpack-rpm-default-user-and-group.rst
deleted file mode 100644
index 7667c7f..0000000
--- a/Help/release/dev/cpack-rpm-default-user-and-group.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-cpack-rpm-default-user-and-group
---------------------------------
-
-* The "CPackRPM" module learned how to set default values for owning user/group
- and file/directory permissions of package content.
- See :variable:`CPACK_RPM_DEFAULT_USER`, :variable:`CPACK_RPM_DEFAULT_GROUP`,
- :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`,
- :variable:`CPACK_RPM_DEFAULT_DIR_PERMISSIONS` and their per component
- counterparts.
diff --git a/Help/release/dev/cpack-rpm-different-package-names.rst b/Help/release/dev/cpack-rpm-different-package-names.rst
deleted file mode 100644
index 48679e1..0000000
--- a/Help/release/dev/cpack-rpm-different-package-names.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-cpack-rpm-different-package-names
----------------------------------
-
-* The :module:`CPackRPM` module learned how to set user defined package file
- names, how to specify that rpmbuild should decide on file name format as
- well as handling of multiple rpm packages generated by a single user defined
- spec file.
- See :variable:`CPACK_RPM_PACKAGE_NAME` and
- :variable:`CPACK_RPM_<component>_PACKAGE_NAME`.
diff --git a/Help/release/dev/cpack-rpm-external-symlink-handling.rst b/Help/release/dev/cpack-rpm-external-symlink-handling.rst
deleted file mode 100644
index ff74e1d..0000000
--- a/Help/release/dev/cpack-rpm-external-symlink-handling.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-cpack-rpm-external-symlink-handling
------------------------------------
-
-* The "CPackRPM" module learned how to correctly handle symlinks
- that are pointing outside generated packages.
diff --git a/Help/release/dev/cpack-rpm-upper-cased-components.rst b/Help/release/dev/cpack-rpm-upper-cased-components.rst
deleted file mode 100644
index 0628170..0000000
--- a/Help/release/dev/cpack-rpm-upper-cased-components.rst
+++ /dev/null
@@ -1,15 +0,0 @@
-cpack-rpm-upper-cased-components
---------------------------------
-
-* The "CPackRPM" module now supports upper cased component name
- in per component CPackRPM specific variables.
- E.g. component named ``foo`` now expects component specific
- variable to be ``CPACK_RPM_FOO_PACKAGE_NAME`` while before
- it expected ``CPACK_RPM_foo_PACKAGE_NAME``.
- Upper cased component name part in variables is compatible
- with convention used for other CPack variables.
- For back compatibility old format of variables is still valid
- and preferred if both versions of variable are set, but the
- preferred future use is upper cased component names in variables.
- New variables that will be added to CPackRPM in later versions
- will only support upper cased component variable format.
diff --git a/Help/release/dev/ctest-run-submodule-sync.rst b/Help/release/dev/ctest-run-submodule-sync.rst
deleted file mode 100644
index c41cc2f..0000000
--- a/Help/release/dev/ctest-run-submodule-sync.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-ctest-run-submodule-sync
-------------------------
-
-* The :command:`ctest_update` command now looks at the
- :variable:`CTEST_GIT_INIT_SUBMODULES` variable to determine whether
- submodules should be updated or not before updating.
-* The :command:`ctest_update` command will now synchronize submodules on an
- update. Updates which add submodules or change a submodule's URL will now be
- pulled properly.
diff --git a/Help/release/dev/custom-command-CROSSCOMPILING_EMULATOR.rst b/Help/release/dev/custom-command-CROSSCOMPILING_EMULATOR.rst
deleted file mode 100644
index 390463e..0000000
--- a/Help/release/dev/custom-command-CROSSCOMPILING_EMULATOR.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-custom-command-CROSSCOMPILING_EMULATOR
---------------------------------------
-
-* The :command:`add_custom_command` and :command:`add_custom_target` commands
- learned how to use the :prop_tgt:`CROSSCOMPILING_EMULATOR` executable
- target property.
diff --git a/Help/release/dev/cygwin-clang.rst b/Help/release/dev/cygwin-clang.rst
deleted file mode 100644
index 7d06d2a..0000000
--- a/Help/release/dev/cygwin-clang.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-cygwin-clang
-------------
-
-* The Clang compiler is now supported on CYGWIN.
diff --git a/Help/release/dev/deprecate-CMakeForceCompiler.rst b/Help/release/dev/deprecate-CMakeForceCompiler.rst
deleted file mode 100644
index dc6e817..0000000
--- a/Help/release/dev/deprecate-CMakeForceCompiler.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-deprecate-CMakeForceCompiler
-----------------------------
-
-* The :module:`CMakeForceCompiler` module and its macros are now deprecated.
- See module documentation for an explanation.
diff --git a/Help/release/dev/enable-ssl-automatically.rst b/Help/release/dev/enable-ssl-automatically.rst
deleted file mode 100644
index 8ded656..0000000
--- a/Help/release/dev/enable-ssl-automatically.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-enable-ssl-automatically
-------------------------
-
-* On Linux and FreeBSD platforms, when building CMake itself from source and
- not using a system-provided libcurl, OpenSSL is now used by default if it is
- found on the system. This enables SSL/TLS support for commands supporting
- network communication via ``https``, such as :command:`file(DOWNLOAD)`,
- :command:`file(UPLOAD)`, and :command:`ctest_submit`.
diff --git a/Help/release/dev/ep-tls-verify-git.rst b/Help/release/dev/ep-tls-verify-git.rst
deleted file mode 100644
index 3c727de..0000000
--- a/Help/release/dev/ep-tls-verify-git.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-ep-tls-verify-git
------------------
-
-* The :module:`ExternalProject` module now uses ``TLS_VERIFY`` when fetching
- from git repositories.
diff --git a/Help/release/dev/error-multiple-targets.rst b/Help/release/dev/error-multiple-targets.rst
deleted file mode 100644
index 060b26b..0000000
--- a/Help/release/dev/error-multiple-targets.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-error-multiple-targets
-----------------------
-
-* The :manual:`cmake(1)` ``--build`` command-line tool now rejects multiple
- ``--target`` options with an error instead of silently ignoring all but the
- last one.
diff --git a/Help/release/dev/external-project-no-extract.rst b/Help/release/dev/external-project-no-extract.rst
deleted file mode 100644
index b3293cd..0000000
--- a/Help/release/dev/external-project-no-extract.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-external-project-no-extract
----------------------------
-
-* The :module:`ExternalProject` module leared the ``DOWNLOAD_NO_EXTRACT 1``
- argument to skip extracting the file that is downloaded (e.g., for
- self-extracting shell installers or ``.msi`` files).
diff --git a/Help/release/dev/find-blas-lapack-OpenBLAS.rst b/Help/release/dev/find-blas-lapack-OpenBLAS.rst
deleted file mode 100644
index 893422a..0000000
--- a/Help/release/dev/find-blas-lapack-OpenBLAS.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-find-blas-lapack-OpenBLAS
--------------------------
-
-* The :module:`FindBLAS` and :module:`FindLAPACK` modules learned to
- support `OpenBLAS <http://www.openblas.net>`__.
diff --git a/Help/release/dev/find-command-prefix-from-PATH-windows-only.rst b/Help/release/dev/find-command-prefix-from-PATH-windows-only.rst
deleted file mode 100644
index be6eb3e..0000000
--- a/Help/release/dev/find-command-prefix-from-PATH-windows-only.rst
+++ /dev/null
@@ -1,12 +0,0 @@
-find-command-prefix-from-PATH-windows-only
-------------------------------------------
-
-* The :command:`find_library`, :command:`find_path`, and :command:`find_file`
- commands no longer search in installation prefixes derived from the ``PATH``
- environment variable on non-Windows platforms. This behavior was added in
- CMake 3.3 to support Windows hosts but has proven problematic on UNIX hosts.
- Users that keep some ``<prefix>/bin`` directories in the ``PATH`` just for
- their tools do not necessarily want any supporting ``<prefix>/lib``
- directories searched. One may set the ``CMAKE_PREFIX_PATH`` environment
- variable with a :ref:`;-list <CMake Language Lists>` of prefixes that are
- to be searched.
diff --git a/Help/release/dev/fix-bison-flex-command-escaping.rst b/Help/release/dev/fix-bison-flex-command-escaping.rst
deleted file mode 100644
index dc2e87b..0000000
--- a/Help/release/dev/fix-bison-flex-command-escaping.rst
+++ /dev/null
@@ -1,12 +0,0 @@
-fix-bison-flex-command-escaping
--------------------------------
-
-* The :module:`FindBISON` module ``BISON_TARGET`` macro now supports
- special characters by passing the ``VERBATIM`` option to internal
- :command:`add_custom_command` calls. This may break clients that
- added escaping manually to work around the bug.
-
-* The :module:`FindFLEX` module ``FLEX_TARGET`` macro now supports
- special characters by passing the ``VERBATIM`` option to internal
- :command:`add_custom_command` calls. This may break clients that
- added escaping manually to work around the bug.
diff --git a/Help/release/dev/install-EXCLUDE_FROM_ALL.rst b/Help/release/dev/install-EXCLUDE_FROM_ALL.rst
deleted file mode 100644
index a611eae..0000000
--- a/Help/release/dev/install-EXCLUDE_FROM_ALL.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-install-EXCLUDE_FROM_ALL
-------------------------
-
-* The :command:`install` command learned a new ``EXCLUDE_FROM_ALL`` option
- to leave installation rules out of the default installation.
diff --git a/Help/release/dev/intel-compiler-features.rst b/Help/release/dev/intel-compiler-features.rst
deleted file mode 100644
index f154dc9..0000000
--- a/Help/release/dev/intel-compiler-features.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-intel-compiler-features
------------------------
-
-* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
- is now aware of features supported by Intel C++ compilers versions 12.1
- through 16.0 on UNIX platforms.
diff --git a/Help/release/dev/list-FILTER-command.rst b/Help/release/dev/list-FILTER-command.rst
deleted file mode 100644
index 3fee4f0..0000000
--- a/Help/release/dev/list-FILTER-command.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-list-FILTER-command
--------------------
-
-* The :command:`list` command gained a ``FILTER`` sub-command to filter
- list elements by regular expression.
diff --git a/Help/release/dev/ninja-depfile-system-headers.rst b/Help/release/dev/ninja-depfile-system-headers.rst
deleted file mode 100644
index 7033cef..0000000
--- a/Help/release/dev/ninja-depfile-system-headers.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-ninja-depfile-system-headers
-----------------------------
-
-* The :generator:`Ninja` generator now includes system header files in build
- dependencies to ensure correct re-builds when system packages are updated.
diff --git a/Help/release/dev/ninja-directory-targets.rst b/Help/release/dev/ninja-directory-targets.rst
deleted file mode 100644
index 4826228..0000000
--- a/Help/release/dev/ninja-directory-targets.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-ninja-directory-targets
------------------------
-
-* The :generator:`Ninja` generator learned to produce phony targets
- of the form ``sub/dir/all`` to drive the build of a subdirectory.
- This is equivalent to ``cd sub/dir; make all`` with
- :ref:`Makefile Generators`.
diff --git a/Help/release/dev/remove-vs6-generator.rst b/Help/release/dev/remove-vs6-generator.rst
deleted file mode 100644
index 921b93a..0000000
--- a/Help/release/dev/remove-vs6-generator.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-remove-vs6-generator
---------------------
-
-* The :generator:`Visual Studio 6` generator has been removed.
diff --git a/Help/release/dev/remove-vs7.0-generator.rst b/Help/release/dev/remove-vs7.0-generator.rst
deleted file mode 100644
index 314bef9..0000000
--- a/Help/release/dev/remove-vs7.0-generator.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-remove-vs7.0-generator
-----------------------
-
-* The :generator:`Visual Studio 7` generator (for VS .NET 2002) has been
- removed.
diff --git a/Help/release/dev/timeout_after_match.rst b/Help/release/dev/timeout_after_match.rst
deleted file mode 100644
index 83f316d..0000000
--- a/Help/release/dev/timeout_after_match.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-timeout_after_match
--------------------
-
-* CTest learned to optionally enforce a secondary timeout after matching
- certain output from a test. See the :prop_test:`TIMEOUT_AFTER_MATCH` test
- property.
diff --git a/Help/release/dev/try_compile-config-flags.rst b/Help/release/dev/try_compile-config-flags.rst
deleted file mode 100644
index 7e5e461..0000000
--- a/Help/release/dev/try_compile-config-flags.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-try_compile-config-flags
-------------------------
-
-* The :command:`try_compile` command source file signature now honors
- configuration-specific flags (e.g. :variable:`CMAKE_<LANG>_FLAGS_DEBUG`)
- in the generated test project. Previously only the default such flags
- for the current toolchain were used.
diff --git a/Help/release/dev/try_compile-target-type.rst b/Help/release/dev/try_compile-target-type.rst
deleted file mode 100644
index cc41bf3..0000000
--- a/Help/release/dev/try_compile-target-type.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-try_compile-target-type
------------------------
-
-* The :command:`try_compile` command learned to check a new
- :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable to optionally
- build a static library instead of an executable. This is useful
- for cross-compiling toolchains that cannot link binaries without
- custom flags or scripts.
diff --git a/Help/release/dev/unix-timestamps.rst b/Help/release/dev/unix-timestamps.rst
deleted file mode 100644
index cdb0e5b..0000000
--- a/Help/release/dev/unix-timestamps.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-unix-timestamps
----------------
-
-* The :command:`string(TIMESTAMP)` and :command:`file(TIMESTAMP)`
- commands gained support for the ``%s`` placeholder. This is
- the number of seconds since the UNIX Epoch.
diff --git a/Help/release/dev/update-osx-release.rst b/Help/release/dev/update-osx-release.rst
deleted file mode 100644
index 7634c05..0000000
--- a/Help/release/dev/update-osx-release.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-update-osx-release
-------------------
-
-* The precompiled OS X binary provided on ``cmake.org`` now requires
- OS X 10.7 or newer.
diff --git a/Help/release/dev/vs-clang-cl.rst b/Help/release/dev/vs-clang-cl.rst
deleted file mode 100644
index ac09188..0000000
--- a/Help/release/dev/vs-clang-cl.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-vs-clang-cl
------------
-
-* The :generator:`Visual Studio 14 2015` generator learned to support the
- Clang/C2 toolsets, e.g. with the ``-T v140_clang_3_7`` option.
diff --git a/Help/release/dev/vs-remote-directory.rst b/Help/release/dev/vs-remote-directory.rst
deleted file mode 100644
index 194236d..0000000
--- a/Help/release/dev/vs-remote-directory.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-vs-remote-directory
--------------------
-
-* The :generator:`Visual Studio 9 2008` and :generator:`Visual Studio 8 2005`
- generators learned to generate the remote directory for WinCE project
- deployment and debugger settings. See the
- :prop_tgt:`DEPLOYMENT_REMOTE_DIRECTORY` target property.
diff --git a/Help/release/dev/vs-startup-project.rst b/Help/release/dev/vs-startup-project.rst
deleted file mode 100644
index f467400..0000000
--- a/Help/release/dev/vs-startup-project.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-vs-startup-project
-------------------
-
-* The :ref:`Visual Studio Generators` learned to honor a new
- :prop_dir:`VS_STARTUP_PROJECT` directory property that specifies
- the default startup project for generated solutions (``.sln`` files).
diff --git a/Help/release/dev/vs-vcxproj-ConfigurationType.rst b/Help/release/dev/vs-vcxproj-ConfigurationType.rst
deleted file mode 100644
index 46d05b4..0000000
--- a/Help/release/dev/vs-vcxproj-ConfigurationType.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-vs-vcxproj-ConfigurationType
-----------------------------
-
-* :ref:`Visual Studio Generators` for VS 2010 and above learned a new
- :prop_tgt:`VS_CONFIGURATION_TYPE` target property to specify a custom
- project file type.
diff --git a/Help/release/dev/vs71-deprecate.rst b/Help/release/dev/vs71-deprecate.rst
deleted file mode 100644
index 1946304..0000000
--- a/Help/release/dev/vs71-deprecate.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-vs71-deprecate
---------------
-
-* The :generator:`Visual Studio 7 .NET 2003` generator is now
- deprecated and will be removed in a future version of CMake.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index 7ecf910..92c3b63 100644
--- a/Help/release/index.rst
+++ b/Help/release/index.rst
@@ -5,14 +5,13 @@ CMake Release Notes
This file should include the adjacent "dev.txt" file
in development versions but not in release versions.
-.. include:: dev.txt
-
Releases
========
.. toctree::
:maxdepth: 1
+ 3.6 <3.6>
3.5 <3.5>
3.4 <3.4>
3.3 <3.3>
diff --git a/Help/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES.rst b/Help/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES.rst
new file mode 100644
index 0000000..c8e3d57
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES.rst
@@ -0,0 +1,14 @@
+CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES
+-----------------------------------------
+
+Include directories to be used for every source file compiled with
+the ``<LANG>`` compiler. This is meant for specification of system
+include directories needed by the language for the current platform.
+The directories always appear at the end of the include path passed
+to the compiler.
+
+This variable should not be set by project code. It is meant to be set by
+CMake's platform information modules for the current toolchain, or by a
+toolchain file when used with :variable:`CMAKE_TOOLCHAIN_FILE`.
+
+See also :variable:`CMAKE_<LANG>_STANDARD_LIBRARIES`.
diff --git a/Help/variable/CMAKE_LANG_STANDARD_LIBRARIES.rst b/Help/variable/CMAKE_LANG_STANDARD_LIBRARIES.rst
new file mode 100644
index 0000000..ba6df93
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_STANDARD_LIBRARIES.rst
@@ -0,0 +1,12 @@
+CMAKE_<LANG>_STANDARD_LIBRARIES
+-------------------------------
+
+Libraries linked into every executable and shared library linked
+for language ``<LANG>``. This is meant for specification of system
+libraries needed by the language for the current platform.
+
+This variable should not be set by project code. It is meant to be set by
+CMake's platform information modules for the current toolchain, or by a
+toolchain file when used with :variable:`CMAKE_TOOLCHAIN_FILE`.
+
+See also :variable:`CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES`.
diff --git a/Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst b/Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst
new file mode 100644
index 0000000..64091aa
--- /dev/null
+++ b/Help/variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX.rst
@@ -0,0 +1,27 @@
+CMAKE_NINJA_OUTPUT_PATH_PREFIX
+------------------------------
+
+Set output files path prefix for the :generator:`Ninja` generator.
+
+Every output files listed in the generated ``build.ninja`` will be
+prefixed by the contents of this variable (a trailing slash is
+appended if missing). This is useful when the generated ninja file is
+meant to be embedded as a ``subninja`` file into a *super* ninja
+project. For example, a ninja build file generated with a command
+like::
+
+ cd top-build-dir/sub &&
+ cmake -G Ninja -DCMAKE_NINJA_OUTPUT_PATH_PREFIX=sub/ path/to/source
+
+can be embedded in ``top-build-dir/build.ninja`` with a directive like
+this::
+
+ subninja sub/build.ninja
+
+The ``auto-regeneration`` rule in ``top-build-dir/build.ninja`` must have an
+order-only dependency on ``sub/build.ninja``.
+
+.. note::
+ When ``CMAKE_NINJA_OUTPUT_PATH_PREFIX`` is set, the project generated
+ by CMake cannot be used as a standalone project. No default targets
+ are specified.
diff --git a/Help/variable/CMAKE_STANDARD_LIBRARIES.rst b/Help/variable/CMAKE_STANDARD_LIBRARIES.rst
deleted file mode 100644
index 9c728cd..0000000
--- a/Help/variable/CMAKE_STANDARD_LIBRARIES.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-CMAKE_STANDARD_LIBRARIES
-------------------------
-
-Libraries linked into every executable and shared library.
-
-This is the list of libraries that are linked into all executables and
-libraries.
diff --git a/Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst b/Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst
new file mode 100644
index 0000000..0f96787
--- /dev/null
+++ b/Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst
@@ -0,0 +1,26 @@
+CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
+------------------------------------
+
+List of variables that the :command:`try_compile` command source file signature
+must propagate into the test project in order to target the same platform as
+the host project.
+
+This variable should not be set by project code. It is meant to be set by
+CMake's platform information modules for the current toolchain, or by a
+toolchain file when used with :variable:`CMAKE_TOOLCHAIN_FILE`.
+
+Variables meaningful to CMake, such as :variable:`CMAKE_<LANG>_FLAGS`, are
+propagated automatically. The ``CMAKE_TRY_COMPILE_PLATFORM_VARIABLES``
+variable may be set to pass custom variables meaningful to a toolchain file.
+For example, a toolchain file may contain:
+
+.. code-block:: cmake
+
+ set(CMAKE_SYSTEM_NAME ...)
+ set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES MY_CUSTOM_VARIABLE)
+ # ... use MY_CUSTOM_VARIABLE ...
+
+If a user passes ``-DMY_CUSTOM_VARIABLE=SomeValue`` to CMake then this
+setting will be made visible to the toolchain file both for the main
+project and for test projects generated by the :command:`try_compile`
+command source file signature.
diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake
index e34f8cd..929b2f6 100644
--- a/Modules/CPackDMG.cmake
+++ b/Modules/CPackDMG.cmake
@@ -19,7 +19,7 @@
#
# The disk image format. Common values are UDRO (UDIF read-only), UDZO (UDIF
# zlib-compressed) or UDBZ (UDIF bzip2-compressed). Refer to hdiutil(1) for
-# more information on other available formats.
+# more information on other available formats. Defaults to UDZO.
#
# .. variable:: CPACK_DMG_DS_STORE
#
@@ -46,6 +46,11 @@
# CPACK_DMG_DS_STORE_SETUP_SCRIPT is executed or CPACK_DMG_DS_STORE is
# installed. By default no background image is set.
#
+# .. variable:: CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK
+#
+# Default behaviour is to include a symlink to ``/Applications`` in the DMG.
+# Set this option to ``ON`` to avoid adding the symlink.
+#
# .. variable:: CPACK_DMG_SLA_DIR
#
# Directory where license and menu files for different languages are stored.
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index d93d924..c9678d6 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -2,29 +2,44 @@
# CPackDeb
# --------
#
-# The builtin (binary) CPack Deb generator (Unix only)
+# The built in (binary) CPack Deb generator (Unix only)
#
# Variables specific to CPack Debian (DEB) generator
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
-# CPackDeb may be used to create Deb package using CPack.
-# CPackDeb is a CPack generator thus it uses the ``CPACK_XXX`` variables
-# used by CPack : https://cmake.org/Wiki/CMake:CPackConfiguration.
-# CPackDeb generator should work on any linux host but it will produce
-# better deb package when Debian specific tools 'dpkg-xxx' are usable on
+# CPackDeb may be used to create Deb package using :module:`CPack`.
+# CPackDeb is a :module:`CPack` generator thus it uses the ``CPACK_XXX``
+# variables used by :module:`CPack`.
+#
+# CPackDeb generator should work on any Linux host but it will produce
+# better deb package when Debian specific tools ``dpkg-xxx`` are usable on
# the build system.
#
# CPackDeb has specific features which are controlled by the specifics
# :code:`CPACK_DEBIAN_XXX` variables.
#
# :code:`CPACK_DEBIAN_<COMPONENT>_XXXX` variables may be used in order to have
-# **component** specific values. Note however that ``<COMPONENT>`` refers to the
-# **grouping name** written in upper case. It may be either a component name or
-# a component GROUP name.
+# **component** specific values. Note however that ``<COMPONENT>`` refers to
+# the **grouping name** written in upper case. It may be either a component name
+# or a component GROUP name.
+#
+# Here are some CPackDeb wiki resources that are here for historic reasons and
+# are no longer maintained but may still prove useful:
+#
+# - https://cmake.org/Wiki/CMake:CPackConfiguration
+# - https://cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
+#
+# List of CPackRPM specific variables:
+#
+# .. variable:: CPACK_DEB_PACKAGE_COMPONENT
+#
+# Enable component packaging for CPackRPM
+#
+# * Mandatory : NO
+# * Default : OFF
#
-# You'll find a detailed usage on the wiki:
-# https://cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 .
-# However as a handy reminder here comes the list of specific variables:
+# If enabled (ON) multiple packages are generated. By default a single package
+# containing files of all components is generated.
#
# .. variable:: CPACK_DEBIAN_PACKAGE_NAME
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME
@@ -42,6 +57,32 @@
#
# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source
#
+# .. variable:: CPACK_DEBIAN_FILE_NAME
+# CPACK_DEBIAN_<COMPONENT>_FILE_NAME
+#
+# Package file name.
+#
+# * Mandatory : YES
+# * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].deb``
+#
+# This may be set to ``DEB-DEFAULT`` to allow CPackDeb to generate package file
+# name by itself in deb format::
+#
+# <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
+#
+# Alternatively provided package file name must end with ``.deb`` suffix.
+#
+# .. note::
+#
+# Preferred setting of this variable is ``DEB-DEFAULT`` but for backward
+# compatibility with CPackDeb in CMake prior to version 3.6 this feature
+# is disabled by default.
+#
+# .. note::
+#
+# By using non default filenames duplicate names may occur. Duplicate files
+# get overwritten and it is up to the packager to set the variables in a
+# manner that will prevent such errors.
#
# .. variable:: CPACK_DEBIAN_PACKAGE_VERSION
#
@@ -72,7 +113,6 @@
# * Default : Output of :code:`dpkg --print-architecture` (or :code:`i386`
# if :code:`dpkg` is not found)
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS
#
@@ -100,6 +140,13 @@
#
# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)")
#
+# .. variable:: CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS
+#
+# Sets inter component dependencies if listed with
+# :variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables.
+#
+# * Mandatory : NO
+# * Default : -
#
# .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER
#
@@ -108,7 +155,6 @@
# * Mandatory : YES
# * Default : :code:`CPACK_PACKAGE_CONTACT`
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION
# CPACK_COMPONENT_<COMPONENT>_DESCRIPTION
#
@@ -127,19 +173,23 @@
# Set Section control field e.g. admin, devel, doc, ...
#
# * Mandatory : YES
-# * Default : 'devel'
+# * Default : "devel"
#
# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
#
-#
# .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
#
# The compression used for creating the Debian package.
-# Possible values are: lzma, xz, bzip2 and gzip.
#
# * Mandatory : YES
-# * Default : 'gzip'
+# * Default : "gzip"
#
+# Possible values are:
+#
+# - lzma
+# - xz
+# - bzip2
+# - gzip
#
# .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY
@@ -148,11 +198,10 @@
# extra
#
# * Mandatory : YES
-# * Default : 'optional'
+# * Default : "optional"
#
# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE
#
# The URL of the web site for this package, preferably (when applicable) the
@@ -167,7 +216,6 @@
# The content of this field is a simple URL without any surrounding
# characters such as <>.
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS
#
@@ -187,7 +235,6 @@
# may fail to find your own shared libs.
# See https://cmake.org/Wiki/CMake_RPATH_handling.
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG
#
# May be set when invoking cpack in order to trace debug information
@@ -251,7 +298,6 @@
#
# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS
#
@@ -293,7 +339,6 @@
#
# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES
#
@@ -310,7 +355,6 @@
#
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS
#
@@ -327,7 +371,6 @@
#
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS
#
@@ -343,14 +386,13 @@
#
# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS
#
# * Mandatory : NO
# * Default : OFF
#
# Allows to generate shlibs control file automatically. Compatibility is defined by
-# CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY variable value.
+# :variable:`CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY` variable value.
#
# .. note::
#
@@ -358,9 +400,10 @@
# set. This can be done by setting SOVERSION property with
# :command:`set_target_properties` command.
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY
#
+# Compatibility policy for auto-generated shlibs control file.
+#
# * Mandatory : NO
# * Default : "="
#
@@ -369,7 +412,6 @@
#
# See https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-sharedlibs-shlibdeps
#
-#
# .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_EXTRA
#
@@ -466,6 +508,17 @@ if(NOT UNIX)
message(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.")
endif()
+function(cpack_deb_variable_fallback OUTPUT_VAR_NAME)
+ set(FALLBACK_VAR_NAMES ${ARGN})
+
+ foreach(variable_name IN LISTS FALLBACK_VAR_NAMES)
+ if(${variable_name})
+ set(${OUTPUT_VAR_NAME} "${${variable_name}}" PARENT_SCOPE)
+ break()
+ endif()
+ endforeach()
+endfunction()
+
function(get_component_package_name var component)
string(TOUPPER "${component}" component_upcase)
if(CPACK_DEBIAN_${component_upcase}_PACKAGE_NAME)
@@ -713,20 +766,23 @@ function(cpack_deb_prepare_package_vars)
endif()
endif()
endforeach()
- set(COMPONENT_DEPENDS "")
- foreach (_PACK ${CPACK_COMPONENT_${_local_component_name}_DEPENDS})
- get_component_package_name(_PACK_NAME "${_PACK}")
+
+ if(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS)
+ set(COMPONENT_DEPENDS "")
+ foreach (_PACK ${CPACK_COMPONENT_${_local_component_name}_DEPENDS})
+ get_component_package_name(_PACK_NAME "${_PACK}")
+ if(COMPONENT_DEPENDS)
+ set(COMPONENT_DEPENDS "${_PACK_NAME} (= ${CPACK_DEBIAN_PACKAGE_VERSION}), ${COMPONENT_DEPENDS}")
+ else()
+ set(COMPONENT_DEPENDS "${_PACK_NAME} (= ${CPACK_DEBIAN_PACKAGE_VERSION})")
+ endif()
+ endforeach()
if(COMPONENT_DEPENDS)
- set(COMPONENT_DEPENDS "${_PACK_NAME} (= ${CPACK_DEBIAN_PACKAGE_VERSION}), ${COMPONENT_DEPENDS}")
- else()
- set(COMPONENT_DEPENDS "${_PACK_NAME} (= ${CPACK_DEBIAN_PACKAGE_VERSION})")
- endif()
- endforeach()
- if(COMPONENT_DEPENDS)
- if(CPACK_DEBIAN_PACKAGE_DEPENDS)
- set(CPACK_DEBIAN_PACKAGE_DEPENDS "${COMPONENT_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
- else()
- set(CPACK_DEBIAN_PACKAGE_DEPENDS "${COMPONENT_DEPENDS}")
+ if(CPACK_DEBIAN_PACKAGE_DEPENDS)
+ set(CPACK_DEBIAN_PACKAGE_DEPENDS "${COMPONENT_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
+ else()
+ set(CPACK_DEBIAN_PACKAGE_DEPENDS "${COMPONENT_DEPENDS}")
+ endif()
endif()
endif()
endif()
@@ -878,13 +934,32 @@ function(cpack_deb_prepare_package_vars)
set(CPACK_DEBIAN_PACKAGE_RELEASE 1)
endif()
- # Patch package file name to be in corrent debian format:
- # <foo>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
- set(CPACK_OUTPUT_FILE_NAME
- "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
- set(CPACK_TEMPORARY_PACKAGE_FILE_NAME "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_OUTPUT_FILE_NAME}")
- get_filename_component(BINARY_DIR "${CPACK_OUTPUT_FILE_PATH}" DIRECTORY)
- set(CPACK_OUTPUT_FILE_PATH "${BINARY_DIR}/${CPACK_OUTPUT_FILE_NAME}")
+
+ cpack_deb_variable_fallback("CPACK_DEBIAN_FILE_NAME"
+ "CPACK_DEBIAN_${_local_component_name}_FILE_NAME"
+ "CPACK_DEBIAN_FILE_NAME")
+ if(CPACK_DEBIAN_FILE_NAME)
+ if(CPACK_DEBIAN_FILE_NAME STREQUAL "DEB-DEFAULT")
+ # Patch package file name to be in corrent debian format:
+ # <foo>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
+ set(CPACK_OUTPUT_FILE_NAME
+ "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
+ else()
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0010 NEW)
+ if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.deb")
+ cmake_policy(POP)
+ message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb'!")
+ endif()
+ cmake_policy(POP)
+
+ set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}")
+ endif()
+
+ set(CPACK_TEMPORARY_PACKAGE_FILE_NAME "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_OUTPUT_FILE_NAME}")
+ get_filename_component(BINARY_DIR "${CPACK_OUTPUT_FILE_PATH}" DIRECTORY)
+ set(CPACK_OUTPUT_FILE_PATH "${BINARY_DIR}/${CPACK_OUTPUT_FILE_NAME}")
+ endif() # else() back compatibility - don't change the name
# Print out some debug information if we were asked for that
if(CPACK_DEBIAN_PACKAGE_DEBUG)
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 6649933..083fc28 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -4,8 +4,8 @@
#
# .. _QtIFW: http://doc.qt.io/qtinstallerframework/index.html
#
-# This module looks for the location of the command line utilities supplied with
-# the Qt Installer Framework (QtIFW_).
+# This module looks for the location of the command line utilities supplied
+# with the Qt Installer Framework (QtIFW_).
#
# The module also defines several commands to control the behavior of the
# CPack ``IFW`` generator.
@@ -31,7 +31,8 @@
# Variables
# ^^^^^^^^^
#
-# You can use the following variables to change behavior of CPack ``IFW`` generator.
+# You can use the following variables to change behavior of CPack ``IFW``
+# generator.
#
# Debug
# """"""
@@ -65,7 +66,8 @@
#
# .. variable:: CPACK_IFW_PACKAGE_WINDOW_ICON
#
-# Filename for a custom window icon in PNG format for the Installer application.
+# Filename for a custom window icon in PNG format for the Installer
+# application.
#
# .. variable:: CPACK_IFW_PACKAGE_LOGO
#
@@ -80,7 +82,8 @@
# .. variable:: CPACK_IFW_TARGET_DIRECTORY
#
# Default target directory for installation.
-# By default used "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`"
+# By default used
+# "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`"
#
# You can use predefined variables.
#
@@ -134,6 +137,7 @@
#
# The default value of this variable is computed by CPack and contains
# all repositories added with command :command:`cpack_ifw_add_repository`
+# or updated with command :command:`cpack_ifw_update_repository`.
#
# .. variable:: CPACK_IFW_DOWNLOAD_ALL
#
@@ -185,7 +189,7 @@
#
# ::
#
-# cpack_ifw_configure_component(<compname> [COMMON]
+# cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL]
# [NAME <name>]
# [VERSION <version>]
# [SCRIPT <script>]
@@ -193,20 +197,23 @@
# [DEPENDS <com_id> ...]
# [LICENSES <display_name> <file_path> ...])
#
-# This command should be called after cpack_add_component command.
+# This command should be called after :command:`cpack_add_component` command.
#
# ``COMMON`` if set, then the component will be packaged and installed as part
# of a group to which it belongs.
#
+# ``ESSENTIAL`` if set, then the package manager stays disabled until that
+# component is updated.
+#
+# ``NAME`` is used to create domain-like identification for this component.
+# By default used origin component name.
+#
# ``VERSION`` is version of component.
# By default used :variable:`CPACK_PACKAGE_VERSION`.
#
# ``SCRIPT`` is a relative or absolute path to operations script
# for this component.
#
-# ``NAME`` is used to create domain-like identification for this component.
-# By default used origin component name.
-#
# ``PRIORITY`` is priority of the component in the tree.
#
# ``DEPENDS`` list of dependency component identifiers in QtIFW_ style.
@@ -222,21 +229,23 @@
#
# ::
#
-# cpack_ifw_configure_component_group(<grpname>
-# [VERSION <version>]
+# cpack_ifw_configure_component_group(<groupname>
# [NAME <name>]
+# [VERSION <version>]
# [SCRIPT <script>]
# [PRIORITY <priority>]
# [LICENSES <display_name> <file_path> ...])
#
-# This command should be called after cpack_add_component_group command.
+# This command should be called after :command:`cpack_add_component_group`
+# command.
+#
+# ``NAME`` is used to create domain-like identification for this component
+# group.
+# By default used origin component group name.
#
# ``VERSION`` is version of component group.
# By default used :variable:`CPACK_PACKAGE_VERSION`.
#
-# ``NAME`` is used to create domain-like identification for this component group.
-# By default used origin component group name.
-#
# ``SCRIPT`` is a relative or absolute path to operations script
# for this component group.
#
@@ -249,7 +258,7 @@
#
# .. command:: cpack_ifw_add_repository
#
-# Add QtIFW_ specific remote repository.
+# Add QtIFW_ specific remote repository to binary installer.
#
# ::
#
@@ -259,8 +268,8 @@
# [PASSWORD <password>]
# [DISPLAY_NAME <display_name>])
#
-# This macro will also add the <reponame> repository
-# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`
+# This command will also add the <reponame> repository
+# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`.
#
# ``DISABLED`` if set, then the repository will be disabled by default.
#
@@ -272,6 +281,37 @@
#
# ``DISPLAY_NAME`` is string to display instead of the URL.
#
+#
+# --------------------------------------------------------------------------
+#
+# .. command:: cpack_ifw_update_repository
+#
+# Update QtIFW_ specific repository from remote repository.
+#
+# ::
+#
+# cpack_ifw_update_repository(<reponame>
+# [[ADD|REMOVE] URL <url>]|
+# [REPLACE OLD_URL <old_url> NEW_URL <new_url>]]
+# [USERNAME <username>]
+# [PASSWORD <password>]
+# [DISPLAY_NAME <display_name>])
+#
+# This command will also add the <reponame> repository
+# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`.
+#
+# ``URL`` is points to a list of available components.
+#
+# ``OLD_URL`` is points to a list that will replaced.
+#
+# ``NEW_URL`` is points to a list that will replace to.
+#
+# ``USERNAME`` is used as user on a protected repository.
+#
+# ``PASSWORD`` is password to use on a protected repository.
+#
+# ``DISPLAY_NAME`` is string to display instead of the URL.
+#
# Example usage
# ^^^^^^^^^^^^^
#
@@ -331,6 +371,9 @@
# Predefined Variables
# http://doc.qt.io/qtinstallerframework/scripting.html#predefined-variables
#
+# Promoting Updates
+# http://doc.qt.io/qtinstallerframework/ifw-updates.html
+#
# Download Qt Installer Framework for you platform from Qt site:
# http://download.qt.io/official_releases/qt-installer-framework
#
@@ -377,6 +420,8 @@ set(_CPACK_IFW_SUFFIXES
"QtIFW2.3.0/bin"
"QtIFW2.2.0/bin"
"QtIFW2.1.0/bin"
+ "QtIFW2.0.3/bin"
+ "QtIFW2.0.1/bin"
"QtIFW2.0.0/bin"
# First branch
"QtIFW-1.6.0/bin"
@@ -503,8 +548,8 @@ macro(cpack_ifw_configure_component compname)
string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME)
- set(_IFW_OPT COMMON)
- set(_IFW_ARGS VERSION SCRIPT NAME PRIORITY)
+ set(_IFW_OPT COMMON ESSENTIAL)
+ set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
set(_IFW_MULTI_ARGS DEPENDS LICENSES)
cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
@@ -608,6 +653,51 @@ macro(cpack_ifw_add_repository reponame)
endmacro()
+# Macro for updating repository
+macro(cpack_ifw_update_repository reponame)
+
+ string(TOUPPER ${reponame} _CPACK_IFWREPO_UNAME)
+
+ set(_IFW_OPT ADD REMOVE REPLACE DISABLED)
+ set(_IFW_ARGS URL OLD_URL NEW_URL USERNAME PASSWORD DISPLAY_NAME)
+ set(_IFW_MULTI_ARGS)
+ cmake_parse_arguments(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
+
+ set(_CPACK_IFWREPO_STR "\n# Configuration for IFW repository \"${reponame}\" update\n")
+
+ foreach(_IFW_ARG_NAME ${_IFW_OPT})
+ cpack_append_option_set_command(
+ CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWREPO_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_ARGS})
+ cpack_append_string_variable_set_command(
+ CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWREPO_STR)
+ endforeach()
+
+ foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
+ cpack_append_variable_set_command(
+ CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+ _CPACK_IFWREPO_STR)
+ endforeach()
+
+ if(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_ADD
+ OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REMOVE
+ OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REPLACE)
+ list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})
+ set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
+ else()
+ set(_CPACK_IFWREPO_STR)
+ endif()
+
+ if(CPack_CMake_INCLUDED AND _CPACK_IFWREPO_STR)
+ file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}")
+ endif()
+
+endmacro()
+
# Resolve package control script
_cpack_ifw_resolve_script(CPACK_IFW_PACKAGE_CONTROL_SCRIPT)
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index aecb7fc..d231ff0 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -2,14 +2,14 @@
# CPackRPM
# --------
#
-# The builtin (binary) CPack RPM generator (Unix only)
+# The built in (binary) CPack RPM generator (Unix only)
#
# Variables specific to CPack RPM generator
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
-# CPackRPM may be used to create RPM package using CPack.
-# CPackRPM is a CPack generator thus it uses the ``CPACK_XXX`` variables
-# used by CPack : https://cmake.org/Wiki/CMake:CPackConfiguration.
+# CPackRPM may be used to create RPM packages using :module:`CPack`.
+# CPackRPM is a :module:`CPack` generator thus it uses the ``CPACK_XXX``
+# variables used by :module:`CPack`.
#
# CPackRPM has specific features which are controlled by the specifics
# :code:`CPACK_RPM_XXX` variables.
@@ -17,8 +17,8 @@
# :code:`CPACK_RPM_<COMPONENT>_XXXX` variables may be used in order to have
# **component** specific values. Note however that ``<COMPONENT>`` refers to the
# **grouping name** written in upper case. It may be either a component name or
-# a component GROUP name. Usually those vars correspond to RPM spec file
-# entities, one may find information about spec files here
+# a component GROUP name. Usually those variables correspond to RPM spec file
+# entities. One may find information about spec files here
# http://www.rpm.org/wiki/Docs
#
# .. note::
@@ -34,9 +34,23 @@
# component variables also override upper cased versions where both are
# present.
#
-# List of CPack/RPM specific variables:
-# https://cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 .
-# However as a handy reminder here comes the list of specific variables:
+# Here are some CPackRPM wiki resources that are here for historic reasons and
+# are no longer maintained but may still prove useful:
+#
+# - https://cmake.org/Wiki/CMake:CPackConfiguration
+# - https://cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29
+#
+# List of CPackRPM specific variables:
+#
+# .. variable:: CPACK_RPM_PACKAGE_COMPONENT
+#
+# Enable component packaging for CPackRPM
+#
+# * Mandatory : NO
+# * Default : OFF
+#
+# If enabled (ON) multiple packages are generated. By default a single package
+# containing files of all components is generated.
#
# .. variable:: CPACK_RPM_PACKAGE_SUMMARY
# CPACK_RPM_<component>_PACKAGE_SUMMARY
@@ -44,7 +58,7 @@
# The RPM package summary.
#
# * Mandatory : YES
-# * Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY
+# * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
#
# .. variable:: CPACK_RPM_PACKAGE_NAME
# CPACK_RPM_<component>_PACKAGE_NAME
@@ -52,7 +66,7 @@
# The RPM package name.
#
# * Mandatory : YES
-# * Default : CPACK_PACKAGE_NAME
+# * Default : :variable:`CPACK_PACKAGE_NAME`
#
# .. variable:: CPACK_RPM_FILE_NAME
# CPACK_RPM_<component>_FILE_NAME
@@ -65,7 +79,7 @@
#
# This may be set to ``RPM-DEFAULT`` to allow rpmbuild tool to generate package
# file name by itself.
-# Alternatively provided package file name must end with ".rpm" suffix.
+# Alternatively provided package file name must end with ``.rpm`` suffix.
#
# .. note::
#
@@ -83,7 +97,7 @@
# The RPM package version.
#
# * Mandatory : YES
-# * Default : CPACK_PACKAGE_VERSION
+# * Default : :variable:`CPACK_PACKAGE_VERSION`
#
# .. variable:: CPACK_RPM_PACKAGE_ARCHITECTURE
# CPACK_RPM_<component>_PACKAGE_ARCHITECTURE
@@ -91,9 +105,9 @@
# The RPM package architecture.
#
# * Mandatory : YES
-# * Default : Native architecture output by "uname -m"
+# * Default : Native architecture output by ``uname -m``
#
-# This may be set to "noarch" if you know you are building a noarch package.
+# This may be set to ``noarch`` if you know you are building a noarch package.
#
# .. variable:: CPACK_RPM_PACKAGE_RELEASE
#
@@ -161,9 +175,9 @@
# RPM package description.
#
# * Mandatory : YES
-# * Default : CPACK_COMPONENT_<compName>_DESCRIPTION (component based installers
-# only) if set, CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package
-# description available"
+# * Default : :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION` (component
+# based installers only) if set, :variable:`CPACK_PACKAGE_DESCRIPTION_FILE`
+# if set or "no package description available"
#
# .. variable:: CPACK_RPM_COMPRESSION_TYPE
#
@@ -174,8 +188,15 @@
#
# May be used to override RPM compression type to be used to build the
# RPM. For example some Linux distribution now default to lzma or xz
-# compression whereas older cannot use such RPM. Using this one can enforce
-# compression type to be used. Possible value are: lzma, xz, bzip2 and gzip.
+# compression whereas older cannot use such RPM. Using this one can enforce
+# compression type to be used.
+#
+# Possible values are:
+#
+# - lzma
+# - xz
+# - bzip2
+# - gzip
#
# .. variable:: CPACK_RPM_PACKAGE_AUTOREQ
# CPACK_RPM_<component>_PACKAGE_AUTOREQ
@@ -190,7 +211,7 @@
#
# .. note::
#
-# By defalut automatic dependency detection is enabled by rpm generator.
+# By default automatic dependency detection is enabled by rpm generator.
#
# .. variable:: CPACK_RPM_PACKAGE_AUTOPROV
# CPACK_RPM_<component>_PACKAGE_AUTOPROV
@@ -206,7 +227,7 @@
#
# .. note::
#
-# By defalut automatic provides detection is enabled by rpm generator.
+# By default automatic provides detection is enabled by rpm generator.
#
# .. variable:: CPACK_RPM_PACKAGE_AUTOREQPROV
# CPACK_RPM_<component>_PACKAGE_AUTOREQPROV
@@ -222,7 +243,7 @@
#
# .. note::
#
-# By defalut automatic detection feature is enabled by rpm.
+# By default automatic detection feature is enabled by rpm.
#
# .. variable:: CPACK_RPM_PACKAGE_REQUIRES
# CPACK_RPM_<component>_PACKAGE_REQUIRES
@@ -232,7 +253,7 @@
# * Mandatory : NO
# * Default : -
#
-# May be used to set RPM dependencies (requires). Note that you must enclose
+# May be used to set RPM dependencies (requires). Note that you must enclose
# the complete requires string between quotes, for example::
#
# set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8")
@@ -249,8 +270,8 @@
# * Mandatory : NO
# * Default : -
#
-# May be used to set negative RPM dependencies (conflicts). Note that you must enclose
-# the complete requires string between quotes, for example::
+# May be used to set negative RPM dependencies (conflicts). Note that you must
+# enclose the complete requires string between quotes, for example::
#
# set(CPACK_RPM_PACKAGE_CONFLICTS "libxml2")
#
@@ -266,8 +287,8 @@
# * Mandatory : NO
# * Default : -
#
-# May be used to set RPM preinstall dependencies (requires(pre)). Note that you must enclose
-# the complete requires string between quotes, for example::
+# May be used to set RPM preinstall dependencies (requires(pre)). Note that
+# you must enclose the complete requires string between quotes, for example::
#
# set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts")
#
@@ -279,12 +300,11 @@
# * Mandatory : NO
# * Default : -
#
-# May be used to set RPM postinstall dependencies (requires(post)). Note that you must enclose
-# the complete requires string between quotes, for example::
+# May be used to set RPM postinstall dependencies (requires(post)). Note that
+# you must enclose the complete requires string between quotes, for example::
#
# set(CPACK_RPM_PACKAGE_REQUIRES_POST "shadow-utils, initscripts")
#
-#
# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN
# CPACK_RPM_<component>_PACKAGE_REQUIRES_POSTUN
#
@@ -293,12 +313,12 @@
# * Mandatory : NO
# * Default : -
#
-# May be used to set RPM postuninstall dependencies (requires(postun)). Note that you must enclose
-# the complete requires string between quotes, for example::
+# May be used to set RPM postuninstall dependencies (requires(postun)). Note
+# that you must enclose the complete requires string between quotes, for
+# example::
#
# set(CPACK_RPM_PACKAGE_REQUIRES_POSTUN "shadow-utils, initscripts")
#
-#
# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN
# CPACK_RPM_<component>_PACKAGE_REQUIRES_PREUN
#
@@ -307,8 +327,8 @@
# * Mandatory : NO
# * Default : -
#
-# May be used to set RPM preuninstall dependencies (requires(preun)). Note that you must enclose
-# the complete requires string between quotes, for example::
+# May be used to set RPM preuninstall dependencies (requires(preun)). Note that
+# you must enclose the complete requires string between quotes, for example::
#
# set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts")
#
@@ -320,7 +340,7 @@
# * Mandatory : NO
# * Default : -
#
-# May be used to set weak RPM dependencies (suggests). Note that you must
+# May be used to set weak RPM dependencies (suggests). Note that you must
# enclose the complete requires string between quotes.
#
# .. variable:: CPACK_RPM_PACKAGE_PROVIDES
@@ -331,7 +351,7 @@
# * Mandatory : NO
# * Default : -
#
-# May be used to set RPM dependencies (provides). The provided package list
+# May be used to set RPM dependencies (provides). The provided package list
# of an RPM file could be printed with::
#
# rpm -qp --provides file.rpm
@@ -359,21 +379,23 @@
#
# rpm --prefix or --relocate
#
-# in order to install it at an alternate place see rpm(8). Note that
-# currently this may fail if CPACK_SET_DESTDIR is set to ON. If
-# CPACK_SET_DESTDIR is set then you will get a warning message but if there
-# is file installed with absolute path you'll get unexpected behavior.
+# in order to install it at an alternate place see rpm(8). Note that
+# currently this may fail if :variable:`CPACK_SET_DESTDIR` is set to ``ON``. If
+# :variable:`CPACK_SET_DESTDIR` is set then you will get a warning message but
+# if there is file installed with absolute path you'll get unexpected behavior.
#
# .. variable:: CPACK_RPM_SPEC_INSTALL_POST
#
+# Deprecated - use :variable:`CPACK_RPM_POST_INSTALL_SCRIPT_FILE` instead.
+#
# * Mandatory : NO
# * Default : -
# * Deprecated: YES
#
# This way of specifying post-install script is deprecated, use
-# CPACK_RPM_POST_INSTALL_SCRIPT_FILE.
+# :variable:`CPACK_RPM_POST_INSTALL_SCRIPT_FILE`.
# May be used to set an RPM post-install command inside the spec file.
-# For example setting it to "/bin/true" may be used to prevent
+# For example setting it to ``/bin/true`` may be used to prevent
# rpmbuild to strip binaries.
#
# .. variable:: CPACK_RPM_SPEC_MORE_DEFINE
@@ -383,7 +405,7 @@
# * Mandatory : NO
# * Default : -
#
-# May be used to add any %define lines to the generated spec file.
+# May be used to add any ``%define`` lines to the generated spec file.
#
# .. variable:: CPACK_RPM_PACKAGE_DEBUG
#
@@ -398,6 +420,7 @@
# cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
#
# .. variable:: CPACK_RPM_USER_BINARY_SPECFILE
+# CPACK_RPM_<componentName>_USER_BINARY_SPECFILE
#
# A user provided spec file.
#
@@ -407,8 +430,6 @@
# May be set by the user in order to specify a USER binary spec file
# to be used by CPackRPM instead of generating the file.
# The specified file will be processed by configure_file( @ONLY).
-# One can provide a component specific file by setting
-# CPACK_RPM_<componentName>_USER_BINARY_SPECFILE.
#
# .. variable:: CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
#
@@ -423,21 +444,24 @@
# cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM
#
# The user may then use this file in order to hand-craft is own
-# binary spec file which may be used with CPACK_RPM_USER_BINARY_SPECFILE.
+# binary spec file which may be used with
+# :variable:`CPACK_RPM_USER_BINARY_SPECFILE`.
#
# .. variable:: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
#
+# Path to file containing pre (un)install script.
+#
# * Mandatory : NO
# * Default : -
#
# May be used to embed a pre (un)installation script in the spec file.
-# The refered script file(s) will be read and directly
-# put after the %pre or %preun section
-# If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for
-# each component can be overridden with
-# CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE and
-# CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE.
+# The referred script file (or both) will be read and directly
+# put after the ``%pre`` or ``%preun`` section
+# If :variable:`CPACK_RPM_PACKAGE_COMPONENT` is set to ON the (un)install
+# script for each component can be overridden with
+# ``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE`` and
+# ``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``.
# One may verify which scriptlet has been included with::
#
# rpm -qp --scripts package.rpm
@@ -445,16 +469,18 @@
# .. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE
# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
#
+# Path to file containing post (un)install script.
+#
# * Mandatory : NO
# * Default : -
#
# May be used to embed a post (un)installation script in the spec file.
-# The refered script file(s) will be read and directly
-# put after the %post or %postun section.
-# If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for
-# each component can be overridden with
-# CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE and
-# CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE.
+# The referred script file (or both) will be read and directly
+# put after the ``%post`` or ``%postun`` section.
+# If :variable:`CPACK_RPM_PACKAGE_COMPONENT` is set to ON the (un)install
+# script for each component can be overridden with
+# ``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE`` and
+# ``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``.
# One may verify which scriptlet has been included with::
#
# rpm -qp --scripts package.rpm
@@ -465,11 +491,11 @@
# * Mandatory : NO
# * Default : -
#
-# May be used to explicitly specify %(<directive>) file line
-# in the spec file. Like %config(noreplace) or any other directive
-# that be found in the %files section. Since CPackRPM is generating
+# May be used to explicitly specify ``%(<directive>)`` file line
+# in the spec file. Like ``%config(noreplace)`` or any other directive
+# that be found in the ``%files`` section. Since CPackRPM is generating
# the list of files (and directories) the user specified files of
-# the CPACK_RPM_<COMPONENT>_USER_FILELIST list will be removed from
+# the ``CPACK_RPM_<COMPONENT>_USER_FILELIST`` list will be removed from
# the generated list.
#
# .. variable:: CPACK_RPM_CHANGELOG_FILE
@@ -480,7 +506,7 @@
# * Default : -
#
# May be used to embed a changelog in the spec file.
-# The refered file will be read and directly put after the %changelog
+# The referred file will be read and directly put after the ``%changelog``
# section.
#
# .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST
@@ -494,8 +520,8 @@
# list of paths discovered by CPack RPM. The defaut value contains a
# reasonable set of values if the variable is not defined by the user. If the
# variable is defined by the user then CPackRPM will NOT any of the default
-# path. If you want to add some path to the default list then you can use
-# CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION variable.
+# path. If you want to add some path to the default list then you can use
+# :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION` variable.
#
# .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
#
@@ -505,39 +531,47 @@
# * Default : -
#
# May be used to add more exclude path (directories or files) from the initial
-# default list of excluded paths. See CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST.
+# default list of excluded paths. See
+# :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST`.
#
# .. variable:: CPACK_RPM_RELOCATION_PATHS
#
+# Packages relocation paths list.
+#
# * Mandatory : NO
# * Default : -
#
# May be used to specify more than one relocation path per relocatable RPM.
# Variable contains a list of relocation paths that if relative are prefixed
-# by the value of CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX or by the value of
-# CPACK_PACKAGING_INSTALL_PREFIX if the component version is not provided.
+# by the value of :variable:`CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX` or by the
+# value of :variable:`CPACK_PACKAGING_INSTALL_PREFIX` if the component version
+# is not provided.
# Variable is not component based as its content can be used to set a different
# path prefix for e.g. binary dir and documentation dir at the same time.
# Only prefixes that are required by a certain component are added to that
# component - component must contain at least one file/directory/symbolic link
-# with CPACK_RPM_RELOCATION_PATHS prefix for a certain relocation path
-# to be added. Package will not contain any relocation paths if there are no
-# files/directories/symbolic links on any of the provided prefix locations.
+# with :variable:`CPACK_RPM_RELOCATION_PATHS` prefix for a certain relocation
+# path to be added. Package will not contain any relocation paths if there are
+# no files/directories/symbolic links on any of the provided prefix locations.
# Packages that either do not contain any relocation paths or contain
# files/directories/symbolic links that are outside relocation paths print
-# out an AUTHOR_WARNING that RPM will be partially relocatable.
+# out an ``AUTHOR_WARNING`` that RPM will be partially relocatable.
#
# .. variable:: CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
#
+# Per component relocation path install prefix.
+#
# * Mandatory : NO
# * Default : CPACK_PACKAGING_INSTALL_PREFIX
#
-# May be used to set per component CPACK_PACKAGING_INSTALL_PREFIX for
-# relocatable RPM packages.
+# May be used to set per component :variable:`CPACK_PACKAGING_INSTALL_PREFIX`
+# for relocatable RPM packages.
#
# .. variable:: CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION
# CPACK_RPM_NO_<COMPONENT>_INSTALL_PREFIX_RELOCATION
#
+# Removal of default install prefix from relocation paths list.
+#
# * Mandatory : NO
# * Default : CPACK_PACKAGING_INSTALL_PREFIX or CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
# are treated as one of relocation paths
@@ -602,9 +636,19 @@
# * Mandatory : NO
# * Default : - (system default)
#
-# Accepted values are lists with PERMISSIONS. Valid permissions
-# are OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ,
-# GROUP_WRITE, GROUP_EXECUTE, WORLD_READ, WORLD_WRITE and WORLD_EXECUTE.
+# Accepted values are lists with ``PERMISSIONS``. Valid permissions
+# are:
+#
+# - OWNER_READ
+# - OWNER_WRITE
+# - OWNER_EXECUTE
+# - GROUP_READ
+# - GROUP_WRITE
+# - GROUP_EXECUTE
+# - WORLD_READ
+# - WORLD_WRITE
+# - WORLD_EXECUTE
+#
# Note that <compName> must be in upper-case.
#
# .. variable:: CPACK_RPM_DEFAULT_DIR_PERMISSIONS
@@ -616,8 +660,7 @@
# * Default : - (system default)
#
# Accepted values are lists with PERMISSIONS. Valid permissions
-# are OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ,
-# GROUP_WRITE, GROUP_EXECUTE, WORLD_READ, WORLD_WRITE and WORLD_EXECUTE.
+# are the same as for :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`.
# Note that <compName> must be in upper-case.
#
# Packaging of Symbolic Links
@@ -643,7 +686,7 @@
# Symbolic links that point to locations outside packaging path produce a
# warning and are treated as non relocatable permanent symbolic links.
#
-# Currenty there are a few limitations though:
+# Currently there are a few limitations though:
#
# * For component based packaging component interdependency is not checked
# when processing symbolic links. Symbolic links pointing to content of
diff --git a/Modules/Compiler/GHS-C.cmake b/Modules/Compiler/GHS-C.cmake
index 50532ce..3072715 100644
--- a/Modules/Compiler/GHS-C.cmake
+++ b/Modules/Compiler/GHS-C.cmake
@@ -1,6 +1,7 @@
include(Compiler/GHS)
set(CMAKE_C_VERBOSE_FLAG "-v")
+set(CMAKE_C_OUTPUT_EXTENSION ".o")
set(CMAKE_C_FLAGS_INIT "")
set(CMAKE_C_FLAGS_DEBUG_INIT "-Odebug -g")
diff --git a/Modules/Compiler/GHS-CXX.cmake b/Modules/Compiler/GHS-CXX.cmake
index 2cffa0d..a51591b 100644
--- a/Modules/Compiler/GHS-CXX.cmake
+++ b/Modules/Compiler/GHS-CXX.cmake
@@ -1,6 +1,7 @@
include(Compiler/GHS)
set(CMAKE_CXX_VERBOSE_FLAG "-v")
+set(CMAKE_CXX_OUTPUT_EXTENSION ".o")
set(CMAKE_CXX_FLAGS_INIT "")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-Odebug -g")
diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake
index 479666c..ebc79f4 100644
--- a/Modules/Compiler/TI-C.cmake
+++ b/Modules/Compiler/TI-C.cmake
@@ -7,4 +7,4 @@ set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> --preproc_only --c_fi
set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> --compile_only --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<OBJECT>")
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -r <TARGET> <OBJECTS>")
-set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_C_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>")
+set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>")
diff --git a/Modules/ExternalProject-download.cmake.in b/Modules/ExternalProject-download.cmake.in
new file mode 100644
index 0000000..5b73cd8
--- /dev/null
+++ b/Modules/ExternalProject-download.cmake.in
@@ -0,0 +1,161 @@
+#=============================================================================
+# Copyright 2008-2013 Kitware, Inc.
+# Copyright 2016 Ruslan Baratov
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+cmake_minimum_required(VERSION 3.5)
+
+function(check_file_hash has_hash hash_is_good)
+ if("${has_hash}" STREQUAL "")
+ message(FATAL_ERROR "has_hash Can't be empty")
+ endif()
+
+ if("${hash_is_good}" STREQUAL "")
+ message(FATAL_ERROR "hash_is_good Can't be empty")
+ endif()
+
+ if("@ALGO@" STREQUAL "")
+ # No check
+ set("${has_hash}" FALSE PARENT_SCOPE)
+ set("${hash_is_good}" FALSE PARENT_SCOPE)
+ return()
+ endif()
+
+ set("${has_hash}" TRUE PARENT_SCOPE)
+
+ message(STATUS "verifying file...
+ file='@LOCAL@'")
+
+ file("@ALGO@" "@LOCAL@" actual_value)
+
+ if(NOT "${actual_value}" STREQUAL "@EXPECT_VALUE@")
+ set("${hash_is_good}" FALSE PARENT_SCOPE)
+ message(STATUS "@ALGO@ hash of
+ @LOCAL@
+ does not match expected value
+ expected: '@EXPECT_VALUE@'
+ actual: '${actual_value}'")
+ else()
+ set("${hash_is_good}" TRUE PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(sleep_before_download attempt)
+ if(attempt EQUAL 0)
+ return()
+ endif()
+
+ if(attempt EQUAL 1)
+ message(STATUS "Retrying...")
+ return()
+ endif()
+
+ set(sleep_seconds 0)
+
+ if(attempt EQUAL 2)
+ set(sleep_seconds 5)
+ elseif(attempt EQUAL 3)
+ set(sleep_seconds 5)
+ elseif(attempt EQUAL 4)
+ set(sleep_seconds 15)
+ elseif(attempt EQUAL 5)
+ set(sleep_seconds 60)
+ elseif(attempt EQUAL 6)
+ set(sleep_seconds 90)
+ elseif(attempt EQUAL 7)
+ set(sleep_seconds 300)
+ else()
+ set(sleep_seconds 1200)
+ endif()
+
+ message(STATUS "Retry after ${sleep_seconds} seconds (attempt #${attempt}) ...")
+
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep "${sleep_seconds}")
+endfunction()
+
+if("@LOCAL@" STREQUAL "")
+ message(FATAL_ERROR "LOCAL can't be empty")
+endif()
+
+if("@REMOTE@" STREQUAL "")
+ message(FATAL_ERROR "REMOTE can't be empty")
+endif()
+
+if(EXISTS "@LOCAL@")
+ check_file_hash(has_hash hash_is_good)
+ if(has_hash)
+ if(hash_is_good)
+ message(STATUS "File already exists and hash match (skip download):
+ file='@LOCAL@'
+ @ALGO@='@EXPECT_VALUE@'"
+ )
+ return()
+ else()
+ message(STATUS "File already exists but hash mismatch. Removing...")
+ file(REMOVE "@LOCAL@")
+ endif()
+ else()
+ message(STATUS "File already exists but no hash specified (use URL_HASH):
+ file='@LOCAL@'
+Old file will be removed and new file downloaded from URL."
+ )
+ file(REMOVE "@LOCAL@")
+ endif()
+endif()
+
+set(retry_number 5)
+
+foreach(i RANGE ${retry_number})
+ sleep_before_download(${i})
+
+ message(STATUS "downloading...
+ src='@REMOTE@'
+ dst='@LOCAL@'
+ timeout='@TIMEOUT_MSG@'")
+
+ @TLS_VERIFY_CODE@
+ @TLS_CAINFO_CODE@
+
+ file(
+ DOWNLOAD
+ "@REMOTE@" "@LOCAL@"
+ @SHOW_PROGRESS@
+ @TIMEOUT_ARGS@
+ STATUS status
+ LOG log
+ )
+
+ list(GET status 0 status_code)
+ list(GET status 1 status_string)
+
+ if(status_code EQUAL 0)
+ check_file_hash(has_hash hash_is_good)
+ if(has_hash AND NOT hash_is_good)
+ message(STATUS "Hash mismatch, removing...")
+ file(REMOVE "@LOCAL@")
+ else()
+ message(STATUS "Downloading... done")
+ return()
+ endif()
+ else()
+ message("error: downloading '@REMOTE@' failed
+ status_code: ${status_code}
+ status_string: ${status_string}
+ log:
+ --- LOG BEGIN ---
+ ${log}
+ --- LOG END ---"
+ )
+ endif()
+endforeach()
+
+message(FATAL_ERROR "Downloading failed")
diff --git a/Modules/ExternalProject-verify.cmake.in b/Modules/ExternalProject-verify.cmake.in
new file mode 100644
index 0000000..1d8db96
--- /dev/null
+++ b/Modules/ExternalProject-verify.cmake.in
@@ -0,0 +1,48 @@
+#=============================================================================
+# Copyright 2008-2013 Kitware, Inc.
+# Copyright 2016 Ruslan Baratov
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+cmake_minimum_required(VERSION 3.5)
+
+if("@LOCAL@" STREQUAL "")
+ message(FATAL_ERROR "LOCAL can't be empty")
+endif()
+
+if(NOT EXISTS "@LOCAL@")
+ message(FATAL_ERROR "File not found: @LOCAL@")
+endif()
+
+if("@ALGO@" STREQUAL "")
+ message(WARNING "File will not be verified since no URL_HASH specified")
+ return()
+endif()
+
+if("@EXPECT_VALUE@" STREQUAL "")
+ message(FATAL_ERROR "EXPECT_VALUE can't be empty")
+endif()
+
+message(STATUS "verifying file...
+ file='@LOCAL@'")
+
+file("@ALGO@" "@LOCAL@" actual_value)
+
+if(NOT "${actual_value}" STREQUAL "@EXPECT_VALUE@")
+ message(FATAL_ERROR "error: @ALGO@ hash of
+ @LOCAL@
+does not match expected value
+ expected: '@EXPECT_VALUE@'
+ actual: '${actual_value}'
+")
+endif()
+
+message(STATUS "verifying file... done")
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 7dad6e5..2ff18fc 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -377,6 +377,7 @@ file::
#=============================================================================
# Copyright 2008-2013 Kitware, Inc.
+# Copyright 2016 Ruslan Baratov
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -418,6 +419,9 @@ endif()
set(_ep_hash_algos "MD5|SHA1|SHA224|SHA256|SHA384|SHA512")
set(_ep_hash_regex "^(${_ep_hash_algos})=([0-9A-Fa-f]+)$")
+set(_ExternalProject_SELF "${CMAKE_CURRENT_LIST_FILE}")
+get_filename_component(_ExternalProject_SELF_DIR "${_ExternalProject_SELF}" PATH)
+
function(_ep_parse_arguments f name ns args)
# Transfer the arguments to this function into target properties for the
# new custom target we just added so that we can set up all the build steps
@@ -847,43 +851,38 @@ endif()
endfunction(_ep_write_gitupdate_script)
-function(_ep_write_downloadfile_script script_filename remote local timeout no_progress hash tls_verify tls_cainfo)
+function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo)
if(timeout)
- set(timeout_args TIMEOUT ${timeout})
- set(timeout_msg "${timeout} seconds")
+ set(TIMEOUT_ARGS TIMEOUT ${timeout})
+ set(TIMEOUT_MSG "${timeout} seconds")
else()
- set(timeout_args "# no TIMEOUT")
- set(timeout_msg "none")
+ set(TIMEOUT_ARGS "# no TIMEOUT")
+ set(TIMEOUT_MSG "none")
endif()
if(no_progress)
- set(show_progress "")
+ set(SHOW_PROGRESS "")
else()
- set(show_progress "SHOW_PROGRESS")
+ set(SHOW_PROGRESS "SHOW_PROGRESS")
endif()
if("${hash}" MATCHES "${_ep_hash_regex}")
- string(CONCAT hash_check
- "if(EXISTS \"${local}\")\n"
- " file(\"${CMAKE_MATCH_1}\" \"${local}\" hash_value)\n"
- " if(\"x\${hash_value}\" STREQUAL \"x${CMAKE_MATCH_2}\")\n"
- " return()\n"
- " endif()\n"
- "endif()\n"
- )
+ set(ALGO "${CMAKE_MATCH_1}")
+ set(EXPECT_VALUE "${CMAKE_MATCH_2}")
else()
- set(hash_check "")
+ set(ALGO "")
+ set(EXPECT_VALUE "")
endif()
- set(tls_verify_code "")
- set(tls_cainfo_code "")
+ set(TLS_VERIFY_CODE "")
+ set(TLS_CAINFO_CODE "")
# check for curl globals in the project
if(DEFINED CMAKE_TLS_VERIFY)
- set(tls_verify_code "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})")
+ set(TLS_VERIFY_CODE "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})")
endif()
if(DEFINED CMAKE_TLS_CAINFO)
- set(tls_cainfo_code "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")")
+ set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")")
endif()
# now check for curl locals so that the local values
@@ -892,91 +891,49 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p
# check for tls_verify argument
string(LENGTH "${tls_verify}" tls_verify_len)
if(tls_verify_len GREATER 0)
- set(tls_verify_code "set(CMAKE_TLS_VERIFY ${tls_verify})")
+ set(TLS_VERIFY_CODE "set(CMAKE_TLS_VERIFY ${tls_verify})")
endif()
# check for tls_cainfo argument
string(LENGTH "${tls_cainfo}" tls_cainfo_len)
if(tls_cainfo_len GREATER 0)
- set(tls_cainfo_code "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")")
- endif()
-
- file(WRITE ${script_filename}
-"${hash_check}message(STATUS \"downloading...
- src='${remote}'
- dst='${local}'
- timeout='${timeout_msg}'\")
-
-${tls_verify_code}
-${tls_cainfo_code}
-
-file(DOWNLOAD
- \"${remote}\"
- \"${local}\"
- ${show_progress}
- ${timeout_args}
- STATUS status
- LOG log)
-
-list(GET status 0 status_code)
-list(GET status 1 status_string)
-
-if(NOT status_code EQUAL 0)
- message(FATAL_ERROR \"error: downloading '${remote}' failed
- status_code: \${status_code}
- status_string: \${status_string}
- log: \${log}
-\")
-endif()
-
-message(STATUS \"downloading... done\")
-"
-)
-
+ set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")")
+ endif()
+
+ # Used variables:
+ # * TLS_VERIFY_CODE
+ # * TLS_CAINFO_CODE
+ # * ALGO
+ # * EXPECT_VALUE
+ # * REMOTE
+ # * LOCAL
+ # * SHOW_PROGRESS
+ # * TIMEOUT_ARGS
+ # * TIMEOUT_MSG
+ configure_file(
+ "${_ExternalProject_SELF_DIR}/ExternalProject-download.cmake.in"
+ "${script_filename}"
+ @ONLY
+ )
endfunction()
-
-function(_ep_write_verifyfile_script script_filename local hash retries download_script)
+function(_ep_write_verifyfile_script script_filename LOCAL hash)
if("${hash}" MATCHES "${_ep_hash_regex}")
- set(algo "${CMAKE_MATCH_1}")
- string(TOLOWER "${CMAKE_MATCH_2}" expect_value)
- set(script_content "set(expect_value \"${expect_value}\")
-set(attempt 0)
-set(succeeded 0)
-while(\${attempt} LESS ${retries} OR \${attempt} EQUAL ${retries} AND NOT \${succeeded})
- file(${algo} \"\${file}\" actual_value)
- if(\"\${actual_value}\" STREQUAL \"\${expect_value}\")
- set(succeeded 1)
- elseif(\${attempt} LESS ${retries})
- message(STATUS \"${algo} hash of \${file}
-does not match expected value
- expected: \${expect_value}
- actual: \${actual_value}
-Retrying download.
-\")
- file(REMOVE \"\${file}\")
- execute_process(COMMAND \${CMAKE_COMMAND} -P \"${download_script}\")
- endif()
- math(EXPR attempt \"\${attempt} + 1\")
-endwhile()
-
-if(\${succeeded})
- message(STATUS \"verifying file... done\")
-else()
- message(FATAL_ERROR \"error: ${algo} hash of
- \${file}
-does not match expected value
- expected: \${expect_value}
- actual: \${actual_value}
-\")
-endif()")
+ set(ALGO "${CMAKE_MATCH_1}")
+ string(TOLOWER "${CMAKE_MATCH_2}" EXPECT_VALUE)
else()
- set(script_content "message(STATUS \"verifying file... warning: did not verify file - no URL_HASH specified?\")")
+ set(ALGO "")
+ set(EXPECT_VALUE "")
endif()
- file(WRITE ${script_filename} "set(file \"${local}\")
-message(STATUS \"verifying file...
- file='\${file}'\")
-${script_content}
-")
+
+ # Used variables:
+ # * ALGO
+ # * EXPECT_VALUE
+ # * LOCAL
+ configure_file(
+ "${_ExternalProject_SELF_DIR}/ExternalProject-verify.cmake.in"
+ "${script_filename}"
+ @ONLY
+ )
endfunction()
@@ -1898,8 +1855,6 @@ function(_ep_add_download_command name)
set(repository "external project URL")
set(module "${url}")
set(tag "${hash}")
- set(retries 0)
- set(download_script "")
configure_file(
"${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
"${stamp_dir}/${name}-urlinfo.txt"
@@ -1937,13 +1892,13 @@ function(_ep_add_download_command name)
_ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}")
set(cmd ${CMAKE_COMMAND} -P "${download_script}"
COMMAND)
- set(retries 3)
if (no_extract)
set(steps "download and verify")
else ()
set(steps "download, verify and extract")
endif ()
set(comment "Performing download step (${steps}) for '${name}'")
+ file(WRITE "${stamp_dir}/verify-${name}.cmake" "") # already verified by 'download_script'
else()
set(file "${url}")
if (no_extract)
@@ -1952,8 +1907,8 @@ function(_ep_add_download_command name)
set(steps "verify and extract")
endif ()
set(comment "Performing download step (${steps}) for '${name}'")
+ _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}")
endif()
- _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}" "${retries}" "${download_script}")
list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake
COMMAND)
if (NOT no_extract)
@@ -2030,6 +1985,9 @@ function(_ep_add_update_command name)
if(cmd_set)
set(work_dir ${source_dir})
+ if(NOT "x${cmd}" STREQUAL "x")
+ set(always 1)
+ endif()
elseif(cvs_repository)
if(NOT CVS_EXECUTABLE)
message(FATAL_ERROR "error: could not find cvs for update of ${name}")
@@ -2063,6 +2021,8 @@ function(_ep_add_update_command name)
--non-interactive ${svn_trust_cert_args} ${svn_user_pw_args})
set(always 1)
elseif(git_repository)
+ unset(CMAKE_MODULE_PATH) # Use CMake builtin find module
+ find_package(Git QUIET)
if(NOT GIT_EXECUTABLE)
message(FATAL_ERROR "error: could not find git for fetch of ${name}")
endif()
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 4f52d25..48bb554 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -264,6 +264,7 @@
# CUDA_VERSION_MINOR -- The minor version.
# CUDA_VERSION
# CUDA_VERSION_STRING -- CUDA_VERSION_MAJOR.CUDA_VERSION_MINOR
+# CUDA_HAS_FP16 -- Whether a short float (float16,fp16) is supported.
#
# CUDA_TOOLKIT_ROOT_DIR -- Path to the CUDA Toolkit (defined if not set).
# CUDA_SDK_ROOT_DIR -- Path to the CUDA SDK. Use this to find files in the
@@ -548,6 +549,7 @@ macro(cuda_unset_include_and_libraries)
endif()
unset(CUDA_cudart_static_LIBRARY CACHE)
unset(CUDA_cublas_LIBRARY CACHE)
+ unset(CUDA_cublas_device_LIBRARY CACHE)
unset(CUDA_cublasemu_LIBRARY CACHE)
unset(CUDA_cufft_LIBRARY CACHE)
unset(CUDA_cufftemu_LIBRARY CACHE)
@@ -683,6 +685,12 @@ find_path(CUDA_TOOLKIT_INCLUDE
find_path(CUDA_TOOLKIT_INCLUDE device_functions.h)
mark_as_advanced(CUDA_TOOLKIT_INCLUDE)
+if (CUDA_VERSION VERSION_GREATER "7.0" OR EXISTS "${CUDA_TOOLKIT_INCLUDE}/cuda_fp16.h")
+ set(CUDA_HAS_FP16 TRUE)
+else()
+ set(CUDA_HAS_FP16 FALSE)
+endif()
+
# Set the user list of include dir to nothing to initialize it.
set (CUDA_NVCC_INCLUDE_ARGS_USER "")
set (CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE})
@@ -847,6 +855,7 @@ if(NOT CUDA_VERSION VERSION_LESS "3.2")
endif()
endif()
if(CUDA_VERSION VERSION_GREATER "5.0")
+ find_cuda_helper_libs(cublas_device)
# In CUDA 5.5 NPP was splitted onto 3 separate libraries.
find_cuda_helper_libs(nppc)
find_cuda_helper_libs(nppi)
@@ -865,7 +874,7 @@ if (CUDA_BUILD_EMULATION)
set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublasemu_LIBRARY})
else()
set(CUDA_CUFFT_LIBRARIES ${CUDA_cufft_LIBRARY})
- set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublas_LIBRARY})
+ set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublas_LIBRARY} ${CUDA_cublas_device_LIBRARY})
endif()
########################
@@ -1388,7 +1397,8 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(cmake_dependency_file "${cuda_compile_intermediate_directory}/${generated_file_basename}.depend")
set(NVCC_generated_dependency_file "${cuda_compile_intermediate_directory}/${generated_file_basename}.NVCC-depend")
set(generated_cubin_file "${generated_file_path}/${generated_file_basename}.cubin.txt")
- set(custom_target_script "${cuda_compile_intermediate_directory}/${generated_file_basename}.cmake")
+ set(custom_target_script_pregen "${cuda_compile_intermediate_directory}/${generated_file_basename}.cmake.pre-gen")
+ set(custom_target_script "${cuda_compile_intermediate_directory}/${generated_file_basename}$<$<BOOL:$<CONFIG>>:.$<CONFIG>>.cmake")
# Setup properties for obj files:
if( NOT cuda_compile_to_external_module )
@@ -1429,7 +1439,11 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
endif()
# Configure the build script
- configure_file("${CUDA_run_nvcc}" "${custom_target_script}" @ONLY)
+ configure_file("${CUDA_run_nvcc}" "${custom_target_script_pregen}" @ONLY)
+ file(GENERATE
+ OUTPUT "${custom_target_script}"
+ INPUT "${custom_target_script_pregen}"
+ )
# So if a user specifies the same cuda file as input more than once, you
# can have bad things happen with dependencies. Here we check an option
@@ -1791,7 +1805,7 @@ macro(CUDA_ADD_CUBLAS_TO_TARGET target)
if (CUDA_BUILD_EMULATION)
target_link_libraries(${target} ${CUDA_cublasemu_LIBRARY})
else()
- target_link_libraries(${target} ${CUDA_cublas_LIBRARY})
+ target_link_libraries(${target} ${CUDA_cublas_LIBRARY} ${CUDA_cublas_device_LIBRARY})
endif()
endmacro()
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index f589977..b074f63 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -345,7 +345,7 @@ macro( _HDF5_parse_compile_line
endmacro()
# Try to find HDF5 using an installed hdf5-config.cmake
-if(NOT HDF5_ROOT AND NOT HDF5_FOUND)
+if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
find_package(HDF5 QUIET NO_MODULE)
if( HDF5_FOUND)
set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
@@ -362,27 +362,42 @@ if(NOT HDF5_ROOT AND NOT HDF5_FOUND)
set(_suffix "-shared")
endif()
foreach(_lang ${HDF5_LANGUAGE_BINDINGS})
- get_target_property(_lang_location ${HDF5_${_component}_TARGET}${_suffix} LOCATION)
+
+ #Older versions of hdf5 don't have a static/shared suffix so
+ #if we detect that occurrence clear the suffix
+ if(_suffix AND NOT TARGET ${HDF5_${_lang}_TARGET}${_suffix})
+ if(NOT TARGET ${HDF5_${_lang}_TARGET})
+ #cant find this component with our without the suffix
+ #so bail out, and let the following locate HDF5
+ set(HDF5_FOUND FALSE)
+ break()
+ endif()
+ set(_suffix "")
+ endif()
+
+ get_target_property(_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION)
if( _lang_location )
set(HDF5_${_lang}_LIBRARY ${_lang_location} CACHE PATH
"HDF5 ${_lang} library" )
mark_as_advanced(HDF5_${_lang}_LIBRARY)
list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_LIBRARY})
+ set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_LIBRARY})
endif()
if(FIND_HL)
get_target_property(_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION)
- if( _lang_location )
- set(HDF5_${_lang}_HL_LIBRARY ${_lang_location} CACHE PATH
+ if( _lang_hl_location )
+ set(HDF5_${_lang}_HL_LIBRARY ${_lang_hl_location} CACHE PATH
"HDF5 ${_lang} HL library" )
- mark_as_advanced(HDF5_${_lang}_LIBRARY)
+ mark_as_advanced(HDF5_${_lang}_HL_LIBRARY)
list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_HL_LIBRARY})
+ set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_HL_LIBRARY})
endif()
endif()
endforeach()
endif()
endif()
-if(NOT HDF5_ROOT AND NOT HDF5_FOUND)
+if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
set(_HDF5_NEED_TO_SEARCH False)
set(HDF5_COMPILER_NO_INTERROGATE True)
# Only search for languages we've enabled
@@ -411,6 +426,8 @@ if(NOT HDF5_ROOT AND NOT HDF5_FOUND)
set(HDF5_${__lang}_DEFINITIONS)
set(HDF5_${__lang}_INCLUDE_DIRS)
set(HDF5_${__lang}_LIBRARIES)
+ set(HDF5_${__lang}_HL_LIBRARIES)
+
mark_as_advanced(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE)
mark_as_advanced(HDF5_${__lang}_DEFINITIONS)
mark_as_advanced(HDF5_${__lang}_INCLUDE_DIRS)
@@ -488,12 +505,12 @@ else()
set(_HDF5_NEED_TO_SEARCH True)
endif()
-if(HDF5_COMPILER_NO_INTERROGATE)
+if(NOT HDF5_FOUND AND HDF5_COMPILER_NO_INTERROGATE)
# No arguments necessary, all languages can use the compiler wrappers
set(HDF5_FOUND True)
set(HDF5_METHOD "Included by compiler wrappers")
set(HDF5_REQUIRED_VARS HDF5_METHOD)
-elseif(NOT _HDF5_NEED_TO_SEARCH)
+elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH)
# Compiler wrappers aren't being used by the build but were found and used
# to determine necessary include and library flags
set(HDF5_INCLUDE_DIRS)
@@ -680,6 +697,13 @@ if( NOT HDF5_FOUND )
endif()
endif()
+# If HDF5_REQUIRED_VARS is empty at this point, then it's likely that
+# something external is trying to explicitly pass already found
+# locations
+if(NOT HDF5_REQUIRED_VARS)
+ set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
+endif()
+
find_package_handle_standard_args(HDF5
REQUIRED_VARS ${HDF5_REQUIRED_VARS}
VERSION_VAR HDF5_VERSION
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake
index 471a4f1..dd93041 100644
--- a/Modules/FindLibArchive.cmake
+++ b/Modules/FindLibArchive.cmake
@@ -42,14 +42,15 @@ mark_as_advanced(LibArchive_INCLUDE_DIR LibArchive_LIBRARY)
# Extract the version number from the header.
if(LibArchive_INCLUDE_DIR AND EXISTS "${LibArchive_INCLUDE_DIR}/archive.h")
- # The version string appears in one of two known formats in the header:
+ # The version string appears in one of three known formats in the header:
# #define ARCHIVE_LIBRARY_VERSION "libarchive 2.4.12"
# #define ARCHIVE_VERSION_STRING "libarchive 2.8.4"
- # Match either format.
- set(_LibArchive_VERSION_REGEX "^#define[ \t]+ARCHIVE[_A-Z]+VERSION[_A-Z]*[ \t]+\"libarchive +([0-9]+)\\.([0-9]+)\\.([0-9]+)[^\"]*\".*$")
+ # #define ARCHIVE_VERSION_ONLY_STRING "3.2.0"
+ # Match any format.
+ set(_LibArchive_VERSION_REGEX "^#define[ \t]+ARCHIVE[_A-Z]+VERSION[_A-Z]*[ \t]+\"(libarchive +)?([0-9]+)\\.([0-9]+)\\.([0-9]+)[^\"]*\".*$")
file(STRINGS "${LibArchive_INCLUDE_DIR}/archive.h" _LibArchive_VERSION_STRING LIMIT_COUNT 1 REGEX "${_LibArchive_VERSION_REGEX}")
if(_LibArchive_VERSION_STRING)
- string(REGEX REPLACE "${_LibArchive_VERSION_REGEX}" "\\1.\\2.\\3" LibArchive_VERSION "${_LibArchive_VERSION_STRING}")
+ string(REGEX REPLACE "${_LibArchive_VERSION_REGEX}" "\\2.\\3.\\4" LibArchive_VERSION "${_LibArchive_VERSION_STRING}")
endif()
unset(_LibArchive_VERSION_REGEX)
unset(_LibArchive_VERSION_STRING)
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 8aa0c11..956dad2 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -229,6 +229,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS)
endif()
set(MATLAB_VERSIONS_MAPPING
+ "R2016a=9.0"
"R2015b=8.6"
"R2015a=8.5"
"R2014b=8.4"
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 644687c..b79e9df 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -591,12 +591,14 @@ endmacro()
XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
#]========================================]
macro(pkg_check_modules _prefix _module0)
+ _pkgconfig_parse_options(_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
- _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
_pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+ elseif (${_prefix}_FOUND AND ${_imp_target})
+ _pkg_create_imp_target("${_prefix}" _no_cmake_path _no_cmake_environment_path)
endif()
endmacro()
@@ -619,10 +621,10 @@ endmacro()
pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
#]========================================]
macro(pkg_search_module _prefix _module0)
+ _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
set(_pkg_modules_found 0)
- _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
if (NOT ${_pkg_is_silent})
message(STATUS "Checking for one of the modules '${_pkg_modules_alt}'")
@@ -646,6 +648,8 @@ macro(pkg_search_module _prefix _module0)
endif()
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+ elseif (${_prefix}_FOUND AND ${_imp_target})
+ _pkg_create_imp_target("${_prefix}" _no_cmake_path _no_cmake_environment_path)
endif()
endmacro()
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 11091b5..d167a13 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -240,6 +240,8 @@
# The QAxServer target (Windows only)
# ``Qt4::QtDBus``
# The QtDBus target
+# ``Qt4::QtDeclarative``
+# The QtDeclarative target
# ``Qt4::QtDesigner``
# The QtDesigner target
# ``Qt4::QtDesignerComponents``
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index dd294f4..aa5bf28 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -663,20 +663,27 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
endif()
set(gp_cmd_paths ${gp_cmd_paths}
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]/../../VC/bin"
"$ENV{VS140COMNTOOLS}/../../VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]/../../VC/bin"
"$ENV{VS120COMNTOOLS}/../../VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]/../../VC/bin"
"$ENV{VS110COMNTOOLS}/../../VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]/../../VC/bin"
"$ENV{VS100COMNTOOLS}/../../VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]/../../VC/bin"
"$ENV{VS90COMNTOOLS}/../../VC/bin"
"C:/Program Files/Microsoft Visual Studio 9.0/VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../VC/bin"
"$ENV{VS80COMNTOOLS}/../../VC/bin"
"C:/Program Files/Microsoft Visual Studio 8/VC/BIN"
"C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1;InstallDir]/../../VC7/bin"
"$ENV{VS71COMNTOOLS}/../../VC7/bin"
"C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN"
"C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN"
@@ -739,7 +746,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(gp_regex_error "")
set(gp_regex_fallback "")
set(gp_regex_cmp_count 1)
- # objdump generaates copious output so we create a grep filter to pre-filter results
+ # objdump generates copious output so we create a grep filter to pre-filter results
find_program(gp_grep_cmd grep)
if(gp_grep_cmd)
set(gp_cmd_maybe_filter COMMAND ${gp_grep_cmd} "^[[:blank:]]*DLL Name: ")
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index aa84077..1c6e751 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -25,8 +25,8 @@
#
# ``CMAKE_INSTALL_UCRT_LIBRARIES``
# Set to TRUE to install the Windows Universal CRT libraries for
-# app-local deployment. This is meaningful only with MSVC from
-# Visual Studio 2015 or higher.
+# app-local deployment (e.g. to Windows XP). This is meaningful
+# only with MSVC from Visual Studio 2015 or higher.
#
# ``CMAKE_INSTALL_MFC_LIBRARIES``
# Set to TRUE to install the MSVC MFC runtime libraries.
diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake
index 58c6483..551a995 100644
--- a/Modules/Platform/AIX.cmake
+++ b/Modules/Platform/AIX.cmake
@@ -8,7 +8,9 @@ set(CMAKE_DL_LIBS "-lld")
# -Wl,-blibpath:/usr/lib:/lib whether RPATH support is on or not.
# When our own RPATH is to be added it may be inserted before the
# "always" paths.
-set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib)
+if(NOT DEFINED CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH)
+ set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib)
+endif()
# Files named "libfoo.a" may actually be shared libraries.
set_property(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1)
diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake
index a08411b..91c2cf3 100644
--- a/Modules/Platform/Darwin-Initialize.cmake
+++ b/Modules/Platform/Darwin-Initialize.cmake
@@ -90,16 +90,6 @@ elseif("${CMAKE_GENERATOR}" MATCHES Xcode
endif()
endforeach()
- if(CMAKE_OSX_DEPLOYMENT_TARGET AND
- NOT CMAKE_OSX_DEPLOYMENT_TARGET VERSION_EQUAL ${_CMAKE_OSX_DEPLOYMENT_TARGET})
- set(_CMAKE_OSX_SDKS_VER ${CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${CMAKE_OSX_DEPLOYMENT_TARGET}})
- set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
- message(WARNING
- "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
- "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n"
- "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"."
- )
- endif()
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET AND _CURRENT_OSX_VERSION VERSION_LESS _CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET ${_CURRENT_OSX_VERSION} CACHE STRING
"Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value." FORCE)
diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake
index 88932ad..9572a7e 100644
--- a/Modules/Platform/HP-UX.cmake
+++ b/Modules/Platform/HP-UX.cmake
@@ -1,4 +1,6 @@
-set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib)
+if(NOT DEFINED CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH)
+ set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib)
+endif()
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "ia64")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so
diff --git a/Modules/Platform/SunOS-PathScale-C.cmake b/Modules/Platform/SunOS-PathScale-C.cmake
new file mode 100644
index 0000000..2f78da1
--- /dev/null
+++ b/Modules/Platform/SunOS-PathScale-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/SunOS-PathScale)
+__sunos_compiler_pathscale(C)
diff --git a/Modules/Platform/SunOS-PathScale-CXX.cmake b/Modules/Platform/SunOS-PathScale-CXX.cmake
new file mode 100644
index 0000000..bb79d86
--- /dev/null
+++ b/Modules/Platform/SunOS-PathScale-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/SunOS-PathScale)
+__sunos_compiler_pathscale(CXX)
diff --git a/Modules/Platform/SunOS-PathScale-Fortran.cmake b/Modules/Platform/SunOS-PathScale-Fortran.cmake
new file mode 100644
index 0000000..3c202f7
--- /dev/null
+++ b/Modules/Platform/SunOS-PathScale-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/SunOS-PathScale)
+__sunos_compiler_pathscale(Fortran)
diff --git a/Modules/Platform/SunOS-PathScale.cmake b/Modules/Platform/SunOS-PathScale.cmake
new file mode 100644
index 0000000..1afe56a
--- /dev/null
+++ b/Modules/Platform/SunOS-PathScale.cmake
@@ -0,0 +1,31 @@
+
+#=============================================================================
+# Copyright 2016 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__SUNOS_COMPILER_PATHSCALE)
+ return()
+endif()
+set(__SUNOS_COMPILER_PATHSCALE 1)
+
+macro(__sunos_compiler_pathscale lang)
+ # Shared library compile and link flags.
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-R")
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
+ set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-h")
+endmacro()
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 1920a7c..6c254ed 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -305,7 +305,7 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-D_DEBUG /MDd -gline-tables-only -fno-inline -O0 ${_RTC1}")
set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD -O2 -DNDEBUG")
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD -gline-tables-only -O2 -fno-inline -DNDEBUG")
- set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD -Os -DNDEBUG")
+ set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD -DNDEBUG") # TODO: Add '-Os' once VS generator maps it properly for Clang
else()
set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}")
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index b59fe34..7b3416e 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -169,7 +169,7 @@
#
# ::
#
-# The add_jar() functions sets some target properties. You can get these
+# The add_jar() function sets some target properties. You can get these
# properties with the
# get_property(TARGET <target_name> PROPERTY <propery_name>)
# command.
diff --git a/Packaging/CMakeDMGSetup.scpt b/Packaging/CMakeDMGSetup.scpt
index c7ddcfb..37e7bd1 100644
--- a/Packaging/CMakeDMGSetup.scpt
+++ b/Packaging/CMakeDMGSetup.scpt
@@ -4,6 +4,21 @@ on run argv
tell application "Finder"
tell disk image_name
+ -- wait for the image to finish mounting
+ set open_attempts to 0
+ repeat while open_attempts < 4
+ try
+ open
+ delay 1
+ set open_attempts to 5
+ close
+ on error errStr number errorNumber
+ set open_attempts to open_attempts + 1
+ delay 10
+ end try
+ end repeat
+ delay 5
+
-- open the image the first time and save a DS_Store with just
-- background and icon setup
open
@@ -12,7 +27,7 @@ on run argv
set background picture of theViewOptions to file ".background:background.tif"
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 128
- delay 1
+ delay 5
close
-- next setup the position of the app and Applications symlink
@@ -28,7 +43,7 @@ on run argv
set position of item "Applications" to { 378, 200 }
end tell
update without registering applications
- delay 1
+ delay 5
close
-- one last open and close so you can see everything looks correct
diff --git a/README.rst b/README.rst
index 9599a04..4188ea0 100644
--- a/README.rst
+++ b/README.rst
@@ -89,7 +89,7 @@ If you have found a bug:
3. Finally, if the issue is not resolved by the above steps, open
an entry in the `CMake Issue Tracker`_.
-.. _`CMake Issue Tracker`: https://cmake.org/Bug
+.. _`CMake Issue Tracker`: https://gitlab.kitware.com/cmake/cmake/issues
Contributing
============
diff --git a/Source/.gitattributes b/Source/.gitattributes
index cf4dabd..bd25ea8 100644
--- a/Source/.gitattributes
+++ b/Source/.gitattributes
@@ -1,2 +1,5 @@
# Preserve upstream indentation style.
cm_sha2.* whitespace=indent-with-non-tab
+
+# Preserve indentation style in generated code.
+cmListFileLexer.c whitespace=-tab-in-indent,-indent-with-non-tab
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 467b692..3223831 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -662,6 +662,7 @@ set(CPACK_SRCS
CPack/cmCPackNSISGenerator.cxx
CPack/IFW/cmCPackIFWPackage.cxx
CPack/IFW/cmCPackIFWInstaller.cxx
+ CPack/IFW/cmCPackIFWRepository.cxx
CPack/IFW/cmCPackIFWGenerator.cxx
CPack/cmCPackSTGZGenerator.cxx
CPack/cmCPackTGZGenerator.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 1eadf3f..c782c5d 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 5)
-set(CMake_VERSION_PATCH 20160517)
-#set(CMake_VERSION_RC 1)
+set(CMake_VERSION_MINOR 6)
+set(CMake_VERSION_PATCH 0)
+set(CMake_VERSION_RC 4)
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index 2c25f43..c1ff526 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -12,9 +12,6 @@
#include "cmCPackIFWGenerator.h"
-#include "cmCPackIFWInstaller.h"
-#include "cmCPackIFWPackage.h"
-
#include <CPack/cmCPackComponentGroup.h>
#include <CPack/cmCPackLog.h>
@@ -72,7 +69,7 @@ int cmCPackIFWGenerator::PackageFiles()
ifwTmpFile += "/IFWOutput.log";
// Run repogen
- if (!Installer.Repositories.empty()) {
+ if (!Installer.RemoteRepositories.empty()) {
std::string ifwCmd = RepoGen;
if (IsVersionLess("2.0.0")) {
@@ -117,6 +114,14 @@ int cmCPackIFWGenerator::PackageFiles()
<< std::endl);
return 0;
}
+
+ if (!Repository.RepositoryUpdate.empty() &&
+ !Repository.PatchUpdatesXml()) {
+ cmCPackLogger(cmCPackLog::LOG_WARNING, "Problem patch IFW \"Updates\" "
+ << "file: " << this->toplevel + "/repository/Updates.xml"
+ << std::endl);
+ }
+
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- repository: "
<< this->toplevel << "/repository generated" << std::endl);
}
@@ -137,7 +142,7 @@ int cmCPackIFWGenerator::PackageFiles()
if (OnlineOnly) {
ifwCmd += " --online-only";
} else if (!DownloadedPackages.empty() &&
- !Installer.Repositories.empty()) {
+ !Installer.RemoteRepositories.empty()) {
ifwCmd += " -e ";
std::set<cmCPackIFWPackage*>::iterator it = DownloadedPackages.begin();
ifwCmd += (*it)->Name;
@@ -272,6 +277,24 @@ int cmCPackIFWGenerator::InitializeInternal()
Installer.Generator = this;
Installer.ConfigureFromOptions();
+ // Repository
+ Repository.Generator = this;
+ Repository.Name = "Unspecified";
+ if (const char* site = this->GetOption("CPACK_DOWNLOAD_SITE")) {
+ Repository.Url = site;
+ Installer.RemoteRepositories.push_back(&Repository);
+ }
+
+ // Repositories
+ if (const char* RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) {
+ std::vector<std::string> RepoAllVector;
+ cmSystemTools::ExpandListArgument(RepoAllStr, RepoAllVector);
+ for (std::vector<std::string>::iterator rit = RepoAllVector.begin();
+ rit != RepoAllVector.end(); ++rit) {
+ GetRepository(*rit);
+ }
+ }
+
if (const char* ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) {
OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll);
} else if (const char* cpackDownloadAll =
@@ -281,7 +304,7 @@ int cmCPackIFWGenerator::InitializeInternal()
OnlineOnly = false;
}
- if (!Installer.Repositories.empty() && RepoGen.empty()) {
+ if (!Installer.RemoteRepositories.empty() && RepoGen.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find QtIFW repository generator \"repogen\": "
"likely it is not installed, or not in your PATH"
@@ -507,6 +530,33 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
return pit != ComponentPackages.end() ? pit->second : 0;
}
+cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
+ const std::string& repositoryName)
+{
+ RepositoriesMap::iterator rit = Repositories.find(repositoryName);
+ if (rit != Repositories.end())
+ return &(rit->second);
+
+ cmCPackIFWRepository* repository = &Repositories[repositoryName];
+ repository->Name = repositoryName;
+ repository->Generator = this;
+ if (repository->ConfigureFromOptions()) {
+ if (repository->Update == cmCPackIFWRepository::None) {
+ Installer.RemoteRepositories.push_back(repository);
+ } else {
+ Repository.RepositoryUpdate.push_back(repository);
+ }
+ } else {
+ Repositories.erase(repositoryName);
+ repository = 0;
+ cmCPackLogger(cmCPackLog::LOG_WARNING, "Invalid repository \""
+ << repositoryName << "\""
+ << " configuration. Repository will be skipped."
+ << std::endl);
+ }
+ return repository;
+}
+
void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
std::stringstream comment;
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index d8cc562..2b35749 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -17,6 +17,7 @@
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
+#include "cmCPackIFWRepository.h"
class cmXMLWriter;
@@ -31,6 +32,7 @@ public:
cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator);
typedef std::map<std::string, cmCPackIFWPackage> PackagesMap;
+ typedef std::map<std::string, cmCPackIFWRepository> RepositoriesMap;
typedef std::map<std::string, cmCPackComponent> ComponentsMap;
typedef std::map<std::string, cmCPackComponentGroup> ComponentGoupsMap;
typedef std::map<std::string, cmCPackIFWPackage::DependenceStruct>
@@ -122,6 +124,8 @@ protected:
cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup* group) const;
cmCPackIFWPackage* GetComponentPackage(cmCPackComponent* component) const;
+ cmCPackIFWRepository* GetRepository(const std::string& repositoryName);
+
void WriteGeneratedByToStrim(cmXMLWriter& xout);
protected:
@@ -129,11 +133,16 @@ protected:
friend class cmCPackIFWPackage;
friend class cmCPackIFWInstaller;
+ friend class cmCPackIFWRepository;
// Installer
cmCPackIFWInstaller Installer;
+ // Repository
+ cmCPackIFWRepository Repository;
// Collection of packages
PackagesMap Packages;
+ // Collection of repositories
+ RepositoriesMap Repositories;
// Collection of binary packages
std::set<cmCPackIFWPackage*> BinaryPackages;
// Collection of downloaded packages
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index b9a9861..dfc509b 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -159,57 +159,6 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
AdminTargetDir = option;
}
- // Repositories
- Repositories.clear();
- RepositoryStruct Repo;
- if (const char* site = this->GetOption("CPACK_DOWNLOAD_SITE")) {
- Repo.Url = site;
- Repositories.push_back(Repo);
- }
- if (const char* RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) {
- std::vector<std::string> RepoAllVector;
- cmSystemTools::ExpandListArgument(RepoAllStr, RepoAllVector);
- for (std::vector<std::string>::iterator rit = RepoAllVector.begin();
- rit != RepoAllVector.end(); ++rit) {
- std::string prefix =
- "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(*rit) + "_";
- // Url
- if (const char* url = GetOption(prefix + "URL")) {
- Repo.Url = url;
- } else {
- Repo.Url = "";
- }
- // Enabled
- if (IsOn(prefix + "DISABLED")) {
- Repo.Enabled = "0";
- } else {
- Repo.Enabled = "";
- }
- // Username
- if (const char* username = GetOption(prefix + "USERNAME")) {
- Repo.Username = username;
- } else {
- Repo.Username = "";
- }
- // Password
- if (const char* password = GetOption(prefix + "PASSWORD")) {
- Repo.Password = password;
- } else {
- Repo.Password = "";
- }
- // DisplayName
- if (const char* displayName = GetOption(prefix + "DISPLAY_NAME")) {
- Repo.DisplayName = displayName;
- } else {
- Repo.DisplayName = "";
- }
-
- if (!Repo.Url.empty()) {
- Repositories.push_back(Repo);
- }
- }
- }
-
// Maintenance tool
if (const char* optIFW_MAINTENANCE_TOOL =
this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME")) {
@@ -320,30 +269,11 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
}
// Remote repositories
- if (!Repositories.empty()) {
+ if (!RemoteRepositories.empty()) {
xout.StartElement("RemoteRepositories");
- for (std::vector<RepositoryStruct>::iterator rit = Repositories.begin();
- rit != Repositories.end(); ++rit) {
- xout.StartElement("Repository");
- // Url
- xout.Element("Url", rit->Url);
- // Enabled
- if (!rit->Enabled.empty()) {
- xout.Element("Enabled", rit->Enabled);
- }
- // Username
- if (!rit->Username.empty()) {
- xout.Element("Username", rit->Username);
- }
- // Password
- if (!rit->Password.empty()) {
- xout.Element("Password", rit->Password);
- }
- // DisplayName
- if (!rit->DisplayName.empty()) {
- xout.Element("DisplayName", rit->DisplayName);
- }
- xout.EndElement();
+ for (RepositoriesVector::iterator rit = RemoteRepositories.begin();
+ rit != RemoteRepositories.end(); ++rit) {
+ (*rit)->WriteRepositoryConfig(xout);
}
xout.EndElement();
}
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index 84a789e..3170116 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -17,6 +17,7 @@
class cmCPackIFWPackage;
class cmCPackIFWGenerator;
+class cmCPackIFWRepository;
class cmXMLWriter;
/** \class cmCPackIFWInstaller
@@ -28,15 +29,7 @@ public:
// Types
typedef std::map<std::string, cmCPackIFWPackage*> PackagesMap;
-
- struct RepositoryStruct
- {
- std::string Url;
- std::string Enabled;
- std::string Username;
- std::string Password;
- std::string DisplayName;
- };
+ typedef std::vector<cmCPackIFWRepository*> RepositoriesVector;
public:
// Constructor
@@ -115,7 +108,7 @@ public:
cmCPackIFWGenerator* Generator;
PackagesMap Packages;
- std::vector<RepositoryStruct> Repositories;
+ RepositoriesVector RemoteRepositories;
std::string Directory;
protected:
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index 5bc1a0b..ad153d1 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -56,13 +56,13 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct(
} else if ((pos = dependence.find(">=")) != std::string::npos) {
Compare.Type = CompareGreaterOrEqual;
Compare.Value = dependence.substr(pos + 2);
- } else if ((pos = dependence.find("<")) != std::string::npos) {
+ } else if ((pos = dependence.find('<')) != std::string::npos) {
Compare.Type = CompareLess;
Compare.Value = dependence.substr(pos + 1);
- } else if ((pos = dependence.find("=")) != std::string::npos) {
+ } else if ((pos = dependence.find('=')) != std::string::npos) {
Compare.Type = CompareEqual;
Compare.Value = dependence.substr(pos + 1);
- } else if ((pos = dependence.find(">")) != std::string::npos) {
+ } else if ((pos = dependence.find('>')) != std::string::npos) {
Compare.Type = CompareGreater;
Compare.Value = dependence.substr(pos + 1);
}
@@ -146,6 +146,7 @@ void cmCPackIFWPackage::DefaultConfiguration()
Licenses.clear();
SortingPriority = "";
Default = "";
+ Essential = "";
Virtual = "";
ForcedInstallation = "";
}
@@ -267,6 +268,11 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
// Default
Default = component->IsDisabledByDefault ? "false" : "true";
+ // Essential
+ if (this->IsOn(prefix + "ESSENTIAL")) {
+ Essential = "true";
+ }
+
// Virtual
Virtual = component->IsHidden ? "true" : "";
@@ -452,6 +458,11 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.Element("Default", Default);
}
+ // Essential
+ if (!Essential.empty()) {
+ xout.Element("Essential", Essential);
+ }
+
// Priority
if (!SortingPriority.empty()) {
xout.Element("SortingPriority", SortingPriority);
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
index 8a566cb..55b07ec 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.h
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -101,6 +101,9 @@ public:
/// Set to true to preselect the component in the installer
std::string Default;
+ /// Marks the package as essential to force a restart of the MaintenanceTool
+ std::string Essential;
+
/// Set to true to hide the component from the installer
std::string Virtual;
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
new file mode 100644
index 0000000..b149f81
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -0,0 +1,341 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ 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.
+============================================================================*/
+
+#include "cmCPackIFWRepository.h"
+
+#include "cmCPackIFWGenerator.h"
+
+#include <CPack/cmCPackLog.h>
+
+#include <cmGeneratedFileStream.h>
+#include <cmXMLParser.h>
+#include <cmXMLWriter.h>
+
+#ifdef cmCPackLogger
+#undef cmCPackLogger
+#endif
+#define cmCPackLogger(logType, msg) \
+ do { \
+ std::ostringstream cmCPackLog_msg; \
+ cmCPackLog_msg << msg; \
+ if (Generator) { \
+ Generator->Logger->Log(logType, __FILE__, __LINE__, \
+ cmCPackLog_msg.str().c_str()); \
+ } \
+ } while (0)
+
+cmCPackIFWRepository::cmCPackIFWRepository()
+ : Update(None)
+ , Generator(0)
+{
+}
+
+bool cmCPackIFWRepository::IsValid() const
+{
+ bool valid = true;
+
+ switch (Update) {
+ case None:
+ valid = Url.empty() ? false : true;
+ break;
+ case Add:
+ valid = Url.empty() ? false : true;
+ break;
+ case Remove:
+ valid = Url.empty() ? false : true;
+ break;
+ case Replace:
+ valid = (OldUrl.empty() || NewUrl.empty()) ? false : true;
+ break;
+ }
+
+ return valid;
+}
+
+const char* cmCPackIFWRepository::GetOption(const std::string& op) const
+{
+ return Generator ? Generator->GetOption(op) : 0;
+}
+
+bool cmCPackIFWRepository::IsOn(const std::string& op) const
+{
+ return Generator ? Generator->IsOn(op) : false;
+}
+
+bool cmCPackIFWRepository::IsVersionLess(const char* version)
+{
+ return Generator ? Generator->IsVersionLess(version) : false;
+}
+
+bool cmCPackIFWRepository::IsVersionGreater(const char* version)
+{
+ return Generator ? Generator->IsVersionGreater(version) : false;
+}
+
+bool cmCPackIFWRepository::IsVersionEqual(const char* version)
+{
+ return Generator ? Generator->IsVersionEqual(version) : false;
+}
+
+bool cmCPackIFWRepository::ConfigureFromOptions()
+{
+ // Name;
+ if (Name.empty())
+ return false;
+
+ std::string prefix =
+ "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(Name) + "_";
+
+ // Update
+ if (IsOn(prefix + "ADD")) {
+ Update = Add;
+ } else if (IsOn(prefix + "REMOVE")) {
+ Update = Remove;
+ } else if (IsOn(prefix + "REPLACE")) {
+ Update = Replace;
+ } else {
+ Update = None;
+ }
+
+ // Url
+ if (const char* url = GetOption(prefix + "URL")) {
+ Url = url;
+ } else {
+ Url = "";
+ }
+
+ // Old url
+ if (const char* oldUrl = GetOption(prefix + "OLD_URL")) {
+ OldUrl = oldUrl;
+ } else {
+ OldUrl = "";
+ }
+
+ // New url
+ if (const char* newUrl = GetOption(prefix + "NEW_URL")) {
+ NewUrl = newUrl;
+ } else {
+ NewUrl = "";
+ }
+
+ // Enabled
+ if (IsOn(prefix + "DISABLED")) {
+ Enabled = "0";
+ } else {
+ Enabled = "";
+ }
+
+ // Username
+ if (const char* username = GetOption(prefix + "USERNAME")) {
+ Username = username;
+ } else {
+ Username = "";
+ }
+
+ // Password
+ if (const char* password = GetOption(prefix + "PASSWORD")) {
+ Password = password;
+ } else {
+ Password = "";
+ }
+
+ // DisplayName
+ if (const char* displayName = GetOption(prefix + "DISPLAY_NAME")) {
+ DisplayName = displayName;
+ } else {
+ DisplayName = "";
+ }
+
+ return IsValid();
+}
+
+/** \class cmCPackeIFWUpdatesPatcher
+ * \brief Helper class that parses and patch Updates.xml file (QtIFW)
+ */
+class cmCPackeIFWUpdatesPatcher : public cmXMLParser
+{
+public:
+ cmCPackeIFWUpdatesPatcher(cmCPackIFWRepository* r, cmXMLWriter& x)
+ : repository(r)
+ , xout(x)
+ , patched(false)
+ {
+ }
+
+ cmCPackIFWRepository* repository;
+ cmXMLWriter& xout;
+ bool patched;
+
+protected:
+ virtual void StartElement(const std::string& name, const char** atts)
+ {
+ xout.StartElement(name);
+ StartFragment(atts);
+ }
+
+ void StartFragment(const char** atts)
+ {
+ for (size_t i = 0; atts[i]; i += 2) {
+ const char* key = atts[i];
+ const char* value = atts[i + 1];
+ xout.Attribute(key, value);
+ }
+ }
+
+ virtual void EndElement(const std::string& name)
+ {
+ if (name == "Updates" && !patched) {
+ repository->WriteRepositoryUpdates(xout);
+ patched = true;
+ }
+ xout.EndElement();
+ if (patched)
+ return;
+ if (name == "Checksum") {
+ repository->WriteRepositoryUpdates(xout);
+ patched = true;
+ }
+ }
+
+ virtual void CharacterDataHandler(const char* data, int length)
+ {
+ std::string content(data, data + length);
+ if (content == "" || content == " " || content == " " || content == "\n")
+ return;
+ xout.Content(content);
+ }
+};
+
+bool cmCPackIFWRepository::PatchUpdatesXml()
+{
+ // Lazy directory initialization
+ if (Directory.empty() && Generator) {
+ Directory = Generator->toplevel;
+ }
+
+ // Filenames
+ std::string updatesXml = Directory + "/repository/Updates.xml";
+ std::string updatesPatchXml = Directory + "/repository/UpdatesPatch.xml";
+
+ // Output stream
+ cmGeneratedFileStream fout(updatesPatchXml.data());
+ cmXMLWriter xout(fout);
+
+ xout.StartDocument();
+
+ WriteGeneratedByToStrim(xout);
+
+ // Patch
+ {
+ cmCPackeIFWUpdatesPatcher patcher(this, xout);
+ patcher.ParseFile(updatesXml.data());
+ }
+
+ xout.EndDocument();
+
+ fout.Close();
+
+ if (!cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data())) {
+ return false;
+ }
+
+ return true;
+}
+
+void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout)
+{
+ xout.StartElement("Repository");
+
+ // Url
+ xout.Element("Url", Url);
+ // Enabled
+ if (!Enabled.empty()) {
+ xout.Element("Enabled", Enabled);
+ }
+ // Username
+ if (!Username.empty()) {
+ xout.Element("Username", Username);
+ }
+ // Password
+ if (!Password.empty()) {
+ xout.Element("Password", Password);
+ }
+ // DisplayName
+ if (!DisplayName.empty()) {
+ xout.Element("DisplayName", DisplayName);
+ }
+
+ xout.EndElement();
+}
+
+void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout)
+{
+ xout.StartElement("Repository");
+
+ switch (Update) {
+ case None:
+ break;
+ case Add:
+ xout.Attribute("action", "add");
+ break;
+ case Remove:
+ xout.Attribute("action", "remove");
+ break;
+ case Replace:
+ xout.Attribute("action", "replace");
+ break;
+ }
+
+ // Url
+ if (Update == Add || Update == Remove) {
+ xout.Attribute("url", Url);
+ } else if (Update == Replace) {
+ xout.Attribute("oldurl", OldUrl);
+ xout.Attribute("newurl", NewUrl);
+ }
+ // Enabled
+ if (!Enabled.empty()) {
+ xout.Attribute("enabled", Enabled);
+ }
+ // Username
+ if (!Username.empty()) {
+ xout.Attribute("username", Username);
+ }
+ // Password
+ if (!Password.empty()) {
+ xout.Attribute("password", Password);
+ }
+ // DisplayName
+ if (!DisplayName.empty()) {
+ xout.Attribute("displayname", DisplayName);
+ }
+
+ xout.EndElement();
+}
+
+void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout)
+{
+ if (!RepositoryUpdate.empty()) {
+ xout.StartElement("RepositoryUpdate");
+ for (RepositoriesVector::iterator rit = RepositoryUpdate.begin();
+ rit != RepositoryUpdate.end(); ++rit) {
+ (*rit)->WriteRepositoryUpdate(xout);
+ }
+ xout.EndElement();
+ }
+}
+
+void cmCPackIFWRepository::WriteGeneratedByToStrim(cmXMLWriter& xout)
+{
+ if (Generator)
+ Generator->WriteGeneratedByToStrim(xout);
+}
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h
new file mode 100644
index 0000000..5ffb775
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWRepository.h
@@ -0,0 +1,105 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ 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 cmCPackIFWRepository_h
+#define cmCPackIFWRepository_h
+
+#include <cmStandardIncludes.h>
+
+class cmCPackIFWGenerator;
+class cmXMLWriter;
+
+/** \class cmCPackIFWRepository
+ * \brief A remote repository to be created CPack IFW generator
+ */
+class cmCPackIFWRepository
+{
+public:
+ // Types
+
+ enum Action
+ {
+ None,
+ Add,
+ Remove,
+ Replace
+ };
+
+ typedef std::vector<cmCPackIFWRepository*> RepositoriesVector;
+
+public:
+ // Constructor
+
+ /**
+ * Construct repository
+ */
+ cmCPackIFWRepository();
+
+public:
+ // Configuration
+
+ /// Internal repository name
+ std::string Name;
+
+ /// Optional update action
+ Action Update;
+
+ /// Is points to a list of available components
+ std::string Url;
+
+ /// Is points to a list that will replaced
+ std::string OldUrl;
+
+ /// Is points to a list that will replace to
+ std::string NewUrl;
+
+ /// With "0" disabling this repository
+ std::string Enabled;
+
+ /// Is used as user on a protected repository
+ std::string Username;
+
+ /// Is password to use on a protected repository
+ std::string Password;
+
+ /// Is optional string to display instead of the URL
+ std::string DisplayName;
+
+public:
+ // Internal implementation
+
+ bool IsValid() const;
+
+ const char* GetOption(const std::string& op) const;
+ bool IsOn(const std::string& op) const;
+
+ bool IsVersionLess(const char* version);
+ bool IsVersionGreater(const char* version);
+ bool IsVersionEqual(const char* version);
+
+ bool ConfigureFromOptions();
+
+ bool PatchUpdatesXml();
+
+ void WriteRepositoryConfig(cmXMLWriter& xout);
+ void WriteRepositoryUpdate(cmXMLWriter& xout);
+ void WriteRepositoryUpdates(cmXMLWriter& xout);
+
+ cmCPackIFWGenerator* Generator;
+ RepositoriesVector RepositoryUpdate;
+ std::string Directory;
+
+protected:
+ void WriteGeneratedByToStrim(cmXMLWriter& xout);
+};
+
+#endif // cmCPackIFWRepository_h
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 7675677..1ad4152 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -50,15 +50,15 @@ int cmCPackDebGenerator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
-int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel,
- std::string packageName)
+int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel,
+ std::string const& packageName)
{
int retval = 1;
// Begin the archive for this pack
std::string localToplevel(initialTopLevel);
std::string packageFileName(cmSystemTools::GetParentDirectory(toplevel));
- std::string outputFileName(cmsys::SystemTools::LowerCase(std::string(
- this->GetOption("CPACK_PACKAGE_FILE_NAME"))) +
+ std::string outputFileName(std::string(
+ this->GetOption("CPACK_PACKAGE_FILE_NAME")) +
"-" + packageName + this->GetOutputExtension());
localToplevel += "/" + packageName;
@@ -174,8 +174,8 @@ int cmCPackDebGenerator::PackageComponentsAllInOne(
// The ALL GROUPS in ONE package case
std::string localToplevel(initialTopLevel);
std::string packageFileName(cmSystemTools::GetParentDirectory(toplevel));
- std::string outputFileName(cmsys::SystemTools::LowerCase(std::string(
- this->GetOption("CPACK_PACKAGE_FILE_NAME"))) +
+ std::string outputFileName(std::string(
+ this->GetOption("CPACK_PACKAGE_FILE_NAME")) +
this->GetOutputExtension());
// all GROUP in one vs all COMPONENT in one
localToplevel += "/" + compInstDirName;
diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h
index f640ab4..ff34ca5 100644
--- a/Source/CPack/cmCPackDebGenerator.h
+++ b/Source/CPack/cmCPackDebGenerator.h
@@ -49,7 +49,8 @@ protected:
/**
* This method factors out the work done in component packaging case.
*/
- int PackageOnePack(std::string initialToplevel, std::string packageName);
+ int PackageOnePack(std::string const& initialToplevel,
+ std::string const& packageName);
/**
* The method used to package files when component
* install is used. This will create one
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index e401657..f4379c1 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -305,6 +305,9 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
? this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT")
: "";
+ const bool cpack_dmg_disable_applications_symlink =
+ this->IsOn("CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK");
+
// only put license on dmg if is user provided
if (!cpack_license_file.empty() &&
cpack_license_file.find("CPack.GenericLicense.txt") !=
@@ -323,11 +326,13 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
staging << src_dir;
// Add a symlink to /Applications so users can drag-and-drop the bundle
- // into it
- std::ostringstream application_link;
- application_link << staging.str() << "/Applications";
- cmSystemTools::CreateSymlink("/Applications",
- application_link.str().c_str());
+ // into it unless this behaviour was disabled
+ if (!cpack_dmg_disable_applications_symlink) {
+ std::ostringstream application_link;
+ application_link << staging.str() << "/Applications";
+ cmSystemTools::CreateSymlink("/Applications",
+ application_link.str().c_str());
+ }
// Optionally add a custom volume icon ...
if (!cpack_package_icon.empty()) {
@@ -447,12 +452,11 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
cmsys::RegularExpression mountpoint_regex(".*(/Volumes/[^\n]+)\n.*");
mountpoint_regex.find(attach_output.c_str());
- std::ostringstream temp_mount;
- temp_mount << mountpoint_regex.match(1);
+ std::string const temp_mount = mountpoint_regex.match(1);
// Remove dummy padding file so we have enough space on RW image ...
std::ostringstream dummy_padding;
- dummy_padding << temp_mount.str() << "/.dummy-padding-file";
+ dummy_padding << temp_mount << "/.dummy-padding-file";
if (!cmSystemTools::RemoveFile(dummy_padding.str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Error removing dummy padding file."
<< std::endl);
@@ -465,7 +469,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
std::ostringstream setfile_command;
setfile_command << this->GetOption("CPACK_COMMAND_SETFILE");
setfile_command << " -a C";
- setfile_command << " \"" << temp_mount.str() << "\"";
+ setfile_command << " \"" << temp_mount << "\"";
if (!this->RunCommand(setfile_command)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -497,7 +501,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
std::ostringstream detach_command;
detach_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
detach_command << " detach";
- detach_command << " \"" << temp_mount.str() << "\"";
+ detach_command << " \"" << temp_mount << "\"";
if (!this->RunCommand(detach_command)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 4d48cb5..9fa588d 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -74,7 +74,7 @@ int cmCPackNSISGenerator::PackageFiles()
// Strip off the component part of the path.
fileN = fileN.substr(fileN.find('/') + 1, std::string::npos);
}
- cmSystemTools::ReplaceString(fileN, "/", "\\");
+ std::replace(fileN.begin(), fileN.end(), '/', '\\');
str << " Delete \"$INSTDIR\\" << fileN << "\"" << std::endl;
}
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Uninstall Files: " << str.str()
@@ -104,7 +104,7 @@ int cmCPackNSISGenerator::PackageFiles()
fileN = fileN.substr(slash + 1, std::string::npos);
}
}
- cmSystemTools::ReplaceString(fileN, "/", "\\");
+ std::replace(fileN.begin(), fileN.end(), '/', '\\');
dstr << " RMDir \"$INSTDIR\\" << fileN << "\"" << std::endl;
if (!componentName.empty()) {
this->Components[componentName].Directories.push_back(fileN);
@@ -548,7 +548,7 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostringstream& str,
// Convert / to \ in filenames, but not in urls:
//
if (!url) {
- cmSystemTools::ReplaceString(sourceName, "/", "\\");
+ std::replace(sourceName.begin(), sourceName.end(), '/', '\\');
}
++it;
@@ -790,13 +790,13 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
for (pathIt = component->Files.begin(); pathIt != component->Files.end();
++pathIt) {
path = *pathIt;
- cmSystemTools::ReplaceString(path, "/", "\\");
+ std::replace(path.begin(), path.end(), '/', '\\');
macrosOut << " Delete \"$INSTDIR\\" << path << "\"\n";
}
for (pathIt = component->Directories.begin();
pathIt != component->Directories.end(); ++pathIt) {
path = *pathIt;
- cmSystemTools::ReplaceString(path, "/", "\\");
+ std::replace(path.begin(), path.end(), '/', '\\');
macrosOut << " RMDir \"$INSTDIR\\" << path << "\"\n";
}
macrosOut << " noremove_" << component->Name << ":\n";
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index fc6603a..9827b70 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -34,13 +34,13 @@ int cmCPackRPMGenerator::InitializeInternal()
*/
if (this->GetOption("CPACK_PACKAGE_NAME")) {
std::string packageName = this->GetOption("CPACK_PACKAGE_NAME");
- cmSystemTools::ReplaceString(packageName, " ", "-");
+ std::replace(packageName.begin(), packageName.end(), ' ', '-');
this->SetOption("CPACK_PACKAGE_NAME", packageName.c_str());
}
/* same for CPACK_PACKAGE_FILE_NAME */
if (this->GetOption("CPACK_PACKAGE_FILE_NAME")) {
std::string packageName = this->GetOption("CPACK_PACKAGE_FILE_NAME");
- cmSystemTools::ReplaceString(packageName, " ", "-");
+ std::replace(packageName.begin(), packageName.end(), ' ', '-');
this->SetOption("CPACK_PACKAGE_FILE_NAME", packageName.c_str());
}
return this->Superclass::InitializeInternal();
@@ -61,8 +61,8 @@ void cmCPackRPMGenerator::AddGeneratedPackageNames()
packageFileNames.push_back(fileNames.substr(pos1, pos2 - pos1));
}
-int cmCPackRPMGenerator::PackageOnePack(std::string initialToplevel,
- std::string packageName)
+int cmCPackRPMGenerator::PackageOnePack(std::string const& initialToplevel,
+ std::string const& packageName)
{
int retval = 1;
// Begin the archive for this pack
diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h
index 40b9bb8..b39f2c2 100644
--- a/Source/CPack/cmCPackRPMGenerator.h
+++ b/Source/CPack/cmCPackRPMGenerator.h
@@ -54,7 +54,8 @@ protected:
/**
* This method factors out the work done in component packaging case.
*/
- int PackageOnePack(std::string initialToplevel, std::string packageName);
+ int PackageOnePack(std::string const& initialToplevel,
+ std::string const& packageName);
/**
* The method used to package files when component
* install is used. This will create one
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index e54be2c..94e1615 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -68,7 +68,7 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
(void)argument;
cpackDefinitions* def = static_cast<cpackDefinitions*>(call_data);
std::string value = cValue;
- size_t pos = value.find_first_of("=");
+ size_t pos = value.find_first_of('=');
if (pos == std::string::npos) {
cmCPack_Log(def->Log, cmCPackLog::LOG_ERROR,
"Please specify CPack definitions as: KEY=VALUE" << std::endl);
@@ -414,8 +414,8 @@ int main(int argc, char const* const* argv)
for (generatorIt = generators.GetGeneratorsList().begin();
generatorIt != generators.GetGeneratorsList().end(); ++generatorIt) {
cmDocumentationEntry e;
- e.Name = generatorIt->first.c_str();
- e.Brief = generatorIt->second.c_str();
+ e.Name = generatorIt->first;
+ e.Brief = generatorIt->second;
v.push_back(e);
}
doc.SetSection("Generators", v);
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 20b0e9c..7141daf 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -617,7 +617,7 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
cmSystemTools::ConvertToUnixSlashes(cm->SourceFile);
if (cm->SourceFile.find("/.../") != cm->SourceFile.npos) {
cmSystemTools::ReplaceString(cm->SourceFile, "/.../", "");
- std::string::size_type p = cm->SourceFile.find("/");
+ std::string::size_type p = cm->SourceFile.find('/');
if (p != cm->SourceFile.npos) {
cm->SourceFile =
cm->SourceFile.substr(p + 1, cm->SourceFile.size() - p);
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 550a774..daefb59 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -1238,7 +1238,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
// Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first.
if (vec[lineIdx] < 0) {
- if (cov > 0 || prefix.find("#") != prefix.npos) {
+ if (cov > 0 || prefix.find('#') != prefix.npos) {
vec[lineIdx] = 0;
}
}
@@ -1356,7 +1356,6 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
return 0;
}
std::string testingDir = this->CTest->GetBinaryDir();
- std::string tempDir = testingDir;
std::string currentDirectory = cmSystemTools::GetCurrentWorkingDirectory();
std::set<std::string> missingFiles;
@@ -1543,7 +1542,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
// Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first.
if (vec[lineIdx] < 0) {
- if (cov > 0 || prefix.find("#") != prefix.npos) {
+ if (cov > 0 || prefix.find('#') != prefix.npos) {
vec[lineIdx] = 0;
}
}
@@ -1622,7 +1621,7 @@ bool cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files)
return false;
}
- prevBinaryDir = cmSystemTools::GetCurrentWorkingDirectory().c_str();
+ prevBinaryDir = cmSystemTools::GetCurrentWorkingDirectory();
// DPI file should appear in build directory
std::string daGlob;
@@ -1759,7 +1758,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
}
std::string cmCTestCoverageHandler::FindFile(
- cmCTestCoverageHandlerContainer* cont, std::string fileName)
+ cmCTestCoverageHandlerContainer* cont, std::string const& fileName)
{
std::string fileNameNoE =
cmSystemTools::GetFilenameWithoutLastExtension(fileName);
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 4a2a602..1773218 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -119,7 +119,7 @@ private:
// Find the source file based on the source and build tree. This is used for
// Trace.py mode, since that one does not tell us where the source file is.
std::string FindFile(cmCTestCoverageHandlerContainer* cont,
- std::string fileName);
+ std::string const& fileName);
std::set<std::string> FindUncoveredFiles(
cmCTestCoverageHandlerContainer* cont);
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index 1c80acd..18caabe 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -68,7 +68,7 @@ void cmCTestGenericHandler::Initialize()
t_StringToString::iterator it;
for (it = this->PersistentOptions.begin();
it != this->PersistentOptions.end(); ++it) {
- this->Options[it->first] = it->second.c_str();
+ this->Options[it->first] = it->second;
}
}
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 2cbd64d..5ae98af 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -422,7 +422,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
if (cmSystemTools::FileExists(
this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str())) {
this->MemoryTester =
- this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str();
+ this->CTest->GetCTestConfiguration("MemoryCheckCommand");
std::string testerName =
cmSystemTools::GetFilenameName(this->MemoryTester);
// determine the checker type
@@ -438,47 +438,41 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
}
} else if (cmSystemTools::FileExists(
this->CTest->GetCTestConfiguration("PurifyCommand").c_str())) {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("PurifyCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("PurifyCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
} else if (cmSystemTools::FileExists(
this->CTest->GetCTestConfiguration("ValgrindCommand")
.c_str())) {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("ValgrindCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("ValgrindCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
} else if (cmSystemTools::FileExists(
this->CTest->GetCTestConfiguration("BoundsCheckerCommand")
.c_str())) {
this->MemoryTester =
- this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str();
+ this->CTest->GetCTestConfiguration("BoundsCheckerCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
}
if (this->CTest->GetCTestConfiguration("MemoryCheckType") ==
"AddressSanitizer") {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::ADDRESS_SANITIZER;
this->LogWithPID = true; // even if we give the log file the pid is added
}
if (this->CTest->GetCTestConfiguration("MemoryCheckType") ==
"ThreadSanitizer") {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::THREAD_SANITIZER;
this->LogWithPID = true; // even if we give the log file the pid is added
}
if (this->CTest->GetCTestConfiguration("MemoryCheckType") ==
"MemorySanitizer") {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::MEMORY_SANITIZER;
this->LogWithPID = true; // even if we give the log file the pid is added
}
if (this->CTest->GetCTestConfiguration("MemoryCheckType") ==
"UndefinedBehaviorSanitizer") {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::UB_SANITIZER;
this->LogWithPID = true; // even if we give the log file the pid is added
}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index d155023..6f19b32 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -500,7 +500,7 @@ void cmCTestMultiProcessHandler::ReadCostData()
}
}
-int cmCTestMultiProcessHandler::SearchByName(std::string name)
+int cmCTestMultiProcessHandler::SearchByName(std::string const& name)
{
int index = -1;
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index cb709cc..9ec1528 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -84,7 +84,7 @@ protected:
void UpdateCostData();
void ReadCostData();
// Return index of a test based on its name
- int SearchByName(std::string name);
+ int SearchByName(std::string const& name);
void CreateTestCostList();
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 59383af..9dda865 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -424,7 +424,7 @@ bool cmCTestRunTest::StartTest(size_t total)
this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND;
this->TestResult.TestCount = this->TestProperties->Index;
this->TestResult.Name = this->TestProperties->Name;
- this->TestResult.Path = this->TestProperties->Directory.c_str();
+ this->TestResult.Path = this->TestProperties->Directory;
if (args.size() >= 2 && args[1] == "NOT_AVAILABLE") {
this->TestProcess = new cmProcess;
@@ -502,7 +502,7 @@ void cmCTestRunTest::ComputeArguments()
if (this->TestHandler->MemCheck) {
cmCTestMemCheckHandler* handler =
static_cast<cmCTestMemCheckHandler*>(this->TestHandler);
- this->ActualCommand = handler->MemoryTester.c_str();
+ this->ActualCommand = handler->MemoryTester;
this->TestProperties->Args[1] = this->TestHandler->FindTheExecutable(
this->TestProperties->Args[1].c_str());
} else {
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 0c09cc7..6389a9d 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -330,9 +330,10 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
// passed into the scripts as S_ARG
std::string script = total_script_arg;
std::string script_arg;
- if (total_script_arg.find(",") != std::string::npos) {
- script = total_script_arg.substr(0, total_script_arg.find(","));
- script_arg = total_script_arg.substr(total_script_arg.find(",") + 1);
+ const std::string::size_type comma_pos = total_script_arg.find(',');
+ if (comma_pos != std::string::npos) {
+ script = total_script_arg.substr(0, comma_pos);
+ script_arg = total_script_arg.substr(comma_pos + 1);
}
// make sure the file exists
if (!cmSystemTools::FileExists(script.c_str())) {
@@ -484,7 +485,7 @@ int cmCTestScriptHandler::ExtractVariables()
// if the dashboard root isn't specified then we can compute it from the
// this->SourceDir
if (this->CTestRoot.empty()) {
- this->CTestRoot = cmSystemTools::GetFilenamePath(this->SourceDir).c_str();
+ this->CTestRoot = cmSystemTools::GetFilenamePath(this->SourceDir);
}
// the script may override the minimum continuous interval
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index fa9bd2c..664552a 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -219,12 +219,11 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
}
if (this->ArgumentDoing == ArgumentDoingFiles) {
- std::string filename(arg);
- if (cmSystemTools::FileExists(filename.c_str())) {
- this->Files.insert(filename);
+ if (cmSystemTools::FileExists(arg.c_str())) {
+ this->Files.insert(arg);
} else {
std::ostringstream e;
- e << "File \"" << filename << "\" does not exist. Cannot submit "
+ e << "File \"" << arg << "\" does not exist. Cannot submit "
<< "a non-existent file.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
this->ArgumentDoing = ArgumentDoingError;
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index bbc6b37..f373348 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -417,7 +417,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
}
}
std::string upload_as = url +
- ((url.find("?", 0) == std::string::npos) ? "?" : "&") + "FileName=" +
+ ((url.find('?') == std::string::npos) ? '?' : '&') + "FileName=" +
ofile;
upload_as += "&MD5=";
@@ -706,7 +706,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files,
}
}
std::string turl = url +
- ((url.find("?", 0) == std::string::npos) ? "?" : "&") + "xmlfile=" +
+ ((url.find('?') == std::string::npos) ? '?' : '&') + "xmlfile=" +
ofile;
*this->LogFile << "Trigger url: " << turl << std::endl;
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 4935f11..20ef693 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1869,7 +1869,7 @@ bool cmCTestTestHandler::SetTestsProperties(
cmSystemTools::ExpandListArgument(val, rtit->Labels);
}
if (key == "MEASUREMENT") {
- size_t pos = val.find_first_of("=");
+ size_t pos = val.find_first_of('=');
if (pos != val.npos) {
std::string mKey = val.substr(0, pos);
const char* mVal = val.c_str() + pos + 1;
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx
index 6813cbc..c85db02 100644
--- a/Source/CTest/cmCTestUploadCommand.cxx
+++ b/Source/CTest/cmCTestUploadCommand.cxx
@@ -46,13 +46,12 @@ bool cmCTestUploadCommand::CheckArgumentKeyword(std::string const& arg)
bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg)
{
if (this->ArgumentDoing == ArgumentDoingFiles) {
- std::string filename(arg);
- if (cmSystemTools::FileExists(filename.c_str())) {
- this->Files.insert(filename);
+ if (cmSystemTools::FileExists(arg.c_str())) {
+ this->Files.insert(arg);
return true;
} else {
std::ostringstream e;
- e << "File \"" << filename << "\" does not exist. Cannot submit "
+ e << "File \"" << arg << "\" does not exist. Cannot submit "
<< "a non-existent file.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
this->ArgumentDoing = ArgumentDoingError;
diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx
index 1e42847..fa539e4 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.cxx
+++ b/Source/CTest/cmParseBlanketJSCoverage.cxx
@@ -46,7 +46,7 @@ public:
return line.substr(begIndex, line.npos);
}
}
- bool ParseFile(std::string file)
+ bool ParseFile(std::string const& file)
{
FileLinesType localCoverageVector;
std::string filename;
@@ -74,7 +74,7 @@ public:
}
foundFile = true;
inSource = false;
- filename = getValue(line, 0).c_str();
+ filename = getValue(line, 0);
} else if ((line.find("coverage") != line.npos) && foundFile &&
inSource) {
/*
@@ -138,7 +138,7 @@ bool cmParseBlanketJSCoverage::LoadCoverageData(std::vector<std::string> files)
return true;
}
-bool cmParseBlanketJSCoverage::ReadJSONFile(std::string file)
+bool cmParseBlanketJSCoverage::ReadJSONFile(std::string const& file)
{
cmParseBlanketJSCoverage::JSONParser parser(this->Coverage);
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
diff --git a/Source/CTest/cmParseBlanketJSCoverage.h b/Source/CTest/cmParseBlanketJSCoverage.h
index 4fc64e7..a4f6670 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.h
+++ b/Source/CTest/cmParseBlanketJSCoverage.h
@@ -35,7 +35,7 @@ public:
cmCTest* ctest);
bool LoadCoverageData(std::vector<std::string> files);
// Read the JSON output
- bool ReadJSONFile(std::string file);
+ bool ReadJSONFile(std::string const& file);
protected:
class JSONParser;
diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx
index d20b16a..9d86ce9 100644
--- a/Source/CTest/cmParseDelphiCoverage.cxx
+++ b/Source/CTest/cmParseDelphiCoverage.cxx
@@ -22,7 +22,7 @@ public:
virtual ~HTMLParser() {}
bool initializeDelphiFile(
- const std::string filename,
+ std::string const& filename,
cmParseDelphiCoverage::HTMLParser::FileLinesType& coverageVector)
{
std::string line;
@@ -171,7 +171,7 @@ public:
}
lastoffset = line.find("class=");
- endcovpos = line.find(">", lastoffset);
+ endcovpos = line.find('>', lastoffset);
lineresult = line.substr(lastoffset + 7, (endcovpos - 8) - lastoffset);
if (lineresult == "covered") {
@@ -197,7 +197,7 @@ cmParseDelphiCoverage::cmParseDelphiCoverage(
}
bool cmParseDelphiCoverage::LoadCoverageData(
- const std::vector<std::string> files)
+ std::vector<std::string> const& files)
{
size_t i;
std::string path;
diff --git a/Source/CTest/cmParseDelphiCoverage.h b/Source/CTest/cmParseDelphiCoverage.h
index 06dea2b..c1c495c 100644
--- a/Source/CTest/cmParseDelphiCoverage.h
+++ b/Source/CTest/cmParseDelphiCoverage.h
@@ -28,7 +28,7 @@ class cmParseDelphiCoverage
{
public:
cmParseDelphiCoverage(cmCTestCoverageHandlerContainer& cont, cmCTest* ctest);
- bool LoadCoverageData(const std::vector<std::string> files);
+ bool LoadCoverageData(std::vector<std::string> const& files);
bool ReadDelphiHTML(const char* file);
// Read a single HTML file from output
bool ReadHTMLFile(const char* f);
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index a065903..33ad839 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -121,7 +121,7 @@ bool cmParseGTMCoverage::FindFunctionInMumpsFile(std::string const& filepath,
std::string line;
int linenum = 0;
while (cmSystemTools::GetLineFromStream(in, line)) {
- std::string::size_type pos = line.find(function.c_str());
+ std::string::size_type pos = line.find(function);
if (pos == 0) {
char nextchar = line[function.size()];
if (nextchar == ' ' || nextchar == '(' || nextchar == '\t') {
diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx
index 6afaca6..335535d 100644
--- a/Source/CTest/cmParseJacocoCoverage.cxx
+++ b/Source/CTest/cmParseJacocoCoverage.cxx
@@ -85,7 +85,7 @@ protected:
}
}
- virtual bool FindPackagePath(const std::string fileName)
+ virtual bool FindPackagePath(std::string const& fileName)
{
// Search for the source file in the source directory.
if (this->PackagePathFound(fileName, this->Coverage.SourceDir)) {
@@ -99,8 +99,8 @@ protected:
return false;
}
- virtual bool PackagePathFound(const std::string fileName,
- const std::string baseDir)
+ virtual bool PackagePathFound(std::string const& fileName,
+ std::string const& baseDir)
{
// Search for the file in the baseDir and its subdirectories.
std::string packageGlob = baseDir;
@@ -149,7 +149,7 @@ cmParseJacocoCoverage::cmParseJacocoCoverage(
}
bool cmParseJacocoCoverage::LoadCoverageData(
- const std::vector<std::string> files)
+ std::vector<std::string> const& files)
{
// load all the jacoco.xml files in the source directory
cmsys::Directory dir;
diff --git a/Source/CTest/cmParseJacocoCoverage.h b/Source/CTest/cmParseJacocoCoverage.h
index fa31d47..bcd472e 100644
--- a/Source/CTest/cmParseJacocoCoverage.h
+++ b/Source/CTest/cmParseJacocoCoverage.h
@@ -27,7 +27,7 @@ class cmParseJacocoCoverage
{
public:
cmParseJacocoCoverage(cmCTestCoverageHandlerContainer& cont, cmCTest* ctest);
- bool LoadCoverageData(const std::vector<std::string> files);
+ bool LoadCoverageData(std::vector<std::string> const& files);
std::string PackageName;
std::string FileName;
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 7368560..b740eb0 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -729,7 +729,7 @@ void cmCursesMainForm::FillCacheManagerFromUI()
void cmCursesMainForm::FixValue(cmState::CacheEntryType type,
const std::string& in, std::string& out) const
{
- out = in.substr(0, in.find_last_not_of(" ") + 1);
+ out = in.substr(0, in.find_last_not_of(' ') + 1);
if (type == cmState::PATH || type == cmState::FILEPATH) {
cmSystemTools::ConvertToUnixSlashes(out);
}
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index c3c1468..c849d52 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -19,6 +19,7 @@
#include <QApplication>
#include <QDir>
#include <QLocale>
+#include <QString>
#include <QTextCodec>
#include <QTranslator>
#include <cmsys/CommandLineArguments.hxx>
@@ -40,6 +41,7 @@ static const char* cmDocumentationOptions[][2] = { { 0, 0 } };
#if defined(Q_OS_MAC)
static int cmOSXInstall(std::string dir);
+static void cmAddPluginPath();
#endif
int main(int argc, char** argv)
@@ -81,6 +83,15 @@ int main(int argc, char** argv)
}
#endif
+// When we are on OSX and we are launching cmake-gui from a symlink, the
+// application will fail to launch as it can't find the qt.conf file which
+// tells it what the name of the plugin folder is. We need to add this path
+// BEFORE the application is constructed as that is what triggers the
+// searching for the platform plugins
+#if defined(Q_OS_MAC)
+ cmAddPluginPath();
+#endif
+
QApplication app(argc, argv);
setlocale(LC_NUMERIC, "C");
@@ -215,4 +226,27 @@ static int cmOSXInstall(std::string dir)
? 0
: 1;
}
+
+// Locate the PlugIns directory and add it to the QApplication library paths.
+// We need to resolve all symlinks so we have a known relative path between
+// MacOS/CMake and the PlugIns directory.
+//
+// Note we are using cmSystemTools since Qt can't provide the path to the
+// executable before the QApplication is created, and that is when plugin
+// searching occurs.
+static void cmAddPluginPath()
+{
+ std::string const& path = cmSystemTools::GetCMakeGUICommand();
+ if (path.empty()) {
+ return;
+ }
+ std::string const& realPath = cmSystemTools::GetRealPath(path);
+ QFileInfo appPath(QString::fromLocal8Bit(realPath.c_str()));
+ QDir pluginDir = appPath.dir();
+ bool const foundPluginDir = pluginDir.cd("../PlugIns");
+ if (foundPluginDir) {
+ QApplication::addLibraryPath(pluginDir.path());
+ }
+}
+
#endif
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 76acaca..ee803c8 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -379,4 +379,19 @@ std::reverse_iterator<Iter> cmMakeReverseIterator(Iter it)
return std::reverse_iterator<Iter>(it);
}
+inline bool cmHasSuffix(const std::string& str, const std::string& suffix)
+{
+ if (str.size() < suffix.size()) {
+ return false;
+ }
+ return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
+}
+
+inline void cmStripSuffixIfExists(std::string& str, const std::string& suffix)
+{
+ if (cmHasSuffix(str, suffix)) {
+ str.resize(str.size() - suffix.size());
+ }
+}
+
#endif
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index 7ed96ab..27234d7 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -32,9 +32,9 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
cmsys::RegularExpression reg("[()/]");
if (reg.find(cacheValue)) {
std::string cv = cacheValue;
- cmSystemTools::ReplaceString(cv, "/", "_");
- cmSystemTools::ReplaceString(cv, "(", "_");
- cmSystemTools::ReplaceString(cv, ")", "_");
+ std::replace(cv.begin(), cv.end(), '/', '_');
+ std::replace(cv.begin(), cv.end(), '(', '_');
+ std::replace(cv.begin(), cv.end(), ')', '_');
this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.",
cmState::STRING);
}
@@ -57,9 +57,9 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->ExpandVariablesInString(compiler);
buildname += "-";
buildname += cmSystemTools::GetFilenameName(compiler);
- cmSystemTools::ReplaceString(buildname, "/", "_");
- cmSystemTools::ReplaceString(buildname, "(", "_");
- cmSystemTools::ReplaceString(buildname, ")", "_");
+ std::replace(buildname.begin(), buildname.end(), '/', '_');
+ std::replace(buildname.begin(), buildname.end(), '(', '_');
+ std::replace(buildname.begin(), buildname.end(), ')', '_');
this->Makefile->AddCacheDefinition(args[0], buildname.c_str(),
"Name of build.", cmState::STRING);
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 7e5d966..bc36c5a 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -67,7 +67,7 @@
std::cerr << __LINE__ << " "; \
std::cerr
-struct tm* cmCTest::GetNightlyTime(std::string str, bool tomorrowtag)
+struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
{
struct tm* lctime;
time_t tctime = time(0);
@@ -170,8 +170,8 @@ static size_t HTTPResponseCallback(void* ptr, size_t size, size_t nmemb,
}
int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
- std::string& response, std::string fields,
- std::string putFile, int timeout)
+ std::string& response, std::string const& fields,
+ std::string const& putFile, int timeout)
{
CURL* curl;
FILE* file;
@@ -721,7 +721,7 @@ bool cmCTest::UpdateCTestConfiguration()
if (line[0] == '#') {
continue;
}
- std::string::size_type cpos = line.find_first_of(":");
+ std::string::size_type cpos = line.find_first_of(':');
if (cpos == line.npos) {
continue;
}
@@ -1481,7 +1481,7 @@ int cmCTest::GenerateNotesFile(const char* cfiles)
return this->GenerateNotesFile(files);
}
-std::string cmCTest::Base64GzipEncodeFile(std::string file)
+std::string cmCTest::Base64GzipEncodeFile(std::string const& file)
{
std::string tarFile = file + "_temp.tar.gz";
std::vector<std::string> files;
@@ -1499,7 +1499,7 @@ std::string cmCTest::Base64GzipEncodeFile(std::string file)
return base64;
}
-std::string cmCTest::Base64EncodeFile(std::string file)
+std::string cmCTest::Base64EncodeFile(std::string const& file)
{
size_t const len = cmSystemTools::FileLength(file);
cmsys::ifstream ifs(file.c_str(), std::ios::in
@@ -2208,7 +2208,7 @@ void cmCTest::SetNotesFiles(const char* notes)
this->NotesFiles = notes;
}
-void cmCTest::SetStopTime(std::string time)
+void cmCTest::SetStopTime(std::string const& time)
{
this->StopTime = time;
this->DetermineNextDayStop();
@@ -2480,7 +2480,7 @@ void cmCTest::AddSubmitFile(Part part, const char* name)
void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
{
- size_t epos = overStr.find("=");
+ size_t epos = overStr.find('=');
if (epos == overStr.npos) {
cmCTestLog(this, ERROR_MESSAGE,
"CTest configuration overwrite specified in the wrong format."
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 1c3490e..65ecaa4 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -108,8 +108,8 @@ public:
* Perform an HTTP request.
*/
static int HTTPRequest(std::string url, HTTPMethod method,
- std::string& response, std::string fields = "",
- std::string putFile = "", int timeout = 0);
+ std::string& response, std::string const& fields = "",
+ std::string const& putFile = "", int timeout = 0);
#endif
/** Get a testing part id from its string name. Returns PartCount
@@ -143,7 +143,7 @@ public:
/*
* A utility function that returns the nightly time
*/
- struct tm* GetNightlyTime(std::string str, bool tomorrowtag);
+ struct tm* GetNightlyTime(std::string const& str, bool tomorrowtag);
/*
* Is the tomorrow tag set?
@@ -211,9 +211,9 @@ public:
std::string CurrentTime();
//! tar/gzip and then base 64 encode a file
- std::string Base64GzipEncodeFile(std::string file);
+ std::string Base64GzipEncodeFile(std::string const& file);
//! base64 encode a file
- std::string Base64EncodeFile(std::string file);
+ std::string Base64EncodeFile(std::string const& file);
/**
* Return the time remaining that the script is allowed to run in
@@ -240,7 +240,7 @@ public:
std::string GetCDashVersion();
std::string GetStopTime() { return this->StopTime; }
- void SetStopTime(std::string time);
+ void SetStopTime(std::string const& time);
// Used for parallel ctest job scheduling
std::string GetScheduleType() { return this->ScheduleType; }
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 6b2d1e3..c630971 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -43,8 +43,8 @@ std::string const& cmCommonTargetGenerator::GetConfigName() const
}
std::string cmCommonTargetGenerator::Convert(
- std::string const& source, cmLocalGenerator::RelativeRoot relative,
- cmLocalGenerator::OutputFormat output)
+ std::string const& source, cmOutputConverter::RelativeRoot relative,
+ cmOutputConverter::OutputFormat output)
{
return this->LocalGenerator->Convert(source, relative, output);
}
@@ -140,7 +140,7 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
std::string mod_dir = this->GetFortranModuleDirectory();
if (!mod_dir.empty()) {
mod_dir =
- this->Convert(mod_dir, this->WorkingDirectory, cmLocalGenerator::SHELL);
+ this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL);
} else {
mod_dir =
this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
@@ -167,7 +167,7 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
idi != includes.end(); ++idi) {
std::string flg = modpath_flag;
flg +=
- this->Convert(*idi, cmLocalGenerator::NONE, cmLocalGenerator::SHELL);
+ this->Convert(*idi, cmOutputConverter::NONE, cmOutputConverter::SHELL);
this->LocalGenerator->AppendFlags(flags, flg);
}
}
@@ -177,18 +177,18 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
std::string& flags, cmSourceFile const& source)
{
const char* srcfmt = source.GetProperty("Fortran_FORMAT");
- cmLocalGenerator::FortranFormat format =
+ cmOutputConverter::FortranFormat format =
this->LocalGenerator->GetFortranFormat(srcfmt);
- if (format == cmLocalGenerator::FortranFormatNone) {
+ if (format == cmOutputConverter::FortranFormatNone) {
const char* tgtfmt = this->GeneratorTarget->GetProperty("Fortran_FORMAT");
format = this->LocalGenerator->GetFortranFormat(tgtfmt);
}
const char* var = 0;
switch (format) {
- case cmLocalGenerator::FortranFormatFixed:
+ case cmOutputConverter::FortranFormatFixed:
var = "CMAKE_Fortran_FORMAT_FIXED_FLAG";
break;
- case cmLocalGenerator::FortranFormatFree:
+ case cmOutputConverter::FortranFormatFree:
var = "CMAKE_Fortran_FORMAT_FREE_FLAG";
break;
default:
@@ -244,7 +244,7 @@ std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l)
if (emitted.insert(*i).second) {
flags += fwSearchFlag;
flags += this->LocalGenerator->ConvertToOutputFormat(
- *i, cmLocalGenerator::SHELL);
+ *i, cmOutputConverter::SHELL);
flags += " ";
}
}
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index c5d324f..c9645e7 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -65,8 +65,8 @@ protected:
void AddFortranFlags(std::string& flags);
std::string Convert(
- std::string const& source, cmLocalGenerator::RelativeRoot relative,
- cmLocalGenerator::OutputFormat output = cmLocalGenerator::UNCHANGED);
+ std::string const& source, cmOutputConverter::RelativeRoot relative,
+ cmOutputConverter::OutputFormat output = cmOutputConverter::UNCHANGED);
void AppendFortranFormatFlags(std::string& flags,
cmSourceFile const& source);
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 9d83624..75d0e9e 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -20,6 +20,30 @@
#include <assert.h>
+static std::string const kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN =
+ "CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN";
+static std::string const kCMAKE_C_COMPILER_TARGET = "CMAKE_C_COMPILER_TARGET";
+static std::string const kCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN =
+ "CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN";
+static std::string const kCMAKE_CXX_COMPILER_TARGET =
+ "CMAKE_CXX_COMPILER_TARGET";
+static std::string const kCMAKE_ENABLE_EXPORTS = "CMAKE_ENABLE_EXPORTS";
+static std::string const kCMAKE_LINK_SEARCH_END_STATIC =
+ "CMAKE_LINK_SEARCH_END_STATIC";
+static std::string const kCMAKE_LINK_SEARCH_START_STATIC =
+ "CMAKE_LINK_SEARCH_START_STATIC";
+static std::string const kCMAKE_OSX_ARCHITECTURES = "CMAKE_OSX_ARCHITECTURES";
+static std::string const kCMAKE_OSX_DEPLOYMENT_TARGET =
+ "CMAKE_OSX_DEPLOYMENT_TARGET";
+static std::string const kCMAKE_OSX_SYSROOT = "CMAKE_OSX_SYSROOT";
+static std::string const kCMAKE_POSITION_INDEPENDENT_CODE =
+ "CMAKE_POSITION_INDEPENDENT_CODE";
+static std::string const kCMAKE_SYSROOT = "CMAKE_SYSROOT";
+static std::string const kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES =
+ "CMAKE_TRY_COMPILE_OSX_ARCHITECTURES";
+static std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES =
+ "CMAKE_TRY_COMPILE_PLATFORM_VARIABLES";
+
int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
bool isTryRun)
{
@@ -309,14 +333,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
" ${COMPILE_DEFINITIONS}\")\n",
li->c_str(), li->c_str());
- static std::string const cfgDefault = "DEBUG";
- std::string const cfg =
- !tcConfig.empty() ? cmSystemTools::UpperCase(tcConfig) : cfgDefault;
- std::string const langFlagsCfg = "CMAKE_" + *li + "_FLAGS_" + cfg;
- const char* flagsCfg = this->Makefile->GetDefinition(langFlagsCfg);
- fprintf(
- fout, "set(%s %s)\n", langFlagsCfg.c_str(),
- cmOutputConverter::EscapeForCMake(flagsCfg ? flagsCfg : "").c_str());
}
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0056)) {
case cmPolicies::WARN:
@@ -383,76 +399,51 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
fname.c_str());
}
- /* for the TRY_COMPILEs we want to be able to specify the architecture.
- So the user can set CMAKE_OSX_ARCHITECTURES to i386;ppc and then set
- CMAKE_TRY_COMPILE_OSX_ARCHITECTURES first to i386 and then to ppc to
- have the tests run for each specific architecture. Since
- cmLocalGenerator doesn't allow building for "the other"
- architecture only via CMAKE_OSX_ARCHITECTURES.
- */
- if (this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_OSX_ARCHITECTURES") !=
- 0) {
- std::string flag = "-DCMAKE_OSX_ARCHITECTURES=";
- flag += this->Makefile->GetSafeDefinition(
- "CMAKE_TRY_COMPILE_OSX_ARCHITECTURES");
- cmakeFlags.push_back(flag);
- } else if (this->Makefile->GetDefinition("CMAKE_OSX_ARCHITECTURES") != 0) {
- std::string flag = "-DCMAKE_OSX_ARCHITECTURES=";
- flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES");
- cmakeFlags.push_back(flag);
- }
- /* on APPLE also pass CMAKE_OSX_SYSROOT to the try_compile */
- if (this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT") != 0) {
- std::string flag = "-DCMAKE_OSX_SYSROOT=";
- flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_SYSROOT");
- cmakeFlags.push_back(flag);
- }
- /* on APPLE also pass CMAKE_OSX_DEPLOYMENT_TARGET to the try_compile */
- if (this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET") != 0) {
- std::string flag = "-DCMAKE_OSX_DEPLOYMENT_TARGET=";
- flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
- cmakeFlags.push_back(flag);
- }
- if (const char* cxxDef =
- this->Makefile->GetDefinition("CMAKE_CXX_COMPILER_TARGET")) {
- std::string flag = "-DCMAKE_CXX_COMPILER_TARGET=";
- flag += cxxDef;
- cmakeFlags.push_back(flag);
- }
- if (const char* cDef =
- this->Makefile->GetDefinition("CMAKE_C_COMPILER_TARGET")) {
- std::string flag = "-DCMAKE_C_COMPILER_TARGET=";
- flag += cDef;
- cmakeFlags.push_back(flag);
- }
- if (const char* tcxxDef = this->Makefile->GetDefinition(
- "CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN")) {
- std::string flag = "-DCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN=";
- flag += tcxxDef;
- cmakeFlags.push_back(flag);
- }
- if (const char* tcDef = this->Makefile->GetDefinition(
- "CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN")) {
- std::string flag = "-DCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN=";
- flag += tcDef;
- cmakeFlags.push_back(flag);
- }
- if (const char* rootDef = this->Makefile->GetDefinition("CMAKE_SYSROOT")) {
- std::string flag = "-DCMAKE_SYSROOT=";
- flag += rootDef;
- cmakeFlags.push_back(flag);
- }
- if (this->Makefile->GetDefinition("CMAKE_POSITION_INDEPENDENT_CODE") !=
- 0) {
- fprintf(fout, "set(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n");
- }
- if (const char* lssDef =
- this->Makefile->GetDefinition("CMAKE_LINK_SEARCH_START_STATIC")) {
- fprintf(fout, "set(CMAKE_LINK_SEARCH_START_STATIC \"%s\")\n", lssDef);
- }
- if (const char* lssDef =
- this->Makefile->GetDefinition("CMAKE_LINK_SEARCH_END_STATIC")) {
- fprintf(fout, "set(CMAKE_LINK_SEARCH_END_STATIC \"%s\")\n", lssDef);
+ // Forward a set of variables to the inner project cache.
+ {
+ std::set<std::string> vars;
+ vars.insert(kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN);
+ vars.insert(kCMAKE_C_COMPILER_TARGET);
+ vars.insert(kCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN);
+ vars.insert(kCMAKE_CXX_COMPILER_TARGET);
+ vars.insert(kCMAKE_ENABLE_EXPORTS);
+ vars.insert(kCMAKE_LINK_SEARCH_END_STATIC);
+ vars.insert(kCMAKE_LINK_SEARCH_START_STATIC);
+ vars.insert(kCMAKE_OSX_ARCHITECTURES);
+ vars.insert(kCMAKE_OSX_DEPLOYMENT_TARGET);
+ vars.insert(kCMAKE_OSX_SYSROOT);
+ vars.insert(kCMAKE_POSITION_INDEPENDENT_CODE);
+ vars.insert(kCMAKE_SYSROOT);
+
+ if (const char* varListStr = this->Makefile->GetDefinition(
+ kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES)) {
+ std::vector<std::string> varList;
+ cmSystemTools::ExpandListArgument(varListStr, varList);
+ vars.insert(varList.begin(), varList.end());
+ }
+
+ /* for the TRY_COMPILEs we want to be able to specify the architecture.
+ So the user can set CMAKE_OSX_ARCHITECTURES to i386;ppc and then set
+ CMAKE_TRY_COMPILE_OSX_ARCHITECTURES first to i386 and then to ppc to
+ have the tests run for each specific architecture. Since
+ cmLocalGenerator doesn't allow building for "the other"
+ architecture only via CMAKE_OSX_ARCHITECTURES.
+ */
+ if (const char* tcArchs = this->Makefile->GetDefinition(
+ kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES)) {
+ vars.erase(kCMAKE_OSX_ARCHITECTURES);
+ std::string flag = "-DCMAKE_OSX_ARCHITECTURES=" + std::string(tcArchs);
+ cmakeFlags.push_back(flag);
+ }
+
+ for (std::set<std::string>::iterator vi = vars.begin(); vi != vars.end();
+ ++vi) {
+ std::string const& var = *vi;
+ if (const char* val = this->Makefile->GetDefinition(var)) {
+ std::string flag = "-D" + var + "=" + val;
+ cmakeFlags.push_back(flag);
+ }
+ }
}
/* Set the appropriate policy information for ENABLE_EXPORTS */
@@ -461,10 +452,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
cmPolicies::NEW
? "NEW"
: "OLD");
- if (const char* ee =
- this->Makefile->GetDefinition("CMAKE_ENABLE_EXPORTS")) {
- fprintf(fout, "set(CMAKE_ENABLE_EXPORTS %s)\n", ee);
- }
if (targetType == cmState::EXECUTABLE) {
/* Put the executable at a known location (for COPY_FILE). */
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 6f7cfbe..d8c629c 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -95,9 +95,9 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
func_name = cmSystemTools::GetFilenameWithoutLastExtension(*i);
}
cmSystemTools::ConvertToUnixSlashes(func_name);
- cmSystemTools::ReplaceString(func_name, " ", "_");
- cmSystemTools::ReplaceString(func_name, "/", "_");
- cmSystemTools::ReplaceString(func_name, ":", "_");
+ std::replace(func_name.begin(), func_name.end(), ' ', '_');
+ std::replace(func_name.begin(), func_name.end(), '/', '_');
+ std::replace(func_name.begin(), func_name.end(), ':', '_');
tests_func_name.push_back(func_name);
forwardDeclareCode += "int ";
forwardDeclareCode += func_name;
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 0a5c7fa..78bb1b2 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -238,17 +238,17 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// convert the dependencies to paths relative to the home output
// directory. We must do the same here.
std::string obj_i =
- this->LocalGenerator->Convert(obj, cmLocalGenerator::HOME_OUTPUT);
+ this->LocalGenerator->Convert(obj, cmOutputConverter::HOME_OUTPUT);
std::string obj_m = this->LocalGenerator->ConvertToOutputFormat(
- obj_i, cmLocalGenerator::MAKERULE);
+ obj_i, cmOutputConverter::MAKERULE);
internalDepends << obj_i << std::endl;
for (std::set<std::string>::const_iterator i = dependencies.begin();
i != dependencies.end(); ++i) {
makeDepends << obj_m << ": "
- << this->LocalGenerator->Convert(*i,
- cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKERULE)
+ << this->LocalGenerator->Convert(
+ *i, cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::MAKERULE)
<< std::endl;
internalDepends << " " << *i << std::endl;
}
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index b8af178..38e319d 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -77,7 +77,7 @@ cmDependsFortran::cmDependsFortran(cmLocalGenerator* lg)
for (std::vector<std::string>::const_iterator it = definitions.begin();
it != definitions.end(); ++it) {
std::string def = *it;
- std::string::size_type assignment = def.find("=");
+ std::string::size_type assignment = def.find('=');
if (assignment != std::string::npos) {
def = it->substr(0, assignment);
}
@@ -192,16 +192,16 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
stamp += ".mod.stamp";
fcStream << "\n";
fcStream << " \""
- << this->LocalGenerator->Convert(mod_lower,
- cmLocalGenerator::START_OUTPUT)
+ << this->LocalGenerator->Convert(
+ mod_lower, cmOutputConverter::START_OUTPUT)
<< "\"\n";
fcStream << " \""
- << this->LocalGenerator->Convert(mod_upper,
- cmLocalGenerator::START_OUTPUT)
+ << this->LocalGenerator->Convert(
+ mod_upper, cmOutputConverter::START_OUTPUT)
<< "\"\n";
fcStream << " \""
- << this->LocalGenerator->Convert(stamp,
- cmLocalGenerator::START_OUTPUT)
+ << this->LocalGenerator->Convert(
+ stamp, cmOutputConverter::START_OUTPUT)
<< "\"\n";
}
fcStream << " )\n";
@@ -317,17 +317,17 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
// Write the include dependencies to the output stream.
std::string obj_i =
- this->LocalGenerator->Convert(obj, cmLocalGenerator::HOME_OUTPUT);
+ this->LocalGenerator->Convert(obj, cmOutputConverter::HOME_OUTPUT);
std::string obj_m = this->LocalGenerator->ConvertToOutputFormat(
- obj_i, cmLocalGenerator::MAKERULE);
+ obj_i, cmOutputConverter::MAKERULE);
internalDepends << obj_i << std::endl;
internalDepends << " " << src << std::endl;
for (std::set<std::string>::const_iterator i = info.Includes.begin();
i != info.Includes.end(); ++i) {
makeDepends << obj_m << ": "
- << this->LocalGenerator->Convert(*i,
- cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKERULE)
+ << this->LocalGenerator->Convert(
+ *i, cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::MAKERULE)
<< std::endl;
internalDepends << " " << *i << std::endl;
}
@@ -354,7 +354,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
proxy += *i;
proxy += ".mod.proxy";
proxy = this->LocalGenerator->Convert(
- proxy, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE);
+ proxy, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
// since we require some things add them to our list of requirements
makeDepends << obj_m << ".requires: " << proxy << std::endl;
@@ -370,8 +370,8 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
if (!required->second.empty()) {
// This module is known. Depend on its timestamp file.
std::string stampFile = this->LocalGenerator->Convert(
- required->second, cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKERULE);
+ required->second, cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::MAKERULE);
makeDepends << obj_m << ": " << stampFile << "\n";
} else {
// This module is not known to CMake. Try to locate it where
@@ -379,7 +379,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
std::string module;
if (this->FindModule(*i, module)) {
module = this->LocalGenerator->Convert(
- module, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE);
+ module, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
makeDepends << obj_m << ": " << module << "\n";
}
}
@@ -392,8 +392,8 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
proxy += "/";
proxy += *i;
proxy += ".mod.proxy";
- proxy = this->LocalGenerator->Convert(proxy, cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKERULE);
+ proxy = this->LocalGenerator->Convert(
+ proxy, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
makeDepends << proxy << ": " << obj_m << ".provides" << std::endl;
}
@@ -415,13 +415,13 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
modFile += "/";
modFile += *i;
modFile = this->LocalGenerator->Convert(
- modFile, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::SHELL);
+ modFile, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::SHELL);
std::string stampFile = stamp_dir;
stampFile += "/";
stampFile += m;
stampFile += ".mod.stamp";
stampFile = this->LocalGenerator->Convert(
- stampFile, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::SHELL);
+ stampFile, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::SHELL);
makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " << modFile
<< " " << stampFile;
cmMakefile* mf = this->LocalGenerator->GetMakefile();
@@ -441,7 +441,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
std::string driver = this->TargetDirectory;
driver += "/build";
driver = this->LocalGenerator->Convert(
- driver, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE);
+ driver, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
makeDepends << driver << ": " << obj_m << ".provides.build\n";
}
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 2d645da..736c7da 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -608,8 +608,8 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
while ((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos) {
std::string::size_type nameStartPos =
pos + sizeof("$<TARGET_PROPERTY:") - 1;
- std::string::size_type closePos = input.find(">", nameStartPos);
- std::string::size_type commaPos = input.find(",", nameStartPos);
+ std::string::size_type closePos = input.find('>', nameStartPos);
+ std::string::size_type commaPos = input.find(',', nameStartPos);
std::string::size_type nextOpenPos = input.find("$<", nameStartPos);
if (commaPos == input.npos // Implied 'this' target
|| closePos == input.npos // Imcomplete expression.
@@ -634,7 +634,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
lastPos = pos;
while ((pos = input.find("$<TARGET_NAME:", lastPos)) != input.npos) {
std::string::size_type nameStartPos = pos + sizeof("$<TARGET_NAME:") - 1;
- std::string::size_type endPos = input.find(">", nameStartPos);
+ std::string::size_type endPos = input.find('>', nameStartPos);
if (endPos == input.npos) {
errorString = "$<TARGET_NAME:...> expression incomplete";
break;
@@ -659,7 +659,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
while (errorString.empty() &&
(pos = input.find("$<LINK_ONLY:", lastPos)) != input.npos) {
std::string::size_type nameStartPos = pos + sizeof("$<LINK_ONLY:") - 1;
- std::string::size_type endPos = input.find(">", nameStartPos);
+ std::string::size_type endPos = input.find('>', nameStartPos);
if (endPos == input.npos) {
errorString = "$<LINK_ONLY:...> expression incomplete";
break;
diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx
index e3c8fa4..0e42d75 100644
--- a/Source/cmExternalMakefileProjectGenerator.cxx
+++ b/Source/cmExternalMakefileProjectGenerator.cxx
@@ -43,9 +43,8 @@ std::string cmExternalMakefileProjectGenerator::GetGlobalGeneratorName(
return "";
}
- std::string currentName = fullName;
// if we get only the short name, take the first global generator as default
- if (currentName == this->GetName()) {
+ if (fullName == this->GetName()) {
return this->SupportedGlobalGenerators[0];
}
@@ -53,7 +52,7 @@ std::string cmExternalMakefileProjectGenerator::GetGlobalGeneratorName(
for (std::vector<std::string>::const_iterator it =
this->SupportedGlobalGenerators.begin();
it != this->SupportedGlobalGenerators.end(); ++it) {
- if (this->CreateFullGeneratorName(*it, this->GetName()) == currentName) {
+ if (this->CreateFullGeneratorName(*it, this->GetName()) == fullName) {
return *it;
}
}
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 2070b1f..589bf53 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -578,19 +578,20 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
}
// the include directories for this target
- std::set<std::string> uniqIncludeDirs;
+ std::vector<std::string> allIncludeDirs;
std::vector<std::string> includes;
lg->GetIncludeDirectories(includes, target, "C", buildType);
- uniqIncludeDirs.insert(includes.begin(), includes.end());
+ allIncludeDirs.insert(allIncludeDirs.end(), includes.begin(),
+ includes.end());
std::string systemIncludeDirs = makefile->GetSafeDefinition(
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
if (!systemIncludeDirs.empty()) {
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
- uniqIncludeDirs.insert(dirs.begin(), dirs.end());
+ allIncludeDirs.insert(allIncludeDirs.end(), dirs.begin(), dirs.end());
}
systemIncludeDirs = makefile->GetSafeDefinition(
@@ -598,13 +599,16 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
if (!systemIncludeDirs.empty()) {
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
- uniqIncludeDirs.insert(dirs.begin(), dirs.end());
+ allIncludeDirs.insert(allIncludeDirs.end(), dirs.begin(), dirs.end());
}
- for (std::set<std::string>::const_iterator dirIt = uniqIncludeDirs.begin();
- dirIt != uniqIncludeDirs.end(); ++dirIt) {
+ std::vector<std::string>::const_iterator end =
+ cmRemoveDuplicates(allIncludeDirs);
+
+ for (std::vector<std::string>::const_iterator i = allIncludeDirs.begin();
+ i != end; ++i) {
xml.StartElement("Add");
- xml.Attribute("directory", *dirIt);
+ xml.Attribute("directory", *i);
xml.EndElement();
}
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index a8f2e3f..f24e7fb 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -435,11 +435,7 @@ void cmExtraEclipseCDT4Generator::WriteGroups(
linkName3 += "/";
linkName3 += sgIt->GetFullName();
- size_t pos = 0;
- while ((pos = linkName3.find("\\", pos)) != std::string::npos) {
- linkName3.replace(pos, 1, "/");
- pos++;
- }
+ std::replace(linkName3.begin(), linkName3.end(), '\\', '/');
this->AppendLinkedResource(xml, linkName3, "virtual:/virtual",
VirtualFolder);
@@ -902,7 +898,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
const std::vector<cmGeneratorTarget*> targets =
(*it)->GetGeneratorTargets();
std::string subdir = (*it)->Convert((*it)->GetCurrentBinaryDirectory(),
- cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter::HOME_OUTPUT);
if (subdir == ".") {
subdir = "";
}
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 5363a99..4e72f36 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -823,6 +823,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
std::vector<std::string>::size_type cc;
std::vector<std::string>& files = g.GetFiles();
+ std::sort(files.begin(), files.end());
for (cc = 0; cc < files.size(); cc++) {
if (!first) {
output += ";";
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 002f9ec..53243b8 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -300,7 +300,7 @@ void cmGeneratorExpression::Split(const std::string& input,
std::string part = input.substr(lastPos, pos - lastPos);
std::string preGenex;
if (!part.empty()) {
- std::string::size_type startPos = input.rfind(";", pos);
+ std::string::size_type startPos = input.rfind(';', pos);
if (startPos == std::string::npos) {
preGenex = part;
part = "";
@@ -364,7 +364,7 @@ std::string::size_type cmGeneratorExpression::Find(const std::string& input)
{
const std::string::size_type openpos = input.find("$<");
if (openpos != std::string::npos &&
- input.find(">", openpos) != std::string::npos) {
+ input.find('>', openpos) != std::string::npos) {
return openpos;
}
return std::string::npos;
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index c69e362..5b48eea 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -76,7 +76,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(
return;
}
- lg->GetMakefile()->AddCMakeOutputFile(outputFileName.c_str());
+ lg->GetMakefile()->AddCMakeOutputFile(outputFileName);
this->Files.push_back(outputFileName);
outputFiles[outputFileName] = outputContent;
@@ -114,7 +114,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg)
if (this->InputIsContent) {
inputContent = this->Input;
} else {
- lg->GetMakefile()->AddCMakeDependFile(this->Input.c_str());
+ lg->GetMakefile()->AddCMakeDependFile(this->Input);
cmSystemTools::GetPermissions(this->Input.c_str(), perm);
cmsys::ifstream fin(this->Input.c_str());
if (!fin) {
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 31fff9f..3856091 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -145,7 +145,7 @@ struct DoAccept<true>
// where the user supplied the file name and Visual Studio
// appended the suffix.
std::string resx = f->GetFullPath();
- std::string hFileName = resx.substr(0, resx.find_last_of(".")) + ".h";
+ std::string hFileName = resx.substr(0, resx.find_last_of('.')) + ".h";
data.ExpectedResxHeaders.insert(hFileName);
data.ResxSources.push_back(f);
}
@@ -2415,6 +2415,18 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
cmDeleteAll(linkInterfaceIncludeDirectoriesEntries);
+ // Add standard include directories for this language.
+ std::string const standardIncludesVar =
+ "CMAKE_" + lang + "_STANDARD_INCLUDE_DIRECTORIES";
+ std::string const standardIncludes =
+ this->Makefile->GetSafeDefinition(standardIncludesVar);
+ std::vector<std::string>::size_type const before = includes.size();
+ cmSystemTools::ExpandListArgument(standardIncludes, includes);
+ for (std::vector<std::string>::iterator i = includes.begin() + before;
+ i != includes.end(); ++i) {
+ cmSystemTools::ConvertToUnixSlashes(*i);
+ }
+
return includes;
}
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 325a86e..8565fdb 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -18,7 +18,6 @@
#include "cmSourceFile.h"
#include "cmTarget.h"
#include <assert.h>
-#include <cmAlgorithms.h>
std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
@@ -323,8 +322,10 @@ void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
void cmGhsMultiTargetGenerator::WriteIncludes(const std::string& config,
const std::string& language)
{
- std::vector<std::string> includes =
- this->GeneratorTarget->GetIncludeDirectories(config, language);
+ std::vector<std::string> includes;
+ this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
+ language, config);
+
for (std::vector<std::string>::const_iterator includes_i = includes.begin();
includes_i != includes.end(); ++includes_i) {
*this->GetFolderBuildStreams() << " -I\"" << *includes_i << "\""
@@ -466,20 +467,14 @@ cmGhsMultiTargetGenerator::GetObjectNames(
for (std::vector<cmSourceFile*>::const_iterator sf =
duplicateSources.begin();
sf != duplicateSources.end(); ++sf) {
- static std::string::size_type const MAX_FULL_PATH_LENGTH = 247;
std::string const longestObjectDirectory(
cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory(
localGhsMultiGenerator, generatorTarget, *sf));
- std::string fullFilename = (*sf)->GetFullPath();
- bool const ObjPathFound = cmLocalGeneratorCheckObjectName(
- fullFilename, longestObjectDirectory.size(), MAX_FULL_PATH_LENGTH);
- if (!ObjPathFound) {
- cmSystemTools::Error("Object path \"", fullFilename.c_str(),
- "\" too long", "");
- }
- cmsys::SystemTools::ReplaceString(fullFilename, ":/", "_");
- cmsys::SystemTools::ReplaceString(fullFilename, "/", "_");
- objectNamesCorrected[*sf] = fullFilename;
+ std::string objFilenameName =
+ localGhsMultiGenerator->GetObjectFileNameWithoutTarget(
+ **sf, longestObjectDirectory);
+ cmsys::SystemTools::ReplaceString(objFilenameName, "/", "_");
+ objectNamesCorrected[*sf] = objFilenameName;
}
return objectNamesCorrected;
@@ -517,8 +512,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si));
if (objectNames.end() != objectNames.find(*si)) {
*this->FolderBuildStreams[sgPath]
- << " -o \"" << objectNames.find(*si)->second << ".o\""
- << std::endl;
+ << " -o \"" << objectNames.find(*si)->second << "\"" << std::endl;
}
this->WriteObjectDir(this->FolderBuildStreams[sgPath],
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3f4c22f..a1764a3 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1385,6 +1385,9 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
void cmGlobalGenerator::FinalizeTargetCompileInfo()
{
+ std::vector<std::string> const langs =
+ this->CMakeInstance->GetState()->GetEnabledLanguages();
+
// Construct per-target generator information.
for (unsigned int i = 0; i < this->Makefiles.size(); ++i) {
cmMakefile* mf = this->Makefiles[i];
@@ -1429,6 +1432,23 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
}
}
}
+
+ // The standard include directories for each language
+ // should be treated as system include directories.
+ std::set<std::string> standardIncludesSet;
+ for (std::vector<std::string>::const_iterator li = langs.begin();
+ li != langs.end(); ++li) {
+ std::string const standardIncludesVar =
+ "CMAKE_" + *li + "_STANDARD_INCLUDE_DIRECTORIES";
+ std::string const standardIncludesStr =
+ mf->GetSafeDefinition(standardIncludesVar);
+ std::vector<std::string> standardIncludesVec;
+ cmSystemTools::ExpandListArgument(standardIncludesStr,
+ standardIncludesVec);
+ standardIncludesSet.insert(standardIncludesVec.begin(),
+ standardIncludesVec.end());
+ }
+ mf->AddSystemIncludeDirectories(standardIncludesSet);
}
}
@@ -2523,7 +2543,7 @@ void cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
// Shorten the output name (in expected use case).
cmOutputConverter converter(this->GetMakefiles()[0]->GetStateSnapshot());
std::string fname =
- converter.Convert(outputs[0], cmLocalGenerator::HOME_OUTPUT);
+ converter.Convert(outputs[0], cmOutputConverter::HOME_OUTPUT);
// Associate the hash with this output.
this->RuleHashes[fname] = hash;
@@ -2726,7 +2746,7 @@ std::string cmGlobalGenerator::EscapeJSON(const std::string& s)
}
void cmGlobalGenerator::SetFilenameTargetDepends(
- cmSourceFile* sf, std::set<cmGeneratorTarget const*> tgts)
+ cmSourceFile* sf, std::set<cmGeneratorTarget const*> const& tgts)
{
this->FilenameTargetDepends[sf] = tgts;
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index fcf8127..2575911 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -348,8 +348,8 @@ public:
void CreateEvaluationSourceFiles(std::string const& config) const;
- void SetFilenameTargetDepends(cmSourceFile* sf,
- std::set<const cmGeneratorTarget*> tgts);
+ void SetFilenameTargetDepends(
+ cmSourceFile* sf, std::set<cmGeneratorTarget const*> const& tgts);
const std::set<const cmGeneratorTarget*>& GetFilenameTargetDepends(
cmSourceFile* sf) const;
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 8a80f46..0ae913e 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -214,7 +214,7 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream()
this->GetCMakeInstance()->MarkCliAsUsed("GHS_OS_DIR");
}
std::string fOSDir(this->trimQuotes(osDir));
- cmSystemTools::ReplaceString(fOSDir, "\\", "/");
+ std::replace(fOSDir.begin(), fOSDir.end(), '\\', '/');
if (!fOSDir.empty() && ('c' == fOSDir[0] || 'C' == fOSDir[0])) {
this->OSDirRelative = false;
} else {
@@ -230,7 +230,7 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream()
this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME");
}
std::string fBspName(this->trimQuotes(bspName));
- cmSystemTools::ReplaceString(fBspName, "\\", "/");
+ std::replace(fBspName.begin(), fBspName.end(), '\\', '/');
this->WriteMacros();
this->WriteHighLevelDirectives();
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 012ef90..143ad92 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -46,15 +46,14 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
if (comment.empty())
return;
- std::string replace = comment;
std::string::size_type lpos = 0;
std::string::size_type rpos;
os << "\n#############################################\n";
- while ((rpos = replace.find('\n', lpos)) != std::string::npos) {
- os << "# " << replace.substr(lpos, rpos - lpos) << "\n";
+ while ((rpos = comment.find('\n', lpos)) != std::string::npos) {
+ os << "# " << comment.substr(lpos, rpos - lpos) << "\n";
lpos = rpos + 1;
}
- os << "# " << replace.substr(lpos) << "\n\n";
+ os << "# " << comment.substr(lpos) << "\n\n";
}
std::string cmGlobalNinjaGenerator::EncodeRuleName(std::string const& name)
@@ -113,9 +112,9 @@ std::string cmGlobalNinjaGenerator::EncodePath(const std::string& path)
std::string result = path;
#ifdef _WIN32
if (this->IsGCCOnWindows())
- cmSystemTools::ReplaceString(result, "\\", "/");
+ std::replace(result.begin(), result.end(), '\\', '/');
else
- cmSystemTools::ReplaceString(result, "/", "\\");
+ std::replace(result.begin(), result.end(), '/', '\\');
#endif
return EncodeLiteral(result);
}
@@ -289,7 +288,7 @@ void cmGlobalNinjaGenerator::AddMacOSXContentRule()
std::ostringstream cmd;
cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(),
- cmLocalGenerator::SHELL)
+ cmOutputConverter::SHELL)
<< " -E copy $in $out";
this->AddRule("COPY_OSX_CONTENT", cmd.str(), "Copying OS X Content $out",
@@ -488,6 +487,10 @@ void cmGlobalNinjaGenerator::Generate()
this->OpenBuildFileStream();
this->OpenRulesFileStream();
+ this->InitOutputPathPrefix();
+ this->TargetAll = this->NinjaOutputPath("all");
+ this->CMakeCacheFile = this->NinjaOutputPath("CMakeCache.txt");
+
this->PolicyCMP0058 =
this->LocalGenerators[0]->GetMakefile()->GetPolicyStatus(
cmPolicies::CMP0058);
@@ -714,13 +717,31 @@ void cmGlobalNinjaGenerator::CloseRulesFileStream()
}
}
+static void EnsureTrailingSlash(std::string& path)
+{
+ if (path.empty()) {
+ return;
+ }
+ std::string::value_type last = path[path.size() - 1];
+#ifdef _WIN32
+ if (last != '\\') {
+ path += '\\';
+ }
+#else
+ if (last != '/') {
+ path += '/';
+ }
+#endif
+}
+
std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path)
{
cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
std::string convPath = ng->Convert(path, cmOutputConverter::HOME_OUTPUT);
+ convPath = this->NinjaOutputPath(convPath);
#ifdef _WIN32
- cmSystemTools::ReplaceString(convPath, "/", "\\");
+ std::replace(convPath.begin(), convPath.end(), '/', '\\');
#endif
return convPath;
}
@@ -731,8 +752,9 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaFolderRule(
cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
std::string convPath = ng->Convert(path + "/all", cmOutputConverter::HOME);
+ convPath = this->NinjaOutputPath(convPath);
#ifdef _WIN32
- cmSystemTools::ReplaceString(convPath, "/", "\\");
+ std::replace(convPath.begin(), convPath.end(), '/', '\\');
#endif
return convPath;
}
@@ -836,22 +858,17 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
}
case cmState::OBJECT_LIBRARY:
case cmState::UTILITY: {
- std::string path = this->ConvertToNinjaPath(
- target->GetLocalGenerator()->GetCurrentBinaryDirectory());
- if (path.empty() || path == ".")
- outputs.push_back(target->GetName());
- else {
- path += "/";
- path += target->GetName();
- outputs.push_back(path);
- }
+ std::string path =
+ target->GetLocalGenerator()->GetCurrentBinaryDirectory() +
+ std::string("/") + target->GetName();
+ outputs.push_back(this->ConvertToNinjaPath(path));
break;
}
case cmState::GLOBAL_TARGET:
// Always use the target in HOME instead of an unused duplicate in a
// subdirectory.
- outputs.push_back(target->GetName());
+ outputs.push_back(this->NinjaOutputPath(target->GetName()));
break;
default:
@@ -885,6 +902,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
cmGeneratorTarget* target)
{
+ std::string buildAlias = this->NinjaOutputPath(alias);
cmNinjaDeps outputs;
this->AppendTargetOutputs(target, outputs);
// Mark the target's outputs as ambiguous to ensure that no other target uses
@@ -895,7 +913,7 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
// Insert the alias into the map. If the alias was already present in the
// map and referred to another target, mark it as ambiguous.
std::pair<TargetAliasMap::iterator, bool> newAlias =
- TargetAliases.insert(std::make_pair(alias, target));
+ TargetAliases.insert(std::make_pair(buildAlias, target));
if (newAlias.second && newAlias.first->second != target)
newAlias.first->second = 0;
}
@@ -1043,7 +1061,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
}
}
}
- knownDependencies.insert("CMakeCache.txt");
+ knownDependencies.insert(this->CMakeCacheFile);
for (TargetAliasMap::const_iterator i = this->TargetAliases.begin();
i != this->TargetAliases.end(); ++i) {
@@ -1064,7 +1082,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
// should all match now.
std::vector<std::string> unknownExplicitDepends;
- this->CombinedCustomCommandExplicitDependencies.erase("all");
+ this->CombinedCustomCommandExplicitDependencies.erase(this->TargetAll);
std::set_difference(this->CombinedCustomCommandExplicitDependencies.begin(),
this->CombinedCustomCommandExplicitDependencies.end(),
@@ -1130,13 +1148,15 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)
void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os)
{
cmNinjaDeps outputs;
- outputs.push_back("all");
+ outputs.push_back(this->TargetAll);
this->WritePhonyBuild(os, "The main all target.", outputs,
this->AllDependencies);
- cmGlobalNinjaGenerator::WriteDefault(os, outputs,
- "Make the all target the default.");
+ if (!this->HasOutputPathPrefix()) {
+ cmGlobalNinjaGenerator::WriteDefault(os, outputs,
+ "Make the all target the default.");
+ }
}
void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
@@ -1145,13 +1165,13 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
std::ostringstream cmd;
cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(),
- cmLocalGenerator::SHELL)
+ cmOutputConverter::SHELL)
<< " -H"
<< lg->ConvertToOutputFormat(lg->GetSourceDirectory(),
- cmLocalGenerator::SHELL)
+ cmOutputConverter::SHELL)
<< " -B"
<< lg->ConvertToOutputFormat(lg->GetBinaryDirectory(),
- cmLocalGenerator::SHELL);
+ cmOutputConverter::SHELL);
WriteRule(*this->RulesFileStream, "RERUN_CMAKE", cmd.str(),
"Re-running CMake...", "Rule for re-running cmake.",
/*depfile=*/"",
@@ -1171,7 +1191,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
implicitDeps.push_back(this->ConvertToNinjaPath(*fi));
}
}
- implicitDeps.push_back("CMakeCache.txt");
+ implicitDeps.push_back(this->CMakeCacheFile);
std::sort(implicitDeps.begin(), implicitDeps.end());
implicitDeps.erase(std::unique(implicitDeps.begin(), implicitDeps.end()),
@@ -1184,9 +1204,10 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
variables["pool"] = "console";
}
+ std::string const ninjaBuildFile = this->NinjaOutputPath(NINJA_BUILD_FILE);
this->WriteBuild(os, "Re-run CMake if any of its inputs changed.",
"RERUN_CMAKE",
- /*outputs=*/cmNinjaDeps(1, NINJA_BUILD_FILE),
+ /*outputs=*/cmNinjaDeps(1, ninjaBuildFile),
/*explicitDeps=*/cmNinjaDeps(), implicitDeps,
/*orderOnlyDeps=*/cmNinjaDeps(), variables);
@@ -1199,7 +1220,7 @@ std::string cmGlobalNinjaGenerator::ninjaCmd() const
cmLocalGenerator* lgen = this->LocalGenerators[0];
if (lgen) {
return lgen->ConvertToOutputFormat(this->NinjaCommand,
- cmLocalGenerator::SHELL);
+ cmOutputConverter::SHELL);
}
return "ninja";
}
@@ -1223,7 +1244,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
/*restat=*/"",
/*generator=*/false);
WriteBuild(os, "Clean all the built files.", "CLEAN",
- /*outputs=*/cmNinjaDeps(1, "clean"),
+ /*outputs=*/cmNinjaDeps(1, this->NinjaOutputPath("clean")),
/*explicitDeps=*/cmNinjaDeps(),
/*implicitDeps=*/cmNinjaDeps(),
/*orderOnlyDeps=*/cmNinjaDeps(),
@@ -1242,9 +1263,35 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
/*restat=*/"",
/*generator=*/false);
WriteBuild(os, "Print all primary targets available.", "HELP",
- /*outputs=*/cmNinjaDeps(1, "help"),
+ /*outputs=*/cmNinjaDeps(1, this->NinjaOutputPath("help")),
/*explicitDeps=*/cmNinjaDeps(),
/*implicitDeps=*/cmNinjaDeps(),
/*orderOnlyDeps=*/cmNinjaDeps(),
/*variables=*/cmNinjaVars());
}
+
+void cmGlobalNinjaGenerator::InitOutputPathPrefix()
+{
+ this->OutputPathPrefix =
+ this->LocalGenerators[0]->GetMakefile()->GetSafeDefinition(
+ "CMAKE_NINJA_OUTPUT_PATH_PREFIX");
+ EnsureTrailingSlash(this->OutputPathPrefix);
+}
+
+std::string cmGlobalNinjaGenerator::NinjaOutputPath(std::string const& path)
+{
+ if (!this->HasOutputPathPrefix() || cmSystemTools::FileIsFullPath(path)) {
+ return path;
+ }
+ return this->OutputPathPrefix + path;
+}
+
+void cmGlobalNinjaGenerator::StripNinjaOutputPathPrefixAsSuffix(
+ std::string& path)
+{
+ if (path.empty()) {
+ return;
+ }
+ EnsureTrailingSlash(path);
+ cmStripSuffixIfExists(path, this->OutputPathPrefix);
+}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 881104f..6d9bfe8 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -314,6 +314,10 @@ public:
static std::string RequiredNinjaVersionForConsolePool() { return "1.5"; }
bool SupportsConsolePool() const;
+ std::string NinjaOutputPath(std::string const& path);
+ bool HasOutputPathPrefix() const { return !this->OutputPathPrefix.empty(); }
+ void StripNinjaOutputPathPrefixAsSuffix(std::string& path);
+
protected:
virtual void Generate();
@@ -397,6 +401,13 @@ private:
std::string NinjaCommand;
std::string NinjaVersion;
+
+private:
+ void InitOutputPathPrefix();
+
+ std::string OutputPathPrefix;
+ std::string TargetAll;
+ std::string CMakeCacheFile;
};
#endif // ! cmGlobalNinjaGenerator_h
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 7b5ea13..cc5d1ba 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -311,11 +311,11 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
cmakefileStream
<< "# The top level Makefile was generated from the following files:\n"
<< "set(CMAKE_MAKEFILE_DEPENDS\n"
- << " \"" << lg->Convert(cache, cmLocalGenerator::START_OUTPUT) << "\"\n";
+ << " \"" << lg->Convert(cache, cmOutputConverter::START_OUTPUT) << "\"\n";
for (std::vector<std::string>::const_iterator i = lfiles.begin();
i != lfiles.end(); ++i) {
cmakefileStream << " \""
- << lg->Convert(*i, cmLocalGenerator::START_OUTPUT)
+ << lg->Convert(*i, cmOutputConverter::START_OUTPUT)
<< "\"\n";
}
cmakefileStream << " )\n\n";
@@ -329,10 +329,10 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
cmakefileStream << "# The corresponding makefile is:\n"
<< "set(CMAKE_MAKEFILE_OUTPUTS\n"
<< " \""
- << lg->Convert(makefileName, cmLocalGenerator::START_OUTPUT)
+ << lg->Convert(makefileName, cmOutputConverter::START_OUTPUT)
<< "\"\n"
<< " \""
- << lg->Convert(check, cmLocalGenerator::START_OUTPUT)
+ << lg->Convert(check, cmOutputConverter::START_OUTPUT)
<< "\"\n";
cmakefileStream << " )\n\n";
@@ -345,7 +345,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
for (std::vector<std::string>::const_iterator k = outfiles.begin();
k != outfiles.end(); ++k) {
cmakefileStream << " \""
- << lg->Convert(*k, cmLocalGenerator::HOME_OUTPUT)
+ << lg->Convert(*k, cmOutputConverter::HOME_OUTPUT)
<< "\"\n";
}
@@ -358,7 +358,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
tmpStr += cmake::GetCMakeFilesDirectory();
tmpStr += "/CMakeDirectoryInformation.cmake";
cmakefileStream << " \""
- << lg->Convert(tmpStr, cmLocalGenerator::HOME_OUTPUT)
+ << lg->Convert(tmpStr, cmOutputConverter::HOME_OUTPUT)
<< "\"\n";
}
cmakefileStream << " )\n\n";
@@ -470,8 +470,8 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2(
// Begin the directory-level rules section.
std::string dir = lg->GetCurrentBinaryDirectory();
- dir = lg->Convert(dir, cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKERULE);
+ dir = lg->Convert(dir, cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::MAKERULE);
lg->WriteDivider(ruleFileStream);
ruleFileStream << "# Directory level rules for directory " << dir << "\n\n";
@@ -716,8 +716,8 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
// # in target
- progCmd << lg->Convert(progress.Dir, cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
+ progCmd << lg->Convert(progress.Dir, cmOutputConverter::FULL,
+ cmOutputConverter::SHELL);
//
std::set<cmGeneratorTarget const*> emitted;
progCmd << " " << this->CountProgressMarksInTarget(gtarget, emitted);
@@ -729,8 +729,8 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
{
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
- progCmd << lg->Convert(progress.Dir, cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
+ progCmd << lg->Convert(progress.Dir, cmOutputConverter::FULL,
+ cmOutputConverter::SHELL);
progCmd << " 0";
commands.push_back(progCmd.str());
}
@@ -958,7 +958,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
if (emittedTargets.insert(name).second) {
path = "... ";
path += name;
- lg->AppendEcho(commands, path.c_str());
+ lg->AppendEcho(commands, path);
}
}
}
@@ -969,7 +969,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
o != localHelp.end(); ++o) {
path = "... ";
path += *o;
- lg->AppendEcho(commands, path.c_str());
+ lg->AppendEcho(commands, path);
}
lg->WriteMakeRule(ruleFileStream, "Help Target", "help", no_depends,
commands, true);
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index cfe5e49..a33bd8b 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -385,7 +385,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
if (vcprojName) {
cmLocalGenerator* lg = target->GetLocalGenerator();
std::string dir = lg->GetCurrentBinaryDirectory();
- dir = root->Convert(dir.c_str(), cmLocalGenerator::START_OUTPUT);
+ dir = root->Convert(dir.c_str(), cmOutputConverter::START_OUTPUT);
if (dir == ".") {
dir = ""; // msbuild cannot handle ".\" prefix
}
@@ -457,7 +457,7 @@ void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
std::string fullName = iter->first;
std::string guid = this->GetGUID(fullName.c_str());
- cmSystemTools::ReplaceString(fullName, "/", "\\");
+ std::replace(fullName.begin(), fullName.end(), '/', '\\');
if (cmSystemTools::StringStartsWith(fullName.c_str(), prefix)) {
fullName = fullName.substr(skip_prefix);
}
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 8066201..1bec581 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -622,7 +622,7 @@ void WriteVSMacrosFileRegistryEntry(const std::string& nextAvailableSubKeyName,
DWORD dw = 0;
std::string s(macrosFile);
- cmSystemTools::ReplaceString(s, "/", "\\");
+ std::replace(s.begin(), s.end(), '/', '\\');
std::wstring ws = cmsys::Encoding::ToWide(s);
result =
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index efc239e..6628cfc 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -367,7 +367,7 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget(
std::string const& tName, std::string const& configName)
{
std::string target = tName;
- cmSystemTools::ReplaceString(target, " ", "_");
+ std::replace(target.begin(), target.end(), ' ', '_');
std::string out = "PostBuild." + target;
if (this->XcodeVersion > 20) {
out += "." + configName;
@@ -660,10 +660,10 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
std::string flags;
const char* srcfmt = sf->GetProperty("Fortran_FORMAT");
switch (this->CurrentLocalGenerator->GetFortranFormat(srcfmt)) {
- case cmLocalGenerator::FortranFormatFixed:
+ case cmOutputConverter::FortranFormatFixed:
flags = "-fixed " + flags;
break;
- case cmLocalGenerator::FortranFormatFree:
+ case cmOutputConverter::FortranFormatFree:
flags = "-free " + flags;
break;
default:
@@ -1982,10 +1982,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
const char* format = 0;
const char* tgtfmt = gtgt->GetProperty("Fortran_FORMAT");
switch (this->CurrentLocalGenerator->GetFortranFormat(tgtfmt)) {
- case cmLocalGenerator::FortranFormatFixed:
+ case cmOutputConverter::FortranFormatFixed:
format = "fixed";
break;
- case cmLocalGenerator::FortranFormatFree:
+ case cmOutputConverter::FortranFormatFree:
format = "free";
break;
default:
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 31fd91a..2fef3a8 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -93,11 +93,11 @@ void cmInstallExportGenerator::ComputeTempDir()
dest[0] = '_';
}
// Avoid windows full paths by removing colons.
- cmSystemTools::ReplaceString(dest, ":", "_");
+ std::replace(dest.begin(), dest.end(), ':', '_');
// Avoid relative paths that go up the tree.
cmSystemTools::ReplaceString(dest, "../", "__/");
// Avoid spaces.
- cmSystemTools::ReplaceString(dest, " ", "_");
+ std::replace(dest.begin(), dest.end(), ' ', '_');
this->TempDir += dest;
}
}
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index a2cfc5a..8c1b357 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -61,7 +61,7 @@ std::string cmInstallFilesGenerator::GetDestination(
}
void cmInstallFilesGenerator::AddFilesInstallRule(
- std::ostream& os, const std::string config, Indent const& indent,
+ std::ostream& os, std::string const& config, Indent const& indent,
std::vector<std::string> const& files)
{
// Write code to install the files.
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 86b5899..0e738d3 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -38,7 +38,7 @@ protected:
virtual void GenerateScriptForConfig(std::ostream& os,
const std::string& config,
Indent const& indent);
- void AddFilesInstallRule(std::ostream& os, const std::string config,
+ void AddFilesInstallRule(std::ostream& os, std::string const& config,
Indent const& indent,
std::vector<std::string> const& files);
diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index af4fc3d..bc1666e 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -8,8 +8,8 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_SUBMINOR_VERSION 0
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -93,15 +93,15 @@ typedef unsigned int flex_uint32_t;
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
-#else /* ! __cplusplus */
+#else /* ! __cplusplus */
/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)
#define YY_USE_CONST
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
#define yyconst const
@@ -179,6 +179,11 @@ typedef void* yyscan_t;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
@@ -197,89 +202,93 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
if ( yytext[yyl] == '\n' )\
--yylineno;\
}while(0)
+ #define YY_LINENO_REWIND_TO(dst) \
+ do {\
+ const char *p;\
+ for ( p = yy_cp-1; p >= (dst); --p)\
+ if ( *p == '\n' )\
+ --yylineno;\
+ }while(0)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
- *yy_cp = yyg->yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
+ *yy_cp = yyg->yy_hold_char; \
+ YY_RESTORE_YY_MORE_OFFSET \
+ yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
+#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
- int yy_buffer_status;
+ int yy_buffer_status;
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via cmListFileLexer_yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via cmListFileLexer_yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
#define YY_BUFFER_EOF_PENDING 2
- };
+ };
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
/* We provide macros for accessing buffer states in case in the
@@ -313,7 +322,7 @@ static void cmListFileLexer_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan
YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
void *cmListFileLexer_yyalloc (yy_size_t ,yyscan_t yyscanner );
void *cmListFileLexer_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
@@ -322,30 +331,30 @@ void cmListFileLexer_yyfree (void * ,yyscan_t yyscanner );
#define yy_new_buffer cmListFileLexer_yy_create_buffer
#define yy_set_interactive(is_interactive) \
- { \
- if ( ! YY_CURRENT_BUFFER ){ \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
cmListFileLexer_yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
+ YY_CURRENT_BUFFER_LVALUE = \
cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
- }
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
#define yy_set_bol(at_bol) \
- { \
- if ( ! YY_CURRENT_BUFFER ){\
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
cmListFileLexer_yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
+ YY_CURRENT_BUFFER_LVALUE = \
cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
- }
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
/* Begin user sect3 */
-#define cmListFileLexer_yywrap(n) 1
+#define cmListFileLexer_yywrap(yyscanner) (/*CONSTCOND*/1)
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
@@ -357,27 +366,30 @@ typedef int yy_state_type;
static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
static int yy_get_next_buffer (yyscan_t yyscanner );
+#if defined(__GNUC__) && __GNUC__ >= 3
+__attribute__((__noreturn__))
+#endif
static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
- yyg->yytext_ptr = yy_bp; \
- yyleng = (size_t) (yy_cp - yy_bp); \
- yyg->yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- yyg->yy_c_buf_p = yy_cp;
+ yyg->yytext_ptr = yy_bp; \
+ yyleng = (size_t) (yy_cp - yy_bp); \
+ yyg->yy_hold_char = *yy_cp; \
+ *yy_cp = '\0'; \
+ yyg->yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 24
#define YY_END_OF_BUFFER 25
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
- {
- flex_int32_t yy_verify;
- flex_int32_t yy_nxt;
- };
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
static yyconst flex_int16_t yy_accept[77] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 4, 4,
@@ -390,7 +402,7 @@ static yyconst flex_int16_t yy_accept[77] =
0, 0, 0, 0, 0, 0
} ;
-static yyconst flex_int32_t yy_ec[256] =
+static yyconst YY_CHAR yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
@@ -422,13 +434,13 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[16] =
+static yyconst YY_CHAR yy_meta[16] =
{ 0,
1, 1, 2, 3, 4, 3, 1, 3, 5, 6,
1, 6, 1, 1, 7
} ;
-static yyconst flex_int16_t yy_base[95] =
+static yyconst flex_uint16_t yy_base[95] =
{ 0,
0, 0, 13, 25, 14, 16, 17, 18, 90, 88,
88, 39, 20, 237, 237, 74, 78, 237, 237, 13,
@@ -458,7 +470,7 @@ static yyconst flex_int16_t yy_def[95] =
} ;
-static yyconst flex_int16_t yy_nxt[253] =
+static yyconst flex_uint16_t yy_nxt[253] =
{ 0,
12, 13, 14, 13, 15, 16, 17, 18, 19, 12,
12, 20, 21, 22, 12, 24, 28, 25, 28, 28,
@@ -552,19 +564,16 @@ static yyconst flex_int32_t yy_rule_can_match_eol[25] =
This file must be translated to C and modified to build everywhere.
-Run flex like this:
+Run flex >= 2.6 like this:
flex --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l
Modify cmListFileLexer.c:
- - remove TABs
- - remove use of the 'register' storage class specifier
- - remove the yyunput function
- - add a statement "(void)yyscanner;" to the top of these methods:
- yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
+ - remove trailing whitespace: sed -i 's/\s*$//' cmListFileLexer.c
+ - remove blank lines at end of file
- remove statement "yyscanner = NULL;" from cmListFileLexer_yylex_destroy
- remove all YY_BREAK lines occurring right after return statements
- - remove the isatty forward declaration
+ - remove unnecessary cast to (int) in yy_get_next_buffer
*/
@@ -583,7 +592,7 @@ Modify cmListFileLexer.c:
struct cmListFileLexer_s
{
cmListFileLexer_Token token;
- int bracket;
+ yy_size_t bracket;
int comment;
int line;
int column;
@@ -649,7 +658,7 @@ struct yyguts_t
YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
char yy_hold_char;
int yy_n_chars;
- int yyleng_r;
+ yy_size_t yyleng_r;
char *yy_c_buf_p;
int yy_init;
int yy_start;
@@ -690,23 +699,23 @@ void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner
FILE *cmListFileLexer_yyget_in (yyscan_t yyscanner );
-void cmListFileLexer_yyset_in (FILE * in_str ,yyscan_t yyscanner );
+void cmListFileLexer_yyset_in (FILE * _in_str ,yyscan_t yyscanner );
FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner );
-void cmListFileLexer_yyset_out (FILE * out_str ,yyscan_t yyscanner );
+void cmListFileLexer_yyset_out (FILE * _out_str ,yyscan_t yyscanner );
-int cmListFileLexer_yyget_leng (yyscan_t yyscanner );
+yy_size_t cmListFileLexer_yyget_leng (yyscan_t yyscanner );
char *cmListFileLexer_yyget_text (yyscan_t yyscanner );
int cmListFileLexer_yyget_lineno (yyscan_t yyscanner );
-void cmListFileLexer_yyset_lineno (int line_number ,yyscan_t yyscanner );
+void cmListFileLexer_yyset_lineno (int _line_number ,yyscan_t yyscanner );
int cmListFileLexer_yyget_column (yyscan_t yyscanner );
-void cmListFileLexer_yyset_column (int column_no ,yyscan_t yyscanner );
+void cmListFileLexer_yyset_column (int _column_no ,yyscan_t yyscanner );
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -720,6 +729,12 @@ extern int cmListFileLexer_yywrap (yyscan_t yyscanner );
#endif
#endif
+#ifndef YY_NO_UNPUT
+
+ static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
+
+#endif
+
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
#endif
@@ -761,33 +776,33 @@ static int input (yyscan_t yyscanner );
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
- { \
- int c = '*'; \
- size_t n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else \
- { \
- errno=0; \
- while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(yyin); \
- } \
- }\
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+ size_t n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else \
+ { \
+ errno=0; \
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ { \
+ if( errno != EINTR) \
+ { \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ break; \
+ } \
+ errno=0; \
+ clearerr(yyin); \
+ } \
+ }\
\
#endif
@@ -832,123 +847,124 @@ extern int cmListFileLexer_yylex (yyscan_t yyscanner);
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
-#define YY_BREAK break;
+#define YY_BREAK /*LINTED*/break;
#endif
#define YY_RULE_SETUP \
- YY_USER_ACTION
+ YY_USER_ACTION
/** The main scanner function which does all the work.
*/
YY_DECL
{
- yy_state_type yy_current_state;
- char *yy_cp, *yy_bp;
- int yy_act;
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 91 "cmListFileLexer.in.l"
+ if ( !yyg->yy_init )
+ {
+ yyg->yy_init = 1;
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
-#line 865 "cmListFileLexer.c"
+ if ( ! yyg->yy_start )
+ yyg->yy_start = 1; /* first start state */
- if ( !yyg->yy_init )
- {
- yyg->yy_init = 1;
+ if ( ! yyin )
+ yyin = stdin;
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
+ if ( ! yyout )
+ yyout = stdout;
- if ( ! yyg->yy_start )
- yyg->yy_start = 1; /* first start state */
+ if ( ! YY_CURRENT_BUFFER ) {
+ cmListFileLexer_yyensure_buffer_stack (yyscanner);
+ YY_CURRENT_BUFFER_LVALUE =
+ cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+ }
- if ( ! yyin )
- yyin = stdin;
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
+ }
- if ( ! yyout )
- yyout = stdout;
+ {
+#line 88 "cmListFileLexer.in.l"
- if ( ! YY_CURRENT_BUFFER ) {
- cmListFileLexer_yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
- cmListFileLexer_yy_load_buffer_state(yyscanner );
- }
+#line 896 "cmListFileLexer.c"
- while ( 1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yyg->yy_c_buf_p;
+ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = yyg->yy_c_buf_p;
- /* Support of yytext. */
- *yy_cp = yyg->yy_hold_char;
+ /* Support of yytext. */
+ *yy_cp = yyg->yy_hold_char;
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
- yy_current_state = yyg->yy_start;
+ yy_current_state = yyg->yy_start;
yy_match:
- do
- {
- YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 77 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- ++yy_cp;
- }
- while ( yy_base[yy_current_state] != 237 );
+ do
+ {
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
+ if ( yy_accept[yy_current_state] )
+ {
+ yyg->yy_last_accepting_state = yy_current_state;
+ yyg->yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 77 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 237 );
yy_find_action:
- yy_act = yy_accept[yy_current_state];
- if ( yy_act == 0 )
- { /* have to back up */
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- yy_act = yy_accept[yy_current_state];
- }
-
- YY_DO_BEFORE_ACTION;
-
- if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
- {
- int yyl;
- for ( yyl = 0; yyl < yyleng; ++yyl )
- if ( yytext[yyl] == '\n' )
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+ if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+ {
+ yy_size_t yyl;
+ for ( yyl = 0; yyl < yyleng; ++yyl )
+ if ( yytext[yyl] == '\n' )
do{ yylineno++;
yycolumn=0;
}while(0)
;
- }
+ }
-do_action: /* This label is used only to access EOF actions. */
+do_action: /* This label is used only to access EOF actions. */
- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yyg->yy_hold_char;
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = yyg->yy_hold_char;
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
+ goto yy_find_action;
case 1:
/* rule 1 can match eol */
YY_RULE_SETUP
-#line 93 "cmListFileLexer.in.l"
+#line 90 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Newline;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -960,51 +976,45 @@ YY_RULE_SETUP
case 2:
/* rule 2 can match eol */
YY_RULE_SETUP
-#line 102 "cmListFileLexer.in.l"
+#line 99 "cmListFileLexer.in.l"
{
const char* bracket = yytext;
lexer->comment = yytext[0] == '#';
- if(lexer->comment)
- {
+ if (lexer->comment) {
lexer->token.type = cmListFileLexer_Token_CommentBracket;
bracket += 1;
- }
- else
- {
+ } else {
lexer->token.type = cmListFileLexer_Token_ArgumentBracket;
- }
+ }
cmListFileLexerSetToken(lexer, "", 0);
- lexer->bracket = (int)(strchr(bracket+1, '[') - bracket);
- if(yytext[yyleng-1] == '\n')
- {
+ lexer->bracket = strchr(bracket+1, '[') - bracket;
+ if (yytext[yyleng-1] == '\n') {
++lexer->line;
lexer->column = 1;
- }
- else
- {
+ } else {
lexer->column += yyleng;
- }
+ }
BEGIN(BRACKET);
}
- YY_BREAK
+ YY_BREAK
case 3:
YY_RULE_SETUP
-#line 128 "cmListFileLexer.in.l"
+#line 119 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
BEGIN(COMMENT);
}
- YY_BREAK
+ YY_BREAK
case 4:
YY_RULE_SETUP
-#line 133 "cmListFileLexer.in.l"
+#line 124 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
}
- YY_BREAK
+ YY_BREAK
case 5:
YY_RULE_SETUP
-#line 137 "cmListFileLexer.in.l"
+#line 128 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ParenLeft;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1013,7 +1023,7 @@ YY_RULE_SETUP
}
case 6:
YY_RULE_SETUP
-#line 144 "cmListFileLexer.in.l"
+#line 135 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ParenRight;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1022,7 +1032,7 @@ YY_RULE_SETUP
}
case 7:
YY_RULE_SETUP
-#line 151 "cmListFileLexer.in.l"
+#line 142 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Identifier;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1031,20 +1041,19 @@ YY_RULE_SETUP
}
case 8:
YY_RULE_SETUP
-#line 158 "cmListFileLexer.in.l"
+#line 149 "cmListFileLexer.in.l"
{
/* Handle ]]====]=======]*/
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
- if(yyleng == lexer->bracket)
- {
+ if (yyleng == lexer->bracket) {
BEGIN(BRACKETEND);
- }
+ }
}
- YY_BREAK
+ YY_BREAK
case 9:
YY_RULE_SETUP
-#line 168 "cmListFileLexer.in.l"
+#line 158 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
/* Erase the partial bracket from the token. */
@@ -1055,35 +1064,35 @@ YY_RULE_SETUP
}
case 10:
YY_RULE_SETUP
-#line 177 "cmListFileLexer.in.l"
+#line 167 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
}
- YY_BREAK
+ YY_BREAK
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
-#line 182 "cmListFileLexer.in.l"
+#line 172 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
++lexer->line;
lexer->column = 1;
BEGIN(BRACKET);
}
- YY_BREAK
+ YY_BREAK
case 12:
YY_RULE_SETUP
-#line 189 "cmListFileLexer.in.l"
+#line 179 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
BEGIN(BRACKET);
}
- YY_BREAK
+ YY_BREAK
case YY_STATE_EOF(BRACKET):
case YY_STATE_EOF(BRACKETEND):
-#line 195 "cmListFileLexer.in.l"
+#line 185 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadBracket;
BEGIN(INITIAL);
@@ -1091,7 +1100,7 @@ case YY_STATE_EOF(BRACKETEND):
}
case 13:
YY_RULE_SETUP
-#line 201 "cmListFileLexer.in.l"
+#line 191 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1100,7 +1109,7 @@ YY_RULE_SETUP
}
case 14:
YY_RULE_SETUP
-#line 208 "cmListFileLexer.in.l"
+#line 198 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1109,7 +1118,7 @@ YY_RULE_SETUP
}
case 15:
YY_RULE_SETUP
-#line 215 "cmListFileLexer.in.l"
+#line 205 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1118,45 +1127,45 @@ YY_RULE_SETUP
}
case 16:
YY_RULE_SETUP
-#line 222 "cmListFileLexer.in.l"
+#line 212 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
cmListFileLexerSetToken(lexer, "", 0);
lexer->column += yyleng;
BEGIN(STRING);
}
- YY_BREAK
+ YY_BREAK
case 17:
YY_RULE_SETUP
-#line 229 "cmListFileLexer.in.l"
+#line 219 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
}
- YY_BREAK
+ YY_BREAK
case 18:
/* rule 18 can match eol */
YY_RULE_SETUP
-#line 234 "cmListFileLexer.in.l"
+#line 224 "cmListFileLexer.in.l"
{
/* Continuation: text is not part of string */
++lexer->line;
lexer->column = 1;
}
- YY_BREAK
+ YY_BREAK
case 19:
/* rule 19 can match eol */
YY_RULE_SETUP
-#line 240 "cmListFileLexer.in.l"
+#line 230 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
++lexer->line;
lexer->column = 1;
}
- YY_BREAK
+ YY_BREAK
case 20:
YY_RULE_SETUP
-#line 246 "cmListFileLexer.in.l"
+#line 236 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
BEGIN(INITIAL);
@@ -1164,14 +1173,14 @@ YY_RULE_SETUP
}
case 21:
YY_RULE_SETUP
-#line 252 "cmListFileLexer.in.l"
+#line 242 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
}
- YY_BREAK
+ YY_BREAK
case YY_STATE_EOF(STRING):
-#line 257 "cmListFileLexer.in.l"
+#line 247 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadString;
BEGIN(INITIAL);
@@ -1179,7 +1188,7 @@ case YY_STATE_EOF(STRING):
}
case 22:
YY_RULE_SETUP
-#line 263 "cmListFileLexer.in.l"
+#line 253 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Space;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1188,7 +1197,7 @@ YY_RULE_SETUP
}
case 23:
YY_RULE_SETUP
-#line 270 "cmListFileLexer.in.l"
+#line 260 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadCharacter;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1197,7 +1206,7 @@ YY_RULE_SETUP
}
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(COMMENT):
-#line 277 "cmListFileLexer.in.l"
+#line 267 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_None;
cmListFileLexerSetToken(lexer, 0, 0);
@@ -1205,339 +1214,387 @@ case YY_STATE_EOF(COMMENT):
}
case 24:
YY_RULE_SETUP
-#line 283 "cmListFileLexer.in.l"
+#line 273 "cmListFileLexer.in.l"
ECHO;
- YY_BREAK
-#line 1238 "cmListFileLexer.c"
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yyg->yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * cmListFileLexer_yylex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
-
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yyg->yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yyg->yy_c_buf_p;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yyg->yy_did_buffer_switch_on_eof = 0;
-
- if ( cmListFileLexer_yywrap(yyscanner ) )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p =
- yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yyg->yy_c_buf_p =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
+ YY_BREAK
+#line 1235 "cmListFileLexer.c"
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = yyg->yy_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * cmListFileLexer_yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( yyscanner );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
+
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++yyg->yy_c_buf_p;
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = yyg->yy_c_buf_p;
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( yyscanner ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ yyg->yy_did_buffer_switch_on_eof = 0;
+
+ if ( cmListFileLexer_yywrap(yyscanner ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yyg->yy_c_buf_p =
+ yyg->yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( yyscanner );
+
+ yy_cp = yyg->yy_c_buf_p;
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ yyg->yy_c_buf_p =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
+
+ yy_current_state = yy_get_previous_state( yyscanner );
+
+ yy_cp = yyg->yy_c_buf_p;
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of user's declarations */
} /* end of cmListFileLexer_yylex */
/* yy_get_next_buffer - try to read in a new buffer
*
* Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
*/
static int yy_get_next_buffer (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- char *source = yyg->yytext_ptr;
- int number_to_move, i;
- int ret_val;
-
- if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
-
- int yy_c_buf_p_offset =
- (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- cmListFileLexer_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
- number_to_move - 1;
-
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, (size_t) num_to_read );
-
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- if ( yyg->yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- cmListFileLexer_yyrestart(yyin ,yyscanner);
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmListFileLexer_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- }
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = yyg->yytext_ptr;
+ yy_size_t number_to_move, i;
+ int ret_val;
+
+ if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
+
+ else
+ {
+ yy_size_t num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+
+ int yy_c_buf_p_offset =
+ (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ yy_size_t new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ cmListFileLexer_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ yyg->yy_n_chars, num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+ }
+
+ if ( yyg->yy_n_chars == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ cmListFileLexer_yyrestart(yyin ,yyscanner);
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmListFileLexer_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
- yyg->yy_n_chars += number_to_move;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+ yyg->yy_n_chars += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
- yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+ yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
- return ret_val;
+ return ret_val;
}
/* yy_get_previous_state - get the state just before the EOB char was reached */
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
{
- yy_state_type yy_current_state;
- char *yy_cp;
+ yy_state_type yy_current_state;
+ char *yy_cp;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yy_current_state = yyg->yy_start;
+ yy_current_state = yyg->yy_start;
- for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
- {
- YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 77 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
+ for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
+ {
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ yyg->yy_last_accepting_state = yy_current_state;
+ yyg->yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 77 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
- return yy_current_state;
+ return yy_current_state;
}
/* yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
- * next_state = yy_try_NUL_trans( current_state );
+ * next_state = yy_try_NUL_trans( current_state );
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
{
- int yy_is_jam;
+ int yy_is_jam;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
- char *yy_cp = yyg->yy_c_buf_p;
-
- YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 77 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 76);
-
- return yy_is_jam ? 0 : yy_current_state;
+ char *yy_cp = yyg->yy_c_buf_p;
+
+ YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ yyg->yy_last_accepting_state = yy_current_state;
+ yyg->yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 77 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 76);
+
+ (void)yyg;
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+#ifndef YY_NO_UNPUT
+
+ static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)
+{
+ char *yy_cp;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ yy_cp = yyg->yy_c_buf_p;
+
+ /* undo effects of setting up yytext */
+ *yy_cp = yyg->yy_hold_char;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ yy_size_t number_to_move = yyg->yy_n_chars + 2;
+ char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ char *source =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+ if ( c == '\n' ){
+ --yylineno;
+ }
+
+ yyg->yytext_ptr = yy_bp;
+ yyg->yy_hold_char = *yy_cp;
+ yyg->yy_c_buf_p = yy_cp;
}
+#endif
+
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput (yyscan_t yyscanner)
@@ -1546,79 +1603,79 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
#endif
{
- int c;
+ int c;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
-
- if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- /* This was really a NUL. */
- *yyg->yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
- ++yyg->yy_c_buf_p;
-
- switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- cmListFileLexer_yyrestart(yyin ,yyscanner);
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( cmListFileLexer_yywrap(yyscanner ) )
- return EOF;
-
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
+
+ if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+ /* This was really a NUL. */
+ *yyg->yy_c_buf_p = '\0';
+
+ else
+ { /* need more input */
+ yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+ ++yyg->yy_c_buf_p;
+
+ switch ( yy_get_next_buffer( yyscanner ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ cmListFileLexer_yyrestart(yyin ,yyscanner);
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( cmListFileLexer_yywrap(yyscanner ) )
+ return EOF;
+
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
#ifdef __cplusplus
- return yyinput(yyscanner);
+ return yyinput(yyscanner);
#else
- return input(yyscanner);
+ return input(yyscanner);
#endif
- }
+ }
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
- break;
- }
- }
- }
+ case EOB_ACT_CONTINUE_SCAN:
+ yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
+ break;
+ }
+ }
+ }
- c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
- *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
- yyg->yy_hold_char = *++yyg->yy_c_buf_p;
+ c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
+ *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
+ yyg->yy_hold_char = *++yyg->yy_c_buf_p;
- if ( c == '\n' )
+ if ( c == '\n' )
do{ yylineno++;
yycolumn=0;
}while(0)
;
- return c;
+ return c;
}
-#endif /* ifndef YY_NO_INPUT */
+#endif /* ifndef YY_NO_INPUT */
/** Immediately switch to a different input stream.
* @param input_file A readable stream.
@@ -1629,14 +1686,14 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if ( ! YY_CURRENT_BUFFER ){
+ if ( ! YY_CURRENT_BUFFER ){
cmListFileLexer_yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
+ YY_CURRENT_BUFFER_LVALUE =
cmListFileLexer_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
+ }
- cmListFileLexer_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
- cmListFileLexer_yy_load_buffer_state(yyscanner );
+ cmListFileLexer_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
}
/** Switch to a different input buffer.
@@ -1647,41 +1704,41 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- /* TODO. We should be able to replace this entire function body
- * with
- * cmListFileLexer_yypop_buffer_state();
- * cmListFileLexer_yypush_buffer_state(new_buffer);
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * cmListFileLexer_yypop_buffer_state();
+ * cmListFileLexer_yypush_buffer_state(new_buffer);
*/
- cmListFileLexer_yyensure_buffer_stack (yyscanner);
- if ( YY_CURRENT_BUFFER == new_buffer )
- return;
-
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
- cmListFileLexer_yy_load_buffer_state(yyscanner );
-
- /* We don't actually know whether we did this switch during
- * EOF (cmListFileLexer_yywrap()) processing, but the only time this flag
- * is looked at is after cmListFileLexer_yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yyg->yy_did_buffer_switch_on_eof = 1;
+ cmListFileLexer_yyensure_buffer_stack (yyscanner);
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (cmListFileLexer_yywrap()) processing, but the only time this flag
+ * is looked at is after cmListFileLexer_yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ yyg->yy_did_buffer_switch_on_eof = 1;
}
static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
- yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
- yyg->yy_hold_char = *yyg->yy_c_buf_p;
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+ yyg->yy_hold_char = *yyg->yy_c_buf_p;
}
/** Allocate and initialize an input buffer state.
@@ -1692,26 +1749,26 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
*/
YY_BUFFER_STATE cmListFileLexer_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
{
- YY_BUFFER_STATE b;
+ YY_BUFFER_STATE b;
- b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" );
+ b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" );
- b->yy_buf_size = size;
+ b->yy_buf_size = (yy_size_t)size;
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) cmListFileLexer_yyalloc(b->yy_buf_size + 2 ,yyscanner );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" );
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) cmListFileLexer_yyalloc(b->yy_buf_size + 2 ,yyscanner );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" );
- b->yy_is_our_buffer = 1;
+ b->yy_is_our_buffer = 1;
- cmListFileLexer_yy_init_buffer(b,file ,yyscanner);
+ cmListFileLexer_yy_init_buffer(b,file ,yyscanner);
- return b;
+ return b;
}
/** Destroy the buffer.
@@ -1722,16 +1779,16 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if ( ! b )
- return;
+ if ( ! b )
+ return;
- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
- if ( b->yy_is_our_buffer )
- cmListFileLexer_yyfree((void *) b->yy_ch_buf ,yyscanner );
+ if ( b->yy_is_our_buffer )
+ cmListFileLexer_yyfree((void *) b->yy_ch_buf ,yyscanner );
- cmListFileLexer_yyfree((void *) b ,yyscanner );
+ cmListFileLexer_yyfree((void *) b ,yyscanner );
}
/* Initializes or reinitializes a buffer.
@@ -1741,13 +1798,13 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
static void cmListFileLexer_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
{
- int oerrno = errno;
+ int oerrno = errno;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- cmListFileLexer_yy_flush_buffer(b ,yyscanner);
+ cmListFileLexer_yy_flush_buffer(b ,yyscanner);
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
/* If b is the current buffer, then cmListFileLexer_yy_init_buffer was _probably_
* called from cmListFileLexer_yyrestart() or through yy_get_next_buffer.
@@ -1760,7 +1817,7 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
- errno = oerrno;
+ errno = oerrno;
}
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
@@ -1770,25 +1827,25 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
void cmListFileLexer_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if ( ! b )
- return;
+ if ( ! b )
+ return;
- b->yy_n_chars = 0;
+ b->yy_n_chars = 0;
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
- b->yy_buf_pos = &b->yy_ch_buf[0];
+ b->yy_buf_pos = &b->yy_ch_buf[0];
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
- if ( b == YY_CURRENT_BUFFER )
- cmListFileLexer_yy_load_buffer_state(yyscanner );
+ if ( b == YY_CURRENT_BUFFER )
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
}
/** Pushes the new state onto the stack. The new state becomes
@@ -1800,28 +1857,28 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
void cmListFileLexer_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (new_buffer == NULL)
- return;
+ if (new_buffer == NULL)
+ return;
- cmListFileLexer_yyensure_buffer_stack(yyscanner);
+ cmListFileLexer_yyensure_buffer_stack(yyscanner);
- /* This block is copied from cmListFileLexer_yy_switch_to_buffer. */
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
+ /* This block is copied from cmListFileLexer_yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+ }
- /* Only push if top exists. Otherwise, replace top. */
- if (YY_CURRENT_BUFFER)
- yyg->yy_buffer_stack_top++;
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ yyg->yy_buffer_stack_top++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
- /* copied from cmListFileLexer_yy_switch_to_buffer. */
- cmListFileLexer_yy_load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
+ /* copied from cmListFileLexer_yy_switch_to_buffer. */
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
+ yyg->yy_did_buffer_switch_on_eof = 1;
}
/** Removes and deletes the top of the stack, if present.
@@ -1831,18 +1888,18 @@ void cmListFileLexer_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t
void cmListFileLexer_yypop_buffer_state (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (!YY_CURRENT_BUFFER)
- return;
+ if (!YY_CURRENT_BUFFER)
+ return;
- cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if (yyg->yy_buffer_stack_top > 0)
- --yyg->yy_buffer_stack_top;
+ cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if (yyg->yy_buffer_stack_top > 0)
+ --yyg->yy_buffer_stack_top;
- if (YY_CURRENT_BUFFER) {
- cmListFileLexer_yy_load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
- }
+ if (YY_CURRENT_BUFFER) {
+ cmListFileLexer_yy_load_buffer_state(yyscanner );
+ yyg->yy_did_buffer_switch_on_eof = 1;
+ }
}
/* Allocates the stack if it does not exist.
@@ -1850,46 +1907,46 @@ void cmListFileLexer_yypop_buffer_state (yyscan_t yyscanner)
*/
static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner)
{
- int num_to_alloc;
+ yy_size_t num_to_alloc;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (!yyg->yy_buffer_stack) {
+ if (!yyg->yy_buffer_stack) {
- /* First allocation is just for 2 elements, since we don't know if this
- * scanner will even need a stack. We use 2 instead of 1 to avoid an
- * immediate realloc on the next call.
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
*/
- num_to_alloc = 1;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyalloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yyensure_buffer_stack()" );
-
- memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
- yyg->yy_buffer_stack_max = num_to_alloc;
- yyg->yy_buffer_stack_top = 0;
- return;
- }
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+ yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ , yyscanner);
+ if ( ! yyg->yy_buffer_stack )
+ YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yyensure_buffer_stack()" );
- if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
+ memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
- /* Increase the buffer to prepare for a possible push. */
- int grow_size = 8 /* arbitrary grow size */;
+ yyg->yy_buffer_stack_max = num_to_alloc;
+ yyg->yy_buffer_stack_top = 0;
+ return;
+ }
- num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyrealloc
- (yyg->yy_buffer_stack,
- num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yyensure_buffer_stack()" );
+ if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
- /* zero only the new slots.*/
- memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
- yyg->yy_buffer_stack_max = num_to_alloc;
- }
+ /* Increase the buffer to prepare for a possible push. */
+ yy_size_t grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
+ yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyrealloc
+ (yyg->yy_buffer_stack,
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ , yyscanner);
+ if ( ! yyg->yy_buffer_stack )
+ YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yyensure_buffer_stack()" );
+
+ /* zero only the new slots.*/
+ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
+ yyg->yy_buffer_stack_max = num_to_alloc;
+ }
}
/** Setup the input buffer state to scan directly from a user-specified character buffer.
@@ -1900,31 +1957,31 @@ static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner)
*/
YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
{
- YY_BUFFER_STATE b;
+ YY_BUFFER_STATE b;
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
- b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_buffer()" );
+ b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_buffer()" );
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
- cmListFileLexer_yy_switch_to_buffer(b ,yyscanner );
+ cmListFileLexer_yy_switch_to_buffer(b ,yyscanner );
- return b;
+ return b;
}
/** Setup the input buffer state to scan a string. The next call to cmListFileLexer_yylex() will
@@ -1938,7 +1995,7 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char * base, yy_size_t size ,
YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
{
- return cmListFileLexer_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
+ return cmListFileLexer_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
}
/** Setup the input buffer state to scan the given bytes. The next call to cmListFileLexer_yylex() will
@@ -1948,34 +2005,34 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char * yystr , yyscan_t
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
-YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
+YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
{
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ yy_size_t i;
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = _yybytes_len + 2;
- buf = (char *) cmListFileLexer_yyalloc(n ,yyscanner );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_bytes()" );
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = _yybytes_len + 2;
+ buf = (char *) cmListFileLexer_yyalloc(n ,yyscanner );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_bytes()" );
- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
+ for ( i = 0; i < _yybytes_len; ++i )
+ buf[i] = yybytes[i];
- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
- b = cmListFileLexer_yy_scan_buffer(buf,n ,yyscanner);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in cmListFileLexer_yy_scan_bytes()" );
+ b = cmListFileLexer_yy_scan_buffer(buf,n ,yyscanner);
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in cmListFileLexer_yy_scan_bytes()" );
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
- return b;
+ return b;
}
#ifndef YY_EXIT_FAILURE
@@ -1984,27 +2041,28 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * yybytes, int _yy
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
{
- (void)yyscanner;
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
}
/* Redefine yyless() so it works in section 3 code. */
#undef yyless
#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
- yytext[yyleng] = yyg->yy_hold_char; \
- yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
- yyg->yy_hold_char = *yyg->yy_c_buf_p; \
- *yyg->yy_c_buf_p = '\0'; \
- yyleng = yyless_macro_arg; \
- } \
- while ( 0 )
+ yytext[yyleng] = yyg->yy_hold_char; \
+ yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
+ yyg->yy_hold_char = *yyg->yy_c_buf_p; \
+ *yyg->yy_c_buf_p = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
/* Accessor methods (get/set functions) to struct members. */
@@ -2064,7 +2122,7 @@ FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner)
/** Get the length of the current token.
* @param yyscanner The scanner object.
*/
-int cmListFileLexer_yyget_leng (yyscan_t yyscanner)
+yy_size_t cmListFileLexer_yyget_leng (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yyleng;
@@ -2091,51 +2149,51 @@ void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscann
}
/** Set the current line number.
- * @param line_number
+ * @param _line_number line number
* @param yyscanner The scanner object.
*/
-void cmListFileLexer_yyset_lineno (int line_number , yyscan_t yyscanner)
+void cmListFileLexer_yyset_lineno (int _line_number , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "cmListFileLexer_yyset_lineno called with no buffer" , yyscanner);
+ YY_FATAL_ERROR( "cmListFileLexer_yyset_lineno called with no buffer" );
- yylineno = line_number;
+ yylineno = _line_number;
}
/** Set the current column.
- * @param line_number
+ * @param _column_no column number
* @param yyscanner The scanner object.
*/
-void cmListFileLexer_yyset_column (int column_no , yyscan_t yyscanner)
+void cmListFileLexer_yyset_column (int _column_no , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "cmListFileLexer_yyset_column called with no buffer" , yyscanner);
+ YY_FATAL_ERROR( "cmListFileLexer_yyset_column called with no buffer" );
- yycolumn = column_no;
+ yycolumn = _column_no;
}
/** Set the input stream. This does not discard the current
* input buffer.
- * @param in_str A readable stream.
+ * @param _in_str A readable stream.
* @param yyscanner The scanner object.
* @see cmListFileLexer_yy_switch_to_buffer
*/
-void cmListFileLexer_yyset_in (FILE * in_str , yyscan_t yyscanner)
+void cmListFileLexer_yyset_in (FILE * _in_str , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyin = in_str ;
+ yyin = _in_str ;
}
-void cmListFileLexer_yyset_out (FILE * out_str , yyscan_t yyscanner)
+void cmListFileLexer_yyset_out (FILE * _out_str , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyout = out_str ;
+ yyout = _out_str ;
}
int cmListFileLexer_yyget_debug (yyscan_t yyscanner)
@@ -2144,10 +2202,10 @@ int cmListFileLexer_yyget_debug (yyscan_t yyscanner)
return yy_flex_debug;
}
-void cmListFileLexer_yyset_debug (int bdebug , yyscan_t yyscanner)
+void cmListFileLexer_yyset_debug (int _bdebug , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yy_flex_debug = bdebug ;
+ yy_flex_debug = _bdebug ;
}
/* Accessor methods for yylval and yylloc */
@@ -2255,15 +2313,15 @@ int cmListFileLexer_yylex_destroy (yyscan_t yyscanner)
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER){
- cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- cmListFileLexer_yypop_buffer_state(yyscanner);
- }
+ while(YY_CURRENT_BUFFER){
+ cmListFileLexer_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ cmListFileLexer_yypop_buffer_state(yyscanner);
+ }
- /* Destroy the stack itself. */
- cmListFileLexer_yyfree(yyg->yy_buffer_stack ,yyscanner);
- yyg->yy_buffer_stack = NULL;
+ /* Destroy the stack itself. */
+ cmListFileLexer_yyfree(yyg->yy_buffer_stack ,yyscanner);
+ yyg->yy_buffer_stack = NULL;
/* Destroy the start condition stack. */
cmListFileLexer_yyfree(yyg->yy_start_stack ,yyscanner );
@@ -2285,51 +2343,58 @@ int cmListFileLexer_yylex_destroy (yyscan_t yyscanner)
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
{
- int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+
+ int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
{
- int n;
- for ( n = 0; s[n]; ++n )
- ;
+ int n;
+ for ( n = 0; s[n]; ++n )
+ ;
- return n;
+ return n;
}
#endif
void *cmListFileLexer_yyalloc (yy_size_t size , yyscan_t yyscanner)
{
- (void)yyscanner;
- return (void *) malloc( size );
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+ return (void *) malloc( size );
}
void *cmListFileLexer_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
{
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- (void)yyscanner;
- return (void *) realloc( (char *) ptr, size );
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
}
void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner)
{
- (void)yyscanner;
- free( (char *) ptr ); /* see cmListFileLexer_yyrealloc() for (char *) cast */
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+ free( (char *) ptr ); /* see cmListFileLexer_yyrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
-#line 282 "cmListFileLexer.in.l"
+#line 273 "cmListFileLexer.in.l"
@@ -2342,30 +2407,25 @@ static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
lexer->token.column = lexer->column;
/* Use the same buffer if possible. */
- if(lexer->token.text)
- {
- if(text && length < lexer->size)
- {
+ if (lexer->token.text) {
+ if (text && length < lexer->size) {
strcpy(lexer->token.text, text);
lexer->token.length = length;
return;
- }
+ }
free(lexer->token.text);
lexer->token.text = 0;
lexer->size = 0;
- }
+ }
/* Need to extend the buffer. */
- if(text)
- {
+ if (text) {
lexer->token.text = strdup(text);
lexer->token.length = length;
- lexer->size = length+1;
- }
- else
- {
+ lexer->size = length + 1;
+ } else {
lexer->token.length = 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
@@ -2377,22 +2437,20 @@ static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
/* If the appended text will fit in the buffer, do not reallocate. */
newSize = lexer->token.length + length + 1;
- if(lexer->token.text && newSize <= lexer->size)
- {
- strcpy(lexer->token.text+lexer->token.length, text);
+ if (lexer->token.text && newSize <= lexer->size) {
+ strcpy(lexer->token.text + lexer->token.length, text);
lexer->token.length += length;
return;
- }
+ }
/* We need to extend the buffer. */
temp = malloc(newSize);
- if(lexer->token.text)
- {
+ if (lexer->token.text) {
memcpy(temp, lexer->token.text, lexer->token.length);
free(lexer->token.text);
- }
- memcpy(temp+lexer->token.length, text, length);
- temp[lexer->token.length+length] = 0;
+ }
+ memcpy(temp + lexer->token.length, text, length);
+ temp[lexer->token.length + length] = 0;
lexer->token.text = temp;
lexer->token.length += length;
lexer->size = newSize;
@@ -2402,96 +2460,84 @@ static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,
size_t bufferSize)
{
- if(lexer)
- {
- if(lexer->file)
- {
+ if (lexer) {
+ if (lexer->file) {
/* Convert CRLF -> LF explicitly. The C FILE "t"ext mode
does not convert newlines on all platforms. Move any
trailing CR to the start of the buffer for the next read. */
size_t cr = lexer->cr;
size_t n;
buffer[0] = '\r';
- n = fread(buffer+cr, 1, bufferSize-cr, lexer->file);
- if(n)
- {
+ n = fread(buffer + cr, 1, bufferSize - cr, lexer->file);
+ if (n) {
char* o = buffer;
const char* i = buffer;
const char* e;
n += cr;
- cr = (buffer[n-1] == '\r')? 1:0;
+ cr = (buffer[n - 1] == '\r') ? 1 : 0;
e = buffer + n - cr;
- while(i != e)
- {
- if(i[0] == '\r' && i[1] == '\n')
- {
+ while (i != e) {
+ if (i[0] == '\r' && i[1] == '\n') {
++i;
- }
- *o++ = *i++;
}
- n = o - buffer;
+ *o++ = *i++;
}
- else
- {
+ n = o - buffer;
+ } else {
n = cr;
cr = 0;
- }
+ }
lexer->cr = cr;
return n;
- }
- else if(lexer->string_left)
- {
+ } else if (lexer->string_left) {
int length = lexer->string_left;
- if((int)bufferSize < length) { length = (int)bufferSize; }
+ if ((int)bufferSize < length) {
+ length = (int)bufferSize;
+ }
memcpy(buffer, lexer->string_position, length);
lexer->string_position += length;
lexer->string_left -= length;
return length;
- }
}
+ }
return 0;
}
/*--------------------------------------------------------------------------*/
static void cmListFileLexerInit(cmListFileLexer* lexer)
{
- if(lexer->file || lexer->string_buffer)
- {
+ if (lexer->file || lexer->string_buffer) {
cmListFileLexer_yylex_init(&lexer->scanner);
cmListFileLexer_yyset_extra(lexer, lexer->scanner);
- }
+ }
}
/*--------------------------------------------------------------------------*/
static void cmListFileLexerDestroy(cmListFileLexer* lexer)
{
cmListFileLexerSetToken(lexer, 0, 0);
- if(lexer->file || lexer->string_buffer)
- {
+ if (lexer->file || lexer->string_buffer) {
cmListFileLexer_yylex_destroy(lexer->scanner);
- if(lexer->file)
- {
+ if (lexer->file) {
fclose(lexer->file);
lexer->file = 0;
- }
- if(lexer->string_buffer)
- {
+ }
+ if (lexer->string_buffer) {
free(lexer->string_buffer);
lexer->string_buffer = 0;
lexer->string_left = 0;
lexer->string_position = 0;
- }
}
+ }
}
/*--------------------------------------------------------------------------*/
cmListFileLexer* cmListFileLexer_New()
{
cmListFileLexer* lexer = (cmListFileLexer*)malloc(sizeof(cmListFileLexer));
- if(!lexer)
- {
+ if (!lexer) {
return 0;
- }
+ }
memset(lexer, 0, sizeof(*lexer));
lexer->line = 1;
lexer->column = 1;
@@ -2509,39 +2555,28 @@ void cmListFileLexer_Delete(cmListFileLexer* lexer)
static cmListFileLexer_BOM cmListFileLexer_ReadBOM(FILE* f)
{
unsigned char b[2];
- if(fread(b, 1, 2, f) == 2)
- {
- if(b[0] == 0xEF && b[1] == 0xBB)
- {
- if(fread(b, 1, 1, f) == 1 && b[0] == 0xBF)
- {
+ if (fread(b, 1, 2, f) == 2) {
+ if (b[0] == 0xEF && b[1] == 0xBB) {
+ if (fread(b, 1, 1, f) == 1 && b[0] == 0xBF) {
return cmListFileLexer_BOM_UTF8;
- }
}
- else if(b[0] == 0xFE && b[1] == 0xFF)
- {
+ } else if (b[0] == 0xFE && b[1] == 0xFF) {
/* UTF-16 BE */
return cmListFileLexer_BOM_UTF16BE;
- }
- else if(b[0] == 0 && b[1] == 0)
- {
- if(fread(b, 1, 2, f) == 2 && b[0] == 0xFE && b[1] == 0xFF)
- {
+ } else if (b[0] == 0 && b[1] == 0) {
+ if (fread(b, 1, 2, f) == 2 && b[0] == 0xFE && b[1] == 0xFF) {
return cmListFileLexer_BOM_UTF32BE;
- }
}
- else if(b[0] == 0xFF && b[1] == 0xFE)
- {
+ } else if (b[0] == 0xFF && b[1] == 0xFE) {
fpos_t p;
fgetpos(f, &p);
- if(fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0)
- {
+ if (fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0) {
return cmListFileLexer_BOM_UTF32LE;
- }
+ }
fsetpos(f, &p);
return cmListFileLexer_BOM_UTF16LE;
- }
}
+ }
rewind(f);
return cmListFileLexer_BOM_None;
}
@@ -2552,8 +2587,7 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
{
int result = 1;
cmListFileLexerDestroy(lexer);
- if(name)
- {
+ if (name) {
#ifdef _WIN32
wchar_t* wname = cmsysEncoding_DupToWide(name);
lexer->file = _wfopen(wname, L"rb");
@@ -2561,18 +2595,14 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
#else
lexer->file = fopen(name, "rb");
#endif
- if(lexer->file)
- {
- if(bom)
- {
+ if (lexer->file) {
+ if (bom) {
*bom = cmListFileLexer_ReadBOM(lexer->file);
- }
}
- else
- {
+ } else {
result = 0;
- }
}
+ }
cmListFileLexerInit(lexer);
return result;
}
@@ -2582,21 +2612,17 @@ int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text)
{
int result = 1;
cmListFileLexerDestroy(lexer);
- if(text)
- {
+ if (text) {
int length = (int)strlen(text);
- lexer->string_buffer = (char*)malloc(length+1);
- if(lexer->string_buffer)
- {
+ lexer->string_buffer = (char*)malloc(length + 1);
+ if (lexer->string_buffer) {
strcpy(lexer->string_buffer, text);
lexer->string_position = lexer->string_buffer;
lexer->string_left = length;
- }
- else
- {
+ } else {
result = 0;
- }
}
+ }
cmListFileLexerInit(lexer);
return result;
}
@@ -2604,45 +2630,35 @@ int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text)
/*--------------------------------------------------------------------------*/
cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer* lexer)
{
- if(!lexer->file)
- {
+ if (!lexer->file) {
return 0;
- }
- if(cmListFileLexer_yylex(lexer->scanner, lexer))
- {
+ }
+ if (cmListFileLexer_yylex(lexer->scanner, lexer)) {
return &lexer->token;
- }
- else
- {
+ } else {
cmListFileLexer_SetFileName(lexer, 0, 0);
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
long cmListFileLexer_GetCurrentLine(cmListFileLexer* lexer)
{
- if(lexer->file)
- {
+ if (lexer->file) {
return lexer->line;
- }
- else
- {
+ } else {
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
long cmListFileLexer_GetCurrentColumn(cmListFileLexer* lexer)
{
- if(lexer->file)
- {
+ if (lexer->file) {
return lexer->column;
- }
- else
- {
+ } else {
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
@@ -2650,21 +2666,33 @@ const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer,
cmListFileLexer_Type type)
{
(void)lexer;
- switch(type)
- {
- case cmListFileLexer_Token_None: return "nothing";
- case cmListFileLexer_Token_Space: return "space";
- case cmListFileLexer_Token_Newline: return "newline";
- case cmListFileLexer_Token_Identifier: return "identifier";
- case cmListFileLexer_Token_ParenLeft: return "left paren";
- case cmListFileLexer_Token_ParenRight: return "right paren";
- case cmListFileLexer_Token_ArgumentUnquoted: return "unquoted argument";
- case cmListFileLexer_Token_ArgumentQuoted: return "quoted argument";
- case cmListFileLexer_Token_ArgumentBracket: return "bracket argument";
- case cmListFileLexer_Token_CommentBracket: return "bracket comment";
- case cmListFileLexer_Token_BadCharacter: return "bad character";
- case cmListFileLexer_Token_BadBracket: return "unterminated bracket";
- case cmListFileLexer_Token_BadString: return "unterminated string";
- }
+ switch (type) {
+ case cmListFileLexer_Token_None:
+ return "nothing";
+ case cmListFileLexer_Token_Space:
+ return "space";
+ case cmListFileLexer_Token_Newline:
+ return "newline";
+ case cmListFileLexer_Token_Identifier:
+ return "identifier";
+ case cmListFileLexer_Token_ParenLeft:
+ return "left paren";
+ case cmListFileLexer_Token_ParenRight:
+ return "right paren";
+ case cmListFileLexer_Token_ArgumentUnquoted:
+ return "unquoted argument";
+ case cmListFileLexer_Token_ArgumentQuoted:
+ return "quoted argument";
+ case cmListFileLexer_Token_ArgumentBracket:
+ return "bracket argument";
+ case cmListFileLexer_Token_CommentBracket:
+ return "bracket comment";
+ case cmListFileLexer_Token_BadCharacter:
+ return "bad character";
+ case cmListFileLexer_Token_BadBracket:
+ return "unterminated bracket";
+ case cmListFileLexer_Token_BadString:
+ return "unterminated string";
+ }
return "unknown token";
}
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index a520c72..6d44814 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -14,19 +14,16 @@
This file must be translated to C and modified to build everywhere.
-Run flex like this:
+Run flex >= 2.6 like this:
flex --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l
Modify cmListFileLexer.c:
- - remove TABs
- - remove use of the 'register' storage class specifier
- - remove the yyunput function
- - add a statement "(void)yyscanner;" to the top of these methods:
- yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
+ - remove trailing whitespace: sed -i 's/\s*$//' cmListFileLexer.c
+ - remove blank lines at end of file
- remove statement "yyscanner = NULL;" from cmListFileLexer_yylex_destroy
- remove all YY_BREAK lines occurring right after return statements
- - remove the isatty forward declaration
+ - remove unnecessary cast to (int) in yy_get_next_buffer
*/
@@ -45,7 +42,7 @@ Modify cmListFileLexer.c:
struct cmListFileLexer_s
{
cmListFileLexer_Token token;
- int bracket;
+ yy_size_t bracket;
int comment;
int line;
int column;
@@ -102,26 +99,20 @@ LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t[=])*\"
#?\[=*\[\n? {
const char* bracket = yytext;
lexer->comment = yytext[0] == '#';
- if(lexer->comment)
- {
+ if (lexer->comment) {
lexer->token.type = cmListFileLexer_Token_CommentBracket;
bracket += 1;
- }
- else
- {
+ } else {
lexer->token.type = cmListFileLexer_Token_ArgumentBracket;
- }
+ }
cmListFileLexerSetToken(lexer, "", 0);
- lexer->bracket = (int)(strchr(bracket+1, '[') - bracket);
- if(yytext[yyleng-1] == '\n')
- {
+ lexer->bracket = strchr(bracket+1, '[') - bracket;
+ if (yytext[yyleng-1] == '\n') {
++lexer->line;
lexer->column = 1;
- }
- else
- {
+ } else {
lexer->column += yyleng;
- }
+ }
BEGIN(BRACKET);
}
@@ -159,10 +150,9 @@ LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t[=])*\"
/* Handle ]]====]=======]*/
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
- if(yyleng == lexer->bracket)
- {
+ if (yyleng == lexer->bracket) {
BEGIN(BRACKETEND);
- }
+ }
}
<BRACKETEND>\] {
@@ -291,30 +281,25 @@ static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
lexer->token.column = lexer->column;
/* Use the same buffer if possible. */
- if(lexer->token.text)
- {
- if(text && length < lexer->size)
- {
+ if (lexer->token.text) {
+ if (text && length < lexer->size) {
strcpy(lexer->token.text, text);
lexer->token.length = length;
return;
- }
+ }
free(lexer->token.text);
lexer->token.text = 0;
lexer->size = 0;
- }
+ }
/* Need to extend the buffer. */
- if(text)
- {
+ if (text) {
lexer->token.text = strdup(text);
lexer->token.length = length;
- lexer->size = length+1;
- }
- else
- {
+ lexer->size = length + 1;
+ } else {
lexer->token.length = 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
@@ -326,22 +311,20 @@ static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
/* If the appended text will fit in the buffer, do not reallocate. */
newSize = lexer->token.length + length + 1;
- if(lexer->token.text && newSize <= lexer->size)
- {
- strcpy(lexer->token.text+lexer->token.length, text);
+ if (lexer->token.text && newSize <= lexer->size) {
+ strcpy(lexer->token.text + lexer->token.length, text);
lexer->token.length += length;
return;
- }
+ }
/* We need to extend the buffer. */
temp = malloc(newSize);
- if(lexer->token.text)
- {
+ if (lexer->token.text) {
memcpy(temp, lexer->token.text, lexer->token.length);
free(lexer->token.text);
- }
- memcpy(temp+lexer->token.length, text, length);
- temp[lexer->token.length+length] = 0;
+ }
+ memcpy(temp + lexer->token.length, text, length);
+ temp[lexer->token.length + length] = 0;
lexer->token.text = temp;
lexer->token.length += length;
lexer->size = newSize;
@@ -351,96 +334,84 @@ static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,
size_t bufferSize)
{
- if(lexer)
- {
- if(lexer->file)
- {
+ if (lexer) {
+ if (lexer->file) {
/* Convert CRLF -> LF explicitly. The C FILE "t"ext mode
does not convert newlines on all platforms. Move any
trailing CR to the start of the buffer for the next read. */
size_t cr = lexer->cr;
size_t n;
buffer[0] = '\r';
- n = fread(buffer+cr, 1, bufferSize-cr, lexer->file);
- if(n)
- {
+ n = fread(buffer + cr, 1, bufferSize - cr, lexer->file);
+ if (n) {
char* o = buffer;
const char* i = buffer;
const char* e;
n += cr;
- cr = (buffer[n-1] == '\r')? 1:0;
+ cr = (buffer[n - 1] == '\r') ? 1 : 0;
e = buffer + n - cr;
- while(i != e)
- {
- if(i[0] == '\r' && i[1] == '\n')
- {
+ while (i != e) {
+ if (i[0] == '\r' && i[1] == '\n') {
++i;
- }
- *o++ = *i++;
}
- n = o - buffer;
+ *o++ = *i++;
}
- else
- {
+ n = o - buffer;
+ } else {
n = cr;
cr = 0;
- }
+ }
lexer->cr = cr;
return n;
- }
- else if(lexer->string_left)
- {
+ } else if (lexer->string_left) {
int length = lexer->string_left;
- if((int)bufferSize < length) { length = (int)bufferSize; }
+ if ((int)bufferSize < length) {
+ length = (int)bufferSize;
+ }
memcpy(buffer, lexer->string_position, length);
lexer->string_position += length;
lexer->string_left -= length;
return length;
- }
}
+ }
return 0;
}
/*--------------------------------------------------------------------------*/
static void cmListFileLexerInit(cmListFileLexer* lexer)
{
- if(lexer->file || lexer->string_buffer)
- {
+ if (lexer->file || lexer->string_buffer) {
cmListFileLexer_yylex_init(&lexer->scanner);
cmListFileLexer_yyset_extra(lexer, lexer->scanner);
- }
+ }
}
/*--------------------------------------------------------------------------*/
static void cmListFileLexerDestroy(cmListFileLexer* lexer)
{
cmListFileLexerSetToken(lexer, 0, 0);
- if(lexer->file || lexer->string_buffer)
- {
+ if (lexer->file || lexer->string_buffer) {
cmListFileLexer_yylex_destroy(lexer->scanner);
- if(lexer->file)
- {
+ if (lexer->file) {
fclose(lexer->file);
lexer->file = 0;
- }
- if(lexer->string_buffer)
- {
+ }
+ if (lexer->string_buffer) {
free(lexer->string_buffer);
lexer->string_buffer = 0;
lexer->string_left = 0;
lexer->string_position = 0;
- }
}
+ }
}
/*--------------------------------------------------------------------------*/
cmListFileLexer* cmListFileLexer_New()
{
cmListFileLexer* lexer = (cmListFileLexer*)malloc(sizeof(cmListFileLexer));
- if(!lexer)
- {
+ if (!lexer) {
return 0;
- }
+ }
memset(lexer, 0, sizeof(*lexer));
lexer->line = 1;
lexer->column = 1;
@@ -458,39 +429,28 @@ void cmListFileLexer_Delete(cmListFileLexer* lexer)
static cmListFileLexer_BOM cmListFileLexer_ReadBOM(FILE* f)
{
unsigned char b[2];
- if(fread(b, 1, 2, f) == 2)
- {
- if(b[0] == 0xEF && b[1] == 0xBB)
- {
- if(fread(b, 1, 1, f) == 1 && b[0] == 0xBF)
- {
+ if (fread(b, 1, 2, f) == 2) {
+ if (b[0] == 0xEF && b[1] == 0xBB) {
+ if (fread(b, 1, 1, f) == 1 && b[0] == 0xBF) {
return cmListFileLexer_BOM_UTF8;
- }
}
- else if(b[0] == 0xFE && b[1] == 0xFF)
- {
+ } else if (b[0] == 0xFE && b[1] == 0xFF) {
/* UTF-16 BE */
return cmListFileLexer_BOM_UTF16BE;
- }
- else if(b[0] == 0 && b[1] == 0)
- {
- if(fread(b, 1, 2, f) == 2 && b[0] == 0xFE && b[1] == 0xFF)
- {
+ } else if (b[0] == 0 && b[1] == 0) {
+ if (fread(b, 1, 2, f) == 2 && b[0] == 0xFE && b[1] == 0xFF) {
return cmListFileLexer_BOM_UTF32BE;
- }
}
- else if(b[0] == 0xFF && b[1] == 0xFE)
- {
+ } else if (b[0] == 0xFF && b[1] == 0xFE) {
fpos_t p;
fgetpos(f, &p);
- if(fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0)
- {
+ if (fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0) {
return cmListFileLexer_BOM_UTF32LE;
- }
+ }
fsetpos(f, &p);
return cmListFileLexer_BOM_UTF16LE;
- }
}
+ }
rewind(f);
return cmListFileLexer_BOM_None;
}
@@ -501,8 +461,7 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
{
int result = 1;
cmListFileLexerDestroy(lexer);
- if(name)
- {
+ if (name) {
#ifdef _WIN32
wchar_t* wname = cmsysEncoding_DupToWide(name);
lexer->file = _wfopen(wname, L"rb");
@@ -510,18 +469,14 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
#else
lexer->file = fopen(name, "rb");
#endif
- if(lexer->file)
- {
- if(bom)
- {
+ if (lexer->file) {
+ if (bom) {
*bom = cmListFileLexer_ReadBOM(lexer->file);
- }
}
- else
- {
+ } else {
result = 0;
- }
}
+ }
cmListFileLexerInit(lexer);
return result;
}
@@ -531,21 +486,17 @@ int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text)
{
int result = 1;
cmListFileLexerDestroy(lexer);
- if(text)
- {
+ if (text) {
int length = (int)strlen(text);
- lexer->string_buffer = (char*)malloc(length+1);
- if(lexer->string_buffer)
- {
+ lexer->string_buffer = (char*)malloc(length + 1);
+ if (lexer->string_buffer) {
strcpy(lexer->string_buffer, text);
lexer->string_position = lexer->string_buffer;
lexer->string_left = length;
- }
- else
- {
+ } else {
result = 0;
- }
}
+ }
cmListFileLexerInit(lexer);
return result;
}
@@ -553,45 +504,35 @@ int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text)
/*--------------------------------------------------------------------------*/
cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer* lexer)
{
- if(!lexer->file)
- {
+ if (!lexer->file) {
return 0;
- }
- if(cmListFileLexer_yylex(lexer->scanner, lexer))
- {
+ }
+ if (cmListFileLexer_yylex(lexer->scanner, lexer)) {
return &lexer->token;
- }
- else
- {
+ } else {
cmListFileLexer_SetFileName(lexer, 0, 0);
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
long cmListFileLexer_GetCurrentLine(cmListFileLexer* lexer)
{
- if(lexer->file)
- {
+ if (lexer->file) {
return lexer->line;
- }
- else
- {
+ } else {
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
long cmListFileLexer_GetCurrentColumn(cmListFileLexer* lexer)
{
- if(lexer->file)
- {
+ if (lexer->file) {
return lexer->column;
- }
- else
- {
+ } else {
return 0;
- }
+ }
}
/*--------------------------------------------------------------------------*/
@@ -599,21 +540,33 @@ const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer,
cmListFileLexer_Type type)
{
(void)lexer;
- switch(type)
- {
- case cmListFileLexer_Token_None: return "nothing";
- case cmListFileLexer_Token_Space: return "space";
- case cmListFileLexer_Token_Newline: return "newline";
- case cmListFileLexer_Token_Identifier: return "identifier";
- case cmListFileLexer_Token_ParenLeft: return "left paren";
- case cmListFileLexer_Token_ParenRight: return "right paren";
- case cmListFileLexer_Token_ArgumentUnquoted: return "unquoted argument";
- case cmListFileLexer_Token_ArgumentQuoted: return "quoted argument";
- case cmListFileLexer_Token_ArgumentBracket: return "bracket argument";
- case cmListFileLexer_Token_CommentBracket: return "bracket comment";
- case cmListFileLexer_Token_BadCharacter: return "bad character";
- case cmListFileLexer_Token_BadBracket: return "unterminated bracket";
- case cmListFileLexer_Token_BadString: return "unterminated string";
- }
+ switch (type) {
+ case cmListFileLexer_Token_None:
+ return "nothing";
+ case cmListFileLexer_Token_Space:
+ return "space";
+ case cmListFileLexer_Token_Newline:
+ return "newline";
+ case cmListFileLexer_Token_Identifier:
+ return "identifier";
+ case cmListFileLexer_Token_ParenLeft:
+ return "left paren";
+ case cmListFileLexer_Token_ParenRight:
+ return "right paren";
+ case cmListFileLexer_Token_ArgumentUnquoted:
+ return "unquoted argument";
+ case cmListFileLexer_Token_ArgumentQuoted:
+ return "quoted argument";
+ case cmListFileLexer_Token_ArgumentBracket:
+ return "bracket argument";
+ case cmListFileLexer_Token_CommentBracket:
+ return "bracket comment";
+ case cmListFileLexer_Token_BadCharacter:
+ return "bad character";
+ case cmListFileLexer_Token_BadBracket:
+ return "unterminated bracket";
+ case cmListFileLexer_Token_BadString:
+ return "unterminated string";
+ }
return "unknown token";
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 0ff13d9..e91eb46 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -640,7 +640,7 @@ std::string cmLocalGenerator::ExpandRuleVariable(
if (variable == "TARGET_BASE") {
// Strip the last extension off the target name.
std::string targetBase = replaceValues.Target;
- std::string::size_type pos = targetBase.rfind(".");
+ std::string::size_type pos = targetBase.rfind('.');
if (pos != targetBase.npos) {
return targetBase.substr(0, pos);
} else {
@@ -1766,13 +1766,12 @@ static void AddVisibilityCompileOption(std::string& flags,
const std::string& lang,
std::string* warnCMP0063)
{
- std::string l(lang);
- std::string compileOption = "CMAKE_" + l + "_COMPILE_OPTIONS_VISIBILITY";
+ std::string compileOption = "CMAKE_" + lang + "_COMPILE_OPTIONS_VISIBILITY";
const char* opt = lg->GetMakefile()->GetDefinition(compileOption);
if (!opt) {
return;
}
- std::string flagDefine = l + "_VISIBILITY_PRESET";
+ std::string flagDefine = lang + "_VISIBILITY_PRESET";
const char* prop = target->GetProperty(flagDefine);
if (!prop) {
@@ -2140,7 +2139,7 @@ std::string cmLocalGenerator::ConstructComment(
for (std::vector<std::string>::const_iterator o = ccg.GetOutputs().begin();
o != ccg.GetOutputs().end(); ++o) {
comment += sep;
- comment += this->Convert(*o, cmLocalGenerator::START_OUTPUT);
+ comment += this->Convert(*o, cmOutputConverter::START_OUTPUT);
sep = ", ";
}
return comment;
@@ -2306,16 +2305,16 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName(
std::string ssin = sin;
// Avoid full paths by removing leading slashes.
- ssin.erase(0, ssin.find_first_not_of("/"));
+ ssin.erase(0, ssin.find_first_not_of('/'));
// Avoid full paths by removing colons.
- cmSystemTools::ReplaceString(ssin, ":", "_");
+ std::replace(ssin.begin(), ssin.end(), ':', '_');
// Avoid relative paths that go up the tree.
cmSystemTools::ReplaceString(ssin, "../", "__/");
// Avoid spaces.
- cmSystemTools::ReplaceString(ssin, " ", "_");
+ std::replace(ssin.begin(), ssin.end(), ' ', '_');
// Mangle the name if necessary.
if (this->Makefile->IsOn("CMAKE_MANGLE_OBJECT_FILE_NAMES")) {
@@ -2464,7 +2463,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
// Remove the source extension if it is to be replaced.
if (replaceExt) {
keptSourceExtension = false;
- std::string::size_type dot_pos = objectName.rfind(".");
+ std::string::size_type dot_pos = objectName.rfind('.');
if (dot_pos != std::string::npos) {
objectName = objectName.substr(0, dot_pos);
}
@@ -2603,7 +2602,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
}
// Many compilers do not support # in the value so we disable it.
- if (define.find_first_of("#") != define.npos) {
+ if (define.find_first_of('#') != define.npos) {
std::ostringstream e;
/* clang-format off */
e << "WARNING: Preprocessor definitions containing '#' may not be "
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 892ad4f..5c603a6 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -174,9 +174,10 @@ public:
bool GetRealDependency(const std::string& name, const std::string& config,
std::string& dep);
- virtual std::string ConvertToIncludeReference(std::string const& path,
- OutputFormat format = SHELL,
- bool forceFullPaths = false);
+ virtual std::string ConvertToIncludeReference(
+ std::string const& path,
+ cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL,
+ bool forceFullPaths = false);
/** Called from command-line hook to clear dependencies. */
virtual void ClearDependencies(cmMakefile* /* mf */, bool /* verbose */) {}
@@ -353,8 +354,9 @@ protected:
std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
std::string const& dir_max);
- virtual std::string ConvertToLinkReference(std::string const& lib,
- OutputFormat format = SHELL);
+ virtual std::string ConvertToLinkReference(
+ std::string const& lib,
+ cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL);
/** Check whether the native build system supports the given
definition. Issues a warning. */
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 671d8a0..6c231c3 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -41,8 +41,8 @@ void cmLocalNinjaGenerator::Generate()
{
// Compute the path to use when referencing the current output
// directory from the top output directory.
- this->HomeRelativeOutputPath =
- this->Convert(this->GetCurrentBinaryDirectory(), HOME_OUTPUT);
+ this->HomeRelativeOutputPath = this->Convert(
+ this->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT);
if (this->HomeRelativeOutputPath == ".") {
this->HomeRelativeOutputPath = "";
}
@@ -121,15 +121,19 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
// Virtual protected methods.
std::string cmLocalNinjaGenerator::ConvertToLinkReference(
- std::string const& lib, OutputFormat format)
+ std::string const& lib, cmOutputConverter::OutputFormat format)
{
- return this->Convert(lib, HOME_OUTPUT, format);
+ std::string path = this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib);
+ return this->ConvertToOutputFormat(path, format);
}
std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
- std::string const& path, OutputFormat format, bool forceFullPaths)
+ std::string const& path, cmOutputConverter::OutputFormat format,
+ bool forceFullPaths)
{
- return this->Convert(path, forceFullPaths ? FULL : HOME_OUTPUT, format);
+ return this->Convert(path, forceFullPaths ? cmOutputConverter::FULL
+ : cmOutputConverter::HOME_OUTPUT,
+ format);
}
// Private methods.
@@ -204,7 +208,7 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os)
cmSystemTools::ExpandListArgument(jobpools, pools);
for (size_t i = 0; i < pools.size(); ++i) {
const std::string pool = pools[i];
- const std::string::size_type eq = pool.find("=");
+ const std::string::size_type eq = pool.find('=');
unsigned int jobs;
if (eq != std::string::npos &&
sscanf(pool.c_str() + eq, "=%u", &jobs) == 1) {
@@ -224,8 +228,13 @@ void cmLocalNinjaGenerator::WriteNinjaFilesInclusion(std::ostream& os)
cmGlobalNinjaGenerator::WriteDivider(os);
os << "# Include auxiliary files.\n"
<< "\n";
- cmGlobalNinjaGenerator::WriteInclude(
- os, cmGlobalNinjaGenerator::NINJA_RULES_FILE, "Include rules file.");
+ cmGlobalNinjaGenerator* ng = this->GetGlobalNinjaGenerator();
+ std::string const ninjaRulesFile =
+ ng->NinjaOutputPath(cmGlobalNinjaGenerator::NINJA_RULES_FILE);
+ std::string const rulesFilePath =
+ ng->EncodeIdent(ng->EncodePath(ninjaRulesFile), os);
+ cmGlobalNinjaGenerator::WriteInclude(os, rulesFilePath,
+ "Include rules file.");
os << "\n";
}
@@ -332,7 +341,8 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(
#else
std::string cdStr = "cd ";
#endif
- cdCmd << cdStr << this->ConvertToOutputFormat(wd, SHELL);
+ cdCmd << cdStr
+ << this->ConvertToOutputFormat(wd, cmOutputConverter::SHELL);
cmdLines.push_back(cdCmd.str());
}
@@ -340,7 +350,8 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(
for (unsigned i = 0; i != ccg.GetNumberOfCommands(); ++i) {
cmdLines.push_back(launcher +
- this->ConvertToOutputFormat(ccg.GetCommand(i), SHELL));
+ this->ConvertToOutputFormat(ccg.GetCommand(i),
+ cmOutputConverter::SHELL));
std::string& cmd = cmdLines.back();
ccg.AppendArguments(i, cmd);
@@ -467,10 +478,12 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
std::string output;
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
- RelativeRoot relative_root =
- ccg.GetWorkingDirectory().empty() ? START_OUTPUT : NONE;
+ cmOutputConverter::RelativeRoot relative_root =
+ ccg.GetWorkingDirectory().empty() ? cmOutputConverter::START_OUTPUT
+ : cmOutputConverter::NONE;
- output = this->Convert(outputs[0], relative_root, SHELL);
+ output =
+ this->Convert(outputs[0], relative_root, cmOutputConverter::SHELL);
}
vars.Output = output.c_str();
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index afaa24c..9899360 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -72,17 +72,19 @@ public:
void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
cmNinjaDeps& ninjaDeps);
- virtual std::string ConvertToLinkReference(std::string const& lib,
- OutputFormat format = SHELL);
+ virtual std::string ConvertToLinkReference(
+ std::string const& lib,
+ cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL);
virtual void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
cmGeneratorTarget const* gt = 0);
protected:
- virtual std::string ConvertToIncludeReference(std::string const& path,
- OutputFormat format = SHELL,
- bool forceFullPaths = false);
+ virtual std::string ConvertToIncludeReference(
+ std::string const& path,
+ cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL,
+ bool forceFullPaths = false);
private:
cmGeneratedFileStream& GetBuildFileStream() const;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 88c6d61..f60a595 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -71,7 +71,7 @@ private:
static std::string cmSplitExtension(std::string const& in, std::string& base)
{
std::string ext;
- std::string::size_type dot_pos = in.rfind(".");
+ std::string::size_type dot_pos = in.rfind('.');
if (dot_pos != std::string::npos) {
// Remove the extension first in case &base == &in.
ext = in.substr(dot_pos, std::string::npos);
@@ -140,8 +140,8 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath()
{
// Compute the path to use when referencing the current output
// directory from the top output directory.
- this->HomeRelativeOutputPath =
- this->Convert(this->GetCurrentBinaryDirectory(), HOME_OUTPUT);
+ this->HomeRelativeOutputPath = this->Convert(
+ this->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT);
if (this->HomeRelativeOutputPath == ".") {
this->HomeRelativeOutputPath = "";
}
@@ -358,7 +358,7 @@ void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule(
this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName));
}
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmLocalGenerator::START_OUTPUT);
+ cmOutputConverter::START_OUTPUT);
// Write the rule to the makefile.
std::vector<std::string> no_depends;
@@ -398,7 +398,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
commands.push_back(
this->GetRecursiveMakeCall(makefile2.c_str(), localName));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmLocalGenerator::START_OUTPUT);
+ cmOutputConverter::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
localName, depends, commands, true);
@@ -423,7 +423,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
commands.push_back(
this->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmLocalGenerator::START_OUTPUT);
+ cmOutputConverter::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
localName, depends, commands, true);
@@ -439,7 +439,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
commands.push_back(
this->GetRecursiveMakeCall(makefile2.c_str(), makeTargetName));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmLocalGenerator::START_OUTPUT);
+ cmOutputConverter::START_OUTPUT);
this->WriteMakeRule(ruleFileStream,
"Manual pre-install relink rule for target.",
localName, depends, commands, true);
@@ -546,7 +546,8 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
}
// Construct the left hand side of the rule.
- std::string tgt = this->Convert(target, HOME_OUTPUT, MAKERULE);
+ std::string tgt = this->Convert(target, cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::MAKERULE);
const char* space = "";
if (tgt.size() == 1) {
@@ -573,7 +574,8 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
for (std::vector<std::string>::const_iterator dep = depends.begin();
dep != depends.end(); ++dep) {
replace = *dep;
- replace = this->Convert(replace, HOME_OUTPUT, MAKERULE);
+ replace = this->Convert(replace, cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::MAKERULE);
os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
}
}
@@ -591,7 +593,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
}
std::string cmLocalUnixMakefileGenerator3::ConvertShellCommand(
- std::string const& cmd, RelativeRoot root)
+ std::string const& cmd, cmOutputConverter::RelativeRoot root)
{
if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) &&
cmd.find_first_of("( )") != cmd.npos) {
@@ -600,10 +602,11 @@ std::string cmLocalUnixMakefileGenerator3::ConvertShellCommand(
// lines with shell redirection operators.
std::string scmd;
if (cmSystemTools::GetShortPath(cmd, scmd)) {
- return this->Convert(scmd, NONE, SHELL);
+ return this->Convert(scmd, cmOutputConverter::NONE,
+ cmOutputConverter::SHELL);
}
}
- return this->Convert(cmd, root, SHELL);
+ return this->Convert(cmd, root, cmOutputConverter::SHELL);
}
void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
@@ -639,13 +642,15 @@ void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
makefileStream
<< "# The CMake executable.\n"
<< "CMAKE_COMMAND = "
- << this->ConvertShellCommand(cmSystemTools::GetCMakeCommand(), FULL)
+ << this->ConvertShellCommand(cmSystemTools::GetCMakeCommand(),
+ cmOutputConverter::FULL)
<< "\n"
<< "\n";
makefileStream
<< "# The command to remove a file.\n"
<< "RM = "
- << this->ConvertShellCommand(cmSystemTools::GetCMakeCommand(), FULL)
+ << this->ConvertShellCommand(cmSystemTools::GetCMakeCommand(),
+ cmOutputConverter::FULL)
<< " -E remove -f\n"
<< "\n";
makefileStream
@@ -655,13 +660,17 @@ void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
makefileStream
<< "# The top-level source directory on which CMake was run.\n"
<< "CMAKE_SOURCE_DIR = "
- << this->Convert(this->GetSourceDirectory(), FULL, SHELL)
+ << this->Convert(this->GetSourceDirectory(),
+ cmOutputConverter::FULL,
+ cmOutputConverter::SHELL)
<< "\n"
<< "\n";
makefileStream
<< "# The top-level build directory on which CMake was run.\n"
<< "CMAKE_BINARY_DIR = "
- << this->Convert(this->GetBinaryDirectory(), FULL, SHELL)
+ << this->Convert(this->GetBinaryDirectory(),
+ cmOutputConverter::FULL,
+ cmOutputConverter::SHELL)
<< "\n"
<< "\n";
/* clang-format on */
@@ -775,7 +784,8 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
std::string runRule =
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
- runRule += this->Convert(cmakefileName, NONE, SHELL);
+ runRule += this->Convert(cmakefileName, cmOutputConverter::NONE,
+ cmOutputConverter::SHELL);
runRule += " 0";
std::vector<std::string> no_depends;
@@ -783,7 +793,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
commands.push_back(runRule);
if (!this->IsRootMakefile()) {
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmLocalGenerator::START_OUTPUT);
+ cmOutputConverter::START_OUTPUT);
}
this->WriteMakeRule(
makefileStream, "Special rule to run CMake to check the build system "
@@ -819,7 +829,8 @@ std::string cmLocalUnixMakefileGenerator3::GetRelativeTargetDirectory(
{
std::string dir = this->HomeRelativeOutputPath;
dir += this->GetTargetDirectory(target);
- return this->Convert(dir, NONE, UNCHANGED);
+ return this->Convert(dir, cmOutputConverter::NONE,
+ cmOutputConverter::UNCHANGED);
}
void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
@@ -889,7 +900,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomDepend(
void cmLocalUnixMakefileGenerator3::AppendCustomCommands(
std::vector<std::string>& commands, const std::vector<cmCustomCommand>& ccs,
- cmGeneratorTarget* target, cmLocalGenerator::RelativeRoot relative)
+ cmGeneratorTarget* target, cmOutputConverter::RelativeRoot relative)
{
for (std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
i != ccs.end(); ++i) {
@@ -901,7 +912,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommands(
void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
std::vector<std::string>& commands, cmCustomCommandGenerator const& ccg,
cmGeneratorTarget* target, bool echo_comment,
- cmLocalGenerator::RelativeRoot relative, std::ostream* content)
+ cmOutputConverter::RelativeRoot relative, std::ostream* content)
{
// Optionally create a command to display the custom command's
// comment text. This is used for pre-build, pre-link, and
@@ -949,11 +960,11 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
cmSystemTools::ReplaceString(cmd, "/./", "/");
// Convert the command to a relative path only if the current
// working directory will be the start-output directory.
- bool had_slash = cmd.find("/") != cmd.npos;
+ bool had_slash = cmd.find('/') != cmd.npos;
if (workingDir.empty()) {
- cmd = this->Convert(cmd, START_OUTPUT);
+ cmd = this->Convert(cmd, cmOutputConverter::START_OUTPUT);
}
- bool has_slash = cmd.find("/") != cmd.npos;
+ bool has_slash = cmd.find('/') != cmd.npos;
if (had_slash && !has_slash) {
// This command was specified as a path to a file in the
// current directory. Add a leading "./" so it can run
@@ -961,8 +972,9 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
cmd = "./" + cmd;
}
std::string launcher = this->MakeLauncher(
- ccg, target, workingDir.empty() ? START_OUTPUT : NONE);
- cmd = launcher + this->ConvertShellCommand(cmd, NONE);
+ ccg, target, workingDir.empty() ? cmOutputConverter::START_OUTPUT
+ : cmOutputConverter::NONE);
+ cmd = launcher + this->ConvertShellCommand(cmd, cmOutputConverter::NONE);
ccg.AppendArguments(c, cmd);
if (content) {
@@ -975,9 +987,9 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// must be written {{} instead of just {. Otherwise some
// curly braces are removed. The hack can be skipped if the
// first curly brace is the last character.
- std::string::size_type lcurly = cmd.find("{");
+ std::string::size_type lcurly = cmd.find('{');
if (lcurly != cmd.npos && lcurly < (cmd.size() - 1)) {
- std::string::size_type rcurly = cmd.find("}");
+ std::string::size_type rcurly = cmd.find('}');
if (rcurly == cmd.npos || rcurly > lcurly) {
// The first curly is a left curly. Use the hack.
std::string hack_cmd = cmd.substr(0, lcurly);
@@ -1007,7 +1019,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
std::string cmLocalUnixMakefileGenerator3::MakeLauncher(
cmCustomCommandGenerator const& ccg, cmGeneratorTarget* target,
- RelativeRoot relative)
+ cmOutputConverter::RelativeRoot relative)
{
// Short-circuit if there is no launcher.
const char* prop = "RULE_LAUNCH_CUSTOM";
@@ -1024,7 +1036,7 @@ std::string cmLocalUnixMakefileGenerator3::MakeLauncher(
std::string output;
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
- output = this->Convert(outputs[0], relative, SHELL);
+ output = this->Convert(outputs[0], relative, cmOutputConverter::SHELL);
}
vars.Output = output.c_str();
@@ -1049,7 +1061,8 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
cleanfile += filename;
}
cleanfile += ".cmake";
- std::string cleanfilePath = this->Convert(cleanfile, FULL);
+ std::string cleanfilePath =
+ this->Convert(cleanfile, cmOutputConverter::FULL);
cmsys::ofstream fout(cleanfilePath.c_str());
if (!fout) {
cmSystemTools::Error("Could not create ", cleanfilePath.c_str());
@@ -1058,13 +1071,15 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
fout << "file(REMOVE_RECURSE\n";
for (std::vector<std::string>::const_iterator f = files.begin();
f != files.end(); ++f) {
- std::string fc = this->Convert(*f, START_OUTPUT, UNCHANGED);
+ std::string fc = this->Convert(*f, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED);
fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n";
}
fout << ")\n";
}
std::string remove = "$(CMAKE_COMMAND) -P ";
- remove += this->Convert(cleanfile, START_OUTPUT, SHELL);
+ remove += this->Convert(cleanfile, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
commands.push_back(remove);
// For the main clean rule add per-language cleaning.
@@ -1133,8 +1148,8 @@ void cmLocalUnixMakefileGenerator3::AppendEcho(
cmd += color_name;
if (progress) {
cmd += "--progress-dir=";
- cmd += this->Convert(progress->Dir, cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
+ cmd += this->Convert(progress->Dir, cmOutputConverter::FULL,
+ cmOutputConverter::SHELL);
cmd += " ";
cmd += "--progress-num=";
cmd += progress->Arg;
@@ -1163,10 +1178,9 @@ void cmLocalUnixMakefileGenerator3::AppendEcho(
}
std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
- const std::string& sin, const std::string& s2in)
+ const std::string& sin, const std::string& s2)
{
std::string s = sin;
- std::string s2 = s2in;
std::string unmodified = s;
unmodified += s2;
// if there is no restriction on the length of make variables
@@ -1190,7 +1204,7 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
// if this there is no value for this->MakefileVariableSize then
// the string must have bad characters in it
if (!this->MakefileVariableSize) {
- cmSystemTools::ReplaceString(ret, ".", "_");
+ std::replace(ret.begin(), ret.end(), '.', '_');
cmSystemTools::ReplaceString(ret, "-", "__");
cmSystemTools::ReplaceString(ret, "+", "___");
int ni = 0;
@@ -1544,9 +1558,9 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
this->AppendCustomDepends(depends, gt->GetPreBuildCommands());
this->AppendCustomDepends(depends, gt->GetPostBuildCommands());
this->AppendCustomCommands(commands, gt->GetPreBuildCommands(), gt,
- cmLocalGenerator::START_OUTPUT);
+ cmOutputConverter::START_OUTPUT);
this->AppendCustomCommands(commands, gt->GetPostBuildCommands(), gt,
- cmLocalGenerator::START_OUTPUT);
+ cmOutputConverter::START_OUTPUT);
std::string targetName = gt->GetName();
this->WriteMakeRule(ruleFileStream, targetString.c_str(), targetName,
depends, commands, true);
@@ -1583,15 +1597,15 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
{
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
- progCmd << this->Convert(progressDir, cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
+ progCmd << this->Convert(progressDir, cmOutputConverter::FULL,
+ cmOutputConverter::SHELL);
std::string progressFile = cmake::GetCMakeFilesDirectory();
progressFile += "/progress.marks";
std::string progressFileNameFull = this->ConvertToFullPath(progressFile);
progCmd << " "
- << this->Convert(progressFileNameFull, cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
+ << this->Convert(progressFileNameFull, cmOutputConverter::FULL,
+ cmOutputConverter::SHELL);
commands.push_back(progCmd.str());
}
std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash();
@@ -1599,12 +1613,12 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
commands.push_back(
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmLocalGenerator::START_OUTPUT);
+ cmOutputConverter::START_OUTPUT);
{
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
- progCmd << this->Convert(progressDir, cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
+ progCmd << this->Convert(progressDir, cmOutputConverter::FULL,
+ cmOutputConverter::SHELL);
progCmd << " 0";
commands.push_back(progCmd.str());
}
@@ -1619,7 +1633,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
commands.push_back(
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmLocalGenerator::START_OUTPUT);
+ cmOutputConverter::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "The main clean target", "clean",
depends, commands, true);
commands.clear();
@@ -1645,7 +1659,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
commands.push_back(
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmLocalGenerator::START_OUTPUT);
+ cmOutputConverter::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.",
"preinstall", depends, commands, true);
depends.clear();
@@ -1660,12 +1674,12 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
std::string runRule =
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
- runRule += this->Convert(cmakefileName, cmLocalGenerator::NONE,
- cmLocalGenerator::SHELL);
+ runRule += this->Convert(cmakefileName, cmOutputConverter::NONE,
+ cmOutputConverter::SHELL);
runRule += " 1";
commands.push_back(runRule);
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
- cmLocalGenerator::START_OUTPUT);
+ cmOutputConverter::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "clear depends", "depend", depends,
commands, true);
}
@@ -1832,7 +1846,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
for (std::vector<std::string>::iterator i = includes.begin();
i != includes.end(); ++i) {
cmakefileStream << " \""
- << this->Convert(*i, cmLocalGenerator::HOME_OUTPUT)
+ << this->Convert(*i, cmOutputConverter::HOME_OUTPUT)
<< "\"\n";
}
cmakefileStream << " )\n";
@@ -1874,7 +1888,8 @@ std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall(
// Call make on the given file.
std::string cmd;
cmd += "$(MAKE) -f ";
- cmd += this->Convert(makefile, NONE, SHELL);
+ cmd +=
+ this->Convert(makefile, cmOutputConverter::NONE, cmOutputConverter::SHELL);
cmd += " ";
cmGlobalUnixMakefileGenerator3* gg =
@@ -1896,7 +1911,7 @@ std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall(
// Add the target.
if (!tgt.empty()) {
// The make target is always relative to the top of the build tree.
- std::string tgt2 = this->Convert(tgt, HOME_OUTPUT);
+ std::string tgt2 = this->Convert(tgt, cmOutputConverter::HOME_OUTPUT);
// The target may have been written with windows paths.
cmSystemTools::ConvertToOutputSlashes(tgt2);
@@ -2031,7 +2046,7 @@ void cmLocalUnixMakefileGenerator3::AddImplicitDepends(
void cmLocalUnixMakefileGenerator3::CreateCDCommand(
std::vector<std::string>& commands, const char* tgtDir,
- cmLocalGenerator::RelativeRoot relRetDir)
+ cmOutputConverter::RelativeRoot relRetDir)
{
const char* retDir = this->GetRelativeRootPath(relRetDir);
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 321edcb..a65a1a1 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -120,7 +120,7 @@ public:
// create a command that cds to the start dir then runs the commands
void CreateCDCommand(std::vector<std::string>& commands,
const char* targetDir,
- cmLocalGenerator::RelativeRoot returnDir);
+ cmOutputConverter::RelativeRoot returnDir);
static std::string ConvertToQuotedOutputPath(const char* p,
bool useWatcomQuote);
@@ -230,11 +230,11 @@ protected:
void AppendCustomCommands(
std::vector<std::string>& commands,
const std::vector<cmCustomCommand>& ccs, cmGeneratorTarget* target,
- cmLocalGenerator::RelativeRoot relative = cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter::RelativeRoot relative = cmOutputConverter::HOME_OUTPUT);
void AppendCustomCommand(
std::vector<std::string>& commands, cmCustomCommandGenerator const& ccg,
cmGeneratorTarget* target, bool echo_comment = false,
- cmLocalGenerator::RelativeRoot relative = cmLocalGenerator::HOME_OUTPUT,
+ cmOutputConverter::RelativeRoot relative = cmOutputConverter::HOME_OUTPUT,
std::ostream* content = 0);
void AppendCleanCommand(std::vector<std::string>& commands,
const std::vector<std::string>& files,
@@ -247,9 +247,11 @@ protected:
void CheckMultipleOutputs(bool verbose);
private:
- std::string ConvertShellCommand(std::string const& cmd, RelativeRoot root);
+ std::string ConvertShellCommand(std::string const& cmd,
+ cmOutputConverter::RelativeRoot root);
std::string MakeLauncher(cmCustomCommandGenerator const& ccg,
- cmGeneratorTarget* target, RelativeRoot relative);
+ cmGeneratorTarget* target,
+ cmOutputConverter::RelativeRoot relative);
virtual void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index ad386f7..6e7d7d2 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -269,7 +269,8 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
args += this->GetBinaryDirectory();
commandLine.push_back(args);
commandLine.push_back("--check-stamp-file");
- std::string stampFilename = this->Convert(stampName.c_str(), FULL, SHELL);
+ std::string stampFilename = this->Convert(
+ stampName.c_str(), cmOutputConverter::FULL, cmOutputConverter::SHELL);
commandLine.push_back(stampFilename.c_str());
std::vector<std::string> const& listFiles = this->Makefile->GetListFiles();
@@ -277,8 +278,8 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
cmCustomCommandLines commandLines;
commandLines.push_back(commandLine);
const char* no_working_directory = 0;
- std::string fullpathStampName =
- this->Convert(stampName.c_str(), FULL, UNCHANGED);
+ std::string fullpathStampName = this->Convert(
+ stampName.c_str(), cmOutputConverter::FULL, cmOutputConverter::UNCHANGED);
this->Makefile->AddCustomCommandToOutput(
fullpathStampName.c_str(), listFiles, makefileIn.c_str(), commandLines,
comment.c_str(), no_working_directory, true);
@@ -683,10 +684,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
if (this->FortranProject) {
switch (this->GetFortranFormat(target->GetProperty("Fortran_FORMAT"))) {
- case FortranFormatFixed:
+ case cmOutputConverter::FortranFormatFixed:
flags += " -fixed";
break;
- case FortranFormatFree:
+ case cmOutputConverter::FortranFormatFree:
flags += " -free";
break;
default:
@@ -786,8 +787,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
target->GetProperty("Fortran_MODULE_DIRECTORY");
std::string modDir;
if (target_mod_dir) {
- modDir = this->Convert(target_mod_dir, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED);
+ modDir = this->Convert(target_mod_dir, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED);
} else {
modDir = ".";
}
@@ -1006,8 +1007,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
linkOptions.Parse(extraLinkOptions.c_str());
if (!this->ModuleDefinitionFile.empty()) {
- std::string defFile =
- this->ConvertToOutputFormat(this->ModuleDefinitionFile, SHELL);
+ std::string defFile = this->ConvertToOutputFormat(
+ this->ModuleDefinitionFile, cmOutputConverter::SHELL);
linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str());
}
@@ -1298,8 +1299,8 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) {
if (l->IsPath) {
std::string rel =
- lg->Convert(l->Value.c_str(), cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED);
+ lg->Convert(l->Value.c_str(), cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED);
fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " ";
} else if (!l->Target ||
l->Target->GetType() != cmState::INTERFACE_LIBRARY) {
@@ -1319,8 +1320,8 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects(
const char* sep = isep ? isep : "";
for (std::vector<std::string>::const_iterator oi = objs.begin();
oi != objs.end(); ++oi) {
- std::string rel = lg->Convert(oi->c_str(), cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED);
+ std::string rel = lg->Convert(oi->c_str(), cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED);
fout << sep << lg->ConvertToXMLOutputPath(rel.c_str());
sep = " ";
}
@@ -1343,7 +1344,9 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
// Switch to a relative path specification if it is shorter.
if (cmSystemTools::FileIsFullPath(dir.c_str())) {
- std::string rel = this->Convert(dir.c_str(), START_OUTPUT, UNCHANGED);
+ std::string rel =
+ this->Convert(dir.c_str(), cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED);
if (rel.size() < dir.size()) {
dir = rel;
}
@@ -1472,11 +1475,11 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
}
if (lg->FortranProject) {
switch (lg->GetFortranFormat(sf.GetProperty("Fortran_FORMAT"))) {
- case cmLocalGenerator::FortranFormatFixed:
+ case cmOutputConverter::FortranFormatFixed:
fc.CompileFlags = "-fixed " + fc.CompileFlags;
needfc = true;
break;
- case cmLocalGenerator::FortranFormatFree:
+ case cmOutputConverter::FortranFormatFree:
fc.CompileFlags = "-free " + fc.CompileFlags;
needfc = true;
break;
@@ -2042,7 +2045,8 @@ std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s)
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(
const char* path)
{
- std::string ret = this->ConvertToOutputFormat(path, SHELL);
+ std::string ret =
+ this->ConvertToOutputFormat(path, cmOutputConverter::SHELL);
cmSystemTools::ReplaceString(ret, "&", "&amp;");
cmSystemTools::ReplaceString(ret, "\"", "&quot;");
cmSystemTools::ReplaceString(ret, "<", "&lt;");
@@ -2053,7 +2057,8 @@ std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(
const char* path)
{
- std::string ret = this->ConvertToOutputFormat(path, SHELL);
+ std::string ret =
+ this->ConvertToOutputFormat(path, cmOutputConverter::SHELL);
cmSystemTools::ReplaceString(ret, "\"", "");
cmSystemTools::ReplaceString(ret, "&", "&amp;");
cmSystemTools::ReplaceString(ret, "<", "&lt;");
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7e99f2c..e684689 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1574,6 +1574,10 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string>& incs,
void cmMakefile::AddSystemIncludeDirectories(const std::set<std::string>& incs)
{
+ if (incs.empty()) {
+ return;
+ }
+
this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
for (cmTargets::iterator l = this->Targets.begin(); l != this->Targets.end();
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 674bc2f..9d42257 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -128,16 +128,16 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string targetFullPathPDB = pdbOutputPath + targetNamePDB;
std::string targetFullPathImport = outpathImp + targetNameImport;
std::string targetOutPathPDB = this->Convert(
- targetFullPathPDB, cmLocalGenerator::NONE, cmLocalGenerator::SHELL);
+ targetFullPathPDB, cmOutputConverter::NONE, cmOutputConverter::SHELL);
// Convert to the output path to use in constructing commands.
std::string targetOutPath = this->Convert(
- targetFullPath, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL);
+ targetFullPath, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL);
std::string targetOutPathReal =
- this->Convert(targetFullPathReal, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
std::string targetOutPathImport =
- this->Convert(targetFullPathImport, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ this->Convert(targetFullPathImport, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
// Get the language to use for linking this executable.
std::string linkLanguage =
@@ -159,9 +159,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
buildEcho += linkLanguage;
buildEcho += " executable ";
buildEcho += targetOutPath;
- this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
- cmLocalUnixMakefileGenerator3::EchoLink,
- &progress);
+ this->LocalGenerator->AppendEcho(
+ commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
}
// Build a list of compiler flags and linker flags.
@@ -209,29 +208,30 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// may need to be cleaned.
std::vector<std::string> exeCleanFiles;
exeCleanFiles.push_back(this->Convert(targetFullPath,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
#ifdef _WIN32
// There may be a manifest file for this target. Add it to the
// clean set just in case.
exeCleanFiles.push_back(this->Convert((targetFullPath + ".manifest").c_str(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
#endif
if (targetNameReal != targetName) {
exeCleanFiles.push_back(this->Convert(targetFullPathReal,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
}
if (!targetNameImport.empty()) {
exeCleanFiles.push_back(this->Convert(targetFullPathImport,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
std::string implib;
if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
implib)) {
- exeCleanFiles.push_back(this->Convert(
- implib, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED));
+ exeCleanFiles.push_back(this->Convert(implib,
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
}
}
@@ -239,8 +239,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// cleaned. We do not want to delete the .pdb file just before
// linking the target.
this->CleanFiles.push_back(this->Convert(targetFullPathPDB,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
// Add the pre-build and pre-link rules building but not when relinking.
if (!relink) {
@@ -323,14 +323,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
- objectDir = this->Convert(objectDir, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
- cmLocalGenerator::OutputFormat output = (useWatcomQuote)
- ? cmLocalGenerator::WATCOMQUOTE
- : cmLocalGenerator::SHELL;
- std::string target = this->Convert(targetFullPathReal,
- cmLocalGenerator::START_OUTPUT, output);
+ cmOutputConverter::OutputFormat output = (useWatcomQuote)
+ ? cmOutputConverter::WATCOMQUOTE
+ : cmOutputConverter::SHELL;
+ std::string target = this->Convert(
+ targetFullPathReal, cmOutputConverter::START_OUTPUT, output);
vars.Target = target.c_str();
vars.TargetPDB = targetOutPathPDB.c_str();
@@ -380,7 +380,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
- cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter::HOME_OUTPUT);
commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear();
@@ -393,7 +393,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
commands1.push_back(symlink);
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
- cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter::HOME_OUTPUT);
commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear();
}
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 25235ea..8f7dd7e 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -301,17 +301,18 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Construct the output path version of the names for use in command
// arguments.
std::string targetOutPathPDB = this->Convert(
- targetFullPathPDB, cmLocalGenerator::NONE, cmLocalGenerator::SHELL);
+ targetFullPathPDB, cmOutputConverter::NONE, cmOutputConverter::SHELL);
std::string targetOutPath = this->Convert(
- targetFullPath, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL);
- std::string targetOutPathSO = this->Convert(
- targetFullPathSO, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL);
+ targetFullPath, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL);
+ std::string targetOutPathSO =
+ this->Convert(targetFullPathSO, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
std::string targetOutPathReal =
- this->Convert(targetFullPathReal, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
std::string targetOutPathImport =
- this->Convert(targetFullPathImport, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ this->Convert(targetFullPathImport, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
this->NumberOfProgressActions++;
if (!this->NoRuleMessages) {
@@ -336,10 +337,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
buildEcho += " library ";
break;
}
- buildEcho += targetOutPath.c_str();
- this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
- cmLocalUnixMakefileGenerator3::EchoLink,
- &progress);
+ buildEcho += targetOutPath;
+ this->LocalGenerator->AppendEcho(
+ commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
}
const char* forbiddenFlagVar = 0;
@@ -357,27 +357,28 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Clean files associated with this library.
std::vector<std::string> libCleanFiles;
libCleanFiles.push_back(this->Convert(targetFullPath,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
if (targetNameReal != targetName) {
libCleanFiles.push_back(this->Convert(targetFullPathReal,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
}
if (targetNameSO != targetName && targetNameSO != targetNameReal) {
libCleanFiles.push_back(this->Convert(targetFullPathSO,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
}
if (!targetNameImport.empty()) {
libCleanFiles.push_back(this->Convert(targetFullPathImport,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
std::string implib;
if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
implib)) {
- libCleanFiles.push_back(this->Convert(
- implib, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED));
+ libCleanFiles.push_back(this->Convert(implib,
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
}
}
@@ -385,16 +386,16 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// cleaned. We do not want to delete the .pdb file just before
// linking the target.
this->CleanFiles.push_back(this->Convert(targetFullPathPDB,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
#ifdef _WIN32
// There may be a manifest file for this target. Add it to the
// clean set just in case.
if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY) {
libCleanFiles.push_back(this->Convert(
- (targetFullPath + ".manifest").c_str(), cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED));
+ (targetFullPath + ".manifest").c_str(), cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED));
}
#endif
@@ -406,7 +407,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
this->GeneratorTarget, "target");
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
- cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter::HOME_OUTPUT);
commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear();
}
@@ -525,16 +526,16 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::string("/") + this->GeneratorTarget->GetName();
name_of_def_file += ".def";
std::string cmd = cmSystemTools::GetCMakeCommand();
- cmd =
- this->Convert(cmd, cmLocalGenerator::NONE, cmLocalGenerator::SHELL);
+ cmd = this->Convert(cmd, cmOutputConverter::NONE,
+ cmOutputConverter::SHELL);
cmd += " -E __create_def ";
- cmd += this->Convert(name_of_def_file, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ cmd += this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
cmd += " ";
std::string objlist_file = name_of_def_file;
objlist_file += ".objs";
- cmd += this->Convert(objlist_file, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ cmd += this->Convert(objlist_file, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
real_link_commands.push_back(cmd);
// create a list of obj files for the -E __create_def to read
cmGeneratedFileStream fout(objlist_file.c_str());
@@ -555,8 +556,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
linkFlags +=
- this->Convert(name_of_def_file, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
linkFlags += " ";
}
}
@@ -588,14 +589,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
- objectDir = this->Convert(objectDir, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
- cmLocalGenerator::OutputFormat output = (useWatcomQuote)
- ? cmLocalGenerator::WATCOMQUOTE
- : cmLocalGenerator::SHELL;
- std::string target = this->Convert(targetFullPathReal,
- cmLocalGenerator::START_OUTPUT, output);
+ cmOutputConverter::OutputFormat output = (useWatcomQuote)
+ ? cmOutputConverter::WATCOMQUOTE
+ : cmOutputConverter::SHELL;
+ std::string target = this->Convert(
+ targetFullPathReal, cmOutputConverter::START_OUTPUT, output);
vars.Target = target.c_str();
vars.LinkLibraries = linkLibs.c_str();
vars.ObjectsQuoted = buildObjs.c_str();
@@ -620,7 +621,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
} else {
// Convert to a path for the native build tool.
install_name_dir = this->LocalGenerator->Convert(
- install_name_dir, cmLocalGenerator::NONE, cmLocalGenerator::SHELL);
+ install_name_dir, cmOutputConverter::NONE, cmOutputConverter::SHELL);
vars.TargetInstallNameDir = install_name_dir.c_str();
}
}
@@ -707,7 +708,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
}
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
- cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter::HOME_OUTPUT);
commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear();
@@ -724,7 +725,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
commands1.push_back(symlink);
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
- cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter::HOME_OUTPUT);
commands.insert(commands.end(), commands1.begin(), commands1.end());
commands1.clear();
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index e480140..93f9e49 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -162,7 +162,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
for (std::vector<std::string>::const_iterator o = outputs.begin();
o != outputs.end(); ++o) {
this->CleanFiles.push_back(this->Convert(
- *o, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED));
+ *o, cmOutputConverter::START_OUTPUT, cmOutputConverter::UNCHANGED));
}
}
}
@@ -203,8 +203,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
*this->BuildFileStream
<< "# Include any dependencies generated for this target.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
- << this->Convert(dependFileNameFull, cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKERULE)
+ << this->Convert(dependFileNameFull, cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::MAKERULE)
<< "\n\n";
if (!this->NoRuleMessages) {
@@ -213,8 +213,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< "# Include the progress variables for this target.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
<< this->Convert(this->ProgressFileNameFull,
- cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKERULE)
+ cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::MAKERULE)
<< "\n\n";
}
@@ -244,8 +244,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
*this->BuildFileStream
<< "# Include the compile flags for this target's objects.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
- << this->Convert(this->FlagFileNameFull, cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKERULE)
+ << this->Convert(this->FlagFileNameFull, cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::MAKERULE)
<< "\n\n";
}
@@ -294,15 +294,15 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
this->Generator->OSXBundleGenerator->InitMacOSXContentDirectory(pkgloc);
// Get the input file location.
- std::string input = source.GetFullPath();
+ std::string const& input = source.GetFullPath();
// Get the output file location.
std::string output = macdir;
output += "/";
output += cmSystemTools::GetFilenameName(input);
this->Generator->CleanFiles.push_back(
- this->Generator->Convert(output, cmLocalGenerator::START_OUTPUT));
- output = this->Generator->Convert(output, cmLocalGenerator::HOME_OUTPUT);
+ this->Generator->Convert(output, cmOutputConverter::START_OUTPUT));
+ output = this->Generator->Convert(output, cmOutputConverter::HOME_OUTPUT);
// Create a rule to copy the content into the bundle.
std::vector<std::string> depends;
@@ -311,13 +311,13 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
std::string copyEcho = "Copying OS X content ";
copyEcho += output;
this->Generator->LocalGenerator->AppendEcho(
- commands, copyEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild);
+ commands, copyEcho, cmLocalUnixMakefileGenerator3::EchoBuild);
std::string copyCommand = "$(CMAKE_COMMAND) -E copy ";
- copyCommand += this->Generator->Convert(input, cmLocalGenerator::NONE,
- cmLocalGenerator::SHELL);
+ copyCommand += this->Generator->Convert(input, cmOutputConverter::NONE,
+ cmOutputConverter::SHELL);
copyCommand += " ";
- copyCommand += this->Generator->Convert(output, cmLocalGenerator::NONE,
- cmLocalGenerator::SHELL);
+ copyCommand += this->Generator->Convert(output, cmOutputConverter::NONE,
+ cmOutputConverter::SHELL);
commands.push_back(copyCommand);
this->Generator->LocalGenerator->WriteMakeRule(
*this->Generator->BuildFileStream, 0, output, depends, commands, false);
@@ -381,9 +381,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string objFullPath = this->LocalGenerator->GetCurrentBinaryDirectory();
objFullPath += "/";
objFullPath += obj;
- objFullPath = this->Convert(objFullPath, cmLocalGenerator::FULL);
+ objFullPath = this->Convert(objFullPath, cmOutputConverter::FULL);
std::string srcFullPath =
- this->Convert(source.GetFullPath(), cmLocalGenerator::FULL);
+ this->Convert(source.GetFullPath(), cmOutputConverter::FULL);
this->LocalGenerator->AddImplicitDepends(
this->GeneratorTarget, lang, objFullPath.c_str(), srcFullPath.c_str());
}
@@ -453,7 +453,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// Get the output paths for source and object files.
std::string sourceFile = this->Convert(
- source.GetFullPath(), cmLocalGenerator::NONE, cmLocalGenerator::SHELL);
+ source.GetFullPath(), cmOutputConverter::NONE, cmOutputConverter::SHELL);
// Construct the build message.
std::vector<std::string> no_commands;
@@ -469,7 +469,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
buildEcho += lang;
buildEcho += " object ";
buildEcho += relativeObj;
- this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
+ this->LocalGenerator->AppendEcho(commands, buildEcho,
cmLocalUnixMakefileGenerator3::EchoBuild,
&progress);
}
@@ -502,13 +502,13 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
}
targetOutPathReal =
- this->Convert(targetFullPathReal, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
- targetOutPathPDB = this->Convert(targetFullPathPDB, cmLocalGenerator::NONE,
- cmLocalGenerator::SHELL);
+ this->Convert(targetFullPathReal, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
+ targetOutPathPDB = this->Convert(
+ targetFullPathPDB, cmOutputConverter::NONE, cmOutputConverter::SHELL);
targetOutPathCompilePDB =
- this->Convert(targetFullPathCompilePDB, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ this->Convert(targetFullPathCompilePDB, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
if (this->LocalGenerator->IsMinGWMake() &&
cmHasLiteralSuffix(targetOutPathCompilePDB, "\\")) {
@@ -527,15 +527,15 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
vars.TargetCompilePDB = targetOutPathCompilePDB.c_str();
vars.Source = sourceFile.c_str();
std::string shellObj =
- this->Convert(obj, cmLocalGenerator::NONE, cmLocalGenerator::SHELL);
+ this->Convert(obj, cmOutputConverter::NONE, cmOutputConverter::SHELL);
vars.Object = shellObj.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
- objectDir = this->Convert(objectDir, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ objectDir = this->Convert(objectDir, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
std::string objectFileDir = cmSystemTools::GetFilenamePath(obj);
- objectFileDir = this->Convert(objectFileDir, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ objectFileDir = this->Convert(objectFileDir, cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::SHELL);
vars.ObjectFileDir = objectFileDir.c_str();
vars.Flags = flags.c_str();
@@ -574,7 +574,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
this->LocalGenerator->ExpandRuleVariables(compileCommand, vars);
std::string workingDirectory = this->LocalGenerator->Convert(
this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmLocalGenerator::FULL);
+ cmOutputConverter::FULL);
compileCommand.replace(compileCommand.find(langFlags), langFlags.size(),
this->GetFlags(lang));
std::string langDefines = std::string("$(") + lang + "_DEFINES)";
@@ -637,7 +637,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// Change the command working directory to the local build tree.
this->LocalGenerator->CreateCDCommand(
compileCommands, this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter::HOME_OUTPUT);
commands.insert(commands.end(), compileCommands.begin(),
compileCommands.end());
}
@@ -661,9 +661,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
if (do_preprocess_rules || do_assembly_rules) {
std::vector<std::string> force_depends;
force_depends.push_back("cmake_force");
- std::string::size_type dot_pos = relativeObj.rfind(".");
+ std::string::size_type dot_pos = relativeObj.rfind('.');
std::string relativeObjBase = relativeObj.substr(0, dot_pos);
- dot_pos = obj.rfind(".");
+ dot_pos = obj.rfind('.');
std::string objBase = obj.substr(0, dot_pos);
if (do_preprocess_rules) {
@@ -676,8 +676,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
preprocessEcho += " source to ";
preprocessEcho += objI;
this->LocalGenerator->AppendEcho(
- commands, preprocessEcho.c_str(),
- cmLocalUnixMakefileGenerator3::EchoBuild);
+ commands, preprocessEcho, cmLocalUnixMakefileGenerator3::EchoBuild);
std::string preprocessRuleVar = "CMAKE_";
preprocessRuleVar += lang;
@@ -687,8 +686,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
std::vector<std::string> preprocessCommands;
cmSystemTools::ExpandListArgument(preprocessRule, preprocessCommands);
- std::string shellObjI =
- this->Convert(objI, cmLocalGenerator::NONE, cmLocalGenerator::SHELL);
+ std::string shellObjI = this->Convert(objI, cmOutputConverter::NONE,
+ cmOutputConverter::SHELL);
vars.PreprocessedSource = shellObjI.c_str();
// Expand placeholders in the commands.
@@ -700,7 +699,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
this->LocalGenerator->CreateCDCommand(
preprocessCommands,
this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter::HOME_OUTPUT);
commands.insert(commands.end(), preprocessCommands.begin(),
preprocessCommands.end());
} else {
@@ -724,8 +723,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
assemblyEcho += " source to assembly ";
assemblyEcho += objS;
this->LocalGenerator->AppendEcho(
- commands, assemblyEcho.c_str(),
- cmLocalUnixMakefileGenerator3::EchoBuild);
+ commands, assemblyEcho, cmLocalUnixMakefileGenerator3::EchoBuild);
std::string assemblyRuleVar = "CMAKE_";
assemblyRuleVar += lang;
@@ -735,8 +733,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
std::vector<std::string> assemblyCommands;
cmSystemTools::ExpandListArgument(assemblyRule, assemblyCommands);
- std::string shellObjS =
- this->Convert(objS, cmLocalGenerator::NONE, cmLocalGenerator::SHELL);
+ std::string shellObjS = this->Convert(objS, cmOutputConverter::NONE,
+ cmOutputConverter::SHELL);
vars.AssemblySource = shellObjS.c_str();
// Expand placeholders in the commands.
@@ -747,7 +745,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
this->LocalGenerator->CreateCDCommand(
assemblyCommands, this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter::HOME_OUTPUT);
commands.insert(commands.end(), assemblyCommands.begin(),
assemblyCommands.end());
} else {
@@ -836,7 +834,7 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules()
this->GeneratorTarget);
this->LocalGenerator->CreateCDCommand(
commands, this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmLocalGenerator::HOME_OUTPUT);
+ cmOutputConverter::HOME_OUTPUT);
// Write the rule.
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, cleanTarget,
@@ -879,8 +877,8 @@ bool cmMakefileTargetGenerator::WriteMakeRule(
o != outputs.end(); ++o) {
// Touch the extra output so "make" knows that it was updated,
// but only if the output was acually created.
- std::string const out = this->Convert(*o, cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::SHELL);
+ std::string const out = this->Convert(*o, cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::SHELL);
std::vector<std::string> output_commands;
bool o_symbolic = false;
@@ -988,7 +986,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// translation table for the dependency scanning process.
depCmd << "cd " << (this->LocalGenerator->Convert(
this->LocalGenerator->GetBinaryDirectory(),
- cmLocalGenerator::FULL, cmLocalGenerator::SHELL))
+ cmOutputConverter::FULL, cmOutputConverter::SHELL))
<< " && ";
#endif
// Generate a call this signature:
@@ -1003,19 +1001,19 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
depCmd << "$(CMAKE_COMMAND) -E cmake_depends \""
<< this->GlobalGenerator->GetName() << "\" "
<< this->Convert(this->LocalGenerator->GetSourceDirectory(),
- cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
+ cmOutputConverter::FULL, cmOutputConverter::SHELL)
<< " "
<< this->Convert(this->LocalGenerator->GetCurrentSourceDirectory(),
- cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
+ cmOutputConverter::FULL, cmOutputConverter::SHELL)
<< " "
<< this->Convert(this->LocalGenerator->GetBinaryDirectory(),
- cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
+ cmOutputConverter::FULL, cmOutputConverter::SHELL)
<< " "
<< this->Convert(this->LocalGenerator->GetCurrentBinaryDirectory(),
- cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
+ cmOutputConverter::FULL, cmOutputConverter::SHELL)
<< " "
- << this->Convert(this->InfoFileNameFull, cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
+ << this->Convert(this->InfoFileNameFull, cmOutputConverter::FULL,
+ cmOutputConverter::SHELL);
if (this->LocalGenerator->GetColorMakefile()) {
depCmd << " --color=$(COLOR)";
}
@@ -1073,7 +1071,7 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
cmLocalUnixMakefileGenerator3::EchoProgress progress;
this->MakeEchoProgress(progress);
this->LocalGenerator->AppendEcho(
- commands, comment.c_str(), cmLocalUnixMakefileGenerator3::EchoGenerate,
+ commands, comment, cmLocalUnixMakefileGenerator3::EchoGenerate,
&progress);
}
}
@@ -1081,8 +1079,8 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
// Now append the actual user-specified commands.
std::ostringstream content;
this->LocalGenerator->AppendCustomCommand(
- commands, ccg, this->GeneratorTarget, false, cmLocalGenerator::HOME_OUTPUT,
- &content);
+ commands, ccg, this->GeneratorTarget, false,
+ cmOutputConverter::HOME_OUTPUT, &content);
// Collect the dependencies.
std::vector<std::string> depends;
@@ -1103,9 +1101,9 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
ccg.GetCC().GetImplicitDepends().begin();
idi != ccg.GetCC().GetImplicitDepends().end(); ++idi) {
std::string objFullPath =
- this->Convert(outputs[0], cmLocalGenerator::FULL);
+ this->Convert(outputs[0], cmOutputConverter::FULL);
std::string srcFullPath =
- this->Convert(idi->second, cmLocalGenerator::FULL);
+ this->Convert(idi->second, cmOutputConverter::FULL);
this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, idi->first,
objFullPath.c_str(),
srcFullPath.c_str());
@@ -1161,7 +1159,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
for (std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin();
i != this->ExternalObjects.end(); ++i) {
- object = this->Convert(*i, cmLocalGenerator::START_OUTPUT);
+ object = this->Convert(*i, cmOutputConverter::START_OUTPUT);
*this->BuildFileStream << " " << lineContinue << "\n"
<< this->Makefile->GetSafeDefinition(
"CMAKE_OBJECT_NAME");
@@ -1195,7 +1193,7 @@ public:
{
// Construct the name of the next object.
this->NextObject = this->LocalGenerator->Convert(
- obj, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::RESPONSE);
+ obj, cmOutputConverter::START_OUTPUT, cmOutputConverter::RESPONSE);
// Roll over to next string if the limit will be exceeded.
if (this->LengthLimit != std::string::npos &&
@@ -1249,8 +1247,8 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
std::string buildTargetRuleName = dir;
buildTargetRuleName += relink ? "/preinstall" : "/build";
buildTargetRuleName =
- this->Convert(buildTargetRuleName, cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::UNCHANGED);
+ this->Convert(buildTargetRuleName, cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::UNCHANGED);
// Build the list of target outputs to drive.
std::vector<std::string> depends;
@@ -1438,8 +1436,8 @@ void cmMakefileTargetGenerator::CreateLinkScript(
// Create the makefile command to invoke the link script.
std::string link_command = "$(CMAKE_COMMAND) -E cmake_link_script ";
- link_command += this->Convert(linkScriptName, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ link_command += this->Convert(
+ linkScriptName, cmOutputConverter::START_OUTPUT, cmOutputConverter::SHELL);
link_command += " --verbose=$(VERBOSE)";
makefile_commands.push_back(link_command);
makefile_depends.push_back(linkScriptName);
@@ -1479,7 +1477,7 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
useResponseFile, useWatcomQuote);
linkLibs = frameworkPath + linkPath + linkLibs;
- if (useResponseFile && linkLibs.find_first_not_of(" ") != linkLibs.npos) {
+ if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {
// Lookup the response file reference flag.
std::string responseFlagVar = "CMAKE_";
responseFlagVar +=
@@ -1496,8 +1494,8 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
// Reference the response file.
linkLibs = responseFlag;
- linkLibs +=
- this->Convert(link_rsp, cmLocalGenerator::NONE, cmLocalGenerator::SHELL);
+ linkLibs += this->Convert(link_rsp, cmOutputConverter::NONE,
+ cmOutputConverter::SHELL);
}
}
@@ -1545,8 +1543,8 @@ void cmMakefileTargetGenerator::CreateObjectLists(
// Reference the response file.
buildObjs += responseFlag;
- buildObjs += this->Convert(objects_rsp, cmLocalGenerator::NONE,
- cmLocalGenerator::SHELL);
+ buildObjs += this->Convert(objects_rsp, cmOutputConverter::NONE,
+ cmOutputConverter::SHELL);
}
} else if (useLinkScript) {
if (!useArchiveRules) {
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 697f123..6e44e8f 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -48,8 +48,8 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
<< "# Include the progress variables for this target.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
<< this->Convert(this->ProgressFileNameFull,
- cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKERULE)
+ cmOutputConverter::HOME_OUTPUT,
+ cmOutputConverter::MAKERULE)
<< "\n\n";
}
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 831d44b..3e91545 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -255,7 +255,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
!this->GetGeneratorTarget()->IsFrameworkOnApple()) {
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
- cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
+ cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
if (targetType == cmState::EXECUTABLE)
this->GetGlobalGenerator()->AddRule(
"CMAKE_SYMLINK_EXECUTABLE",
@@ -304,7 +304,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
{
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
- cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
+ cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
linkCmds.push_back(cmakeCommand + " -E remove $TARGET_FILE");
}
// TODO: Use ARCHIVE_APPEND for archives over a certain size.
@@ -432,7 +432,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator();
vars["TARGET_FILE"] =
- localGen.ConvertToOutputFormat(targetOutputReal, cmLocalGenerator::SHELL);
+ localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
localGen.GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"],
vars["LINK_FLAGS"], frameworkPath, linkPath,
@@ -445,7 +445,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
name_of_def_file += ".def ";
vars["LINK_FLAGS"] += " /DEF:";
vars["LINK_FLAGS"] += this->GetLocalGenerator()->ConvertToOutputFormat(
- name_of_def_file.c_str(), cmLocalGenerator::SHELL);
+ name_of_def_file, cmOutputConverter::SHELL);
}
}
@@ -492,7 +492,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
this->GetGeneratorTarget()->GetInstallNameDirForBuildTree(cfgName);
if (!install_dir.empty()) {
vars["INSTALLNAME_DIR"] = localGen.Convert(
- install_dir, cmLocalGenerator::NONE, cmLocalGenerator::SHELL);
+ install_dir, cmOutputConverter::NONE, cmOutputConverter::SHELL);
}
}
}
@@ -501,7 +501,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
if (!this->TargetNameImport.empty()) {
const std::string impLibPath = localGen.ConvertToOutputFormat(
- targetOutputImplib, cmLocalGenerator::SHELL);
+ targetOutputImplib, cmOutputConverter::SHELL);
vars["TARGET_IMPLIB"] = impLibPath;
EnsureParentDirectoryExists(impLibPath);
if (genTarget.HasImportLibrary()) {
@@ -526,7 +526,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
const std::string objPath = GetGeneratorTarget()->GetSupportDirectory();
vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- this->ConvertToNinjaPath(objPath), cmLocalGenerator::SHELL);
+ this->ConvertToNinjaPath(objPath), cmOutputConverter::SHELL);
EnsureDirectoryExists(objPath);
if (this->GetGlobalGenerator()->IsGCCOnWindows()) {
@@ -565,20 +565,20 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
- cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
+ cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
std::string name_of_def_file = gt.GetSupportDirectory();
name_of_def_file += "/" + gt.GetName();
name_of_def_file += ".def";
std::string cmd = cmakeCommand;
cmd += " -E __create_def ";
cmd += this->GetLocalGenerator()->ConvertToOutputFormat(
- name_of_def_file.c_str(), cmLocalGenerator::SHELL);
+ name_of_def_file, cmOutputConverter::SHELL);
cmd += " ";
cmNinjaDeps objs = this->GetObjects();
std::string obj_list_file = name_of_def_file;
obj_list_file += ".objs";
cmd += this->GetLocalGenerator()->ConvertToOutputFormat(
- obj_list_file.c_str(), cmLocalGenerator::SHELL);
+ obj_list_file, cmOutputConverter::SHELL);
preLinkCmdLines.push_back(cmd);
// create a list of obj files for the -E __create_def to read
cmGeneratedFileStream fout(obj_list_file.c_str());
@@ -593,7 +593,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// the link commands.
if (!preLinkCmdLines.empty()) {
const std::string homeOutDir = localGen.ConvertToOutputFormat(
- localGen.GetBinaryDirectory(), cmLocalGenerator::SHELL);
+ localGen.GetBinaryDirectory(), cmOutputConverter::SHELL);
preLinkCmdLines.push_back("cd " + homeOutDir);
}
@@ -652,7 +652,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
cmNinjaDeps(1, targetOutputReal), emptyDeps, emptyDeps, symlinkVars);
} else {
cmNinjaDeps symlinks;
- const std::string soName = this->GetTargetFilePath(this->TargetNameSO);
+ std::string const soName =
+ this->ConvertToNinjaPath(this->GetTargetFilePath(this->TargetNameSO));
// If one link has to be created.
if (targetOutputReal == soName || targetOutput == soName) {
symlinkVars["SONAME"] = soName;
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index c214c8a..bad5e2f 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -134,7 +134,7 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
// needed by cmcldeps
false, this->GetConfigName());
if (this->GetGlobalGenerator()->IsGCCOnWindows())
- cmSystemTools::ReplaceString(includeFlags, "\\", "/");
+ std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/');
this->LocalGenerator->AppendFlags(languageFlags, includeFlags);
}
@@ -274,10 +274,10 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
}
vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- ConvertToNinjaPath(pdbPath), cmLocalGenerator::SHELL);
+ ConvertToNinjaPath(pdbPath), cmOutputConverter::SHELL);
vars["TARGET_COMPILE_PDB"] =
this->GetLocalGenerator()->ConvertToOutputFormat(
- ConvertToNinjaPath(compilePdbPath), cmLocalGenerator::SHELL);
+ ConvertToNinjaPath(compilePdbPath), cmOutputConverter::SHELL);
EnsureParentDirectoryExists(pdbPath);
EnsureParentDirectoryExists(compilePdbPath);
@@ -316,7 +316,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
std::string rspcontent;
std::string responseFlag;
- if (this->ForceResponseFile()) {
+ if (lang != "RC" && this->ForceResponseFile()) {
rspfile = "$RSP_FILE";
responseFlag = "@" + rspfile;
rspcontent = " $DEFINES $INCLUDES $FLAGS";
@@ -383,7 +383,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
const char* tidy = this->GeneratorTarget->GetProperty(tidy_prop);
if ((iwyu && *iwyu) || (tidy && *tidy)) {
std::string run_iwyu = this->GetLocalGenerator()->ConvertToOutputFormat(
- cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
+ cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
run_iwyu += " -E __run_iwyu";
if (iwyu && *iwyu) {
run_iwyu += " --iwyu=";
@@ -521,8 +521,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
std::string const language = source->GetLanguage();
std::string const sourceFileName =
language == "RC" ? source->GetFullPath() : this->GetSourceFilePath(source);
- std::string const objectDir = this->GeneratorTarget->GetSupportDirectory();
- std::string const objectFileName = this->GetObjectFilePath(source);
+ std::string const objectDir =
+ this->ConvertToNinjaPath(this->GeneratorTarget->GetSupportDirectory());
+ std::string const objectFileName =
+ this->ConvertToNinjaPath(this->GetObjectFilePath(source));
std::string const objectFileDir =
cmSystemTools::GetFilenamePath(objectFileName);
@@ -582,16 +584,18 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
EnsureParentDirectoryExists(objectFileName);
vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- ConvertToNinjaPath(objectDir), cmLocalGenerator::SHELL);
+ objectDir, cmOutputConverter::SHELL);
vars["OBJECT_FILE_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- ConvertToNinjaPath(objectFileDir), cmLocalGenerator::SHELL);
+ objectFileDir, cmOutputConverter::SHELL);
this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetGeneratorTarget(),
vars);
this->SetMsvcTargetPdbVariable(vars);
- int const commandLineLengthLimit = this->ForceResponseFile() ? -1 : 0;
+ bool const isRC = (language == "RC");
+ int const commandLineLengthLimit =
+ ((!isRC && this->ForceResponseFile())) ? -1 : 0;
std::string const rspfile = objectFileName + ".rsp";
this->GetGlobalGenerator()->WriteBuild(
@@ -632,7 +636,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
}
escapedSourceFileName = this->LocalGenerator->ConvertToOutputFormat(
- escapedSourceFileName, cmLocalGenerator::SHELL);
+ escapedSourceFileName, cmOutputConverter::SHELL);
compileObjectVars.Source = escapedSourceFileName.c_str();
compileObjectVars.Object = objectFileName.c_str();
@@ -667,10 +671,12 @@ void cmNinjaTargetGenerator::EnsureDirectoryExists(
if (cmSystemTools::FileIsFullPath(path.c_str())) {
cmSystemTools::MakeDirectory(path.c_str());
} else {
- const std::string fullPath = std::string(this->GetGlobalGenerator()
- ->GetCMakeInstance()
- ->GetHomeOutputDirectory()) +
- "/" + path;
+ cmGlobalNinjaGenerator* gg = this->GetGlobalGenerator();
+ std::string fullPath =
+ std::string(gg->GetCMakeInstance()->GetHomeOutputDirectory());
+ // Also ensures their is a trailing slash.
+ gg->StripNinjaOutputPathPrefixAsSuffix(fullPath);
+ fullPath += path;
cmSystemTools::MakeDirectory(fullPath.c_str());
}
}
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index b0b1147..f7a7f38 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -33,6 +33,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
{
std::string utilCommandName = cmake::GetCMakeFilesDirectoryPostSlash();
utilCommandName += this->GetTargetName() + ".util";
+ utilCommandName =
+ this->GetGlobalGenerator()->NinjaOutputPath(utilCommandName);
std::vector<std::string> commands;
cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName);
@@ -109,14 +111,14 @@ void cmNinjaUtilityTargetGenerator::Generate()
this->GetLocalGenerator()
->ConvertToOutputFormat(
this->GetLocalGenerator()->GetSourceDirectory(),
- cmLocalGenerator::SHELL)
+ cmOutputConverter::SHELL)
.c_str());
cmSystemTools::ReplaceString(
command, "$(CMAKE_BINARY_DIR)",
this->GetLocalGenerator()
->ConvertToOutputFormat(
this->GetLocalGenerator()->GetBinaryDirectory(),
- cmLocalGenerator::SHELL)
+ cmOutputConverter::SHELL)
.c_str());
cmSystemTools::ReplaceString(command, "$(ARGS)", "");
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 0388a95..dd19760 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -963,7 +963,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
cmsys::ofstream infoFile(outputFile.c_str(), std::ios::app);
if (!infoFile) {
std::string error = "Internal CMake error when trying to open file: ";
- error += outputFile.c_str();
+ error += outputFile;
error += " for writing.";
cmSystemTools::Error(error.c_str());
return;
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index cb1801f..ac64397 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1303,7 +1303,7 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
const std::string& qrcOutputFile)
{
std::string relName = this->SourceRelativePath(qrcInputFile);
- cmSystemTools::ReplaceString(relName, "/", "_");
+ std::replace(relName.begin(), relName.end(), '/', '_');
relName += cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcInputFile);
const ::std::string qrcBuildFile = this->Builddir + qrcOutputFile;
diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h
index 4b37a3a..835196f 100644
--- a/Source/cmSearchPath.h
+++ b/Source/cmSearchPath.h
@@ -26,7 +26,7 @@ class cmSearchPath
{
public:
// cmSearchPath must be initialized from a valid pointer. The only reason
- // for teh default is to allow it to be easily used in stl containers.
+ // for the default is to allow it to be easily used in stl containers.
// Attempting to initialize with a NULL value will fail an assertion
cmSearchPath(cmFindCommon* findCmd = 0);
~cmSearchPath();
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index 3438321..440b635 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -62,7 +62,7 @@ bool cmSeparateArgumentsCommand::InitialPass(
// Original space-replacement version of command.
if (const char* def = this->Makefile->GetDefinition(var)) {
std::string value = def;
- cmSystemTools::ReplaceString(value, " ", ";");
+ std::replace(value.begin(), value.end(), ' ', ';');
this->Makefile->AddDefinition(var, value.c_str());
}
} else {
diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h
index af3651a..7989173 100644
--- a/Source/cmSourceFileLocation.h
+++ b/Source/cmSourceFileLocation.h
@@ -39,7 +39,7 @@ public:
cmSourceFileLocation& operator=(const cmSourceFileLocation& loc);
/**
- * Return whether the givne source file location could refers to the
+ * Return whether the given source file location could refers to the
* same source file as this location given the level of ambiguity in
* each location.
*/
diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx
index c09d596..394b33a 100644
--- a/Source/cmSourceGroup.cxx
+++ b/Source/cmSourceGroup.cxx
@@ -103,7 +103,7 @@ const std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles() const
return this->SourceFiles;
}
-void cmSourceGroup::AddChild(cmSourceGroup child)
+void cmSourceGroup::AddChild(cmSourceGroup const& child)
{
this->Internal->GroupChildren.push_back(child);
}
diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h
index 5a551f8..8603e95 100644
--- a/Source/cmSourceGroup.h
+++ b/Source/cmSourceGroup.h
@@ -52,7 +52,7 @@ public:
/**
* Add child to this sourcegroup
*/
- void AddChild(cmSourceGroup child);
+ void AddChild(cmSourceGroup const& child);
/**
* Looks up child and returns it
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index b674b4e..04f07ce 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -965,7 +965,7 @@ void cmState::Directory::SetCurrentSource(std::string const& dir)
loc, this->DirectoryState->CurrentSourceDirectoryComponents);
this->ComputeRelativePathTopSource();
- this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc.c_str());
+ this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc);
}
const char* cmState::Directory::GetCurrentBinary() const
@@ -984,7 +984,7 @@ void cmState::Directory::SetCurrentBinary(std::string const& dir)
loc, this->DirectoryState->CurrentBinaryDirectoryComponents);
this->ComputeRelativePathTopBinary();
- this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc.c_str());
+ this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc);
}
void cmState::Snapshot::SetListFile(const std::string& listfile)
@@ -1380,8 +1380,8 @@ void cmState::Snapshot::InitializeFromParent_ForSubdirsCommand()
this->SetDefinition("CMAKE_SOURCE_DIR", this->State->GetSourceDirectory());
this->SetDefinition("CMAKE_BINARY_DIR", this->State->GetBinaryDirectory());
- this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", currentSrcDir.c_str());
- this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", currentBinDir.c_str());
+ this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", currentSrcDir);
+ this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", currentBinDir);
}
cmState::Directory::Directory(
@@ -1616,7 +1616,7 @@ bool cmState::Snapshot::StrictWeakOrder::operator()(
void cmState::Directory::SetProperty(const std::string& prop,
const char* value,
- cmListFileBacktrace lfbt)
+ cmListFileBacktrace const& lfbt)
{
if (prop == "INCLUDE_DIRECTORIES") {
if (!value) {
@@ -1648,7 +1648,7 @@ void cmState::Directory::SetProperty(const std::string& prop,
void cmState::Directory::AppendProperty(const std::string& prop,
const char* value, bool asString,
- cmListFileBacktrace lfbt)
+ cmListFileBacktrace const& lfbt)
{
if (prop == "INCLUDE_DIRECTORIES") {
this->AppendIncludeDirectoriesEntry(value, lfbt);
diff --git a/Source/cmState.h b/Source/cmState.h
index 7ecac56..18c45b8 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -164,9 +164,9 @@ public:
void ClearCompileOptions();
void SetProperty(const std::string& prop, const char* value,
- cmListFileBacktrace lfbt);
+ cmListFileBacktrace const& lfbt);
void AppendProperty(const std::string& prop, const char* value,
- bool asString, cmListFileBacktrace lfbt);
+ bool asString, cmListFileBacktrace const& 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;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index bb52441..7dece47 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1298,7 +1298,7 @@ cmSystemTools::SaveRestoreEnvironment::~SaveRestoreEnvironment()
eit != currentEnv.end(); ++eit) {
std::string var(*eit);
- std::string::size_type pos = var.find("=");
+ std::string::size_type pos = var.find('=');
if (pos != std::string::npos) {
var = var.substr(0, pos);
}
@@ -2135,37 +2135,33 @@ bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath,
std::string::size_type cmSystemToolsFindRPath(std::string const& have,
std::string const& want)
{
- // Search for the desired rpath.
- std::string::size_type pos = have.find(want);
+ std::string::size_type pos = 0;
+ while (pos < have.size()) {
+ // Look for an occurrence of the string.
+ std::string::size_type const beg = have.find(want, pos);
+ if (beg == std::string::npos) {
+ return std::string::npos;
+ }
- // If the path is not present we are done.
- if (pos == std::string::npos) {
- return pos;
- }
+ // Make sure it is separated from preceding entries.
+ if (beg > 0 && have[beg - 1] != ':') {
+ pos = beg + 1;
+ continue;
+ }
- // Build a regex to match a properly separated path instance.
- std::string regex_str = "(^|:)(";
- for (std::string::const_iterator i = want.begin(); i != want.end(); ++i) {
- int ch = *i;
- if (!(('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
- ('0' <= ch && ch <= '9'))) {
- // Escape the non-alphanumeric character.
- regex_str += "\\";
+ // Make sure it is separated from following entries.
+ std::string::size_type const end = beg + want.size();
+ if (end < have.size() && have[end] != ':') {
+ pos = beg + 1;
+ continue;
}
- // Store the character.
- regex_str.append(1, static_cast<char>(ch));
- }
- regex_str += ")(:|$)";
- // Look for the separated path.
- cmsys::RegularExpression regex(regex_str.c_str());
- if (regex.find(have)) {
// Return the position of the path portion.
- return regex.start(2);
- } else {
- // The desired rpath was not found.
- return std::string::npos;
+ return beg;
}
+
+ // The desired rpath was not found.
+ return std::string::npos;
}
#endif
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 5e0d2b7..f435a1d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1131,7 +1131,9 @@ const char* cmTarget::GetProperty(const std::string& prop,
// target because the configuration type may not be known at
// CMake time.
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
- gg->CreateGenerationObjects();
+ if (!gg->GetConfigureDoneCMP0026()) {
+ gg->CreateGenerationObjects();
+ }
cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
this->Properties.SetProperty(propLOCATION, gt->GetLocationForBuild());
}
@@ -1150,7 +1152,9 @@ const char* cmTarget::GetProperty(const std::string& prop,
prop, this->ImportedGetFullPath(configName, false).c_str());
} else {
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
- gg->CreateGenerationObjects();
+ if (!gg->GetConfigureDoneCMP0026()) {
+ gg->CreateGenerationObjects();
+ }
cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
this->Properties.SetProperty(
prop, gt->GetFullPath(configName, false).c_str());
@@ -1168,7 +1172,9 @@ const char* cmTarget::GetProperty(const std::string& prop,
prop, this->ImportedGetFullPath(configName, false).c_str());
} else {
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
- gg->CreateGenerationObjects();
+ if (!gg->GetConfigureDoneCMP0026()) {
+ gg->CreateGenerationObjects();
+ }
cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
this->Properties.SetProperty(
prop, gt->GetFullPath(configName, false).c_str());
diff --git a/Source/cmVS14CLFlagTable.h b/Source/cmVS14CLFlagTable.h
index 4243f30..5812e79 100644
--- a/Source/cmVS14CLFlagTable.h
+++ b/Source/cmVS14CLFlagTable.h
@@ -16,7 +16,6 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = {
{ "Optimization", "", "Custom", "Custom", 0 },
{ "Optimization", "Od", "Disabled", "Disabled", 0 },
- { "Optimization", "Os", "Minimize Size", "MinSize", 0 },
{ "Optimization", "O1", "Minimize Size", "MinSpace", 0 },
{ "Optimization", "O2", "Maximize Speed", "MaxSpeed", 0 },
{ "Optimization", "Ox", "Full Optimization", "Full", 0 },
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index ac2f2fa..11eaa93 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -13,6 +13,8 @@
#include "cmAlgorithms.h"
+#include <cmsys/auto_ptr.hxx>
+
static const char* const cmVariableWatchAccessStrings[] = {
"READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS",
"MODIFIED_ACCESS", "REMOVED_ACCESS", "NO_ACCESS"
@@ -46,7 +48,7 @@ bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method,
void* client_data /*=0*/,
DeleteData delete_data /*=0*/)
{
- cmVariableWatch::Pair* p = new cmVariableWatch::Pair;
+ cmsys::auto_ptr<cmVariableWatch::Pair> p(new cmVariableWatch::Pair);
p->Method = method;
p->ClientData = client_data;
p->DeleteDataCall = delete_data;
@@ -60,7 +62,7 @@ bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method,
return false;
}
}
- vp->push_back(p);
+ vp->push_back(p.release());
return true;
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 3d93e69..3b1cddb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2207,7 +2207,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
libs = libs.substr(0, pos + 1);
}
// Replace spaces in libs with ;
- cmSystemTools::ReplaceString(libs, " ", ";");
+ std::replace(libs.begin(), libs.end(), ' ', ';');
std::vector<std::string> libVec;
cmSystemTools::ExpandListArgument(libs, libVec);
@@ -2404,8 +2404,8 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) {
if (l->IsPath) {
std::string path = this->LocalGenerator->Convert(
- l->Value.c_str(), cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED);
+ l->Value.c_str(), cmOutputConverter::START_OUTPUT,
+ cmOutputConverter::UNCHANGED);
this->ConvertToWindowsSlash(path);
libVec.push_back(path);
} else if (!l->Target ||
diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx
index 4f5e7c0..bc6b0bf 100644
--- a/Source/cmVisualStudioWCEPlatformParser.cxx
+++ b/Source/cmVisualStudioWCEPlatformParser.cxx
@@ -141,8 +141,8 @@ std::string cmVisualStudioWCEPlatformParser::FixPaths(
cmSystemTools::ReplaceString(ret, "$(PATH)", "%PATH%");
cmSystemTools::ReplaceString(ret, "$(VCInstallDir)", VcInstallDir.c_str());
cmSystemTools::ReplaceString(ret, "$(VSInstallDir)", VsInstallDir.c_str());
- cmSystemTools::ReplaceString(ret, "\\", "/");
+ std::replace(ret.begin(), ret.end(), '\\', '/');
cmSystemTools::ReplaceString(ret, "//", "/");
- cmSystemTools::ReplaceString(ret, "/", "\\");
+ std::replace(ret.begin(), ret.end(), '/', '\\');
return ret;
}
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e4d6656..89ea955 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2296,10 +2296,8 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg)
}
void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
- cmListFileBacktrace const& bt, bool force)
+ cmListFileBacktrace const& backtrace, bool force)
{
- cmListFileBacktrace backtrace = bt;
-
if (!force) {
// override the message type, if needed, for warnings and errors
cmake::MessageType override = this->ConvertMessageType(t);
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 891b291..471028a 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -196,8 +196,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// If error occurs we want to continue copying next files.
bool return_value = 0;
for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
- if (!cmSystemTools::CopyADirectory(args[cc].c_str(),
- args[args.size() - 1].c_str())) {
+ if (!cmSystemTools::CopyADirectory(args[cc], args[args.size() - 1])) {
std::cerr << "Error copying directory from \"" << args[cc]
<< "\" to \"" << args[args.size() - 1] << "\".\n";
return_value = 1;
@@ -386,7 +385,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::cerr << "cmake -E env: unknown option '" << a << "'"
<< std::endl;
return 1;
- } else if (a.find("=") != a.npos) {
+ } else if (a.find('=') != a.npos) {
// Set environment variable.
cmSystemTools::PutEnv(a);
} else {
diff --git a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in
index c018e08..b141942 100644
--- a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in
+++ b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in
@@ -51,7 +51,7 @@ main(int ac, char **av)
}
if (!logfile.empty())
- cmSystemTools::Touch(logfile.c_str(), true);
+ cmSystemTools::Touch(logfile, true);
}
return RETVAL;
diff --git a/Tests/CMakeLib/testGeneratedFileStream.cxx b/Tests/CMakeLib/testGeneratedFileStream.cxx
index 128cab4..67dd69a 100644
--- a/Tests/CMakeLib/testGeneratedFileStream.cxx
+++ b/Tests/CMakeLib/testGeneratedFileStream.cxx
@@ -81,14 +81,14 @@ int testGeneratedFileStream(int, char* [])
cmFailed("Something wrong with cmGeneratedFileStream. Cannot find file: ",
file1.c_str());
}
- cmSystemTools::RemoveFile(file1.c_str());
- cmSystemTools::RemoveFile(file2.c_str());
- cmSystemTools::RemoveFile(file3.c_str());
- cmSystemTools::RemoveFile(file4.c_str());
- cmSystemTools::RemoveFile(file1tmp.c_str());
- cmSystemTools::RemoveFile(file2tmp.c_str());
- cmSystemTools::RemoveFile(file3tmp.c_str());
- cmSystemTools::RemoveFile(file4tmp.c_str());
+ cmSystemTools::RemoveFile(file1);
+ cmSystemTools::RemoveFile(file2);
+ cmSystemTools::RemoveFile(file3);
+ cmSystemTools::RemoveFile(file4);
+ cmSystemTools::RemoveFile(file1tmp);
+ cmSystemTools::RemoveFile(file2tmp);
+ cmSystemTools::RemoveFile(file3tmp);
+ cmSystemTools::RemoveFile(file4tmp);
return failed;
}
diff --git a/Tests/CMakeLib/testRST.cxx b/Tests/CMakeLib/testRST.cxx
index a575d0d..e5a96c2 100644
--- a/Tests/CMakeLib/testRST.cxx
+++ b/Tests/CMakeLib/testRST.cxx
@@ -13,7 +13,7 @@
#include "cmSystemTools.h"
-void reportLine(std::ostream& os, bool ret, std::string line, bool eol)
+void reportLine(std::ostream& os, bool ret, std::string const& line, bool eol)
{
if (ret) {
os << "\"" << line << "\" (" << (eol ? "with EOL" : "without EOL") << ")";
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 2db5ded..f21e430 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -274,6 +274,9 @@ if(BUILD_TESTING)
endif()
if(TEST_RESOURCES)
ADD_TEST_MACRO(VSResource VSResource)
+ if (CMAKE_GENERATOR MATCHES "Ninja")
+ add_test_macro(VSResourceNinjaForceRSP VSResourceNinjaForceRSP)
+ endif ()
endif()
ADD_TEST_MACRO(MSManifest MSManifest)
ADD_TEST_MACRO(Simple Simple)
diff --git a/Tests/CPackComponentsDEB/CMakeLists.txt b/Tests/CPackComponentsDEB/CMakeLists.txt
index 093b23f..9d4b5e9 100644
--- a/Tests/CPackComponentsDEB/CMakeLists.txt
+++ b/Tests/CPackComponentsDEB/CMakeLists.txt
@@ -130,6 +130,8 @@ configure_file(${CPackComponentsDEB_SOURCE_DIR}/MyLibCPackConfig-${CPackDEBConfi
@ONLY)
set(CPACK_PROJECT_CONFIG_FILE ${CPackComponentsDEB_BINARY_DIR}/MyLibCPackConfig-${CPackDEBConfiguration}.cmake)
+# set CPACK_DEBIAN_FILE_NAME to use default package name format
+set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
# Include CPack to introduce the appropriate targets
include(CPack)
diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-depend1.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-depend1.cmake.in
index d207bcc..dc038fa 100644
--- a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-depend1.cmake.in
+++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-depend1.cmake.in
@@ -4,6 +4,7 @@
if(CPACK_GENERATOR MATCHES "DEB")
set(CPACK_DEB_COMPONENT_INSTALL "ON")
+ set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS "ON")
endif()
#
diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-depend2.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-depend2.cmake.in
index 803720a..1aa7d01 100644
--- a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-depend2.cmake.in
+++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-depend2.cmake.in
@@ -4,6 +4,7 @@
if(CPACK_GENERATOR MATCHES "DEB")
set(CPACK_DEB_COMPONENT_INSTALL "ON")
+ set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS "ON")
endif()
#
diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt
index 05c13a4..3440843 100644
--- a/Tests/CPackComponentsForAll/CMakeLists.txt
+++ b/Tests/CPackComponentsForAll/CMakeLists.txt
@@ -165,6 +165,9 @@ set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}"
"${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}" "other_relocatable"
"${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable")
+# set CPACK_DEBIAN_FILE_NAME to use default package name format
+set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
+
# 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/ExternalProjectUpdate/CMakeLists.txt b/Tests/ExternalProjectUpdate/CMakeLists.txt
index fbb3388..dbf26c8 100644
--- a/Tests/ExternalProjectUpdate/CMakeLists.txt
+++ b/Tests/ExternalProjectUpdate/CMakeLists.txt
@@ -21,6 +21,18 @@ set_property(DIRECTORY PROPERTY EP_BASE ${base})
set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test)
set_property(DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS update)
+ExternalProject_Add(TestUpdateCommand
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
+ UPDATE_COMMAND ${CMAKE_COMMAND} -E echo update
+ UPDATE_DISCONNECTED 1
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ INDEPENDENT_STEP_TARGETS update
+ )
+add_custom_target(TestUpdateCommandDriver ALL)
+add_dependencies(TestUpdateCommandDriver TestUpdateCommand-update)
+
set(do_git_tests 0)
if(GIT_EXECUTABLE)
diff --git a/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt b/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt
index ffdb582..82a014b 100644
--- a/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt
+++ b/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt
@@ -1,7 +1,12 @@
cmake_minimum_required(VERSION 3.5)
project(demo C)
-add_library(libdemo test.c subfolder/test.c)
+add_library(libdemo
+ test.c
+ subfolder_test.c
+ subfolder_test_0.c
+ "subfolder/test.c"
+)
add_executable(demo main.c)
target_link_libraries(demo libdemo)
diff --git a/Tests/GhsMultiDuplicateSourceFilenames/main.c b/Tests/GhsMultiDuplicateSourceFilenames/main.c
index 301a32e..d5b7914 100644
--- a/Tests/GhsMultiDuplicateSourceFilenames/main.c
+++ b/Tests/GhsMultiDuplicateSourceFilenames/main.c
@@ -1,9 +1,13 @@
int test_a(void);
int test_b(void);
+int test_c(void);
+int test_d(void);
int main(int argc, char* argv[])
{
test_a();
test_b();
+ test_c();
+ test_d();
return 0;
}
diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c
new file mode 100644
index 0000000..c552e6a
--- /dev/null
+++ b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c
@@ -0,0 +1,5 @@
+
+int test_c()
+{
+ return 1;
+}
diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c
new file mode 100644
index 0000000..170b33d
--- /dev/null
+++ b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c
@@ -0,0 +1,5 @@
+
+int test_d()
+{
+ return 1;
+}
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index 9ee1957..523c4f7 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -63,6 +63,7 @@ else()
PROPERTIES COMPILE_FLAGS "-ITarProp")
endif()
+add_subdirectory(StandardIncludeDirectories)
add_subdirectory(TargetIncludeDirectories)
set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}")
diff --git a/Tests/IncludeDirectories/StandardIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/StandardIncludeDirectories/CMakeLists.txt
new file mode 100644
index 0000000..dcbc566
--- /dev/null
+++ b/Tests/IncludeDirectories/StandardIncludeDirectories/CMakeLists.txt
@@ -0,0 +1,5 @@
+# Normally this variable should be set by a platform information module or
+# a toolchain file, but for purposes of this test we simply set it here.
+set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/StdDir)
+
+add_executable(StandardIncludeDirectories main.c)
diff --git a/Tests/IncludeDirectories/StandardIncludeDirectories/StdDir/StdIncDir.h b/Tests/IncludeDirectories/StandardIncludeDirectories/StdDir/StdIncDir.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/IncludeDirectories/StandardIncludeDirectories/StdDir/StdIncDir.h
diff --git a/Tests/IncludeDirectories/StandardIncludeDirectories/main.c b/Tests/IncludeDirectories/StandardIncludeDirectories/main.c
new file mode 100644
index 0000000..edfe9ce
--- /dev/null
+++ b/Tests/IncludeDirectories/StandardIncludeDirectories/main.c
@@ -0,0 +1,5 @@
+#include "StdIncDir.h"
+int main()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CPack/RPM_CUSTOM_NAMES.cmake b/Tests/RunCMake/CPack/CUSTOM_NAMES.cmake
index ba53a87..c89df89 100644
--- a/Tests/RunCMake/CPack/RPM_CUSTOM_NAMES.cmake
+++ b/Tests/RunCMake/CPack/CUSTOM_NAMES.cmake
@@ -1,9 +1,5 @@
set(CPACK_RPM_COMPONENT_INSTALL "ON")
-set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
-set(CPACK_RPM_PKG_2_PACKAGE_NAME "second")
-set(CPACK_RPM_PKG_3_FILE_NAME "pkg_3_abc.rpm")
-
install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1)
install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2)
install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3)
diff --git a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake
index 2720fe9..4b4ac8d 100644
--- a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake
+++ b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake
@@ -1,2 +1,3 @@
set(CPACK_PACKAGE_CONTACT "someone")
set(CPACK_DEB_COMPONENT_INSTALL "ON")
+set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
diff --git a/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-ExpectedFiles.cmake
new file mode 100644
index 0000000..2acf45b
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-ExpectedFiles.cmake
@@ -0,0 +1,9 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "3")
+set(EXPECTED_FILE_1 "custom_names-pkg_1_0.1.1-1_*.deb")
+set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
+set(EXPECTED_FILE_2 "second*.deb")
+set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
+set(EXPECTED_FILE_3 "pkg_3_abc.deb")
+set(EXPECTED_FILE_CONTENT_3 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-specifics.cmake b/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-specifics.cmake
new file mode 100644
index 0000000..c64f161
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-specifics.cmake
@@ -0,0 +1,6 @@
+set(CPACK_PACKAGE_CONTACT "someone")
+set(CPACK_DEB_COMPONENT_INSTALL "ON")
+
+set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
+set(CPACK_DEBIAN_PKG_2_PACKAGE_NAME "second")
+set(CPACK_DEBIAN_PKG_3_FILE_NAME "pkg_3_abc.deb")
diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake
index 5f929ff..85e137f 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake
@@ -1,17 +1,18 @@
set(foo_preinst "^echo default_preinst$")
-set(foo_preinst_permissions_regex "-rwxr-xr-x .*")
+# NOTE: optional dot at the end of permissions regex is for SELinux enabled systems
+set(foo_preinst_permissions_regex "-rwxr-xr-x\.? .*")
set(foo_prerm "^echo default_prerm$")
-set(foo_prerm_permissions_regex "-rwxr-xr-x .*")
+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_preinst_permissions_regex "-rwx------\.? .*")
set(bar_prerm "^echo bar_prerm$")
-set(bar_prerm_permissions_regex "-rwx------ .*")
+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_preinst_permissions_regex "-rwxr-xr-x\.? .*")
set(bas_prerm "^echo default_prerm$")
-set(bas_prerm_permissions_regex "-rwxr-xr-x .*")
+set(bas_prerm_permissions_regex "-rwxr-xr-x\.? .*")
verifyDebControl("${FOUND_FILE_3}" "bas" "preinst;prerm")
diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake
index 8ccb628..b1952ef 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake
@@ -1,3 +1,4 @@
set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$")
-set(shlibs_shlibs_permissions_regex "-rw-r--r-- .*")
+# optional dot at the end of permissions regex is for SELinux enabled systems
+set(shlibs_shlibs_permissions_regex "-rw-r--r--\.? .*")
verifyDebControl("${FOUND_FILE_1}" "shlibs" "shlibs")
diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake
index d04c641..422cfbe 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake
@@ -1,7 +1,8 @@
set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs_ldconfig \\(>\\= 0\\.1\\.1\\)\n$")
-set(shlibs_shlibs_permissions_regex "-rw-r--r-- .*")
+# NOTE: optional dot at the end of permissions regex is for SELinux enabled systems
+set(shlibs_shlibs_permissions_regex "-rw-r--r--\.? .*")
set(shlibs_postinst ".*ldconfig.*")
-set(shlibs_postinst_permissions_regex "-rwxr-xr-x .*")
+set(shlibs_postinst_permissions_regex "-rwxr-xr-x\.? .*")
set(shlibs_postrm ".*ldconfig.*")
-set(shlibs_postrm_permissions_regex "-rwxr-xr-x .*")
+set(shlibs_postrm_permissions_regex "-rwxr-xr-x\.? .*")
verifyDebControl("${FOUND_FILE_1}" "shlibs" "shlibs;postinst;postrm")
diff --git a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake
index c182e30..a6f08fe 100644
--- a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake
+++ b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake
@@ -1,14 +1,14 @@
set(whitespaces_ "[\t\n\r ]*")
set(EXPECTED_FILES_COUNT "5")
-set(EXPECTED_FILE_1 "dependencies-applications_0.1.1-1_*.deb")
+set(EXPECTED_FILE_1 "dependencies-0.1.1-*-applications.deb")
set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/test_prog$")
-set(EXPECTED_FILE_2 "dependencies-applications_auto_0.1.1-1_*.deb")
+set(EXPECTED_FILE_2 "dependencies-0.1.1-*-applications_auto.deb")
set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo_auto${whitespaces_}.*/usr/foo_auto/test_prog$")
-set(EXPECTED_FILE_3 "dependencies-headers_0.1.1-1_*.deb")
+set(EXPECTED_FILE_3 "dependencies-0.1.1-*-headers.deb")
set(EXPECTED_FILE_CONTENT_3 "^.*/usr/bar${whitespaces_}.*/usr/bar/CMakeLists.txt$")
-set(EXPECTED_FILE_4 "dependencies-libs_0.1.1-1_*.deb")
+set(EXPECTED_FILE_4 "dependencies-0.1.1-*-libs.deb")
# dynamic lib extension is .so on Linux and .dylib on Mac so we will use a wildcard .* for it
set(EXPECTED_FILE_CONTENT_4 "^.*/usr/bas${whitespaces_}.*/usr/bas/libtest_lib\\..*$")
-set(EXPECTED_FILE_5 "dependencies-libs_auto_0.1.1-1_*.deb")
+set(EXPECTED_FILE_5 "dependencies-0.1.1-*-libs_auto.deb")
set(EXPECTED_FILE_CONTENT_5 "^.*/usr/bas_auto${whitespaces_}.*/usr/bas_auto/libtest_lib\\..*$")
diff --git a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake
index 96a9f14..5f82cc6 100644
--- a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake
+++ b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake
@@ -1,5 +1,7 @@
set(CPACK_PACKAGE_CONTACT "someone")
set(CPACK_DEB_COMPONENT_INSTALL "ON")
+#intentionaly commented out to test old file naming
+#set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
# false by default
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS FALSE)
diff --git a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake
index 8821ab9..4e9a2e7 100644
--- a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake
+++ b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake
@@ -1 +1,2 @@
set(CPACK_PACKAGE_CONTACT "someone")
+set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake
index 8821ab9..4e9a2e7 100644
--- a/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake
+++ b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake
@@ -1 +1,2 @@
set(CPACK_PACKAGE_CONTACT "someone")
+set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
diff --git a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake
index a1da1a3..25bd2e7 100644
--- a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake
+++ b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake
@@ -1,5 +1,6 @@
set(CPACK_PACKAGE_CONTACT "someone")
set(CPACK_DEB_COMPONENT_INSTALL "ON")
+set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_PACKAGE_SECTION "default")
set(CPACK_DEBIAN_PKG_2_PACKAGE_NAME "second")
diff --git a/Tests/RunCMake/CPack/DEB_EXTRA.cmake b/Tests/RunCMake/CPack/DEB_EXTRA.cmake
index 3c291d5..189d123 100644
--- a/Tests/RunCMake/CPack/DEB_EXTRA.cmake
+++ b/Tests/RunCMake/CPack/DEB_EXTRA.cmake
@@ -34,5 +34,6 @@ set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA
set(CPACK_PACKAGE_NAME "deb_extra")
set(CPACK_PACKAGE_CONTACT "someone")
+set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEB_COMPONENT_INSTALL ON)
diff --git a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake b/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake
index efb0211..1aeb06f 100644
--- a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake
+++ b/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake
@@ -1,5 +1,6 @@
set(CPACK_PACKAGE_CONTACT "someone")
set(CPACK_DEB_COMPONENT_INSTALL "ON")
+set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON")
diff --git a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake b/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake
index 1f70386..f58c876 100644
--- a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake
+++ b/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake
@@ -1,5 +1,6 @@
set(CPACK_PACKAGE_CONTACT "someone")
set(CPACK_DEB_COMPONENT_INSTALL "ON")
+set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON")
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
diff --git a/Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-ExpectedFiles.cmake
index 780e57e..780e57e 100644
--- a/Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-ExpectedFiles.cmake
+++ b/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-ExpectedFiles.cmake
diff --git a/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-specifics.cmake b/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-specifics.cmake
new file mode 100644
index 0000000..575aa01
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-specifics.cmake
@@ -0,0 +1,5 @@
+set(CPACK_RPM_COMPONENT_INSTALL "ON")
+
+set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
+set(CPACK_RPM_PKG_2_PACKAGE_NAME "second")
+set(CPACK_RPM_PKG_3_FILE_NAME "pkg_3_abc.rpm")
diff --git a/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-stderr.txt b/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-stderr.txt
new file mode 100644
index 0000000..9bfba7e
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-stderr.txt
@@ -0,0 +1,3 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/custom_names-pkg_1.spec
+CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/second.spec
+CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/custom_names-pkg_3.spec$
diff --git a/Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-stderr.txt b/Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-stderr.txt
deleted file mode 100644
index d3ba7b0..0000000
--- a/Tests/RunCMake/CPack/RPM/RPM_CUSTOM_NAMES-stderr.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/RPM_CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/custom_names-pkg_1.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/RPM_CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/second.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/RPM_CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/custom_names-pkg_3.spec$
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 759295f..59c52f8 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -10,7 +10,7 @@ run_cpack_test(DEB_EXTRA "DEB" false)
run_cpack_test(DEPENDENCIES "RPM;DEB" true)
run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true)
run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true)
-run_cpack_test(RPM_CUSTOM_NAMES "RPM" true)
+run_cpack_test(CUSTOM_NAMES "RPM;DEB" true)
run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false)
run_cpack_test(RPM_DIST "RPM" false)
run_cpack_test(INSTALL_SCRIPTS "RPM" false)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 45175d8..625bab2 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -28,6 +28,7 @@ run_cmake(COMPILE_LANGUAGE-add_test)
run_cmake(COMPILE_LANGUAGE-unknown-lang)
run_cmake(TARGET_FILE-recursion)
run_cmake(OUTPUT_NAME-recursion)
+run_cmake(TARGET_PROPERTY-LOCATION)
run_cmake(ImportedTarget-TARGET_PDB_FILE)
if(LINKER_SUPPORTS_PDB)
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt
new file mode 100644
index 0000000..e4dbb71
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ Policy CMP0026 is not set: Disallow use of the LOCATION target property.
+ Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ The LOCATION property should not be read from target "foo". Use the target
+ name directly with add_custom_command, or use the generator expression
+ \$<TARGET_FILE>, as appropriate.
+
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake
new file mode 100644
index 0000000..8929cdb
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_library(foo empty.c)
+add_custom_target(drive COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:foo,LOCATION>)
diff --git a/Tests/RunCMake/Ninja/CheckNoPrefixSubDir.cmake b/Tests/RunCMake/Ninja/CheckNoPrefixSubDir.cmake
new file mode 100644
index 0000000..b845f2f
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CheckNoPrefixSubDir.cmake
@@ -0,0 +1,7 @@
+add_custom_target(check_no_prefix_sub_dir ALL
+ COMMAND "${CMAKE_COMMAND}"
+ "-DNINJA_OUTPUT_PATH_PREFIX=${CMAKE_NINJA_OUTPUT_PATH_PREFIX}"
+ "-DCUR_BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}"
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/CheckNoPrefixSubDirScript.cmake"
+ VERBATIM
+ )
diff --git a/Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake b/Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake
new file mode 100644
index 0000000..5a03fcb
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake
@@ -0,0 +1,8 @@
+# Check that the prefix sub-directory is not repeated.
+
+if(EXISTS "${CUR_BIN_DIR}/${NINJA_OUTPUT_PATH_PREFIX}")
+ message(FATAL_ERROR
+ "no sub directory named after the CMAKE_NINJA_OUTPUT_PATH_PREFIX "
+ "should be in the binary directory."
+ )
+endif()
diff --git a/Tests/RunCMake/Ninja/CheckOutput.cmake b/Tests/RunCMake/Ninja/CheckOutput.cmake
new file mode 100644
index 0000000..ddb35a7
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CheckOutput.cmake
@@ -0,0 +1,23 @@
+# Add rules to check the generated executable works.
+
+set(hello_output "${CMAKE_CURRENT_BINARY_DIR}/hello.output")
+add_custom_command(
+ OUTPUT "${hello_output}"
+ COMMAND "$<TARGET_FILE:hello>" > "${hello_output}"
+ DEPENDS hello
+ VERBATIM
+ )
+
+if(NOT DEFINED HELLO_OUTPUT_STRING)
+ set(HELLO_OUTPUT_STRING "Hello world!\n")
+endif()
+
+set(hello_output_ref "${CMAKE_CURRENT_BINARY_DIR}/hello.output.ref")
+file(WRITE "${hello_output_ref}" "${HELLO_OUTPUT_STRING}")
+
+add_custom_target(check_output ALL
+ COMMAND "${CMAKE_COMMAND}" -E compare_files
+ "${hello_output}" "${hello_output_ref}"
+ DEPENDS "${hello_output}" "${hello_output_ref}"
+ VERBATIM
+ )
diff --git a/Tests/RunCMake/Ninja/CustomCommandWorkingDirectory.cmake b/Tests/RunCMake/Ninja/CustomCommandWorkingDirectory.cmake
new file mode 100644
index 0000000..8e01c8c
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CustomCommandWorkingDirectory.cmake
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello NONE)
+
+add_custom_command(
+ OUTPUT hello.copy.c
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/hello.c"
+ hello.copy.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ )
+add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/hello.copy.c")
+
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/Executable.cmake b/Tests/RunCMake/Ninja/Executable.cmake
new file mode 100644
index 0000000..4e17d68
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Executable.cmake
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello C)
+add_executable(hello hello.c)
+include(CheckOutput.cmake)
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 4e06888..c73f852 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -1,5 +1,20 @@
include(RunCMake)
+# Detect ninja version so we know what tests can be supported.
+execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}" --version
+ OUTPUT_VARIABLE ninja_out
+ ERROR_VARIABLE ninja_out
+ RESULT_VARIABLE ninja_res
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+if(ninja_res EQUAL 0 AND "x${ninja_out}" MATCHES "^x[0-9]+\\.[0-9]+")
+ set(ninja_version "${ninja_out}")
+ message(STATUS "ninja version: ${ninja_version}")
+else()
+ message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}")
+endif()
+
function(run_CMP0058 case)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build)
@@ -32,3 +47,153 @@ function(run_SubDir)
run_cmake_command(SubDir-build ${CMAKE_COMMAND} --build . --target ${SubDir_all})
endfunction()
run_SubDir()
+
+function(run_ninja dir)
+ execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}"
+ WORKING_DIRECTORY "${dir}"
+ OUTPUT_VARIABLE ninja_stdout
+ ERROR_VARIABLE ninja_stderr
+ RESULT_VARIABLE ninja_result
+ )
+ if(NOT ninja_result EQUAL 0)
+ message(STATUS "
+============ beginning of ninja's stdout ============
+${ninja_stdout}
+=============== end of ninja's stdout ===============
+")
+ message(STATUS "
+============ beginning of ninja's stderr ============
+${ninja_stderr}
+=============== end of ninja's stderr ===============
+")
+ message(FATAL_ERROR
+ "top ninja build failed exited with status ${ninja_result}")
+ endif()
+endfunction(run_ninja)
+
+function(sleep delay)
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E sleep ${delay}
+ RESULT_VARIABLE result
+ )
+ if(NOT result EQUAL 0)
+ message(FATAL_ERROR "failed to sleep for ${delay} second.")
+ endif()
+endfunction(sleep)
+
+function(touch path)
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E touch ${path}
+ RESULT_VARIABLE result
+ )
+ if(NOT result EQUAL 0)
+ message(FATAL_ERROR "failed to touch main ${path} file.")
+ endif()
+endfunction(touch)
+
+macro(ninja_escape_path path out)
+ string(REPLACE "\$ " "\$\$" "${out}" "${path}")
+ string(REPLACE " " "\$ " "${out}" "${${out}}")
+ string(REPLACE ":" "\$:" "${out}" "${${out}}")
+endmacro(ninja_escape_path)
+
+macro(shell_escape string out)
+ string(REPLACE "\"" "\\\"" "${out}" "${string}")
+endmacro(shell_escape)
+
+function(run_sub_cmake test ninja_output_path_prefix)
+ set(top_build_dir "${RunCMake_BINARY_DIR}/${test}-build/")
+ file(REMOVE_RECURSE "${top_build_dir}")
+ file(MAKE_DIRECTORY "${top_build_dir}")
+
+ ninja_escape_path("${ninja_output_path_prefix}"
+ escaped_ninja_output_path_prefix)
+
+ # Generate top build ninja file.
+ set(top_build_ninja "${top_build_dir}/build.ninja")
+ shell_escape("${top_build_ninja}" escaped_top_build_ninja)
+ set(build_ninja_dep "${top_build_dir}/build_ninja_dep")
+ ninja_escape_path("${build_ninja_dep}" escaped_build_ninja_dep)
+ shell_escape("${CMAKE_COMMAND}" escaped_CMAKE_COMMAND)
+ file(WRITE "${build_ninja_dep}" "fake dependency of top build.ninja file\n")
+ if(WIN32)
+ set(cmd_prefix "cmd.exe /C \"")
+ set(cmd_suffix "\"")
+ else()
+ set(cmd_prefix "")
+ set(cmd_suffix "")
+ endif()
+ file(WRITE "${top_build_ninja}" "\
+subninja ${escaped_ninja_output_path_prefix}/build.ninja
+default ${escaped_ninja_output_path_prefix}/all
+
+# Sleep for 1 second before to regenerate to make sure the timestamp of
+# the top build.ninja will be strictly greater than the timestamp of the
+# sub/build.ninja file. We assume the system as 1 sec timestamp resolution.
+rule RERUN
+ command = ${cmd_prefix}\"${escaped_CMAKE_COMMAND}\" -E sleep 1 && \"${escaped_CMAKE_COMMAND}\" -E touch \"${escaped_top_build_ninja}\"${cmd_suffix}
+ description = Testing regeneration
+ generator = 1
+
+build build.ninja: RERUN ${escaped_build_ninja_dep} || ${escaped_ninja_output_path_prefix}/build.ninja
+ pool = console
+")
+
+ # Run sub cmake project.
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_OUTPUT_PATH_PREFIX=${ninja_output_path_prefix}")
+ set(RunCMake_TEST_BINARY_DIR "${top_build_dir}/${ninja_output_path_prefix}")
+ run_cmake(${test})
+
+ # Check there is no 'default' statement in Ninja file generated by CMake.
+ set(sub_build_ninja "${RunCMake_TEST_BINARY_DIR}/build.ninja")
+ file(READ "${sub_build_ninja}" sub_build_ninja_file)
+ if(sub_build_ninja_file MATCHES "\ndefault [^\n][^\n]*all\n")
+ message(FATAL_ERROR
+ "unexpected 'default' statement found in '${sub_build_ninja}'")
+ endif()
+
+ # Run ninja from the top build directory.
+ run_ninja("${top_build_dir}")
+
+ # Test regeneration rules run in order.
+ set(main_cmakelists "${RunCMake_SOURCE_DIR}/CMakeLists.txt")
+ sleep(1) # Assume the system as 1 sec timestamp resolution.
+ touch("${main_cmakelists}")
+ touch("${build_ninja_dep}")
+ run_ninja("${top_build_dir}")
+ file(TIMESTAMP "${main_cmakelists}" mtime_main_cmakelists UTC)
+ file(TIMESTAMP "${sub_build_ninja}" mtime_sub_build_ninja UTC)
+ file(TIMESTAMP "${top_build_ninja}" mtime_top_build_ninja UTC)
+
+ # Check sub build.ninja is regenerated.
+ if(mtime_main_cmakelists STRGREATER mtime_sub_build_ninja)
+ message(FATAL_ERROR
+ "sub build.ninja not regenerated:
+ CMakeLists.txt = ${mtime_main_cmakelists}
+ sub/build.ninja = ${mtime_sub_build_ninja}")
+ endif()
+
+ # Check top build.ninja is regenerated after sub build.ninja.
+ if(NOT mtime_top_build_ninja STRGREATER mtime_sub_build_ninja)
+ message(FATAL_ERROR
+ "top build.ninja not regenerated strictly after sub build.ninja:
+ sub/build.ninja = ${mtime_sub_build_ninja}
+ build.ninja = ${mtime_top_build_ninja}")
+ endif()
+
+endfunction(run_sub_cmake)
+
+if("${ninja_version}" VERSION_LESS 1.6)
+ message(WARNING "Ninja is too old; skipping rest of test.")
+ return()
+endif()
+
+foreach(ninja_output_path_prefix "sub space" "sub")
+ run_sub_cmake(Executable "${ninja_output_path_prefix}")
+ run_sub_cmake(StaticLib "${ninja_output_path_prefix}")
+ run_sub_cmake(SharedLib "${ninja_output_path_prefix}")
+ run_sub_cmake(TwoLibs "${ninja_output_path_prefix}")
+ run_sub_cmake(SubDirPrefix "${ninja_output_path_prefix}")
+ run_sub_cmake(CustomCommandWorkingDirectory "${ninja_output_path_prefix}")
+endforeach(ninja_output_path_prefix)
diff --git a/Tests/RunCMake/Ninja/SharedLib.cmake b/Tests/RunCMake/Ninja/SharedLib.cmake
new file mode 100644
index 0000000..1a78390
--- /dev/null
+++ b/Tests/RunCMake/Ninja/SharedLib.cmake
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello C)
+add_library(greeting SHARED greeting.c)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_executable(hello hello_with_greeting.c)
+target_link_libraries(hello greeting)
+include(CheckOutput.cmake)
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/StaticLib.cmake b/Tests/RunCMake/Ninja/StaticLib.cmake
new file mode 100644
index 0000000..0f815ae
--- /dev/null
+++ b/Tests/RunCMake/Ninja/StaticLib.cmake
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello C)
+add_definitions(-DGREETING_STATIC)
+add_library(greeting STATIC greeting.c)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_executable(hello hello_with_greeting.c)
+target_link_libraries(hello greeting)
+include(CheckOutput.cmake)
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/SubDirPrefix.cmake b/Tests/RunCMake/Ninja/SubDirPrefix.cmake
new file mode 100644
index 0000000..30ad1e6
--- /dev/null
+++ b/Tests/RunCMake/Ninja/SubDirPrefix.cmake
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello C)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
+add_subdirectory(SubDirPrefix)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_executable(hello hello_sub_greeting.c)
+target_link_libraries(hello greeting)
+include(CheckOutput.cmake)
diff --git a/Tests/RunCMake/Ninja/SubDirPrefix/CMakeLists.txt b/Tests/RunCMake/Ninja/SubDirPrefix/CMakeLists.txt
new file mode 100644
index 0000000..575597d
--- /dev/null
+++ b/Tests/RunCMake/Ninja/SubDirPrefix/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(greeting SHARED greeting.c)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/Tests/RunCMake/Ninja/SubDirPrefix/greeting.c b/Tests/RunCMake/Ninja/SubDirPrefix/greeting.c
new file mode 100644
index 0000000..ba3e55b
--- /dev/null
+++ b/Tests/RunCMake/Ninja/SubDirPrefix/greeting.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#if defined(_WIN32) && !defined(GREETING_STATIC)
+__declspec(dllexport)
+#endif
+ void greeting(void)
+{
+ printf("Hello world!\n");
+}
diff --git a/Tests/RunCMake/Ninja/SubDirPrefix/greeting.h b/Tests/RunCMake/Ninja/SubDirPrefix/greeting.h
new file mode 100644
index 0000000..ee4053e
--- /dev/null
+++ b/Tests/RunCMake/Ninja/SubDirPrefix/greeting.h
@@ -0,0 +1,4 @@
+#if defined(_WIN32) && !defined(GREETING_STATIC)
+__declspec(dllimport)
+#endif
+ void greeting(void);
diff --git a/Tests/RunCMake/Ninja/TwoLibs.cmake b/Tests/RunCMake/Ninja/TwoLibs.cmake
new file mode 100644
index 0000000..666452f
--- /dev/null
+++ b/Tests/RunCMake/Ninja/TwoLibs.cmake
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.5)
+project(hello C)
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib-static")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
+
+add_library(greeting SHARED greeting.c)
+add_library(greeting2 STATIC greeting2.c)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_executable(hello hello_with_two_greetings.c)
+target_link_libraries(hello greeting greeting2)
+
+set(HELLO_OUTPUT_STRING "Hello world!\nHello world 2!\n")
+include(CheckOutput.cmake)
+
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/greeting.c b/Tests/RunCMake/Ninja/greeting.c
new file mode 100644
index 0000000..ba3e55b
--- /dev/null
+++ b/Tests/RunCMake/Ninja/greeting.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#if defined(_WIN32) && !defined(GREETING_STATIC)
+__declspec(dllexport)
+#endif
+ void greeting(void)
+{
+ printf("Hello world!\n");
+}
diff --git a/Tests/RunCMake/Ninja/greeting.h b/Tests/RunCMake/Ninja/greeting.h
new file mode 100644
index 0000000..ee4053e
--- /dev/null
+++ b/Tests/RunCMake/Ninja/greeting.h
@@ -0,0 +1,4 @@
+#if defined(_WIN32) && !defined(GREETING_STATIC)
+__declspec(dllimport)
+#endif
+ void greeting(void);
diff --git a/Tests/RunCMake/Ninja/greeting2.c b/Tests/RunCMake/Ninja/greeting2.c
new file mode 100644
index 0000000..c6ed87d
--- /dev/null
+++ b/Tests/RunCMake/Ninja/greeting2.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void greeting2(void)
+{
+ printf("Hello world 2!\n");
+}
diff --git a/Tests/RunCMake/Ninja/greeting2.h b/Tests/RunCMake/Ninja/greeting2.h
new file mode 100644
index 0000000..c4d8f9b
--- /dev/null
+++ b/Tests/RunCMake/Ninja/greeting2.h
@@ -0,0 +1 @@
+void greeting2(void);
diff --git a/Tests/RunCMake/Ninja/hello.c b/Tests/RunCMake/Ninja/hello.c
new file mode 100644
index 0000000..aac8b4e
--- /dev/null
+++ b/Tests/RunCMake/Ninja/hello.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(void)
+{
+ printf("Hello world!\n");
+ return 0;
+}
diff --git a/Tests/RunCMake/Ninja/hello_sub_greeting.c b/Tests/RunCMake/Ninja/hello_sub_greeting.c
new file mode 100644
index 0000000..fc4bd60
--- /dev/null
+++ b/Tests/RunCMake/Ninja/hello_sub_greeting.c
@@ -0,0 +1,7 @@
+#include <SubDirPrefix/greeting.h>
+
+int main(void)
+{
+ greeting();
+ return 0;
+}
diff --git a/Tests/RunCMake/Ninja/hello_with_greeting.c b/Tests/RunCMake/Ninja/hello_with_greeting.c
new file mode 100644
index 0000000..dbf90e3
--- /dev/null
+++ b/Tests/RunCMake/Ninja/hello_with_greeting.c
@@ -0,0 +1,7 @@
+#include <greeting.h>
+
+int main(void)
+{
+ greeting();
+ return 0;
+}
diff --git a/Tests/RunCMake/Ninja/hello_with_two_greetings.c b/Tests/RunCMake/Ninja/hello_with_two_greetings.c
new file mode 100644
index 0000000..cbbdaad
--- /dev/null
+++ b/Tests/RunCMake/Ninja/hello_with_two_greetings.c
@@ -0,0 +1,9 @@
+#include <greeting.h>
+#include <greeting2.h>
+
+int main(void)
+{
+ greeting();
+ greeting2();
+ return 0;
+}
diff --git a/Tests/RunCMake/file/GLOB.cmake b/Tests/RunCMake/file/GLOB.cmake
index 3d577e3..c524e42 100644
--- a/Tests/RunCMake/file/GLOB.cmake
+++ b/Tests/RunCMake/file/GLOB.cmake
@@ -12,17 +12,14 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir fi
file(GLOB CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake
index a8c6784..fb8be42 100644
--- a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake
+++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake
@@ -7,17 +7,14 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINA
file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
diff --git a/Tests/RunCMake/file/GLOB_RECURSE.cmake b/Tests/RunCMake/file/GLOB_RECURSE.cmake
index 6db377b..530930f 100644
--- a/Tests/RunCMake/file/GLOB_RECURSE.cmake
+++ b/Tests/RunCMake/file/GLOB_RECURSE.cmake
@@ -12,17 +12,14 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir fi
file(GLOB_RECURSE CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*")
list(LENGTH CONTENT_LIST CONTENT_COUNT)
message("content: ${CONTENT_COUNT} ")
-list(SORT CONTENT_LIST)
message("${CONTENT_LIST}")
diff --git a/Tests/RunCMake/try_compile/CompileFlags.cmake b/Tests/RunCMake/try_compile/CompileFlags.cmake
deleted file mode 100644
index d4dc074..0000000
--- a/Tests/RunCMake/try_compile/CompileFlags.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-enable_language(C)
-set(CMAKE_C_FLAGS_RELEASE "-DPP_ERROR ${CMAKE_C_FLAGS_DEBUG}")
-
-#-----------------------------------------------------------------------------
-set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/src.c
- OUTPUT_VARIABLE out
- )
-string(REPLACE "\n" "\n " out " ${out}")
-if(RESULT)
- message(FATAL_ERROR "try_compile passed but should have failed:\n${out}")
-elseif(NOT "x${out}" MATCHES "PP_ERROR is defined")
- message(FATAL_ERROR "try_compile did not fail with PP_ERROR:\n${out}")
-else()
- message(STATUS "try_compile with per-config flag worked as expected")
-endif()
diff --git a/Tests/RunCMake/try_compile/PlatformVariables.cmake b/Tests/RunCMake/try_compile/PlatformVariables.cmake
new file mode 100644
index 0000000..54da645
--- /dev/null
+++ b/Tests/RunCMake/try_compile/PlatformVariables.cmake
@@ -0,0 +1,23 @@
+enable_language(C)
+
+# Normally this variable should be set by a platform information module or
+# a toolchain file, but for purposes of this test we simply set it here.
+set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES MY_CUSTOM_VARIABLE)
+
+set(MY_CUSTOM_VARIABLE SOME_VALUE)
+
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ OUTPUT_VARIABLE out
+ )
+if(NOT result)
+ message(FATAL_ERROR "try_compile failed:\n${out}")
+endif()
+
+# Check that the cache was populated with our custom variable.
+file(STRINGS ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CMakeCache.txt entries
+ REGEX MY_CUSTOM_VARIABLE:UNINITIALIZED=${MY_CUSTOM_VARIABLE}
+ )
+if(NOT entries)
+ message(FATAL_ERROR "try_compile did not populate cache as expected")
+endif()
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 4b1d92a..4f30f1d 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -16,12 +16,15 @@ run_cmake(BadSources2)
run_cmake(NonSourceCopyFile)
run_cmake(NonSourceCompileDefinitions)
+set(RunCMake_TEST_OPTIONS --debug-trycompile)
+run_cmake(PlatformVariables)
+unset(RunCMake_TEST_OPTIONS)
+
run_cmake(TargetTypeExe)
run_cmake(TargetTypeInvalid)
run_cmake(TargetTypeStatic)
run_cmake(CMP0056)
-run_cmake(CompileFlags)
if(RunCMake_GENERATOR MATCHES "Make|Ninja")
# Use a single build tree for a few tests without cleaning.
diff --git a/Tests/RunCMake/try_compile/src.c b/Tests/RunCMake/try_compile/src.c
index 5e51382..8488f4e 100644
--- a/Tests/RunCMake/try_compile/src.c
+++ b/Tests/RunCMake/try_compile/src.c
@@ -2,6 +2,3 @@ int main(void)
{
return 0;
}
-#ifdef PP_ERROR
-#error PP_ERROR is defined
-#endif
diff --git a/Tests/VSResourceNinjaForceRSP/CMakeLists.txt b/Tests/VSResourceNinjaForceRSP/CMakeLists.txt
new file mode 100644
index 0000000..29ba0ce
--- /dev/null
+++ b/Tests/VSResourceNinjaForceRSP/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(VSResourceNinjaForceRSP)
+
+set(CMAKE_NINJA_FORCE_RESPONSE_FILE TRUE)
+
+add_library(ResourceLib lib.cpp test.rc)
+add_executable(VSResourceNinjaForceRSP main.cpp test.rc)
diff --git a/Tests/VSResourceNinjaForceRSP/lib.cpp b/Tests/VSResourceNinjaForceRSP/lib.cpp
new file mode 100644
index 0000000..c912397
--- /dev/null
+++ b/Tests/VSResourceNinjaForceRSP/lib.cpp
@@ -0,0 +1,4 @@
+int lib()
+{
+ return 0;
+}
diff --git a/Tests/VSResourceNinjaForceRSP/main.cpp b/Tests/VSResourceNinjaForceRSP/main.cpp
new file mode 100644
index 0000000..247411d
--- /dev/null
+++ b/Tests/VSResourceNinjaForceRSP/main.cpp
@@ -0,0 +1,6 @@
+int main(int argc, char** argv)
+{
+ (void)argc;
+ (void)argv;
+ return 0;
+}
diff --git a/Tests/VSResourceNinjaForceRSP/test.rc b/Tests/VSResourceNinjaForceRSP/test.rc
new file mode 100644
index 0000000..1ffade6
--- /dev/null
+++ b/Tests/VSResourceNinjaForceRSP/test.rc
@@ -0,0 +1,4 @@
+STRINGTABLE
+BEGIN
+ 1234 "5"
+END
diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake
index f5e325e..04a0cac 100644
--- a/Utilities/Release/upload_release.cmake
+++ b/Utilities/Release/upload_release.cmake
@@ -1,6 +1,6 @@
set(CTEST_RUN_CURRENT_SCRIPT 0)
if(NOT VERSION)
- set(VERSION 3.5)
+ set(VERSION 3.6)
endif()
if(NOT DEFINED PROJECT_PREFIX)
set(PROJECT_PREFIX cmake-${VERSION})
diff --git a/Utilities/cmexpat/lib/expat.h b/Utilities/cmexpat/lib/expat.h
index ec62f14..5abcefd 100644
--- a/Utilities/cmexpat/lib/expat.h
+++ b/Utilities/cmexpat/lib/expat.h
@@ -973,9 +973,12 @@ XML_FreeContentModel(XML_Parser parser, XML_Content *model);
/* Exposing the memory handling functions used in Expat */
XMLPARSEAPI(void *)
+XML_ATTR_MALLOC
+XML_ATTR_ALLOC_SIZE(2)
XML_MemMalloc(XML_Parser parser, size_t size);
XMLPARSEAPI(void *)
+XML_ATTR_ALLOC_SIZE(3)
XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
XMLPARSEAPI(void)
diff --git a/Utilities/cmexpat/lib/expat_external.h b/Utilities/cmexpat/lib/expat_external.h
index b2be17b..07a3c5c 100644
--- a/Utilities/cmexpat/lib/expat_external.h
+++ b/Utilities/cmexpat/lib/expat_external.h
@@ -67,12 +67,26 @@
#endif
#endif /* not defined XML_STATIC */
+#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)
+#define XMLIMPORT __attribute__ ((visibility ("default")))
+#endif
/* If we didn't define it above, define it away: */
#ifndef XMLIMPORT
#define XMLIMPORT
#endif
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
+#define XML_ATTR_MALLOC __attribute__((__malloc__))
+#else
+#define XML_ATTR_MALLOC
+#endif
+
+#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+#define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
+#else
+#define XML_ATTR_ALLOC_SIZE(x)
+#endif
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
diff --git a/Utilities/cmexpat/lib/internal.h b/Utilities/cmexpat/lib/internal.h
index dd54548..94cb98e 100644
--- a/Utilities/cmexpat/lib/internal.h
+++ b/Utilities/cmexpat/lib/internal.h
@@ -71,3 +71,25 @@
#define inline
#endif
#endif
+
+#ifndef UNUSED_P
+# ifdef __GNUC__
+# define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__))
+# else
+# define UNUSED_P(p) UNUSED_ ## p
+# endif
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void
+align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef);
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/Utilities/cmexpat/lib/xmlparse.c b/Utilities/cmexpat/lib/xmlparse.c
index c0e8f6e..b56b66a 100644
--- a/Utilities/cmexpat/lib/xmlparse.c
+++ b/Utilities/cmexpat/lib/xmlparse.c
@@ -1730,7 +1730,8 @@ XML_GetBuffer(XML_Parser parser, int len)
#ifdef XML_CONTEXT_BYTES
int keep;
#endif /* defined XML_CONTEXT_BYTES */
- int neededSize = len + (int)(bufferEnd - bufferPtr);
+ /* Do not invoke signed arithmetic overflow: */
+ int neededSize = (int) ((unsigned)len + (unsigned)(bufferEnd - bufferPtr));
if (neededSize < 0) {
errorCode = XML_ERROR_NO_MEMORY;
return NULL;
@@ -1761,7 +1762,8 @@ XML_GetBuffer(XML_Parser parser, int len)
if (bufferSize == 0)
bufferSize = INIT_BUFFER_SIZE;
do {
- bufferSize *= 2;
+ /* Do not invoke signed arithmetic overflow: */
+ bufferSize = (int) (2U * (unsigned) bufferSize);
} while (bufferSize < neededSize && bufferSize > 0);
if (bufferSize <= 0) {
errorCode = XML_ERROR_NO_MEMORY;
@@ -2462,11 +2464,11 @@ doContent(XML_Parser parser,
for (;;) {
int bufSize;
int convLen;
- XmlConvert(enc,
+ const enum XML_Convert_Result convert_res = XmlConvert(enc,
&fromPtr, rawNameEnd,
(ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);
convLen = (int)(toPtr - (XML_Char *)tag->buf);
- if (fromPtr == rawNameEnd) {
+ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) {
tag->name.strLen = convLen;
break;
}
@@ -2687,11 +2689,11 @@ doContent(XML_Parser parser,
if (MUST_CONVERT(enc, s)) {
for (;;) {
ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
+ const enum XML_Convert_Result convert_res = XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = s;
charDataHandler(handlerArg, dataBuf,
(int)(dataPtr - (ICHAR *)dataBuf));
- if (s == next)
+ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE))
break;
*eventPP = s;
}
@@ -3297,11 +3299,11 @@ doCdataSection(XML_Parser parser,
if (MUST_CONVERT(enc, s)) {
for (;;) {
ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
+ const enum XML_Convert_Result convert_res = XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = next;
charDataHandler(handlerArg, dataBuf,
(int)(dataPtr - (ICHAR *)dataBuf));
- if (s == next)
+ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE))
break;
*eventPP = s;
}
@@ -4960,9 +4962,9 @@ internalEntityProcessor(XML_Parser parser,
static enum XML_Error PTRCALL
errorProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
+ const char *UNUSED_P(s),
+ const char *UNUSED_P(end),
+ const char **UNUSED_P(nextPtr))
{
return errorCode;
}
@@ -5378,6 +5380,7 @@ reportDefault(XML_Parser parser, const ENCODING *enc,
const char *s, const char *end)
{
if (MUST_CONVERT(enc, s)) {
+ enum XML_Convert_Result convert_res;
const char **eventPP;
const char **eventEndPP;
if (enc == encoding) {
@@ -5390,11 +5393,11 @@ reportDefault(XML_Parser parser, const ENCODING *enc,
}
do {
ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
+ convert_res = XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = s;
defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf));
*eventPP = s;
- } while (s != end);
+ } while ((convert_res != XML_CONVERT_COMPLETED) && (convert_res != XML_CONVERT_INPUT_INCOMPLETE));
}
else
defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s));
@@ -6199,8 +6202,8 @@ poolAppend(STRING_POOL *pool, const ENCODING *enc,
if (!pool->ptr && !poolGrow(pool))
return NULL;
for (;;) {
- XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
- if (ptr == end)
+ const enum XML_Convert_Result convert_res = XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
+ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE))
break;
if (!poolGrow(pool))
return NULL;
@@ -6284,8 +6287,13 @@ poolGrow(STRING_POOL *pool)
}
}
if (pool->blocks && pool->start == pool->blocks->s) {
- int blockSize = (int)(pool->end - pool->start)*2;
- BLOCK *temp = (BLOCK *)
+ BLOCK *temp;
+ int blockSize = (int)((unsigned)(pool->end - pool->start)*2U);
+
+ if (blockSize < 0)
+ return XML_FALSE;
+
+ temp = (BLOCK *)
pool->mem->realloc_fcn(pool->blocks,
(offsetof(BLOCK, s)
+ blockSize * sizeof(XML_Char)));
@@ -6300,6 +6308,10 @@ poolGrow(STRING_POOL *pool)
else {
BLOCK *tem;
int blockSize = (int)(pool->end - pool->start);
+
+ if (blockSize < 0)
+ return XML_FALSE;
+
if (blockSize < INIT_BLOCK_SIZE)
blockSize = INIT_BLOCK_SIZE;
else
diff --git a/Utilities/cmexpat/lib/xmlrole.c b/Utilities/cmexpat/lib/xmlrole.c
index f6e66ab..4e79ffd 100644
--- a/Utilities/cmexpat/lib/xmlrole.c
+++ b/Utilities/cmexpat/lib/xmlrole.c
@@ -195,9 +195,9 @@ prolog1(PROLOG_STATE *state,
static int PTRCALL
prolog2(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -216,9 +216,9 @@ prolog2(PROLOG_STATE *state,
static int PTRCALL
doctype0(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -264,9 +264,9 @@ doctype1(PROLOG_STATE *state,
static int PTRCALL
doctype2(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -281,9 +281,9 @@ doctype2(PROLOG_STATE *state,
static int PTRCALL
doctype3(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -298,9 +298,9 @@ doctype3(PROLOG_STATE *state,
static int PTRCALL
doctype4(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -318,9 +318,9 @@ doctype4(PROLOG_STATE *state,
static int PTRCALL
doctype5(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -437,9 +437,9 @@ externalSubset1(PROLOG_STATE *state,
static int PTRCALL
entity0(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -457,9 +457,9 @@ entity0(PROLOG_STATE *state,
static int PTRCALL
entity1(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -502,9 +502,9 @@ entity2(PROLOG_STATE *state,
static int PTRCALL
entity3(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -519,9 +519,9 @@ entity3(PROLOG_STATE *state,
static int PTRCALL
entity4(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -559,9 +559,9 @@ entity5(PROLOG_STATE *state,
static int PTRCALL
entity6(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -605,9 +605,9 @@ entity7(PROLOG_STATE *state,
static int PTRCALL
entity8(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -622,9 +622,9 @@ entity8(PROLOG_STATE *state,
static int PTRCALL
entity9(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -639,9 +639,9 @@ entity9(PROLOG_STATE *state,
static int PTRCALL
entity10(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -656,9 +656,9 @@ entity10(PROLOG_STATE *state,
static int PTRCALL
notation0(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -697,9 +697,9 @@ notation1(PROLOG_STATE *state,
static int PTRCALL
notation2(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -714,9 +714,9 @@ notation2(PROLOG_STATE *state,
static int PTRCALL
notation3(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -732,9 +732,9 @@ notation3(PROLOG_STATE *state,
static int PTRCALL
notation4(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -753,9 +753,9 @@ notation4(PROLOG_STATE *state,
static int PTRCALL
attlist0(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -771,9 +771,9 @@ attlist0(PROLOG_STATE *state,
static int PTRCALL
attlist1(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -833,9 +833,9 @@ attlist2(PROLOG_STATE *state,
static int PTRCALL
attlist3(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -852,9 +852,9 @@ attlist3(PROLOG_STATE *state,
static int PTRCALL
attlist4(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -872,9 +872,9 @@ attlist4(PROLOG_STATE *state,
static int PTRCALL
attlist5(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -889,9 +889,9 @@ attlist5(PROLOG_STATE *state,
static int PTRCALL
attlist6(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -906,9 +906,9 @@ attlist6(PROLOG_STATE *state,
static int PTRCALL
attlist7(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -967,9 +967,9 @@ attlist8(PROLOG_STATE *state,
static int PTRCALL
attlist9(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -984,9 +984,9 @@ attlist9(PROLOG_STATE *state,
static int PTRCALL
element0(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1072,9 +1072,9 @@ element2(PROLOG_STATE *state,
static int PTRCALL
element3(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1097,9 +1097,9 @@ element3(PROLOG_STATE *state,
static int PTRCALL
element4(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1115,9 +1115,9 @@ element4(PROLOG_STATE *state,
static int PTRCALL
element5(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1136,9 +1136,9 @@ element5(PROLOG_STATE *state,
static int PTRCALL
element6(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1166,9 +1166,9 @@ element6(PROLOG_STATE *state,
static int PTRCALL
element7(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1240,9 +1240,9 @@ condSect0(PROLOG_STATE *state,
static int PTRCALL
condSect1(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1258,9 +1258,9 @@ condSect1(PROLOG_STATE *state,
static int PTRCALL
condSect2(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1277,9 +1277,9 @@ condSect2(PROLOG_STATE *state,
static int PTRCALL
declClose(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1292,11 +1292,11 @@ declClose(PROLOG_STATE *state,
}
static int PTRCALL
-error(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+error(PROLOG_STATE *UNUSED_P(state),
+ int UNUSED_P(tok),
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
return XML_ROLE_NONE;
}
diff --git a/Utilities/cmexpat/lib/xmltok.c b/Utilities/cmexpat/lib/xmltok.c
index 814fe92..4195279 100644
--- a/Utilities/cmexpat/lib/xmltok.c
+++ b/Utilities/cmexpat/lib/xmltok.c
@@ -46,7 +46,7 @@
#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16)
#define UCS2_GET_NAMING(pages, hi, lo) \
- (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))
+ (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1u << ((lo) & 0x1F)))
/* A 2 byte UTF-8 representation splits the characters 11 bits between
the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
@@ -56,7 +56,7 @@
(namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \
+ ((((byte)[0]) & 3) << 1) \
+ ((((byte)[1]) >> 5) & 1)] \
- & (1 << (((byte)[1]) & 0x1F)))
+ & (1u << (((byte)[1]) & 0x1F)))
/* A 3 byte UTF-8 representation splits the characters 16 bits between
the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
@@ -69,7 +69,7 @@
<< 3) \
+ ((((byte)[1]) & 3) << 1) \
+ ((((byte)[2]) >> 5) & 1)] \
- & (1 << (((byte)[2]) & 0x1F)))
+ & (1u << (((byte)[2]) & 0x1F)))
#define UTF8_GET_NAMING(pages, p, n) \
((n) == 2 \
@@ -122,19 +122,19 @@
((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0)))
static int PTRFASTCALL
-isNever(const ENCODING *enc, const char *p)
+isNever(const ENCODING *UNUSED_P(enc), const char *UNUSED_P(p))
{
return 0;
}
static int PTRFASTCALL
-utf8_isName2(const ENCODING *enc, const char *p)
+utf8_isName2(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_GET_NAMING2(namePages, (const unsigned char *)p);
}
static int PTRFASTCALL
-utf8_isName3(const ENCODING *enc, const char *p)
+utf8_isName3(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_GET_NAMING3(namePages, (const unsigned char *)p);
}
@@ -142,13 +142,13 @@ utf8_isName3(const ENCODING *enc, const char *p)
#define utf8_isName4 isNever
static int PTRFASTCALL
-utf8_isNmstrt2(const ENCODING *enc, const char *p)
+utf8_isNmstrt2(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p);
}
static int PTRFASTCALL
-utf8_isNmstrt3(const ENCODING *enc, const char *p)
+utf8_isNmstrt3(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p);
}
@@ -156,19 +156,19 @@ utf8_isNmstrt3(const ENCODING *enc, const char *p)
#define utf8_isNmstrt4 isNever
static int PTRFASTCALL
-utf8_isInvalid2(const ENCODING *enc, const char *p)
+utf8_isInvalid2(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_INVALID2((const unsigned char *)p);
}
static int PTRFASTCALL
-utf8_isInvalid3(const ENCODING *enc, const char *p)
+utf8_isInvalid3(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_INVALID3((const unsigned char *)p);
}
static int PTRFASTCALL
-utf8_isInvalid4(const ENCODING *enc, const char *p)
+utf8_isInvalid4(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_INVALID4((const unsigned char *)p);
}
@@ -329,39 +329,89 @@ enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */
UTF8_cval4 = 0xf0
};
-static void PTRCALL
-utf8_toUtf8(const ENCODING *enc,
+void
+align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef)
+{
+ const char * fromLim = *fromLimRef;
+ size_t walked = 0;
+ for (; fromLim > from; fromLim--, walked++) {
+ const unsigned char prev = (unsigned char)fromLim[-1];
+ if ((prev & 0xf8u) == 0xf0u) { /* 4-byte character, lead by 0b11110xxx byte */
+ if (walked + 1 >= 4) {
+ fromLim += 4 - 1;
+ break;
+ } else {
+ walked = 0;
+ }
+ } else if ((prev & 0xf0u) == 0xe0u) { /* 3-byte character, lead by 0b1110xxxx byte */
+ if (walked + 1 >= 3) {
+ fromLim += 3 - 1;
+ break;
+ } else {
+ walked = 0;
+ }
+ } else if ((prev & 0xe0u) == 0xc0u) { /* 2-byte character, lead by 0b110xxxxx byte */
+ if (walked + 1 >= 2) {
+ fromLim += 2 - 1;
+ break;
+ } else {
+ walked = 0;
+ }
+ } else if ((prev & 0x80u) == 0x00u) { /* 1-byte character, matching 0b0xxxxxxx */
+ break;
+ }
+ }
+ *fromLimRef = fromLim;
+}
+
+static enum XML_Convert_Result PTRCALL
+utf8_toUtf8(const ENCODING *UNUSED_P(enc),
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
{
+ enum XML_Convert_Result res = XML_CONVERT_COMPLETED;
char *to;
const char *from;
if (fromLim - *fromP > toLim - *toP) {
/* Avoid copying partial characters. */
- for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--)
- if (((unsigned char)fromLim[-1] & 0xc0) != 0x80)
- break;
+ res = XML_CONVERT_OUTPUT_EXHAUSTED;
+ fromLim = *fromP + (toLim - *toP);
+ align_limit_to_full_utf8_characters(*fromP, &fromLim);
}
- for (to = *toP, from = *fromP; from != fromLim; from++, to++)
+ for (to = *toP, from = *fromP; (from < fromLim) && (to < toLim); from++, to++)
*to = *from;
*fromP = from;
*toP = to;
+
+ if ((to == toLim) && (from < fromLim))
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
+ else
+ return res;
}
-static void PTRCALL
+static enum XML_Convert_Result PTRCALL
utf8_toUtf16(const ENCODING *enc,
const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim)
{
+ enum XML_Convert_Result res = XML_CONVERT_COMPLETED;
unsigned short *to = *toP;
const char *from = *fromP;
- while (from != fromLim && to != toLim) {
+ while (from < fromLim && to < toLim) {
switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) {
case BT_LEAD2:
+ if (fromLim - from < 2) {
+ res = XML_CONVERT_INPUT_INCOMPLETE;
+ break;
+ }
*to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f));
from += 2;
break;
case BT_LEAD3:
+ if (fromLim - from < 3) {
+ res = XML_CONVERT_INPUT_INCOMPLETE;
+ break;
+ }
*to++ = (unsigned short)(((from[0] & 0xf) << 12)
| ((from[1] & 0x3f) << 6) | (from[2] & 0x3f));
from += 3;
@@ -369,8 +419,14 @@ utf8_toUtf16(const ENCODING *enc,
case BT_LEAD4:
{
unsigned long n;
- if (to + 1 == toLim)
+ if (toLim - to < 2) {
+ res = XML_CONVERT_OUTPUT_EXHAUSTED;
goto after;
+ }
+ if (fromLim - from < 4) {
+ res = XML_CONVERT_INPUT_INCOMPLETE;
+ goto after;
+ }
n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12)
| ((from[2] & 0x3f) << 6) | (from[3] & 0x3f);
n -= 0x10000;
@@ -388,6 +444,7 @@ utf8_toUtf16(const ENCODING *enc,
after:
*fromP = from;
*toP = to;
+ return res;
}
#ifdef XML_NS
@@ -436,38 +493,43 @@ static const struct normal_encoding internal_utf8_encoding = {
STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
};
-static void PTRCALL
-latin1_toUtf8(const ENCODING *enc,
+static enum XML_Convert_Result PTRCALL
+latin1_toUtf8(const ENCODING *UNUSED_P(enc),
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
{
for (;;) {
unsigned char c;
if (*fromP == fromLim)
- break;
+ return XML_CONVERT_COMPLETED;
c = (unsigned char)**fromP;
if (c & 0x80) {
if (toLim - *toP < 2)
- break;
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
*(*toP)++ = (char)((c >> 6) | UTF8_cval2);
*(*toP)++ = (char)((c & 0x3f) | 0x80);
(*fromP)++;
}
else {
if (*toP == toLim)
- break;
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
*(*toP)++ = *(*fromP)++;
}
}
}
-static void PTRCALL
-latin1_toUtf16(const ENCODING *enc,
+static enum XML_Convert_Result PTRCALL
+latin1_toUtf16(const ENCODING *UNUSED_P(enc),
const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim)
{
- while (*fromP != fromLim && *toP != toLim)
+ while (*fromP < fromLim && *toP < toLim)
*(*toP)++ = (unsigned char)*(*fromP)++;
+
+ if ((*toP == toLim) && (*fromP < fromLim))
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
+ else
+ return XML_CONVERT_COMPLETED;
}
#ifdef XML_NS
@@ -494,13 +556,18 @@ static const struct normal_encoding latin1_encoding = {
STANDARD_VTABLE(sb_) NULL_VTABLE
};
-static void PTRCALL
-ascii_toUtf8(const ENCODING *enc,
+static enum XML_Convert_Result PTRCALL
+ascii_toUtf8(const ENCODING *UNUSED_P(enc),
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
{
- while (*fromP != fromLim && *toP != toLim)
+ while (*fromP < fromLim && *toP < toLim)
*(*toP)++ = *(*fromP)++;
+
+ if ((*toP == toLim) && (*fromP < fromLim))
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
+ else
+ return XML_CONVERT_COMPLETED;
}
#ifdef XML_NS
@@ -547,13 +614,14 @@ unicode_byte_type(char hi, char lo)
}
#define DEFINE_UTF16_TO_UTF8(E) \
-static void PTRCALL \
-E ## toUtf8(const ENCODING *enc, \
+static enum XML_Convert_Result PTRCALL \
+E ## toUtf8(const ENCODING *UNUSED_P(enc), \
const char **fromP, const char *fromLim, \
char **toP, const char *toLim) \
{ \
- const char *from; \
- for (from = *fromP; from != fromLim; from += 2) { \
+ const char *from = *fromP; \
+ fromLim = from + (((fromLim - from) >> 1) << 1); /* shrink to even */ \
+ for (; from < fromLim; from += 2) { \
int plane; \
unsigned char lo2; \
unsigned char lo = GET_LO(from); \
@@ -563,7 +631,7 @@ E ## toUtf8(const ENCODING *enc, \
if (lo < 0x80) { \
if (*toP == toLim) { \
*fromP = from; \
- return; \
+ return XML_CONVERT_OUTPUT_EXHAUSTED; \
} \
*(*toP)++ = lo; \
break; \
@@ -573,7 +641,7 @@ E ## toUtf8(const ENCODING *enc, \
case 0x4: case 0x5: case 0x6: case 0x7: \
if (toLim - *toP < 2) { \
*fromP = from; \
- return; \
+ return XML_CONVERT_OUTPUT_EXHAUSTED; \
} \
*(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \
*(*toP)++ = ((lo & 0x3f) | 0x80); \
@@ -581,7 +649,7 @@ E ## toUtf8(const ENCODING *enc, \
default: \
if (toLim - *toP < 3) { \
*fromP = from; \
- return; \
+ return XML_CONVERT_OUTPUT_EXHAUSTED; \
} \
/* 16 bits divided 4, 6, 6 amongst 3 bytes */ \
*(*toP)++ = ((hi >> 4) | UTF8_cval3); \
@@ -591,7 +659,11 @@ E ## toUtf8(const ENCODING *enc, \
case 0xD8: case 0xD9: case 0xDA: case 0xDB: \
if (toLim - *toP < 4) { \
*fromP = from; \
- return; \
+ return XML_CONVERT_OUTPUT_EXHAUSTED; \
+ } \
+ if (fromLim - from < 4) { \
+ *fromP = from; \
+ return XML_CONVERT_INPUT_INCOMPLETE; \
} \
plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \
*(*toP)++ = ((plane >> 2) | UTF8_cval4); \
@@ -607,20 +679,32 @@ E ## toUtf8(const ENCODING *enc, \
} \
} \
*fromP = from; \
+ if (from < fromLim) \
+ return XML_CONVERT_INPUT_INCOMPLETE; \
+ else \
+ return XML_CONVERT_COMPLETED; \
}
#define DEFINE_UTF16_TO_UTF16(E) \
-static void PTRCALL \
-E ## toUtf16(const ENCODING *enc, \
+static enum XML_Convert_Result PTRCALL \
+E ## toUtf16(const ENCODING *UNUSED_P(enc), \
const char **fromP, const char *fromLim, \
unsigned short **toP, const unsigned short *toLim) \
{ \
+ enum XML_Convert_Result res = XML_CONVERT_COMPLETED; \
+ fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */ \
/* Avoid copying first half only of surrogate */ \
if (fromLim - *fromP > ((toLim - *toP) << 1) \
- && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \
+ && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) { \
fromLim -= 2; \
- for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \
+ res = XML_CONVERT_INPUT_INCOMPLETE; \
+ } \
+ for (; *fromP < fromLim && *toP < toLim; *fromP += 2) \
*(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \
+ if ((*toP == toLim) && (*fromP < fromLim)) \
+ return XML_CONVERT_OUTPUT_EXHAUSTED; \
+ else \
+ return res; \
}
#define SET2(ptr, ch) \
@@ -949,7 +1033,7 @@ streqci(const char *s1, const char *s2)
}
static void PTRCALL
-initUpdatePosition(const ENCODING *enc, const char *ptr,
+initUpdatePosition(const ENCODING *UNUSED_P(enc), const char *ptr,
const char *end, POSITION *pos)
{
normal_updatePosition(&utf8_encoding.enc, ptr, end, pos);
@@ -1299,7 +1383,7 @@ unknown_isInvalid(const ENCODING *enc, const char *p)
return (c & ~0xFFFF) || checkCharRefNumber(c) < 0;
}
-static void PTRCALL
+static enum XML_Convert_Result PTRCALL
unknown_toUtf8(const ENCODING *enc,
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
@@ -1310,21 +1394,21 @@ unknown_toUtf8(const ENCODING *enc,
const char *utf8;
int n;
if (*fromP == fromLim)
- break;
+ return XML_CONVERT_COMPLETED;
utf8 = uenc->utf8[(unsigned char)**fromP];
n = *utf8++;
if (n == 0) {
int c = uenc->convert(uenc->userData, *fromP);
n = XmlUtf8Encode(c, buf);
if (n > toLim - *toP)
- break;
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
utf8 = buf;
*fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]
- (BT_LEAD2 - 2));
}
else {
if (n > toLim - *toP)
- break;
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
(*fromP)++;
}
do {
@@ -1333,13 +1417,13 @@ unknown_toUtf8(const ENCODING *enc,
}
}
-static void PTRCALL
+static enum XML_Convert_Result PTRCALL
unknown_toUtf16(const ENCODING *enc,
const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim)
{
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
- while (*fromP != fromLim && *toP != toLim) {
+ while (*fromP < fromLim && *toP < toLim) {
unsigned short c = uenc->utf16[(unsigned char)**fromP];
if (c == 0) {
c = (unsigned short)
@@ -1351,6 +1435,11 @@ unknown_toUtf16(const ENCODING *enc,
(*fromP)++;
*(*toP)++ = c;
}
+
+ if ((*toP == toLim) && (*fromP < fromLim))
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
+ else
+ return XML_CONVERT_COMPLETED;
}
ENCODING *
@@ -1514,7 +1603,7 @@ initScan(const ENCODING * const *encodingTable,
{
const ENCODING **encPtr;
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
encPtr = enc->encPtr;
if (ptr + 1 == end) {
diff --git a/Utilities/cmexpat/lib/xmltok.h b/Utilities/cmexpat/lib/xmltok.h
index ca867aa..752007e 100644
--- a/Utilities/cmexpat/lib/xmltok.h
+++ b/Utilities/cmexpat/lib/xmltok.h
@@ -130,6 +130,12 @@ typedef int (PTRCALL *SCANNER)(const ENCODING *,
const char *,
const char **);
+enum XML_Convert_Result {
+ XML_CONVERT_COMPLETED = 0,
+ XML_CONVERT_INPUT_INCOMPLETE = 1,
+ XML_CONVERT_OUTPUT_EXHAUSTED = 2 /* and therefore potentially input remaining as well */
+};
+
struct encoding {
SCANNER scanners[XML_N_STATES];
SCANNER literalScanners[XML_N_LITERAL_TYPES];
@@ -158,12 +164,12 @@ struct encoding {
const char *ptr,
const char *end,
const char **badPtr);
- void (PTRCALL *utf8Convert)(const ENCODING *enc,
+ enum XML_Convert_Result (PTRCALL *utf8Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
char **toP,
const char *toLim);
- void (PTRCALL *utf16Convert)(const ENCODING *enc,
+ enum XML_Convert_Result (PTRCALL *utf16Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
unsigned short **toP,
diff --git a/Utilities/cmexpat/lib/xmltok_impl.c b/Utilities/cmexpat/lib/xmltok_impl.c
index 9c2895b..fd0ee22 100644
--- a/Utilities/cmexpat/lib/xmltok_impl.c
+++ b/Utilities/cmexpat/lib/xmltok_impl.c
@@ -87,27 +87,45 @@
#define PREFIX(ident) ident
#endif
+
+#define HAS_CHARS(enc, ptr, end, count) \
+ (end - ptr >= count * MINBPC(enc))
+
+#define HAS_CHAR(enc, ptr, end) \
+ HAS_CHARS(enc, ptr, end, 1)
+
+#define REQUIRE_CHARS(enc, ptr, end, count) \
+ { \
+ if (! HAS_CHARS(enc, ptr, end, count)) { \
+ return XML_TOK_PARTIAL; \
+ } \
+ }
+
+#define REQUIRE_CHAR(enc, ptr, end) \
+ REQUIRE_CHARS(enc, ptr, end, 1)
+
+
/* ptr points to character following "<!-" */
static int PTRCALL
PREFIX(scanComment)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr != end) {
+ if (HAS_CHAR(enc, ptr, end)) {
if (!CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
ptr += MINBPC(enc);
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
INVALID_CASES(ptr, nextTokPtr)
case BT_MINUS:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
*nextTokPtr = ptr;
return XML_TOK_INVALID;
@@ -131,8 +149,7 @@ static int PTRCALL
PREFIX(scanDecl)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
case BT_MINUS:
return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);
@@ -147,11 +164,10 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_PERCNT:
- if (ptr + MINBPC(enc) == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHARS(enc, ptr, end, 2);
/* don't allow <!ENTITY% foo "whatever"> */
switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) {
case BT_S: case BT_CR: case BT_LF: case BT_PERCNT:
@@ -175,7 +191,7 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr,
}
static int PTRCALL
-PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr,
+PREFIX(checkPiTarget)(const ENCODING *UNUSED_P(enc), const char *ptr,
const char *end, int *tokPtr)
{
int upper = 0;
@@ -225,15 +241,14 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
{
int tok;
const char *target = ptr;
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
default:
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_S: case BT_CR: case BT_LF:
@@ -242,13 +257,12 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
return XML_TOK_INVALID;
}
ptr += MINBPC(enc);
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
INVALID_CASES(ptr, nextTokPtr)
case BT_QUEST:
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
*nextTokPtr = ptr + MINBPC(enc);
return tok;
@@ -266,8 +280,7 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
return XML_TOK_INVALID;
}
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
*nextTokPtr = ptr + MINBPC(enc);
return tok;
@@ -282,15 +295,14 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
}
static int PTRCALL
-PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr,
+PREFIX(scanCdataSection)(const ENCODING *UNUSED_P(enc), const char *ptr,
const char *end, const char **nextTokPtr)
{
static const char CDATA_LSQB[] = { ASCII_C, ASCII_D, ASCII_A,
ASCII_T, ASCII_A, ASCII_LSQB };
int i;
/* CDATA[ */
- if (end - ptr < 6 * MINBPC(enc))
- return XML_TOK_PARTIAL;
+ REQUIRE_CHARS(enc, ptr, end, 6);
for (i = 0; i < 6; i++, ptr += MINBPC(enc)) {
if (!CHAR_MATCHES(enc, ptr, CDATA_LSQB[i])) {
*nextTokPtr = ptr;
@@ -305,7 +317,7 @@ static int PTRCALL
PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
if (MINBPC(enc) > 1) {
size_t n = end - ptr;
@@ -319,13 +331,11 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
switch (BYTE_TYPE(enc, ptr)) {
case BT_RSQB:
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))
break;
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
ptr -= MINBPC(enc);
break;
@@ -334,8 +344,7 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
return XML_TOK_CDATA_SECT_CLOSE;
case BT_CR:
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
*nextTokPtr = ptr;
@@ -348,7 +357,7 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
ptr += MINBPC(enc);
break;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
#define LEAD_CASE(n) \
case BT_LEAD ## n: \
@@ -383,19 +392,18 @@ static int PTRCALL
PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
default:
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_S: case BT_CR: case BT_LF:
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
+ for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_S: case BT_CR: case BT_LF:
break;
@@ -432,7 +440,7 @@ static int PTRCALL
PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr != end) {
+ if (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_DIGIT:
case BT_HEX:
@@ -441,7 +449,7 @@ PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
+ for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_DIGIT:
case BT_HEX:
@@ -464,7 +472,7 @@ static int PTRCALL
PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr != end) {
+ if (HAS_CHAR(enc, ptr, end)) {
if (CHAR_MATCHES(enc, ptr, ASCII_x))
return PREFIX(scanHexCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
switch (BYTE_TYPE(enc, ptr)) {
@@ -474,7 +482,7 @@ PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
+ for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_DIGIT:
break;
@@ -496,8 +504,7 @@ static int PTRCALL
PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
case BT_NUM:
@@ -506,7 +513,7 @@ PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_SEMI:
@@ -529,7 +536,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
#ifdef XML_NS
int hadColon = 0;
#endif
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
#ifdef XML_NS
@@ -540,8 +547,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
}
hadColon = 1;
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
default:
@@ -555,8 +561,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
int t;
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
t = BYTE_TYPE(enc, ptr);
if (t == BT_EQUALS)
break;
@@ -579,8 +584,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
#endif
for (;;) {
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
open = BYTE_TYPE(enc, ptr);
if (open == BT_QUOT || open == BT_APOS)
break;
@@ -598,8 +602,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
/* in attribute value */
for (;;) {
int t;
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
t = BYTE_TYPE(enc, ptr);
if (t == open)
break;
@@ -624,8 +627,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
}
}
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
case BT_S:
case BT_CR:
@@ -642,8 +644,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
/* ptr points to closing quote */
for (;;) {
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
case BT_S: case BT_CR: case BT_LF:
@@ -655,8 +656,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
case BT_SOL:
sol:
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
*nextTokPtr = ptr;
return XML_TOK_INVALID;
@@ -688,13 +688,12 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
#ifdef XML_NS
int hadColon;
#endif
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
case BT_EXCL:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
case BT_MINUS:
return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);
@@ -716,7 +715,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
hadColon = 0;
#endif
/* we have a start-tag */
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
#ifdef XML_NS
@@ -727,8 +726,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
}
hadColon = 1;
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
default:
@@ -740,7 +738,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
case BT_S: case BT_CR: case BT_LF:
{
ptr += MINBPC(enc);
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
case BT_GT:
@@ -765,8 +763,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
case BT_SOL:
sol:
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
*nextTokPtr = ptr;
return XML_TOK_INVALID;
@@ -785,7 +782,7 @@ static int PTRCALL
PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
if (MINBPC(enc) > 1) {
size_t n = end - ptr;
@@ -803,7 +800,7 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
case BT_CR:
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return XML_TOK_TRAILING_CR;
if (BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
@@ -814,12 +811,12 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
return XML_TOK_DATA_NEWLINE;
case BT_RSQB:
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return XML_TOK_TRAILING_RSQB;
if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))
break;
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return XML_TOK_TRAILING_RSQB;
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
ptr -= MINBPC(enc);
@@ -832,7 +829,7 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
ptr += MINBPC(enc);
break;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
#define LEAD_CASE(n) \
case BT_LEAD ## n: \
@@ -845,12 +842,12 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
#undef LEAD_CASE
case BT_RSQB:
- if (ptr + MINBPC(enc) != end) {
+ if (HAS_CHARS(enc, ptr, end, 2)) {
if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) {
ptr += MINBPC(enc);
break;
}
- if (ptr + 2*MINBPC(enc) != end) {
+ if (HAS_CHARS(enc, ptr, end, 3)) {
if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) {
ptr += MINBPC(enc);
break;
@@ -884,8 +881,7 @@ static int PTRCALL
PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
case BT_S: case BT_LF: case BT_CR: case BT_PERCNT:
@@ -895,7 +891,7 @@ PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_SEMI:
@@ -913,15 +909,14 @@ static int PTRCALL
PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
default:
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_CR: case BT_LF: case BT_S:
@@ -941,7 +936,7 @@ PREFIX(scanLit)(int open, const ENCODING *enc,
const char *ptr, const char *end,
const char **nextTokPtr)
{
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
int t = BYTE_TYPE(enc, ptr);
switch (t) {
INVALID_CASES(ptr, nextTokPtr)
@@ -950,7 +945,7 @@ PREFIX(scanLit)(int open, const ENCODING *enc,
ptr += MINBPC(enc);
if (t != open)
break;
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return -XML_TOK_LITERAL;
*nextTokPtr = ptr;
switch (BYTE_TYPE(enc, ptr)) {
@@ -973,7 +968,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
int tok;
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
if (MINBPC(enc) > 1) {
size_t n = end - ptr;
@@ -992,8 +987,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
case BT_LT:
{
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
case BT_EXCL:
return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr);
@@ -1021,7 +1015,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
case BT_S: case BT_LF:
for (;;) {
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
break;
switch (BYTE_TYPE(enc, ptr)) {
case BT_S: case BT_LF:
@@ -1048,11 +1042,10 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
return XML_TOK_OPEN_BRACKET;
case BT_RSQB:
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return -XML_TOK_CLOSE_BRACKET;
if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {
- if (ptr + MINBPC(enc) == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHARS(enc, ptr, end, 2);
if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) {
*nextTokPtr = ptr + 2*MINBPC(enc);
return XML_TOK_COND_SECT_CLOSE;
@@ -1065,7 +1058,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
return XML_TOK_OPEN_PAREN;
case BT_RPAR:
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return -XML_TOK_CLOSE_PAREN;
switch (BYTE_TYPE(enc, ptr)) {
case BT_AST:
@@ -1141,7 +1134,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_GT: case BT_RPAR: case BT_COMMA:
@@ -1154,8 +1147,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
ptr += MINBPC(enc);
switch (tok) {
case XML_TOK_NAME:
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
tok = XML_TOK_PREFIXED_NAME;
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
@@ -1204,10 +1196,10 @@ PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
const char *start;
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
start = ptr;
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
#define LEAD_CASE(n) \
case BT_LEAD ## n: ptr += n; break;
@@ -1232,7 +1224,7 @@ PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr,
case BT_CR:
if (ptr == start) {
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return XML_TOK_TRAILING_CR;
if (BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
@@ -1262,10 +1254,10 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
const char *start;
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
start = ptr;
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
#define LEAD_CASE(n) \
case BT_LEAD ## n: ptr += n; break;
@@ -1294,7 +1286,7 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr,
case BT_CR:
if (ptr == start) {
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return XML_TOK_TRAILING_CR;
if (BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
@@ -1326,15 +1318,15 @@ PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr,
end = ptr + n;
}
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
INVALID_CASES(ptr, nextTokPtr)
case BT_LT:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) {
++level;
ptr += MINBPC(enc);
@@ -1342,11 +1334,11 @@ PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr,
}
break;
case BT_RSQB:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
ptr += MINBPC(enc);
if (level == 0) {
@@ -1373,7 +1365,7 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
{
ptr += MINBPC(enc);
end -= MINBPC(enc);
- for (; ptr != end; ptr += MINBPC(enc)) {
+ for (; HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_DIGIT:
case BT_HEX:
@@ -1521,7 +1513,7 @@ PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
}
static int PTRFASTCALL
-PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
+PREFIX(charRefNumber)(const ENCODING *UNUSED_P(enc), const char *ptr)
{
int result = 0;
/* skip &# */
@@ -1565,7 +1557,7 @@ PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
}
static int PTRCALL
-PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr,
+PREFIX(predefinedEntityName)(const ENCODING *UNUSED_P(enc), const char *ptr,
const char *end)
{
switch ((end - ptr)/MINBPC(enc)) {
@@ -1683,11 +1675,11 @@ PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
}
static int PTRCALL
-PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
+PREFIX(nameMatchesAscii)(const ENCODING *UNUSED_P(enc), const char *ptr1,
const char *end1, const char *ptr2)
{
for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) {
- if (ptr1 == end1)
+ if (end1 - ptr1 < MINBPC(enc))
return 0;
if (!CHAR_MATCHES(enc, ptr1, *ptr2))
return 0;
@@ -1744,7 +1736,7 @@ PREFIX(updatePosition)(const ENCODING *enc,
const char *end,
POSITION *pos)
{
- while (ptr < end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
#define LEAD_CASE(n) \
case BT_LEAD ## n: \
@@ -1760,7 +1752,7 @@ PREFIX(updatePosition)(const ENCODING *enc,
case BT_CR:
pos->lineNumber++;
ptr += MINBPC(enc);
- if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF)
+ if (HAS_CHAR(enc, ptr, end) && BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
pos->columnNumber = (XML_Size)-1;
break;
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
index 453a737..09bef51 100644
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -509,6 +509,7 @@ IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
FIND_PACKAGE(OpenSSL)
IF(OPENSSL_FOUND)
SET(HAVE_LIBCRYPTO 1)
+ INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
ENDIF(OPENSSL_FOUND)
ELSE()
SET(OPENSSL_FOUND FALSE) # Override cached value
diff --git a/Utilities/cmlibarchive/build/version b/Utilities/cmlibarchive/build/version
index 595378f..f293156 100644
--- a/Utilities/cmlibarchive/build/version
+++ b/Utilities/cmlibarchive/build/version
@@ -1 +1 @@
-3002000
+3002001
diff --git a/Utilities/cmlibarchive/libarchive/archive.h b/Utilities/cmlibarchive/libarchive/archive.h
index a8aa704..3b5104b 100644
--- a/Utilities/cmlibarchive/libarchive/archive.h
+++ b/Utilities/cmlibarchive/libarchive/archive.h
@@ -36,7 +36,7 @@
* assert that ARCHIVE_VERSION_NUMBER >= 2012108.
*/
/* Note: Compiler will complain if this does not match archive_entry.h! */
-#define ARCHIVE_VERSION_NUMBER 3002000
+#define ARCHIVE_VERSION_NUMBER 3002001
#include <sys/stat.h>
#include <stddef.h> /* for wchar_t */
@@ -152,7 +152,7 @@ __LA_DECL int archive_version_number(void);
/*
* Textual name/version of the library, useful for version displays.
*/
-#define ARCHIVE_VERSION_ONLY_STRING "3.2.0"
+#define ARCHIVE_VERSION_ONLY_STRING "3.2.1"
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
__LA_DECL const char * archive_version_string(void);
diff --git a/Utilities/cmlibarchive/libarchive/archive_entry.h b/Utilities/cmlibarchive/libarchive/archive_entry.h
index 2bc2928..81cd425 100644
--- a/Utilities/cmlibarchive/libarchive/archive_entry.h
+++ b/Utilities/cmlibarchive/libarchive/archive_entry.h
@@ -29,7 +29,7 @@
#define ARCHIVE_ENTRY_H_INCLUDED
/* Note: Compiler will complain if this does not match archive.h! */
-#define ARCHIVE_VERSION_NUMBER 3002000
+#define ARCHIVE_VERSION_NUMBER 3002001
/*
* Note: archive_entry.h is for use outside of libarchive; the
diff --git a/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c b/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c
index 05eb90f..5fe726b 100644
--- a/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c
+++ b/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c
@@ -91,16 +91,11 @@ archive_entry_xattr_add_entry(struct archive_entry *entry,
{
struct ae_xattr *xp;
- for (xp = entry->xattr_head; xp != NULL; xp = xp->next)
- ;
-
if ((xp = (struct ae_xattr *)malloc(sizeof(struct ae_xattr))) == NULL)
- /* XXX Error XXX */
- return;
+ __archive_errx(1, "Out of memory");
if ((xp->name = strdup(name)) == NULL)
- /* XXX Error XXX */
- return;
+ __archive_errx(1, "Out of memory");
if ((xp->value = malloc(size)) != NULL) {
memcpy(xp->value, value, size);
diff --git a/Utilities/cmlibarchive/libarchive/archive_ppmd7.c b/Utilities/cmlibarchive/libarchive/archive_ppmd7.c
index fe0b031..1aed922 100644
--- a/Utilities/cmlibarchive/libarchive/archive_ppmd7.c
+++ b/Utilities/cmlibarchive/libarchive/archive_ppmd7.c
@@ -126,6 +126,11 @@ static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc)
{
if (p->Base == 0 || p->Size != size)
{
+ /* RestartModel() below assumes that p->Size >= UNIT_SIZE
+ (see the calculation of m->MinContext). */
+ if (size < UNIT_SIZE) {
+ return False;
+ }
Ppmd7_Free(p, alloc);
p->AlignOffset =
#ifdef PPMD_32BIT
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
index f045b8f..a33ea4f 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
@@ -2153,6 +2153,9 @@ read_SubStreamsInfo(struct archive_read *a, struct _7z_substream_info *ss,
return (-1);
if (UMAX_ENTRY < f[i].numUnpackStreams)
return (-1);
+ if (unpack_streams > SIZE_MAX - UMAX_ENTRY) {
+ return (-1);
+ }
unpack_streams += (size_t)f[i].numUnpackStreams;
}
if ((p = header_bytes(a, 1)) == NULL)
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c
index c2ca85b..b09db0e 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c
@@ -401,6 +401,11 @@ archive_read_format_cpio_read_header(struct archive_read *a,
/* If this is a symlink, read the link contents. */
if (archive_entry_filetype(entry) == AE_IFLNK) {
+ if (cpio->entry_bytes_remaining > 1024 * 1024) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Rejecting malformed cpio archive: symlink contents exceed 1 megabyte");
+ return (ARCHIVE_FATAL);
+ }
h = __archive_read_ahead(a,
(size_t)cpio->entry_bytes_remaining, NULL);
if (h == NULL)
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
index 3628025..c19614a 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
@@ -1091,7 +1091,7 @@ choose_volume(struct archive_read *a, struct iso9660 *iso9660)
/* This condition is unlikely; by way of caution. */
vd = &(iso9660->joliet);
- skipsize = LOGICAL_BLOCK_SIZE * vd->location;
+ skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location;
skipsize = __archive_read_consume(a, skipsize);
if (skipsize < 0)
return ((int)skipsize);
@@ -1129,7 +1129,7 @@ choose_volume(struct archive_read *a, struct iso9660 *iso9660)
&& iso9660->seenJoliet) {
/* Switch reading data from primary to joliet. */
vd = &(iso9660->joliet);
- skipsize = LOGICAL_BLOCK_SIZE * vd->location;
+ skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location;
skipsize -= iso9660->current_position;
skipsize = __archive_read_consume(a, skipsize);
if (skipsize < 0)
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c
index 81d9652..8c3be9a 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c
@@ -1342,7 +1342,7 @@ parse_line(struct archive_read *a, struct archive_entry *entry,
/* strsep() is not in C90, but strcspn() is. */
/* Taken from http://unixpapa.com/incnote/string.html */
static char *
-la_strsep(char **sp, char *sep)
+la_strsep(char **sp, const char *sep)
{
char *p, *s;
if (sp == NULL || *sp == NULL || **sp == '\0')
@@ -1385,12 +1385,12 @@ parse_device(dev_t *pdev, struct archive *a, char *val)
"Missing number");
return ARCHIVE_WARN;
}
- numbers[argc++] = (unsigned long)mtree_atol(&p);
- if (argc > MAX_PACK_ARGS) {
+ if (argc >= MAX_PACK_ARGS) {
archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
"Too many arguments");
return ARCHIVE_WARN;
}
+ numbers[argc++] = (unsigned long)mtree_atol(&p);
}
if (argc < 2) {
archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
index c52c429..fc8153f 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
@@ -2127,6 +2127,12 @@ parse_codes(struct archive_read *a)
rar->range_dec.Stream = &rar->bytein;
__archive_ppmd7_functions.Ppmd7_Construct(&rar->ppmd7_context);
+ if (rar->dictionary_size == 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Invalid zero dictionary size");
+ return (ARCHIVE_FATAL);
+ }
+
if (!__archive_ppmd7_functions.Ppmd7_Alloc(&rar->ppmd7_context,
rar->dictionary_size, &g_szalloc))
{
@@ -2884,11 +2890,10 @@ copy_from_lzss_window(struct archive_read *a, const void **buffer,
}
windowoffs = lzss_offset_for_position(&rar->lzss, startpos);
- if(windowoffs + length <= lzss_size(&rar->lzss))
+ if(windowoffs + length <= lzss_size(&rar->lzss)) {
memcpy(&rar->unp_buffer[rar->unp_offset], &rar->lzss.window[windowoffs],
length);
- else
- {
+ } else if (length <= lzss_size(&rar->lzss)) {
firstpart = lzss_size(&rar->lzss) - windowoffs;
if (firstpart < 0) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
@@ -2900,9 +2905,14 @@ copy_from_lzss_window(struct archive_read *a, const void **buffer,
&rar->lzss.window[windowoffs], firstpart);
memcpy(&rar->unp_buffer[rar->unp_offset + firstpart],
&rar->lzss.window[0], length - firstpart);
- } else
+ } else {
memcpy(&rar->unp_buffer[rar->unp_offset],
&rar->lzss.window[windowoffs], length);
+ }
+ } else {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Bad RAR file data");
+ return (ARCHIVE_FATAL);
}
rar->unp_offset += length;
if (rar->unp_offset >= rar->unp_buffer_size)
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c
index 01d85cf..b0521a6 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c
@@ -202,7 +202,7 @@ static int archive_read_format_tar_read_header(struct archive_read *,
struct archive_entry *);
static int checksum(struct archive_read *, const void *);
static int pax_attribute(struct archive_read *, struct tar *,
- struct archive_entry *, char *key, char *value);
+ struct archive_entry *, const char *key, const char *value);
static int pax_header(struct archive_read *, struct tar *,
struct archive_entry *, char *attr);
static void pax_time(const char *, int64_t *sec, long *nanos);
@@ -1664,7 +1664,7 @@ pax_header(struct archive_read *a, struct tar *tar,
static int
pax_attribute_xattr(struct archive_entry *entry,
- char *name, char *value)
+ const char *name, const char *value)
{
char *name_decoded;
void *value_decoded;
@@ -1710,7 +1710,7 @@ pax_attribute_xattr(struct archive_entry *entry,
*/
static int
pax_attribute(struct archive_read *a, struct tar *tar,
- struct archive_entry *entry, char *key, char *value)
+ struct archive_entry *entry, const char *key, const char *value)
{
int64_t s;
long n;
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
index 1399e07..c50ba84 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
@@ -181,6 +181,14 @@ struct zip {
char init_decryption;
/* Decryption buffer. */
+ /*
+ * The decrypted data starts at decrypted_ptr and
+ * extends for decrypted_bytes_remaining. Decryption
+ * adds new data to the end of this block, data is returned
+ * to clients from the beginning. When the block hits the
+ * end of decrypted_buffer, it has to be shuffled back to
+ * the beginning of the buffer.
+ */
unsigned char *decrypted_buffer;
unsigned char *decrypted_ptr;
size_t decrypted_buffer_size;
@@ -1293,8 +1301,9 @@ zip_read_data_deflate(struct archive_read *a, const void **buff,
if (zip->tctx_valid || zip->cctx_valid) {
if (zip->decrypted_bytes_remaining < (size_t)bytes_avail) {
- size_t buff_remaining = zip->decrypted_buffer_size
- - (zip->decrypted_ptr - zip->decrypted_buffer);
+ size_t buff_remaining =
+ (zip->decrypted_buffer + zip->decrypted_buffer_size)
+ - (zip->decrypted_ptr + zip->decrypted_bytes_remaining);
if (buff_remaining > (size_t)bytes_avail)
buff_remaining = (size_t)bytes_avail;
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c b/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
index 800aa89..da76c54 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
@@ -468,9 +468,17 @@ permissive_name_w(struct archive_write_disk *a)
return (-1);
archive_wstring_ensure(&(a->_name_data), 4 + l + 1 + wcslen(wn) + 1);
a->name = a->_name_data.s;
- /* Prepend "\\?\" and drive name. */
- archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4);
- archive_wstrncat(&(a->_name_data), wsp, l);
+ /* Prepend "\\?\" and drive name if not already added. */
+ if (l > 3 && wsp[0] == L'\\' && wsp[1] == L'\\' &&
+ wsp[2] == L'?' && wsp[3] == L'\\')
+ {
+ archive_wstrncpy(&(a->_name_data), wsp, l);
+ }
+ else
+ {
+ archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4);
+ archive_wstrncat(&(a->_name_data), wsp, l);
+ }
archive_wstrncat(&(a->_name_data), L"\\", 1);
archive_wstrcat(&(a->_name_data), wn);
a->name = a->_name_data.s;
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_filter.3 b/Utilities/cmlibarchive/libarchive/archive_write_filter.3
index 869dc46..e1d1891 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_filter.3
+++ b/Utilities/cmlibarchive/libarchive/archive_write_filter.3
@@ -43,6 +43,7 @@
.Nm archive_write_add_filter_program ,
.Nm archive_write_add_filter_uuencode ,
.Nm archive_write_add_filter_xz
+.Nd functions enabling output filters
.Sh LIBRARY
Streaming Archive Library (libarchive, -larchive)
.Sh SYNOPSIS
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c
index 647079d..1d635d2 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c
@@ -467,7 +467,7 @@ archive_write_gnutar_header(struct archive_write *a,
}
}
if (gnutar->linkname_length > GNUTAR_linkname_size) {
- size_t todo = gnutar->linkname_length;
+ size_t length = gnutar->linkname_length + 1;
struct archive_entry *temp = archive_entry_new2(&a->archive);
/* Uname/gname here don't really matter since no one reads them;
@@ -476,7 +476,7 @@ archive_write_gnutar_header(struct archive_write *a,
archive_entry_set_gname(temp, "wheel");
archive_entry_set_pathname(temp, "././@LongLink");
- archive_entry_set_size(temp, gnutar->linkname_length + 1);
+ archive_entry_set_size(temp, length);
ret = archive_format_gnutar_header(a, buff, temp, 'K');
if (ret < ARCHIVE_WARN)
goto exit_write_header;
@@ -484,11 +484,12 @@ archive_write_gnutar_header(struct archive_write *a,
if(ret < ARCHIVE_WARN)
goto exit_write_header;
archive_entry_free(temp);
- /* Write as many 512 bytes blocks as needed to write full name. */
- ret = __archive_write_output(a, gnutar->linkname, todo);
+ /* Write name and trailing null byte. */
+ ret = __archive_write_output(a, gnutar->linkname, length);
if(ret < ARCHIVE_WARN)
goto exit_write_header;
- ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)todo));
+ /* Pad to 512 bytes */
+ ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)length));
if (ret < ARCHIVE_WARN)
goto exit_write_header;
}
@@ -496,7 +497,7 @@ archive_write_gnutar_header(struct archive_write *a,
/* If pathname is longer than 100 chars we need to add an 'L' header. */
if (gnutar->pathname_length > GNUTAR_name_size) {
const char *pathname = gnutar->pathname;
- size_t todo = gnutar->pathname_length;
+ size_t length = gnutar->pathname_length + 1;
struct archive_entry *temp = archive_entry_new2(&a->archive);
/* Uname/gname here don't really matter since no one reads them;
@@ -505,7 +506,7 @@ archive_write_gnutar_header(struct archive_write *a,
archive_entry_set_gname(temp, "wheel");
archive_entry_set_pathname(temp, "././@LongLink");
- archive_entry_set_size(temp, gnutar->pathname_length + 1);
+ archive_entry_set_size(temp, length);
ret = archive_format_gnutar_header(a, buff, temp, 'L');
if (ret < ARCHIVE_WARN)
goto exit_write_header;
@@ -513,11 +514,12 @@ archive_write_gnutar_header(struct archive_write *a,
if(ret < ARCHIVE_WARN)
goto exit_write_header;
archive_entry_free(temp);
- /* Write as many 512 bytes blocks as needed to write full name. */
- ret = __archive_write_output(a, pathname, todo);
+ /* Write pathname + trailing null byte. */
+ ret = __archive_write_output(a, pathname, length);
if(ret < ARCHIVE_WARN)
goto exit_write_header;
- ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)todo));
+ /* Pad to multiple of 512 bytes. */
+ ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)length));
if (ret < ARCHIVE_WARN)
goto exit_write_header;
}
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
index 576f4c2..879a776 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
@@ -6225,7 +6225,7 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
unsigned char *p;
size_t l;
int r;
- int ffmax, parent_len;
+ size_t ffmax, parent_len;
static const struct archive_rb_tree_ops rb_ops = {
isoent_cmp_node_joliet, isoent_cmp_key_joliet
};
@@ -6239,7 +6239,7 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
else
ffmax = 128;
- r = idr_start(a, idr, isoent->children.cnt, ffmax, 6, 2, &rb_ops);
+ r = idr_start(a, idr, isoent->children.cnt, (int)ffmax, 6, 2, &rb_ops);
if (r < 0)
return (r);
@@ -6252,7 +6252,7 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
int ext_off, noff, weight;
size_t lt;
- if ((int)(l = np->file->basename_utf16.length) > ffmax)
+ if ((l = np->file->basename_utf16.length) > ffmax)
l = ffmax;
p = malloc((l+1)*2);
@@ -6285,7 +6285,7 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
/*
* Get a length of MBS of a full-pathname.
*/
- if ((int)np->file->basename_utf16.length > ffmax) {
+ if (np->file->basename_utf16.length > ffmax) {
if (archive_strncpy_l(&iso9660->mbs,
(const char *)np->identifier, l,
iso9660->sconv_from_utf16be) != 0 &&
@@ -6302,7 +6302,9 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
/* If a length of full-pathname is longer than 240 bytes,
* it violates Joliet extensions regulation. */
- if (parent_len + np->mb_len > 240) {
+ if (parent_len > 240
+ || np->mb_len > 240
+ || parent_len + np->mb_len > 240) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"The regulation of Joliet extensions;"
" A length of a full-pathname of `%s' is "
@@ -6314,11 +6316,11 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
/* Make an offset of the number which is used to be set
* hexadecimal number to avoid duplicate identifier. */
- if ((int)l == ffmax)
+ if (l == ffmax)
noff = ext_off - 6;
- else if ((int)l == ffmax-2)
+ else if (l == ffmax-2)
noff = ext_off - 4;
- else if ((int)l == ffmax-4)
+ else if (l == ffmax-4)
noff = ext_off - 2;
else
noff = ext_off;
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_options.3 b/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
index ce7ed89..aeb7a18 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
@@ -32,7 +32,7 @@
.Nm archive_write_set_format_option ,
.Nm archive_write_set_option ,
.Nm archive_write_set_options
-.Nd functions controlling options for reading archives
+.Nd functions controlling options for writing archives
.Sh LIBRARY
Streaming Archive Library (libarchive, -larchive)
.Sh SYNOPSIS
diff --git a/Utilities/cmlibarchive/libarchive/libarchive-formats.5 b/Utilities/cmlibarchive/libarchive/libarchive-formats.5
index e619fe5..9cec760 100644
--- a/Utilities/cmlibarchive/libarchive/libarchive-formats.5
+++ b/Utilities/cmlibarchive/libarchive/libarchive-formats.5
@@ -65,7 +65,6 @@ Later variants have extended this by either appropriating undefined
areas of the header record, extending the header to multiple records,
or by storing special entries that modify the interpretation of
subsequent entries.
-.Pp
.Bl -tag -width indent
.It Cm gnutar
The
diff --git a/Utilities/cmlibarchive/libarchive/libarchive_changes.3 b/Utilities/cmlibarchive/libarchive/libarchive_changes.3
index bacd6e1..881a67c 100644
--- a/Utilities/cmlibarchive/libarchive/libarchive_changes.3
+++ b/Utilities/cmlibarchive/libarchive/libarchive_changes.3
@@ -28,7 +28,7 @@
.Dt LIBARCHIVE_CHANGES 3
.Os
.Sh NAME
-.Nm changes in libarchive interface
+.Nd changes in libarchive interface
.\"
.Sh CHANGES IN LIBARCHIVE 3
This page describes user-visible changes in libarchive3, and lists
diff --git a/Utilities/cmliblzma/liblzma/simple/x86.c b/Utilities/cmliblzma/liblzma/simple/x86.c
index 101d8ed..95858e5 100644
--- a/Utilities/cmliblzma/liblzma/simple/x86.c
+++ b/Utilities/cmliblzma/liblzma/simple/x86.c
@@ -103,7 +103,7 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder,
if (!Test86MSByte(b))
break;
- src = dest ^ ((1 << (32 - i * 8)) - 1);
+ src = dest ^ ((1u << (32 - i * 8)) - 1);
}
buffer[buffer_pos + 4]